haori 0.26.0 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +10 -10
- package/dist/haori.es.js +753 -717
- package/dist/haori.iife.js +10 -10
- package/dist/index.d.ts +21 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -29,13 +29,13 @@ const X = class X {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
X.devMode = !1;
|
|
32
|
-
let
|
|
33
|
-
const
|
|
32
|
+
let U = X;
|
|
33
|
+
const ye = "embedded";
|
|
34
34
|
function De(f) {
|
|
35
35
|
return f === "embedded" || f === "demo";
|
|
36
36
|
}
|
|
37
37
|
function We(f) {
|
|
38
|
-
return f === null ? null : De(f) ? f :
|
|
38
|
+
return f === null ? null : De(f) ? f : ye;
|
|
39
39
|
}
|
|
40
40
|
const V = class V {
|
|
41
41
|
/**
|
|
@@ -53,7 +53,7 @@ const V = class V {
|
|
|
53
53
|
* @return 戻り値はありません。
|
|
54
54
|
*/
|
|
55
55
|
static setRuntime(e) {
|
|
56
|
-
V._runtime = De(e) ? e :
|
|
56
|
+
V._runtime = De(e) ? e : ye;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 実行環境からプレフィックスと開発モードかどうかを自動検出します。
|
|
@@ -73,15 +73,15 @@ const V = class V {
|
|
|
73
73
|
i !== null && (V._runtime = i);
|
|
74
74
|
}
|
|
75
75
|
if (e instanceof HTMLScriptElement && e.hasAttribute(`${V._prefix}dev`)) {
|
|
76
|
-
|
|
76
|
+
U.set(!0);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const t = window.location.hostname;
|
|
80
80
|
if (t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "::1" || t.endsWith(".local")) {
|
|
81
|
-
|
|
81
|
+
U.set(!0);
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
U.set(!1);
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -94,10 +94,10 @@ const V = class V {
|
|
|
94
94
|
return V._prefix;
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
V._prefix = "data-", V._runtime =
|
|
98
|
-
let
|
|
99
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
100
|
-
class
|
|
97
|
+
V._prefix = "data-", V._runtime = ye;
|
|
98
|
+
let u = V;
|
|
99
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect();
|
|
100
|
+
class m {
|
|
101
101
|
/**
|
|
102
102
|
* 開発モードでのみコンソールに情報を出力します。
|
|
103
103
|
*
|
|
@@ -105,7 +105,7 @@ class p {
|
|
|
105
105
|
* @param args 追加の引数
|
|
106
106
|
*/
|
|
107
107
|
static info(e, ...t) {
|
|
108
|
-
|
|
108
|
+
U.isEnabled() && console.log && console.log(e, ...t);
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* 開発モードでのみコンソールに警告を出力します。
|
|
@@ -114,7 +114,7 @@ class p {
|
|
|
114
114
|
* @param args 追加の引数
|
|
115
115
|
*/
|
|
116
116
|
static warn(e, ...t) {
|
|
117
|
-
|
|
117
|
+
U.isEnabled() && console.warn && console.warn(e, ...t);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* モードに関係なくコンソールにエラーを出力します。
|
|
@@ -127,21 +127,21 @@ class p {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
const Fe = "yyyy/MM/dd HH:mm", Ke = "en-US", Te = 1e4;
|
|
130
|
-
function
|
|
130
|
+
function z(f) {
|
|
131
131
|
return String(f).padStart(2, "0");
|
|
132
132
|
}
|
|
133
133
|
function Ne(f, e, t, r, i, n) {
|
|
134
134
|
return {
|
|
135
135
|
yyyy: String(f).padStart(4, "0"),
|
|
136
|
-
yy:
|
|
137
|
-
MM:
|
|
136
|
+
yy: z(f % 100),
|
|
137
|
+
MM: z(e),
|
|
138
138
|
M: String(e),
|
|
139
|
-
dd:
|
|
139
|
+
dd: z(t),
|
|
140
140
|
d: String(t),
|
|
141
|
-
HH:
|
|
141
|
+
HH: z(r),
|
|
142
142
|
H: String(r),
|
|
143
|
-
mm:
|
|
144
|
-
ss:
|
|
143
|
+
mm: z(i),
|
|
144
|
+
ss: z(n)
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function Me(f, e) {
|
|
@@ -161,8 +161,8 @@ function Me(f, e) {
|
|
|
161
161
|
return null;
|
|
162
162
|
}
|
|
163
163
|
const r = {};
|
|
164
|
-
for (const
|
|
165
|
-
|
|
164
|
+
for (const h of t)
|
|
165
|
+
h.type !== "literal" && (r[h.type] = h.value);
|
|
166
166
|
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), l = Number(r.second);
|
|
167
167
|
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) ? null : Ne(i, n, s, a, o, l);
|
|
168
168
|
}
|
|
@@ -195,7 +195,7 @@ const ze = "yyyy-MM-dd";
|
|
|
195
195
|
function xe(f = Fe, e) {
|
|
196
196
|
return de(/* @__PURE__ */ new Date(), f, e);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function ke(f = 0, e = ze, t) {
|
|
199
199
|
const r = Number.isFinite(f) ? Math.trunc(f) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
200
200
|
let n, s, a;
|
|
201
201
|
if (i !== "") {
|
|
@@ -210,7 +210,7 @@ function Pe(f = 0, e = ze, t) {
|
|
|
210
210
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
211
211
|
return de(o, e, "UTC");
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Pe(f, e) {
|
|
214
214
|
if (f == null)
|
|
215
215
|
return "";
|
|
216
216
|
let t;
|
|
@@ -231,7 +231,7 @@ function Ie(f, e) {
|
|
|
231
231
|
}
|
|
232
232
|
return new Intl.NumberFormat(Ke, r).format(t);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Ie(f, e, t) {
|
|
235
235
|
let r, i, n;
|
|
236
236
|
if (e === void 0 ? (r = 0, i = f, n = 1) : (r = f, i = e, n = t === void 0 ? 1 : t), !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(n) || n === 0)
|
|
237
237
|
return [];
|
|
@@ -253,41 +253,41 @@ function Ce(f, e, t = {}) {
|
|
|
253
253
|
Math.max(Math.trunc(Number(e)) || 0, 0),
|
|
254
254
|
r - 1
|
|
255
255
|
), n = Math.max(0, Math.trunc(t.window ?? 2)), s = Math.max(0, Math.trunc(t.boundary ?? 1)), a = /* @__PURE__ */ new Set();
|
|
256
|
-
for (let
|
|
257
|
-
a.add(
|
|
258
|
-
for (let
|
|
259
|
-
a.add(
|
|
260
|
-
for (let
|
|
261
|
-
a.add(
|
|
262
|
-
const o = Array.from(a).sort((
|
|
263
|
-
let
|
|
264
|
-
for (const
|
|
265
|
-
if (
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
256
|
+
for (let c = 0; c < s && c < r; c += 1)
|
|
257
|
+
a.add(c);
|
|
258
|
+
for (let c = Math.max(0, r - s); c < r; c += 1)
|
|
259
|
+
a.add(c);
|
|
260
|
+
for (let c = Math.max(0, i - n); c <= Math.min(r - 1, i + n); c += 1)
|
|
261
|
+
a.add(c);
|
|
262
|
+
const o = Array.from(a).sort((c, p) => c - p), l = [];
|
|
263
|
+
let h = null;
|
|
264
|
+
for (const c of o) {
|
|
265
|
+
if (h !== null && c - h > 1)
|
|
266
|
+
if (c - h === 2) {
|
|
267
|
+
const p = h + 1;
|
|
268
268
|
l.push({
|
|
269
|
-
page:
|
|
270
|
-
label:
|
|
271
|
-
active:
|
|
269
|
+
page: p,
|
|
270
|
+
label: p + 1,
|
|
271
|
+
active: p === i,
|
|
272
272
|
ellipsis: !1
|
|
273
273
|
});
|
|
274
274
|
} else
|
|
275
275
|
l.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
276
276
|
l.push({
|
|
277
|
-
page:
|
|
278
|
-
label:
|
|
279
|
-
active:
|
|
277
|
+
page: c,
|
|
278
|
+
label: c + 1,
|
|
279
|
+
active: c === i,
|
|
280
280
|
ellipsis: !1
|
|
281
|
-
}),
|
|
281
|
+
}), h = c;
|
|
282
282
|
}
|
|
283
283
|
return l;
|
|
284
284
|
}
|
|
285
285
|
const Ge = /^(\d{4})-(\d{1,2})$/, Ye = 1200;
|
|
286
|
-
function
|
|
286
|
+
function ne(f, e) {
|
|
287
287
|
const t = Number(f);
|
|
288
288
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function fe(f, e) {
|
|
291
291
|
if (typeof f != "string")
|
|
292
292
|
return "";
|
|
293
293
|
const t = Ge.exec(f.trim());
|
|
@@ -297,13 +297,13 @@ function he(f, e) {
|
|
|
297
297
|
if (i < 1 || i > 12)
|
|
298
298
|
return "";
|
|
299
299
|
const n = Number.isFinite(e) ? Math.trunc(e) : 0, s = r * 12 + (i - 1) + n, a = Math.floor(s / 12), o = s - a * 12 + 1;
|
|
300
|
-
return `${String(a).padStart(4, "0")}-${
|
|
300
|
+
return `${String(a).padStart(4, "0")}-${z(o)}`;
|
|
301
301
|
}
|
|
302
302
|
function Je(f) {
|
|
303
303
|
if (typeof f == "string" && f.trim() !== "")
|
|
304
|
-
return
|
|
304
|
+
return fe(f, 0);
|
|
305
305
|
const e = /* @__PURE__ */ new Date();
|
|
306
|
-
return `${String(e.getFullYear()).padStart(4, "0")}-${
|
|
306
|
+
return `${String(e.getFullYear()).padStart(4, "0")}-${z(e.getMonth() + 1)}`;
|
|
307
307
|
}
|
|
308
308
|
function Be(f, e) {
|
|
309
309
|
const t = Math.trunc(Number(f));
|
|
@@ -314,7 +314,7 @@ function Be(f, e) {
|
|
|
314
314
|
return [];
|
|
315
315
|
const i = Math.min(t, Ye), n = [];
|
|
316
316
|
for (let s = 0; s <= i; s += 1) {
|
|
317
|
-
const a =
|
|
317
|
+
const a = fe(r, -s);
|
|
318
318
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
319
319
|
}
|
|
320
320
|
return n;
|
|
@@ -323,22 +323,22 @@ function $e(f, e) {
|
|
|
323
323
|
const t = { start: 0, end: 0, total: 0, empty: !0 };
|
|
324
324
|
if (!f || typeof f != "object")
|
|
325
325
|
return t;
|
|
326
|
-
const r = f, i =
|
|
326
|
+
const r = f, i = ne(
|
|
327
327
|
r.totalElements ?? r.totalCount,
|
|
328
328
|
0
|
|
329
329
|
);
|
|
330
330
|
if (i <= 0)
|
|
331
331
|
return t;
|
|
332
|
-
const n = Math.max(0,
|
|
332
|
+
const n = Math.max(0, ne(r.number, 0)), s = Math.max(0, ne(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
|
|
333
333
|
let l;
|
|
334
334
|
if (e !== void 0 && Number.isFinite(e))
|
|
335
335
|
l = Math.max(0, Math.trunc(e));
|
|
336
336
|
else {
|
|
337
|
-
const
|
|
338
|
-
l = Number.isFinite(
|
|
337
|
+
const c = ne(r.numberOfElements, NaN);
|
|
338
|
+
l = Number.isFinite(c) ? c : Math.min(s, i - a);
|
|
339
339
|
}
|
|
340
|
-
const
|
|
341
|
-
return { start: o, end: Math.max(
|
|
340
|
+
const h = Math.min(a + l, i);
|
|
341
|
+
return { start: o, end: Math.max(h, o), total: i, empty: !1 };
|
|
342
342
|
}
|
|
343
343
|
function Oe(f, e, t) {
|
|
344
344
|
if (!Array.isArray(f) || f.length === 0)
|
|
@@ -391,18 +391,18 @@ function Ve(f, e) {
|
|
|
391
391
|
const Xe = Object.freeze({
|
|
392
392
|
date: de,
|
|
393
393
|
now: xe,
|
|
394
|
-
today:
|
|
395
|
-
number:
|
|
394
|
+
today: ke,
|
|
395
|
+
number: Pe,
|
|
396
396
|
pages: Ce,
|
|
397
|
-
range:
|
|
398
|
-
monthAdd:
|
|
397
|
+
range: Ie,
|
|
398
|
+
monthAdd: fe,
|
|
399
399
|
monthRange: Be,
|
|
400
400
|
pageSummary: $e,
|
|
401
401
|
findBy: Oe,
|
|
402
402
|
sum: He,
|
|
403
403
|
distinct: Ue,
|
|
404
404
|
groupBy: Ve
|
|
405
|
-
}),
|
|
405
|
+
}), $ = class $ {
|
|
406
406
|
/**
|
|
407
407
|
* 明示バインド内に持ち込まれてはならない危険値を返します。
|
|
408
408
|
*
|
|
@@ -496,18 +496,18 @@ const Xe = Object.freeze({
|
|
|
496
496
|
*/
|
|
497
497
|
static evaluateDetailed(e, t = {}) {
|
|
498
498
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
499
|
-
return
|
|
499
|
+
return m.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
500
500
|
if (this.containsDangerousPatterns(e)) {
|
|
501
501
|
const l = this.detectDisallowedKeywords(e);
|
|
502
502
|
if (l.length > 0) {
|
|
503
|
-
const
|
|
504
|
-
|
|
503
|
+
const h = l.some((c) => c === "function" || c === "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.";
|
|
504
|
+
m.warn(
|
|
505
505
|
"[Haori]",
|
|
506
506
|
e,
|
|
507
|
-
"Expression uses disallowed keyword(s): " + l.join(", ") + "." +
|
|
507
|
+
"Expression uses disallowed keyword(s): " + l.join(", ") + "." + h
|
|
508
508
|
);
|
|
509
509
|
} else
|
|
510
|
-
|
|
510
|
+
m.warn(
|
|
511
511
|
"[Haori]",
|
|
512
512
|
e,
|
|
513
513
|
"Expression contains dangerous patterns"
|
|
@@ -517,7 +517,7 @@ const Xe = Object.freeze({
|
|
|
517
517
|
const r = this.collectForbiddenKeys(t);
|
|
518
518
|
if (r.length > 0) {
|
|
519
519
|
const l = r.join(",");
|
|
520
|
-
this.loggedForbiddenKeySignatures.has(l) || (this.loggedForbiddenKeySignatures.add(l), this.scheduleForbiddenKeyLogReset(),
|
|
520
|
+
this.loggedForbiddenKeySignatures.has(l) || (this.loggedForbiddenKeySignatures.add(l), this.scheduleForbiddenKeyLogReset(), m.error(
|
|
521
521
|
"[Haori]",
|
|
522
522
|
"Binding keys are reserved and ignored: " + r.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
523
523
|
));
|
|
@@ -528,7 +528,7 @@ const Xe = Object.freeze({
|
|
|
528
528
|
/* @__PURE__ */ new WeakSet(),
|
|
529
529
|
i
|
|
530
530
|
))
|
|
531
|
-
return
|
|
531
|
+
return m.warn(
|
|
532
532
|
"[Haori]",
|
|
533
533
|
t,
|
|
534
534
|
"Binded values contain forbidden values"
|
|
@@ -539,7 +539,7 @@ const Xe = Object.freeze({
|
|
|
539
539
|
), s = this.BUILTIN_REFERENCE_PATTERN.test(
|
|
540
540
|
n
|
|
541
541
|
);
|
|
542
|
-
s && this.BUILTIN_NAMESPACE in t &&
|
|
542
|
+
s && this.BUILTIN_NAMESPACE in t && m.warn(
|
|
543
543
|
"[Haori]",
|
|
544
544
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
545
545
|
);
|
|
@@ -549,36 +549,36 @@ const Xe = Object.freeze({
|
|
|
549
549
|
s && (a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS);
|
|
550
550
|
const o = this.canAttemptMissingIdentifierRecovery(e);
|
|
551
551
|
for (let l = 0; l <= this.MAX_IDENTIFIER_RECOVERY_COUNT; l += 1) {
|
|
552
|
-
const
|
|
553
|
-
if (
|
|
552
|
+
const h = this.prepareEvaluator(e, a);
|
|
553
|
+
if (h.compileFailed || h.evaluator === null)
|
|
554
554
|
return { value: null, unresolvedReference: !1 };
|
|
555
555
|
try {
|
|
556
|
-
const
|
|
557
|
-
return
|
|
558
|
-
|
|
556
|
+
const c = [], p = this.wrapBoundValues(a);
|
|
557
|
+
return h.bindKeys.forEach((y) => {
|
|
558
|
+
c.push(p[y]);
|
|
559
559
|
}), {
|
|
560
560
|
value: this.withBlockedPropertyAccess(
|
|
561
|
-
() =>
|
|
561
|
+
() => h.evaluator(...c)
|
|
562
562
|
),
|
|
563
563
|
unresolvedReference: !1
|
|
564
564
|
};
|
|
565
|
-
} catch (
|
|
566
|
-
if (o &&
|
|
567
|
-
const y = this.extractMissingIdentifier(
|
|
565
|
+
} catch (c) {
|
|
566
|
+
if (o && c instanceof ReferenceError) {
|
|
567
|
+
const y = this.extractMissingIdentifier(c);
|
|
568
568
|
if (y !== null && this.canRecoverMissingIdentifier(y, a)) {
|
|
569
569
|
a[y] = void 0;
|
|
570
570
|
continue;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
const
|
|
574
|
-
return
|
|
573
|
+
const p = this.detectForbiddenIdentifiers(e);
|
|
574
|
+
return p.length > 0 && m.warn(
|
|
575
575
|
"[Haori]",
|
|
576
|
-
"Expression references blocked identifier(s): " +
|
|
576
|
+
"Expression references blocked identifier(s): " + p.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of this error). Use spread {...a, ...b} instead of Object.assign.",
|
|
577
577
|
e
|
|
578
|
-
),
|
|
578
|
+
), m.error("[Haori]", "Expression evaluation error:", e, c), c instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
return
|
|
581
|
+
return m.error(
|
|
582
582
|
"[Haori]",
|
|
583
583
|
"Failed to recover missing identifiers:",
|
|
584
584
|
e,
|
|
@@ -612,7 +612,7 @@ return (${e});`;
|
|
|
612
612
|
compileFailed: !1
|
|
613
613
|
};
|
|
614
614
|
} catch (o) {
|
|
615
|
-
return
|
|
615
|
+
return m.error(
|
|
616
616
|
"[Haori]",
|
|
617
617
|
"Failed to compile expression:",
|
|
618
618
|
e,
|
|
@@ -697,12 +697,12 @@ return (${e});`;
|
|
|
697
697
|
const r = [];
|
|
698
698
|
let i = null;
|
|
699
699
|
for (let n = 0; n < t.length; n++) {
|
|
700
|
-
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null, l = t[n - 2] || null,
|
|
700
|
+
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null, l = t[n - 2] || null, h = t[n - 3] || null;
|
|
701
701
|
if (this.startsObjectKey(
|
|
702
702
|
o,
|
|
703
703
|
i,
|
|
704
704
|
l,
|
|
705
|
-
|
|
705
|
+
h
|
|
706
706
|
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
707
707
|
this.decodeStringLiteral(s.value)
|
|
708
708
|
)) || s.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(s.value) || this.STRICT_FORBIDDEN_NAMES.includes(s.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(s.value)) || o === "member" && s.value !== "]" && s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
@@ -719,8 +719,8 @@ return (${e});`;
|
|
|
719
719
|
break;
|
|
720
720
|
}
|
|
721
721
|
case "[": {
|
|
722
|
-
const
|
|
723
|
-
r.push(
|
|
722
|
+
const c = this.startsMemberAccess(i) ? "member" : "array";
|
|
723
|
+
r.push(c);
|
|
724
724
|
break;
|
|
725
725
|
}
|
|
726
726
|
case "{":
|
|
@@ -1116,9 +1116,9 @@ return (${e});`;
|
|
|
1116
1116
|
return this.forbiddenBindingValueCache.set(e, !1), !1;
|
|
1117
1117
|
}
|
|
1118
1118
|
};
|
|
1119
|
-
|
|
1119
|
+
$.MAX_IDENTIFIER_RECOVERY_COUNT = 8, $.BUILTIN_NAMESPACE = "haori", $.BUILTIN_HELPERS = {
|
|
1120
1120
|
...Xe
|
|
1121
|
-
},
|
|
1121
|
+
}, $.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, $.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), $.forbiddenBindingValueCacheResetScheduled = !1, $.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), $.loggedForbiddenKeyResetScheduled = !1, $.FORBIDDEN_NAMES = [
|
|
1122
1122
|
// グローバルオブジェクト
|
|
1123
1123
|
"window",
|
|
1124
1124
|
"self",
|
|
@@ -1150,7 +1150,7 @@ B.MAX_IDENTIFIER_RECOVERY_COUNT = 8, B.BUILTIN_NAMESPACE = "haori", B.BUILTIN_HE
|
|
|
1150
1150
|
"sessionStorage",
|
|
1151
1151
|
"IndexedDB",
|
|
1152
1152
|
"history"
|
|
1153
|
-
],
|
|
1153
|
+
], $.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], $.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set([
|
|
1154
1154
|
"location",
|
|
1155
1155
|
"history",
|
|
1156
1156
|
"document",
|
|
@@ -1158,23 +1158,23 @@ B.MAX_IDENTIFIER_RECOVERY_COUNT = 8, B.BUILTIN_NAMESPACE = "haori", B.BUILTIN_HE
|
|
|
1158
1158
|
"localStorage",
|
|
1159
1159
|
"sessionStorage",
|
|
1160
1160
|
"IndexedDB"
|
|
1161
|
-
]),
|
|
1162
|
-
|
|
1163
|
-
(e) =>
|
|
1161
|
+
]), $.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
1162
|
+
...$.FORBIDDEN_NAMES.filter(
|
|
1163
|
+
(e) => !$.REBINDABLE_FORBIDDEN_NAMES.has(e)
|
|
1164
1164
|
),
|
|
1165
1165
|
"constructor",
|
|
1166
1166
|
"__proto__",
|
|
1167
1167
|
"prototype",
|
|
1168
|
-
|
|
1169
|
-
]),
|
|
1168
|
+
...$.STRICT_FORBIDDEN_NAMES
|
|
1169
|
+
]), $.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
|
|
1170
1170
|
"constructor",
|
|
1171
1171
|
"__proto__",
|
|
1172
1172
|
"prototype"
|
|
1173
|
-
]),
|
|
1173
|
+
]), $.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
|
|
1174
1174
|
"get",
|
|
1175
1175
|
"set",
|
|
1176
1176
|
"async"
|
|
1177
|
-
]),
|
|
1177
|
+
]), $.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
1178
1178
|
"await",
|
|
1179
1179
|
"break",
|
|
1180
1180
|
"case",
|
|
@@ -1208,9 +1208,9 @@ B.MAX_IDENTIFIER_RECOVERY_COUNT = 8, B.BUILTIN_NAMESPACE = "haori", B.BUILTIN_HE
|
|
|
1208
1208
|
"while",
|
|
1209
1209
|
"with",
|
|
1210
1210
|
"yield"
|
|
1211
|
-
]),
|
|
1212
|
-
let G =
|
|
1213
|
-
class
|
|
1211
|
+
]), $.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
|
|
1212
|
+
let G = $;
|
|
1213
|
+
class Ae {
|
|
1214
1214
|
constructor() {
|
|
1215
1215
|
this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
|
|
1216
1216
|
}
|
|
@@ -1252,13 +1252,13 @@ class ye {
|
|
|
1252
1252
|
const r = await t.task();
|
|
1253
1253
|
t.resolve(r);
|
|
1254
1254
|
} catch (r) {
|
|
1255
|
-
t.reject(r),
|
|
1255
|
+
t.reject(r), m.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
1256
1256
|
}
|
|
1257
1257
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
1258
1258
|
break;
|
|
1259
1259
|
}
|
|
1260
1260
|
} catch (e) {
|
|
1261
|
-
|
|
1261
|
+
m.error("[Haori]", "Error processing queue:", e);
|
|
1262
1262
|
} finally {
|
|
1263
1263
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
1264
1264
|
}
|
|
@@ -1300,7 +1300,7 @@ class ye {
|
|
|
1300
1300
|
async waitForIdle(e = 1e3) {
|
|
1301
1301
|
let t = 0, r = 0;
|
|
1302
1302
|
for (; t < 2 && r < e; )
|
|
1303
|
-
this.processing || this.queue.length > 0 ? (await this.wait(), t = 0) : t += 1, await
|
|
1303
|
+
this.processing || this.queue.length > 0 ? (await this.wait(), t = 0) : t += 1, await Ae.nextTick(), r += 1;
|
|
1304
1304
|
}
|
|
1305
1305
|
/**
|
|
1306
1306
|
* 次のフレーム(または 1 マクロタスク)まで待機します。
|
|
@@ -1313,7 +1313,7 @@ class ye {
|
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
|
-
const
|
|
1316
|
+
const we = class we {
|
|
1317
1317
|
/**
|
|
1318
1318
|
* タスクをキューに追加します。
|
|
1319
1319
|
*
|
|
@@ -1340,8 +1340,8 @@ const Ee = class Ee {
|
|
|
1340
1340
|
return this.ASYNC_QUEUE.waitForIdle(e);
|
|
1341
1341
|
}
|
|
1342
1342
|
};
|
|
1343
|
-
|
|
1344
|
-
let
|
|
1343
|
+
we.ASYNC_QUEUE = new Ae();
|
|
1344
|
+
let P = we;
|
|
1345
1345
|
const x = class x {
|
|
1346
1346
|
/**
|
|
1347
1347
|
* 集計状態を初期化します。
|
|
@@ -1390,7 +1390,7 @@ const x = class x {
|
|
|
1390
1390
|
* @param expressions 今回評価した式一覧
|
|
1391
1391
|
*/
|
|
1392
1392
|
static record(e, t, r) {
|
|
1393
|
-
if (!
|
|
1393
|
+
if (!U.isEnabled() || !e || t.length === 0)
|
|
1394
1394
|
return;
|
|
1395
1395
|
x.ensureGlobalAccess();
|
|
1396
1396
|
const i = x.getOrCreateElementStore(
|
|
@@ -1424,7 +1424,7 @@ const x = class x {
|
|
|
1424
1424
|
* globalThis から dev-only の取得窓口を参照できるようにします。
|
|
1425
1425
|
*/
|
|
1426
1426
|
static ensureGlobalAccess() {
|
|
1427
|
-
if (!
|
|
1427
|
+
if (!U.isEnabled())
|
|
1428
1428
|
return;
|
|
1429
1429
|
const e = globalThis;
|
|
1430
1430
|
e[x.GLOBAL_KEY] === void 0 && (e[x.GLOBAL_KEY] = {
|
|
@@ -1558,8 +1558,8 @@ const x = class x {
|
|
|
1558
1558
|
i += `#${n.trim()}`, t.unshift(i);
|
|
1559
1559
|
break;
|
|
1560
1560
|
}
|
|
1561
|
-
const s = r.getAttribute(`${
|
|
1562
|
-
s && s.trim() !== "" && (i += `[${
|
|
1561
|
+
const s = r.getAttribute(`${u.prefix}derive-name`);
|
|
1562
|
+
s && s.trim() !== "" && (i += `[${u.prefix}derive-name="${s.trim()}"]`);
|
|
1563
1563
|
const a = r.parentElement;
|
|
1564
1564
|
a && (i += `:nth-child(${[...a.children].indexOf(r) + 1})`), t.unshift(i), r = a;
|
|
1565
1565
|
}
|
|
@@ -1567,7 +1567,7 @@ const x = class x {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
};
|
|
1569
1569
|
x.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", x.ELEMENT_STORES = /* @__PURE__ */ new Map();
|
|
1570
|
-
let
|
|
1570
|
+
let oe = x;
|
|
1571
1571
|
const Q = class Q {
|
|
1572
1572
|
/**
|
|
1573
1573
|
* フラグメントのコンストラクタ。
|
|
@@ -1591,10 +1591,10 @@ const Q = class Q {
|
|
|
1591
1591
|
t = new j(e);
|
|
1592
1592
|
break;
|
|
1593
1593
|
case Node.COMMENT_NODE:
|
|
1594
|
-
t = new
|
|
1594
|
+
t = new Se(e);
|
|
1595
1595
|
break;
|
|
1596
1596
|
default:
|
|
1597
|
-
return
|
|
1597
|
+
return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
1598
1598
|
}
|
|
1599
1599
|
return t;
|
|
1600
1600
|
}
|
|
@@ -1616,7 +1616,7 @@ const Q = class Q {
|
|
|
1616
1616
|
return Promise.resolve();
|
|
1617
1617
|
if (this.parent) {
|
|
1618
1618
|
const e = this.parent, t = e.skipMutationNodes;
|
|
1619
|
-
return
|
|
1619
|
+
return P.enqueue(() => {
|
|
1620
1620
|
e.skipMutationNodes = !0, this.target.parentNode === e.getTarget() && e.getTarget().removeChild(this.target), this.mounted = !1;
|
|
1621
1621
|
}).finally(() => {
|
|
1622
1622
|
e.skipMutationNodes = t;
|
|
@@ -1624,7 +1624,7 @@ const Q = class Q {
|
|
|
1624
1624
|
} else {
|
|
1625
1625
|
const e = this.target.parentNode;
|
|
1626
1626
|
if (e)
|
|
1627
|
-
return
|
|
1627
|
+
return P.enqueue(() => {
|
|
1628
1628
|
this.target.parentNode === e && e.removeChild(this.target), this.mounted = !1;
|
|
1629
1629
|
});
|
|
1630
1630
|
this.mounted = !1;
|
|
@@ -1641,7 +1641,7 @@ const Q = class Q {
|
|
|
1641
1641
|
return Promise.resolve();
|
|
1642
1642
|
if (this.parent) {
|
|
1643
1643
|
const e = this.parent, t = e.skipMutationNodes;
|
|
1644
|
-
return
|
|
1644
|
+
return P.enqueue(() => {
|
|
1645
1645
|
e.skipMutationNodes = !0, this.target.parentNode !== e.getTarget() && e.getTarget().appendChild(this.target), this.mounted = !0;
|
|
1646
1646
|
}).finally(() => {
|
|
1647
1647
|
e.skipMutationNodes = t;
|
|
@@ -1701,7 +1701,7 @@ const Q = class Q {
|
|
|
1701
1701
|
};
|
|
1702
1702
|
Q.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
1703
1703
|
let S = Q;
|
|
1704
|
-
const
|
|
1704
|
+
const q = class q extends S {
|
|
1705
1705
|
/**
|
|
1706
1706
|
* エレメントフラグメントのコンストラクタ。
|
|
1707
1707
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -1724,10 +1724,10 @@ const z = class z extends S {
|
|
|
1724
1724
|
"month",
|
|
1725
1725
|
"time",
|
|
1726
1726
|
"week"
|
|
1727
|
-
], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${
|
|
1727
|
+
], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${u.prefix}bind`), e.getAttributeNames().forEach((t) => {
|
|
1728
1728
|
const r = e.getAttribute(t);
|
|
1729
1729
|
if (r !== null && !this.attributeMap.has(t)) {
|
|
1730
|
-
const i = new
|
|
1730
|
+
const i = new le(t, r);
|
|
1731
1731
|
this.attributeMap.set(t, i);
|
|
1732
1732
|
}
|
|
1733
1733
|
}), e.childNodes.forEach((t) => {
|
|
@@ -1750,7 +1750,7 @@ const z = class z extends S {
|
|
|
1750
1750
|
*/
|
|
1751
1751
|
getChildElementFragments() {
|
|
1752
1752
|
return this.children.filter(
|
|
1753
|
-
(e) => e instanceof
|
|
1753
|
+
(e) => e instanceof q
|
|
1754
1754
|
);
|
|
1755
1755
|
}
|
|
1756
1756
|
/**
|
|
@@ -1771,7 +1771,7 @@ const z = class z extends S {
|
|
|
1771
1771
|
removeChild(e) {
|
|
1772
1772
|
const t = this.children.indexOf(e);
|
|
1773
1773
|
if (t < 0) {
|
|
1774
|
-
|
|
1774
|
+
m.warn("[Haori]", "Child fragment not found.", e);
|
|
1775
1775
|
return;
|
|
1776
1776
|
}
|
|
1777
1777
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -1782,7 +1782,7 @@ const z = class z extends S {
|
|
|
1782
1782
|
* @returns クローンされたフラグメント
|
|
1783
1783
|
*/
|
|
1784
1784
|
clone() {
|
|
1785
|
-
const e = new
|
|
1785
|
+
const e = new q(
|
|
1786
1786
|
this.target.cloneNode(!1)
|
|
1787
1787
|
);
|
|
1788
1788
|
return this.attributeMap.forEach((t, r) => {
|
|
@@ -1796,8 +1796,8 @@ const z = class z extends S {
|
|
|
1796
1796
|
* clone 時に runtime の hidden 状態だけを落とします。
|
|
1797
1797
|
*/
|
|
1798
1798
|
normalizeClonedVisibilityState() {
|
|
1799
|
-
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${
|
|
1800
|
-
e instanceof
|
|
1799
|
+
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${u.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${u.prefix}if-false`)), this.children.forEach((e) => {
|
|
1800
|
+
e instanceof q && e.normalizeClonedVisibilityState();
|
|
1801
1801
|
});
|
|
1802
1802
|
}
|
|
1803
1803
|
/**
|
|
@@ -1961,7 +1961,7 @@ const z = class z extends S {
|
|
|
1961
1961
|
*/
|
|
1962
1962
|
clearBindingDataCache() {
|
|
1963
1963
|
this.bindingDataCache = null, this.descendantBindingDataCache = null, this.children.forEach((e) => {
|
|
1964
|
-
e instanceof
|
|
1964
|
+
e instanceof q && e.clearBindingDataCache();
|
|
1965
1965
|
});
|
|
1966
1966
|
}
|
|
1967
1967
|
/**
|
|
@@ -2111,9 +2111,9 @@ const z = class z extends S {
|
|
|
2111
2111
|
return Promise.resolve();
|
|
2112
2112
|
const r = this.getTarget();
|
|
2113
2113
|
if (r instanceof HTMLInputElement && r.type === "file")
|
|
2114
|
-
return e === null || e === "" ? (this.value = null, r.value === "" ? Promise.resolve() :
|
|
2114
|
+
return e === null || e === "" ? (this.value = null, r.value === "" ? Promise.resolve() : P.enqueue(() => {
|
|
2115
2115
|
r.value = "";
|
|
2116
|
-
})) : (
|
|
2116
|
+
})) : (m.warn(
|
|
2117
2117
|
"[Haori]",
|
|
2118
2118
|
"A value cannot be assigned to input[type=file]; only clearing is supported.",
|
|
2119
2119
|
r
|
|
@@ -2121,14 +2121,14 @@ const z = class z extends S {
|
|
|
2121
2121
|
if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
|
|
2122
2122
|
const i = this.getAttribute("value"), n = r.type === "checkbox" && i === "true";
|
|
2123
2123
|
let s;
|
|
2124
|
-
return n ? s = e === !0 || e === "true" : i === "false" ? s = e === !1 : Array.isArray(e) ? s = e.map(String).includes(String(i)) : s = i === String(e), n ? this.value = s : s ? Array.isArray(e) ? this.value = String(i) : this.value = e : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0,
|
|
2124
|
+
return n ? s = e === !0 || e === "true" : i === "false" ? s = e === !1 : Array.isArray(e) ? s = e.map(String).includes(String(i)) : s = i === String(e), n ? this.value = s : s ? Array.isArray(e) ? this.value = String(i) : this.value = e : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, P.enqueue(() => {
|
|
2125
2125
|
r.checked = s, t && r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2126
2126
|
}).finally(() => {
|
|
2127
2127
|
this.skipChangeValue = !1;
|
|
2128
2128
|
}));
|
|
2129
2129
|
} else if (r instanceof HTMLSelectElement && r.multiple) {
|
|
2130
2130
|
const i = (Array.isArray(e) ? e : e === null ? [] : [e]).map(String);
|
|
2131
|
-
return this.value = i.slice(), this.skipChangeValue = !0,
|
|
2131
|
+
return this.value = i.slice(), this.skipChangeValue = !0, P.enqueue(() => {
|
|
2132
2132
|
let n = !1;
|
|
2133
2133
|
Array.from(r.options).forEach((s) => {
|
|
2134
2134
|
const a = i.includes(s.value);
|
|
@@ -2139,13 +2139,13 @@ const z = class z extends S {
|
|
|
2139
2139
|
});
|
|
2140
2140
|
} else if (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement) {
|
|
2141
2141
|
const i = Array.isArray(e) ? e.join(",") : e;
|
|
2142
|
-
return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0,
|
|
2142
|
+
return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0, P.enqueue(() => {
|
|
2143
2143
|
r.value = i === null ? "" : String(i), t && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
2144
2144
|
}).finally(() => {
|
|
2145
2145
|
this.skipChangeValue = !1;
|
|
2146
2146
|
});
|
|
2147
2147
|
} else
|
|
2148
|
-
return
|
|
2148
|
+
return m.warn(
|
|
2149
2149
|
"[Haori]",
|
|
2150
2150
|
"setValue is not supported for this element type.",
|
|
2151
2151
|
r
|
|
@@ -2211,6 +2211,26 @@ const z = class z extends S {
|
|
|
2211
2211
|
(t) => t.value
|
|
2212
2212
|
) : this.value = e.value);
|
|
2213
2213
|
}
|
|
2214
|
+
/**
|
|
2215
|
+
* チェック状態の DOM 反映に合わせて内部値を DOM から同期します。
|
|
2216
|
+
*
|
|
2217
|
+
* `checked` を反映した場合は自身の内部値を、`option` の `selected` を反映した
|
|
2218
|
+
* 場合は所属する `<select>` の内部値を同期します(option 自身は値収集の対象では
|
|
2219
|
+
* なく、選択によって変化するのは select の値のため)。
|
|
2220
|
+
*
|
|
2221
|
+
* @param forSelectedOption `option` の `selected` を反映した場合に true
|
|
2222
|
+
*/
|
|
2223
|
+
syncCheckableValueFromDom(e) {
|
|
2224
|
+
if (!e) {
|
|
2225
|
+
this.syncValue();
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
const t = this.getTarget().closest("select");
|
|
2229
|
+
if (!t)
|
|
2230
|
+
return;
|
|
2231
|
+
const r = S.get(t);
|
|
2232
|
+
r instanceof q && r.syncValue();
|
|
2233
|
+
}
|
|
2214
2234
|
/**
|
|
2215
2235
|
* 属性の値を評価して設定します。
|
|
2216
2236
|
* 評価値がfalseの場合は属性を削除します。
|
|
@@ -2252,7 +2272,7 @@ const z = class z extends S {
|
|
|
2252
2272
|
return Promise.resolve();
|
|
2253
2273
|
this.attributeMap.delete(e), this.skipMutationAttributes = !0;
|
|
2254
2274
|
const r = this.getTarget();
|
|
2255
|
-
return
|
|
2275
|
+
return P.enqueue(() => {
|
|
2256
2276
|
r.removeAttribute(e), t !== e && r.removeAttribute(t);
|
|
2257
2277
|
}).finally(() => {
|
|
2258
2278
|
this.skipMutationAttributes = !1;
|
|
@@ -2272,11 +2292,11 @@ const z = class z extends S {
|
|
|
2272
2292
|
return Promise.resolve();
|
|
2273
2293
|
if (r === null)
|
|
2274
2294
|
return e === t ? this.removeAttribute(e) : this.removeAliasedAttribute(e, t);
|
|
2275
|
-
const s = new
|
|
2295
|
+
const s = new le(e, r);
|
|
2276
2296
|
if (n) {
|
|
2277
|
-
const
|
|
2278
|
-
if (
|
|
2279
|
-
return this.skipMutationAttributes = !0,
|
|
2297
|
+
const me = this.attributeMap.get(e);
|
|
2298
|
+
if (me && (me.isEvaluate || me.isForceEvaluation()) && !s.isEvaluate && !s.isForceEvaluation())
|
|
2299
|
+
return this.skipMutationAttributes = !0, P.enqueue(() => {
|
|
2280
2300
|
}).finally(() => {
|
|
2281
2301
|
this.skipMutationAttributes = !1;
|
|
2282
2302
|
});
|
|
@@ -2287,9 +2307,9 @@ const z = class z extends S {
|
|
|
2287
2307
|
element: a,
|
|
2288
2308
|
rawName: e,
|
|
2289
2309
|
template: r
|
|
2290
|
-
}), l = s.isEvaluate || s.isRawEvaluate,
|
|
2291
|
-
return !R && !C && !F && !
|
|
2292
|
-
R && a.setAttribute(e, r), v === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, v), t === `${
|
|
2310
|
+
}), l = s.isEvaluate || s.isRawEvaluate, h = e === t && q.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), c = s.isSingleExpression(), p = Y.joinEvaluateResults(o.results), y = o.results.length === 1 ? o.results[0] : p, T = !s.isForceEvaluation() && (t !== e || h || c ? o.hasUnresolvedReference || y === null || y === void 0 || y === !1 : l && p === ""), I = s.isForceEvaluation() ? r : c ? y : p, H = i && s.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), E = a.getRootNode(), b = H && a === E.activeElement, v = T || I === null || I === !1 ? null : String(I), R = e !== t && a.getAttribute(e) !== r, C = v === null ? a.hasAttribute(t) : a.getAttribute(t) !== v, F = H && !b && v !== null && a.value !== v, L = t === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), B = t === "selected" && a instanceof HTMLOptionElement, K = E.activeElement, ge = K !== null && (L && a === K || B && a.closest("select") === K), re = v !== null, pe = L && !ge && a.checked !== re, ie = B && !ge && a.selected !== re;
|
|
2311
|
+
return !R && !C && !F && !pe && !ie ? (H && !b && v !== null && (this.value = this.normalizeValueForElement(a, v)), (L || B) && !ge && this.syncCheckableValueFromDom(B), Promise.resolve()) : (this.skipMutationAttributes = !0, P.enqueue(() => {
|
|
2312
|
+
R && a.setAttribute(e, r), v === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, v), t === `${u.prefix}bind` && this.recordSelfWrittenBind(v)), H && !b && (this.value = this.normalizeValueForElement(a, v), F && (a.value = v))), pe && (a.checked = re), ie && (a.selected = re), (pe || ie) && this.syncCheckableValueFromDom(ie);
|
|
2293
2313
|
}).finally(() => {
|
|
2294
2314
|
this.skipMutationAttributes = !1;
|
|
2295
2315
|
}));
|
|
@@ -2305,7 +2325,7 @@ const z = class z extends S {
|
|
|
2305
2325
|
return Promise.resolve();
|
|
2306
2326
|
this.attributeMap.delete(e), this.skipMutationAttributes = !0;
|
|
2307
2327
|
const t = this.getTarget();
|
|
2308
|
-
return
|
|
2328
|
+
return P.enqueue(() => {
|
|
2309
2329
|
t.removeAttribute(e);
|
|
2310
2330
|
}).finally(() => {
|
|
2311
2331
|
this.skipMutationAttributes = !1;
|
|
@@ -2408,42 +2428,42 @@ const z = class z extends S {
|
|
|
2408
2428
|
if (this.skipMutationNodes)
|
|
2409
2429
|
return Promise.resolve();
|
|
2410
2430
|
if (e === this)
|
|
2411
|
-
return
|
|
2431
|
+
return m.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
2412
2432
|
const i = /* @__PURE__ */ new Set();
|
|
2413
2433
|
let n = this.parent;
|
|
2414
2434
|
for (; n; )
|
|
2415
2435
|
i.add(n), n = n.getParent();
|
|
2416
2436
|
if (i.has(e))
|
|
2417
|
-
return
|
|
2437
|
+
return m.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
2418
2438
|
const s = e.getParent() === this;
|
|
2419
2439
|
let a = -1, o = -1;
|
|
2420
2440
|
s && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
|
|
2421
2441
|
const l = e.getParent();
|
|
2422
2442
|
l !== null && l.removeChild(e);
|
|
2423
|
-
let
|
|
2443
|
+
let h = r === void 0 ? t?.getTarget() || null : r;
|
|
2424
2444
|
if (t === null)
|
|
2425
2445
|
this.children.push(e);
|
|
2426
2446
|
else {
|
|
2427
|
-
let
|
|
2428
|
-
if (s ? a !== -1 && a < o ?
|
|
2447
|
+
let p;
|
|
2448
|
+
if (s ? a !== -1 && a < o ? p = o - 1 : p = o : p = this.children.indexOf(t), p === -1) {
|
|
2429
2449
|
const y = this.resolveInsertionPointFromDom(
|
|
2430
2450
|
t,
|
|
2431
2451
|
!1
|
|
2432
2452
|
);
|
|
2433
|
-
y === null ? (
|
|
2453
|
+
y === null ? (m.warn(
|
|
2434
2454
|
"[Haori]",
|
|
2435
2455
|
"Reference child not found in children.",
|
|
2436
2456
|
t
|
|
2437
|
-
), this.children.push(e)) : (this.children.splice(y.index, 0, e),
|
|
2457
|
+
), this.children.push(e)) : (this.children.splice(y.index, 0, e), h = y.referenceNode);
|
|
2438
2458
|
} else
|
|
2439
|
-
this.children.splice(
|
|
2459
|
+
this.children.splice(p, 0, e);
|
|
2440
2460
|
}
|
|
2441
2461
|
e.setParent(this), e.setMounted(this.mounted);
|
|
2442
|
-
const
|
|
2443
|
-
return this.skipMutationNodes = !0,
|
|
2444
|
-
this.target.insertBefore(e.getTarget(),
|
|
2462
|
+
const c = this.skipMutationNodes;
|
|
2463
|
+
return this.skipMutationNodes = !0, P.enqueue(() => {
|
|
2464
|
+
this.target.insertBefore(e.getTarget(), h);
|
|
2445
2465
|
}).finally(() => {
|
|
2446
|
-
this.skipMutationNodes =
|
|
2466
|
+
this.skipMutationNodes = c;
|
|
2447
2467
|
});
|
|
2448
2468
|
}
|
|
2449
2469
|
/**
|
|
@@ -2462,7 +2482,7 @@ const z = class z extends S {
|
|
|
2462
2482
|
t,
|
|
2463
2483
|
!0
|
|
2464
2484
|
);
|
|
2465
|
-
return i === null ? (
|
|
2485
|
+
return i === null ? (m.warn(
|
|
2466
2486
|
"[Haori]",
|
|
2467
2487
|
"Reference child not found in children.",
|
|
2468
2488
|
t
|
|
@@ -2518,7 +2538,7 @@ const z = class z extends S {
|
|
|
2518
2538
|
return Promise.resolve();
|
|
2519
2539
|
this.visible = !1;
|
|
2520
2540
|
const e = this.getTarget();
|
|
2521
|
-
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${
|
|
2541
|
+
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${u.prefix}if-false`, ""), Promise.resolve();
|
|
2522
2542
|
}
|
|
2523
2543
|
/**
|
|
2524
2544
|
* エレメントを表示します。
|
|
@@ -2533,7 +2553,7 @@ const z = class z extends S {
|
|
|
2533
2553
|
"display",
|
|
2534
2554
|
this.display,
|
|
2535
2555
|
this.displayPriority ?? ""
|
|
2536
|
-
), this.display = null, this.displayPriority = null, e.removeAttribute(`${
|
|
2556
|
+
), this.display = null, this.displayPriority = null, e.removeAttribute(`${u.prefix}if-false`), this.visible = !0, Promise.resolve();
|
|
2537
2557
|
}
|
|
2538
2558
|
/**
|
|
2539
2559
|
* 指定した属性名を持つ最も近い親要素を返します。
|
|
@@ -2549,7 +2569,7 @@ const z = class z extends S {
|
|
|
2549
2569
|
return t === null ? null : t.closestByAttribute(e);
|
|
2550
2570
|
}
|
|
2551
2571
|
};
|
|
2552
|
-
|
|
2572
|
+
q.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
2553
2573
|
"allowfullscreen",
|
|
2554
2574
|
"async",
|
|
2555
2575
|
"autofocus",
|
|
@@ -2574,7 +2594,7 @@ z.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
2574
2594
|
"reversed",
|
|
2575
2595
|
"selected"
|
|
2576
2596
|
]);
|
|
2577
|
-
let M =
|
|
2597
|
+
let M = q;
|
|
2578
2598
|
class j extends S {
|
|
2579
2599
|
/**
|
|
2580
2600
|
* テキストフラグメントのコンストラクタ。
|
|
@@ -2627,7 +2647,7 @@ class j extends S {
|
|
|
2627
2647
|
evaluate() {
|
|
2628
2648
|
return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
|
|
2629
2649
|
new Error("Parent fragment is required for raw evaluation")
|
|
2630
|
-
) :
|
|
2650
|
+
) : P.enqueue(() => {
|
|
2631
2651
|
this.skipMutation = !0;
|
|
2632
2652
|
let e = this.text;
|
|
2633
2653
|
this.contents.isRawEvaluate ? e = this.contents.evaluate(
|
|
@@ -2653,7 +2673,7 @@ class j extends S {
|
|
|
2653
2673
|
});
|
|
2654
2674
|
}
|
|
2655
2675
|
}
|
|
2656
|
-
class
|
|
2676
|
+
class Se extends S {
|
|
2657
2677
|
/**
|
|
2658
2678
|
* コメントフラグメントのコンストラクタ。
|
|
2659
2679
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -2669,7 +2689,7 @@ class ve extends S {
|
|
|
2669
2689
|
* @returns クローンされたフラグメント
|
|
2670
2690
|
*/
|
|
2671
2691
|
clone() {
|
|
2672
|
-
const e = new
|
|
2692
|
+
const e = new Se(this.target.cloneNode(!0));
|
|
2673
2693
|
return e.mounted = !1, e.text = this.text, e;
|
|
2674
2694
|
}
|
|
2675
2695
|
/**
|
|
@@ -2687,14 +2707,14 @@ class ve extends S {
|
|
|
2687
2707
|
* @return 更新のPromise
|
|
2688
2708
|
*/
|
|
2689
2709
|
setContent(e) {
|
|
2690
|
-
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e,
|
|
2710
|
+
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, P.enqueue(() => {
|
|
2691
2711
|
this.skipMutation = !0, this.target.textContent = this.text;
|
|
2692
2712
|
}).finally(() => {
|
|
2693
2713
|
this.skipMutation = !1;
|
|
2694
2714
|
}));
|
|
2695
2715
|
}
|
|
2696
2716
|
}
|
|
2697
|
-
const
|
|
2717
|
+
const ce = class ce {
|
|
2698
2718
|
/**
|
|
2699
2719
|
* コンストラクタ。
|
|
2700
2720
|
*
|
|
@@ -2702,7 +2722,7 @@ const ue = class ue {
|
|
|
2702
2722
|
*/
|
|
2703
2723
|
constructor(e) {
|
|
2704
2724
|
this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = e;
|
|
2705
|
-
const t = [...e.matchAll(
|
|
2725
|
+
const t = [...e.matchAll(ce.PLACEHOLDER_REGEX)];
|
|
2706
2726
|
let r = 0, i = !1, n = !1;
|
|
2707
2727
|
for (const s of t) {
|
|
2708
2728
|
s.index > r && this.contents.push({
|
|
@@ -2753,7 +2773,7 @@ const ue = class ue {
|
|
|
2753
2773
|
*/
|
|
2754
2774
|
checkRawExpressions() {
|
|
2755
2775
|
for (let e = 0; e < this.contents.length; e++)
|
|
2756
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
2776
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (m.error(
|
|
2757
2777
|
"[Haori]",
|
|
2758
2778
|
"Raw expressions are not allowed in multi-content expressions."
|
|
2759
2779
|
), this.contents[e].type = 1);
|
|
@@ -2799,35 +2819,35 @@ const ue = class ue {
|
|
|
2799
2819
|
return this.contents.forEach((l) => {
|
|
2800
2820
|
try {
|
|
2801
2821
|
if (r(l)) {
|
|
2802
|
-
const
|
|
2822
|
+
const h = oe.measure(
|
|
2803
2823
|
() => G.evaluateDetailed(l.text, e)
|
|
2804
|
-
),
|
|
2805
|
-
a +=
|
|
2824
|
+
), c = h.value;
|
|
2825
|
+
a += h.durationMs, s.push({
|
|
2806
2826
|
expression: l.text,
|
|
2807
|
-
durationMs:
|
|
2808
|
-
}), o = o ||
|
|
2827
|
+
durationMs: h.durationMs
|
|
2828
|
+
}), o = o || c.unresolvedReference, n.push(c.value);
|
|
2809
2829
|
} else
|
|
2810
2830
|
n.push(l.text);
|
|
2811
|
-
} catch (
|
|
2812
|
-
|
|
2831
|
+
} catch (h) {
|
|
2832
|
+
m.error(
|
|
2813
2833
|
"[Haori]",
|
|
2814
2834
|
`Error evaluating ${i} expression: ${l.text}`,
|
|
2815
|
-
|
|
2835
|
+
h
|
|
2816
2836
|
), s.push({
|
|
2817
2837
|
expression: l.text,
|
|
2818
2838
|
durationMs: 0
|
|
2819
2839
|
}), n.push("");
|
|
2820
2840
|
}
|
|
2821
|
-
}),
|
|
2841
|
+
}), oe.record(
|
|
2822
2842
|
t,
|
|
2823
2843
|
s,
|
|
2824
2844
|
a
|
|
2825
2845
|
), { results: n, hasUnresolvedReference: o };
|
|
2826
2846
|
}
|
|
2827
2847
|
};
|
|
2828
|
-
|
|
2829
|
-
let Y =
|
|
2830
|
-
const
|
|
2848
|
+
ce.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
|
|
2849
|
+
let Y = ce;
|
|
2850
|
+
const he = class he extends Y {
|
|
2831
2851
|
/**
|
|
2832
2852
|
* コンストラクタ。
|
|
2833
2853
|
*
|
|
@@ -2835,7 +2855,7 @@ const ce = class ce extends Y {
|
|
|
2835
2855
|
* @param text 属性値
|
|
2836
2856
|
*/
|
|
2837
2857
|
constructor(e, t) {
|
|
2838
|
-
super(t), this.forceEvaluation =
|
|
2858
|
+
super(t), this.forceEvaluation = he.FORCE_EVALUATION_ATTRIBUTES.includes(e);
|
|
2839
2859
|
}
|
|
2840
2860
|
/**
|
|
2841
2861
|
* 強制評価フラグを取得します。
|
|
@@ -2872,7 +2892,7 @@ const ce = class ce extends Y {
|
|
|
2872
2892
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
2873
2893
|
"attribute"
|
|
2874
2894
|
);
|
|
2875
|
-
return this.forceEvaluation && r.results.length > 1 ? (
|
|
2895
|
+
return this.forceEvaluation && r.results.length > 1 ? (m.error(
|
|
2876
2896
|
"[Haori]",
|
|
2877
2897
|
"each or if expressions must have a single content.",
|
|
2878
2898
|
r.results
|
|
@@ -2882,7 +2902,7 @@ const ce = class ce extends Y {
|
|
|
2882
2902
|
}) : r;
|
|
2883
2903
|
}
|
|
2884
2904
|
};
|
|
2885
|
-
|
|
2905
|
+
he.FORCE_EVALUATION_ATTRIBUTES = [
|
|
2886
2906
|
"data-if",
|
|
2887
2907
|
"hor-if",
|
|
2888
2908
|
"data-each",
|
|
@@ -2890,7 +2910,7 @@ ce.FORCE_EVALUATION_ATTRIBUTES = [
|
|
|
2890
2910
|
"data-derive",
|
|
2891
2911
|
"hor-derive"
|
|
2892
2912
|
];
|
|
2893
|
-
let
|
|
2913
|
+
let le = he;
|
|
2894
2914
|
class Z {
|
|
2895
2915
|
/**
|
|
2896
2916
|
* 実行モードを取得します。
|
|
@@ -2898,7 +2918,7 @@ class Z {
|
|
|
2898
2918
|
* @return 実行モード。
|
|
2899
2919
|
*/
|
|
2900
2920
|
static get runtime() {
|
|
2901
|
-
return
|
|
2921
|
+
return u.runtime;
|
|
2902
2922
|
}
|
|
2903
2923
|
/**
|
|
2904
2924
|
* 実行モードを設定します。
|
|
@@ -2907,7 +2927,7 @@ class Z {
|
|
|
2907
2927
|
* @return 戻り値はありません。
|
|
2908
2928
|
*/
|
|
2909
2929
|
static setRuntime(e) {
|
|
2910
|
-
|
|
2930
|
+
u.setRuntime(e);
|
|
2911
2931
|
}
|
|
2912
2932
|
/**
|
|
2913
2933
|
* 進行中・追従して投入されるものを含め、すべてのレンダリングタスクの完了を待ちます。
|
|
@@ -2921,7 +2941,7 @@ class Z {
|
|
|
2921
2941
|
* @return すべてのレンダリングが完了したら解決される Promise
|
|
2922
2942
|
*/
|
|
2923
2943
|
static waitForRenders() {
|
|
2924
|
-
return
|
|
2944
|
+
return P.waitForIdle();
|
|
2925
2945
|
}
|
|
2926
2946
|
/**
|
|
2927
2947
|
* 通知ダイアログを表示します。
|
|
@@ -2930,7 +2950,7 @@ class Z {
|
|
|
2930
2950
|
* @returns 通知が閉じられると解決されるPromise
|
|
2931
2951
|
*/
|
|
2932
2952
|
static dialog(e) {
|
|
2933
|
-
return
|
|
2953
|
+
return P.enqueue(() => {
|
|
2934
2954
|
window.alert(e);
|
|
2935
2955
|
}, !0);
|
|
2936
2956
|
}
|
|
@@ -2958,7 +2978,7 @@ class Z {
|
|
|
2958
2978
|
* @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
|
|
2959
2979
|
*/
|
|
2960
2980
|
static confirm(e) {
|
|
2961
|
-
return
|
|
2981
|
+
return P.enqueue(() => window.confirm(e), !0);
|
|
2962
2982
|
}
|
|
2963
2983
|
/**
|
|
2964
2984
|
* ダイアログを開きます。
|
|
@@ -2966,8 +2986,8 @@ class Z {
|
|
|
2966
2986
|
* @param element 開くダイアログのHTML要素
|
|
2967
2987
|
*/
|
|
2968
2988
|
static openDialog(e) {
|
|
2969
|
-
return
|
|
2970
|
-
e instanceof HTMLDialogElement ? (Z.clearMessagesSync(e), e.showModal()) :
|
|
2989
|
+
return P.enqueue(() => {
|
|
2990
|
+
e instanceof HTMLDialogElement ? (Z.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2971
2991
|
}, !0);
|
|
2972
2992
|
}
|
|
2973
2993
|
/**
|
|
@@ -2976,8 +2996,8 @@ class Z {
|
|
|
2976
2996
|
* @param element 閉じるダイアログのHTML要素
|
|
2977
2997
|
*/
|
|
2978
2998
|
static closeDialog(e) {
|
|
2979
|
-
return
|
|
2980
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
2999
|
+
return P.enqueue(() => {
|
|
3000
|
+
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2981
3001
|
}, !0);
|
|
2982
3002
|
}
|
|
2983
3003
|
/**
|
|
@@ -2997,7 +3017,7 @@ class Z {
|
|
|
2997
3017
|
* @param level メッセージのレベル(省略可能)
|
|
2998
3018
|
*/
|
|
2999
3019
|
static addMessage(e, t, r) {
|
|
3000
|
-
return
|
|
3020
|
+
return P.enqueue(() => {
|
|
3001
3021
|
const i = e instanceof HTMLFormElement ? e : e.parentElement ?? e;
|
|
3002
3022
|
i.setAttribute("data-message", t), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
|
|
3003
3023
|
}, !0);
|
|
@@ -3008,7 +3028,7 @@ class Z {
|
|
|
3008
3028
|
* @param parent メッセージをクリアする親要素
|
|
3009
3029
|
*/
|
|
3010
3030
|
static clearMessages(e) {
|
|
3011
|
-
return
|
|
3031
|
+
return P.enqueue(() => {
|
|
3012
3032
|
Z.clearMessagesSync(e);
|
|
3013
3033
|
}, !0);
|
|
3014
3034
|
}
|
|
@@ -3063,7 +3083,7 @@ class Z {
|
|
|
3063
3083
|
* @returns 整形済みの日付文字列。timeZone が不正な場合は空文字
|
|
3064
3084
|
*/
|
|
3065
3085
|
static today(e, t, r) {
|
|
3066
|
-
return
|
|
3086
|
+
return ke(e, t, r);
|
|
3067
3087
|
}
|
|
3068
3088
|
/**
|
|
3069
3089
|
* 数値を桁区切り・小数桁付きの文字列へ整形します。
|
|
@@ -3075,7 +3095,7 @@ class Z {
|
|
|
3075
3095
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
3076
3096
|
*/
|
|
3077
3097
|
static number(e, t) {
|
|
3078
|
-
return
|
|
3098
|
+
return Pe(e, t);
|
|
3079
3099
|
}
|
|
3080
3100
|
/**
|
|
3081
3101
|
* 整数の配列を生成します(終端は排他)。
|
|
@@ -3088,7 +3108,7 @@ class Z {
|
|
|
3088
3108
|
* @returns 整数配列
|
|
3089
3109
|
*/
|
|
3090
3110
|
static range(e, t, r) {
|
|
3091
|
-
return
|
|
3111
|
+
return Ie(e, t, r);
|
|
3092
3112
|
}
|
|
3093
3113
|
/**
|
|
3094
3114
|
* 番号ページネーション用の表示要素列を生成します。
|
|
@@ -3113,7 +3133,7 @@ class Z {
|
|
|
3113
3133
|
* @returns 加算後の年月(`YYYY-MM` 形式)。不正な入力は空文字
|
|
3114
3134
|
*/
|
|
3115
3135
|
static monthAdd(e, t) {
|
|
3116
|
-
return
|
|
3136
|
+
return fe(e, t);
|
|
3117
3137
|
}
|
|
3118
3138
|
/**
|
|
3119
3139
|
* 基準月から過去方向へ `count + 1` 個の年月配列を降順で返します。
|
|
@@ -3230,8 +3250,25 @@ class A {
|
|
|
3230
3250
|
const r = t, i = r.files ? Array.from(r.files) : [];
|
|
3231
3251
|
return r.multiple ? i : i.length > 0 ? i[0] : null;
|
|
3232
3252
|
}
|
|
3253
|
+
if (A.isBooleanCheckbox(e)) {
|
|
3254
|
+
const r = t;
|
|
3255
|
+
return r.value === "false" ? !r.checked : r.checked;
|
|
3256
|
+
}
|
|
3233
3257
|
return e.getValue();
|
|
3234
3258
|
}
|
|
3259
|
+
/**
|
|
3260
|
+
* boolean 値として扱うチェックボックスかどうかを判定します。
|
|
3261
|
+
*
|
|
3262
|
+
* `value="true"` は「チェック時に `true`」、`value="false"` は「チェック時に
|
|
3263
|
+
* `false`」を表す単一の真偽値入力で、同名グループとしては扱いません。
|
|
3264
|
+
*
|
|
3265
|
+
* @param fragment 対象フラグメント
|
|
3266
|
+
* @returns boolean チェックボックスの場合 true
|
|
3267
|
+
*/
|
|
3268
|
+
static isBooleanCheckbox(e) {
|
|
3269
|
+
const t = e.getTarget();
|
|
3270
|
+
return t instanceof HTMLInputElement && t.type === "checkbox" && (t.value === "true" || t.value === "false");
|
|
3271
|
+
}
|
|
3235
3272
|
/**
|
|
3236
3273
|
* `input[type=file]` かどうかを判定します。
|
|
3237
3274
|
*
|
|
@@ -3251,9 +3288,9 @@ class A {
|
|
|
3251
3288
|
* @returns values と同じオブジェクト
|
|
3252
3289
|
*/
|
|
3253
3290
|
static getPartValues(e, t) {
|
|
3254
|
-
if (e.getTarget().hasAttribute(`${
|
|
3291
|
+
if (e.getTarget().hasAttribute(`${u.prefix}if-false`))
|
|
3255
3292
|
return t;
|
|
3256
|
-
const r = e.getAttribute("name"), i = e.getAttribute(`${
|
|
3293
|
+
const r = e.getAttribute("name"), i = e.getAttribute(`${u.prefix}form-object`), n = e.getAttribute(`${u.prefix}form-list`);
|
|
3257
3294
|
if (r) {
|
|
3258
3295
|
if (n) {
|
|
3259
3296
|
const s = A.resolveCollectedValue(e), a = A.isFileInput(e) && Array.isArray(s) ? s : [s];
|
|
@@ -3263,9 +3300,9 @@ class A {
|
|
|
3263
3300
|
o === null ? l in t || (t[l] = null) : t[l] === null || t[l] === void 0 ? t[l] = o : Array.isArray(t[l]) ? t[l].push(o) : t[l] = [t[l], o];
|
|
3264
3301
|
} else
|
|
3265
3302
|
t[String(r)] = A.resolveCollectedValue(e);
|
|
3266
|
-
i &&
|
|
3303
|
+
i && m.warn(
|
|
3267
3304
|
"Haori",
|
|
3268
|
-
`Element cannot have both ${
|
|
3305
|
+
`Element cannot have both ${u.prefix}form-object and name attributes.`
|
|
3269
3306
|
);
|
|
3270
3307
|
for (const s of e.getChildElementFragments())
|
|
3271
3308
|
A.getPartValues(s, t);
|
|
@@ -3273,9 +3310,9 @@ class A {
|
|
|
3273
3310
|
const s = {};
|
|
3274
3311
|
for (const a of e.getChildElementFragments())
|
|
3275
3312
|
A.getPartValues(a, s);
|
|
3276
|
-
Object.keys(s).length > 0 && (t[String(i)] = s), n &&
|
|
3313
|
+
Object.keys(s).length > 0 && (t[String(i)] = s), n && m.warn(
|
|
3277
3314
|
"Haori",
|
|
3278
|
-
`Element cannot have both ${
|
|
3315
|
+
`Element cannot have both ${u.prefix}form-list and ${u.prefix}form-object attributes.`
|
|
3279
3316
|
);
|
|
3280
3317
|
} else if (n) {
|
|
3281
3318
|
const s = [];
|
|
@@ -3355,48 +3392,48 @@ class A {
|
|
|
3355
3392
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
3356
3393
|
*/
|
|
3357
3394
|
static setPartValues(e, t, r = null, i = !1, n = !0) {
|
|
3358
|
-
const s = [], a = e.getAttribute("name"), o = e.getAttribute(`${
|
|
3395
|
+
const s = [], a = e.getAttribute("name"), o = e.getAttribute(`${u.prefix}form-object`), l = e.getAttribute(`${u.prefix}form-list`), h = e.getAttribute(`${u.prefix}form-detach`);
|
|
3359
3396
|
if (a) {
|
|
3360
|
-
if (!
|
|
3361
|
-
const
|
|
3397
|
+
if (!h || i) {
|
|
3398
|
+
const c = t[String(a)];
|
|
3362
3399
|
if (A.isFileInput(e))
|
|
3363
|
-
return (
|
|
3400
|
+
return (c === null || c === "") && s.push(A.applyFragmentValue(e, null, n)), Promise.all(s).then(() => {
|
|
3364
3401
|
});
|
|
3365
|
-
l && Array.isArray(
|
|
3366
|
-
A.applyFragmentValue(e,
|
|
3367
|
-
) : typeof
|
|
3402
|
+
l && Array.isArray(c) && r !== null ? s.push(
|
|
3403
|
+
A.applyFragmentValue(e, c[r] ?? null, n)
|
|
3404
|
+
) : typeof c > "u" || (Array.isArray(c) && A.isGroupedCheckable(e) || Array.isArray(c) && A.isMultipleSelect(e) || typeof c == "string" || typeof c == "number" || typeof c == "boolean" || c === null ? s.push(
|
|
3368
3405
|
A.applyFragmentValue(
|
|
3369
3406
|
e,
|
|
3370
|
-
|
|
3407
|
+
c,
|
|
3371
3408
|
n
|
|
3372
3409
|
)
|
|
3373
3410
|
) : s.push(
|
|
3374
|
-
A.applyFragmentValue(e, String(
|
|
3411
|
+
A.applyFragmentValue(e, String(c), n)
|
|
3375
3412
|
));
|
|
3376
3413
|
}
|
|
3377
3414
|
} else if (o) {
|
|
3378
|
-
const
|
|
3379
|
-
if (
|
|
3380
|
-
for (const
|
|
3415
|
+
const c = t[String(o)];
|
|
3416
|
+
if (c && typeof c == "object")
|
|
3417
|
+
for (const p of e.getChildElementFragments())
|
|
3381
3418
|
s.push(
|
|
3382
3419
|
A.setPartValues(
|
|
3383
|
-
|
|
3384
|
-
|
|
3420
|
+
p,
|
|
3421
|
+
c,
|
|
3385
3422
|
null,
|
|
3386
3423
|
i,
|
|
3387
3424
|
n
|
|
3388
3425
|
)
|
|
3389
3426
|
);
|
|
3390
3427
|
} else if (l) {
|
|
3391
|
-
const
|
|
3392
|
-
if (Array.isArray(
|
|
3393
|
-
const
|
|
3394
|
-
for (let y = 0; y <
|
|
3395
|
-
const T =
|
|
3396
|
-
|
|
3428
|
+
const c = t[String(l)];
|
|
3429
|
+
if (Array.isArray(c)) {
|
|
3430
|
+
const p = e.getChildElementFragments();
|
|
3431
|
+
for (let y = 0; y < p.length; y++) {
|
|
3432
|
+
const T = p[y];
|
|
3433
|
+
c.length > y ? s.push(
|
|
3397
3434
|
A.setPartValues(
|
|
3398
3435
|
T,
|
|
3399
|
-
|
|
3436
|
+
c[y],
|
|
3400
3437
|
y,
|
|
3401
3438
|
i,
|
|
3402
3439
|
n
|
|
@@ -3405,9 +3442,9 @@ class A {
|
|
|
3405
3442
|
}
|
|
3406
3443
|
}
|
|
3407
3444
|
} else
|
|
3408
|
-
for (const
|
|
3445
|
+
for (const c of e.getChildElementFragments())
|
|
3409
3446
|
s.push(
|
|
3410
|
-
A.setPartValues(
|
|
3447
|
+
A.setPartValues(c, t, null, i, n)
|
|
3411
3448
|
);
|
|
3412
3449
|
return Promise.all(s).then(() => {
|
|
3413
3450
|
});
|
|
@@ -3423,7 +3460,7 @@ class A {
|
|
|
3423
3460
|
A.clearValues(e), await Promise.all([
|
|
3424
3461
|
A.clearMessages(e),
|
|
3425
3462
|
A.clearEachClones(e)
|
|
3426
|
-
]), await
|
|
3463
|
+
]), await P.enqueue(() => {
|
|
3427
3464
|
const r = e.getTarget();
|
|
3428
3465
|
if (r instanceof HTMLFormElement)
|
|
3429
3466
|
r.reset();
|
|
@@ -3439,17 +3476,17 @@ class A {
|
|
|
3439
3476
|
const t = A.collectBindingTargetForms(e);
|
|
3440
3477
|
for (const r of t) {
|
|
3441
3478
|
const i = A.getInitialBindingData(r);
|
|
3442
|
-
i && await
|
|
3479
|
+
i && await k.setBindingData(r.getTarget(), i);
|
|
3443
3480
|
}
|
|
3444
3481
|
A.syncValuesFromDom(e);
|
|
3445
3482
|
for (const r of t) {
|
|
3446
3483
|
const i = A.getInitialBindingData(r);
|
|
3447
3484
|
if (r.getRawBindingData() === null && i === null)
|
|
3448
3485
|
continue;
|
|
3449
|
-
const n = A.getValues(r), s = r.getAttribute(`${
|
|
3450
|
-
s ? a[String(s)] = n : Object.assign(a, n), await
|
|
3486
|
+
const n = A.getValues(r), s = r.getAttribute(`${u.prefix}form-arg`), a = { ...i || {} };
|
|
3487
|
+
s ? a[String(s)] = n : Object.assign(a, n), await k.setBindingData(r.getTarget(), a);
|
|
3451
3488
|
}
|
|
3452
|
-
await
|
|
3489
|
+
await k.evaluateAll(e);
|
|
3453
3490
|
}
|
|
3454
3491
|
/**
|
|
3455
3492
|
* data-bind 属性で宣言された初期バインドデータを取得します。
|
|
@@ -3459,7 +3496,7 @@ class A {
|
|
|
3459
3496
|
*/
|
|
3460
3497
|
static getInitialBindingData(e) {
|
|
3461
3498
|
const t = e.getInitialBindAttribute();
|
|
3462
|
-
return t === null ? null :
|
|
3499
|
+
return t === null ? null : k.parseDataBind(t);
|
|
3463
3500
|
}
|
|
3464
3501
|
/**
|
|
3465
3502
|
* フラグメント配下の入力要素について、内部値を現在の DOM 値と再同期します。
|
|
@@ -3499,9 +3536,9 @@ class A {
|
|
|
3499
3536
|
*/
|
|
3500
3537
|
static clearEachClones(e) {
|
|
3501
3538
|
const t = [], r = (n) => {
|
|
3502
|
-
if (n.hasAttribute(`${
|
|
3539
|
+
if (n.hasAttribute(`${u.prefix}each`))
|
|
3503
3540
|
for (const s of n.getChildElementFragments()) {
|
|
3504
|
-
const a = s.hasAttribute(`${
|
|
3541
|
+
const a = s.hasAttribute(`${u.prefix}each-before`), o = s.hasAttribute(`${u.prefix}each-after`);
|
|
3505
3542
|
!a && !o && t.push(s.remove());
|
|
3506
3543
|
}
|
|
3507
3544
|
}, i = (n) => {
|
|
@@ -3559,9 +3596,9 @@ class A {
|
|
|
3559
3596
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
3560
3597
|
*/
|
|
3561
3598
|
static addMessage(e, t, r, i) {
|
|
3562
|
-
const n = [], s = Re(), a = s.addMessage, o = (
|
|
3563
|
-
return l.forEach((
|
|
3564
|
-
n.push(o(
|
|
3599
|
+
const n = [], s = Re(), a = s.addMessage, o = (h) => typeof a == "function" ? a.call(s, h, r, i) : s.addErrorMessage(h, r), l = A.findFragmentsByKey(e, t);
|
|
3600
|
+
return l.forEach((h) => {
|
|
3601
|
+
n.push(o(h.getTarget()));
|
|
3565
3602
|
}), l.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
3566
3603
|
});
|
|
3567
3604
|
}
|
|
@@ -3585,23 +3622,23 @@ class A {
|
|
|
3585
3622
|
*/
|
|
3586
3623
|
static findFragmentByKeyParts(e, t) {
|
|
3587
3624
|
const r = [], i = t[0];
|
|
3588
|
-
if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${
|
|
3589
|
-
t.length > 1 && e.getAttribute(`${
|
|
3625
|
+
if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${u.prefix}form-object`))
|
|
3626
|
+
t.length > 1 && e.getAttribute(`${u.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
3590
3627
|
r.push(...A.findFragmentByKeyParts(s, t.slice(1)));
|
|
3591
3628
|
});
|
|
3592
|
-
else if (e.hasAttribute(`${
|
|
3629
|
+
else if (e.hasAttribute(`${u.prefix}form-list`)) {
|
|
3593
3630
|
if (t.length > 1) {
|
|
3594
|
-
const n = e.getAttribute(`${
|
|
3631
|
+
const n = e.getAttribute(`${u.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
|
|
3595
3632
|
if (s !== -1 && a !== -1 && s < a) {
|
|
3596
3633
|
const o = i.substring(0, s);
|
|
3597
3634
|
if (n === o) {
|
|
3598
|
-
const l = i.substring(s + 1, a),
|
|
3599
|
-
if (isNaN(
|
|
3600
|
-
|
|
3635
|
+
const l = i.substring(s + 1, a), h = Number(l);
|
|
3636
|
+
if (isNaN(h))
|
|
3637
|
+
m.error("Haori", `Invalid index: ${i}`);
|
|
3601
3638
|
else {
|
|
3602
|
-
const
|
|
3603
|
-
|
|
3604
|
-
...A.findFragmentByKeyParts(
|
|
3639
|
+
const c = e.getChildElementFragments().filter((p) => p.hasAttribute(`${u.prefix}row`));
|
|
3640
|
+
h < c.length && r.push(
|
|
3641
|
+
...A.findFragmentByKeyParts(c[h], t.slice(1))
|
|
3605
3642
|
);
|
|
3606
3643
|
}
|
|
3607
3644
|
}
|
|
@@ -3626,7 +3663,7 @@ class A {
|
|
|
3626
3663
|
*/
|
|
3627
3664
|
static getFormFragment(e) {
|
|
3628
3665
|
const t = e.getTarget();
|
|
3629
|
-
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${
|
|
3666
|
+
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${u.prefix}form`))
|
|
3630
3667
|
return e;
|
|
3631
3668
|
const r = e.getParent();
|
|
3632
3669
|
return r ? this.getFormFragment(r) : null;
|
|
@@ -3706,8 +3743,8 @@ class N {
|
|
|
3706
3743
|
static bindChange(e, t, r, i = "other") {
|
|
3707
3744
|
const n = [], s = new Set(Object.keys(t || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
3708
3745
|
for (const l of o) {
|
|
3709
|
-
const
|
|
3710
|
-
|
|
3746
|
+
const h = t?.[l], c = r[l];
|
|
3747
|
+
h !== c && n.push(l);
|
|
3711
3748
|
}
|
|
3712
3749
|
N.dispatch(e, "bindchange", {
|
|
3713
3750
|
previous: t || {},
|
|
@@ -3886,7 +3923,7 @@ function je(f) {
|
|
|
3886
3923
|
const e = Ze[f];
|
|
3887
3924
|
if (e === void 0 || typeof document > "u")
|
|
3888
3925
|
return !1;
|
|
3889
|
-
const t = `${
|
|
3926
|
+
const t = `${u.prefix}${e}`, r = [];
|
|
3890
3927
|
document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
|
|
3891
3928
|
for (const i of r) {
|
|
3892
3929
|
const n = et(i, t);
|
|
@@ -3948,8 +3985,8 @@ const rt = [
|
|
|
3948
3985
|
"dialog",
|
|
3949
3986
|
"openDialog",
|
|
3950
3987
|
"toast"
|
|
3951
|
-
], it = "__haoriHistoryState__",
|
|
3952
|
-
function
|
|
3988
|
+
], it = "__haoriHistoryState__", be = "data-haori-click-lock";
|
|
3989
|
+
function se() {
|
|
3953
3990
|
const e = globalThis.window?.Haori;
|
|
3954
3991
|
return rt.every(
|
|
3955
3992
|
(r) => typeof e?.[r] == "function"
|
|
@@ -3990,10 +4027,10 @@ function ut(f) {
|
|
|
3990
4027
|
(t) => !(t instanceof Blob) && te(t)
|
|
3991
4028
|
) : te(e));
|
|
3992
4029
|
}
|
|
3993
|
-
function
|
|
3994
|
-
return
|
|
4030
|
+
function ae(f) {
|
|
4031
|
+
return ve(A.getValues(f));
|
|
3995
4032
|
}
|
|
3996
|
-
function
|
|
4033
|
+
function ve(f) {
|
|
3997
4034
|
const e = (r) => {
|
|
3998
4035
|
if (r instanceof File)
|
|
3999
4036
|
return r.name;
|
|
@@ -4047,7 +4084,7 @@ const g = class g {
|
|
|
4047
4084
|
* 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
|
|
4048
4085
|
*/
|
|
4049
4086
|
static attrName(e, t, r = !1) {
|
|
4050
|
-
return e ? `${
|
|
4087
|
+
return e ? `${u.prefix}${e}-${t}` : r ? `${u.prefix}fetch-${t}` : `${u.prefix}${t}`;
|
|
4051
4088
|
}
|
|
4052
4089
|
/**
|
|
4053
4090
|
* data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
|
|
@@ -4188,7 +4225,7 @@ const g = class g {
|
|
|
4188
4225
|
const a = r.trim();
|
|
4189
4226
|
if (g.SINGLE_PLACEHOLDER_REGEX.test(a))
|
|
4190
4227
|
return {
|
|
4191
|
-
value:
|
|
4228
|
+
value: k.parseDataBind(n),
|
|
4192
4229
|
hasUnresolvedReference: s
|
|
4193
4230
|
};
|
|
4194
4231
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
@@ -4197,7 +4234,7 @@ const g = class g {
|
|
|
4197
4234
|
e.getBindingData()
|
|
4198
4235
|
);
|
|
4199
4236
|
return {
|
|
4200
|
-
value:
|
|
4237
|
+
value: k.parseDataBind(l.value),
|
|
4201
4238
|
hasUnresolvedReference: s || l.hasUnresolvedReference
|
|
4202
4239
|
};
|
|
4203
4240
|
}
|
|
@@ -4206,7 +4243,7 @@ const g = class g {
|
|
|
4206
4243
|
e.getBindingData()
|
|
4207
4244
|
);
|
|
4208
4245
|
return {
|
|
4209
|
-
value:
|
|
4246
|
+
value: k.parseDataBind(o.value),
|
|
4210
4247
|
hasUnresolvedReference: s || o.hasUnresolvedReference
|
|
4211
4248
|
};
|
|
4212
4249
|
}
|
|
@@ -4231,16 +4268,16 @@ const g = class g {
|
|
|
4231
4268
|
const v = document.body.querySelector(b);
|
|
4232
4269
|
v !== null ? r.formFragment = A.getFormFragment(
|
|
4233
4270
|
S.get(v)
|
|
4234
|
-
) :
|
|
4271
|
+
) : m.error(
|
|
4235
4272
|
"Haori",
|
|
4236
4273
|
`Form element not found: ${b} (${g.attrName(t, "form")})`
|
|
4237
4274
|
);
|
|
4238
4275
|
} else
|
|
4239
4276
|
r.formFragment = A.getFormFragment(e);
|
|
4240
4277
|
} else (t === "change" || t === "input") && (r.formFragment = A.getFormFragment(e), r.formFragment === null && g.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
4241
|
-
if (e.hasAttribute(`${
|
|
4278
|
+
if (e.hasAttribute(`${u.prefix}${t}-before-run`)) {
|
|
4242
4279
|
const b = e.getRawAttribute(
|
|
4243
|
-
`${
|
|
4280
|
+
`${u.prefix}${t}-before-run`
|
|
4244
4281
|
);
|
|
4245
4282
|
try {
|
|
4246
4283
|
r.beforeCallback = new Function(
|
|
@@ -4252,7 +4289,7 @@ ${b}
|
|
|
4252
4289
|
`
|
|
4253
4290
|
);
|
|
4254
4291
|
} catch (v) {
|
|
4255
|
-
|
|
4292
|
+
m.error("Haori", `Invalid before script: ${v}`);
|
|
4256
4293
|
}
|
|
4257
4294
|
}
|
|
4258
4295
|
const E = g.attrName(t, "run");
|
|
@@ -4275,7 +4312,7 @@ ${b}
|
|
|
4275
4312
|
`
|
|
4276
4313
|
);
|
|
4277
4314
|
} catch (R) {
|
|
4278
|
-
|
|
4315
|
+
m.error("Haori", `Invalid run script: ${R}`);
|
|
4279
4316
|
}
|
|
4280
4317
|
}
|
|
4281
4318
|
v && (r.runScript = v);
|
|
@@ -4309,9 +4346,9 @@ ${b}
|
|
|
4309
4346
|
E
|
|
4310
4347
|
);
|
|
4311
4348
|
try {
|
|
4312
|
-
s.headers =
|
|
4349
|
+
s.headers = k.parseDataBind(b);
|
|
4313
4350
|
} catch (v) {
|
|
4314
|
-
|
|
4351
|
+
m.error("Haori", `Invalid fetch headers: ${v}`);
|
|
4315
4352
|
}
|
|
4316
4353
|
}
|
|
4317
4354
|
} else {
|
|
@@ -4325,9 +4362,9 @@ ${b}
|
|
|
4325
4362
|
E
|
|
4326
4363
|
);
|
|
4327
4364
|
try {
|
|
4328
|
-
s.headers =
|
|
4365
|
+
s.headers = k.parseDataBind(b);
|
|
4329
4366
|
} catch (v) {
|
|
4330
|
-
|
|
4367
|
+
m.error("Haori", `Invalid fetch headers: ${v}`);
|
|
4331
4368
|
}
|
|
4332
4369
|
}
|
|
4333
4370
|
}
|
|
@@ -4381,7 +4418,7 @@ ${b}
|
|
|
4381
4418
|
b.length > 0 ? (r.bindFragments = [], b.forEach((v) => {
|
|
4382
4419
|
const R = S.get(v);
|
|
4383
4420
|
R && r.bindFragments.push(R);
|
|
4384
|
-
})) :
|
|
4421
|
+
})) : m.error(
|
|
4385
4422
|
"Haori",
|
|
4386
4423
|
`Bind element not found: ${E} (${a})`
|
|
4387
4424
|
);
|
|
@@ -4391,31 +4428,31 @@ ${b}
|
|
|
4391
4428
|
null,
|
|
4392
4429
|
"arg",
|
|
4393
4430
|
!0
|
|
4394
|
-
),
|
|
4431
|
+
), h = g.attrName(
|
|
4395
4432
|
null,
|
|
4396
4433
|
"bind-arg",
|
|
4397
4434
|
!0
|
|
4398
4435
|
);
|
|
4399
4436
|
t ? e.hasAttribute(o) && (r.bindArg = e.getRawAttribute(o)) : e.hasAttribute(l) ? r.bindArg = e.getRawAttribute(
|
|
4400
4437
|
l
|
|
4401
|
-
) : e.hasAttribute(
|
|
4402
|
-
const
|
|
4403
|
-
if (e.hasAttribute(
|
|
4404
|
-
const E = e.getRawAttribute(
|
|
4438
|
+
) : e.hasAttribute(h) && (r.bindArg = e.getRawAttribute(h));
|
|
4439
|
+
const c = t ? g.attrName(t, "bind-params") : g.attrName(null, "bind-params", !0);
|
|
4440
|
+
if (e.hasAttribute(c)) {
|
|
4441
|
+
const E = e.getRawAttribute(c);
|
|
4405
4442
|
r.bindParams = E.split("&").map((b) => b.trim());
|
|
4406
4443
|
}
|
|
4407
|
-
const
|
|
4408
|
-
if (e.hasAttribute(
|
|
4409
|
-
const E = e.getRawAttribute(
|
|
4444
|
+
const p = t ? g.attrName(t, "bind-append") : g.attrName(null, "bind-append", !0);
|
|
4445
|
+
if (e.hasAttribute(p)) {
|
|
4446
|
+
const E = e.getRawAttribute(p);
|
|
4410
4447
|
r.bindAppendParams = E.split("&").map((b) => b.trim()).filter(Boolean);
|
|
4411
4448
|
}
|
|
4412
4449
|
const y = t ? g.attrName(t, "bind-merge") : g.attrName(null, "bind-merge", !0);
|
|
4413
4450
|
e.hasAttribute(y) && (r.bindMerge = !0);
|
|
4414
4451
|
const T = t ? g.attrName(t, "bind-transform") : g.attrName(null, "bind-transform", !0);
|
|
4415
4452
|
e.hasAttribute(T) && (r.bindTransform = e.getRawAttribute(T));
|
|
4416
|
-
const
|
|
4417
|
-
if (
|
|
4418
|
-
const E = e.getRawAttribute(
|
|
4453
|
+
const I = t ? g.attrName(t, "copy-params") : null;
|
|
4454
|
+
if (I && e.hasAttribute(I)) {
|
|
4455
|
+
const E = e.getRawAttribute(I);
|
|
4419
4456
|
r.copyParams = E.split("&").map((b) => b.trim()).filter(Boolean);
|
|
4420
4457
|
}
|
|
4421
4458
|
if (t) {
|
|
@@ -4428,7 +4465,7 @@ ${b}
|
|
|
4428
4465
|
R.length > 0 ? (r.adjustFragments = [], R.forEach((C) => {
|
|
4429
4466
|
const F = S.get(C);
|
|
4430
4467
|
F && r.adjustFragments.push(F);
|
|
4431
|
-
})) :
|
|
4468
|
+
})) : m.error(
|
|
4432
4469
|
"Haori",
|
|
4433
4470
|
`Adjust element not found: ${v} (${g.attrName(t, "adjust")})`
|
|
4434
4471
|
);
|
|
@@ -4440,9 +4477,9 @@ ${b}
|
|
|
4440
4477
|
isNaN(C) || (r.adjustValue = C);
|
|
4441
4478
|
}
|
|
4442
4479
|
}
|
|
4443
|
-
if (e.hasAttribute(g.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(g.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(g.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(g.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${
|
|
4480
|
+
if (e.hasAttribute(g.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(g.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(g.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(g.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${u.prefix}${t}-after-run`)) {
|
|
4444
4481
|
const v = e.getRawAttribute(
|
|
4445
|
-
`${
|
|
4482
|
+
`${u.prefix}${t}-after-run`
|
|
4446
4483
|
);
|
|
4447
4484
|
try {
|
|
4448
4485
|
r.afterCallback = new Function(
|
|
@@ -4453,7 +4490,7 @@ ${v}
|
|
|
4453
4490
|
`
|
|
4454
4491
|
);
|
|
4455
4492
|
} catch (R) {
|
|
4456
|
-
|
|
4493
|
+
m.error("Haori", `Invalid after script: ${R}`);
|
|
4457
4494
|
}
|
|
4458
4495
|
}
|
|
4459
4496
|
if (e.hasAttribute(g.attrName(t, "dialog")) && (r.dialogMessage = e.getAttribute(g.attrName(t, "dialog")).replace(/\\n/g, `
|
|
@@ -4490,7 +4527,7 @@ ${v}
|
|
|
4490
4527
|
const R = document.body.querySelector(v);
|
|
4491
4528
|
R !== null ? r.historyFormFragment = A.getFormFragment(
|
|
4492
4529
|
S.get(R)
|
|
4493
|
-
) :
|
|
4530
|
+
) : m.error(
|
|
4494
4531
|
"Haori",
|
|
4495
4532
|
`Form element not found: ${v} (${g.attrName(t, "history-form")})`
|
|
4496
4533
|
);
|
|
@@ -4511,13 +4548,13 @@ ${v}
|
|
|
4511
4548
|
return;
|
|
4512
4549
|
const C = e.getRawAttribute(R), F = [];
|
|
4513
4550
|
if (C)
|
|
4514
|
-
document.body.querySelectorAll(C).forEach((
|
|
4515
|
-
const
|
|
4516
|
-
|
|
4517
|
-
}), F.length === 0 &&
|
|
4551
|
+
document.body.querySelectorAll(C).forEach((B) => {
|
|
4552
|
+
const K = S.get(B);
|
|
4553
|
+
K && F.push(K);
|
|
4554
|
+
}), F.length === 0 && m.error("Haori", `Element not found: ${C} (${R})`);
|
|
4518
4555
|
else if (v === "open" || v === "close") {
|
|
4519
|
-
const
|
|
4520
|
-
|
|
4556
|
+
const L = e.getTarget().closest("dialog");
|
|
4557
|
+
L ? F.push(S.get(L)) : m.error("Haori", `Ancestor <dialog> not found (${R})`);
|
|
4521
4558
|
} else
|
|
4522
4559
|
F.push(e);
|
|
4523
4560
|
if (F.length > 0)
|
|
@@ -4554,12 +4591,12 @@ ${v}
|
|
|
4554
4591
|
const R = document.body.querySelector(v);
|
|
4555
4592
|
if (R !== null) {
|
|
4556
4593
|
const C = S.get(R);
|
|
4557
|
-
C ? r.copySourceFragment = C :
|
|
4594
|
+
C ? r.copySourceFragment = C : m.error(
|
|
4558
4595
|
"Haori",
|
|
4559
4596
|
`Element is not managed by Haori: ${v} (${b})`
|
|
4560
4597
|
);
|
|
4561
4598
|
} else
|
|
4562
|
-
|
|
4599
|
+
m.error(
|
|
4563
4600
|
"Haori",
|
|
4564
4601
|
`Element not found: ${v} (${b})`
|
|
4565
4602
|
);
|
|
@@ -4575,7 +4612,7 @@ ${v}
|
|
|
4575
4612
|
const b = document.body.querySelector(E);
|
|
4576
4613
|
b !== null ? r.formFragment = A.getFormFragment(
|
|
4577
4614
|
S.get(b)
|
|
4578
|
-
) :
|
|
4615
|
+
) : m.error(
|
|
4579
4616
|
"Haori",
|
|
4580
4617
|
`Form element not found: ${E} (${g.attrName(null, "fetch-form", !0)})`
|
|
4581
4618
|
);
|
|
@@ -4588,7 +4625,7 @@ ${v}
|
|
|
4588
4625
|
E ? (document.body.querySelectorAll(E).forEach((R) => {
|
|
4589
4626
|
const C = S.get(R);
|
|
4590
4627
|
C && b.push(C);
|
|
4591
|
-
}), b.length === 0 &&
|
|
4628
|
+
}), b.length === 0 && m.error(
|
|
4592
4629
|
"Haori",
|
|
4593
4630
|
`Element not found: ${E} (${H})`
|
|
4594
4631
|
)) : b.push(e), b.length > 0 && (r.fetchStateFragments = b);
|
|
@@ -4665,66 +4702,66 @@ ${v}
|
|
|
4665
4702
|
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1)
|
|
4666
4703
|
return !1;
|
|
4667
4704
|
if (this.options.runScript) {
|
|
4668
|
-
const
|
|
4705
|
+
const h = this.options.targetFragment?.getTarget() ?? null;
|
|
4669
4706
|
try {
|
|
4670
|
-
const
|
|
4671
|
-
|
|
4707
|
+
const c = this.options.runScript.call(
|
|
4708
|
+
h,
|
|
4672
4709
|
this.domEvent
|
|
4673
4710
|
);
|
|
4674
|
-
|
|
4675
|
-
} catch (
|
|
4676
|
-
|
|
4711
|
+
c === !1 && this.domEvent && this.domEvent.preventDefault(), c != null && typeof c.then == "function" && await c;
|
|
4712
|
+
} catch (c) {
|
|
4713
|
+
m.error("Haori", `Run script execution error: ${c}`);
|
|
4677
4714
|
}
|
|
4678
4715
|
}
|
|
4679
4716
|
if (!await this.confirm())
|
|
4680
4717
|
return !1;
|
|
4681
4718
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
4682
4719
|
this.options.resetBeforeFragments.map(
|
|
4683
|
-
(
|
|
4720
|
+
(h) => A.reset(h)
|
|
4684
4721
|
)
|
|
4685
4722
|
), this.captureHistorySnapshots());
|
|
4686
4723
|
const r = this.prepareFetchRequest(), i = r.payload;
|
|
4687
4724
|
let n = r.url, s = r.options;
|
|
4688
4725
|
if (this.options.beforeCallback) {
|
|
4689
|
-
const
|
|
4726
|
+
const h = this.options.beforeCallback(
|
|
4690
4727
|
n || null,
|
|
4691
4728
|
s || null
|
|
4692
4729
|
);
|
|
4693
|
-
if (
|
|
4694
|
-
if (
|
|
4730
|
+
if (h != null) {
|
|
4731
|
+
if (h === !1 || typeof h == "object" && h.stop)
|
|
4695
4732
|
return !1;
|
|
4696
|
-
typeof
|
|
4733
|
+
typeof h == "object" && (n = "fetchUrl" in h ? h.fetchUrl : n, s = "fetchOptions" in h ? h.fetchOptions : s);
|
|
4697
4734
|
}
|
|
4698
4735
|
}
|
|
4699
4736
|
const a = Object.keys(i).length > 0;
|
|
4700
4737
|
if (n) {
|
|
4701
|
-
const
|
|
4702
|
-
if (y &&
|
|
4703
|
-
runtime:
|
|
4704
|
-
requestedMethod:
|
|
4705
|
-
effectiveMethod:
|
|
4738
|
+
const h = { ...s || {} }, c = r.requestedMethod, p = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
|
|
4739
|
+
if (y && m.info("Haori demo fetch normalization", {
|
|
4740
|
+
runtime: u.runtime,
|
|
4741
|
+
requestedMethod: c,
|
|
4742
|
+
effectiveMethod: p,
|
|
4706
4743
|
transportMode: "query-get",
|
|
4707
4744
|
url: n,
|
|
4708
4745
|
payload: a ? i : void 0,
|
|
4709
4746
|
queryString: T
|
|
4710
4747
|
}), this.options.targetFragment && n) {
|
|
4711
|
-
const
|
|
4712
|
-
runtime:
|
|
4713
|
-
requestedMethod:
|
|
4714
|
-
effectiveMethod:
|
|
4748
|
+
const I = performance.now(), H = {
|
|
4749
|
+
runtime: u.runtime,
|
|
4750
|
+
requestedMethod: c,
|
|
4751
|
+
effectiveMethod: p,
|
|
4715
4752
|
transportMode: y ? "query-get" : "http",
|
|
4716
4753
|
...y ? { queryString: T } : {}
|
|
4717
4754
|
};
|
|
4718
4755
|
return N.fetchStart(
|
|
4719
4756
|
this.options.targetFragment.getTarget(),
|
|
4720
4757
|
n,
|
|
4721
|
-
|
|
4758
|
+
h,
|
|
4722
4759
|
a ? i : void 0,
|
|
4723
4760
|
H
|
|
4724
|
-
), await this.injectFetchState("loading"), fetch(n,
|
|
4761
|
+
), await this.injectFetchState("loading"), fetch(n, h).then((E) => this.handleFetchResult(
|
|
4725
4762
|
E,
|
|
4726
4763
|
n || void 0,
|
|
4727
|
-
|
|
4764
|
+
I
|
|
4728
4765
|
)).catch(async (E) => {
|
|
4729
4766
|
throw n && N.fetchError(
|
|
4730
4767
|
this.options.targetFragment.getTarget(),
|
|
@@ -4737,16 +4774,16 @@ ${v}
|
|
|
4737
4774
|
), E;
|
|
4738
4775
|
});
|
|
4739
4776
|
}
|
|
4740
|
-
return fetch(n,
|
|
4777
|
+
return fetch(n, h).then((I) => this.handleFetchResult(I, n || void 0));
|
|
4741
4778
|
}
|
|
4742
4779
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
|
|
4743
|
-
const
|
|
4744
|
-
e && e.appliedDisabledAttribute && this.options.targetFragment &&
|
|
4745
|
-
const y =
|
|
4746
|
-
Object.assign(y,
|
|
4780
|
+
const h = this.options.formFragment, c = h.getTarget(), p = /* @__PURE__ */ new Set();
|
|
4781
|
+
e && e.appliedDisabledAttribute && this.options.targetFragment && p.add(this.options.targetFragment);
|
|
4782
|
+
const y = h.getBindingData();
|
|
4783
|
+
Object.assign(y, ve(i)), await k.setBindingData(c, y, p);
|
|
4747
4784
|
}
|
|
4748
4785
|
this.suppressEmptyReplaceBind = !a && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input");
|
|
4749
|
-
const o = a ?
|
|
4786
|
+
const o = a ? ve(i) : {}, l = new Response(JSON.stringify(o), {
|
|
4750
4787
|
headers: { "Content-Type": "application/json" }
|
|
4751
4788
|
});
|
|
4752
4789
|
return this.handleFetchResult(l);
|
|
@@ -4763,12 +4800,12 @@ ${v}
|
|
|
4763
4800
|
if (this.eventType !== "click" || !this.options.targetFragment)
|
|
4764
4801
|
return null;
|
|
4765
4802
|
const t = this.options.targetFragment.getTarget();
|
|
4766
|
-
if (g.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(
|
|
4803
|
+
if (g.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(be))
|
|
4767
4804
|
return !1;
|
|
4768
4805
|
const r = t.hasAttribute(
|
|
4769
|
-
`${
|
|
4806
|
+
`${u.prefix}click-no-disabled`
|
|
4770
4807
|
);
|
|
4771
|
-
return g.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(
|
|
4808
|
+
return g.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(be, ""), r || t.setAttribute("disabled", ""), {
|
|
4772
4809
|
target: t,
|
|
4773
4810
|
appliedDisabledAttribute: !r
|
|
4774
4811
|
};
|
|
@@ -4780,13 +4817,13 @@ ${v}
|
|
|
4780
4817
|
* @returns 戻り値はありません。
|
|
4781
4818
|
*/
|
|
4782
4819
|
releaseExecutionLock(e) {
|
|
4783
|
-
e && (g.RUNNING_CLICK_TARGETS.delete(e.target), e.target.removeAttribute(
|
|
4820
|
+
e && (g.RUNNING_CLICK_TARGETS.delete(e.target), e.target.removeAttribute(be), e.appliedDisabledAttribute && e.target.removeAttribute("disabled"));
|
|
4784
4821
|
}
|
|
4785
4822
|
/**
|
|
4786
4823
|
* フェッチ後の処理を実行します。
|
|
4787
4824
|
*/
|
|
4788
4825
|
async handleFetchResult(e, t, r) {
|
|
4789
|
-
const i =
|
|
4826
|
+
const i = se();
|
|
4790
4827
|
if (!e.ok)
|
|
4791
4828
|
return je(e.status) || (this.options.targetFragment && t && N.fetchError(
|
|
4792
4829
|
this.options.targetFragment.getTarget(),
|
|
@@ -4821,7 +4858,7 @@ ${v}
|
|
|
4821
4858
|
s.push(new g(a, null).run());
|
|
4822
4859
|
}), this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
4823
4860
|
for (const a of this.options.clickFragments) {
|
|
4824
|
-
await
|
|
4861
|
+
await k.evaluateAll(a);
|
|
4825
4862
|
const o = a.getTarget();
|
|
4826
4863
|
typeof o.click == "function" ? o.click() : o.dispatchEvent(
|
|
4827
4864
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
@@ -4829,10 +4866,10 @@ ${v}
|
|
|
4829
4866
|
}
|
|
4830
4867
|
if (this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
|
|
4831
4868
|
const o = a.getTarget();
|
|
4832
|
-
o instanceof HTMLElement ? s.push(i.openDialog(o)) :
|
|
4869
|
+
o instanceof HTMLElement ? s.push(i.openDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
|
|
4833
4870
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
|
|
4834
4871
|
const o = a.getTarget();
|
|
4835
|
-
o instanceof HTMLElement ? s.push(i.closeDialog(o)) :
|
|
4872
|
+
o instanceof HTMLElement ? s.push(i.closeDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
|
|
4836
4873
|
}), await Promise.all(s), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
|
|
4837
4874
|
this.options.toastMessage,
|
|
4838
4875
|
this.options.toastLevel ?? "info"
|
|
@@ -4840,12 +4877,12 @@ ${v}
|
|
|
4840
4877
|
let a = this.options.redirectUrl;
|
|
4841
4878
|
const o = this.options.redirectReturnParam;
|
|
4842
4879
|
if (o) {
|
|
4843
|
-
const
|
|
4844
|
-
if (
|
|
4845
|
-
const
|
|
4846
|
-
qe.isSafeLocalPath(
|
|
4880
|
+
const h = new URLSearchParams(window.location.search).get(o);
|
|
4881
|
+
if (h !== null) {
|
|
4882
|
+
const c = h.trim();
|
|
4883
|
+
qe.isSafeLocalPath(c) ? a = c : m.warn(
|
|
4847
4884
|
"Haori",
|
|
4848
|
-
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${
|
|
4885
|
+
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${h}`
|
|
4849
4886
|
);
|
|
4850
4887
|
}
|
|
4851
4888
|
}
|
|
@@ -4867,12 +4904,12 @@ ${v}
|
|
|
4867
4904
|
const s = e ? this.options.historyUrl : window.location.pathname, a = new URL(s, window.location.href);
|
|
4868
4905
|
if (a.origin !== window.location.origin) {
|
|
4869
4906
|
const l = "history.pushState: cross-origin URL is not allowed: " + a.toString();
|
|
4870
|
-
|
|
4907
|
+
m.error("Haori", l);
|
|
4871
4908
|
return;
|
|
4872
4909
|
}
|
|
4873
4910
|
const o = (l) => {
|
|
4874
|
-
for (const [
|
|
4875
|
-
|
|
4911
|
+
for (const [h, c] of Object.entries(l))
|
|
4912
|
+
c != null && (Array.isArray(c) ? c.forEach((p) => a.searchParams.append(h, String(p))) : typeof c == "object" ? a.searchParams.set(h, JSON.stringify(c)) : a.searchParams.set(h, String(c)));
|
|
4876
4913
|
};
|
|
4877
4914
|
i && o(t), n && o(r), history.pushState(
|
|
4878
4915
|
{ [it]: !0 },
|
|
@@ -4880,7 +4917,7 @@ ${v}
|
|
|
4880
4917
|
a.toString()
|
|
4881
4918
|
);
|
|
4882
4919
|
} catch (s) {
|
|
4883
|
-
|
|
4920
|
+
m.error("Haori", `history.pushState failed: ${s}`);
|
|
4884
4921
|
}
|
|
4885
4922
|
}
|
|
4886
4923
|
/**
|
|
@@ -4890,10 +4927,10 @@ ${v}
|
|
|
4890
4927
|
let t = null;
|
|
4891
4928
|
this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t = A.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
4892
4929
|
const r = t ? t.getTarget() : document.body;
|
|
4893
|
-
await
|
|
4930
|
+
await se().clearMessages(r);
|
|
4894
4931
|
const i = async (a) => {
|
|
4895
4932
|
const o = t ? t.getTarget() : document.body;
|
|
4896
|
-
await
|
|
4933
|
+
await se().addErrorMessage(o, a);
|
|
4897
4934
|
}, n = () => {
|
|
4898
4935
|
if (!this.options.scrollOnError)
|
|
4899
4936
|
return;
|
|
@@ -4904,35 +4941,35 @@ ${v}
|
|
|
4904
4941
|
try {
|
|
4905
4942
|
const a = await e.json(), o = [];
|
|
4906
4943
|
if (Array.isArray(a)) {
|
|
4907
|
-
const l = /* @__PURE__ */ new Map(),
|
|
4908
|
-
for (const
|
|
4909
|
-
if (
|
|
4910
|
-
const
|
|
4911
|
-
if (
|
|
4944
|
+
const l = /* @__PURE__ */ new Map(), h = [];
|
|
4945
|
+
for (const c of a)
|
|
4946
|
+
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
4947
|
+
const p = c.key, y = c.message, T = typeof p == "string" && p.length > 0 ? p : null, I = typeof y == "string" ? y : y != null ? String(y) : "";
|
|
4948
|
+
if (I.length === 0)
|
|
4912
4949
|
continue;
|
|
4913
4950
|
if (T !== null) {
|
|
4914
4951
|
const H = l.get(T) ?? [];
|
|
4915
|
-
H.push(
|
|
4952
|
+
H.push(I), l.set(T, H);
|
|
4916
4953
|
} else
|
|
4917
|
-
|
|
4918
|
-
} else typeof
|
|
4919
|
-
for (const [
|
|
4920
|
-
o.push({ key:
|
|
4954
|
+
h.push(I);
|
|
4955
|
+
} else typeof c == "string" && c.length > 0 && h.push(c);
|
|
4956
|
+
for (const [c, p] of l)
|
|
4957
|
+
o.push({ key: c, message: p.join(`
|
|
4921
4958
|
`) });
|
|
4922
|
-
for (const
|
|
4923
|
-
o.push({ message:
|
|
4959
|
+
for (const c of h)
|
|
4960
|
+
o.push({ message: c });
|
|
4924
4961
|
} else if (a && typeof a == "object") {
|
|
4925
4962
|
if (typeof a.message == "string" && o.push({ message: a.message }), Array.isArray(a.messages))
|
|
4926
4963
|
for (const l of a.messages)
|
|
4927
4964
|
typeof l == "string" && o.push({ message: l });
|
|
4928
4965
|
if (a.errors && typeof a.errors == "object")
|
|
4929
|
-
for (const [l,
|
|
4930
|
-
Array.isArray(
|
|
4931
|
-
`) }) : typeof
|
|
4966
|
+
for (const [l, h] of Object.entries(a.errors))
|
|
4967
|
+
Array.isArray(h) ? o.push({ key: l, message: h.join(`
|
|
4968
|
+
`) }) : typeof h == "string" ? o.push({ key: l, message: h }) : h != null && o.push({ key: l, message: String(h) });
|
|
4932
4969
|
if (o.length === 0)
|
|
4933
|
-
for (const [l,
|
|
4934
|
-
l === "message" || l === "messages" || l === "errors" || (Array.isArray(
|
|
4935
|
-
`) }) : typeof
|
|
4970
|
+
for (const [l, h] of Object.entries(a))
|
|
4971
|
+
l === "message" || l === "messages" || l === "errors" || (Array.isArray(h) ? o.push({ key: l, message: h.join(`
|
|
4972
|
+
`) }) : typeof h == "string" && o.push({ key: l, message: h }));
|
|
4936
4973
|
}
|
|
4937
4974
|
if (o.length === 0)
|
|
4938
4975
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
@@ -4996,7 +5033,7 @@ ${v}
|
|
|
4996
5033
|
*/
|
|
4997
5034
|
confirm() {
|
|
4998
5035
|
const e = this.options.confirmMessage;
|
|
4999
|
-
return e == null ? Promise.resolve(!0) :
|
|
5036
|
+
return e == null ? Promise.resolve(!0) : se().confirm(e);
|
|
5000
5037
|
}
|
|
5001
5038
|
/**
|
|
5002
5039
|
* 結果データを対象のフラグメントにバインドします。
|
|
@@ -5017,7 +5054,7 @@ ${v}
|
|
|
5017
5054
|
response: i
|
|
5018
5055
|
});
|
|
5019
5056
|
} catch (s) {
|
|
5020
|
-
|
|
5057
|
+
m.error("Haori", `Invalid bind-transform: ${s}`);
|
|
5021
5058
|
}
|
|
5022
5059
|
if (this.options.bindParams) {
|
|
5023
5060
|
const s = {};
|
|
@@ -5026,9 +5063,9 @@ ${v}
|
|
|
5026
5063
|
}), i = s;
|
|
5027
5064
|
}
|
|
5028
5065
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
5029
|
-
|
|
5066
|
+
m.warn(
|
|
5030
5067
|
"Haori",
|
|
5031
|
-
`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 ${
|
|
5068
|
+
`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 ${u.prefix}${this.eventType}-form.`
|
|
5032
5069
|
);
|
|
5033
5070
|
return;
|
|
5034
5071
|
}
|
|
@@ -5037,16 +5074,16 @@ ${v}
|
|
|
5037
5074
|
this.options.bindFragments.forEach((s) => {
|
|
5038
5075
|
const a = { ...s.getRawBindingData() ?? {} }, o = this.options.bindArg;
|
|
5039
5076
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
5040
|
-
const l = a[o],
|
|
5077
|
+
const l = a[o], h = l && typeof l == "object" && !Array.isArray(l) ? l : {};
|
|
5041
5078
|
a[o] = this.mergeAppendBindingData(
|
|
5042
5079
|
s,
|
|
5043
5080
|
i,
|
|
5044
|
-
|
|
5081
|
+
h
|
|
5045
5082
|
);
|
|
5046
5083
|
} else
|
|
5047
5084
|
a[o] = i;
|
|
5048
5085
|
n.push(
|
|
5049
|
-
|
|
5086
|
+
k.setBindingData(
|
|
5050
5087
|
s.getTarget(),
|
|
5051
5088
|
a,
|
|
5052
5089
|
/* @__PURE__ */ new Set(),
|
|
@@ -5060,13 +5097,13 @@ ${v}
|
|
|
5060
5097
|
});
|
|
5061
5098
|
else if (typeof i == "string") {
|
|
5062
5099
|
if (this.options.defaultSelfBind) {
|
|
5063
|
-
|
|
5100
|
+
m.warn(
|
|
5064
5101
|
"Haori",
|
|
5065
5102
|
"string data is not bound because no bind target was specified."
|
|
5066
5103
|
);
|
|
5067
5104
|
return;
|
|
5068
5105
|
}
|
|
5069
|
-
return
|
|
5106
|
+
return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
5070
5107
|
new Error("string data cannot be bound without a bindArg.")
|
|
5071
5108
|
);
|
|
5072
5109
|
} else
|
|
@@ -5076,7 +5113,7 @@ ${v}
|
|
|
5076
5113
|
i
|
|
5077
5114
|
), o = this.options.bindMerge ? { ...s.getRawBindingData() ?? {}, ...a } : a;
|
|
5078
5115
|
n.push(
|
|
5079
|
-
|
|
5116
|
+
k.setBindingData(
|
|
5080
5117
|
s.getTarget(),
|
|
5081
5118
|
o,
|
|
5082
5119
|
/* @__PURE__ */ new Set(),
|
|
@@ -5117,7 +5154,7 @@ ${v}
|
|
|
5117
5154
|
...i.getBindingData(),
|
|
5118
5155
|
...t
|
|
5119
5156
|
};
|
|
5120
|
-
return
|
|
5157
|
+
return k.setBindingData(i.getTarget(), n);
|
|
5121
5158
|
});
|
|
5122
5159
|
return Promise.all(r).then(() => {
|
|
5123
5160
|
});
|
|
@@ -5126,7 +5163,7 @@ ${v}
|
|
|
5126
5163
|
* copy のコピー元データを取得します。
|
|
5127
5164
|
*/
|
|
5128
5165
|
resolveCopySourceData() {
|
|
5129
|
-
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ?
|
|
5166
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? ae(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? ae(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
|
|
5130
5167
|
}
|
|
5131
5168
|
/**
|
|
5132
5169
|
* data 属性とフォーム値を統合した送信データを作成します。
|
|
@@ -5187,47 +5224,47 @@ ${v}
|
|
|
5187
5224
|
let i = this.options.fetchUrl;
|
|
5188
5225
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
5189
5226
|
n.headers || void 0
|
|
5190
|
-
), a = (n.method || "GET").toUpperCase(), o =
|
|
5227
|
+
), a = (n.method || "GET").toUpperCase(), o = u.runtime === "demo" && !st(a), l = o ? "GET" : a;
|
|
5191
5228
|
if (n.method = l, Object.keys(t).length > 0 && te(t)) {
|
|
5192
|
-
const
|
|
5193
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(
|
|
5229
|
+
const c = s.get("Content-Type") || "";
|
|
5230
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(c) ? ut(t) && m.warn(
|
|
5194
5231
|
"Haori",
|
|
5195
|
-
`A File value nested under ${
|
|
5196
|
-
) :
|
|
5232
|
+
`A File value nested under ${u.prefix}form-object / ${u.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
5233
|
+
) : m.warn(
|
|
5197
5234
|
"Haori",
|
|
5198
|
-
`A File value cannot be sent without ${
|
|
5235
|
+
`A File value cannot be sent without ${u.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
5199
5236
|
);
|
|
5200
5237
|
}
|
|
5201
5238
|
if (l === "GET" || l === "HEAD" || l === "OPTIONS")
|
|
5202
5239
|
Object.keys(t).length > 0 && (i = ot(i, t));
|
|
5203
5240
|
else if (Object.keys(t).length > 0) {
|
|
5204
|
-
const
|
|
5205
|
-
if (/multipart\/form-data/i.test(
|
|
5241
|
+
const c = s.get("Content-Type") || "";
|
|
5242
|
+
if (/multipart\/form-data/i.test(c)) {
|
|
5206
5243
|
s.delete("Content-Type");
|
|
5207
|
-
const
|
|
5244
|
+
const p = new FormData();
|
|
5208
5245
|
for (const [y, T] of Object.entries(t))
|
|
5209
|
-
T == null ?
|
|
5210
|
-
|
|
5211
|
-
}) : typeof T == "object" ?
|
|
5212
|
-
n.body =
|
|
5213
|
-
} else if (/application\/x-www-form-urlencoded/i.test(
|
|
5214
|
-
const
|
|
5246
|
+
T == null ? p.append(y, "") : T instanceof Blob ? p.append(y, T) : Array.isArray(T) ? T.forEach((I) => {
|
|
5247
|
+
I instanceof Blob ? p.append(y, I) : p.append(y, String(I));
|
|
5248
|
+
}) : typeof T == "object" ? p.append(y, JSON.stringify(T)) : p.append(y, String(T));
|
|
5249
|
+
n.body = p;
|
|
5250
|
+
} else if (/application\/x-www-form-urlencoded/i.test(c)) {
|
|
5251
|
+
const p = new URLSearchParams();
|
|
5215
5252
|
for (const [y, T] of Object.entries(t))
|
|
5216
|
-
T !== void 0 && (T === null ?
|
|
5217
|
-
n.body =
|
|
5253
|
+
T !== void 0 && (T === null ? p.append(y, "") : Array.isArray(T) ? T.forEach((I) => p.append(y, String(I))) : typeof T == "object" ? p.append(y, JSON.stringify(T)) : p.append(y, String(T)));
|
|
5254
|
+
n.body = p;
|
|
5218
5255
|
} else
|
|
5219
5256
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
5220
5257
|
}
|
|
5221
5258
|
n.headers = s;
|
|
5222
|
-
let
|
|
5223
|
-
return o && (
|
|
5259
|
+
let h;
|
|
5260
|
+
return o && (h = new URL(i, window.location.href).search || void 0, s.delete("Content-Type")), {
|
|
5224
5261
|
url: i,
|
|
5225
5262
|
options: n,
|
|
5226
5263
|
payload: t,
|
|
5227
5264
|
hasUnresolvedReference: !1,
|
|
5228
5265
|
requestedMethod: a,
|
|
5229
5266
|
effectiveMethod: l,
|
|
5230
|
-
queryString:
|
|
5267
|
+
queryString: h,
|
|
5231
5268
|
transportMode: o ? "query-get" : "http",
|
|
5232
5269
|
signature: ct(i, n)
|
|
5233
5270
|
};
|
|
@@ -5239,7 +5276,7 @@ ${v}
|
|
|
5239
5276
|
this.options.targetFragment && this.options.historyDataAttrName ? this.historyDataSnapshot = g.resolveDataAttribute(
|
|
5240
5277
|
this.options.targetFragment,
|
|
5241
5278
|
this.options.historyDataAttrName
|
|
5242
|
-
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ?
|
|
5279
|
+
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? ae(this.options.historyFormFragment) : void 0;
|
|
5243
5280
|
}
|
|
5244
5281
|
/**
|
|
5245
5282
|
* history-data の評価値を取得します。
|
|
@@ -5261,7 +5298,7 @@ ${v}
|
|
|
5261
5298
|
if (this.historyFormSnapshot !== void 0)
|
|
5262
5299
|
return this.historyFormSnapshot;
|
|
5263
5300
|
if (this.options.historyFormFragment)
|
|
5264
|
-
return
|
|
5301
|
+
return ae(this.options.historyFormFragment);
|
|
5265
5302
|
}
|
|
5266
5303
|
/**
|
|
5267
5304
|
* copy-params が指定されている場合は include / exclude を考慮して抽出します。
|
|
@@ -5309,11 +5346,11 @@ ${v}
|
|
|
5309
5346
|
*/
|
|
5310
5347
|
getRowFragment() {
|
|
5311
5348
|
if (!this.options.targetFragment)
|
|
5312
|
-
return
|
|
5349
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
5313
5350
|
const e = this.options.targetFragment.closestByAttribute(
|
|
5314
|
-
`${
|
|
5351
|
+
`${u.prefix}row`
|
|
5315
5352
|
);
|
|
5316
|
-
return e || (
|
|
5353
|
+
return e || (m.error("Haori", "Row fragment not found."), null);
|
|
5317
5354
|
}
|
|
5318
5355
|
/**
|
|
5319
5356
|
* 行を追加します。
|
|
@@ -5329,7 +5366,7 @@ ${v}
|
|
|
5329
5366
|
const t = [], r = e.clone();
|
|
5330
5367
|
return t.push(
|
|
5331
5368
|
e.getParent().insertAfter(r, e)
|
|
5332
|
-
), t.push(
|
|
5369
|
+
), t.push(k.evaluateAll(r)), t.push(A.reset(r)), Promise.all(t).then(() => {
|
|
5333
5370
|
});
|
|
5334
5371
|
}
|
|
5335
5372
|
/**
|
|
@@ -5344,7 +5381,7 @@ ${v}
|
|
|
5344
5381
|
if (!e)
|
|
5345
5382
|
return Promise.reject(new Error("Row fragment not found."));
|
|
5346
5383
|
const t = e.getParent();
|
|
5347
|
-
return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${
|
|
5384
|
+
return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${u.prefix}each-before`) && !i.hasAttribute(`${u.prefix}each-after`)).length <= 1 ? Promise.resolve() : e.remove();
|
|
5348
5385
|
}
|
|
5349
5386
|
/**
|
|
5350
5387
|
* 前の行へ移動します。
|
|
@@ -5412,14 +5449,14 @@ ${v}
|
|
|
5412
5449
|
...s.getRawBindingData() ?? {},
|
|
5413
5450
|
_fetch: n
|
|
5414
5451
|
};
|
|
5415
|
-
return
|
|
5452
|
+
return k.setBindingData(a, o, /* @__PURE__ */ new Set(), !1, !1);
|
|
5416
5453
|
})
|
|
5417
5454
|
);
|
|
5418
5455
|
}
|
|
5419
5456
|
};
|
|
5420
5457
|
g.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, g.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/, g.RUNNING_CLICK_TARGETS = /* @__PURE__ */ new WeakSet();
|
|
5421
|
-
let
|
|
5422
|
-
class
|
|
5458
|
+
let W = g;
|
|
5459
|
+
class ht {
|
|
5423
5460
|
/**
|
|
5424
5461
|
* 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
|
|
5425
5462
|
*
|
|
@@ -5437,28 +5474,28 @@ class dt {
|
|
|
5437
5474
|
try {
|
|
5438
5475
|
r = await fetch(e, t);
|
|
5439
5476
|
} catch (n) {
|
|
5440
|
-
throw
|
|
5477
|
+
throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
5441
5478
|
}
|
|
5442
5479
|
if (!r.ok) {
|
|
5443
5480
|
je(r.status);
|
|
5444
5481
|
const n = `${r.status} ${r.statusText}`;
|
|
5445
|
-
throw
|
|
5482
|
+
throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
5446
5483
|
}
|
|
5447
5484
|
let i;
|
|
5448
5485
|
try {
|
|
5449
5486
|
i = await r.text();
|
|
5450
5487
|
} catch (n) {
|
|
5451
|
-
throw
|
|
5488
|
+
throw m.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
5452
5489
|
}
|
|
5453
5490
|
try {
|
|
5454
5491
|
const s = new DOMParser().parseFromString(i, "text/html");
|
|
5455
|
-
return s && s.body ? s.body.innerHTML : (
|
|
5492
|
+
return s && s.body ? s.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), i);
|
|
5456
5493
|
} catch (n) {
|
|
5457
|
-
return
|
|
5494
|
+
return m.error("[Haori]", "Failed to parse imported HTML:", e, n), i;
|
|
5458
5495
|
}
|
|
5459
5496
|
}
|
|
5460
5497
|
}
|
|
5461
|
-
const
|
|
5498
|
+
const d = class d {
|
|
5462
5499
|
/**
|
|
5463
5500
|
* 遅延属性かどうか(完全名で判定)を判定します。
|
|
5464
5501
|
*
|
|
@@ -5466,8 +5503,8 @@ const h = class h {
|
|
|
5466
5503
|
* @returns 遅延属性かどうか
|
|
5467
5504
|
*/
|
|
5468
5505
|
static isDeferredAttributeName(e) {
|
|
5469
|
-
return
|
|
5470
|
-
(t) => e === `${
|
|
5506
|
+
return d.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
5507
|
+
(t) => e === `${u.prefix}${t}`
|
|
5471
5508
|
);
|
|
5472
5509
|
}
|
|
5473
5510
|
/**
|
|
@@ -5477,8 +5514,8 @@ const h = class h {
|
|
|
5477
5514
|
* @returns 除外対象かどうか
|
|
5478
5515
|
*/
|
|
5479
5516
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
5480
|
-
return
|
|
5481
|
-
(t) => e === `${
|
|
5517
|
+
return d.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
5518
|
+
(t) => e === `${u.prefix}${t}`
|
|
5482
5519
|
);
|
|
5483
5520
|
}
|
|
5484
5521
|
/**
|
|
@@ -5489,7 +5526,7 @@ const h = class h {
|
|
|
5489
5526
|
* @returns 再評価する場合は true
|
|
5490
5527
|
*/
|
|
5491
5528
|
static shouldReevaluateAttribute(e, t) {
|
|
5492
|
-
return t !== null && !
|
|
5529
|
+
return t !== null && !d.isEvaluateAllExcludedAttributeName(e) && d.ATTRIBUTE_PLACEHOLDER_REGEX.test(t);
|
|
5493
5530
|
}
|
|
5494
5531
|
/**
|
|
5495
5532
|
* data-attr-* 形式の属性名から実際に更新する属性名を取得します。
|
|
@@ -5498,7 +5535,7 @@ const h = class h {
|
|
|
5498
5535
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
5499
5536
|
*/
|
|
5500
5537
|
static getAliasedAttributeName(e) {
|
|
5501
|
-
const t = `${
|
|
5538
|
+
const t = `${u.prefix}${d.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
5502
5539
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
5503
5540
|
}
|
|
5504
5541
|
/**
|
|
@@ -5511,7 +5548,7 @@ const h = class h {
|
|
|
5511
5548
|
static isAliasedAttributeReflection(e, t) {
|
|
5512
5549
|
const r = S.get(e);
|
|
5513
5550
|
return r instanceof M ? r.hasAttribute(
|
|
5514
|
-
`${
|
|
5551
|
+
`${u.prefix}${d.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
5515
5552
|
) : !1;
|
|
5516
5553
|
}
|
|
5517
5554
|
/**
|
|
@@ -5525,8 +5562,8 @@ const h = class h {
|
|
|
5525
5562
|
let t = Promise.resolve();
|
|
5526
5563
|
for (const r of e.getAttributeNames()) {
|
|
5527
5564
|
const i = e.getRawAttribute(r);
|
|
5528
|
-
|
|
5529
|
-
() =>
|
|
5565
|
+
d.shouldReevaluateAttribute(r, i) && (t = t.then(
|
|
5566
|
+
() => d.setAttribute(e.getTarget(), r, i)
|
|
5530
5567
|
));
|
|
5531
5568
|
}
|
|
5532
5569
|
return t.then(() => {
|
|
@@ -5541,7 +5578,7 @@ const h = class h {
|
|
|
5541
5578
|
static reevaluateChildren(e) {
|
|
5542
5579
|
const t = [];
|
|
5543
5580
|
return e.getChildren().forEach((r) => {
|
|
5544
|
-
r instanceof M ? t.push(
|
|
5581
|
+
r instanceof M ? t.push(d.evaluateAll(r)) : r instanceof j && t.push(d.evaluateText(r));
|
|
5545
5582
|
}), Promise.all(t).then(() => {
|
|
5546
5583
|
});
|
|
5547
5584
|
}
|
|
@@ -5552,7 +5589,7 @@ const h = class h {
|
|
|
5552
5589
|
* @returns 再評価状態
|
|
5553
5590
|
*/
|
|
5554
5591
|
static getReactiveFetchState(e) {
|
|
5555
|
-
const t =
|
|
5592
|
+
const t = d.REACTIVE_FETCH_STATES.get(e);
|
|
5556
5593
|
if (t)
|
|
5557
5594
|
return t;
|
|
5558
5595
|
const r = {
|
|
@@ -5560,7 +5597,7 @@ const h = class h {
|
|
|
5560
5597
|
running: !1,
|
|
5561
5598
|
rerunRequested: !1
|
|
5562
5599
|
};
|
|
5563
|
-
return
|
|
5600
|
+
return d.REACTIVE_FETCH_STATES.set(e, r), r;
|
|
5564
5601
|
}
|
|
5565
5602
|
/**
|
|
5566
5603
|
* data-import の再評価状態を取得します。
|
|
@@ -5569,7 +5606,7 @@ const h = class h {
|
|
|
5569
5606
|
* @returns 再評価状態
|
|
5570
5607
|
*/
|
|
5571
5608
|
static getReactiveImportState(e) {
|
|
5572
|
-
const t =
|
|
5609
|
+
const t = d.REACTIVE_IMPORT_STATES.get(e);
|
|
5573
5610
|
if (t)
|
|
5574
5611
|
return t;
|
|
5575
5612
|
const r = {
|
|
@@ -5577,7 +5614,7 @@ const h = class h {
|
|
|
5577
5614
|
running: !1,
|
|
5578
5615
|
rerunRequested: !1
|
|
5579
5616
|
};
|
|
5580
|
-
return
|
|
5617
|
+
return d.REACTIVE_IMPORT_STATES.set(e, r), r;
|
|
5581
5618
|
}
|
|
5582
5619
|
/**
|
|
5583
5620
|
* bind 更新時に data-fetch / data-import を専用ルートで再評価します。
|
|
@@ -5590,9 +5627,9 @@ const h = class h {
|
|
|
5590
5627
|
if (t.has(e))
|
|
5591
5628
|
return Promise.resolve();
|
|
5592
5629
|
const r = [];
|
|
5593
|
-
return e.hasAttribute(`${
|
|
5630
|
+
return e.hasAttribute(`${u.prefix}fetch`) && r.push(d.executeManagedFetch(e)), e.hasAttribute(`${u.prefix}import`) && r.push(d.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
5594
5631
|
i instanceof M && r.push(
|
|
5595
|
-
|
|
5632
|
+
d.reevaluateReactiveSpecialAttributes(i, t)
|
|
5596
5633
|
);
|
|
5597
5634
|
}), Promise.all(r).then(() => {
|
|
5598
5635
|
});
|
|
@@ -5604,7 +5641,7 @@ const h = class h {
|
|
|
5604
5641
|
* @returns 実行完了の Promise
|
|
5605
5642
|
*/
|
|
5606
5643
|
static executeManagedFetch(e) {
|
|
5607
|
-
const t = e.getTarget(), r =
|
|
5644
|
+
const t = e.getTarget(), r = d.getReactiveFetchState(t), i = W.resolveAutoFetchSignature(e);
|
|
5608
5645
|
if (r.running)
|
|
5609
5646
|
return (i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve();
|
|
5610
5647
|
if (i.hasUnresolvedReference || i.signature === null)
|
|
@@ -5612,11 +5649,11 @@ const h = class h {
|
|
|
5612
5649
|
if (r.lastSignature === i.signature)
|
|
5613
5650
|
return Promise.resolve();
|
|
5614
5651
|
r.lastSignature = i.signature, r.running = !0;
|
|
5615
|
-
const n = new
|
|
5652
|
+
const n = new W(e, null);
|
|
5616
5653
|
return n.markReentrantBind(), n.runWithResult().then(() => {
|
|
5617
5654
|
}).finally(() => {
|
|
5618
5655
|
if (r.running = !1, r.rerunRequested)
|
|
5619
|
-
return r.rerunRequested = !1,
|
|
5656
|
+
return r.rerunRequested = !1, d.executeManagedFetch(e);
|
|
5620
5657
|
});
|
|
5621
5658
|
}
|
|
5622
5659
|
/**
|
|
@@ -5626,8 +5663,8 @@ const h = class h {
|
|
|
5626
5663
|
* @returns 実行完了の Promise
|
|
5627
5664
|
*/
|
|
5628
5665
|
static executeManagedImport(e) {
|
|
5629
|
-
const t = e.getTarget(), r =
|
|
5630
|
-
`${
|
|
5666
|
+
const t = e.getTarget(), r = d.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
5667
|
+
`${u.prefix}import`
|
|
5631
5668
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
5632
5669
|
if (r.running)
|
|
5633
5670
|
return n !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
|
|
@@ -5637,25 +5674,25 @@ const h = class h {
|
|
|
5637
5674
|
return Promise.resolve();
|
|
5638
5675
|
r.lastUrl = n, r.running = !0;
|
|
5639
5676
|
const s = performance.now();
|
|
5640
|
-
return t.setAttribute(`${
|
|
5677
|
+
return t.setAttribute(`${u.prefix}importing`, ""), N.importStart(t, n), ht.load(n).then((a) => {
|
|
5641
5678
|
const o = new TextEncoder().encode(a).length;
|
|
5642
|
-
return
|
|
5679
|
+
return P.enqueue(() => {
|
|
5643
5680
|
t.innerHTML = a;
|
|
5644
5681
|
}).then(() => {
|
|
5645
|
-
if (t.removeAttribute(`${
|
|
5682
|
+
if (t.removeAttribute(`${u.prefix}importing`), N.importEnd(t, n, o, s), !document.body.hasAttribute("data-haori-ready")) {
|
|
5646
5683
|
const l = [];
|
|
5647
|
-
return t.childNodes.forEach((
|
|
5648
|
-
const
|
|
5649
|
-
|
|
5684
|
+
return t.childNodes.forEach((h) => {
|
|
5685
|
+
const c = S.get(h);
|
|
5686
|
+
c instanceof M ? l.push(d.scan(c.getTarget())) : c instanceof j && l.push(d.evaluateText(c));
|
|
5650
5687
|
}), Promise.all(l).then(() => {
|
|
5651
5688
|
});
|
|
5652
5689
|
}
|
|
5653
5690
|
});
|
|
5654
5691
|
}).catch((a) => {
|
|
5655
|
-
t.removeAttribute(`${
|
|
5692
|
+
t.removeAttribute(`${u.prefix}importing`), N.importError(t, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
|
|
5656
5693
|
}).finally(() => {
|
|
5657
5694
|
if (r.running = !1, r.rerunRequested)
|
|
5658
|
-
return r.rerunRequested = !1,
|
|
5695
|
+
return r.rerunRequested = !1, d.executeManagedImport(e);
|
|
5659
5696
|
});
|
|
5660
5697
|
}
|
|
5661
5698
|
/**
|
|
@@ -5666,7 +5703,7 @@ const h = class h {
|
|
|
5666
5703
|
*/
|
|
5667
5704
|
static scan(e) {
|
|
5668
5705
|
const t = S.get(e);
|
|
5669
|
-
return t ?
|
|
5706
|
+
return t ? d.initializeElementFragment(t, !1) : Promise.resolve();
|
|
5670
5707
|
}
|
|
5671
5708
|
/**
|
|
5672
5709
|
* 新規 each 行を局所初期化します。
|
|
@@ -5676,8 +5713,8 @@ const h = class h {
|
|
|
5676
5713
|
* @returns 初期化完了の Promise
|
|
5677
5714
|
*/
|
|
5678
5715
|
static initializeFreshEachRow(e) {
|
|
5679
|
-
return
|
|
5680
|
-
|
|
5716
|
+
return d.initializeElementFragment(e, !0).then(() => {
|
|
5717
|
+
d.needsScheduledEvaluateAll(e) && d.scheduleEvaluateAll(e);
|
|
5681
5718
|
});
|
|
5682
5719
|
}
|
|
5683
5720
|
/**
|
|
@@ -5688,16 +5725,16 @@ const h = class h {
|
|
|
5688
5725
|
* @returns 初期化完了の Promise
|
|
5689
5726
|
*/
|
|
5690
5727
|
static initializeElementFragment(e, t) {
|
|
5691
|
-
return
|
|
5692
|
-
if (
|
|
5693
|
-
|
|
5728
|
+
return d.syncMountedState(e), t && e.isFreshInitializationSkippable() ? Promise.resolve() : d.initializeElementAttributes(e).then(() => {
|
|
5729
|
+
if (d.shouldSkipChildInitialization(e, t)) {
|
|
5730
|
+
d.refreshDerivedSubtreeSignature(e);
|
|
5694
5731
|
return;
|
|
5695
5732
|
}
|
|
5696
5733
|
const r = [];
|
|
5697
5734
|
return e.getChildren().forEach((i) => {
|
|
5698
|
-
i instanceof M ? r.push(
|
|
5735
|
+
i instanceof M ? r.push(d.initializeElementFragment(i, t)) : i instanceof j && r.push(d.evaluateText(i));
|
|
5699
5736
|
}), Promise.all(r).then(() => {
|
|
5700
|
-
|
|
5737
|
+
d.refreshDerivedSubtreeSignature(e);
|
|
5701
5738
|
});
|
|
5702
5739
|
});
|
|
5703
5740
|
}
|
|
@@ -5727,10 +5764,10 @@ const h = class h {
|
|
|
5727
5764
|
static initializeElementAttributes(e) {
|
|
5728
5765
|
let t = Promise.resolve();
|
|
5729
5766
|
const r = /* @__PURE__ */ new Set();
|
|
5730
|
-
for (const i of
|
|
5731
|
-
const n =
|
|
5767
|
+
for (const i of d.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
5768
|
+
const n = u.prefix + i;
|
|
5732
5769
|
e.hasAttribute(n) && (t = t.then(
|
|
5733
|
-
() =>
|
|
5770
|
+
() => d.setAttribute(
|
|
5734
5771
|
e.getTarget(),
|
|
5735
5772
|
n,
|
|
5736
5773
|
e.getRawAttribute(n)
|
|
@@ -5738,17 +5775,17 @@ const h = class h {
|
|
|
5738
5775
|
), r.add(n));
|
|
5739
5776
|
}
|
|
5740
5777
|
for (const i of e.getAttributeNames()) {
|
|
5741
|
-
if (r.has(i) ||
|
|
5778
|
+
if (r.has(i) || d.isDeferredAttributeName(i))
|
|
5742
5779
|
continue;
|
|
5743
5780
|
const n = e.getRawAttribute(i);
|
|
5744
5781
|
n !== null && (t = t.then(
|
|
5745
|
-
() =>
|
|
5782
|
+
() => d.setAttribute(e.getTarget(), i, n)
|
|
5746
5783
|
));
|
|
5747
5784
|
}
|
|
5748
|
-
for (const i of
|
|
5749
|
-
const n =
|
|
5785
|
+
for (const i of d.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
5786
|
+
const n = u.prefix + i;
|
|
5750
5787
|
e.hasAttribute(n) && (t = t.then(
|
|
5751
|
-
() =>
|
|
5788
|
+
() => d.setAttribute(
|
|
5752
5789
|
e.getTarget(),
|
|
5753
5790
|
n,
|
|
5754
5791
|
e.getRawAttribute(n)
|
|
@@ -5766,8 +5803,8 @@ const h = class h {
|
|
|
5766
5803
|
* @returns 子孫初期化をスキップするなら true
|
|
5767
5804
|
*/
|
|
5768
5805
|
static shouldSkipChildInitialization(e, t) {
|
|
5769
|
-
const r = e.getAttribute(`${
|
|
5770
|
-
return e.hasAttribute(`${
|
|
5806
|
+
const r = e.getAttribute(`${u.prefix}if`);
|
|
5807
|
+
return e.hasAttribute(`${u.prefix}if`) && d.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${u.prefix}each`);
|
|
5771
5808
|
}
|
|
5772
5809
|
/**
|
|
5773
5810
|
* エレメントに属性を設定します。
|
|
@@ -5779,7 +5816,7 @@ const h = class h {
|
|
|
5779
5816
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5780
5817
|
*/
|
|
5781
5818
|
static setAttribute(e, t, r, i = !1) {
|
|
5782
|
-
const n = S.get(e), s =
|
|
5819
|
+
const n = S.get(e), s = d.getAliasedAttributeName(t);
|
|
5783
5820
|
if (s !== null)
|
|
5784
5821
|
return r === null ? n.removeAliasedAttribute(t, s) : n.setAliasedAttribute(
|
|
5785
5822
|
t,
|
|
@@ -5790,68 +5827,68 @@ const h = class h {
|
|
|
5790
5827
|
const a = [];
|
|
5791
5828
|
let o = null, l = null;
|
|
5792
5829
|
switch (t) {
|
|
5793
|
-
case `${
|
|
5830
|
+
case `${u.prefix}bind`: {
|
|
5794
5831
|
if (r === null)
|
|
5795
5832
|
n.clearBindingDataCache(), n.setBindingData({});
|
|
5796
5833
|
else {
|
|
5797
5834
|
if (i && n instanceof M && n.consumeSelfWrittenBind(r))
|
|
5798
5835
|
break;
|
|
5799
|
-
n.setBindingData(
|
|
5836
|
+
n.setBindingData(d.parseDataBind(r));
|
|
5800
5837
|
}
|
|
5801
5838
|
break;
|
|
5802
5839
|
}
|
|
5803
|
-
case `${
|
|
5804
|
-
l =
|
|
5840
|
+
case `${u.prefix}derive`:
|
|
5841
|
+
l = d.createDeriveInputSignature(
|
|
5805
5842
|
n,
|
|
5806
5843
|
r,
|
|
5807
|
-
n.getRawAttribute(`${
|
|
5808
|
-
), o =
|
|
5844
|
+
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
5845
|
+
), o = d.evaluateDerive(
|
|
5809
5846
|
n,
|
|
5810
5847
|
r,
|
|
5811
|
-
n.getRawAttribute(`${
|
|
5848
|
+
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
5812
5849
|
), a.push(o.then(() => {
|
|
5813
5850
|
}));
|
|
5814
5851
|
break;
|
|
5815
|
-
case `${
|
|
5816
|
-
l =
|
|
5852
|
+
case `${u.prefix}derive-name`:
|
|
5853
|
+
l = d.createDeriveInputSignature(
|
|
5817
5854
|
n,
|
|
5818
|
-
n.getRawAttribute(`${
|
|
5855
|
+
n.getRawAttribute(`${u.prefix}derive`),
|
|
5819
5856
|
r
|
|
5820
|
-
), o =
|
|
5857
|
+
), o = d.evaluateDerive(
|
|
5821
5858
|
n,
|
|
5822
|
-
n.getRawAttribute(`${
|
|
5859
|
+
n.getRawAttribute(`${u.prefix}derive`),
|
|
5823
5860
|
r
|
|
5824
5861
|
), a.push(o.then(() => {
|
|
5825
5862
|
}));
|
|
5826
5863
|
break;
|
|
5827
|
-
case `${
|
|
5828
|
-
a.push(
|
|
5864
|
+
case `${u.prefix}if`:
|
|
5865
|
+
a.push(d.evaluateIf(n));
|
|
5829
5866
|
break;
|
|
5830
|
-
case `${
|
|
5831
|
-
a.push(
|
|
5867
|
+
case `${u.prefix}each`:
|
|
5868
|
+
a.push(d.evaluateEach(n));
|
|
5832
5869
|
break;
|
|
5833
|
-
case `${
|
|
5834
|
-
a.push(
|
|
5870
|
+
case `${u.prefix}fetch`:
|
|
5871
|
+
a.push(d.executeManagedFetch(n));
|
|
5835
5872
|
break;
|
|
5836
|
-
case `${
|
|
5837
|
-
typeof r == "string" && a.push(
|
|
5873
|
+
case `${u.prefix}import`:
|
|
5874
|
+
typeof r == "string" && a.push(d.executeManagedImport(n));
|
|
5838
5875
|
break;
|
|
5839
|
-
case `${
|
|
5840
|
-
const
|
|
5841
|
-
if (
|
|
5842
|
-
a.push(
|
|
5876
|
+
case `${u.prefix}url-param`: {
|
|
5877
|
+
const h = n.getAttribute(`${u.prefix}url-arg`), c = qe.readParams();
|
|
5878
|
+
if (h === null)
|
|
5879
|
+
a.push(d.setBindingData(e, c, /* @__PURE__ */ new Set(), !0));
|
|
5843
5880
|
else {
|
|
5844
|
-
const
|
|
5845
|
-
|
|
5881
|
+
const p = n.getRawBindingData() || {};
|
|
5882
|
+
p[String(h)] = c, a.push(d.setBindingData(e, p, /* @__PURE__ */ new Set(), !0));
|
|
5846
5883
|
}
|
|
5847
5884
|
break;
|
|
5848
5885
|
}
|
|
5849
5886
|
}
|
|
5850
5887
|
return r === null ? a.push(n.removeAttribute(t)) : a.push(n.setAttribute(t, r, i)), Promise.all(a).then(() => {
|
|
5851
5888
|
if (o !== null)
|
|
5852
|
-
return n.setDeriveInputSignature(l), o.then((
|
|
5853
|
-
if (
|
|
5854
|
-
return
|
|
5889
|
+
return n.setDeriveInputSignature(l), o.then((h) => {
|
|
5890
|
+
if (h)
|
|
5891
|
+
return d.reevaluateChildren(n);
|
|
5855
5892
|
});
|
|
5856
5893
|
}).then(() => {
|
|
5857
5894
|
});
|
|
@@ -5880,17 +5917,16 @@ const h = class h {
|
|
|
5880
5917
|
const o = () => {
|
|
5881
5918
|
s.markBindingWorkStart();
|
|
5882
5919
|
const l = s.getRawBindingData() ?? t;
|
|
5883
|
-
let
|
|
5884
|
-
|
|
5885
|
-
const
|
|
5886
|
-
|
|
5887
|
-
}
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
), d.then(
|
|
5920
|
+
let h = n ? s.setAttribute(`${u.prefix}bind`, JSON.stringify(l)) : Promise.resolve();
|
|
5921
|
+
return e.tagName === "FORM" && (h = h.then(() => {
|
|
5922
|
+
const c = s.getRawBindingData() ?? t, p = s.getAttribute(`${u.prefix}form-arg`), y = p && c[String(p)] && typeof c[String(p)] == "object" && !Array.isArray(c[String(p)]) ? c[String(p)] : p ? {} : c;
|
|
5923
|
+
return A.syncValues(s, y);
|
|
5924
|
+
})), h = h.then(() => d.evaluateAll(s, r)), h = h.then(
|
|
5925
|
+
() => d.reevaluateReactiveSpecialAttributes(s, r)
|
|
5926
|
+
), h.then(
|
|
5891
5927
|
() => s.markBindingWorkEnd(),
|
|
5892
|
-
(
|
|
5893
|
-
throw s.markBindingWorkEnd(),
|
|
5928
|
+
(c) => {
|
|
5929
|
+
throw s.markBindingWorkEnd(), c;
|
|
5894
5930
|
}
|
|
5895
5931
|
);
|
|
5896
5932
|
};
|
|
@@ -5937,22 +5973,22 @@ const h = class h {
|
|
|
5937
5973
|
if (!t)
|
|
5938
5974
|
return { resolved: {}, sources: {} };
|
|
5939
5975
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
5940
|
-
const
|
|
5941
|
-
return
|
|
5942
|
-
}, s = (l,
|
|
5976
|
+
const h = l.getTarget();
|
|
5977
|
+
return h.id ? `#${h.id}` : h.tagName.toLowerCase();
|
|
5978
|
+
}, s = (l, h, c, p) => {
|
|
5943
5979
|
if (l)
|
|
5944
5980
|
for (const y of Object.keys(l))
|
|
5945
5981
|
y in i || (i[y] = {
|
|
5946
5982
|
value: l[y],
|
|
5947
|
-
source: n(
|
|
5948
|
-
kind:
|
|
5949
|
-
depth:
|
|
5983
|
+
source: n(h),
|
|
5984
|
+
kind: c,
|
|
5985
|
+
depth: p
|
|
5950
5986
|
});
|
|
5951
5987
|
};
|
|
5952
5988
|
let a = t, o = 0;
|
|
5953
5989
|
for (; a; )
|
|
5954
5990
|
a !== t && s(a.getRawDerivedBindingData(), a, "derive", o), s(a.getRawBindingData(), a, "bind", o), a = a.getParent(), o += 1;
|
|
5955
|
-
return
|
|
5991
|
+
return U.isEnabled() && m.info("[Haori]", "scope dump for", e, { resolved: r, sources: i }), { resolved: r, sources: i };
|
|
5956
5992
|
}
|
|
5957
5993
|
/**
|
|
5958
5994
|
* data-bind 属性の値をパースします。
|
|
@@ -5965,7 +6001,7 @@ const h = class h {
|
|
|
5965
6001
|
try {
|
|
5966
6002
|
return JSON.parse(e);
|
|
5967
6003
|
} catch (t) {
|
|
5968
|
-
return
|
|
6004
|
+
return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
5969
6005
|
}
|
|
5970
6006
|
else {
|
|
5971
6007
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -5985,7 +6021,7 @@ const h = class h {
|
|
|
5985
6021
|
if (r.isSkipMutationNodes())
|
|
5986
6022
|
return;
|
|
5987
6023
|
const i = S.get(t.nextSibling), n = S.get(t);
|
|
5988
|
-
n && (r.insertBefore(n, i), n instanceof M ?
|
|
6024
|
+
n && (r.insertBefore(n, i), n instanceof M ? d.scan(n.getTarget()) : n instanceof j && d.evaluateText(n));
|
|
5989
6025
|
}
|
|
5990
6026
|
/**
|
|
5991
6027
|
* ノードを親要素から削除します。
|
|
@@ -6025,11 +6061,11 @@ const h = class h {
|
|
|
6025
6061
|
return Promise.resolve();
|
|
6026
6062
|
const i = [];
|
|
6027
6063
|
i.push(r.setValue(t));
|
|
6028
|
-
const n =
|
|
6064
|
+
const n = d.getFormFragment(r);
|
|
6029
6065
|
if (n) {
|
|
6030
|
-
const s = A.getValues(n), a = n.getAttribute(`${
|
|
6066
|
+
const s = A.getValues(n), a = n.getAttribute(`${u.prefix}form-arg`);
|
|
6031
6067
|
let o;
|
|
6032
|
-
a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(
|
|
6068
|
+
a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(d.setBindingData(n.getTarget(), o));
|
|
6033
6069
|
}
|
|
6034
6070
|
return Promise.all(i).then(() => {
|
|
6035
6071
|
});
|
|
@@ -6044,7 +6080,7 @@ const h = class h {
|
|
|
6044
6080
|
if (e.getTarget() instanceof HTMLFormElement)
|
|
6045
6081
|
return e;
|
|
6046
6082
|
const t = e.getParent();
|
|
6047
|
-
return t ?
|
|
6083
|
+
return t ? d.getFormFragment(t) : null;
|
|
6048
6084
|
}
|
|
6049
6085
|
/**
|
|
6050
6086
|
* フラグメントとその子要素を評価します。
|
|
@@ -6055,55 +6091,55 @@ const h = class h {
|
|
|
6055
6091
|
static evaluateAll(e, t = /* @__PURE__ */ new Set()) {
|
|
6056
6092
|
if (t.has(e))
|
|
6057
6093
|
return Promise.resolve();
|
|
6058
|
-
let r =
|
|
6059
|
-
const i = e.hasAttribute(`${
|
|
6060
|
-
let l = !1,
|
|
6094
|
+
let r = d.reevaluateInterpolatedAttributes(e);
|
|
6095
|
+
const i = e.hasAttribute(`${u.prefix}derive`), n = e.hasAttribute(`${u.prefix}if`), s = e.hasAttribute(`${u.prefix}each`), a = e.getRawAttribute(`${u.prefix}derive`), o = e.getRawAttribute(`${u.prefix}derive-name`);
|
|
6096
|
+
let l = !1, h = !1, c = null;
|
|
6061
6097
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
6062
|
-
const
|
|
6098
|
+
const p = d.createDeriveInputSignature(
|
|
6063
6099
|
e,
|
|
6064
6100
|
a,
|
|
6065
6101
|
o
|
|
6066
6102
|
);
|
|
6067
|
-
|
|
6068
|
-
() =>
|
|
6103
|
+
p === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
6104
|
+
() => d.evaluateDerive(e, a, o).then(
|
|
6069
6105
|
() => {
|
|
6070
6106
|
}
|
|
6071
6107
|
)
|
|
6072
|
-
)) : e.getDeriveInputSignature() !==
|
|
6108
|
+
)) : e.getDeriveInputSignature() !== p && (r = r.then(() => d.evaluateDerive(
|
|
6073
6109
|
e,
|
|
6074
6110
|
a,
|
|
6075
6111
|
o
|
|
6076
6112
|
).then(() => {
|
|
6077
|
-
e.setDeriveInputSignature(
|
|
6113
|
+
e.setDeriveInputSignature(p);
|
|
6078
6114
|
})));
|
|
6079
6115
|
}
|
|
6080
|
-
return n && (r = r.then(() =>
|
|
6116
|
+
return n && (r = r.then(() => d.evaluateIf(e))), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => d.evaluateEach(e))) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
6081
6117
|
})) : (i && (r = r.then(() => {
|
|
6082
|
-
if (!
|
|
6083
|
-
e.setDeriveSubtreeSignature(null),
|
|
6118
|
+
if (!d.canSkipStableDerivedSubtree(e)) {
|
|
6119
|
+
e.setDeriveSubtreeSignature(null), d.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
6084
6120
|
return;
|
|
6085
6121
|
}
|
|
6086
|
-
|
|
6122
|
+
c = d.createDescendantBindingSignature(
|
|
6087
6123
|
e,
|
|
6088
6124
|
"evaluateAll"
|
|
6089
|
-
),
|
|
6125
|
+
), h = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === c, d.logDerivedSubtreeProfileSnapshot(
|
|
6090
6126
|
e,
|
|
6091
6127
|
l ? "skip-hit" : "skip-miss"
|
|
6092
6128
|
);
|
|
6093
6129
|
})), r.then(() => {
|
|
6094
6130
|
if (l)
|
|
6095
6131
|
return;
|
|
6096
|
-
const
|
|
6132
|
+
const p = [];
|
|
6097
6133
|
return e.getChildren().forEach((y) => {
|
|
6098
6134
|
if (y instanceof M) {
|
|
6099
|
-
if (
|
|
6135
|
+
if (d.canSkipUnchangedNestedEach(y))
|
|
6100
6136
|
return;
|
|
6101
|
-
|
|
6102
|
-
} else y instanceof j &&
|
|
6103
|
-
}), Promise.all(
|
|
6137
|
+
p.push(d.evaluateAll(y, t));
|
|
6138
|
+
} else y instanceof j && p.push(d.evaluateText(y));
|
|
6139
|
+
}), Promise.all(p).then(() => {
|
|
6104
6140
|
});
|
|
6105
6141
|
}).then(() => {
|
|
6106
|
-
|
|
6142
|
+
h && c !== null && e.setDeriveSubtreeSignature(c);
|
|
6107
6143
|
}));
|
|
6108
6144
|
}
|
|
6109
6145
|
/**
|
|
@@ -6115,9 +6151,9 @@ const h = class h {
|
|
|
6115
6151
|
* @returns Promise (評価完了時に解決)
|
|
6116
6152
|
*/
|
|
6117
6153
|
static evaluateDerive(e, t = e.getRawAttribute(
|
|
6118
|
-
`${
|
|
6154
|
+
`${u.prefix}derive`
|
|
6119
6155
|
), r = e.getRawAttribute(
|
|
6120
|
-
`${
|
|
6156
|
+
`${u.prefix}derive-name`
|
|
6121
6157
|
)) {
|
|
6122
6158
|
const i = e.getRawDerivedBindingData(), n = typeof r == "string" ? r.trim() : "";
|
|
6123
6159
|
if (!t || n === "")
|
|
@@ -6131,7 +6167,7 @@ const h = class h {
|
|
|
6131
6167
|
const a = {
|
|
6132
6168
|
[n]: s.value
|
|
6133
6169
|
};
|
|
6134
|
-
return
|
|
6170
|
+
return d.createBindingSignature(i) === d.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
|
|
6135
6171
|
}
|
|
6136
6172
|
/**
|
|
6137
6173
|
* テキストフラグメントを評価します。
|
|
@@ -6166,10 +6202,10 @@ const h = class h {
|
|
|
6166
6202
|
* @return 戻り値はありません。
|
|
6167
6203
|
*/
|
|
6168
6204
|
static logFalsyIfDiagnostics(e) {
|
|
6169
|
-
const t = e.getRawAttribute(`${
|
|
6205
|
+
const t = e.getRawAttribute(`${u.prefix}if`);
|
|
6170
6206
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
6171
6207
|
return;
|
|
6172
|
-
const { sources: r } =
|
|
6208
|
+
const { sources: r } = d.dumpScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
6173
6209
|
let s = 0;
|
|
6174
6210
|
n.forEach((o) => {
|
|
6175
6211
|
const l = t.indexOf(o, s);
|
|
@@ -6178,7 +6214,7 @@ const h = class h {
|
|
|
6178
6214
|
const a = {};
|
|
6179
6215
|
i.forEach((o) => {
|
|
6180
6216
|
o in r && (a[o] = r[o]);
|
|
6181
|
-
}),
|
|
6217
|
+
}), m.info(
|
|
6182
6218
|
"[Haori]",
|
|
6183
6219
|
"data-if is falsy (hidden):",
|
|
6184
6220
|
t,
|
|
@@ -6195,9 +6231,9 @@ const h = class h {
|
|
|
6195
6231
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
6196
6232
|
*/
|
|
6197
6233
|
static evaluateIf(e) {
|
|
6198
|
-
const t = [], r = e.getAttribute(`${
|
|
6199
|
-
if (
|
|
6200
|
-
|
|
6234
|
+
const t = [], r = e.getAttribute(`${u.prefix}if`);
|
|
6235
|
+
if (d.isHiddenIfCondition(r))
|
|
6236
|
+
U.isEnabled() && d.logFalsyIfDiagnostics(e), t.push(
|
|
6201
6237
|
e.hide().then(() => {
|
|
6202
6238
|
N.hide(e.getTarget());
|
|
6203
6239
|
})
|
|
@@ -6206,11 +6242,11 @@ const h = class h {
|
|
|
6206
6242
|
const i = e.isVisible(), n = [];
|
|
6207
6243
|
e.getChildren().forEach((s) => {
|
|
6208
6244
|
s instanceof M ? n.push(
|
|
6209
|
-
s.isMounted() ?
|
|
6210
|
-
) : s instanceof j && n.push(
|
|
6245
|
+
s.isMounted() ? d.evaluateAll(s) : d.scan(s.getTarget())
|
|
6246
|
+
) : s instanceof j && n.push(d.evaluateText(s));
|
|
6211
6247
|
}), t.push(
|
|
6212
6248
|
e.show().then(() => {
|
|
6213
|
-
N.show(e.getTarget()), i ||
|
|
6249
|
+
N.show(e.getTarget()), i || d.triggerLoadOnShow(e);
|
|
6214
6250
|
})
|
|
6215
6251
|
), t.push(Promise.all(n).then(() => {
|
|
6216
6252
|
}));
|
|
@@ -6228,9 +6264,9 @@ const h = class h {
|
|
|
6228
6264
|
* @return 戻り値はありません。
|
|
6229
6265
|
*/
|
|
6230
6266
|
static triggerLoadOnShow(e) {
|
|
6231
|
-
const t = `${
|
|
6232
|
-
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new
|
|
6233
|
-
|
|
6267
|
+
const t = `${u.prefix}load-`;
|
|
6268
|
+
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new W(e, "load").run().catch((i) => {
|
|
6269
|
+
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
6234
6270
|
});
|
|
6235
6271
|
}
|
|
6236
6272
|
/**
|
|
@@ -6240,8 +6276,8 @@ const h = class h {
|
|
|
6240
6276
|
* @return 再入制御状態
|
|
6241
6277
|
*/
|
|
6242
6278
|
static getEachUpdateState(e) {
|
|
6243
|
-
let t =
|
|
6244
|
-
return t || (t = { running: !1, rerunRequested: !1, settled: null },
|
|
6279
|
+
let t = d.EACH_UPDATE_STATES.get(e);
|
|
6280
|
+
return t || (t = { running: !1, rerunRequested: !1, settled: null }, d.EACH_UPDATE_STATES.set(e, t)), t;
|
|
6245
6281
|
}
|
|
6246
6282
|
/**
|
|
6247
6283
|
* each要素を評価します。
|
|
@@ -6259,8 +6295,8 @@ const h = class h {
|
|
|
6259
6295
|
static evaluateEach(e) {
|
|
6260
6296
|
if (!e.isVisible() || !e.isMounted())
|
|
6261
6297
|
return Promise.resolve();
|
|
6262
|
-
const t =
|
|
6263
|
-
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) :
|
|
6298
|
+
const t = d.getEachUpdateState(e);
|
|
6299
|
+
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) : d.runEachUpdateLoop(e, t);
|
|
6264
6300
|
}
|
|
6265
6301
|
/**
|
|
6266
6302
|
* data-each の差分更新を、再評価要求が無くなるまで直列に繰り返し実行します。
|
|
@@ -6272,18 +6308,18 @@ const h = class h {
|
|
|
6272
6308
|
* @return すべての差分更新が安定するまでの完了 Promise
|
|
6273
6309
|
*/
|
|
6274
6310
|
static runEachUpdateLoop(e, t) {
|
|
6275
|
-
t.running = !0, e.getTarget().removeAttribute(`${
|
|
6311
|
+
t.running = !0, e.getTarget().removeAttribute(`${u.prefix}each-done`);
|
|
6276
6312
|
const r = (async () => {
|
|
6277
6313
|
try {
|
|
6278
6314
|
do
|
|
6279
|
-
t.rerunRequested = !1, await
|
|
6315
|
+
t.rerunRequested = !1, await d.performEachUpdate(e);
|
|
6280
6316
|
while (t.rerunRequested);
|
|
6281
6317
|
const i = e.getTarget();
|
|
6282
|
-
i.setAttribute(`${
|
|
6318
|
+
i.setAttribute(`${u.prefix}each-done`, ""), d.runEachRenderedScript(i);
|
|
6283
6319
|
} finally {
|
|
6284
6320
|
t.running = !1, t.settled = null;
|
|
6285
6321
|
}
|
|
6286
|
-
|
|
6322
|
+
d.runEachRenderedChange(e);
|
|
6287
6323
|
})();
|
|
6288
6324
|
return t.settled = r, r;
|
|
6289
6325
|
}
|
|
@@ -6298,7 +6334,7 @@ const h = class h {
|
|
|
6298
6334
|
* @param target data-each コンテナ要素
|
|
6299
6335
|
*/
|
|
6300
6336
|
static runEachRenderedScript(e) {
|
|
6301
|
-
const t = `${
|
|
6337
|
+
const t = `${u.prefix}each-rendered-run`;
|
|
6302
6338
|
if (!e.hasAttribute(t))
|
|
6303
6339
|
return;
|
|
6304
6340
|
const r = String(e.getAttribute(t) ?? "");
|
|
@@ -6315,14 +6351,14 @@ ${r}
|
|
|
6315
6351
|
${r}
|
|
6316
6352
|
`);
|
|
6317
6353
|
} catch (n) {
|
|
6318
|
-
|
|
6354
|
+
m.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
6319
6355
|
}
|
|
6320
6356
|
}
|
|
6321
6357
|
if (i)
|
|
6322
6358
|
try {
|
|
6323
6359
|
i.call(e);
|
|
6324
6360
|
} catch (n) {
|
|
6325
|
-
|
|
6361
|
+
m.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
6326
6362
|
}
|
|
6327
6363
|
}
|
|
6328
6364
|
/**
|
|
@@ -6348,24 +6384,24 @@ ${r}
|
|
|
6348
6384
|
* @param fragment data-each コンテナのフラグメント
|
|
6349
6385
|
*/
|
|
6350
6386
|
static runEachRenderedChange(e) {
|
|
6351
|
-
const t = `${
|
|
6387
|
+
const t = `${u.prefix}each-rendered-change`, r = e.getTarget();
|
|
6352
6388
|
if (!r.hasAttribute(t))
|
|
6353
6389
|
return;
|
|
6354
6390
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
6355
6391
|
let n = !1;
|
|
6356
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (
|
|
6392
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (d.EACH_RENDERED_CHANGE_WARNED.has(r) || (d.EACH_RENDERED_CHANGE_WARNED.add(r), m.warn(
|
|
6357
6393
|
"[Haori]",
|
|
6358
6394
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
6359
|
-
))),
|
|
6395
|
+
))), d.countEachRenderedRows(e) !== 0) {
|
|
6360
6396
|
if (!n) {
|
|
6361
|
-
if (
|
|
6397
|
+
if (d.EACH_RENDERED_CHANGE_FIRED.has(r))
|
|
6362
6398
|
return;
|
|
6363
|
-
|
|
6399
|
+
d.EACH_RENDERED_CHANGE_FIRED.add(r);
|
|
6364
6400
|
}
|
|
6365
6401
|
try {
|
|
6366
6402
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
6367
6403
|
} catch (s) {
|
|
6368
|
-
|
|
6404
|
+
m.error("[Haori]", `each-rendered-change dispatch error: ${s}`);
|
|
6369
6405
|
}
|
|
6370
6406
|
}
|
|
6371
6407
|
}
|
|
@@ -6382,7 +6418,7 @@ ${r}
|
|
|
6382
6418
|
static countEachRenderedRows(e) {
|
|
6383
6419
|
let t = 0;
|
|
6384
6420
|
for (const r of e.getChildElementFragments())
|
|
6385
|
-
r.getTarget().hasAttribute(`${
|
|
6421
|
+
r.getTarget().hasAttribute(`${u.prefix}row`) && (t += 1);
|
|
6386
6422
|
return t;
|
|
6387
6423
|
}
|
|
6388
6424
|
/**
|
|
@@ -6392,11 +6428,11 @@ ${r}
|
|
|
6392
6428
|
* @return 差分更新完了の Promise
|
|
6393
6429
|
*/
|
|
6394
6430
|
static performEachUpdate(e) {
|
|
6395
|
-
const t =
|
|
6431
|
+
const t = d.resolveEachItems(e);
|
|
6396
6432
|
if (t === null)
|
|
6397
6433
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
6398
6434
|
let r = e.getTemplate();
|
|
6399
|
-
const i = e.getAttribute(`${
|
|
6435
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = d.createBindingSignature({
|
|
6400
6436
|
key: i ? String(i) : null,
|
|
6401
6437
|
items: t
|
|
6402
6438
|
});
|
|
@@ -6404,23 +6440,23 @@ ${r}
|
|
|
6404
6440
|
let s = !1;
|
|
6405
6441
|
if (e.getChildren().forEach((a) => {
|
|
6406
6442
|
if (!s && a instanceof M) {
|
|
6407
|
-
if (a.hasAttribute(`${
|
|
6443
|
+
if (a.hasAttribute(`${u.prefix}each-before`) || a.hasAttribute(`${u.prefix}each-after`))
|
|
6408
6444
|
return;
|
|
6409
|
-
r = a.clone(),
|
|
6445
|
+
r = a.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
6410
6446
|
const o = a.getTarget();
|
|
6411
6447
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
6412
6448
|
}
|
|
6413
6449
|
}), !s) {
|
|
6414
6450
|
const a = e.getTarget();
|
|
6415
6451
|
Array.from(a.children).filter(
|
|
6416
|
-
(l) => !l.hasAttribute(`${
|
|
6452
|
+
(l) => !l.hasAttribute(`${u.prefix}each-before`) && !l.hasAttribute(`${u.prefix}each-after`)
|
|
6417
6453
|
).forEach((l) => {
|
|
6418
6454
|
if (!s) {
|
|
6419
|
-
const
|
|
6420
|
-
|
|
6455
|
+
const c = S.get(l);
|
|
6456
|
+
c instanceof M && (r = c.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
6421
6457
|
}
|
|
6422
|
-
const
|
|
6423
|
-
|
|
6458
|
+
const h = S.get(l);
|
|
6459
|
+
h instanceof M && e.getChildren().includes(h) && (e.removeChild(h), h.setMounted(!1)), l.parentNode && l.parentNode.removeChild(l);
|
|
6424
6460
|
});
|
|
6425
6461
|
}
|
|
6426
6462
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -6438,8 +6474,8 @@ ${r}
|
|
|
6438
6474
|
* @returns 配列。無効な場合は null
|
|
6439
6475
|
*/
|
|
6440
6476
|
static resolveEachItems(e) {
|
|
6441
|
-
const t = e.getAttributeEvaluation(`${
|
|
6442
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
6477
|
+
const t = e.getAttributeEvaluation(`${u.prefix}each`), r = t?.value;
|
|
6478
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
|
|
6443
6479
|
}
|
|
6444
6480
|
/**
|
|
6445
6481
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -6449,15 +6485,15 @@ ${r}
|
|
|
6449
6485
|
* @returns 省略可能なら true
|
|
6450
6486
|
*/
|
|
6451
6487
|
static canSkipUnchangedNestedEach(e) {
|
|
6452
|
-
if (!e.hasAttribute(`${
|
|
6488
|
+
if (!e.hasAttribute(`${u.prefix}each`) || e.getEachInputSignature() === null)
|
|
6453
6489
|
return !1;
|
|
6454
6490
|
const t = e.getParent();
|
|
6455
|
-
if (t?.closestByAttribute(`${
|
|
6491
|
+
if (t?.closestByAttribute(`${u.prefix}derive`) || t?.closestByAttribute(`${u.prefix}derive-name`) || t?.closestByAttribute(`${u.prefix}if`) || t?.closestByAttribute(`${u.prefix}fetch`) || t?.closestByAttribute(`${u.prefix}import`) || d.hasNonEachDynamicElementState(e))
|
|
6456
6492
|
return !1;
|
|
6457
|
-
const r =
|
|
6493
|
+
const r = d.resolveEachItems(e);
|
|
6458
6494
|
if (r === null)
|
|
6459
6495
|
return !1;
|
|
6460
|
-
const i = e.getAttribute(`${
|
|
6496
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = d.createBindingSignature({
|
|
6461
6497
|
key: i ? String(i) : null,
|
|
6462
6498
|
items: r
|
|
6463
6499
|
});
|
|
@@ -6471,7 +6507,7 @@ ${r}
|
|
|
6471
6507
|
* @returns 省略可能なら true
|
|
6472
6508
|
*/
|
|
6473
6509
|
static canSkipStableDerivedSubtree(e) {
|
|
6474
|
-
return !e.hasAttribute(`${
|
|
6510
|
+
return !e.hasAttribute(`${u.prefix}derive`) || e.hasAttribute(`${u.prefix}if`) || e.hasAttribute(`${u.prefix}each`) || e.hasAttribute(`${u.prefix}fetch`) || e.hasAttribute(`${u.prefix}import`) ? !1 : !d.hasDisallowedDerivedSubtreeDescendant(e);
|
|
6475
6511
|
}
|
|
6476
6512
|
/**
|
|
6477
6513
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -6480,7 +6516,7 @@ ${r}
|
|
|
6480
6516
|
* @returns 含むなら true
|
|
6481
6517
|
*/
|
|
6482
6518
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
6483
|
-
return e.getChildren().some((t) => t instanceof M ? t.hasAttribute(`${
|
|
6519
|
+
return e.getChildren().some((t) => t instanceof M ? t.hasAttribute(`${u.prefix}derive`) || t.hasAttribute(`${u.prefix}derive-name`) || t.hasAttribute(`${u.prefix}fetch`) || t.hasAttribute(`${u.prefix}import`) ? !0 : d.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
6484
6520
|
}
|
|
6485
6521
|
/**
|
|
6486
6522
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -6489,7 +6525,7 @@ ${r}
|
|
|
6489
6525
|
* @returns binding 署名
|
|
6490
6526
|
*/
|
|
6491
6527
|
static createDescendantBindingSignature(e, t) {
|
|
6492
|
-
return
|
|
6528
|
+
return d.recordDerivedSubtreeSignatureComputation(e, t), d.createBindingSignature(e.getDescendantBindingData());
|
|
6493
6529
|
}
|
|
6494
6530
|
/**
|
|
6495
6531
|
* data-derive 実行前の入力署名を返します。
|
|
@@ -6501,7 +6537,7 @@ ${r}
|
|
|
6501
6537
|
*/
|
|
6502
6538
|
static createDeriveInputSignature(e, t, r) {
|
|
6503
6539
|
const i = typeof r == "string" ? r.trim() : "";
|
|
6504
|
-
return !t || i === "" ? null :
|
|
6540
|
+
return !t || i === "" ? null : d.createBindingSignature({
|
|
6505
6541
|
expression: t,
|
|
6506
6542
|
name: i,
|
|
6507
6543
|
scope: e.getBindingData()
|
|
@@ -6513,13 +6549,13 @@ ${r}
|
|
|
6513
6549
|
* @param fragment 対象フラグメント
|
|
6514
6550
|
*/
|
|
6515
6551
|
static refreshDerivedSubtreeSignature(e) {
|
|
6516
|
-
if (!
|
|
6517
|
-
e.setDeriveSubtreeSignature(null),
|
|
6552
|
+
if (!d.canSkipStableDerivedSubtree(e)) {
|
|
6553
|
+
e.setDeriveSubtreeSignature(null), d.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
6518
6554
|
return;
|
|
6519
6555
|
}
|
|
6520
6556
|
e.setDeriveSubtreeSignature(
|
|
6521
|
-
|
|
6522
|
-
),
|
|
6557
|
+
d.createDescendantBindingSignature(e, "refresh")
|
|
6558
|
+
), d.logDerivedSubtreeProfileSnapshot(e, "refresh");
|
|
6523
6559
|
}
|
|
6524
6560
|
/**
|
|
6525
6561
|
* data-derive subtree skip のプロファイルを取得または初期化します。
|
|
@@ -6528,13 +6564,13 @@ ${r}
|
|
|
6528
6564
|
* @returns プロファイル
|
|
6529
6565
|
*/
|
|
6530
6566
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
6531
|
-
if (!
|
|
6567
|
+
if (!U.isEnabled() || !e.hasAttribute(`${u.prefix}derive`))
|
|
6532
6568
|
return null;
|
|
6533
|
-
const t =
|
|
6569
|
+
const t = d.DERIVE_SUBTREE_PROFILES.get(e);
|
|
6534
6570
|
if (t)
|
|
6535
6571
|
return t;
|
|
6536
6572
|
const r = {
|
|
6537
|
-
hostId:
|
|
6573
|
+
hostId: d.createDerivedSubtreeHostId(e),
|
|
6538
6574
|
signatureComputeTotal: 0,
|
|
6539
6575
|
signatureComputeFromEvaluateAll: 0,
|
|
6540
6576
|
signatureComputeFromRefresh: 0,
|
|
@@ -6542,7 +6578,7 @@ ${r}
|
|
|
6542
6578
|
skipMissCount: 0,
|
|
6543
6579
|
skipIneligibleCount: 0
|
|
6544
6580
|
};
|
|
6545
|
-
return
|
|
6581
|
+
return d.DERIVE_SUBTREE_PROFILES.set(e, r), r;
|
|
6546
6582
|
}
|
|
6547
6583
|
/**
|
|
6548
6584
|
* data-derive subtree host の識別子を作成します。
|
|
@@ -6562,8 +6598,8 @@ ${r}
|
|
|
6562
6598
|
n += `#${i.id.trim()}`, t.unshift(n);
|
|
6563
6599
|
break;
|
|
6564
6600
|
}
|
|
6565
|
-
const s = r.getRawAttribute(`${
|
|
6566
|
-
typeof s == "string" && s.trim() !== "" && (n += `[${
|
|
6601
|
+
const s = r.getRawAttribute(`${u.prefix}derive-name`);
|
|
6602
|
+
typeof s == "string" && s.trim() !== "" && (n += `[${u.prefix}derive-name="${s.trim()}"]`);
|
|
6567
6603
|
const a = r.getParent();
|
|
6568
6604
|
if (a) {
|
|
6569
6605
|
const o = a.getChildren().filter((l) => l instanceof M).findIndex((l) => l === r);
|
|
@@ -6580,7 +6616,7 @@ ${r}
|
|
|
6580
6616
|
* @param source 計算元
|
|
6581
6617
|
*/
|
|
6582
6618
|
static recordDerivedSubtreeSignatureComputation(e, t) {
|
|
6583
|
-
const r =
|
|
6619
|
+
const r = d.getOrCreateDerivedSubtreeProfile(e);
|
|
6584
6620
|
if (r !== null) {
|
|
6585
6621
|
if (r.signatureComputeTotal += 1, t === "refresh") {
|
|
6586
6622
|
r.signatureComputeFromRefresh += 1;
|
|
@@ -6596,8 +6632,8 @@ ${r}
|
|
|
6596
6632
|
* @param reason ログ理由
|
|
6597
6633
|
*/
|
|
6598
6634
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
6599
|
-
const r =
|
|
6600
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
6635
|
+
const r = d.getOrCreateDerivedSubtreeProfile(e);
|
|
6636
|
+
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]", {
|
|
6601
6637
|
reason: t,
|
|
6602
6638
|
hostId: r.hostId,
|
|
6603
6639
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -6616,15 +6652,15 @@ ${r}
|
|
|
6616
6652
|
*/
|
|
6617
6653
|
static hasNonEachDynamicElementState(e) {
|
|
6618
6654
|
const t = /* @__PURE__ */ new Set([
|
|
6619
|
-
`${
|
|
6620
|
-
`${
|
|
6621
|
-
`${
|
|
6622
|
-
`${
|
|
6655
|
+
`${u.prefix}each`,
|
|
6656
|
+
`${u.prefix}each-key`,
|
|
6657
|
+
`${u.prefix}each-arg`,
|
|
6658
|
+
`${u.prefix}each-index`
|
|
6623
6659
|
]);
|
|
6624
6660
|
return e.getAttributeNames().some((i) => {
|
|
6625
6661
|
if (t.has(i))
|
|
6626
6662
|
return !1;
|
|
6627
|
-
if (i.startsWith(`${
|
|
6663
|
+
if (i.startsWith(`${u.prefix}attr-`) || i.startsWith(u.prefix))
|
|
6628
6664
|
return !0;
|
|
6629
6665
|
const n = e.getRawAttribute(i);
|
|
6630
6666
|
return typeof n == "string" && n.includes("{{");
|
|
@@ -6639,7 +6675,7 @@ ${r}
|
|
|
6639
6675
|
* @returns subtree 全体を省略可能なら true
|
|
6640
6676
|
*/
|
|
6641
6677
|
static markFreshInitializationSkippable(e) {
|
|
6642
|
-
const t = e.getAttributeNames().some((n) =>
|
|
6678
|
+
const t = e.getAttributeNames().some((n) => d.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof M ? !d.markFreshInitializationSkippable(n) : n instanceof j ? n.hasDynamicContent() : !1), i = !t && !r;
|
|
6643
6679
|
return e.setFreshInitializationSkippable(i), i;
|
|
6644
6680
|
}
|
|
6645
6681
|
/**
|
|
@@ -6650,7 +6686,7 @@ ${r}
|
|
|
6650
6686
|
* @returns 再評価が必要なら true
|
|
6651
6687
|
*/
|
|
6652
6688
|
static isFreshInitializationDynamicAttribute(e, t) {
|
|
6653
|
-
if (t.startsWith(`${
|
|
6689
|
+
if (t.startsWith(`${u.prefix}attr-`) || t.startsWith(u.prefix))
|
|
6654
6690
|
return !0;
|
|
6655
6691
|
const r = e.getRawAttribute(t);
|
|
6656
6692
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -6664,56 +6700,56 @@ ${r}
|
|
|
6664
6700
|
static updateDiff(e, t) {
|
|
6665
6701
|
const r = e.getTemplate();
|
|
6666
6702
|
if (r === null)
|
|
6667
|
-
return
|
|
6668
|
-
let i = e.getAttribute(`${
|
|
6703
|
+
return m.error("[Haori]", "Template is not set for each element."), Promise.resolve();
|
|
6704
|
+
let i = e.getAttribute(`${u.prefix}each-index`);
|
|
6669
6705
|
i && (i = String(i));
|
|
6670
|
-
const n = e.getAttribute(`${
|
|
6706
|
+
const n = e.getAttribute(`${u.prefix}each-key`), s = e.getAttribute(`${u.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
6671
6707
|
t.forEach((b, v) => {
|
|
6672
|
-
const R =
|
|
6708
|
+
const R = d.createListKey(
|
|
6673
6709
|
b,
|
|
6674
6710
|
n ? String(n) : null,
|
|
6675
6711
|
v
|
|
6676
6712
|
);
|
|
6677
6713
|
o.push(R), a.set(R, { item: b, itemIndex: v });
|
|
6678
6714
|
});
|
|
6679
|
-
const l = new Set(o),
|
|
6680
|
-
let
|
|
6681
|
-
(b) => !b.hasAttribute(`${
|
|
6715
|
+
const l = new Set(o), h = [];
|
|
6716
|
+
let c = e.getChildren().filter((b) => b instanceof M).filter(
|
|
6717
|
+
(b) => !b.hasAttribute(`${u.prefix}each-before`) && !b.hasAttribute(`${u.prefix}each-after`)
|
|
6682
6718
|
);
|
|
6683
|
-
const
|
|
6684
|
-
|
|
6685
|
-
const y =
|
|
6686
|
-
|
|
6719
|
+
const p = c.map((b) => b.getListKey());
|
|
6720
|
+
c = c.filter((b) => l.has(String(b.getListKey())) ? !0 : (h.push(b.remove()), !1));
|
|
6721
|
+
const y = c.map((b) => b.getListKey()), T = /* @__PURE__ */ new Map();
|
|
6722
|
+
c.forEach((b) => {
|
|
6687
6723
|
const v = b.getListKey();
|
|
6688
6724
|
v !== null && !T.has(v) && T.set(v, b);
|
|
6689
6725
|
});
|
|
6690
|
-
const
|
|
6691
|
-
(b) => b.hasAttribute(`${
|
|
6726
|
+
const I = e.getChildElementFragments().slice(), H = I.filter(
|
|
6727
|
+
(b) => b.hasAttribute(`${u.prefix}each-before`)
|
|
6692
6728
|
).length;
|
|
6693
6729
|
let E = Promise.resolve();
|
|
6694
6730
|
return o.forEach((b, v) => {
|
|
6695
6731
|
const { item: R, itemIndex: C } = a.get(b);
|
|
6696
6732
|
let F;
|
|
6697
|
-
const
|
|
6698
|
-
if (
|
|
6699
|
-
F =
|
|
6700
|
-
() =>
|
|
6733
|
+
const L = T.get(b);
|
|
6734
|
+
if (L)
|
|
6735
|
+
F = L, E = E.then(
|
|
6736
|
+
() => d.updateRowFragment(
|
|
6701
6737
|
F,
|
|
6702
6738
|
R,
|
|
6703
6739
|
i,
|
|
6704
6740
|
C,
|
|
6705
6741
|
s ? String(s) : null,
|
|
6706
6742
|
b
|
|
6707
|
-
).then((
|
|
6708
|
-
if (
|
|
6709
|
-
return
|
|
6743
|
+
).then((B) => {
|
|
6744
|
+
if (B)
|
|
6745
|
+
return d.evaluateAll(F);
|
|
6710
6746
|
})
|
|
6711
6747
|
);
|
|
6712
6748
|
else {
|
|
6713
6749
|
F = r.clone();
|
|
6714
|
-
const
|
|
6750
|
+
const B = H + v;
|
|
6715
6751
|
E = E.then(
|
|
6716
|
-
() =>
|
|
6752
|
+
() => d.updateRowFragment(
|
|
6717
6753
|
F,
|
|
6718
6754
|
R,
|
|
6719
6755
|
i,
|
|
@@ -6721,27 +6757,27 @@ ${r}
|
|
|
6721
6757
|
s ? String(s) : null,
|
|
6722
6758
|
b
|
|
6723
6759
|
).then(() => {
|
|
6724
|
-
const
|
|
6725
|
-
return e.insertBefore(F,
|
|
6726
|
-
|
|
6727
|
-
}).then(() =>
|
|
6760
|
+
const K = I[B] ?? null;
|
|
6761
|
+
return e.insertBefore(F, K).then(() => {
|
|
6762
|
+
I.splice(B, 0, F);
|
|
6763
|
+
}).then(() => d.initializeFreshEachRow(F));
|
|
6728
6764
|
})
|
|
6729
6765
|
);
|
|
6730
6766
|
}
|
|
6731
|
-
}), Promise.all(
|
|
6767
|
+
}), Promise.all(h).then(() => E).then(() => {
|
|
6732
6768
|
const b = o.filter(
|
|
6733
|
-
(
|
|
6769
|
+
(B) => B !== null
|
|
6734
6770
|
), v = y.filter(
|
|
6735
|
-
(
|
|
6736
|
-
), R = new Set(v), C = b.filter((
|
|
6737
|
-
(
|
|
6771
|
+
(B) => B !== null
|
|
6772
|
+
), R = new Set(v), C = b.filter((B) => !R.has(B)), L = p.filter(
|
|
6773
|
+
(B) => B !== null
|
|
6738
6774
|
).filter(
|
|
6739
|
-
(
|
|
6775
|
+
(B) => !l.has(B)
|
|
6740
6776
|
);
|
|
6741
6777
|
N.eachUpdate(
|
|
6742
6778
|
e.getTarget(),
|
|
6743
6779
|
C,
|
|
6744
|
-
|
|
6780
|
+
L,
|
|
6745
6781
|
b
|
|
6746
6782
|
);
|
|
6747
6783
|
});
|
|
@@ -6788,15 +6824,15 @@ ${r}
|
|
|
6788
6824
|
[n]: t
|
|
6789
6825
|
}, r && (a[r] = i);
|
|
6790
6826
|
else
|
|
6791
|
-
return
|
|
6827
|
+
return m.error(
|
|
6792
6828
|
"[Haori]",
|
|
6793
|
-
`Primitive value requires '${
|
|
6829
|
+
`Primitive value requires '${u.prefix}each-arg' attribute: ${t}`
|
|
6794
6830
|
), Promise.resolve(!1);
|
|
6795
|
-
const o = a, l =
|
|
6831
|
+
const o = a, l = d.createBindingSignature({
|
|
6796
6832
|
listKey: s,
|
|
6797
6833
|
bindingData: o
|
|
6798
6834
|
});
|
|
6799
|
-
return e.getListKey() === s && e.getRenderSignature() === l ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(l), e.setBindingData(o), e.setAttribute(`${
|
|
6835
|
+
return e.getListKey() === s && e.getRenderSignature() === l ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(l), e.setBindingData(o), e.setAttribute(`${u.prefix}row`, s).then(() => !0));
|
|
6800
6836
|
}
|
|
6801
6837
|
/**
|
|
6802
6838
|
* 新規挿入行に遅延再評価が必要かどうかを判定します。
|
|
@@ -6810,7 +6846,7 @@ ${r}
|
|
|
6810
6846
|
const r = t.pop();
|
|
6811
6847
|
if (r.getChildElementFragments().forEach((i) => {
|
|
6812
6848
|
t.push(i);
|
|
6813
|
-
}), r !== e && !r.isMounted() &&
|
|
6849
|
+
}), r !== e && !r.isMounted() && d.hasMountSensitiveAttribute(r))
|
|
6814
6850
|
return !0;
|
|
6815
6851
|
}
|
|
6816
6852
|
return !1;
|
|
@@ -6823,7 +6859,7 @@ ${r}
|
|
|
6823
6859
|
*/
|
|
6824
6860
|
static hasMountSensitiveAttribute(e) {
|
|
6825
6861
|
return ["fetch", "import"].some(
|
|
6826
|
-
(t) => e.hasAttribute(`${
|
|
6862
|
+
(t) => e.hasAttribute(`${u.prefix}${t}`)
|
|
6827
6863
|
);
|
|
6828
6864
|
}
|
|
6829
6865
|
/**
|
|
@@ -6857,7 +6893,7 @@ ${r}
|
|
|
6857
6893
|
if (t.has(e))
|
|
6858
6894
|
return `[Circular:${t.get(e)}]`;
|
|
6859
6895
|
const i = `array-${r.value}`;
|
|
6860
|
-
return r.value += 1, t.set(e, i), `[${e.map((n) =>
|
|
6896
|
+
return r.value += 1, t.set(e, i), `[${e.map((n) => d.createBindingSignature(n, t, r)).join(",")}]`;
|
|
6861
6897
|
}
|
|
6862
6898
|
if (typeof e == "object") {
|
|
6863
6899
|
if (t.has(e))
|
|
@@ -6866,7 +6902,7 @@ ${r}
|
|
|
6866
6902
|
r.value += 1, t.set(e, i);
|
|
6867
6903
|
const n = e;
|
|
6868
6904
|
return `{${Object.keys(n).sort().map(
|
|
6869
|
-
(s) => `${JSON.stringify(s)}:${
|
|
6905
|
+
(s) => `${JSON.stringify(s)}:${d.createBindingSignature(
|
|
6870
6906
|
n[s],
|
|
6871
6907
|
t,
|
|
6872
6908
|
r
|
|
@@ -6882,18 +6918,18 @@ ${r}
|
|
|
6882
6918
|
*/
|
|
6883
6919
|
static scheduleEvaluateAll(e) {
|
|
6884
6920
|
setTimeout(() => {
|
|
6885
|
-
|
|
6921
|
+
d.evaluateAll(e);
|
|
6886
6922
|
}, 100);
|
|
6887
6923
|
}
|
|
6888
6924
|
};
|
|
6889
|
-
|
|
6925
|
+
d.ATTRIBUTE_ALIAS_SUFFIX = "attr-", d.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
6890
6926
|
"bind",
|
|
6891
6927
|
"url-param",
|
|
6892
6928
|
"derive-name",
|
|
6893
6929
|
"derive",
|
|
6894
6930
|
"if",
|
|
6895
6931
|
"each"
|
|
6896
|
-
],
|
|
6932
|
+
], d.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], d.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
|
|
6897
6933
|
"bind",
|
|
6898
6934
|
"derive",
|
|
6899
6935
|
"derive-name",
|
|
@@ -6902,8 +6938,8 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
6902
6938
|
"fetch",
|
|
6903
6939
|
"import",
|
|
6904
6940
|
"url-param"
|
|
6905
|
-
],
|
|
6906
|
-
let
|
|
6941
|
+
], d.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, d.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), d.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), d.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), d.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap(), d.EACH_RENDERED_CHANGE_FIRED = /* @__PURE__ */ new WeakSet(), d.EACH_RENDERED_CHANGE_WARNED = /* @__PURE__ */ new WeakSet();
|
|
6942
|
+
let k = d;
|
|
6907
6943
|
const ee = class ee {
|
|
6908
6944
|
/**
|
|
6909
6945
|
* コンストラクタ。
|
|
@@ -6929,7 +6965,7 @@ const ee = class ee {
|
|
|
6929
6965
|
*/
|
|
6930
6966
|
runWindowLoadProcedure() {
|
|
6931
6967
|
const e = document.documentElement, t = S.get(e);
|
|
6932
|
-
t && new
|
|
6968
|
+
t && new W(t, "load").run();
|
|
6933
6969
|
}
|
|
6934
6970
|
/**
|
|
6935
6971
|
* イベントリスナーの登録を開始します。
|
|
@@ -6971,7 +7007,7 @@ const ee = class ee {
|
|
|
6971
7007
|
try {
|
|
6972
7008
|
t();
|
|
6973
7009
|
} catch (r) {
|
|
6974
|
-
|
|
7010
|
+
m.error("[Haori]", "Deferred event handling error:", r);
|
|
6975
7011
|
}
|
|
6976
7012
|
}
|
|
6977
7013
|
/**
|
|
@@ -6998,7 +7034,7 @@ const ee = class ee {
|
|
|
6998
7034
|
* @returns `data-on` 属性名
|
|
6999
7035
|
*/
|
|
7000
7036
|
get onAttributeName() {
|
|
7001
|
-
return `${
|
|
7037
|
+
return `${u.prefix}on`;
|
|
7002
7038
|
}
|
|
7003
7039
|
/**
|
|
7004
7040
|
* ルート配下に存在する `data-on` 宣言を走査し、カスタムイベントを購読します。
|
|
@@ -7026,7 +7062,7 @@ const ee = class ee {
|
|
|
7026
7062
|
if (e === null || e === "")
|
|
7027
7063
|
return;
|
|
7028
7064
|
if (ee.BUILTIN_EVENT_NAMES.has(e)) {
|
|
7029
|
-
|
|
7065
|
+
m.warn(
|
|
7030
7066
|
"[Haori]",
|
|
7031
7067
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
7032
7068
|
);
|
|
@@ -7055,8 +7091,8 @@ const ee = class ee {
|
|
|
7055
7091
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
7056
7092
|
return;
|
|
7057
7093
|
const n = S.get(i);
|
|
7058
|
-
n instanceof M && new
|
|
7059
|
-
|
|
7094
|
+
n instanceof M && new W(n, "on", t).run().catch((s) => {
|
|
7095
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
7060
7096
|
});
|
|
7061
7097
|
});
|
|
7062
7098
|
}
|
|
@@ -7094,11 +7130,11 @@ const ee = class ee {
|
|
|
7094
7130
|
const r = this.getElementFromTarget(e.target, t);
|
|
7095
7131
|
if (r) {
|
|
7096
7132
|
if (t === "input") {
|
|
7097
|
-
const i = `${
|
|
7133
|
+
const i = `${u.prefix}input-`;
|
|
7098
7134
|
if (!r.getAttributeNames().some((s) => s.startsWith(i)))
|
|
7099
7135
|
return;
|
|
7100
7136
|
}
|
|
7101
|
-
if (r.hasAttribute(`${
|
|
7137
|
+
if (r.hasAttribute(`${u.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
7102
7138
|
this.deferredProcedures.push(() => {
|
|
7103
7139
|
r.isConnected && this.runProcedureFor(r, t, e);
|
|
7104
7140
|
});
|
|
@@ -7129,11 +7165,11 @@ const ee = class ee {
|
|
|
7129
7165
|
}
|
|
7130
7166
|
}
|
|
7131
7167
|
const n = () => {
|
|
7132
|
-
new
|
|
7133
|
-
|
|
7168
|
+
new W(i, t, r).run().catch((s) => {
|
|
7169
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
7134
7170
|
});
|
|
7135
7171
|
};
|
|
7136
|
-
if (t === "click" && e.hasAttribute(`${
|
|
7172
|
+
if (t === "click" && e.hasAttribute(`${u.prefix}click-defer`)) {
|
|
7137
7173
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => n()) : setTimeout(n, 0);
|
|
7138
7174
|
return;
|
|
7139
7175
|
}
|
|
@@ -7170,7 +7206,7 @@ const ee = class ee {
|
|
|
7170
7206
|
* @returns 処理対象要素。見つからない場合は null
|
|
7171
7207
|
*/
|
|
7172
7208
|
findClickableElement(e) {
|
|
7173
|
-
const t = `${
|
|
7209
|
+
const t = `${u.prefix}click-`, r = `${u.prefix}click-passive`;
|
|
7174
7210
|
let i = e;
|
|
7175
7211
|
for (; i; ) {
|
|
7176
7212
|
if (i.getAttributeNames().some((s) => s.startsWith(t) && s !== r))
|
|
@@ -7188,7 +7224,7 @@ ee.HISTORY_STATE_KEY = "__haoriHistoryState__", ee.BUILTIN_EVENT_NAMES = /* @__P
|
|
|
7188
7224
|
"input",
|
|
7189
7225
|
"load"
|
|
7190
7226
|
]);
|
|
7191
|
-
let
|
|
7227
|
+
let Ee = ee;
|
|
7192
7228
|
const D = class D {
|
|
7193
7229
|
/**
|
|
7194
7230
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -7215,7 +7251,7 @@ const D = class D {
|
|
|
7215
7251
|
}
|
|
7216
7252
|
if (typeof IntersectionObserver > "u")
|
|
7217
7253
|
return;
|
|
7218
|
-
const i = D.resolveRoot(r), n = D.resolveRootMargin(r), s = D.resolveThreshold(r), a = r.hasAttribute(`${
|
|
7254
|
+
const i = D.resolveRoot(r), n = D.resolveRootMargin(r), s = D.resolveThreshold(r), a = r.hasAttribute(`${u.prefix}intersect-once`);
|
|
7219
7255
|
if (t && t.observer.root === i && t.observer.rootMargin === n && D.sameThreshold(
|
|
7220
7256
|
t.observer.thresholds,
|
|
7221
7257
|
s
|
|
@@ -7226,19 +7262,19 @@ const D = class D {
|
|
|
7226
7262
|
t && (t.observer.disconnect(), D.registrations.delete(e));
|
|
7227
7263
|
const o = new IntersectionObserver(
|
|
7228
7264
|
(l) => {
|
|
7229
|
-
const
|
|
7230
|
-
|
|
7231
|
-
!
|
|
7232
|
-
|
|
7233
|
-
}).catch((
|
|
7234
|
-
|
|
7265
|
+
const h = D.registrations.get(e);
|
|
7266
|
+
h && l.forEach((c) => {
|
|
7267
|
+
!c.isIntersecting || h.running || D.isDisabled(h.fragment) || (h.running = !0, new W(h.fragment, "intersect").runWithResult().then((p) => {
|
|
7268
|
+
p && h.once && (h.observer.disconnect(), D.registrations.delete(e));
|
|
7269
|
+
}).catch((p) => {
|
|
7270
|
+
m.error(
|
|
7235
7271
|
"[Haori]",
|
|
7236
7272
|
"Intersect procedure execution error:",
|
|
7237
|
-
|
|
7273
|
+
p
|
|
7238
7274
|
);
|
|
7239
7275
|
}).finally(() => {
|
|
7240
|
-
const
|
|
7241
|
-
|
|
7276
|
+
const p = D.registrations.get(e);
|
|
7277
|
+
p && (p.running = !1);
|
|
7242
7278
|
}));
|
|
7243
7279
|
});
|
|
7244
7280
|
},
|
|
@@ -7272,32 +7308,32 @@ const D = class D {
|
|
|
7272
7308
|
}
|
|
7273
7309
|
static shouldObserve(e) {
|
|
7274
7310
|
return e.getAttributeNames().some((t) => {
|
|
7275
|
-
if (!t.startsWith(`${
|
|
7311
|
+
if (!t.startsWith(`${u.prefix}intersect-`))
|
|
7276
7312
|
return !1;
|
|
7277
|
-
const r = t.slice(`${
|
|
7313
|
+
const r = t.slice(`${u.prefix}intersect-`.length);
|
|
7278
7314
|
return !D.CONFIG_KEYS.has(r);
|
|
7279
7315
|
});
|
|
7280
7316
|
}
|
|
7281
7317
|
static resolveRoot(e) {
|
|
7282
|
-
const t = `${
|
|
7318
|
+
const t = `${u.prefix}intersect-root`;
|
|
7283
7319
|
if (!e.hasAttribute(t))
|
|
7284
7320
|
return null;
|
|
7285
7321
|
const r = e.getAttribute(t);
|
|
7286
7322
|
if (typeof r != "string" || r.trim() === "")
|
|
7287
7323
|
return null;
|
|
7288
7324
|
const i = document.querySelector(r);
|
|
7289
|
-
return D.isHtmlElement(i) ? i : (
|
|
7325
|
+
return D.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
7290
7326
|
}
|
|
7291
7327
|
static resolveRootMargin(e) {
|
|
7292
|
-
const t = `${
|
|
7328
|
+
const t = `${u.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
7293
7329
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
7294
7330
|
}
|
|
7295
7331
|
static resolveThreshold(e) {
|
|
7296
|
-
const t = `${
|
|
7332
|
+
const t = `${u.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
7297
7333
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
7298
7334
|
}
|
|
7299
7335
|
static isDisabled(e) {
|
|
7300
|
-
const t = `${
|
|
7336
|
+
const t = `${u.prefix}intersect-disabled`, r = e.getAttribute(t);
|
|
7301
7337
|
if (r === null || r === !1)
|
|
7302
7338
|
return !1;
|
|
7303
7339
|
if (typeof r == "boolean")
|
|
@@ -7317,7 +7353,7 @@ D.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
7317
7353
|
"once"
|
|
7318
7354
|
]), D.registrations = /* @__PURE__ */ new Map();
|
|
7319
7355
|
let _ = D;
|
|
7320
|
-
function
|
|
7356
|
+
function dt(f) {
|
|
7321
7357
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => f()) : Promise.resolve().then(f);
|
|
7322
7358
|
}
|
|
7323
7359
|
const w = class w {
|
|
@@ -7359,7 +7395,7 @@ const w = class w {
|
|
|
7359
7395
|
return;
|
|
7360
7396
|
const i = w.resolveVarName(r);
|
|
7361
7397
|
if (i === "") {
|
|
7362
|
-
t && (t.observer.disconnect(), w.registrations.delete(e)),
|
|
7398
|
+
t && (t.observer.disconnect(), w.registrations.delete(e)), m.warn(
|
|
7363
7399
|
"[Haori]",
|
|
7364
7400
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
7365
7401
|
);
|
|
@@ -7373,14 +7409,14 @@ const w = class w {
|
|
|
7373
7409
|
t && (t.observer.disconnect(), w.registrations.delete(e));
|
|
7374
7410
|
const a = new IntersectionObserver(
|
|
7375
7411
|
(l) => {
|
|
7376
|
-
const
|
|
7377
|
-
if (!
|
|
7412
|
+
const h = w.registrations.get(e);
|
|
7413
|
+
if (!h)
|
|
7378
7414
|
return;
|
|
7379
|
-
let
|
|
7380
|
-
l.forEach((
|
|
7381
|
-
const y =
|
|
7382
|
-
|
|
7383
|
-
}),
|
|
7415
|
+
let c = !1;
|
|
7416
|
+
l.forEach((p) => {
|
|
7417
|
+
const y = p.target;
|
|
7418
|
+
h.observedRows.has(y) && (p.isIntersecting ? h.visibleRows.has(y) || (h.visibleRows.add(y), c = !0) : h.visibleRows.delete(y) && (c = !0));
|
|
7419
|
+
}), c && w.scheduleCompute(h);
|
|
7384
7420
|
},
|
|
7385
7421
|
{
|
|
7386
7422
|
root: n,
|
|
@@ -7430,7 +7466,7 @@ const w = class w {
|
|
|
7430
7466
|
* @returns 監視対象なら true
|
|
7431
7467
|
*/
|
|
7432
7468
|
static shouldObserve(e) {
|
|
7433
|
-
return e.hasAttribute(`${
|
|
7469
|
+
return e.hasAttribute(`${u.prefix}each`) && e.hasAttribute(`${u.prefix}each-visible`);
|
|
7434
7470
|
}
|
|
7435
7471
|
/**
|
|
7436
7472
|
* 公開する変数名を解決します。
|
|
@@ -7439,7 +7475,7 @@ const w = class w {
|
|
|
7439
7475
|
* @returns 変数名。未指定なら空文字
|
|
7440
7476
|
*/
|
|
7441
7477
|
static resolveVarName(e) {
|
|
7442
|
-
const t = e.getRawAttribute(`${
|
|
7478
|
+
const t = e.getRawAttribute(`${u.prefix}each-visible`);
|
|
7443
7479
|
return typeof t == "string" ? t.trim() : "";
|
|
7444
7480
|
}
|
|
7445
7481
|
/**
|
|
@@ -7449,14 +7485,14 @@ const w = class w {
|
|
|
7449
7485
|
* @returns root 要素。未指定・不正ならビューポート(null)
|
|
7450
7486
|
*/
|
|
7451
7487
|
static resolveRoot(e) {
|
|
7452
|
-
const t = `${
|
|
7488
|
+
const t = `${u.prefix}each-visible-root`;
|
|
7453
7489
|
if (!e.hasAttribute(t))
|
|
7454
7490
|
return null;
|
|
7455
7491
|
const r = e.getAttribute(t);
|
|
7456
7492
|
if (typeof r != "string" || r.trim() === "")
|
|
7457
7493
|
return null;
|
|
7458
7494
|
const i = document.querySelector(r);
|
|
7459
|
-
return w.isHtmlElement(i) ? i : (
|
|
7495
|
+
return w.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
7460
7496
|
}
|
|
7461
7497
|
/**
|
|
7462
7498
|
* rootMargin を解決します。
|
|
@@ -7465,7 +7501,7 @@ const w = class w {
|
|
|
7465
7501
|
* @returns rootMargin 文字列(未指定は既定値)
|
|
7466
7502
|
*/
|
|
7467
7503
|
static resolveRootMargin(e) {
|
|
7468
|
-
const t = `${
|
|
7504
|
+
const t = `${u.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
7469
7505
|
return r === null || r === !1 || r === "" ? w.DEFAULT_ROOT_MARGIN : String(r);
|
|
7470
7506
|
}
|
|
7471
7507
|
/**
|
|
@@ -7476,7 +7512,7 @@ const w = class w {
|
|
|
7476
7512
|
*/
|
|
7477
7513
|
static realRowElements(e) {
|
|
7478
7514
|
return e.getChildren().filter(
|
|
7479
|
-
(t) => t instanceof M && !t.hasAttribute(`${
|
|
7515
|
+
(t) => t instanceof M && !t.hasAttribute(`${u.prefix}each-before`) && !t.hasAttribute(`${u.prefix}each-after`)
|
|
7480
7516
|
).map((t) => t.getTarget());
|
|
7481
7517
|
}
|
|
7482
7518
|
/**
|
|
@@ -7499,7 +7535,7 @@ const w = class w {
|
|
|
7499
7535
|
* @param registration 対象の登録
|
|
7500
7536
|
*/
|
|
7501
7537
|
static scheduleCompute(e) {
|
|
7502
|
-
e.scheduled || (e.scheduled = !0,
|
|
7538
|
+
e.scheduled || (e.scheduled = !0, dt(() => {
|
|
7503
7539
|
e.scheduled = !1;
|
|
7504
7540
|
const t = e.fragment.getTarget();
|
|
7505
7541
|
w.registrations.get(t) === e && w.computeAndPublish(e);
|
|
@@ -7555,7 +7591,7 @@ const w = class w {
|
|
|
7555
7591
|
static publish(e, t) {
|
|
7556
7592
|
const r = w.resolveBindOwner(e.fragment);
|
|
7557
7593
|
if (!r) {
|
|
7558
|
-
|
|
7594
|
+
m.warn(
|
|
7559
7595
|
"[Haori]",
|
|
7560
7596
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
7561
7597
|
);
|
|
@@ -7566,14 +7602,14 @@ const w = class w {
|
|
|
7566
7602
|
};
|
|
7567
7603
|
n[e.varName] = { ...t };
|
|
7568
7604
|
const s = e.fragment.getTarget(), a = i === s ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([e.fragment]);
|
|
7569
|
-
|
|
7605
|
+
k.setBindingData(
|
|
7570
7606
|
i,
|
|
7571
7607
|
n,
|
|
7572
7608
|
a,
|
|
7573
7609
|
!1,
|
|
7574
7610
|
!1
|
|
7575
7611
|
).catch((o) => {
|
|
7576
|
-
|
|
7612
|
+
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
7577
7613
|
});
|
|
7578
7614
|
}
|
|
7579
7615
|
/**
|
|
@@ -7584,7 +7620,7 @@ const w = class w {
|
|
|
7584
7620
|
* @returns 公開先フラグメント。無ければ null
|
|
7585
7621
|
*/
|
|
7586
7622
|
static resolveBindOwner(e) {
|
|
7587
|
-
const t = `${
|
|
7623
|
+
const t = `${u.prefix}bind`;
|
|
7588
7624
|
let r = e.getParent();
|
|
7589
7625
|
for (; r; ) {
|
|
7590
7626
|
if (r.hasAttribute(t))
|
|
@@ -7613,22 +7649,22 @@ const O = class O {
|
|
|
7613
7649
|
if (O._initialized)
|
|
7614
7650
|
return;
|
|
7615
7651
|
O._initialized = !0, O.disconnectMutationObservers();
|
|
7616
|
-
const e = new
|
|
7652
|
+
const e = new Ee();
|
|
7617
7653
|
O._dispatcher = e, e.startDeferred();
|
|
7618
7654
|
try {
|
|
7619
7655
|
const t = await Promise.allSettled([
|
|
7620
|
-
|
|
7621
|
-
|
|
7656
|
+
k.scan(document.head),
|
|
7657
|
+
k.scan(document.body)
|
|
7622
7658
|
]), [r, i] = t;
|
|
7623
|
-
r.status !== "fulfilled" &&
|
|
7659
|
+
r.status !== "fulfilled" && m.error(
|
|
7624
7660
|
"[Haori]",
|
|
7625
7661
|
"Failed to build head fragment:",
|
|
7626
7662
|
r.reason
|
|
7627
|
-
), i.status !== "fulfilled" &&
|
|
7663
|
+
), i.status !== "fulfilled" && m.error(
|
|
7628
7664
|
"[Haori]",
|
|
7629
7665
|
"Failed to build body fragment:",
|
|
7630
7666
|
i.reason
|
|
7631
|
-
), await
|
|
7667
|
+
), await P.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), _.syncTree(document.body), J.syncTree(document.body);
|
|
7632
7668
|
} finally {
|
|
7633
7669
|
e.release();
|
|
7634
7670
|
}
|
|
@@ -7656,7 +7692,7 @@ const O = class O {
|
|
|
7656
7692
|
* @returns 外部管理サブツリーに属する場合 true
|
|
7657
7693
|
*/
|
|
7658
7694
|
static isExternallyManaged(e) {
|
|
7659
|
-
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${
|
|
7695
|
+
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${u.prefix}external]`) != null;
|
|
7660
7696
|
}
|
|
7661
7697
|
/**
|
|
7662
7698
|
* 指定された要素を監視します。
|
|
@@ -7672,12 +7708,12 @@ const O = class O {
|
|
|
7672
7708
|
switch (i.type) {
|
|
7673
7709
|
case "attributes": {
|
|
7674
7710
|
const n = i.target;
|
|
7675
|
-
if (i.attributeName && n.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName &&
|
|
7711
|
+
if (i.attributeName && n.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName && k.isAliasedAttributeReflection(
|
|
7676
7712
|
n,
|
|
7677
7713
|
i.attributeName
|
|
7678
7714
|
))
|
|
7679
7715
|
break;
|
|
7680
|
-
|
|
7716
|
+
k.setAttribute(
|
|
7681
7717
|
n,
|
|
7682
7718
|
i.attributeName,
|
|
7683
7719
|
n.getAttribute(i.attributeName),
|
|
@@ -7687,16 +7723,16 @@ const O = class O {
|
|
|
7687
7723
|
}
|
|
7688
7724
|
case "childList": {
|
|
7689
7725
|
Array.from(i.removedNodes).forEach((n) => {
|
|
7690
|
-
_.cleanupTree(n), J.cleanupTree(n),
|
|
7726
|
+
_.cleanupTree(n), J.cleanupTree(n), k.removeNode(n);
|
|
7691
7727
|
}), Array.from(i.addedNodes).forEach((n) => {
|
|
7692
|
-
n.parentElement instanceof Element && (
|
|
7728
|
+
n.parentElement instanceof Element && (k.addNode(n.parentElement, n), _.syncTree(n), J.syncTree(n));
|
|
7693
7729
|
}), i.target instanceof Element && J.syncElement(
|
|
7694
7730
|
i.target
|
|
7695
7731
|
);
|
|
7696
7732
|
break;
|
|
7697
7733
|
}
|
|
7698
7734
|
case "characterData": {
|
|
7699
|
-
i.target instanceof Text || i.target instanceof Comment ?
|
|
7735
|
+
i.target instanceof Text || i.target instanceof Comment ? k.changeText(i.target, i.target.textContent) : m.warn(
|
|
7700
7736
|
"[Haori]",
|
|
7701
7737
|
"Unsupported character data type:",
|
|
7702
7738
|
i.target
|
|
@@ -7704,11 +7740,11 @@ const O = class O {
|
|
|
7704
7740
|
break;
|
|
7705
7741
|
}
|
|
7706
7742
|
default:
|
|
7707
|
-
|
|
7743
|
+
m.warn("[Haori]", "Unknown mutation type:", i.type);
|
|
7708
7744
|
continue;
|
|
7709
7745
|
}
|
|
7710
7746
|
} catch (n) {
|
|
7711
|
-
|
|
7747
|
+
m.error("[Haori]", "Error processing mutation:", n);
|
|
7712
7748
|
}
|
|
7713
7749
|
});
|
|
7714
7750
|
t.observe(e, {
|
|
@@ -7720,17 +7756,17 @@ const O = class O {
|
|
|
7720
7756
|
}
|
|
7721
7757
|
};
|
|
7722
7758
|
O._initialized = !1, O._mutationObservers = [], O._dispatcher = null;
|
|
7723
|
-
let
|
|
7724
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
7725
|
-
const ft = () => Z.waitForRenders(), gt = "0.26.
|
|
7759
|
+
let ue = O;
|
|
7760
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", ue.init) : ue.init();
|
|
7761
|
+
const ft = () => Z.waitForRenders(), gt = "0.26.2";
|
|
7726
7762
|
export {
|
|
7727
|
-
|
|
7728
|
-
|
|
7763
|
+
k as Core,
|
|
7764
|
+
u as Env,
|
|
7729
7765
|
A as Form,
|
|
7730
7766
|
S as Fragment,
|
|
7731
7767
|
Z as Haori,
|
|
7732
|
-
|
|
7733
|
-
|
|
7768
|
+
m as Log,
|
|
7769
|
+
P as Queue,
|
|
7734
7770
|
Z as default,
|
|
7735
7771
|
gt as version,
|
|
7736
7772
|
ft as waitForRenders
|