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