haori 0.63.0 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +17 -17
- package/dist/haori.es.js +874 -831
- package/dist/haori.iife.js +14 -14
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -29,16 +29,16 @@ const we = class we {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
we.devMode = !1;
|
|
32
|
-
let
|
|
32
|
+
let H = we;
|
|
33
33
|
const tt = "embedded";
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function Nt(f) {
|
|
35
|
+
return f === "embedded" || f === "demo";
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function er(f) {
|
|
38
|
+
return f === null ? null : Nt(f) ? f : tt;
|
|
39
39
|
}
|
|
40
|
-
function ut(
|
|
41
|
-
const e =
|
|
40
|
+
function ut(f) {
|
|
41
|
+
const e = f.trim().toLowerCase();
|
|
42
42
|
return e !== "false" && e !== "off" && e !== "0";
|
|
43
43
|
}
|
|
44
44
|
const ee = class ee {
|
|
@@ -97,7 +97,7 @@ const ee = class ee {
|
|
|
97
97
|
* @return 戻り値はありません。
|
|
98
98
|
*/
|
|
99
99
|
static setRuntime(e) {
|
|
100
|
-
ee._runtime =
|
|
100
|
+
ee._runtime = Nt(e) ? e : tt;
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* 実行環境からプレフィックスと開発モードかどうかを自動検出します。
|
|
@@ -111,7 +111,7 @@ const ee = class ee {
|
|
|
111
111
|
if (e instanceof HTMLScriptElement) {
|
|
112
112
|
const r = e.getAttribute("data-prefix") || ee._prefix;
|
|
113
113
|
ee._prefix = r.endsWith("-") ? r : r + "-";
|
|
114
|
-
const i =
|
|
114
|
+
const i = er(
|
|
115
115
|
e.getAttribute("data-runtime")
|
|
116
116
|
);
|
|
117
117
|
i !== null && (ee._runtime = i), ee._strictBind = e.hasAttribute(
|
|
@@ -121,7 +121,7 @@ const ee = class ee {
|
|
|
121
121
|
s !== null && (ee._csp = ut(s));
|
|
122
122
|
}
|
|
123
123
|
if (e instanceof HTMLScriptElement && e.hasAttribute(`${ee._prefix}dev`)) {
|
|
124
|
-
|
|
124
|
+
H.set(
|
|
125
125
|
ut(
|
|
126
126
|
e.getAttribute(`${ee._prefix}dev`) ?? ""
|
|
127
127
|
)
|
|
@@ -130,10 +130,10 @@ const ee = class ee {
|
|
|
130
130
|
}
|
|
131
131
|
const t = window.location.hostname;
|
|
132
132
|
if (t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "::1" || t.endsWith(".local")) {
|
|
133
|
-
|
|
133
|
+
H.set(!0);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
H.set(!1);
|
|
137
137
|
} catch {
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -149,7 +149,7 @@ const ee = class ee {
|
|
|
149
149
|
ee._prefix = "data-", ee._runtime = tt, ee._strictBind = !1, ee._csp = !1;
|
|
150
150
|
let c = ee;
|
|
151
151
|
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", c.detect) : c.detect());
|
|
152
|
-
class
|
|
152
|
+
class m {
|
|
153
153
|
/**
|
|
154
154
|
* 開発モードでのみコンソールに情報を出力します。
|
|
155
155
|
*
|
|
@@ -157,7 +157,7 @@ class y {
|
|
|
157
157
|
* @param args 追加の引数
|
|
158
158
|
*/
|
|
159
159
|
static info(e, ...t) {
|
|
160
|
-
|
|
160
|
+
H.isEnabled() && console.log && console.log(e, ...t);
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* 開発モードでのみコンソールに警告を出力します。
|
|
@@ -166,7 +166,7 @@ class y {
|
|
|
166
166
|
* @param args 追加の引数
|
|
167
167
|
*/
|
|
168
168
|
static warn(e, ...t) {
|
|
169
|
-
|
|
169
|
+
H.isEnabled() && console.warn && console.warn(e, ...t);
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* モードに関係なくコンソールにエラーを出力します。
|
|
@@ -178,7 +178,7 @@ class y {
|
|
|
178
178
|
console.error(e, ...t);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const tr = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:", I = class I {
|
|
182
182
|
/**
|
|
183
183
|
* 外部ライブラリ連携を登録します。
|
|
184
184
|
*
|
|
@@ -193,11 +193,11 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
193
193
|
static register(e, t) {
|
|
194
194
|
const r = typeof e == "string" ? e.trim() : "";
|
|
195
195
|
if (r === "") {
|
|
196
|
-
|
|
196
|
+
m.error("[Haori]", "Enhancer name is required.");
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
if (!t || typeof t.init != "function") {
|
|
200
|
-
|
|
200
|
+
m.error("[Haori]", `Enhancer "${r}" must have an init function.`);
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
I.enhancers.set(r, t), I.warnedUnknownNames.delete(r), typeof document < "u" && document.body && I.forEachTarget(document.body, (i) => {
|
|
@@ -397,8 +397,8 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
397
397
|
* @returns 解決した値。解決できない場合は null
|
|
398
398
|
*/
|
|
399
399
|
static resolveGlobal(e) {
|
|
400
|
-
if (!
|
|
401
|
-
return
|
|
400
|
+
if (!tr.test(e))
|
|
401
|
+
return m.error(
|
|
402
402
|
"[Haori]",
|
|
403
403
|
`${c.prefix}enhance-new accepts a dot-separated global reference only: ${e}`
|
|
404
404
|
), null;
|
|
@@ -411,7 +411,7 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
411
411
|
if (t = t[r], t === void 0)
|
|
412
412
|
break;
|
|
413
413
|
}
|
|
414
|
-
return typeof t != "function" ? (
|
|
414
|
+
return typeof t != "function" ? (H.isEnabled() && !I.warnedMissingGlobals.has(e) && (I.warnedMissingGlobals.add(e), m.warn(
|
|
415
415
|
"[Haori]",
|
|
416
416
|
`${c.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
417
417
|
)), null) : t;
|
|
@@ -423,7 +423,7 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
423
423
|
* @returns 戻り値はありません。
|
|
424
424
|
*/
|
|
425
425
|
static warnUnknownName(e) {
|
|
426
|
-
!
|
|
426
|
+
!H.isEnabled() || I.warnedUnknownNames.has(e) || (I.warnedUnknownNames.add(e), m.warn(
|
|
427
427
|
"[Haori]",
|
|
428
428
|
`Enhancer "${e}" is not registered yet; the declaration is kept pending and applied when it is registered (Haori.enhancers.register('${e}', {init(el) {...}})).`
|
|
429
429
|
));
|
|
@@ -443,7 +443,7 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
443
443
|
try {
|
|
444
444
|
t();
|
|
445
445
|
} catch (i) {
|
|
446
|
-
|
|
446
|
+
m.error("[Haori]", `${e} failed:`, i);
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
449
|
I.mutationCapture ? I.mutationCapture(r) : r();
|
|
@@ -451,14 +451,14 @@ const _t = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, dt = "new:
|
|
|
451
451
|
};
|
|
452
452
|
I.enhancers = /* @__PURE__ */ new Map(), I.instances = /* @__PURE__ */ new WeakMap(), I.warnedUnknownNames = /* @__PURE__ */ new Set(), I.warnedMissingGlobals = /* @__PURE__ */ new Set(), I.visited = /* @__PURE__ */ new WeakSet(), I.mutationCapture = null;
|
|
453
453
|
let ae = I;
|
|
454
|
-
const
|
|
455
|
-
function fe(
|
|
456
|
-
return String(
|
|
454
|
+
const It = "yyyy/MM/dd HH:mm", rr = "en-US", ht = 1e4;
|
|
455
|
+
function fe(f) {
|
|
456
|
+
return String(f).padStart(2, "0");
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Ft(f, e, t, r, i, s) {
|
|
459
459
|
return {
|
|
460
|
-
yyyy: String(
|
|
461
|
-
yy: fe(
|
|
460
|
+
yyyy: String(f).padStart(4, "0"),
|
|
461
|
+
yy: fe(f % 100),
|
|
462
462
|
MM: fe(e),
|
|
463
463
|
M: String(e),
|
|
464
464
|
dd: fe(t),
|
|
@@ -469,7 +469,7 @@ function Nt(p, e, t, r, i, s) {
|
|
|
469
469
|
ss: fe(s)
|
|
470
470
|
};
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Ct(f, e) {
|
|
473
473
|
let t;
|
|
474
474
|
try {
|
|
475
475
|
t = new Intl.DateTimeFormat("en-US", {
|
|
@@ -481,7 +481,7 @@ function It(p, e) {
|
|
|
481
481
|
hour: "2-digit",
|
|
482
482
|
minute: "2-digit",
|
|
483
483
|
second: "2-digit"
|
|
484
|
-
}).formatToParts(
|
|
484
|
+
}).formatToParts(f);
|
|
485
485
|
} catch {
|
|
486
486
|
return null;
|
|
487
487
|
}
|
|
@@ -489,20 +489,20 @@ function It(p, e) {
|
|
|
489
489
|
for (const u of t)
|
|
490
490
|
u.type !== "literal" && (r[u.type] = u.value);
|
|
491
491
|
const i = Number(r.year), s = Number(r.month), n = Number(r.day), a = Number(r.hour), o = Number(r.minute), l = Number(r.second);
|
|
492
|
-
return !Number.isFinite(i) || !Number.isFinite(s) || !Number.isFinite(n) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) ? null :
|
|
492
|
+
return !Number.isFinite(i) || !Number.isFinite(s) || !Number.isFinite(n) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) ? null : Ft(i, s, n, a, o, l);
|
|
493
493
|
}
|
|
494
|
-
function Je(
|
|
495
|
-
if (
|
|
494
|
+
function Je(f, e = It, t) {
|
|
495
|
+
if (f == null || f === "")
|
|
496
496
|
return "";
|
|
497
|
-
const r =
|
|
497
|
+
const r = f instanceof Date ? f : new Date(f);
|
|
498
498
|
if (Number.isNaN(r.getTime()))
|
|
499
499
|
return "";
|
|
500
500
|
let i;
|
|
501
501
|
if (typeof t == "string" && t.trim() !== "") {
|
|
502
|
-
if (i =
|
|
502
|
+
if (i = Ct(r, t.trim()), i === null)
|
|
503
503
|
return "";
|
|
504
504
|
} else
|
|
505
|
-
i =
|
|
505
|
+
i = Ft(
|
|
506
506
|
r.getFullYear(),
|
|
507
507
|
r.getMonth() + 1,
|
|
508
508
|
r.getDate(),
|
|
@@ -516,15 +516,15 @@ function Je(p, e = xt, t) {
|
|
|
516
516
|
(n, a) => a !== void 0 ? a === "" ? "'" : a : s[n]
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
|
-
const
|
|
520
|
-
function
|
|
521
|
-
return Je(/* @__PURE__ */ new Date(),
|
|
519
|
+
const ir = "yyyy-MM-dd";
|
|
520
|
+
function Mt(f = It, e) {
|
|
521
|
+
return Je(/* @__PURE__ */ new Date(), f, e);
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
const r = Number.isFinite(
|
|
523
|
+
function $t(f = 0, e = ir, t) {
|
|
524
|
+
const r = Number.isFinite(f) ? Math.trunc(f) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
525
525
|
let s, n, a;
|
|
526
526
|
if (i !== "") {
|
|
527
|
-
const l =
|
|
527
|
+
const l = Ct(/* @__PURE__ */ new Date(), i);
|
|
528
528
|
if (l === null)
|
|
529
529
|
return "";
|
|
530
530
|
s = Number(l.yyyy), n = Number(l.MM), a = Number(l.dd);
|
|
@@ -535,14 +535,14 @@ function Ct(p = 0, e = tr, t) {
|
|
|
535
535
|
const o = new Date(Date.UTC(s, n - 1, a + r));
|
|
536
536
|
return Je(o, e, "UTC");
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
if (
|
|
538
|
+
function Pt(f, e) {
|
|
539
|
+
if (f == null)
|
|
540
540
|
return "";
|
|
541
541
|
let t;
|
|
542
|
-
if (typeof
|
|
543
|
-
t =
|
|
542
|
+
if (typeof f == "number")
|
|
543
|
+
t = f;
|
|
544
544
|
else {
|
|
545
|
-
const i = String(
|
|
545
|
+
const i = String(f).trim();
|
|
546
546
|
if (i === "")
|
|
547
547
|
return "";
|
|
548
548
|
t = Number(i);
|
|
@@ -554,11 +554,11 @@ function Mt(p, e) {
|
|
|
554
554
|
const i = Math.max(0, Math.trunc(e));
|
|
555
555
|
r.minimumFractionDigits = i, r.maximumFractionDigits = i;
|
|
556
556
|
}
|
|
557
|
-
return new Intl.NumberFormat(
|
|
557
|
+
return new Intl.NumberFormat(rr, r).format(t);
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Lt(f, e, t) {
|
|
560
560
|
let r, i, s;
|
|
561
|
-
if (e === void 0 ? (r = 0, i =
|
|
561
|
+
if (e === void 0 ? (r = 0, i = f, s = 1) : (r = f, i = e, s = t === void 0 ? 1 : t), !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(s) || s === 0)
|
|
562
562
|
return [];
|
|
563
563
|
r = Math.trunc(r), i = Math.trunc(i), s = Math.trunc(s);
|
|
564
564
|
const n = [];
|
|
@@ -570,8 +570,8 @@ function $t(p, e, t) {
|
|
|
570
570
|
n.push(a);
|
|
571
571
|
return n;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
const r = Math.trunc(Number(
|
|
573
|
+
function Ot(f, e, t = {}) {
|
|
574
|
+
const r = Math.trunc(Number(f));
|
|
575
575
|
if (!Number.isFinite(r) || r <= 0)
|
|
576
576
|
return [];
|
|
577
577
|
const i = Math.min(
|
|
@@ -584,16 +584,16 @@ function Pt(p, e, t = {}) {
|
|
|
584
584
|
a.add(d);
|
|
585
585
|
for (let d = Math.max(0, i - s); d <= Math.min(r - 1, i + s); d += 1)
|
|
586
586
|
a.add(d);
|
|
587
|
-
const o = Array.from(a).sort((d,
|
|
587
|
+
const o = Array.from(a).sort((d, y) => d - y), l = [];
|
|
588
588
|
let u = null;
|
|
589
589
|
for (const d of o) {
|
|
590
590
|
if (u !== null && d - u > 1)
|
|
591
591
|
if (d - u === 2) {
|
|
592
|
-
const
|
|
592
|
+
const y = u + 1;
|
|
593
593
|
l.push({
|
|
594
|
-
page:
|
|
595
|
-
label:
|
|
596
|
-
active:
|
|
594
|
+
page: y,
|
|
595
|
+
label: y + 1,
|
|
596
|
+
active: y === i,
|
|
597
597
|
ellipsis: !1
|
|
598
598
|
});
|
|
599
599
|
} else
|
|
@@ -607,15 +607,15 @@ function Pt(p, e, t = {}) {
|
|
|
607
607
|
}
|
|
608
608
|
return l;
|
|
609
609
|
}
|
|
610
|
-
const
|
|
611
|
-
function Ve(
|
|
612
|
-
const t = Number(
|
|
610
|
+
const sr = /^(\d{4})-(\d{1,2})$/, nr = 1200;
|
|
611
|
+
function Ve(f, e) {
|
|
612
|
+
const t = Number(f);
|
|
613
613
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
614
614
|
}
|
|
615
|
-
function Ze(
|
|
616
|
-
if (typeof
|
|
615
|
+
function Ze(f, e) {
|
|
616
|
+
if (typeof f != "string")
|
|
617
617
|
return "";
|
|
618
|
-
const t =
|
|
618
|
+
const t = sr.exec(f.trim());
|
|
619
619
|
if (!t)
|
|
620
620
|
return "";
|
|
621
621
|
const r = Number(t[1]), i = Number(t[2]);
|
|
@@ -624,31 +624,31 @@ function Ze(p, e) {
|
|
|
624
624
|
const s = Number.isFinite(e) ? Math.trunc(e) : 0, n = r * 12 + (i - 1) + s, a = Math.floor(n / 12), o = n - a * 12 + 1;
|
|
625
625
|
return `${String(a).padStart(4, "0")}-${fe(o)}`;
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
if (typeof
|
|
629
|
-
return Ze(
|
|
627
|
+
function ar(f) {
|
|
628
|
+
if (typeof f == "string" && f.trim() !== "")
|
|
629
|
+
return Ze(f, 0);
|
|
630
630
|
const e = /* @__PURE__ */ new Date();
|
|
631
631
|
return `${String(e.getFullYear()).padStart(4, "0")}-${fe(e.getMonth() + 1)}`;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
const t = Math.trunc(Number(
|
|
633
|
+
function Bt(f, e) {
|
|
634
|
+
const t = Math.trunc(Number(f));
|
|
635
635
|
if (!Number.isFinite(t) || t < 0)
|
|
636
636
|
return [];
|
|
637
|
-
const r =
|
|
637
|
+
const r = ar(e);
|
|
638
638
|
if (r === "")
|
|
639
639
|
return [];
|
|
640
|
-
const i = Math.min(t,
|
|
640
|
+
const i = Math.min(t, nr), s = [];
|
|
641
641
|
for (let n = 0; n <= i; n += 1) {
|
|
642
642
|
const a = Ze(r, -n);
|
|
643
643
|
s.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
644
644
|
}
|
|
645
645
|
return s;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Ut(f, e) {
|
|
648
648
|
const t = { start: 0, end: 0, total: 0, empty: !0 };
|
|
649
|
-
if (!
|
|
649
|
+
if (!f || typeof f != "object")
|
|
650
650
|
return t;
|
|
651
|
-
const r =
|
|
651
|
+
const r = f, i = Ve(r.totalElements ?? r.totalCount, 0);
|
|
652
652
|
if (i <= 0)
|
|
653
653
|
return t;
|
|
654
654
|
const s = Math.max(0, Ve(r.number, 0)), n = Math.max(0, Ve(r.size, 0)), a = s * n, o = Math.min(a + 1, i);
|
|
@@ -662,19 +662,19 @@ function Ot(p, e) {
|
|
|
662
662
|
const u = Math.min(a + l, i);
|
|
663
663
|
return { start: o, end: Math.max(u, o), total: i, empty: !1 };
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
if (!Array.isArray(
|
|
665
|
+
function Ht(f, e, t) {
|
|
666
|
+
if (!Array.isArray(f) || f.length === 0)
|
|
667
667
|
return null;
|
|
668
|
-
const r = String(t), i =
|
|
668
|
+
const r = String(t), i = f.find(
|
|
669
669
|
(s) => s != null && String(s[e]) === r
|
|
670
670
|
);
|
|
671
671
|
return i === void 0 ? null : i;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
if (!Array.isArray(
|
|
673
|
+
function Vt(f, e) {
|
|
674
|
+
if (!Array.isArray(f))
|
|
675
675
|
return 0;
|
|
676
676
|
let t = 0;
|
|
677
|
-
for (const r of
|
|
677
|
+
for (const r of f) {
|
|
678
678
|
const i = e == null ? r : r?.[e];
|
|
679
679
|
if (i == null || i === "")
|
|
680
680
|
continue;
|
|
@@ -683,25 +683,25 @@ function Ut(p, e) {
|
|
|
683
683
|
}
|
|
684
684
|
return t;
|
|
685
685
|
}
|
|
686
|
-
function
|
|
687
|
-
return e == null ||
|
|
686
|
+
function qt(f, e) {
|
|
687
|
+
return e == null || f == null ? String(f) : String(f[e]);
|
|
688
688
|
}
|
|
689
|
-
function
|
|
690
|
-
if (!Array.isArray(
|
|
689
|
+
function Wt(f, e) {
|
|
690
|
+
if (!Array.isArray(f))
|
|
691
691
|
return [];
|
|
692
692
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
693
|
-
for (const i of
|
|
694
|
-
const s =
|
|
693
|
+
for (const i of f) {
|
|
694
|
+
const s = qt(i, e);
|
|
695
695
|
t.has(s) || (t.add(s), r.push(i));
|
|
696
696
|
}
|
|
697
697
|
return r;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
700
|
-
if (!Array.isArray(
|
|
699
|
+
function jt(f, e) {
|
|
700
|
+
if (!Array.isArray(f))
|
|
701
701
|
return [];
|
|
702
702
|
const t = /* @__PURE__ */ new Map(), r = [];
|
|
703
|
-
for (const i of
|
|
704
|
-
const s =
|
|
703
|
+
for (const i of f) {
|
|
704
|
+
const s = qt(i, e), n = t.get(s);
|
|
705
705
|
if (n === void 0) {
|
|
706
706
|
const a = i == null ? i : i[e];
|
|
707
707
|
t.set(s, r.length), r.push({ key: a, items: [i] });
|
|
@@ -710,20 +710,20 @@ function qt(p, e) {
|
|
|
710
710
|
}
|
|
711
711
|
return r;
|
|
712
712
|
}
|
|
713
|
-
const
|
|
713
|
+
const or = Object.freeze({
|
|
714
714
|
date: Je,
|
|
715
|
-
now:
|
|
716
|
-
today:
|
|
717
|
-
number:
|
|
718
|
-
pages:
|
|
719
|
-
range:
|
|
715
|
+
now: Mt,
|
|
716
|
+
today: $t,
|
|
717
|
+
number: Pt,
|
|
718
|
+
pages: Ot,
|
|
719
|
+
range: Lt,
|
|
720
720
|
monthAdd: Ze,
|
|
721
|
-
monthRange:
|
|
722
|
-
pageSummary:
|
|
723
|
-
findBy:
|
|
724
|
-
sum:
|
|
725
|
-
distinct:
|
|
726
|
-
groupBy:
|
|
721
|
+
monthRange: Bt,
|
|
722
|
+
pageSummary: Ut,
|
|
723
|
+
findBy: Ht,
|
|
724
|
+
sum: Vt,
|
|
725
|
+
distinct: Wt,
|
|
726
|
+
groupBy: jt
|
|
727
727
|
});
|
|
728
728
|
class nt {
|
|
729
729
|
constructor() {
|
|
@@ -767,13 +767,13 @@ class nt {
|
|
|
767
767
|
const r = await t.task();
|
|
768
768
|
t.resolve(r);
|
|
769
769
|
} catch (r) {
|
|
770
|
-
t.reject(r),
|
|
770
|
+
t.reject(r), m.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
771
771
|
}
|
|
772
772
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
773
773
|
break;
|
|
774
774
|
}
|
|
775
775
|
} catch (e) {
|
|
776
|
-
|
|
776
|
+
m.error("[Haori]", "Error processing queue:", e);
|
|
777
777
|
} finally {
|
|
778
778
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
779
779
|
}
|
|
@@ -879,7 +879,7 @@ const ot = class ot {
|
|
|
879
879
|
};
|
|
880
880
|
ot.ASYNC_QUEUE = new nt();
|
|
881
881
|
let J = ot;
|
|
882
|
-
const
|
|
882
|
+
const Kt = /* @__PURE__ */ new Set([
|
|
883
883
|
"window",
|
|
884
884
|
"self",
|
|
885
885
|
"globalThis",
|
|
@@ -910,7 +910,7 @@ const Wt = /* @__PURE__ */ new Set([
|
|
|
910
910
|
]), je = /* @__PURE__ */ new Set([
|
|
911
911
|
"eval",
|
|
912
912
|
"arguments"
|
|
913
|
-
]),
|
|
913
|
+
]), zt = /* @__PURE__ */ new Set([
|
|
914
914
|
"location",
|
|
915
915
|
"history",
|
|
916
916
|
"document",
|
|
@@ -966,7 +966,7 @@ const Wt = /* @__PURE__ */ new Set([
|
|
|
966
966
|
"public",
|
|
967
967
|
"static",
|
|
968
968
|
"super"
|
|
969
|
-
]),
|
|
969
|
+
]), Gt = /* @__PURE__ */ new Set([
|
|
970
970
|
"Math",
|
|
971
971
|
"JSON",
|
|
972
972
|
"Intl",
|
|
@@ -1017,7 +1017,7 @@ const Wt = /* @__PURE__ */ new Set([
|
|
|
1017
1017
|
"encodeURIComponent",
|
|
1018
1018
|
"decodeURI",
|
|
1019
1019
|
"decodeURIComponent"
|
|
1020
|
-
]),
|
|
1020
|
+
]), lr = [
|
|
1021
1021
|
">>>",
|
|
1022
1022
|
"===",
|
|
1023
1023
|
"!==",
|
|
@@ -1054,7 +1054,7 @@ const Wt = /* @__PURE__ */ new Set([
|
|
|
1054
1054
|
"!",
|
|
1055
1055
|
"<",
|
|
1056
1056
|
">"
|
|
1057
|
-
],
|
|
1057
|
+
], cr = {
|
|
1058
1058
|
"==": 1,
|
|
1059
1059
|
"!=": 1,
|
|
1060
1060
|
"===": 1,
|
|
@@ -1071,29 +1071,29 @@ const Wt = /* @__PURE__ */ new Set([
|
|
|
1071
1071
|
"*": 5,
|
|
1072
1072
|
"/": 5,
|
|
1073
1073
|
"%": 5
|
|
1074
|
-
},
|
|
1074
|
+
}, ur = /* @__PURE__ */ new Set([
|
|
1075
1075
|
"undefined",
|
|
1076
1076
|
"NaN",
|
|
1077
1077
|
"Infinity"
|
|
1078
1078
|
]);
|
|
1079
|
-
function _e(
|
|
1080
|
-
return
|
|
1081
|
-
` ||
|
|
1079
|
+
function _e(f) {
|
|
1080
|
+
return f === `
|
|
1081
|
+
` || f === "\r" || f === "\u2028" || f === "\u2029";
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1084
|
-
return
|
|
1083
|
+
function dr(f) {
|
|
1084
|
+
return f !== void 0 && /[A-Za-z_$]/.test(f);
|
|
1085
1085
|
}
|
|
1086
|
-
function ft(
|
|
1087
|
-
return
|
|
1086
|
+
function ft(f) {
|
|
1087
|
+
return f !== void 0 && /[A-Za-z0-9_$]/.test(f);
|
|
1088
1088
|
}
|
|
1089
|
-
function Y(
|
|
1090
|
-
return new SyntaxError(`${
|
|
1089
|
+
function Y(f, e) {
|
|
1090
|
+
return new SyntaxError(`${f} (at position ${e})`);
|
|
1091
1091
|
}
|
|
1092
1092
|
const X = {
|
|
1093
1093
|
comment: "Comments are not allowed in expressions",
|
|
1094
|
-
unexpectedCharacter: (
|
|
1094
|
+
unexpectedCharacter: (f) => `Unexpected character '${f}'`,
|
|
1095
1095
|
unterminatedRegExp: "Unterminated regular expression",
|
|
1096
|
-
invalidRegExp: (
|
|
1096
|
+
invalidRegExp: (f) => `Invalid regular expression: ${f}`,
|
|
1097
1097
|
numericSeparator: "Numeric separators are not allowed here",
|
|
1098
1098
|
invalidToken: "Invalid or unexpected token",
|
|
1099
1099
|
octalLiteral: "Octal literals are not allowed in strict mode",
|
|
@@ -1102,17 +1102,17 @@ const X = {
|
|
|
1102
1102
|
invalidHex: "Invalid hexadecimal escape sequence",
|
|
1103
1103
|
invalidUnicode: "Invalid Unicode escape sequence",
|
|
1104
1104
|
unexpectedEnd: "Unexpected end of expression",
|
|
1105
|
-
unexpectedToken: (
|
|
1106
|
-
notInExpressions: (
|
|
1107
|
-
notParameter: (
|
|
1108
|
-
notProperty: (
|
|
1105
|
+
unexpectedToken: (f) => `Unexpected token '${f}'`,
|
|
1106
|
+
notInExpressions: (f) => `'${f}' cannot be used in expressions`,
|
|
1107
|
+
notParameter: (f) => `'${f}' cannot be used as a parameter`,
|
|
1108
|
+
notProperty: (f) => `'${f}' cannot be used as a property`,
|
|
1109
1109
|
duplicateParameter: "Duplicate parameter name",
|
|
1110
1110
|
blockBody: "Arrow functions with a block body are not supported",
|
|
1111
1111
|
mixNullish: "Cannot mix ?? with || or &&",
|
|
1112
1112
|
unaryExponent: "Unary operator used immediately before exponentiation expression",
|
|
1113
1113
|
invalidUpdate: "Invalid left-hand side expression in update operation"
|
|
1114
1114
|
};
|
|
1115
|
-
class
|
|
1115
|
+
class hr {
|
|
1116
1116
|
/**
|
|
1117
1117
|
* @param source 式の文字列
|
|
1118
1118
|
*/
|
|
@@ -1143,7 +1143,7 @@ class ur {
|
|
|
1143
1143
|
return this.readNumber(r, t);
|
|
1144
1144
|
if (i === '"' || i === "'")
|
|
1145
1145
|
return this.readString(r, t);
|
|
1146
|
-
if (
|
|
1146
|
+
if (dr(i)) {
|
|
1147
1147
|
let n = r + 1;
|
|
1148
1148
|
for (; ft(e[n]); )
|
|
1149
1149
|
n += 1;
|
|
@@ -1157,7 +1157,7 @@ class ur {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
if (i === "/" && (s === "/" || s === "*"))
|
|
1159
1159
|
throw Y(X.comment, r);
|
|
1160
|
-
for (const n of
|
|
1160
|
+
for (const n of lr)
|
|
1161
1161
|
if (e.startsWith(n, r))
|
|
1162
1162
|
return this.position = r + n.length, {
|
|
1163
1163
|
type: "punct",
|
|
@@ -1370,7 +1370,7 @@ class ur {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
case "u": {
|
|
1372
1372
|
if (r[s] === "{") {
|
|
1373
|
-
const d = r.indexOf("}", s),
|
|
1373
|
+
const d = r.indexOf("}", s), y = d < 0 ? s : d, b = r.slice(s + 1, y), E = /^[0-9a-fA-F]+$/.test(b) ? parseInt(b, 16) : NaN;
|
|
1374
1374
|
if (!(E <= 1114111))
|
|
1375
1375
|
throw Y(X.invalidUnicode, l);
|
|
1376
1376
|
n += String.fromCodePoint(E), s = d + 1;
|
|
@@ -1408,12 +1408,12 @@ class ur {
|
|
|
1408
1408
|
};
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
class
|
|
1411
|
+
class fr {
|
|
1412
1412
|
/**
|
|
1413
1413
|
* @param source 式の文字列
|
|
1414
1414
|
*/
|
|
1415
1415
|
constructor(e) {
|
|
1416
|
-
this.lastEnd = 0, this.lexer = new
|
|
1416
|
+
this.lastEnd = 0, this.lexer = new hr(e), this.token = this.lexer.lex();
|
|
1417
1417
|
}
|
|
1418
1418
|
/**
|
|
1419
1419
|
* 式全体を解析します。
|
|
@@ -1794,7 +1794,7 @@ class dr {
|
|
|
1794
1794
|
const t = this.token.start;
|
|
1795
1795
|
let r = this.parseExponent();
|
|
1796
1796
|
for (; ; ) {
|
|
1797
|
-
const i = this.token, s = i.type === "punct" ?
|
|
1797
|
+
const i = this.token, s = i.type === "punct" ? cr[i.value] : void 0;
|
|
1798
1798
|
if (s === void 0 || s < e)
|
|
1799
1799
|
return r;
|
|
1800
1800
|
this.advance();
|
|
@@ -1890,7 +1890,7 @@ class dr {
|
|
|
1890
1890
|
return !0;
|
|
1891
1891
|
switch (e.type) {
|
|
1892
1892
|
case "Identifier":
|
|
1893
|
-
return !
|
|
1893
|
+
return !ur.has(e.name);
|
|
1894
1894
|
case "Member":
|
|
1895
1895
|
case "Call":
|
|
1896
1896
|
return !0;
|
|
@@ -2107,10 +2107,10 @@ class dr {
|
|
|
2107
2107
|
throw this.unexpected();
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2111
|
-
return new
|
|
2110
|
+
function pr(f) {
|
|
2111
|
+
return new fr(f).parseProgram();
|
|
2112
2112
|
}
|
|
2113
|
-
class
|
|
2113
|
+
class Yt extends ReferenceError {
|
|
2114
2114
|
/**
|
|
2115
2115
|
* @param identifier 参照された名前
|
|
2116
2116
|
*/
|
|
@@ -2123,25 +2123,25 @@ const pt = /* @__PURE__ */ new Map([
|
|
|
2123
2123
|
["NaN", NaN],
|
|
2124
2124
|
["Infinity", 1 / 0]
|
|
2125
2125
|
]);
|
|
2126
|
-
function gt(
|
|
2127
|
-
return Object.prototype.propertyIsEnumerable.call(
|
|
2126
|
+
function gt(f, e) {
|
|
2127
|
+
return Object.prototype.propertyIsEnumerable.call(f, e);
|
|
2128
2128
|
}
|
|
2129
|
-
function mt(
|
|
2130
|
-
const e = typeof
|
|
2129
|
+
function mt(f) {
|
|
2130
|
+
const e = typeof f == "symbol" ? f : String(f);
|
|
2131
2131
|
return Ke.has(e) ? "undefined" : e;
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2134
|
-
return typeof
|
|
2133
|
+
function gr(f) {
|
|
2134
|
+
return typeof f == "bigint" ? f : Number(f);
|
|
2135
2135
|
}
|
|
2136
|
-
function yt(
|
|
2137
|
-
return
|
|
2136
|
+
function yt(f) {
|
|
2137
|
+
return f[Symbol.iterator]();
|
|
2138
2138
|
}
|
|
2139
|
-
function bt(
|
|
2139
|
+
function bt(f, e, t) {
|
|
2140
2140
|
const r = Object(e);
|
|
2141
2141
|
for (const i of Reflect.ownKeys(r)) {
|
|
2142
2142
|
if (t?.has(i))
|
|
2143
2143
|
continue;
|
|
2144
|
-
Reflect.getOwnPropertyDescriptor(r, i)?.enumerable && Object.defineProperty(
|
|
2144
|
+
Reflect.getOwnPropertyDescriptor(r, i)?.enumerable && Object.defineProperty(f, i, {
|
|
2145
2145
|
value: r[i],
|
|
2146
2146
|
writable: !0,
|
|
2147
2147
|
enumerable: !0,
|
|
@@ -2165,7 +2165,7 @@ const lt = class lt {
|
|
|
2165
2165
|
return t;
|
|
2166
2166
|
let r;
|
|
2167
2167
|
try {
|
|
2168
|
-
const i =
|
|
2168
|
+
const i = pr(e);
|
|
2169
2169
|
r = {
|
|
2170
2170
|
expression: e,
|
|
2171
2171
|
evaluator: this.compileNode(i, null)
|
|
@@ -2329,7 +2329,7 @@ const lt = class lt {
|
|
|
2329
2329
|
* @returns 種類
|
|
2330
2330
|
*/
|
|
2331
2331
|
static classify(e) {
|
|
2332
|
-
return
|
|
2332
|
+
return zt.has(e) ? "rebindable" : Kt.has(e) ? "forbidden" : pt.has(e) ? "constant" : Gt.has(e) ? "builtin" : "free";
|
|
2333
2333
|
}
|
|
2334
2334
|
/**
|
|
2335
2335
|
* バインドに無い識別子を参照したときの値を返します。
|
|
@@ -2340,7 +2340,7 @@ const lt = class lt {
|
|
|
2340
2340
|
*/
|
|
2341
2341
|
static missing(e, t) {
|
|
2342
2342
|
if (e.missingIdentifier === "throw")
|
|
2343
|
-
throw new
|
|
2343
|
+
throw new Yt(t);
|
|
2344
2344
|
}
|
|
2345
2345
|
/**
|
|
2346
2346
|
* 識別子の参照を変換します。
|
|
@@ -2393,13 +2393,13 @@ const lt = class lt {
|
|
|
2393
2393
|
*/
|
|
2394
2394
|
static compileUpdate(e, t) {
|
|
2395
2395
|
const r = e.argument.name, i = e.operator === "++" ? 1 : -1, s = e.prefix, n = (u) => {
|
|
2396
|
-
const d =
|
|
2397
|
-
return [d,
|
|
2396
|
+
const d = gr(u), y = typeof d == "bigint" ? d + BigInt(i) : d + i;
|
|
2397
|
+
return [d, y];
|
|
2398
2398
|
}, a = this.findSlot(r, t);
|
|
2399
2399
|
if (a !== null) {
|
|
2400
2400
|
const { depth: u, slot: d } = a;
|
|
2401
|
-
return (
|
|
2402
|
-
const b = this.outerFrame(
|
|
2401
|
+
return (y) => {
|
|
2402
|
+
const b = this.outerFrame(y, u), [E, A] = n(b.slots[d]);
|
|
2403
2403
|
return b.slots[d] = A, s ? A : E;
|
|
2404
2404
|
};
|
|
2405
2405
|
}
|
|
@@ -2577,11 +2577,11 @@ const lt = class lt {
|
|
|
2577
2577
|
if (n.type === "Member") {
|
|
2578
2578
|
const o = this.compileNode(n.object, t), l = n.computed ? null : n.property, u = n.computed ? this.compileNode(n.property, t) : null;
|
|
2579
2579
|
return (d) => {
|
|
2580
|
-
const
|
|
2581
|
-
if (
|
|
2580
|
+
const y = o(d);
|
|
2581
|
+
if (y == null)
|
|
2582
2582
|
return;
|
|
2583
2583
|
const b = u === null ? l : mt(u(d));
|
|
2584
|
-
return s(
|
|
2584
|
+
return s(y[b], y, d);
|
|
2585
2585
|
};
|
|
2586
2586
|
}
|
|
2587
2587
|
const a = this.compileNode(n, t);
|
|
@@ -2699,12 +2699,12 @@ const lt = class lt {
|
|
|
2699
2699
|
e.params.forEach((l) => this.assignSlots(l, r.names)), e.rest !== null && this.assignSlots(e.rest, r.names);
|
|
2700
2700
|
const i = e.params.map((l) => this.compilePattern(l, r)), s = e.rest === null ? null : this.compilePattern(e.rest, r), n = this.compileNode(e.body, r), a = i.length, o = e.async;
|
|
2701
2701
|
return (l) => {
|
|
2702
|
-
const u = (
|
|
2702
|
+
const u = (y) => {
|
|
2703
2703
|
const b = { slots: [], parent: l, run: l.run };
|
|
2704
2704
|
for (let E = 0; E < a; E += 1)
|
|
2705
|
-
i[E](b,
|
|
2706
|
-
return s !== null && s(b,
|
|
2707
|
-
}, d = o ? async (...
|
|
2705
|
+
i[E](b, y[E]);
|
|
2706
|
+
return s !== null && s(b, y.slice(a)), n(b);
|
|
2707
|
+
}, d = o ? async (...y) => u(y) : (...y) => u(y);
|
|
2708
2708
|
return Object.defineProperty(d, "length", { value: a }), d;
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
@@ -2862,7 +2862,7 @@ const T = class T {
|
|
|
2862
2862
|
const t = e.filter(
|
|
2863
2863
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
2864
2864
|
);
|
|
2865
|
-
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)),
|
|
2865
|
+
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)), m.warn(
|
|
2866
2866
|
"[Haori]",
|
|
2867
2867
|
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${c.prefix}form-object to collect nested values.`
|
|
2868
2868
|
));
|
|
@@ -3024,7 +3024,7 @@ let ${e.join(", ")};`;
|
|
|
3024
3024
|
if (this.loggedBlockedIdentifierExpressions.has(e))
|
|
3025
3025
|
return;
|
|
3026
3026
|
const t = this.detectForbiddenIdentifiers(e);
|
|
3027
|
-
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e),
|
|
3027
|
+
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e), m.warn(
|
|
3028
3028
|
"[Haori]",
|
|
3029
3029
|
"Expression references blocked identifier(s): " + t.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of an empty result). Use spread {...a, ...b} instead of Object.assign.",
|
|
3030
3030
|
e
|
|
@@ -3168,7 +3168,7 @@ let ${e.join(", ")};`;
|
|
|
3168
3168
|
* @returns 未解決として報告する識別子名の一覧
|
|
3169
3169
|
*/
|
|
3170
3170
|
static extractUninitializedIdentifiers(e, t) {
|
|
3171
|
-
if (e instanceof
|
|
3171
|
+
if (e instanceof Yt)
|
|
3172
3172
|
return [e.identifier];
|
|
3173
3173
|
const r = String(e.message || ""), i = t.filter(
|
|
3174
3174
|
(s) => ["'", '"', "`"].some(
|
|
@@ -3191,14 +3191,14 @@ let ${e.join(", ")};`;
|
|
|
3191
3191
|
static recordUnresolvedIdentifiers(e, t) {
|
|
3192
3192
|
if (!(e.length === 0 || this.evaluatingForDiagnosis)) {
|
|
3193
3193
|
if (c.strictBind) {
|
|
3194
|
-
|
|
3194
|
+
m.error(
|
|
3195
3195
|
"[Haori]",
|
|
3196
3196
|
"Expression references key(s) that are not in the binding data: " + e.join(", ") + ". The result is treated as an unresolved reference.",
|
|
3197
3197
|
t
|
|
3198
3198
|
);
|
|
3199
3199
|
return;
|
|
3200
3200
|
}
|
|
3201
|
-
|
|
3201
|
+
H.isEnabled() && (e.forEach((r) => {
|
|
3202
3202
|
this.pendingUnresolvedIdentifiers.add(r);
|
|
3203
3203
|
}), this.scheduleUnresolvedIdentifierReport());
|
|
3204
3204
|
}
|
|
@@ -3222,7 +3222,7 @@ let ${e.join(", ")};`;
|
|
|
3222
3222
|
if (this.pendingUnresolvedIdentifiers.size === 0)
|
|
3223
3223
|
return;
|
|
3224
3224
|
const e = Array.from(this.pendingUnresolvedIdentifiers);
|
|
3225
|
-
this.pendingUnresolvedIdentifiers.clear(),
|
|
3225
|
+
this.pendingUnresolvedIdentifiers.clear(), m.warn(
|
|
3226
3226
|
"[Haori]",
|
|
3227
3227
|
"Expression key(s) were never provided by any binding: " + e.join(", ") + ". They are treated as unresolved references (rendered as empty). Check for typos if this is unexpected."
|
|
3228
3228
|
);
|
|
@@ -3255,7 +3255,7 @@ let ${e.join(", ")};`;
|
|
|
3255
3255
|
* @return 戻り値はありません。
|
|
3256
3256
|
*/
|
|
3257
3257
|
static recordRowScopeIdentifiers(e) {
|
|
3258
|
-
if (
|
|
3258
|
+
if (H.isEnabled())
|
|
3259
3259
|
for (const t of e)
|
|
3260
3260
|
typeof t == "string" && t !== "" && this.rowScopeIdentifiers.add(t);
|
|
3261
3261
|
}
|
|
@@ -3305,7 +3305,7 @@ let ${e.join(", ")};`;
|
|
|
3305
3305
|
${t}`;
|
|
3306
3306
|
this.loggedScopeMissingIdentifiers.has(n) || (this.loggedScopeMissingIdentifiers.add(n), i.push(s));
|
|
3307
3307
|
}
|
|
3308
|
-
i.length !== 0 &&
|
|
3308
|
+
i.length !== 0 && m.warn(
|
|
3309
3309
|
"[Haori]",
|
|
3310
3310
|
`Expression key(s) are missing from this scope but are provided in another scope: ${i.join(", ")}. A binding is visible only to the target element itself and its descendants, so bind the response to this element or one of its ancestors (data-fetch-bind / data-{event}-bind):`,
|
|
3311
3311
|
t
|
|
@@ -3384,19 +3384,19 @@ ${t}`;
|
|
|
3384
3384
|
*/
|
|
3385
3385
|
static evaluateDetailed(e, t = {}) {
|
|
3386
3386
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
3387
|
-
return
|
|
3387
|
+
return m.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
3388
3388
|
const r = this.getExpressionProfile(e);
|
|
3389
3389
|
if (r.dangerous) {
|
|
3390
3390
|
const b = this.detectDisallowedKeywords(e);
|
|
3391
3391
|
if (b.length > 0) {
|
|
3392
3392
|
const E = b.some((A) => A === "function" || A === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
|
|
3393
|
-
|
|
3393
|
+
m.warn(
|
|
3394
3394
|
"[Haori]",
|
|
3395
3395
|
e,
|
|
3396
3396
|
"Expression uses disallowed keyword(s): " + b.join(", ") + "." + E
|
|
3397
3397
|
);
|
|
3398
3398
|
} else
|
|
3399
|
-
|
|
3399
|
+
m.warn(
|
|
3400
3400
|
"[Haori]",
|
|
3401
3401
|
e,
|
|
3402
3402
|
"Expression contains dangerous patterns"
|
|
@@ -3406,20 +3406,20 @@ ${t}`;
|
|
|
3406
3406
|
const i = this.collectForbiddenKeys(t);
|
|
3407
3407
|
if (i.length > 0) {
|
|
3408
3408
|
const b = i.join(",");
|
|
3409
|
-
this.loggedForbiddenKeySignatures.has(b) || (this.loggedForbiddenKeySignatures.add(b), this.scheduleForbiddenKeyLogReset(),
|
|
3409
|
+
this.loggedForbiddenKeySignatures.has(b) || (this.loggedForbiddenKeySignatures.add(b), this.scheduleForbiddenKeyLogReset(), m.error(
|
|
3410
3410
|
"[Haori]",
|
|
3411
3411
|
"Binding keys are reserved and ignored: " + i.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
3412
3412
|
));
|
|
3413
3413
|
}
|
|
3414
3414
|
const s = r.referencesBuiltinData, n = s ? null : this.getReferencedNames(e);
|
|
3415
3415
|
if (this.containsForbiddenReferencedValues(t, n))
|
|
3416
|
-
return
|
|
3416
|
+
return m.warn(
|
|
3417
3417
|
"[Haori]",
|
|
3418
3418
|
t,
|
|
3419
3419
|
"Binded values contain forbidden values"
|
|
3420
3420
|
), { value: null, unresolvedReference: !1 };
|
|
3421
3421
|
const a = r.referencesBuiltins;
|
|
3422
|
-
a && this.BUILTIN_NAMESPACE in t &&
|
|
3422
|
+
a && this.BUILTIN_NAMESPACE in t && m.warn(
|
|
3423
3423
|
"[Haori]",
|
|
3424
3424
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
3425
3425
|
);
|
|
@@ -3429,7 +3429,7 @@ ${t}`;
|
|
|
3429
3429
|
a && (s ? o[this.BUILTIN_NAMESPACE] = {
|
|
3430
3430
|
...this.BUILTIN_HELPERS,
|
|
3431
3431
|
[this.BUILTIN_DATA_PROPERTY]: { ...o }
|
|
3432
|
-
} : o[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(o),
|
|
3432
|
+
} : o[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(o), H.isEnabled() && this.recordSuppliedIdentifiers(o);
|
|
3433
3433
|
const l = r.allowMissingIdentifierRecovery, u = this.extractFreeIdentifiers(e).filter(
|
|
3434
3434
|
(b) => !(b in o) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
3435
3435
|
// (二重宣言は構文エラーになる)。
|
|
@@ -3437,24 +3437,24 @@ ${t}`;
|
|
|
3437
3437
|
!this.ALLOWED_GLOBAL_IDENTIFIERS.has(b)
|
|
3438
3438
|
);
|
|
3439
3439
|
let d = null;
|
|
3440
|
-
if (
|
|
3440
|
+
if (H.isEnabled()) {
|
|
3441
3441
|
const b = this.extractBoundIdentifiers(e);
|
|
3442
3442
|
d = b.size === 0 ? u : u.filter((E) => !b.has(E));
|
|
3443
3443
|
}
|
|
3444
|
-
const
|
|
3444
|
+
const y = this.evaluateWithShadowing(
|
|
3445
3445
|
e,
|
|
3446
3446
|
o,
|
|
3447
3447
|
u,
|
|
3448
3448
|
l
|
|
3449
3449
|
);
|
|
3450
3450
|
return d !== null && this.recordScopeMissingIdentifiers(
|
|
3451
|
-
typeof
|
|
3451
|
+
typeof y.value == "boolean" ? (
|
|
3452
3452
|
// 判定する式として結論が出た評価では、予約キーが無いのは正常
|
|
3453
3453
|
// (注入より前の状態)なので報告しない(仕様「未解決参照の診断」)。
|
|
3454
3454
|
d.filter((b) => !this.isReservedBindingKey(b))
|
|
3455
3455
|
) : d,
|
|
3456
3456
|
e
|
|
3457
|
-
),
|
|
3457
|
+
), y;
|
|
3458
3458
|
}
|
|
3459
3459
|
/**
|
|
3460
3460
|
* バインドに無い識別子を遮蔽して式を評価します。
|
|
@@ -3507,10 +3507,10 @@ ${t}`;
|
|
|
3507
3507
|
e
|
|
3508
3508
|
), { value: void 0, unresolvedReference: !0 });
|
|
3509
3509
|
}
|
|
3510
|
-
return
|
|
3510
|
+
return m.error("[Haori]", "Expression evaluation error:", e, o), o instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
3511
3511
|
}
|
|
3512
3512
|
}
|
|
3513
|
-
return
|
|
3513
|
+
return m.error(
|
|
3514
3514
|
"[Haori]",
|
|
3515
3515
|
"Failed to recover missing identifiers:",
|
|
3516
3516
|
e,
|
|
@@ -3612,7 +3612,7 @@ ${t}`;
|
|
|
3612
3612
|
).parameterCandidates.filter(
|
|
3613
3613
|
(E) => Object.prototype.propertyIsEnumerable.call(t, E) && !this.FORBIDDEN_BINDING_NAMES.has(E)
|
|
3614
3614
|
);
|
|
3615
|
-
if (
|
|
3615
|
+
if (H.isEnabled() && this.reportUnusableBindingKeys(
|
|
3616
3616
|
Object.keys(t).filter((E) => !this.isUsableBindingKey(E))
|
|
3617
3617
|
), c.csp)
|
|
3618
3618
|
return this.prepareInterpretedEvaluator(e, i);
|
|
@@ -3626,11 +3626,11 @@ ${t}`;
|
|
|
3626
3626
|
evaluator: o,
|
|
3627
3627
|
compileFailed: !1
|
|
3628
3628
|
};
|
|
3629
|
-
const l = this.buildAssignments(i), u = this.buildBuiltinConstants(e, s), d = this.buildShadowDeclarations(n),
|
|
3629
|
+
const l = this.buildAssignments(i), u = this.buildBuiltinConstants(e, s), d = this.buildShadowDeclarations(n), y = this.toGuardedMemberExpression(
|
|
3630
3630
|
this.toOptionalChainExpression(e)
|
|
3631
3631
|
), b = `"use strict";
|
|
3632
3632
|
${l};
|
|
3633
|
-
${u}return (${
|
|
3633
|
+
${u}return (${y});` + d;
|
|
3634
3634
|
try {
|
|
3635
3635
|
return o = new Function(...i, b), this.EXPRESSION_CACHE.set(a, o), this.compileFailedExpressions.delete(e), {
|
|
3636
3636
|
bindKeys: i,
|
|
@@ -3638,11 +3638,11 @@ ${u}return (${m});` + d;
|
|
|
3638
3638
|
compileFailed: !1
|
|
3639
3639
|
};
|
|
3640
3640
|
} catch (E) {
|
|
3641
|
-
return n.length > 0 ? (
|
|
3641
|
+
return n.length > 0 ? (m.warn(
|
|
3642
3642
|
"[Haori]",
|
|
3643
3643
|
"Failed to shadow undeclared identifier(s): " + n.join(", ") + ". Falling back to evaluation without shadowing.",
|
|
3644
3644
|
e
|
|
3645
|
-
), this.prepareEvaluator(e, t, [])) : (E instanceof EvalError && this.reportEvalBlocked(),
|
|
3645
|
+
), this.prepareEvaluator(e, t, [])) : (E instanceof EvalError && this.reportEvalBlocked(), m.error("[Haori]", "Failed to compile expression:", e, E), this.compileFailedExpressions.add(e), {
|
|
3646
3646
|
bindKeys: i,
|
|
3647
3647
|
evaluator: null,
|
|
3648
3648
|
compileFailed: !0
|
|
@@ -3658,7 +3658,7 @@ ${u}return (${m});` + d;
|
|
|
3658
3658
|
* @return 戻り値はありません。
|
|
3659
3659
|
*/
|
|
3660
3660
|
static reportEvalBlocked() {
|
|
3661
|
-
this.evalBlockedReported || (this.evalBlockedReported = !0,
|
|
3661
|
+
this.evalBlockedReported || (this.evalBlockedReported = !0, m.error(
|
|
3662
3662
|
"[Haori]",
|
|
3663
3663
|
`Expressions cannot be compiled because the Content Security Policy does not allow 'unsafe-eval'. Enable the CSP mode with <script src="haori.js" data-csp> or Haori.setCsp(true).`
|
|
3664
3664
|
));
|
|
@@ -3681,7 +3681,7 @@ ${u}return (${m});` + d;
|
|
|
3681
3681
|
const r = Pe.compile(e);
|
|
3682
3682
|
return { bindKeys: t, evaluator: null, compileFailed: !1, compiled: r };
|
|
3683
3683
|
} catch (r) {
|
|
3684
|
-
return
|
|
3684
|
+
return m.error("[Haori]", "Failed to compile expression:", e, r), this.compileFailedExpressions.add(e), { bindKeys: t, evaluator: null, compileFailed: !0 };
|
|
3685
3685
|
}
|
|
3686
3686
|
}
|
|
3687
3687
|
/**
|
|
@@ -4449,7 +4449,7 @@ ${u}return (${m});` + d;
|
|
|
4449
4449
|
}
|
|
4450
4450
|
};
|
|
4451
4451
|
T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HELPERS = {
|
|
4452
|
-
...
|
|
4452
|
+
...or
|
|
4453
4453
|
}, T.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, T.BUILTIN_DATA_PROPERTY = "data", T.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, T.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, T.STRICT_PARAMETER_RESERVED_WORDS = /* @__PURE__ */ new Set([
|
|
4454
4454
|
...[...ze].filter((e) => e !== "await"),
|
|
4455
4455
|
...rt,
|
|
@@ -4459,10 +4459,10 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
4459
4459
|
"false",
|
|
4460
4460
|
"null"
|
|
4461
4461
|
]), T.evalBlockedReported = !1, T.usableBindingKeyCache = /* @__PURE__ */ new Map(), T.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), T.compileFailedExpressions = /* @__PURE__ */ new Set(), T.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), T.forbiddenBindingValueSet = null, T.forbiddenBindingValueCacheResetScheduled = !1, T.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), T.loggedForbiddenKeyResetScheduled = !1, T.FORBIDDEN_NAMES = [
|
|
4462
|
-
...
|
|
4462
|
+
...Kt
|
|
4463
4463
|
], T.STRICT_FORBIDDEN_NAMES = [
|
|
4464
4464
|
...je
|
|
4465
|
-
], T.REBINDABLE_FORBIDDEN_NAMES =
|
|
4465
|
+
], T.REBINDABLE_FORBIDDEN_NAMES = zt, T.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
4466
4466
|
...T.FORBIDDEN_NAMES.filter(
|
|
4467
4467
|
(e) => !T.REBINDABLE_FORBIDDEN_NAMES.has(e)
|
|
4468
4468
|
),
|
|
@@ -4484,7 +4484,7 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
4484
4484
|
"Infinity",
|
|
4485
4485
|
// strict モードの予約語(`let` 宣言が構文エラーになる)
|
|
4486
4486
|
...rt
|
|
4487
|
-
]), T.ALLOWED_GLOBAL_IDENTIFIERS =
|
|
4487
|
+
]), T.ALLOWED_GLOBAL_IDENTIFIERS = Gt, T.BUILTIN_HOLDER = Object.freeze(
|
|
4488
4488
|
Object.defineProperties(
|
|
4489
4489
|
{},
|
|
4490
4490
|
Object.fromEntries(
|
|
@@ -4631,7 +4631,7 @@ const Ee = "data-haori-if-disabled", Et = "input, select, textarea, button, fiel
|
|
|
4631
4631
|
* @returns 集計中なら true
|
|
4632
4632
|
*/
|
|
4633
4633
|
static isCollecting() {
|
|
4634
|
-
return P.collecting &&
|
|
4634
|
+
return P.collecting && H.isEnabled();
|
|
4635
4635
|
}
|
|
4636
4636
|
/**
|
|
4637
4637
|
* 現在の集計結果スナップショットを返します。
|
|
@@ -4687,8 +4687,8 @@ const Ee = "data-haori-if-disabled", Et = "input, select, textarea, button, fiel
|
|
|
4687
4687
|
let r = 0, i = 0;
|
|
4688
4688
|
const s = (l, u, d) => {
|
|
4689
4689
|
r += d.totalDurationMs, i += d.calls;
|
|
4690
|
-
const
|
|
4691
|
-
if (
|
|
4690
|
+
const y = t.get(l);
|
|
4691
|
+
if (y === void 0) {
|
|
4692
4692
|
t.set(l, {
|
|
4693
4693
|
where: u,
|
|
4694
4694
|
template: d.template,
|
|
@@ -4701,10 +4701,10 @@ const Ee = "data-haori-if-disabled", Et = "input, select, textarea, button, fiel
|
|
|
4701
4701
|
});
|
|
4702
4702
|
return;
|
|
4703
4703
|
}
|
|
4704
|
-
|
|
4705
|
-
|
|
4704
|
+
y.elements += 1, y.calls += d.calls, y.totalDurationMs += d.totalDurationMs, y.maxDurationMs = Math.max(
|
|
4705
|
+
y.maxDurationMs,
|
|
4706
4706
|
d.maxDurationMs
|
|
4707
|
-
), d.totalDurationMs >
|
|
4707
|
+
), d.totalDurationMs > y.representativeDurationMs && (y.where = u, y.representativeDurationMs = d.totalDurationMs);
|
|
4708
4708
|
};
|
|
4709
4709
|
P.snapshot().forEach((l) => {
|
|
4710
4710
|
l.attributes.forEach((u) => {
|
|
@@ -4752,7 +4752,7 @@ ${u.template}`,
|
|
|
4752
4752
|
const s = String(i + 1).padStart(2), n = r.totalDurationMs.toFixed(1).padStart(9), a = `${r.sharePercent.toFixed(1)}%`.padStart(6), o = String(r.calls).padStart(6), l = String(r.elements).padStart(4), u = r.maxDurationMs.toFixed(1).padStart(8);
|
|
4753
4753
|
return `${s}. ${n}ms ${a} calls=${o} elements=${l} max=${u}ms ${r.where} ${r.template}`;
|
|
4754
4754
|
});
|
|
4755
|
-
|
|
4755
|
+
m.info(
|
|
4756
4756
|
"[Haori][evaluation-profile]",
|
|
4757
4757
|
`total=${e.totalDurationMs.toFixed(1)}ms calls=${e.totalCalls} declarations=${e.entryCount}
|
|
4758
4758
|
` + t.join(`
|
|
@@ -4766,7 +4766,7 @@ ${u.template}`,
|
|
|
4766
4766
|
* @param expressions 今回評価した式一覧
|
|
4767
4767
|
*/
|
|
4768
4768
|
static record(e, t, r) {
|
|
4769
|
-
if (!
|
|
4769
|
+
if (!H.isEnabled() || !e || t.length === 0 || (P.ensureGlobalAccess(), !P.isCollecting()))
|
|
4770
4770
|
return;
|
|
4771
4771
|
const i = P.getOrCreateElementStore(
|
|
4772
4772
|
e.element
|
|
@@ -4799,7 +4799,7 @@ ${u.template}`,
|
|
|
4799
4799
|
* globalThis から dev-only の取得窓口を参照できるようにします。
|
|
4800
4800
|
*/
|
|
4801
4801
|
static ensureGlobalAccess() {
|
|
4802
|
-
if (!
|
|
4802
|
+
if (!H.isEnabled())
|
|
4803
4803
|
return;
|
|
4804
4804
|
const e = globalThis;
|
|
4805
4805
|
e[P.GLOBAL_KEY] === void 0 && (e[P.GLOBAL_KEY] = {
|
|
@@ -4974,7 +4974,7 @@ const pe = class pe {
|
|
|
4974
4974
|
t = new at(e);
|
|
4975
4975
|
break;
|
|
4976
4976
|
default:
|
|
4977
|
-
return
|
|
4977
|
+
return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
4978
4978
|
}
|
|
4979
4979
|
return t;
|
|
4980
4980
|
}
|
|
@@ -5215,7 +5215,7 @@ const v = class v extends D {
|
|
|
5215
5215
|
removeChild(e) {
|
|
5216
5216
|
const t = this.children.indexOf(e);
|
|
5217
5217
|
if (t < 0) {
|
|
5218
|
-
|
|
5218
|
+
m.warn("[Haori]", "Child fragment not found.", e);
|
|
5219
5219
|
return;
|
|
5220
5220
|
}
|
|
5221
5221
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -5755,7 +5755,7 @@ const v = class v extends D {
|
|
|
5755
5755
|
if (i instanceof HTMLInputElement && i.type === "file")
|
|
5756
5756
|
return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : J.enqueue(() => {
|
|
5757
5757
|
i.value = "";
|
|
5758
|
-
})) : (
|
|
5758
|
+
})) : (m.warn(
|
|
5759
5759
|
"[Haori]",
|
|
5760
5760
|
"A value cannot be assigned to input[type=file]; only clearing is supported.",
|
|
5761
5761
|
i
|
|
@@ -5776,7 +5776,7 @@ const v = class v extends D {
|
|
|
5776
5776
|
Array.isArray(e) ? e.join(",") : e,
|
|
5777
5777
|
t,
|
|
5778
5778
|
r
|
|
5779
|
-
) : (
|
|
5779
|
+
) : (m.warn(
|
|
5780
5780
|
"[Haori]",
|
|
5781
5781
|
"setValue is not supported for this element type.",
|
|
5782
5782
|
i
|
|
@@ -6210,10 +6210,10 @@ const v = class v extends D {
|
|
|
6210
6210
|
* @return 戻り値はありません。
|
|
6211
6211
|
*/
|
|
6212
6212
|
static warnUnresolvedAttribute(e, t, r, i) {
|
|
6213
|
-
if (!
|
|
6213
|
+
if (!H.isEnabled())
|
|
6214
6214
|
return;
|
|
6215
6215
|
const s = `${e} ${r}`;
|
|
6216
|
-
v.loggedUnresolvedAttributes.has(s) || (v.loggedUnresolvedAttributes.add(s),
|
|
6216
|
+
v.loggedUnresolvedAttributes.has(s) || (v.loggedUnresolvedAttributes.add(s), m.warn(
|
|
6217
6217
|
"[Haori]",
|
|
6218
6218
|
`Attribute "${t}" was not applied because the expression has an unresolved reference; the attribute is removed and the synchronized value is emptied: ${e}="${r}"`,
|
|
6219
6219
|
i
|
|
@@ -6236,7 +6236,7 @@ const v = class v extends D {
|
|
|
6236
6236
|
*/
|
|
6237
6237
|
static warnTypeMismatchedComparison(e, t, r, i) {
|
|
6238
6238
|
const s = `${e} ${t}`;
|
|
6239
|
-
v.loggedTypeMismatchedComparisons.has(s) || (v.loggedTypeMismatchedComparisons.add(s),
|
|
6239
|
+
v.loggedTypeMismatchedComparisons.has(s) || (v.loggedTypeMismatchedComparisons.add(s), m.warn(
|
|
6240
6240
|
"[Haori]",
|
|
6241
6241
|
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${c.prefix}value-type) or compare converted values: ${e}="${t}"`,
|
|
6242
6242
|
i
|
|
@@ -6432,10 +6432,10 @@ const v = class v extends D {
|
|
|
6432
6432
|
* @returns 戻り値はありません。
|
|
6433
6433
|
*/
|
|
6434
6434
|
static warnValueTypeDeclaration(e, t, r) {
|
|
6435
|
-
if (!
|
|
6435
|
+
if (!H.isEnabled())
|
|
6436
6436
|
return;
|
|
6437
6437
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", s = `${e.tagName}${i} ${t} ${r}`;
|
|
6438
|
-
v.loggedValueTypeDeclarations.has(s) || (v.loggedValueTypeDeclarations.add(s),
|
|
6438
|
+
v.loggedValueTypeDeclarations.has(s) || (v.loggedValueTypeDeclarations.add(s), m.warn(
|
|
6439
6439
|
"Haori",
|
|
6440
6440
|
`${c.prefix}value-type="${t}" を無視しました(${r}):`,
|
|
6441
6441
|
e
|
|
@@ -6705,13 +6705,13 @@ const v = class v extends D {
|
|
|
6705
6705
|
element: l,
|
|
6706
6706
|
rawName: e,
|
|
6707
6707
|
template: r
|
|
6708
|
-
}), d = o.isEvaluate || o.isRawEvaluate,
|
|
6708
|
+
}), d = o.isEvaluate || o.isRawEvaluate, y = e === t && v.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), b = o.isSingleExpression(), E = ge.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, k = t === "value" && v.resolveDeclaredValueType(l) === "boolean", C = A === !1 && !k, $ = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || C : y ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : b ? u.hasUnresolvedReference || A === null || A === void 0 || C : d && E === "");
|
|
6709
6709
|
if ($ && u.hasUnresolvedReference && v.warnUnresolvedAttribute(
|
|
6710
6710
|
e,
|
|
6711
6711
|
t,
|
|
6712
6712
|
r,
|
|
6713
6713
|
l
|
|
6714
|
-
),
|
|
6714
|
+
), H.isEnabled() && A === !1 && b) {
|
|
6715
6715
|
const he = o.getSingleExpression(), ye = he === null ? null : se.diagnoseStrictComparison(
|
|
6716
6716
|
he,
|
|
6717
6717
|
this.getBindingData()
|
|
@@ -6724,16 +6724,16 @@ const v = class v extends D {
|
|
|
6724
6724
|
);
|
|
6725
6725
|
}
|
|
6726
6726
|
const ie = o.isForceEvaluation() ? r : b ? A : E, F = i && o.isEvaluate && t === "value" && v.isValuePropertyTarget(l), Z = l.getRootNode(), te = this.userEditSequence, Q = F && v.isUserEditableValue(l) && (l === Z.activeElement || this.hasPendingUserEdit()), z = $ || ie === null || ie === !1 && !k ? null : String(ie), ce = o.isEvaluate && z !== null && v.URL_ATTRIBUTES.has(t) && Le.hasScriptScheme(z);
|
|
6727
|
-
ce &&
|
|
6727
|
+
ce && m.warn(
|
|
6728
6728
|
"[Haori]",
|
|
6729
6729
|
`Attribute "${t}" was removed because the evaluated URL uses a script scheme: ${e}="${r}" -> ${z}`,
|
|
6730
6730
|
l
|
|
6731
6731
|
);
|
|
6732
|
-
const w = ce ? null : z, O = e !== t && l.getAttribute(e) !== r, j = w === null ? l.hasAttribute(t) : l.getAttribute(t) !== w,
|
|
6732
|
+
const w = ce ? null : z, O = e !== t && l.getAttribute(e) !== r, j = w === null ? l.hasAttribute(t) : l.getAttribute(t) !== w, V = w === null ? "" : w, ue = F && !Q && l.value !== V, Me = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), oe = t === "selected" && l instanceof HTMLOptionElement, W = Z.activeElement, G = W !== null && (Me && l === W || oe && l.closest("select") === W) || (Me || oe) && this.hasPendingCheckableUserEdit(oe), re = this.getCheckableUserEditSequence(oe), me = w !== null, Qe = Me && o.isEvaluate && !G && l.checked !== me, He = oe && o.isEvaluate && !G && l.selected !== me;
|
|
6733
6733
|
if (!O && !j && !ue && !Qe && !He)
|
|
6734
6734
|
return F && !Q && (this.value = this.normalizeValueForElement(
|
|
6735
6735
|
l,
|
|
6736
|
-
|
|
6736
|
+
V
|
|
6737
6737
|
), this.clearUnappliedValueWrite()), (Me || oe) && !G && this.syncCheckableValueFromDom(oe), Promise.resolve();
|
|
6738
6738
|
const ct = J.enqueue(() => {
|
|
6739
6739
|
const he = this.getCheckableUserEditSequence(oe) !== re, ye = oe && (G || he) ? v.captureSelection(
|
|
@@ -6744,10 +6744,10 @@ const v = class v extends D {
|
|
|
6744
6744
|
) : null;
|
|
6745
6745
|
O && l.setAttribute(e, r), w === null ? l.removeAttribute(t) : j && (l.setAttribute(t, w), t === `${c.prefix}bind` && this.recordSelfWrittenBind(w)), t === "style" && this.captureAndHideDisplay(), ye?.(), F && !Q && !(v.isUserEditableValue(l) && this.isSupersededByUserEdit(te)) && (this.value = this.normalizeValueForElement(
|
|
6746
6746
|
l,
|
|
6747
|
-
|
|
6748
|
-
), ue && (l.value =
|
|
6749
|
-
const
|
|
6750
|
-
|
|
6747
|
+
V
|
|
6748
|
+
), ue && (l.value = V), this.recordValueWriteResult(l.value === V));
|
|
6749
|
+
const Qt = Qe && !he, _t = He && !he;
|
|
6750
|
+
Qt && (l.checked = me), _t && (l.selected = me), (Qe || He) && this.syncCheckableValueFromDom(He);
|
|
6751
6751
|
}).finally(() => {
|
|
6752
6752
|
this.releaseSelfWritingAttributes(n);
|
|
6753
6753
|
});
|
|
@@ -6897,13 +6897,13 @@ const v = class v extends D {
|
|
|
6897
6897
|
if (this.isSkipMutationNode(e.getTarget()))
|
|
6898
6898
|
return Promise.resolve();
|
|
6899
6899
|
if (e === this)
|
|
6900
|
-
return
|
|
6900
|
+
return m.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
6901
6901
|
const i = /* @__PURE__ */ new Set();
|
|
6902
6902
|
let s = this.parent;
|
|
6903
6903
|
for (; s; )
|
|
6904
6904
|
i.add(s), s = s.getParent();
|
|
6905
6905
|
if (i.has(e))
|
|
6906
|
-
return
|
|
6906
|
+
return m.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
6907
6907
|
const n = this.linkChild(
|
|
6908
6908
|
e,
|
|
6909
6909
|
t,
|
|
@@ -6954,7 +6954,7 @@ const v = class v extends D {
|
|
|
6954
6954
|
t,
|
|
6955
6955
|
!1
|
|
6956
6956
|
);
|
|
6957
|
-
u === null ? (
|
|
6957
|
+
u === null ? (m.warn(
|
|
6958
6958
|
"[Haori]",
|
|
6959
6959
|
"Reference child not found in children.",
|
|
6960
6960
|
t
|
|
@@ -6980,7 +6980,7 @@ const v = class v extends D {
|
|
|
6980
6980
|
t,
|
|
6981
6981
|
!0
|
|
6982
6982
|
);
|
|
6983
|
-
return i === null ? (
|
|
6983
|
+
return i === null ? (m.warn(
|
|
6984
6984
|
"[Haori]",
|
|
6985
6985
|
"Reference child not found in children.",
|
|
6986
6986
|
t
|
|
@@ -7447,7 +7447,7 @@ const Xe = class Xe {
|
|
|
7447
7447
|
*/
|
|
7448
7448
|
checkRawExpressions() {
|
|
7449
7449
|
for (let e = 0; e < this.contents.length; e++)
|
|
7450
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
7450
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (m.error(
|
|
7451
7451
|
"[Haori]",
|
|
7452
7452
|
"Raw expressions are not allowed in multi-content expressions."
|
|
7453
7453
|
), this.contents[e].type = 1);
|
|
@@ -7503,7 +7503,7 @@ const Xe = class Xe {
|
|
|
7503
7503
|
} else
|
|
7504
7504
|
s.push(l.text);
|
|
7505
7505
|
} catch (u) {
|
|
7506
|
-
|
|
7506
|
+
m.error(
|
|
7507
7507
|
"[Haori]",
|
|
7508
7508
|
`Error evaluating ${i} expression: ${l.text}`,
|
|
7509
7509
|
u
|
|
@@ -7530,7 +7530,7 @@ const _ = class _ extends ge {
|
|
|
7530
7530
|
*/
|
|
7531
7531
|
constructor(e, t) {
|
|
7532
7532
|
const r = _.isEventHandlerAttribute(e);
|
|
7533
|
-
super(t, e === `${c.prefix}bind` || r), this.name = e, this.forceEvaluation = _.needsForceEvaluation(e), this.checksUrlPath = _.isRequestUrlAttribute(e), r &&
|
|
7533
|
+
super(t, e === `${c.prefix}bind` || r), this.name = e, this.forceEvaluation = _.needsForceEvaluation(e), this.checksUrlPath = _.isRequestUrlAttribute(e), r && H.isEnabled() && t.includes("{{") && _.warnEventHandlerPlaceholder(e, t);
|
|
7534
7534
|
}
|
|
7535
7535
|
/**
|
|
7536
7536
|
* イベントハンドラ属性(名前が `on` で始まる属性と `data-attr-on*`)かどうかを
|
|
@@ -7561,7 +7561,7 @@ const _ = class _ extends ge {
|
|
|
7561
7561
|
*/
|
|
7562
7562
|
static warnEventHandlerPlaceholder(e, t) {
|
|
7563
7563
|
const r = `${e}\0${t}`;
|
|
7564
|
-
_.WARNED_EVENT_HANDLER_PLACEHOLDERS.has(r) || (_.WARNED_EVENT_HANDLER_PLACEHOLDERS.add(r),
|
|
7564
|
+
_.WARNED_EVENT_HANDLER_PLACEHOLDERS.has(r) || (_.WARNED_EVENT_HANDLER_PLACEHOLDERS.add(r), m.warn(
|
|
7565
7565
|
"[Haori]",
|
|
7566
7566
|
`Placeholders in event handler attributes are not evaluated: ${e}="${t}". Use ${c.prefix}{event}-run, or read the bound value inside the called function.`
|
|
7567
7567
|
));
|
|
@@ -7583,7 +7583,7 @@ const _ = class _ extends ge {
|
|
|
7583
7583
|
t = !0;
|
|
7584
7584
|
else if (t && !/[?#]/.test(r) && _.changesUrlPath(n)) {
|
|
7585
7585
|
const a = `${this.name}\0${this.getValue()}\0${n}`;
|
|
7586
|
-
_.WARNED_URL_PATH_VALUES.has(a) || (_.WARNED_URL_PATH_VALUES.add(a),
|
|
7586
|
+
_.WARNED_URL_PATH_VALUES.has(a) || (_.WARNED_URL_PATH_VALUES.add(a), m.warn(
|
|
7587
7587
|
"[Haori]",
|
|
7588
7588
|
`A value embedded in the URL path is not URL-encoded and changes the request path: ${this.name}="${this.getValue()}", value: ${n}. Encode it with encodeURIComponent, or send it as a query.`
|
|
7589
7589
|
));
|
|
@@ -7658,7 +7658,7 @@ const _ = class _ extends ge {
|
|
|
7658
7658
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
7659
7659
|
"attribute"
|
|
7660
7660
|
);
|
|
7661
|
-
return this.checksUrlPath &&
|
|
7661
|
+
return this.checksUrlPath && H.isEnabled() && this.diagnoseUrlPathValues(r.results), this.forceEvaluation && r.results.length > 1 ? (m.error(
|
|
7662
7662
|
"[Haori]",
|
|
7663
7663
|
"each or if expressions must have a single content.",
|
|
7664
7664
|
r.results
|
|
@@ -7672,7 +7672,7 @@ _.FORCE_EVALUATION_SUFFIXES = ["if", "each", "derive"], _.FORCE_EVALUATION_PREFI
|
|
|
7672
7672
|
let Ye = _;
|
|
7673
7673
|
const At = "[Haori]", vt = {
|
|
7674
7674
|
nameRequired: "Handler name is required.",
|
|
7675
|
-
notFunction: (
|
|
7675
|
+
notFunction: (f) => `Handler "${f}" must be a function.`
|
|
7676
7676
|
}, Se = class Se {
|
|
7677
7677
|
/**
|
|
7678
7678
|
* 関数を登録します。同じ名前で登録し直すと置き換えます。
|
|
@@ -7684,11 +7684,11 @@ const At = "[Haori]", vt = {
|
|
|
7684
7684
|
static register(e, t) {
|
|
7685
7685
|
const r = typeof e == "string" ? e.trim() : "";
|
|
7686
7686
|
if (r === "") {
|
|
7687
|
-
|
|
7687
|
+
m.error(At, vt.nameRequired);
|
|
7688
7688
|
return;
|
|
7689
7689
|
}
|
|
7690
7690
|
if (typeof t != "function") {
|
|
7691
|
-
|
|
7691
|
+
m.error(At, vt.notFunction(r));
|
|
7692
7692
|
return;
|
|
7693
7693
|
}
|
|
7694
7694
|
Se.handlers.set(r, t);
|
|
@@ -7818,7 +7818,7 @@ const Re = class Re {
|
|
|
7818
7818
|
*/
|
|
7819
7819
|
static openDialog(e) {
|
|
7820
7820
|
return J.enqueue(() => {
|
|
7821
|
-
e instanceof HTMLDialogElement ? (Re.clearMessagesSync(e), e.showModal()) :
|
|
7821
|
+
e instanceof HTMLDialogElement ? (Re.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
7822
7822
|
}, !0);
|
|
7823
7823
|
}
|
|
7824
7824
|
/**
|
|
@@ -7828,7 +7828,7 @@ const Re = class Re {
|
|
|
7828
7828
|
*/
|
|
7829
7829
|
static closeDialog(e) {
|
|
7830
7830
|
return J.enqueue(() => {
|
|
7831
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
7831
|
+
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
7832
7832
|
}, !0);
|
|
7833
7833
|
}
|
|
7834
7834
|
/**
|
|
@@ -7903,7 +7903,7 @@ const Re = class Re {
|
|
|
7903
7903
|
* @returns 整形済みの現在日時文字列
|
|
7904
7904
|
*/
|
|
7905
7905
|
static now(e, t) {
|
|
7906
|
-
return
|
|
7906
|
+
return Mt(e, t);
|
|
7907
7907
|
}
|
|
7908
7908
|
/**
|
|
7909
7909
|
* 現在日付に日数を加減した日付を指定フォーマットの文字列へ整形します。
|
|
@@ -7917,7 +7917,7 @@ const Re = class Re {
|
|
|
7917
7917
|
* @returns 整形済みの日付文字列。timeZone が不正な場合は空文字
|
|
7918
7918
|
*/
|
|
7919
7919
|
static today(e, t, r) {
|
|
7920
|
-
return
|
|
7920
|
+
return $t(e, t, r);
|
|
7921
7921
|
}
|
|
7922
7922
|
/**
|
|
7923
7923
|
* 数値を桁区切り・小数桁付きの文字列へ整形します。
|
|
@@ -7929,7 +7929,7 @@ const Re = class Re {
|
|
|
7929
7929
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
7930
7930
|
*/
|
|
7931
7931
|
static number(e, t) {
|
|
7932
|
-
return
|
|
7932
|
+
return Pt(e, t);
|
|
7933
7933
|
}
|
|
7934
7934
|
/**
|
|
7935
7935
|
* 整数の配列を生成します(終端は排他)。
|
|
@@ -7942,7 +7942,7 @@ const Re = class Re {
|
|
|
7942
7942
|
* @returns 整数配列
|
|
7943
7943
|
*/
|
|
7944
7944
|
static range(e, t, r) {
|
|
7945
|
-
return
|
|
7945
|
+
return Lt(e, t, r);
|
|
7946
7946
|
}
|
|
7947
7947
|
/**
|
|
7948
7948
|
* 番号ページネーション用の表示要素列を生成します。
|
|
@@ -7955,7 +7955,7 @@ const Re = class Re {
|
|
|
7955
7955
|
* @returns 表示要素の配列
|
|
7956
7956
|
*/
|
|
7957
7957
|
static pages(e, t, r) {
|
|
7958
|
-
return
|
|
7958
|
+
return Ot(e, t, r);
|
|
7959
7959
|
}
|
|
7960
7960
|
/**
|
|
7961
7961
|
* `YYYY-MM` 形式の年月文字列に月数を加算します。
|
|
@@ -7979,7 +7979,7 @@ const Re = class Re {
|
|
|
7979
7979
|
* @returns 年月情報の降順配列。不正な入力は空配列
|
|
7980
7980
|
*/
|
|
7981
7981
|
static monthRange(e, t) {
|
|
7982
|
-
return
|
|
7982
|
+
return Bt(e, t);
|
|
7983
7983
|
}
|
|
7984
7984
|
/**
|
|
7985
7985
|
* ページレスポンスから表示用サマリーを作ります。
|
|
@@ -7991,7 +7991,7 @@ const Re = class Re {
|
|
|
7991
7991
|
* @returns 表示サマリー
|
|
7992
7992
|
*/
|
|
7993
7993
|
static pageSummary(e, t) {
|
|
7994
|
-
return
|
|
7994
|
+
return Ut(e, t);
|
|
7995
7995
|
}
|
|
7996
7996
|
/**
|
|
7997
7997
|
* 配列から `item[key]` が指定値に一致する最初の要素を返します。
|
|
@@ -8005,7 +8005,7 @@ const Re = class Re {
|
|
|
8005
8005
|
* @returns 一致した最初の要素。無ければ null
|
|
8006
8006
|
*/
|
|
8007
8007
|
static findBy(e, t, r) {
|
|
8008
|
-
return
|
|
8008
|
+
return Ht(e, t, r);
|
|
8009
8009
|
}
|
|
8010
8010
|
/**
|
|
8011
8011
|
* 配列の数値合計を返します。
|
|
@@ -8018,7 +8018,7 @@ const Re = class Re {
|
|
|
8018
8018
|
* @returns 数値の合計。対象が無ければ 0
|
|
8019
8019
|
*/
|
|
8020
8020
|
static sum(e, t) {
|
|
8021
|
-
return
|
|
8021
|
+
return Vt(e, t);
|
|
8022
8022
|
}
|
|
8023
8023
|
/**
|
|
8024
8024
|
* 配列から重複を取り除いた新しい配列を返します。
|
|
@@ -8031,7 +8031,7 @@ const Re = class Re {
|
|
|
8031
8031
|
* @returns 重複排除後の新しい配列。非配列は空配列
|
|
8032
8032
|
*/
|
|
8033
8033
|
static distinct(e, t) {
|
|
8034
|
-
return
|
|
8034
|
+
return Wt(e, t);
|
|
8035
8035
|
}
|
|
8036
8036
|
/**
|
|
8037
8037
|
* 配列を `item[key]` ごとのグループへ分けて返します。
|
|
@@ -8044,7 +8044,7 @@ const Re = class Re {
|
|
|
8044
8044
|
* @returns グループ情報の配列。非配列は空配列
|
|
8045
8045
|
*/
|
|
8046
8046
|
static groupBy(e, t) {
|
|
8047
|
-
return
|
|
8047
|
+
return jt(e, t);
|
|
8048
8048
|
}
|
|
8049
8049
|
};
|
|
8050
8050
|
Re.handlers = {
|
|
@@ -8089,14 +8089,14 @@ Re.handlers = {
|
|
|
8089
8089
|
}
|
|
8090
8090
|
};
|
|
8091
8091
|
let ke = Re;
|
|
8092
|
-
const
|
|
8092
|
+
const mr = "入力内容を確認してください", yr = ["addErrorMessage", "clearMessages"], wt = "data-haori-group-name";
|
|
8093
8093
|
function St() {
|
|
8094
8094
|
const e = globalThis.window?.Haori;
|
|
8095
|
-
return
|
|
8095
|
+
return yr.every(
|
|
8096
8096
|
(r) => typeof e?.[r] == "function"
|
|
8097
8097
|
) ? e : ke;
|
|
8098
8098
|
}
|
|
8099
|
-
const
|
|
8099
|
+
const p = class p {
|
|
8100
8100
|
/**
|
|
8101
8101
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
8102
8102
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -8107,7 +8107,7 @@ const f = class f {
|
|
|
8107
8107
|
*/
|
|
8108
8108
|
static getValues(e) {
|
|
8109
8109
|
const t = {}, r = /* @__PURE__ */ new Set();
|
|
8110
|
-
return
|
|
8110
|
+
return p.getPartValues(e, t, null, r), p.registerCollectedExcludedKeys(t, r), t;
|
|
8111
8111
|
}
|
|
8112
8112
|
/**
|
|
8113
8113
|
* 入力エレメントから収集する値を解決します。
|
|
@@ -8128,11 +8128,11 @@ const f = class f {
|
|
|
8128
8128
|
*/
|
|
8129
8129
|
static resolveCollectedValue(e) {
|
|
8130
8130
|
const t = e.getTarget();
|
|
8131
|
-
if (
|
|
8131
|
+
if (p.isFileInput(e)) {
|
|
8132
8132
|
const r = t, i = r.files ? Array.from(r.files) : [];
|
|
8133
8133
|
return r.multiple ? i : i.length > 0 ? i[0] : null;
|
|
8134
8134
|
}
|
|
8135
|
-
if (
|
|
8135
|
+
if (p.isBooleanCheckbox(e)) {
|
|
8136
8136
|
const r = t;
|
|
8137
8137
|
return r.value === "false" ? !r.checked : r.checked;
|
|
8138
8138
|
}
|
|
@@ -8185,13 +8185,13 @@ const f = class f {
|
|
|
8185
8185
|
* @returns 戻り値はありません。
|
|
8186
8186
|
*/
|
|
8187
8187
|
static clearRowUserEditMarksForChangedKeys(e, t) {
|
|
8188
|
-
const r =
|
|
8188
|
+
const r = p.getValues(e), i = /* @__PURE__ */ new Set();
|
|
8189
8189
|
for (const s of /* @__PURE__ */ new Set([
|
|
8190
8190
|
...Object.keys(r),
|
|
8191
8191
|
...Object.keys(t)
|
|
8192
8192
|
]))
|
|
8193
|
-
|
|
8194
|
-
i.size !== 0 &&
|
|
8193
|
+
p.isSameCollectedValue(r[s], t[s]) || i.add(s);
|
|
8194
|
+
i.size !== 0 && p.clearUserEditMarksForKeys(e, e, i);
|
|
8195
8195
|
}
|
|
8196
8196
|
/**
|
|
8197
8197
|
* 収集値と要素データの値が同じ内容かどうかを判定します。
|
|
@@ -8220,9 +8220,9 @@ const f = class f {
|
|
|
8220
8220
|
* @returns 戻り値はありません。
|
|
8221
8221
|
*/
|
|
8222
8222
|
static clearUserEditMarksForKeys(e, t, r) {
|
|
8223
|
-
const i =
|
|
8223
|
+
const i = p.resolveRowTopLevelKey(e, t);
|
|
8224
8224
|
i !== null && r.has(i) && e.clearUserEditMark(), e.getChildElementFragments().forEach((s) => {
|
|
8225
|
-
|
|
8225
|
+
p.clearUserEditMarksForKeys(s, t, r);
|
|
8226
8226
|
});
|
|
8227
8227
|
}
|
|
8228
8228
|
/**
|
|
@@ -8238,7 +8238,7 @@ const f = class f {
|
|
|
8238
8238
|
static resolveRowTopLevelKey(e, t) {
|
|
8239
8239
|
let r = null, i = e;
|
|
8240
8240
|
for (; i !== null && i !== t; ) {
|
|
8241
|
-
const s = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) ||
|
|
8241
|
+
const s = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) || p.resolveFieldName(i);
|
|
8242
8242
|
s != null && String(s) !== "" && (r = String(s)), i = i.getParent();
|
|
8243
8243
|
}
|
|
8244
8244
|
return r;
|
|
@@ -8269,7 +8269,7 @@ const f = class f {
|
|
|
8269
8269
|
return;
|
|
8270
8270
|
const t = e.getAttribute(`${c.prefix}form-name`);
|
|
8271
8271
|
if (!t) {
|
|
8272
|
-
|
|
8272
|
+
m.warn(
|
|
8273
8273
|
"Haori",
|
|
8274
8274
|
`${c.prefix}form-name evaluated to an empty key; the field falls back to the name attribute or is not collected.`,
|
|
8275
8275
|
e.getTarget()
|
|
@@ -8279,7 +8279,7 @@ const f = class f {
|
|
|
8279
8279
|
const r = e.getTarget();
|
|
8280
8280
|
if (!(r instanceof HTMLInputElement) || r.type !== "radio" || r.hasAttribute("name") && !r.hasAttribute(wt))
|
|
8281
8281
|
return;
|
|
8282
|
-
const i =
|
|
8282
|
+
const i = p.resolveGroupScope(e), s = `${String(t)}--haori${p.resolveGroupScopeId(
|
|
8283
8283
|
i
|
|
8284
8284
|
)}`;
|
|
8285
8285
|
if (r.getAttribute("name") !== s)
|
|
@@ -8313,8 +8313,8 @@ const f = class f {
|
|
|
8313
8313
|
* @returns スコープの識別番号
|
|
8314
8314
|
*/
|
|
8315
8315
|
static resolveGroupScopeId(e) {
|
|
8316
|
-
const t =
|
|
8317
|
-
return t !== void 0 ? t : (
|
|
8316
|
+
const t = p.GROUP_SCOPE_IDS.get(e);
|
|
8317
|
+
return t !== void 0 ? t : (p.groupScopeSequence += 1, p.GROUP_SCOPE_IDS.set(e, p.groupScopeSequence), p.groupScopeSequence);
|
|
8318
8318
|
}
|
|
8319
8319
|
/**
|
|
8320
8320
|
* 宣言バインドで値・状態が決まり、その評価が解決している入力かどうかを判定します。
|
|
@@ -8332,17 +8332,17 @@ const f = class f {
|
|
|
8332
8332
|
* @returns 宣言バインドで値・状態が決まり、その評価が解決している場合 true
|
|
8333
8333
|
*/
|
|
8334
8334
|
static hasResolvedDeclarativeState(e) {
|
|
8335
|
-
if (!
|
|
8335
|
+
if (!p.isDeclarativeStateBound(e))
|
|
8336
8336
|
return !1;
|
|
8337
8337
|
const t = e.getTarget();
|
|
8338
8338
|
if (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio"))
|
|
8339
|
-
return
|
|
8340
|
-
if (
|
|
8341
|
-
return
|
|
8339
|
+
return p.isDeclarationResolved(e, "checked");
|
|
8340
|
+
if (p.hasDeclarativeBinding(e, "value"))
|
|
8341
|
+
return p.isDeclarationResolved(e, "value");
|
|
8342
8342
|
if (t instanceof HTMLSelectElement) {
|
|
8343
8343
|
for (const r of Array.from(t.options)) {
|
|
8344
8344
|
const i = D.get(r);
|
|
8345
|
-
if (i instanceof R &&
|
|
8345
|
+
if (i instanceof R && p.hasDeclarativeBinding(i, "selected") && !p.isDeclarationResolved(i, "selected"))
|
|
8346
8346
|
return !1;
|
|
8347
8347
|
}
|
|
8348
8348
|
return !0;
|
|
@@ -8385,7 +8385,7 @@ const f = class f {
|
|
|
8385
8385
|
*/
|
|
8386
8386
|
static isDeclarativeStateBound(e) {
|
|
8387
8387
|
const t = e.getTarget();
|
|
8388
|
-
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ?
|
|
8388
|
+
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? p.hasDeclarativeBinding(e, "checked") : R.isValuePropertyTarget(t) ? p.hasDeclarativeBinding(e, "value") ? !0 : t instanceof HTMLSelectElement ? p.hasDeclarativeSelectedOption(t) : !1 : !1;
|
|
8389
8389
|
}
|
|
8390
8390
|
/**
|
|
8391
8391
|
* 対象の部分木にある入力欄を、ネイティブのフォームリセットと同じ既定値へ戻します。
|
|
@@ -8405,7 +8405,7 @@ const f = class f {
|
|
|
8405
8405
|
const t = "input, textarea, select", r = [];
|
|
8406
8406
|
e.matches(t) && r.push(e), r.push(...e.querySelectorAll(t));
|
|
8407
8407
|
for (const i of r)
|
|
8408
|
-
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement &&
|
|
8408
|
+
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement && p.restoreDefaultSelection(i);
|
|
8409
8409
|
}
|
|
8410
8410
|
/**
|
|
8411
8411
|
* `<select>` の選択状態を既定の選択(`defaultSelected`)へ戻します。
|
|
@@ -8435,14 +8435,14 @@ const f = class f {
|
|
|
8435
8435
|
* @return 戻り値はありません。
|
|
8436
8436
|
*/
|
|
8437
8437
|
static clearDeclarativeStateFromDom(e) {
|
|
8438
|
-
if (
|
|
8438
|
+
if (p.isDeclarativeStateBound(e)) {
|
|
8439
8439
|
const t = e.getTarget();
|
|
8440
8440
|
t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked = !1 : t instanceof HTMLSelectElement ? (Array.from(t.options).forEach((r) => {
|
|
8441
8441
|
r.selected = !1;
|
|
8442
8442
|
}), t.selectedIndex = -1) : (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = "");
|
|
8443
8443
|
}
|
|
8444
8444
|
e.getChildren().forEach((t) => {
|
|
8445
|
-
t instanceof R &&
|
|
8445
|
+
t instanceof R && p.clearDeclarativeStateFromDom(t);
|
|
8446
8446
|
});
|
|
8447
8447
|
}
|
|
8448
8448
|
/**
|
|
@@ -8472,7 +8472,7 @@ const f = class f {
|
|
|
8472
8472
|
static hasDeclarativeSelectedOption(e) {
|
|
8473
8473
|
for (const t of Array.from(e.options)) {
|
|
8474
8474
|
const r = D.get(t);
|
|
8475
|
-
if (r instanceof R &&
|
|
8475
|
+
if (r instanceof R && p.hasDeclarativeBinding(r, "selected"))
|
|
8476
8476
|
return !0;
|
|
8477
8477
|
}
|
|
8478
8478
|
return !1;
|
|
@@ -8503,7 +8503,7 @@ const f = class f {
|
|
|
8503
8503
|
* @returns 編集された入力欄だけを含む値のオブジェクト
|
|
8504
8504
|
*/
|
|
8505
8505
|
static getValuesEditedAfter(e, t) {
|
|
8506
|
-
return
|
|
8506
|
+
return p.getPartValues(e, {}, t);
|
|
8507
8507
|
}
|
|
8508
8508
|
/**
|
|
8509
8509
|
* 利用者が編集した入力欄に対応するバインドデータの経路を集めます。
|
|
@@ -8545,10 +8545,10 @@ const f = class f {
|
|
|
8545
8545
|
*/
|
|
8546
8546
|
static collectEditedPaths(e, t, r = "", i = null) {
|
|
8547
8547
|
const s = /* @__PURE__ */ new Map();
|
|
8548
|
-
for (const a of
|
|
8548
|
+
for (const a of p.collectUserEditSequences(e)) {
|
|
8549
8549
|
const o = /* @__PURE__ */ new Set();
|
|
8550
|
-
|
|
8551
|
-
|
|
8550
|
+
p.walkEditedPaths(
|
|
8551
|
+
p.getValuesEditedAfter(e, a - 1),
|
|
8552
8552
|
r,
|
|
8553
8553
|
o
|
|
8554
8554
|
);
|
|
@@ -8556,7 +8556,7 @@ const f = class f {
|
|
|
8556
8556
|
s.has(l) || s.set(l, a);
|
|
8557
8557
|
}
|
|
8558
8558
|
const n = /* @__PURE__ */ new Set();
|
|
8559
|
-
|
|
8559
|
+
p.walkExcludedPaths(i ?? p.getValues(e), r, n);
|
|
8560
8560
|
for (const a of n)
|
|
8561
8561
|
s.has(a) || s.set(a, t);
|
|
8562
8562
|
return s;
|
|
@@ -8569,7 +8569,7 @@ const f = class f {
|
|
|
8569
8569
|
*/
|
|
8570
8570
|
static collectUserEditSequences(e) {
|
|
8571
8571
|
const t = /* @__PURE__ */ new Set();
|
|
8572
|
-
return
|
|
8572
|
+
return p.walkUserEditSequences(e, t), [...t].sort((r, i) => i - r);
|
|
8573
8573
|
}
|
|
8574
8574
|
/**
|
|
8575
8575
|
* 部分木をたどってユーザー編集の通番を集めます。
|
|
@@ -8582,7 +8582,7 @@ const f = class f {
|
|
|
8582
8582
|
const r = e.getUserEditSequence();
|
|
8583
8583
|
r > 0 && t.add(r);
|
|
8584
8584
|
for (const i of e.getChildElementFragments())
|
|
8585
|
-
|
|
8585
|
+
p.walkUserEditSequences(i, t);
|
|
8586
8586
|
}
|
|
8587
8587
|
/**
|
|
8588
8588
|
* 収集値をたどって、除外されたキーの経路を集めます。
|
|
@@ -8597,15 +8597,15 @@ const f = class f {
|
|
|
8597
8597
|
static walkExcludedPaths(e, t, r) {
|
|
8598
8598
|
if (Array.isArray(e))
|
|
8599
8599
|
return;
|
|
8600
|
-
const i =
|
|
8600
|
+
const i = p.asPlainRecord(e);
|
|
8601
8601
|
if (i === null)
|
|
8602
8602
|
return;
|
|
8603
|
-
const s =
|
|
8603
|
+
const s = p.COLLECTED_EXCLUDED_KEYS.get(i);
|
|
8604
8604
|
if (s)
|
|
8605
8605
|
for (const n of s)
|
|
8606
8606
|
n in i || r.add(t === "" ? n : `${t}.${n}`);
|
|
8607
8607
|
for (const [n, a] of Object.entries(i))
|
|
8608
|
-
|
|
8608
|
+
p.walkExcludedPaths(
|
|
8609
8609
|
a,
|
|
8610
8610
|
t === "" ? n : `${t}.${n}`,
|
|
8611
8611
|
r
|
|
@@ -8621,10 +8621,10 @@ const f = class f {
|
|
|
8621
8621
|
static walkEditedPaths(e, t, r) {
|
|
8622
8622
|
if (Array.isArray(e))
|
|
8623
8623
|
return;
|
|
8624
|
-
const i =
|
|
8624
|
+
const i = p.asPlainRecord(e);
|
|
8625
8625
|
if (i !== null) {
|
|
8626
8626
|
for (const [s, n] of Object.entries(i))
|
|
8627
|
-
|
|
8627
|
+
p.walkEditedPaths(
|
|
8628
8628
|
n,
|
|
8629
8629
|
t === "" ? s : `${t}.${s}`,
|
|
8630
8630
|
r
|
|
@@ -8639,7 +8639,7 @@ const f = class f {
|
|
|
8639
8639
|
* @returns 最中なら true
|
|
8640
8640
|
*/
|
|
8641
8641
|
static isResettingInternally() {
|
|
8642
|
-
return
|
|
8642
|
+
return p.internalResetDepth > 0;
|
|
8643
8643
|
}
|
|
8644
8644
|
/**
|
|
8645
8645
|
* フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
|
|
@@ -8658,75 +8658,75 @@ const f = class f {
|
|
|
8658
8658
|
return t;
|
|
8659
8659
|
if (e.getTarget().hasAttribute(`${c.prefix}if-false`)) {
|
|
8660
8660
|
if (i !== null)
|
|
8661
|
-
for (const u of
|
|
8661
|
+
for (const u of p.collectDeclaredKeysInFragment(e))
|
|
8662
8662
|
i.add(u);
|
|
8663
8663
|
return t;
|
|
8664
8664
|
}
|
|
8665
|
-
const s =
|
|
8665
|
+
const s = p.resolveFieldName(e), n = e.getAttribute(`${c.prefix}form-object`), a = e.getAttribute(`${c.prefix}form-list`), o = e.hasAttribute(`${c.prefix}form-list`), l = r !== null && e.getUserEditSequence() <= r;
|
|
8666
8666
|
if (s) {
|
|
8667
|
-
if (r !== null &&
|
|
8668
|
-
const u =
|
|
8667
|
+
if (r !== null && p.isGroupedCheckable(e)) {
|
|
8668
|
+
const u = p.collectGroupSelection(
|
|
8669
8669
|
e,
|
|
8670
8670
|
o,
|
|
8671
8671
|
r
|
|
8672
8672
|
);
|
|
8673
8673
|
u.edited && (t[String(s)] = u.value);
|
|
8674
|
-
} else if (o &&
|
|
8674
|
+
} else if (o && p.isGroupedCheckable(e)) {
|
|
8675
8675
|
const u = String(s), d = e.getTarget();
|
|
8676
8676
|
r === null && !Array.isArray(t[u]) && (t[u] = []), !l && d.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(d.value));
|
|
8677
8677
|
} else if (o && l)
|
|
8678
8678
|
Array.isArray(t[String(s)]) ? t[String(s)].push(null) : t[String(s)] = [null];
|
|
8679
8679
|
else if (!l) if (o) {
|
|
8680
|
-
const u =
|
|
8680
|
+
const u = p.resolveCollectedValue(e), d = p.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
8681
8681
|
Array.isArray(t[String(s)]) ? t[String(s)].push(...d) : t[String(s)] = d;
|
|
8682
|
-
} else if (
|
|
8683
|
-
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0,
|
|
8682
|
+
} else if (p.isGroupedCheckable(e)) {
|
|
8683
|
+
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, y = u instanceof HTMLInputElement ? u.value : e.getValue(), b = d ? y : null, E = String(s);
|
|
8684
8684
|
b === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = b : Array.isArray(t[E]) ? t[E].push(b) : t[E] = [t[E], b];
|
|
8685
8685
|
} else
|
|
8686
|
-
t[String(s)] =
|
|
8687
|
-
n &&
|
|
8686
|
+
t[String(s)] = p.resolveCollectedValue(e);
|
|
8687
|
+
n && m.warn(
|
|
8688
8688
|
"Haori",
|
|
8689
8689
|
`Element cannot have both ${c.prefix}form-object and name attributes.`
|
|
8690
8690
|
);
|
|
8691
8691
|
for (const u of e.getChildElementFragments())
|
|
8692
|
-
|
|
8692
|
+
p.getPartValues(u, t, r, i);
|
|
8693
8693
|
} else if (n) {
|
|
8694
8694
|
const u = {}, d = i === null ? null : /* @__PURE__ */ new Set();
|
|
8695
|
-
for (const
|
|
8696
|
-
|
|
8697
|
-
|
|
8695
|
+
for (const y of e.getChildElementFragments())
|
|
8696
|
+
p.getPartValues(
|
|
8697
|
+
y,
|
|
8698
8698
|
u,
|
|
8699
8699
|
r,
|
|
8700
8700
|
d
|
|
8701
8701
|
);
|
|
8702
|
-
d !== null &&
|
|
8702
|
+
d !== null && p.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(n)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(n)), a && m.warn(
|
|
8703
8703
|
"Haori",
|
|
8704
8704
|
`Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
|
|
8705
8705
|
);
|
|
8706
8706
|
} else if (a) {
|
|
8707
8707
|
const u = [], d = [];
|
|
8708
|
-
let
|
|
8708
|
+
let y = !1;
|
|
8709
8709
|
for (const b of e.getChildElementFragments()) {
|
|
8710
8710
|
const E = {}, A = i === null ? null : /* @__PURE__ */ new Set();
|
|
8711
|
-
|
|
8711
|
+
p.getPartValues(
|
|
8712
8712
|
b,
|
|
8713
8713
|
E,
|
|
8714
8714
|
r,
|
|
8715
8715
|
A
|
|
8716
|
-
), A !== null &&
|
|
8716
|
+
), A !== null && p.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (y = !0, u.push(E), d.push(b.getListKey())) : r !== null && (u.push({}), d.push(b.getListKey()));
|
|
8717
8717
|
}
|
|
8718
8718
|
if (r === null) {
|
|
8719
8719
|
const b = e.getAttribute(`${c.prefix}each-key`);
|
|
8720
|
-
|
|
8720
|
+
p.registerCollectedRowIdentity(
|
|
8721
8721
|
u,
|
|
8722
8722
|
b == null ? null : String(b),
|
|
8723
8723
|
d,
|
|
8724
|
-
|
|
8725
|
-
),
|
|
8726
|
-
} else
|
|
8724
|
+
p.isCollectedListFromEachSource(e)
|
|
8725
|
+
), p.warnDerivedRowsWithoutKey(e), t[String(a)] = u;
|
|
8726
|
+
} else y && (t[String(a)] = u);
|
|
8727
8727
|
} else
|
|
8728
8728
|
for (const u of e.getChildElementFragments())
|
|
8729
|
-
|
|
8729
|
+
p.getPartValues(u, t, r, i);
|
|
8730
8730
|
return t;
|
|
8731
8731
|
}
|
|
8732
8732
|
/**
|
|
@@ -8739,7 +8739,7 @@ const f = class f {
|
|
|
8739
8739
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
8740
8740
|
*/
|
|
8741
8741
|
static setValues(e, t, r = !1) {
|
|
8742
|
-
return
|
|
8742
|
+
return p.setPartValues(e, t, r, !0);
|
|
8743
8743
|
}
|
|
8744
8744
|
/**
|
|
8745
8745
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -8752,7 +8752,7 @@ const f = class f {
|
|
|
8752
8752
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
8753
8753
|
*/
|
|
8754
8754
|
static syncValues(e, t, r = !1, i = null) {
|
|
8755
|
-
return
|
|
8755
|
+
return p.setPartValues(
|
|
8756
8756
|
e,
|
|
8757
8757
|
t,
|
|
8758
8758
|
r,
|
|
@@ -8775,7 +8775,7 @@ const f = class f {
|
|
|
8775
8775
|
* @returns 反映完了の Promise
|
|
8776
8776
|
*/
|
|
8777
8777
|
static syncRowValues(e, t, r = null) {
|
|
8778
|
-
return
|
|
8778
|
+
return p.setPartValues(
|
|
8779
8779
|
e,
|
|
8780
8780
|
t,
|
|
8781
8781
|
!1,
|
|
@@ -8805,7 +8805,7 @@ const f = class f {
|
|
|
8805
8805
|
if (!r)
|
|
8806
8806
|
return t;
|
|
8807
8807
|
const i = String(r);
|
|
8808
|
-
return Object.prototype.hasOwnProperty.call(t, i) ?
|
|
8808
|
+
return Object.prototype.hasOwnProperty.call(t, i) ? p.asPlainRecord(t[i]) ?? {} : p.resolveAncestorArgOwner(e, i)?.value ?? {};
|
|
8809
8809
|
}
|
|
8810
8810
|
/**
|
|
8811
8811
|
* キーを所有する祖先を、値の型を問わず解決します。
|
|
@@ -8851,11 +8851,11 @@ const f = class f {
|
|
|
8851
8851
|
* @returns 所有する祖先フラグメントとその値。見つからない場合は null
|
|
8852
8852
|
*/
|
|
8853
8853
|
static resolveAncestorArgOwner(e, t) {
|
|
8854
|
-
const r =
|
|
8854
|
+
const r = p.resolveAncestorKeyOwner(e, t);
|
|
8855
8855
|
if (r === null)
|
|
8856
8856
|
return null;
|
|
8857
|
-
const i =
|
|
8858
|
-
return i === null ? (
|
|
8857
|
+
const i = p.asPlainRecord(r.value);
|
|
8858
|
+
return i === null ? (p.warnArgOwnerIsNotRecord(e, t, r.value), null) : { owner: r.owner, value: i };
|
|
8859
8859
|
}
|
|
8860
8860
|
/**
|
|
8861
8861
|
* 収集キーの土台を祖先から解決する関数を返します。
|
|
@@ -8869,7 +8869,7 @@ const f = class f {
|
|
|
8869
8869
|
* @returns キーを受け取り、祖先が所有する値を返す関数(所有者が無ければ undefined)
|
|
8870
8870
|
*/
|
|
8871
8871
|
static ancestorBaseResolver(e) {
|
|
8872
|
-
return (t) =>
|
|
8872
|
+
return (t) => p.resolveAncestorKeyOwner(e, t)?.value;
|
|
8873
8873
|
}
|
|
8874
8874
|
/**
|
|
8875
8875
|
* `data-form-arg` のキーをレコード以外で所有している構成を、開発モードで知らせます。
|
|
@@ -8879,10 +8879,10 @@ const f = class f {
|
|
|
8879
8879
|
* @param value 祖先が所有している値
|
|
8880
8880
|
*/
|
|
8881
8881
|
static warnArgOwnerIsNotRecord(e, t, r) {
|
|
8882
|
-
if (!
|
|
8882
|
+
if (!H.isEnabled() || r == null)
|
|
8883
8883
|
return;
|
|
8884
|
-
const i = e.getTarget(), s =
|
|
8885
|
-
s?.has(t) || (s ? s.add(t) :
|
|
8884
|
+
const i = e.getTarget(), s = p.warnedArgOwnerNotRecord.get(i);
|
|
8885
|
+
s?.has(t) || (s ? s.add(t) : p.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])), m.warn(
|
|
8886
8886
|
"[Haori]",
|
|
8887
8887
|
`${c.prefix}form-arg="${t}" のキーを祖先が${Array.isArray(r) ? "配列" : `${typeof r} 型の値`}で持っています。${c.prefix}form-arg はそのキーの配下に入力欄が対応することを宣言するため、値はレコード(オブジェクト)である必要があります。このままでは収集値がそのキーへ直接入り、値の型が変わります。`
|
|
8888
8888
|
));
|
|
@@ -8904,18 +8904,18 @@ const f = class f {
|
|
|
8904
8904
|
static buildConditionScope(e, t = null) {
|
|
8905
8905
|
const r = { ...e.getBindingData() }, i = t ? {
|
|
8906
8906
|
source: t,
|
|
8907
|
-
argKey:
|
|
8908
|
-
} :
|
|
8907
|
+
argKey: p.resolveFormArgKey(t)
|
|
8908
|
+
} : p.resolveConditionValueSource(e);
|
|
8909
8909
|
if (!i)
|
|
8910
8910
|
return r;
|
|
8911
|
-
const s =
|
|
8911
|
+
const s = p.getValues(i.source), n = p.collectDeclaredFieldKeys(i.source);
|
|
8912
8912
|
if (i.argKey === null) {
|
|
8913
8913
|
for (const o of n)
|
|
8914
8914
|
r[o] = s[o];
|
|
8915
8915
|
return r;
|
|
8916
8916
|
}
|
|
8917
8917
|
const a = {
|
|
8918
|
-
...
|
|
8918
|
+
...p.asPlainRecord(r[i.argKey]) ?? {}
|
|
8919
8919
|
};
|
|
8920
8920
|
for (const o of n)
|
|
8921
8921
|
a[o] = s[o];
|
|
@@ -8945,8 +8945,8 @@ const f = class f {
|
|
|
8945
8945
|
}
|
|
8946
8946
|
t = i;
|
|
8947
8947
|
}
|
|
8948
|
-
const r =
|
|
8949
|
-
return r ? { source: r, argKey:
|
|
8948
|
+
const r = p.getFormFragment(e);
|
|
8949
|
+
return r ? { source: r, argKey: p.resolveFormArgKey(r) } : null;
|
|
8950
8950
|
}
|
|
8951
8951
|
/**
|
|
8952
8952
|
* フォームコンテナの `data-form-arg` のキー名を返します。
|
|
@@ -8978,7 +8978,7 @@ const f = class f {
|
|
|
8978
8978
|
* @returns 宣言されている最上位のキー名
|
|
8979
8979
|
*/
|
|
8980
8980
|
static collectDeclaredFieldKeys(e) {
|
|
8981
|
-
return
|
|
8981
|
+
return p.collectDeclaredKeysInFragment(e);
|
|
8982
8982
|
}
|
|
8983
8983
|
/**
|
|
8984
8984
|
* フラグメントの配下で収集対象として**宣言されている**最上位のキー名を列挙します。
|
|
@@ -8990,7 +8990,7 @@ const f = class f {
|
|
|
8990
8990
|
* @returns 宣言されている最上位のキー名
|
|
8991
8991
|
*/
|
|
8992
8992
|
static collectDeclaredKeysInFragment(e) {
|
|
8993
|
-
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i =
|
|
8993
|
+
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = p.resolveFieldName(e);
|
|
8994
8994
|
i && t.add(String(i));
|
|
8995
8995
|
const s = `${c.prefix}form-object`, n = `${c.prefix}form-list`, a = r.getAttribute(s) ?? r.getAttribute(n);
|
|
8996
8996
|
if (a)
|
|
@@ -8999,9 +8999,9 @@ const f = class f {
|
|
|
8999
8999
|
return r.querySelectorAll(o).forEach((l) => {
|
|
9000
9000
|
if (!(l instanceof HTMLElement))
|
|
9001
9001
|
return;
|
|
9002
|
-
let u = null, d = !1,
|
|
9003
|
-
for (;
|
|
9004
|
-
|
|
9002
|
+
let u = null, d = !1, y = l;
|
|
9003
|
+
for (; y && y !== r; )
|
|
9004
|
+
y.hasAttribute(`${c.prefix}form-detach`) && (d = !0), (y.hasAttribute(s) || y.hasAttribute(n)) && (u = y), y = y.parentElement;
|
|
9005
9005
|
if (d)
|
|
9006
9006
|
return;
|
|
9007
9007
|
const b = u ?? l, E = b.getAttribute(s) || b.getAttribute(n) || b.getAttribute(`${c.prefix}form-name`) || b.getAttribute("name");
|
|
@@ -9020,7 +9020,7 @@ const f = class f {
|
|
|
9020
9020
|
*/
|
|
9021
9021
|
static applyCustomValidity(e) {
|
|
9022
9022
|
const t = `${c.prefix}validity`, r = (i) => {
|
|
9023
|
-
i.hasAttribute(t) &&
|
|
9023
|
+
i.hasAttribute(t) && p.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
9024
9024
|
};
|
|
9025
9025
|
r(e);
|
|
9026
9026
|
}
|
|
@@ -9034,7 +9034,7 @@ const f = class f {
|
|
|
9034
9034
|
static applyOneCustomValidity(e, t) {
|
|
9035
9035
|
const r = e.getTarget();
|
|
9036
9036
|
if (!(r instanceof HTMLInputElement) && !(r instanceof HTMLSelectElement) && !(r instanceof HTMLTextAreaElement)) {
|
|
9037
|
-
|
|
9037
|
+
m.warn(
|
|
9038
9038
|
"Haori",
|
|
9039
9039
|
`${t} は入力要素にのみ指定できます: ${r.tagName}`
|
|
9040
9040
|
);
|
|
@@ -9045,19 +9045,19 @@ const f = class f {
|
|
|
9045
9045
|
r.setCustomValidity("");
|
|
9046
9046
|
return;
|
|
9047
9047
|
}
|
|
9048
|
-
const s =
|
|
9049
|
-
|
|
9048
|
+
const s = p.buildConditionScope(e), n = se.evaluateDetailed(
|
|
9049
|
+
p.unwrapConditionExpression(i),
|
|
9050
9050
|
s
|
|
9051
9051
|
);
|
|
9052
9052
|
if (n.unresolvedReference) {
|
|
9053
|
-
|
|
9053
|
+
m.warn(
|
|
9054
9054
|
"Haori",
|
|
9055
9055
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
9056
|
-
), r.setCustomValidity(
|
|
9056
|
+
), r.setCustomValidity(p.resolveValidityMessage(e));
|
|
9057
9057
|
return;
|
|
9058
9058
|
}
|
|
9059
9059
|
r.setCustomValidity(
|
|
9060
|
-
n.value ? "" :
|
|
9060
|
+
n.value ? "" : p.resolveValidityMessage(e)
|
|
9061
9061
|
);
|
|
9062
9062
|
}
|
|
9063
9063
|
/**
|
|
@@ -9068,7 +9068,7 @@ const f = class f {
|
|
|
9068
9068
|
*/
|
|
9069
9069
|
static resolveValidityMessage(e) {
|
|
9070
9070
|
const t = e.getAttribute(`${c.prefix}validity-message`);
|
|
9071
|
-
return typeof t == "string" && t.trim() !== "" ? t :
|
|
9071
|
+
return typeof t == "string" && t.trim() !== "" ? t : mr;
|
|
9072
9072
|
}
|
|
9073
9073
|
/**
|
|
9074
9074
|
* 条件属性の値から式を取り出します。
|
|
@@ -9093,10 +9093,10 @@ const f = class f {
|
|
|
9093
9093
|
* @returns 戻り値はありません。
|
|
9094
9094
|
*/
|
|
9095
9095
|
static warnUnvalidatedCustomValidity(e, t) {
|
|
9096
|
-
if (!
|
|
9096
|
+
if (!H.isEnabled() || !e)
|
|
9097
9097
|
return;
|
|
9098
9098
|
const r = `${c.prefix}validity`;
|
|
9099
|
-
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) &&
|
|
9099
|
+
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && m.warn(
|
|
9100
9100
|
"Haori",
|
|
9101
9101
|
`${r} は指定されていますが検証は行われません(${t})。${c.prefix}{event}-validate を指定するか、${c.prefix}{event}-if を使用してください。`
|
|
9102
9102
|
);
|
|
@@ -9119,7 +9119,7 @@ const f = class f {
|
|
|
9119
9119
|
* @param identifiesItems リストキーで収集先の配列要素を識別できるかどうか
|
|
9120
9120
|
*/
|
|
9121
9121
|
static registerCollectedRowIdentity(e, t, r, i) {
|
|
9122
|
-
|
|
9122
|
+
p.COLLECTED_ROW_IDENTITY.set(e, { keyArg: t, keys: r, identifiesItems: i });
|
|
9123
9123
|
}
|
|
9124
9124
|
/**
|
|
9125
9125
|
* 収集値の階層に、除外されたキーの集合を結び付けます。
|
|
@@ -9128,7 +9128,7 @@ const f = class f {
|
|
|
9128
9128
|
* @param keys 除外されたキー
|
|
9129
9129
|
*/
|
|
9130
9130
|
static registerCollectedExcludedKeys(e, t) {
|
|
9131
|
-
t.size > 0 &&
|
|
9131
|
+
t.size > 0 && p.COLLECTED_EXCLUDED_KEYS.set(e, t);
|
|
9132
9132
|
}
|
|
9133
9133
|
/**
|
|
9134
9134
|
* 収集値に控えた情報を、複製した値へ引き継ぎます。
|
|
@@ -9141,10 +9141,10 @@ const f = class f {
|
|
|
9141
9141
|
* @param to 複製した値
|
|
9142
9142
|
*/
|
|
9143
9143
|
static carryCollectedRowIdentity(e, t) {
|
|
9144
|
-
const r =
|
|
9145
|
-
r &&
|
|
9146
|
-
const i =
|
|
9147
|
-
i &&
|
|
9144
|
+
const r = p.COLLECTED_ROW_IDENTITY.get(e);
|
|
9145
|
+
r && p.COLLECTED_ROW_IDENTITY.set(t, r);
|
|
9146
|
+
const i = p.COLLECTED_EXCLUDED_KEYS.get(e);
|
|
9147
|
+
i && p.COLLECTED_EXCLUDED_KEYS.set(t, i);
|
|
9148
9148
|
}
|
|
9149
9149
|
/**
|
|
9150
9150
|
* 行の対応付けが出現順へ退いたことを、開発モードで一度だけ知らせます。
|
|
@@ -9156,7 +9156,7 @@ const f = class f {
|
|
|
9156
9156
|
* @param reason 退いた理由
|
|
9157
9157
|
*/
|
|
9158
9158
|
static warnPositionalRowFallback(e) {
|
|
9159
|
-
!
|
|
9159
|
+
!H.isEnabled() || p.warnedPositionalRowFallbacks.has(e) || (p.warnedPositionalRowFallbacks.add(e), m.warn(
|
|
9160
9160
|
"[Haori]",
|
|
9161
9161
|
`${c.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
9162
9162
|
));
|
|
@@ -9176,10 +9176,10 @@ const f = class f {
|
|
|
9176
9176
|
* @param container `data-form-list` を持つコンテナのフラグメント
|
|
9177
9177
|
*/
|
|
9178
9178
|
static warnDerivedRowsWithoutKey(e) {
|
|
9179
|
-
if (!
|
|
9179
|
+
if (!H.isEnabled() || e.getRawAttribute(`${c.prefix}each-key`) !== null)
|
|
9180
9180
|
return;
|
|
9181
9181
|
const t = e.getRawAttribute(`${c.prefix}each`);
|
|
9182
|
-
t === null ||
|
|
9182
|
+
t === null || p.resolveLeadingPath(t) !== null || p.warnedDerivedRowsWithoutKey.has(t) || (p.warnedDerivedRowsWithoutKey.add(t), m.warn(
|
|
9183
9183
|
"[Haori]",
|
|
9184
9184
|
`${c.prefix}each="${t}" の一覧を ${c.prefix}form-list で収集していますが、${c.prefix}each-key がありません。行と配列要素を出現順で対応付けるため、画面に出ていない要素があると行の値を取り違えます。${c.prefix}each-key を宣言してください。`
|
|
9185
9185
|
));
|
|
@@ -9226,12 +9226,12 @@ const f = class f {
|
|
|
9226
9226
|
static mergeCollectedValues(e, t, r = null) {
|
|
9227
9227
|
const i = { ...e ?? {} };
|
|
9228
9228
|
for (const [n, a] of Object.entries(t)) {
|
|
9229
|
-
if (
|
|
9229
|
+
if (p.UNSAFE_MERGE_KEYS.has(n))
|
|
9230
9230
|
continue;
|
|
9231
9231
|
const o = e && Object.prototype.hasOwnProperty.call(e, n) ? e[n] : r?.(n);
|
|
9232
|
-
i[n] =
|
|
9232
|
+
i[n] = p.overlayCollectedValue(o, a);
|
|
9233
9233
|
}
|
|
9234
|
-
const s =
|
|
9234
|
+
const s = p.COLLECTED_EXCLUDED_KEYS.get(t);
|
|
9235
9235
|
if (s)
|
|
9236
9236
|
for (const n of s)
|
|
9237
9237
|
n in t || delete i[n];
|
|
@@ -9248,13 +9248,13 @@ const f = class f {
|
|
|
9248
9248
|
if (Array.isArray(t)) {
|
|
9249
9249
|
if (!Array.isArray(e))
|
|
9250
9250
|
return t;
|
|
9251
|
-
const s =
|
|
9251
|
+
const s = p.overlayIdentifiedRows(e, t);
|
|
9252
9252
|
return s !== null ? s : t.map(
|
|
9253
|
-
(n, a) =>
|
|
9253
|
+
(n, a) => p.overlayCollectedValue(e[a], n)
|
|
9254
9254
|
);
|
|
9255
9255
|
}
|
|
9256
|
-
const r =
|
|
9257
|
-
return r === null || i === null ? t :
|
|
9256
|
+
const r = p.asPlainRecord(t), i = p.asPlainRecord(e);
|
|
9257
|
+
return r === null || i === null ? t : p.mergeCollectedValues(i, r);
|
|
9258
9258
|
}
|
|
9259
9259
|
/**
|
|
9260
9260
|
* 式の先頭にある素の経路を返します。
|
|
@@ -9272,7 +9272,7 @@ const f = class f {
|
|
|
9272
9272
|
* @returns 先頭の経路。経路として読めない場合は null
|
|
9273
9273
|
*/
|
|
9274
9274
|
static resolveLeadingPath(e) {
|
|
9275
|
-
const t =
|
|
9275
|
+
const t = p.LEADING_PATH_PATTERN.exec(e);
|
|
9276
9276
|
if (!t)
|
|
9277
9277
|
return null;
|
|
9278
9278
|
const r = t[2].trim();
|
|
@@ -9309,7 +9309,7 @@ const f = class f {
|
|
|
9309
9309
|
const r = e.getRawAttribute(`${c.prefix}each`);
|
|
9310
9310
|
if (typeof r != "string" || r.trim() === "")
|
|
9311
9311
|
return !0;
|
|
9312
|
-
const i =
|
|
9312
|
+
const i = p.resolveLeadingPath(r);
|
|
9313
9313
|
if (i === null)
|
|
9314
9314
|
return !0;
|
|
9315
9315
|
const s = i.split(".");
|
|
@@ -9364,7 +9364,7 @@ const f = class f {
|
|
|
9364
9364
|
const i = e.map((n) => n.getListKey());
|
|
9365
9365
|
if (i.some((n) => n === null))
|
|
9366
9366
|
return null;
|
|
9367
|
-
const s =
|
|
9367
|
+
const s = p.createRowKeyIndexes(t, r);
|
|
9368
9368
|
return i.map((n) => {
|
|
9369
9369
|
const a = s.get(n);
|
|
9370
9370
|
return !a || a.length === 0 ? null : t[a.shift()];
|
|
@@ -9394,22 +9394,22 @@ const f = class f {
|
|
|
9394
9394
|
* @returns 重ね合わせた配列。対応付けができない場合は null(出現順へ退く)
|
|
9395
9395
|
*/
|
|
9396
9396
|
static overlayIdentifiedRows(e, t) {
|
|
9397
|
-
const r =
|
|
9397
|
+
const r = p.COLLECTED_ROW_IDENTITY.get(t);
|
|
9398
9398
|
if (r && !r.identifiesItems)
|
|
9399
9399
|
return null;
|
|
9400
9400
|
if (!r)
|
|
9401
|
-
return t.some((n) =>
|
|
9401
|
+
return t.some((n) => p.asPlainRecord(n) !== null) && p.warnPositionalRowFallback("識別情報が引き継がれていません"), null;
|
|
9402
9402
|
if (r.keys.length !== t.length)
|
|
9403
|
-
return
|
|
9403
|
+
return p.warnPositionalRowFallback("収集後に行の数が変わっています"), null;
|
|
9404
9404
|
if (r.keys.some((n) => n === null))
|
|
9405
9405
|
return null;
|
|
9406
|
-
const i =
|
|
9406
|
+
const i = p.createRowKeyIndexes(e, r.keyArg), s = e.slice();
|
|
9407
9407
|
for (let n = 0; n < t.length; n += 1) {
|
|
9408
9408
|
const a = r.keys[n], o = i.get(a);
|
|
9409
9409
|
if (!o || o.length === 0)
|
|
9410
9410
|
continue;
|
|
9411
9411
|
const l = o.shift();
|
|
9412
|
-
s[l] =
|
|
9412
|
+
s[l] = p.overlayCollectedValue(
|
|
9413
9413
|
e[l],
|
|
9414
9414
|
t[n]
|
|
9415
9415
|
);
|
|
@@ -9443,20 +9443,20 @@ const f = class f {
|
|
|
9443
9443
|
*/
|
|
9444
9444
|
static syncAncestorArgForms(e, t, r = null, i = null) {
|
|
9445
9445
|
const s = [];
|
|
9446
|
-
for (const { form: a, key: o } of
|
|
9446
|
+
for (const { form: a, key: o } of p.collectArgForms(e)) {
|
|
9447
9447
|
if (a.wasResetAfter(t))
|
|
9448
9448
|
continue;
|
|
9449
|
-
const l =
|
|
9450
|
-
!l || l.owner !== e || s.push(
|
|
9449
|
+
const l = p.resolveAncestorArgOwner(a, o);
|
|
9450
|
+
!l || l.owner !== e || s.push(p.pushAncestorArgValue(a, o, l.value, r));
|
|
9451
9451
|
}
|
|
9452
9452
|
const n = e.getRawBindingData();
|
|
9453
|
-
for (const { form: a, keys: o } of
|
|
9453
|
+
for (const { form: a, keys: o } of p.collectShadowingContainers(e)) {
|
|
9454
9454
|
if (a.wasResetAfter(t))
|
|
9455
9455
|
continue;
|
|
9456
9456
|
const l = o.filter(
|
|
9457
|
-
(u) =>
|
|
9457
|
+
(u) => p.createArgValueSignature(i?.[u]) !== p.createArgValueSignature(n?.[u])
|
|
9458
9458
|
);
|
|
9459
|
-
l.length !== 0 && s.push(
|
|
9459
|
+
l.length !== 0 && s.push(p.releaseOwnCopy(a, l, r));
|
|
9460
9460
|
}
|
|
9461
9461
|
return Promise.all(s).then(() => {
|
|
9462
9462
|
});
|
|
@@ -9490,7 +9490,7 @@ const f = class f {
|
|
|
9490
9490
|
const n = s.getRawBindingData();
|
|
9491
9491
|
if (n === null)
|
|
9492
9492
|
return;
|
|
9493
|
-
const a =
|
|
9493
|
+
const a = p.getInitialBindingData(s), o = Object.keys(n).filter((l) => Object.prototype.hasOwnProperty.call(a ?? {}, l) ? !1 : p.resolveAncestorKeyOwner(s, l)?.owner === e);
|
|
9494
9494
|
o.length > 0 && r.push({ form: s, keys: o });
|
|
9495
9495
|
}), r;
|
|
9496
9496
|
}
|
|
@@ -9551,15 +9551,15 @@ const f = class f {
|
|
|
9551
9551
|
* @returns 反映完了の Promise
|
|
9552
9552
|
*/
|
|
9553
9553
|
static pushAncestorArgValue(e, t, r, i = null) {
|
|
9554
|
-
const s = e.getTarget(), n =
|
|
9554
|
+
const s = e.getTarget(), n = p.createArgValueSignature(r);
|
|
9555
9555
|
if (n !== null) {
|
|
9556
|
-
if (
|
|
9556
|
+
if (p.LAST_ANCESTOR_ARG_VALUES.get(s) === n)
|
|
9557
9557
|
return Promise.resolve();
|
|
9558
|
-
|
|
9558
|
+
p.LAST_ANCESTOR_ARG_VALUES.set(s, n);
|
|
9559
9559
|
} else
|
|
9560
|
-
|
|
9560
|
+
p.LAST_ANCESTOR_ARG_VALUES.delete(s);
|
|
9561
9561
|
const a = e.getRawBindingData();
|
|
9562
|
-
return a && Object.prototype.hasOwnProperty.call(a, t) ?
|
|
9562
|
+
return a && Object.prototype.hasOwnProperty.call(a, t) ? p.releaseOwnCopy(e, [t], i) : p.syncValues(e, r, !1, i);
|
|
9563
9563
|
}
|
|
9564
9564
|
/**
|
|
9565
9565
|
* 流し込み済み判定に使う値の署名を作ります。
|
|
@@ -9598,23 +9598,23 @@ const f = class f {
|
|
|
9598
9598
|
});
|
|
9599
9599
|
const r = [];
|
|
9600
9600
|
for (const i of t) {
|
|
9601
|
-
if (
|
|
9601
|
+
if (p.INITIAL_RESTORED_FORMS.has(i))
|
|
9602
9602
|
continue;
|
|
9603
9603
|
const s = D.get(i);
|
|
9604
9604
|
if (!(s instanceof R))
|
|
9605
9605
|
continue;
|
|
9606
|
-
const n = s.getRawBindingData(), a = s.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(n && Object.prototype.hasOwnProperty.call(n, o)) ?
|
|
9606
|
+
const n = s.getRawBindingData(), a = s.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(n && Object.prototype.hasOwnProperty.call(n, o)) ? p.resolveAncestorArgOwner(s, o) : null;
|
|
9607
9607
|
if (!(!n && !l)) {
|
|
9608
|
-
if (
|
|
9608
|
+
if (p.INITIAL_RESTORED_FORMS.add(i), l) {
|
|
9609
9609
|
r.push(
|
|
9610
|
-
|
|
9610
|
+
p.pushAncestorArgValue(s, o, l.value)
|
|
9611
9611
|
);
|
|
9612
9612
|
continue;
|
|
9613
9613
|
}
|
|
9614
9614
|
r.push(
|
|
9615
|
-
|
|
9615
|
+
p.syncValues(
|
|
9616
9616
|
s,
|
|
9617
|
-
|
|
9617
|
+
p.resolveSyncValues(s, n)
|
|
9618
9618
|
)
|
|
9619
9619
|
);
|
|
9620
9620
|
}
|
|
@@ -9649,9 +9649,9 @@ const f = class f {
|
|
|
9649
9649
|
*/
|
|
9650
9650
|
static collectGroupSelection(e, t, r) {
|
|
9651
9651
|
const i = [];
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
String(
|
|
9652
|
+
p.collectGroupMembers(
|
|
9653
|
+
p.resolveCollectionScope(e),
|
|
9654
|
+
String(p.resolveFieldName(e)),
|
|
9655
9655
|
i
|
|
9656
9656
|
);
|
|
9657
9657
|
let s = !1;
|
|
@@ -9661,9 +9661,9 @@ const f = class f {
|
|
|
9661
9661
|
const o = a.getTarget();
|
|
9662
9662
|
o instanceof HTMLInputElement && o.checked && n.push(o.value);
|
|
9663
9663
|
}
|
|
9664
|
-
return t ? { edited: s, value:
|
|
9664
|
+
return t ? { edited: s, value: p.markCompleteSet(n) } : n.length === 0 ? { edited: s, value: null } : {
|
|
9665
9665
|
edited: s,
|
|
9666
|
-
value: n.length === 1 ? n[0] :
|
|
9666
|
+
value: n.length === 1 ? n[0] : p.markCompleteSet(n)
|
|
9667
9667
|
};
|
|
9668
9668
|
}
|
|
9669
9669
|
/**
|
|
@@ -9678,7 +9678,7 @@ const f = class f {
|
|
|
9678
9678
|
* @returns 新しい階層を始める場合は true
|
|
9679
9679
|
*/
|
|
9680
9680
|
static startsCollectionLevel(e) {
|
|
9681
|
-
return
|
|
9681
|
+
return p.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${c.prefix}form-object`) || e.getAttribute(`${c.prefix}form-list`));
|
|
9682
9682
|
}
|
|
9683
9683
|
/**
|
|
9684
9684
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -9699,9 +9699,9 @@ const f = class f {
|
|
|
9699
9699
|
static resolveCollectionScope(e) {
|
|
9700
9700
|
let t = e, r = t.getParent();
|
|
9701
9701
|
for (; r !== null; ) {
|
|
9702
|
-
if (
|
|
9702
|
+
if (p.startsCollectionLevel(r))
|
|
9703
9703
|
return r.getAttribute(`${c.prefix}form-object`) ? r : t;
|
|
9704
|
-
if (
|
|
9704
|
+
if (p.isFormScopeRoot(r))
|
|
9705
9705
|
return r;
|
|
9706
9706
|
t = r, r = r.getParent();
|
|
9707
9707
|
}
|
|
@@ -9734,11 +9734,11 @@ const f = class f {
|
|
|
9734
9734
|
* @param members 集める先
|
|
9735
9735
|
*/
|
|
9736
9736
|
static collectGroupMembers(e, t, r) {
|
|
9737
|
-
|
|
9737
|
+
p.isGroupedCheckable(e) && String(p.resolveFieldName(e)) === t && r.push(e);
|
|
9738
9738
|
for (const i of e.getChildElementFragments())
|
|
9739
|
-
|
|
9739
|
+
p.startsCollectionLevel(i) || i.hasAttribute(`${c.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
9740
9740
|
// (`getPartValues()` と同じ理由)。
|
|
9741
|
-
i.getTarget().hasAttribute(`${c.prefix}if-false`) ||
|
|
9741
|
+
i.getTarget().hasAttribute(`${c.prefix}if-false`) || p.collectGroupMembers(i, t, r);
|
|
9742
9742
|
}
|
|
9743
9743
|
/**
|
|
9744
9744
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -9752,7 +9752,7 @@ const f = class f {
|
|
|
9752
9752
|
* @returns 同じ配列
|
|
9753
9753
|
*/
|
|
9754
9754
|
static markCompleteSet(e) {
|
|
9755
|
-
return
|
|
9755
|
+
return p.COMPLETE_SET_VALUES.add(e), e;
|
|
9756
9756
|
}
|
|
9757
9757
|
/**
|
|
9758
9758
|
* 「集合として完結した値」の印が付いているかを返します。
|
|
@@ -9765,7 +9765,7 @@ const f = class f {
|
|
|
9765
9765
|
* @returns 印が付いていれば true
|
|
9766
9766
|
*/
|
|
9767
9767
|
static isCompleteSetValue(e) {
|
|
9768
|
-
return e !== null && typeof e == "object" &&
|
|
9768
|
+
return e !== null && typeof e == "object" && p.COMPLETE_SET_VALUES.has(e);
|
|
9769
9769
|
}
|
|
9770
9770
|
/**
|
|
9771
9771
|
* 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
|
|
@@ -9817,43 +9817,43 @@ const f = class f {
|
|
|
9817
9817
|
const o = [];
|
|
9818
9818
|
if (e.hasAttribute(`${c.prefix}form-detach`) && !r)
|
|
9819
9819
|
return Promise.resolve();
|
|
9820
|
-
const l =
|
|
9820
|
+
const l = p.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), d = e.getAttribute(`${c.prefix}form-list`), y = e.hasAttribute(`${c.prefix}form-list`);
|
|
9821
9821
|
if (l) {
|
|
9822
|
-
const b = t[String(l)], E = s &&
|
|
9822
|
+
const b = t[String(l)], E = s && p.hasResolvedDeclarativeState(e), A = s && typeof b > "u" && !p.isDeclarativeStateBound(e);
|
|
9823
9823
|
let k = b;
|
|
9824
|
-
if (E ? k = void 0 : A && (k = null),
|
|
9824
|
+
if (E ? k = void 0 : A && (k = null), p.isFileInput(e))
|
|
9825
9825
|
return (k === null || k === "") && o.push(
|
|
9826
|
-
|
|
9826
|
+
p.applyFragmentValue(e, null, i, a)
|
|
9827
9827
|
), Promise.all(o).then(() => {
|
|
9828
9828
|
});
|
|
9829
|
-
if (
|
|
9829
|
+
if (y && Array.isArray(k) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
9830
9830
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
9831
9831
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
9832
|
-
!
|
|
9832
|
+
!p.isGroupedCheckable(e) && !p.isMultipleSelect(e)) {
|
|
9833
9833
|
const C = String(l), $ = n.get(C) ?? 0;
|
|
9834
9834
|
n.set(C, $ + 1), o.push(
|
|
9835
|
-
|
|
9835
|
+
p.applyFragmentValue(
|
|
9836
9836
|
e,
|
|
9837
9837
|
k[$] ?? null,
|
|
9838
9838
|
i,
|
|
9839
9839
|
a
|
|
9840
9840
|
)
|
|
9841
9841
|
);
|
|
9842
|
-
} else typeof k > "u" || (Array.isArray(k) &&
|
|
9843
|
-
|
|
9842
|
+
} else typeof k > "u" || (Array.isArray(k) && p.isGroupedCheckable(e) || Array.isArray(k) && p.isMultipleSelect(e) || typeof k == "string" || typeof k == "number" || typeof k == "boolean" || k === null || Array.isArray(k) && e.collectsLines() ? o.push(
|
|
9843
|
+
p.applyFragmentValue(
|
|
9844
9844
|
e,
|
|
9845
9845
|
k,
|
|
9846
9846
|
i,
|
|
9847
9847
|
a
|
|
9848
9848
|
)
|
|
9849
9849
|
) : o.push(
|
|
9850
|
-
|
|
9850
|
+
p.applyFragmentValue(e, String(k), i, a)
|
|
9851
9851
|
));
|
|
9852
9852
|
} else if (u) {
|
|
9853
9853
|
const b = t[String(u)], E = b && typeof b == "object" ? b : {}, A = /* @__PURE__ */ new Map();
|
|
9854
9854
|
for (const k of e.getChildElementFragments())
|
|
9855
9855
|
o.push(
|
|
9856
|
-
|
|
9856
|
+
p.setPartValues(
|
|
9857
9857
|
k,
|
|
9858
9858
|
E,
|
|
9859
9859
|
r,
|
|
@@ -9864,7 +9864,7 @@ const f = class f {
|
|
|
9864
9864
|
)
|
|
9865
9865
|
);
|
|
9866
9866
|
} else if (d) {
|
|
9867
|
-
const b = t[String(d)], E = Array.isArray(b) ? b : [], A = e.getChildElementFragments(), k = e.getAttribute(`${c.prefix}each-key`), C =
|
|
9867
|
+
const b = t[String(d)], E = Array.isArray(b) ? b : [], A = e.getChildElementFragments(), k = e.getAttribute(`${c.prefix}each-key`), C = p.isCollectedListFromEachSource(e) ? p.pairRowsWithItems(
|
|
9868
9868
|
A,
|
|
9869
9869
|
E,
|
|
9870
9870
|
k == null ? null : String(k)
|
|
@@ -9873,9 +9873,9 @@ const f = class f {
|
|
|
9873
9873
|
const ie = A[$], F = C ? C[$] : E.length > $ ? E[$] : null;
|
|
9874
9874
|
o.push(
|
|
9875
9875
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
9876
|
-
|
|
9876
|
+
p.setPartValues(
|
|
9877
9877
|
ie,
|
|
9878
|
-
|
|
9878
|
+
p.asPlainRecord(F) ?? {},
|
|
9879
9879
|
r,
|
|
9880
9880
|
i,
|
|
9881
9881
|
s,
|
|
@@ -9887,7 +9887,7 @@ const f = class f {
|
|
|
9887
9887
|
} else
|
|
9888
9888
|
for (const b of e.getChildElementFragments())
|
|
9889
9889
|
o.push(
|
|
9890
|
-
|
|
9890
|
+
p.setPartValues(
|
|
9891
9891
|
b,
|
|
9892
9892
|
t,
|
|
9893
9893
|
r,
|
|
@@ -9916,52 +9916,52 @@ const f = class f {
|
|
|
9916
9916
|
* @returns すべての初期化処理が完了するPromise
|
|
9917
9917
|
*/
|
|
9918
9918
|
static async reset(e, t = R.nextSequence()) {
|
|
9919
|
-
const r =
|
|
9919
|
+
const r = p.collectBindingTargetForms(e);
|
|
9920
9920
|
if (r.length > 0 && r.every((s) => s.isSupplyStale(t)))
|
|
9921
9921
|
return;
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9922
|
+
p.markResetSubtree(e, t), M.clearUserEditMarks(e, t), p.clearValues(e), await Promise.all([
|
|
9923
|
+
p.clearMessages(e),
|
|
9924
|
+
p.clearEachClones(e)
|
|
9925
9925
|
]), await J.enqueue(() => {
|
|
9926
|
-
const s =
|
|
9926
|
+
const s = p.collectEditsAfter(
|
|
9927
9927
|
e,
|
|
9928
9928
|
t
|
|
9929
9929
|
), n = e.getTarget();
|
|
9930
|
-
|
|
9930
|
+
p.internalResetDepth += 1;
|
|
9931
9931
|
try {
|
|
9932
|
-
n instanceof HTMLFormElement ? n.reset() : (n.querySelectorAll("form").forEach((a) => a.reset()),
|
|
9932
|
+
n instanceof HTMLFormElement ? n.reset() : (n.querySelectorAll("form").forEach((a) => a.reset()), p.restoreDefaultValues(n));
|
|
9933
9933
|
} finally {
|
|
9934
|
-
|
|
9934
|
+
p.internalResetDepth -= 1;
|
|
9935
9935
|
}
|
|
9936
|
-
|
|
9936
|
+
p.clearDeclarativeStateFromDom(e), M.invalidateDerivedSubtreeSignatures(e), p.restoreEdits(s);
|
|
9937
9937
|
});
|
|
9938
9938
|
const i = r;
|
|
9939
9939
|
for (const s of i) {
|
|
9940
|
-
const n =
|
|
9940
|
+
const n = p.getInitialBindingData(s);
|
|
9941
9941
|
n === null && s.getRawBindingData() === null || await M.setBindingData(s.getTarget(), n ?? {}, {
|
|
9942
9942
|
sequence: t
|
|
9943
9943
|
});
|
|
9944
9944
|
}
|
|
9945
|
-
|
|
9945
|
+
p.syncValuesFromDom(e), await M.evaluateAll(e);
|
|
9946
9946
|
for (const s of i)
|
|
9947
|
-
|
|
9947
|
+
p.getInitialBindingData(s) !== null || s.getRawBindingData() !== null || await p.restoreAncestorArgValues(s, {
|
|
9948
9948
|
sequence: t,
|
|
9949
9949
|
kind: "supply"
|
|
9950
9950
|
});
|
|
9951
9951
|
for (const s of i) {
|
|
9952
|
-
const n =
|
|
9952
|
+
const n = p.getInitialBindingData(s);
|
|
9953
9953
|
if (s.getRawBindingData() === null && n === null)
|
|
9954
9954
|
continue;
|
|
9955
|
-
const a =
|
|
9955
|
+
const a = p.getValues(s), o = s.getAttribute(`${c.prefix}form-arg`);
|
|
9956
9956
|
let l = { ...n || {} };
|
|
9957
9957
|
if (o) {
|
|
9958
9958
|
const u = String(o);
|
|
9959
|
-
!Object.prototype.hasOwnProperty.call(n ?? {}, u) &&
|
|
9959
|
+
!Object.prototype.hasOwnProperty.call(n ?? {}, u) && p.resolveAncestorArgOwner(s, u) !== null || (l[u] = p.mergeCollectedValues(
|
|
9960
9960
|
l[u] ?? null,
|
|
9961
9961
|
a
|
|
9962
9962
|
));
|
|
9963
9963
|
} else
|
|
9964
|
-
l =
|
|
9964
|
+
l = p.mergeCollectedValues(l, a), p.deleteAncestorOwnedKeys(s, n, l);
|
|
9965
9965
|
await M.setBindingData(s.getTarget(), l, {
|
|
9966
9966
|
sequence: t
|
|
9967
9967
|
});
|
|
@@ -9980,7 +9980,7 @@ const f = class f {
|
|
|
9980
9980
|
*/
|
|
9981
9981
|
static deleteAncestorOwnedKeys(e, t, r) {
|
|
9982
9982
|
for (const i of Object.keys(r))
|
|
9983
|
-
Object.prototype.hasOwnProperty.call(t ?? {}, i) ||
|
|
9983
|
+
Object.prototype.hasOwnProperty.call(t ?? {}, i) || p.resolveAncestorKeyOwner(e, i) !== null && delete r[i];
|
|
9984
9984
|
}
|
|
9985
9985
|
/**
|
|
9986
9986
|
* data-bind 属性で宣言された初期バインドデータを取得します。
|
|
@@ -10001,7 +10001,7 @@ const f = class f {
|
|
|
10001
10001
|
const t = e.getTarget();
|
|
10002
10002
|
(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && e.syncValue();
|
|
10003
10003
|
for (const r of e.getChildElementFragments())
|
|
10004
|
-
|
|
10004
|
+
p.syncValuesFromDom(r);
|
|
10005
10005
|
}
|
|
10006
10006
|
/**
|
|
10007
10007
|
* リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
|
|
@@ -10056,7 +10056,7 @@ const f = class f {
|
|
|
10056
10056
|
static clearValues(e) {
|
|
10057
10057
|
e.clearValue();
|
|
10058
10058
|
for (const t of e.getChildElementFragments())
|
|
10059
|
-
|
|
10059
|
+
p.clearValues(t);
|
|
10060
10060
|
}
|
|
10061
10061
|
/**
|
|
10062
10062
|
* 指定した通番より後に編集された入力欄の DOM の状態を控えます。
|
|
@@ -10080,7 +10080,7 @@ const f = class f {
|
|
|
10080
10080
|
)
|
|
10081
10081
|
}) : r.push({ element: i, value: i.value }));
|
|
10082
10082
|
for (const s of e.getChildElementFragments())
|
|
10083
|
-
|
|
10083
|
+
p.collectEditsAfter(s, t, r);
|
|
10084
10084
|
return r;
|
|
10085
10085
|
}
|
|
10086
10086
|
/**
|
|
@@ -10122,8 +10122,8 @@ const f = class f {
|
|
|
10122
10122
|
const r = e.getAttribute(`${c.prefix}form-arg`);
|
|
10123
10123
|
if (!r)
|
|
10124
10124
|
return;
|
|
10125
|
-
const i = String(r), s =
|
|
10126
|
-
s && (
|
|
10125
|
+
const i = String(r), s = p.resolveAncestorArgOwner(e, i);
|
|
10126
|
+
s && (p.LAST_ANCESTOR_ARG_VALUES.delete(e.getTarget()), await p.pushAncestorArgValue(e, i, s.value, t));
|
|
10127
10127
|
}
|
|
10128
10128
|
/**
|
|
10129
10129
|
* 初期化の通番を部分木のすべてのフラグメントへ記録します。
|
|
@@ -10139,7 +10139,7 @@ const f = class f {
|
|
|
10139
10139
|
static markResetSubtree(e, t) {
|
|
10140
10140
|
e.markResetAt(t), e.markSupplyApplied(t);
|
|
10141
10141
|
for (const r of e.getChildElementFragments())
|
|
10142
|
-
|
|
10142
|
+
p.markResetSubtree(r, t);
|
|
10143
10143
|
}
|
|
10144
10144
|
/**
|
|
10145
10145
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -10162,7 +10162,7 @@ const f = class f {
|
|
|
10162
10162
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
10163
10163
|
*/
|
|
10164
10164
|
static addErrorMessage(e, t, r) {
|
|
10165
|
-
return
|
|
10165
|
+
return p.addMessage(e, t, r, "error");
|
|
10166
10166
|
}
|
|
10167
10167
|
/**
|
|
10168
10168
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -10175,8 +10175,8 @@ const f = class f {
|
|
|
10175
10175
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
10176
10176
|
*/
|
|
10177
10177
|
static addMessage(e, t, r, i) {
|
|
10178
|
-
const s = [], n = St(), a = n.addMessage, o = (u) => typeof a == "function" ? a.call(n, u, r, i) : n.addErrorMessage(u, r), l =
|
|
10179
|
-
|
|
10178
|
+
const s = [], n = St(), a = n.addMessage, o = (u) => typeof a == "function" ? a.call(n, u, r, i) : n.addErrorMessage(u, r), l = p.keepFirstRadio(
|
|
10179
|
+
p.findFragmentsByKey(e, t)
|
|
10180
10180
|
);
|
|
10181
10181
|
return l.forEach((u) => {
|
|
10182
10182
|
s.push(o(u.getTarget()));
|
|
@@ -10208,7 +10208,7 @@ const f = class f {
|
|
|
10208
10208
|
* @returns 一致するフラグメントの配列
|
|
10209
10209
|
*/
|
|
10210
10210
|
static findFragmentsByKey(e, t) {
|
|
10211
|
-
return
|
|
10211
|
+
return p.findFragmentByKeyParts(e, t.split("."));
|
|
10212
10212
|
}
|
|
10213
10213
|
/**
|
|
10214
10214
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -10220,9 +10220,9 @@ const f = class f {
|
|
|
10220
10220
|
*/
|
|
10221
10221
|
static findFragmentByKeyParts(e, t) {
|
|
10222
10222
|
const r = [], i = t[0];
|
|
10223
|
-
if (t.length == 1 &&
|
|
10223
|
+
if (t.length == 1 && p.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${c.prefix}form-object`))
|
|
10224
10224
|
t.length > 1 && e.getAttribute(`${c.prefix}form-object`) === i && e.getChildElementFragments().forEach((n) => {
|
|
10225
|
-
r.push(...
|
|
10225
|
+
r.push(...p.findFragmentByKeyParts(n, t.slice(1)));
|
|
10226
10226
|
});
|
|
10227
10227
|
else if (e.hasAttribute(`${c.prefix}form-list`)) {
|
|
10228
10228
|
if (t.length > 1) {
|
|
@@ -10232,11 +10232,11 @@ const f = class f {
|
|
|
10232
10232
|
if (s === o) {
|
|
10233
10233
|
const l = i.substring(n + 1, a), u = Number(l);
|
|
10234
10234
|
if (isNaN(u))
|
|
10235
|
-
|
|
10235
|
+
m.error("Haori", `Invalid index: ${i}`);
|
|
10236
10236
|
else {
|
|
10237
|
-
const d = e.getChildElementFragments().filter((
|
|
10237
|
+
const d = e.getChildElementFragments().filter((y) => y.hasAttribute(`${c.prefix}row`));
|
|
10238
10238
|
u < d.length && r.push(
|
|
10239
|
-
...
|
|
10239
|
+
...p.findFragmentByKeyParts(d[u], t.slice(1))
|
|
10240
10240
|
);
|
|
10241
10241
|
}
|
|
10242
10242
|
}
|
|
@@ -10244,7 +10244,7 @@ const f = class f {
|
|
|
10244
10244
|
}
|
|
10245
10245
|
} else
|
|
10246
10246
|
e.getChildElementFragments().forEach((s) => {
|
|
10247
|
-
r.push(...
|
|
10247
|
+
r.push(...p.findFragmentByKeyParts(s, t));
|
|
10248
10248
|
});
|
|
10249
10249
|
return r;
|
|
10250
10250
|
}
|
|
@@ -10267,12 +10267,12 @@ const f = class f {
|
|
|
10267
10267
|
return r ? this.getFormFragment(r) : null;
|
|
10268
10268
|
}
|
|
10269
10269
|
};
|
|
10270
|
-
|
|
10270
|
+
p.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), p.LAST_ANCESTOR_ARG_VALUES = /* @__PURE__ */ new WeakMap(), p.GROUP_SCOPE_IDS = /* @__PURE__ */ new WeakMap(), p.groupScopeSequence = 0, p.internalResetDepth = 0, p.warnedArgOwnerNotRecord = /* @__PURE__ */ new WeakMap(), p.UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set([
|
|
10271
10271
|
"__proto__",
|
|
10272
10272
|
"constructor",
|
|
10273
10273
|
"prototype"
|
|
10274
|
-
]),
|
|
10275
|
-
let x =
|
|
10274
|
+
]), p.COLLECTED_ROW_IDENTITY = /* @__PURE__ */ new WeakMap(), p.COMPLETE_SET_VALUES = /* @__PURE__ */ new WeakSet(), p.COLLECTED_EXCLUDED_KEYS = /* @__PURE__ */ new WeakMap(), p.warnedPositionalRowFallbacks = /* @__PURE__ */ new Set(), p.warnedDerivedRowsWithoutKey = /* @__PURE__ */ new Set(), p.LEADING_PATH_PATTERN = /^\s*([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*([\s\S]*)$/;
|
|
10275
|
+
let x = p;
|
|
10276
10276
|
class B {
|
|
10277
10277
|
/**
|
|
10278
10278
|
* カスタムイベントを発火します。
|
|
@@ -10512,12 +10512,12 @@ class B {
|
|
|
10512
10512
|
B.dispatch(e, "pollstop", { reason: t, count: r, elapsedMs: i });
|
|
10513
10513
|
}
|
|
10514
10514
|
}
|
|
10515
|
-
const
|
|
10515
|
+
const br = {
|
|
10516
10516
|
401: "unauthorized-redirect",
|
|
10517
10517
|
403: "forbidden-redirect"
|
|
10518
10518
|
};
|
|
10519
|
-
function
|
|
10520
|
-
return
|
|
10519
|
+
function Er(f, e) {
|
|
10520
|
+
return f.replace(/\{\{([\s\S]+?)\}\}/g, (t, r) => {
|
|
10521
10521
|
try {
|
|
10522
10522
|
const i = se.evaluate(String(r).trim(), e);
|
|
10523
10523
|
return i == null ? "" : String(i);
|
|
@@ -10526,17 +10526,17 @@ function yr(p, e) {
|
|
|
10526
10526
|
}
|
|
10527
10527
|
});
|
|
10528
10528
|
}
|
|
10529
|
-
function
|
|
10530
|
-
const t =
|
|
10529
|
+
function Rt(f, e) {
|
|
10530
|
+
const t = f.getAttribute(e);
|
|
10531
10531
|
if (t === null || t === "")
|
|
10532
10532
|
return null;
|
|
10533
10533
|
if (!t.includes("{{"))
|
|
10534
10534
|
return t;
|
|
10535
|
-
const r = D.get(
|
|
10535
|
+
const r = D.get(f), i = r instanceof R ? r.getBindingData() : {}, s = Er(t, i);
|
|
10536
10536
|
return s === "" ? null : s;
|
|
10537
10537
|
}
|
|
10538
|
-
function
|
|
10539
|
-
const r =
|
|
10538
|
+
function Ar(f, e, t) {
|
|
10539
|
+
const r = f.getAttribute(`${e}-return-param`);
|
|
10540
10540
|
if (r === null || r === "")
|
|
10541
10541
|
return t;
|
|
10542
10542
|
try {
|
|
@@ -10548,28 +10548,37 @@ function Er(p, e, t) {
|
|
|
10548
10548
|
const i = window.location.pathname + window.location.search + window.location.hash, n = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "", l = a >= 0 ? t.slice(0, a) : t, u = l.includes("?") ? "&" : "?";
|
|
10549
10549
|
return `${l}${u}${n}${o}`;
|
|
10550
10550
|
}
|
|
10551
|
-
function
|
|
10552
|
-
const
|
|
10553
|
-
if (
|
|
10551
|
+
function Tt(f, e, t) {
|
|
10552
|
+
const r = Ar(f, e, t);
|
|
10553
|
+
if (!Le.isNavigableUrl(r))
|
|
10554
|
+
return m.error(
|
|
10555
|
+
"Haori",
|
|
10556
|
+
`遷移先が http: / https: / 現在ページと同じスキームの URL ではないため遷移しません: ${r}`
|
|
10557
|
+
), !1;
|
|
10558
|
+
try {
|
|
10559
|
+
if (new URL(r, window.location.href).href === window.location.href)
|
|
10560
|
+
return !1;
|
|
10561
|
+
} catch {
|
|
10562
|
+
}
|
|
10563
|
+
return window.location.href = r, !0;
|
|
10564
|
+
}
|
|
10565
|
+
function Xt(f, e = null) {
|
|
10566
|
+
const t = br[f];
|
|
10567
|
+
if (t === void 0 || typeof document > "u")
|
|
10554
10568
|
return !1;
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
continue;
|
|
10561
|
-
const n = Er(i, t, s);
|
|
10562
|
-
if (!Le.isNavigableUrl(n))
|
|
10563
|
-
return y.error(
|
|
10564
|
-
"Haori",
|
|
10565
|
-
`遷移先が http: / https: / 現在ページと同じスキームの URL ではないため遷移しません: ${n}`
|
|
10566
|
-
), !1;
|
|
10567
|
-
try {
|
|
10568
|
-
if (new URL(n, window.location.href).href === window.location.href)
|
|
10569
|
-
return !1;
|
|
10570
|
-
} catch {
|
|
10569
|
+
if (e !== null) {
|
|
10570
|
+
const s = `${e.attrPrefix}${t}`;
|
|
10571
|
+
if (e.element.hasAttribute(s)) {
|
|
10572
|
+
const n = Rt(e.element, s);
|
|
10573
|
+
return n !== null && Tt(e.element, s, n);
|
|
10571
10574
|
}
|
|
10572
|
-
|
|
10575
|
+
}
|
|
10576
|
+
const r = `${c.prefix}${t}`, i = [];
|
|
10577
|
+
document.body && i.push(document.body), document.documentElement && i.push(document.documentElement);
|
|
10578
|
+
for (const s of i) {
|
|
10579
|
+
const n = Rt(s, r);
|
|
10580
|
+
if (n !== null)
|
|
10581
|
+
return Tt(s, r, n);
|
|
10573
10582
|
}
|
|
10574
10583
|
return !1;
|
|
10575
10584
|
}
|
|
@@ -10603,7 +10612,7 @@ class K {
|
|
|
10603
10612
|
try {
|
|
10604
10613
|
return Array.from(r.querySelectorAll(e));
|
|
10605
10614
|
} catch (i) {
|
|
10606
|
-
return
|
|
10615
|
+
return m.error(
|
|
10607
10616
|
"Haori",
|
|
10608
10617
|
`Invalid selector: ${e} (${t})`,
|
|
10609
10618
|
i
|
|
@@ -10661,7 +10670,7 @@ class K {
|
|
|
10661
10670
|
try {
|
|
10662
10671
|
return r.querySelector(e);
|
|
10663
10672
|
} catch (i) {
|
|
10664
|
-
return
|
|
10673
|
+
return m.error(
|
|
10665
10674
|
"Haori",
|
|
10666
10675
|
`Invalid selector: ${e} (${t})`,
|
|
10667
10676
|
i
|
|
@@ -10687,7 +10696,7 @@ const N = class N {
|
|
|
10687
10696
|
throw new Error("storage is not available");
|
|
10688
10697
|
return t;
|
|
10689
10698
|
} catch (t) {
|
|
10690
|
-
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e),
|
|
10699
|
+
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), m.warn(
|
|
10691
10700
|
"Haori",
|
|
10692
10701
|
`${e}Storage が利用できないため ${c.prefix}store を無効にします:`,
|
|
10693
10702
|
t
|
|
@@ -10725,7 +10734,7 @@ const N = class N {
|
|
|
10725
10734
|
*/
|
|
10726
10735
|
static warnOnce(e, t, r) {
|
|
10727
10736
|
let i = N.WARNED_ELEMENTS.get(e);
|
|
10728
|
-
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t),
|
|
10737
|
+
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t), m.warn("Haori", r));
|
|
10729
10738
|
}
|
|
10730
10739
|
/**
|
|
10731
10740
|
* `data-each` の行の内側かどうかを判定します。
|
|
@@ -10786,12 +10795,12 @@ const N = class N {
|
|
|
10786
10795
|
const a = e.getRawAttribute(`${c.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), l = e.getRawAttribute(`${c.prefix}store-params`);
|
|
10787
10796
|
let u = null;
|
|
10788
10797
|
if (l !== null) {
|
|
10789
|
-
const d = l.split("&").map((b) => b.trim()).filter((b) => b !== ""),
|
|
10790
|
-
|
|
10798
|
+
const d = l.split("&").map((b) => b.trim()).filter((b) => b !== ""), y = d.filter((b) => !N.isReservedKey(b));
|
|
10799
|
+
y.length !== d.length && N.warnOnce(
|
|
10791
10800
|
t,
|
|
10792
10801
|
"reserved",
|
|
10793
10802
|
`${c.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
10794
|
-
), u =
|
|
10803
|
+
), u = y.length > 0 ? y : null;
|
|
10795
10804
|
}
|
|
10796
10805
|
return u === null && o === null ? (N.warnOnce(
|
|
10797
10806
|
t,
|
|
@@ -10817,7 +10826,7 @@ const N = class N {
|
|
|
10817
10826
|
try {
|
|
10818
10827
|
r = t.getItem(e.key);
|
|
10819
10828
|
} catch (s) {
|
|
10820
|
-
return
|
|
10829
|
+
return m.warn(
|
|
10821
10830
|
"Haori",
|
|
10822
10831
|
`ストレージの読み取りに失敗しました: ${e.key}`,
|
|
10823
10832
|
s
|
|
@@ -10829,13 +10838,13 @@ const N = class N {
|
|
|
10829
10838
|
try {
|
|
10830
10839
|
i = JSON.parse(r);
|
|
10831
10840
|
} catch (s) {
|
|
10832
|
-
return
|
|
10841
|
+
return m.warn(
|
|
10833
10842
|
"Haori",
|
|
10834
10843
|
`保存済みデータが JSON として解釈できません: ${e.key}`,
|
|
10835
10844
|
s
|
|
10836
10845
|
), null;
|
|
10837
10846
|
}
|
|
10838
|
-
return N.isPlainRecord(i) ? i : (
|
|
10847
|
+
return N.isPlainRecord(i) ? i : (m.warn(
|
|
10839
10848
|
"Haori",
|
|
10840
10849
|
`保存済みデータがオブジェクトではありません: ${e.key}`
|
|
10841
10850
|
), null);
|
|
@@ -10854,7 +10863,7 @@ const N = class N {
|
|
|
10854
10863
|
if (n === void 0)
|
|
10855
10864
|
return {};
|
|
10856
10865
|
if (!N.isPlainRecord(n))
|
|
10857
|
-
return
|
|
10866
|
+
return m.warn(
|
|
10858
10867
|
"Haori",
|
|
10859
10868
|
`保存済みデータの ${e.arg} がオブジェクトではありません: ` + e.key
|
|
10860
10869
|
), {};
|
|
@@ -10969,7 +10978,7 @@ const N = class N {
|
|
|
10969
10978
|
try {
|
|
10970
10979
|
return r.setItem(e.key, JSON.stringify(i)), !0;
|
|
10971
10980
|
} catch (s) {
|
|
10972
|
-
return
|
|
10981
|
+
return m.warn(
|
|
10973
10982
|
"Haori",
|
|
10974
10983
|
`ストレージへの保存に失敗しました: ${e.key}`,
|
|
10975
10984
|
s
|
|
@@ -11033,7 +11042,7 @@ const N = class N {
|
|
|
11033
11042
|
return;
|
|
11034
11043
|
const a = N.stringify(s);
|
|
11035
11044
|
if (a === null) {
|
|
11036
|
-
|
|
11045
|
+
m.warn(
|
|
11037
11046
|
"Haori",
|
|
11038
11047
|
`保存対象を直列化できないためミラーを行いません: ${t.key}`
|
|
11039
11048
|
);
|
|
@@ -11061,7 +11070,7 @@ const N = class N {
|
|
|
11061
11070
|
try {
|
|
11062
11071
|
r.removeItem(e);
|
|
11063
11072
|
} catch (i) {
|
|
11064
|
-
|
|
11073
|
+
m.warn("Haori", `ストレージの破棄に失敗しました: ${e}`, i);
|
|
11065
11074
|
return;
|
|
11066
11075
|
}
|
|
11067
11076
|
N.reseedDeclaringElements(e, t);
|
|
@@ -11096,12 +11105,12 @@ const N = class N {
|
|
|
11096
11105
|
N.SIGNATURES = /* @__PURE__ */ new WeakMap(), N.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), N.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), N.WARNED_KINDS = /* @__PURE__ */ new Set();
|
|
11097
11106
|
let Oe = N;
|
|
11098
11107
|
const De = "[Haori]", xe = {
|
|
11099
|
-
bodyIgnored: (
|
|
11100
|
-
notRegistered: (
|
|
11101
|
-
argsNotArray: (
|
|
11102
|
-
templateInBody: (
|
|
11103
|
-
notExpression: (
|
|
11104
|
-
shadowed: (
|
|
11108
|
+
bodyIgnored: (f) => `${f} is ignored because ${f}-handler is also declared.`,
|
|
11109
|
+
notRegistered: (f, e) => `Handler "${f}" is not registered (${e}-handler). Register it with Haori.handlers.register().`,
|
|
11110
|
+
argsNotArray: (f) => `${f}-args must evaluate to an array without unresolved references; the handler is not called.`,
|
|
11111
|
+
templateInBody: (f) => `${f} with {{...}} is not run in the CSP mode. Write the expression without {{...}}, or use ${f}-handler and ${f}-args.`,
|
|
11112
|
+
notExpression: (f) => `${f} is not run in the CSP mode because it is not a single expression. Use ${f}-handler and ${f}-args.`,
|
|
11113
|
+
shadowed: (f, e) => `Handler(s) ${f.join(", ")} are shadowed by binding keys of the same name in ${e}; the binding values are used.`
|
|
11105
11114
|
};
|
|
11106
11115
|
class ne {
|
|
11107
11116
|
/**
|
|
@@ -11135,7 +11144,7 @@ class ne {
|
|
|
11135
11144
|
*/
|
|
11136
11145
|
static compile(e, t, r) {
|
|
11137
11146
|
const i = `${t}-handler`;
|
|
11138
|
-
return e.hasAttribute(i) ? (
|
|
11147
|
+
return e.hasAttribute(i) ? (H.isEnabled() && e.hasAttribute(t) && m.warn(De, xe.bodyIgnored(t), e.getTarget()), ne.compileHandler(e, t)) : ne.compileExpression(e, t, r);
|
|
11139
11148
|
}
|
|
11140
11149
|
/**
|
|
11141
11150
|
* 登録した関数を呼ぶ呼び出しを組み立てます(`-handler` / `-args`)。
|
|
@@ -11151,7 +11160,7 @@ class ne {
|
|
|
11151
11160
|
return (s) => {
|
|
11152
11161
|
const n = Te.get(r);
|
|
11153
11162
|
if (n === void 0) {
|
|
11154
|
-
|
|
11163
|
+
m.warn(
|
|
11155
11164
|
De,
|
|
11156
11165
|
xe.notRegistered(r, t),
|
|
11157
11166
|
e.getTarget()
|
|
@@ -11165,7 +11174,7 @@ class ne {
|
|
|
11165
11174
|
e.getBindingData()
|
|
11166
11175
|
);
|
|
11167
11176
|
if (!Array.isArray(o.value)) {
|
|
11168
|
-
|
|
11177
|
+
m.warn(De, xe.argsNotArray(t), i);
|
|
11169
11178
|
return;
|
|
11170
11179
|
}
|
|
11171
11180
|
a = o.value;
|
|
@@ -11187,15 +11196,15 @@ class ne {
|
|
|
11187
11196
|
static compileExpression(e, t, r) {
|
|
11188
11197
|
const i = e.getRawAttribute(t);
|
|
11189
11198
|
if (i.includes("{{"))
|
|
11190
|
-
return
|
|
11199
|
+
return m.warn(De, xe.templateInBody(t), e.getTarget()), null;
|
|
11191
11200
|
try {
|
|
11192
11201
|
Pe.compile(i);
|
|
11193
11202
|
} catch {
|
|
11194
|
-
return
|
|
11203
|
+
return m.warn(De, xe.notExpression(t), e.getTarget()), null;
|
|
11195
11204
|
}
|
|
11196
11205
|
return (s) => {
|
|
11197
11206
|
const n = e.getBindingData();
|
|
11198
|
-
|
|
11207
|
+
H.isEnabled() && ne.reportShadowedHandlers(n, t);
|
|
11199
11208
|
const a = {
|
|
11200
11209
|
...Te.entries(),
|
|
11201
11210
|
...n
|
|
@@ -11214,10 +11223,10 @@ class ne {
|
|
|
11214
11223
|
*/
|
|
11215
11224
|
static reportShadowedHandlers(e, t) {
|
|
11216
11225
|
const r = Object.keys(e).filter((i) => Te.has(i));
|
|
11217
|
-
r.length > 0 &&
|
|
11226
|
+
r.length > 0 && m.warn(De, xe.shadowed(r, t));
|
|
11218
11227
|
}
|
|
11219
11228
|
}
|
|
11220
|
-
const
|
|
11229
|
+
const vr = [
|
|
11221
11230
|
"addErrorMessage",
|
|
11222
11231
|
"clearMessages",
|
|
11223
11232
|
"closeDialog",
|
|
@@ -11225,45 +11234,45 @@ const Ar = [
|
|
|
11225
11234
|
"dialog",
|
|
11226
11235
|
"openDialog",
|
|
11227
11236
|
"toast"
|
|
11228
|
-
],
|
|
11237
|
+
], wr = "__haoriHistoryState__", et = "data-haori-click-lock", kt = "ファイルを保存できませんでした", Sr = 100;
|
|
11229
11238
|
let $e = null;
|
|
11230
|
-
const
|
|
11239
|
+
const Rr = ["info", "warning", "error", "success"], Dt = /^(\d{3})-(click|click-await|close|toast|toast-level|no-message|bind)$/;
|
|
11231
11240
|
function be() {
|
|
11232
11241
|
const e = globalThis.window?.Haori;
|
|
11233
|
-
return
|
|
11242
|
+
return vr.every(
|
|
11234
11243
|
(r) => typeof e?.[r] == "function"
|
|
11235
11244
|
) ? e : ke;
|
|
11236
11245
|
}
|
|
11237
|
-
const
|
|
11238
|
-
function We(
|
|
11239
|
-
return
|
|
11246
|
+
const Tr = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
11247
|
+
function We(f) {
|
|
11248
|
+
return Tr.has(f.toUpperCase());
|
|
11240
11249
|
}
|
|
11241
|
-
function
|
|
11250
|
+
function kr(f, e) {
|
|
11242
11251
|
for (const [t, r] of Object.entries(e))
|
|
11243
11252
|
r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
|
|
11244
|
-
|
|
11245
|
-
}) :
|
|
11253
|
+
f.append(t, Ne(i));
|
|
11254
|
+
}) : f.append(t, Ne(r)));
|
|
11246
11255
|
}
|
|
11247
|
-
function Ne(
|
|
11248
|
-
if (
|
|
11256
|
+
function Ne(f) {
|
|
11257
|
+
if (f == null)
|
|
11249
11258
|
return "";
|
|
11250
|
-
if (typeof
|
|
11259
|
+
if (typeof f == "object" || typeof f == "function")
|
|
11251
11260
|
try {
|
|
11252
|
-
return JSON.stringify(
|
|
11261
|
+
return JSON.stringify(f) ?? "";
|
|
11253
11262
|
} catch {
|
|
11254
11263
|
return "";
|
|
11255
11264
|
}
|
|
11256
|
-
return String(
|
|
11265
|
+
return String(f);
|
|
11257
11266
|
}
|
|
11258
|
-
function
|
|
11259
|
-
const t = new URL(
|
|
11260
|
-
return
|
|
11267
|
+
function Jt(f, e) {
|
|
11268
|
+
const t = new URL(f, window.location.href), r = new URLSearchParams(t.search);
|
|
11269
|
+
return kr(r, e), t.search = r.toString(), t.toString();
|
|
11261
11270
|
}
|
|
11262
|
-
function
|
|
11263
|
-
if (
|
|
11271
|
+
function Dr(f) {
|
|
11272
|
+
if (f == null)
|
|
11264
11273
|
return { payload: {}, dropped: !1 };
|
|
11265
|
-
if (typeof
|
|
11266
|
-
const e =
|
|
11274
|
+
if (typeof f == "string") {
|
|
11275
|
+
const e = f.trim();
|
|
11267
11276
|
if (e === "")
|
|
11268
11277
|
return { payload: {}, dropped: !1 };
|
|
11269
11278
|
if (e.startsWith("{")) {
|
|
@@ -11276,48 +11285,48 @@ function kr(p) {
|
|
|
11276
11285
|
return { payload: {}, dropped: !0 };
|
|
11277
11286
|
}
|
|
11278
11287
|
return e.includes("=") ? {
|
|
11279
|
-
payload:
|
|
11288
|
+
payload: xt(new URLSearchParams(e)),
|
|
11280
11289
|
dropped: !1
|
|
11281
11290
|
} : { payload: {}, dropped: !0 };
|
|
11282
11291
|
}
|
|
11283
|
-
if (
|
|
11284
|
-
return { payload:
|
|
11285
|
-
if (typeof FormData < "u" &&
|
|
11292
|
+
if (f instanceof URLSearchParams)
|
|
11293
|
+
return { payload: xt(f), dropped: !1 };
|
|
11294
|
+
if (typeof FormData < "u" && f instanceof FormData) {
|
|
11286
11295
|
const e = {};
|
|
11287
11296
|
let t = !1;
|
|
11288
|
-
for (const [r, i] of
|
|
11297
|
+
for (const [r, i] of f.entries()) {
|
|
11289
11298
|
if (typeof i != "string") {
|
|
11290
11299
|
t = !0;
|
|
11291
11300
|
continue;
|
|
11292
11301
|
}
|
|
11293
|
-
|
|
11302
|
+
Zt(e, r, i);
|
|
11294
11303
|
}
|
|
11295
11304
|
return { payload: e, dropped: t };
|
|
11296
11305
|
}
|
|
11297
11306
|
return { payload: {}, dropped: !0 };
|
|
11298
11307
|
}
|
|
11299
|
-
function
|
|
11308
|
+
function xt(f) {
|
|
11300
11309
|
const e = {};
|
|
11301
|
-
for (const [t, r] of
|
|
11302
|
-
|
|
11310
|
+
for (const [t, r] of f.entries())
|
|
11311
|
+
Zt(e, t, r);
|
|
11303
11312
|
return e;
|
|
11304
11313
|
}
|
|
11305
|
-
function
|
|
11306
|
-
const r =
|
|
11307
|
-
r === void 0 ?
|
|
11314
|
+
function Zt(f, e, t) {
|
|
11315
|
+
const r = f[e];
|
|
11316
|
+
r === void 0 ? f[e] = t : Array.isArray(r) ? r.push(t) : f[e] = [r, t];
|
|
11308
11317
|
}
|
|
11309
|
-
function Ae(
|
|
11318
|
+
function Ae(f, e) {
|
|
11310
11319
|
if (x.isCompleteSetValue(e))
|
|
11311
11320
|
return e;
|
|
11312
11321
|
if (Array.isArray(e)) {
|
|
11313
|
-
const t = Array.isArray(
|
|
11322
|
+
const t = Array.isArray(f) ? f.slice() : [];
|
|
11314
11323
|
let r = !1;
|
|
11315
11324
|
return e.forEach((i, s) => {
|
|
11316
11325
|
i != null && (typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (t[s] = Ae(t[s], i), r = !0));
|
|
11317
|
-
}), r ? t :
|
|
11326
|
+
}), r ? t : f;
|
|
11318
11327
|
}
|
|
11319
11328
|
if (e !== null && typeof e == "object") {
|
|
11320
|
-
const t =
|
|
11329
|
+
const t = f !== null && typeof f == "object" && !Array.isArray(f) ? { ...f } : {};
|
|
11321
11330
|
for (const [r, i] of Object.entries(
|
|
11322
11331
|
e
|
|
11323
11332
|
))
|
|
@@ -11326,25 +11335,25 @@ function Ae(p, e) {
|
|
|
11326
11335
|
}
|
|
11327
11336
|
return e;
|
|
11328
11337
|
}
|
|
11329
|
-
function
|
|
11330
|
-
const e =
|
|
11338
|
+
function xr(f) {
|
|
11339
|
+
const e = f?.body;
|
|
11331
11340
|
return e == null ? !1 : typeof e == "string" ? e !== "" : !0;
|
|
11332
11341
|
}
|
|
11333
|
-
function
|
|
11342
|
+
function Nr(f, e) {
|
|
11334
11343
|
const t = { ...e || {} }, r = (t.method || "GET").toUpperCase();
|
|
11335
11344
|
if (c.runtime !== "demo" || We(r))
|
|
11336
11345
|
return {
|
|
11337
|
-
url:
|
|
11346
|
+
url: f,
|
|
11338
11347
|
options: t,
|
|
11339
11348
|
requestedMethod: r,
|
|
11340
11349
|
effectiveMethod: r,
|
|
11341
11350
|
normalized: !1
|
|
11342
11351
|
};
|
|
11343
|
-
const { payload: i, dropped: s } =
|
|
11352
|
+
const { payload: i, dropped: s } = Dr(
|
|
11344
11353
|
t.body
|
|
11345
11354
|
);
|
|
11346
|
-
let n =
|
|
11347
|
-
Object.keys(i).length > 0 && (n =
|
|
11355
|
+
let n = f;
|
|
11356
|
+
Object.keys(i).length > 0 && (n = Jt(n, i)), s && m.warn(
|
|
11348
11357
|
"Haori",
|
|
11349
11358
|
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${c.prefix}{event}-data / ${c.prefix}{event}-form, or use the embedded runtime.`
|
|
11350
11359
|
), delete t.body, t.method = "GET";
|
|
@@ -11360,8 +11369,8 @@ function xr(p, e) {
|
|
|
11360
11369
|
queryString: new URL(n, window.location.href).search || void 0
|
|
11361
11370
|
};
|
|
11362
11371
|
}
|
|
11363
|
-
function
|
|
11364
|
-
return
|
|
11372
|
+
function Ir(f) {
|
|
11373
|
+
return f == null ? null : typeof f == "string" ? f : f instanceof URLSearchParams ? f.toString() : f instanceof FormData ? Array.from(f.entries()).map(([e, t]) => t instanceof File ? [
|
|
11365
11374
|
e,
|
|
11366
11375
|
{
|
|
11367
11376
|
type: "file",
|
|
@@ -11369,22 +11378,22 @@ function Nr(p) {
|
|
|
11369
11378
|
size: t.size,
|
|
11370
11379
|
mimeType: t.type
|
|
11371
11380
|
}
|
|
11372
|
-
] : [e, String(t)]) : String(
|
|
11381
|
+
] : [e, String(t)]) : String(f);
|
|
11373
11382
|
}
|
|
11374
|
-
function Be(
|
|
11375
|
-
return
|
|
11383
|
+
function Be(f) {
|
|
11384
|
+
return f instanceof Blob ? !0 : Array.isArray(f) ? f.some(Be) : f !== null && typeof f == "object" ? Object.values(f).some(
|
|
11376
11385
|
Be
|
|
11377
11386
|
) : !1;
|
|
11378
11387
|
}
|
|
11379
|
-
function
|
|
11380
|
-
return Object.values(
|
|
11388
|
+
function Fr(f) {
|
|
11389
|
+
return Object.values(f).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
11381
11390
|
(t) => !(t instanceof Blob) && Be(t)
|
|
11382
11391
|
) : Be(e));
|
|
11383
11392
|
}
|
|
11384
|
-
function qe(
|
|
11385
|
-
return it(x.getValues(
|
|
11393
|
+
function qe(f) {
|
|
11394
|
+
return it(x.getValues(f));
|
|
11386
11395
|
}
|
|
11387
|
-
function it(
|
|
11396
|
+
function it(f) {
|
|
11388
11397
|
const e = (r) => {
|
|
11389
11398
|
if (r instanceof File)
|
|
11390
11399
|
return r.name;
|
|
@@ -11404,21 +11413,21 @@ function it(p) {
|
|
|
11404
11413
|
}
|
|
11405
11414
|
return r;
|
|
11406
11415
|
}, t = {};
|
|
11407
|
-
for (const [r, i] of Object.entries(
|
|
11416
|
+
for (const [r, i] of Object.entries(f))
|
|
11408
11417
|
t[r] = e(i);
|
|
11409
|
-
return x.carryCollectedRowIdentity(
|
|
11418
|
+
return x.carryCollectedRowIdentity(f, t), t;
|
|
11410
11419
|
}
|
|
11411
|
-
function
|
|
11420
|
+
function Cr(f, e) {
|
|
11412
11421
|
const t = new Headers(
|
|
11413
11422
|
e.headers || void 0
|
|
11414
11423
|
), r = Array.from(t.entries()).sort(
|
|
11415
11424
|
([i], [s]) => i.localeCompare(s)
|
|
11416
11425
|
);
|
|
11417
11426
|
return JSON.stringify({
|
|
11418
|
-
url:
|
|
11427
|
+
url: f,
|
|
11419
11428
|
method: String(e.method || "GET").toUpperCase(),
|
|
11420
11429
|
headers: r,
|
|
11421
|
-
body:
|
|
11430
|
+
body: Ir(e.body || null)
|
|
11422
11431
|
});
|
|
11423
11432
|
}
|
|
11424
11433
|
const g = class g {
|
|
@@ -11465,6 +11474,31 @@ const g = class g {
|
|
|
11465
11474
|
static attrName(e, t, r = !1) {
|
|
11466
11475
|
return e ? `${c.prefix}${e}-${t}` : r ? `${c.prefix}fetch-${t}` : `${c.prefix}${t}`;
|
|
11467
11476
|
}
|
|
11477
|
+
/**
|
|
11478
|
+
* 取得を伴わない要素に書いた認証ガードの宣言を警告します(開発モード)。
|
|
11479
|
+
*
|
|
11480
|
+
* `data-{event}-forbidden-redirect` などは、その要素の取得の応答でだけ読みます
|
|
11481
|
+
* (仕様「取得ごとの切り替え」)。`data-{event}-fetch` が無い要素に
|
|
11482
|
+
* 書いても効かないため、書き間違いとして知らせます。
|
|
11483
|
+
*
|
|
11484
|
+
* @param fragment 宣言を書いた要素
|
|
11485
|
+
* @param event イベント名
|
|
11486
|
+
* @returns 戻り値はありません。
|
|
11487
|
+
*/
|
|
11488
|
+
static warnAuthRedirectWithoutFetch(e, t) {
|
|
11489
|
+
if (!e.hasAttribute(g.attrName(t, "fetch")))
|
|
11490
|
+
for (const r of ["unauthorized-redirect", "forbidden-redirect"]) {
|
|
11491
|
+
const i = g.attrName(t, r);
|
|
11492
|
+
if (e.hasAttribute(i)) {
|
|
11493
|
+
const s = g.attrName(t, "fetch");
|
|
11494
|
+
m.warn(
|
|
11495
|
+
"Haori",
|
|
11496
|
+
`${i} has no effect without ${s}.`,
|
|
11497
|
+
e.getTarget()
|
|
11498
|
+
);
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
}
|
|
11468
11502
|
/**
|
|
11469
11503
|
* セレクタを値に取る属性(`data-{event}-click` / `-close` / `-error-click` など)
|
|
11470
11504
|
* の対象を解決します。
|
|
@@ -11485,15 +11519,15 @@ const g = class g {
|
|
|
11485
11519
|
(r === "click" || r === "error-click" ? K.queryAllInListOrder(i, t) : K.queryAll(i, t)).forEach((a) => {
|
|
11486
11520
|
const o = D.get(a);
|
|
11487
11521
|
o && s.push(o);
|
|
11488
|
-
}), s.length === 0 &&
|
|
11522
|
+
}), s.length === 0 && m.error("Haori", `Element not found: ${i} (${t})`);
|
|
11489
11523
|
else if (r === "error-click")
|
|
11490
|
-
|
|
11524
|
+
m.error(
|
|
11491
11525
|
"Haori",
|
|
11492
11526
|
`${t} にはクリックする要素のセレクタが必要です。`
|
|
11493
11527
|
);
|
|
11494
11528
|
else if (r === "open" || r === "close" || r === "error-close") {
|
|
11495
11529
|
const n = e.getTarget().closest("dialog");
|
|
11496
|
-
n ? s.push(D.get(n)) :
|
|
11530
|
+
n ? s.push(D.get(n)) : m.error("Haori", `Ancestor <dialog> not found (${t})`);
|
|
11497
11531
|
} else
|
|
11498
11532
|
s.push(e);
|
|
11499
11533
|
return s;
|
|
@@ -11539,7 +11573,7 @@ const g = class g {
|
|
|
11539
11573
|
);
|
|
11540
11574
|
const s = g.attrName(r, "error-"), n = /* @__PURE__ */ new Map();
|
|
11541
11575
|
for (const a of e.getAttributeNames()) {
|
|
11542
|
-
const o = a.startsWith(s) ?
|
|
11576
|
+
const o = a.startsWith(s) ? Dt.exec(a.slice(s.length)) : null;
|
|
11543
11577
|
o && o[2] === "no-message" && n.set(Number(o[1]), {
|
|
11544
11578
|
key: `error-${o[1]}`,
|
|
11545
11579
|
clickFragments: null,
|
|
@@ -11571,7 +11605,7 @@ const g = class g {
|
|
|
11571
11605
|
for (const a of e.getAttributeNames()) {
|
|
11572
11606
|
if (!a.startsWith(i))
|
|
11573
11607
|
continue;
|
|
11574
|
-
const o =
|
|
11608
|
+
const o = Dt.exec(
|
|
11575
11609
|
a.slice(i.length)
|
|
11576
11610
|
);
|
|
11577
11611
|
o && s.add(o[1]);
|
|
@@ -11617,7 +11651,7 @@ const g = class g {
|
|
|
11617
11651
|
* @returns レベル。4 つの値のどれとも一致しない場合は null(`info` で表示する)
|
|
11618
11652
|
*/
|
|
11619
11653
|
static toToastLevel(e) {
|
|
11620
|
-
return
|
|
11654
|
+
return Rr.includes(e) ? e : null;
|
|
11621
11655
|
}
|
|
11622
11656
|
/**
|
|
11623
11657
|
* `data-{event}-error-status` の値を、ステータスの一覧へ変換します。
|
|
@@ -11634,7 +11668,7 @@ const g = class g {
|
|
|
11634
11668
|
const r = [];
|
|
11635
11669
|
for (const i of (e ?? "").split("&")) {
|
|
11636
11670
|
const s = i.trim();
|
|
11637
|
-
/^\d{3}$/.test(s) ? r.push(Number(s)) :
|
|
11671
|
+
/^\d{3}$/.test(s) ? r.push(Number(s)) : m.warn(
|
|
11638
11672
|
"Haori",
|
|
11639
11673
|
`${t} の "${s}" は 3 桁のステータスではないため無視します。`
|
|
11640
11674
|
);
|
|
@@ -11706,9 +11740,9 @@ const g = class g {
|
|
|
11706
11740
|
try {
|
|
11707
11741
|
i = M.parseDataBind(r);
|
|
11708
11742
|
} catch (s) {
|
|
11709
|
-
return
|
|
11743
|
+
return m.error("Haori", `Invalid fetch headers: ${s}`), null;
|
|
11710
11744
|
}
|
|
11711
|
-
return i === null || typeof i != "object" || Array.isArray(i) ? (
|
|
11745
|
+
return i === null || typeof i != "object" || Array.isArray(i) ? (m.warn(
|
|
11712
11746
|
"Haori",
|
|
11713
11747
|
`${t} はヘッダー名と値のオブジェクトで指定してください(${Array.isArray(i) ? "配列" : `${typeof i} 型の値`}が指定されたため、ヘッダーは設定しません)。`
|
|
11714
11748
|
), null) : i;
|
|
@@ -11937,7 +11971,7 @@ const g = class g {
|
|
|
11937
11971
|
}, i = t ? g.attrName(t, "if") : g.attrName(null, "if", !0);
|
|
11938
11972
|
if (e.hasAttribute(i)) {
|
|
11939
11973
|
const w = e.getRawAttribute(i);
|
|
11940
|
-
typeof w == "string" && w.trim() !== "" ? (r.conditionExpression = x.unwrapConditionExpression(w), r.conditionAttributeName = i) :
|
|
11974
|
+
typeof w == "string" && w.trim() !== "" ? (r.conditionExpression = x.unwrapConditionExpression(w), r.conditionAttributeName = i) : m.warn(
|
|
11941
11975
|
"Haori",
|
|
11942
11976
|
`${i} に条件式が指定されていません。`
|
|
11943
11977
|
);
|
|
@@ -11953,13 +11987,13 @@ const g = class g {
|
|
|
11953
11987
|
g.attrName(t, "form")
|
|
11954
11988
|
);
|
|
11955
11989
|
if (j) {
|
|
11956
|
-
const
|
|
11990
|
+
const V = K.query(
|
|
11957
11991
|
j,
|
|
11958
11992
|
g.attrName(t, "form")
|
|
11959
11993
|
);
|
|
11960
|
-
|
|
11961
|
-
D.get(
|
|
11962
|
-
) :
|
|
11994
|
+
V !== null ? r.formFragment = x.getFormFragment(
|
|
11995
|
+
D.get(V)
|
|
11996
|
+
) : m.error(
|
|
11963
11997
|
"Haori",
|
|
11964
11998
|
`Form element not found: ${j} (${g.attrName(t, "form")})`
|
|
11965
11999
|
);
|
|
@@ -11968,15 +12002,16 @@ const g = class g {
|
|
|
11968
12002
|
} else if (t === "change" || t === "input") {
|
|
11969
12003
|
r.formFragment = x.getFormFragment(e);
|
|
11970
12004
|
const j = `${c.prefix}${t}-`;
|
|
11971
|
-
r.implicitFormFragment = !e.getAttributeNames().some((
|
|
12005
|
+
r.implicitFormFragment = !e.getAttributeNames().some((V) => V.startsWith(j)), r.formFragment === null && g.isNamedInputFragment(e) && (r.selfValueFragment = e);
|
|
11972
12006
|
}
|
|
12007
|
+
H.isEnabled() && g.warnAuthRedirectWithoutFetch(e, t);
|
|
11973
12008
|
const w = `${c.prefix}${t}-before-run`;
|
|
11974
12009
|
if (ne.declared(e, w) && ne.applies(e, w)) {
|
|
11975
12010
|
const j = ne.compile(e, w, [
|
|
11976
12011
|
"fetchUrl",
|
|
11977
12012
|
"fetchOptions"
|
|
11978
12013
|
]);
|
|
11979
|
-
j && (r.beforeCallback = (
|
|
12014
|
+
j && (r.beforeCallback = (V, ue) => j([V, ue]));
|
|
11980
12015
|
} else if (e.hasAttribute(w)) {
|
|
11981
12016
|
const j = e.getRawAttribute(w);
|
|
11982
12017
|
try {
|
|
@@ -11988,19 +12023,19 @@ const g = class g {
|
|
|
11988
12023
|
${j}
|
|
11989
12024
|
`
|
|
11990
12025
|
);
|
|
11991
|
-
} catch (
|
|
11992
|
-
|
|
12026
|
+
} catch (V) {
|
|
12027
|
+
m.error("Haori", `Invalid before script: ${V}`);
|
|
11993
12028
|
}
|
|
11994
12029
|
}
|
|
11995
12030
|
const O = g.attrName(t, "run");
|
|
11996
12031
|
if (ne.declared(e, O) && ne.applies(e, O)) {
|
|
11997
12032
|
const j = ne.compile(e, O, ["event"]);
|
|
11998
|
-
j && (r.runScript = (
|
|
12033
|
+
j && (r.runScript = (V) => j([V]));
|
|
11999
12034
|
} else if (e.hasAttribute(O)) {
|
|
12000
12035
|
const j = String(e.getAttribute(O) ?? "");
|
|
12001
|
-
let
|
|
12036
|
+
let V = null;
|
|
12002
12037
|
try {
|
|
12003
|
-
|
|
12038
|
+
V = new Function(
|
|
12004
12039
|
"event",
|
|
12005
12040
|
`"use strict"; return (
|
|
12006
12041
|
${j}
|
|
@@ -12008,14 +12043,14 @@ ${j}
|
|
|
12008
12043
|
);
|
|
12009
12044
|
} catch {
|
|
12010
12045
|
try {
|
|
12011
|
-
|
|
12046
|
+
V = new Function("event", `"use strict";
|
|
12012
12047
|
${j}
|
|
12013
12048
|
`);
|
|
12014
12049
|
} catch (ue) {
|
|
12015
|
-
|
|
12050
|
+
m.error("Haori", `Invalid run script: ${ue}`);
|
|
12016
12051
|
}
|
|
12017
12052
|
}
|
|
12018
|
-
|
|
12053
|
+
V && (r.runScript = V);
|
|
12019
12054
|
}
|
|
12020
12055
|
}
|
|
12021
12056
|
const s = g.attrName(t, "fetch"), n = e.hasAttribute(s);
|
|
@@ -12034,17 +12069,17 @@ ${j}
|
|
|
12034
12069
|
);
|
|
12035
12070
|
u !== null && (a.headers = u);
|
|
12036
12071
|
const d = t ? g.attrName(t, "fetch-content-type") : g.attrName(null, "content-type", !0);
|
|
12037
|
-
let
|
|
12072
|
+
let y = null;
|
|
12038
12073
|
if (e.hasAttribute(d)) {
|
|
12039
12074
|
const w = e.getAttributeEvaluation(d);
|
|
12040
|
-
w?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0),
|
|
12075
|
+
w?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), y = g.normalizeAttributeText(
|
|
12041
12076
|
w?.value
|
|
12042
12077
|
);
|
|
12043
12078
|
}
|
|
12044
|
-
if (
|
|
12079
|
+
if (y !== null)
|
|
12045
12080
|
a.headers = g.withContentType(
|
|
12046
12081
|
a.headers,
|
|
12047
|
-
|
|
12082
|
+
y
|
|
12048
12083
|
);
|
|
12049
12084
|
else if (a.method && !g.hasDeclaredContentType(a.headers)) {
|
|
12050
12085
|
const w = a.method.toUpperCase();
|
|
@@ -12056,7 +12091,7 @@ ${j}
|
|
|
12056
12091
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
12057
12092
|
const b = t ? g.attrName(t, "fetch-download") : g.attrName(null, "download", !0);
|
|
12058
12093
|
if (e.hasAttribute(b) && !n)
|
|
12059
|
-
|
|
12094
|
+
m.warn(
|
|
12060
12095
|
"Haori",
|
|
12061
12096
|
`${b} は ${s} と併せて指定してください(保存する応答が無いため、この宣言は無視します)。`
|
|
12062
12097
|
);
|
|
@@ -12066,7 +12101,7 @@ ${j}
|
|
|
12066
12101
|
r.downloadFileName = w?.hasUnresolvedReference ? null : g.normalizeAttributeText(w?.value);
|
|
12067
12102
|
}
|
|
12068
12103
|
const E = t ? g.attrName(t, "fetch-download-folder") : g.attrName(null, "download-folder", !0);
|
|
12069
|
-
e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 :
|
|
12104
|
+
e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 : m.warn(
|
|
12070
12105
|
"Haori",
|
|
12071
12106
|
`${E} は ${b} と併せて指定してください(書き出す応答が無いため、この宣言は無視します)。`
|
|
12072
12107
|
));
|
|
@@ -12076,9 +12111,9 @@ ${j}
|
|
|
12076
12111
|
if (w) {
|
|
12077
12112
|
const O = K.queryAll(w, A);
|
|
12078
12113
|
O.length > 0 ? (r.bindFragments = [], O.forEach((j) => {
|
|
12079
|
-
const
|
|
12080
|
-
|
|
12081
|
-
})) :
|
|
12114
|
+
const V = D.get(j);
|
|
12115
|
+
V && r.bindFragments.push(V);
|
|
12116
|
+
})) : m.error(
|
|
12082
12117
|
"Haori",
|
|
12083
12118
|
`Bind element not found: ${w} (${A})`
|
|
12084
12119
|
);
|
|
@@ -12121,7 +12156,7 @@ ${j}
|
|
|
12121
12156
|
G.length > 0 ? (r.adjustFragments = [], G.forEach((re) => {
|
|
12122
12157
|
const me = D.get(re);
|
|
12123
12158
|
me && r.adjustFragments.push(me);
|
|
12124
|
-
})) :
|
|
12159
|
+
})) : m.error(
|
|
12125
12160
|
"Haori",
|
|
12126
12161
|
`Adjust element not found: ${W} (${g.attrName(t, "adjust")})`
|
|
12127
12162
|
);
|
|
@@ -12151,7 +12186,7 @@ ${W}
|
|
|
12151
12186
|
`
|
|
12152
12187
|
);
|
|
12153
12188
|
} catch (G) {
|
|
12154
|
-
|
|
12189
|
+
m.error("Haori", `Invalid after script: ${G}`);
|
|
12155
12190
|
}
|
|
12156
12191
|
}
|
|
12157
12192
|
if (e.hasAttribute(g.attrName(t, "dialog")) && (r.dialogMessage = g.unescapeNewlines(
|
|
@@ -12194,8 +12229,8 @@ ${W}
|
|
|
12194
12229
|
g.attrName(t, "error-bind")
|
|
12195
12230
|
);
|
|
12196
12231
|
}
|
|
12197
|
-
const O = g.attrName(t, "redirect"), j = g.attrName(t, "redirect-replace"),
|
|
12198
|
-
if (
|
|
12232
|
+
const O = g.attrName(t, "redirect"), j = g.attrName(t, "redirect-replace"), V = e.hasAttribute(O), ue = e.hasAttribute(j);
|
|
12233
|
+
if (V && (r.redirectUrl = g.readLateAttribute(
|
|
12199
12234
|
e,
|
|
12200
12235
|
r,
|
|
12201
12236
|
"redirect",
|
|
@@ -12205,7 +12240,7 @@ ${W}
|
|
|
12205
12240
|
r,
|
|
12206
12241
|
"redirect-replace",
|
|
12207
12242
|
j
|
|
12208
|
-
)),
|
|
12243
|
+
)), V || ue) {
|
|
12209
12244
|
const W = g.attrName(
|
|
12210
12245
|
t,
|
|
12211
12246
|
"redirect-return-param"
|
|
@@ -12239,7 +12274,7 @@ ${W}
|
|
|
12239
12274
|
);
|
|
12240
12275
|
G !== null ? r.historyFormFragment = x.getFormFragment(
|
|
12241
12276
|
D.get(G)
|
|
12242
|
-
) :
|
|
12277
|
+
) : m.error(
|
|
12243
12278
|
"Haori",
|
|
12244
12279
|
`Form element not found: ${W} (${g.attrName(t, "history-form")})`
|
|
12245
12280
|
);
|
|
@@ -12311,12 +12346,12 @@ ${W}
|
|
|
12311
12346
|
const G = K.query(W, oe);
|
|
12312
12347
|
if (G !== null) {
|
|
12313
12348
|
const re = D.get(G);
|
|
12314
|
-
re ? r.copySourceFragment = re :
|
|
12349
|
+
re ? r.copySourceFragment = re : m.error(
|
|
12315
12350
|
"Haori",
|
|
12316
12351
|
`Element is not managed by Haori: ${W} (${oe})`
|
|
12317
12352
|
);
|
|
12318
12353
|
} else
|
|
12319
|
-
|
|
12354
|
+
m.error(
|
|
12320
12355
|
"Haori",
|
|
12321
12356
|
`Element not found: ${W} (${oe})`
|
|
12322
12357
|
);
|
|
@@ -12336,7 +12371,7 @@ ${W}
|
|
|
12336
12371
|
);
|
|
12337
12372
|
O !== null ? r.formFragment = x.getFormFragment(
|
|
12338
12373
|
D.get(O)
|
|
12339
|
-
) :
|
|
12374
|
+
) : m.error(
|
|
12340
12375
|
"Haori",
|
|
12341
12376
|
`Form element not found: ${w} (${g.attrName(null, "fetch-form", !0)})`
|
|
12342
12377
|
);
|
|
@@ -12347,10 +12382,10 @@ ${W}
|
|
|
12347
12382
|
const z = t ? g.attrName(t, "fetch-state") : g.attrName(null, "state", !0);
|
|
12348
12383
|
if (e.hasAttribute(z)) {
|
|
12349
12384
|
const w = K.read(e, z), O = [];
|
|
12350
|
-
w ? (K.queryAll(w, z).forEach((
|
|
12351
|
-
const ue = D.get(
|
|
12385
|
+
w ? (K.queryAll(w, z).forEach((V) => {
|
|
12386
|
+
const ue = D.get(V);
|
|
12352
12387
|
ue && O.push(ue);
|
|
12353
|
-
}), O.length === 0 &&
|
|
12388
|
+
}), O.length === 0 && m.error(
|
|
12354
12389
|
"Haori",
|
|
12355
12390
|
`Element not found: ${w} (${z})`
|
|
12356
12391
|
)) : O.push(e), O.length > 0 && (r.fetchStateFragments = O);
|
|
@@ -12359,7 +12394,7 @@ ${W}
|
|
|
12359
12394
|
if (e.hasAttribute(ce)) {
|
|
12360
12395
|
const w = e.getRawAttribute(ce), O = w === null ? "" : w.trim();
|
|
12361
12396
|
if (O === "")
|
|
12362
|
-
|
|
12397
|
+
m.error(
|
|
12363
12398
|
"Haori",
|
|
12364
12399
|
`ストレージキーが指定されていません (${ce})`
|
|
12365
12400
|
);
|
|
@@ -12367,14 +12402,14 @@ ${W}
|
|
|
12367
12402
|
r.storeClearKey = O;
|
|
12368
12403
|
const j = e.getRawAttribute(
|
|
12369
12404
|
`${ce}-type`
|
|
12370
|
-
),
|
|
12371
|
-
|
|
12405
|
+
), V = j === null ? "session" : j.trim();
|
|
12406
|
+
V === "local" || V === "session" ? r.storeClearKind = V : (m.warn(
|
|
12372
12407
|
"Haori",
|
|
12373
|
-
`${ce}-type は session または local を指定してください(session として扱います): ${
|
|
12408
|
+
`${ce}-type は session または local を指定してください(session として扱います): ${V}`
|
|
12374
12409
|
), r.storeClearKind = "session");
|
|
12375
12410
|
}
|
|
12376
12411
|
}
|
|
12377
|
-
return n && !r.download && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [e], r.defaultSelfBind = !0), r.download && r.bindFragments && r.bindFragments.length > 0 && (
|
|
12412
|
+
return n && !r.download && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [e], r.defaultSelfBind = !0), r.download && r.bindFragments && r.bindFragments.length > 0 && (m.warn(
|
|
12378
12413
|
"Haori",
|
|
12379
12414
|
`${b} と同時にバインド先が指定されています(応答はファイルとして保存し、バインドは行いません)。`
|
|
12380
12415
|
), r.bindFragments = null), g.recordRowWriteTargets(r), r;
|
|
@@ -12490,15 +12525,15 @@ ${W}
|
|
|
12490
12525
|
), !this.evaluateExecutionCondition())
|
|
12491
12526
|
return this.skipped = !0, await this.commitEditOnStop(), !1;
|
|
12492
12527
|
if (this.options.runScript) {
|
|
12493
|
-
const
|
|
12528
|
+
const y = this.options.targetFragment?.getTarget() ?? null;
|
|
12494
12529
|
try {
|
|
12495
12530
|
const b = this.options.runScript.call(
|
|
12496
|
-
|
|
12531
|
+
y,
|
|
12497
12532
|
this.domEvent
|
|
12498
12533
|
);
|
|
12499
12534
|
b === !1 && this.domEvent && this.domEvent.preventDefault(), b != null && typeof b.then == "function" && await b;
|
|
12500
12535
|
} catch (b) {
|
|
12501
|
-
|
|
12536
|
+
m.error("Haori", `Run script execution error: ${b}`);
|
|
12502
12537
|
}
|
|
12503
12538
|
}
|
|
12504
12539
|
if (!await this.confirm())
|
|
@@ -12507,7 +12542,7 @@ ${W}
|
|
|
12507
12542
|
return !1;
|
|
12508
12543
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
12509
12544
|
this.options.resetBeforeFragments.map(
|
|
12510
|
-
(
|
|
12545
|
+
(y) => x.reset(y, this.operationSequence)
|
|
12511
12546
|
)
|
|
12512
12547
|
), this.captureHistorySnapshots());
|
|
12513
12548
|
const r = this.prepareFetchRequest();
|
|
@@ -12515,14 +12550,14 @@ ${W}
|
|
|
12515
12550
|
const i = r.payload;
|
|
12516
12551
|
let s = r.url, n = r.options, a = !1, o = !1;
|
|
12517
12552
|
if (this.options.beforeCallback) {
|
|
12518
|
-
const
|
|
12553
|
+
const y = this.options.beforeCallback(
|
|
12519
12554
|
s || null,
|
|
12520
12555
|
n || null
|
|
12521
12556
|
);
|
|
12522
|
-
if (
|
|
12523
|
-
if (
|
|
12557
|
+
if (y != null) {
|
|
12558
|
+
if (y === !1 || typeof y == "object" && y.stop)
|
|
12524
12559
|
return !1;
|
|
12525
|
-
typeof
|
|
12560
|
+
typeof y == "object" && (a = "fetchUrl" in y, o = "fetchOptions" in y, s = a ? y.fetchUrl : s, n = o ? y.fetchOptions : n);
|
|
12526
12561
|
}
|
|
12527
12562
|
}
|
|
12528
12563
|
const l = Object.keys(i).length > 0;
|
|
@@ -12532,13 +12567,13 @@ ${W}
|
|
|
12532
12567
|
i,
|
|
12533
12568
|
e
|
|
12534
12569
|
);
|
|
12535
|
-
const
|
|
12570
|
+
const y = (n?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && xr(n) && !We(y) ? r.baseUrl ?? s : s, A = Nr(
|
|
12536
12571
|
E,
|
|
12537
12572
|
n
|
|
12538
12573
|
);
|
|
12539
12574
|
s = A.url;
|
|
12540
12575
|
const k = { ...A.options }, C = A.normalized ? A.requestedMethod : r.requestedMethod, $ = A.effectiveMethod, ie = r.transportMode === "query-get" || A.normalized, F = A.queryString ?? r.queryString;
|
|
12541
|
-
if (ie &&
|
|
12576
|
+
if (ie && m.info("Haori demo fetch normalization", {
|
|
12542
12577
|
runtime: c.runtime,
|
|
12543
12578
|
requestedMethod: C,
|
|
12544
12579
|
effectiveMethod: $,
|
|
@@ -12728,7 +12763,7 @@ ${W}
|
|
|
12728
12763
|
}
|
|
12729
12764
|
M.setAttribute(t, r.name, r.value).catch(
|
|
12730
12765
|
(i) => {
|
|
12731
|
-
|
|
12766
|
+
m.error(
|
|
12732
12767
|
"Haori",
|
|
12733
12768
|
`ロックの解除で ${r.name} を適用し直せませんでした: ${i}`
|
|
12734
12769
|
);
|
|
@@ -12759,7 +12794,7 @@ ${W}
|
|
|
12759
12794
|
return this.downloadFolder = $e, "ready";
|
|
12760
12795
|
const e = globalThis.showDirectoryPicker;
|
|
12761
12796
|
if (typeof e != "function")
|
|
12762
|
-
return
|
|
12797
|
+
return m.info(
|
|
12763
12798
|
"Haori",
|
|
12764
12799
|
"この環境では保存先のフォルダを選ばせられないため、今までどおり保存します。"
|
|
12765
12800
|
), "fallback";
|
|
@@ -12767,7 +12802,7 @@ ${W}
|
|
|
12767
12802
|
const t = await e.call(globalThis, { mode: "readwrite" });
|
|
12768
12803
|
return $e = t, this.downloadFolder = t, "ready";
|
|
12769
12804
|
} catch (t) {
|
|
12770
|
-
return t?.name === "AbortError" ? "cancelled" : (
|
|
12805
|
+
return t?.name === "AbortError" ? "cancelled" : (m.info(
|
|
12771
12806
|
"Haori",
|
|
12772
12807
|
`保存先のフォルダを選ばせられなかったため、今までどおり保存します: ${t}`
|
|
12773
12808
|
), "fallback");
|
|
@@ -12789,7 +12824,7 @@ ${W}
|
|
|
12789
12824
|
const n = await e.blob();
|
|
12790
12825
|
return this.downloadReceivedBytes = n.size, this.dropTotalBytesIfExceeded(), await this.injectFetchState("loading"), n;
|
|
12791
12826
|
} catch (n) {
|
|
12792
|
-
return
|
|
12827
|
+
return m.error(
|
|
12793
12828
|
"Haori",
|
|
12794
12829
|
`応答をファイルとして読み取れませんでした: ${n}`
|
|
12795
12830
|
), null;
|
|
@@ -12820,10 +12855,10 @@ ${W}
|
|
|
12820
12855
|
break;
|
|
12821
12856
|
await t(n), this.downloadReceivedBytes += n.byteLength, this.dropTotalBytesIfExceeded();
|
|
12822
12857
|
const a = Date.now();
|
|
12823
|
-
a - r >=
|
|
12858
|
+
a - r >= Sr && (r = a, await this.injectFetchState("loading"));
|
|
12824
12859
|
}
|
|
12825
12860
|
} catch (s) {
|
|
12826
|
-
return
|
|
12861
|
+
return m.error("Haori", `応答をファイルとして読み取れませんでした: ${s}`), !1;
|
|
12827
12862
|
}
|
|
12828
12863
|
return !0;
|
|
12829
12864
|
}
|
|
@@ -12889,7 +12924,7 @@ ${W}
|
|
|
12889
12924
|
if (l?.name === "NotFoundError")
|
|
12890
12925
|
n = !1;
|
|
12891
12926
|
else
|
|
12892
|
-
return
|
|
12927
|
+
return m.info(
|
|
12893
12928
|
"Haori",
|
|
12894
12929
|
`保存先のフォルダを確かめられなかったため、今までどおり保存します: ${l}`
|
|
12895
12930
|
), "fallback";
|
|
@@ -12902,7 +12937,7 @@ ${W}
|
|
|
12902
12937
|
try {
|
|
12903
12938
|
a = await (await e.getFileHandle(s, { create: !0 })).createWritable();
|
|
12904
12939
|
} catch (l) {
|
|
12905
|
-
return
|
|
12940
|
+
return m.info(
|
|
12906
12941
|
"Haori",
|
|
12907
12942
|
`保存先のファイルを作れなかったため、今までどおり保存します: ${l}`
|
|
12908
12943
|
), "fallback";
|
|
@@ -12914,18 +12949,18 @@ ${W}
|
|
|
12914
12949
|
try {
|
|
12915
12950
|
return await a.close(), "saved";
|
|
12916
12951
|
} catch (l) {
|
|
12917
|
-
|
|
12952
|
+
m.error("Haori", `ファイルを書き終えられませんでした: ${l}`);
|
|
12918
12953
|
}
|
|
12919
12954
|
try {
|
|
12920
12955
|
await a.abort();
|
|
12921
12956
|
} catch (l) {
|
|
12922
|
-
|
|
12957
|
+
m.error("Haori", `書きかけを取り消せませんでした: ${l}`);
|
|
12923
12958
|
}
|
|
12924
12959
|
if (!n)
|
|
12925
12960
|
try {
|
|
12926
12961
|
await e.removeEntry(s);
|
|
12927
12962
|
} catch (l) {
|
|
12928
|
-
|
|
12963
|
+
m.error(
|
|
12929
12964
|
"Haori",
|
|
12930
12965
|
`作りかけのファイルを取り除けませんでした: ${l}`
|
|
12931
12966
|
);
|
|
@@ -12962,7 +12997,7 @@ ${W}
|
|
|
12962
12997
|
t ?? this.options.fetchUrl ?? null
|
|
12963
12998
|
);
|
|
12964
12999
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function")
|
|
12965
|
-
return
|
|
13000
|
+
return m.error(
|
|
12966
13001
|
"Haori",
|
|
12967
13002
|
"この環境では Blob の URL を生成できないため、ファイルを保存できません。"
|
|
12968
13003
|
), "failed";
|
|
@@ -12981,7 +13016,7 @@ ${W}
|
|
|
12981
13016
|
*/
|
|
12982
13017
|
async showDownloadFailure(e) {
|
|
12983
13018
|
const t = this.resolveMessageScope(), r = be();
|
|
12984
|
-
await r.clearMessages(t), e && await r.addErrorMessage(t,
|
|
13019
|
+
await r.clearMessages(t), e && await r.addErrorMessage(t, kt);
|
|
12985
13020
|
}
|
|
12986
13021
|
/**
|
|
12987
13022
|
* 保存するファイル名を決めます。
|
|
@@ -13024,7 +13059,7 @@ ${W}
|
|
|
13024
13059
|
try {
|
|
13025
13060
|
return decodeURIComponent(a);
|
|
13026
13061
|
} catch (o) {
|
|
13027
|
-
|
|
13062
|
+
m.warn("Haori", `Content-Disposition を解釈できません: ${o}`);
|
|
13028
13063
|
}
|
|
13029
13064
|
}
|
|
13030
13065
|
const r = /filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(e);
|
|
@@ -13066,7 +13101,10 @@ ${W}
|
|
|
13066
13101
|
async handleFetchResult(e, t, r) {
|
|
13067
13102
|
const i = be();
|
|
13068
13103
|
if (!e.ok) {
|
|
13069
|
-
if (
|
|
13104
|
+
if (Xt(e.status, {
|
|
13105
|
+
element: this.options.targetFragment.getTarget(),
|
|
13106
|
+
attrPrefix: g.attrName(this.eventType, "", !0)
|
|
13107
|
+
}))
|
|
13070
13108
|
return !1;
|
|
13071
13109
|
this.options.targetFragment && t && B.fetchError(
|
|
13072
13110
|
this.options.targetFragment.getTarget(),
|
|
@@ -13080,7 +13118,7 @@ ${W}
|
|
|
13080
13118
|
E?.noMessage !== !0 && !A
|
|
13081
13119
|
);
|
|
13082
13120
|
return A && await this.bindResult(e).catch((C) => {
|
|
13083
|
-
|
|
13121
|
+
m.error("Haori", "Failed to bind the error response:", C);
|
|
13084
13122
|
}), await this.injectFetchState(
|
|
13085
13123
|
"error",
|
|
13086
13124
|
e.status,
|
|
@@ -13110,7 +13148,7 @@ ${W}
|
|
|
13110
13148
|
return await this.showDownloadFailure(A?.noMessage !== !0), await this.injectFetchState(
|
|
13111
13149
|
"error",
|
|
13112
13150
|
e.status,
|
|
13113
|
-
|
|
13151
|
+
kt
|
|
13114
13152
|
), await this.runErrorActions(null), !1;
|
|
13115
13153
|
}
|
|
13116
13154
|
}
|
|
@@ -13132,10 +13170,10 @@ ${W}
|
|
|
13132
13170
|
);
|
|
13133
13171
|
if (!a && this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((E) => {
|
|
13134
13172
|
const A = E.getTarget();
|
|
13135
|
-
A instanceof HTMLElement ? n.push(i.openDialog(A)) :
|
|
13173
|
+
A instanceof HTMLElement ? n.push(i.openDialog(A)) : m.error("Haori", "Element is not an HTML element: ", A);
|
|
13136
13174
|
}), !a && this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((E) => {
|
|
13137
13175
|
const A = E.getTarget();
|
|
13138
|
-
A instanceof HTMLElement ? n.push(i.closeDialog(A)) :
|
|
13176
|
+
A instanceof HTMLElement ? n.push(i.closeDialog(A)) : m.error("Haori", "Element is not an HTML element: ", A);
|
|
13139
13177
|
}), await Promise.all(n), a)
|
|
13140
13178
|
return !1;
|
|
13141
13179
|
const o = g.unescapeNewlines(
|
|
@@ -13166,15 +13204,15 @@ ${W}
|
|
|
13166
13204
|
const d = this.resolveLateAttribute(
|
|
13167
13205
|
"redirect",
|
|
13168
13206
|
this.options.redirectUrl
|
|
13169
|
-
),
|
|
13207
|
+
), y = this.resolveLateAttribute(
|
|
13170
13208
|
"redirect-replace",
|
|
13171
13209
|
this.options.redirectReplaceUrl
|
|
13172
13210
|
);
|
|
13173
|
-
d &&
|
|
13211
|
+
d && y && m.warn(
|
|
13174
13212
|
"Haori",
|
|
13175
13213
|
`${g.attrName(this.eventType, "redirect")} と ${g.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
13176
13214
|
);
|
|
13177
|
-
const b =
|
|
13215
|
+
const b = y || d;
|
|
13178
13216
|
if (b) {
|
|
13179
13217
|
let E = b;
|
|
13180
13218
|
const A = this.resolveLateAttribute(
|
|
@@ -13185,13 +13223,13 @@ ${W}
|
|
|
13185
13223
|
const C = new URLSearchParams(window.location.search).get(A);
|
|
13186
13224
|
if (C !== null) {
|
|
13187
13225
|
const $ = C.trim();
|
|
13188
|
-
Le.isSafeLocalPath($) ? E = $ :
|
|
13226
|
+
Le.isSafeLocalPath($) ? E = $ : m.warn(
|
|
13189
13227
|
"Haori",
|
|
13190
13228
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${C}`
|
|
13191
13229
|
);
|
|
13192
13230
|
}
|
|
13193
13231
|
}
|
|
13194
|
-
Le.isNavigableUrl(E) ?
|
|
13232
|
+
Le.isNavigableUrl(E) ? y ? window.location.replace(E) : window.location.href = E : m.error(
|
|
13195
13233
|
"Haori",
|
|
13196
13234
|
`遷移先が http: / https: / 現在ページと同じスキームの URL ではないため遷移しません: ${E}`
|
|
13197
13235
|
);
|
|
@@ -13232,7 +13270,7 @@ ${W}
|
|
|
13232
13270
|
continue;
|
|
13233
13271
|
const n = g.takeClickOutcome(s);
|
|
13234
13272
|
if (n === null) {
|
|
13235
|
-
|
|
13273
|
+
m.warn(
|
|
13236
13274
|
"Haori",
|
|
13237
13275
|
`${c.prefix}${this.eventType ?? "fetch"}-${r} はこの対象の完了を待てません(手続きが同期に起動していません)。`
|
|
13238
13276
|
);
|
|
@@ -13263,7 +13301,7 @@ ${W}
|
|
|
13263
13301
|
const i = be(), s = [];
|
|
13264
13302
|
t.closeFragments?.forEach((a) => {
|
|
13265
13303
|
const o = a.getTarget();
|
|
13266
|
-
o instanceof HTMLElement ? s.push(i.closeDialog(o)) :
|
|
13304
|
+
o instanceof HTMLElement ? s.push(i.closeDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
|
|
13267
13305
|
}), await Promise.all(s);
|
|
13268
13306
|
const n = g.normalizeAttributeText(
|
|
13269
13307
|
this.resolveLateAttribute(`${t.key}-toast`, t.toastMessage)
|
|
@@ -13328,7 +13366,7 @@ ${W}
|
|
|
13328
13366
|
if (!i || !s || !s.hasAttribute(i.attributeName))
|
|
13329
13367
|
return r;
|
|
13330
13368
|
const n = s.getAttributeEvaluation(i.attributeName);
|
|
13331
|
-
return n === null ? r : n.hasUnresolvedReference && !i.hasUnresolvedReference ? (
|
|
13369
|
+
return n === null ? r : n.hasUnresolvedReference && !i.hasUnresolvedReference ? (H.isEnabled() && m.warn(
|
|
13332
13370
|
"Haori",
|
|
13333
13371
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
13334
13372
|
), r) : n.value ?? null;
|
|
@@ -13350,20 +13388,20 @@ ${W}
|
|
|
13350
13388
|
const a = t ? e : window.location.pathname, o = new URL(a, window.location.href);
|
|
13351
13389
|
if (o.origin !== window.location.origin) {
|
|
13352
13390
|
const u = "history.pushState: cross-origin URL is not allowed: " + o.toString();
|
|
13353
|
-
|
|
13391
|
+
m.error("Haori", u);
|
|
13354
13392
|
return;
|
|
13355
13393
|
}
|
|
13356
13394
|
const l = (u) => {
|
|
13357
|
-
for (const [d,
|
|
13358
|
-
|
|
13395
|
+
for (const [d, y] of Object.entries(u))
|
|
13396
|
+
y != null && (Array.isArray(y) ? (o.searchParams.delete(d), y.forEach((b) => o.searchParams.append(d, String(b)))) : typeof y == "object" ? o.searchParams.set(d, JSON.stringify(y)) : o.searchParams.set(d, String(y)));
|
|
13359
13397
|
};
|
|
13360
13398
|
s && l(r), n && l(i), history.pushState(
|
|
13361
|
-
{ [
|
|
13399
|
+
{ [wr]: !0 },
|
|
13362
13400
|
"",
|
|
13363
13401
|
o.toString()
|
|
13364
13402
|
), M.refreshUrlParams();
|
|
13365
13403
|
} catch (a) {
|
|
13366
|
-
|
|
13404
|
+
m.error("Haori", `history.pushState failed: ${a}`);
|
|
13367
13405
|
}
|
|
13368
13406
|
}
|
|
13369
13407
|
/**
|
|
@@ -13417,35 +13455,35 @@ ${W}
|
|
|
13417
13455
|
try {
|
|
13418
13456
|
const u = await e.json(), d = [];
|
|
13419
13457
|
if (Array.isArray(u)) {
|
|
13420
|
-
const
|
|
13458
|
+
const y = /* @__PURE__ */ new Map(), b = [];
|
|
13421
13459
|
for (const E of u)
|
|
13422
13460
|
if (E && typeof E == "object" && !Array.isArray(E)) {
|
|
13423
13461
|
const A = E.key, k = E.message, C = typeof A == "string" && A.length > 0 ? A : null, $ = typeof k == "string" ? k : k != null ? String(k) : "";
|
|
13424
13462
|
if ($.length === 0)
|
|
13425
13463
|
continue;
|
|
13426
13464
|
if (C !== null) {
|
|
13427
|
-
const ie =
|
|
13428
|
-
ie.push($),
|
|
13465
|
+
const ie = y.get(C) ?? [];
|
|
13466
|
+
ie.push($), y.set(C, ie);
|
|
13429
13467
|
} else
|
|
13430
13468
|
b.push($);
|
|
13431
13469
|
} else typeof E == "string" && E.length > 0 && b.push(E);
|
|
13432
|
-
for (const [E, A] of
|
|
13470
|
+
for (const [E, A] of y)
|
|
13433
13471
|
d.push({ key: E, message: A.join(`
|
|
13434
13472
|
`) });
|
|
13435
13473
|
for (const E of b)
|
|
13436
13474
|
d.push({ message: E });
|
|
13437
13475
|
} else if (u && typeof u == "object") {
|
|
13438
13476
|
if (typeof u.message == "string" && d.push({ message: u.message }), Array.isArray(u.messages))
|
|
13439
|
-
for (const
|
|
13440
|
-
typeof
|
|
13477
|
+
for (const y of u.messages)
|
|
13478
|
+
typeof y == "string" && d.push({ message: y });
|
|
13441
13479
|
if (u.errors && typeof u.errors == "object")
|
|
13442
|
-
for (const [
|
|
13443
|
-
Array.isArray(b) ? d.push({ key:
|
|
13444
|
-
`) }) : typeof b == "string" ? d.push({ key:
|
|
13480
|
+
for (const [y, b] of Object.entries(u.errors))
|
|
13481
|
+
Array.isArray(b) ? d.push({ key: y, message: b.join(`
|
|
13482
|
+
`) }) : typeof b == "string" ? d.push({ key: y, message: b }) : b != null && d.push({ key: y, message: String(b) });
|
|
13445
13483
|
if (d.length === 0)
|
|
13446
|
-
for (const [
|
|
13447
|
-
|
|
13448
|
-
`) }) : typeof b == "string" && d.push({ key:
|
|
13484
|
+
for (const [y, b] of Object.entries(u))
|
|
13485
|
+
y === "message" || y === "messages" || y === "errors" || (Array.isArray(b) ? d.push({ key: y, message: b.join(`
|
|
13486
|
+
`) }) : typeof b == "string" && d.push({ key: y, message: b }));
|
|
13449
13487
|
}
|
|
13450
13488
|
return await a(d);
|
|
13451
13489
|
} catch {
|
|
@@ -13565,10 +13603,10 @@ ${W}
|
|
|
13565
13603
|
r,
|
|
13566
13604
|
this.options.formFragment ?? null
|
|
13567
13605
|
), n = se.evaluateDetailed(t, s);
|
|
13568
|
-
return n.unresolvedReference ? (e ||
|
|
13606
|
+
return n.unresolvedReference ? (e || m.warn(
|
|
13569
13607
|
"Haori",
|
|
13570
13608
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
13571
|
-
), !1) : n.value ? !0 : (e ||
|
|
13609
|
+
), !1) : n.value ? !0 : (e || m.info(
|
|
13572
13610
|
"Haori",
|
|
13573
13611
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
13574
13612
|
), !1);
|
|
@@ -13630,7 +13668,7 @@ ${W}
|
|
|
13630
13668
|
response: i
|
|
13631
13669
|
});
|
|
13632
13670
|
} catch (o) {
|
|
13633
|
-
|
|
13671
|
+
m.error("Haori", `Invalid bind-transform: ${o}`);
|
|
13634
13672
|
}
|
|
13635
13673
|
if (this.options.bindParams) {
|
|
13636
13674
|
const o = {};
|
|
@@ -13639,7 +13677,7 @@ ${W}
|
|
|
13639
13677
|
}), i = o;
|
|
13640
13678
|
}
|
|
13641
13679
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
13642
|
-
|
|
13680
|
+
m.warn(
|
|
13643
13681
|
"Haori",
|
|
13644
13682
|
`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 ${c.prefix}${this.eventType}-form.`
|
|
13645
13683
|
);
|
|
@@ -13652,7 +13690,7 @@ ${W}
|
|
|
13652
13690
|
if (l.kind === "skip")
|
|
13653
13691
|
return;
|
|
13654
13692
|
if (l.kind === "row") {
|
|
13655
|
-
const
|
|
13693
|
+
const y = this.options.bindArg;
|
|
13656
13694
|
a.push({
|
|
13657
13695
|
container: l.container,
|
|
13658
13696
|
row: o,
|
|
@@ -13661,14 +13699,14 @@ ${W}
|
|
|
13661
13699
|
apply: (b) => {
|
|
13662
13700
|
const E = this.resolveCurrentRowItem(o, b), A = { ...E };
|
|
13663
13701
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
13664
|
-
const k = E[
|
|
13665
|
-
A[
|
|
13702
|
+
const k = E[y], C = k !== null && typeof k == "object" && !Array.isArray(k) ? k : {};
|
|
13703
|
+
A[y] = this.mergeAppendBindingData(
|
|
13666
13704
|
o,
|
|
13667
13705
|
i,
|
|
13668
13706
|
C
|
|
13669
13707
|
);
|
|
13670
13708
|
} else
|
|
13671
|
-
A[
|
|
13709
|
+
A[y] = i;
|
|
13672
13710
|
return this.reconcileRowUserEdits(o, A);
|
|
13673
13711
|
}
|
|
13674
13712
|
});
|
|
@@ -13676,7 +13714,7 @@ ${W}
|
|
|
13676
13714
|
}
|
|
13677
13715
|
const u = { ...o.getRawBindingData() ?? {} }, d = this.options.bindArg;
|
|
13678
13716
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
13679
|
-
const
|
|
13717
|
+
const y = u[d], b = y && typeof y == "object" && !Array.isArray(y) ? y : {};
|
|
13680
13718
|
u[d] = this.mergeAppendBindingData(
|
|
13681
13719
|
o,
|
|
13682
13720
|
i,
|
|
@@ -13707,13 +13745,13 @@ ${W}
|
|
|
13707
13745
|
});
|
|
13708
13746
|
else if (typeof i == "string") {
|
|
13709
13747
|
if (this.options.defaultSelfBind) {
|
|
13710
|
-
|
|
13748
|
+
m.warn(
|
|
13711
13749
|
"Haori",
|
|
13712
13750
|
"string data is not bound because no bind target was specified."
|
|
13713
13751
|
);
|
|
13714
13752
|
return;
|
|
13715
13753
|
}
|
|
13716
|
-
return
|
|
13754
|
+
return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
13717
13755
|
new Error("string data cannot be bound without a bindArg.")
|
|
13718
13756
|
);
|
|
13719
13757
|
} else
|
|
@@ -13727,8 +13765,8 @@ ${W}
|
|
|
13727
13765
|
row: o,
|
|
13728
13766
|
attributeName: n,
|
|
13729
13767
|
syncWhenUnchanged: "reflect",
|
|
13730
|
-
apply: (
|
|
13731
|
-
const b = this.options.bindMerge ? this.resolveCurrentRowItem(o,
|
|
13768
|
+
apply: (y) => {
|
|
13769
|
+
const b = this.options.bindMerge ? this.resolveCurrentRowItem(o, y) : y, E = this.mergeAppendBindingData(
|
|
13732
13770
|
o,
|
|
13733
13771
|
i,
|
|
13734
13772
|
b
|
|
@@ -14051,31 +14089,31 @@ ${W}
|
|
|
14051
14089
|
), a = (s.method || "GET").toUpperCase(), o = c.runtime === "demo" && !We(a), l = o ? "GET" : a;
|
|
14052
14090
|
if (s.method = l, Object.keys(t).length > 0 && Be(t)) {
|
|
14053
14091
|
const d = n.get("Content-Type") || "";
|
|
14054
|
-
!We(a) && /multipart\/form-data/i.test(d) ?
|
|
14092
|
+
!We(a) && /multipart\/form-data/i.test(d) ? Fr(t) && m.warn(
|
|
14055
14093
|
"Haori",
|
|
14056
14094
|
`A File value nested under ${c.prefix}form-object / ${c.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
14057
|
-
) :
|
|
14095
|
+
) : m.warn(
|
|
14058
14096
|
"Haori",
|
|
14059
14097
|
`A File value cannot be sent without ${c.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
14060
14098
|
);
|
|
14061
14099
|
}
|
|
14062
14100
|
if (l === "GET" || l === "HEAD" || l === "OPTIONS")
|
|
14063
|
-
Object.keys(t).length > 0 && (i =
|
|
14101
|
+
Object.keys(t).length > 0 && (i = Jt(i, t));
|
|
14064
14102
|
else if (Object.keys(t).length > 0) {
|
|
14065
14103
|
const d = n.get("Content-Type") || "";
|
|
14066
14104
|
if (/multipart\/form-data/i.test(d)) {
|
|
14067
14105
|
n.delete("Content-Type");
|
|
14068
|
-
const
|
|
14106
|
+
const y = new FormData();
|
|
14069
14107
|
for (const [b, E] of Object.entries(t))
|
|
14070
|
-
E == null ?
|
|
14071
|
-
A instanceof Blob ?
|
|
14072
|
-
}) :
|
|
14073
|
-
s.body =
|
|
14108
|
+
E == null ? y.append(b, "") : E instanceof Blob ? y.append(b, E) : Array.isArray(E) ? E.forEach((A) => {
|
|
14109
|
+
A instanceof Blob ? y.append(b, A) : y.append(b, Ne(A));
|
|
14110
|
+
}) : y.append(b, Ne(E));
|
|
14111
|
+
s.body = y;
|
|
14074
14112
|
} else if (/application\/x-www-form-urlencoded/i.test(d)) {
|
|
14075
|
-
const
|
|
14113
|
+
const y = new URLSearchParams();
|
|
14076
14114
|
for (const [b, E] of Object.entries(t))
|
|
14077
|
-
E !== void 0 && (Array.isArray(E) ? E.forEach((A) =>
|
|
14078
|
-
s.body =
|
|
14115
|
+
E !== void 0 && (Array.isArray(E) ? E.forEach((A) => y.append(b, Ne(A))) : y.append(b, Ne(E)));
|
|
14116
|
+
s.body = y;
|
|
14079
14117
|
} else
|
|
14080
14118
|
n.set("Content-Type", "application/json"), s.body = JSON.stringify(t);
|
|
14081
14119
|
}
|
|
@@ -14091,7 +14129,7 @@ ${W}
|
|
|
14091
14129
|
effectiveMethod: l,
|
|
14092
14130
|
queryString: u,
|
|
14093
14131
|
transportMode: o ? "query-get" : "http",
|
|
14094
|
-
signature:
|
|
14132
|
+
signature: Cr(i, s)
|
|
14095
14133
|
};
|
|
14096
14134
|
}
|
|
14097
14135
|
/**
|
|
@@ -14171,11 +14209,11 @@ ${W}
|
|
|
14171
14209
|
*/
|
|
14172
14210
|
getRowFragment() {
|
|
14173
14211
|
if (!this.options.targetFragment)
|
|
14174
|
-
return
|
|
14212
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
14175
14213
|
const e = this.options.targetFragment.closestByAttribute(
|
|
14176
14214
|
`${c.prefix}row`
|
|
14177
14215
|
);
|
|
14178
|
-
return e || (
|
|
14216
|
+
return e || (m.error("Haori", "Row fragment not found."), null);
|
|
14179
14217
|
}
|
|
14180
14218
|
/**
|
|
14181
14219
|
* 行操作の対象となる `data-each` コンテナを解決します。
|
|
@@ -14191,20 +14229,20 @@ ${W}
|
|
|
14191
14229
|
resolveRowContainer(e) {
|
|
14192
14230
|
const t = this.options.targetFragment;
|
|
14193
14231
|
if (!t)
|
|
14194
|
-
return
|
|
14232
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
14195
14233
|
const r = g.attrName(this.eventType, e), i = K.read(t, r);
|
|
14196
14234
|
if (i !== null && i.trim() !== "") {
|
|
14197
14235
|
const n = K.query(i, r, document);
|
|
14198
14236
|
if (n === null)
|
|
14199
|
-
return
|
|
14237
|
+
return m.error(
|
|
14200
14238
|
"Haori",
|
|
14201
14239
|
`Row container not found: ${i} (${r})`
|
|
14202
14240
|
), null;
|
|
14203
14241
|
const a = D.get(n);
|
|
14204
|
-
return a instanceof R ? a.hasAttribute(`${c.prefix}each`) ? a : (
|
|
14242
|
+
return a instanceof R ? a.hasAttribute(`${c.prefix}each`) ? a : (m.error(
|
|
14205
14243
|
"Haori",
|
|
14206
14244
|
`Row container must have ${c.prefix}each: ${i} (${r})`
|
|
14207
|
-
), null) : (
|
|
14245
|
+
), null) : (m.error(
|
|
14208
14246
|
"Haori",
|
|
14209
14247
|
`Row container is not initialized: ${i} (${r})`
|
|
14210
14248
|
), null);
|
|
@@ -14231,45 +14269,45 @@ ${W}
|
|
|
14231
14269
|
static resolveEachArray(e, t = !1) {
|
|
14232
14270
|
const r = e.getRawAttribute(`${c.prefix}each`);
|
|
14233
14271
|
if (r === null)
|
|
14234
|
-
return t ||
|
|
14272
|
+
return t || m.error(
|
|
14235
14273
|
"Haori",
|
|
14236
14274
|
`Row container has no ${c.prefix}each expression.`
|
|
14237
14275
|
), null;
|
|
14238
14276
|
const i = e.getRawAttribute(`${c.prefix}each-array`), s = i !== null, n = s ? `${c.prefix}each-array` : `${c.prefix}each`, a = s ? i : r, o = a.trim().split(".");
|
|
14239
14277
|
if (!(o.length > 0 && o.every((A) => /^[A-Za-z_$][\w$]*$/.test(A))))
|
|
14240
|
-
return t ||
|
|
14278
|
+
return t || m.error(
|
|
14241
14279
|
"Haori",
|
|
14242
14280
|
`Row operations require a plain identifier path for ${n} (got: ${a}).` + (s ? "" : ` Declare ${c.prefix}each-array to specify the array to write back to.`)
|
|
14243
14281
|
), null;
|
|
14244
14282
|
if (s && e.getRawAttribute(`${c.prefix}each-key`) === null)
|
|
14245
|
-
return t ||
|
|
14283
|
+
return t || m.error(
|
|
14246
14284
|
"Haori",
|
|
14247
14285
|
`${c.prefix}each-array requires ${c.prefix}each-key (${c.prefix}each-array="${a}").`
|
|
14248
14286
|
), null;
|
|
14249
14287
|
const u = g.resolveRowScopeBase(e, o[0]);
|
|
14250
14288
|
if (u === "unresolvable")
|
|
14251
14289
|
return null;
|
|
14252
|
-
let d,
|
|
14290
|
+
let d, y, b;
|
|
14253
14291
|
if (u)
|
|
14254
|
-
d = u.owner,
|
|
14292
|
+
d = u.owner, y = u.ownerData, b = [...u.path, ...o.slice(1)];
|
|
14255
14293
|
else {
|
|
14256
|
-
for (d = e,
|
|
14294
|
+
for (d = e, y = null; d; ) {
|
|
14257
14295
|
const A = d.getRawBindingData();
|
|
14258
14296
|
if (A && o[0] in A && !g.isRowScopeKey(d, o[0])) {
|
|
14259
|
-
|
|
14297
|
+
y = A;
|
|
14260
14298
|
break;
|
|
14261
14299
|
}
|
|
14262
14300
|
d = d.getParent();
|
|
14263
14301
|
}
|
|
14264
14302
|
b = o;
|
|
14265
14303
|
}
|
|
14266
|
-
if (!d || !
|
|
14267
|
-
return t ||
|
|
14304
|
+
if (!d || !y)
|
|
14305
|
+
return t || m.error(
|
|
14268
14306
|
"Haori",
|
|
14269
14307
|
`Binding data owner not found for ${n}="${a}".`
|
|
14270
14308
|
), null;
|
|
14271
|
-
const E = g.readPathValue(
|
|
14272
|
-
return Array.isArray(E) ? { owner: d, ownerData:
|
|
14309
|
+
const E = g.readPathValue(y, b);
|
|
14310
|
+
return Array.isArray(E) ? { owner: d, ownerData: y, array: E, path: b, mapped: s } : (t || m.error(
|
|
14273
14311
|
"Haori",
|
|
14274
14312
|
`${n}="${a}" does not resolve to an array.`
|
|
14275
14313
|
), null);
|
|
@@ -14302,7 +14340,7 @@ ${W}
|
|
|
14302
14340
|
if (s.getAttribute(`${c.prefix}each-arg`) === t) {
|
|
14303
14341
|
const n = g.resolveEachArray(s, !0);
|
|
14304
14342
|
if (!n)
|
|
14305
|
-
return
|
|
14343
|
+
return m.error(
|
|
14306
14344
|
"Haori",
|
|
14307
14345
|
`Row operations cannot resolve the write-back array for ${c.prefix}each="${e.getRawAttribute(
|
|
14308
14346
|
`${c.prefix}each`
|
|
@@ -14413,10 +14451,10 @@ ${W}
|
|
|
14413
14451
|
if (!r || !r.has(e))
|
|
14414
14452
|
return { kind: "plain" };
|
|
14415
14453
|
const i = r.get(e) ?? null;
|
|
14416
|
-
return i === null ? (
|
|
14454
|
+
return i === null ? (m.warn(
|
|
14417
14455
|
"Haori",
|
|
14418
14456
|
`Target is not a row of the ${c.prefix}each container (${t}).`
|
|
14419
|
-
), { kind: "skip" }) : g.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (
|
|
14457
|
+
), { kind: "skip" }) : g.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (m.warn(
|
|
14420
14458
|
"Haori",
|
|
14421
14459
|
`The target row is no longer in the ${c.prefix}each container; the write was skipped (${t}).`
|
|
14422
14460
|
), { kind: "skip" });
|
|
@@ -14449,16 +14487,16 @@ ${W}
|
|
|
14449
14487
|
const d = g.resolveRowArrayIndex(u, a);
|
|
14450
14488
|
if (d === null)
|
|
14451
14489
|
continue;
|
|
14452
|
-
const
|
|
14453
|
-
if (
|
|
14454
|
-
|
|
14490
|
+
const y = a[d];
|
|
14491
|
+
if (y === null || typeof y != "object" || Array.isArray(y)) {
|
|
14492
|
+
m.warn(
|
|
14455
14493
|
"Haori",
|
|
14456
14494
|
`Row data is not an object; the write was skipped (${u.attributeName}).`
|
|
14457
14495
|
);
|
|
14458
14496
|
continue;
|
|
14459
14497
|
}
|
|
14460
|
-
const b = u.apply(
|
|
14461
|
-
if (g.isSameRowItem(
|
|
14498
|
+
const b = u.apply(y);
|
|
14499
|
+
if (g.isSameRowItem(y, b)) {
|
|
14462
14500
|
u.syncWhenUnchanged && r.push(
|
|
14463
14501
|
g.syncUnchangedRowValues(
|
|
14464
14502
|
u.row,
|
|
@@ -14490,7 +14528,7 @@ ${W}
|
|
|
14490
14528
|
);
|
|
14491
14529
|
if (M.isEachUpdateRunning(s)) {
|
|
14492
14530
|
l.catch((u) => {
|
|
14493
|
-
|
|
14531
|
+
m.error("Haori", "Failed to write row data.", u);
|
|
14494
14532
|
});
|
|
14495
14533
|
return;
|
|
14496
14534
|
}
|
|
@@ -14576,27 +14614,27 @@ ${W}
|
|
|
14576
14614
|
static resolveRowIndex(e, t, r, i) {
|
|
14577
14615
|
const s = g.getRowFragments(e), n = s.indexOf(t);
|
|
14578
14616
|
if (n === -1)
|
|
14579
|
-
return
|
|
14617
|
+
return m.warn(
|
|
14580
14618
|
"Haori",
|
|
14581
14619
|
`The target row is no longer in the ${c.prefix}each container; the write was skipped (${i}).`
|
|
14582
14620
|
), null;
|
|
14583
14621
|
const a = e.getAttribute(`${c.prefix}each-key`), o = t.getListKey();
|
|
14584
14622
|
if (a && o !== null) {
|
|
14585
14623
|
const l = [];
|
|
14586
|
-
r.forEach((
|
|
14624
|
+
r.forEach((y, b) => {
|
|
14587
14625
|
M.createListKey(
|
|
14588
|
-
|
|
14626
|
+
y,
|
|
14589
14627
|
String(a),
|
|
14590
14628
|
b
|
|
14591
14629
|
) === o && l.push(b);
|
|
14592
14630
|
});
|
|
14593
|
-
const u = s.slice(0, n).filter((
|
|
14594
|
-
return d === -1 ? (
|
|
14631
|
+
const u = s.slice(0, n).filter((y) => y.getListKey() === o).length, d = l[u] ?? -1;
|
|
14632
|
+
return d === -1 ? (m.warn(
|
|
14595
14633
|
"Haori",
|
|
14596
14634
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
14597
14635
|
), null) : d;
|
|
14598
14636
|
}
|
|
14599
|
-
return n >= r.length ? (
|
|
14637
|
+
return n >= r.length ? (m.warn(
|
|
14600
14638
|
"Haori",
|
|
14601
14639
|
`The target row index is out of range; the write was skipped (${i}).`
|
|
14602
14640
|
), null) : n;
|
|
@@ -14695,14 +14733,14 @@ ${W}
|
|
|
14695
14733
|
() => l(o + 1)
|
|
14696
14734
|
))
|
|
14697
14735
|
return Promise.resolve();
|
|
14698
|
-
const
|
|
14736
|
+
const y = /* @__PURE__ */ new Map();
|
|
14699
14737
|
return a.forEach((b) => {
|
|
14700
14738
|
const E = b.getListKey();
|
|
14701
|
-
E !== null && !
|
|
14739
|
+
E !== null && !y.has(String(E)) && y.set(String(E), b);
|
|
14702
14740
|
}), d.forEach((b, E) => {
|
|
14703
14741
|
if (g.isSameRowItem(i.array[E], b))
|
|
14704
14742
|
return;
|
|
14705
|
-
const A =
|
|
14743
|
+
const A = y.get(
|
|
14706
14744
|
M.createListKey(
|
|
14707
14745
|
b,
|
|
14708
14746
|
null,
|
|
@@ -14768,7 +14806,7 @@ ${W}
|
|
|
14768
14806
|
};
|
|
14769
14807
|
g.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, g.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/, g.RUNNING_CLICK_TARGETS = /* @__PURE__ */ new WeakSet(), g.CLICK_OUTCOMES = /* @__PURE__ */ new WeakMap(), g.validationReportGeneration = 0, g.VALIDATION_SCROLL_TIMEOUT_MS = 1e3, g.VALIDATION_SCROLL_STABLE_FRAMES = 2;
|
|
14770
14808
|
let de = g;
|
|
14771
|
-
class
|
|
14809
|
+
class Mr {
|
|
14772
14810
|
/**
|
|
14773
14811
|
* 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
|
|
14774
14812
|
*
|
|
@@ -14779,31 +14817,32 @@ class Cr {
|
|
|
14779
14817
|
*
|
|
14780
14818
|
* @param url 取得先の URL
|
|
14781
14819
|
* @param init fetch のオプション(任意)
|
|
14820
|
+
* @param declaration 認証ガードの宣言を読む取得の要素(任意)
|
|
14782
14821
|
* @returns body 内の HTML 文字列
|
|
14783
14822
|
*/
|
|
14784
|
-
static async load(e, t) {
|
|
14785
|
-
let
|
|
14823
|
+
static async load(e, t, r = null) {
|
|
14824
|
+
let i;
|
|
14786
14825
|
try {
|
|
14787
|
-
|
|
14788
|
-
} catch (
|
|
14789
|
-
throw
|
|
14826
|
+
i = await fetch(e, t);
|
|
14827
|
+
} catch (n) {
|
|
14828
|
+
throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
14790
14829
|
}
|
|
14791
|
-
if (!
|
|
14792
|
-
|
|
14793
|
-
const
|
|
14794
|
-
throw
|
|
14830
|
+
if (!i.ok) {
|
|
14831
|
+
Xt(i.status, r);
|
|
14832
|
+
const n = `${i.status} ${i.statusText}`;
|
|
14833
|
+
throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
14795
14834
|
}
|
|
14796
|
-
let
|
|
14835
|
+
let s;
|
|
14797
14836
|
try {
|
|
14798
|
-
|
|
14799
|
-
} catch (
|
|
14800
|
-
throw
|
|
14837
|
+
s = await i.text();
|
|
14838
|
+
} catch (n) {
|
|
14839
|
+
throw m.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
14801
14840
|
}
|
|
14802
14841
|
try {
|
|
14803
|
-
const
|
|
14804
|
-
return
|
|
14805
|
-
} catch (
|
|
14806
|
-
return
|
|
14842
|
+
const a = new DOMParser().parseFromString(s, "text/html");
|
|
14843
|
+
return a && a.body ? a.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), s);
|
|
14844
|
+
} catch (n) {
|
|
14845
|
+
return m.error("[Haori]", "Failed to parse imported HTML:", e, n), s;
|
|
14807
14846
|
}
|
|
14808
14847
|
}
|
|
14809
14848
|
}
|
|
@@ -14979,7 +15018,7 @@ const h = class h {
|
|
|
14979
15018
|
const r = e.getTarget();
|
|
14980
15019
|
if (!t && h.initialValueRestores.size > 0 && e.hasAttribute(`${c.prefix}fetch-form`))
|
|
14981
15020
|
return Promise.all(h.initialValueRestores).then(() => h.executeManagedFetch(e, !0)).catch((a) => {
|
|
14982
|
-
|
|
15021
|
+
m.error("Haori", `初期表示の取得に失敗しました: ${a}`);
|
|
14983
15022
|
}), Promise.resolve();
|
|
14984
15023
|
const i = h.getReactiveFetchState(r), s = de.resolveAutoFetchSignature(e);
|
|
14985
15024
|
if (i.running)
|
|
@@ -14991,6 +15030,7 @@ const h = class h {
|
|
|
14991
15030
|
i.lastSignature = s.signature, i.running = !0;
|
|
14992
15031
|
const n = new de(e, null);
|
|
14993
15032
|
return n.markReentrantBind(), n.runWithResult().then(() => {
|
|
15033
|
+
}).catch(() => {
|
|
14994
15034
|
}).finally(() => {
|
|
14995
15035
|
if (i.running = !1, i.rerunRequested)
|
|
14996
15036
|
return i.rerunRequested = !1, h.executeManagedFetch(e);
|
|
@@ -15014,7 +15054,10 @@ const h = class h {
|
|
|
15014
15054
|
return Promise.resolve();
|
|
15015
15055
|
r.lastUrl = s, r.running = !0;
|
|
15016
15056
|
const n = performance.now();
|
|
15017
|
-
return t.setAttribute(`${c.prefix}importing`, ""), B.importStart(t, s),
|
|
15057
|
+
return t.setAttribute(`${c.prefix}importing`, ""), B.importStart(t, s), Mr.load(s, void 0, {
|
|
15058
|
+
element: t,
|
|
15059
|
+
attrPrefix: `${c.prefix}import-`
|
|
15060
|
+
}).then((a) => {
|
|
15018
15061
|
const o = new TextEncoder().encode(a).length;
|
|
15019
15062
|
return J.enqueue(() => {
|
|
15020
15063
|
t.innerHTML = a;
|
|
@@ -15027,7 +15070,7 @@ const h = class h {
|
|
|
15027
15070
|
});
|
|
15028
15071
|
});
|
|
15029
15072
|
}).catch((a) => {
|
|
15030
|
-
t.removeAttribute(`${c.prefix}importing`), B.importError(t, s, a),
|
|
15073
|
+
t.removeAttribute(`${c.prefix}importing`), B.importError(t, s, a), m.error("[Haori]", "Failed to import HTML:", s, a);
|
|
15031
15074
|
}).finally(() => {
|
|
15032
15075
|
if (r.running = !1, r.rerunRequested)
|
|
15033
15076
|
return r.rerunRequested = !1, h.executeManagedImport(e);
|
|
@@ -15237,22 +15280,22 @@ const h = class h {
|
|
|
15237
15280
|
case `${c.prefix}bind`: {
|
|
15238
15281
|
if (r !== null && i && n instanceof R && n.consumeSelfWrittenBind(r))
|
|
15239
15282
|
break;
|
|
15240
|
-
const
|
|
15283
|
+
const y = r === null ? {} : h.parseDataBind(r);
|
|
15241
15284
|
if (i) {
|
|
15242
15285
|
const b = s ?? R.nextSequence();
|
|
15243
15286
|
return r === null ? (o.push(
|
|
15244
|
-
h.setBindingData(e,
|
|
15287
|
+
h.setBindingData(e, y, {
|
|
15245
15288
|
reflectToAttribute: !1,
|
|
15246
15289
|
sequence: b
|
|
15247
15290
|
})
|
|
15248
15291
|
), o.push(n.removeAttribute(t))) : o.push(
|
|
15249
|
-
h.setBindingData(e,
|
|
15292
|
+
h.setBindingData(e, y, {
|
|
15250
15293
|
sequence: b
|
|
15251
15294
|
})
|
|
15252
15295
|
), Promise.all(o).then(() => {
|
|
15253
15296
|
});
|
|
15254
15297
|
}
|
|
15255
|
-
r === null && n.clearBindingDataCache(), n.setBindingData(
|
|
15298
|
+
r === null && n.clearBindingDataCache(), n.setBindingData(y);
|
|
15256
15299
|
break;
|
|
15257
15300
|
}
|
|
15258
15301
|
case `${c.prefix}derive`:
|
|
@@ -15299,8 +15342,8 @@ const h = class h {
|
|
|
15299
15342
|
return r !== null && x.applyCustomValidity(n), Promise.all(o).then(() => {
|
|
15300
15343
|
});
|
|
15301
15344
|
case `${c.prefix}url-param`: {
|
|
15302
|
-
const
|
|
15303
|
-
|
|
15345
|
+
const y = n.getAttribute(`${c.prefix}url-arg`), b = Le.readParams();
|
|
15346
|
+
y === null && n.hasAttribute(`${c.prefix}store`) && m.warn(
|
|
15304
15347
|
"Haori",
|
|
15305
15348
|
`${c.prefix}url-param を ${c.prefix}url-arg なしで ${c.prefix}store と併用すると復元した値が消えます(${c.prefix}url-arg を指定してください)。`
|
|
15306
15349
|
);
|
|
@@ -15309,11 +15352,11 @@ const h = class h {
|
|
|
15309
15352
|
kind: "nonSupply",
|
|
15310
15353
|
sequence: R.nextSequence()
|
|
15311
15354
|
};
|
|
15312
|
-
if (
|
|
15355
|
+
if (y === null)
|
|
15313
15356
|
o.push(h.setBindingData(e, b, E));
|
|
15314
15357
|
else {
|
|
15315
15358
|
const A = n.getRawBindingData() || {};
|
|
15316
|
-
A[String(
|
|
15359
|
+
A[String(y)] = b, o.push(h.setBindingData(e, A, E));
|
|
15317
15360
|
}
|
|
15318
15361
|
break;
|
|
15319
15362
|
}
|
|
@@ -15322,8 +15365,8 @@ const h = class h {
|
|
|
15322
15365
|
() => d === null ? void 0 : d()
|
|
15323
15366
|
).then(() => {
|
|
15324
15367
|
if (l !== null)
|
|
15325
|
-
return n.setDeriveInputSignature(u), l.then((
|
|
15326
|
-
if (
|
|
15368
|
+
return n.setDeriveInputSignature(u), l.then((y) => {
|
|
15369
|
+
if (y)
|
|
15327
15370
|
return h.reevaluateChildren(n);
|
|
15328
15371
|
});
|
|
15329
15372
|
}).then(() => {
|
|
@@ -15362,7 +15405,7 @@ const h = class h {
|
|
|
15362
15405
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
15363
15406
|
}, d = o === "supply";
|
|
15364
15407
|
d && i.markSupplyApplied(l);
|
|
15365
|
-
const
|
|
15408
|
+
const y = R.currentSequence(), b = i.getRawBindingData();
|
|
15366
15409
|
d && (r.clearUserEdits ?? !0) && h.clearUserEditMarks(i, l);
|
|
15367
15410
|
const E = a ? h.resolveByPathAuthority(i, b, t, u) : t;
|
|
15368
15411
|
i.setBindingData(E), a && (B.bindChange(e, b, E, "manual"), Oe.mirror(i));
|
|
@@ -15374,7 +15417,7 @@ const h = class h {
|
|
|
15374
15417
|
JSON.stringify(h.withoutReservedBindingKeys(k))
|
|
15375
15418
|
) : Promise.resolve();
|
|
15376
15419
|
return e.tagName === "FORM" && (C = C.then(() => {
|
|
15377
|
-
if (i.wasResetAfter(
|
|
15420
|
+
if (i.wasResetAfter(y))
|
|
15378
15421
|
return;
|
|
15379
15422
|
const $ = i.getRawBindingData() ?? E;
|
|
15380
15423
|
return x.syncValues(
|
|
@@ -15384,9 +15427,9 @@ const h = class h {
|
|
|
15384
15427
|
u
|
|
15385
15428
|
);
|
|
15386
15429
|
})), C = C.then(
|
|
15387
|
-
() => x.syncAncestorArgForms(i,
|
|
15430
|
+
() => x.syncAncestorArgForms(i, y, u, b)
|
|
15388
15431
|
), C = C.then(() => h.evaluateAll(i, s)), C = C.then(
|
|
15389
|
-
() => R.retryUnappliedValueWrites(e,
|
|
15432
|
+
() => R.retryUnappliedValueWrites(e, y)
|
|
15390
15433
|
), C = C.then(
|
|
15391
15434
|
() => h.reevaluateReactiveSpecialAttributes(i, s)
|
|
15392
15435
|
), C.then(
|
|
@@ -15456,26 +15499,26 @@ const h = class h {
|
|
|
15456
15499
|
*/
|
|
15457
15500
|
static mergePathAuthority(e, t, r, i, s, n) {
|
|
15458
15501
|
if (h.isPlainRecord(t) && h.isPlainRecord(r)) {
|
|
15459
|
-
const d = t,
|
|
15502
|
+
const d = t, y = r, b = {};
|
|
15460
15503
|
let E = Object.keys(d).some(
|
|
15461
|
-
(k) => !Object.prototype.hasOwnProperty.call(
|
|
15504
|
+
(k) => !Object.prototype.hasOwnProperty.call(y, k)
|
|
15462
15505
|
);
|
|
15463
15506
|
const A = /* @__PURE__ */ new Set([
|
|
15464
15507
|
...Object.keys(d),
|
|
15465
|
-
...Object.keys(
|
|
15508
|
+
...Object.keys(y)
|
|
15466
15509
|
]);
|
|
15467
15510
|
for (const k of A) {
|
|
15468
15511
|
const C = s === "" ? k : `${s}.${k}`, $ = h.mergePathAuthority(
|
|
15469
15512
|
e,
|
|
15470
15513
|
Object.prototype.hasOwnProperty.call(d, k) ? d[k] : h.ABSENT_PATH,
|
|
15471
|
-
Object.prototype.hasOwnProperty.call(
|
|
15514
|
+
Object.prototype.hasOwnProperty.call(y, k) ? y[k] : h.ABSENT_PATH,
|
|
15472
15515
|
i,
|
|
15473
15516
|
C,
|
|
15474
15517
|
n
|
|
15475
15518
|
);
|
|
15476
|
-
$ !== h.ABSENT_PATH && (b[k] = $), $ !== (Object.prototype.hasOwnProperty.call(
|
|
15519
|
+
$ !== h.ABSENT_PATH && (b[k] = $), $ !== (Object.prototype.hasOwnProperty.call(y, k) ? y[k] : h.ABSENT_PATH) && (E = !0);
|
|
15477
15520
|
}
|
|
15478
|
-
return E ? b :
|
|
15521
|
+
return E ? b : y;
|
|
15479
15522
|
}
|
|
15480
15523
|
const a = h.resolveArrayPairing(
|
|
15481
15524
|
e,
|
|
@@ -15485,7 +15528,7 @@ const h = class h {
|
|
|
15485
15528
|
n
|
|
15486
15529
|
);
|
|
15487
15530
|
if (a !== null) {
|
|
15488
|
-
const d = t,
|
|
15531
|
+
const d = t, y = r, b = y.map(
|
|
15489
15532
|
(E, A) => h.mergePathAuthority(
|
|
15490
15533
|
e,
|
|
15491
15534
|
d[A],
|
|
@@ -15495,7 +15538,7 @@ const h = class h {
|
|
|
15495
15538
|
n
|
|
15496
15539
|
)
|
|
15497
15540
|
);
|
|
15498
|
-
return b.some((E, A) => E !==
|
|
15541
|
+
return b.some((E, A) => E !== y[A]) ? b : y;
|
|
15499
15542
|
}
|
|
15500
15543
|
if (h.isSameBindingValue(t, r))
|
|
15501
15544
|
return r;
|
|
@@ -15691,7 +15734,7 @@ const h = class h {
|
|
|
15691
15734
|
*/
|
|
15692
15735
|
static dumpScope(e) {
|
|
15693
15736
|
const t = h.collectScope(e);
|
|
15694
|
-
return
|
|
15737
|
+
return H.isEnabled() && m.info("[Haori]", "scope dump for", e, t), t;
|
|
15695
15738
|
}
|
|
15696
15739
|
/**
|
|
15697
15740
|
* スコープの解決結果と由来を収集します。
|
|
@@ -15710,14 +15753,14 @@ const h = class h {
|
|
|
15710
15753
|
const r = t.getBindingData(), i = {}, s = (l) => {
|
|
15711
15754
|
const u = l.getTarget(), d = h.resolveElementId(u);
|
|
15712
15755
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
15713
|
-
}, n = (l, u, d,
|
|
15756
|
+
}, n = (l, u, d, y) => {
|
|
15714
15757
|
if (l)
|
|
15715
15758
|
for (const b of Object.keys(l))
|
|
15716
15759
|
b in i || (i[b] = {
|
|
15717
15760
|
value: l[b],
|
|
15718
15761
|
source: s(u),
|
|
15719
15762
|
kind: d,
|
|
15720
|
-
depth:
|
|
15763
|
+
depth: y
|
|
15721
15764
|
});
|
|
15722
15765
|
};
|
|
15723
15766
|
let a = t, o = 0;
|
|
@@ -15736,7 +15779,7 @@ const h = class h {
|
|
|
15736
15779
|
try {
|
|
15737
15780
|
return JSON.parse(e);
|
|
15738
15781
|
} catch (t) {
|
|
15739
|
-
return
|
|
15782
|
+
return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
15740
15783
|
}
|
|
15741
15784
|
else {
|
|
15742
15785
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -15882,14 +15925,14 @@ const h = class h {
|
|
|
15882
15925
|
e.setDeriveInputSignature(E);
|
|
15883
15926
|
})));
|
|
15884
15927
|
}
|
|
15885
|
-
let
|
|
15928
|
+
let y = !1, b = 0;
|
|
15886
15929
|
return s && (r = r.then(() => {
|
|
15887
15930
|
const E = e.isVisible();
|
|
15888
15931
|
return b = R.currentSequence(), h.evaluateIf(e, t).then(() => {
|
|
15889
|
-
|
|
15932
|
+
y = !E && e.isVisible();
|
|
15890
15933
|
});
|
|
15891
15934
|
})), n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => h.evaluateEachFixedChildren(e)).then(() => h.evaluateEach(e)).then(() => {
|
|
15892
|
-
if (
|
|
15935
|
+
if (y)
|
|
15893
15936
|
return h.applyEnhancersOnShow(e, b);
|
|
15894
15937
|
})) : s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
15895
15938
|
})) : (i && (r = r.then(() => {
|
|
@@ -15984,7 +16027,7 @@ const h = class h {
|
|
|
15984
16027
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
15985
16028
|
return;
|
|
15986
16029
|
if (se.hasCompileFailure(t)) {
|
|
15987
|
-
|
|
16030
|
+
m.warn(
|
|
15988
16031
|
"[Haori]",
|
|
15989
16032
|
"data-if is hidden because the expression could not be compiled (see the preceding compile error):",
|
|
15990
16033
|
t
|
|
@@ -16000,7 +16043,7 @@ const h = class h {
|
|
|
16000
16043
|
const a = {};
|
|
16001
16044
|
i.forEach((o) => {
|
|
16002
16045
|
o in r && (a[o] = r[o]);
|
|
16003
|
-
}),
|
|
16046
|
+
}), m.info(
|
|
16004
16047
|
"[Haori]",
|
|
16005
16048
|
"data-if is falsy (hidden):",
|
|
16006
16049
|
t,
|
|
@@ -16097,7 +16140,7 @@ const h = class h {
|
|
|
16097
16140
|
static evaluateIf(e, t = /* @__PURE__ */ new Set()) {
|
|
16098
16141
|
const r = [], i = e.getAttribute(`${c.prefix}if`);
|
|
16099
16142
|
if (h.isHiddenIfCondition(i))
|
|
16100
|
-
|
|
16143
|
+
H.isEnabled() && e.isVisible() && h.logFalsyIfDiagnostics(e), r.push(
|
|
16101
16144
|
e.hide().then(() => {
|
|
16102
16145
|
B.hide(e.getTarget());
|
|
16103
16146
|
})
|
|
@@ -16141,7 +16184,7 @@ const h = class h {
|
|
|
16141
16184
|
static triggerLoadOnShow(e) {
|
|
16142
16185
|
const t = `${c.prefix}load-`;
|
|
16143
16186
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new de(e, "load").run().catch((i) => {
|
|
16144
|
-
|
|
16187
|
+
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
16145
16188
|
});
|
|
16146
16189
|
}
|
|
16147
16190
|
/**
|
|
@@ -16168,7 +16211,7 @@ const h = class h {
|
|
|
16168
16211
|
* @return 差分更新(再実行を含む)の完了 Promise
|
|
16169
16212
|
*/
|
|
16170
16213
|
static evaluateEach(e) {
|
|
16171
|
-
if (
|
|
16214
|
+
if (H.isEnabled() && se.recordRowScopeIdentifiers([
|
|
16172
16215
|
h.getRowScopeName(e, "each-arg"),
|
|
16173
16216
|
h.getRowScopeName(e, "each-index")
|
|
16174
16217
|
]), e.isMounted() || h.syncMountedState(e), !e.isVisible() || !e.isMounted())
|
|
@@ -16245,7 +16288,7 @@ const h = class h {
|
|
|
16245
16288
|
try {
|
|
16246
16289
|
n?.([]);
|
|
16247
16290
|
} catch (a) {
|
|
16248
|
-
|
|
16291
|
+
m.error("[Haori]", `each-rendered-run execution error: ${a}`);
|
|
16249
16292
|
}
|
|
16250
16293
|
return;
|
|
16251
16294
|
}
|
|
@@ -16263,14 +16306,14 @@ ${i}
|
|
|
16263
16306
|
${i}
|
|
16264
16307
|
`);
|
|
16265
16308
|
} catch (n) {
|
|
16266
|
-
|
|
16309
|
+
m.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
16267
16310
|
}
|
|
16268
16311
|
}
|
|
16269
16312
|
if (s)
|
|
16270
16313
|
try {
|
|
16271
16314
|
s.call(e);
|
|
16272
16315
|
} catch (n) {
|
|
16273
|
-
|
|
16316
|
+
m.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
16274
16317
|
}
|
|
16275
16318
|
}
|
|
16276
16319
|
/**
|
|
@@ -16301,7 +16344,7 @@ ${i}
|
|
|
16301
16344
|
return;
|
|
16302
16345
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
16303
16346
|
let s = !1;
|
|
16304
|
-
if (i === "always" ? s = !0 : i !== "" && i !== "once" && (h.EACH_RENDERED_CHANGE_WARNED.has(r) || (h.EACH_RENDERED_CHANGE_WARNED.add(r),
|
|
16347
|
+
if (i === "always" ? s = !0 : i !== "" && i !== "once" && (h.EACH_RENDERED_CHANGE_WARNED.has(r) || (h.EACH_RENDERED_CHANGE_WARNED.add(r), m.warn(
|
|
16305
16348
|
"[Haori]",
|
|
16306
16349
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
16307
16350
|
))), h.countEachRenderedRows(e) !== 0) {
|
|
@@ -16313,7 +16356,7 @@ ${i}
|
|
|
16313
16356
|
try {
|
|
16314
16357
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
16315
16358
|
} catch (n) {
|
|
16316
|
-
|
|
16359
|
+
m.error("[Haori]", `each-rendered-change dispatch error: ${n}`);
|
|
16317
16360
|
}
|
|
16318
16361
|
}
|
|
16319
16362
|
}
|
|
@@ -16468,7 +16511,7 @@ ${i}
|
|
|
16468
16511
|
*/
|
|
16469
16512
|
static resolveEachItems(e) {
|
|
16470
16513
|
const t = e.getAttributeEvaluation(`${c.prefix}each`), r = t?.value;
|
|
16471
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
16514
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
|
|
16472
16515
|
}
|
|
16473
16516
|
/**
|
|
16474
16517
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -16676,7 +16719,7 @@ ${i}
|
|
|
16676
16719
|
});
|
|
16677
16720
|
return Promise.all(r).then(() => {
|
|
16678
16721
|
}).catch((i) => {
|
|
16679
|
-
|
|
16722
|
+
m.error("Haori", `${e} を読み直せませんでした: ${i}`);
|
|
16680
16723
|
});
|
|
16681
16724
|
}
|
|
16682
16725
|
/**
|
|
@@ -16723,7 +16766,7 @@ ${i}
|
|
|
16723
16766
|
* @returns プロファイル
|
|
16724
16767
|
*/
|
|
16725
16768
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
16726
|
-
if (!
|
|
16769
|
+
if (!H.isEnabled() || !e.hasAttribute(`${c.prefix}derive`))
|
|
16727
16770
|
return null;
|
|
16728
16771
|
const t = h.DERIVE_SUBTREE_PROFILES.get(e);
|
|
16729
16772
|
if (t)
|
|
@@ -16808,7 +16851,7 @@ ${i}
|
|
|
16808
16851
|
*/
|
|
16809
16852
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
16810
16853
|
const r = h.getOrCreateDerivedSubtreeProfile(e);
|
|
16811
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
16854
|
+
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
|
|
16812
16855
|
reason: t,
|
|
16813
16856
|
hostId: r.hostId,
|
|
16814
16857
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -16875,7 +16918,7 @@ ${i}
|
|
|
16875
16918
|
static updateDiff(e, t) {
|
|
16876
16919
|
const r = e.getTemplate();
|
|
16877
16920
|
if (r === null)
|
|
16878
|
-
return
|
|
16921
|
+
return m.error(
|
|
16879
16922
|
"[Haori]",
|
|
16880
16923
|
`Template is not set for ${c.prefix}each="${e.getRawAttribute(`${c.prefix}each`)}". The container needs one element child as the row template.`,
|
|
16881
16924
|
e.getTarget()
|
|
@@ -16892,7 +16935,7 @@ ${i}
|
|
|
16892
16935
|
let d = e.getChildren().filter((F) => F instanceof R).filter(
|
|
16893
16936
|
(F) => !F.hasAttribute(`${c.prefix}each-before`) && !F.hasAttribute(`${c.prefix}each-after`)
|
|
16894
16937
|
);
|
|
16895
|
-
const
|
|
16938
|
+
const y = d.map((F) => F.getListKey()), b = /* @__PURE__ */ new Set();
|
|
16896
16939
|
d = d.filter((F, Z) => {
|
|
16897
16940
|
const te = String(F.getListKey()), Q = l.get(te) ?? 0;
|
|
16898
16941
|
if (Q === 0) {
|
|
@@ -16982,7 +17025,7 @@ ${i}
|
|
|
16982
17025
|
(w) => w !== null
|
|
16983
17026
|
), Z = E.filter(
|
|
16984
17027
|
(w) => w !== null
|
|
16985
|
-
), te = new Set(Z), Q = F.filter((w) => !te.has(w)), ce =
|
|
17028
|
+
), te = new Set(Z), Q = F.filter((w) => !te.has(w)), ce = y.filter(
|
|
16986
17029
|
(w) => w !== null
|
|
16987
17030
|
).filter(
|
|
16988
17031
|
(w) => !o.has(w)
|
|
@@ -17024,7 +17067,7 @@ ${i}
|
|
|
17024
17067
|
).filter(
|
|
17025
17068
|
(r) => !r.hasAttribute(`${c.prefix}each-before`) && !r.hasAttribute(`${c.prefix}each-after`)
|
|
17026
17069
|
);
|
|
17027
|
-
t.length !== 0 &&
|
|
17070
|
+
t.length !== 0 && m.warn(
|
|
17028
17071
|
"[Haori]",
|
|
17029
17072
|
`${c.prefix}each="${e.getRawAttribute(`${c.prefix}each`)}" のコンテナに要素の子が 2 つ以上あります。テンプレートになるのは最初の子だけで、残り ${t.length} 個は行に入りません(${t.map((r) => r.getTarget().tagName.toLowerCase()).join(", ")})。行の中身は 1 つの要素で包んでください。`,
|
|
17030
17073
|
e.getTarget()
|
|
@@ -17042,7 +17085,7 @@ ${i}
|
|
|
17042
17085
|
* @returns 戻り値はありません。
|
|
17043
17086
|
*/
|
|
17044
17087
|
static warnDuplicateEachKey(e) {
|
|
17045
|
-
!
|
|
17088
|
+
!H.isEnabled() || h.WARNED_DUPLICATE_EACH_KEYS.has(e) || (h.WARNED_DUPLICATE_EACH_KEYS.add(e), m.warn(
|
|
17046
17089
|
"[Haori]",
|
|
17047
17090
|
`${c.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
17048
17091
|
));
|
|
@@ -17139,7 +17182,7 @@ ${i}
|
|
|
17139
17182
|
else if (s)
|
|
17140
17183
|
a = { [s]: t };
|
|
17141
17184
|
else
|
|
17142
|
-
return
|
|
17185
|
+
return m.error(
|
|
17143
17186
|
"[Haori]",
|
|
17144
17187
|
`Primitive value requires '${c.prefix}each-arg' attribute: ${t}`
|
|
17145
17188
|
), Promise.resolve(!1);
|
|
@@ -17359,7 +17402,7 @@ const Ce = class Ce {
|
|
|
17359
17402
|
try {
|
|
17360
17403
|
t();
|
|
17361
17404
|
} catch (r) {
|
|
17362
|
-
|
|
17405
|
+
m.error("[Haori]", "Deferred event handling error:", r);
|
|
17363
17406
|
}
|
|
17364
17407
|
}
|
|
17365
17408
|
/**
|
|
@@ -17412,7 +17455,7 @@ const Ce = class Ce {
|
|
|
17412
17455
|
if (e === null || e === "")
|
|
17413
17456
|
return;
|
|
17414
17457
|
if (Ce.BUILTIN_EVENT_NAMES.has(e)) {
|
|
17415
|
-
|
|
17458
|
+
m.warn(
|
|
17416
17459
|
"[Haori]",
|
|
17417
17460
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
17418
17461
|
);
|
|
@@ -17442,7 +17485,7 @@ const Ce = class Ce {
|
|
|
17442
17485
|
return;
|
|
17443
17486
|
const s = D.get(i);
|
|
17444
17487
|
s instanceof R && this.isFromTarget(s, t) && new de(s, "on", t).run().catch((n) => {
|
|
17445
|
-
|
|
17488
|
+
m.error("[Haori]", "Procedure execution error:", n);
|
|
17446
17489
|
});
|
|
17447
17490
|
});
|
|
17448
17491
|
}
|
|
@@ -17529,7 +17572,7 @@ const Ce = class Ce {
|
|
|
17529
17572
|
return;
|
|
17530
17573
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
17531
17574
|
const s = () => {
|
|
17532
|
-
const n = new de(i, t, r).runWithOutcome().catch((a) => (
|
|
17575
|
+
const n = new de(i, t, r).runWithOutcome().catch((a) => (m.error("[Haori]", "Procedure execution error:", a), "failure"));
|
|
17533
17576
|
if (t === "click") {
|
|
17534
17577
|
de.recordClickOutcome(e, n);
|
|
17535
17578
|
const a = r.target;
|
|
@@ -17763,7 +17806,7 @@ const q = class q {
|
|
|
17763
17806
|
new de(t.fragment, "intersect").runWithResult().then((i) => {
|
|
17764
17807
|
r = i;
|
|
17765
17808
|
}).catch((i) => {
|
|
17766
|
-
|
|
17809
|
+
m.error("[Haori]", "Intersect procedure execution error:", i);
|
|
17767
17810
|
}).finally(() => {
|
|
17768
17811
|
const i = q.registrations.get(e);
|
|
17769
17812
|
if (i) {
|
|
@@ -17831,7 +17874,7 @@ const q = class q {
|
|
|
17831
17874
|
if (typeof r != "string" || r.trim() === "")
|
|
17832
17875
|
return null;
|
|
17833
17876
|
const i = K.query(r, t, document);
|
|
17834
|
-
return q.isHtmlElement(i) ? i : (
|
|
17877
|
+
return q.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
17835
17878
|
}
|
|
17836
17879
|
static resolveRootMargin(e) {
|
|
17837
17880
|
const t = `${c.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
@@ -18052,7 +18095,7 @@ const S = class S {
|
|
|
18052
18095
|
"poll"
|
|
18053
18096
|
).runWithResult();
|
|
18054
18097
|
} catch (s) {
|
|
18055
|
-
|
|
18098
|
+
m.error("[Haori]", "Poll procedure execution error:", s);
|
|
18056
18099
|
} finally {
|
|
18057
18100
|
t.fetching = !1;
|
|
18058
18101
|
}
|
|
@@ -18232,7 +18275,7 @@ const S = class S {
|
|
|
18232
18275
|
document
|
|
18233
18276
|
);
|
|
18234
18277
|
if (s.length === 0)
|
|
18235
|
-
return
|
|
18278
|
+
return m.error("[Haori]", `Poll state element not found: ${i}`), [];
|
|
18236
18279
|
const n = [];
|
|
18237
18280
|
return s.forEach((a) => {
|
|
18238
18281
|
if (!a.isConnected)
|
|
@@ -18255,10 +18298,10 @@ const S = class S {
|
|
|
18255
18298
|
if (!e.hasAttribute(t))
|
|
18256
18299
|
return S.DEFAULT_INTERVAL_MS;
|
|
18257
18300
|
const r = S.toNumber(e.getAttribute(t));
|
|
18258
|
-
return r === null ? (
|
|
18301
|
+
return r === null ? (m.warn(
|
|
18259
18302
|
"[Haori]",
|
|
18260
18303
|
`${t} は数値で指定してください。既定値 ${S.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
18261
|
-
), S.DEFAULT_INTERVAL_MS) : r < S.MIN_INTERVAL_MS ? (
|
|
18304
|
+
), S.DEFAULT_INTERVAL_MS) : r < S.MIN_INTERVAL_MS ? (m.warn(
|
|
18262
18305
|
"[Haori]",
|
|
18263
18306
|
`${t} の下限は ${S.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
18264
18307
|
), S.MIN_INTERVAL_MS) : r;
|
|
@@ -18274,7 +18317,7 @@ const S = class S {
|
|
|
18274
18317
|
if (!e.hasAttribute(t))
|
|
18275
18318
|
return null;
|
|
18276
18319
|
const r = S.toNumber(e.getAttribute(t));
|
|
18277
|
-
return r === null || r <= 0 ? (
|
|
18320
|
+
return r === null || r <= 0 ? (m.warn(
|
|
18278
18321
|
"[Haori]",
|
|
18279
18322
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
18280
18323
|
), null) : r;
|
|
@@ -18290,7 +18333,7 @@ const S = class S {
|
|
|
18290
18333
|
if (!e.hasAttribute(t))
|
|
18291
18334
|
return null;
|
|
18292
18335
|
const r = S.toNumber(e.getAttribute(t));
|
|
18293
|
-
return r === null || r < 1 ? (
|
|
18336
|
+
return r === null || r < 1 ? (m.warn(
|
|
18294
18337
|
"[Haori]",
|
|
18295
18338
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
18296
18339
|
), null) : Math.floor(r);
|
|
@@ -18349,7 +18392,7 @@ const S = class S {
|
|
|
18349
18392
|
if (!e.hasAttribute(t))
|
|
18350
18393
|
return !1;
|
|
18351
18394
|
const r = e.getAttributeEvaluation(t);
|
|
18352
|
-
return r ? r.hasUnresolvedReference ? (
|
|
18395
|
+
return r ? r.hasUnresolvedReference ? (m.warn(
|
|
18353
18396
|
"[Haori]",
|
|
18354
18397
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
18355
18398
|
e.getRawAttribute(t),
|
|
@@ -18386,9 +18429,9 @@ S.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
18386
18429
|
"state"
|
|
18387
18430
|
]), S.DEFAULT_INTERVAL_MS = 5e3, S.MIN_INTERVAL_MS = 100, S.registrations = /* @__PURE__ */ new Map(), S.visibilityListener = null;
|
|
18388
18431
|
let Fe = S;
|
|
18389
|
-
const
|
|
18390
|
-
function
|
|
18391
|
-
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() =>
|
|
18432
|
+
const $r = "0.64.0";
|
|
18433
|
+
function Pr(f) {
|
|
18434
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => f()) : Promise.resolve().then(f);
|
|
18392
18435
|
}
|
|
18393
18436
|
const L = class L {
|
|
18394
18437
|
/**
|
|
@@ -18429,7 +18472,7 @@ const L = class L {
|
|
|
18429
18472
|
return;
|
|
18430
18473
|
const i = L.resolveVarName(r);
|
|
18431
18474
|
if (i === "") {
|
|
18432
|
-
t && (t.observer.disconnect(), L.registrations.delete(e)),
|
|
18475
|
+
t && (t.observer.disconnect(), L.registrations.delete(e)), m.warn(
|
|
18433
18476
|
"[Haori]",
|
|
18434
18477
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
18435
18478
|
);
|
|
@@ -18447,9 +18490,9 @@ const L = class L {
|
|
|
18447
18490
|
if (!u)
|
|
18448
18491
|
return;
|
|
18449
18492
|
let d = !1;
|
|
18450
|
-
l.forEach((
|
|
18451
|
-
const b =
|
|
18452
|
-
u.observedRows.has(b) && (
|
|
18493
|
+
l.forEach((y) => {
|
|
18494
|
+
const b = y.target;
|
|
18495
|
+
u.observedRows.has(b) && (y.isIntersecting ? u.visibleRows.has(b) || (u.visibleRows.add(b), d = !0) : u.visibleRows.delete(b) && (d = !0));
|
|
18453
18496
|
}), d && L.scheduleCompute(u);
|
|
18454
18497
|
},
|
|
18455
18498
|
{
|
|
@@ -18526,7 +18569,7 @@ const L = class L {
|
|
|
18526
18569
|
if (typeof r != "string" || r.trim() === "")
|
|
18527
18570
|
return null;
|
|
18528
18571
|
const i = K.query(r, t, document);
|
|
18529
|
-
return L.isHtmlElement(i) ? i : (
|
|
18572
|
+
return L.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
18530
18573
|
}
|
|
18531
18574
|
/**
|
|
18532
18575
|
* rootMargin を解決します。
|
|
@@ -18569,7 +18612,7 @@ const L = class L {
|
|
|
18569
18612
|
* @param registration 対象の登録
|
|
18570
18613
|
*/
|
|
18571
18614
|
static scheduleCompute(e) {
|
|
18572
|
-
e.scheduled || (e.scheduled = !0,
|
|
18615
|
+
e.scheduled || (e.scheduled = !0, Pr(() => {
|
|
18573
18616
|
e.scheduled = !1;
|
|
18574
18617
|
const t = e.fragment.getTarget();
|
|
18575
18618
|
L.registrations.get(t) === e && L.computeAndPublish(e);
|
|
@@ -18625,7 +18668,7 @@ const L = class L {
|
|
|
18625
18668
|
static publish(e, t) {
|
|
18626
18669
|
const r = L.resolveBindOwner(e.fragment);
|
|
18627
18670
|
if (!r) {
|
|
18628
|
-
|
|
18671
|
+
m.warn(
|
|
18629
18672
|
"[Haori]",
|
|
18630
18673
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
18631
18674
|
);
|
|
@@ -18644,7 +18687,7 @@ const L = class L {
|
|
|
18644
18687
|
kind: "nonSupply",
|
|
18645
18688
|
sequence: R.nextSequence()
|
|
18646
18689
|
}).catch((o) => {
|
|
18647
|
-
|
|
18690
|
+
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
18648
18691
|
});
|
|
18649
18692
|
}
|
|
18650
18693
|
/**
|
|
@@ -18693,11 +18736,11 @@ const U = class U {
|
|
|
18693
18736
|
M.scan(document.head),
|
|
18694
18737
|
M.scan(document.body)
|
|
18695
18738
|
]), [r, i] = t;
|
|
18696
|
-
r.status !== "fulfilled" &&
|
|
18739
|
+
r.status !== "fulfilled" && m.error(
|
|
18697
18740
|
"[Haori]",
|
|
18698
18741
|
"Failed to build head fragment:",
|
|
18699
18742
|
r.reason
|
|
18700
|
-
), i.status !== "fulfilled" &&
|
|
18743
|
+
), i.status !== "fulfilled" && m.error(
|
|
18701
18744
|
"[Haori]",
|
|
18702
18745
|
"Failed to build body fragment:",
|
|
18703
18746
|
i.reason
|
|
@@ -18705,7 +18748,7 @@ const U = class U {
|
|
|
18705
18748
|
} finally {
|
|
18706
18749
|
U._initialIntakes = null, e.release();
|
|
18707
18750
|
}
|
|
18708
|
-
B.ready(
|
|
18751
|
+
B.ready($r);
|
|
18709
18752
|
}
|
|
18710
18753
|
/**
|
|
18711
18754
|
* 稼働中の EventDispatcher を返します。
|
|
@@ -18949,7 +18992,7 @@ const U = class U {
|
|
|
18949
18992
|
break;
|
|
18950
18993
|
}
|
|
18951
18994
|
case "characterData": {
|
|
18952
|
-
r.target instanceof Text || r.target instanceof Comment ? M.changeText(r.target, r.target.textContent) :
|
|
18995
|
+
r.target instanceof Text || r.target instanceof Comment ? M.changeText(r.target, r.target.textContent) : m.warn(
|
|
18953
18996
|
"[Haori]",
|
|
18954
18997
|
"Unsupported character data type:",
|
|
18955
18998
|
r.target
|
|
@@ -18957,19 +19000,19 @@ const U = class U {
|
|
|
18957
19000
|
break;
|
|
18958
19001
|
}
|
|
18959
19002
|
default:
|
|
18960
|
-
|
|
19003
|
+
m.warn("[Haori]", "Unknown mutation type:", r.type);
|
|
18961
19004
|
continue;
|
|
18962
19005
|
}
|
|
18963
19006
|
} catch (i) {
|
|
18964
|
-
|
|
19007
|
+
m.error("[Haori]", "Error processing mutation:", i);
|
|
18965
19008
|
}
|
|
18966
19009
|
}
|
|
18967
19010
|
};
|
|
18968
19011
|
U._initialized = !1, U._mutationObservers = [], U._dispatcher = null, U._initialIntakes = null;
|
|
18969
19012
|
let Ue = U;
|
|
18970
|
-
ae.setMutationCapture((
|
|
19013
|
+
ae.setMutationCapture((f) => Ue.captureMutations(f));
|
|
18971
19014
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Ue.init) : Ue.init();
|
|
18972
|
-
const
|
|
19015
|
+
const Lr = () => ke.waitForRenders(), Or = ke.enhancers, Br = ke.handlers;
|
|
18973
19016
|
export {
|
|
18974
19017
|
M as Core,
|
|
18975
19018
|
ae as Enhance,
|
|
@@ -18977,12 +19020,12 @@ export {
|
|
|
18977
19020
|
x as Form,
|
|
18978
19021
|
D as Fragment,
|
|
18979
19022
|
ke as Haori,
|
|
18980
|
-
|
|
19023
|
+
m as Log,
|
|
18981
19024
|
J as Queue,
|
|
18982
19025
|
ke as default,
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
19026
|
+
Or as enhancers,
|
|
19027
|
+
Br as handlers,
|
|
19028
|
+
$r as version,
|
|
19029
|
+
Lr as waitForRenders
|
|
18987
19030
|
};
|
|
18988
19031
|
//# sourceMappingURL=haori.es.js.map
|