haori 0.26.1 → 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 +455 -418
- 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,7 +94,7 @@ const V = class V {
|
|
|
94
94
|
return V._prefix;
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
V._prefix = "data-", V._runtime =
|
|
97
|
+
V._prefix = "data-", V._runtime = ye;
|
|
98
98
|
let u = V;
|
|
99
99
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect();
|
|
100
100
|
class m {
|
|
@@ -105,7 +105,7 @@ class m {
|
|
|
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 m {
|
|
|
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 m {
|
|
|
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 [];
|
|
@@ -260,11 +260,11 @@ function Ce(f, e, t = {}) {
|
|
|
260
260
|
for (let c = Math.max(0, i - n); c <= Math.min(r - 1, i + n); c += 1)
|
|
261
261
|
a.add(c);
|
|
262
262
|
const o = Array.from(a).sort((c, p) => c - p), l = [];
|
|
263
|
-
let
|
|
263
|
+
let h = null;
|
|
264
264
|
for (const c of o) {
|
|
265
|
-
if (
|
|
266
|
-
if (c -
|
|
267
|
-
const p =
|
|
265
|
+
if (h !== null && c - h > 1)
|
|
266
|
+
if (c - h === 2) {
|
|
267
|
+
const p = h + 1;
|
|
268
268
|
l.push({
|
|
269
269
|
page: p,
|
|
270
270
|
label: p + 1,
|
|
@@ -278,16 +278,16 @@ function Ce(f, e, t = {}) {
|
|
|
278
278
|
label: c + 1,
|
|
279
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 c =
|
|
337
|
+
const c = ne(r.numberOfElements, NaN);
|
|
338
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
|
*
|
|
@@ -500,11 +500,11 @@ const Xe = Object.freeze({
|
|
|
500
500
|
if (this.containsDangerousPatterns(e)) {
|
|
501
501
|
const l = this.detectDisallowedKeywords(e);
|
|
502
502
|
if (l.length > 0) {
|
|
503
|
-
const
|
|
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
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(
|
|
@@ -549,16 +549,16 @@ 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
556
|
const c = [], p = this.wrapBoundValues(a);
|
|
557
|
-
return
|
|
557
|
+
return h.bindKeys.forEach((y) => {
|
|
558
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
|
};
|
|
@@ -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(
|
|
@@ -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
|
}
|
|
@@ -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] = {
|
|
@@ -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,7 +1591,7 @@ 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
1597
|
return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
@@ -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
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -1727,7 +1727,7 @@ const z = class z extends S {
|
|
|
1727
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
|
/**
|
|
@@ -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) => {
|
|
@@ -1797,7 +1797,7 @@ const z = class z extends S {
|
|
|
1797
1797
|
*/
|
|
1798
1798
|
normalizeClonedVisibilityState() {
|
|
1799
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
|
|
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,7 +2111,7 @@ 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]",
|
|
@@ -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,7 +2139,7 @@ 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;
|
|
@@ -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 === `${u.prefix}bind` && this.recordSelfWrittenBind(v)), H && !b && (this.value = this.normalizeValueForElement(a, v), F && (a.value = v))),
|
|
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;
|
|
@@ -2420,7 +2440,7 @@ const z = class z extends S {
|
|
|
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 {
|
|
@@ -2434,14 +2454,14 @@ const z = class z extends S {
|
|
|
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
2459
|
this.children.splice(p, 0, e);
|
|
2440
2460
|
}
|
|
2441
2461
|
e.setParent(this), e.setMounted(this.mounted);
|
|
2442
2462
|
const c = this.skipMutationNodes;
|
|
2443
|
-
return this.skipMutationNodes = !0,
|
|
2444
|
-
this.target.insertBefore(e.getTarget(),
|
|
2463
|
+
return this.skipMutationNodes = !0, P.enqueue(() => {
|
|
2464
|
+
this.target.insertBefore(e.getTarget(), h);
|
|
2445
2465
|
}).finally(() => {
|
|
2446
2466
|
this.skipMutationNodes = c;
|
|
2447
2467
|
});
|
|
@@ -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({
|
|
@@ -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
|
-
), c =
|
|
2805
|
-
a +=
|
|
2824
|
+
), c = h.value;
|
|
2825
|
+
a += h.durationMs, s.push({
|
|
2806
2826
|
expression: l.text,
|
|
2807
|
-
durationMs:
|
|
2827
|
+
durationMs: h.durationMs
|
|
2808
2828
|
}), o = o || c.unresolvedReference, n.push(c.value);
|
|
2809
2829
|
} else
|
|
2810
2830
|
n.push(l.text);
|
|
2811
|
-
} catch (
|
|
2831
|
+
} catch (h) {
|
|
2812
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
|
* 強制評価フラグを取得します。
|
|
@@ -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
|
* 実行モードを取得します。
|
|
@@ -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,7 +2986,7 @@ class Z {
|
|
|
2966
2986
|
* @param element 開くダイアログのHTML要素
|
|
2967
2987
|
*/
|
|
2968
2988
|
static openDialog(e) {
|
|
2969
|
-
return
|
|
2989
|
+
return P.enqueue(() => {
|
|
2970
2990
|
e instanceof HTMLDialogElement ? (Z.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2971
2991
|
}, !0);
|
|
2972
2992
|
}
|
|
@@ -2976,7 +2996,7 @@ class Z {
|
|
|
2976
2996
|
* @param element 閉じるダイアログのHTML要素
|
|
2977
2997
|
*/
|
|
2978
2998
|
static closeDialog(e) {
|
|
2979
|
-
return
|
|
2999
|
+
return P.enqueue(() => {
|
|
2980
3000
|
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2981
3001
|
}, !0);
|
|
2982
3002
|
}
|
|
@@ -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
|
*
|
|
@@ -3355,9 +3392,9 @@ 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(`${u.prefix}form-object`), l = e.getAttribute(`${u.prefix}form-list`),
|
|
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 (!
|
|
3397
|
+
if (!h || i) {
|
|
3361
3398
|
const c = t[String(a)];
|
|
3362
3399
|
if (A.isFileInput(e))
|
|
3363
3400
|
return (c === null || c === "") && s.push(A.applyFragmentValue(e, null, n)), Promise.all(s).then(() => {
|
|
@@ -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,7 +3476,7 @@ 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) {
|
|
@@ -3447,9 +3484,9 @@ class A {
|
|
|
3447
3484
|
if (r.getRawBindingData() === null && i === null)
|
|
3448
3485
|
continue;
|
|
3449
3486
|
const n = A.getValues(r), s = r.getAttribute(`${u.prefix}form-arg`), a = { ...i || {} };
|
|
3450
|
-
s ? a[String(s)] = n : Object.assign(a, n), await
|
|
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 値と再同期します。
|
|
@@ -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
|
}
|
|
@@ -3595,13 +3632,13 @@ class A {
|
|
|
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(
|
|
3635
|
+
const l = i.substring(s + 1, a), h = Number(l);
|
|
3636
|
+
if (isNaN(h))
|
|
3600
3637
|
m.error("Haori", `Invalid index: ${i}`);
|
|
3601
3638
|
else {
|
|
3602
3639
|
const c = e.getChildElementFragments().filter((p) => p.hasAttribute(`${u.prefix}row`));
|
|
3603
|
-
|
|
3604
|
-
...A.findFragmentByKeyParts(c[
|
|
3640
|
+
h < c.length && r.push(
|
|
3641
|
+
...A.findFragmentByKeyParts(c[h], t.slice(1))
|
|
3605
3642
|
);
|
|
3606
3643
|
}
|
|
3607
3644
|
}
|
|
@@ -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 || {},
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -4309,7 +4346,7 @@ ${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
|
}
|
|
@@ -4325,7 +4362,7 @@ ${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
|
}
|
|
@@ -4391,14 +4428,14 @@ ${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(
|
|
4438
|
+
) : e.hasAttribute(h) && (r.bindArg = e.getRawAttribute(h));
|
|
4402
4439
|
const c = t ? g.attrName(t, "bind-params") : g.attrName(null, "bind-params", !0);
|
|
4403
4440
|
if (e.hasAttribute(c)) {
|
|
4404
4441
|
const E = e.getRawAttribute(c);
|
|
@@ -4413,9 +4450,9 @@ ${b}
|
|
|
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) {
|
|
@@ -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
|
-
|
|
4551
|
+
document.body.querySelectorAll(C).forEach((B) => {
|
|
4552
|
+
const K = S.get(B);
|
|
4553
|
+
K && F.push(K);
|
|
4517
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)
|
|
@@ -4665,10 +4702,10 @@ ${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
4707
|
const c = this.options.runScript.call(
|
|
4671
|
-
|
|
4708
|
+
h,
|
|
4672
4709
|
this.domEvent
|
|
4673
4710
|
);
|
|
4674
4711
|
c === !1 && this.domEvent && this.domEvent.preventDefault(), c != null && typeof c.then == "function" && await c;
|
|
@@ -4680,25 +4717,25 @@ ${v}
|
|
|
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
|
|
4738
|
+
const h = { ...s || {} }, c = r.requestedMethod, p = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
|
|
4702
4739
|
if (y && m.info("Haori demo fetch normalization", {
|
|
4703
4740
|
runtime: u.runtime,
|
|
4704
4741
|
requestedMethod: c,
|
|
@@ -4708,7 +4745,7 @@ ${v}
|
|
|
4708
4745
|
payload: a ? i : void 0,
|
|
4709
4746
|
queryString: T
|
|
4710
4747
|
}), this.options.targetFragment && n) {
|
|
4711
|
-
const
|
|
4748
|
+
const I = performance.now(), H = {
|
|
4712
4749
|
runtime: u.runtime,
|
|
4713
4750
|
requestedMethod: c,
|
|
4714
4751
|
effectiveMethod: p,
|
|
@@ -4718,13 +4755,13 @@ ${v}
|
|
|
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
|
|
4780
|
+
const h = this.options.formFragment, c = h.getTarget(), p = /* @__PURE__ */ new Set();
|
|
4744
4781
|
e && e.appliedDisabledAttribute && this.options.targetFragment && p.add(this.options.targetFragment);
|
|
4745
|
-
const y =
|
|
4746
|
-
Object.assign(y,
|
|
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 })
|
|
@@ -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 c =
|
|
4880
|
+
const h = new URLSearchParams(window.location.search).get(o);
|
|
4881
|
+
if (h !== null) {
|
|
4882
|
+
const c = h.trim();
|
|
4846
4883
|
qe.isSafeLocalPath(c) ? a = c : m.warn(
|
|
4847
4884
|
"Haori",
|
|
4848
|
-
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${
|
|
4885
|
+
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${h}`
|
|
4849
4886
|
);
|
|
4850
4887
|
}
|
|
4851
4888
|
}
|
|
@@ -4871,8 +4908,8 @@ ${v}
|
|
|
4871
4908
|
return;
|
|
4872
4909
|
}
|
|
4873
4910
|
const o = (l) => {
|
|
4874
|
-
for (const [
|
|
4875
|
-
c != null && (Array.isArray(c) ? c.forEach((p) => a.searchParams.append(
|
|
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 },
|
|
@@ -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(),
|
|
4944
|
+
const l = /* @__PURE__ */ new Map(), h = [];
|
|
4908
4945
|
for (const c of a)
|
|
4909
4946
|
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
4910
|
-
const p = c.key, y = c.message, T = typeof p == "string" && p.length > 0 ? p : null,
|
|
4911
|
-
if (
|
|
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 c == "string" && c.length > 0 &&
|
|
4954
|
+
h.push(I);
|
|
4955
|
+
} else typeof c == "string" && c.length > 0 && h.push(c);
|
|
4919
4956
|
for (const [c, p] of l)
|
|
4920
4957
|
o.push({ key: c, message: p.join(`
|
|
4921
4958
|
`) });
|
|
4922
|
-
for (const c of
|
|
4959
|
+
for (const c of h)
|
|
4923
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
|
* 結果データを対象のフラグメントにバインドします。
|
|
@@ -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(),
|
|
@@ -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 属性とフォーム値を統合した送信データを作成します。
|
|
@@ -5206,28 +5243,28 @@ ${v}
|
|
|
5206
5243
|
s.delete("Content-Type");
|
|
5207
5244
|
const p = new FormData();
|
|
5208
5245
|
for (const [y, T] of Object.entries(t))
|
|
5209
|
-
T == null ? p.append(y, "") : T instanceof Blob ? p.append(y, T) : Array.isArray(T) ? T.forEach((
|
|
5210
|
-
|
|
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));
|
|
5211
5248
|
}) : typeof T == "object" ? p.append(y, JSON.stringify(T)) : p.append(y, String(T));
|
|
5212
5249
|
n.body = p;
|
|
5213
5250
|
} else if (/application\/x-www-form-urlencoded/i.test(c)) {
|
|
5214
5251
|
const p = new URLSearchParams();
|
|
5215
5252
|
for (const [y, T] of Object.entries(t))
|
|
5216
|
-
T !== void 0 && (T === null ? p.append(y, "") : Array.isArray(T) ? T.forEach((
|
|
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)));
|
|
5217
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 を考慮して抽出します。
|
|
@@ -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
|
/**
|
|
@@ -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
|
*
|
|
@@ -5458,7 +5495,7 @@ class dt {
|
|
|
5458
5495
|
}
|
|
5459
5496
|
}
|
|
5460
5497
|
}
|
|
5461
|
-
const
|
|
5498
|
+
const d = class d {
|
|
5462
5499
|
/**
|
|
5463
5500
|
* 遅延属性かどうか(完全名で判定)を判定します。
|
|
5464
5501
|
*
|
|
@@ -5466,7 +5503,7 @@ const h = class h {
|
|
|
5466
5503
|
* @returns 遅延属性かどうか
|
|
5467
5504
|
*/
|
|
5468
5505
|
static isDeferredAttributeName(e) {
|
|
5469
|
-
return
|
|
5506
|
+
return d.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
5470
5507
|
(t) => e === `${u.prefix}${t}`
|
|
5471
5508
|
);
|
|
5472
5509
|
}
|
|
@@ -5477,7 +5514,7 @@ const h = class h {
|
|
|
5477
5514
|
* @returns 除外対象かどうか
|
|
5478
5515
|
*/
|
|
5479
5516
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
5480
|
-
return
|
|
5517
|
+
return d.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
5481
5518
|
(t) => e === `${u.prefix}${t}`
|
|
5482
5519
|
);
|
|
5483
5520
|
}
|
|
@@ -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 = `${u.prefix}${
|
|
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
|
-
`${u.prefix}${
|
|
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(`${u.prefix}fetch`) && r.push(
|
|
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,7 +5663,7 @@ const h = class h {
|
|
|
5626
5663
|
* @returns 実行完了の Promise
|
|
5627
5664
|
*/
|
|
5628
5665
|
static executeManagedImport(e) {
|
|
5629
|
-
const t = e.getTarget(), r =
|
|
5666
|
+
const t = e.getTarget(), r = d.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
5630
5667
|
`${u.prefix}import`
|
|
5631
5668
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
5632
5669
|
if (r.running)
|
|
@@ -5637,16 +5674,16 @@ 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(`${u.prefix}importing`, ""), N.importStart(t, n),
|
|
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
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 c = S.get(
|
|
5649
|
-
c instanceof M ? l.push(
|
|
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
|
}
|
|
@@ -5655,7 +5692,7 @@ const h = class h {
|
|
|
5655
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
|
|
5767
|
+
for (const i of d.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
5731
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
|
|
5785
|
+
for (const i of d.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
5749
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)
|
|
@@ -5767,7 +5804,7 @@ const h = class h {
|
|
|
5767
5804
|
*/
|
|
5768
5805
|
static shouldSkipChildInitialization(e, t) {
|
|
5769
5806
|
const r = e.getAttribute(`${u.prefix}if`);
|
|
5770
|
-
return e.hasAttribute(`${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,
|
|
@@ -5796,16 +5833,16 @@ const h = class h {
|
|
|
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
5840
|
case `${u.prefix}derive`:
|
|
5804
|
-
l =
|
|
5841
|
+
l = d.createDeriveInputSignature(
|
|
5805
5842
|
n,
|
|
5806
5843
|
r,
|
|
5807
5844
|
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
5808
|
-
), o =
|
|
5845
|
+
), o = d.evaluateDerive(
|
|
5809
5846
|
n,
|
|
5810
5847
|
r,
|
|
5811
5848
|
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
@@ -5813,11 +5850,11 @@ const h = class h {
|
|
|
5813
5850
|
}));
|
|
5814
5851
|
break;
|
|
5815
5852
|
case `${u.prefix}derive-name`:
|
|
5816
|
-
l =
|
|
5853
|
+
l = d.createDeriveInputSignature(
|
|
5817
5854
|
n,
|
|
5818
5855
|
n.getRawAttribute(`${u.prefix}derive`),
|
|
5819
5856
|
r
|
|
5820
|
-
), o =
|
|
5857
|
+
), o = d.evaluateDerive(
|
|
5821
5858
|
n,
|
|
5822
5859
|
n.getRawAttribute(`${u.prefix}derive`),
|
|
5823
5860
|
r
|
|
@@ -5825,33 +5862,33 @@ const h = class h {
|
|
|
5825
5862
|
}));
|
|
5826
5863
|
break;
|
|
5827
5864
|
case `${u.prefix}if`:
|
|
5828
|
-
a.push(
|
|
5865
|
+
a.push(d.evaluateIf(n));
|
|
5829
5866
|
break;
|
|
5830
5867
|
case `${u.prefix}each`:
|
|
5831
|
-
a.push(
|
|
5868
|
+
a.push(d.evaluateEach(n));
|
|
5832
5869
|
break;
|
|
5833
5870
|
case `${u.prefix}fetch`:
|
|
5834
|
-
a.push(
|
|
5871
|
+
a.push(d.executeManagedFetch(n));
|
|
5835
5872
|
break;
|
|
5836
5873
|
case `${u.prefix}import`:
|
|
5837
|
-
typeof r == "string" && a.push(
|
|
5874
|
+
typeof r == "string" && a.push(d.executeManagedImport(n));
|
|
5838
5875
|
break;
|
|
5839
5876
|
case `${u.prefix}url-param`: {
|
|
5840
|
-
const
|
|
5841
|
-
if (
|
|
5842
|
-
a.push(
|
|
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
5881
|
const p = n.getRawBindingData() || {};
|
|
5845
|
-
p[String(
|
|
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,13 +5917,13 @@ const h = class h {
|
|
|
5880
5917
|
const o = () => {
|
|
5881
5918
|
s.markBindingWorkStart();
|
|
5882
5919
|
const l = s.getRawBindingData() ?? t;
|
|
5883
|
-
let
|
|
5884
|
-
return e.tagName === "FORM" && (
|
|
5920
|
+
let h = n ? s.setAttribute(`${u.prefix}bind`, JSON.stringify(l)) : Promise.resolve();
|
|
5921
|
+
return e.tagName === "FORM" && (h = h.then(() => {
|
|
5885
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;
|
|
5886
5923
|
return A.syncValues(s, y);
|
|
5887
|
-
})),
|
|
5888
|
-
() =>
|
|
5889
|
-
),
|
|
5924
|
+
})), h = h.then(() => d.evaluateAll(s, r)), h = h.then(
|
|
5925
|
+
() => d.reevaluateReactiveSpecialAttributes(s, r)
|
|
5926
|
+
), h.then(
|
|
5890
5927
|
() => s.markBindingWorkEnd(),
|
|
5891
5928
|
(c) => {
|
|
5892
5929
|
throw s.markBindingWorkEnd(), c;
|
|
@@ -5936,14 +5973,14 @@ const h = class h {
|
|
|
5936
5973
|
if (!t)
|
|
5937
5974
|
return { resolved: {}, sources: {} };
|
|
5938
5975
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
5939
|
-
const
|
|
5940
|
-
return
|
|
5941
|
-
}, s = (l,
|
|
5976
|
+
const h = l.getTarget();
|
|
5977
|
+
return h.id ? `#${h.id}` : h.tagName.toLowerCase();
|
|
5978
|
+
}, s = (l, h, c, p) => {
|
|
5942
5979
|
if (l)
|
|
5943
5980
|
for (const y of Object.keys(l))
|
|
5944
5981
|
y in i || (i[y] = {
|
|
5945
5982
|
value: l[y],
|
|
5946
|
-
source: n(
|
|
5983
|
+
source: n(h),
|
|
5947
5984
|
kind: c,
|
|
5948
5985
|
depth: p
|
|
5949
5986
|
});
|
|
@@ -5951,7 +5988,7 @@ const h = class h {
|
|
|
5951
5988
|
let a = t, o = 0;
|
|
5952
5989
|
for (; a; )
|
|
5953
5990
|
a !== t && s(a.getRawDerivedBindingData(), a, "derive", o), s(a.getRawBindingData(), a, "bind", o), a = a.getParent(), o += 1;
|
|
5954
|
-
return
|
|
5991
|
+
return U.isEnabled() && m.info("[Haori]", "scope dump for", e, { resolved: r, sources: i }), { resolved: r, sources: i };
|
|
5955
5992
|
}
|
|
5956
5993
|
/**
|
|
5957
5994
|
* data-bind 属性の値をパースします。
|
|
@@ -5984,7 +6021,7 @@ const h = class h {
|
|
|
5984
6021
|
if (r.isSkipMutationNodes())
|
|
5985
6022
|
return;
|
|
5986
6023
|
const i = S.get(t.nextSibling), n = S.get(t);
|
|
5987
|
-
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));
|
|
5988
6025
|
}
|
|
5989
6026
|
/**
|
|
5990
6027
|
* ノードを親要素から削除します。
|
|
@@ -6024,11 +6061,11 @@ const h = class h {
|
|
|
6024
6061
|
return Promise.resolve();
|
|
6025
6062
|
const i = [];
|
|
6026
6063
|
i.push(r.setValue(t));
|
|
6027
|
-
const n =
|
|
6064
|
+
const n = d.getFormFragment(r);
|
|
6028
6065
|
if (n) {
|
|
6029
6066
|
const s = A.getValues(n), a = n.getAttribute(`${u.prefix}form-arg`);
|
|
6030
6067
|
let o;
|
|
6031
|
-
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));
|
|
6032
6069
|
}
|
|
6033
6070
|
return Promise.all(i).then(() => {
|
|
6034
6071
|
});
|
|
@@ -6043,7 +6080,7 @@ const h = class h {
|
|
|
6043
6080
|
if (e.getTarget() instanceof HTMLFormElement)
|
|
6044
6081
|
return e;
|
|
6045
6082
|
const t = e.getParent();
|
|
6046
|
-
return t ?
|
|
6083
|
+
return t ? d.getFormFragment(t) : null;
|
|
6047
6084
|
}
|
|
6048
6085
|
/**
|
|
6049
6086
|
* フラグメントとその子要素を評価します。
|
|
@@ -6054,21 +6091,21 @@ const h = class h {
|
|
|
6054
6091
|
static evaluateAll(e, t = /* @__PURE__ */ new Set()) {
|
|
6055
6092
|
if (t.has(e))
|
|
6056
6093
|
return Promise.resolve();
|
|
6057
|
-
let r =
|
|
6094
|
+
let r = d.reevaluateInterpolatedAttributes(e);
|
|
6058
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`);
|
|
6059
|
-
let l = !1,
|
|
6096
|
+
let l = !1, h = !1, c = null;
|
|
6060
6097
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
6061
|
-
const p =
|
|
6098
|
+
const p = d.createDeriveInputSignature(
|
|
6062
6099
|
e,
|
|
6063
6100
|
a,
|
|
6064
6101
|
o
|
|
6065
6102
|
);
|
|
6066
6103
|
p === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
6067
|
-
() =>
|
|
6104
|
+
() => d.evaluateDerive(e, a, o).then(
|
|
6068
6105
|
() => {
|
|
6069
6106
|
}
|
|
6070
6107
|
)
|
|
6071
|
-
)) : e.getDeriveInputSignature() !== p && (r = r.then(() =>
|
|
6108
|
+
)) : e.getDeriveInputSignature() !== p && (r = r.then(() => d.evaluateDerive(
|
|
6072
6109
|
e,
|
|
6073
6110
|
a,
|
|
6074
6111
|
o
|
|
@@ -6076,16 +6113,16 @@ const h = class h {
|
|
|
6076
6113
|
e.setDeriveInputSignature(p);
|
|
6077
6114
|
})));
|
|
6078
6115
|
}
|
|
6079
|
-
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(() => {
|
|
6080
6117
|
})) : (i && (r = r.then(() => {
|
|
6081
|
-
if (!
|
|
6082
|
-
e.setDeriveSubtreeSignature(null),
|
|
6118
|
+
if (!d.canSkipStableDerivedSubtree(e)) {
|
|
6119
|
+
e.setDeriveSubtreeSignature(null), d.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
6083
6120
|
return;
|
|
6084
6121
|
}
|
|
6085
|
-
c =
|
|
6122
|
+
c = d.createDescendantBindingSignature(
|
|
6086
6123
|
e,
|
|
6087
6124
|
"evaluateAll"
|
|
6088
|
-
),
|
|
6125
|
+
), h = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === c, d.logDerivedSubtreeProfileSnapshot(
|
|
6089
6126
|
e,
|
|
6090
6127
|
l ? "skip-hit" : "skip-miss"
|
|
6091
6128
|
);
|
|
@@ -6095,14 +6132,14 @@ const h = class h {
|
|
|
6095
6132
|
const p = [];
|
|
6096
6133
|
return e.getChildren().forEach((y) => {
|
|
6097
6134
|
if (y instanceof M) {
|
|
6098
|
-
if (
|
|
6135
|
+
if (d.canSkipUnchangedNestedEach(y))
|
|
6099
6136
|
return;
|
|
6100
|
-
p.push(
|
|
6101
|
-
} else y instanceof j && p.push(
|
|
6137
|
+
p.push(d.evaluateAll(y, t));
|
|
6138
|
+
} else y instanceof j && p.push(d.evaluateText(y));
|
|
6102
6139
|
}), Promise.all(p).then(() => {
|
|
6103
6140
|
});
|
|
6104
6141
|
}).then(() => {
|
|
6105
|
-
|
|
6142
|
+
h && c !== null && e.setDeriveSubtreeSignature(c);
|
|
6106
6143
|
}));
|
|
6107
6144
|
}
|
|
6108
6145
|
/**
|
|
@@ -6130,7 +6167,7 @@ const h = class h {
|
|
|
6130
6167
|
const a = {
|
|
6131
6168
|
[n]: s.value
|
|
6132
6169
|
};
|
|
6133
|
-
return
|
|
6170
|
+
return d.createBindingSignature(i) === d.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
|
|
6134
6171
|
}
|
|
6135
6172
|
/**
|
|
6136
6173
|
* テキストフラグメントを評価します。
|
|
@@ -6168,7 +6205,7 @@ const h = class h {
|
|
|
6168
6205
|
const t = e.getRawAttribute(`${u.prefix}if`);
|
|
6169
6206
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
6170
6207
|
return;
|
|
6171
|
-
const { sources: r } =
|
|
6208
|
+
const { sources: r } = d.dumpScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
6172
6209
|
let s = 0;
|
|
6173
6210
|
n.forEach((o) => {
|
|
6174
6211
|
const l = t.indexOf(o, s);
|
|
@@ -6195,8 +6232,8 @@ const h = class h {
|
|
|
6195
6232
|
*/
|
|
6196
6233
|
static evaluateIf(e) {
|
|
6197
6234
|
const t = [], r = e.getAttribute(`${u.prefix}if`);
|
|
6198
|
-
if (
|
|
6199
|
-
|
|
6235
|
+
if (d.isHiddenIfCondition(r))
|
|
6236
|
+
U.isEnabled() && d.logFalsyIfDiagnostics(e), t.push(
|
|
6200
6237
|
e.hide().then(() => {
|
|
6201
6238
|
N.hide(e.getTarget());
|
|
6202
6239
|
})
|
|
@@ -6205,11 +6242,11 @@ const h = class h {
|
|
|
6205
6242
|
const i = e.isVisible(), n = [];
|
|
6206
6243
|
e.getChildren().forEach((s) => {
|
|
6207
6244
|
s instanceof M ? n.push(
|
|
6208
|
-
s.isMounted() ?
|
|
6209
|
-
) : s instanceof j && n.push(
|
|
6245
|
+
s.isMounted() ? d.evaluateAll(s) : d.scan(s.getTarget())
|
|
6246
|
+
) : s instanceof j && n.push(d.evaluateText(s));
|
|
6210
6247
|
}), t.push(
|
|
6211
6248
|
e.show().then(() => {
|
|
6212
|
-
N.show(e.getTarget()), i ||
|
|
6249
|
+
N.show(e.getTarget()), i || d.triggerLoadOnShow(e);
|
|
6213
6250
|
})
|
|
6214
6251
|
), t.push(Promise.all(n).then(() => {
|
|
6215
6252
|
}));
|
|
@@ -6228,7 +6265,7 @@ const h = class h {
|
|
|
6228
6265
|
*/
|
|
6229
6266
|
static triggerLoadOnShow(e) {
|
|
6230
6267
|
const t = `${u.prefix}load-`;
|
|
6231
|
-
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new
|
|
6268
|
+
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new W(e, "load").run().catch((i) => {
|
|
6232
6269
|
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
6233
6270
|
});
|
|
6234
6271
|
}
|
|
@@ -6239,8 +6276,8 @@ const h = class h {
|
|
|
6239
6276
|
* @return 再入制御状態
|
|
6240
6277
|
*/
|
|
6241
6278
|
static getEachUpdateState(e) {
|
|
6242
|
-
let t =
|
|
6243
|
-
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;
|
|
6244
6281
|
}
|
|
6245
6282
|
/**
|
|
6246
6283
|
* each要素を評価します。
|
|
@@ -6258,8 +6295,8 @@ const h = class h {
|
|
|
6258
6295
|
static evaluateEach(e) {
|
|
6259
6296
|
if (!e.isVisible() || !e.isMounted())
|
|
6260
6297
|
return Promise.resolve();
|
|
6261
|
-
const t =
|
|
6262
|
-
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);
|
|
6263
6300
|
}
|
|
6264
6301
|
/**
|
|
6265
6302
|
* data-each の差分更新を、再評価要求が無くなるまで直列に繰り返し実行します。
|
|
@@ -6275,14 +6312,14 @@ const h = class h {
|
|
|
6275
6312
|
const r = (async () => {
|
|
6276
6313
|
try {
|
|
6277
6314
|
do
|
|
6278
|
-
t.rerunRequested = !1, await
|
|
6315
|
+
t.rerunRequested = !1, await d.performEachUpdate(e);
|
|
6279
6316
|
while (t.rerunRequested);
|
|
6280
6317
|
const i = e.getTarget();
|
|
6281
|
-
i.setAttribute(`${u.prefix}each-done`, ""),
|
|
6318
|
+
i.setAttribute(`${u.prefix}each-done`, ""), d.runEachRenderedScript(i);
|
|
6282
6319
|
} finally {
|
|
6283
6320
|
t.running = !1, t.settled = null;
|
|
6284
6321
|
}
|
|
6285
|
-
|
|
6322
|
+
d.runEachRenderedChange(e);
|
|
6286
6323
|
})();
|
|
6287
6324
|
return t.settled = r, r;
|
|
6288
6325
|
}
|
|
@@ -6352,14 +6389,14 @@ ${r}
|
|
|
6352
6389
|
return;
|
|
6353
6390
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
6354
6391
|
let n = !1;
|
|
6355
|
-
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(
|
|
6356
6393
|
"[Haori]",
|
|
6357
6394
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
6358
|
-
))),
|
|
6395
|
+
))), d.countEachRenderedRows(e) !== 0) {
|
|
6359
6396
|
if (!n) {
|
|
6360
|
-
if (
|
|
6397
|
+
if (d.EACH_RENDERED_CHANGE_FIRED.has(r))
|
|
6361
6398
|
return;
|
|
6362
|
-
|
|
6399
|
+
d.EACH_RENDERED_CHANGE_FIRED.add(r);
|
|
6363
6400
|
}
|
|
6364
6401
|
try {
|
|
6365
6402
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -6391,11 +6428,11 @@ ${r}
|
|
|
6391
6428
|
* @return 差分更新完了の Promise
|
|
6392
6429
|
*/
|
|
6393
6430
|
static performEachUpdate(e) {
|
|
6394
|
-
const t =
|
|
6431
|
+
const t = d.resolveEachItems(e);
|
|
6395
6432
|
if (t === null)
|
|
6396
6433
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
6397
6434
|
let r = e.getTemplate();
|
|
6398
|
-
const i = e.getAttribute(`${u.prefix}each-key`), n =
|
|
6435
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = d.createBindingSignature({
|
|
6399
6436
|
key: i ? String(i) : null,
|
|
6400
6437
|
items: t
|
|
6401
6438
|
});
|
|
@@ -6405,7 +6442,7 @@ ${r}
|
|
|
6405
6442
|
if (!s && a instanceof M) {
|
|
6406
6443
|
if (a.hasAttribute(`${u.prefix}each-before`) || a.hasAttribute(`${u.prefix}each-after`))
|
|
6407
6444
|
return;
|
|
6408
|
-
r = a.clone(),
|
|
6445
|
+
r = a.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
6409
6446
|
const o = a.getTarget();
|
|
6410
6447
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
6411
6448
|
}
|
|
@@ -6416,10 +6453,10 @@ ${r}
|
|
|
6416
6453
|
).forEach((l) => {
|
|
6417
6454
|
if (!s) {
|
|
6418
6455
|
const c = S.get(l);
|
|
6419
|
-
c instanceof M && (r = c.clone(),
|
|
6456
|
+
c instanceof M && (r = c.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
6420
6457
|
}
|
|
6421
|
-
const
|
|
6422
|
-
|
|
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);
|
|
6423
6460
|
});
|
|
6424
6461
|
}
|
|
6425
6462
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -6451,12 +6488,12 @@ ${r}
|
|
|
6451
6488
|
if (!e.hasAttribute(`${u.prefix}each`) || e.getEachInputSignature() === null)
|
|
6452
6489
|
return !1;
|
|
6453
6490
|
const t = e.getParent();
|
|
6454
|
-
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`) ||
|
|
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))
|
|
6455
6492
|
return !1;
|
|
6456
|
-
const r =
|
|
6493
|
+
const r = d.resolveEachItems(e);
|
|
6457
6494
|
if (r === null)
|
|
6458
6495
|
return !1;
|
|
6459
|
-
const i = e.getAttribute(`${u.prefix}each-key`), n =
|
|
6496
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = d.createBindingSignature({
|
|
6460
6497
|
key: i ? String(i) : null,
|
|
6461
6498
|
items: r
|
|
6462
6499
|
});
|
|
@@ -6470,7 +6507,7 @@ ${r}
|
|
|
6470
6507
|
* @returns 省略可能なら true
|
|
6471
6508
|
*/
|
|
6472
6509
|
static canSkipStableDerivedSubtree(e) {
|
|
6473
|
-
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 : !
|
|
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);
|
|
6474
6511
|
}
|
|
6475
6512
|
/**
|
|
6476
6513
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -6479,7 +6516,7 @@ ${r}
|
|
|
6479
6516
|
* @returns 含むなら true
|
|
6480
6517
|
*/
|
|
6481
6518
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
6482
|
-
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 :
|
|
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);
|
|
6483
6520
|
}
|
|
6484
6521
|
/**
|
|
6485
6522
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -6488,7 +6525,7 @@ ${r}
|
|
|
6488
6525
|
* @returns binding 署名
|
|
6489
6526
|
*/
|
|
6490
6527
|
static createDescendantBindingSignature(e, t) {
|
|
6491
|
-
return
|
|
6528
|
+
return d.recordDerivedSubtreeSignatureComputation(e, t), d.createBindingSignature(e.getDescendantBindingData());
|
|
6492
6529
|
}
|
|
6493
6530
|
/**
|
|
6494
6531
|
* data-derive 実行前の入力署名を返します。
|
|
@@ -6500,7 +6537,7 @@ ${r}
|
|
|
6500
6537
|
*/
|
|
6501
6538
|
static createDeriveInputSignature(e, t, r) {
|
|
6502
6539
|
const i = typeof r == "string" ? r.trim() : "";
|
|
6503
|
-
return !t || i === "" ? null :
|
|
6540
|
+
return !t || i === "" ? null : d.createBindingSignature({
|
|
6504
6541
|
expression: t,
|
|
6505
6542
|
name: i,
|
|
6506
6543
|
scope: e.getBindingData()
|
|
@@ -6512,13 +6549,13 @@ ${r}
|
|
|
6512
6549
|
* @param fragment 対象フラグメント
|
|
6513
6550
|
*/
|
|
6514
6551
|
static refreshDerivedSubtreeSignature(e) {
|
|
6515
|
-
if (!
|
|
6516
|
-
e.setDeriveSubtreeSignature(null),
|
|
6552
|
+
if (!d.canSkipStableDerivedSubtree(e)) {
|
|
6553
|
+
e.setDeriveSubtreeSignature(null), d.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
6517
6554
|
return;
|
|
6518
6555
|
}
|
|
6519
6556
|
e.setDeriveSubtreeSignature(
|
|
6520
|
-
|
|
6521
|
-
),
|
|
6557
|
+
d.createDescendantBindingSignature(e, "refresh")
|
|
6558
|
+
), d.logDerivedSubtreeProfileSnapshot(e, "refresh");
|
|
6522
6559
|
}
|
|
6523
6560
|
/**
|
|
6524
6561
|
* data-derive subtree skip のプロファイルを取得または初期化します。
|
|
@@ -6527,13 +6564,13 @@ ${r}
|
|
|
6527
6564
|
* @returns プロファイル
|
|
6528
6565
|
*/
|
|
6529
6566
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
6530
|
-
if (!
|
|
6567
|
+
if (!U.isEnabled() || !e.hasAttribute(`${u.prefix}derive`))
|
|
6531
6568
|
return null;
|
|
6532
|
-
const t =
|
|
6569
|
+
const t = d.DERIVE_SUBTREE_PROFILES.get(e);
|
|
6533
6570
|
if (t)
|
|
6534
6571
|
return t;
|
|
6535
6572
|
const r = {
|
|
6536
|
-
hostId:
|
|
6573
|
+
hostId: d.createDerivedSubtreeHostId(e),
|
|
6537
6574
|
signatureComputeTotal: 0,
|
|
6538
6575
|
signatureComputeFromEvaluateAll: 0,
|
|
6539
6576
|
signatureComputeFromRefresh: 0,
|
|
@@ -6541,7 +6578,7 @@ ${r}
|
|
|
6541
6578
|
skipMissCount: 0,
|
|
6542
6579
|
skipIneligibleCount: 0
|
|
6543
6580
|
};
|
|
6544
|
-
return
|
|
6581
|
+
return d.DERIVE_SUBTREE_PROFILES.set(e, r), r;
|
|
6545
6582
|
}
|
|
6546
6583
|
/**
|
|
6547
6584
|
* data-derive subtree host の識別子を作成します。
|
|
@@ -6579,7 +6616,7 @@ ${r}
|
|
|
6579
6616
|
* @param source 計算元
|
|
6580
6617
|
*/
|
|
6581
6618
|
static recordDerivedSubtreeSignatureComputation(e, t) {
|
|
6582
|
-
const r =
|
|
6619
|
+
const r = d.getOrCreateDerivedSubtreeProfile(e);
|
|
6583
6620
|
if (r !== null) {
|
|
6584
6621
|
if (r.signatureComputeTotal += 1, t === "refresh") {
|
|
6585
6622
|
r.signatureComputeFromRefresh += 1;
|
|
@@ -6595,7 +6632,7 @@ ${r}
|
|
|
6595
6632
|
* @param reason ログ理由
|
|
6596
6633
|
*/
|
|
6597
6634
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
6598
|
-
const r =
|
|
6635
|
+
const r = d.getOrCreateDerivedSubtreeProfile(e);
|
|
6599
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]", {
|
|
6600
6637
|
reason: t,
|
|
6601
6638
|
hostId: r.hostId,
|
|
@@ -6638,7 +6675,7 @@ ${r}
|
|
|
6638
6675
|
* @returns subtree 全体を省略可能なら true
|
|
6639
6676
|
*/
|
|
6640
6677
|
static markFreshInitializationSkippable(e) {
|
|
6641
|
-
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;
|
|
6642
6679
|
return e.setFreshInitializationSkippable(i), i;
|
|
6643
6680
|
}
|
|
6644
6681
|
/**
|
|
@@ -6668,51 +6705,51 @@ ${r}
|
|
|
6668
6705
|
i && (i = String(i));
|
|
6669
6706
|
const n = e.getAttribute(`${u.prefix}each-key`), s = e.getAttribute(`${u.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
6670
6707
|
t.forEach((b, v) => {
|
|
6671
|
-
const R =
|
|
6708
|
+
const R = d.createListKey(
|
|
6672
6709
|
b,
|
|
6673
6710
|
n ? String(n) : null,
|
|
6674
6711
|
v
|
|
6675
6712
|
);
|
|
6676
6713
|
o.push(R), a.set(R, { item: b, itemIndex: v });
|
|
6677
6714
|
});
|
|
6678
|
-
const l = new Set(o),
|
|
6715
|
+
const l = new Set(o), h = [];
|
|
6679
6716
|
let c = e.getChildren().filter((b) => b instanceof M).filter(
|
|
6680
6717
|
(b) => !b.hasAttribute(`${u.prefix}each-before`) && !b.hasAttribute(`${u.prefix}each-after`)
|
|
6681
6718
|
);
|
|
6682
6719
|
const p = c.map((b) => b.getListKey());
|
|
6683
|
-
c = c.filter((b) => l.has(String(b.getListKey())) ? !0 : (
|
|
6720
|
+
c = c.filter((b) => l.has(String(b.getListKey())) ? !0 : (h.push(b.remove()), !1));
|
|
6684
6721
|
const y = c.map((b) => b.getListKey()), T = /* @__PURE__ */ new Map();
|
|
6685
6722
|
c.forEach((b) => {
|
|
6686
6723
|
const v = b.getListKey();
|
|
6687
6724
|
v !== null && !T.has(v) && T.set(v, b);
|
|
6688
6725
|
});
|
|
6689
|
-
const
|
|
6726
|
+
const I = e.getChildElementFragments().slice(), H = I.filter(
|
|
6690
6727
|
(b) => b.hasAttribute(`${u.prefix}each-before`)
|
|
6691
6728
|
).length;
|
|
6692
6729
|
let E = Promise.resolve();
|
|
6693
6730
|
return o.forEach((b, v) => {
|
|
6694
6731
|
const { item: R, itemIndex: C } = a.get(b);
|
|
6695
6732
|
let F;
|
|
6696
|
-
const
|
|
6697
|
-
if (
|
|
6698
|
-
F =
|
|
6699
|
-
() =>
|
|
6733
|
+
const L = T.get(b);
|
|
6734
|
+
if (L)
|
|
6735
|
+
F = L, E = E.then(
|
|
6736
|
+
() => d.updateRowFragment(
|
|
6700
6737
|
F,
|
|
6701
6738
|
R,
|
|
6702
6739
|
i,
|
|
6703
6740
|
C,
|
|
6704
6741
|
s ? String(s) : null,
|
|
6705
6742
|
b
|
|
6706
|
-
).then((
|
|
6707
|
-
if (
|
|
6708
|
-
return
|
|
6743
|
+
).then((B) => {
|
|
6744
|
+
if (B)
|
|
6745
|
+
return d.evaluateAll(F);
|
|
6709
6746
|
})
|
|
6710
6747
|
);
|
|
6711
6748
|
else {
|
|
6712
6749
|
F = r.clone();
|
|
6713
|
-
const
|
|
6750
|
+
const B = H + v;
|
|
6714
6751
|
E = E.then(
|
|
6715
|
-
() =>
|
|
6752
|
+
() => d.updateRowFragment(
|
|
6716
6753
|
F,
|
|
6717
6754
|
R,
|
|
6718
6755
|
i,
|
|
@@ -6720,27 +6757,27 @@ ${r}
|
|
|
6720
6757
|
s ? String(s) : null,
|
|
6721
6758
|
b
|
|
6722
6759
|
).then(() => {
|
|
6723
|
-
const
|
|
6724
|
-
return e.insertBefore(F,
|
|
6725
|
-
|
|
6726
|
-
}).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));
|
|
6727
6764
|
})
|
|
6728
6765
|
);
|
|
6729
6766
|
}
|
|
6730
|
-
}), Promise.all(
|
|
6767
|
+
}), Promise.all(h).then(() => E).then(() => {
|
|
6731
6768
|
const b = o.filter(
|
|
6732
|
-
(
|
|
6769
|
+
(B) => B !== null
|
|
6733
6770
|
), v = y.filter(
|
|
6734
|
-
(
|
|
6735
|
-
), R = new Set(v), C = b.filter((
|
|
6736
|
-
(
|
|
6771
|
+
(B) => B !== null
|
|
6772
|
+
), R = new Set(v), C = b.filter((B) => !R.has(B)), L = p.filter(
|
|
6773
|
+
(B) => B !== null
|
|
6737
6774
|
).filter(
|
|
6738
|
-
(
|
|
6775
|
+
(B) => !l.has(B)
|
|
6739
6776
|
);
|
|
6740
6777
|
N.eachUpdate(
|
|
6741
6778
|
e.getTarget(),
|
|
6742
6779
|
C,
|
|
6743
|
-
|
|
6780
|
+
L,
|
|
6744
6781
|
b
|
|
6745
6782
|
);
|
|
6746
6783
|
});
|
|
@@ -6791,7 +6828,7 @@ ${r}
|
|
|
6791
6828
|
"[Haori]",
|
|
6792
6829
|
`Primitive value requires '${u.prefix}each-arg' attribute: ${t}`
|
|
6793
6830
|
), Promise.resolve(!1);
|
|
6794
|
-
const o = a, l =
|
|
6831
|
+
const o = a, l = d.createBindingSignature({
|
|
6795
6832
|
listKey: s,
|
|
6796
6833
|
bindingData: o
|
|
6797
6834
|
});
|
|
@@ -6809,7 +6846,7 @@ ${r}
|
|
|
6809
6846
|
const r = t.pop();
|
|
6810
6847
|
if (r.getChildElementFragments().forEach((i) => {
|
|
6811
6848
|
t.push(i);
|
|
6812
|
-
}), r !== e && !r.isMounted() &&
|
|
6849
|
+
}), r !== e && !r.isMounted() && d.hasMountSensitiveAttribute(r))
|
|
6813
6850
|
return !0;
|
|
6814
6851
|
}
|
|
6815
6852
|
return !1;
|
|
@@ -6856,7 +6893,7 @@ ${r}
|
|
|
6856
6893
|
if (t.has(e))
|
|
6857
6894
|
return `[Circular:${t.get(e)}]`;
|
|
6858
6895
|
const i = `array-${r.value}`;
|
|
6859
|
-
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(",")}]`;
|
|
6860
6897
|
}
|
|
6861
6898
|
if (typeof e == "object") {
|
|
6862
6899
|
if (t.has(e))
|
|
@@ -6865,7 +6902,7 @@ ${r}
|
|
|
6865
6902
|
r.value += 1, t.set(e, i);
|
|
6866
6903
|
const n = e;
|
|
6867
6904
|
return `{${Object.keys(n).sort().map(
|
|
6868
|
-
(s) => `${JSON.stringify(s)}:${
|
|
6905
|
+
(s) => `${JSON.stringify(s)}:${d.createBindingSignature(
|
|
6869
6906
|
n[s],
|
|
6870
6907
|
t,
|
|
6871
6908
|
r
|
|
@@ -6881,18 +6918,18 @@ ${r}
|
|
|
6881
6918
|
*/
|
|
6882
6919
|
static scheduleEvaluateAll(e) {
|
|
6883
6920
|
setTimeout(() => {
|
|
6884
|
-
|
|
6921
|
+
d.evaluateAll(e);
|
|
6885
6922
|
}, 100);
|
|
6886
6923
|
}
|
|
6887
6924
|
};
|
|
6888
|
-
|
|
6925
|
+
d.ATTRIBUTE_ALIAS_SUFFIX = "attr-", d.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
6889
6926
|
"bind",
|
|
6890
6927
|
"url-param",
|
|
6891
6928
|
"derive-name",
|
|
6892
6929
|
"derive",
|
|
6893
6930
|
"if",
|
|
6894
6931
|
"each"
|
|
6895
|
-
],
|
|
6932
|
+
], d.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], d.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
|
|
6896
6933
|
"bind",
|
|
6897
6934
|
"derive",
|
|
6898
6935
|
"derive-name",
|
|
@@ -6901,8 +6938,8 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
6901
6938
|
"fetch",
|
|
6902
6939
|
"import",
|
|
6903
6940
|
"url-param"
|
|
6904
|
-
],
|
|
6905
|
-
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;
|
|
6906
6943
|
const ee = class ee {
|
|
6907
6944
|
/**
|
|
6908
6945
|
* コンストラクタ。
|
|
@@ -6928,7 +6965,7 @@ const ee = class ee {
|
|
|
6928
6965
|
*/
|
|
6929
6966
|
runWindowLoadProcedure() {
|
|
6930
6967
|
const e = document.documentElement, t = S.get(e);
|
|
6931
|
-
t && new
|
|
6968
|
+
t && new W(t, "load").run();
|
|
6932
6969
|
}
|
|
6933
6970
|
/**
|
|
6934
6971
|
* イベントリスナーの登録を開始します。
|
|
@@ -7054,7 +7091,7 @@ const ee = class ee {
|
|
|
7054
7091
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
7055
7092
|
return;
|
|
7056
7093
|
const n = S.get(i);
|
|
7057
|
-
n instanceof M && new
|
|
7094
|
+
n instanceof M && new W(n, "on", t).run().catch((s) => {
|
|
7058
7095
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
7059
7096
|
});
|
|
7060
7097
|
});
|
|
@@ -7128,7 +7165,7 @@ const ee = class ee {
|
|
|
7128
7165
|
}
|
|
7129
7166
|
}
|
|
7130
7167
|
const n = () => {
|
|
7131
|
-
new
|
|
7168
|
+
new W(i, t, r).run().catch((s) => {
|
|
7132
7169
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
7133
7170
|
});
|
|
7134
7171
|
};
|
|
@@ -7187,7 +7224,7 @@ ee.HISTORY_STATE_KEY = "__haoriHistoryState__", ee.BUILTIN_EVENT_NAMES = /* @__P
|
|
|
7187
7224
|
"input",
|
|
7188
7225
|
"load"
|
|
7189
7226
|
]);
|
|
7190
|
-
let
|
|
7227
|
+
let Ee = ee;
|
|
7191
7228
|
const D = class D {
|
|
7192
7229
|
/**
|
|
7193
7230
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -7225,10 +7262,10 @@ const D = class D {
|
|
|
7225
7262
|
t && (t.observer.disconnect(), D.registrations.delete(e));
|
|
7226
7263
|
const o = new IntersectionObserver(
|
|
7227
7264
|
(l) => {
|
|
7228
|
-
const
|
|
7229
|
-
|
|
7230
|
-
!c.isIntersecting ||
|
|
7231
|
-
p &&
|
|
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));
|
|
7232
7269
|
}).catch((p) => {
|
|
7233
7270
|
m.error(
|
|
7234
7271
|
"[Haori]",
|
|
@@ -7316,7 +7353,7 @@ D.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
7316
7353
|
"once"
|
|
7317
7354
|
]), D.registrations = /* @__PURE__ */ new Map();
|
|
7318
7355
|
let _ = D;
|
|
7319
|
-
function
|
|
7356
|
+
function dt(f) {
|
|
7320
7357
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => f()) : Promise.resolve().then(f);
|
|
7321
7358
|
}
|
|
7322
7359
|
const w = class w {
|
|
@@ -7372,14 +7409,14 @@ const w = class w {
|
|
|
7372
7409
|
t && (t.observer.disconnect(), w.registrations.delete(e));
|
|
7373
7410
|
const a = new IntersectionObserver(
|
|
7374
7411
|
(l) => {
|
|
7375
|
-
const
|
|
7376
|
-
if (!
|
|
7412
|
+
const h = w.registrations.get(e);
|
|
7413
|
+
if (!h)
|
|
7377
7414
|
return;
|
|
7378
7415
|
let c = !1;
|
|
7379
7416
|
l.forEach((p) => {
|
|
7380
7417
|
const y = p.target;
|
|
7381
|
-
|
|
7382
|
-
}), c && w.scheduleCompute(
|
|
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);
|
|
7383
7420
|
},
|
|
7384
7421
|
{
|
|
7385
7422
|
root: n,
|
|
@@ -7498,7 +7535,7 @@ const w = class w {
|
|
|
7498
7535
|
* @param registration 対象の登録
|
|
7499
7536
|
*/
|
|
7500
7537
|
static scheduleCompute(e) {
|
|
7501
|
-
e.scheduled || (e.scheduled = !0,
|
|
7538
|
+
e.scheduled || (e.scheduled = !0, dt(() => {
|
|
7502
7539
|
e.scheduled = !1;
|
|
7503
7540
|
const t = e.fragment.getTarget();
|
|
7504
7541
|
w.registrations.get(t) === e && w.computeAndPublish(e);
|
|
@@ -7565,7 +7602,7 @@ const w = class w {
|
|
|
7565
7602
|
};
|
|
7566
7603
|
n[e.varName] = { ...t };
|
|
7567
7604
|
const s = e.fragment.getTarget(), a = i === s ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([e.fragment]);
|
|
7568
|
-
|
|
7605
|
+
k.setBindingData(
|
|
7569
7606
|
i,
|
|
7570
7607
|
n,
|
|
7571
7608
|
a,
|
|
@@ -7612,12 +7649,12 @@ const O = class O {
|
|
|
7612
7649
|
if (O._initialized)
|
|
7613
7650
|
return;
|
|
7614
7651
|
O._initialized = !0, O.disconnectMutationObservers();
|
|
7615
|
-
const e = new
|
|
7652
|
+
const e = new Ee();
|
|
7616
7653
|
O._dispatcher = e, e.startDeferred();
|
|
7617
7654
|
try {
|
|
7618
7655
|
const t = await Promise.allSettled([
|
|
7619
|
-
|
|
7620
|
-
|
|
7656
|
+
k.scan(document.head),
|
|
7657
|
+
k.scan(document.body)
|
|
7621
7658
|
]), [r, i] = t;
|
|
7622
7659
|
r.status !== "fulfilled" && m.error(
|
|
7623
7660
|
"[Haori]",
|
|
@@ -7627,7 +7664,7 @@ const O = class O {
|
|
|
7627
7664
|
"[Haori]",
|
|
7628
7665
|
"Failed to build body fragment:",
|
|
7629
7666
|
i.reason
|
|
7630
|
-
), 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);
|
|
7631
7668
|
} finally {
|
|
7632
7669
|
e.release();
|
|
7633
7670
|
}
|
|
@@ -7671,12 +7708,12 @@ const O = class O {
|
|
|
7671
7708
|
switch (i.type) {
|
|
7672
7709
|
case "attributes": {
|
|
7673
7710
|
const n = i.target;
|
|
7674
|
-
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(
|
|
7675
7712
|
n,
|
|
7676
7713
|
i.attributeName
|
|
7677
7714
|
))
|
|
7678
7715
|
break;
|
|
7679
|
-
|
|
7716
|
+
k.setAttribute(
|
|
7680
7717
|
n,
|
|
7681
7718
|
i.attributeName,
|
|
7682
7719
|
n.getAttribute(i.attributeName),
|
|
@@ -7686,16 +7723,16 @@ const O = class O {
|
|
|
7686
7723
|
}
|
|
7687
7724
|
case "childList": {
|
|
7688
7725
|
Array.from(i.removedNodes).forEach((n) => {
|
|
7689
|
-
_.cleanupTree(n), J.cleanupTree(n),
|
|
7726
|
+
_.cleanupTree(n), J.cleanupTree(n), k.removeNode(n);
|
|
7690
7727
|
}), Array.from(i.addedNodes).forEach((n) => {
|
|
7691
|
-
n.parentElement instanceof Element && (
|
|
7728
|
+
n.parentElement instanceof Element && (k.addNode(n.parentElement, n), _.syncTree(n), J.syncTree(n));
|
|
7692
7729
|
}), i.target instanceof Element && J.syncElement(
|
|
7693
7730
|
i.target
|
|
7694
7731
|
);
|
|
7695
7732
|
break;
|
|
7696
7733
|
}
|
|
7697
7734
|
case "characterData": {
|
|
7698
|
-
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(
|
|
7699
7736
|
"[Haori]",
|
|
7700
7737
|
"Unsupported character data type:",
|
|
7701
7738
|
i.target
|
|
@@ -7719,17 +7756,17 @@ const O = class O {
|
|
|
7719
7756
|
}
|
|
7720
7757
|
};
|
|
7721
7758
|
O._initialized = !1, O._mutationObservers = [], O._dispatcher = null;
|
|
7722
|
-
let
|
|
7723
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
7724
|
-
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";
|
|
7725
7762
|
export {
|
|
7726
|
-
|
|
7763
|
+
k as Core,
|
|
7727
7764
|
u as Env,
|
|
7728
7765
|
A as Form,
|
|
7729
7766
|
S as Fragment,
|
|
7730
7767
|
Z as Haori,
|
|
7731
7768
|
m as Log,
|
|
7732
|
-
|
|
7769
|
+
P as Queue,
|
|
7733
7770
|
Z as default,
|
|
7734
7771
|
gt as version,
|
|
7735
7772
|
ft as waitForRenders
|