haori 0.45.2 → 0.45.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 +1 -1
- package/dist/haori.cjs.js +15 -15
- package/dist/haori.es.js +930 -900
- package/dist/haori.iife.js +15 -15
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -118,8 +118,8 @@ const J = class J {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
J._prefix = "data-", J._runtime = Le, J._strictBind = !1;
|
|
121
|
-
let
|
|
122
|
-
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
121
|
+
let l = J;
|
|
122
|
+
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect());
|
|
123
123
|
class y {
|
|
124
124
|
/**
|
|
125
125
|
* 開発モードでのみコンソールに情報を出力します。
|
|
@@ -231,7 +231,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
231
231
|
static forEachTarget(e, t) {
|
|
232
232
|
if (!e || typeof e.querySelectorAll != "function")
|
|
233
233
|
return;
|
|
234
|
-
const r = `[${
|
|
234
|
+
const r = `[${l.prefix}enhance],[${l.prefix}enhance-new]`;
|
|
235
235
|
typeof e.matches == "function" && e.matches(r) && t(e), e.querySelectorAll(r).forEach((i) => {
|
|
236
236
|
t(i);
|
|
237
237
|
});
|
|
@@ -244,7 +244,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
244
244
|
*/
|
|
245
245
|
static applyElement(e) {
|
|
246
246
|
const t = $.instances.get(e) ?? null;
|
|
247
|
-
$.names(e, `${
|
|
247
|
+
$.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
248
248
|
if (t?.has(r))
|
|
249
249
|
return;
|
|
250
250
|
const i = $.enhancers.get(r);
|
|
@@ -256,7 +256,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
256
256
|
const n = i.init(e);
|
|
257
257
|
$.appliedKeys(e).set(r, n);
|
|
258
258
|
});
|
|
259
|
-
}), $.names(e, `${
|
|
259
|
+
}), $.names(e, `${l.prefix}enhance-new`).forEach((r) => {
|
|
260
260
|
const i = `${je}${r}`;
|
|
261
261
|
if ($.instances.get(e)?.has(i))
|
|
262
262
|
return;
|
|
@@ -275,7 +275,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
275
275
|
*/
|
|
276
276
|
static refreshElement(e) {
|
|
277
277
|
const t = $.instances.get(e);
|
|
278
|
-
$.names(e, `${
|
|
278
|
+
$.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
279
279
|
if (!t || !t.has(r))
|
|
280
280
|
return;
|
|
281
281
|
const i = $.enhancers.get(r);
|
|
@@ -342,7 +342,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
342
342
|
if (!yt.test(e))
|
|
343
343
|
return y.error(
|
|
344
344
|
"[Haori]",
|
|
345
|
-
`${
|
|
345
|
+
`${l.prefix}enhance-new accepts a dot-separated global reference only: ${e}`
|
|
346
346
|
), null;
|
|
347
347
|
let t = globalThis;
|
|
348
348
|
for (const r of e.split(".")) {
|
|
@@ -355,7 +355,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
355
355
|
}
|
|
356
356
|
return typeof t != "function" ? (j.isEnabled() && !$.warnedMissingGlobals.has(e) && ($.warnedMissingGlobals.add(e), y.warn(
|
|
357
357
|
"[Haori]",
|
|
358
|
-
`${
|
|
358
|
+
`${l.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
359
359
|
)), null) : t;
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
@@ -426,10 +426,10 @@ function _e(m, e) {
|
|
|
426
426
|
const r = {};
|
|
427
427
|
for (const u of t)
|
|
428
428
|
u.type !== "literal" && (r[u.type] = u.value);
|
|
429
|
-
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute),
|
|
430
|
-
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(
|
|
429
|
+
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), c = Number(r.second);
|
|
430
|
+
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : Qe(i, n, s, a, o, c);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Ce(m, e = Ze, t) {
|
|
433
433
|
if (m == null || m === "")
|
|
434
434
|
return "";
|
|
435
435
|
const r = m instanceof Date ? m : new Date(m);
|
|
@@ -456,22 +456,22 @@ function Me(m, e = Ze, t) {
|
|
|
456
456
|
}
|
|
457
457
|
const Et = "yyyy-MM-dd";
|
|
458
458
|
function et(m = Ze, e) {
|
|
459
|
-
return
|
|
459
|
+
return Ce(/* @__PURE__ */ new Date(), m, e);
|
|
460
460
|
}
|
|
461
461
|
function tt(m = 0, e = Et, t) {
|
|
462
462
|
const r = Number.isFinite(m) ? Math.trunc(m) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
463
463
|
let n, s, a;
|
|
464
464
|
if (i !== "") {
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
465
|
+
const c = _e(/* @__PURE__ */ new Date(), i);
|
|
466
|
+
if (c === null)
|
|
467
467
|
return "";
|
|
468
|
-
n = Number(
|
|
468
|
+
n = Number(c.yyyy), s = Number(c.MM), a = Number(c.dd);
|
|
469
469
|
} else {
|
|
470
|
-
const
|
|
471
|
-
n =
|
|
470
|
+
const c = /* @__PURE__ */ new Date();
|
|
471
|
+
n = c.getFullYear(), s = c.getMonth() + 1, a = c.getDate();
|
|
472
472
|
}
|
|
473
473
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
474
|
-
return
|
|
474
|
+
return Ce(o, e, "UTC");
|
|
475
475
|
}
|
|
476
476
|
function rt(m, e) {
|
|
477
477
|
if (m == null)
|
|
@@ -522,35 +522,35 @@ function nt(m, e, t = {}) {
|
|
|
522
522
|
a.add(d);
|
|
523
523
|
for (let d = Math.max(0, i - n); d <= Math.min(r - 1, i + n); d += 1)
|
|
524
524
|
a.add(d);
|
|
525
|
-
const o = Array.from(a).sort((d,
|
|
525
|
+
const o = Array.from(a).sort((d, g) => d - g), c = [];
|
|
526
526
|
let u = null;
|
|
527
527
|
for (const d of o) {
|
|
528
528
|
if (u !== null && d - u > 1)
|
|
529
529
|
if (d - u === 2) {
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
page:
|
|
533
|
-
label:
|
|
534
|
-
active:
|
|
530
|
+
const g = u + 1;
|
|
531
|
+
c.push({
|
|
532
|
+
page: g,
|
|
533
|
+
label: g + 1,
|
|
534
|
+
active: g === i,
|
|
535
535
|
ellipsis: !1
|
|
536
536
|
});
|
|
537
537
|
} else
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
c.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
539
|
+
c.push({
|
|
540
540
|
page: d,
|
|
541
541
|
label: d + 1,
|
|
542
542
|
active: d === i,
|
|
543
543
|
ellipsis: !1
|
|
544
544
|
}), u = d;
|
|
545
545
|
}
|
|
546
|
-
return
|
|
546
|
+
return c;
|
|
547
547
|
}
|
|
548
548
|
const At = /^(\d{4})-(\d{1,2})$/, vt = 1200;
|
|
549
549
|
function Te(m, e) {
|
|
550
550
|
const t = Number(m);
|
|
551
551
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Me(m, e) {
|
|
554
554
|
if (typeof m != "string")
|
|
555
555
|
return "";
|
|
556
556
|
const t = At.exec(m.trim());
|
|
@@ -564,7 +564,7 @@ function xe(m, e) {
|
|
|
564
564
|
}
|
|
565
565
|
function St(m) {
|
|
566
566
|
if (typeof m == "string" && m.trim() !== "")
|
|
567
|
-
return
|
|
567
|
+
return Me(m, 0);
|
|
568
568
|
const e = /* @__PURE__ */ new Date();
|
|
569
569
|
return `${String(e.getFullYear()).padStart(4, "0")}-${ne(e.getMonth() + 1)}`;
|
|
570
570
|
}
|
|
@@ -577,7 +577,7 @@ function st(m, e) {
|
|
|
577
577
|
return [];
|
|
578
578
|
const i = Math.min(t, vt), n = [];
|
|
579
579
|
for (let s = 0; s <= i; s += 1) {
|
|
580
|
-
const a =
|
|
580
|
+
const a = Me(r, -s);
|
|
581
581
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
582
582
|
}
|
|
583
583
|
return n;
|
|
@@ -590,14 +590,14 @@ function at(m, e) {
|
|
|
590
590
|
if (i <= 0)
|
|
591
591
|
return t;
|
|
592
592
|
const n = Math.max(0, Te(r.number, 0)), s = Math.max(0, Te(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
|
|
593
|
-
let
|
|
593
|
+
let c;
|
|
594
594
|
if (e !== void 0 && Number.isFinite(e))
|
|
595
|
-
|
|
595
|
+
c = Math.max(0, Math.trunc(e));
|
|
596
596
|
else {
|
|
597
597
|
const d = Te(r.numberOfElements, NaN);
|
|
598
|
-
|
|
598
|
+
c = Number.isFinite(d) ? d : Math.min(s, i - a);
|
|
599
599
|
}
|
|
600
|
-
const u = Math.min(a +
|
|
600
|
+
const u = Math.min(a + c, i);
|
|
601
601
|
return { start: o, end: Math.max(u, o), total: i, empty: !1 };
|
|
602
602
|
}
|
|
603
603
|
function ot(m, e, t) {
|
|
@@ -649,13 +649,13 @@ function dt(m, e) {
|
|
|
649
649
|
return r;
|
|
650
650
|
}
|
|
651
651
|
const wt = Object.freeze({
|
|
652
|
-
date:
|
|
652
|
+
date: Ce,
|
|
653
653
|
now: et,
|
|
654
654
|
today: tt,
|
|
655
655
|
number: rt,
|
|
656
656
|
pages: nt,
|
|
657
657
|
range: it,
|
|
658
|
-
monthAdd:
|
|
658
|
+
monthAdd: Me,
|
|
659
659
|
monthRange: st,
|
|
660
660
|
pageSummary: at,
|
|
661
661
|
findBy: ot,
|
|
@@ -948,7 +948,7 @@ const T = class T {
|
|
|
948
948
|
);
|
|
949
949
|
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)), y.warn(
|
|
950
950
|
"[Haori]",
|
|
951
|
-
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${
|
|
951
|
+
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${l.prefix}form-object to collect nested values.`
|
|
952
952
|
));
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
@@ -1043,19 +1043,19 @@ const T = class T {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
if (a.value !== ")")
|
|
1045
1045
|
continue;
|
|
1046
|
-
let o = 0,
|
|
1046
|
+
let o = 0, c = 0;
|
|
1047
1047
|
for (let u = s - 1; u >= 0; u -= 1) {
|
|
1048
1048
|
const d = i[u].value;
|
|
1049
1049
|
if (d === ")" || d === "]" || d === "}") {
|
|
1050
|
-
o += 1, d === ")" && (
|
|
1050
|
+
o += 1, d === ")" && (c += 1);
|
|
1051
1051
|
continue;
|
|
1052
1052
|
}
|
|
1053
1053
|
if (d === "(" || d === "[" || d === "{") {
|
|
1054
|
-
if (o -= 1, d === "(" && (
|
|
1054
|
+
if (o -= 1, d === "(" && (c -= 1), o === 0)
|
|
1055
1055
|
break;
|
|
1056
1056
|
continue;
|
|
1057
1057
|
}
|
|
1058
|
-
|
|
1058
|
+
c === 1 && i[u].type === "identifier" && n.has(i[u - 1]?.value ?? "") && r.add(i[u].value);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
@@ -1178,8 +1178,8 @@ let ${e.join(", ")};`;
|
|
|
1178
1178
|
let a = null;
|
|
1179
1179
|
for (const o of r) {
|
|
1180
1180
|
if (o.value === "[") {
|
|
1181
|
-
const
|
|
1182
|
-
s.push(
|
|
1181
|
+
const c = this.startsMemberAccess(a);
|
|
1182
|
+
s.push(c), c && n.push({
|
|
1183
1183
|
start: o.position + 1,
|
|
1184
1184
|
end: o.position + 1,
|
|
1185
1185
|
text: T.MEMBER_KEY_GUARD_OPEN
|
|
@@ -1192,8 +1192,8 @@ let ${e.join(", ")};`;
|
|
|
1192
1192
|
a = o;
|
|
1193
1193
|
}
|
|
1194
1194
|
for (let o = n.length - 1; o >= 0; o -= 1) {
|
|
1195
|
-
const
|
|
1196
|
-
i = i.slice(0,
|
|
1195
|
+
const c = n[o];
|
|
1196
|
+
i = i.slice(0, c.start) + c.text + i.slice(c.end);
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
return this.GUARDED_MEMBER_CACHE.set(e, i), i;
|
|
@@ -1231,7 +1231,7 @@ let ${e.join(", ")};`;
|
|
|
1231
1231
|
*/
|
|
1232
1232
|
static recordUnresolvedIdentifiers(e, t) {
|
|
1233
1233
|
if (e.length !== 0) {
|
|
1234
|
-
if (
|
|
1234
|
+
if (l.strictBind) {
|
|
1235
1235
|
y.error(
|
|
1236
1236
|
"[Haori]",
|
|
1237
1237
|
"Expression references key(s) that are not in the binding data: " + e.join(", ") + ". The result is treated as an unresolved reference.",
|
|
@@ -1373,7 +1373,7 @@ ${t}`;
|
|
|
1373
1373
|
const n = this.prepareEvaluator(e, i);
|
|
1374
1374
|
if (!(n.compileFailed || n.evaluator === null))
|
|
1375
1375
|
try {
|
|
1376
|
-
const s = this.wrapBoundValues(i), a = n.bindKeys.map((
|
|
1376
|
+
const s = this.wrapBoundValues(i), a = n.bindKeys.map((c) => s[c]), o = this.withBlockedPropertyAccess(
|
|
1377
1377
|
() => n.evaluator(...a)
|
|
1378
1378
|
);
|
|
1379
1379
|
return typeof o == "boolean" ? o : void 0;
|
|
@@ -1417,11 +1417,11 @@ ${t}`;
|
|
|
1417
1417
|
if (this.containsDangerousPatterns(e)) {
|
|
1418
1418
|
const d = this.detectDisallowedKeywords(e);
|
|
1419
1419
|
if (d.length > 0) {
|
|
1420
|
-
const
|
|
1420
|
+
const g = d.some((p) => p === "function" || p === "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.";
|
|
1421
1421
|
y.warn(
|
|
1422
1422
|
"[Haori]",
|
|
1423
1423
|
e,
|
|
1424
|
-
"Expression uses disallowed keyword(s): " + d.join(", ") + "." +
|
|
1424
|
+
"Expression uses disallowed keyword(s): " + d.join(", ") + "." + g
|
|
1425
1425
|
);
|
|
1426
1426
|
} else
|
|
1427
1427
|
y.warn(
|
|
@@ -1467,7 +1467,7 @@ ${t}`;
|
|
|
1467
1467
|
...this.BUILTIN_HELPERS,
|
|
1468
1468
|
[this.BUILTIN_DATA_PROPERTY]: { ...a }
|
|
1469
1469
|
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a), j.isEnabled() && this.recordSuppliedIdentifiers(a);
|
|
1470
|
-
const o = this.canAttemptMissingIdentifierRecovery(e),
|
|
1470
|
+
const o = this.canAttemptMissingIdentifierRecovery(e), c = this.extractFreeIdentifiers(e).filter(
|
|
1471
1471
|
(d) => !(d in a) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
1472
1472
|
// (二重宣言は構文エラーになる)。
|
|
1473
1473
|
!this.FORBIDDEN_NAMES.includes(d) && // 標準組み込み(`Math` など)は式から参照できる仕様のため遮蔽しない。
|
|
@@ -1476,29 +1476,29 @@ ${t}`;
|
|
|
1476
1476
|
if (j.isEnabled()) {
|
|
1477
1477
|
const d = this.extractBoundIdentifiers(e);
|
|
1478
1478
|
this.recordScopeMissingIdentifiers(
|
|
1479
|
-
d.size === 0 ?
|
|
1479
|
+
d.size === 0 ? c : c.filter((g) => !d.has(g)),
|
|
1480
1480
|
e
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
1483
|
-
o &&
|
|
1483
|
+
o && c.forEach((d) => {
|
|
1484
1484
|
a[d] = void 0;
|
|
1485
1485
|
});
|
|
1486
|
-
const u = o ? [] :
|
|
1486
|
+
const u = o ? [] : c;
|
|
1487
1487
|
for (let d = 0; d <= this.MAX_IDENTIFIER_RECOVERY_COUNT; d += 1) {
|
|
1488
|
-
const
|
|
1488
|
+
const g = this.prepareEvaluator(
|
|
1489
1489
|
e,
|
|
1490
1490
|
a,
|
|
1491
1491
|
u
|
|
1492
1492
|
);
|
|
1493
|
-
if (
|
|
1493
|
+
if (g.compileFailed || g.evaluator === null)
|
|
1494
1494
|
return { value: null, unresolvedReference: !1 };
|
|
1495
1495
|
try {
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1496
|
+
const p = [], E = this.wrapBoundValues(a);
|
|
1497
|
+
g.bindKeys.forEach((D) => {
|
|
1498
|
+
p.push(E[D]);
|
|
1499
1499
|
});
|
|
1500
1500
|
const v = this.withBlockedPropertyAccess(
|
|
1501
|
-
() =>
|
|
1501
|
+
() => g.evaluator(...p)
|
|
1502
1502
|
);
|
|
1503
1503
|
return v === void 0 && this.warnBlockedIdentifiers(e), {
|
|
1504
1504
|
value: v,
|
|
@@ -1507,26 +1507,26 @@ ${t}`;
|
|
|
1507
1507
|
// メンバーアクセスもここへ集約される。
|
|
1508
1508
|
unresolvedReference: v === void 0
|
|
1509
1509
|
};
|
|
1510
|
-
} catch (
|
|
1511
|
-
if (o &&
|
|
1512
|
-
const
|
|
1513
|
-
if (
|
|
1514
|
-
a[
|
|
1510
|
+
} catch (p) {
|
|
1511
|
+
if (o && p instanceof ReferenceError) {
|
|
1512
|
+
const E = this.extractMissingIdentifier(p);
|
|
1513
|
+
if (E !== null && this.canRecoverMissingIdentifier(E, a)) {
|
|
1514
|
+
a[E] = void 0;
|
|
1515
1515
|
continue;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
if (this.warnBlockedIdentifiers(e),
|
|
1519
|
-
const
|
|
1518
|
+
if (this.warnBlockedIdentifiers(e), p instanceof ReferenceError && u.length > 0) {
|
|
1519
|
+
const E = this.evaluateAsCondition(
|
|
1520
1520
|
e,
|
|
1521
1521
|
a,
|
|
1522
1522
|
u
|
|
1523
1523
|
);
|
|
1524
|
-
return
|
|
1525
|
-
this.extractUninitializedIdentifiers(
|
|
1524
|
+
return E !== void 0 ? { value: E, unresolvedReference: !1 } : (this.recordUnresolvedIdentifiers(
|
|
1525
|
+
this.extractUninitializedIdentifiers(p, u),
|
|
1526
1526
|
e
|
|
1527
1527
|
), { value: void 0, unresolvedReference: !0 });
|
|
1528
1528
|
}
|
|
1529
|
-
return y.error("[Haori]", "Expression evaluation error:", e,
|
|
1529
|
+
return y.error("[Haori]", "Expression evaluation error:", e, p), p instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
return y.error(
|
|
@@ -1551,24 +1551,24 @@ ${t}`;
|
|
|
1551
1551
|
i.forEach((v) => {
|
|
1552
1552
|
this.isUsableBindingKey(v) ? n.push(v) : s.push(v);
|
|
1553
1553
|
}), n.sort(), this.reportUnusableBindingKeys(s);
|
|
1554
|
-
const a = new Set(n), o = r.filter((v) => !a.has(v)),
|
|
1554
|
+
const a = new Set(n), o = r.filter((v) => !a.has(v)), c = `${e}:${n.join(",")}:${o.join(
|
|
1555
1555
|
","
|
|
1556
1556
|
)}`;
|
|
1557
|
-
let u = this.EXPRESSION_CACHE.get(
|
|
1557
|
+
let u = this.EXPRESSION_CACHE.get(c) || null;
|
|
1558
1558
|
if (u !== null)
|
|
1559
1559
|
return this.compileFailedExpressions.delete(e), {
|
|
1560
1560
|
bindKeys: n,
|
|
1561
1561
|
evaluator: u,
|
|
1562
1562
|
compileFailed: !1
|
|
1563
1563
|
};
|
|
1564
|
-
const d = this.buildAssignments(n),
|
|
1564
|
+
const d = this.buildAssignments(n), g = this.buildShadowDeclarations(o), p = this.toGuardedMemberExpression(
|
|
1565
1565
|
this.toOptionalChainExpression(e)
|
|
1566
|
-
),
|
|
1566
|
+
), E = d ? `"use strict";
|
|
1567
1567
|
${d};
|
|
1568
|
-
return (${
|
|
1569
|
-
return (${
|
|
1568
|
+
return (${p});${g}` : `"use strict";
|
|
1569
|
+
return (${p});${g}`;
|
|
1570
1570
|
try {
|
|
1571
|
-
return u = new Function(...n,
|
|
1571
|
+
return u = new Function(...n, E), this.EXPRESSION_CACHE.set(c, u), this.compileFailedExpressions.delete(e), {
|
|
1572
1572
|
bindKeys: n,
|
|
1573
1573
|
evaluator: u,
|
|
1574
1574
|
compileFailed: !1
|
|
@@ -1656,11 +1656,11 @@ return (${g});${p}`;
|
|
|
1656
1656
|
const r = [];
|
|
1657
1657
|
let i = null;
|
|
1658
1658
|
for (let n = 0; n < t.length; n++) {
|
|
1659
|
-
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null,
|
|
1659
|
+
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null, c = t[n - 2] || null, u = t[n - 3] || null;
|
|
1660
1660
|
if (this.startsObjectKey(
|
|
1661
1661
|
o,
|
|
1662
1662
|
i,
|
|
1663
|
-
|
|
1663
|
+
c,
|
|
1664
1664
|
u
|
|
1665
1665
|
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
1666
1666
|
this.decodeStringLiteral(s.value)
|
|
@@ -2047,8 +2047,8 @@ return (${g});${p}`;
|
|
|
2047
2047
|
get: (s, a, o) => {
|
|
2048
2048
|
if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
|
|
2049
2049
|
return;
|
|
2050
|
-
const
|
|
2051
|
-
return typeof a == "symbol" ?
|
|
2050
|
+
const c = Reflect.get(s, a, o);
|
|
2051
|
+
return typeof a == "symbol" ? c : this.wrapBoundValue(c, t);
|
|
2052
2052
|
},
|
|
2053
2053
|
has: (s, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(s, a),
|
|
2054
2054
|
getOwnPropertyDescriptor: (s, a) => {
|
|
@@ -2056,12 +2056,12 @@ return (${g});${p}`;
|
|
|
2056
2056
|
return Reflect.getOwnPropertyDescriptor(s, a);
|
|
2057
2057
|
},
|
|
2058
2058
|
apply: (s, a, o) => {
|
|
2059
|
-
const
|
|
2059
|
+
const c = Reflect.apply(
|
|
2060
2060
|
s,
|
|
2061
2061
|
a,
|
|
2062
2062
|
o
|
|
2063
2063
|
);
|
|
2064
|
-
return this.isIteratorLike(
|
|
2064
|
+
return this.isIteratorLike(c) ? c : this.wrapBoundValue(c, t);
|
|
2065
2065
|
},
|
|
2066
2066
|
construct: (s, a, o) => this.wrapBoundValue(
|
|
2067
2067
|
Reflect.construct(
|
|
@@ -2619,8 +2619,8 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2619
2619
|
i += `#${n.trim()}`, t.unshift(i);
|
|
2620
2620
|
break;
|
|
2621
2621
|
}
|
|
2622
|
-
const s = r.getAttribute(`${
|
|
2623
|
-
s && s.trim() !== "" && (i += `[${
|
|
2622
|
+
const s = r.getAttribute(`${l.prefix}derive-name`);
|
|
2623
|
+
s && s.trim() !== "" && (i += `[${l.prefix}derive-name="${s.trim()}"]`);
|
|
2624
2624
|
const a = r.parentElement;
|
|
2625
2625
|
a && (i += `:nth-child(${[...a.children].indexOf(r) + 1})`), t.unshift(i), r = a;
|
|
2626
2626
|
}
|
|
@@ -2761,8 +2761,8 @@ const ce = class ce {
|
|
|
2761
2761
|
}
|
|
2762
2762
|
};
|
|
2763
2763
|
ce.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
2764
|
-
let
|
|
2765
|
-
const R = class R extends
|
|
2764
|
+
let x = ce;
|
|
2765
|
+
const R = class R extends x {
|
|
2766
2766
|
/**
|
|
2767
2767
|
* エレメントフラグメントのコンストラクタ。
|
|
2768
2768
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -2770,14 +2770,14 @@ const R = class R extends C {
|
|
|
2770
2770
|
* @param target 対象エレメント
|
|
2771
2771
|
*/
|
|
2772
2772
|
constructor(e) {
|
|
2773
|
-
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, this.syncValue(), this.initialBindAttribute = e.getAttribute(`${
|
|
2773
|
+
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, this.syncValue(), this.initialBindAttribute = e.getAttribute(`${l.prefix}bind`), e.getAttributeNames().forEach((t) => {
|
|
2774
2774
|
const r = e.getAttribute(t);
|
|
2775
2775
|
if (r !== null && !this.attributeMap.has(t)) {
|
|
2776
2776
|
const i = new Fe(t, r);
|
|
2777
2777
|
this.attributeMap.set(t, i);
|
|
2778
2778
|
}
|
|
2779
2779
|
}), e.childNodes.forEach((t) => {
|
|
2780
|
-
const r =
|
|
2780
|
+
const r = x.get(t);
|
|
2781
2781
|
r.setParent(this), this.children.push(r);
|
|
2782
2782
|
});
|
|
2783
2783
|
}
|
|
@@ -2842,7 +2842,7 @@ const R = class R extends C {
|
|
|
2842
2842
|
* clone 時に runtime の hidden 状態だけを落とします。
|
|
2843
2843
|
*/
|
|
2844
2844
|
normalizeClonedVisibilityState() {
|
|
2845
|
-
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${
|
|
2845
|
+
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${l.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${l.prefix}if-false`), this.restoreFormControlsDisabledByIf()), this.children.forEach((e) => {
|
|
2846
2846
|
e instanceof R && e.normalizeClonedVisibilityState();
|
|
2847
2847
|
});
|
|
2848
2848
|
}
|
|
@@ -3309,8 +3309,8 @@ const R = class R extends C {
|
|
|
3309
3309
|
let s = !1;
|
|
3310
3310
|
const a = /* @__PURE__ */ new Set();
|
|
3311
3311
|
Array.from(i.options).forEach((o) => {
|
|
3312
|
-
const
|
|
3313
|
-
o.selected !==
|
|
3312
|
+
const c = e.includes(o.value);
|
|
3313
|
+
o.selected !== c && (o.selected = c, s = !0), c && a.add(o.value);
|
|
3314
3314
|
}), this.recordValueWriteResult(
|
|
3315
3315
|
e.every((o) => a.has(o))
|
|
3316
3316
|
), s && t && i.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -3678,7 +3678,7 @@ const R = class R extends C {
|
|
|
3678
3678
|
const n = `${e} ${t}`;
|
|
3679
3679
|
R.loggedTypeMismatchedComparisons.has(n) || (R.loggedTypeMismatchedComparisons.add(n), y.warn(
|
|
3680
3680
|
"[Haori]",
|
|
3681
|
-
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${
|
|
3681
|
+
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${l.prefix}value-type) or compare converted values: ${e}="${t}"`,
|
|
3682
3682
|
i
|
|
3683
3683
|
));
|
|
3684
3684
|
}
|
|
@@ -3697,7 +3697,7 @@ const R = class R extends C {
|
|
|
3697
3697
|
const t = this.getTarget().closest("select");
|
|
3698
3698
|
if (!t)
|
|
3699
3699
|
return !1;
|
|
3700
|
-
const r =
|
|
3700
|
+
const r = x.get(t);
|
|
3701
3701
|
return r instanceof R ? r.hasPendingUserEdit() : !1;
|
|
3702
3702
|
}
|
|
3703
3703
|
/**
|
|
@@ -3783,7 +3783,7 @@ const R = class R extends C {
|
|
|
3783
3783
|
* @returns 宣言された型。宣言が無い場合と無視する場合は null
|
|
3784
3784
|
*/
|
|
3785
3785
|
static resolveDeclaredValueType(e) {
|
|
3786
|
-
const t = e.getAttribute(`${
|
|
3786
|
+
const t = e.getAttribute(`${l.prefix}value-type`);
|
|
3787
3787
|
if (t === null)
|
|
3788
3788
|
return null;
|
|
3789
3789
|
const r = t.trim().toLowerCase();
|
|
@@ -3826,7 +3826,7 @@ const R = class R extends C {
|
|
|
3826
3826
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
3827
3827
|
R.loggedValueTypeDeclarations.has(n) || (R.loggedValueTypeDeclarations.add(n), y.warn(
|
|
3828
3828
|
"Haori",
|
|
3829
|
-
`${
|
|
3829
|
+
`${l.prefix}value-type="${t}" を無視しました(${r}):`,
|
|
3830
3830
|
e
|
|
3831
3831
|
));
|
|
3832
3832
|
}
|
|
@@ -3962,7 +3962,7 @@ const R = class R extends C {
|
|
|
3962
3962
|
const t = this.getTarget().closest("select");
|
|
3963
3963
|
if (!t)
|
|
3964
3964
|
return;
|
|
3965
|
-
const r =
|
|
3965
|
+
const r = x.get(t);
|
|
3966
3966
|
r instanceof R && r.syncValue();
|
|
3967
3967
|
}
|
|
3968
3968
|
/**
|
|
@@ -4089,18 +4089,18 @@ const R = class R extends C {
|
|
|
4089
4089
|
}
|
|
4090
4090
|
}
|
|
4091
4091
|
this.attributeMap.set(e, o);
|
|
4092
|
-
const
|
|
4092
|
+
const c = this.getTarget(), u = o.evaluateDetailed(this.getBindingData(), {
|
|
4093
4093
|
kind: "attribute",
|
|
4094
|
-
element:
|
|
4094
|
+
element: c,
|
|
4095
4095
|
rawName: e,
|
|
4096
4096
|
template: r
|
|
4097
|
-
}), d = o.isEvaluate || o.isRawEvaluate,
|
|
4097
|
+
}), d = o.isEvaluate || o.isRawEvaluate, g = e === t && R.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), p = o.isSingleExpression(), E = se.joinEvaluateResults(u.results), v = u.results.length === 1 ? u.results[0] : E, D = t === "value" && R.resolveDeclaredValueType(c) === "boolean", k = v === !1 && !D, H = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || v === null || v === void 0 || k : g ? u.hasUnresolvedReference || v === null || v === void 0 || v === !1 : p ? u.hasUnresolvedReference || v === null || v === void 0 || k : d && E === "");
|
|
4098
4098
|
if (H && u.hasUnresolvedReference && R.warnUnresolvedAttribute(
|
|
4099
4099
|
e,
|
|
4100
4100
|
t,
|
|
4101
4101
|
r,
|
|
4102
|
-
|
|
4103
|
-
), j.isEnabled() && v === !1 &&
|
|
4102
|
+
c
|
|
4103
|
+
), j.isEnabled() && v === !1 && p) {
|
|
4104
4104
|
const de = o.getSingleExpression(), Ee = de === null ? null : Q.diagnoseStrictComparison(
|
|
4105
4105
|
de,
|
|
4106
4106
|
this.getBindingData()
|
|
@@ -4109,20 +4109,20 @@ const R = class R extends C {
|
|
|
4109
4109
|
e,
|
|
4110
4110
|
r,
|
|
4111
4111
|
Ee,
|
|
4112
|
-
|
|
4112
|
+
c
|
|
4113
4113
|
);
|
|
4114
4114
|
}
|
|
4115
|
-
const
|
|
4116
|
-
if (!_ && !
|
|
4115
|
+
const A = o.isForceEvaluation() ? r : p ? v : E, S = i && o.isEvaluate && t === "value" && R.isValuePropertyTarget(c), C = c.getRootNode(), V = S && R.isUserEditableValue(c) && (c === C.activeElement || this.hasPendingUserEdit()), P = H || A === null || A === !1 && !D ? null : String(A), _ = e !== t && c.getAttribute(e) !== r, M = P === null ? c.hasAttribute(t) : c.getAttribute(t) !== P, q = P === null ? "" : P, X = S && !V && c.value !== q, Y = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), te = t === "selected" && c instanceof HTMLOptionElement, be = C.activeElement, ue = be !== null && (Y && c === be || te && c.closest("select") === be) || (Y || te) && this.hasPendingCheckableUserEdit(te), we = P !== null, $e = Y && !ue && c.checked !== we, Re = te && !ue && c.selected !== we;
|
|
4116
|
+
if (!_ && !M && !X && !$e && !Re)
|
|
4117
4117
|
return S && !V && (this.value = this.normalizeValueForElement(
|
|
4118
|
-
|
|
4118
|
+
c,
|
|
4119
4119
|
q
|
|
4120
4120
|
), this.clearUnappliedValueWrite()), (Y || te) && !ue && this.syncCheckableValueFromDom(te), Promise.resolve();
|
|
4121
4121
|
const We = K.enqueue(() => {
|
|
4122
|
-
_ &&
|
|
4123
|
-
|
|
4122
|
+
_ && c.setAttribute(e, r), P === null ? c.removeAttribute(t) : M && (c.setAttribute(t, P), t === `${l.prefix}bind` && this.recordSelfWrittenBind(P)), S && !V && (this.value = this.normalizeValueForElement(
|
|
4123
|
+
c,
|
|
4124
4124
|
q
|
|
4125
|
-
), X && (
|
|
4125
|
+
), X && (c.value = q), this.recordValueWriteResult(c.value === q)), $e && (c.checked = we), Re && (c.selected = we), ($e || Re) && this.syncCheckableValueFromDom(Re);
|
|
4126
4126
|
}).finally(() => {
|
|
4127
4127
|
this.releaseSelfWritingAttributes(s);
|
|
4128
4128
|
});
|
|
@@ -4227,7 +4227,7 @@ const R = class R extends C {
|
|
|
4227
4227
|
const i = t ? r.nextSibling : r;
|
|
4228
4228
|
let n = t ? r.nextSibling : r;
|
|
4229
4229
|
for (; n !== null; ) {
|
|
4230
|
-
const s =
|
|
4230
|
+
const s = x.get(n);
|
|
4231
4231
|
if (s !== null) {
|
|
4232
4232
|
const a = this.children.indexOf(s);
|
|
4233
4233
|
if (a !== -1)
|
|
@@ -4259,25 +4259,25 @@ const R = class R extends C {
|
|
|
4259
4259
|
const s = e.getParent() === this;
|
|
4260
4260
|
let a = -1, o = -1;
|
|
4261
4261
|
s && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
|
|
4262
|
-
const
|
|
4263
|
-
|
|
4262
|
+
const c = e.getParent();
|
|
4263
|
+
c !== null && c.removeChild(e);
|
|
4264
4264
|
let u = r === void 0 ? t?.getTarget() || null : r;
|
|
4265
4265
|
if (t === null)
|
|
4266
4266
|
this.children.push(e);
|
|
4267
4267
|
else {
|
|
4268
|
-
let
|
|
4269
|
-
if (s ? a !== -1 && a < o ?
|
|
4270
|
-
const
|
|
4268
|
+
let g;
|
|
4269
|
+
if (s ? a !== -1 && a < o ? g = o - 1 : g = o : g = this.children.indexOf(t), g === -1) {
|
|
4270
|
+
const p = this.resolveInsertionPointFromDom(
|
|
4271
4271
|
t,
|
|
4272
4272
|
!1
|
|
4273
4273
|
);
|
|
4274
|
-
|
|
4274
|
+
p === null ? (y.warn(
|
|
4275
4275
|
"[Haori]",
|
|
4276
4276
|
"Reference child not found in children.",
|
|
4277
4277
|
t
|
|
4278
|
-
), this.children.push(e)) : (this.children.splice(
|
|
4278
|
+
), this.children.push(e)) : (this.children.splice(p.index, 0, e), u = p.referenceNode);
|
|
4279
4279
|
} else
|
|
4280
|
-
this.children.splice(
|
|
4280
|
+
this.children.splice(g, 0, e);
|
|
4281
4281
|
}
|
|
4282
4282
|
e.setParent(this), e.setMounted(this.mounted);
|
|
4283
4283
|
const d = this.skipMutationNodes;
|
|
@@ -4359,7 +4359,7 @@ const R = class R extends C {
|
|
|
4359
4359
|
return Promise.resolve();
|
|
4360
4360
|
this.visible = !1;
|
|
4361
4361
|
const e = this.getTarget();
|
|
4362
|
-
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${
|
|
4362
|
+
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${l.prefix}if-false`, ""), R.disableFormControlsInBranch(e), Promise.resolve();
|
|
4363
4363
|
}
|
|
4364
4364
|
/**
|
|
4365
4365
|
* 分岐配下のフォームコントロールを順に処理します。
|
|
@@ -4376,7 +4376,7 @@ const R = class R extends C {
|
|
|
4376
4376
|
e.matches(Ge) && t(e);
|
|
4377
4377
|
const r = (i) => {
|
|
4378
4378
|
Array.from(i.children).forEach((n) => {
|
|
4379
|
-
n.hasAttribute(`${
|
|
4379
|
+
n.hasAttribute(`${l.prefix}if-false`) || (n instanceof HTMLElement && n.matches(Ge) && t(n), r(n));
|
|
4380
4380
|
});
|
|
4381
4381
|
};
|
|
4382
4382
|
r(e);
|
|
@@ -4428,7 +4428,7 @@ const R = class R extends C {
|
|
|
4428
4428
|
"display",
|
|
4429
4429
|
this.display,
|
|
4430
4430
|
this.displayPriority ?? ""
|
|
4431
|
-
), this.display = null, this.displayPriority = null, e.removeAttribute(`${
|
|
4431
|
+
), this.display = null, this.displayPriority = null, e.removeAttribute(`${l.prefix}if-false`), this.restoreFormControlsDisabledByIf(), this.visible = !0, Promise.resolve();
|
|
4432
4432
|
}
|
|
4433
4433
|
/**
|
|
4434
4434
|
* 指定した属性名を持つ最も近い親要素を返します。
|
|
@@ -4489,7 +4489,7 @@ R.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, R.VALUE
|
|
|
4489
4489
|
"week"
|
|
4490
4490
|
], R.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), R.sequenceCounter = 0, R.bindingWorkActiveCount = 0, R.pendingMutationFlusher = null, R.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), R.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
4491
4491
|
let I = R;
|
|
4492
|
-
class ee extends
|
|
4492
|
+
class ee extends x {
|
|
4493
4493
|
/**
|
|
4494
4494
|
* テキストフラグメントのコンストラクタ。
|
|
4495
4495
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -4575,7 +4575,7 @@ class ee extends C {
|
|
|
4575
4575
|
});
|
|
4576
4576
|
}
|
|
4577
4577
|
}
|
|
4578
|
-
class Ve extends
|
|
4578
|
+
class Ve extends x {
|
|
4579
4579
|
/**
|
|
4580
4580
|
* コメントフラグメントのコンストラクタ。
|
|
4581
4581
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -4726,25 +4726,25 @@ const ke = class ke {
|
|
|
4726
4726
|
evaluateWithProfile(e, t, r, i) {
|
|
4727
4727
|
const n = [], s = [];
|
|
4728
4728
|
let a = 0, o = !1;
|
|
4729
|
-
return this.contents.forEach((
|
|
4729
|
+
return this.contents.forEach((c) => {
|
|
4730
4730
|
try {
|
|
4731
|
-
if (r(
|
|
4731
|
+
if (r(c)) {
|
|
4732
4732
|
const u = Ne.measure(
|
|
4733
|
-
() => Q.evaluateDetailed(
|
|
4733
|
+
() => Q.evaluateDetailed(c.text, e)
|
|
4734
4734
|
), d = u.value;
|
|
4735
4735
|
a += u.durationMs, s.push({
|
|
4736
|
-
expression:
|
|
4736
|
+
expression: c.text,
|
|
4737
4737
|
durationMs: u.durationMs
|
|
4738
4738
|
}), o = o || d.unresolvedReference, n.push(d.value);
|
|
4739
4739
|
} else
|
|
4740
|
-
n.push(
|
|
4740
|
+
n.push(c.text);
|
|
4741
4741
|
} catch (u) {
|
|
4742
4742
|
y.error(
|
|
4743
4743
|
"[Haori]",
|
|
4744
|
-
`Error evaluating ${i} expression: ${
|
|
4744
|
+
`Error evaluating ${i} expression: ${c.text}`,
|
|
4745
4745
|
u
|
|
4746
4746
|
), s.push({
|
|
4747
|
-
expression:
|
|
4747
|
+
expression: c.text,
|
|
4748
4748
|
durationMs: 0
|
|
4749
4749
|
}), n.push("");
|
|
4750
4750
|
}
|
|
@@ -4778,15 +4778,15 @@ const Z = class Z extends se {
|
|
|
4778
4778
|
* @returns 強制評価の対象なら true
|
|
4779
4779
|
*/
|
|
4780
4780
|
static needsForceEvaluation(e) {
|
|
4781
|
-
if (Z.forceEvaluationNames === null || Z.forceEvaluationPrefix !==
|
|
4781
|
+
if (Z.forceEvaluationNames === null || Z.forceEvaluationPrefix !== l.prefix) {
|
|
4782
4782
|
const t = /* @__PURE__ */ new Set();
|
|
4783
4783
|
for (const r of [
|
|
4784
|
-
|
|
4784
|
+
l.prefix,
|
|
4785
4785
|
...Z.FORCE_EVALUATION_PREFIXES
|
|
4786
4786
|
])
|
|
4787
4787
|
for (const i of Z.FORCE_EVALUATION_SUFFIXES)
|
|
4788
4788
|
t.add(`${r}${i}`);
|
|
4789
|
-
Z.forceEvaluationNames = t, Z.forceEvaluationPrefix =
|
|
4789
|
+
Z.forceEvaluationNames = t, Z.forceEvaluationPrefix = l.prefix;
|
|
4790
4790
|
}
|
|
4791
4791
|
return Z.forceEvaluationNames.has(e);
|
|
4792
4792
|
}
|
|
@@ -4844,7 +4844,7 @@ const ge = class ge {
|
|
|
4844
4844
|
* @return 実行モード。
|
|
4845
4845
|
*/
|
|
4846
4846
|
static get runtime() {
|
|
4847
|
-
return
|
|
4847
|
+
return l.runtime;
|
|
4848
4848
|
}
|
|
4849
4849
|
/**
|
|
4850
4850
|
* 実行モードを設定します。
|
|
@@ -4853,7 +4853,7 @@ const ge = class ge {
|
|
|
4853
4853
|
* @return 戻り値はありません。
|
|
4854
4854
|
*/
|
|
4855
4855
|
static setRuntime(e) {
|
|
4856
|
-
|
|
4856
|
+
l.setRuntime(e);
|
|
4857
4857
|
}
|
|
4858
4858
|
/**
|
|
4859
4859
|
* 進行中・追従して投入されるものを含め、すべてのレンダリングタスクの完了を待ちます。
|
|
@@ -4982,7 +4982,7 @@ const ge = class ge {
|
|
|
4982
4982
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
4983
4983
|
*/
|
|
4984
4984
|
static date(e, t, r) {
|
|
4985
|
-
return
|
|
4985
|
+
return Ce(e, t, r);
|
|
4986
4986
|
}
|
|
4987
4987
|
/**
|
|
4988
4988
|
* 現在日時を指定フォーマットの文字列へ整形します。
|
|
@@ -5059,7 +5059,7 @@ const ge = class ge {
|
|
|
5059
5059
|
* @returns 加算後の年月(`YYYY-MM` 形式)。不正な入力は空文字
|
|
5060
5060
|
*/
|
|
5061
5061
|
static monthAdd(e, t) {
|
|
5062
|
-
return
|
|
5062
|
+
return Me(e, t);
|
|
5063
5063
|
}
|
|
5064
5064
|
/**
|
|
5065
5065
|
* 基準月から過去方向へ `count + 1` 個の年月配列を降順で返します。
|
|
@@ -5234,7 +5234,7 @@ const f = class f {
|
|
|
5234
5234
|
* @returns 収集キー。どちらも無い場合は null
|
|
5235
5235
|
*/
|
|
5236
5236
|
static resolveFieldName(e) {
|
|
5237
|
-
const t = e.getAttribute(`${
|
|
5237
|
+
const t = e.getAttribute(`${l.prefix}form-name`);
|
|
5238
5238
|
return t || e.getAttribute("name");
|
|
5239
5239
|
}
|
|
5240
5240
|
/**
|
|
@@ -5310,7 +5310,7 @@ const f = class f {
|
|
|
5310
5310
|
static resolveRowTopLevelKey(e, t) {
|
|
5311
5311
|
let r = null, i = e;
|
|
5312
5312
|
for (; i !== null && i !== t; ) {
|
|
5313
|
-
const n = i.getAttribute(`${
|
|
5313
|
+
const n = i.getAttribute(`${l.prefix}form-object`) || i.getAttribute(`${l.prefix}form-list`) || f.resolveFieldName(i);
|
|
5314
5314
|
n != null && String(n) !== "" && (r = String(n)), i = i.getParent();
|
|
5315
5315
|
}
|
|
5316
5316
|
return r;
|
|
@@ -5337,13 +5337,13 @@ const f = class f {
|
|
|
5337
5337
|
* @returns 属性設定の Promise。処理が不要な場合は undefined
|
|
5338
5338
|
*/
|
|
5339
5339
|
static prepareFormName(e) {
|
|
5340
|
-
if (!e.hasAttribute(`${
|
|
5340
|
+
if (!e.hasAttribute(`${l.prefix}form-name`))
|
|
5341
5341
|
return;
|
|
5342
|
-
const t = e.getAttribute(`${
|
|
5342
|
+
const t = e.getAttribute(`${l.prefix}form-name`);
|
|
5343
5343
|
if (!t) {
|
|
5344
5344
|
y.warn(
|
|
5345
5345
|
"Haori",
|
|
5346
|
-
`${
|
|
5346
|
+
`${l.prefix}form-name evaluated to an empty key; the field falls back to the name attribute or is not collected.`,
|
|
5347
5347
|
e.getTarget()
|
|
5348
5348
|
);
|
|
5349
5349
|
return;
|
|
@@ -5370,9 +5370,9 @@ const f = class f {
|
|
|
5370
5370
|
static resolveGroupScope(e) {
|
|
5371
5371
|
let t = e, r = t.getParent();
|
|
5372
5372
|
for (; r !== null; ) {
|
|
5373
|
-
if (r.hasAttribute(`${
|
|
5373
|
+
if (r.hasAttribute(`${l.prefix}form-list`))
|
|
5374
5374
|
return t;
|
|
5375
|
-
if (r.getTarget() instanceof HTMLFormElement || r.hasAttribute(`${
|
|
5375
|
+
if (r.getTarget() instanceof HTMLFormElement || r.hasAttribute(`${l.prefix}form`))
|
|
5376
5376
|
return r;
|
|
5377
5377
|
t = r, r = r.getParent();
|
|
5378
5378
|
}
|
|
@@ -5413,7 +5413,7 @@ const f = class f {
|
|
|
5413
5413
|
return f.isDeclarationResolved(e, "value");
|
|
5414
5414
|
if (t instanceof HTMLSelectElement) {
|
|
5415
5415
|
for (const r of Array.from(t.options)) {
|
|
5416
|
-
const i =
|
|
5416
|
+
const i = x.get(r);
|
|
5417
5417
|
if (i instanceof I && f.hasDeclarativeBinding(i, "selected") && !f.isDeclarationResolved(i, "selected"))
|
|
5418
5418
|
return !1;
|
|
5419
5419
|
}
|
|
@@ -5432,7 +5432,7 @@ const f = class f {
|
|
|
5432
5432
|
* @returns 未解決参照が無い場合 true
|
|
5433
5433
|
*/
|
|
5434
5434
|
static isDeclarationResolved(e, t) {
|
|
5435
|
-
for (const r of [`${
|
|
5435
|
+
for (const r of [`${l.prefix}attr-${t}`, t]) {
|
|
5436
5436
|
const i = e.getAttributeEvaluation(r);
|
|
5437
5437
|
if (i !== null)
|
|
5438
5438
|
return !i.hasUnresolvedReference;
|
|
@@ -5526,7 +5526,7 @@ const f = class f {
|
|
|
5526
5526
|
* @returns 宣言バインドの場合 true
|
|
5527
5527
|
*/
|
|
5528
5528
|
static hasDeclarativeBinding(e, t) {
|
|
5529
|
-
if (e.hasAttribute(`${
|
|
5529
|
+
if (e.hasAttribute(`${l.prefix}attr-${t}`))
|
|
5530
5530
|
return !0;
|
|
5531
5531
|
const r = e.getRawAttribute(t);
|
|
5532
5532
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -5543,7 +5543,7 @@ const f = class f {
|
|
|
5543
5543
|
*/
|
|
5544
5544
|
static hasDeclarativeSelectedOption(e) {
|
|
5545
5545
|
for (const t of Array.from(e.options)) {
|
|
5546
|
-
const r =
|
|
5546
|
+
const r = x.get(t);
|
|
5547
5547
|
if (r instanceof I && f.hasDeclarativeBinding(r, "selected"))
|
|
5548
5548
|
return !0;
|
|
5549
5549
|
}
|
|
@@ -5624,8 +5624,8 @@ const f = class f {
|
|
|
5624
5624
|
r,
|
|
5625
5625
|
o
|
|
5626
5626
|
);
|
|
5627
|
-
for (const
|
|
5628
|
-
n.has(
|
|
5627
|
+
for (const c of o)
|
|
5628
|
+
n.has(c) || n.set(c, a);
|
|
5629
5629
|
}
|
|
5630
5630
|
const s = /* @__PURE__ */ new Set();
|
|
5631
5631
|
f.walkExcludedPaths(i ?? f.getValues(e), r, s);
|
|
@@ -5718,15 +5718,15 @@ const f = class f {
|
|
|
5718
5718
|
* @returns values と同じオブジェクト
|
|
5719
5719
|
*/
|
|
5720
5720
|
static getPartValues(e, t, r = null, i = null) {
|
|
5721
|
-
if (e.hasAttribute(`${
|
|
5721
|
+
if (e.hasAttribute(`${l.prefix}form-detach`))
|
|
5722
5722
|
return t;
|
|
5723
|
-
if (e.getTarget().hasAttribute(`${
|
|
5723
|
+
if (e.getTarget().hasAttribute(`${l.prefix}if-false`)) {
|
|
5724
5724
|
if (i !== null)
|
|
5725
5725
|
for (const u of f.collectDeclaredKeysInFragment(e))
|
|
5726
5726
|
i.add(u);
|
|
5727
5727
|
return t;
|
|
5728
5728
|
}
|
|
5729
|
-
const n = f.resolveFieldName(e), s = e.getAttribute(`${
|
|
5729
|
+
const n = f.resolveFieldName(e), s = e.getAttribute(`${l.prefix}form-object`), a = e.getAttribute(`${l.prefix}form-list`), o = e.hasAttribute(`${l.prefix}form-list`), c = r !== null && e.getUserEditSequence() <= r;
|
|
5730
5730
|
if (n) {
|
|
5731
5731
|
if (r !== null && f.isGroupedCheckable(e)) {
|
|
5732
5732
|
const u = f.collectGroupSelection(
|
|
@@ -5737,57 +5737,57 @@ const f = class f {
|
|
|
5737
5737
|
u.edited && (t[String(n)] = u.value);
|
|
5738
5738
|
} else if (o && f.isGroupedCheckable(e)) {
|
|
5739
5739
|
const u = String(n), d = e.getTarget();
|
|
5740
|
-
r === null && !Array.isArray(t[u]) && (t[u] = []), !
|
|
5741
|
-
} else if (o &&
|
|
5740
|
+
r === null && !Array.isArray(t[u]) && (t[u] = []), !c && d.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(d.value));
|
|
5741
|
+
} else if (o && c)
|
|
5742
5742
|
Array.isArray(t[String(n)]) ? t[String(n)].push(null) : t[String(n)] = [null];
|
|
5743
|
-
else if (!
|
|
5743
|
+
else if (!c) if (o) {
|
|
5744
5744
|
const u = f.resolveCollectedValue(e), d = f.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
5745
5745
|
Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
|
|
5746
5746
|
} else if (f.isGroupedCheckable(e)) {
|
|
5747
|
-
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0,
|
|
5748
|
-
|
|
5747
|
+
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, g = u instanceof HTMLInputElement ? u.value : e.getValue(), p = d ? g : null, E = String(n);
|
|
5748
|
+
p === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = p : Array.isArray(t[E]) ? t[E].push(p) : t[E] = [t[E], p];
|
|
5749
5749
|
} else
|
|
5750
5750
|
t[String(n)] = f.resolveCollectedValue(e);
|
|
5751
5751
|
s && y.warn(
|
|
5752
5752
|
"Haori",
|
|
5753
|
-
`Element cannot have both ${
|
|
5753
|
+
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
5754
5754
|
);
|
|
5755
5755
|
for (const u of e.getChildElementFragments())
|
|
5756
5756
|
f.getPartValues(u, t, r, i);
|
|
5757
5757
|
} else if (s) {
|
|
5758
5758
|
const u = {}, d = i === null ? null : /* @__PURE__ */ new Set();
|
|
5759
|
-
for (const
|
|
5759
|
+
for (const g of e.getChildElementFragments())
|
|
5760
5760
|
f.getPartValues(
|
|
5761
|
-
|
|
5761
|
+
g,
|
|
5762
5762
|
u,
|
|
5763
5763
|
r,
|
|
5764
5764
|
d
|
|
5765
5765
|
);
|
|
5766
5766
|
d !== null && f.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(s)), a && y.warn(
|
|
5767
5767
|
"Haori",
|
|
5768
|
-
`Element cannot have both ${
|
|
5768
|
+
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
5769
5769
|
);
|
|
5770
5770
|
} else if (a) {
|
|
5771
5771
|
const u = [], d = [];
|
|
5772
|
-
let
|
|
5773
|
-
for (const
|
|
5774
|
-
const
|
|
5772
|
+
let g = !1;
|
|
5773
|
+
for (const p of e.getChildElementFragments()) {
|
|
5774
|
+
const E = {}, v = i === null ? null : /* @__PURE__ */ new Set();
|
|
5775
5775
|
f.getPartValues(
|
|
5776
|
-
|
|
5777
|
-
|
|
5776
|
+
p,
|
|
5777
|
+
E,
|
|
5778
5778
|
r,
|
|
5779
5779
|
v
|
|
5780
|
-
), v !== null && f.registerCollectedExcludedKeys(
|
|
5780
|
+
), v !== null && f.registerCollectedExcludedKeys(E, v), Object.keys(E).length > 0 ? (g = !0, u.push(E), d.push(p.getListKey())) : r !== null && (u.push({}), d.push(p.getListKey()));
|
|
5781
5781
|
}
|
|
5782
5782
|
if (r === null) {
|
|
5783
|
-
const
|
|
5783
|
+
const p = e.getAttribute(`${l.prefix}each-key`);
|
|
5784
5784
|
f.registerCollectedRowIdentity(
|
|
5785
5785
|
u,
|
|
5786
|
-
|
|
5786
|
+
p == null ? null : String(p),
|
|
5787
5787
|
d,
|
|
5788
5788
|
f.isCollectedListFromEachSource(e)
|
|
5789
5789
|
), t[String(a)] = u;
|
|
5790
|
-
} else
|
|
5790
|
+
} else g && (t[String(a)] = u);
|
|
5791
5791
|
} else
|
|
5792
5792
|
for (const u of e.getChildElementFragments())
|
|
5793
5793
|
f.getPartValues(u, t, r, i);
|
|
@@ -5865,7 +5865,7 @@ const f = class f {
|
|
|
5865
5865
|
* @returns 入力欄へ書き戻す値
|
|
5866
5866
|
*/
|
|
5867
5867
|
static resolveSyncValues(e, t) {
|
|
5868
|
-
const r = e.getAttribute(`${
|
|
5868
|
+
const r = e.getAttribute(`${l.prefix}form-arg`);
|
|
5869
5869
|
if (!r)
|
|
5870
5870
|
return t;
|
|
5871
5871
|
const i = String(r);
|
|
@@ -5950,8 +5950,8 @@ const f = class f {
|
|
|
5950
5950
|
let t = e;
|
|
5951
5951
|
for (; t; ) {
|
|
5952
5952
|
const i = t.getParent();
|
|
5953
|
-
if (i && i.hasAttribute(`${
|
|
5954
|
-
const n = i.getRawAttribute(`${
|
|
5953
|
+
if (i && i.hasAttribute(`${l.prefix}each`) && i.hasAttribute(`${l.prefix}form-list`)) {
|
|
5954
|
+
const n = i.getRawAttribute(`${l.prefix}each-arg`);
|
|
5955
5955
|
return {
|
|
5956
5956
|
source: t,
|
|
5957
5957
|
argKey: typeof n == "string" && n !== "" ? n : null
|
|
@@ -5969,7 +5969,7 @@ const f = class f {
|
|
|
5969
5969
|
* @returns キー名。指定が無い場合は null
|
|
5970
5970
|
*/
|
|
5971
5971
|
static resolveFormArgKey(e) {
|
|
5972
|
-
const t = e.getAttribute(`${
|
|
5972
|
+
const t = e.getAttribute(`${l.prefix}form-arg`);
|
|
5973
5973
|
return t ? String(t) : null;
|
|
5974
5974
|
}
|
|
5975
5975
|
/**
|
|
@@ -6006,20 +6006,20 @@ const f = class f {
|
|
|
6006
6006
|
static collectDeclaredKeysInFragment(e) {
|
|
6007
6007
|
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = f.resolveFieldName(e);
|
|
6008
6008
|
i && t.add(String(i));
|
|
6009
|
-
const n = `${
|
|
6009
|
+
const n = `${l.prefix}form-object`, s = `${l.prefix}form-list`, a = r.getAttribute(n) ?? r.getAttribute(s);
|
|
6010
6010
|
if (a)
|
|
6011
6011
|
return t.add(a), t;
|
|
6012
|
-
const o = `input[name],select[name],textarea[name],[${
|
|
6013
|
-
return r.querySelectorAll(o).forEach((
|
|
6014
|
-
if (!(
|
|
6012
|
+
const o = `input[name],select[name],textarea[name],[${l.prefix}form-name],[${n}],[${s}]`;
|
|
6013
|
+
return r.querySelectorAll(o).forEach((c) => {
|
|
6014
|
+
if (!(c instanceof HTMLElement))
|
|
6015
6015
|
return;
|
|
6016
|
-
let u = null, d = !1,
|
|
6017
|
-
for (;
|
|
6018
|
-
|
|
6016
|
+
let u = null, d = !1, g = c;
|
|
6017
|
+
for (; g && g !== r; )
|
|
6018
|
+
g.hasAttribute(`${l.prefix}form-detach`) && (d = !0), (g.hasAttribute(n) || g.hasAttribute(s)) && (u = g), g = g.parentElement;
|
|
6019
6019
|
if (d)
|
|
6020
6020
|
return;
|
|
6021
|
-
const
|
|
6022
|
-
|
|
6021
|
+
const p = u ?? c, E = p.getAttribute(n) || p.getAttribute(s) || p.getAttribute(`${l.prefix}form-name`) || p.getAttribute("name");
|
|
6022
|
+
E && t.add(E);
|
|
6023
6023
|
}), t;
|
|
6024
6024
|
}
|
|
6025
6025
|
/**
|
|
@@ -6033,7 +6033,7 @@ const f = class f {
|
|
|
6033
6033
|
* @returns 戻り値はありません。
|
|
6034
6034
|
*/
|
|
6035
6035
|
static applyCustomValidity(e) {
|
|
6036
|
-
const t = `${
|
|
6036
|
+
const t = `${l.prefix}validity`, r = (i) => {
|
|
6037
6037
|
i.hasAttribute(t) && f.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
6038
6038
|
};
|
|
6039
6039
|
r(e);
|
|
@@ -6081,7 +6081,7 @@ const f = class f {
|
|
|
6081
6081
|
* @returns 表示する文言
|
|
6082
6082
|
*/
|
|
6083
6083
|
static resolveValidityMessage(e) {
|
|
6084
|
-
const t = e.getAttribute(`${
|
|
6084
|
+
const t = e.getAttribute(`${l.prefix}validity-message`);
|
|
6085
6085
|
return typeof t == "string" && t.trim() !== "" ? t : Rt;
|
|
6086
6086
|
}
|
|
6087
6087
|
/**
|
|
@@ -6109,10 +6109,10 @@ const f = class f {
|
|
|
6109
6109
|
static warnUnvalidatedCustomValidity(e, t) {
|
|
6110
6110
|
if (!j.isEnabled() || !e)
|
|
6111
6111
|
return;
|
|
6112
|
-
const r = `${
|
|
6112
|
+
const r = `${l.prefix}validity`;
|
|
6113
6113
|
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && y.warn(
|
|
6114
6114
|
"Haori",
|
|
6115
|
-
`${r} は指定されていますが検証は行われません(${t})。${
|
|
6115
|
+
`${r} は指定されていますが検証は行われません(${t})。${l.prefix}{event}-validate を指定するか、${l.prefix}{event}-if を使用してください。`
|
|
6116
6116
|
);
|
|
6117
6117
|
}
|
|
6118
6118
|
/**
|
|
@@ -6172,7 +6172,7 @@ const f = class f {
|
|
|
6172
6172
|
static warnPositionalRowFallback(e) {
|
|
6173
6173
|
!j.isEnabled() || f.warnedPositionalRowFallbacks.has(e) || (f.warnedPositionalRowFallbacks.add(e), y.warn(
|
|
6174
6174
|
"[Haori]",
|
|
6175
|
-
`${
|
|
6175
|
+
`${l.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6176
6176
|
));
|
|
6177
6177
|
}
|
|
6178
6178
|
/**
|
|
@@ -6281,10 +6281,10 @@ const f = class f {
|
|
|
6281
6281
|
* @returns 同じ配列を指す場合、または判定できない場合は true
|
|
6282
6282
|
*/
|
|
6283
6283
|
static isCollectedListFromEachSource(e) {
|
|
6284
|
-
const t = e.getAttribute(`${
|
|
6284
|
+
const t = e.getAttribute(`${l.prefix}form-list`);
|
|
6285
6285
|
if (t == null || t === "")
|
|
6286
6286
|
return !0;
|
|
6287
|
-
const r = e.getRawAttribute(`${
|
|
6287
|
+
const r = e.getRawAttribute(`${l.prefix}each`);
|
|
6288
6288
|
if (typeof r != "string" || r.trim() === "")
|
|
6289
6289
|
return !0;
|
|
6290
6290
|
const i = f.resolveLeadingPath(r);
|
|
@@ -6378,9 +6378,9 @@ const f = class f {
|
|
|
6378
6378
|
const a = r.keys[s], o = i.get(a);
|
|
6379
6379
|
if (!o || o.length === 0)
|
|
6380
6380
|
continue;
|
|
6381
|
-
const
|
|
6381
|
+
const c = o.shift();
|
|
6382
6382
|
n.push(
|
|
6383
|
-
f.overlayCollectedValue(e[
|
|
6383
|
+
f.overlayCollectedValue(e[c], t[s])
|
|
6384
6384
|
);
|
|
6385
6385
|
}
|
|
6386
6386
|
return n;
|
|
@@ -6417,9 +6417,9 @@ const f = class f {
|
|
|
6417
6417
|
* @returns フォームフラグメントと `data-form-arg` のキー名の組
|
|
6418
6418
|
*/
|
|
6419
6419
|
static collectArgForms(e) {
|
|
6420
|
-
const t = `${
|
|
6420
|
+
const t = `${l.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
6421
6421
|
return r.forEach((n) => {
|
|
6422
|
-
const s =
|
|
6422
|
+
const s = x.get(n);
|
|
6423
6423
|
if (!(s instanceof I))
|
|
6424
6424
|
return;
|
|
6425
6425
|
const a = s.getAttribute(t);
|
|
@@ -6499,14 +6499,14 @@ const f = class f {
|
|
|
6499
6499
|
for (const i of t) {
|
|
6500
6500
|
if (f.INITIAL_RESTORED_FORMS.has(i))
|
|
6501
6501
|
continue;
|
|
6502
|
-
const n =
|
|
6502
|
+
const n = x.get(i);
|
|
6503
6503
|
if (!(n instanceof I))
|
|
6504
6504
|
continue;
|
|
6505
|
-
const s = n.getRawBindingData(), a = n.getAttribute(`${
|
|
6506
|
-
if (!(!s && !
|
|
6507
|
-
if (f.INITIAL_RESTORED_FORMS.add(i),
|
|
6505
|
+
const s = n.getRawBindingData(), a = n.getAttribute(`${l.prefix}form-arg`), o = a ? String(a) : null, c = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ? f.resolveAncestorArgOwner(n, o) : null;
|
|
6506
|
+
if (!(!s && !c)) {
|
|
6507
|
+
if (f.INITIAL_RESTORED_FORMS.add(i), c) {
|
|
6508
6508
|
r.push(
|
|
6509
|
-
f.pushAncestorArgValue(n, o,
|
|
6509
|
+
f.pushAncestorArgValue(n, o, c.value)
|
|
6510
6510
|
);
|
|
6511
6511
|
continue;
|
|
6512
6512
|
}
|
|
@@ -6577,7 +6577,7 @@ const f = class f {
|
|
|
6577
6577
|
* @returns 新しい階層を始める場合は true
|
|
6578
6578
|
*/
|
|
6579
6579
|
static startsCollectionLevel(e) {
|
|
6580
|
-
return f.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${
|
|
6580
|
+
return f.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${l.prefix}form-object`) || e.getAttribute(`${l.prefix}form-list`));
|
|
6581
6581
|
}
|
|
6582
6582
|
/**
|
|
6583
6583
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -6599,7 +6599,7 @@ const f = class f {
|
|
|
6599
6599
|
let t = e, r = t.getParent();
|
|
6600
6600
|
for (; r !== null; ) {
|
|
6601
6601
|
if (f.startsCollectionLevel(r))
|
|
6602
|
-
return r.getAttribute(`${
|
|
6602
|
+
return r.getAttribute(`${l.prefix}form-object`) ? r : t;
|
|
6603
6603
|
if (f.isFormScopeRoot(r))
|
|
6604
6604
|
return r;
|
|
6605
6605
|
t = r, r = r.getParent();
|
|
@@ -6613,7 +6613,7 @@ const f = class f {
|
|
|
6613
6613
|
* @returns フォームの範囲の根であれば true
|
|
6614
6614
|
*/
|
|
6615
6615
|
static isFormScopeRoot(e) {
|
|
6616
|
-
return e.getTarget() instanceof HTMLFormElement || e.hasAttribute(`${
|
|
6616
|
+
return e.getTarget() instanceof HTMLFormElement || e.hasAttribute(`${l.prefix}form`);
|
|
6617
6617
|
}
|
|
6618
6618
|
/**
|
|
6619
6619
|
* 階層の中から、同じ収集キーを持つ群の欄を集めます。
|
|
@@ -6635,9 +6635,9 @@ const f = class f {
|
|
|
6635
6635
|
static collectGroupMembers(e, t, r) {
|
|
6636
6636
|
f.isGroupedCheckable(e) && String(f.resolveFieldName(e)) === t && r.push(e);
|
|
6637
6637
|
for (const i of e.getChildElementFragments())
|
|
6638
|
-
f.startsCollectionLevel(i) || i.hasAttribute(`${
|
|
6638
|
+
f.startsCollectionLevel(i) || i.hasAttribute(`${l.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
6639
6639
|
// (`getPartValues()` と同じ理由)。
|
|
6640
|
-
i.getTarget().hasAttribute(`${
|
|
6640
|
+
i.getTarget().hasAttribute(`${l.prefix}if-false`) || f.collectGroupMembers(i, t, r);
|
|
6641
6641
|
}
|
|
6642
6642
|
/**
|
|
6643
6643
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -6714,22 +6714,22 @@ const f = class f {
|
|
|
6714
6714
|
*/
|
|
6715
6715
|
static setPartValues(e, t, r = !1, i = !0, n = !1, s = /* @__PURE__ */ new Map(), a = null) {
|
|
6716
6716
|
const o = [];
|
|
6717
|
-
if (e.hasAttribute(`${
|
|
6717
|
+
if (e.hasAttribute(`${l.prefix}form-detach`) && !r)
|
|
6718
6718
|
return Promise.resolve();
|
|
6719
|
-
const
|
|
6720
|
-
if (
|
|
6721
|
-
const
|
|
6722
|
-
let D =
|
|
6723
|
-
if (
|
|
6719
|
+
const c = f.resolveFieldName(e), u = e.getAttribute(`${l.prefix}form-object`), d = e.getAttribute(`${l.prefix}form-list`), g = e.hasAttribute(`${l.prefix}form-list`);
|
|
6720
|
+
if (c) {
|
|
6721
|
+
const p = t[String(c)], E = n && f.hasResolvedDeclarativeState(e), v = n && typeof p > "u" && !f.isDeclarativeStateBound(e);
|
|
6722
|
+
let D = p;
|
|
6723
|
+
if (E ? D = void 0 : v && (D = null), f.isFileInput(e))
|
|
6724
6724
|
return (D === null || D === "") && o.push(
|
|
6725
6725
|
f.applyFragmentValue(e, null, i, a)
|
|
6726
6726
|
), Promise.all(o).then(() => {
|
|
6727
6727
|
});
|
|
6728
|
-
if (
|
|
6728
|
+
if (g && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
6729
6729
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
6730
6730
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
6731
6731
|
!f.isGroupedCheckable(e) && !f.isMultipleSelect(e)) {
|
|
6732
|
-
const k = String(
|
|
6732
|
+
const k = String(c), H = s.get(k) ?? 0;
|
|
6733
6733
|
s.set(k, H + 1), o.push(
|
|
6734
6734
|
f.applyFragmentValue(
|
|
6735
6735
|
e,
|
|
@@ -6749,37 +6749,37 @@ const f = class f {
|
|
|
6749
6749
|
f.applyFragmentValue(e, String(D), i, a)
|
|
6750
6750
|
));
|
|
6751
6751
|
} else if (u) {
|
|
6752
|
-
const
|
|
6753
|
-
if (
|
|
6754
|
-
const
|
|
6752
|
+
const p = t[String(u)];
|
|
6753
|
+
if (p && typeof p == "object") {
|
|
6754
|
+
const E = /* @__PURE__ */ new Map();
|
|
6755
6755
|
for (const v of e.getChildElementFragments())
|
|
6756
6756
|
o.push(
|
|
6757
6757
|
f.setPartValues(
|
|
6758
6758
|
v,
|
|
6759
|
-
|
|
6759
|
+
p,
|
|
6760
6760
|
r,
|
|
6761
6761
|
i,
|
|
6762
6762
|
n,
|
|
6763
|
-
|
|
6763
|
+
E,
|
|
6764
6764
|
a
|
|
6765
6765
|
)
|
|
6766
6766
|
);
|
|
6767
6767
|
}
|
|
6768
6768
|
} else if (d) {
|
|
6769
|
-
const
|
|
6770
|
-
if (Array.isArray(
|
|
6771
|
-
const
|
|
6772
|
-
|
|
6773
|
-
|
|
6769
|
+
const p = t[String(d)];
|
|
6770
|
+
if (Array.isArray(p)) {
|
|
6771
|
+
const E = e.getChildElementFragments(), v = e.getAttribute(`${l.prefix}each-key`), D = f.isCollectedListFromEachSource(e) ? f.pairRowsWithItems(
|
|
6772
|
+
E,
|
|
6773
|
+
p,
|
|
6774
6774
|
v == null ? null : String(v)
|
|
6775
6775
|
) : null;
|
|
6776
|
-
for (let k = 0; k <
|
|
6777
|
-
const H =
|
|
6776
|
+
for (let k = 0; k < E.length; k++) {
|
|
6777
|
+
const H = E[k], A = D ? D[k] : p.length > k ? p[k] : null;
|
|
6778
6778
|
o.push(
|
|
6779
6779
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
6780
6780
|
f.setPartValues(
|
|
6781
6781
|
H,
|
|
6782
|
-
f.asPlainRecord(
|
|
6782
|
+
f.asPlainRecord(A) ?? {},
|
|
6783
6783
|
r,
|
|
6784
6784
|
i,
|
|
6785
6785
|
n,
|
|
@@ -6790,10 +6790,10 @@ const f = class f {
|
|
|
6790
6790
|
}
|
|
6791
6791
|
}
|
|
6792
6792
|
} else
|
|
6793
|
-
for (const
|
|
6793
|
+
for (const p of e.getChildElementFragments())
|
|
6794
6794
|
o.push(
|
|
6795
6795
|
f.setPartValues(
|
|
6796
|
-
|
|
6796
|
+
p,
|
|
6797
6797
|
t,
|
|
6798
6798
|
r,
|
|
6799
6799
|
i,
|
|
@@ -6851,17 +6851,17 @@ const f = class f {
|
|
|
6851
6851
|
const s = f.getInitialBindingData(n);
|
|
6852
6852
|
if (n.getRawBindingData() === null && s === null)
|
|
6853
6853
|
continue;
|
|
6854
|
-
const a = f.getValues(n), o = n.getAttribute(`${
|
|
6855
|
-
let
|
|
6854
|
+
const a = f.getValues(n), o = n.getAttribute(`${l.prefix}form-arg`);
|
|
6855
|
+
let c = { ...s || {} };
|
|
6856
6856
|
if (o) {
|
|
6857
6857
|
const u = String(o);
|
|
6858
|
-
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && f.resolveAncestorArgOwner(n, u) !== null || (
|
|
6859
|
-
|
|
6858
|
+
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && f.resolveAncestorArgOwner(n, u) !== null || (c[u] = f.mergeCollectedValues(
|
|
6859
|
+
c[u] ?? null,
|
|
6860
6860
|
a
|
|
6861
6861
|
));
|
|
6862
6862
|
} else
|
|
6863
|
-
|
|
6864
|
-
await B.setBindingData(n.getTarget(),
|
|
6863
|
+
c = f.mergeCollectedValues(c, a);
|
|
6864
|
+
await B.setBindingData(n.getTarget(), c, {
|
|
6865
6865
|
sequence: t
|
|
6866
6866
|
});
|
|
6867
6867
|
}
|
|
@@ -6901,7 +6901,7 @@ const f = class f {
|
|
|
6901
6901
|
t instanceof HTMLFormElement ? r.push(t) : r.push(...Array.from(t.querySelectorAll("form")));
|
|
6902
6902
|
const i = [];
|
|
6903
6903
|
for (const n of r) {
|
|
6904
|
-
const s =
|
|
6904
|
+
const s = x.get(n);
|
|
6905
6905
|
s instanceof I && i.push(s);
|
|
6906
6906
|
}
|
|
6907
6907
|
return i;
|
|
@@ -6914,9 +6914,9 @@ const f = class f {
|
|
|
6914
6914
|
*/
|
|
6915
6915
|
static clearEachClones(e) {
|
|
6916
6916
|
const t = [], r = (n) => {
|
|
6917
|
-
if (n.hasAttribute(`${
|
|
6917
|
+
if (n.hasAttribute(`${l.prefix}each`)) {
|
|
6918
6918
|
for (const s of n.getChildElementFragments()) {
|
|
6919
|
-
const a = s.hasAttribute(`${
|
|
6919
|
+
const a = s.hasAttribute(`${l.prefix}each-before`), o = s.hasAttribute(`${l.prefix}each-after`);
|
|
6920
6920
|
!a && !o && t.push(s.remove());
|
|
6921
6921
|
}
|
|
6922
6922
|
n.setEachInputSignature(null);
|
|
@@ -7003,7 +7003,7 @@ const f = class f {
|
|
|
7003
7003
|
* @returns 反映完了の Promise
|
|
7004
7004
|
*/
|
|
7005
7005
|
static async restoreAncestorArgValues(e, t = null) {
|
|
7006
|
-
const r = e.getAttribute(`${
|
|
7006
|
+
const r = e.getAttribute(`${l.prefix}form-arg`);
|
|
7007
7007
|
if (!r)
|
|
7008
7008
|
return;
|
|
7009
7009
|
const i = String(r), n = f.resolveAncestorArgOwner(e, i);
|
|
@@ -7059,10 +7059,10 @@ const f = class f {
|
|
|
7059
7059
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7060
7060
|
*/
|
|
7061
7061
|
static addMessage(e, t, r, i) {
|
|
7062
|
-
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r),
|
|
7063
|
-
return
|
|
7062
|
+
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), c = f.findFragmentsByKey(e, t);
|
|
7063
|
+
return c.forEach((u) => {
|
|
7064
7064
|
n.push(o(u.getTarget()));
|
|
7065
|
-
}),
|
|
7065
|
+
}), c.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
7066
7066
|
});
|
|
7067
7067
|
}
|
|
7068
7068
|
/**
|
|
@@ -7085,21 +7085,21 @@ const f = class f {
|
|
|
7085
7085
|
*/
|
|
7086
7086
|
static findFragmentByKeyParts(e, t) {
|
|
7087
7087
|
const r = [], i = t[0];
|
|
7088
|
-
if (t.length == 1 && f.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${
|
|
7089
|
-
t.length > 1 && e.getAttribute(`${
|
|
7088
|
+
if (t.length == 1 && f.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${l.prefix}form-object`))
|
|
7089
|
+
t.length > 1 && e.getAttribute(`${l.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
7090
7090
|
r.push(...f.findFragmentByKeyParts(s, t.slice(1)));
|
|
7091
7091
|
});
|
|
7092
|
-
else if (e.hasAttribute(`${
|
|
7092
|
+
else if (e.hasAttribute(`${l.prefix}form-list`)) {
|
|
7093
7093
|
if (t.length > 1) {
|
|
7094
|
-
const n = e.getAttribute(`${
|
|
7094
|
+
const n = e.getAttribute(`${l.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
|
|
7095
7095
|
if (s !== -1 && a !== -1 && s < a) {
|
|
7096
7096
|
const o = i.substring(0, s);
|
|
7097
7097
|
if (n === o) {
|
|
7098
|
-
const
|
|
7098
|
+
const c = i.substring(s + 1, a), u = Number(c);
|
|
7099
7099
|
if (isNaN(u))
|
|
7100
7100
|
y.error("Haori", `Invalid index: ${i}`);
|
|
7101
7101
|
else {
|
|
7102
|
-
const d = e.getChildElementFragments().filter((
|
|
7102
|
+
const d = e.getChildElementFragments().filter((g) => g.hasAttribute(`${l.prefix}row`));
|
|
7103
7103
|
u < d.length && r.push(
|
|
7104
7104
|
...f.findFragmentByKeyParts(d[u], t.slice(1))
|
|
7105
7105
|
);
|
|
@@ -7126,7 +7126,7 @@ const f = class f {
|
|
|
7126
7126
|
*/
|
|
7127
7127
|
static getFormFragment(e) {
|
|
7128
7128
|
const t = e.getTarget();
|
|
7129
|
-
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${
|
|
7129
|
+
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${l.prefix}form`))
|
|
7130
7130
|
return e;
|
|
7131
7131
|
const r = e.getParent();
|
|
7132
7132
|
return r ? this.getFormFragment(r) : null;
|
|
@@ -7211,9 +7211,9 @@ class O {
|
|
|
7211
7211
|
*/
|
|
7212
7212
|
static bindChange(e, t, r, i = "other") {
|
|
7213
7213
|
const n = [], s = new Set(Object.keys(t || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
7214
|
-
for (const
|
|
7215
|
-
const u = t?.[
|
|
7216
|
-
u !== d && n.push(
|
|
7214
|
+
for (const c of o) {
|
|
7215
|
+
const u = t?.[c], d = r[c];
|
|
7216
|
+
u !== d && n.push(c);
|
|
7217
7217
|
}
|
|
7218
7218
|
O.dispatch(e, "bindchange", {
|
|
7219
7219
|
previous: t || {},
|
|
@@ -7397,7 +7397,7 @@ function Nt(m, e) {
|
|
|
7397
7397
|
return null;
|
|
7398
7398
|
if (!t.includes("{{"))
|
|
7399
7399
|
return t;
|
|
7400
|
-
const r =
|
|
7400
|
+
const r = x.get(m), i = r instanceof I ? r.getBindingData() : {}, n = It(t, i);
|
|
7401
7401
|
return n === "" ? null : n;
|
|
7402
7402
|
}
|
|
7403
7403
|
function Ft(m, e, t) {
|
|
@@ -7410,14 +7410,14 @@ function Ft(m, e, t) {
|
|
|
7410
7410
|
} catch {
|
|
7411
7411
|
return t;
|
|
7412
7412
|
}
|
|
7413
|
-
const i = window.location.pathname + window.location.search + window.location.hash, s = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "",
|
|
7414
|
-
return `${
|
|
7413
|
+
const i = window.location.pathname + window.location.search + window.location.hash, s = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "", c = a >= 0 ? t.slice(0, a) : t, u = c.includes("?") ? "&" : "?";
|
|
7414
|
+
return `${c}${u}${s}${o}`;
|
|
7415
7415
|
}
|
|
7416
7416
|
function ft(m) {
|
|
7417
7417
|
const e = Dt[m];
|
|
7418
7418
|
if (e === void 0 || typeof document > "u")
|
|
7419
7419
|
return !1;
|
|
7420
|
-
const t = `${
|
|
7420
|
+
const t = `${l.prefix}${e}`, r = [];
|
|
7421
7421
|
document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
|
|
7422
7422
|
for (const i of r) {
|
|
7423
7423
|
const n = Nt(i, t);
|
|
@@ -7510,7 +7510,7 @@ const N = class N {
|
|
|
7510
7510
|
} catch (t) {
|
|
7511
7511
|
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), y.warn(
|
|
7512
7512
|
"Haori",
|
|
7513
|
-
`${e}Storage が利用できないため ${
|
|
7513
|
+
`${e}Storage が利用できないため ${l.prefix}store を無効にします:`,
|
|
7514
7514
|
t
|
|
7515
7515
|
)), null;
|
|
7516
7516
|
}
|
|
@@ -7576,7 +7576,7 @@ const N = class N {
|
|
|
7576
7576
|
* @returns 宣言内容。宣言が無い、または無効な場合は null
|
|
7577
7577
|
*/
|
|
7578
7578
|
static readDeclaration(e) {
|
|
7579
|
-
const t = e.getTarget(), r = e.getRawAttribute(`${
|
|
7579
|
+
const t = e.getTarget(), r = e.getRawAttribute(`${l.prefix}store`);
|
|
7580
7580
|
if (r === null)
|
|
7581
7581
|
return null;
|
|
7582
7582
|
const i = r.trim();
|
|
@@ -7584,38 +7584,38 @@ const N = class N {
|
|
|
7584
7584
|
return N.warnOnce(
|
|
7585
7585
|
t,
|
|
7586
7586
|
"key",
|
|
7587
|
-
`${
|
|
7587
|
+
`${l.prefix}store にストレージキーが指定されていません。`
|
|
7588
7588
|
), null;
|
|
7589
7589
|
if (i.includes("{{"))
|
|
7590
7590
|
return N.warnOnce(
|
|
7591
7591
|
t,
|
|
7592
7592
|
"expression",
|
|
7593
|
-
`${
|
|
7593
|
+
`${l.prefix}store に式は使用できません(静的な文字列を指定してください): ${i}`
|
|
7594
7594
|
), null;
|
|
7595
|
-
const n = e.getRawAttribute(`${
|
|
7595
|
+
const n = e.getRawAttribute(`${l.prefix}store-type`);
|
|
7596
7596
|
let s = "session";
|
|
7597
7597
|
if (n !== null) {
|
|
7598
7598
|
const d = n.trim();
|
|
7599
7599
|
d === "local" || d === "session" ? s = d : N.warnOnce(
|
|
7600
7600
|
t,
|
|
7601
7601
|
"type",
|
|
7602
|
-
`${
|
|
7602
|
+
`${l.prefix}store-type は session または local を指定してください(session として扱います): ${d}`
|
|
7603
7603
|
);
|
|
7604
7604
|
}
|
|
7605
|
-
const a = e.getRawAttribute(`${
|
|
7605
|
+
const a = e.getRawAttribute(`${l.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), c = e.getRawAttribute(`${l.prefix}store-params`);
|
|
7606
7606
|
let u = null;
|
|
7607
|
-
if (
|
|
7608
|
-
const d =
|
|
7609
|
-
|
|
7607
|
+
if (c !== null) {
|
|
7608
|
+
const d = c.split("&").map((p) => p.trim()).filter((p) => p !== ""), g = d.filter((p) => !N.isReservedKey(p));
|
|
7609
|
+
g.length !== d.length && N.warnOnce(
|
|
7610
7610
|
t,
|
|
7611
7611
|
"reserved",
|
|
7612
|
-
`${
|
|
7613
|
-
), u =
|
|
7612
|
+
`${l.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
7613
|
+
), u = g.length > 0 ? g : null;
|
|
7614
7614
|
}
|
|
7615
7615
|
return u === null && o === null ? (N.warnOnce(
|
|
7616
7616
|
t,
|
|
7617
7617
|
"target",
|
|
7618
|
-
`${
|
|
7618
|
+
`${l.prefix}store には ${l.prefix}store-params または ${l.prefix}store-arg のいずれかが必要です。`
|
|
7619
7619
|
), null) : { key: i, kind: s, params: u, arg: o };
|
|
7620
7620
|
}
|
|
7621
7621
|
/**
|
|
@@ -7814,7 +7814,7 @@ const N = class N {
|
|
|
7814
7814
|
return N.warnOnce(
|
|
7815
7815
|
r,
|
|
7816
7816
|
"each-row",
|
|
7817
|
-
`${
|
|
7817
|
+
`${l.prefix}each の行の内側では ${l.prefix}store を使用できません(行データは親要素側で配列キーを指定してください)。`
|
|
7818
7818
|
), Promise.resolve();
|
|
7819
7819
|
N.RESTORED_ELEMENTS.add(r);
|
|
7820
7820
|
const i = N.readRecord(t), n = i ? N.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
@@ -7894,11 +7894,11 @@ const N = class N {
|
|
|
7894
7894
|
*/
|
|
7895
7895
|
static reseedDeclaringElements(e, t) {
|
|
7896
7896
|
document.querySelectorAll(
|
|
7897
|
-
`[${
|
|
7897
|
+
`[${l.prefix}store]`
|
|
7898
7898
|
).forEach((i) => {
|
|
7899
7899
|
if (!N.RESTORED_ELEMENTS.has(i))
|
|
7900
7900
|
return;
|
|
7901
|
-
const n =
|
|
7901
|
+
const n = x.get(i);
|
|
7902
7902
|
if (!(n instanceof I))
|
|
7903
7903
|
return;
|
|
7904
7904
|
const s = N.readDeclaration(n);
|
|
@@ -7952,7 +7952,7 @@ class ht {
|
|
|
7952
7952
|
}
|
|
7953
7953
|
}
|
|
7954
7954
|
}
|
|
7955
|
-
const
|
|
7955
|
+
const xt = [
|
|
7956
7956
|
"addErrorMessage",
|
|
7957
7957
|
"clearMessages",
|
|
7958
7958
|
"closeDialog",
|
|
@@ -7963,15 +7963,15 @@ const Ct = [
|
|
|
7963
7963
|
], kt = "__haoriHistoryState__", Pe = "data-haori-click-lock";
|
|
7964
7964
|
function De() {
|
|
7965
7965
|
const e = globalThis.window?.Haori;
|
|
7966
|
-
return
|
|
7966
|
+
return xt.every(
|
|
7967
7967
|
(r) => typeof e?.[r] == "function"
|
|
7968
7968
|
) ? e : ye;
|
|
7969
7969
|
}
|
|
7970
|
-
const
|
|
7970
|
+
const Ct = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
7971
7971
|
function Be(m) {
|
|
7972
|
-
return
|
|
7972
|
+
return Ct.has(m.toUpperCase());
|
|
7973
7973
|
}
|
|
7974
|
-
function
|
|
7974
|
+
function Mt(m, e) {
|
|
7975
7975
|
for (const [t, r] of Object.entries(e))
|
|
7976
7976
|
r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
|
|
7977
7977
|
m.append(t, fe(i));
|
|
@@ -7990,7 +7990,7 @@ function fe(m) {
|
|
|
7990
7990
|
}
|
|
7991
7991
|
function pt(m, e) {
|
|
7992
7992
|
const t = new URL(m, window.location.href), r = new URLSearchParams(t.search);
|
|
7993
|
-
return
|
|
7993
|
+
return Mt(r, e), t.search = r.toString(), t.toString();
|
|
7994
7994
|
}
|
|
7995
7995
|
function $t(m) {
|
|
7996
7996
|
if (m == null)
|
|
@@ -8065,7 +8065,7 @@ function Pt(m) {
|
|
|
8065
8065
|
}
|
|
8066
8066
|
function Lt(m, e) {
|
|
8067
8067
|
const t = { ...e || {} }, r = (t.method || "GET").toUpperCase();
|
|
8068
|
-
if (
|
|
8068
|
+
if (l.runtime !== "demo" || Be(r))
|
|
8069
8069
|
return {
|
|
8070
8070
|
url: m,
|
|
8071
8071
|
options: t,
|
|
@@ -8079,7 +8079,7 @@ function Lt(m, e) {
|
|
|
8079
8079
|
let s = m;
|
|
8080
8080
|
Object.keys(i).length > 0 && (s = pt(s, i)), n && y.warn(
|
|
8081
8081
|
"Haori",
|
|
8082
|
-
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${
|
|
8082
|
+
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${l.prefix}{event}-data / ${l.prefix}{event}-form, or use the embedded runtime.`
|
|
8083
8083
|
), delete t.body, t.method = "GET";
|
|
8084
8084
|
const a = new Headers(
|
|
8085
8085
|
t.headers || void 0
|
|
@@ -8173,7 +8173,7 @@ const b = class b {
|
|
|
8173
8173
|
* 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
|
|
8174
8174
|
*/
|
|
8175
8175
|
static attrName(e, t, r = !1) {
|
|
8176
|
-
return e ? `${
|
|
8176
|
+
return e ? `${l.prefix}${e}-${t}` : r ? `${l.prefix}fetch-${t}` : `${l.prefix}${t}`;
|
|
8177
8177
|
}
|
|
8178
8178
|
/**
|
|
8179
8179
|
* bind より後で使うアクション属性を読み取り、開始時の評価情報を記録します。
|
|
@@ -8286,11 +8286,11 @@ const b = class b {
|
|
|
8286
8286
|
return { value: e.replace(
|
|
8287
8287
|
b.DATA_PLACEHOLDER_REGEX,
|
|
8288
8288
|
(n, s, a, o) => {
|
|
8289
|
-
const
|
|
8289
|
+
const c = Q.evaluateDetailed(
|
|
8290
8290
|
s ?? a ?? "",
|
|
8291
8291
|
t
|
|
8292
8292
|
);
|
|
8293
|
-
return r = r ||
|
|
8293
|
+
return r = r || c.unresolvedReference, b.isJsonStringContext(e, o) ? b.stringifyJsonTemplateStringContent(c.value) : b.stringifyJsonTemplateValue(c.value);
|
|
8294
8294
|
}
|
|
8295
8295
|
), hasUnresolvedReference: r };
|
|
8296
8296
|
}
|
|
@@ -8327,13 +8327,13 @@ const b = class b {
|
|
|
8327
8327
|
hasUnresolvedReference: s
|
|
8328
8328
|
};
|
|
8329
8329
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
8330
|
-
const
|
|
8330
|
+
const c = b.resolveDataJsonStringDetailed(
|
|
8331
8331
|
r,
|
|
8332
8332
|
e.getBindingData()
|
|
8333
8333
|
);
|
|
8334
8334
|
return {
|
|
8335
|
-
value: B.parseDataBind(
|
|
8336
|
-
hasUnresolvedReference: s ||
|
|
8335
|
+
value: B.parseDataBind(c.value),
|
|
8336
|
+
hasUnresolvedReference: s || c.hasUnresolvedReference
|
|
8337
8337
|
};
|
|
8338
8338
|
}
|
|
8339
8339
|
const o = b.resolveDataParamStringDetailed(
|
|
@@ -8357,8 +8357,8 @@ const b = class b {
|
|
|
8357
8357
|
targetFragment: e
|
|
8358
8358
|
}, i = t ? b.attrName(t, "if") : b.attrName(null, "if", !0);
|
|
8359
8359
|
if (e.hasAttribute(i)) {
|
|
8360
|
-
const
|
|
8361
|
-
typeof
|
|
8360
|
+
const A = e.getRawAttribute(i);
|
|
8361
|
+
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) : y.warn(
|
|
8362
8362
|
"Haori",
|
|
8363
8363
|
`${i} に条件式が指定されていません。`
|
|
8364
8364
|
);
|
|
@@ -8371,12 +8371,12 @@ const b = class b {
|
|
|
8371
8371
|
b.attrName(t, "form")
|
|
8372
8372
|
);
|
|
8373
8373
|
if (S) {
|
|
8374
|
-
const
|
|
8374
|
+
const C = z.query(
|
|
8375
8375
|
S,
|
|
8376
8376
|
b.attrName(t, "form")
|
|
8377
8377
|
);
|
|
8378
|
-
|
|
8379
|
-
|
|
8378
|
+
C !== null ? r.formFragment = F.getFormFragment(
|
|
8379
|
+
x.get(C)
|
|
8380
8380
|
) : y.error(
|
|
8381
8381
|
"Haori",
|
|
8382
8382
|
`Form element not found: ${S} (${b.attrName(t, "form")})`
|
|
@@ -8384,9 +8384,9 @@ const b = class b {
|
|
|
8384
8384
|
} else
|
|
8385
8385
|
r.formFragment = F.getFormFragment(e);
|
|
8386
8386
|
} else (t === "change" || t === "input") && (r.formFragment = F.getFormFragment(e), r.formFragment === null && b.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
8387
|
-
if (e.hasAttribute(`${
|
|
8387
|
+
if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
|
|
8388
8388
|
const S = e.getRawAttribute(
|
|
8389
|
-
`${
|
|
8389
|
+
`${l.prefix}${t}-before-run`
|
|
8390
8390
|
);
|
|
8391
8391
|
try {
|
|
8392
8392
|
r.beforeCallback = new Function(
|
|
@@ -8397,16 +8397,16 @@ const b = class b {
|
|
|
8397
8397
|
${S}
|
|
8398
8398
|
`
|
|
8399
8399
|
);
|
|
8400
|
-
} catch (
|
|
8401
|
-
y.error("Haori", `Invalid before script: ${
|
|
8400
|
+
} catch (C) {
|
|
8401
|
+
y.error("Haori", `Invalid before script: ${C}`);
|
|
8402
8402
|
}
|
|
8403
8403
|
}
|
|
8404
|
-
const
|
|
8405
|
-
if (e.hasAttribute(
|
|
8406
|
-
const S = String(e.getAttribute(
|
|
8407
|
-
let
|
|
8404
|
+
const A = b.attrName(t, "run");
|
|
8405
|
+
if (e.hasAttribute(A)) {
|
|
8406
|
+
const S = String(e.getAttribute(A) ?? "");
|
|
8407
|
+
let C = null;
|
|
8408
8408
|
try {
|
|
8409
|
-
|
|
8409
|
+
C = new Function(
|
|
8410
8410
|
"event",
|
|
8411
8411
|
`"use strict"; return (
|
|
8412
8412
|
${S}
|
|
@@ -8414,70 +8414,70 @@ ${S}
|
|
|
8414
8414
|
);
|
|
8415
8415
|
} catch {
|
|
8416
8416
|
try {
|
|
8417
|
-
|
|
8417
|
+
C = new Function("event", `"use strict";
|
|
8418
8418
|
${S}
|
|
8419
8419
|
`);
|
|
8420
8420
|
} catch (V) {
|
|
8421
8421
|
y.error("Haori", `Invalid run script: ${V}`);
|
|
8422
8422
|
}
|
|
8423
8423
|
}
|
|
8424
|
-
|
|
8424
|
+
C && (r.runScript = C);
|
|
8425
8425
|
}
|
|
8426
8426
|
}
|
|
8427
8427
|
const n = b.attrName(t, "fetch"), s = e.hasAttribute(n);
|
|
8428
8428
|
if (s) {
|
|
8429
|
-
const
|
|
8430
|
-
|
|
8429
|
+
const A = e.getAttributeEvaluation(n);
|
|
8430
|
+
A && (r.fetchHasUnresolvedReference = A.hasUnresolvedReference, r.fetchUrl = A.hasUnresolvedReference ? null : A.value);
|
|
8431
8431
|
}
|
|
8432
8432
|
const a = {};
|
|
8433
8433
|
if (t) {
|
|
8434
|
-
const
|
|
8435
|
-
if (e.hasAttribute(
|
|
8436
|
-
const S = e.getAttributeEvaluation(
|
|
8434
|
+
const A = b.attrName(t, "fetch-method");
|
|
8435
|
+
if (e.hasAttribute(A)) {
|
|
8436
|
+
const S = e.getAttributeEvaluation(A);
|
|
8437
8437
|
S?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = S?.value;
|
|
8438
8438
|
}
|
|
8439
8439
|
} else {
|
|
8440
|
-
const
|
|
8441
|
-
if (e.hasAttribute(
|
|
8440
|
+
const A = b.attrName(null, "method", !0);
|
|
8441
|
+
if (e.hasAttribute(A)) {
|
|
8442
8442
|
const S = e.getAttributeEvaluation(
|
|
8443
|
-
|
|
8443
|
+
A
|
|
8444
8444
|
);
|
|
8445
8445
|
S?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = S?.value;
|
|
8446
8446
|
}
|
|
8447
8447
|
}
|
|
8448
8448
|
if (t) {
|
|
8449
|
-
const
|
|
8450
|
-
if (e.hasAttribute(
|
|
8449
|
+
const A = b.attrName(t, "fetch-headers");
|
|
8450
|
+
if (e.hasAttribute(A)) {
|
|
8451
8451
|
const S = e.getRawAttribute(
|
|
8452
|
-
|
|
8452
|
+
A
|
|
8453
8453
|
);
|
|
8454
8454
|
try {
|
|
8455
8455
|
a.headers = B.parseDataBind(S);
|
|
8456
|
-
} catch (
|
|
8457
|
-
y.error("Haori", `Invalid fetch headers: ${
|
|
8456
|
+
} catch (C) {
|
|
8457
|
+
y.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8458
8458
|
}
|
|
8459
8459
|
}
|
|
8460
8460
|
} else {
|
|
8461
|
-
const
|
|
8461
|
+
const A = b.attrName(
|
|
8462
8462
|
null,
|
|
8463
8463
|
"headers",
|
|
8464
8464
|
!0
|
|
8465
8465
|
);
|
|
8466
|
-
if (e.hasAttribute(
|
|
8466
|
+
if (e.hasAttribute(A)) {
|
|
8467
8467
|
const S = e.getRawAttribute(
|
|
8468
|
-
|
|
8468
|
+
A
|
|
8469
8469
|
);
|
|
8470
8470
|
try {
|
|
8471
8471
|
a.headers = B.parseDataBind(S);
|
|
8472
|
-
} catch (
|
|
8473
|
-
y.error("Haori", `Invalid fetch headers: ${
|
|
8472
|
+
} catch (C) {
|
|
8473
|
+
y.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8474
8474
|
}
|
|
8475
8475
|
}
|
|
8476
8476
|
}
|
|
8477
8477
|
if (t) {
|
|
8478
|
-
const
|
|
8479
|
-
if (e.hasAttribute(
|
|
8480
|
-
const S = e.getAttributeEvaluation(
|
|
8478
|
+
const A = b.attrName(t, "fetch-content-type");
|
|
8479
|
+
if (e.hasAttribute(A)) {
|
|
8480
|
+
const S = e.getAttributeEvaluation(A);
|
|
8481
8481
|
S?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), a.headers = {
|
|
8482
8482
|
...a.headers,
|
|
8483
8483
|
"Content-Type": S?.value
|
|
@@ -8493,13 +8493,13 @@ ${S}
|
|
|
8493
8493
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
8494
8494
|
});
|
|
8495
8495
|
} else {
|
|
8496
|
-
const
|
|
8496
|
+
const A = b.attrName(
|
|
8497
8497
|
null,
|
|
8498
8498
|
"content-type",
|
|
8499
8499
|
!0
|
|
8500
8500
|
);
|
|
8501
|
-
if (e.hasAttribute(
|
|
8502
|
-
const S = e.getAttributeEvaluation(
|
|
8501
|
+
if (e.hasAttribute(A)) {
|
|
8502
|
+
const S = e.getAttributeEvaluation(A);
|
|
8503
8503
|
S?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), a.headers = {
|
|
8504
8504
|
...a.headers,
|
|
8505
8505
|
"Content-Type": S?.value
|
|
@@ -8518,58 +8518,58 @@ ${S}
|
|
|
8518
8518
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
8519
8519
|
const o = t ? b.attrName(t, "bind") : b.attrName(null, "bind", !0);
|
|
8520
8520
|
if (e.hasAttribute(o)) {
|
|
8521
|
-
const
|
|
8522
|
-
if (
|
|
8523
|
-
const S = z.queryAll(
|
|
8524
|
-
S.length > 0 ? (r.bindFragments = [], S.forEach((
|
|
8525
|
-
const V =
|
|
8521
|
+
const A = z.read(e, o);
|
|
8522
|
+
if (A) {
|
|
8523
|
+
const S = z.queryAll(A, o);
|
|
8524
|
+
S.length > 0 ? (r.bindFragments = [], S.forEach((C) => {
|
|
8525
|
+
const V = x.get(C);
|
|
8526
8526
|
V && r.bindFragments.push(V);
|
|
8527
8527
|
})) : y.error(
|
|
8528
8528
|
"Haori",
|
|
8529
|
-
`Bind element not found: ${
|
|
8529
|
+
`Bind element not found: ${A} (${o})`
|
|
8530
8530
|
);
|
|
8531
8531
|
}
|
|
8532
8532
|
}
|
|
8533
|
-
const
|
|
8534
|
-
t ? e.hasAttribute(
|
|
8533
|
+
const c = b.attrName(t, "bind-arg"), u = b.attrName(null, "arg", !0), d = b.attrName(null, "bind-arg", !0);
|
|
8534
|
+
t ? e.hasAttribute(c) && (r.bindArg = e.getRawAttribute(c)) : e.hasAttribute(u) ? r.bindArg = e.getRawAttribute(
|
|
8535
8535
|
u
|
|
8536
8536
|
) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
|
|
8537
|
-
const
|
|
8538
|
-
if (e.hasAttribute(p)) {
|
|
8539
|
-
const E = e.getRawAttribute(p);
|
|
8540
|
-
r.bindParams = E.split("&").map((S) => S.trim());
|
|
8541
|
-
}
|
|
8542
|
-
const g = t ? b.attrName(t, "bind-append") : b.attrName(null, "bind-append", !0);
|
|
8537
|
+
const g = t ? b.attrName(t, "bind-params") : b.attrName(null, "bind-params", !0);
|
|
8543
8538
|
if (e.hasAttribute(g)) {
|
|
8544
|
-
const
|
|
8545
|
-
r.
|
|
8539
|
+
const A = e.getRawAttribute(g);
|
|
8540
|
+
r.bindParams = A.split("&").map((S) => S.trim());
|
|
8546
8541
|
}
|
|
8547
|
-
const
|
|
8548
|
-
e.hasAttribute(
|
|
8542
|
+
const p = t ? b.attrName(t, "bind-append") : b.attrName(null, "bind-append", !0);
|
|
8543
|
+
if (e.hasAttribute(p)) {
|
|
8544
|
+
const A = e.getRawAttribute(p);
|
|
8545
|
+
r.bindAppendParams = A.split("&").map((S) => S.trim()).filter(Boolean);
|
|
8546
|
+
}
|
|
8547
|
+
const E = t ? b.attrName(t, "bind-merge") : b.attrName(null, "bind-merge", !0);
|
|
8548
|
+
e.hasAttribute(E) && (r.bindMerge = !0);
|
|
8549
8549
|
const v = t ? b.attrName(t, "bind-transform") : b.attrName(null, "bind-transform", !0);
|
|
8550
8550
|
e.hasAttribute(v) && (r.bindTransform = e.getRawAttribute(v));
|
|
8551
8551
|
const D = t ? b.attrName(t, "copy-params") : null;
|
|
8552
8552
|
if (D && e.hasAttribute(D)) {
|
|
8553
|
-
const
|
|
8554
|
-
r.copyParams =
|
|
8553
|
+
const A = e.getRawAttribute(D);
|
|
8554
|
+
r.copyParams = A.split("&").map((S) => S.trim()).filter(Boolean);
|
|
8555
8555
|
}
|
|
8556
8556
|
if (t) {
|
|
8557
8557
|
if (e.hasAttribute(b.attrName(t, "adjust"))) {
|
|
8558
|
-
const
|
|
8558
|
+
const M = z.read(
|
|
8559
8559
|
e,
|
|
8560
8560
|
b.attrName(t, "adjust")
|
|
8561
8561
|
);
|
|
8562
|
-
if (
|
|
8562
|
+
if (M) {
|
|
8563
8563
|
const q = z.queryAll(
|
|
8564
|
-
|
|
8564
|
+
M,
|
|
8565
8565
|
b.attrName(t, "adjust")
|
|
8566
8566
|
);
|
|
8567
8567
|
q.length > 0 ? (r.adjustFragments = [], q.forEach((X) => {
|
|
8568
|
-
const Y =
|
|
8568
|
+
const Y = x.get(X);
|
|
8569
8569
|
Y && r.adjustFragments.push(Y);
|
|
8570
8570
|
})) : y.error(
|
|
8571
8571
|
"Haori",
|
|
8572
|
-
`Adjust element not found: ${
|
|
8572
|
+
`Adjust element not found: ${M} (${b.attrName(t, "adjust")})`
|
|
8573
8573
|
);
|
|
8574
8574
|
}
|
|
8575
8575
|
if (e.hasAttribute(b.attrName(t, "adjust-value"))) {
|
|
@@ -8579,16 +8579,16 @@ ${S}
|
|
|
8579
8579
|
isNaN(X) || (r.adjustValue = X);
|
|
8580
8580
|
}
|
|
8581
8581
|
}
|
|
8582
|
-
if (e.hasAttribute(b.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(b.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(b.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(b.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${
|
|
8583
|
-
const
|
|
8584
|
-
`${
|
|
8582
|
+
if (e.hasAttribute(b.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(b.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(b.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(b.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
|
|
8583
|
+
const M = e.getRawAttribute(
|
|
8584
|
+
`${l.prefix}${t}-after-run`
|
|
8585
8585
|
);
|
|
8586
8586
|
try {
|
|
8587
8587
|
r.afterCallback = new Function(
|
|
8588
8588
|
"response",
|
|
8589
8589
|
`
|
|
8590
8590
|
"use strict";
|
|
8591
|
-
${
|
|
8591
|
+
${M}
|
|
8592
8592
|
`
|
|
8593
8593
|
);
|
|
8594
8594
|
} catch (q) {
|
|
@@ -8609,32 +8609,32 @@ ${x}
|
|
|
8609
8609
|
"toast",
|
|
8610
8610
|
b.attrName(t, "toast")
|
|
8611
8611
|
);
|
|
8612
|
-
const
|
|
8612
|
+
const M = e.getRawAttribute(
|
|
8613
8613
|
b.attrName(t, "toast-level")
|
|
8614
|
-
), X = ["info", "warning", "error", "success"].includes(
|
|
8615
|
-
r.toastLevel = X ?
|
|
8614
|
+
), X = ["info", "warning", "error", "success"].includes(M);
|
|
8615
|
+
r.toastLevel = X ? M : null;
|
|
8616
8616
|
}
|
|
8617
|
-
const
|
|
8618
|
-
if (
|
|
8617
|
+
const A = b.attrName(t, "redirect"), S = b.attrName(t, "redirect-replace"), C = e.hasAttribute(A), V = e.hasAttribute(S);
|
|
8618
|
+
if (C && (r.redirectUrl = b.readLateAttribute(
|
|
8619
8619
|
e,
|
|
8620
8620
|
r,
|
|
8621
8621
|
"redirect",
|
|
8622
|
-
|
|
8622
|
+
A
|
|
8623
8623
|
)), V && (r.redirectReplaceUrl = b.readLateAttribute(
|
|
8624
8624
|
e,
|
|
8625
8625
|
r,
|
|
8626
8626
|
"redirect-replace",
|
|
8627
8627
|
S
|
|
8628
|
-
)),
|
|
8629
|
-
const
|
|
8628
|
+
)), C || V) {
|
|
8629
|
+
const M = b.attrName(
|
|
8630
8630
|
t,
|
|
8631
8631
|
"redirect-return-param"
|
|
8632
8632
|
);
|
|
8633
|
-
e.hasAttribute(
|
|
8633
|
+
e.hasAttribute(M) && (r.redirectReturnParam = b.readLateAttribute(
|
|
8634
8634
|
e,
|
|
8635
8635
|
r,
|
|
8636
8636
|
"redirect-return-param",
|
|
8637
|
-
|
|
8637
|
+
M
|
|
8638
8638
|
));
|
|
8639
8639
|
}
|
|
8640
8640
|
if (e.hasAttribute(b.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(b.attrName(t, "scroll")) && (r.scrollTarget = b.readLateAttribute(
|
|
@@ -8648,20 +8648,20 @@ ${x}
|
|
|
8648
8648
|
"history",
|
|
8649
8649
|
b.attrName(t, "history")
|
|
8650
8650
|
)), e.hasAttribute(b.attrName(t, "history-data")) && (r.historyDataAttrName = b.attrName(t, "history-data")), e.hasAttribute(b.attrName(t, "history-form"))) {
|
|
8651
|
-
const
|
|
8651
|
+
const M = z.read(
|
|
8652
8652
|
e,
|
|
8653
8653
|
b.attrName(t, "history-form")
|
|
8654
8654
|
);
|
|
8655
|
-
if (
|
|
8655
|
+
if (M) {
|
|
8656
8656
|
const q = z.query(
|
|
8657
|
-
|
|
8657
|
+
M,
|
|
8658
8658
|
b.attrName(t, "history-form")
|
|
8659
8659
|
);
|
|
8660
8660
|
q !== null ? r.historyFormFragment = F.getFormFragment(
|
|
8661
|
-
|
|
8661
|
+
x.get(q)
|
|
8662
8662
|
) : y.error(
|
|
8663
8663
|
"Haori",
|
|
8664
|
-
`Form element not found: ${
|
|
8664
|
+
`Form element not found: ${M} (${b.attrName(t, "history-form")})`
|
|
8665
8665
|
);
|
|
8666
8666
|
} else
|
|
8667
8667
|
r.historyFormFragment = F.getFormFragment(e);
|
|
@@ -8674,23 +8674,23 @@ ${x}
|
|
|
8674
8674
|
"copy",
|
|
8675
8675
|
"open",
|
|
8676
8676
|
"close"
|
|
8677
|
-
].forEach((
|
|
8678
|
-
const q = b.attrName(t,
|
|
8677
|
+
].forEach((M) => {
|
|
8678
|
+
const q = b.attrName(t, M);
|
|
8679
8679
|
if (!e.hasAttribute(q))
|
|
8680
8680
|
return;
|
|
8681
8681
|
const X = z.read(e, q), Y = [];
|
|
8682
8682
|
if (X)
|
|
8683
8683
|
z.queryAll(X, q).forEach((be) => {
|
|
8684
|
-
const ue =
|
|
8684
|
+
const ue = x.get(be);
|
|
8685
8685
|
ue && Y.push(ue);
|
|
8686
8686
|
}), Y.length === 0 && y.error("Haori", `Element not found: ${X} (${q})`);
|
|
8687
|
-
else if (
|
|
8687
|
+
else if (M === "open" || M === "close") {
|
|
8688
8688
|
const te = e.getTarget().closest("dialog");
|
|
8689
|
-
te ? Y.push(
|
|
8689
|
+
te ? Y.push(x.get(te)) : y.error("Haori", `Ancestor <dialog> not found (${q})`);
|
|
8690
8690
|
} else
|
|
8691
8691
|
Y.push(e);
|
|
8692
8692
|
if (Y.length > 0)
|
|
8693
|
-
switch (
|
|
8693
|
+
switch (M) {
|
|
8694
8694
|
case "reset-before":
|
|
8695
8695
|
r.resetBeforeFragments = Y;
|
|
8696
8696
|
break;
|
|
@@ -8716,57 +8716,57 @@ ${x}
|
|
|
8716
8716
|
});
|
|
8717
8717
|
const _ = b.attrName(t, "copy-source");
|
|
8718
8718
|
if (e.hasAttribute(_)) {
|
|
8719
|
-
const
|
|
8720
|
-
if (
|
|
8721
|
-
const q = z.query(
|
|
8719
|
+
const M = z.read(e, _);
|
|
8720
|
+
if (M) {
|
|
8721
|
+
const q = z.query(M, _);
|
|
8722
8722
|
if (q !== null) {
|
|
8723
|
-
const X =
|
|
8723
|
+
const X = x.get(q);
|
|
8724
8724
|
X ? r.copySourceFragment = X : y.error(
|
|
8725
8725
|
"Haori",
|
|
8726
|
-
`Element is not managed by Haori: ${
|
|
8726
|
+
`Element is not managed by Haori: ${M} (${_})`
|
|
8727
8727
|
);
|
|
8728
8728
|
} else
|
|
8729
8729
|
y.error(
|
|
8730
8730
|
"Haori",
|
|
8731
|
-
`Element not found: ${
|
|
8731
|
+
`Element not found: ${M} (${_})`
|
|
8732
8732
|
);
|
|
8733
8733
|
} else
|
|
8734
8734
|
r.copySourceFragment = e;
|
|
8735
8735
|
}
|
|
8736
8736
|
}
|
|
8737
8737
|
if (!t && (e.hasAttribute(b.attrName(null, "data", !0)) && (r.dataAttrName = b.attrName(null, "data", !0)), e.hasAttribute(b.attrName(null, "form", !0)))) {
|
|
8738
|
-
const
|
|
8738
|
+
const A = z.read(
|
|
8739
8739
|
e,
|
|
8740
8740
|
b.attrName(null, "form", !0)
|
|
8741
8741
|
);
|
|
8742
|
-
if (
|
|
8742
|
+
if (A) {
|
|
8743
8743
|
const S = z.query(
|
|
8744
|
-
|
|
8744
|
+
A,
|
|
8745
8745
|
b.attrName(null, "form", !0)
|
|
8746
8746
|
);
|
|
8747
8747
|
S !== null ? r.formFragment = F.getFormFragment(
|
|
8748
|
-
|
|
8748
|
+
x.get(S)
|
|
8749
8749
|
) : y.error(
|
|
8750
8750
|
"Haori",
|
|
8751
|
-
`Form element not found: ${
|
|
8751
|
+
`Form element not found: ${A} (${b.attrName(null, "fetch-form", !0)})`
|
|
8752
8752
|
);
|
|
8753
8753
|
} else
|
|
8754
8754
|
r.formFragment = F.getFormFragment(e);
|
|
8755
8755
|
}
|
|
8756
8756
|
const k = t ? b.attrName(t, "fetch-state") : b.attrName(null, "state", !0);
|
|
8757
8757
|
if (e.hasAttribute(k)) {
|
|
8758
|
-
const
|
|
8759
|
-
|
|
8760
|
-
const P =
|
|
8758
|
+
const A = z.read(e, k), S = [];
|
|
8759
|
+
A ? (z.queryAll(A, k).forEach((V) => {
|
|
8760
|
+
const P = x.get(V);
|
|
8761
8761
|
P && S.push(P);
|
|
8762
8762
|
}), S.length === 0 && y.error(
|
|
8763
8763
|
"Haori",
|
|
8764
|
-
`Element not found: ${
|
|
8764
|
+
`Element not found: ${A} (${k})`
|
|
8765
8765
|
)) : S.push(e), S.length > 0 && (r.fetchStateFragments = S);
|
|
8766
8766
|
}
|
|
8767
8767
|
const H = t ? b.attrName(t, "store-clear") : b.attrName(null, "store-clear", !0);
|
|
8768
8768
|
if (e.hasAttribute(H)) {
|
|
8769
|
-
const
|
|
8769
|
+
const A = e.getRawAttribute(H), S = A === null ? "" : A.trim();
|
|
8770
8770
|
if (S === "")
|
|
8771
8771
|
y.error(
|
|
8772
8772
|
"Haori",
|
|
@@ -8774,9 +8774,9 @@ ${x}
|
|
|
8774
8774
|
);
|
|
8775
8775
|
else {
|
|
8776
8776
|
r.storeClearKey = S;
|
|
8777
|
-
const
|
|
8777
|
+
const C = e.getRawAttribute(
|
|
8778
8778
|
`${H}-type`
|
|
8779
|
-
), V =
|
|
8779
|
+
), V = C === null ? "session" : C.trim();
|
|
8780
8780
|
V === "local" || V === "session" ? r.storeClearKind = V : (y.warn(
|
|
8781
8781
|
"Haori",
|
|
8782
8782
|
`${H}-type は session または local を指定してください(session として扱います): ${V}`
|
|
@@ -8805,7 +8805,7 @@ ${x}
|
|
|
8805
8805
|
];
|
|
8806
8806
|
for (const i of r) {
|
|
8807
8807
|
const n = i.getParent();
|
|
8808
|
-
!n || !n.hasAttribute(`${
|
|
8808
|
+
!n || !n.hasAttribute(`${l.prefix}each`) || !n.hasAttribute(`${l.prefix}form-list`) || t.set(
|
|
8809
8809
|
i,
|
|
8810
8810
|
b.getRowFragments(n).includes(i) ? n : null
|
|
8811
8811
|
);
|
|
@@ -8822,7 +8822,7 @@ ${x}
|
|
|
8822
8822
|
*/
|
|
8823
8823
|
static isNamedInputFragment(e) {
|
|
8824
8824
|
const t = e.getTarget();
|
|
8825
|
-
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${
|
|
8825
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${l.prefix}form-name`) : !1;
|
|
8826
8826
|
}
|
|
8827
8827
|
/**
|
|
8828
8828
|
* ElementFragment の構造的タイプガード。
|
|
@@ -8881,26 +8881,26 @@ ${x}
|
|
|
8881
8881
|
try {
|
|
8882
8882
|
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || (!this.options.formFragment && this.options.targetFragment && F.warnUnvalidatedCustomValidity(
|
|
8883
8883
|
F.getFormFragment(this.options.targetFragment),
|
|
8884
|
-
`${
|
|
8884
|
+
`${l.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
8885
8885
|
), !this.evaluateExecutionCondition()))
|
|
8886
8886
|
return !1;
|
|
8887
8887
|
if (this.options.runScript) {
|
|
8888
|
-
const
|
|
8888
|
+
const g = this.options.targetFragment?.getTarget() ?? null;
|
|
8889
8889
|
try {
|
|
8890
|
-
const
|
|
8891
|
-
|
|
8890
|
+
const p = this.options.runScript.call(
|
|
8891
|
+
g,
|
|
8892
8892
|
this.domEvent
|
|
8893
8893
|
);
|
|
8894
|
-
|
|
8895
|
-
} catch (
|
|
8896
|
-
y.error("Haori", `Run script execution error: ${
|
|
8894
|
+
p === !1 && this.domEvent && this.domEvent.preventDefault(), p != null && typeof p.then == "function" && await p;
|
|
8895
|
+
} catch (p) {
|
|
8896
|
+
y.error("Haori", `Run script execution error: ${p}`);
|
|
8897
8897
|
}
|
|
8898
8898
|
}
|
|
8899
8899
|
if (!await this.confirm())
|
|
8900
8900
|
return !1;
|
|
8901
8901
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
8902
8902
|
this.options.resetBeforeFragments.map(
|
|
8903
|
-
(
|
|
8903
|
+
(g) => F.reset(g, this.operationSequence)
|
|
8904
8904
|
)
|
|
8905
8905
|
), this.captureHistorySnapshots());
|
|
8906
8906
|
const r = this.prepareFetchRequest();
|
|
@@ -8908,50 +8908,50 @@ ${x}
|
|
|
8908
8908
|
const i = r.payload;
|
|
8909
8909
|
let n = r.url, s = r.options, a = !1, o = !1;
|
|
8910
8910
|
if (this.options.beforeCallback) {
|
|
8911
|
-
const
|
|
8911
|
+
const g = this.options.beforeCallback(
|
|
8912
8912
|
n || null,
|
|
8913
8913
|
s || null
|
|
8914
8914
|
);
|
|
8915
|
-
if (
|
|
8916
|
-
if (
|
|
8915
|
+
if (g != null) {
|
|
8916
|
+
if (g === !1 || typeof g == "object" && g.stop)
|
|
8917
8917
|
return !1;
|
|
8918
|
-
typeof
|
|
8918
|
+
typeof g == "object" && (a = "fetchUrl" in g, o = "fetchOptions" in g, n = a ? g.fetchUrl : n, s = o ? g.fetchOptions : s);
|
|
8919
8919
|
}
|
|
8920
8920
|
}
|
|
8921
|
-
const
|
|
8921
|
+
const c = Object.keys(i).length > 0;
|
|
8922
8922
|
if (n) {
|
|
8923
|
-
const
|
|
8924
|
-
|
|
8923
|
+
const g = (s?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && Pt(s) && !Be(g) ? r.baseUrl ?? n : n, v = Lt(
|
|
8924
|
+
E,
|
|
8925
8925
|
s
|
|
8926
8926
|
);
|
|
8927
8927
|
n = v.url;
|
|
8928
|
-
const D = { ...v.options }, k = v.normalized ? v.requestedMethod : r.requestedMethod, H = v.effectiveMethod,
|
|
8929
|
-
if (
|
|
8930
|
-
runtime:
|
|
8928
|
+
const D = { ...v.options }, k = v.normalized ? v.requestedMethod : r.requestedMethod, H = v.effectiveMethod, A = r.transportMode === "query-get" || v.normalized, S = v.queryString ?? r.queryString;
|
|
8929
|
+
if (A && y.info("Haori demo fetch normalization", {
|
|
8930
|
+
runtime: l.runtime,
|
|
8931
8931
|
requestedMethod: k,
|
|
8932
8932
|
effectiveMethod: H,
|
|
8933
8933
|
transportMode: "query-get",
|
|
8934
8934
|
url: n,
|
|
8935
|
-
payload:
|
|
8935
|
+
payload: c ? i : void 0,
|
|
8936
8936
|
queryString: S
|
|
8937
8937
|
}), this.options.targetFragment && n) {
|
|
8938
|
-
const
|
|
8939
|
-
runtime:
|
|
8938
|
+
const C = performance.now(), V = {
|
|
8939
|
+
runtime: l.runtime,
|
|
8940
8940
|
requestedMethod: k,
|
|
8941
8941
|
effectiveMethod: H,
|
|
8942
|
-
transportMode:
|
|
8943
|
-
...
|
|
8942
|
+
transportMode: A ? "query-get" : "http",
|
|
8943
|
+
...A ? { queryString: S } : {}
|
|
8944
8944
|
};
|
|
8945
8945
|
return O.fetchStart(
|
|
8946
8946
|
this.options.targetFragment.getTarget(),
|
|
8947
8947
|
n,
|
|
8948
8948
|
D,
|
|
8949
|
-
|
|
8949
|
+
c ? i : void 0,
|
|
8950
8950
|
V
|
|
8951
8951
|
), await this.injectFetchState("loading"), await fetch(n, D).then((P) => this.handleFetchResult(
|
|
8952
8952
|
P,
|
|
8953
8953
|
n || void 0,
|
|
8954
|
-
|
|
8954
|
+
C
|
|
8955
8955
|
)).catch(async (P) => {
|
|
8956
8956
|
throw n && O.fetchError(
|
|
8957
8957
|
this.options.targetFragment.getTarget(),
|
|
@@ -8964,36 +8964,36 @@ ${x}
|
|
|
8964
8964
|
), P;
|
|
8965
8965
|
});
|
|
8966
8966
|
}
|
|
8967
|
-
return await fetch(n, D).then((
|
|
8967
|
+
return await fetch(n, D).then((C) => this.handleFetchResult(C, n || void 0));
|
|
8968
8968
|
}
|
|
8969
|
-
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment &&
|
|
8970
|
-
const
|
|
8971
|
-
e && e.appliedDisabledAttribute && this.options.targetFragment &&
|
|
8972
|
-
const v =
|
|
8969
|
+
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
|
|
8970
|
+
const g = this.options.formFragment, p = g.getTarget(), E = /* @__PURE__ */ new Set();
|
|
8971
|
+
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
8972
|
+
const v = g.getRawBindingData(), D = Oe(i), k = g.getAttribute(`${l.prefix}form-arg`);
|
|
8973
8973
|
let H;
|
|
8974
8974
|
if (k) {
|
|
8975
8975
|
H = { ...v ?? {} };
|
|
8976
|
-
const
|
|
8977
|
-
H[
|
|
8978
|
-
(S ? S.value : H[
|
|
8976
|
+
const A = String(k), S = F.resolveAncestorArgOwner(g, A);
|
|
8977
|
+
H[A] = F.mergeCollectedValues(
|
|
8978
|
+
(S ? S.value : H[A]) ?? null,
|
|
8979
8979
|
D
|
|
8980
8980
|
);
|
|
8981
8981
|
} else
|
|
8982
8982
|
H = F.mergeCollectedValues(v, D);
|
|
8983
|
-
await B.setBindingData(
|
|
8984
|
-
skipFragments:
|
|
8983
|
+
await B.setBindingData(p, H, {
|
|
8984
|
+
skipFragments: E,
|
|
8985
8985
|
kind: "nonSupply",
|
|
8986
8986
|
sequence: this.operationSequence,
|
|
8987
8987
|
editedPaths: F.collectEditedPaths(
|
|
8988
|
-
|
|
8988
|
+
g,
|
|
8989
8989
|
this.operationSequence,
|
|
8990
8990
|
k ? String(k) : "",
|
|
8991
8991
|
D
|
|
8992
8992
|
)
|
|
8993
8993
|
});
|
|
8994
8994
|
}
|
|
8995
|
-
this.suppressEmptyReplaceBind = !
|
|
8996
|
-
const u =
|
|
8995
|
+
this.suppressEmptyReplaceBind = !c && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input"), this.twoWayCommitBind = this.eventType === "change" || this.eventType === "input";
|
|
8996
|
+
const u = c ? Oe(i) : {}, d = new Response(JSON.stringify(u), {
|
|
8997
8997
|
headers: { "Content-Type": "application/json" }
|
|
8998
8998
|
});
|
|
8999
8999
|
return await this.handleFetchResult(d);
|
|
@@ -9012,7 +9012,7 @@ ${x}
|
|
|
9012
9012
|
const t = this.options.targetFragment.getTarget();
|
|
9013
9013
|
if (b.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Pe))
|
|
9014
9014
|
return !1;
|
|
9015
|
-
const r = t.hasAttribute(`${
|
|
9015
|
+
const r = t.hasAttribute(`${l.prefix}click-no-disabled`);
|
|
9016
9016
|
return b.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Pe, ""), r || t.setAttribute("disabled", ""), {
|
|
9017
9017
|
target: t,
|
|
9018
9018
|
appliedDisabledAttribute: !r
|
|
@@ -9050,36 +9050,36 @@ ${x}
|
|
|
9050
9050
|
e.status,
|
|
9051
9051
|
r
|
|
9052
9052
|
), this.options.afterCallback) {
|
|
9053
|
-
const
|
|
9054
|
-
if (
|
|
9055
|
-
if (
|
|
9053
|
+
const p = this.options.afterCallback(e);
|
|
9054
|
+
if (p != null) {
|
|
9055
|
+
if (p === !1 || typeof p == "object" && p.stop)
|
|
9056
9056
|
return !1;
|
|
9057
|
-
typeof
|
|
9057
|
+
typeof p == "object" && "response" in p && (e = "response" in p ? p.response : e);
|
|
9058
9058
|
}
|
|
9059
9059
|
}
|
|
9060
9060
|
const n = [];
|
|
9061
9061
|
n.push(this.bindResult(e)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), await this.injectFetchState("success", e.status, null), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
9062
9062
|
this.options.resetFragments.map(
|
|
9063
|
-
(
|
|
9063
|
+
(p) => F.reset(p, this.operationSequence)
|
|
9064
9064
|
)
|
|
9065
9065
|
), await this.copy();
|
|
9066
9066
|
const s = [];
|
|
9067
|
-
if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((
|
|
9068
|
-
s.push(new b(
|
|
9067
|
+
if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((p) => {
|
|
9068
|
+
s.push(new b(p, null).run());
|
|
9069
9069
|
}), this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
9070
|
-
for (const
|
|
9071
|
-
await B.evaluateAll(
|
|
9072
|
-
const
|
|
9073
|
-
typeof
|
|
9070
|
+
for (const p of this.options.clickFragments) {
|
|
9071
|
+
await B.evaluateAll(p);
|
|
9072
|
+
const E = p.getTarget();
|
|
9073
|
+
typeof E.click == "function" ? E.click() : E.dispatchEvent(
|
|
9074
9074
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
9075
9075
|
);
|
|
9076
9076
|
}
|
|
9077
|
-
this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((
|
|
9078
|
-
const
|
|
9079
|
-
|
|
9080
|
-
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((
|
|
9081
|
-
const
|
|
9082
|
-
|
|
9077
|
+
this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((p) => {
|
|
9078
|
+
const E = p.getTarget();
|
|
9079
|
+
E instanceof HTMLElement ? s.push(i.openDialog(E)) : y.error("Haori", "Element is not an HTML element: ", E);
|
|
9080
|
+
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((p) => {
|
|
9081
|
+
const E = p.getTarget();
|
|
9082
|
+
E instanceof HTMLElement ? s.push(i.closeDialog(E)) : y.error("Haori", "Element is not an HTML element: ", E);
|
|
9083
9083
|
}), await Promise.all(s);
|
|
9084
9084
|
const a = b.unescapeNewlines(
|
|
9085
9085
|
this.resolveLateAttribute("dialog", this.options.dialogMessage)
|
|
@@ -9090,12 +9090,12 @@ ${x}
|
|
|
9090
9090
|
this.options.toastMessage
|
|
9091
9091
|
);
|
|
9092
9092
|
o && await i.toast(o, this.options.toastLevel ?? "info"), this.clearStore(), this.pushHistory();
|
|
9093
|
-
const
|
|
9093
|
+
const c = this.resolveLateAttribute(
|
|
9094
9094
|
"scroll",
|
|
9095
9095
|
this.options.scrollTarget
|
|
9096
9096
|
);
|
|
9097
|
-
|
|
9098
|
-
|
|
9097
|
+
c && z.query(
|
|
9098
|
+
c,
|
|
9099
9099
|
b.attrName(this.eventType, "scroll"),
|
|
9100
9100
|
document
|
|
9101
9101
|
)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
@@ -9110,24 +9110,24 @@ ${x}
|
|
|
9110
9110
|
"Haori",
|
|
9111
9111
|
`${b.attrName(this.eventType, "redirect")} と ${b.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
9112
9112
|
);
|
|
9113
|
-
const
|
|
9114
|
-
if (
|
|
9115
|
-
let
|
|
9116
|
-
const
|
|
9113
|
+
const g = d || u;
|
|
9114
|
+
if (g) {
|
|
9115
|
+
let p = g;
|
|
9116
|
+
const E = this.resolveLateAttribute(
|
|
9117
9117
|
"redirect-return-param",
|
|
9118
9118
|
this.options.redirectReturnParam
|
|
9119
9119
|
);
|
|
9120
|
-
if (
|
|
9121
|
-
const D = new URLSearchParams(window.location.search).get(
|
|
9120
|
+
if (E) {
|
|
9121
|
+
const D = new URLSearchParams(window.location.search).get(E);
|
|
9122
9122
|
if (D !== null) {
|
|
9123
9123
|
const k = D.trim();
|
|
9124
|
-
ht.isSafeLocalPath(k) ?
|
|
9124
|
+
ht.isSafeLocalPath(k) ? p = k : y.warn(
|
|
9125
9125
|
"Haori",
|
|
9126
9126
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${D}`
|
|
9127
9127
|
);
|
|
9128
9128
|
}
|
|
9129
9129
|
}
|
|
9130
|
-
d ? window.location.replace(
|
|
9130
|
+
d ? window.location.replace(p) : window.location.href = p;
|
|
9131
9131
|
}
|
|
9132
9132
|
return !0;
|
|
9133
9133
|
}
|
|
@@ -9183,11 +9183,11 @@ ${x}
|
|
|
9183
9183
|
y.error("Haori", u);
|
|
9184
9184
|
return;
|
|
9185
9185
|
}
|
|
9186
|
-
const
|
|
9187
|
-
for (const [d,
|
|
9188
|
-
|
|
9186
|
+
const c = (u) => {
|
|
9187
|
+
for (const [d, g] of Object.entries(u))
|
|
9188
|
+
g != null && (Array.isArray(g) ? g.forEach((p) => o.searchParams.append(d, String(p))) : typeof g == "object" ? o.searchParams.set(d, JSON.stringify(g)) : o.searchParams.set(d, String(g)));
|
|
9189
9189
|
};
|
|
9190
|
-
n &&
|
|
9190
|
+
n && c(r), s && c(i), history.pushState(
|
|
9191
9191
|
{ [kt]: !0 },
|
|
9192
9192
|
"",
|
|
9193
9193
|
o.toString()
|
|
@@ -9217,40 +9217,40 @@ ${x}
|
|
|
9217
9217
|
try {
|
|
9218
9218
|
const a = await e.json(), o = [];
|
|
9219
9219
|
if (Array.isArray(a)) {
|
|
9220
|
-
const
|
|
9220
|
+
const c = /* @__PURE__ */ new Map(), u = [];
|
|
9221
9221
|
for (const d of a)
|
|
9222
9222
|
if (d && typeof d == "object" && !Array.isArray(d)) {
|
|
9223
|
-
const
|
|
9223
|
+
const g = d.key, p = d.message, E = typeof g == "string" && g.length > 0 ? g : null, v = typeof p == "string" ? p : p != null ? String(p) : "";
|
|
9224
9224
|
if (v.length === 0)
|
|
9225
9225
|
continue;
|
|
9226
|
-
if (
|
|
9227
|
-
const D =
|
|
9228
|
-
D.push(v),
|
|
9226
|
+
if (E !== null) {
|
|
9227
|
+
const D = c.get(E) ?? [];
|
|
9228
|
+
D.push(v), c.set(E, D);
|
|
9229
9229
|
} else
|
|
9230
9230
|
u.push(v);
|
|
9231
9231
|
} else typeof d == "string" && d.length > 0 && u.push(d);
|
|
9232
|
-
for (const [d,
|
|
9233
|
-
o.push({ key: d, message:
|
|
9232
|
+
for (const [d, g] of c)
|
|
9233
|
+
o.push({ key: d, message: g.join(`
|
|
9234
9234
|
`) });
|
|
9235
9235
|
for (const d of u)
|
|
9236
9236
|
o.push({ message: d });
|
|
9237
9237
|
} else if (a && typeof a == "object") {
|
|
9238
9238
|
if (typeof a.message == "string" && o.push({ message: a.message }), Array.isArray(a.messages))
|
|
9239
|
-
for (const
|
|
9240
|
-
typeof
|
|
9239
|
+
for (const c of a.messages)
|
|
9240
|
+
typeof c == "string" && o.push({ message: c });
|
|
9241
9241
|
if (a.errors && typeof a.errors == "object")
|
|
9242
|
-
for (const [
|
|
9243
|
-
Array.isArray(u) ? o.push({ key:
|
|
9244
|
-
`) }) : typeof u == "string" ? o.push({ key:
|
|
9242
|
+
for (const [c, u] of Object.entries(a.errors))
|
|
9243
|
+
Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9244
|
+
`) }) : typeof u == "string" ? o.push({ key: c, message: u }) : u != null && o.push({ key: c, message: String(u) });
|
|
9245
9245
|
if (o.length === 0)
|
|
9246
|
-
for (const [
|
|
9247
|
-
|
|
9248
|
-
`) }) : typeof u == "string" && o.push({ key:
|
|
9246
|
+
for (const [c, u] of Object.entries(a))
|
|
9247
|
+
c === "message" || c === "messages" || c === "errors" || (Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9248
|
+
`) }) : typeof u == "string" && o.push({ key: c, message: u }));
|
|
9249
9249
|
}
|
|
9250
9250
|
if (o.length === 0)
|
|
9251
9251
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
9252
|
-
for (const
|
|
9253
|
-
|
|
9252
|
+
for (const c of o)
|
|
9253
|
+
c.key && t ? await F.addErrorMessage(t, c.key, c.message) : await i(c.message);
|
|
9254
9254
|
return n(), !1;
|
|
9255
9255
|
} catch {
|
|
9256
9256
|
}
|
|
@@ -9273,7 +9273,7 @@ ${x}
|
|
|
9273
9273
|
if (this.options.valid !== !0)
|
|
9274
9274
|
return F.warnUnvalidatedCustomValidity(
|
|
9275
9275
|
e,
|
|
9276
|
-
`${
|
|
9276
|
+
`${l.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
9277
9277
|
), !0;
|
|
9278
9278
|
F.applyCustomValidity(e);
|
|
9279
9279
|
const t = this.findFirstInvalid(e);
|
|
@@ -9366,7 +9366,7 @@ ${x}
|
|
|
9366
9366
|
const r = this.options.targetFragment;
|
|
9367
9367
|
if (!r)
|
|
9368
9368
|
return !0;
|
|
9369
|
-
const i = this.options.conditionAttributeName ?? `${
|
|
9369
|
+
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n = F.buildConditionScope(
|
|
9370
9370
|
r,
|
|
9371
9371
|
this.options.formFragment ?? null
|
|
9372
9372
|
), s = Q.evaluateDetailed(t, n);
|
|
@@ -9386,7 +9386,7 @@ ${x}
|
|
|
9386
9386
|
* @returns 最初の invalid 要素、なければ null
|
|
9387
9387
|
*/
|
|
9388
9388
|
findFirstInvalid(e) {
|
|
9389
|
-
if (e.getTarget().hasAttribute(`${
|
|
9389
|
+
if (e.getTarget().hasAttribute(`${l.prefix}if-false`))
|
|
9390
9390
|
return null;
|
|
9391
9391
|
let t = null;
|
|
9392
9392
|
for (const r of e.getChildElementFragments().reverse()) {
|
|
@@ -9439,41 +9439,41 @@ ${x}
|
|
|
9439
9439
|
}
|
|
9440
9440
|
if (this.options.bindParams) {
|
|
9441
9441
|
const o = {};
|
|
9442
|
-
this.options.bindParams.forEach((
|
|
9443
|
-
i && typeof i == "object" &&
|
|
9442
|
+
this.options.bindParams.forEach((c) => {
|
|
9443
|
+
i && typeof i == "object" && c in i && (o[c] = i[c]);
|
|
9444
9444
|
}), i = o;
|
|
9445
9445
|
}
|
|
9446
9446
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
9447
9447
|
y.warn(
|
|
9448
9448
|
"Haori",
|
|
9449
|
-
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${
|
|
9449
|
+
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${l.prefix}${this.eventType}-form.`
|
|
9450
9450
|
);
|
|
9451
9451
|
return;
|
|
9452
9452
|
}
|
|
9453
9453
|
const n = [], s = this.eventType ? b.attrName(this.eventType, "bind") : b.attrName(null, "bind", !0), a = [];
|
|
9454
9454
|
if (this.options.bindArg)
|
|
9455
9455
|
this.options.bindFragments.forEach((o) => {
|
|
9456
|
-
const
|
|
9457
|
-
if (
|
|
9456
|
+
const c = this.resolveRowWrite(o, s);
|
|
9457
|
+
if (c.kind === "skip")
|
|
9458
9458
|
return;
|
|
9459
|
-
if (
|
|
9460
|
-
const
|
|
9459
|
+
if (c.kind === "row") {
|
|
9460
|
+
const g = this.options.bindArg;
|
|
9461
9461
|
a.push({
|
|
9462
|
-
container:
|
|
9462
|
+
container: c.container,
|
|
9463
9463
|
row: o,
|
|
9464
9464
|
attributeName: s,
|
|
9465
9465
|
syncWhenUnchanged: "reflect",
|
|
9466
|
-
apply: (
|
|
9467
|
-
const
|
|
9466
|
+
apply: (p) => {
|
|
9467
|
+
const E = this.resolveCurrentRowItem(o, p), v = { ...E };
|
|
9468
9468
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
9469
|
-
const D =
|
|
9470
|
-
v[
|
|
9469
|
+
const D = E[g], k = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
|
|
9470
|
+
v[g] = this.mergeAppendBindingData(
|
|
9471
9471
|
o,
|
|
9472
9472
|
i,
|
|
9473
9473
|
k
|
|
9474
9474
|
);
|
|
9475
9475
|
} else
|
|
9476
|
-
v[
|
|
9476
|
+
v[g] = i;
|
|
9477
9477
|
return this.reconcileRowUserEdits(o, v);
|
|
9478
9478
|
}
|
|
9479
9479
|
});
|
|
@@ -9481,11 +9481,11 @@ ${x}
|
|
|
9481
9481
|
}
|
|
9482
9482
|
const u = { ...o.getRawBindingData() ?? {} }, d = this.options.bindArg;
|
|
9483
9483
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
9484
|
-
const
|
|
9484
|
+
const g = u[d], p = g && typeof g == "object" && !Array.isArray(g) ? g : {};
|
|
9485
9485
|
u[d] = this.mergeAppendBindingData(
|
|
9486
9486
|
o,
|
|
9487
9487
|
i,
|
|
9488
|
-
|
|
9488
|
+
p
|
|
9489
9489
|
);
|
|
9490
9490
|
} else
|
|
9491
9491
|
u[d] = i;
|
|
@@ -9523,21 +9523,21 @@ ${x}
|
|
|
9523
9523
|
);
|
|
9524
9524
|
} else
|
|
9525
9525
|
this.options.bindFragments.forEach((o) => {
|
|
9526
|
-
const
|
|
9527
|
-
if (
|
|
9526
|
+
const c = this.resolveRowWrite(o, s);
|
|
9527
|
+
if (c.kind === "skip")
|
|
9528
9528
|
return;
|
|
9529
|
-
if (
|
|
9529
|
+
if (c.kind === "row") {
|
|
9530
9530
|
a.push({
|
|
9531
|
-
container:
|
|
9531
|
+
container: c.container,
|
|
9532
9532
|
row: o,
|
|
9533
9533
|
attributeName: s,
|
|
9534
9534
|
syncWhenUnchanged: "reflect",
|
|
9535
|
-
apply: (
|
|
9536
|
-
const
|
|
9535
|
+
apply: (g) => {
|
|
9536
|
+
const p = this.options.bindMerge ? this.resolveCurrentRowItem(o, g) : g, E = this.mergeAppendBindingData(
|
|
9537
9537
|
o,
|
|
9538
9538
|
i,
|
|
9539
|
-
|
|
9540
|
-
), v = this.options.bindMerge ? { ...
|
|
9539
|
+
p
|
|
9540
|
+
), v = this.options.bindMerge ? { ...p, ...E } : E;
|
|
9541
9541
|
return this.reconcileRowUserEdits(o, v);
|
|
9542
9542
|
}
|
|
9543
9543
|
});
|
|
@@ -9562,8 +9562,8 @@ ${x}
|
|
|
9562
9562
|
});
|
|
9563
9563
|
return n.push(this.applyRowWrites(a)), Promise.all(n).then(() => {
|
|
9564
9564
|
const o = this.options.bindArg ?? null;
|
|
9565
|
-
this.options.bindFragments.forEach((
|
|
9566
|
-
O.bindComplete(
|
|
9565
|
+
this.options.bindFragments.forEach((c) => {
|
|
9566
|
+
O.bindComplete(c.getTarget(), o);
|
|
9567
9567
|
});
|
|
9568
9568
|
});
|
|
9569
9569
|
});
|
|
@@ -9616,10 +9616,10 @@ ${x}
|
|
|
9616
9616
|
);
|
|
9617
9617
|
if (Object.keys(n).length === 0)
|
|
9618
9618
|
return t;
|
|
9619
|
-
const s = e.getAttribute(`${
|
|
9619
|
+
const s = e.getAttribute(`${l.prefix}form-arg`);
|
|
9620
9620
|
if (s) {
|
|
9621
|
-
const a = String(s), o = t[a],
|
|
9622
|
-
return { ...t, [a]: ae(
|
|
9621
|
+
const a = String(s), o = t[a], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9622
|
+
return { ...t, [a]: ae(c, n) };
|
|
9623
9623
|
}
|
|
9624
9624
|
return ae(t, n);
|
|
9625
9625
|
}
|
|
@@ -9672,8 +9672,8 @@ ${x}
|
|
|
9672
9672
|
const a = F.getValuesEditedAfter(n, r);
|
|
9673
9673
|
if (Object.keys(a).length === 0)
|
|
9674
9674
|
continue;
|
|
9675
|
-
const o = i[s],
|
|
9676
|
-
i = { ...i, [s]: ae(
|
|
9675
|
+
const o = i[s], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9676
|
+
i = { ...i, [s]: ae(c, a) };
|
|
9677
9677
|
}
|
|
9678
9678
|
return i;
|
|
9679
9679
|
}
|
|
@@ -9707,7 +9707,7 @@ ${x}
|
|
|
9707
9707
|
row: s,
|
|
9708
9708
|
attributeName: r,
|
|
9709
9709
|
syncWhenUnchanged: "supply",
|
|
9710
|
-
apply: (
|
|
9710
|
+
apply: (c) => this.applyCopyToRowItem(s, c, t)
|
|
9711
9711
|
});
|
|
9712
9712
|
return;
|
|
9713
9713
|
}
|
|
@@ -9841,34 +9841,34 @@ ${x}
|
|
|
9841
9841
|
let i = this.options.fetchUrl;
|
|
9842
9842
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
9843
9843
|
n.headers || void 0
|
|
9844
|
-
), a = (n.method || "GET").toUpperCase(), o =
|
|
9845
|
-
if (n.method =
|
|
9844
|
+
), a = (n.method || "GET").toUpperCase(), o = l.runtime === "demo" && !Be(a), c = o ? "GET" : a;
|
|
9845
|
+
if (n.method = c, Object.keys(t).length > 0 && Se(t)) {
|
|
9846
9846
|
const d = s.get("Content-Type") || "";
|
|
9847
|
-
|
|
9847
|
+
c !== "GET" && c !== "HEAD" && c !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Ot(t) && y.warn(
|
|
9848
9848
|
"Haori",
|
|
9849
|
-
`A File value nested under ${
|
|
9849
|
+
`A File value nested under ${l.prefix}form-object / ${l.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
9850
9850
|
) : y.warn(
|
|
9851
9851
|
"Haori",
|
|
9852
|
-
`A File value cannot be sent without ${
|
|
9852
|
+
`A File value cannot be sent without ${l.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
9853
9853
|
);
|
|
9854
9854
|
}
|
|
9855
|
-
if (
|
|
9855
|
+
if (c === "GET" || c === "HEAD" || c === "OPTIONS")
|
|
9856
9856
|
Object.keys(t).length > 0 && (i = pt(i, t));
|
|
9857
9857
|
else if (Object.keys(t).length > 0) {
|
|
9858
9858
|
const d = s.get("Content-Type") || "";
|
|
9859
9859
|
if (/multipart\/form-data/i.test(d)) {
|
|
9860
9860
|
s.delete("Content-Type");
|
|
9861
|
-
const
|
|
9862
|
-
for (const [
|
|
9863
|
-
|
|
9864
|
-
v instanceof Blob ?
|
|
9865
|
-
}) :
|
|
9866
|
-
n.body =
|
|
9861
|
+
const g = new FormData();
|
|
9862
|
+
for (const [p, E] of Object.entries(t))
|
|
9863
|
+
E == null ? g.append(p, "") : E instanceof Blob ? g.append(p, E) : Array.isArray(E) ? E.forEach((v) => {
|
|
9864
|
+
v instanceof Blob ? g.append(p, v) : g.append(p, fe(v));
|
|
9865
|
+
}) : g.append(p, fe(E));
|
|
9866
|
+
n.body = g;
|
|
9867
9867
|
} else if (/application\/x-www-form-urlencoded/i.test(d)) {
|
|
9868
|
-
const
|
|
9869
|
-
for (const [
|
|
9870
|
-
|
|
9871
|
-
n.body =
|
|
9868
|
+
const g = new URLSearchParams();
|
|
9869
|
+
for (const [p, E] of Object.entries(t))
|
|
9870
|
+
E !== void 0 && (Array.isArray(E) ? E.forEach((v) => g.append(p, fe(v))) : g.append(p, fe(E)));
|
|
9871
|
+
n.body = g;
|
|
9872
9872
|
} else
|
|
9873
9873
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
9874
9874
|
}
|
|
@@ -9881,7 +9881,7 @@ ${x}
|
|
|
9881
9881
|
payload: t,
|
|
9882
9882
|
hasUnresolvedReference: !1,
|
|
9883
9883
|
requestedMethod: a,
|
|
9884
|
-
effectiveMethod:
|
|
9884
|
+
effectiveMethod: c,
|
|
9885
9885
|
queryString: u,
|
|
9886
9886
|
transportMode: o ? "query-get" : "http",
|
|
9887
9887
|
signature: Ut(i, n)
|
|
@@ -9966,7 +9966,7 @@ ${x}
|
|
|
9966
9966
|
if (!this.options.targetFragment)
|
|
9967
9967
|
return y.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
9968
9968
|
const e = this.options.targetFragment.closestByAttribute(
|
|
9969
|
-
`${
|
|
9969
|
+
`${l.prefix}row`
|
|
9970
9970
|
);
|
|
9971
9971
|
return e || (y.error("Haori", "Row fragment not found."), null);
|
|
9972
9972
|
}
|
|
@@ -9993,10 +9993,10 @@ ${x}
|
|
|
9993
9993
|
"Haori",
|
|
9994
9994
|
`Row container not found: ${i} (${r})`
|
|
9995
9995
|
), null;
|
|
9996
|
-
const a =
|
|
9997
|
-
return a instanceof I ? a.hasAttribute(`${
|
|
9996
|
+
const a = x.get(s);
|
|
9997
|
+
return a instanceof I ? a.hasAttribute(`${l.prefix}each`) ? a : (y.error(
|
|
9998
9998
|
"Haori",
|
|
9999
|
-
`Row container must have ${
|
|
9999
|
+
`Row container must have ${l.prefix}each: ${i} (${r})`
|
|
10000
10000
|
), null) : (y.error(
|
|
10001
10001
|
"Haori",
|
|
10002
10002
|
`Row container is not initialized: ${i} (${r})`
|
|
@@ -10006,50 +10006,57 @@ ${x}
|
|
|
10006
10006
|
return n ? n.getParent() : null;
|
|
10007
10007
|
}
|
|
10008
10008
|
/**
|
|
10009
|
-
*
|
|
10009
|
+
* 行操作の書き戻し先となる配列と、その所有者を解決します。
|
|
10010
10010
|
*
|
|
10011
10011
|
* `data-each` の式を単純な識別子パス(`contracts` / `form.contracts` など)と
|
|
10012
10012
|
* みなし、根の識別子を持つ最も近い祖先(自身を含む)のバインディングデータを
|
|
10013
10013
|
* 所有者として扱います。関数呼び出しや演算を含む式は書き戻し先を一意に決められ
|
|
10014
|
-
* ないため、エラーログを出して null
|
|
10014
|
+
* ないため、エラーログを出して null を返します。ただし `data-each-array` で
|
|
10015
|
+
* 書き戻し先を宣言している場合は、`data-each` の式ではなくその宣言を解決します。
|
|
10015
10016
|
*
|
|
10016
10017
|
* @param container `data-each` コンテナのフラグメント
|
|
10017
|
-
* @returns
|
|
10018
|
+
* @returns 所有者・所有者データ・配列・経路と、表示位置と配列の位置が一致しない
|
|
10019
|
+
* (`data-each-array` による宣言)かどうか。解決できない場合は null
|
|
10018
10020
|
*/
|
|
10019
10021
|
static resolveEachArray(e) {
|
|
10020
|
-
const t = e.getRawAttribute(`${
|
|
10022
|
+
const t = e.getRawAttribute(`${l.prefix}each`);
|
|
10021
10023
|
if (t === null)
|
|
10022
|
-
return y.error("Haori", `Row container has no ${
|
|
10023
|
-
const r = t.trim().split(".");
|
|
10024
|
-
if (!(
|
|
10024
|
+
return y.error("Haori", `Row container has no ${l.prefix}each expression.`), null;
|
|
10025
|
+
const r = e.getRawAttribute(`${l.prefix}each-array`), i = r !== null, n = i ? `${l.prefix}each-array` : `${l.prefix}each`, s = i ? r : t, a = s.trim().split(".");
|
|
10026
|
+
if (!(a.length > 0 && a.every((E) => /^[A-Za-z_$][\w$]*$/.test(E))))
|
|
10025
10027
|
return y.error(
|
|
10026
10028
|
"Haori",
|
|
10027
|
-
`Row operations require a plain identifier path for ${
|
|
10029
|
+
`Row operations require a plain identifier path for ${n} (got: ${s}).` + (i ? "" : ` Declare ${l.prefix}each-array to specify the array to write back to.`)
|
|
10028
10030
|
), null;
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10031
|
+
if (i && e.getRawAttribute(`${l.prefix}each-key`) === null)
|
|
10032
|
+
return y.error(
|
|
10033
|
+
"Haori",
|
|
10034
|
+
`${l.prefix}each-array requires ${l.prefix}each-key (${l.prefix}each-array="${s}").`
|
|
10035
|
+
), null;
|
|
10036
|
+
const c = b.resolveRowScopeBase(e, a[0]);
|
|
10037
|
+
let u, d, g;
|
|
10038
|
+
if (c)
|
|
10039
|
+
u = c.owner, d = c.ownerData, g = [...c.path, ...a.slice(1)];
|
|
10033
10040
|
else {
|
|
10034
|
-
for (
|
|
10035
|
-
const
|
|
10036
|
-
if (
|
|
10037
|
-
|
|
10041
|
+
for (u = e, d = null; u; ) {
|
|
10042
|
+
const E = u.getRawBindingData();
|
|
10043
|
+
if (E && a[0] in E && !b.isRowScopeKey(u, a[0])) {
|
|
10044
|
+
d = E;
|
|
10038
10045
|
break;
|
|
10039
10046
|
}
|
|
10040
|
-
|
|
10047
|
+
u = u.getParent();
|
|
10041
10048
|
}
|
|
10042
|
-
|
|
10049
|
+
g = a;
|
|
10043
10050
|
}
|
|
10044
|
-
if (!
|
|
10051
|
+
if (!u || !d)
|
|
10045
10052
|
return y.error(
|
|
10046
10053
|
"Haori",
|
|
10047
|
-
`Binding data owner not found for ${
|
|
10054
|
+
`Binding data owner not found for ${n}="${s}".`
|
|
10048
10055
|
), null;
|
|
10049
|
-
const
|
|
10050
|
-
return Array.isArray(
|
|
10056
|
+
const p = b.readPathValue(d, g);
|
|
10057
|
+
return Array.isArray(p) ? { owner: u, ownerData: d, array: p, path: g, mapped: i } : (y.error(
|
|
10051
10058
|
"Haori",
|
|
10052
|
-
`${
|
|
10059
|
+
`${n}="${s}" does not resolve to an array.`
|
|
10053
10060
|
), null);
|
|
10054
10061
|
}
|
|
10055
10062
|
/**
|
|
@@ -10068,13 +10075,13 @@ ${x}
|
|
|
10068
10075
|
static resolveRowScopeBase(e, t) {
|
|
10069
10076
|
let r = e;
|
|
10070
10077
|
for (; r; ) {
|
|
10071
|
-
const i = r.closestByAttribute(`${
|
|
10078
|
+
const i = r.closestByAttribute(`${l.prefix}row`);
|
|
10072
10079
|
if (!i)
|
|
10073
10080
|
return null;
|
|
10074
10081
|
const n = i.getParent();
|
|
10075
10082
|
if (!n)
|
|
10076
10083
|
return null;
|
|
10077
|
-
if (n.getAttribute(`${
|
|
10084
|
+
if (n.getAttribute(`${l.prefix}each-arg`) === t) {
|
|
10078
10085
|
const s = b.resolveEachArray(n);
|
|
10079
10086
|
if (!s)
|
|
10080
10087
|
return null;
|
|
@@ -10082,7 +10089,7 @@ ${x}
|
|
|
10082
10089
|
n,
|
|
10083
10090
|
i,
|
|
10084
10091
|
s.array,
|
|
10085
|
-
`${
|
|
10092
|
+
`${l.prefix}each="${n.getRawAttribute(`${l.prefix}each`)}"`
|
|
10086
10093
|
);
|
|
10087
10094
|
return a === null ? null : {
|
|
10088
10095
|
owner: s.owner,
|
|
@@ -10106,10 +10113,10 @@ ${x}
|
|
|
10106
10113
|
* @returns 行データ由来なら true
|
|
10107
10114
|
*/
|
|
10108
10115
|
static isRowScopeKey(e, t) {
|
|
10109
|
-
if (!e.hasAttribute(`${
|
|
10116
|
+
if (!e.hasAttribute(`${l.prefix}row`))
|
|
10110
10117
|
return !1;
|
|
10111
10118
|
const r = e.getParent();
|
|
10112
|
-
return r ? r.getAttribute(`${
|
|
10119
|
+
return r ? r.getAttribute(`${l.prefix}each-arg`) === t || r.getAttribute(`${l.prefix}each-index`) === t : !1;
|
|
10113
10120
|
}
|
|
10114
10121
|
/**
|
|
10115
10122
|
* 経路をたどって値を読み出します。
|
|
@@ -10146,8 +10153,8 @@ ${x}
|
|
|
10146
10153
|
const i = { ...e };
|
|
10147
10154
|
let n = i;
|
|
10148
10155
|
for (let s = 0; s < t.length - 1; s += 1) {
|
|
10149
|
-
const a = t[s], o = n[a],
|
|
10150
|
-
n[a] =
|
|
10156
|
+
const a = t[s], o = n[a], c = Array.isArray(o) ? o.slice() : { ...o };
|
|
10157
|
+
n[a] = c, n = c;
|
|
10151
10158
|
}
|
|
10152
10159
|
return n[t[t.length - 1]] = r, i;
|
|
10153
10160
|
}
|
|
@@ -10161,7 +10168,7 @@ ${x}
|
|
|
10161
10168
|
*/
|
|
10162
10169
|
static getRowFragments(e) {
|
|
10163
10170
|
return e.getChildElementFragments().filter(
|
|
10164
|
-
(t) => !t.hasAttribute(`${
|
|
10171
|
+
(t) => !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
10165
10172
|
);
|
|
10166
10173
|
}
|
|
10167
10174
|
/**
|
|
@@ -10183,10 +10190,10 @@ ${x}
|
|
|
10183
10190
|
const i = r.get(e) ?? null;
|
|
10184
10191
|
return i === null ? (y.warn(
|
|
10185
10192
|
"Haori",
|
|
10186
|
-
`Target is not a row of the ${
|
|
10193
|
+
`Target is not a row of the ${l.prefix}each container (${t}).`
|
|
10187
10194
|
), { kind: "skip" }) : b.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (y.warn(
|
|
10188
10195
|
"Haori",
|
|
10189
|
-
`The target row is no longer in the ${
|
|
10196
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${t}).`
|
|
10190
10197
|
), { kind: "skip" });
|
|
10191
10198
|
}
|
|
10192
10199
|
/**
|
|
@@ -10217,30 +10224,30 @@ ${x}
|
|
|
10217
10224
|
const d = b.resolveRowArrayIndex(u, a);
|
|
10218
10225
|
if (d === null)
|
|
10219
10226
|
continue;
|
|
10220
|
-
const
|
|
10221
|
-
if (
|
|
10227
|
+
const g = a[d];
|
|
10228
|
+
if (g === null || typeof g != "object" || Array.isArray(g)) {
|
|
10222
10229
|
y.warn(
|
|
10223
10230
|
"Haori",
|
|
10224
10231
|
`Row data is not an object; the write was skipped (${u.attributeName}).`
|
|
10225
10232
|
);
|
|
10226
10233
|
continue;
|
|
10227
10234
|
}
|
|
10228
|
-
const
|
|
10229
|
-
if (b.isSameRowItem(
|
|
10235
|
+
const p = u.apply(g);
|
|
10236
|
+
if (b.isSameRowItem(g, p)) {
|
|
10230
10237
|
u.syncWhenUnchanged && r.push(
|
|
10231
10238
|
b.syncUnchangedRowValues(
|
|
10232
10239
|
u.row,
|
|
10233
|
-
|
|
10240
|
+
p,
|
|
10234
10241
|
u.syncWhenUnchanged
|
|
10235
10242
|
)
|
|
10236
10243
|
);
|
|
10237
10244
|
continue;
|
|
10238
10245
|
}
|
|
10239
|
-
a[d] =
|
|
10246
|
+
a[d] = p, o = !0, u.syncWhenUnchanged === "supply" && F.clearRowUserEditMarksForChangedKeys(u.row, p);
|
|
10240
10247
|
}
|
|
10241
10248
|
if (!o)
|
|
10242
10249
|
return;
|
|
10243
|
-
const
|
|
10250
|
+
const c = B.setBindingData(
|
|
10244
10251
|
s.owner.getTarget(),
|
|
10245
10252
|
b.withPathValue(s.ownerData, s.path, a),
|
|
10246
10253
|
{
|
|
@@ -10257,12 +10264,12 @@ ${x}
|
|
|
10257
10264
|
}
|
|
10258
10265
|
);
|
|
10259
10266
|
if (B.isEachUpdateRunning(n)) {
|
|
10260
|
-
|
|
10267
|
+
c.catch((u) => {
|
|
10261
10268
|
y.error("Haori", "Failed to write row data.", u);
|
|
10262
10269
|
});
|
|
10263
10270
|
return;
|
|
10264
10271
|
}
|
|
10265
|
-
r.push(
|
|
10272
|
+
r.push(c);
|
|
10266
10273
|
}), Promise.all(r).then(() => {
|
|
10267
10274
|
});
|
|
10268
10275
|
}
|
|
@@ -10346,19 +10353,19 @@ ${x}
|
|
|
10346
10353
|
if (s === -1)
|
|
10347
10354
|
return y.warn(
|
|
10348
10355
|
"Haori",
|
|
10349
|
-
`The target row is no longer in the ${
|
|
10356
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${i}).`
|
|
10350
10357
|
), null;
|
|
10351
|
-
const a = e.getAttribute(`${
|
|
10358
|
+
const a = e.getAttribute(`${l.prefix}each-key`), o = t.getListKey();
|
|
10352
10359
|
if (a && o !== null) {
|
|
10353
|
-
const
|
|
10354
|
-
r.forEach((
|
|
10360
|
+
const c = [];
|
|
10361
|
+
r.forEach((g, p) => {
|
|
10355
10362
|
B.createListKey(
|
|
10356
|
-
|
|
10363
|
+
g,
|
|
10357
10364
|
String(a),
|
|
10358
|
-
|
|
10359
|
-
) === o &&
|
|
10365
|
+
p
|
|
10366
|
+
) === o && c.push(p);
|
|
10360
10367
|
});
|
|
10361
|
-
const u = n.slice(0, s).filter((
|
|
10368
|
+
const u = n.slice(0, s).filter((g) => g.getListKey() === o).length, d = c[u] ?? -1;
|
|
10362
10369
|
return d === -1 ? (y.warn(
|
|
10363
10370
|
"Haori",
|
|
10364
10371
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
@@ -10396,11 +10403,12 @@ ${x}
|
|
|
10396
10403
|
* @returns 処理結果のPromise
|
|
10397
10404
|
*/
|
|
10398
10405
|
movePrevRow() {
|
|
10399
|
-
return this.options.rowMovePrev !== !0 ? Promise.resolve() : this.spliceRows("row-prev", (e, t) => {
|
|
10400
|
-
|
|
10406
|
+
return this.options.rowMovePrev !== !0 ? Promise.resolve() : this.spliceRows("row-prev", (e, t, r) => {
|
|
10407
|
+
const i = r();
|
|
10408
|
+
if (i === null || t <= 0 || t >= e.length)
|
|
10401
10409
|
return !1;
|
|
10402
|
-
const [
|
|
10403
|
-
return e.splice(
|
|
10410
|
+
const [n] = e.splice(t, 1);
|
|
10411
|
+
return e.splice(i, 0, n), !0;
|
|
10404
10412
|
});
|
|
10405
10413
|
}
|
|
10406
10414
|
/**
|
|
@@ -10409,12 +10417,16 @@ ${x}
|
|
|
10409
10417
|
* @returns 処理結果のPromise
|
|
10410
10418
|
*/
|
|
10411
10419
|
moveNextRow() {
|
|
10412
|
-
return this.options.rowMoveNext !== !0 ? Promise.resolve() : this.spliceRows(
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10420
|
+
return this.options.rowMoveNext !== !0 ? Promise.resolve() : this.spliceRows(
|
|
10421
|
+
"row-next",
|
|
10422
|
+
(e, t, r, i) => {
|
|
10423
|
+
const n = i();
|
|
10424
|
+
if (n === null || t < 0 || t >= e.length - 1)
|
|
10425
|
+
return !1;
|
|
10426
|
+
const [s] = e.splice(t, 1);
|
|
10427
|
+
return e.splice(n, 0, s), !0;
|
|
10428
|
+
}
|
|
10429
|
+
);
|
|
10418
10430
|
}
|
|
10419
10431
|
/**
|
|
10420
10432
|
* `data-each` が参照する配列を書き換えて行を増減・並べ替えします。
|
|
@@ -10423,8 +10435,13 @@ ${x}
|
|
|
10423
10435
|
* `Core.setBindingData()` を適用します。DOM の行は差分更新で再描画されるため、
|
|
10424
10436
|
* DOM とバインディングデータが常に一致します。
|
|
10425
10437
|
*
|
|
10426
|
-
* `mutate` の第 2
|
|
10427
|
-
*
|
|
10438
|
+
* `mutate` の第 2 引数は操作対象の行に対応する配列のインデックス、第 3・第 4 引数は
|
|
10439
|
+
* 表示上の前後の行に対応するインデックスを返す関数(無ければ null を返す)です。
|
|
10440
|
+
* 属性値でコンテナを指定した場合(行の外に置いたボタン)は末尾の行を指し、
|
|
10441
|
+
* `row-add` では末尾へ追加されます。`data-each-array` を指定した場合、表示の並びと
|
|
10442
|
+
* 配列の並びは一致しないため、これらは `data-each-key` で対応付けた配列上の位置に
|
|
10443
|
+
* なります。前後の行の解決は関数越しにします。増減の操作では使わないため、
|
|
10444
|
+
* 対応する要素が無い隣の行について無関係な警告を出さないためです。
|
|
10428
10445
|
*
|
|
10429
10446
|
* @param attributeKey 属性のキー(`row-add` など)
|
|
10430
10447
|
* @param mutate 配列を書き換える関数。書き換えた場合は true を返す
|
|
@@ -10437,27 +10454,40 @@ ${x}
|
|
|
10437
10454
|
const i = b.resolveEachArray(r);
|
|
10438
10455
|
if (!i)
|
|
10439
10456
|
return Promise.reject(new Error("Row array not resolved."));
|
|
10440
|
-
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${
|
|
10441
|
-
|
|
10457
|
+
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${l.prefix}row`) : null, a = b.getRowFragments(r), o = s ? a.indexOf(s) : a.length - 1, c = (p) => p < 0 || p >= a.length ? null : i.mapped ? b.resolveRowIndex(
|
|
10458
|
+
r,
|
|
10459
|
+
a[p],
|
|
10460
|
+
i.array,
|
|
10461
|
+
b.attrName(this.eventType, e)
|
|
10462
|
+
) : p, u = o >= 0 ? c(o) : i.mapped ? i.array.length - 1 : o;
|
|
10463
|
+
if (u === null)
|
|
10464
|
+
return Promise.resolve();
|
|
10465
|
+
const d = i.array.slice();
|
|
10466
|
+
if (!t(
|
|
10467
|
+
d,
|
|
10468
|
+
u,
|
|
10469
|
+
() => c(o - 1),
|
|
10470
|
+
() => c(o + 1)
|
|
10471
|
+
))
|
|
10442
10472
|
return Promise.resolve();
|
|
10443
|
-
const
|
|
10444
|
-
return a.forEach((
|
|
10445
|
-
const
|
|
10446
|
-
|
|
10447
|
-
}),
|
|
10448
|
-
if (b.isSameRowItem(i.array[
|
|
10473
|
+
const g = /* @__PURE__ */ new Map();
|
|
10474
|
+
return a.forEach((p) => {
|
|
10475
|
+
const E = p.getListKey();
|
|
10476
|
+
E !== null && !g.has(String(E)) && g.set(String(E), p);
|
|
10477
|
+
}), d.forEach((p, E) => {
|
|
10478
|
+
if (b.isSameRowItem(i.array[E], p))
|
|
10449
10479
|
return;
|
|
10450
|
-
const
|
|
10480
|
+
const v = g.get(
|
|
10451
10481
|
B.createListKey(
|
|
10452
|
-
|
|
10482
|
+
p,
|
|
10453
10483
|
null,
|
|
10454
|
-
|
|
10484
|
+
E
|
|
10455
10485
|
)
|
|
10456
10486
|
);
|
|
10457
|
-
|
|
10487
|
+
v && B.clearUserEditMarks(v);
|
|
10458
10488
|
}), B.setBindingData(
|
|
10459
10489
|
i.owner.getTarget(),
|
|
10460
|
-
b.withPathValue(i.ownerData, i.path,
|
|
10490
|
+
b.withPathValue(i.ownerData, i.path, d),
|
|
10461
10491
|
{
|
|
10462
10492
|
// 対象は配列の 1 要素だけなので、所有者の部分木を丸ごと供給の宛先にはしない
|
|
10463
10493
|
// (行の書き戻し `applyRowWrites()` と同じ扱い)。
|
|
@@ -10559,7 +10589,7 @@ const h = class h {
|
|
|
10559
10589
|
*/
|
|
10560
10590
|
static isDeferredAttributeName(e) {
|
|
10561
10591
|
return h.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
10562
|
-
(t) => e === `${
|
|
10592
|
+
(t) => e === `${l.prefix}${t}`
|
|
10563
10593
|
);
|
|
10564
10594
|
}
|
|
10565
10595
|
/**
|
|
@@ -10570,7 +10600,7 @@ const h = class h {
|
|
|
10570
10600
|
*/
|
|
10571
10601
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
10572
10602
|
return h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
10573
|
-
(t) => e === `${
|
|
10603
|
+
(t) => e === `${l.prefix}${t}`
|
|
10574
10604
|
);
|
|
10575
10605
|
}
|
|
10576
10606
|
/**
|
|
@@ -10590,7 +10620,7 @@ const h = class h {
|
|
|
10590
10620
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
10591
10621
|
*/
|
|
10592
10622
|
static getAliasedAttributeName(e) {
|
|
10593
|
-
const t = `${
|
|
10623
|
+
const t = `${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
10594
10624
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
10595
10625
|
}
|
|
10596
10626
|
/**
|
|
@@ -10601,9 +10631,9 @@ const h = class h {
|
|
|
10601
10631
|
* @returns data-attr-* の内部反映なら true
|
|
10602
10632
|
*/
|
|
10603
10633
|
static isAliasedAttributeReflection(e, t) {
|
|
10604
|
-
const r =
|
|
10634
|
+
const r = x.get(e);
|
|
10605
10635
|
return r instanceof I ? r.hasAttribute(
|
|
10606
|
-
`${
|
|
10636
|
+
`${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
10607
10637
|
) : !1;
|
|
10608
10638
|
}
|
|
10609
10639
|
/**
|
|
@@ -10704,7 +10734,7 @@ const h = class h {
|
|
|
10704
10734
|
if (t.has(e))
|
|
10705
10735
|
return Promise.resolve();
|
|
10706
10736
|
const r = [];
|
|
10707
|
-
return e.hasAttribute(`${
|
|
10737
|
+
return e.hasAttribute(`${l.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${l.prefix}fetch`) && r.push(h.executeManagedFetch(e)), e.hasAttribute(`${l.prefix}import`) && r.push(h.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
10708
10738
|
i instanceof I && r.push(
|
|
10709
10739
|
h.reevaluateReactiveSpecialAttributes(i, t)
|
|
10710
10740
|
);
|
|
@@ -10741,7 +10771,7 @@ const h = class h {
|
|
|
10741
10771
|
*/
|
|
10742
10772
|
static executeManagedImport(e) {
|
|
10743
10773
|
const t = e.getTarget(), r = h.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
10744
|
-
`${
|
|
10774
|
+
`${l.prefix}import`
|
|
10745
10775
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
10746
10776
|
if (r.running)
|
|
10747
10777
|
return n !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
|
|
@@ -10751,20 +10781,20 @@ const h = class h {
|
|
|
10751
10781
|
return Promise.resolve();
|
|
10752
10782
|
r.lastUrl = n, r.running = !0;
|
|
10753
10783
|
const s = performance.now();
|
|
10754
|
-
return t.setAttribute(`${
|
|
10784
|
+
return t.setAttribute(`${l.prefix}importing`, ""), O.importStart(t, n), Ht.load(n).then((a) => {
|
|
10755
10785
|
const o = new TextEncoder().encode(a).length;
|
|
10756
10786
|
return K.enqueue(() => {
|
|
10757
10787
|
t.innerHTML = a;
|
|
10758
10788
|
}).then(() => {
|
|
10759
|
-
t.removeAttribute(`${
|
|
10760
|
-
const
|
|
10789
|
+
t.removeAttribute(`${l.prefix}importing`), O.importEnd(t, n, o, s), h.adoptImportedChildren(e);
|
|
10790
|
+
const c = [];
|
|
10761
10791
|
return e.getChildren().forEach((u) => {
|
|
10762
|
-
u instanceof I ?
|
|
10763
|
-
}), Promise.all(
|
|
10792
|
+
u instanceof I ? c.push(h.scan(u.getTarget())) : u instanceof ee && c.push(h.evaluateText(u));
|
|
10793
|
+
}), Promise.all(c).then(() => {
|
|
10764
10794
|
});
|
|
10765
10795
|
});
|
|
10766
10796
|
}).catch((a) => {
|
|
10767
|
-
t.removeAttribute(`${
|
|
10797
|
+
t.removeAttribute(`${l.prefix}importing`), O.importError(t, n, a), y.error("[Haori]", "Failed to import HTML:", n, a);
|
|
10768
10798
|
}).finally(() => {
|
|
10769
10799
|
if (r.running = !1, r.rerunRequested)
|
|
10770
10800
|
return r.rerunRequested = !1, h.executeManagedImport(e);
|
|
@@ -10787,7 +10817,7 @@ const h = class h {
|
|
|
10787
10817
|
e.getChildren().filter((r) => r.getTarget().parentNode !== t).forEach((r) => {
|
|
10788
10818
|
r.remove(!1);
|
|
10789
10819
|
}), t.childNodes.forEach((r) => {
|
|
10790
|
-
const i =
|
|
10820
|
+
const i = x.get(r);
|
|
10791
10821
|
i !== null && i.getParent() !== e && e.pushChild(i);
|
|
10792
10822
|
});
|
|
10793
10823
|
}
|
|
@@ -10798,7 +10828,7 @@ const h = class h {
|
|
|
10798
10828
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
10799
10829
|
*/
|
|
10800
10830
|
static scan(e) {
|
|
10801
|
-
const t =
|
|
10831
|
+
const t = x.get(e);
|
|
10802
10832
|
return t ? h.initializeElementFragment(t, !1).then(() => F.restoreInitialValues(e)).then(() => {
|
|
10803
10833
|
ie.applySubtree(e);
|
|
10804
10834
|
}) : Promise.resolve();
|
|
@@ -10863,7 +10893,7 @@ const h = class h {
|
|
|
10863
10893
|
let t = Promise.resolve();
|
|
10864
10894
|
const r = /* @__PURE__ */ new Set();
|
|
10865
10895
|
for (const i of h.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
10866
|
-
const n =
|
|
10896
|
+
const n = l.prefix + i;
|
|
10867
10897
|
e.hasAttribute(n) && (t = t.then(
|
|
10868
10898
|
() => h.setAttribute(
|
|
10869
10899
|
e.getTarget(),
|
|
@@ -10881,7 +10911,7 @@ const h = class h {
|
|
|
10881
10911
|
));
|
|
10882
10912
|
}
|
|
10883
10913
|
for (const i of h.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
10884
|
-
const n =
|
|
10914
|
+
const n = l.prefix + i;
|
|
10885
10915
|
e.hasAttribute(n) && (t = t.then(
|
|
10886
10916
|
() => h.setAttribute(
|
|
10887
10917
|
e.getTarget(),
|
|
@@ -10900,8 +10930,8 @@ const h = class h {
|
|
|
10900
10930
|
* @returns 子孫初期化をスキップするなら true
|
|
10901
10931
|
*/
|
|
10902
10932
|
static shouldSkipChildInitialization(e, t) {
|
|
10903
|
-
const r = e.getAttribute(`${
|
|
10904
|
-
return e.hasAttribute(`${
|
|
10933
|
+
const r = e.getAttribute(`${l.prefix}if`);
|
|
10934
|
+
return e.hasAttribute(`${l.prefix}if`) && h.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${l.prefix}each`);
|
|
10905
10935
|
}
|
|
10906
10936
|
/**
|
|
10907
10937
|
* エレメントに属性を設定します。
|
|
@@ -10917,7 +10947,7 @@ const h = class h {
|
|
|
10917
10947
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
10918
10948
|
*/
|
|
10919
10949
|
static setAttribute(e, t, r, i = !1, n) {
|
|
10920
|
-
const s =
|
|
10950
|
+
const s = x.get(e), a = h.getAliasedAttributeName(t);
|
|
10921
10951
|
if (a !== null)
|
|
10922
10952
|
return r === null ? s.removeAliasedAttribute(t, a) : s.setAliasedAttribute(
|
|
10923
10953
|
t,
|
|
@@ -10926,88 +10956,88 @@ const h = class h {
|
|
|
10926
10956
|
i
|
|
10927
10957
|
);
|
|
10928
10958
|
const o = [];
|
|
10929
|
-
let
|
|
10959
|
+
let c = null, u = null, d = null;
|
|
10930
10960
|
switch (t) {
|
|
10931
|
-
case `${
|
|
10961
|
+
case `${l.prefix}bind`: {
|
|
10932
10962
|
if (r !== null && i && s instanceof I && s.consumeSelfWrittenBind(r))
|
|
10933
10963
|
break;
|
|
10934
|
-
const
|
|
10964
|
+
const g = r === null ? {} : h.parseDataBind(r);
|
|
10935
10965
|
if (i) {
|
|
10936
|
-
const
|
|
10966
|
+
const p = n ?? I.nextSequence();
|
|
10937
10967
|
return r === null ? (o.push(
|
|
10938
|
-
h.setBindingData(e,
|
|
10968
|
+
h.setBindingData(e, g, {
|
|
10939
10969
|
reflectToAttribute: !1,
|
|
10940
|
-
sequence:
|
|
10970
|
+
sequence: p
|
|
10941
10971
|
})
|
|
10942
10972
|
), o.push(s.removeAttribute(t))) : o.push(
|
|
10943
|
-
h.setBindingData(e,
|
|
10944
|
-
sequence:
|
|
10973
|
+
h.setBindingData(e, g, {
|
|
10974
|
+
sequence: p
|
|
10945
10975
|
})
|
|
10946
10976
|
), Promise.all(o).then(() => {
|
|
10947
10977
|
});
|
|
10948
10978
|
}
|
|
10949
|
-
r === null && s.clearBindingDataCache(), s.setBindingData(
|
|
10979
|
+
r === null && s.clearBindingDataCache(), s.setBindingData(g);
|
|
10950
10980
|
break;
|
|
10951
10981
|
}
|
|
10952
|
-
case `${
|
|
10982
|
+
case `${l.prefix}derive`:
|
|
10953
10983
|
u = h.createDeriveInputSignature(
|
|
10954
10984
|
s,
|
|
10955
10985
|
r,
|
|
10956
|
-
s.getRawAttribute(`${
|
|
10957
|
-
),
|
|
10986
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
10987
|
+
), c = h.evaluateDerive(
|
|
10958
10988
|
s,
|
|
10959
10989
|
r,
|
|
10960
|
-
s.getRawAttribute(`${
|
|
10961
|
-
), o.push(
|
|
10990
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
10991
|
+
), o.push(c.then(() => {
|
|
10962
10992
|
}));
|
|
10963
10993
|
break;
|
|
10964
|
-
case `${
|
|
10994
|
+
case `${l.prefix}derive-name`:
|
|
10965
10995
|
u = h.createDeriveInputSignature(
|
|
10966
10996
|
s,
|
|
10967
|
-
s.getRawAttribute(`${
|
|
10997
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
10968
10998
|
r
|
|
10969
|
-
),
|
|
10999
|
+
), c = h.evaluateDerive(
|
|
10970
11000
|
s,
|
|
10971
|
-
s.getRawAttribute(`${
|
|
11001
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
10972
11002
|
r
|
|
10973
|
-
), o.push(
|
|
11003
|
+
), o.push(c.then(() => {
|
|
10974
11004
|
}));
|
|
10975
11005
|
break;
|
|
10976
|
-
case `${
|
|
11006
|
+
case `${l.prefix}if`:
|
|
10977
11007
|
o.push(h.evaluateIf(s));
|
|
10978
11008
|
break;
|
|
10979
|
-
case `${
|
|
11009
|
+
case `${l.prefix}each`:
|
|
10980
11010
|
o.push(h.evaluateEach(s));
|
|
10981
11011
|
break;
|
|
10982
|
-
case `${
|
|
11012
|
+
case `${l.prefix}fetch`:
|
|
10983
11013
|
d = () => h.executeManagedFetch(s);
|
|
10984
11014
|
break;
|
|
10985
|
-
case `${
|
|
11015
|
+
case `${l.prefix}import`:
|
|
10986
11016
|
typeof r == "string" && (d = () => h.executeManagedImport(s));
|
|
10987
11017
|
break;
|
|
10988
|
-
case `${
|
|
11018
|
+
case `${l.prefix}store`:
|
|
10989
11019
|
r !== null && o.push(ve.restore(s));
|
|
10990
11020
|
break;
|
|
10991
|
-
case `${
|
|
10992
|
-
case `${
|
|
11021
|
+
case `${l.prefix}validity`:
|
|
11022
|
+
case `${l.prefix}validity-message`:
|
|
10993
11023
|
return r !== null && F.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
10994
11024
|
});
|
|
10995
|
-
case `${
|
|
10996
|
-
const
|
|
10997
|
-
|
|
11025
|
+
case `${l.prefix}url-param`: {
|
|
11026
|
+
const g = s.getAttribute(`${l.prefix}url-arg`), p = ht.readParams();
|
|
11027
|
+
g === null && s.hasAttribute(`${l.prefix}store`) && y.warn(
|
|
10998
11028
|
"Haori",
|
|
10999
|
-
`${
|
|
11029
|
+
`${l.prefix}url-param を ${l.prefix}url-arg なしで ${l.prefix}store と併用すると復元した値が消えます(${l.prefix}url-arg を指定してください)。`
|
|
11000
11030
|
);
|
|
11001
|
-
const
|
|
11031
|
+
const E = {
|
|
11002
11032
|
reentrant: !0,
|
|
11003
11033
|
kind: "nonSupply",
|
|
11004
11034
|
sequence: I.nextSequence()
|
|
11005
11035
|
};
|
|
11006
|
-
if (
|
|
11007
|
-
o.push(h.setBindingData(e,
|
|
11036
|
+
if (g === null)
|
|
11037
|
+
o.push(h.setBindingData(e, p, E));
|
|
11008
11038
|
else {
|
|
11009
11039
|
const v = s.getRawBindingData() || {};
|
|
11010
|
-
v[String(
|
|
11040
|
+
v[String(g)] = p, o.push(h.setBindingData(e, v, E));
|
|
11011
11041
|
}
|
|
11012
11042
|
break;
|
|
11013
11043
|
}
|
|
@@ -11015,9 +11045,9 @@ const h = class h {
|
|
|
11015
11045
|
return r === null ? o.push(s.removeAttribute(t)) : o.push(s.setAttribute(t, r, i)), Promise.all(o).then(
|
|
11016
11046
|
() => d === null ? void 0 : d()
|
|
11017
11047
|
).then(() => {
|
|
11018
|
-
if (
|
|
11019
|
-
return s.setDeriveInputSignature(u),
|
|
11020
|
-
if (
|
|
11048
|
+
if (c !== null)
|
|
11049
|
+
return s.setDeriveInputSignature(u), c.then((g) => {
|
|
11050
|
+
if (g)
|
|
11021
11051
|
return h.reevaluateChildren(s);
|
|
11022
11052
|
});
|
|
11023
11053
|
}).then(() => {
|
|
@@ -11050,24 +11080,24 @@ const h = class h {
|
|
|
11050
11080
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11051
11081
|
*/
|
|
11052
11082
|
static setBindingData(e, t, r = {}) {
|
|
11053
|
-
const i =
|
|
11054
|
-
sequence:
|
|
11083
|
+
const i = x.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", c = r.sequence ?? I.nextOperationSequence(), u = {
|
|
11084
|
+
sequence: c,
|
|
11055
11085
|
kind: o,
|
|
11056
11086
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11057
11087
|
}, d = o === "supply";
|
|
11058
|
-
d && i.markSupplyApplied(
|
|
11059
|
-
const
|
|
11060
|
-
d && (r.clearUserEdits ?? !0) && h.clearUserEditMarks(i,
|
|
11061
|
-
const
|
|
11062
|
-
i.setBindingData(
|
|
11088
|
+
d && i.markSupplyApplied(c);
|
|
11089
|
+
const g = I.currentSequence(), p = i.getRawBindingData();
|
|
11090
|
+
d && (r.clearUserEdits ?? !0) && h.clearUserEditMarks(i, c);
|
|
11091
|
+
const E = a ? h.resolveByPathAuthority(i, p, t, u) : t;
|
|
11092
|
+
i.setBindingData(E), a && (O.bindChange(e, p, E, "manual"), ve.mirror(i));
|
|
11063
11093
|
const v = () => {
|
|
11064
11094
|
i.markBindingWorkStart();
|
|
11065
|
-
const D = i.getRawBindingData() ??
|
|
11066
|
-
let k = a ? i.setAttribute(`${
|
|
11095
|
+
const D = i.getRawBindingData() ?? E;
|
|
11096
|
+
let k = a ? i.setAttribute(`${l.prefix}bind`, JSON.stringify(D)) : Promise.resolve();
|
|
11067
11097
|
return e.tagName === "FORM" && (k = k.then(() => {
|
|
11068
|
-
if (i.wasResetAfter(
|
|
11098
|
+
if (i.wasResetAfter(g))
|
|
11069
11099
|
return;
|
|
11070
|
-
const H = i.getRawBindingData() ??
|
|
11100
|
+
const H = i.getRawBindingData() ?? E;
|
|
11071
11101
|
return F.syncValues(
|
|
11072
11102
|
i,
|
|
11073
11103
|
F.resolveSyncValues(i, H),
|
|
@@ -11075,9 +11105,9 @@ const h = class h {
|
|
|
11075
11105
|
u
|
|
11076
11106
|
);
|
|
11077
11107
|
})), k = k.then(
|
|
11078
|
-
() => F.syncAncestorArgForms(i,
|
|
11108
|
+
() => F.syncAncestorArgForms(i, g, u)
|
|
11079
11109
|
), k = k.then(() => h.evaluateAll(i, n)), k = k.then(
|
|
11080
|
-
() => I.retryUnappliedValueWrites(e,
|
|
11110
|
+
() => I.retryUnappliedValueWrites(e, g)
|
|
11081
11111
|
), k = k.then(
|
|
11082
11112
|
() => h.reevaluateReactiveSpecialAttributes(i, n)
|
|
11083
11113
|
), k.then(
|
|
@@ -11126,15 +11156,15 @@ const h = class h {
|
|
|
11126
11156
|
*/
|
|
11127
11157
|
static mergePathAuthority(e, t, r, i, n) {
|
|
11128
11158
|
if (h.isPlainRecord(t) && h.isPlainRecord(r)) {
|
|
11129
|
-
const u = t, d = r,
|
|
11130
|
-
let
|
|
11159
|
+
const u = t, d = r, g = {};
|
|
11160
|
+
let p = Object.keys(u).some(
|
|
11131
11161
|
(v) => !Object.prototype.hasOwnProperty.call(d, v)
|
|
11132
11162
|
);
|
|
11133
|
-
const
|
|
11163
|
+
const E = /* @__PURE__ */ new Set([
|
|
11134
11164
|
...Object.keys(u),
|
|
11135
11165
|
...Object.keys(d)
|
|
11136
11166
|
]);
|
|
11137
|
-
for (const v of
|
|
11167
|
+
for (const v of E) {
|
|
11138
11168
|
const D = n === "" ? v : `${n}.${v}`, k = h.mergePathAuthority(
|
|
11139
11169
|
e,
|
|
11140
11170
|
Object.prototype.hasOwnProperty.call(u, v) ? u[v] : h.ABSENT_PATH,
|
|
@@ -11142,30 +11172,30 @@ const h = class h {
|
|
|
11142
11172
|
i,
|
|
11143
11173
|
D
|
|
11144
11174
|
);
|
|
11145
|
-
k !== h.ABSENT_PATH && (
|
|
11175
|
+
k !== h.ABSENT_PATH && (g[v] = k), k !== (Object.prototype.hasOwnProperty.call(d, v) ? d[v] : h.ABSENT_PATH) && (p = !0);
|
|
11146
11176
|
}
|
|
11147
|
-
return
|
|
11177
|
+
return p ? g : d;
|
|
11148
11178
|
}
|
|
11149
11179
|
const s = h.resolveArrayPairing(e, t, r, n);
|
|
11150
11180
|
if (s !== null) {
|
|
11151
|
-
const u = t, d = r,
|
|
11152
|
-
(
|
|
11181
|
+
const u = t, d = r, g = d.map(
|
|
11182
|
+
(p, E) => h.mergePathAuthority(
|
|
11153
11183
|
e,
|
|
11154
|
-
u[
|
|
11155
|
-
|
|
11184
|
+
u[E],
|
|
11185
|
+
p,
|
|
11156
11186
|
i,
|
|
11157
|
-
`${n}[${s[
|
|
11187
|
+
`${n}[${s[E]}]`
|
|
11158
11188
|
)
|
|
11159
11189
|
);
|
|
11160
|
-
return
|
|
11190
|
+
return g.some((p, E) => p !== d[E]) ? g : d;
|
|
11161
11191
|
}
|
|
11162
11192
|
if (h.isSameBindingValue(t, r))
|
|
11163
11193
|
return r;
|
|
11164
|
-
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit",
|
|
11194
|
+
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit", c = {
|
|
11165
11195
|
sequence: a ?? i.sequence,
|
|
11166
11196
|
kind: o
|
|
11167
11197
|
};
|
|
11168
|
-
return e.canApplyPath(n,
|
|
11198
|
+
return e.canApplyPath(n, c) ? (e.markPathApplied(n, c), r) : t;
|
|
11169
11199
|
}
|
|
11170
11200
|
/**
|
|
11171
11201
|
* 配列を要素ごとの宛先として扱えるかを判定し、扱える場合は各要素のリストキーを
|
|
@@ -11186,19 +11216,19 @@ const h = class h {
|
|
|
11186
11216
|
if (!Array.isArray(t) || !Array.isArray(r) || t.length !== r.length || r.length === 0)
|
|
11187
11217
|
return null;
|
|
11188
11218
|
const n = r.some((o) => h.isPlainRecord(o)) ? h.resolveEachKeyArg(e, i) : null, s = t.map(
|
|
11189
|
-
(o,
|
|
11219
|
+
(o, c) => h.createListKey(
|
|
11190
11220
|
o,
|
|
11191
11221
|
n,
|
|
11192
|
-
|
|
11222
|
+
c
|
|
11193
11223
|
)
|
|
11194
11224
|
), a = r.map(
|
|
11195
|
-
(o,
|
|
11225
|
+
(o, c) => h.createListKey(
|
|
11196
11226
|
o,
|
|
11197
11227
|
n,
|
|
11198
|
-
|
|
11228
|
+
c
|
|
11199
11229
|
)
|
|
11200
11230
|
);
|
|
11201
|
-
return s.some((o,
|
|
11231
|
+
return s.some((o, c) => o !== a[c]) ? null : a;
|
|
11202
11232
|
}
|
|
11203
11233
|
/**
|
|
11204
11234
|
* 配列の経路に対応する `data-each-key` の指定を探します。
|
|
@@ -11214,13 +11244,13 @@ const h = class h {
|
|
|
11214
11244
|
* @returns リストキーに使うプロパティ名。宣言が無ければ null
|
|
11215
11245
|
*/
|
|
11216
11246
|
static resolveEachKeyArg(e, t) {
|
|
11217
|
-
const r = `${
|
|
11247
|
+
const r = `${l.prefix}each`, i = e.getTarget(), n = t.replace(/\[[^\]]*\]/g, ""), s = i.querySelectorAll(`[${r}]`);
|
|
11218
11248
|
for (const a of Array.from(s)) {
|
|
11219
11249
|
const o = h.resolveEachDeclarationPath(a, i);
|
|
11220
11250
|
if (o === null || o !== n)
|
|
11221
11251
|
continue;
|
|
11222
|
-
const
|
|
11223
|
-
return
|
|
11252
|
+
const c = a.getAttribute(`${r}-key`);
|
|
11253
|
+
return c === null ? null : c.trim();
|
|
11224
11254
|
}
|
|
11225
11255
|
return null;
|
|
11226
11256
|
}
|
|
@@ -11242,7 +11272,7 @@ const h = class h {
|
|
|
11242
11272
|
* @returns 絶対経路。式が空、または経路として扱えない場合は null
|
|
11243
11273
|
*/
|
|
11244
11274
|
static resolveEachDeclarationPath(e, t) {
|
|
11245
|
-
const r = `${
|
|
11275
|
+
const r = `${l.prefix}each`;
|
|
11246
11276
|
let i = e.getAttribute(r)?.trim() ?? "";
|
|
11247
11277
|
if (i === "")
|
|
11248
11278
|
return null;
|
|
@@ -11311,7 +11341,7 @@ const h = class h {
|
|
|
11311
11341
|
* `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
|
|
11312
11342
|
*/
|
|
11313
11343
|
static getBindingData(e, t = {}) {
|
|
11314
|
-
const r =
|
|
11344
|
+
const r = x.get(e);
|
|
11315
11345
|
return r instanceof I ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
11316
11346
|
}
|
|
11317
11347
|
/**
|
|
@@ -11344,20 +11374,20 @@ const h = class h {
|
|
|
11344
11374
|
* @return 解決済みスコープと各キーの由来情報
|
|
11345
11375
|
*/
|
|
11346
11376
|
static collectScope(e) {
|
|
11347
|
-
const t =
|
|
11377
|
+
const t = x.get(e);
|
|
11348
11378
|
if (!t)
|
|
11349
11379
|
return { resolved: {}, sources: {} };
|
|
11350
|
-
const r = t.getBindingData(), i = {}, n = (
|
|
11351
|
-
const u =
|
|
11380
|
+
const r = t.getBindingData(), i = {}, n = (c) => {
|
|
11381
|
+
const u = c.getTarget(), d = h.resolveElementId(u);
|
|
11352
11382
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
11353
|
-
}, s = (
|
|
11354
|
-
if (
|
|
11355
|
-
for (const
|
|
11356
|
-
|
|
11357
|
-
value:
|
|
11383
|
+
}, s = (c, u, d, g) => {
|
|
11384
|
+
if (c)
|
|
11385
|
+
for (const p of Object.keys(c))
|
|
11386
|
+
p in i || (i[p] = {
|
|
11387
|
+
value: c[p],
|
|
11358
11388
|
source: n(u),
|
|
11359
11389
|
kind: d,
|
|
11360
|
-
depth:
|
|
11390
|
+
depth: g
|
|
11361
11391
|
});
|
|
11362
11392
|
};
|
|
11363
11393
|
let a = t, o = 0;
|
|
@@ -11392,10 +11422,10 @@ const h = class h {
|
|
|
11392
11422
|
* @param node 追加するノード
|
|
11393
11423
|
*/
|
|
11394
11424
|
static addNode(e, t) {
|
|
11395
|
-
const r =
|
|
11425
|
+
const r = x.get(e);
|
|
11396
11426
|
if (r.isSkipMutationNodes())
|
|
11397
11427
|
return;
|
|
11398
|
-
const i =
|
|
11428
|
+
const i = x.get(t.nextSibling), n = x.get(t);
|
|
11399
11429
|
if (n) {
|
|
11400
11430
|
if (n.getParent() === r)
|
|
11401
11431
|
return;
|
|
@@ -11408,7 +11438,7 @@ const h = class h {
|
|
|
11408
11438
|
* @param node 削除するノード
|
|
11409
11439
|
*/
|
|
11410
11440
|
static removeNode(e) {
|
|
11411
|
-
const t =
|
|
11441
|
+
const t = x.get(e);
|
|
11412
11442
|
if (t) {
|
|
11413
11443
|
const r = t.getParent();
|
|
11414
11444
|
if (r && r.isSkipMutationNodes())
|
|
@@ -11423,7 +11453,7 @@ const h = class h {
|
|
|
11423
11453
|
* @param text 新しいテキスト
|
|
11424
11454
|
*/
|
|
11425
11455
|
static changeText(e, t) {
|
|
11426
|
-
const r =
|
|
11456
|
+
const r = x.get(e);
|
|
11427
11457
|
r && r.setContent(t);
|
|
11428
11458
|
}
|
|
11429
11459
|
/**
|
|
@@ -11435,28 +11465,28 @@ const h = class h {
|
|
|
11435
11465
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11436
11466
|
*/
|
|
11437
11467
|
static changeValue(e, t) {
|
|
11438
|
-
const r =
|
|
11468
|
+
const r = x.get(e);
|
|
11439
11469
|
if (r.getValue() === t)
|
|
11440
11470
|
return Promise.resolve();
|
|
11441
11471
|
const i = [];
|
|
11442
11472
|
i.push(r.setValue(t));
|
|
11443
11473
|
const n = h.getFormFragment(r);
|
|
11444
11474
|
if (n) {
|
|
11445
|
-
const s = F.getValues(n), a = n.getAttribute(`${
|
|
11446
|
-
let
|
|
11475
|
+
const s = F.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`), o = n.getRawBindingData();
|
|
11476
|
+
let c;
|
|
11447
11477
|
if (a) {
|
|
11448
|
-
|
|
11478
|
+
c = { ...o ?? {} };
|
|
11449
11479
|
const u = String(a), d = F.resolveAncestorArgOwner(n, u);
|
|
11450
|
-
|
|
11451
|
-
(d ? d.value :
|
|
11480
|
+
c[u] = F.mergeCollectedValues(
|
|
11481
|
+
(d ? d.value : c[u]) ?? null,
|
|
11452
11482
|
s
|
|
11453
11483
|
);
|
|
11454
11484
|
} else
|
|
11455
|
-
|
|
11485
|
+
c = F.mergeCollectedValues(o, s);
|
|
11456
11486
|
i.push(
|
|
11457
11487
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
11458
11488
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
11459
|
-
h.setBindingData(n.getTarget(),
|
|
11489
|
+
h.setBindingData(n.getTarget(), c, {
|
|
11460
11490
|
kind: "nonSupply",
|
|
11461
11491
|
sequence: I.nextSequence()
|
|
11462
11492
|
})
|
|
@@ -11487,25 +11517,25 @@ const h = class h {
|
|
|
11487
11517
|
if (t.has(e))
|
|
11488
11518
|
return Promise.resolve();
|
|
11489
11519
|
let r = h.reevaluateInterpolatedAttributes(e);
|
|
11490
|
-
const i = e.hasAttribute(`${
|
|
11491
|
-
let
|
|
11520
|
+
const i = e.hasAttribute(`${l.prefix}derive`), n = e.hasAttribute(`${l.prefix}if`), s = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
|
|
11521
|
+
let c = !1, u = !1, d = null;
|
|
11492
11522
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
11493
|
-
const
|
|
11523
|
+
const g = h.createDeriveInputSignature(
|
|
11494
11524
|
e,
|
|
11495
11525
|
a,
|
|
11496
11526
|
o
|
|
11497
11527
|
);
|
|
11498
|
-
|
|
11528
|
+
g === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
11499
11529
|
() => h.evaluateDerive(e, a, o).then(
|
|
11500
11530
|
() => {
|
|
11501
11531
|
}
|
|
11502
11532
|
)
|
|
11503
|
-
)) : e.getDeriveInputSignature() !==
|
|
11533
|
+
)) : e.getDeriveInputSignature() !== g && (r = r.then(() => h.evaluateDerive(
|
|
11504
11534
|
e,
|
|
11505
11535
|
a,
|
|
11506
11536
|
o
|
|
11507
11537
|
).then(() => {
|
|
11508
|
-
e.setDeriveInputSignature(
|
|
11538
|
+
e.setDeriveInputSignature(g);
|
|
11509
11539
|
})));
|
|
11510
11540
|
}
|
|
11511
11541
|
return n && (r = r.then(() => h.evaluateIf(e))), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => h.evaluateEach(e))) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
@@ -11517,21 +11547,21 @@ const h = class h {
|
|
|
11517
11547
|
d = h.createDescendantBindingSignature(
|
|
11518
11548
|
e,
|
|
11519
11549
|
"evaluateAll"
|
|
11520
|
-
), u = !0,
|
|
11550
|
+
), u = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d, h.logDerivedSubtreeProfileSnapshot(
|
|
11521
11551
|
e,
|
|
11522
|
-
|
|
11552
|
+
c ? "skip-hit" : "skip-miss"
|
|
11523
11553
|
);
|
|
11524
11554
|
})), r.then(() => {
|
|
11525
|
-
if (
|
|
11555
|
+
if (c)
|
|
11526
11556
|
return;
|
|
11527
|
-
const
|
|
11528
|
-
return e.getChildren().forEach((
|
|
11529
|
-
if (
|
|
11530
|
-
if (h.canSkipUnchangedNestedEach(
|
|
11557
|
+
const g = [];
|
|
11558
|
+
return e.getChildren().forEach((p) => {
|
|
11559
|
+
if (p instanceof I) {
|
|
11560
|
+
if (h.canSkipUnchangedNestedEach(p))
|
|
11531
11561
|
return;
|
|
11532
|
-
|
|
11533
|
-
} else
|
|
11534
|
-
}), Promise.all(
|
|
11562
|
+
g.push(h.evaluateAll(p, t));
|
|
11563
|
+
} else p instanceof ee && g.push(h.evaluateText(p));
|
|
11564
|
+
}), Promise.all(g).then(() => {
|
|
11535
11565
|
});
|
|
11536
11566
|
}).then(() => {
|
|
11537
11567
|
u && d !== null && e.setDeriveSubtreeSignature(d);
|
|
@@ -11546,9 +11576,9 @@ const h = class h {
|
|
|
11546
11576
|
* @returns Promise (評価完了時に解決)
|
|
11547
11577
|
*/
|
|
11548
11578
|
static evaluateDerive(e, t = e.getRawAttribute(
|
|
11549
|
-
`${
|
|
11579
|
+
`${l.prefix}derive`
|
|
11550
11580
|
), r = e.getRawAttribute(
|
|
11551
|
-
`${
|
|
11581
|
+
`${l.prefix}derive-name`
|
|
11552
11582
|
)) {
|
|
11553
11583
|
const i = e.getRawDerivedBindingData(), n = typeof r == "string" ? r.trim() : "";
|
|
11554
11584
|
if (!t || n === "")
|
|
@@ -11597,7 +11627,7 @@ const h = class h {
|
|
|
11597
11627
|
* @return 戻り値はありません。
|
|
11598
11628
|
*/
|
|
11599
11629
|
static logFalsyIfDiagnostics(e) {
|
|
11600
|
-
const t = e.getRawAttribute(`${
|
|
11630
|
+
const t = e.getRawAttribute(`${l.prefix}if`);
|
|
11601
11631
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
11602
11632
|
return;
|
|
11603
11633
|
if (Q.hasCompileFailure(t)) {
|
|
@@ -11611,8 +11641,8 @@ const h = class h {
|
|
|
11611
11641
|
const { sources: r } = h.collectScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
11612
11642
|
let s = 0;
|
|
11613
11643
|
n.forEach((o) => {
|
|
11614
|
-
const
|
|
11615
|
-
s =
|
|
11644
|
+
const c = t.indexOf(o, s);
|
|
11645
|
+
s = c + o.length, !(c > 0 && t[c - 1] === ".") && i.add(o);
|
|
11616
11646
|
});
|
|
11617
11647
|
const a = {};
|
|
11618
11648
|
i.forEach((o) => {
|
|
@@ -11634,7 +11664,7 @@ const h = class h {
|
|
|
11634
11664
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
11635
11665
|
*/
|
|
11636
11666
|
static evaluateIf(e) {
|
|
11637
|
-
const t = [], r = e.getAttribute(`${
|
|
11667
|
+
const t = [], r = e.getAttribute(`${l.prefix}if`);
|
|
11638
11668
|
if (h.isHiddenIfCondition(r))
|
|
11639
11669
|
j.isEnabled() && e.isVisible() && h.logFalsyIfDiagnostics(e), t.push(
|
|
11640
11670
|
e.hide().then(() => {
|
|
@@ -11668,7 +11698,7 @@ const h = class h {
|
|
|
11668
11698
|
* @return 戻り値はありません。
|
|
11669
11699
|
*/
|
|
11670
11700
|
static triggerLoadOnShow(e) {
|
|
11671
|
-
const t = `${
|
|
11701
|
+
const t = `${l.prefix}load-`;
|
|
11672
11702
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new re(e, "load").run().catch((i) => {
|
|
11673
11703
|
y.error("[Haori]", "data-load procedure error (on show):", i);
|
|
11674
11704
|
});
|
|
@@ -11713,7 +11743,7 @@ const h = class h {
|
|
|
11713
11743
|
* @returns 公開される名前。指定が無い場合は null
|
|
11714
11744
|
*/
|
|
11715
11745
|
static getRowScopeName(e, t) {
|
|
11716
|
-
const r = e.getAttribute(`${
|
|
11746
|
+
const r = e.getAttribute(`${l.prefix}${t}`);
|
|
11717
11747
|
return typeof r != "string" || r === "" ? null : r;
|
|
11718
11748
|
}
|
|
11719
11749
|
/**
|
|
@@ -11740,14 +11770,14 @@ const h = class h {
|
|
|
11740
11770
|
* @return すべての差分更新が安定するまでの完了 Promise
|
|
11741
11771
|
*/
|
|
11742
11772
|
static runEachUpdateLoop(e, t) {
|
|
11743
|
-
t.running = !0, e.getTarget().removeAttribute(`${
|
|
11773
|
+
t.running = !0, e.getTarget().removeAttribute(`${l.prefix}each-done`);
|
|
11744
11774
|
const r = (async () => {
|
|
11745
11775
|
try {
|
|
11746
11776
|
do
|
|
11747
11777
|
t.rerunRequested = !1, await h.performEachUpdate(e);
|
|
11748
11778
|
while (t.rerunRequested);
|
|
11749
11779
|
const i = e.getTarget();
|
|
11750
|
-
i.setAttribute(`${
|
|
11780
|
+
i.setAttribute(`${l.prefix}each-done`, ""), ie.refreshSubtree(i), h.runEachRenderedScript(i);
|
|
11751
11781
|
} finally {
|
|
11752
11782
|
t.running = !1, t.settled = null;
|
|
11753
11783
|
}
|
|
@@ -11766,7 +11796,7 @@ const h = class h {
|
|
|
11766
11796
|
* @param target data-each コンテナ要素
|
|
11767
11797
|
*/
|
|
11768
11798
|
static runEachRenderedScript(e) {
|
|
11769
|
-
const t = `${
|
|
11799
|
+
const t = `${l.prefix}each-rendered-run`;
|
|
11770
11800
|
if (!e.hasAttribute(t))
|
|
11771
11801
|
return;
|
|
11772
11802
|
const r = String(e.getAttribute(t) ?? "");
|
|
@@ -11816,7 +11846,7 @@ ${r}
|
|
|
11816
11846
|
* @param fragment data-each コンテナのフラグメント
|
|
11817
11847
|
*/
|
|
11818
11848
|
static runEachRenderedChange(e) {
|
|
11819
|
-
const t = `${
|
|
11849
|
+
const t = `${l.prefix}each-rendered-change`, r = e.getTarget();
|
|
11820
11850
|
if (!r.hasAttribute(t))
|
|
11821
11851
|
return;
|
|
11822
11852
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
@@ -11850,7 +11880,7 @@ ${r}
|
|
|
11850
11880
|
static countEachRenderedRows(e) {
|
|
11851
11881
|
let t = 0;
|
|
11852
11882
|
for (const r of e.getChildElementFragments())
|
|
11853
|
-
r.getTarget().hasAttribute(`${
|
|
11883
|
+
r.getTarget().hasAttribute(`${l.prefix}row`) && (t += 1);
|
|
11854
11884
|
return t;
|
|
11855
11885
|
}
|
|
11856
11886
|
/**
|
|
@@ -11864,7 +11894,7 @@ ${r}
|
|
|
11864
11894
|
if (t === null)
|
|
11865
11895
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
11866
11896
|
let r = e.getTemplate();
|
|
11867
|
-
const i = e.getAttribute(`${
|
|
11897
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
|
|
11868
11898
|
key: i ? String(i) : null,
|
|
11869
11899
|
items: t
|
|
11870
11900
|
});
|
|
@@ -11872,7 +11902,7 @@ ${r}
|
|
|
11872
11902
|
let s = !1;
|
|
11873
11903
|
if (e.getChildren().forEach((a) => {
|
|
11874
11904
|
if (!s && a instanceof I) {
|
|
11875
|
-
if (a.hasAttribute(`${
|
|
11905
|
+
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
11876
11906
|
return;
|
|
11877
11907
|
r = a.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
11878
11908
|
const o = a.getTarget();
|
|
@@ -11881,14 +11911,14 @@ ${r}
|
|
|
11881
11911
|
}), !s) {
|
|
11882
11912
|
const a = e.getTarget();
|
|
11883
11913
|
Array.from(a.children).filter(
|
|
11884
|
-
(
|
|
11885
|
-
).forEach((
|
|
11914
|
+
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
11915
|
+
).forEach((c) => {
|
|
11886
11916
|
if (!s) {
|
|
11887
|
-
const d =
|
|
11917
|
+
const d = x.get(c);
|
|
11888
11918
|
d instanceof I && (r = d.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
11889
11919
|
}
|
|
11890
|
-
const u =
|
|
11891
|
-
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)),
|
|
11920
|
+
const u = x.get(c);
|
|
11921
|
+
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), c.parentNode && c.parentNode.removeChild(c);
|
|
11892
11922
|
});
|
|
11893
11923
|
}
|
|
11894
11924
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -11912,7 +11942,7 @@ ${r}
|
|
|
11912
11942
|
if (h.isRowLocalEachTemplate(e))
|
|
11913
11943
|
return Promise.resolve();
|
|
11914
11944
|
const t = e.getChildElementFragments().filter(
|
|
11915
|
-
(r) => !r.hasAttribute(`${
|
|
11945
|
+
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
11916
11946
|
);
|
|
11917
11947
|
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) => h.evaluateAll(r))).then(
|
|
11918
11948
|
() => {
|
|
@@ -11926,7 +11956,7 @@ ${r}
|
|
|
11926
11956
|
* @returns 配列。無効な場合は null
|
|
11927
11957
|
*/
|
|
11928
11958
|
static resolveEachItems(e) {
|
|
11929
|
-
const t = e.getAttributeEvaluation(`${
|
|
11959
|
+
const t = e.getAttributeEvaluation(`${l.prefix}each`), r = t?.value;
|
|
11930
11960
|
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (y.error("[Haori]", "Invalid each attribute:", r), null);
|
|
11931
11961
|
}
|
|
11932
11962
|
/**
|
|
@@ -11937,15 +11967,15 @@ ${r}
|
|
|
11937
11967
|
* @returns 省略可能なら true
|
|
11938
11968
|
*/
|
|
11939
11969
|
static canSkipUnchangedNestedEach(e) {
|
|
11940
|
-
if (!e.hasAttribute(`${
|
|
11970
|
+
if (!e.hasAttribute(`${l.prefix}each`) || e.getEachInputSignature() === null)
|
|
11941
11971
|
return !1;
|
|
11942
11972
|
const t = e.getParent();
|
|
11943
|
-
if (t?.closestByAttribute(`${
|
|
11973
|
+
if (t?.closestByAttribute(`${l.prefix}derive`) || t?.closestByAttribute(`${l.prefix}derive-name`) || t?.closestByAttribute(`${l.prefix}if`) || t?.closestByAttribute(`${l.prefix}fetch`) || t?.closestByAttribute(`${l.prefix}import`) || h.hasNonEachDynamicElementState(e) || !h.isRowLocalEachTemplate(e))
|
|
11944
11974
|
return !1;
|
|
11945
11975
|
const r = h.resolveEachItems(e);
|
|
11946
11976
|
if (r === null)
|
|
11947
11977
|
return !1;
|
|
11948
|
-
const i = e.getAttribute(`${
|
|
11978
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
|
|
11949
11979
|
key: i ? String(i) : null,
|
|
11950
11980
|
items: r
|
|
11951
11981
|
});
|
|
@@ -11974,10 +12004,10 @@ ${r}
|
|
|
11974
12004
|
const t = e.getRowLocalTemplate();
|
|
11975
12005
|
if (t !== null)
|
|
11976
12006
|
return t;
|
|
11977
|
-
const r = e.getTemplate(), i = e.getAttribute(`${
|
|
12007
|
+
const r = e.getTemplate(), i = e.getAttribute(`${l.prefix}each-arg`);
|
|
11978
12008
|
if (r === null || !i)
|
|
11979
12009
|
return e.setRowLocalTemplate(!1), !1;
|
|
11980
|
-
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${
|
|
12010
|
+
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${l.prefix}each-index`);
|
|
11981
12011
|
s && n.add(String(s));
|
|
11982
12012
|
const a = h.isRowLocalSubtree(r, n);
|
|
11983
12013
|
return e.setRowLocalTemplate(a), a;
|
|
@@ -12000,9 +12030,9 @@ ${r}
|
|
|
12000
12030
|
return !1;
|
|
12001
12031
|
continue;
|
|
12002
12032
|
}
|
|
12003
|
-
if (!i.startsWith(
|
|
12033
|
+
if (!i.startsWith(l.prefix))
|
|
12004
12034
|
continue;
|
|
12005
|
-
const a = i.slice(
|
|
12035
|
+
const a = i.slice(l.prefix.length);
|
|
12006
12036
|
if (h.ROW_LOCAL_EXPRESSION_ATTRIBUTES.has(a)) {
|
|
12007
12037
|
if (!h.areExpressionsRowLocal([s], t))
|
|
12008
12038
|
return !1;
|
|
@@ -12012,13 +12042,13 @@ ${r}
|
|
|
12012
12042
|
return !1;
|
|
12013
12043
|
}
|
|
12014
12044
|
let r = t;
|
|
12015
|
-
if (e.hasAttribute(`${
|
|
12016
|
-
const i = e.getRawAttribute(`${
|
|
12045
|
+
if (e.hasAttribute(`${l.prefix}each`)) {
|
|
12046
|
+
const i = e.getRawAttribute(`${l.prefix}each-arg`);
|
|
12017
12047
|
if (typeof i != "string" || i === "")
|
|
12018
12048
|
return !1;
|
|
12019
12049
|
const n = new Set(t);
|
|
12020
12050
|
n.add(i);
|
|
12021
|
-
const s = e.getRawAttribute(`${
|
|
12051
|
+
const s = e.getRawAttribute(`${l.prefix}each-index`);
|
|
12022
12052
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
12023
12053
|
}
|
|
12024
12054
|
for (const i of e.getChildren())
|
|
@@ -12076,7 +12106,7 @@ ${r}
|
|
|
12076
12106
|
* @returns 省略可能なら true
|
|
12077
12107
|
*/
|
|
12078
12108
|
static canSkipStableDerivedSubtree(e) {
|
|
12079
|
-
return !e.hasAttribute(`${
|
|
12109
|
+
return !e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}if`) || e.hasAttribute(`${l.prefix}each`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !1 : !h.hasDisallowedDerivedSubtreeDescendant(e);
|
|
12080
12110
|
}
|
|
12081
12111
|
/**
|
|
12082
12112
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -12085,7 +12115,7 @@ ${r}
|
|
|
12085
12115
|
* @returns 含むなら true
|
|
12086
12116
|
*/
|
|
12087
12117
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12088
|
-
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${
|
|
12118
|
+
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}derive-name`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !0 : h.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
12089
12119
|
}
|
|
12090
12120
|
/**
|
|
12091
12121
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -12133,7 +12163,7 @@ ${r}
|
|
|
12133
12163
|
* @returns プロファイル
|
|
12134
12164
|
*/
|
|
12135
12165
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
12136
|
-
if (!j.isEnabled() || !e.hasAttribute(`${
|
|
12166
|
+
if (!j.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
12137
12167
|
return null;
|
|
12138
12168
|
const t = h.DERIVE_SUBTREE_PROFILES.get(e);
|
|
12139
12169
|
if (t)
|
|
@@ -12183,12 +12213,12 @@ ${r}
|
|
|
12183
12213
|
n += `#${s}`, t.unshift(n);
|
|
12184
12214
|
break;
|
|
12185
12215
|
}
|
|
12186
|
-
const a = r.getRawAttribute(`${
|
|
12187
|
-
typeof a == "string" && a.trim() !== "" && (n += `[${
|
|
12216
|
+
const a = r.getRawAttribute(`${l.prefix}derive-name`);
|
|
12217
|
+
typeof a == "string" && a.trim() !== "" && (n += `[${l.prefix}derive-name="${a.trim()}"]`);
|
|
12188
12218
|
const o = r.getParent();
|
|
12189
12219
|
if (o) {
|
|
12190
|
-
const
|
|
12191
|
-
n += `:nth-child(${
|
|
12220
|
+
const c = o.getChildren().filter((u) => u instanceof I).findIndex((u) => u === r);
|
|
12221
|
+
n += `:nth-child(${c + 1})`;
|
|
12192
12222
|
}
|
|
12193
12223
|
t.unshift(n), r = o;
|
|
12194
12224
|
}
|
|
@@ -12237,15 +12267,15 @@ ${r}
|
|
|
12237
12267
|
*/
|
|
12238
12268
|
static hasNonEachDynamicElementState(e) {
|
|
12239
12269
|
const t = /* @__PURE__ */ new Set([
|
|
12240
|
-
`${
|
|
12241
|
-
`${
|
|
12242
|
-
`${
|
|
12243
|
-
`${
|
|
12270
|
+
`${l.prefix}each`,
|
|
12271
|
+
`${l.prefix}each-key`,
|
|
12272
|
+
`${l.prefix}each-arg`,
|
|
12273
|
+
`${l.prefix}each-index`
|
|
12244
12274
|
]);
|
|
12245
12275
|
return e.getAttributeNames().some((i) => {
|
|
12246
12276
|
if (t.has(i))
|
|
12247
12277
|
return !1;
|
|
12248
|
-
if (i.startsWith(`${
|
|
12278
|
+
if (i.startsWith(`${l.prefix}attr-`) || i.startsWith(l.prefix))
|
|
12249
12279
|
return !0;
|
|
12250
12280
|
const n = e.getRawAttribute(i);
|
|
12251
12281
|
return typeof n == "string" && n.includes("{{");
|
|
@@ -12271,7 +12301,7 @@ ${r}
|
|
|
12271
12301
|
* @returns 再評価が必要なら true
|
|
12272
12302
|
*/
|
|
12273
12303
|
static isFreshInitializationDynamicAttribute(e, t) {
|
|
12274
|
-
if (t.startsWith(`${
|
|
12304
|
+
if (t.startsWith(`${l.prefix}attr-`) || t.startsWith(l.prefix))
|
|
12275
12305
|
return !0;
|
|
12276
12306
|
const r = e.getRawAttribute(t);
|
|
12277
12307
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -12286,55 +12316,55 @@ ${r}
|
|
|
12286
12316
|
const r = e.getTemplate();
|
|
12287
12317
|
if (r === null)
|
|
12288
12318
|
return y.error("[Haori]", "Template is not set for each element."), Promise.resolve();
|
|
12289
|
-
let i = e.getAttribute(`${
|
|
12319
|
+
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
12290
12320
|
i && (i = String(i));
|
|
12291
|
-
const n = e.getAttribute(`${
|
|
12292
|
-
(
|
|
12293
|
-
), o = new Set(a),
|
|
12294
|
-
a.forEach((
|
|
12295
|
-
|
|
12321
|
+
const n = e.getAttribute(`${l.prefix}each-key`), s = e.getAttribute(`${l.prefix}each-arg`), a = t.map(
|
|
12322
|
+
(A, S) => h.createListKey(A, n ? String(n) : null, S)
|
|
12323
|
+
), o = new Set(a), c = /* @__PURE__ */ new Map();
|
|
12324
|
+
a.forEach((A) => {
|
|
12325
|
+
c.set(A, (c.get(A) ?? 0) + 1);
|
|
12296
12326
|
}), n && o.size !== a.length && h.warnDuplicateEachKey(String(n));
|
|
12297
12327
|
const u = [];
|
|
12298
|
-
let d = e.getChildren().filter((
|
|
12299
|
-
(
|
|
12328
|
+
let d = e.getChildren().filter((A) => A instanceof I).filter(
|
|
12329
|
+
(A) => !A.hasAttribute(`${l.prefix}each-before`) && !A.hasAttribute(`${l.prefix}each-after`)
|
|
12300
12330
|
);
|
|
12301
|
-
const
|
|
12302
|
-
d = d.filter((
|
|
12303
|
-
const
|
|
12331
|
+
const g = d.map((A) => A.getListKey()), p = /* @__PURE__ */ new Set();
|
|
12332
|
+
d = d.filter((A, S) => {
|
|
12333
|
+
const C = String(A.getListKey()), V = c.get(C) ?? 0;
|
|
12304
12334
|
if (V === 0) {
|
|
12305
|
-
|
|
12306
|
-
const P =
|
|
12307
|
-
return P !== null && O.rowRemove(
|
|
12335
|
+
p.add(A);
|
|
12336
|
+
const P = A.getListKey();
|
|
12337
|
+
return P !== null && O.rowRemove(A.getTarget(), P, S), u.push(A.remove()), !1;
|
|
12308
12338
|
}
|
|
12309
|
-
return
|
|
12339
|
+
return c.set(C, V - 1), !0;
|
|
12310
12340
|
});
|
|
12311
|
-
const
|
|
12312
|
-
d.forEach((
|
|
12313
|
-
const S =
|
|
12341
|
+
const E = d.map((A) => A.getListKey()), v = /* @__PURE__ */ new Map();
|
|
12342
|
+
d.forEach((A) => {
|
|
12343
|
+
const S = A.getListKey();
|
|
12314
12344
|
if (S === null)
|
|
12315
12345
|
return;
|
|
12316
|
-
const
|
|
12317
|
-
|
|
12346
|
+
const C = v.get(S);
|
|
12347
|
+
C ? C.push(A) : v.set(S, [A]);
|
|
12318
12348
|
});
|
|
12319
|
-
const D = e.getChildElementFragments().filter((
|
|
12320
|
-
(
|
|
12349
|
+
const D = e.getChildElementFragments().filter((A) => !p.has(A)), k = D.filter(
|
|
12350
|
+
(A) => A.hasAttribute(`${l.prefix}each-before`)
|
|
12321
12351
|
).length;
|
|
12322
12352
|
let H = Promise.resolve();
|
|
12323
|
-
return a.forEach((
|
|
12324
|
-
const
|
|
12353
|
+
return a.forEach((A, S) => {
|
|
12354
|
+
const C = t[S], V = S;
|
|
12325
12355
|
let P;
|
|
12326
|
-
const _ = v.get(
|
|
12356
|
+
const _ = v.get(A)?.shift();
|
|
12327
12357
|
if (_) {
|
|
12328
12358
|
P = _;
|
|
12329
|
-
const
|
|
12359
|
+
const M = k + S;
|
|
12330
12360
|
H = H.then(
|
|
12331
12361
|
() => h.updateRowFragment(
|
|
12332
12362
|
P,
|
|
12333
|
-
|
|
12363
|
+
C,
|
|
12334
12364
|
i,
|
|
12335
12365
|
V,
|
|
12336
12366
|
s ? String(s) : null,
|
|
12337
|
-
|
|
12367
|
+
A
|
|
12338
12368
|
).then(
|
|
12339
12369
|
(q) => (
|
|
12340
12370
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
@@ -12344,16 +12374,16 @@ ${r}
|
|
|
12344
12374
|
e,
|
|
12345
12375
|
P,
|
|
12346
12376
|
D,
|
|
12347
|
-
|
|
12377
|
+
M
|
|
12348
12378
|
).then((X) => {
|
|
12349
12379
|
if (X !== null && O.rowMove(
|
|
12350
12380
|
P.getTarget(),
|
|
12351
|
-
|
|
12381
|
+
A,
|
|
12352
12382
|
X - k,
|
|
12353
12383
|
S
|
|
12354
12384
|
), !!q)
|
|
12355
12385
|
return h.evaluateAll(P).then(
|
|
12356
|
-
() => h.applyRowFormValues(e, P,
|
|
12386
|
+
() => h.applyRowFormValues(e, P, C)
|
|
12357
12387
|
);
|
|
12358
12388
|
})
|
|
12359
12389
|
)
|
|
@@ -12361,40 +12391,40 @@ ${r}
|
|
|
12361
12391
|
);
|
|
12362
12392
|
} else {
|
|
12363
12393
|
P = r.clone();
|
|
12364
|
-
const
|
|
12394
|
+
const M = k + S;
|
|
12365
12395
|
H = H.then(
|
|
12366
12396
|
() => h.updateRowFragment(
|
|
12367
12397
|
P,
|
|
12368
|
-
|
|
12398
|
+
C,
|
|
12369
12399
|
i,
|
|
12370
12400
|
V,
|
|
12371
12401
|
s ? String(s) : null,
|
|
12372
|
-
|
|
12402
|
+
A
|
|
12373
12403
|
).then(() => {
|
|
12374
|
-
const q = D[
|
|
12404
|
+
const q = D[M] ?? null;
|
|
12375
12405
|
return e.insertBefore(P, q).then(() => {
|
|
12376
|
-
D.splice(
|
|
12377
|
-
}).then(() => h.initializeFreshEachRow(P)).then(() => h.applyRowFormValues(e, P,
|
|
12378
|
-
O.rowAdd(P.getTarget(),
|
|
12406
|
+
D.splice(M, 0, P);
|
|
12407
|
+
}).then(() => h.initializeFreshEachRow(P)).then(() => h.applyRowFormValues(e, P, C)).then(() => {
|
|
12408
|
+
O.rowAdd(P.getTarget(), A, V, C);
|
|
12379
12409
|
});
|
|
12380
12410
|
})
|
|
12381
12411
|
);
|
|
12382
12412
|
}
|
|
12383
12413
|
}), Promise.all(u).then(() => H).then(() => {
|
|
12384
|
-
const
|
|
12385
|
-
(
|
|
12386
|
-
), S =
|
|
12387
|
-
(
|
|
12388
|
-
),
|
|
12389
|
-
(
|
|
12414
|
+
const A = a.filter(
|
|
12415
|
+
(M) => M !== null
|
|
12416
|
+
), S = E.filter(
|
|
12417
|
+
(M) => M !== null
|
|
12418
|
+
), C = new Set(S), V = A.filter((M) => !C.has(M)), _ = g.filter(
|
|
12419
|
+
(M) => M !== null
|
|
12390
12420
|
).filter(
|
|
12391
|
-
(
|
|
12421
|
+
(M) => !o.has(M)
|
|
12392
12422
|
);
|
|
12393
12423
|
O.eachUpdate(
|
|
12394
12424
|
e.getTarget(),
|
|
12395
12425
|
V,
|
|
12396
12426
|
_,
|
|
12397
|
-
|
|
12427
|
+
A
|
|
12398
12428
|
);
|
|
12399
12429
|
});
|
|
12400
12430
|
}
|
|
@@ -12412,7 +12442,7 @@ ${r}
|
|
|
12412
12442
|
static warnDuplicateEachKey(e) {
|
|
12413
12443
|
!j.isEnabled() || h.WARNED_DUPLICATE_EACH_KEYS.has(e) || (h.WARNED_DUPLICATE_EACH_KEYS.add(e), y.warn(
|
|
12414
12444
|
"[Haori]",
|
|
12415
|
-
`${
|
|
12445
|
+
`${l.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
12416
12446
|
));
|
|
12417
12447
|
}
|
|
12418
12448
|
/**
|
|
@@ -12462,7 +12492,7 @@ ${r}
|
|
|
12462
12492
|
* @returns 反映完了の Promise
|
|
12463
12493
|
*/
|
|
12464
12494
|
static applyRowFormValues(e, t, r) {
|
|
12465
|
-
return !e.hasAttribute(`${
|
|
12495
|
+
return !e.hasAttribute(`${l.prefix}form-list`) || !F.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : F.syncRowValues(t, r);
|
|
12466
12496
|
}
|
|
12467
12497
|
/**
|
|
12468
12498
|
* リスト比較用のキーを生成します。
|
|
@@ -12509,14 +12539,14 @@ ${r}
|
|
|
12509
12539
|
else
|
|
12510
12540
|
return y.error(
|
|
12511
12541
|
"[Haori]",
|
|
12512
|
-
`Primitive value requires '${
|
|
12542
|
+
`Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
|
|
12513
12543
|
), Promise.resolve(!1);
|
|
12514
12544
|
r && (a[r] = i);
|
|
12515
|
-
const o = a,
|
|
12545
|
+
const o = a, c = h.createBindingSignature({
|
|
12516
12546
|
listKey: s,
|
|
12517
12547
|
bindingData: o
|
|
12518
12548
|
});
|
|
12519
|
-
return e.getListKey() === s && e.getRenderSignature() ===
|
|
12549
|
+
return e.getListKey() === s && e.getRenderSignature() === c ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(c), e.setBindingData(o), e.setAttribute(`${l.prefix}row`, s).then(() => !0));
|
|
12520
12550
|
}
|
|
12521
12551
|
/**
|
|
12522
12552
|
* 新規挿入行に遅延再評価が必要かどうかを判定します。
|
|
@@ -12543,7 +12573,7 @@ ${r}
|
|
|
12543
12573
|
*/
|
|
12544
12574
|
static hasMountSensitiveAttribute(e) {
|
|
12545
12575
|
return ["fetch", "import"].some(
|
|
12546
|
-
(t) => e.hasAttribute(`${
|
|
12576
|
+
(t) => e.hasAttribute(`${l.prefix}${t}`)
|
|
12547
12577
|
);
|
|
12548
12578
|
}
|
|
12549
12579
|
/**
|
|
@@ -12675,7 +12705,7 @@ const me = class me {
|
|
|
12675
12705
|
* @returns 戻り値はない。
|
|
12676
12706
|
*/
|
|
12677
12707
|
runWindowLoadProcedure() {
|
|
12678
|
-
const e = document.documentElement, t =
|
|
12708
|
+
const e = document.documentElement, t = x.get(e);
|
|
12679
12709
|
t && new re(t, "load").run();
|
|
12680
12710
|
}
|
|
12681
12711
|
/**
|
|
@@ -12745,7 +12775,7 @@ const me = class me {
|
|
|
12745
12775
|
* @returns `data-on` 属性名
|
|
12746
12776
|
*/
|
|
12747
12777
|
get onAttributeName() {
|
|
12748
|
-
return `${
|
|
12778
|
+
return `${l.prefix}on`;
|
|
12749
12779
|
}
|
|
12750
12780
|
/**
|
|
12751
12781
|
* ルート配下に存在する `data-on` 宣言を走査し、カスタムイベントを購読します。
|
|
@@ -12799,7 +12829,7 @@ const me = class me {
|
|
|
12799
12829
|
this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
|
|
12800
12830
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
12801
12831
|
return;
|
|
12802
|
-
const n =
|
|
12832
|
+
const n = x.get(i);
|
|
12803
12833
|
n instanceof I && new re(n, "on", t).run().catch((s) => {
|
|
12804
12834
|
y.error("[Haori]", "Procedure execution error:", s);
|
|
12805
12835
|
});
|
|
@@ -12839,13 +12869,13 @@ const me = class me {
|
|
|
12839
12869
|
const r = this.getElementFromTarget(e.target, t);
|
|
12840
12870
|
if (r) {
|
|
12841
12871
|
if (t === "input") {
|
|
12842
|
-
const i = `${
|
|
12872
|
+
const i = `${l.prefix}input-`;
|
|
12843
12873
|
if (!r.getAttributeNames().some((s) => s.startsWith(i))) {
|
|
12844
12874
|
this.recordUserEdit(r);
|
|
12845
12875
|
return;
|
|
12846
12876
|
}
|
|
12847
12877
|
}
|
|
12848
|
-
if (r.hasAttribute(`${
|
|
12878
|
+
if (r.hasAttribute(`${l.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
12849
12879
|
this.deferredProcedures.push(() => {
|
|
12850
12880
|
r.isConnected && this.runProcedureFor(r, t, e);
|
|
12851
12881
|
});
|
|
@@ -12863,7 +12893,7 @@ const me = class me {
|
|
|
12863
12893
|
* @returns 戻り値はない。
|
|
12864
12894
|
*/
|
|
12865
12895
|
runProcedureFor(e, t, r) {
|
|
12866
|
-
const i =
|
|
12896
|
+
const i = x.get(e);
|
|
12867
12897
|
if (!i)
|
|
12868
12898
|
return;
|
|
12869
12899
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
@@ -12872,7 +12902,7 @@ const me = class me {
|
|
|
12872
12902
|
y.error("[Haori]", "Procedure execution error:", s);
|
|
12873
12903
|
});
|
|
12874
12904
|
};
|
|
12875
|
-
if (t === "click" && e.hasAttribute(`${
|
|
12905
|
+
if (t === "click" && e.hasAttribute(`${l.prefix}click-defer`)) {
|
|
12876
12906
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => n()) : setTimeout(n, 0);
|
|
12877
12907
|
return;
|
|
12878
12908
|
}
|
|
@@ -12920,7 +12950,7 @@ const me = class me {
|
|
|
12920
12950
|
* @returns 戻り値はない。
|
|
12921
12951
|
*/
|
|
12922
12952
|
markUserEditOnly(e) {
|
|
12923
|
-
const t =
|
|
12953
|
+
const t = x.get(e);
|
|
12924
12954
|
t instanceof I && t.markUserEdit();
|
|
12925
12955
|
}
|
|
12926
12956
|
/**
|
|
@@ -12936,13 +12966,13 @@ const me = class me {
|
|
|
12936
12966
|
* @returns 戻り値はない。
|
|
12937
12967
|
*/
|
|
12938
12968
|
syncUserEdit(e, t) {
|
|
12939
|
-
const r =
|
|
12969
|
+
const r = x.get(e);
|
|
12940
12970
|
if (r instanceof I && (r.syncValue(), t ? r.markUserEditOnChange() : r.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
12941
12971
|
const i = document.getElementsByName(e.name);
|
|
12942
12972
|
for (const n of Array.from(i)) {
|
|
12943
12973
|
if (n === e || !(n instanceof HTMLInputElement) || n.type !== "radio" || n.form !== e.form)
|
|
12944
12974
|
continue;
|
|
12945
|
-
const s =
|
|
12975
|
+
const s = x.get(n);
|
|
12946
12976
|
s instanceof I && (s.syncValue(), s.markUserEdit());
|
|
12947
12977
|
}
|
|
12948
12978
|
}
|
|
@@ -12978,7 +13008,7 @@ const me = class me {
|
|
|
12978
13008
|
* @returns 処理対象要素。見つからない場合は null
|
|
12979
13009
|
*/
|
|
12980
13010
|
findClickableElement(e) {
|
|
12981
|
-
const t = `${
|
|
13011
|
+
const t = `${l.prefix}click-`, r = `${l.prefix}click-passive`;
|
|
12982
13012
|
let i = e;
|
|
12983
13013
|
for (; i; ) {
|
|
12984
13014
|
if (i.getAttributeNames().some((s) => s.startsWith(t) && s !== r))
|
|
@@ -13016,14 +13046,14 @@ const W = class W {
|
|
|
13016
13046
|
}));
|
|
13017
13047
|
}
|
|
13018
13048
|
static syncElement(e) {
|
|
13019
|
-
const t = W.registrations.get(e), r =
|
|
13049
|
+
const t = W.registrations.get(e), r = x.get(e);
|
|
13020
13050
|
if (!r || !W.shouldObserve(r)) {
|
|
13021
13051
|
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13022
13052
|
return;
|
|
13023
13053
|
}
|
|
13024
13054
|
if (typeof IntersectionObserver > "u")
|
|
13025
13055
|
return;
|
|
13026
|
-
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${
|
|
13056
|
+
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
13027
13057
|
if (t && t.observer.root === i && t.observer.rootMargin === n && W.sameThreshold(
|
|
13028
13058
|
t.observer.thresholds,
|
|
13029
13059
|
s
|
|
@@ -13033,20 +13063,20 @@ const W = class W {
|
|
|
13033
13063
|
}
|
|
13034
13064
|
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13035
13065
|
const o = new IntersectionObserver(
|
|
13036
|
-
(
|
|
13066
|
+
(c) => {
|
|
13037
13067
|
const u = W.registrations.get(e);
|
|
13038
|
-
u &&
|
|
13039
|
-
!d.isIntersecting || u.running || W.isDisabled(u.fragment) || (u.running = !0, new re(u.fragment, "intersect").runWithResult().then((
|
|
13040
|
-
|
|
13041
|
-
}).catch((
|
|
13068
|
+
u && c.forEach((d) => {
|
|
13069
|
+
!d.isIntersecting || u.running || W.isDisabled(u.fragment) || (u.running = !0, new re(u.fragment, "intersect").runWithResult().then((g) => {
|
|
13070
|
+
g && u.once && (u.observer.disconnect(), W.registrations.delete(e));
|
|
13071
|
+
}).catch((g) => {
|
|
13042
13072
|
y.error(
|
|
13043
13073
|
"[Haori]",
|
|
13044
13074
|
"Intersect procedure execution error:",
|
|
13045
|
-
|
|
13075
|
+
g
|
|
13046
13076
|
);
|
|
13047
13077
|
}).finally(() => {
|
|
13048
|
-
const
|
|
13049
|
-
|
|
13078
|
+
const g = W.registrations.get(e);
|
|
13079
|
+
g && (g.running = !1);
|
|
13050
13080
|
}));
|
|
13051
13081
|
});
|
|
13052
13082
|
},
|
|
@@ -13080,14 +13110,14 @@ const W = class W {
|
|
|
13080
13110
|
}
|
|
13081
13111
|
static shouldObserve(e) {
|
|
13082
13112
|
return e.getAttributeNames().some((t) => {
|
|
13083
|
-
if (!t.startsWith(`${
|
|
13113
|
+
if (!t.startsWith(`${l.prefix}intersect-`))
|
|
13084
13114
|
return !1;
|
|
13085
|
-
const r = t.slice(`${
|
|
13115
|
+
const r = t.slice(`${l.prefix}intersect-`.length);
|
|
13086
13116
|
return !W.CONFIG_KEYS.has(r);
|
|
13087
13117
|
});
|
|
13088
13118
|
}
|
|
13089
13119
|
static resolveRoot(e) {
|
|
13090
|
-
const t = `${
|
|
13120
|
+
const t = `${l.prefix}intersect-root`;
|
|
13091
13121
|
if (!e.hasAttribute(t))
|
|
13092
13122
|
return null;
|
|
13093
13123
|
const r = e.getAttribute(t);
|
|
@@ -13097,15 +13127,15 @@ const W = class W {
|
|
|
13097
13127
|
return W.isHtmlElement(i) ? i : (y.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
13098
13128
|
}
|
|
13099
13129
|
static resolveRootMargin(e) {
|
|
13100
|
-
const t = `${
|
|
13130
|
+
const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
13101
13131
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
13102
13132
|
}
|
|
13103
13133
|
static resolveThreshold(e) {
|
|
13104
|
-
const t = `${
|
|
13134
|
+
const t = `${l.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
13105
13135
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
13106
13136
|
}
|
|
13107
13137
|
static isDisabled(e) {
|
|
13108
|
-
const t = `${
|
|
13138
|
+
const t = `${l.prefix}intersect-disabled`, r = e.getAttribute(t);
|
|
13109
13139
|
if (r === null || r === !1)
|
|
13110
13140
|
return !1;
|
|
13111
13141
|
if (typeof r == "boolean")
|
|
@@ -13150,7 +13180,7 @@ const w = class w {
|
|
|
13150
13180
|
const t = w.registrations.get(e);
|
|
13151
13181
|
if (!t && !w.hasPollAttribute(e))
|
|
13152
13182
|
return;
|
|
13153
|
-
const r =
|
|
13183
|
+
const r = x.get(e);
|
|
13154
13184
|
if (!(r instanceof I) || !w.shouldObserve(r)) {
|
|
13155
13185
|
t && w.teardown(e, t);
|
|
13156
13186
|
return;
|
|
@@ -13220,7 +13250,7 @@ const w = class w {
|
|
|
13220
13250
|
* @returns `data-poll-*` を持つ場合は true
|
|
13221
13251
|
*/
|
|
13222
13252
|
static hasPollAttribute(e) {
|
|
13223
|
-
const t = `${
|
|
13253
|
+
const t = `${l.prefix}poll-`, r = e.attributes;
|
|
13224
13254
|
for (let i = 0; i < r.length; i += 1)
|
|
13225
13255
|
if (r[i].name.startsWith(t))
|
|
13226
13256
|
return !0;
|
|
@@ -13236,7 +13266,7 @@ const w = class w {
|
|
|
13236
13266
|
* @returns 監視対象の場合は true
|
|
13237
13267
|
*/
|
|
13238
13268
|
static shouldObserve(e) {
|
|
13239
|
-
const t = `${
|
|
13269
|
+
const t = `${l.prefix}poll-`;
|
|
13240
13270
|
return e.getAttributeNames().some((r) => r.startsWith(t) ? !w.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
13241
13271
|
}
|
|
13242
13272
|
/**
|
|
@@ -13253,7 +13283,7 @@ const w = class w {
|
|
|
13253
13283
|
* @returns 設定の同一性を表すキー
|
|
13254
13284
|
*/
|
|
13255
13285
|
static buildConfigKey(e) {
|
|
13256
|
-
const t = `${
|
|
13286
|
+
const t = `${l.prefix}poll-`;
|
|
13257
13287
|
return e.getAttributeNames().filter((r) => r.startsWith(t)).sort().map((r) => `${r}=${e.getRawAttribute(r) ?? ""}`).join(`
|
|
13258
13288
|
`);
|
|
13259
13289
|
}
|
|
@@ -13503,7 +13533,7 @@ const w = class w {
|
|
|
13503
13533
|
* @returns 注入先フラグメントのリスト
|
|
13504
13534
|
*/
|
|
13505
13535
|
static resolveStateFragments(e) {
|
|
13506
|
-
const t = `${
|
|
13536
|
+
const t = `${l.prefix}poll-state`, r = e.fragment;
|
|
13507
13537
|
if (!r.hasAttribute(t))
|
|
13508
13538
|
return [];
|
|
13509
13539
|
const i = r.getAttribute(t);
|
|
@@ -13520,7 +13550,7 @@ const w = class w {
|
|
|
13520
13550
|
return n.forEach((a) => {
|
|
13521
13551
|
if (!a.isConnected)
|
|
13522
13552
|
return;
|
|
13523
|
-
const o =
|
|
13553
|
+
const o = x.get(a);
|
|
13524
13554
|
o instanceof I && s.push(o);
|
|
13525
13555
|
}), s;
|
|
13526
13556
|
}
|
|
@@ -13534,7 +13564,7 @@ const w = class w {
|
|
|
13534
13564
|
* @returns 取得間隔(ミリ秒)
|
|
13535
13565
|
*/
|
|
13536
13566
|
static resolveInterval(e) {
|
|
13537
|
-
const t = `${
|
|
13567
|
+
const t = `${l.prefix}poll-interval`;
|
|
13538
13568
|
if (!e.hasAttribute(t))
|
|
13539
13569
|
return w.DEFAULT_INTERVAL_MS;
|
|
13540
13570
|
const r = w.toNumber(e.getAttribute(t));
|
|
@@ -13553,7 +13583,7 @@ const w = class w {
|
|
|
13553
13583
|
* @returns 打ち切り時間(ミリ秒)。省略時や不正値の場合は null(無制限)
|
|
13554
13584
|
*/
|
|
13555
13585
|
static resolveTimeout(e) {
|
|
13556
|
-
const t = `${
|
|
13586
|
+
const t = `${l.prefix}poll-timeout`;
|
|
13557
13587
|
if (!e.hasAttribute(t))
|
|
13558
13588
|
return null;
|
|
13559
13589
|
const r = w.toNumber(e.getAttribute(t));
|
|
@@ -13569,7 +13599,7 @@ const w = class w {
|
|
|
13569
13599
|
* @returns 連続失敗の上限回数。省略時や不正値の場合は null(無制限)
|
|
13570
13600
|
*/
|
|
13571
13601
|
static resolveErrorLimit(e) {
|
|
13572
|
-
const t = `${
|
|
13602
|
+
const t = `${l.prefix}poll-error-limit`;
|
|
13573
13603
|
if (!e.hasAttribute(t))
|
|
13574
13604
|
return null;
|
|
13575
13605
|
const r = w.toNumber(e.getAttribute(t));
|
|
@@ -13604,7 +13634,7 @@ const w = class w {
|
|
|
13604
13634
|
* @returns 非表示の配下にある場合は true
|
|
13605
13635
|
*/
|
|
13606
13636
|
static isHidden(e) {
|
|
13607
|
-
return e.closest(`[${
|
|
13637
|
+
return e.closest(`[${l.prefix}if-false]`) !== null;
|
|
13608
13638
|
}
|
|
13609
13639
|
/**
|
|
13610
13640
|
* `data-poll-disabled` が真かどうかを判定します。
|
|
@@ -13613,7 +13643,7 @@ const w = class w {
|
|
|
13613
13643
|
* @returns 抑止中の場合は true
|
|
13614
13644
|
*/
|
|
13615
13645
|
static isDisabled(e) {
|
|
13616
|
-
const t = `${
|
|
13646
|
+
const t = `${l.prefix}poll-disabled`;
|
|
13617
13647
|
return e.hasAttribute(t) ? w.isTruthy(e.getAttribute(t)) : !1;
|
|
13618
13648
|
}
|
|
13619
13649
|
/**
|
|
@@ -13628,7 +13658,7 @@ const w = class w {
|
|
|
13628
13658
|
* @returns 条件が成立した場合は true
|
|
13629
13659
|
*/
|
|
13630
13660
|
static isUntilSatisfied(e) {
|
|
13631
|
-
const t = `${
|
|
13661
|
+
const t = `${l.prefix}poll-until`;
|
|
13632
13662
|
if (!e.hasAttribute(t))
|
|
13633
13663
|
return !1;
|
|
13634
13664
|
const r = e.getAttributeEvaluation(t);
|
|
@@ -13669,7 +13699,7 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
13669
13699
|
"state"
|
|
13670
13700
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
13671
13701
|
let pe = w;
|
|
13672
|
-
const Vt = "0.45.
|
|
13702
|
+
const Vt = "0.45.3";
|
|
13673
13703
|
function qt(m) {
|
|
13674
13704
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => m()) : Promise.resolve().then(m);
|
|
13675
13705
|
}
|
|
@@ -13703,7 +13733,7 @@ const L = class L {
|
|
|
13703
13733
|
* @param element 対象要素
|
|
13704
13734
|
*/
|
|
13705
13735
|
static syncElement(e) {
|
|
13706
|
-
const t = L.registrations.get(e), r =
|
|
13736
|
+
const t = L.registrations.get(e), r = x.get(e);
|
|
13707
13737
|
if (!(r instanceof I) || !L.shouldObserve(r)) {
|
|
13708
13738
|
t && (t.observer.disconnect(), L.registrations.delete(e));
|
|
13709
13739
|
return;
|
|
@@ -13725,14 +13755,14 @@ const L = class L {
|
|
|
13725
13755
|
}
|
|
13726
13756
|
t && (t.observer.disconnect(), L.registrations.delete(e));
|
|
13727
13757
|
const a = new IntersectionObserver(
|
|
13728
|
-
(
|
|
13758
|
+
(c) => {
|
|
13729
13759
|
const u = L.registrations.get(e);
|
|
13730
13760
|
if (!u)
|
|
13731
13761
|
return;
|
|
13732
13762
|
let d = !1;
|
|
13733
|
-
|
|
13734
|
-
const
|
|
13735
|
-
u.observedRows.has(
|
|
13763
|
+
c.forEach((g) => {
|
|
13764
|
+
const p = g.target;
|
|
13765
|
+
u.observedRows.has(p) && (g.isIntersecting ? u.visibleRows.has(p) || (u.visibleRows.add(p), d = !0) : u.visibleRows.delete(p) && (d = !0));
|
|
13736
13766
|
}), d && L.scheduleCompute(u);
|
|
13737
13767
|
},
|
|
13738
13768
|
{
|
|
@@ -13783,7 +13813,7 @@ const L = class L {
|
|
|
13783
13813
|
* @returns 監視対象なら true
|
|
13784
13814
|
*/
|
|
13785
13815
|
static shouldObserve(e) {
|
|
13786
|
-
return e.hasAttribute(`${
|
|
13816
|
+
return e.hasAttribute(`${l.prefix}each`) && e.hasAttribute(`${l.prefix}each-visible`);
|
|
13787
13817
|
}
|
|
13788
13818
|
/**
|
|
13789
13819
|
* 公開する変数名を解決します。
|
|
@@ -13792,7 +13822,7 @@ const L = class L {
|
|
|
13792
13822
|
* @returns 変数名。未指定なら空文字
|
|
13793
13823
|
*/
|
|
13794
13824
|
static resolveVarName(e) {
|
|
13795
|
-
const t = e.getRawAttribute(`${
|
|
13825
|
+
const t = e.getRawAttribute(`${l.prefix}each-visible`);
|
|
13796
13826
|
return typeof t == "string" ? t.trim() : "";
|
|
13797
13827
|
}
|
|
13798
13828
|
/**
|
|
@@ -13802,7 +13832,7 @@ const L = class L {
|
|
|
13802
13832
|
* @returns root 要素。未指定・不正ならビューポート(null)
|
|
13803
13833
|
*/
|
|
13804
13834
|
static resolveRoot(e) {
|
|
13805
|
-
const t = `${
|
|
13835
|
+
const t = `${l.prefix}each-visible-root`;
|
|
13806
13836
|
if (!e.hasAttribute(t))
|
|
13807
13837
|
return null;
|
|
13808
13838
|
const r = e.getAttribute(t);
|
|
@@ -13818,7 +13848,7 @@ const L = class L {
|
|
|
13818
13848
|
* @returns rootMargin 文字列(未指定は既定値)
|
|
13819
13849
|
*/
|
|
13820
13850
|
static resolveRootMargin(e) {
|
|
13821
|
-
const t = `${
|
|
13851
|
+
const t = `${l.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
13822
13852
|
return r === null || r === !1 || r === "" ? L.DEFAULT_ROOT_MARGIN : String(r);
|
|
13823
13853
|
}
|
|
13824
13854
|
/**
|
|
@@ -13829,7 +13859,7 @@ const L = class L {
|
|
|
13829
13859
|
*/
|
|
13830
13860
|
static realRowElements(e) {
|
|
13831
13861
|
return e.getChildren().filter(
|
|
13832
|
-
(t) => t instanceof I && !t.hasAttribute(`${
|
|
13862
|
+
(t) => t instanceof I && !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
13833
13863
|
).map((t) => t.getTarget());
|
|
13834
13864
|
}
|
|
13835
13865
|
/**
|
|
@@ -13884,8 +13914,8 @@ const L = class L {
|
|
|
13884
13914
|
};
|
|
13885
13915
|
else {
|
|
13886
13916
|
let a = i[0], o = i[0];
|
|
13887
|
-
for (const
|
|
13888
|
-
|
|
13917
|
+
for (const c of i)
|
|
13918
|
+
c < a && (a = c), c > o && (o = c);
|
|
13889
13919
|
n = {
|
|
13890
13920
|
first: a,
|
|
13891
13921
|
last: o,
|
|
@@ -13938,7 +13968,7 @@ const L = class L {
|
|
|
13938
13968
|
* @returns 公開先フラグメント。無ければ null
|
|
13939
13969
|
*/
|
|
13940
13970
|
static resolveBindOwner(e) {
|
|
13941
|
-
const t = `${
|
|
13971
|
+
const t = `${l.prefix}bind`;
|
|
13942
13972
|
let r = e.getParent();
|
|
13943
13973
|
for (; r; ) {
|
|
13944
13974
|
if (r.hasAttribute(t))
|
|
@@ -14013,7 +14043,7 @@ const G = class G {
|
|
|
14013
14043
|
* @returns 外部管理サブツリーに属する場合 true
|
|
14014
14044
|
*/
|
|
14015
14045
|
static isExternallyManaged(e) {
|
|
14016
|
-
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${
|
|
14046
|
+
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${l.prefix}external]`) != null;
|
|
14017
14047
|
}
|
|
14018
14048
|
/**
|
|
14019
14049
|
* 指定された要素を監視します。
|
|
@@ -14071,7 +14101,7 @@ const G = class G {
|
|
|
14071
14101
|
* @returns `data-bind` 属性の変更なら true
|
|
14072
14102
|
*/
|
|
14073
14103
|
static isBindAttributeRecord(e) {
|
|
14074
|
-
return e.type === "attributes" && e.attributeName === `${
|
|
14104
|
+
return e.type === "attributes" && e.attributeName === `${l.prefix}bind`;
|
|
14075
14105
|
}
|
|
14076
14106
|
/**
|
|
14077
14107
|
* DOM 変更のレコードを処理します。
|
|
@@ -14089,7 +14119,7 @@ const G = class G {
|
|
|
14089
14119
|
switch (r.type) {
|
|
14090
14120
|
case "attributes": {
|
|
14091
14121
|
const i = r.target;
|
|
14092
|
-
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(Ae) && (r.attributeName === "disabled" || r.attributeName === Ae) || r.attributeName && (r.attributeName === `${
|
|
14122
|
+
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(Ae) && (r.attributeName === "disabled" || r.attributeName === Ae) || r.attributeName && (r.attributeName === `${l.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${l.prefix}if-false`)) || r.attributeName && B.isAliasedAttributeReflection(i, r.attributeName))
|
|
14093
14123
|
break;
|
|
14094
14124
|
B.setAttribute(
|
|
14095
14125
|
i,
|
|
@@ -14126,15 +14156,15 @@ const G = class G {
|
|
|
14126
14156
|
}
|
|
14127
14157
|
};
|
|
14128
14158
|
G._initialized = !1, G._mutationObservers = [], G._dispatcher = null;
|
|
14129
|
-
let
|
|
14130
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
14159
|
+
let xe = G;
|
|
14160
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", xe.init) : xe.init();
|
|
14131
14161
|
const Wt = () => ye.waitForRenders(), jt = ye.enhancers;
|
|
14132
14162
|
export {
|
|
14133
14163
|
B as Core,
|
|
14134
14164
|
ie as Enhance,
|
|
14135
|
-
|
|
14165
|
+
l as Env,
|
|
14136
14166
|
F as Form,
|
|
14137
|
-
|
|
14167
|
+
x as Fragment,
|
|
14138
14168
|
ye as Haori,
|
|
14139
14169
|
y as Log,
|
|
14140
14170
|
K as Queue,
|