haori 0.59.4 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +4 -2
- package/README.md +4 -2
- package/dist/haori.cjs.js +21 -18
- package/dist/haori.es.js +739 -628
- package/dist/haori.iife.js +21 -18
- package/dist/index.d.ts +74 -9
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -120,7 +120,7 @@ const ee = class ee {
|
|
|
120
120
|
ee._prefix = "data-", ee._runtime = He, ee._strictBind = !1;
|
|
121
121
|
let c = ee;
|
|
122
122
|
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", c.detect) : c.detect());
|
|
123
|
-
class
|
|
123
|
+
class g {
|
|
124
124
|
/**
|
|
125
125
|
* 開発モードでのみコンソールに情報を出力します。
|
|
126
126
|
*
|
|
@@ -164,11 +164,11 @@ const Rt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ge = "new:
|
|
|
164
164
|
static register(e, t) {
|
|
165
165
|
const r = typeof e == "string" ? e.trim() : "";
|
|
166
166
|
if (r === "") {
|
|
167
|
-
|
|
167
|
+
g.error("[Haori]", "Enhancer name is required.");
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
170
|
if (!t || typeof t.init != "function") {
|
|
171
|
-
|
|
171
|
+
g.error("[Haori]", `Enhancer "${r}" must have an init function.`);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
x.enhancers.set(r, t), x.warnedUnknownNames.delete(r), typeof document < "u" && document.body && x.forEachTarget(document.body, (i) => {
|
|
@@ -369,7 +369,7 @@ const Rt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ge = "new:
|
|
|
369
369
|
*/
|
|
370
370
|
static resolveGlobal(e) {
|
|
371
371
|
if (!Rt.test(e))
|
|
372
|
-
return
|
|
372
|
+
return g.error(
|
|
373
373
|
"[Haori]",
|
|
374
374
|
`${c.prefix}enhance-new accepts a dot-separated global reference only: ${e}`
|
|
375
375
|
), null;
|
|
@@ -382,7 +382,7 @@ const Rt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ge = "new:
|
|
|
382
382
|
if (t = t[r], t === void 0)
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
|
-
return typeof t != "function" ? (V.isEnabled() && !x.warnedMissingGlobals.has(e) && (x.warnedMissingGlobals.add(e),
|
|
385
|
+
return typeof t != "function" ? (V.isEnabled() && !x.warnedMissingGlobals.has(e) && (x.warnedMissingGlobals.add(e), g.warn(
|
|
386
386
|
"[Haori]",
|
|
387
387
|
`${c.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
388
388
|
)), null) : t;
|
|
@@ -394,7 +394,7 @@ const Rt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ge = "new:
|
|
|
394
394
|
* @returns 戻り値はありません。
|
|
395
395
|
*/
|
|
396
396
|
static warnUnknownName(e) {
|
|
397
|
-
!V.isEnabled() || x.warnedUnknownNames.has(e) || (x.warnedUnknownNames.add(e),
|
|
397
|
+
!V.isEnabled() || x.warnedUnknownNames.has(e) || (x.warnedUnknownNames.add(e), g.warn(
|
|
398
398
|
"[Haori]",
|
|
399
399
|
`Enhancer "${e}" is not registered yet; the declaration is kept pending and applied when it is registered (Haori.enhancers.register('${e}', {init(el) {...}})).`
|
|
400
400
|
));
|
|
@@ -414,7 +414,7 @@ const Rt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ge = "new:
|
|
|
414
414
|
try {
|
|
415
415
|
t();
|
|
416
416
|
} catch (i) {
|
|
417
|
-
|
|
417
|
+
g.error("[Haori]", `${e} failed:`, i);
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
420
|
x.mutationCapture ? x.mutationCapture(r) : r();
|
|
@@ -555,16 +555,16 @@ function ct(b, e, t = {}) {
|
|
|
555
555
|
a.add(d);
|
|
556
556
|
for (let d = Math.max(0, i - n); d <= Math.min(r - 1, i + n); d += 1)
|
|
557
557
|
a.add(d);
|
|
558
|
-
const o = Array.from(a).sort((d,
|
|
558
|
+
const o = Array.from(a).sort((d, m) => d - m), l = [];
|
|
559
559
|
let u = null;
|
|
560
560
|
for (const d of o) {
|
|
561
561
|
if (u !== null && d - u > 1)
|
|
562
562
|
if (d - u === 2) {
|
|
563
|
-
const
|
|
563
|
+
const m = u + 1;
|
|
564
564
|
l.push({
|
|
565
|
-
page:
|
|
566
|
-
label:
|
|
567
|
-
active:
|
|
565
|
+
page: m,
|
|
566
|
+
label: m + 1,
|
|
567
|
+
active: m === i,
|
|
568
568
|
ellipsis: !1
|
|
569
569
|
});
|
|
570
570
|
} else
|
|
@@ -578,7 +578,7 @@ function ct(b, e, t = {}) {
|
|
|
578
578
|
}
|
|
579
579
|
return l;
|
|
580
580
|
}
|
|
581
|
-
const Ft = /^(\d{4})-(\d{1,2})$/,
|
|
581
|
+
const Ft = /^(\d{4})-(\d{1,2})$/, kt = 1200;
|
|
582
582
|
function xe(b, e) {
|
|
583
583
|
const t = Number(b);
|
|
584
584
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
@@ -595,7 +595,7 @@ function Oe(b, e) {
|
|
|
595
595
|
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;
|
|
596
596
|
return `${String(a).padStart(4, "0")}-${ue(o)}`;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function Nt(b) {
|
|
599
599
|
if (typeof b == "string" && b.trim() !== "")
|
|
600
600
|
return Oe(b, 0);
|
|
601
601
|
const e = /* @__PURE__ */ new Date();
|
|
@@ -605,10 +605,10 @@ function ut(b, e) {
|
|
|
605
605
|
const t = Math.trunc(Number(b));
|
|
606
606
|
if (!Number.isFinite(t) || t < 0)
|
|
607
607
|
return [];
|
|
608
|
-
const r =
|
|
608
|
+
const r = Nt(e);
|
|
609
609
|
if (r === "")
|
|
610
610
|
return [];
|
|
611
|
-
const i = Math.min(t,
|
|
611
|
+
const i = Math.min(t, kt), n = [];
|
|
612
612
|
for (let s = 0; s <= i; s += 1) {
|
|
613
613
|
const a = Oe(r, -s);
|
|
614
614
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
@@ -738,13 +738,13 @@ class We {
|
|
|
738
738
|
const r = await t.task();
|
|
739
739
|
t.resolve(r);
|
|
740
740
|
} catch (r) {
|
|
741
|
-
t.reject(r),
|
|
741
|
+
t.reject(r), g.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
742
742
|
}
|
|
743
743
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
744
744
|
break;
|
|
745
745
|
}
|
|
746
746
|
} catch (e) {
|
|
747
|
-
|
|
747
|
+
g.error("[Haori]", "Error processing queue:", e);
|
|
748
748
|
} finally {
|
|
749
749
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
750
750
|
}
|
|
@@ -979,7 +979,7 @@ const R = class R {
|
|
|
979
979
|
const t = e.filter(
|
|
980
980
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
981
981
|
);
|
|
982
|
-
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)),
|
|
982
|
+
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)), g.warn(
|
|
983
983
|
"[Haori]",
|
|
984
984
|
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${c.prefix}form-object to collect nested values.`
|
|
985
985
|
));
|
|
@@ -1123,7 +1123,7 @@ let ${e.join(", ")};`;
|
|
|
1123
1123
|
if (this.loggedBlockedIdentifierExpressions.has(e))
|
|
1124
1124
|
return;
|
|
1125
1125
|
const t = this.detectForbiddenIdentifiers(e);
|
|
1126
|
-
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e),
|
|
1126
|
+
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e), g.warn(
|
|
1127
1127
|
"[Haori]",
|
|
1128
1128
|
"Expression references blocked identifier(s): " + t.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of an empty result). Use spread {...a, ...b} instead of Object.assign.",
|
|
1129
1129
|
e
|
|
@@ -1265,7 +1265,7 @@ let ${e.join(", ")};`;
|
|
|
1265
1265
|
static recordUnresolvedIdentifiers(e, t) {
|
|
1266
1266
|
if (!(e.length === 0 || this.evaluatingForDiagnosis)) {
|
|
1267
1267
|
if (c.strictBind) {
|
|
1268
|
-
|
|
1268
|
+
g.error(
|
|
1269
1269
|
"[Haori]",
|
|
1270
1270
|
"Expression references key(s) that are not in the binding data: " + e.join(", ") + ". The result is treated as an unresolved reference.",
|
|
1271
1271
|
t
|
|
@@ -1296,7 +1296,7 @@ let ${e.join(", ")};`;
|
|
|
1296
1296
|
if (this.pendingUnresolvedIdentifiers.size === 0)
|
|
1297
1297
|
return;
|
|
1298
1298
|
const e = Array.from(this.pendingUnresolvedIdentifiers);
|
|
1299
|
-
this.pendingUnresolvedIdentifiers.clear(),
|
|
1299
|
+
this.pendingUnresolvedIdentifiers.clear(), g.warn(
|
|
1300
1300
|
"[Haori]",
|
|
1301
1301
|
"Expression key(s) were never provided by any binding: " + e.join(", ") + ". They are treated as unresolved references (rendered as empty). Check for typos if this is unexpected."
|
|
1302
1302
|
);
|
|
@@ -1379,7 +1379,7 @@ let ${e.join(", ")};`;
|
|
|
1379
1379
|
${t}`;
|
|
1380
1380
|
this.loggedScopeMissingIdentifiers.has(s) || (this.loggedScopeMissingIdentifiers.add(s), i.push(n));
|
|
1381
1381
|
}
|
|
1382
|
-
i.length !== 0 &&
|
|
1382
|
+
i.length !== 0 && g.warn(
|
|
1383
1383
|
"[Haori]",
|
|
1384
1384
|
`Expression key(s) are missing from this scope but are provided in another scope: ${i.join(", ")}. A binding is visible only to the target element itself and its descendants, so bind the response to this element or one of its ancestors (data-fetch-bind / data-{event}-bind):`,
|
|
1385
1385
|
t
|
|
@@ -1448,18 +1448,18 @@ ${t}`;
|
|
|
1448
1448
|
*/
|
|
1449
1449
|
static evaluateDetailed(e, t = {}) {
|
|
1450
1450
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
1451
|
-
return
|
|
1451
|
+
return g.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
1452
1452
|
if (this.containsDangerousPatterns(e)) {
|
|
1453
1453
|
const d = this.detectDisallowedKeywords(e);
|
|
1454
1454
|
if (d.length > 0) {
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1455
|
+
const m = d.some((y) => y === "function" || y === "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.";
|
|
1456
|
+
g.warn(
|
|
1457
1457
|
"[Haori]",
|
|
1458
1458
|
e,
|
|
1459
|
-
"Expression uses disallowed keyword(s): " + d.join(", ") + "." +
|
|
1459
|
+
"Expression uses disallowed keyword(s): " + d.join(", ") + "." + m
|
|
1460
1460
|
);
|
|
1461
1461
|
} else
|
|
1462
|
-
|
|
1462
|
+
g.warn(
|
|
1463
1463
|
"[Haori]",
|
|
1464
1464
|
e,
|
|
1465
1465
|
"Expression contains dangerous patterns"
|
|
@@ -1469,7 +1469,7 @@ ${t}`;
|
|
|
1469
1469
|
const r = this.collectForbiddenKeys(t);
|
|
1470
1470
|
if (r.length > 0) {
|
|
1471
1471
|
const d = r.join(",");
|
|
1472
|
-
this.loggedForbiddenKeySignatures.has(d) || (this.loggedForbiddenKeySignatures.add(d), this.scheduleForbiddenKeyLogReset(),
|
|
1472
|
+
this.loggedForbiddenKeySignatures.has(d) || (this.loggedForbiddenKeySignatures.add(d), this.scheduleForbiddenKeyLogReset(), g.error(
|
|
1473
1473
|
"[Haori]",
|
|
1474
1474
|
"Binding keys are reserved and ignored: " + r.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
1475
1475
|
));
|
|
@@ -1480,7 +1480,7 @@ ${t}`;
|
|
|
1480
1480
|
/* @__PURE__ */ new WeakSet(),
|
|
1481
1481
|
i
|
|
1482
1482
|
))
|
|
1483
|
-
return
|
|
1483
|
+
return g.warn(
|
|
1484
1484
|
"[Haori]",
|
|
1485
1485
|
t,
|
|
1486
1486
|
"Binded values contain forbidden values"
|
|
@@ -1491,7 +1491,7 @@ ${t}`;
|
|
|
1491
1491
|
), s = this.BUILTIN_REFERENCE_PATTERN.test(
|
|
1492
1492
|
n
|
|
1493
1493
|
);
|
|
1494
|
-
s && this.BUILTIN_NAMESPACE in t &&
|
|
1494
|
+
s && this.BUILTIN_NAMESPACE in t && g.warn(
|
|
1495
1495
|
"[Haori]",
|
|
1496
1496
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
1497
1497
|
);
|
|
@@ -1511,7 +1511,7 @@ ${t}`;
|
|
|
1511
1511
|
if (V.isEnabled()) {
|
|
1512
1512
|
const d = this.extractBoundIdentifiers(e);
|
|
1513
1513
|
this.recordScopeMissingIdentifiers(
|
|
1514
|
-
d.size === 0 ? l : l.filter((
|
|
1514
|
+
d.size === 0 ? l : l.filter((m) => !d.has(m)),
|
|
1515
1515
|
e
|
|
1516
1516
|
);
|
|
1517
1517
|
}
|
|
@@ -1520,20 +1520,20 @@ ${t}`;
|
|
|
1520
1520
|
});
|
|
1521
1521
|
const u = o ? [] : l;
|
|
1522
1522
|
for (let d = 0; d <= this.MAX_IDENTIFIER_RECOVERY_COUNT; d += 1) {
|
|
1523
|
-
const
|
|
1523
|
+
const m = this.prepareEvaluator(
|
|
1524
1524
|
e,
|
|
1525
1525
|
a,
|
|
1526
1526
|
u
|
|
1527
1527
|
);
|
|
1528
|
-
if (
|
|
1528
|
+
if (m.compileFailed || m.evaluator === null)
|
|
1529
1529
|
return { value: null, unresolvedReference: !1 };
|
|
1530
1530
|
try {
|
|
1531
1531
|
const y = [], E = this.wrapBoundValues(a);
|
|
1532
|
-
|
|
1533
|
-
y.push(E[
|
|
1532
|
+
m.bindKeys.forEach((D) => {
|
|
1533
|
+
y.push(E[D]);
|
|
1534
1534
|
});
|
|
1535
1535
|
const A = this.withBlockedPropertyAccess(
|
|
1536
|
-
() =>
|
|
1536
|
+
() => m.evaluator(...y)
|
|
1537
1537
|
);
|
|
1538
1538
|
return A === void 0 && this.warnBlockedIdentifiers(e), {
|
|
1539
1539
|
value: A,
|
|
@@ -1561,10 +1561,10 @@ ${t}`;
|
|
|
1561
1561
|
e
|
|
1562
1562
|
), { value: void 0, unresolvedReference: !0 });
|
|
1563
1563
|
}
|
|
1564
|
-
return
|
|
1564
|
+
return g.error("[Haori]", "Expression evaluation error:", e, y), y instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
return
|
|
1567
|
+
return g.error(
|
|
1568
1568
|
"[Haori]",
|
|
1569
1569
|
"Failed to recover missing identifiers:",
|
|
1570
1570
|
e,
|
|
@@ -1596,12 +1596,12 @@ ${t}`;
|
|
|
1596
1596
|
evaluator: u,
|
|
1597
1597
|
compileFailed: !1
|
|
1598
1598
|
};
|
|
1599
|
-
const d = this.buildAssignments(n),
|
|
1599
|
+
const d = this.buildAssignments(n), m = this.buildShadowDeclarations(o), y = this.toGuardedMemberExpression(
|
|
1600
1600
|
this.toOptionalChainExpression(e)
|
|
1601
1601
|
), E = d ? `"use strict";
|
|
1602
1602
|
${d};
|
|
1603
|
-
return (${y});${
|
|
1604
|
-
return (${y});${
|
|
1603
|
+
return (${y});${m}` : `"use strict";
|
|
1604
|
+
return (${y});${m}`;
|
|
1605
1605
|
try {
|
|
1606
1606
|
return u = new Function(...n, E), this.EXPRESSION_CACHE.set(l, u), this.compileFailedExpressions.delete(e), {
|
|
1607
1607
|
bindKeys: n,
|
|
@@ -1609,11 +1609,11 @@ return (${y});${g}`;
|
|
|
1609
1609
|
compileFailed: !1
|
|
1610
1610
|
};
|
|
1611
1611
|
} catch (A) {
|
|
1612
|
-
return o.length > 0 ? (
|
|
1612
|
+
return o.length > 0 ? (g.warn(
|
|
1613
1613
|
"[Haori]",
|
|
1614
1614
|
"Failed to shadow undeclared identifier(s): " + o.join(", ") + ". Falling back to evaluation without shadowing.",
|
|
1615
1615
|
e
|
|
1616
|
-
), this.prepareEvaluator(e, t, [])) : (
|
|
1616
|
+
), this.prepareEvaluator(e, t, [])) : (g.error("[Haori]", "Failed to compile expression:", e, A), this.compileFailedExpressions.add(e), {
|
|
1617
1617
|
bindKeys: n,
|
|
1618
1618
|
evaluator: null,
|
|
1619
1619
|
compileFailed: !0
|
|
@@ -2590,8 +2590,8 @@ const ge = "data-haori-if-disabled", Xe = "input, select, textarea, button, fiel
|
|
|
2590
2590
|
let r = 0, i = 0;
|
|
2591
2591
|
const n = (l, u, d) => {
|
|
2592
2592
|
r += d.totalDurationMs, i += d.calls;
|
|
2593
|
-
const
|
|
2594
|
-
if (
|
|
2593
|
+
const m = t.get(l);
|
|
2594
|
+
if (m === void 0) {
|
|
2595
2595
|
t.set(l, {
|
|
2596
2596
|
where: u,
|
|
2597
2597
|
template: d.template,
|
|
@@ -2604,10 +2604,10 @@ const ge = "data-haori-if-disabled", Xe = "input, select, textarea, button, fiel
|
|
|
2604
2604
|
});
|
|
2605
2605
|
return;
|
|
2606
2606
|
}
|
|
2607
|
-
|
|
2608
|
-
|
|
2607
|
+
m.elements += 1, m.calls += d.calls, m.totalDurationMs += d.totalDurationMs, m.maxDurationMs = Math.max(
|
|
2608
|
+
m.maxDurationMs,
|
|
2609
2609
|
d.maxDurationMs
|
|
2610
|
-
), d.totalDurationMs >
|
|
2610
|
+
), d.totalDurationMs > m.representativeDurationMs && (m.where = u, m.representativeDurationMs = d.totalDurationMs);
|
|
2611
2611
|
};
|
|
2612
2612
|
P.snapshot().forEach((l) => {
|
|
2613
2613
|
l.attributes.forEach((u) => {
|
|
@@ -2655,7 +2655,7 @@ ${u.template}`,
|
|
|
2655
2655
|
const n = String(i + 1).padStart(2), s = r.totalDurationMs.toFixed(1).padStart(9), a = `${r.sharePercent.toFixed(1)}%`.padStart(6), o = String(r.calls).padStart(6), l = String(r.elements).padStart(4), u = r.maxDurationMs.toFixed(1).padStart(8);
|
|
2656
2656
|
return `${n}. ${s}ms ${a} calls=${o} elements=${l} max=${u}ms ${r.where} ${r.template}`;
|
|
2657
2657
|
});
|
|
2658
|
-
|
|
2658
|
+
g.info(
|
|
2659
2659
|
"[Haori][evaluation-profile]",
|
|
2660
2660
|
`total=${e.totalDurationMs.toFixed(1)}ms calls=${e.totalCalls} declarations=${e.entryCount}
|
|
2661
2661
|
` + t.join(`
|
|
@@ -2877,7 +2877,7 @@ const de = class de {
|
|
|
2877
2877
|
t = new je(e);
|
|
2878
2878
|
break;
|
|
2879
2879
|
default:
|
|
2880
|
-
return
|
|
2880
|
+
return g.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
2881
2881
|
}
|
|
2882
2882
|
return t;
|
|
2883
2883
|
}
|
|
@@ -3016,7 +3016,7 @@ const de = class de {
|
|
|
3016
3016
|
};
|
|
3017
3017
|
de.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
3018
3018
|
let T = de;
|
|
3019
|
-
const
|
|
3019
|
+
const v = class v extends T {
|
|
3020
3020
|
/**
|
|
3021
3021
|
* エレメントフラグメントのコンストラクタ。
|
|
3022
3022
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -3024,7 +3024,7 @@ const w = class w extends T {
|
|
|
3024
3024
|
* @param target 対象エレメント
|
|
3025
3025
|
*/
|
|
3026
3026
|
constructor(e) {
|
|
3027
|
-
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.initialized = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0,
|
|
3027
|
+
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.initialized = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, v.dropFollowUpArtifacts(e), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${c.prefix}bind`), e.getAttributeNames().forEach((i) => {
|
|
3028
3028
|
const n = e.getAttribute(i);
|
|
3029
3029
|
if (n !== null && !this.attributeMap.has(i)) {
|
|
3030
3030
|
const s = new $e(i, n);
|
|
@@ -3034,7 +3034,7 @@ const w = class w extends T {
|
|
|
3034
3034
|
let t = null;
|
|
3035
3035
|
const r = [];
|
|
3036
3036
|
e.childNodes.forEach((i) => {
|
|
3037
|
-
if (
|
|
3037
|
+
if (v.isOwnedWithinExternal(i))
|
|
3038
3038
|
return;
|
|
3039
3039
|
const n = T.peek(i)?.getParent() ?? null, s = T.get(i);
|
|
3040
3040
|
n !== null && n !== this && (t = t ?? n, n === t && r.push(s)), s.setParent(this), this.children.push(s);
|
|
@@ -3097,7 +3097,7 @@ const w = class w extends T {
|
|
|
3097
3097
|
*/
|
|
3098
3098
|
getChildElementFragments() {
|
|
3099
3099
|
return this.children.filter(
|
|
3100
|
-
(e) => e instanceof
|
|
3100
|
+
(e) => e instanceof v
|
|
3101
3101
|
);
|
|
3102
3102
|
}
|
|
3103
3103
|
/**
|
|
@@ -3118,7 +3118,7 @@ const w = class w extends T {
|
|
|
3118
3118
|
removeChild(e) {
|
|
3119
3119
|
const t = this.children.indexOf(e);
|
|
3120
3120
|
if (t < 0) {
|
|
3121
|
-
|
|
3121
|
+
g.warn("[Haori]", "Child fragment not found.", e);
|
|
3122
3122
|
return;
|
|
3123
3123
|
}
|
|
3124
3124
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -3129,7 +3129,7 @@ const w = class w extends T {
|
|
|
3129
3129
|
* @returns クローンされたフラグメント
|
|
3130
3130
|
*/
|
|
3131
3131
|
clone() {
|
|
3132
|
-
const e = new
|
|
3132
|
+
const e = new v(
|
|
3133
3133
|
this.target.cloneNode(!1)
|
|
3134
3134
|
);
|
|
3135
3135
|
return this.attributeMap.forEach((t, r) => {
|
|
@@ -3153,7 +3153,7 @@ const w = class w extends T {
|
|
|
3153
3153
|
* @returns 戻り値はありません。
|
|
3154
3154
|
*/
|
|
3155
3155
|
static dropFollowUpArtifacts(e) {
|
|
3156
|
-
|
|
3156
|
+
v.dropIfVisibilityArtifacts(e), e.removeAttribute(`${c.prefix}each-done`), e.removeAttribute(`${c.prefix}importing`);
|
|
3157
3157
|
}
|
|
3158
3158
|
/**
|
|
3159
3159
|
* `data-if` の非表示化が DOM へ書いた追随結果を落とします。
|
|
@@ -3168,7 +3168,7 @@ const w = class w extends T {
|
|
|
3168
3168
|
* @returns 戻り値はありません。
|
|
3169
3169
|
*/
|
|
3170
3170
|
static dropIfVisibilityArtifacts(e) {
|
|
3171
|
-
e.hasAttribute(`${c.prefix}if-false`) && (e.style.removeProperty("display"), e.getAttribute("style")?.trim() === "" && e.removeAttribute("style"), e.removeAttribute(`${c.prefix}if-false`),
|
|
3171
|
+
e.hasAttribute(`${c.prefix}if-false`) && (e.style.removeProperty("display"), e.getAttribute("style")?.trim() === "" && e.removeAttribute("style"), e.removeAttribute(`${c.prefix}if-false`), v.forEachFormControlInBranch(e, (t) => {
|
|
3172
3172
|
t.hasAttribute(ge) && (t.removeAttribute(ge), t.removeAttribute("disabled"));
|
|
3173
3173
|
}));
|
|
3174
3174
|
}
|
|
@@ -3192,7 +3192,7 @@ const w = class w extends T {
|
|
|
3192
3192
|
* 付け直しで描画済みの DOM から作り直すことになり、描いた結果を宣言として読み込み
|
|
3193
3193
|
* ます(仕様「監視対象」の「走査した要素を外部のスクリプトが DOM の中で移したり、
|
|
3194
3194
|
* 外して後で戻したりしても、宣言は保ちます」)。付け直しでは `Core.addNode()` が
|
|
3195
|
-
*
|
|
3195
|
+
* この断片をそのまま木へつなぎ直して走査します。
|
|
3196
3196
|
*
|
|
3197
3197
|
* DOM は既に動いているため、DOM からの除去は行いません(同じ親の中で順を変えた
|
|
3198
3198
|
* 場合、ノードはまだ親の下にあります)。外部ライブラリ連携は、DOM から外れる要素と
|
|
@@ -3212,7 +3212,7 @@ const w = class w extends T {
|
|
|
3212
3212
|
* 外部ライブラリが配下に生成した DOM ごと取り込んでフォーム値の収集に載せます
|
|
3213
3213
|
* (仕様「`data-external`」の「付け直した場合も、配下は走査した時点の構成のまま
|
|
3214
3214
|
* 扱う」、課題 #42)。子の断片・属性・キャッシュ登録は保ち、付け直しでは
|
|
3215
|
-
* `Core.addNode()`
|
|
3215
|
+
* `Core.addNode()` がこの断片をそのまま木へつなぎ直して走査します。バインドデータの
|
|
3216
3216
|
* キャッシュは、付け直しで親を設定するとき(`setParent()`)に部分木ごと捨てられる
|
|
3217
3217
|
* ため、ここでは捨てません(捨てる行を外しても結果が変わらないことを確認済み)。
|
|
3218
3218
|
*
|
|
@@ -3313,7 +3313,7 @@ const w = class w extends T {
|
|
|
3313
3313
|
return e;
|
|
3314
3314
|
const r = {};
|
|
3315
3315
|
for (const i of Object.keys(t))
|
|
3316
|
-
|
|
3316
|
+
v.isReservedBindingKey(i) && (r[i] = t[i]);
|
|
3317
3317
|
return { ...r, ...e };
|
|
3318
3318
|
}
|
|
3319
3319
|
/**
|
|
@@ -3363,19 +3363,19 @@ const w = class w extends T {
|
|
|
3363
3363
|
* @returns 実行中なら true
|
|
3364
3364
|
*/
|
|
3365
3365
|
static isExecutingAnyBindingWork() {
|
|
3366
|
-
return
|
|
3366
|
+
return v.bindingWorkActiveCount > 0;
|
|
3367
3367
|
}
|
|
3368
3368
|
/**
|
|
3369
3369
|
* バインドワークの実行開始を記録します(`Core.setBindingData` の work 開始時に呼ぶ)。
|
|
3370
3370
|
*/
|
|
3371
3371
|
markBindingWorkStart() {
|
|
3372
|
-
this.bindingWorkActive++,
|
|
3372
|
+
this.bindingWorkActive++, v.bindingWorkActiveCount++;
|
|
3373
3373
|
}
|
|
3374
3374
|
/**
|
|
3375
3375
|
* バインドワークの実行終了を記録します(work 完了時に呼ぶ)。
|
|
3376
3376
|
*/
|
|
3377
3377
|
markBindingWorkEnd() {
|
|
3378
|
-
this.bindingWorkActive > 0 && (this.bindingWorkActive--,
|
|
3378
|
+
this.bindingWorkActive > 0 && (this.bindingWorkActive--, v.bindingWorkActiveCount--);
|
|
3379
3379
|
}
|
|
3380
3380
|
/**
|
|
3381
3381
|
* このフラグメントへ供給が適用されたことを記録します。
|
|
@@ -3467,7 +3467,7 @@ const w = class w extends T {
|
|
|
3467
3467
|
*/
|
|
3468
3468
|
clearBindingDataCache() {
|
|
3469
3469
|
this.bindingDataCache = null, this.descendantBindingDataCache = null, this.children.forEach((e) => {
|
|
3470
|
-
e instanceof
|
|
3470
|
+
e instanceof v && e.clearBindingDataCache();
|
|
3471
3471
|
});
|
|
3472
3472
|
}
|
|
3473
3473
|
/**
|
|
@@ -3657,7 +3657,7 @@ const w = class w extends T {
|
|
|
3657
3657
|
if (i instanceof HTMLInputElement && i.type === "file")
|
|
3658
3658
|
return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : z.enqueue(() => {
|
|
3659
3659
|
i.value = "";
|
|
3660
|
-
})) : (
|
|
3660
|
+
})) : (g.warn(
|
|
3661
3661
|
"[Haori]",
|
|
3662
3662
|
"A value cannot be assigned to input[type=file]; only clearing is supported.",
|
|
3663
3663
|
i
|
|
@@ -3674,16 +3674,44 @@ const w = class w extends T {
|
|
|
3674
3674
|
} else if (i instanceof HTMLSelectElement && i.multiple) {
|
|
3675
3675
|
const n = (Array.isArray(e) ? e : e === null ? [] : [e]).map(String);
|
|
3676
3676
|
return this.writeSelectedValues(n, t, r);
|
|
3677
|
-
} else return i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement ? this.writeScalarValue(
|
|
3677
|
+
} else return this.collectsLines() ? this.writeLinesValue(e, t, r) : i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement ? this.writeScalarValue(
|
|
3678
3678
|
Array.isArray(e) ? e.join(",") : e,
|
|
3679
3679
|
t,
|
|
3680
3680
|
r
|
|
3681
|
-
) : (
|
|
3681
|
+
) : (g.warn(
|
|
3682
3682
|
"[Haori]",
|
|
3683
3683
|
"setValue is not supported for this element type.",
|
|
3684
3684
|
i
|
|
3685
3685
|
), Promise.resolve());
|
|
3686
3686
|
}
|
|
3687
|
+
/**
|
|
3688
|
+
* 値を行の配列で収集する入力欄(`data-value-type="lines"` の textarea)かどうかを
|
|
3689
|
+
* 判定します。
|
|
3690
|
+
*
|
|
3691
|
+
* @returns 行の配列で収集する場合 true
|
|
3692
|
+
*/
|
|
3693
|
+
collectsLines() {
|
|
3694
|
+
const e = this.getTarget();
|
|
3695
|
+
return e instanceof HTMLTextAreaElement && v.resolveDeclaredValueType(e) === "lines";
|
|
3696
|
+
}
|
|
3697
|
+
/**
|
|
3698
|
+
* `data-value-type="lines"` の textarea へ、行の配列を反映します。
|
|
3699
|
+
*
|
|
3700
|
+
* 改行でつないで書きます。DOM の内容が同じ行の配列を表している場合は書き換え
|
|
3701
|
+
* ません。利用者が書いた空の行や前後の空白を、コミットの書き戻しで消さない
|
|
3702
|
+
* ためです(仕様「`data-value-type`」)。
|
|
3703
|
+
*
|
|
3704
|
+
* @param value 反映する値(配列、または改行区切りの文字列)
|
|
3705
|
+
* @param dispatchEvents input/change イベントを発火するかどうか
|
|
3706
|
+
* @param origin 値の由来(通番と種別)
|
|
3707
|
+
* @returns 反映完了の Promise
|
|
3708
|
+
*/
|
|
3709
|
+
writeLinesValue(e, t, r) {
|
|
3710
|
+
const i = this.getTarget(), n = v.normalizeLinesValue(e), s = n.join(`
|
|
3711
|
+
`);
|
|
3712
|
+
return v.normalizeLinesValue(i.value).join(`
|
|
3713
|
+
`) === s ? (this.value = n, Promise.resolve()) : this.writeScalarValue(s, t, r);
|
|
3714
|
+
}
|
|
3687
3715
|
/**
|
|
3688
3716
|
* 値を持つ入力エレメント(テキスト系 / textarea / 単一選択 select)へ値を反映します。
|
|
3689
3717
|
*
|
|
@@ -3702,7 +3730,7 @@ const w = class w extends T {
|
|
|
3702
3730
|
if (this.isSupersededByUserEdit(s) || r && !this.canApplyValue(r))
|
|
3703
3731
|
return;
|
|
3704
3732
|
const a = i.value;
|
|
3705
|
-
i.value = n, this.recordValueWriteResult(i.value === n), i.value !== a &&
|
|
3733
|
+
i.value = n, this.recordValueWriteResult(i.value === n), i.value !== a && v.notifyValueToEnhancers(i), t && ((i instanceof HTMLInputElement && v.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement) && i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
3706
3734
|
});
|
|
3707
3735
|
}
|
|
3708
3736
|
/**
|
|
@@ -3730,7 +3758,7 @@ const w = class w extends T {
|
|
|
3730
3758
|
o.selected !== l && (o.selected = l, s = !0), l && a.add(o.value);
|
|
3731
3759
|
}), this.recordValueWriteResult(
|
|
3732
3760
|
e.every((o) => a.has(o))
|
|
3733
|
-
), s &&
|
|
3761
|
+
), s && v.notifyValueToEnhancers(i), s && t && i.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
3734
3762
|
});
|
|
3735
3763
|
}
|
|
3736
3764
|
/**
|
|
@@ -3783,10 +3811,10 @@ const w = class w extends T {
|
|
|
3783
3811
|
* @returns 再試行の完了 Promise
|
|
3784
3812
|
*/
|
|
3785
3813
|
static retryUnappliedValueWrites(e, t) {
|
|
3786
|
-
if (
|
|
3814
|
+
if (v.UNAPPLIED_VALUE_WRITES.size === 0)
|
|
3787
3815
|
return Promise.resolve();
|
|
3788
3816
|
const r = [];
|
|
3789
|
-
for (const i of Array.from(
|
|
3817
|
+
for (const i of Array.from(v.UNAPPLIED_VALUE_WRITES)) {
|
|
3790
3818
|
const n = i.getTarget();
|
|
3791
3819
|
if (i.wasResetAfter(t)) {
|
|
3792
3820
|
i.clearUnappliedValueWrite();
|
|
@@ -3845,7 +3873,7 @@ const w = class w extends T {
|
|
|
3845
3873
|
* @returns 戻り値はありません。
|
|
3846
3874
|
*/
|
|
3847
3875
|
clearUnappliedValueWrite() {
|
|
3848
|
-
this.valueWriteUnapplied = !1,
|
|
3876
|
+
this.valueWriteUnapplied = !1, v.UNAPPLIED_VALUE_WRITES.delete(this);
|
|
3849
3877
|
}
|
|
3850
3878
|
/**
|
|
3851
3879
|
* 入力エレメントの値を取得します。
|
|
@@ -3866,7 +3894,7 @@ const w = class w extends T {
|
|
|
3866
3894
|
* @returns 直近に発番した通番(未発番なら 0)
|
|
3867
3895
|
*/
|
|
3868
3896
|
static currentSequence() {
|
|
3869
|
-
return
|
|
3897
|
+
return v.sequenceCounter;
|
|
3870
3898
|
}
|
|
3871
3899
|
/**
|
|
3872
3900
|
* 新しい通番を発番します。
|
|
@@ -3879,7 +3907,7 @@ const w = class w extends T {
|
|
|
3879
3907
|
* @returns 発番した通番
|
|
3880
3908
|
*/
|
|
3881
3909
|
static nextSequence() {
|
|
3882
|
-
return
|
|
3910
|
+
return v.sequenceCounter += 1, v.sequenceCounter;
|
|
3883
3911
|
}
|
|
3884
3912
|
/**
|
|
3885
3913
|
* 保留中の外部 DOM 変更を取り込む処理を登録します。
|
|
@@ -3888,7 +3916,7 @@ const w = class w extends T {
|
|
|
3888
3916
|
* @returns 戻り値はありません。
|
|
3889
3917
|
*/
|
|
3890
3918
|
static setPendingMutationFlusher(e) {
|
|
3891
|
-
|
|
3919
|
+
v.pendingMutationFlusher = e;
|
|
3892
3920
|
}
|
|
3893
3921
|
/**
|
|
3894
3922
|
* 利用者の操作を起点とする通番を発番します。
|
|
@@ -3909,7 +3937,7 @@ const w = class w extends T {
|
|
|
3909
3937
|
* @returns 発番した通番
|
|
3910
3938
|
*/
|
|
3911
3939
|
static nextOperationSequence() {
|
|
3912
|
-
return
|
|
3940
|
+
return v.pendingMutationFlusher && !v.isExecutingAnyBindingWork() && v.pendingMutationFlusher(), v.nextSequence();
|
|
3913
3941
|
}
|
|
3914
3942
|
/**
|
|
3915
3943
|
* この入力欄へ値を適用してよいかを返します。
|
|
@@ -3939,7 +3967,7 @@ const w = class w extends T {
|
|
|
3939
3967
|
* @returns 適用してよい場合は true
|
|
3940
3968
|
*/
|
|
3941
3969
|
canApplyValue(e) {
|
|
3942
|
-
return e.kind === "nonSupply" && e.editedPaths !== void 0 && this.userEditSequence > 0 && this.wasResetAfter(this.userEditSequence) ? !1 :
|
|
3970
|
+
return e.kind === "nonSupply" && e.editedPaths !== void 0 && this.userEditSequence > 0 && this.wasResetAfter(this.userEditSequence) ? !1 : v.isApplicable(
|
|
3943
3971
|
{ sequence: this.lastValueSequence, kind: this.lastValueKind },
|
|
3944
3972
|
e
|
|
3945
3973
|
);
|
|
@@ -3962,7 +3990,7 @@ const w = class w extends T {
|
|
|
3962
3990
|
* @returns 適用してよい場合は true
|
|
3963
3991
|
*/
|
|
3964
3992
|
canApplyPath(e, t) {
|
|
3965
|
-
return
|
|
3993
|
+
return v.isApplicable(
|
|
3966
3994
|
this.lastPathApplied.get(e) ?? null,
|
|
3967
3995
|
t
|
|
3968
3996
|
);
|
|
@@ -4011,7 +4039,7 @@ const w = class w extends T {
|
|
|
4011
4039
|
* @returns 発番した編集の通番
|
|
4012
4040
|
*/
|
|
4013
4041
|
markUserEdit() {
|
|
4014
|
-
return this.userEditSequence =
|
|
4042
|
+
return this.userEditSequence = v.nextSequence(), this.markValueApplied({ sequence: this.userEditSequence, kind: "edit" }), this.userEditSequence;
|
|
4015
4043
|
}
|
|
4016
4044
|
/**
|
|
4017
4045
|
* `change` によるユーザー編集を記録します。
|
|
@@ -4066,7 +4094,7 @@ const w = class w extends T {
|
|
|
4066
4094
|
* @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
|
|
4067
4095
|
* @return 戻り値はありません。
|
|
4068
4096
|
*/
|
|
4069
|
-
clearUserEditMark(e =
|
|
4097
|
+
clearUserEditMark(e = v.currentSequence()) {
|
|
4070
4098
|
e > this.authoritativeValueSequence && (this.authoritativeValueSequence = e), this.lastValueKind === "edit" && this.lastValueSequence <= e && (this.lastValueKind = "supply");
|
|
4071
4099
|
}
|
|
4072
4100
|
/**
|
|
@@ -4087,7 +4115,7 @@ const w = class w extends T {
|
|
|
4087
4115
|
if (!V.isEnabled())
|
|
4088
4116
|
return;
|
|
4089
4117
|
const n = `${e} ${r}`;
|
|
4090
|
-
|
|
4118
|
+
v.loggedUnresolvedAttributes.has(n) || (v.loggedUnresolvedAttributes.add(n), g.warn(
|
|
4091
4119
|
"[Haori]",
|
|
4092
4120
|
`Attribute "${t}" was not applied because the expression has an unresolved reference; the attribute is removed and the synchronized value is emptied: ${e}="${r}"`,
|
|
4093
4121
|
i
|
|
@@ -4110,7 +4138,7 @@ const w = class w extends T {
|
|
|
4110
4138
|
*/
|
|
4111
4139
|
static warnTypeMismatchedComparison(e, t, r, i) {
|
|
4112
4140
|
const n = `${e} ${t}`;
|
|
4113
|
-
|
|
4141
|
+
v.loggedTypeMismatchedComparisons.has(n) || (v.loggedTypeMismatchedComparisons.add(n), g.warn(
|
|
4114
4142
|
"[Haori]",
|
|
4115
4143
|
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${c.prefix}value-type) or compare converted values: ${e}="${t}"`,
|
|
4116
4144
|
i
|
|
@@ -4132,7 +4160,7 @@ const w = class w extends T {
|
|
|
4132
4160
|
if (!t)
|
|
4133
4161
|
return !1;
|
|
4134
4162
|
const r = T.get(t);
|
|
4135
|
-
return r instanceof
|
|
4163
|
+
return r instanceof v ? r.hasPendingUserEdit() : !1;
|
|
4136
4164
|
}
|
|
4137
4165
|
/**
|
|
4138
4166
|
* `<select>` の今の選択を控え、その状態へ戻す関数を返します。
|
|
@@ -4164,7 +4192,7 @@ const w = class w extends T {
|
|
|
4164
4192
|
const t = T.get(
|
|
4165
4193
|
this.getTarget().closest("select")
|
|
4166
4194
|
);
|
|
4167
|
-
return t instanceof
|
|
4195
|
+
return t instanceof v ? t.userEditSequence : null;
|
|
4168
4196
|
}
|
|
4169
4197
|
/**
|
|
4170
4198
|
* 内部の値をクリアします。エレメントのvalue値は変化しません。
|
|
@@ -4186,16 +4214,31 @@ const w = class w extends T {
|
|
|
4186
4214
|
*
|
|
4187
4215
|
* `data-value-type` を宣言した入力欄では、宣言した型へ正規化します(仕様
|
|
4188
4216
|
* 「`data-value-type`」)。宣言は `type` より優先するため、`type="number"` へ
|
|
4189
|
-
* `string`
|
|
4190
|
-
*
|
|
4217
|
+
* `string` を宣言した場合は文字列になります。`lines` を宣言した textarea では、
|
|
4218
|
+
* 行の配列になります。それ以外の要素では値をそのまま返します。
|
|
4191
4219
|
*
|
|
4192
4220
|
* @param element 対象の入力要素
|
|
4193
4221
|
* @param value 正規化する値
|
|
4194
4222
|
* @returns 正規化後の値(宣言または `type="number"` に従う)
|
|
4195
4223
|
*/
|
|
4196
4224
|
normalizeValueForElement(e, t) {
|
|
4197
|
-
const r =
|
|
4198
|
-
return r === "boolean" ?
|
|
4225
|
+
const r = v.resolveDeclaredValueType(e);
|
|
4226
|
+
return r === "lines" ? v.normalizeLinesValue(t) : r === "boolean" ? v.normalizeBooleanValue(t) : r === "string" ? t === null ? null : String(t) : r === "number" || r === null && e instanceof HTMLInputElement && e.type === "number" ? v.normalizeNumberValue(t) : t;
|
|
4227
|
+
}
|
|
4228
|
+
/**
|
|
4229
|
+
* 値を行の配列へ正規化します。
|
|
4230
|
+
*
|
|
4231
|
+
* 改行で分け、各行の前後の空白を除き、空の行は捨てます(`\r\n` の `\r` は
|
|
4232
|
+
* 前後の空白として除かれます)。配列が渡された場合は、各要素を行として同じ規則を
|
|
4233
|
+
* 適用します。`null` と、配列の `null` の要素は空として扱います(仕様
|
|
4234
|
+
* 「`data-value-type`」)。
|
|
4235
|
+
*
|
|
4236
|
+
* @param value 正規化する値
|
|
4237
|
+
* @returns 行の配列
|
|
4238
|
+
*/
|
|
4239
|
+
static normalizeLinesValue(e) {
|
|
4240
|
+
return (Array.isArray(e) ? e.filter((r) => r !== null).map(String) : e === null ? [] : String(e).split(`
|
|
4241
|
+
`)).map((r) => r.trim()).filter((r) => r !== "");
|
|
4199
4242
|
}
|
|
4200
4243
|
/**
|
|
4201
4244
|
* 値を数値へ正規化します。
|
|
@@ -4212,7 +4255,7 @@ const w = class w extends T {
|
|
|
4212
4255
|
return null;
|
|
4213
4256
|
if (typeof e == "number")
|
|
4214
4257
|
return Number.isFinite(e) ? e : null;
|
|
4215
|
-
if (typeof e != "string" || !
|
|
4258
|
+
if (typeof e != "string" || !v.NUMBER_INPUT_PATTERN.test(e))
|
|
4216
4259
|
return null;
|
|
4217
4260
|
const t = Number(e);
|
|
4218
4261
|
return Number.isFinite(t) ? t : null;
|
|
@@ -4240,10 +4283,10 @@ const w = class w extends T {
|
|
|
4240
4283
|
* 入力欄に宣言された収集値の型(`data-value-type`)を解決します。
|
|
4241
4284
|
*
|
|
4242
4285
|
* 宣言は静的なものとして扱い、DOM の属性から直接読みます。宣言できるのは
|
|
4243
|
-
* `boolean` / `number` / `string` で、対象は値を持つ入力(`<input>`
|
|
4244
|
-
* `checkbox` / `radio` / `file` を除くもの、`<textarea>`、単一選択の
|
|
4245
|
-
*
|
|
4246
|
-
*
|
|
4286
|
+
* `boolean` / `number` / `string` / `lines` で、対象は値を持つ入力(`<input>` の
|
|
4287
|
+
* うち `checkbox` / `radio` / `file` を除くもの、`<textarea>`、単一選択の
|
|
4288
|
+
* `<select>`)です。`lines` は `<textarea>` だけです。対象外の要素や未知の型は
|
|
4289
|
+
* 宣言が無いものとして扱い、開発モードで警告します(仕様「`data-value-type`」)。
|
|
4247
4290
|
*
|
|
4248
4291
|
* @param element 対象の要素
|
|
4249
4292
|
* @returns 宣言された型。宣言が無い場合と無視する場合は null
|
|
@@ -4253,14 +4296,18 @@ const w = class w extends T {
|
|
|
4253
4296
|
if (t === null)
|
|
4254
4297
|
return null;
|
|
4255
4298
|
const r = t.trim().toLowerCase();
|
|
4256
|
-
return
|
|
4299
|
+
return v.VALUE_TYPE_NAMES.has(r) ? r === "lines" && !(e instanceof HTMLTextAreaElement) ? (v.warnValueTypeDeclaration(
|
|
4300
|
+
e,
|
|
4301
|
+
t,
|
|
4302
|
+
"lines は <textarea> にのみ指定できます"
|
|
4303
|
+
), null) : v.acceptsDeclaredValueType(e) ? r : (v.warnValueTypeDeclaration(
|
|
4257
4304
|
e,
|
|
4258
4305
|
t,
|
|
4259
4306
|
"値を持つ入力(checkbox / radio / file と複数選択の select を除く)にのみ指定できます"
|
|
4260
|
-
), null) : (
|
|
4307
|
+
), null) : (v.warnValueTypeDeclaration(
|
|
4261
4308
|
e,
|
|
4262
4309
|
t,
|
|
4263
|
-
"boolean / number / string のいずれかを指定してください"
|
|
4310
|
+
"boolean / number / string / lines のいずれかを指定してください"
|
|
4264
4311
|
), null);
|
|
4265
4312
|
}
|
|
4266
4313
|
/**
|
|
@@ -4290,7 +4337,7 @@ const w = class w extends T {
|
|
|
4290
4337
|
if (!V.isEnabled())
|
|
4291
4338
|
return;
|
|
4292
4339
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
4293
|
-
|
|
4340
|
+
v.loggedValueTypeDeclarations.has(n) || (v.loggedValueTypeDeclarations.add(n), g.warn(
|
|
4294
4341
|
"Haori",
|
|
4295
4342
|
`${c.prefix}value-type="${t}" を無視しました(${r}):`,
|
|
4296
4343
|
e
|
|
@@ -4311,7 +4358,7 @@ const w = class w extends T {
|
|
|
4311
4358
|
* @returns 同期対象の場合true
|
|
4312
4359
|
*/
|
|
4313
4360
|
static isValuePropertyTarget(e) {
|
|
4314
|
-
return e instanceof HTMLInputElement ?
|
|
4361
|
+
return e instanceof HTMLInputElement ? v.INPUT_EVENT_TYPES.includes(e.type) || e.type === "hidden" : e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
|
|
4315
4362
|
}
|
|
4316
4363
|
/**
|
|
4317
4364
|
* 利用者が打鍵で値を変えられる入力欄かどうかを判定します。
|
|
@@ -4350,7 +4397,7 @@ const w = class w extends T {
|
|
|
4350
4397
|
*/
|
|
4351
4398
|
readValueFromDom() {
|
|
4352
4399
|
const e = this.getTarget();
|
|
4353
|
-
if (
|
|
4400
|
+
if (v.resolveDeclaredValueType(e), e instanceof HTMLInputElement) {
|
|
4354
4401
|
if (e.type === "checkbox" || e.type === "radio") {
|
|
4355
4402
|
const t = e.type === "checkbox" && e.value === "true", r = e.value;
|
|
4356
4403
|
return e.checked ? t ? !0 : r === "false" ? !1 : r : t ? !1 : r === "false" ? !0 : null;
|
|
@@ -4379,7 +4426,7 @@ const w = class w extends T {
|
|
|
4379
4426
|
*/
|
|
4380
4427
|
recordValueWriteResult(e) {
|
|
4381
4428
|
if (!e && this.value !== null && this.value !== "") {
|
|
4382
|
-
this.valueWriteUnapplied = !0,
|
|
4429
|
+
this.valueWriteUnapplied = !0, v.UNAPPLIED_VALUE_WRITES.add(this);
|
|
4383
4430
|
return;
|
|
4384
4431
|
}
|
|
4385
4432
|
this.clearUnappliedValueWrite();
|
|
@@ -4409,7 +4456,7 @@ const w = class w extends T {
|
|
|
4409
4456
|
* @returns 収集する値
|
|
4410
4457
|
*/
|
|
4411
4458
|
getValueForCollection() {
|
|
4412
|
-
return this.skipChangeValue || this.valueWriteUnapplied ? this.value :
|
|
4459
|
+
return this.skipChangeValue || this.valueWriteUnapplied ? this.value : v.isValuePropertyTarget(this.getTarget()) ? this.readValueFromDom() : this.value;
|
|
4413
4460
|
}
|
|
4414
4461
|
/**
|
|
4415
4462
|
* チェック状態の DOM 反映に合わせて内部値を DOM から同期します。
|
|
@@ -4429,7 +4476,7 @@ const w = class w extends T {
|
|
|
4429
4476
|
if (!t)
|
|
4430
4477
|
return;
|
|
4431
4478
|
const r = T.get(t);
|
|
4432
|
-
r instanceof
|
|
4479
|
+
r instanceof v && r.syncValue();
|
|
4433
4480
|
}
|
|
4434
4481
|
/**
|
|
4435
4482
|
* 指定した属性のいずれかを自身が書き込み中なら、その完了 Promise を返します。
|
|
@@ -4560,8 +4607,8 @@ const w = class w extends T {
|
|
|
4560
4607
|
element: l,
|
|
4561
4608
|
rawName: e,
|
|
4562
4609
|
template: r
|
|
4563
|
-
}), d = o.isEvaluate || o.isRawEvaluate,
|
|
4564
|
-
if (q && u.hasUnresolvedReference &&
|
|
4610
|
+
}), d = o.isEvaluate || o.isRawEvaluate, m = e === t && v.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E = fe.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, D = t === "value" && v.resolveDeclaredValueType(l) === "boolean", M = A === !1 && !D, q = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || M : m ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : y ? u.hasUnresolvedReference || A === null || A === void 0 || M : d && E === "");
|
|
4611
|
+
if (q && u.hasUnresolvedReference && v.warnUnresolvedAttribute(
|
|
4565
4612
|
e,
|
|
4566
4613
|
t,
|
|
4567
4614
|
r,
|
|
@@ -4571,27 +4618,27 @@ const w = class w extends T {
|
|
|
4571
4618
|
le,
|
|
4572
4619
|
this.getBindingData()
|
|
4573
4620
|
);
|
|
4574
|
-
he !== null &&
|
|
4621
|
+
he !== null && v.warnTypeMismatchedComparison(
|
|
4575
4622
|
e,
|
|
4576
4623
|
r,
|
|
4577
4624
|
he,
|
|
4578
4625
|
l
|
|
4579
4626
|
);
|
|
4580
4627
|
}
|
|
4581
|
-
const I = o.isForceEvaluation() ? r : y ? A : E, K = i && o.isEvaluate && t === "value" &&
|
|
4582
|
-
if (!G && !
|
|
4628
|
+
const I = o.isForceEvaluation() ? r : y ? A : E, K = i && o.isEvaluate && t === "value" && v.isValuePropertyTarget(l), J = l.getRootNode(), re = this.userEditSequence, H = K && v.isUserEditableValue(l) && (l === J.activeElement || this.hasPendingUserEdit()), _ = q || I === null || I === !1 && !D ? null : String(I), G = e !== t && l.getAttribute(e) !== r, F = _ === null ? l.hasAttribute(t) : l.getAttribute(t) !== _, $ = _ === null ? "" : _, Z = K && !H && l.value !== $, Q = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), se = t === "selected" && l instanceof HTMLOptionElement, ce = J.activeElement, W = ce !== null && (Q && l === ce || se && l.closest("select") === ce) || (Q || se) && this.hasPendingCheckableUserEdit(se), Y = this.getCheckableUserEditSequence(se), X = _ !== null, Ee = Q && o.isEvaluate && !W && l.checked !== X, Ie = se && o.isEvaluate && !W && l.selected !== X;
|
|
4629
|
+
if (!G && !F && !Z && !Ee && !Ie)
|
|
4583
4630
|
return K && !H && (this.value = this.normalizeValueForElement(
|
|
4584
4631
|
l,
|
|
4585
4632
|
$
|
|
4586
4633
|
), this.clearUnappliedValueWrite()), (Q || se) && !W && this.syncCheckableValueFromDom(se), Promise.resolve();
|
|
4587
4634
|
const ze = z.enqueue(() => {
|
|
4588
|
-
const le = this.getCheckableUserEditSequence(se) !== Y, he = se && (W || le) ?
|
|
4635
|
+
const le = this.getCheckableUserEditSequence(se) !== Y, he = se && (W || le) ? v.captureSelection(
|
|
4589
4636
|
// 守るべき選択があるのは所属する `<select>` があるときだけ。
|
|
4590
4637
|
l.closest(
|
|
4591
4638
|
"select"
|
|
4592
4639
|
)
|
|
4593
4640
|
) : null;
|
|
4594
|
-
G && l.setAttribute(e, r), _ === null ? l.removeAttribute(t) :
|
|
4641
|
+
G && l.setAttribute(e, r), _ === null ? l.removeAttribute(t) : F && (l.setAttribute(t, _), t === `${c.prefix}bind` && this.recordSelfWrittenBind(_)), t === "style" && this.captureAndHideDisplay(), he?.(), K && !H && !(v.isUserEditableValue(l) && this.isSupersededByUserEdit(re)) && (this.value = this.normalizeValueForElement(
|
|
4595
4642
|
l,
|
|
4596
4643
|
$
|
|
4597
4644
|
), Z && (l.value = $), this.recordValueWriteResult(l.value === $));
|
|
@@ -4746,43 +4793,72 @@ const w = class w extends T {
|
|
|
4746
4793
|
if (this.isSkipMutationNode(e.getTarget()))
|
|
4747
4794
|
return Promise.resolve();
|
|
4748
4795
|
if (e === this)
|
|
4749
|
-
return
|
|
4796
|
+
return g.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
4750
4797
|
const i = /* @__PURE__ */ new Set();
|
|
4751
4798
|
let n = this.parent;
|
|
4752
4799
|
for (; n; )
|
|
4753
4800
|
i.add(n), n = n.getParent();
|
|
4754
4801
|
if (i.has(e))
|
|
4755
|
-
return
|
|
4756
|
-
const s =
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4802
|
+
return g.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
4803
|
+
const s = this.linkChild(
|
|
4804
|
+
e,
|
|
4805
|
+
t,
|
|
4806
|
+
r
|
|
4807
|
+
), a = this.skipMutationNodes;
|
|
4808
|
+
return this.skipMutationNodes = !0, this.holdSkipMutationNode(e.getTarget()), z.enqueue(() => {
|
|
4809
|
+
this.target.insertBefore(e.getTarget(), s);
|
|
4810
|
+
}).finally(() => {
|
|
4811
|
+
this.skipMutationNodes = a, this.releaseSkipMutationNode(e.getTarget());
|
|
4812
|
+
});
|
|
4813
|
+
}
|
|
4814
|
+
/**
|
|
4815
|
+
* 監視が観測した追加を、DOM を動かさずに内部の木へ反映します。
|
|
4816
|
+
*
|
|
4817
|
+
* ノードは既に DOM 上の追加された位置にあります。DOM から外して付け直すと、開いた
|
|
4818
|
+
* popover・`showModal()` で開いた `<dialog>` のモーダル状態・フォーカスが失われます
|
|
4819
|
+
* (仕様「監視対象」の「外部のスクリプトが DOM に追加したノードは、追加された位置の
|
|
4820
|
+
* まま取り込み、DOM から外して付け直すことはしません」)。
|
|
4821
|
+
*
|
|
4822
|
+
* @param newChild 追加された子ノード
|
|
4823
|
+
* @param referenceChild 追加された位置の次の子ノード(末尾の場合は null)
|
|
4824
|
+
* @returns 戻り値はありません。
|
|
4825
|
+
*/
|
|
4826
|
+
attachObserved(e, t) {
|
|
4827
|
+
this.linkChild(e, t);
|
|
4828
|
+
}
|
|
4829
|
+
/**
|
|
4830
|
+
* 子ノードを内部の木の参照ノードの前へつなぎます。DOM は操作しません。
|
|
4831
|
+
*
|
|
4832
|
+
* @param newChild 新しい子ノード
|
|
4833
|
+
* @param referenceChild 参照ノード(末尾の場合は null)
|
|
4834
|
+
* @param referenceNodeOverride DOM で挿入する位置の次のノード(省略時は参照ノード)
|
|
4835
|
+
* @returns DOM で挿入する位置の次のノード
|
|
4836
|
+
*/
|
|
4837
|
+
linkChild(e, t, r) {
|
|
4838
|
+
const i = e.getParent() === this;
|
|
4839
|
+
let n = -1, s = -1;
|
|
4840
|
+
i && (n = this.children.indexOf(e), t !== null && (s = this.children.indexOf(t)));
|
|
4841
|
+
const a = e.getParent();
|
|
4842
|
+
a !== null && a.removeChild(e);
|
|
4843
|
+
let o = r === void 0 ? t?.getTarget() || null : r;
|
|
4762
4844
|
if (t === null)
|
|
4763
4845
|
this.children.push(e);
|
|
4764
4846
|
else {
|
|
4765
|
-
let
|
|
4766
|
-
if (
|
|
4767
|
-
const
|
|
4847
|
+
let l;
|
|
4848
|
+
if (i ? n !== -1 && n < s ? l = s - 1 : l = s : l = this.children.indexOf(t), l === -1) {
|
|
4849
|
+
const u = this.resolveInsertionPointFromDom(
|
|
4768
4850
|
t,
|
|
4769
4851
|
!1
|
|
4770
4852
|
);
|
|
4771
|
-
|
|
4853
|
+
u === null ? (g.warn(
|
|
4772
4854
|
"[Haori]",
|
|
4773
4855
|
"Reference child not found in children.",
|
|
4774
4856
|
t
|
|
4775
|
-
), this.children.push(e)) : (this.children.splice(
|
|
4857
|
+
), this.children.push(e)) : (this.children.splice(u.index, 0, e), o = u.referenceNode);
|
|
4776
4858
|
} else
|
|
4777
|
-
this.children.splice(
|
|
4859
|
+
this.children.splice(l, 0, e);
|
|
4778
4860
|
}
|
|
4779
|
-
e.setParent(this), e.setMounted(this.mounted);
|
|
4780
|
-
const d = this.skipMutationNodes;
|
|
4781
|
-
return this.skipMutationNodes = !0, this.holdSkipMutationNode(e.getTarget()), z.enqueue(() => {
|
|
4782
|
-
this.target.insertBefore(e.getTarget(), u);
|
|
4783
|
-
}).finally(() => {
|
|
4784
|
-
this.skipMutationNodes = d, this.releaseSkipMutationNode(e.getTarget());
|
|
4785
|
-
});
|
|
4861
|
+
return e.setParent(this), e.setMounted(this.mounted), o;
|
|
4786
4862
|
}
|
|
4787
4863
|
/**
|
|
4788
4864
|
* 指定した参照ノードの後に子ノードを挿入します。
|
|
@@ -4800,7 +4876,7 @@ const w = class w extends T {
|
|
|
4800
4876
|
t,
|
|
4801
4877
|
!0
|
|
4802
4878
|
);
|
|
4803
|
-
return i === null ? (
|
|
4879
|
+
return i === null ? (g.warn(
|
|
4804
4880
|
"[Haori]",
|
|
4805
4881
|
"Reference child not found in children.",
|
|
4806
4882
|
t
|
|
@@ -4914,7 +4990,7 @@ const w = class w extends T {
|
|
|
4914
4990
|
*/
|
|
4915
4991
|
static reassertHiddenDisplay(e) {
|
|
4916
4992
|
const t = T.get(e);
|
|
4917
|
-
t instanceof
|
|
4993
|
+
t instanceof v && t.hideDisplayWithoutCapture();
|
|
4918
4994
|
}
|
|
4919
4995
|
/**
|
|
4920
4996
|
* エレメントを非表示にします。
|
|
@@ -4926,7 +5002,7 @@ const w = class w extends T {
|
|
|
4926
5002
|
return Promise.resolve();
|
|
4927
5003
|
this.visible = !1;
|
|
4928
5004
|
const e = this.getTarget();
|
|
4929
|
-
return this.captureAndHideDisplay(), e.setAttribute(`${c.prefix}if-false`, ""),
|
|
5005
|
+
return this.captureAndHideDisplay(), e.setAttribute(`${c.prefix}if-false`, ""), v.disableFormControlsInBranch(e), Promise.resolve();
|
|
4930
5006
|
}
|
|
4931
5007
|
/**
|
|
4932
5008
|
* 分岐配下のフォームコントロールを順に処理します。
|
|
@@ -4964,7 +5040,7 @@ const w = class w extends T {
|
|
|
4964
5040
|
* @returns 戻り値はありません。
|
|
4965
5041
|
*/
|
|
4966
5042
|
static disableFormControlsInBranch(e) {
|
|
4967
|
-
|
|
5043
|
+
v.forEachFormControlInBranch(e, (t) => {
|
|
4968
5044
|
t.hasAttribute("disabled") || (t.setAttribute(ge, ""), t.setAttribute("disabled", ""));
|
|
4969
5045
|
});
|
|
4970
5046
|
}
|
|
@@ -4978,7 +5054,7 @@ const w = class w extends T {
|
|
|
4978
5054
|
* @returns 戻り値はありません。
|
|
4979
5055
|
*/
|
|
4980
5056
|
restoreFormControlsDisabledByIf() {
|
|
4981
|
-
|
|
5057
|
+
v.forEachFormControlInBranch(this.getTarget(), (e) => {
|
|
4982
5058
|
e.hasAttribute(ge) && (e.removeAttribute(ge), e.removeAttribute("disabled"));
|
|
4983
5059
|
});
|
|
4984
5060
|
}
|
|
@@ -5011,11 +5087,12 @@ const w = class w extends T {
|
|
|
5011
5087
|
return t === null ? null : t.closestByAttribute(e);
|
|
5012
5088
|
}
|
|
5013
5089
|
};
|
|
5014
|
-
|
|
5090
|
+
v.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, v.VALUE_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5015
5091
|
"boolean",
|
|
5016
5092
|
"number",
|
|
5017
|
-
"string"
|
|
5018
|
-
|
|
5093
|
+
"string",
|
|
5094
|
+
"lines"
|
|
5095
|
+
]), v.loggedValueTypeDeclarations = /* @__PURE__ */ new Set(), v.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
5019
5096
|
"allowfullscreen",
|
|
5020
5097
|
"async",
|
|
5021
5098
|
"autofocus",
|
|
@@ -5039,7 +5116,7 @@ w.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, w.VALUE
|
|
|
5039
5116
|
"required",
|
|
5040
5117
|
"reversed",
|
|
5041
5118
|
"selected"
|
|
5042
|
-
]),
|
|
5119
|
+
]), v.INPUT_EVENT_TYPES = [
|
|
5043
5120
|
"text",
|
|
5044
5121
|
"password",
|
|
5045
5122
|
"email",
|
|
@@ -5054,8 +5131,8 @@ w.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, w.VALUE
|
|
|
5054
5131
|
"month",
|
|
5055
5132
|
"time",
|
|
5056
5133
|
"week"
|
|
5057
|
-
],
|
|
5058
|
-
let S =
|
|
5134
|
+
], v.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), v.sequenceCounter = 0, v.bindingWorkActiveCount = 0, v.pendingMutationFlusher = null, v.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), v.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
5135
|
+
let S = v;
|
|
5059
5136
|
class ae extends T {
|
|
5060
5137
|
/**
|
|
5061
5138
|
* テキストフラグメントのコンストラクタ。
|
|
@@ -5256,7 +5333,7 @@ const Pe = class Pe {
|
|
|
5256
5333
|
*/
|
|
5257
5334
|
checkRawExpressions() {
|
|
5258
5335
|
for (let e = 0; e < this.contents.length; e++)
|
|
5259
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
5336
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (g.error(
|
|
5260
5337
|
"[Haori]",
|
|
5261
5338
|
"Raw expressions are not allowed in multi-content expressions."
|
|
5262
5339
|
), this.contents[e].type = 1);
|
|
@@ -5312,7 +5389,7 @@ const Pe = class Pe {
|
|
|
5312
5389
|
} else
|
|
5313
5390
|
n.push(l.text);
|
|
5314
5391
|
} catch (u) {
|
|
5315
|
-
|
|
5392
|
+
g.error(
|
|
5316
5393
|
"[Haori]",
|
|
5317
5394
|
`Error evaluating ${i} expression: ${l.text}`,
|
|
5318
5395
|
u
|
|
@@ -5407,7 +5484,7 @@ const ie = class ie extends fe {
|
|
|
5407
5484
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
5408
5485
|
"attribute"
|
|
5409
5486
|
);
|
|
5410
|
-
return this.forceEvaluation && r.results.length > 1 ? (
|
|
5487
|
+
return this.forceEvaluation && r.results.length > 1 ? (g.error(
|
|
5411
5488
|
"[Haori]",
|
|
5412
5489
|
"each or if expressions must have a single content.",
|
|
5413
5490
|
r.results
|
|
@@ -5495,7 +5572,7 @@ const Se = class Se {
|
|
|
5495
5572
|
*/
|
|
5496
5573
|
static openDialog(e) {
|
|
5497
5574
|
return z.enqueue(() => {
|
|
5498
|
-
e instanceof HTMLDialogElement ? (Se.clearMessagesSync(e), e.showModal()) :
|
|
5575
|
+
e instanceof HTMLDialogElement ? (Se.clearMessagesSync(e), e.showModal()) : g.error("[Haori]", "Element is not a dialog: ", e);
|
|
5499
5576
|
}, !0);
|
|
5500
5577
|
}
|
|
5501
5578
|
/**
|
|
@@ -5505,7 +5582,7 @@ const Se = class Se {
|
|
|
5505
5582
|
*/
|
|
5506
5583
|
static closeDialog(e) {
|
|
5507
5584
|
return z.enqueue(() => {
|
|
5508
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
5585
|
+
e instanceof HTMLDialogElement ? e.close() : g.error("[Haori]", "Element is not a dialog: ", e);
|
|
5509
5586
|
}, !0);
|
|
5510
5587
|
}
|
|
5511
5588
|
/**
|
|
@@ -5926,7 +6003,7 @@ const h = class h {
|
|
|
5926
6003
|
return;
|
|
5927
6004
|
const t = e.getAttribute(`${c.prefix}form-name`);
|
|
5928
6005
|
if (!t) {
|
|
5929
|
-
|
|
6006
|
+
g.warn(
|
|
5930
6007
|
"Haori",
|
|
5931
6008
|
`${c.prefix}form-name evaluated to an empty key; the field falls back to the name attribute or is not collected.`,
|
|
5932
6009
|
e.getTarget()
|
|
@@ -6337,11 +6414,11 @@ const h = class h {
|
|
|
6337
6414
|
const u = h.resolveCollectedValue(e), d = h.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
6338
6415
|
Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
|
|
6339
6416
|
} else if (h.isGroupedCheckable(e)) {
|
|
6340
|
-
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0,
|
|
6417
|
+
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, m = u instanceof HTMLInputElement ? u.value : e.getValue(), y = d ? m : null, E = String(n);
|
|
6341
6418
|
y === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = y : Array.isArray(t[E]) ? t[E].push(y) : t[E] = [t[E], y];
|
|
6342
6419
|
} else
|
|
6343
6420
|
t[String(n)] = h.resolveCollectedValue(e);
|
|
6344
|
-
s &&
|
|
6421
|
+
s && g.warn(
|
|
6345
6422
|
"Haori",
|
|
6346
6423
|
`Element cannot have both ${c.prefix}form-object and name attributes.`
|
|
6347
6424
|
);
|
|
@@ -6349,20 +6426,20 @@ const h = class h {
|
|
|
6349
6426
|
h.getPartValues(u, t, r, i);
|
|
6350
6427
|
} else if (s) {
|
|
6351
6428
|
const u = {}, d = i === null ? null : /* @__PURE__ */ new Set();
|
|
6352
|
-
for (const
|
|
6429
|
+
for (const m of e.getChildElementFragments())
|
|
6353
6430
|
h.getPartValues(
|
|
6354
|
-
|
|
6431
|
+
m,
|
|
6355
6432
|
u,
|
|
6356
6433
|
r,
|
|
6357
6434
|
d
|
|
6358
6435
|
);
|
|
6359
|
-
d !== null && h.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(s)), a &&
|
|
6436
|
+
d !== null && h.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(s)), a && g.warn(
|
|
6360
6437
|
"Haori",
|
|
6361
6438
|
`Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
|
|
6362
6439
|
);
|
|
6363
6440
|
} else if (a) {
|
|
6364
6441
|
const u = [], d = [];
|
|
6365
|
-
let
|
|
6442
|
+
let m = !1;
|
|
6366
6443
|
for (const y of e.getChildElementFragments()) {
|
|
6367
6444
|
const E = {}, A = i === null ? null : /* @__PURE__ */ new Set();
|
|
6368
6445
|
h.getPartValues(
|
|
@@ -6370,7 +6447,7 @@ const h = class h {
|
|
|
6370
6447
|
E,
|
|
6371
6448
|
r,
|
|
6372
6449
|
A
|
|
6373
|
-
), A !== null && h.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (
|
|
6450
|
+
), A !== null && h.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (m = !0, u.push(E), d.push(y.getListKey())) : r !== null && (u.push({}), d.push(y.getListKey()));
|
|
6374
6451
|
}
|
|
6375
6452
|
if (r === null) {
|
|
6376
6453
|
const y = e.getAttribute(`${c.prefix}each-key`);
|
|
@@ -6380,7 +6457,7 @@ const h = class h {
|
|
|
6380
6457
|
d,
|
|
6381
6458
|
h.isCollectedListFromEachSource(e)
|
|
6382
6459
|
), h.warnDerivedRowsWithoutKey(e), t[String(a)] = u;
|
|
6383
|
-
} else
|
|
6460
|
+
} else m && (t[String(a)] = u);
|
|
6384
6461
|
} else
|
|
6385
6462
|
for (const u of e.getChildElementFragments())
|
|
6386
6463
|
h.getPartValues(u, t, r, i);
|
|
@@ -6539,7 +6616,7 @@ const h = class h {
|
|
|
6539
6616
|
if (!V.isEnabled() || r == null)
|
|
6540
6617
|
return;
|
|
6541
6618
|
const i = e.getTarget(), n = h.warnedArgOwnerNotRecord.get(i);
|
|
6542
|
-
n?.has(t) || (n ? n.add(t) : h.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])),
|
|
6619
|
+
n?.has(t) || (n ? n.add(t) : h.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])), g.warn(
|
|
6543
6620
|
"[Haori]",
|
|
6544
6621
|
`${c.prefix}form-arg="${t}" のキーを祖先が${Array.isArray(r) ? "配列" : `${typeof r} 型の値`}で持っています。${c.prefix}form-arg はそのキーの配下に入力欄が対応することを宣言するため、値はレコード(オブジェクト)である必要があります。このままでは収集値がそのキーへ直接入り、値の型が変わります。`
|
|
6545
6622
|
));
|
|
@@ -6656,9 +6733,9 @@ const h = class h {
|
|
|
6656
6733
|
return r.querySelectorAll(o).forEach((l) => {
|
|
6657
6734
|
if (!(l instanceof HTMLElement))
|
|
6658
6735
|
return;
|
|
6659
|
-
let u = null, d = !1,
|
|
6660
|
-
for (;
|
|
6661
|
-
|
|
6736
|
+
let u = null, d = !1, m = l;
|
|
6737
|
+
for (; m && m !== r; )
|
|
6738
|
+
m.hasAttribute(`${c.prefix}form-detach`) && (d = !0), (m.hasAttribute(n) || m.hasAttribute(s)) && (u = m), m = m.parentElement;
|
|
6662
6739
|
if (d)
|
|
6663
6740
|
return;
|
|
6664
6741
|
const y = u ?? l, E = y.getAttribute(n) || y.getAttribute(s) || y.getAttribute(`${c.prefix}form-name`) || y.getAttribute("name");
|
|
@@ -6691,7 +6768,7 @@ const h = class h {
|
|
|
6691
6768
|
static applyOneCustomValidity(e, t) {
|
|
6692
6769
|
const r = e.getTarget();
|
|
6693
6770
|
if (!(r instanceof HTMLInputElement) && !(r instanceof HTMLSelectElement) && !(r instanceof HTMLTextAreaElement)) {
|
|
6694
|
-
|
|
6771
|
+
g.warn(
|
|
6695
6772
|
"Haori",
|
|
6696
6773
|
`${t} は入力要素にのみ指定できます: ${r.tagName}`
|
|
6697
6774
|
);
|
|
@@ -6707,7 +6784,7 @@ const h = class h {
|
|
|
6707
6784
|
n
|
|
6708
6785
|
);
|
|
6709
6786
|
if (s.unresolvedReference) {
|
|
6710
|
-
|
|
6787
|
+
g.warn(
|
|
6711
6788
|
"Haori",
|
|
6712
6789
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
6713
6790
|
), r.setCustomValidity(h.resolveValidityMessage(e));
|
|
@@ -6753,7 +6830,7 @@ const h = class h {
|
|
|
6753
6830
|
if (!V.isEnabled() || !e)
|
|
6754
6831
|
return;
|
|
6755
6832
|
const r = `${c.prefix}validity`;
|
|
6756
|
-
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) &&
|
|
6833
|
+
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && g.warn(
|
|
6757
6834
|
"Haori",
|
|
6758
6835
|
`${r} は指定されていますが検証は行われません(${t})。${c.prefix}{event}-validate を指定するか、${c.prefix}{event}-if を使用してください。`
|
|
6759
6836
|
);
|
|
@@ -6813,7 +6890,7 @@ const h = class h {
|
|
|
6813
6890
|
* @param reason 退いた理由
|
|
6814
6891
|
*/
|
|
6815
6892
|
static warnPositionalRowFallback(e) {
|
|
6816
|
-
!V.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e),
|
|
6893
|
+
!V.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e), g.warn(
|
|
6817
6894
|
"[Haori]",
|
|
6818
6895
|
`${c.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6819
6896
|
));
|
|
@@ -6836,7 +6913,7 @@ const h = class h {
|
|
|
6836
6913
|
if (!V.isEnabled() || e.getRawAttribute(`${c.prefix}each-key`) !== null)
|
|
6837
6914
|
return;
|
|
6838
6915
|
const t = e.getRawAttribute(`${c.prefix}each`);
|
|
6839
|
-
t === null || h.resolveLeadingPath(t) !== null || h.warnedDerivedRowsWithoutKey.has(t) || (h.warnedDerivedRowsWithoutKey.add(t),
|
|
6916
|
+
t === null || h.resolveLeadingPath(t) !== null || h.warnedDerivedRowsWithoutKey.has(t) || (h.warnedDerivedRowsWithoutKey.add(t), g.warn(
|
|
6840
6917
|
"[Haori]",
|
|
6841
6918
|
`${c.prefix}each="${t}" の一覧を ${c.prefix}form-list で収集していますが、${c.prefix}each-key がありません。行と配列要素を出現順で対応付けるため、画面に出ていない要素があると行の値を取り違えます。${c.prefix}each-key を宣言してください。`
|
|
6842
6919
|
));
|
|
@@ -7474,16 +7551,16 @@ const h = class h {
|
|
|
7474
7551
|
const o = [];
|
|
7475
7552
|
if (e.hasAttribute(`${c.prefix}form-detach`) && !r)
|
|
7476
7553
|
return Promise.resolve();
|
|
7477
|
-
const l = h.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), d = e.getAttribute(`${c.prefix}form-list`),
|
|
7554
|
+
const l = h.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), d = e.getAttribute(`${c.prefix}form-list`), m = e.hasAttribute(`${c.prefix}form-list`);
|
|
7478
7555
|
if (l) {
|
|
7479
7556
|
const y = t[String(l)], E = n && h.hasResolvedDeclarativeState(e), A = n && typeof y > "u" && !h.isDeclarativeStateBound(e);
|
|
7480
|
-
let
|
|
7481
|
-
if (E ?
|
|
7482
|
-
return (
|
|
7557
|
+
let D = y;
|
|
7558
|
+
if (E ? D = void 0 : A && (D = null), h.isFileInput(e))
|
|
7559
|
+
return (D === null || D === "") && o.push(
|
|
7483
7560
|
h.applyFragmentValue(e, null, i, a)
|
|
7484
7561
|
), Promise.all(o).then(() => {
|
|
7485
7562
|
});
|
|
7486
|
-
if (
|
|
7563
|
+
if (m && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
7487
7564
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
7488
7565
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
7489
7566
|
!h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
|
|
@@ -7491,20 +7568,20 @@ const h = class h {
|
|
|
7491
7568
|
s.set(M, q + 1), o.push(
|
|
7492
7569
|
h.applyFragmentValue(
|
|
7493
7570
|
e,
|
|
7494
|
-
|
|
7571
|
+
D[q] ?? null,
|
|
7495
7572
|
i,
|
|
7496
7573
|
a
|
|
7497
7574
|
)
|
|
7498
7575
|
);
|
|
7499
|
-
} else typeof
|
|
7576
|
+
} else typeof D > "u" || (Array.isArray(D) && h.isGroupedCheckable(e) || Array.isArray(D) && h.isMultipleSelect(e) || typeof D == "string" || typeof D == "number" || typeof D == "boolean" || D === null || Array.isArray(D) && e.collectsLines() ? o.push(
|
|
7500
7577
|
h.applyFragmentValue(
|
|
7501
7578
|
e,
|
|
7502
|
-
|
|
7579
|
+
D,
|
|
7503
7580
|
i,
|
|
7504
7581
|
a
|
|
7505
7582
|
)
|
|
7506
7583
|
) : o.push(
|
|
7507
|
-
h.applyFragmentValue(e, String(
|
|
7584
|
+
h.applyFragmentValue(e, String(D), i, a)
|
|
7508
7585
|
));
|
|
7509
7586
|
} else if (u) {
|
|
7510
7587
|
const y = t[String(u)];
|
|
@@ -7526,13 +7603,13 @@ const h = class h {
|
|
|
7526
7603
|
} else if (d) {
|
|
7527
7604
|
const y = t[String(d)];
|
|
7528
7605
|
if (Array.isArray(y)) {
|
|
7529
|
-
const E = e.getChildElementFragments(), A = e.getAttribute(`${c.prefix}each-key`),
|
|
7606
|
+
const E = e.getChildElementFragments(), A = e.getAttribute(`${c.prefix}each-key`), D = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
|
|
7530
7607
|
E,
|
|
7531
7608
|
y,
|
|
7532
7609
|
A == null ? null : String(A)
|
|
7533
7610
|
) : null;
|
|
7534
7611
|
for (let M = 0; M < E.length; M++) {
|
|
7535
|
-
const q = E[M], I =
|
|
7612
|
+
const q = E[M], I = D ? D[M] : y.length > M ? y[M] : null;
|
|
7536
7613
|
o.push(
|
|
7537
7614
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
7538
7615
|
h.setPartValues(
|
|
@@ -7838,12 +7915,31 @@ const h = class h {
|
|
|
7838
7915
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7839
7916
|
*/
|
|
7840
7917
|
static addMessage(e, t, r, i) {
|
|
7841
|
-
const n = [], s = Ze(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.
|
|
7918
|
+
const n = [], s = Ze(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.keepFirstRadio(
|
|
7919
|
+
h.findFragmentsByKey(e, t)
|
|
7920
|
+
);
|
|
7842
7921
|
return l.forEach((u) => {
|
|
7843
7922
|
n.push(o(u.getTarget()));
|
|
7844
7923
|
}), l.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
7845
7924
|
});
|
|
7846
7925
|
}
|
|
7926
|
+
/**
|
|
7927
|
+
* キーに一致したフラグメントから、2 つめ以降のラジオボタンを除きます。
|
|
7928
|
+
*
|
|
7929
|
+
* 同じキーで収集するラジオボタンは 1 つの値を表すため、メッセージは最初の
|
|
7930
|
+
* 1 つにだけ渡します(仕様「エラーハンドリング」)。ラジオの数だけ渡すと、
|
|
7931
|
+
* 同じ文がラジオの数だけ並びます。
|
|
7932
|
+
*
|
|
7933
|
+
* @param fragments キーに一致したフラグメント
|
|
7934
|
+
* @returns メッセージを渡すフラグメント
|
|
7935
|
+
*/
|
|
7936
|
+
static keepFirstRadio(e) {
|
|
7937
|
+
let t = !1;
|
|
7938
|
+
return e.filter((r) => {
|
|
7939
|
+
const i = r.getTarget();
|
|
7940
|
+
return !(i instanceof HTMLInputElement) || i.type !== "radio" ? !0 : t ? !1 : (t = !0, !0);
|
|
7941
|
+
});
|
|
7942
|
+
}
|
|
7847
7943
|
/**
|
|
7848
7944
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
7849
7945
|
*
|
|
@@ -7876,9 +7972,9 @@ const h = class h {
|
|
|
7876
7972
|
if (n === o) {
|
|
7877
7973
|
const l = i.substring(s + 1, a), u = Number(l);
|
|
7878
7974
|
if (isNaN(u))
|
|
7879
|
-
|
|
7975
|
+
g.error("Haori", `Invalid index: ${i}`);
|
|
7880
7976
|
else {
|
|
7881
|
-
const d = e.getChildElementFragments().filter((
|
|
7977
|
+
const d = e.getChildElementFragments().filter((m) => m.hasAttribute(`${c.prefix}row`));
|
|
7882
7978
|
u < d.length && r.push(
|
|
7883
7979
|
...h.findFragmentByKeyParts(d[u], t.slice(1))
|
|
7884
7980
|
);
|
|
@@ -7916,7 +8012,7 @@ h.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), h.LAST_ANCESTOR_ARG_VA
|
|
|
7916
8012
|
"constructor",
|
|
7917
8013
|
"prototype"
|
|
7918
8014
|
]), h.COLLECTED_ROW_IDENTITY = /* @__PURE__ */ new WeakMap(), h.COMPLETE_SET_VALUES = /* @__PURE__ */ new WeakSet(), h.COLLECTED_EXCLUDED_KEYS = /* @__PURE__ */ new WeakMap(), h.warnedPositionalRowFallbacks = /* @__PURE__ */ new Set(), h.warnedDerivedRowsWithoutKey = /* @__PURE__ */ new Set(), h.LEADING_PATH_PATTERN = /^\s*([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*([\s\S]*)$/;
|
|
7919
|
-
let
|
|
8015
|
+
let k = h;
|
|
7920
8016
|
class O {
|
|
7921
8017
|
/**
|
|
7922
8018
|
* カスタムイベントを発火します。
|
|
@@ -8242,7 +8338,7 @@ class j {
|
|
|
8242
8338
|
try {
|
|
8243
8339
|
return Array.from(r.querySelectorAll(e));
|
|
8244
8340
|
} catch (i) {
|
|
8245
|
-
return
|
|
8341
|
+
return g.error(
|
|
8246
8342
|
"Haori",
|
|
8247
8343
|
`Invalid selector: ${e} (${t})`,
|
|
8248
8344
|
i
|
|
@@ -8300,7 +8396,7 @@ class j {
|
|
|
8300
8396
|
try {
|
|
8301
8397
|
return r.querySelector(e);
|
|
8302
8398
|
} catch (i) {
|
|
8303
|
-
return
|
|
8399
|
+
return g.error(
|
|
8304
8400
|
"Haori",
|
|
8305
8401
|
`Invalid selector: ${e} (${t})`,
|
|
8306
8402
|
i
|
|
@@ -8308,7 +8404,7 @@ class j {
|
|
|
8308
8404
|
}
|
|
8309
8405
|
}
|
|
8310
8406
|
}
|
|
8311
|
-
const
|
|
8407
|
+
const N = class N {
|
|
8312
8408
|
/**
|
|
8313
8409
|
* ストレージ種別に対応する `Storage` を解決します。
|
|
8314
8410
|
*
|
|
@@ -8326,7 +8422,7 @@ const k = class k {
|
|
|
8326
8422
|
throw new Error("storage is not available");
|
|
8327
8423
|
return t;
|
|
8328
8424
|
} catch (t) {
|
|
8329
|
-
return
|
|
8425
|
+
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), g.warn(
|
|
8330
8426
|
"Haori",
|
|
8331
8427
|
`${e}Storage が利用できないため ${c.prefix}store を無効にします:`,
|
|
8332
8428
|
t
|
|
@@ -8363,8 +8459,8 @@ const k = class k {
|
|
|
8363
8459
|
* @param message 警告メッセージ
|
|
8364
8460
|
*/
|
|
8365
8461
|
static warnOnce(e, t, r) {
|
|
8366
|
-
let i =
|
|
8367
|
-
i || (i = /* @__PURE__ */ new Set(),
|
|
8462
|
+
let i = N.WARNED_ELEMENTS.get(e);
|
|
8463
|
+
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t), g.warn("Haori", r));
|
|
8368
8464
|
}
|
|
8369
8465
|
/**
|
|
8370
8466
|
* `data-each` の行の内側かどうかを判定します。
|
|
@@ -8401,13 +8497,13 @@ const k = class k {
|
|
|
8401
8497
|
return null;
|
|
8402
8498
|
const i = r.trim();
|
|
8403
8499
|
if (i === "")
|
|
8404
|
-
return
|
|
8500
|
+
return N.warnOnce(
|
|
8405
8501
|
t,
|
|
8406
8502
|
"key",
|
|
8407
8503
|
`${c.prefix}store にストレージキーが指定されていません。`
|
|
8408
8504
|
), null;
|
|
8409
8505
|
if (i.includes("{{"))
|
|
8410
|
-
return
|
|
8506
|
+
return N.warnOnce(
|
|
8411
8507
|
t,
|
|
8412
8508
|
"expression",
|
|
8413
8509
|
`${c.prefix}store に式は使用できません(静的な文字列を指定してください): ${i}`
|
|
@@ -8416,7 +8512,7 @@ const k = class k {
|
|
|
8416
8512
|
let s = "session";
|
|
8417
8513
|
if (n !== null) {
|
|
8418
8514
|
const d = n.trim();
|
|
8419
|
-
d === "local" || d === "session" ? s = d :
|
|
8515
|
+
d === "local" || d === "session" ? s = d : N.warnOnce(
|
|
8420
8516
|
t,
|
|
8421
8517
|
"type",
|
|
8422
8518
|
`${c.prefix}store-type は session または local を指定してください(session として扱います): ${d}`
|
|
@@ -8425,14 +8521,14 @@ const k = class k {
|
|
|
8425
8521
|
const a = e.getRawAttribute(`${c.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), l = e.getRawAttribute(`${c.prefix}store-params`);
|
|
8426
8522
|
let u = null;
|
|
8427
8523
|
if (l !== null) {
|
|
8428
|
-
const d = l.split("&").map((y) => y.trim()).filter((y) => y !== ""),
|
|
8429
|
-
|
|
8524
|
+
const d = l.split("&").map((y) => y.trim()).filter((y) => y !== ""), m = d.filter((y) => !N.isReservedKey(y));
|
|
8525
|
+
m.length !== d.length && N.warnOnce(
|
|
8430
8526
|
t,
|
|
8431
8527
|
"reserved",
|
|
8432
8528
|
`${c.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
8433
|
-
), u =
|
|
8529
|
+
), u = m.length > 0 ? m : null;
|
|
8434
8530
|
}
|
|
8435
|
-
return u === null && o === null ? (
|
|
8531
|
+
return u === null && o === null ? (N.warnOnce(
|
|
8436
8532
|
t,
|
|
8437
8533
|
"target",
|
|
8438
8534
|
`${c.prefix}store には ${c.prefix}store-params または ${c.prefix}store-arg のいずれかが必要です。`
|
|
@@ -8449,14 +8545,14 @@ const k = class k {
|
|
|
8449
8545
|
* @returns レコード。読み取れない場合は null
|
|
8450
8546
|
*/
|
|
8451
8547
|
static readRecord(e) {
|
|
8452
|
-
const t =
|
|
8548
|
+
const t = N.resolveStorage(e.kind);
|
|
8453
8549
|
if (!t)
|
|
8454
8550
|
return null;
|
|
8455
8551
|
let r;
|
|
8456
8552
|
try {
|
|
8457
8553
|
r = t.getItem(e.key);
|
|
8458
8554
|
} catch (n) {
|
|
8459
|
-
return
|
|
8555
|
+
return g.warn(
|
|
8460
8556
|
"Haori",
|
|
8461
8557
|
`ストレージの読み取りに失敗しました: ${e.key}`,
|
|
8462
8558
|
n
|
|
@@ -8468,13 +8564,13 @@ const k = class k {
|
|
|
8468
8564
|
try {
|
|
8469
8565
|
i = JSON.parse(r);
|
|
8470
8566
|
} catch (n) {
|
|
8471
|
-
return
|
|
8567
|
+
return g.warn(
|
|
8472
8568
|
"Haori",
|
|
8473
8569
|
`保存済みデータが JSON として解釈できません: ${e.key}`,
|
|
8474
8570
|
n
|
|
8475
8571
|
), null;
|
|
8476
8572
|
}
|
|
8477
|
-
return
|
|
8573
|
+
return N.isPlainRecord(i) ? i : (g.warn(
|
|
8478
8574
|
"Haori",
|
|
8479
8575
|
`保存済みデータがオブジェクトではありません: ${e.key}`
|
|
8480
8576
|
), null);
|
|
@@ -8492,8 +8588,8 @@ const k = class k {
|
|
|
8492
8588
|
const s = t[e.arg];
|
|
8493
8589
|
if (s === void 0)
|
|
8494
8590
|
return {};
|
|
8495
|
-
if (!
|
|
8496
|
-
return
|
|
8591
|
+
if (!N.isPlainRecord(s))
|
|
8592
|
+
return g.warn(
|
|
8497
8593
|
"Haori",
|
|
8498
8594
|
`保存済みデータの ${e.arg} がオブジェクトではありません: ` + e.key
|
|
8499
8595
|
), {};
|
|
@@ -8501,7 +8597,7 @@ const k = class k {
|
|
|
8501
8597
|
}
|
|
8502
8598
|
const i = e.params ?? Object.keys(r), n = {};
|
|
8503
8599
|
for (const s of i)
|
|
8504
|
-
|
|
8600
|
+
N.isReservedKey(s) || Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
8505
8601
|
return n;
|
|
8506
8602
|
}
|
|
8507
8603
|
/**
|
|
@@ -8518,7 +8614,7 @@ const k = class k {
|
|
|
8518
8614
|
static selectFromData(e, t) {
|
|
8519
8615
|
const r = e.params ?? Object.keys(t), i = {};
|
|
8520
8616
|
for (const n of r) {
|
|
8521
|
-
if (
|
|
8617
|
+
if (N.isReservedKey(n) || !Object.prototype.hasOwnProperty.call(t, n))
|
|
8522
8618
|
continue;
|
|
8523
8619
|
const s = t[n];
|
|
8524
8620
|
s !== void 0 && (i[n] = s);
|
|
@@ -8577,12 +8673,12 @@ const k = class k {
|
|
|
8577
8673
|
* @param selected 基準にする選択内容
|
|
8578
8674
|
*/
|
|
8579
8675
|
static seedSignature(e, t) {
|
|
8580
|
-
const r =
|
|
8676
|
+
const r = N.stringify(t);
|
|
8581
8677
|
if (r === null) {
|
|
8582
|
-
|
|
8678
|
+
N.SIGNATURES.delete(e);
|
|
8583
8679
|
return;
|
|
8584
8680
|
}
|
|
8585
|
-
|
|
8681
|
+
N.SIGNATURES.set(e, { json: r, refs: N.createRefs(t) });
|
|
8586
8682
|
}
|
|
8587
8683
|
/**
|
|
8588
8684
|
* レコードへ選択内容を書き込みます。
|
|
@@ -8596,19 +8692,19 @@ const k = class k {
|
|
|
8596
8692
|
* @returns 書き込めたら true
|
|
8597
8693
|
*/
|
|
8598
8694
|
static writeRecord(e, t) {
|
|
8599
|
-
const r =
|
|
8695
|
+
const r = N.resolveStorage(e.kind);
|
|
8600
8696
|
if (!r)
|
|
8601
8697
|
return !1;
|
|
8602
|
-
const i =
|
|
8698
|
+
const i = N.readRecord(e) ?? {};
|
|
8603
8699
|
if (e.arg !== null) {
|
|
8604
|
-
const n = i[e.arg], s =
|
|
8700
|
+
const n = i[e.arg], s = N.isPlainRecord(n) ? { ...n } : {};
|
|
8605
8701
|
i[e.arg] = { ...s, ...t };
|
|
8606
8702
|
} else
|
|
8607
8703
|
Object.assign(i, t);
|
|
8608
8704
|
try {
|
|
8609
8705
|
return r.setItem(e.key, JSON.stringify(i)), !0;
|
|
8610
8706
|
} catch (n) {
|
|
8611
|
-
return
|
|
8707
|
+
return g.warn(
|
|
8612
8708
|
"Haori",
|
|
8613
8709
|
`ストレージへの保存に失敗しました: ${e.key}`,
|
|
8614
8710
|
n
|
|
@@ -8626,19 +8722,19 @@ const k = class k {
|
|
|
8626
8722
|
* @returns 復元完了の Promise
|
|
8627
8723
|
*/
|
|
8628
8724
|
static restore(e) {
|
|
8629
|
-
const t =
|
|
8725
|
+
const t = N.readDeclaration(e);
|
|
8630
8726
|
if (!t)
|
|
8631
8727
|
return Promise.resolve();
|
|
8632
8728
|
const r = e.getTarget();
|
|
8633
|
-
if (
|
|
8634
|
-
return
|
|
8729
|
+
if (N.isInsideEachRow(e))
|
|
8730
|
+
return N.warnOnce(
|
|
8635
8731
|
r,
|
|
8636
8732
|
"each-row",
|
|
8637
8733
|
`${c.prefix}each の行の内側では ${c.prefix}store を使用できません(行データは親要素側で配列キーを指定してください)。`
|
|
8638
8734
|
), Promise.resolve();
|
|
8639
|
-
|
|
8640
|
-
const i =
|
|
8641
|
-
return
|
|
8735
|
+
N.RESTORED_ELEMENTS.add(r);
|
|
8736
|
+
const i = N.readRecord(t), n = i ? N.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
8737
|
+
return N.seedSignature(r, N.selectFromData(t, s)), Object.keys(n).length === 0 ? Promise.resolve() : C.setBindingData(r, s, {
|
|
8642
8738
|
reentrant: !0,
|
|
8643
8739
|
kind: "nonSupply",
|
|
8644
8740
|
sequence: S.nextSequence()
|
|
@@ -8655,34 +8751,34 @@ const k = class k {
|
|
|
8655
8751
|
* @param fragment 対象フラグメント
|
|
8656
8752
|
*/
|
|
8657
8753
|
static mirror(e) {
|
|
8658
|
-
const t =
|
|
8659
|
-
if (!t ||
|
|
8754
|
+
const t = N.readDeclaration(e);
|
|
8755
|
+
if (!t || N.isInsideEachRow(e))
|
|
8660
8756
|
return;
|
|
8661
8757
|
const r = e.getTarget();
|
|
8662
|
-
if (!
|
|
8758
|
+
if (!N.RESTORED_ELEMENTS.has(r))
|
|
8663
8759
|
return;
|
|
8664
8760
|
const i = e.getRawBindingData();
|
|
8665
8761
|
if (!i)
|
|
8666
8762
|
return;
|
|
8667
|
-
const n =
|
|
8763
|
+
const n = N.selectFromData(t, i);
|
|
8668
8764
|
if (Object.keys(n).length === 0)
|
|
8669
8765
|
return;
|
|
8670
|
-
const s =
|
|
8671
|
-
if (s &&
|
|
8766
|
+
const s = N.SIGNATURES.get(r);
|
|
8767
|
+
if (s && N.hasSameRefs(s, n))
|
|
8672
8768
|
return;
|
|
8673
|
-
const a =
|
|
8769
|
+
const a = N.stringify(n);
|
|
8674
8770
|
if (a === null) {
|
|
8675
|
-
|
|
8771
|
+
g.warn(
|
|
8676
8772
|
"Haori",
|
|
8677
8773
|
`保存対象を直列化できないためミラーを行いません: ${t.key}`
|
|
8678
8774
|
);
|
|
8679
8775
|
return;
|
|
8680
8776
|
}
|
|
8681
8777
|
if (s && s.json === a) {
|
|
8682
|
-
s.refs =
|
|
8778
|
+
s.refs = N.createRefs(n);
|
|
8683
8779
|
return;
|
|
8684
8780
|
}
|
|
8685
|
-
|
|
8781
|
+
N.writeRecord(t, n) && N.SIGNATURES.set(r, { json: a, refs: N.createRefs(n) });
|
|
8686
8782
|
}
|
|
8687
8783
|
/**
|
|
8688
8784
|
* レコードを破棄します。
|
|
@@ -8695,15 +8791,15 @@ const k = class k {
|
|
|
8695
8791
|
* @param kind ストレージ種別
|
|
8696
8792
|
*/
|
|
8697
8793
|
static clear(e, t) {
|
|
8698
|
-
const r =
|
|
8794
|
+
const r = N.resolveStorage(t);
|
|
8699
8795
|
if (r) {
|
|
8700
8796
|
try {
|
|
8701
8797
|
r.removeItem(e);
|
|
8702
8798
|
} catch (i) {
|
|
8703
|
-
|
|
8799
|
+
g.warn("Haori", `ストレージの破棄に失敗しました: ${e}`, i);
|
|
8704
8800
|
return;
|
|
8705
8801
|
}
|
|
8706
|
-
|
|
8802
|
+
N.reseedDeclaringElements(e, t);
|
|
8707
8803
|
}
|
|
8708
8804
|
}
|
|
8709
8805
|
/**
|
|
@@ -8716,24 +8812,24 @@ const k = class k {
|
|
|
8716
8812
|
document.querySelectorAll(
|
|
8717
8813
|
`[${c.prefix}store]`
|
|
8718
8814
|
).forEach((i) => {
|
|
8719
|
-
if (!
|
|
8815
|
+
if (!N.RESTORED_ELEMENTS.has(i))
|
|
8720
8816
|
return;
|
|
8721
8817
|
const n = T.get(i);
|
|
8722
8818
|
if (!(n instanceof S))
|
|
8723
8819
|
return;
|
|
8724
|
-
const s =
|
|
8820
|
+
const s = N.readDeclaration(n);
|
|
8725
8821
|
if (!s || s.key !== e || s.kind !== t)
|
|
8726
8822
|
return;
|
|
8727
8823
|
const a = n.getRawBindingData();
|
|
8728
|
-
|
|
8824
|
+
N.seedSignature(
|
|
8729
8825
|
i,
|
|
8730
|
-
a ?
|
|
8826
|
+
a ? N.selectFromData(s, a) : {}
|
|
8731
8827
|
);
|
|
8732
8828
|
});
|
|
8733
8829
|
}
|
|
8734
8830
|
};
|
|
8735
|
-
|
|
8736
|
-
let Fe =
|
|
8831
|
+
N.SIGNATURES = /* @__PURE__ */ new WeakMap(), N.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), N.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), N.WARNED_KINDS = /* @__PURE__ */ new Set();
|
|
8832
|
+
let Fe = N;
|
|
8737
8833
|
class bt {
|
|
8738
8834
|
/**
|
|
8739
8835
|
* URLのクエリパラメータを取得します。
|
|
@@ -8870,7 +8966,7 @@ function At(b, e, t) {
|
|
|
8870
8966
|
r === void 0 ? b[e] = t : Array.isArray(r) ? r.push(t) : b[e] = [r, t];
|
|
8871
8967
|
}
|
|
8872
8968
|
function me(b, e) {
|
|
8873
|
-
if (
|
|
8969
|
+
if (k.isCompleteSetValue(e))
|
|
8874
8970
|
return e;
|
|
8875
8971
|
if (Array.isArray(e)) {
|
|
8876
8972
|
const t = Array.isArray(b) ? b.slice() : [];
|
|
@@ -8907,7 +9003,7 @@ function Kt(b, e) {
|
|
|
8907
9003
|
t.body
|
|
8908
9004
|
);
|
|
8909
9005
|
let s = b;
|
|
8910
|
-
Object.keys(i).length > 0 && (s = Et(s, i)), n &&
|
|
9006
|
+
Object.keys(i).length > 0 && (s = Et(s, i)), n && g.warn(
|
|
8911
9007
|
"Haori",
|
|
8912
9008
|
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${c.prefix}{event}-data / ${c.prefix}{event}-form, or use the embedded runtime.`
|
|
8913
9009
|
), delete t.body, t.method = "GET";
|
|
@@ -8934,18 +9030,18 @@ function zt(b) {
|
|
|
8934
9030
|
}
|
|
8935
9031
|
] : [e, String(t)]) : String(b);
|
|
8936
9032
|
}
|
|
8937
|
-
function
|
|
8938
|
-
return b instanceof Blob ? !0 : Array.isArray(b) ? b.some(
|
|
8939
|
-
|
|
9033
|
+
function ke(b) {
|
|
9034
|
+
return b instanceof Blob ? !0 : Array.isArray(b) ? b.some(ke) : b !== null && typeof b == "object" ? Object.values(b).some(
|
|
9035
|
+
ke
|
|
8940
9036
|
) : !1;
|
|
8941
9037
|
}
|
|
8942
9038
|
function Gt(b) {
|
|
8943
9039
|
return Object.values(b).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
8944
|
-
(t) => !(t instanceof Blob) &&
|
|
8945
|
-
) :
|
|
9040
|
+
(t) => !(t instanceof Blob) && ke(t)
|
|
9041
|
+
) : ke(e));
|
|
8946
9042
|
}
|
|
8947
9043
|
function Me(b) {
|
|
8948
|
-
return Ve(
|
|
9044
|
+
return Ve(k.getValues(b));
|
|
8949
9045
|
}
|
|
8950
9046
|
function Ve(b) {
|
|
8951
9047
|
const e = (r) => {
|
|
@@ -8955,7 +9051,7 @@ function Ve(b) {
|
|
|
8955
9051
|
return "";
|
|
8956
9052
|
if (Array.isArray(r)) {
|
|
8957
9053
|
const i = r.map(e);
|
|
8958
|
-
return
|
|
9054
|
+
return k.carryCollectedRowIdentity(r, i), i;
|
|
8959
9055
|
}
|
|
8960
9056
|
if (r !== null && typeof r == "object") {
|
|
8961
9057
|
const i = {};
|
|
@@ -8963,13 +9059,13 @@ function Ve(b) {
|
|
|
8963
9059
|
r
|
|
8964
9060
|
))
|
|
8965
9061
|
i[n] = e(s);
|
|
8966
|
-
return
|
|
9062
|
+
return k.carryCollectedRowIdentity(r, i), i;
|
|
8967
9063
|
}
|
|
8968
9064
|
return r;
|
|
8969
9065
|
}, t = {};
|
|
8970
9066
|
for (const [r, i] of Object.entries(b))
|
|
8971
9067
|
t[r] = e(i);
|
|
8972
|
-
return
|
|
9068
|
+
return k.carryCollectedRowIdentity(b, t), t;
|
|
8973
9069
|
}
|
|
8974
9070
|
function Yt(b, e) {
|
|
8975
9071
|
const t = new Headers(
|
|
@@ -9048,15 +9144,15 @@ const p = class p {
|
|
|
9048
9144
|
(r === "click" || r === "error-click" ? j.queryAllInListOrder(i, t) : j.queryAll(i, t)).forEach((a) => {
|
|
9049
9145
|
const o = T.get(a);
|
|
9050
9146
|
o && n.push(o);
|
|
9051
|
-
}), n.length === 0 &&
|
|
9147
|
+
}), n.length === 0 && g.error("Haori", `Element not found: ${i} (${t})`);
|
|
9052
9148
|
else if (r === "error-click")
|
|
9053
|
-
|
|
9149
|
+
g.error(
|
|
9054
9150
|
"Haori",
|
|
9055
9151
|
`${t} にはクリックする要素のセレクタが必要です。`
|
|
9056
9152
|
);
|
|
9057
9153
|
else if (r === "open" || r === "close" || r === "error-close") {
|
|
9058
9154
|
const s = e.getTarget().closest("dialog");
|
|
9059
|
-
s ? n.push(T.get(s)) :
|
|
9155
|
+
s ? n.push(T.get(s)) : g.error("Haori", `Ancestor <dialog> not found (${t})`);
|
|
9060
9156
|
} else
|
|
9061
9157
|
n.push(e);
|
|
9062
9158
|
return n;
|
|
@@ -9197,7 +9293,7 @@ const p = class p {
|
|
|
9197
9293
|
const r = [];
|
|
9198
9294
|
for (const i of (e ?? "").split("&")) {
|
|
9199
9295
|
const n = i.trim();
|
|
9200
|
-
/^\d{3}$/.test(n) ? r.push(Number(n)) :
|
|
9296
|
+
/^\d{3}$/.test(n) ? r.push(Number(n)) : g.warn(
|
|
9201
9297
|
"Haori",
|
|
9202
9298
|
`${t} の "${n}" は 3 桁のステータスではないため無視します。`
|
|
9203
9299
|
);
|
|
@@ -9269,9 +9365,9 @@ const p = class p {
|
|
|
9269
9365
|
try {
|
|
9270
9366
|
i = C.parseDataBind(r);
|
|
9271
9367
|
} catch (n) {
|
|
9272
|
-
return
|
|
9368
|
+
return g.error("Haori", `Invalid fetch headers: ${n}`), null;
|
|
9273
9369
|
}
|
|
9274
|
-
return i === null || typeof i != "object" || Array.isArray(i) ? (
|
|
9370
|
+
return i === null || typeof i != "object" || Array.isArray(i) ? (g.warn(
|
|
9275
9371
|
"Haori",
|
|
9276
9372
|
`${t} はヘッダー名と値のオブジェクトで指定してください(${Array.isArray(i) ? "配列" : `${typeof i} 型の値`}が指定されたため、ヘッダーは設定しません)。`
|
|
9277
9373
|
), null) : i;
|
|
@@ -9499,8 +9595,8 @@ const p = class p {
|
|
|
9499
9595
|
targetFragment: e
|
|
9500
9596
|
}, i = t ? p.attrName(t, "if") : p.attrName(null, "if", !0);
|
|
9501
9597
|
if (e.hasAttribute(i)) {
|
|
9502
|
-
const
|
|
9503
|
-
typeof
|
|
9598
|
+
const F = e.getRawAttribute(i);
|
|
9599
|
+
typeof F == "string" && F.trim() !== "" ? (r.conditionExpression = k.unwrapConditionExpression(F), r.conditionAttributeName = i) : g.warn(
|
|
9504
9600
|
"Haori",
|
|
9505
9601
|
`${i} に条件式が指定されていません。`
|
|
9506
9602
|
);
|
|
@@ -9520,15 +9616,15 @@ const p = class p {
|
|
|
9520
9616
|
$,
|
|
9521
9617
|
p.attrName(t, "form")
|
|
9522
9618
|
);
|
|
9523
|
-
Z !== null ? r.formFragment =
|
|
9619
|
+
Z !== null ? r.formFragment = k.getFormFragment(
|
|
9524
9620
|
T.get(Z)
|
|
9525
|
-
) :
|
|
9621
|
+
) : g.error(
|
|
9526
9622
|
"Haori",
|
|
9527
9623
|
`Form element not found: ${$} (${p.attrName(t, "form")})`
|
|
9528
9624
|
);
|
|
9529
9625
|
} else
|
|
9530
|
-
r.formFragment =
|
|
9531
|
-
} else (t === "change" || t === "input") && (r.formFragment =
|
|
9626
|
+
r.formFragment = k.getFormFragment(e);
|
|
9627
|
+
} else (t === "change" || t === "input") && (r.formFragment = k.getFormFragment(e), r.formFragment === null && p.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
9532
9628
|
if (e.hasAttribute(`${c.prefix}${t}-before-run`)) {
|
|
9533
9629
|
const $ = e.getRawAttribute(
|
|
9534
9630
|
`${c.prefix}${t}-before-run`
|
|
@@ -9543,12 +9639,12 @@ ${$}
|
|
|
9543
9639
|
`
|
|
9544
9640
|
);
|
|
9545
9641
|
} catch (Z) {
|
|
9546
|
-
|
|
9642
|
+
g.error("Haori", `Invalid before script: ${Z}`);
|
|
9547
9643
|
}
|
|
9548
9644
|
}
|
|
9549
|
-
const
|
|
9550
|
-
if (e.hasAttribute(
|
|
9551
|
-
const $ = String(e.getAttribute(
|
|
9645
|
+
const F = p.attrName(t, "run");
|
|
9646
|
+
if (e.hasAttribute(F)) {
|
|
9647
|
+
const $ = String(e.getAttribute(F) ?? "");
|
|
9552
9648
|
let Z = null;
|
|
9553
9649
|
try {
|
|
9554
9650
|
Z = new Function(
|
|
@@ -9563,7 +9659,7 @@ ${$}
|
|
|
9563
9659
|
${$}
|
|
9564
9660
|
`);
|
|
9565
9661
|
} catch (Q) {
|
|
9566
|
-
|
|
9662
|
+
g.error("Haori", `Invalid run script: ${Q}`);
|
|
9567
9663
|
}
|
|
9568
9664
|
}
|
|
9569
9665
|
Z && (r.runScript = Z);
|
|
@@ -9571,13 +9667,13 @@ ${$}
|
|
|
9571
9667
|
}
|
|
9572
9668
|
const n = p.attrName(t, "fetch"), s = e.hasAttribute(n);
|
|
9573
9669
|
if (s) {
|
|
9574
|
-
const
|
|
9575
|
-
|
|
9670
|
+
const F = e.getAttributeEvaluation(n);
|
|
9671
|
+
F && (r.fetchHasUnresolvedReference = F.hasUnresolvedReference, r.fetchUrl = F.hasUnresolvedReference ? null : F.value);
|
|
9576
9672
|
}
|
|
9577
9673
|
const a = {}, o = t ? p.attrName(t, "fetch-method") : p.attrName(null, "method", !0);
|
|
9578
9674
|
if (e.hasAttribute(o)) {
|
|
9579
|
-
const
|
|
9580
|
-
|
|
9675
|
+
const F = e.getAttributeEvaluation(o);
|
|
9676
|
+
F?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = p.normalizeAttributeText(F?.value) ?? void 0;
|
|
9581
9677
|
}
|
|
9582
9678
|
const l = t ? p.attrName(t, "fetch-headers") : p.attrName(null, "headers", !0), u = p.readFetchHeaders(
|
|
9583
9679
|
e,
|
|
@@ -9585,69 +9681,69 @@ ${$}
|
|
|
9585
9681
|
);
|
|
9586
9682
|
u !== null && (a.headers = u);
|
|
9587
9683
|
const d = t ? p.attrName(t, "fetch-content-type") : p.attrName(null, "content-type", !0);
|
|
9588
|
-
let
|
|
9684
|
+
let m = null;
|
|
9589
9685
|
if (e.hasAttribute(d)) {
|
|
9590
|
-
const
|
|
9591
|
-
|
|
9592
|
-
|
|
9686
|
+
const F = e.getAttributeEvaluation(d);
|
|
9687
|
+
F?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), m = p.normalizeAttributeText(
|
|
9688
|
+
F?.value
|
|
9593
9689
|
);
|
|
9594
9690
|
}
|
|
9595
|
-
if (
|
|
9691
|
+
if (m !== null)
|
|
9596
9692
|
a.headers = p.withContentType(
|
|
9597
9693
|
a.headers,
|
|
9598
|
-
|
|
9694
|
+
m
|
|
9599
9695
|
);
|
|
9600
9696
|
else if (a.method && !p.hasDeclaredContentType(a.headers)) {
|
|
9601
|
-
const
|
|
9697
|
+
const F = a.method.toUpperCase();
|
|
9602
9698
|
a.headers = p.withContentType(
|
|
9603
9699
|
a.headers,
|
|
9604
|
-
|
|
9700
|
+
F === "GET" || F === "HEAD" || F === "OPTIONS" ? "application/x-www-form-urlencoded" : "application/json"
|
|
9605
9701
|
);
|
|
9606
9702
|
}
|
|
9607
9703
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
9608
9704
|
const y = t ? p.attrName(t, "fetch-download") : p.attrName(null, "download", !0);
|
|
9609
9705
|
if (e.hasAttribute(y) && !s)
|
|
9610
|
-
|
|
9706
|
+
g.warn(
|
|
9611
9707
|
"Haori",
|
|
9612
9708
|
`${y} は ${n} と併せて指定してください(保存する応答が無いため、この宣言は無視します)。`
|
|
9613
9709
|
);
|
|
9614
9710
|
else if (e.hasAttribute(y)) {
|
|
9615
9711
|
r.download = !0;
|
|
9616
|
-
const
|
|
9617
|
-
r.downloadFileName =
|
|
9712
|
+
const F = e.getAttributeEvaluation(y);
|
|
9713
|
+
r.downloadFileName = F?.hasUnresolvedReference ? null : p.normalizeAttributeText(F?.value);
|
|
9618
9714
|
}
|
|
9619
9715
|
const E = t ? p.attrName(t, "fetch-download-folder") : p.attrName(null, "download-folder", !0);
|
|
9620
|
-
e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 :
|
|
9716
|
+
e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 : g.warn(
|
|
9621
9717
|
"Haori",
|
|
9622
9718
|
`${E} は ${y} と併せて指定してください(書き出す応答が無いため、この宣言は無視します)。`
|
|
9623
9719
|
));
|
|
9624
9720
|
const A = t ? p.attrName(t, "bind") : p.attrName(null, "bind", !0);
|
|
9625
9721
|
if (e.hasAttribute(A)) {
|
|
9626
|
-
const
|
|
9627
|
-
if (
|
|
9628
|
-
const $ = j.queryAll(
|
|
9722
|
+
const F = j.read(e, A);
|
|
9723
|
+
if (F) {
|
|
9724
|
+
const $ = j.queryAll(F, A);
|
|
9629
9725
|
$.length > 0 ? (r.bindFragments = [], $.forEach((Z) => {
|
|
9630
9726
|
const Q = T.get(Z);
|
|
9631
9727
|
Q && r.bindFragments.push(Q);
|
|
9632
|
-
})) :
|
|
9728
|
+
})) : g.error(
|
|
9633
9729
|
"Haori",
|
|
9634
|
-
`Bind element not found: ${
|
|
9730
|
+
`Bind element not found: ${F} (${A})`
|
|
9635
9731
|
);
|
|
9636
9732
|
}
|
|
9637
9733
|
}
|
|
9638
|
-
const
|
|
9639
|
-
t ? e.hasAttribute(
|
|
9734
|
+
const D = p.attrName(t, "bind-arg"), M = p.attrName(null, "arg", !0), q = p.attrName(null, "bind-arg", !0);
|
|
9735
|
+
t ? e.hasAttribute(D) && (r.bindArg = e.getRawAttribute(D)) : e.hasAttribute(M) ? r.bindArg = e.getRawAttribute(
|
|
9640
9736
|
M
|
|
9641
9737
|
) : e.hasAttribute(q) && (r.bindArg = e.getRawAttribute(q));
|
|
9642
9738
|
const I = t ? p.attrName(t, "bind-params") : p.attrName(null, "bind-params", !0);
|
|
9643
9739
|
if (e.hasAttribute(I)) {
|
|
9644
|
-
const
|
|
9645
|
-
r.bindParams =
|
|
9740
|
+
const F = e.getRawAttribute(I);
|
|
9741
|
+
r.bindParams = F.split("&").map(($) => $.trim());
|
|
9646
9742
|
}
|
|
9647
9743
|
const K = t ? p.attrName(t, "bind-append") : p.attrName(null, "bind-append", !0);
|
|
9648
9744
|
if (e.hasAttribute(K)) {
|
|
9649
|
-
const
|
|
9650
|
-
r.bindAppendParams =
|
|
9745
|
+
const F = e.getRawAttribute(K);
|
|
9746
|
+
r.bindAppendParams = F.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9651
9747
|
}
|
|
9652
9748
|
const J = t ? p.attrName(t, "bind-merge") : p.attrName(null, "bind-merge", !0);
|
|
9653
9749
|
e.hasAttribute(J) && (r.bindMerge = !0);
|
|
@@ -9655,8 +9751,8 @@ ${$}
|
|
|
9655
9751
|
e.hasAttribute(re) && (r.bindTransform = e.getRawAttribute(re));
|
|
9656
9752
|
const H = t ? p.attrName(t, "copy-params") : null;
|
|
9657
9753
|
if (H && e.hasAttribute(H)) {
|
|
9658
|
-
const
|
|
9659
|
-
r.copyParams =
|
|
9754
|
+
const F = e.getRawAttribute(H);
|
|
9755
|
+
r.copyParams = F.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9660
9756
|
}
|
|
9661
9757
|
if (t) {
|
|
9662
9758
|
if (e.hasAttribute(p.attrName(t, "adjust"))) {
|
|
@@ -9672,7 +9768,7 @@ ${$}
|
|
|
9672
9768
|
Y.length > 0 ? (r.adjustFragments = [], Y.forEach((X) => {
|
|
9673
9769
|
const Ee = T.get(X);
|
|
9674
9770
|
Ee && r.adjustFragments.push(Ee);
|
|
9675
|
-
})) :
|
|
9771
|
+
})) : g.error(
|
|
9676
9772
|
"Haori",
|
|
9677
9773
|
`Adjust element not found: ${W} (${p.attrName(t, "adjust")})`
|
|
9678
9774
|
);
|
|
@@ -9697,7 +9793,7 @@ ${W}
|
|
|
9697
9793
|
`
|
|
9698
9794
|
);
|
|
9699
9795
|
} catch (Y) {
|
|
9700
|
-
|
|
9796
|
+
g.error("Haori", `Invalid after script: ${Y}`);
|
|
9701
9797
|
}
|
|
9702
9798
|
}
|
|
9703
9799
|
if (e.hasAttribute(p.attrName(t, "dialog")) && (r.dialogMessage = p.unescapeNewlines(
|
|
@@ -9740,12 +9836,12 @@ ${W}
|
|
|
9740
9836
|
p.attrName(t, "error-bind")
|
|
9741
9837
|
);
|
|
9742
9838
|
}
|
|
9743
|
-
const
|
|
9839
|
+
const F = p.attrName(t, "redirect"), $ = p.attrName(t, "redirect-replace"), Z = e.hasAttribute(F), Q = e.hasAttribute($);
|
|
9744
9840
|
if (Z && (r.redirectUrl = p.readLateAttribute(
|
|
9745
9841
|
e,
|
|
9746
9842
|
r,
|
|
9747
9843
|
"redirect",
|
|
9748
|
-
|
|
9844
|
+
F
|
|
9749
9845
|
)), Q && (r.redirectReplaceUrl = p.readLateAttribute(
|
|
9750
9846
|
e,
|
|
9751
9847
|
r,
|
|
@@ -9763,7 +9859,7 @@ ${W}
|
|
|
9763
9859
|
W
|
|
9764
9860
|
));
|
|
9765
9861
|
}
|
|
9766
|
-
if (e.hasAttribute(p.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(p.attrName(t, "scroll")) && (r.scrollTarget = p.readLateAttribute(
|
|
9862
|
+
if (e.hasAttribute(p.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(p.attrName(t, "clear-messages")) && (r.clearMessagesOnSuccess = !0), e.hasAttribute(p.attrName(t, "scroll")) && (r.scrollTarget = p.readLateAttribute(
|
|
9767
9863
|
e,
|
|
9768
9864
|
r,
|
|
9769
9865
|
"scroll",
|
|
@@ -9783,14 +9879,14 @@ ${W}
|
|
|
9783
9879
|
W,
|
|
9784
9880
|
p.attrName(t, "history-form")
|
|
9785
9881
|
);
|
|
9786
|
-
Y !== null ? r.historyFormFragment =
|
|
9882
|
+
Y !== null ? r.historyFormFragment = k.getFormFragment(
|
|
9787
9883
|
T.get(Y)
|
|
9788
|
-
) :
|
|
9884
|
+
) : g.error(
|
|
9789
9885
|
"Haori",
|
|
9790
9886
|
`Form element not found: ${W} (${p.attrName(t, "history-form")})`
|
|
9791
9887
|
);
|
|
9792
9888
|
} else
|
|
9793
|
-
r.historyFormFragment =
|
|
9889
|
+
r.historyFormFragment = k.getFormFragment(e);
|
|
9794
9890
|
}
|
|
9795
9891
|
[
|
|
9796
9892
|
"reset-before",
|
|
@@ -9857,12 +9953,12 @@ ${W}
|
|
|
9857
9953
|
const Y = j.query(W, ce);
|
|
9858
9954
|
if (Y !== null) {
|
|
9859
9955
|
const X = T.get(Y);
|
|
9860
|
-
X ? r.copySourceFragment = X :
|
|
9956
|
+
X ? r.copySourceFragment = X : g.error(
|
|
9861
9957
|
"Haori",
|
|
9862
9958
|
`Element is not managed by Haori: ${W} (${ce})`
|
|
9863
9959
|
);
|
|
9864
9960
|
} else
|
|
9865
|
-
|
|
9961
|
+
g.error(
|
|
9866
9962
|
"Haori",
|
|
9867
9963
|
`Element not found: ${W} (${ce})`
|
|
9868
9964
|
);
|
|
@@ -9871,41 +9967,41 @@ ${W}
|
|
|
9871
9967
|
}
|
|
9872
9968
|
}
|
|
9873
9969
|
if (!t && (e.hasAttribute(p.attrName(null, "data", !0)) && (r.dataAttrName = p.attrName(null, "data", !0)), e.hasAttribute(p.attrName(null, "form", !0)))) {
|
|
9874
|
-
const
|
|
9970
|
+
const F = j.read(
|
|
9875
9971
|
e,
|
|
9876
9972
|
p.attrName(null, "form", !0)
|
|
9877
9973
|
);
|
|
9878
|
-
if (
|
|
9974
|
+
if (F) {
|
|
9879
9975
|
const $ = j.query(
|
|
9880
|
-
|
|
9976
|
+
F,
|
|
9881
9977
|
p.attrName(null, "form", !0)
|
|
9882
9978
|
);
|
|
9883
|
-
$ !== null ? r.formFragment =
|
|
9979
|
+
$ !== null ? r.formFragment = k.getFormFragment(
|
|
9884
9980
|
T.get($)
|
|
9885
|
-
) :
|
|
9981
|
+
) : g.error(
|
|
9886
9982
|
"Haori",
|
|
9887
|
-
`Form element not found: ${
|
|
9983
|
+
`Form element not found: ${F} (${p.attrName(null, "fetch-form", !0)})`
|
|
9888
9984
|
);
|
|
9889
9985
|
} else
|
|
9890
|
-
r.formFragment =
|
|
9986
|
+
r.formFragment = k.getFormFragment(e);
|
|
9891
9987
|
}
|
|
9892
9988
|
(!t || t === "poll") && p.readNoMessageDeclarations(e, r, t ?? "fetch");
|
|
9893
9989
|
const _ = t ? p.attrName(t, "fetch-state") : p.attrName(null, "state", !0);
|
|
9894
9990
|
if (e.hasAttribute(_)) {
|
|
9895
|
-
const
|
|
9896
|
-
|
|
9991
|
+
const F = j.read(e, _), $ = [];
|
|
9992
|
+
F ? (j.queryAll(F, _).forEach((Q) => {
|
|
9897
9993
|
const se = T.get(Q);
|
|
9898
9994
|
se && $.push(se);
|
|
9899
|
-
}), $.length === 0 &&
|
|
9995
|
+
}), $.length === 0 && g.error(
|
|
9900
9996
|
"Haori",
|
|
9901
|
-
`Element not found: ${
|
|
9997
|
+
`Element not found: ${F} (${_})`
|
|
9902
9998
|
)) : $.push(e), $.length > 0 && (r.fetchStateFragments = $);
|
|
9903
9999
|
}
|
|
9904
10000
|
const G = t ? p.attrName(t, "store-clear") : p.attrName(null, "store-clear", !0);
|
|
9905
10001
|
if (e.hasAttribute(G)) {
|
|
9906
|
-
const
|
|
10002
|
+
const F = e.getRawAttribute(G), $ = F === null ? "" : F.trim();
|
|
9907
10003
|
if ($ === "")
|
|
9908
|
-
|
|
10004
|
+
g.error(
|
|
9909
10005
|
"Haori",
|
|
9910
10006
|
`ストレージキーが指定されていません (${G})`
|
|
9911
10007
|
);
|
|
@@ -9914,13 +10010,13 @@ ${W}
|
|
|
9914
10010
|
const Z = e.getRawAttribute(
|
|
9915
10011
|
`${G}-type`
|
|
9916
10012
|
), Q = Z === null ? "session" : Z.trim();
|
|
9917
|
-
Q === "local" || Q === "session" ? r.storeClearKind = Q : (
|
|
10013
|
+
Q === "local" || Q === "session" ? r.storeClearKind = Q : (g.warn(
|
|
9918
10014
|
"Haori",
|
|
9919
10015
|
`${G}-type は session または local を指定してください(session として扱います): ${Q}`
|
|
9920
10016
|
), r.storeClearKind = "session");
|
|
9921
10017
|
}
|
|
9922
10018
|
}
|
|
9923
|
-
return s && !r.download && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [e], r.defaultSelfBind = !0), r.download && r.bindFragments && r.bindFragments.length > 0 && (
|
|
10019
|
+
return s && !r.download && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [e], r.defaultSelfBind = !0), r.download && r.bindFragments && r.bindFragments.length > 0 && (g.warn(
|
|
9924
10020
|
"Haori",
|
|
9925
10021
|
`${y} と同時にバインド先が指定されています(応答はファイルとして保存し、バインドは行いません)。`
|
|
9926
10022
|
), r.bindFragments = null), p.recordRowWriteTargets(r), r;
|
|
@@ -10030,21 +10126,21 @@ ${W}
|
|
|
10030
10126
|
return this.skipped = !0, !1;
|
|
10031
10127
|
if (this.options.formFragment && this.validate(this.options.formFragment) === !1)
|
|
10032
10128
|
return await this.commitEditOnStop(), !1;
|
|
10033
|
-
if (!this.options.formFragment && this.options.targetFragment &&
|
|
10034
|
-
|
|
10129
|
+
if (!this.options.formFragment && this.options.targetFragment && k.warnUnvalidatedCustomValidity(
|
|
10130
|
+
k.getFormFragment(this.options.targetFragment),
|
|
10035
10131
|
`${c.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
10036
10132
|
), !this.evaluateExecutionCondition())
|
|
10037
10133
|
return this.skipped = !0, await this.commitEditOnStop(), !1;
|
|
10038
10134
|
if (this.options.runScript) {
|
|
10039
|
-
const
|
|
10135
|
+
const m = this.options.targetFragment?.getTarget() ?? null;
|
|
10040
10136
|
try {
|
|
10041
10137
|
const y = this.options.runScript.call(
|
|
10042
|
-
|
|
10138
|
+
m,
|
|
10043
10139
|
this.domEvent
|
|
10044
10140
|
);
|
|
10045
10141
|
y === !1 && this.domEvent && this.domEvent.preventDefault(), y != null && typeof y.then == "function" && await y;
|
|
10046
10142
|
} catch (y) {
|
|
10047
|
-
|
|
10143
|
+
g.error("Haori", `Run script execution error: ${y}`);
|
|
10048
10144
|
}
|
|
10049
10145
|
}
|
|
10050
10146
|
if (!await this.confirm())
|
|
@@ -10053,7 +10149,7 @@ ${W}
|
|
|
10053
10149
|
return !1;
|
|
10054
10150
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
10055
10151
|
this.options.resetBeforeFragments.map(
|
|
10056
|
-
(
|
|
10152
|
+
(m) => k.reset(m, this.operationSequence)
|
|
10057
10153
|
)
|
|
10058
10154
|
), this.captureHistorySnapshots());
|
|
10059
10155
|
const r = this.prepareFetchRequest();
|
|
@@ -10061,14 +10157,14 @@ ${W}
|
|
|
10061
10157
|
const i = r.payload;
|
|
10062
10158
|
let n = r.url, s = r.options, a = !1, o = !1;
|
|
10063
10159
|
if (this.options.beforeCallback) {
|
|
10064
|
-
const
|
|
10160
|
+
const m = this.options.beforeCallback(
|
|
10065
10161
|
n || null,
|
|
10066
10162
|
s || null
|
|
10067
10163
|
);
|
|
10068
|
-
if (
|
|
10069
|
-
if (
|
|
10164
|
+
if (m != null) {
|
|
10165
|
+
if (m === !1 || typeof m == "object" && m.stop)
|
|
10070
10166
|
return !1;
|
|
10071
|
-
typeof
|
|
10167
|
+
typeof m == "object" && (a = "fetchUrl" in m, o = "fetchOptions" in m, n = a ? m.fetchUrl : n, s = o ? m.fetchOptions : s);
|
|
10072
10168
|
}
|
|
10073
10169
|
}
|
|
10074
10170
|
const l = Object.keys(i).length > 0;
|
|
@@ -10078,13 +10174,13 @@ ${W}
|
|
|
10078
10174
|
i,
|
|
10079
10175
|
e
|
|
10080
10176
|
);
|
|
10081
|
-
const
|
|
10177
|
+
const m = (s?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && jt(s) && !Ue(m) ? r.baseUrl ?? n : n, A = Kt(
|
|
10082
10178
|
E,
|
|
10083
10179
|
s
|
|
10084
10180
|
);
|
|
10085
10181
|
n = A.url;
|
|
10086
|
-
const
|
|
10087
|
-
if (I &&
|
|
10182
|
+
const D = { ...A.options }, M = A.normalized ? A.requestedMethod : r.requestedMethod, q = A.effectiveMethod, I = r.transportMode === "query-get" || A.normalized, K = A.queryString ?? r.queryString;
|
|
10183
|
+
if (I && g.info("Haori demo fetch normalization", {
|
|
10088
10184
|
runtime: c.runtime,
|
|
10089
10185
|
requestedMethod: M,
|
|
10090
10186
|
effectiveMethod: q,
|
|
@@ -10103,10 +10199,10 @@ ${W}
|
|
|
10103
10199
|
return O.fetchStart(
|
|
10104
10200
|
this.options.targetFragment.getTarget(),
|
|
10105
10201
|
n,
|
|
10106
|
-
|
|
10202
|
+
D,
|
|
10107
10203
|
l ? i : void 0,
|
|
10108
10204
|
re
|
|
10109
|
-
), await this.injectFetchState("loading"), await p.invokeFetch(n,
|
|
10205
|
+
), await this.injectFetchState("loading"), await p.invokeFetch(n, D).then((H) => this.handleFetchResult(
|
|
10110
10206
|
H,
|
|
10111
10207
|
n || void 0,
|
|
10112
10208
|
J
|
|
@@ -10122,7 +10218,7 @@ ${W}
|
|
|
10122
10218
|
), await this.runErrorActions(null), H;
|
|
10123
10219
|
});
|
|
10124
10220
|
}
|
|
10125
|
-
return await fetch(n,
|
|
10221
|
+
return await fetch(n, D).then((J) => this.handleFetchResult(J, n || void 0));
|
|
10126
10222
|
}
|
|
10127
10223
|
(!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && l && await this.commitFormValues(
|
|
10128
10224
|
this.options.formFragment,
|
|
@@ -10186,22 +10282,22 @@ ${W}
|
|
|
10186
10282
|
let l;
|
|
10187
10283
|
if (o) {
|
|
10188
10284
|
l = { ...s ?? {} };
|
|
10189
|
-
const u = String(o), d =
|
|
10190
|
-
l[u] =
|
|
10285
|
+
const u = String(o), d = k.resolveAncestorArgOwner(e, u);
|
|
10286
|
+
l[u] = k.mergeCollectedValues(
|
|
10191
10287
|
(d ? d.value : l[u]) ?? null,
|
|
10192
10288
|
a
|
|
10193
10289
|
);
|
|
10194
10290
|
} else
|
|
10195
|
-
l =
|
|
10291
|
+
l = k.mergeCollectedValues(
|
|
10196
10292
|
s,
|
|
10197
10293
|
a,
|
|
10198
|
-
|
|
10294
|
+
k.ancestorBaseResolver(e)
|
|
10199
10295
|
);
|
|
10200
10296
|
await C.setBindingData(i, l, {
|
|
10201
10297
|
skipFragments: n,
|
|
10202
10298
|
kind: "nonSupply",
|
|
10203
10299
|
sequence: this.operationSequence,
|
|
10204
|
-
editedPaths:
|
|
10300
|
+
editedPaths: k.collectEditedPaths(
|
|
10205
10301
|
e,
|
|
10206
10302
|
this.operationSequence,
|
|
10207
10303
|
o ? String(o) : "",
|
|
@@ -10274,7 +10370,7 @@ ${W}
|
|
|
10274
10370
|
}
|
|
10275
10371
|
C.setAttribute(t, r.name, r.value).catch(
|
|
10276
10372
|
(i) => {
|
|
10277
|
-
|
|
10373
|
+
g.error(
|
|
10278
10374
|
"Haori",
|
|
10279
10375
|
`ロックの解除で ${r.name} を適用し直せませんでした: ${i}`
|
|
10280
10376
|
);
|
|
@@ -10305,7 +10401,7 @@ ${W}
|
|
|
10305
10401
|
return this.downloadFolder = De, "ready";
|
|
10306
10402
|
const e = globalThis.showDirectoryPicker;
|
|
10307
10403
|
if (typeof e != "function")
|
|
10308
|
-
return
|
|
10404
|
+
return g.info(
|
|
10309
10405
|
"Haori",
|
|
10310
10406
|
"この環境では保存先のフォルダを選ばせられないため、今までどおり保存します。"
|
|
10311
10407
|
), "fallback";
|
|
@@ -10313,7 +10409,7 @@ ${W}
|
|
|
10313
10409
|
const t = await e.call(globalThis, { mode: "readwrite" });
|
|
10314
10410
|
return De = t, this.downloadFolder = t, "ready";
|
|
10315
10411
|
} catch (t) {
|
|
10316
|
-
return t?.name === "AbortError" ? "cancelled" : (
|
|
10412
|
+
return t?.name === "AbortError" ? "cancelled" : (g.info(
|
|
10317
10413
|
"Haori",
|
|
10318
10414
|
`保存先のフォルダを選ばせられなかったため、今までどおり保存します: ${t}`
|
|
10319
10415
|
), "fallback");
|
|
@@ -10335,7 +10431,7 @@ ${W}
|
|
|
10335
10431
|
const s = await e.blob();
|
|
10336
10432
|
return this.downloadReceivedBytes = s.size, this.dropTotalBytesIfExceeded(), await this.injectFetchState("loading"), s;
|
|
10337
10433
|
} catch (s) {
|
|
10338
|
-
return
|
|
10434
|
+
return g.error(
|
|
10339
10435
|
"Haori",
|
|
10340
10436
|
`応答をファイルとして読み取れませんでした: ${s}`
|
|
10341
10437
|
), null;
|
|
@@ -10369,7 +10465,7 @@ ${W}
|
|
|
10369
10465
|
a - r >= Ht && (r = a, await this.injectFetchState("loading"));
|
|
10370
10466
|
}
|
|
10371
10467
|
} catch (n) {
|
|
10372
|
-
return
|
|
10468
|
+
return g.error("Haori", `応答をファイルとして読み取れませんでした: ${n}`), !1;
|
|
10373
10469
|
}
|
|
10374
10470
|
return !0;
|
|
10375
10471
|
}
|
|
@@ -10435,7 +10531,7 @@ ${W}
|
|
|
10435
10531
|
if (l?.name === "NotFoundError")
|
|
10436
10532
|
s = !1;
|
|
10437
10533
|
else
|
|
10438
|
-
return
|
|
10534
|
+
return g.info(
|
|
10439
10535
|
"Haori",
|
|
10440
10536
|
`保存先のフォルダを確かめられなかったため、今までどおり保存します: ${l}`
|
|
10441
10537
|
), "fallback";
|
|
@@ -10448,7 +10544,7 @@ ${W}
|
|
|
10448
10544
|
try {
|
|
10449
10545
|
a = await (await e.getFileHandle(n, { create: !0 })).createWritable();
|
|
10450
10546
|
} catch (l) {
|
|
10451
|
-
return
|
|
10547
|
+
return g.info(
|
|
10452
10548
|
"Haori",
|
|
10453
10549
|
`保存先のファイルを作れなかったため、今までどおり保存します: ${l}`
|
|
10454
10550
|
), "fallback";
|
|
@@ -10460,18 +10556,18 @@ ${W}
|
|
|
10460
10556
|
try {
|
|
10461
10557
|
return await a.close(), "saved";
|
|
10462
10558
|
} catch (l) {
|
|
10463
|
-
|
|
10559
|
+
g.error("Haori", `ファイルを書き終えられませんでした: ${l}`);
|
|
10464
10560
|
}
|
|
10465
10561
|
try {
|
|
10466
10562
|
await a.abort();
|
|
10467
10563
|
} catch (l) {
|
|
10468
|
-
|
|
10564
|
+
g.error("Haori", `書きかけを取り消せませんでした: ${l}`);
|
|
10469
10565
|
}
|
|
10470
10566
|
if (!s)
|
|
10471
10567
|
try {
|
|
10472
10568
|
await e.removeEntry(n);
|
|
10473
10569
|
} catch (l) {
|
|
10474
|
-
|
|
10570
|
+
g.error(
|
|
10475
10571
|
"Haori",
|
|
10476
10572
|
`作りかけのファイルを取り除けませんでした: ${l}`
|
|
10477
10573
|
);
|
|
@@ -10508,7 +10604,7 @@ ${W}
|
|
|
10508
10604
|
t ?? this.options.fetchUrl ?? null
|
|
10509
10605
|
);
|
|
10510
10606
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function")
|
|
10511
|
-
return
|
|
10607
|
+
return g.error(
|
|
10512
10608
|
"Haori",
|
|
10513
10609
|
"この環境では Blob の URL を生成できないため、ファイルを保存できません。"
|
|
10514
10610
|
), "failed";
|
|
@@ -10526,8 +10622,8 @@ ${W}
|
|
|
10526
10622
|
* @returns 表示の完了 Promise
|
|
10527
10623
|
*/
|
|
10528
10624
|
async showDownloadFailure(e) {
|
|
10529
|
-
const t = this.
|
|
10530
|
-
await
|
|
10625
|
+
const t = this.resolveMessageScope(), r = pe();
|
|
10626
|
+
await r.clearMessages(t), e && await r.addErrorMessage(t, Qe);
|
|
10531
10627
|
}
|
|
10532
10628
|
/**
|
|
10533
10629
|
* 保存するファイル名を決めます。
|
|
@@ -10570,7 +10666,7 @@ ${W}
|
|
|
10570
10666
|
try {
|
|
10571
10667
|
return decodeURIComponent(a);
|
|
10572
10668
|
} catch (o) {
|
|
10573
|
-
|
|
10669
|
+
g.warn("Haori", `Content-Disposition を解釈できません: ${o}`);
|
|
10574
10670
|
}
|
|
10575
10671
|
}
|
|
10576
10672
|
const r = /filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(e);
|
|
@@ -10621,17 +10717,17 @@ ${W}
|
|
|
10621
10717
|
e.status,
|
|
10622
10718
|
r
|
|
10623
10719
|
);
|
|
10624
|
-
const E = this.selectErrorActions(e.status), A = E?.bind === !0,
|
|
10720
|
+
const E = this.selectErrorActions(e.status), A = E?.bind === !0, D = await this.handleFetchError(
|
|
10625
10721
|
A ? e.clone() : e,
|
|
10626
10722
|
E?.noMessage !== !0 && !A
|
|
10627
10723
|
);
|
|
10628
10724
|
return A && await this.bindResult(e).catch((M) => {
|
|
10629
|
-
|
|
10725
|
+
g.error("Haori", "Failed to bind the error response:", M);
|
|
10630
10726
|
}), await this.injectFetchState(
|
|
10631
10727
|
"error",
|
|
10632
10728
|
e.status,
|
|
10633
10729
|
e.statusText || null,
|
|
10634
|
-
|
|
10730
|
+
D
|
|
10635
10731
|
), await this.runErrorActions(e.status), !1;
|
|
10636
10732
|
}
|
|
10637
10733
|
if (this.options.targetFragment && t && r && O.fetchEnd(
|
|
@@ -10660,10 +10756,11 @@ ${W}
|
|
|
10660
10756
|
), await this.runErrorActions(null), !1;
|
|
10661
10757
|
}
|
|
10662
10758
|
}
|
|
10759
|
+
this.options.clearMessagesOnSuccess && await i.clearMessages(this.resolveMessageScope());
|
|
10663
10760
|
const n = [];
|
|
10664
10761
|
n.push(this.bindResult(e)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), await this.injectFetchState("success", e.status, null), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
10665
10762
|
this.options.resetFragments.map(
|
|
10666
|
-
(E) =>
|
|
10763
|
+
(E) => k.reset(E, this.operationSequence)
|
|
10667
10764
|
)
|
|
10668
10765
|
), await this.copy();
|
|
10669
10766
|
const s = [];
|
|
@@ -10677,10 +10774,10 @@ ${W}
|
|
|
10677
10774
|
);
|
|
10678
10775
|
if (!a && this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((E) => {
|
|
10679
10776
|
const A = E.getTarget();
|
|
10680
|
-
A instanceof HTMLElement ? s.push(i.openDialog(A)) :
|
|
10777
|
+
A instanceof HTMLElement ? s.push(i.openDialog(A)) : g.error("Haori", "Element is not an HTML element: ", A);
|
|
10681
10778
|
}), !a && this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((E) => {
|
|
10682
10779
|
const A = E.getTarget();
|
|
10683
|
-
A instanceof HTMLElement ? s.push(i.closeDialog(A)) :
|
|
10780
|
+
A instanceof HTMLElement ? s.push(i.closeDialog(A)) : g.error("Haori", "Element is not an HTML element: ", A);
|
|
10684
10781
|
}), await Promise.all(s), a)
|
|
10685
10782
|
return !1;
|
|
10686
10783
|
const o = p.unescapeNewlines(
|
|
@@ -10711,15 +10808,15 @@ ${W}
|
|
|
10711
10808
|
const d = this.resolveLateAttribute(
|
|
10712
10809
|
"redirect",
|
|
10713
10810
|
this.options.redirectUrl
|
|
10714
|
-
),
|
|
10811
|
+
), m = this.resolveLateAttribute(
|
|
10715
10812
|
"redirect-replace",
|
|
10716
10813
|
this.options.redirectReplaceUrl
|
|
10717
10814
|
);
|
|
10718
|
-
d &&
|
|
10815
|
+
d && m && g.warn(
|
|
10719
10816
|
"Haori",
|
|
10720
10817
|
`${p.attrName(this.eventType, "redirect")} と ${p.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
10721
10818
|
);
|
|
10722
|
-
const y =
|
|
10819
|
+
const y = m || d;
|
|
10723
10820
|
if (y) {
|
|
10724
10821
|
let E = y;
|
|
10725
10822
|
const A = this.resolveLateAttribute(
|
|
@@ -10730,13 +10827,13 @@ ${W}
|
|
|
10730
10827
|
const M = new URLSearchParams(window.location.search).get(A);
|
|
10731
10828
|
if (M !== null) {
|
|
10732
10829
|
const q = M.trim();
|
|
10733
|
-
bt.isSafeLocalPath(q) ? E = q :
|
|
10830
|
+
bt.isSafeLocalPath(q) ? E = q : g.warn(
|
|
10734
10831
|
"Haori",
|
|
10735
10832
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${M}`
|
|
10736
10833
|
);
|
|
10737
10834
|
}
|
|
10738
10835
|
}
|
|
10739
|
-
|
|
10836
|
+
m ? window.location.replace(E) : window.location.href = E;
|
|
10740
10837
|
}
|
|
10741
10838
|
return !0;
|
|
10742
10839
|
}
|
|
@@ -10774,7 +10871,7 @@ ${W}
|
|
|
10774
10871
|
continue;
|
|
10775
10872
|
const s = p.takeClickOutcome(n);
|
|
10776
10873
|
if (s === null) {
|
|
10777
|
-
|
|
10874
|
+
g.warn(
|
|
10778
10875
|
"Haori",
|
|
10779
10876
|
`${c.prefix}${this.eventType ?? "fetch"}-${r} はこの対象の完了を待てません(手続きが同期に起動していません)。`
|
|
10780
10877
|
);
|
|
@@ -10805,7 +10902,7 @@ ${W}
|
|
|
10805
10902
|
const i = pe(), n = [];
|
|
10806
10903
|
t.closeFragments?.forEach((a) => {
|
|
10807
10904
|
const o = a.getTarget();
|
|
10808
|
-
o instanceof HTMLElement ? n.push(i.closeDialog(o)) :
|
|
10905
|
+
o instanceof HTMLElement ? n.push(i.closeDialog(o)) : g.error("Haori", "Element is not an HTML element: ", o);
|
|
10809
10906
|
}), await Promise.all(n);
|
|
10810
10907
|
const s = p.normalizeAttributeText(
|
|
10811
10908
|
this.resolveLateAttribute(`${t.key}-toast`, t.toastMessage)
|
|
@@ -10870,7 +10967,7 @@ ${W}
|
|
|
10870
10967
|
if (!i || !n || !n.hasAttribute(i.attributeName))
|
|
10871
10968
|
return r;
|
|
10872
10969
|
const s = n.getAttributeEvaluation(i.attributeName);
|
|
10873
|
-
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (V.isEnabled() &&
|
|
10970
|
+
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (V.isEnabled() && g.warn(
|
|
10874
10971
|
"Haori",
|
|
10875
10972
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
10876
10973
|
), r) : s.value ?? null;
|
|
@@ -10892,12 +10989,12 @@ ${W}
|
|
|
10892
10989
|
const a = t ? e : window.location.pathname, o = new URL(a, window.location.href);
|
|
10893
10990
|
if (o.origin !== window.location.origin) {
|
|
10894
10991
|
const u = "history.pushState: cross-origin URL is not allowed: " + o.toString();
|
|
10895
|
-
|
|
10992
|
+
g.error("Haori", u);
|
|
10896
10993
|
return;
|
|
10897
10994
|
}
|
|
10898
10995
|
const l = (u) => {
|
|
10899
|
-
for (const [d,
|
|
10900
|
-
|
|
10996
|
+
for (const [d, m] of Object.entries(u))
|
|
10997
|
+
m != null && (Array.isArray(m) ? (o.searchParams.delete(d), m.forEach((y) => o.searchParams.append(d, String(y)))) : typeof m == "object" ? o.searchParams.set(d, JSON.stringify(m)) : o.searchParams.set(d, String(m)));
|
|
10901
10998
|
};
|
|
10902
10999
|
n && l(r), s && l(i), history.pushState(
|
|
10903
11000
|
{ [Bt]: !0 },
|
|
@@ -10905,9 +11002,21 @@ ${W}
|
|
|
10905
11002
|
o.toString()
|
|
10906
11003
|
), C.refreshUrlParams();
|
|
10907
11004
|
} catch (a) {
|
|
10908
|
-
|
|
11005
|
+
g.error("Haori", `history.pushState failed: ${a}`);
|
|
10909
11006
|
}
|
|
10910
11007
|
}
|
|
11008
|
+
/**
|
|
11009
|
+
* 失敗の表示先(メッセージのスコープ)を解決します。
|
|
11010
|
+
*
|
|
11011
|
+
* フォーム、無ければ対象要素(その祖先のフォームがあればフォーム)、それも
|
|
11012
|
+
* 無ければ `document.body` です(仕様「エラーハンドリング」)。
|
|
11013
|
+
*
|
|
11014
|
+
* @returns 失敗の表示先の要素
|
|
11015
|
+
*/
|
|
11016
|
+
resolveMessageScope() {
|
|
11017
|
+
const e = this.options.formFragment ?? (this.options.targetFragment ? k.getFormFragment(this.options.targetFragment) || this.options.targetFragment : null);
|
|
11018
|
+
return e ? e.getTarget() : document.body;
|
|
11019
|
+
}
|
|
10911
11020
|
/**
|
|
10912
11021
|
* フェッチエラー応答のメッセージを適切な要素へ伝播します。
|
|
10913
11022
|
*
|
|
@@ -10920,7 +11029,7 @@ ${W}
|
|
|
10920
11029
|
*/
|
|
10921
11030
|
async handleFetchError(e, t) {
|
|
10922
11031
|
let r = null;
|
|
10923
|
-
this.options.formFragment ? r = this.options.formFragment : this.options.targetFragment && (r =
|
|
11032
|
+
this.options.formFragment ? r = this.options.formFragment : this.options.targetFragment && (r = k.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
10924
11033
|
const i = r ? r.getTarget() : document.body;
|
|
10925
11034
|
await pe().clearMessages(i);
|
|
10926
11035
|
const n = async (u) => {
|
|
@@ -10929,13 +11038,15 @@ ${W}
|
|
|
10929
11038
|
}, s = () => {
|
|
10930
11039
|
if (!this.options.scrollOnError)
|
|
10931
11040
|
return;
|
|
10932
|
-
const u = r ? r.getTarget() : document.body;
|
|
10933
|
-
(u.getAttribute("data-message-level") === "error" ? u : u.parentElement?.getAttribute("data-message-level") === "error" ? u.parentElement : u.querySelector(
|
|
11041
|
+
const u = r ? r.getTarget() : document.body, d = u.nextElementSibling;
|
|
11042
|
+
(u.getAttribute("data-message-level") === "error" ? u : u.parentElement?.getAttribute("data-message-level") === "error" ? u.parentElement : u.querySelector(
|
|
11043
|
+
'[data-message-level="error"]'
|
|
11044
|
+
) ?? (d?.getAttribute("data-message-level") === "error" ? d : null))?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
10934
11045
|
}, a = async (u) => {
|
|
10935
11046
|
if (t) {
|
|
10936
11047
|
u.length === 0 && await n(`${e.status} ${e.statusText}`);
|
|
10937
11048
|
for (const d of u)
|
|
10938
|
-
d.key && r ? await
|
|
11049
|
+
d.key && r ? await k.addErrorMessage(r, d.key, d.message) : await n(d.message);
|
|
10939
11050
|
s();
|
|
10940
11051
|
}
|
|
10941
11052
|
return u.length === 0 ? null : u.map((d) => d.message).join(`
|
|
@@ -10945,35 +11056,35 @@ ${W}
|
|
|
10945
11056
|
try {
|
|
10946
11057
|
const u = await e.json(), d = [];
|
|
10947
11058
|
if (Array.isArray(u)) {
|
|
10948
|
-
const
|
|
11059
|
+
const m = /* @__PURE__ */ new Map(), y = [];
|
|
10949
11060
|
for (const E of u)
|
|
10950
11061
|
if (E && typeof E == "object" && !Array.isArray(E)) {
|
|
10951
|
-
const A = E.key,
|
|
11062
|
+
const A = E.key, D = E.message, M = typeof A == "string" && A.length > 0 ? A : null, q = typeof D == "string" ? D : D != null ? String(D) : "";
|
|
10952
11063
|
if (q.length === 0)
|
|
10953
11064
|
continue;
|
|
10954
11065
|
if (M !== null) {
|
|
10955
|
-
const I =
|
|
10956
|
-
I.push(q),
|
|
11066
|
+
const I = m.get(M) ?? [];
|
|
11067
|
+
I.push(q), m.set(M, I);
|
|
10957
11068
|
} else
|
|
10958
11069
|
y.push(q);
|
|
10959
11070
|
} else typeof E == "string" && E.length > 0 && y.push(E);
|
|
10960
|
-
for (const [E, A] of
|
|
11071
|
+
for (const [E, A] of m)
|
|
10961
11072
|
d.push({ key: E, message: A.join(`
|
|
10962
11073
|
`) });
|
|
10963
11074
|
for (const E of y)
|
|
10964
11075
|
d.push({ message: E });
|
|
10965
11076
|
} else if (u && typeof u == "object") {
|
|
10966
11077
|
if (typeof u.message == "string" && d.push({ message: u.message }), Array.isArray(u.messages))
|
|
10967
|
-
for (const
|
|
10968
|
-
typeof
|
|
11078
|
+
for (const m of u.messages)
|
|
11079
|
+
typeof m == "string" && d.push({ message: m });
|
|
10969
11080
|
if (u.errors && typeof u.errors == "object")
|
|
10970
|
-
for (const [
|
|
10971
|
-
Array.isArray(y) ? d.push({ key:
|
|
10972
|
-
`) }) : typeof y == "string" ? d.push({ key:
|
|
11081
|
+
for (const [m, y] of Object.entries(u.errors))
|
|
11082
|
+
Array.isArray(y) ? d.push({ key: m, message: y.join(`
|
|
11083
|
+
`) }) : typeof y == "string" ? d.push({ key: m, message: y }) : y != null && d.push({ key: m, message: String(y) });
|
|
10973
11084
|
if (d.length === 0)
|
|
10974
|
-
for (const [
|
|
10975
|
-
|
|
10976
|
-
`) }) : typeof y == "string" && d.push({ key:
|
|
11085
|
+
for (const [m, y] of Object.entries(u))
|
|
11086
|
+
m === "message" || m === "messages" || m === "errors" || (Array.isArray(y) ? d.push({ key: m, message: y.join(`
|
|
11087
|
+
`) }) : typeof y == "string" && d.push({ key: m, message: y }));
|
|
10977
11088
|
}
|
|
10978
11089
|
return await a(d);
|
|
10979
11090
|
} catch {
|
|
@@ -10994,11 +11105,11 @@ ${W}
|
|
|
10994
11105
|
*/
|
|
10995
11106
|
validate(e) {
|
|
10996
11107
|
if (this.options.valid !== !0)
|
|
10997
|
-
return
|
|
11108
|
+
return k.warnUnvalidatedCustomValidity(
|
|
10998
11109
|
e,
|
|
10999
11110
|
`${c.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
11000
11111
|
), !0;
|
|
11001
|
-
|
|
11112
|
+
k.applyCustomValidity(e);
|
|
11002
11113
|
const t = this.findFirstInvalid(e);
|
|
11003
11114
|
if (t === null)
|
|
11004
11115
|
return !0;
|
|
@@ -11089,14 +11200,14 @@ ${W}
|
|
|
11089
11200
|
const r = this.options.targetFragment;
|
|
11090
11201
|
if (!r)
|
|
11091
11202
|
return !0;
|
|
11092
|
-
const i = this.options.conditionAttributeName ?? `${c.prefix}if`, n =
|
|
11203
|
+
const i = this.options.conditionAttributeName ?? `${c.prefix}if`, n = k.buildConditionScope(
|
|
11093
11204
|
r,
|
|
11094
11205
|
this.options.formFragment ?? null
|
|
11095
11206
|
), s = ne.evaluateDetailed(t, n);
|
|
11096
|
-
return s.unresolvedReference ? (e ||
|
|
11207
|
+
return s.unresolvedReference ? (e || g.warn(
|
|
11097
11208
|
"Haori",
|
|
11098
11209
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
11099
|
-
), !1) : s.value ? !0 : (!e && V.isEnabled() &&
|
|
11210
|
+
), !1) : s.value ? !0 : (!e && V.isEnabled() && g.warn(
|
|
11100
11211
|
"Haori",
|
|
11101
11212
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
11102
11213
|
), !1);
|
|
@@ -11158,7 +11269,7 @@ ${W}
|
|
|
11158
11269
|
response: i
|
|
11159
11270
|
});
|
|
11160
11271
|
} catch (o) {
|
|
11161
|
-
|
|
11272
|
+
g.error("Haori", `Invalid bind-transform: ${o}`);
|
|
11162
11273
|
}
|
|
11163
11274
|
if (this.options.bindParams) {
|
|
11164
11275
|
const o = {};
|
|
@@ -11167,7 +11278,7 @@ ${W}
|
|
|
11167
11278
|
}), i = o;
|
|
11168
11279
|
}
|
|
11169
11280
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
11170
|
-
|
|
11281
|
+
g.warn(
|
|
11171
11282
|
"Haori",
|
|
11172
11283
|
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${c.prefix}${this.eventType}-form.`
|
|
11173
11284
|
);
|
|
@@ -11180,7 +11291,7 @@ ${W}
|
|
|
11180
11291
|
if (l.kind === "skip")
|
|
11181
11292
|
return;
|
|
11182
11293
|
if (l.kind === "row") {
|
|
11183
|
-
const
|
|
11294
|
+
const m = this.options.bindArg;
|
|
11184
11295
|
a.push({
|
|
11185
11296
|
container: l.container,
|
|
11186
11297
|
row: o,
|
|
@@ -11189,14 +11300,14 @@ ${W}
|
|
|
11189
11300
|
apply: (y) => {
|
|
11190
11301
|
const E = this.resolveCurrentRowItem(o, y), A = { ...E };
|
|
11191
11302
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
11192
|
-
const
|
|
11193
|
-
A[
|
|
11303
|
+
const D = E[m], M = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
|
|
11304
|
+
A[m] = this.mergeAppendBindingData(
|
|
11194
11305
|
o,
|
|
11195
11306
|
i,
|
|
11196
11307
|
M
|
|
11197
11308
|
);
|
|
11198
11309
|
} else
|
|
11199
|
-
A[
|
|
11310
|
+
A[m] = i;
|
|
11200
11311
|
return this.reconcileRowUserEdits(o, A);
|
|
11201
11312
|
}
|
|
11202
11313
|
});
|
|
@@ -11204,7 +11315,7 @@ ${W}
|
|
|
11204
11315
|
}
|
|
11205
11316
|
const u = { ...o.getRawBindingData() ?? {} }, d = this.options.bindArg;
|
|
11206
11317
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
11207
|
-
const
|
|
11318
|
+
const m = u[d], y = m && typeof m == "object" && !Array.isArray(m) ? m : {};
|
|
11208
11319
|
u[d] = this.mergeAppendBindingData(
|
|
11209
11320
|
o,
|
|
11210
11321
|
i,
|
|
@@ -11235,13 +11346,13 @@ ${W}
|
|
|
11235
11346
|
});
|
|
11236
11347
|
else if (typeof i == "string") {
|
|
11237
11348
|
if (this.options.defaultSelfBind) {
|
|
11238
|
-
|
|
11349
|
+
g.warn(
|
|
11239
11350
|
"Haori",
|
|
11240
11351
|
"string data is not bound because no bind target was specified."
|
|
11241
11352
|
);
|
|
11242
11353
|
return;
|
|
11243
11354
|
}
|
|
11244
|
-
return
|
|
11355
|
+
return g.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
11245
11356
|
new Error("string data cannot be bound without a bindArg.")
|
|
11246
11357
|
);
|
|
11247
11358
|
} else
|
|
@@ -11255,8 +11366,8 @@ ${W}
|
|
|
11255
11366
|
row: o,
|
|
11256
11367
|
attributeName: s,
|
|
11257
11368
|
syncWhenUnchanged: "reflect",
|
|
11258
|
-
apply: (
|
|
11259
|
-
const y = this.options.bindMerge ? this.resolveCurrentRowItem(o,
|
|
11369
|
+
apply: (m) => {
|
|
11370
|
+
const y = this.options.bindMerge ? this.resolveCurrentRowItem(o, m) : m, E = this.mergeAppendBindingData(
|
|
11260
11371
|
o,
|
|
11261
11372
|
i,
|
|
11262
11373
|
y
|
|
@@ -11340,7 +11451,7 @@ ${W}
|
|
|
11340
11451
|
r,
|
|
11341
11452
|
n ? 0 : i
|
|
11342
11453
|
);
|
|
11343
|
-
const s =
|
|
11454
|
+
const s = k.getValuesEditedAfter(
|
|
11344
11455
|
e,
|
|
11345
11456
|
n ? 0 : i
|
|
11346
11457
|
);
|
|
@@ -11374,7 +11485,7 @@ ${W}
|
|
|
11374
11485
|
return t;
|
|
11375
11486
|
const i = this.eventType === "poll";
|
|
11376
11487
|
!i && !this.twoWayCommitBind && C.clearUserEditMarks(e, r);
|
|
11377
|
-
const n =
|
|
11488
|
+
const n = k.getValuesEditedAfter(
|
|
11378
11489
|
e,
|
|
11379
11490
|
i ? 0 : r
|
|
11380
11491
|
);
|
|
@@ -11397,10 +11508,10 @@ ${W}
|
|
|
11397
11508
|
*/
|
|
11398
11509
|
reconcileAncestorArgFormEdits(e, t, r, i) {
|
|
11399
11510
|
let n = t;
|
|
11400
|
-
for (const { form: s, key: a } of
|
|
11511
|
+
for (const { form: s, key: a } of k.collectArgForms(e)) {
|
|
11401
11512
|
if (!r.includes(a))
|
|
11402
11513
|
continue;
|
|
11403
|
-
const o =
|
|
11514
|
+
const o = k.getValuesEditedAfter(s, i);
|
|
11404
11515
|
if (Object.keys(o).length === 0)
|
|
11405
11516
|
continue;
|
|
11406
11517
|
const l = n[a], u = l && typeof l == "object" && !Array.isArray(l) ? l : {};
|
|
@@ -11480,7 +11591,7 @@ ${W}
|
|
|
11480
11591
|
* @returns 行の入力欄の状態を反映した要素データ
|
|
11481
11592
|
*/
|
|
11482
11593
|
resolveCurrentRowItem(e, t) {
|
|
11483
|
-
const r =
|
|
11594
|
+
const r = k.getValuesEditedAfter(e, 0);
|
|
11484
11595
|
return Object.keys(r).length === 0 ? t : me(t, r);
|
|
11485
11596
|
}
|
|
11486
11597
|
/**
|
|
@@ -11525,8 +11636,8 @@ ${W}
|
|
|
11525
11636
|
let t = !1;
|
|
11526
11637
|
const r = this.options.formFragment ?? this.options.selfValueFragment;
|
|
11527
11638
|
if (r) {
|
|
11528
|
-
const i =
|
|
11529
|
-
Object.assign(e, i),
|
|
11639
|
+
const i = k.getValues(r);
|
|
11640
|
+
Object.assign(e, i), k.carryCollectedRowIdentity(i, e);
|
|
11530
11641
|
}
|
|
11531
11642
|
if (this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
|
|
11532
11643
|
const i = p.resolveDataAttributeDetailed(
|
|
@@ -11577,12 +11688,12 @@ ${W}
|
|
|
11577
11688
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
11578
11689
|
n.headers || void 0
|
|
11579
11690
|
), a = (n.method || "GET").toUpperCase(), o = c.runtime === "demo" && !Ue(a), l = o ? "GET" : a;
|
|
11580
|
-
if (n.method = l, Object.keys(t).length > 0 &&
|
|
11691
|
+
if (n.method = l, Object.keys(t).length > 0 && ke(t)) {
|
|
11581
11692
|
const d = s.get("Content-Type") || "";
|
|
11582
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Gt(t) &&
|
|
11693
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Gt(t) && g.warn(
|
|
11583
11694
|
"Haori",
|
|
11584
11695
|
`A File value nested under ${c.prefix}form-object / ${c.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
11585
|
-
) :
|
|
11696
|
+
) : g.warn(
|
|
11586
11697
|
"Haori",
|
|
11587
11698
|
`A File value cannot be sent without ${c.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
11588
11699
|
);
|
|
@@ -11593,17 +11704,17 @@ ${W}
|
|
|
11593
11704
|
const d = s.get("Content-Type") || "";
|
|
11594
11705
|
if (/multipart\/form-data/i.test(d)) {
|
|
11595
11706
|
s.delete("Content-Type");
|
|
11596
|
-
const
|
|
11707
|
+
const m = new FormData();
|
|
11597
11708
|
for (const [y, E] of Object.entries(t))
|
|
11598
|
-
E == null ?
|
|
11599
|
-
A instanceof Blob ?
|
|
11600
|
-
}) :
|
|
11601
|
-
n.body =
|
|
11709
|
+
E == null ? m.append(y, "") : E instanceof Blob ? m.append(y, E) : Array.isArray(E) ? E.forEach((A) => {
|
|
11710
|
+
A instanceof Blob ? m.append(y, A) : m.append(y, Ae(A));
|
|
11711
|
+
}) : m.append(y, Ae(E));
|
|
11712
|
+
n.body = m;
|
|
11602
11713
|
} else if (/application\/x-www-form-urlencoded/i.test(d)) {
|
|
11603
|
-
const
|
|
11714
|
+
const m = new URLSearchParams();
|
|
11604
11715
|
for (const [y, E] of Object.entries(t))
|
|
11605
|
-
E !== void 0 && (Array.isArray(E) ? E.forEach((A) =>
|
|
11606
|
-
n.body =
|
|
11716
|
+
E !== void 0 && (Array.isArray(E) ? E.forEach((A) => m.append(y, Ae(A))) : m.append(y, Ae(E)));
|
|
11717
|
+
n.body = m;
|
|
11607
11718
|
} else
|
|
11608
11719
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
11609
11720
|
}
|
|
@@ -11699,11 +11810,11 @@ ${W}
|
|
|
11699
11810
|
*/
|
|
11700
11811
|
getRowFragment() {
|
|
11701
11812
|
if (!this.options.targetFragment)
|
|
11702
|
-
return
|
|
11813
|
+
return g.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
11703
11814
|
const e = this.options.targetFragment.closestByAttribute(
|
|
11704
11815
|
`${c.prefix}row`
|
|
11705
11816
|
);
|
|
11706
|
-
return e || (
|
|
11817
|
+
return e || (g.error("Haori", "Row fragment not found."), null);
|
|
11707
11818
|
}
|
|
11708
11819
|
/**
|
|
11709
11820
|
* 行操作の対象となる `data-each` コンテナを解決します。
|
|
@@ -11719,20 +11830,20 @@ ${W}
|
|
|
11719
11830
|
resolveRowContainer(e) {
|
|
11720
11831
|
const t = this.options.targetFragment;
|
|
11721
11832
|
if (!t)
|
|
11722
|
-
return
|
|
11833
|
+
return g.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
11723
11834
|
const r = p.attrName(this.eventType, e), i = j.read(t, r);
|
|
11724
11835
|
if (i !== null && i.trim() !== "") {
|
|
11725
11836
|
const s = j.query(i, r, document);
|
|
11726
11837
|
if (s === null)
|
|
11727
|
-
return
|
|
11838
|
+
return g.error(
|
|
11728
11839
|
"Haori",
|
|
11729
11840
|
`Row container not found: ${i} (${r})`
|
|
11730
11841
|
), null;
|
|
11731
11842
|
const a = T.get(s);
|
|
11732
|
-
return a instanceof S ? a.hasAttribute(`${c.prefix}each`) ? a : (
|
|
11843
|
+
return a instanceof S ? a.hasAttribute(`${c.prefix}each`) ? a : (g.error(
|
|
11733
11844
|
"Haori",
|
|
11734
11845
|
`Row container must have ${c.prefix}each: ${i} (${r})`
|
|
11735
|
-
), null) : (
|
|
11846
|
+
), null) : (g.error(
|
|
11736
11847
|
"Haori",
|
|
11737
11848
|
`Row container is not initialized: ${i} (${r})`
|
|
11738
11849
|
), null);
|
|
@@ -11759,45 +11870,45 @@ ${W}
|
|
|
11759
11870
|
static resolveEachArray(e, t = !1) {
|
|
11760
11871
|
const r = e.getRawAttribute(`${c.prefix}each`);
|
|
11761
11872
|
if (r === null)
|
|
11762
|
-
return t ||
|
|
11873
|
+
return t || g.error(
|
|
11763
11874
|
"Haori",
|
|
11764
11875
|
`Row container has no ${c.prefix}each expression.`
|
|
11765
11876
|
), null;
|
|
11766
11877
|
const i = e.getRawAttribute(`${c.prefix}each-array`), n = i !== null, s = n ? `${c.prefix}each-array` : `${c.prefix}each`, a = n ? i : r, o = a.trim().split(".");
|
|
11767
11878
|
if (!(o.length > 0 && o.every((A) => /^[A-Za-z_$][\w$]*$/.test(A))))
|
|
11768
|
-
return t ||
|
|
11879
|
+
return t || g.error(
|
|
11769
11880
|
"Haori",
|
|
11770
11881
|
`Row operations require a plain identifier path for ${s} (got: ${a}).` + (n ? "" : ` Declare ${c.prefix}each-array to specify the array to write back to.`)
|
|
11771
11882
|
), null;
|
|
11772
11883
|
if (n && e.getRawAttribute(`${c.prefix}each-key`) === null)
|
|
11773
|
-
return t ||
|
|
11884
|
+
return t || g.error(
|
|
11774
11885
|
"Haori",
|
|
11775
11886
|
`${c.prefix}each-array requires ${c.prefix}each-key (${c.prefix}each-array="${a}").`
|
|
11776
11887
|
), null;
|
|
11777
11888
|
const u = p.resolveRowScopeBase(e, o[0]);
|
|
11778
11889
|
if (u === "unresolvable")
|
|
11779
11890
|
return null;
|
|
11780
|
-
let d,
|
|
11891
|
+
let d, m, y;
|
|
11781
11892
|
if (u)
|
|
11782
|
-
d = u.owner,
|
|
11893
|
+
d = u.owner, m = u.ownerData, y = [...u.path, ...o.slice(1)];
|
|
11783
11894
|
else {
|
|
11784
|
-
for (d = e,
|
|
11895
|
+
for (d = e, m = null; d; ) {
|
|
11785
11896
|
const A = d.getRawBindingData();
|
|
11786
11897
|
if (A && o[0] in A && !p.isRowScopeKey(d, o[0])) {
|
|
11787
|
-
|
|
11898
|
+
m = A;
|
|
11788
11899
|
break;
|
|
11789
11900
|
}
|
|
11790
11901
|
d = d.getParent();
|
|
11791
11902
|
}
|
|
11792
11903
|
y = o;
|
|
11793
11904
|
}
|
|
11794
|
-
if (!d || !
|
|
11795
|
-
return t ||
|
|
11905
|
+
if (!d || !m)
|
|
11906
|
+
return t || g.error(
|
|
11796
11907
|
"Haori",
|
|
11797
11908
|
`Binding data owner not found for ${s}="${a}".`
|
|
11798
11909
|
), null;
|
|
11799
|
-
const E = p.readPathValue(
|
|
11800
|
-
return Array.isArray(E) ? { owner: d, ownerData:
|
|
11910
|
+
const E = p.readPathValue(m, y);
|
|
11911
|
+
return Array.isArray(E) ? { owner: d, ownerData: m, array: E, path: y, mapped: n } : (t || g.error(
|
|
11801
11912
|
"Haori",
|
|
11802
11913
|
`${s}="${a}" does not resolve to an array.`
|
|
11803
11914
|
), null);
|
|
@@ -11830,7 +11941,7 @@ ${W}
|
|
|
11830
11941
|
if (n.getAttribute(`${c.prefix}each-arg`) === t) {
|
|
11831
11942
|
const s = p.resolveEachArray(n, !0);
|
|
11832
11943
|
if (!s)
|
|
11833
|
-
return
|
|
11944
|
+
return g.error(
|
|
11834
11945
|
"Haori",
|
|
11835
11946
|
`Row operations cannot resolve the write-back array for ${c.prefix}each="${e.getRawAttribute(
|
|
11836
11947
|
`${c.prefix}each`
|
|
@@ -11941,10 +12052,10 @@ ${W}
|
|
|
11941
12052
|
if (!r || !r.has(e))
|
|
11942
12053
|
return { kind: "plain" };
|
|
11943
12054
|
const i = r.get(e) ?? null;
|
|
11944
|
-
return i === null ? (
|
|
12055
|
+
return i === null ? (g.warn(
|
|
11945
12056
|
"Haori",
|
|
11946
12057
|
`Target is not a row of the ${c.prefix}each container (${t}).`
|
|
11947
|
-
), { kind: "skip" }) : p.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (
|
|
12058
|
+
), { kind: "skip" }) : p.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (g.warn(
|
|
11948
12059
|
"Haori",
|
|
11949
12060
|
`The target row is no longer in the ${c.prefix}each container; the write was skipped (${t}).`
|
|
11950
12061
|
), { kind: "skip" });
|
|
@@ -11977,16 +12088,16 @@ ${W}
|
|
|
11977
12088
|
const d = p.resolveRowArrayIndex(u, a);
|
|
11978
12089
|
if (d === null)
|
|
11979
12090
|
continue;
|
|
11980
|
-
const
|
|
11981
|
-
if (
|
|
11982
|
-
|
|
12091
|
+
const m = a[d];
|
|
12092
|
+
if (m === null || typeof m != "object" || Array.isArray(m)) {
|
|
12093
|
+
g.warn(
|
|
11983
12094
|
"Haori",
|
|
11984
12095
|
`Row data is not an object; the write was skipped (${u.attributeName}).`
|
|
11985
12096
|
);
|
|
11986
12097
|
continue;
|
|
11987
12098
|
}
|
|
11988
|
-
const y = u.apply(
|
|
11989
|
-
if (p.isSameRowItem(
|
|
12099
|
+
const y = u.apply(m);
|
|
12100
|
+
if (p.isSameRowItem(m, y)) {
|
|
11990
12101
|
u.syncWhenUnchanged && r.push(
|
|
11991
12102
|
p.syncUnchangedRowValues(
|
|
11992
12103
|
u.row,
|
|
@@ -11996,7 +12107,7 @@ ${W}
|
|
|
11996
12107
|
);
|
|
11997
12108
|
continue;
|
|
11998
12109
|
}
|
|
11999
|
-
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" &&
|
|
12110
|
+
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" && k.clearRowUserEditMarksForChangedKeys(u.row, y);
|
|
12000
12111
|
}
|
|
12001
12112
|
if (!o)
|
|
12002
12113
|
return;
|
|
@@ -12018,7 +12129,7 @@ ${W}
|
|
|
12018
12129
|
);
|
|
12019
12130
|
if (C.isEachUpdateRunning(n)) {
|
|
12020
12131
|
l.catch((u) => {
|
|
12021
|
-
|
|
12132
|
+
g.error("Haori", "Failed to write row data.", u);
|
|
12022
12133
|
});
|
|
12023
12134
|
return;
|
|
12024
12135
|
}
|
|
@@ -12046,7 +12157,7 @@ ${W}
|
|
|
12046
12157
|
* @returns 反映完了の Promise
|
|
12047
12158
|
*/
|
|
12048
12159
|
static syncUnchangedRowValues(e, t, r) {
|
|
12049
|
-
return r === "supply" &&
|
|
12160
|
+
return r === "supply" && k.clearRowUserEditMarksForChangedKeys(e, t), k.syncRowValues(e, t);
|
|
12050
12161
|
}
|
|
12051
12162
|
/**
|
|
12052
12163
|
* 行の要素データが同じ内容かどうかを判定します。
|
|
@@ -12104,27 +12215,27 @@ ${W}
|
|
|
12104
12215
|
static resolveRowIndex(e, t, r, i) {
|
|
12105
12216
|
const n = p.getRowFragments(e), s = n.indexOf(t);
|
|
12106
12217
|
if (s === -1)
|
|
12107
|
-
return
|
|
12218
|
+
return g.warn(
|
|
12108
12219
|
"Haori",
|
|
12109
12220
|
`The target row is no longer in the ${c.prefix}each container; the write was skipped (${i}).`
|
|
12110
12221
|
), null;
|
|
12111
12222
|
const a = e.getAttribute(`${c.prefix}each-key`), o = t.getListKey();
|
|
12112
12223
|
if (a && o !== null) {
|
|
12113
12224
|
const l = [];
|
|
12114
|
-
r.forEach((
|
|
12225
|
+
r.forEach((m, y) => {
|
|
12115
12226
|
C.createListKey(
|
|
12116
|
-
|
|
12227
|
+
m,
|
|
12117
12228
|
String(a),
|
|
12118
12229
|
y
|
|
12119
12230
|
) === o && l.push(y);
|
|
12120
12231
|
});
|
|
12121
|
-
const u = n.slice(0, s).filter((
|
|
12122
|
-
return d === -1 ? (
|
|
12232
|
+
const u = n.slice(0, s).filter((m) => m.getListKey() === o).length, d = l[u] ?? -1;
|
|
12233
|
+
return d === -1 ? (g.warn(
|
|
12123
12234
|
"Haori",
|
|
12124
12235
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
12125
12236
|
), null) : d;
|
|
12126
12237
|
}
|
|
12127
|
-
return s >= r.length ? (
|
|
12238
|
+
return s >= r.length ? (g.warn(
|
|
12128
12239
|
"Haori",
|
|
12129
12240
|
`The target row index is out of range; the write was skipped (${i}).`
|
|
12130
12241
|
), null) : s;
|
|
@@ -12223,14 +12334,14 @@ ${W}
|
|
|
12223
12334
|
() => l(o + 1)
|
|
12224
12335
|
))
|
|
12225
12336
|
return Promise.resolve();
|
|
12226
|
-
const
|
|
12337
|
+
const m = /* @__PURE__ */ new Map();
|
|
12227
12338
|
return a.forEach((y) => {
|
|
12228
12339
|
const E = y.getListKey();
|
|
12229
|
-
E !== null && !
|
|
12340
|
+
E !== null && !m.has(String(E)) && m.set(String(E), y);
|
|
12230
12341
|
}), d.forEach((y, E) => {
|
|
12231
12342
|
if (p.isSameRowItem(i.array[E], y))
|
|
12232
12343
|
return;
|
|
12233
|
-
const A =
|
|
12344
|
+
const A = m.get(
|
|
12234
12345
|
C.createListKey(
|
|
12235
12346
|
y,
|
|
12236
12347
|
null,
|
|
@@ -12314,24 +12425,24 @@ class Xt {
|
|
|
12314
12425
|
try {
|
|
12315
12426
|
r = await fetch(e, t);
|
|
12316
12427
|
} catch (n) {
|
|
12317
|
-
throw
|
|
12428
|
+
throw g.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
12318
12429
|
}
|
|
12319
12430
|
if (!r.ok) {
|
|
12320
12431
|
yt(r.status);
|
|
12321
12432
|
const n = `${r.status} ${r.statusText}`;
|
|
12322
|
-
throw
|
|
12433
|
+
throw g.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
12323
12434
|
}
|
|
12324
12435
|
let i;
|
|
12325
12436
|
try {
|
|
12326
12437
|
i = await r.text();
|
|
12327
12438
|
} catch (n) {
|
|
12328
|
-
throw
|
|
12439
|
+
throw g.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
12329
12440
|
}
|
|
12330
12441
|
try {
|
|
12331
12442
|
const s = new DOMParser().parseFromString(i, "text/html");
|
|
12332
|
-
return s && s.body ? s.body.innerHTML : (
|
|
12443
|
+
return s && s.body ? s.body.innerHTML : (g.warn("[Haori]", "No body found in imported document:", e), i);
|
|
12333
12444
|
} catch (n) {
|
|
12334
|
-
return
|
|
12445
|
+
return g.error("[Haori]", "Failed to parse imported HTML:", e, n), i;
|
|
12335
12446
|
}
|
|
12336
12447
|
}
|
|
12337
12448
|
}
|
|
@@ -12489,7 +12600,7 @@ const f = class f {
|
|
|
12489
12600
|
if (t.has(e) || !e.isInitialized())
|
|
12490
12601
|
return Promise.resolve();
|
|
12491
12602
|
const r = [];
|
|
12492
|
-
return e.hasAttribute(`${c.prefix}validity`) &&
|
|
12603
|
+
return e.hasAttribute(`${c.prefix}validity`) && k.applyCustomValidity(e), e.hasAttribute(`${c.prefix}fetch`) && r.push(f.executeManagedFetch(e)), e.hasAttribute(`${c.prefix}import`) && r.push(f.executeManagedImport(e)), e.isVisible() ? (e.getChildren().forEach((i) => {
|
|
12493
12604
|
i instanceof S && r.push(
|
|
12494
12605
|
f.reevaluateReactiveSpecialAttributes(i, t)
|
|
12495
12606
|
);
|
|
@@ -12507,7 +12618,7 @@ const f = class f {
|
|
|
12507
12618
|
const r = e.getTarget();
|
|
12508
12619
|
if (!t && f.initialValueRestores.size > 0 && e.hasAttribute(`${c.prefix}fetch-form`))
|
|
12509
12620
|
return Promise.all(f.initialValueRestores).then(() => f.executeManagedFetch(e, !0)).catch((a) => {
|
|
12510
|
-
|
|
12621
|
+
g.error("Haori", `初期表示の取得に失敗しました: ${a}`);
|
|
12511
12622
|
}), Promise.resolve();
|
|
12512
12623
|
const i = f.getReactiveFetchState(r), n = oe.resolveAutoFetchSignature(e);
|
|
12513
12624
|
if (i.running)
|
|
@@ -12555,7 +12666,7 @@ const f = class f {
|
|
|
12555
12666
|
});
|
|
12556
12667
|
});
|
|
12557
12668
|
}).catch((a) => {
|
|
12558
|
-
t.removeAttribute(`${c.prefix}importing`), O.importError(t, n, a),
|
|
12669
|
+
t.removeAttribute(`${c.prefix}importing`), O.importError(t, n, a), g.error("[Haori]", "Failed to import HTML:", n, a);
|
|
12559
12670
|
}).finally(() => {
|
|
12560
12671
|
if (r.running = !1, r.rerunRequested)
|
|
12561
12672
|
return r.rerunRequested = !1, f.executeManagedImport(e);
|
|
@@ -12607,7 +12718,7 @@ const f = class f {
|
|
|
12607
12718
|
if (!r)
|
|
12608
12719
|
return Promise.resolve();
|
|
12609
12720
|
const i = f.initializeElementFragment(r, !1).then(
|
|
12610
|
-
() =>
|
|
12721
|
+
() => k.restoreInitialValues(e)
|
|
12611
12722
|
);
|
|
12612
12723
|
return f.initialValueRestores.add(i), i.then(() => {
|
|
12613
12724
|
f.initialValueRestores.delete(i), t && te.applySubtree(e);
|
|
@@ -12721,7 +12832,7 @@ const f = class f {
|
|
|
12721
12832
|
e.getRawAttribute(n)
|
|
12722
12833
|
))), r.add(n));
|
|
12723
12834
|
}
|
|
12724
|
-
return t.then(() => (e.markInitialized(),
|
|
12835
|
+
return t.then(() => (e.markInitialized(), k.prepareFormName(e)));
|
|
12725
12836
|
}
|
|
12726
12837
|
/**
|
|
12727
12838
|
* 子孫初期化をスキップすべきかどうかを返します。
|
|
@@ -12765,22 +12876,22 @@ const f = class f {
|
|
|
12765
12876
|
case `${c.prefix}bind`: {
|
|
12766
12877
|
if (r !== null && i && s instanceof S && s.consumeSelfWrittenBind(r))
|
|
12767
12878
|
break;
|
|
12768
|
-
const
|
|
12879
|
+
const m = r === null ? {} : f.parseDataBind(r);
|
|
12769
12880
|
if (i) {
|
|
12770
12881
|
const y = n ?? S.nextSequence();
|
|
12771
12882
|
return r === null ? (o.push(
|
|
12772
|
-
f.setBindingData(e,
|
|
12883
|
+
f.setBindingData(e, m, {
|
|
12773
12884
|
reflectToAttribute: !1,
|
|
12774
12885
|
sequence: y
|
|
12775
12886
|
})
|
|
12776
12887
|
), o.push(s.removeAttribute(t))) : o.push(
|
|
12777
|
-
f.setBindingData(e,
|
|
12888
|
+
f.setBindingData(e, m, {
|
|
12778
12889
|
sequence: y
|
|
12779
12890
|
})
|
|
12780
12891
|
), Promise.all(o).then(() => {
|
|
12781
12892
|
});
|
|
12782
12893
|
}
|
|
12783
|
-
r === null && s.clearBindingDataCache(), s.setBindingData(
|
|
12894
|
+
r === null && s.clearBindingDataCache(), s.setBindingData(m);
|
|
12784
12895
|
break;
|
|
12785
12896
|
}
|
|
12786
12897
|
case `${c.prefix}derive`:
|
|
@@ -12824,11 +12935,11 @@ const f = class f {
|
|
|
12824
12935
|
break;
|
|
12825
12936
|
case `${c.prefix}validity`:
|
|
12826
12937
|
case `${c.prefix}validity-message`:
|
|
12827
|
-
return r !== null &&
|
|
12938
|
+
return r !== null && k.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
12828
12939
|
});
|
|
12829
12940
|
case `${c.prefix}url-param`: {
|
|
12830
|
-
const
|
|
12831
|
-
|
|
12941
|
+
const m = s.getAttribute(`${c.prefix}url-arg`), y = bt.readParams();
|
|
12942
|
+
m === null && s.hasAttribute(`${c.prefix}store`) && g.warn(
|
|
12832
12943
|
"Haori",
|
|
12833
12944
|
`${c.prefix}url-param を ${c.prefix}url-arg なしで ${c.prefix}store と併用すると復元した値が消えます(${c.prefix}url-arg を指定してください)。`
|
|
12834
12945
|
);
|
|
@@ -12837,11 +12948,11 @@ const f = class f {
|
|
|
12837
12948
|
kind: "nonSupply",
|
|
12838
12949
|
sequence: S.nextSequence()
|
|
12839
12950
|
};
|
|
12840
|
-
if (
|
|
12951
|
+
if (m === null)
|
|
12841
12952
|
o.push(f.setBindingData(e, y, E));
|
|
12842
12953
|
else {
|
|
12843
12954
|
const A = s.getRawBindingData() || {};
|
|
12844
|
-
A[String(
|
|
12955
|
+
A[String(m)] = y, o.push(f.setBindingData(e, A, E));
|
|
12845
12956
|
}
|
|
12846
12957
|
break;
|
|
12847
12958
|
}
|
|
@@ -12850,8 +12961,8 @@ const f = class f {
|
|
|
12850
12961
|
() => d === null ? void 0 : d()
|
|
12851
12962
|
).then(() => {
|
|
12852
12963
|
if (l !== null)
|
|
12853
|
-
return s.setDeriveInputSignature(u), l.then((
|
|
12854
|
-
if (
|
|
12964
|
+
return s.setDeriveInputSignature(u), l.then((m) => {
|
|
12965
|
+
if (m)
|
|
12855
12966
|
return f.reevaluateChildren(s);
|
|
12856
12967
|
});
|
|
12857
12968
|
}).then(() => {
|
|
@@ -12890,31 +13001,31 @@ const f = class f {
|
|
|
12890
13001
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
12891
13002
|
}, d = o === "supply";
|
|
12892
13003
|
d && i.markSupplyApplied(l);
|
|
12893
|
-
const
|
|
13004
|
+
const m = S.currentSequence(), y = i.getRawBindingData();
|
|
12894
13005
|
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i, l);
|
|
12895
13006
|
const E = a ? f.resolveByPathAuthority(i, y, t, u) : t;
|
|
12896
13007
|
i.setBindingData(E), a && (O.bindChange(e, y, E, "manual"), Fe.mirror(i));
|
|
12897
13008
|
const A = () => {
|
|
12898
13009
|
i.markBindingWorkStart();
|
|
12899
|
-
const
|
|
13010
|
+
const D = i.getRawBindingData() ?? E;
|
|
12900
13011
|
let M = a ? i.setAttribute(
|
|
12901
13012
|
`${c.prefix}bind`,
|
|
12902
|
-
JSON.stringify(f.withoutReservedBindingKeys(
|
|
13013
|
+
JSON.stringify(f.withoutReservedBindingKeys(D))
|
|
12903
13014
|
) : Promise.resolve();
|
|
12904
13015
|
return e.tagName === "FORM" && (M = M.then(() => {
|
|
12905
|
-
if (i.wasResetAfter(
|
|
13016
|
+
if (i.wasResetAfter(m))
|
|
12906
13017
|
return;
|
|
12907
13018
|
const q = i.getRawBindingData() ?? E;
|
|
12908
|
-
return
|
|
13019
|
+
return k.syncValues(
|
|
12909
13020
|
i,
|
|
12910
|
-
|
|
13021
|
+
k.resolveSyncValues(i, q),
|
|
12911
13022
|
!1,
|
|
12912
13023
|
u
|
|
12913
13024
|
);
|
|
12914
13025
|
})), M = M.then(
|
|
12915
|
-
() =>
|
|
13026
|
+
() => k.syncAncestorArgForms(i, m, u, y)
|
|
12916
13027
|
), M = M.then(() => f.evaluateAll(i, n)), M = M.then(
|
|
12917
|
-
() => S.retryUnappliedValueWrites(e,
|
|
13028
|
+
() => S.retryUnappliedValueWrites(e, m)
|
|
12918
13029
|
), M = M.then(
|
|
12919
13030
|
() => f.reevaluateReactiveSpecialAttributes(i, n)
|
|
12920
13031
|
), M.then(
|
|
@@ -12981,7 +13092,7 @@ const f = class f {
|
|
|
12981
13092
|
*/
|
|
12982
13093
|
static mergePathAuthority(e, t, r, i, n) {
|
|
12983
13094
|
if (f.isPlainRecord(t) && f.isPlainRecord(r)) {
|
|
12984
|
-
const u = t, d = r,
|
|
13095
|
+
const u = t, d = r, m = {};
|
|
12985
13096
|
let y = Object.keys(u).some(
|
|
12986
13097
|
(A) => !Object.prototype.hasOwnProperty.call(d, A)
|
|
12987
13098
|
);
|
|
@@ -12990,20 +13101,20 @@ const f = class f {
|
|
|
12990
13101
|
...Object.keys(d)
|
|
12991
13102
|
]);
|
|
12992
13103
|
for (const A of E) {
|
|
12993
|
-
const
|
|
13104
|
+
const D = n === "" ? A : `${n}.${A}`, M = f.mergePathAuthority(
|
|
12994
13105
|
e,
|
|
12995
13106
|
Object.prototype.hasOwnProperty.call(u, A) ? u[A] : f.ABSENT_PATH,
|
|
12996
13107
|
Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH,
|
|
12997
13108
|
i,
|
|
12998
|
-
|
|
13109
|
+
D
|
|
12999
13110
|
);
|
|
13000
|
-
M !== f.ABSENT_PATH && (
|
|
13111
|
+
M !== f.ABSENT_PATH && (m[A] = M), M !== (Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH) && (y = !0);
|
|
13001
13112
|
}
|
|
13002
|
-
return y ?
|
|
13113
|
+
return y ? m : d;
|
|
13003
13114
|
}
|
|
13004
13115
|
const s = f.resolveArrayPairing(e, t, r, n);
|
|
13005
13116
|
if (s !== null) {
|
|
13006
|
-
const u = t, d = r,
|
|
13117
|
+
const u = t, d = r, m = d.map(
|
|
13007
13118
|
(y, E) => f.mergePathAuthority(
|
|
13008
13119
|
e,
|
|
13009
13120
|
u[E],
|
|
@@ -13012,7 +13123,7 @@ const f = class f {
|
|
|
13012
13123
|
`${n}[${s[E]}]`
|
|
13013
13124
|
)
|
|
13014
13125
|
);
|
|
13015
|
-
return
|
|
13126
|
+
return m.some((y, E) => y !== d[E]) ? m : d;
|
|
13016
13127
|
}
|
|
13017
13128
|
if (f.isSameBindingValue(t, r))
|
|
13018
13129
|
return r;
|
|
@@ -13186,7 +13297,7 @@ const f = class f {
|
|
|
13186
13297
|
*/
|
|
13187
13298
|
static dumpScope(e) {
|
|
13188
13299
|
const t = f.collectScope(e);
|
|
13189
|
-
return V.isEnabled() &&
|
|
13300
|
+
return V.isEnabled() && g.info("[Haori]", "scope dump for", e, t), t;
|
|
13190
13301
|
}
|
|
13191
13302
|
/**
|
|
13192
13303
|
* スコープの解決結果と由来を収集します。
|
|
@@ -13205,14 +13316,14 @@ const f = class f {
|
|
|
13205
13316
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
13206
13317
|
const u = l.getTarget(), d = f.resolveElementId(u);
|
|
13207
13318
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
13208
|
-
}, s = (l, u, d,
|
|
13319
|
+
}, s = (l, u, d, m) => {
|
|
13209
13320
|
if (l)
|
|
13210
13321
|
for (const y of Object.keys(l))
|
|
13211
13322
|
y in i || (i[y] = {
|
|
13212
13323
|
value: l[y],
|
|
13213
13324
|
source: n(u),
|
|
13214
13325
|
kind: d,
|
|
13215
|
-
depth:
|
|
13326
|
+
depth: m
|
|
13216
13327
|
});
|
|
13217
13328
|
};
|
|
13218
13329
|
let a = t, o = 0;
|
|
@@ -13231,7 +13342,7 @@ const f = class f {
|
|
|
13231
13342
|
try {
|
|
13232
13343
|
return JSON.parse(e);
|
|
13233
13344
|
} catch (t) {
|
|
13234
|
-
return
|
|
13345
|
+
return g.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
13235
13346
|
}
|
|
13236
13347
|
else {
|
|
13237
13348
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -13255,7 +13366,7 @@ const f = class f {
|
|
|
13255
13366
|
if (n) {
|
|
13256
13367
|
if (n.getParent() === r)
|
|
13257
13368
|
return Promise.resolve();
|
|
13258
|
-
if (r.
|
|
13369
|
+
if (r.attachObserved(n, i), n instanceof S)
|
|
13259
13370
|
return f.scan(n.getTarget());
|
|
13260
13371
|
if (n instanceof ae)
|
|
13261
13372
|
return f.evaluateText(n);
|
|
@@ -13306,20 +13417,20 @@ const f = class f {
|
|
|
13306
13417
|
i.push(r.setValue(t));
|
|
13307
13418
|
const n = f.getFormFragment(r);
|
|
13308
13419
|
if (n) {
|
|
13309
|
-
const s =
|
|
13420
|
+
const s = k.getValues(n), a = n.getAttribute(`${c.prefix}form-arg`), o = n.getRawBindingData();
|
|
13310
13421
|
let l;
|
|
13311
13422
|
if (a) {
|
|
13312
13423
|
l = { ...o ?? {} };
|
|
13313
|
-
const u = String(a), d =
|
|
13314
|
-
l[u] =
|
|
13424
|
+
const u = String(a), d = k.resolveAncestorArgOwner(n, u);
|
|
13425
|
+
l[u] = k.mergeCollectedValues(
|
|
13315
13426
|
(d ? d.value : l[u]) ?? null,
|
|
13316
13427
|
s
|
|
13317
13428
|
);
|
|
13318
13429
|
} else
|
|
13319
|
-
l =
|
|
13430
|
+
l = k.mergeCollectedValues(
|
|
13320
13431
|
o,
|
|
13321
13432
|
s,
|
|
13322
|
-
|
|
13433
|
+
k.ancestorBaseResolver(n)
|
|
13323
13434
|
);
|
|
13324
13435
|
i.push(
|
|
13325
13436
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
@@ -13376,14 +13487,14 @@ const f = class f {
|
|
|
13376
13487
|
e.setDeriveInputSignature(E);
|
|
13377
13488
|
})));
|
|
13378
13489
|
}
|
|
13379
|
-
let
|
|
13490
|
+
let m = !1, y = 0;
|
|
13380
13491
|
return n && (r = r.then(() => {
|
|
13381
13492
|
const E = e.isVisible();
|
|
13382
13493
|
return y = S.currentSequence(), f.evaluateIf(e).then(() => {
|
|
13383
|
-
|
|
13494
|
+
m = !E && e.isVisible();
|
|
13384
13495
|
});
|
|
13385
13496
|
})), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => f.evaluateEachFixedChildren(e)).then(() => f.evaluateEach(e)).then(() => {
|
|
13386
|
-
if (
|
|
13497
|
+
if (m)
|
|
13387
13498
|
return f.applyEnhancersOnShow(e, y);
|
|
13388
13499
|
})) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
13389
13500
|
})) : (i && (r = r.then(() => {
|
|
@@ -13478,7 +13589,7 @@ const f = class f {
|
|
|
13478
13589
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
13479
13590
|
return;
|
|
13480
13591
|
if (ne.hasCompileFailure(t)) {
|
|
13481
|
-
|
|
13592
|
+
g.warn(
|
|
13482
13593
|
"[Haori]",
|
|
13483
13594
|
"data-if is hidden because the expression could not be compiled (see the preceding compile error):",
|
|
13484
13595
|
t
|
|
@@ -13494,7 +13605,7 @@ const f = class f {
|
|
|
13494
13605
|
const a = {};
|
|
13495
13606
|
i.forEach((o) => {
|
|
13496
13607
|
o in r && (a[o] = r[o]);
|
|
13497
|
-
}),
|
|
13608
|
+
}), g.info(
|
|
13498
13609
|
"[Haori]",
|
|
13499
13610
|
"data-if is falsy (hidden):",
|
|
13500
13611
|
t,
|
|
@@ -13633,7 +13744,7 @@ const f = class f {
|
|
|
13633
13744
|
static triggerLoadOnShow(e) {
|
|
13634
13745
|
const t = `${c.prefix}load-`;
|
|
13635
13746
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new oe(e, "load").run().catch((i) => {
|
|
13636
|
-
|
|
13747
|
+
g.error("[Haori]", "data-load procedure error (on show):", i);
|
|
13637
13748
|
});
|
|
13638
13749
|
}
|
|
13639
13750
|
/**
|
|
@@ -13746,14 +13857,14 @@ ${r}
|
|
|
13746
13857
|
${r}
|
|
13747
13858
|
`);
|
|
13748
13859
|
} catch (n) {
|
|
13749
|
-
|
|
13860
|
+
g.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
13750
13861
|
}
|
|
13751
13862
|
}
|
|
13752
13863
|
if (i)
|
|
13753
13864
|
try {
|
|
13754
13865
|
i.call(e);
|
|
13755
13866
|
} catch (n) {
|
|
13756
|
-
|
|
13867
|
+
g.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
13757
13868
|
}
|
|
13758
13869
|
}
|
|
13759
13870
|
/**
|
|
@@ -13784,7 +13895,7 @@ ${r}
|
|
|
13784
13895
|
return;
|
|
13785
13896
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
13786
13897
|
let n = !1;
|
|
13787
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (f.EACH_RENDERED_CHANGE_WARNED.has(r) || (f.EACH_RENDERED_CHANGE_WARNED.add(r),
|
|
13898
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (f.EACH_RENDERED_CHANGE_WARNED.has(r) || (f.EACH_RENDERED_CHANGE_WARNED.add(r), g.warn(
|
|
13788
13899
|
"[Haori]",
|
|
13789
13900
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
13790
13901
|
))), f.countEachRenderedRows(e) !== 0) {
|
|
@@ -13796,7 +13907,7 @@ ${r}
|
|
|
13796
13907
|
try {
|
|
13797
13908
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
13798
13909
|
} catch (s) {
|
|
13799
|
-
|
|
13910
|
+
g.error("[Haori]", `each-rendered-change dispatch error: ${s}`);
|
|
13800
13911
|
}
|
|
13801
13912
|
}
|
|
13802
13913
|
}
|
|
@@ -13890,7 +14001,7 @@ ${r}
|
|
|
13890
14001
|
*/
|
|
13891
14002
|
static resolveEachItems(e) {
|
|
13892
14003
|
const t = e.getAttributeEvaluation(`${c.prefix}each`), r = t?.value;
|
|
13893
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
14004
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (g.error("[Haori]", "Invalid each attribute:", r), null);
|
|
13894
14005
|
}
|
|
13895
14006
|
/**
|
|
13896
14007
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -14100,7 +14211,7 @@ ${r}
|
|
|
14100
14211
|
});
|
|
14101
14212
|
return Promise.all(r).then(() => {
|
|
14102
14213
|
}).catch((i) => {
|
|
14103
|
-
|
|
14214
|
+
g.error("Haori", `${e} を読み直せませんでした: ${i}`);
|
|
14104
14215
|
});
|
|
14105
14216
|
}
|
|
14106
14217
|
/**
|
|
@@ -14232,7 +14343,7 @@ ${r}
|
|
|
14232
14343
|
*/
|
|
14233
14344
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
14234
14345
|
const r = f.getOrCreateDerivedSubtreeProfile(e);
|
|
14235
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
14346
|
+
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), g.info("[Haori][derive-profile]", {
|
|
14236
14347
|
reason: t,
|
|
14237
14348
|
hostId: r.hostId,
|
|
14238
14349
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -14299,7 +14410,7 @@ ${r}
|
|
|
14299
14410
|
static updateDiff(e, t) {
|
|
14300
14411
|
const r = e.getTemplate();
|
|
14301
14412
|
if (r === null)
|
|
14302
|
-
return
|
|
14413
|
+
return g.error(
|
|
14303
14414
|
"[Haori]",
|
|
14304
14415
|
`Template is not set for ${c.prefix}each="${e.getRawAttribute(`${c.prefix}each`)}". The container needs one element child as the row template.`,
|
|
14305
14416
|
e.getTarget()
|
|
@@ -14316,7 +14427,7 @@ ${r}
|
|
|
14316
14427
|
let d = e.getChildren().filter((I) => I instanceof S).filter(
|
|
14317
14428
|
(I) => !I.hasAttribute(`${c.prefix}each-before`) && !I.hasAttribute(`${c.prefix}each-after`)
|
|
14318
14429
|
);
|
|
14319
|
-
const
|
|
14430
|
+
const m = d.map((I) => I.getListKey()), y = /* @__PURE__ */ new Set();
|
|
14320
14431
|
d = d.filter((I, K) => {
|
|
14321
14432
|
const J = String(I.getListKey()), re = l.get(J) ?? 0;
|
|
14322
14433
|
if (re === 0) {
|
|
@@ -14334,7 +14445,7 @@ ${r}
|
|
|
14334
14445
|
const J = A.get(K);
|
|
14335
14446
|
J ? J.push(I) : A.set(K, [I]);
|
|
14336
14447
|
});
|
|
14337
|
-
const
|
|
14448
|
+
const D = e.getChildElementFragments().filter((I) => !y.has(I)), M = D.filter(
|
|
14338
14449
|
(I) => I.hasAttribute(`${c.prefix}each-before`)
|
|
14339
14450
|
).length;
|
|
14340
14451
|
let q = Promise.resolve();
|
|
@@ -14354,14 +14465,14 @@ ${r}
|
|
|
14354
14465
|
s ? String(s) : null,
|
|
14355
14466
|
I
|
|
14356
14467
|
).then(
|
|
14357
|
-
(
|
|
14468
|
+
(F) => (
|
|
14358
14469
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
14359
14470
|
// ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
|
|
14360
14471
|
// される)で DOM の順序が古いまま残る。
|
|
14361
14472
|
f.repositionEachRow(
|
|
14362
14473
|
e,
|
|
14363
14474
|
H,
|
|
14364
|
-
|
|
14475
|
+
D,
|
|
14365
14476
|
G
|
|
14366
14477
|
).then(($) => {
|
|
14367
14478
|
if ($ !== null && O.rowMove(
|
|
@@ -14369,7 +14480,7 @@ ${r}
|
|
|
14369
14480
|
I,
|
|
14370
14481
|
$ - M,
|
|
14371
14482
|
K
|
|
14372
|
-
), !(!
|
|
14483
|
+
), !(!F && f.isRowLocalEachTemplate(e)))
|
|
14373
14484
|
return f.evaluateAll(H).then(
|
|
14374
14485
|
() => f.applyRowFormValues(e, H, J)
|
|
14375
14486
|
);
|
|
@@ -14389,9 +14500,9 @@ ${r}
|
|
|
14389
14500
|
s ? String(s) : null,
|
|
14390
14501
|
I
|
|
14391
14502
|
).then(() => {
|
|
14392
|
-
const
|
|
14393
|
-
return e.insertBefore(H,
|
|
14394
|
-
|
|
14503
|
+
const F = D[G] ?? null;
|
|
14504
|
+
return e.insertBefore(H, F).then(() => {
|
|
14505
|
+
D.splice(G, 0, H);
|
|
14395
14506
|
}).then(() => f.initializeFreshEachRow(H)).then(() => f.applyRowFormValues(e, H, J)).then(() => {
|
|
14396
14507
|
O.rowAdd(H.getTarget(), I, re, J);
|
|
14397
14508
|
});
|
|
@@ -14403,7 +14514,7 @@ ${r}
|
|
|
14403
14514
|
(G) => G !== null
|
|
14404
14515
|
), K = E.filter(
|
|
14405
14516
|
(G) => G !== null
|
|
14406
|
-
), J = new Set(K), re = I.filter((G) => !J.has(G)), _ =
|
|
14517
|
+
), J = new Set(K), re = I.filter((G) => !J.has(G)), _ = m.filter(
|
|
14407
14518
|
(G) => G !== null
|
|
14408
14519
|
).filter(
|
|
14409
14520
|
(G) => !o.has(G)
|
|
@@ -14445,7 +14556,7 @@ ${r}
|
|
|
14445
14556
|
).filter(
|
|
14446
14557
|
(r) => !r.hasAttribute(`${c.prefix}each-before`) && !r.hasAttribute(`${c.prefix}each-after`)
|
|
14447
14558
|
);
|
|
14448
|
-
t.length !== 0 &&
|
|
14559
|
+
t.length !== 0 && g.warn(
|
|
14449
14560
|
"[Haori]",
|
|
14450
14561
|
`${c.prefix}each="${e.getRawAttribute(`${c.prefix}each`)}" のコンテナに要素の子が 2 つ以上あります。テンプレートになるのは最初の子だけで、残り ${t.length} 個は行に入りません(${t.map((r) => r.getTarget().tagName.toLowerCase()).join(", ")})。行の中身は 1 つの要素で包んでください。`,
|
|
14451
14562
|
e.getTarget()
|
|
@@ -14463,7 +14574,7 @@ ${r}
|
|
|
14463
14574
|
* @returns 戻り値はありません。
|
|
14464
14575
|
*/
|
|
14465
14576
|
static warnDuplicateEachKey(e) {
|
|
14466
|
-
!V.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e),
|
|
14577
|
+
!V.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e), g.warn(
|
|
14467
14578
|
"[Haori]",
|
|
14468
14579
|
`${c.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
14469
14580
|
));
|
|
@@ -14515,7 +14626,7 @@ ${r}
|
|
|
14515
14626
|
* @returns 反映完了の Promise
|
|
14516
14627
|
*/
|
|
14517
14628
|
static applyRowFormValues(e, t, r) {
|
|
14518
|
-
return !e.hasAttribute(`${c.prefix}form-list`) || !
|
|
14629
|
+
return !e.hasAttribute(`${c.prefix}form-list`) || !k.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : k.syncRowValues(t, r);
|
|
14519
14630
|
}
|
|
14520
14631
|
/**
|
|
14521
14632
|
* リスト比較用のキーを生成します。
|
|
@@ -14560,7 +14671,7 @@ ${r}
|
|
|
14560
14671
|
else if (n)
|
|
14561
14672
|
a = { [n]: t };
|
|
14562
14673
|
else
|
|
14563
|
-
return
|
|
14674
|
+
return g.error(
|
|
14564
14675
|
"[Haori]",
|
|
14565
14676
|
`Primitive value requires '${c.prefix}each-arg' attribute: ${t}`
|
|
14566
14677
|
), Promise.resolve(!1);
|
|
@@ -14712,7 +14823,7 @@ const Re = class Re {
|
|
|
14712
14823
|
*/
|
|
14713
14824
|
constructor(e = document) {
|
|
14714
14825
|
this.customEventHandlers = /* @__PURE__ */ new Map(), this.builtinListenersAdded = !1, this.deferred = !1, this.deferredProcedures = [], this.onClick = (t) => this.delegate(t, "click"), this.onReset = (t) => {
|
|
14715
|
-
if (t.defaultPrevented ||
|
|
14826
|
+
if (t.defaultPrevented || k.isResettingInternally())
|
|
14716
14827
|
return;
|
|
14717
14828
|
const r = t.target;
|
|
14718
14829
|
r instanceof HTMLElement && setTimeout(() => te.refreshSubtree(r), 0);
|
|
@@ -14780,7 +14891,7 @@ const Re = class Re {
|
|
|
14780
14891
|
try {
|
|
14781
14892
|
t();
|
|
14782
14893
|
} catch (r) {
|
|
14783
|
-
|
|
14894
|
+
g.error("[Haori]", "Deferred event handling error:", r);
|
|
14784
14895
|
}
|
|
14785
14896
|
}
|
|
14786
14897
|
/**
|
|
@@ -14833,7 +14944,7 @@ const Re = class Re {
|
|
|
14833
14944
|
if (e === null || e === "")
|
|
14834
14945
|
return;
|
|
14835
14946
|
if (Re.BUILTIN_EVENT_NAMES.has(e)) {
|
|
14836
|
-
|
|
14947
|
+
g.warn(
|
|
14837
14948
|
"[Haori]",
|
|
14838
14949
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
14839
14950
|
);
|
|
@@ -14863,7 +14974,7 @@ const Re = class Re {
|
|
|
14863
14974
|
return;
|
|
14864
14975
|
const n = T.get(i);
|
|
14865
14976
|
n instanceof S && this.isFromTarget(n, t) && new oe(n, "on", t).run().catch((s) => {
|
|
14866
|
-
|
|
14977
|
+
g.error("[Haori]", "Procedure execution error:", s);
|
|
14867
14978
|
});
|
|
14868
14979
|
});
|
|
14869
14980
|
}
|
|
@@ -14950,7 +15061,7 @@ const Re = class Re {
|
|
|
14950
15061
|
return;
|
|
14951
15062
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
14952
15063
|
const n = () => {
|
|
14953
|
-
const s = new oe(i, t, r).runWithOutcome().catch((a) => (
|
|
15064
|
+
const s = new oe(i, t, r).runWithOutcome().catch((a) => (g.error("[Haori]", "Procedure execution error:", a), "failure"));
|
|
14954
15065
|
if (t === "click") {
|
|
14955
15066
|
oe.recordClickOutcome(e, s);
|
|
14956
15067
|
const a = r.target;
|
|
@@ -15184,7 +15295,7 @@ const U = class U {
|
|
|
15184
15295
|
new oe(t.fragment, "intersect").runWithResult().then((i) => {
|
|
15185
15296
|
r = i;
|
|
15186
15297
|
}).catch((i) => {
|
|
15187
|
-
|
|
15298
|
+
g.error("[Haori]", "Intersect procedure execution error:", i);
|
|
15188
15299
|
}).finally(() => {
|
|
15189
15300
|
const i = U.registrations.get(e);
|
|
15190
15301
|
if (i) {
|
|
@@ -15252,7 +15363,7 @@ const U = class U {
|
|
|
15252
15363
|
if (typeof r != "string" || r.trim() === "")
|
|
15253
15364
|
return null;
|
|
15254
15365
|
const i = j.query(r, t, document);
|
|
15255
|
-
return U.isHtmlElement(i) ? i : (
|
|
15366
|
+
return U.isHtmlElement(i) ? i : (g.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
15256
15367
|
}
|
|
15257
15368
|
static resolveRootMargin(e) {
|
|
15258
15369
|
const t = `${c.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
@@ -15280,7 +15391,7 @@ U.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
15280
15391
|
"once"
|
|
15281
15392
|
]), U.registrations = /* @__PURE__ */ new Map();
|
|
15282
15393
|
let ve = U;
|
|
15283
|
-
const
|
|
15394
|
+
const w = class w {
|
|
15284
15395
|
/**
|
|
15285
15396
|
* 指定ノードとその子孫を走査し、`data-poll-*` の監視状態を同期します。
|
|
15286
15397
|
*
|
|
@@ -15288,8 +15399,8 @@ const v = class v {
|
|
|
15288
15399
|
* @returns 戻り値はありません。
|
|
15289
15400
|
*/
|
|
15290
15401
|
static syncTree(e) {
|
|
15291
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
15292
|
-
|
|
15402
|
+
(e instanceof Element || e instanceof DocumentFragment) && (w.isHtmlElement(e) && w.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
15403
|
+
w.syncElement(t);
|
|
15293
15404
|
}));
|
|
15294
15405
|
}
|
|
15295
15406
|
/**
|
|
@@ -15302,23 +15413,23 @@ const v = class v {
|
|
|
15302
15413
|
* @returns 戻り値はありません。
|
|
15303
15414
|
*/
|
|
15304
15415
|
static syncElement(e) {
|
|
15305
|
-
const t =
|
|
15306
|
-
if (!t && !
|
|
15416
|
+
const t = w.registrations.get(e);
|
|
15417
|
+
if (!t && !w.hasPollAttribute(e))
|
|
15307
15418
|
return;
|
|
15308
15419
|
const r = T.get(e);
|
|
15309
|
-
if (!(r instanceof S) || !
|
|
15310
|
-
t &&
|
|
15420
|
+
if (!(r instanceof S) || !w.shouldObserve(r)) {
|
|
15421
|
+
t && w.teardown(e, t);
|
|
15311
15422
|
return;
|
|
15312
15423
|
}
|
|
15313
|
-
const i =
|
|
15424
|
+
const i = w.buildConfigKey(r);
|
|
15314
15425
|
if (t) {
|
|
15315
15426
|
if (t.configKey === i) {
|
|
15316
15427
|
t.fragment = r;
|
|
15317
15428
|
return;
|
|
15318
15429
|
}
|
|
15319
|
-
|
|
15430
|
+
w.teardown(e, t);
|
|
15320
15431
|
}
|
|
15321
|
-
|
|
15432
|
+
w.startPolling(e, r, i);
|
|
15322
15433
|
}
|
|
15323
15434
|
/**
|
|
15324
15435
|
* 指定ノードとその子孫の監視を解除します。
|
|
@@ -15330,13 +15441,13 @@ const v = class v {
|
|
|
15330
15441
|
* @returns 戻り値はありません。
|
|
15331
15442
|
*/
|
|
15332
15443
|
static cleanupTree(e) {
|
|
15333
|
-
if (
|
|
15334
|
-
const t =
|
|
15335
|
-
t &&
|
|
15444
|
+
if (w.isHtmlElement(e)) {
|
|
15445
|
+
const t = w.registrations.get(e);
|
|
15446
|
+
t && w.teardown(e, t);
|
|
15336
15447
|
}
|
|
15337
15448
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
15338
|
-
const r =
|
|
15339
|
-
r &&
|
|
15449
|
+
const r = w.registrations.get(t);
|
|
15450
|
+
r && w.teardown(t, r);
|
|
15340
15451
|
});
|
|
15341
15452
|
}
|
|
15342
15453
|
/**
|
|
@@ -15345,12 +15456,12 @@ const v = class v {
|
|
|
15345
15456
|
* @returns 戻り値はありません。
|
|
15346
15457
|
*/
|
|
15347
15458
|
static disconnectAll() {
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
}),
|
|
15459
|
+
w.registrations.forEach((e) => {
|
|
15460
|
+
w.clearTimers(e);
|
|
15461
|
+
}), w.registrations.clear(), w.visibilityListener && typeof document < "u" && document.removeEventListener(
|
|
15351
15462
|
"visibilitychange",
|
|
15352
|
-
|
|
15353
|
-
),
|
|
15463
|
+
w.visibilityListener
|
|
15464
|
+
), w.visibilityListener = null;
|
|
15354
15465
|
}
|
|
15355
15466
|
/**
|
|
15356
15467
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -15392,7 +15503,7 @@ const v = class v {
|
|
|
15392
15503
|
*/
|
|
15393
15504
|
static shouldObserve(e) {
|
|
15394
15505
|
const t = `${c.prefix}poll-`;
|
|
15395
|
-
return e.getAttributeNames().some((r) => r.startsWith(t) ? !
|
|
15506
|
+
return e.getAttributeNames().some((r) => r.startsWith(t) ? !w.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
15396
15507
|
}
|
|
15397
15508
|
/**
|
|
15398
15509
|
* 設定の同一性を判定するキーを組み立てます。
|
|
@@ -15424,9 +15535,9 @@ const v = class v {
|
|
|
15424
15535
|
const i = {
|
|
15425
15536
|
fragment: t,
|
|
15426
15537
|
configKey: r,
|
|
15427
|
-
intervalMs:
|
|
15428
|
-
timeoutMs:
|
|
15429
|
-
errorLimit:
|
|
15538
|
+
intervalMs: w.resolveInterval(t),
|
|
15539
|
+
timeoutMs: w.resolveTimeout(t),
|
|
15540
|
+
errorLimit: w.resolveErrorLimit(t),
|
|
15430
15541
|
startedAt: performance.now(),
|
|
15431
15542
|
intervalTimerId: null,
|
|
15432
15543
|
timeoutTimerId: null,
|
|
@@ -15438,9 +15549,9 @@ const v = class v {
|
|
|
15438
15549
|
count: 0,
|
|
15439
15550
|
consecutiveErrors: 0
|
|
15440
15551
|
};
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
}, i.timeoutMs)),
|
|
15552
|
+
w.registrations.set(e, i), w.ensureVisibilityListener(), i.timeoutMs !== null && (i.timeoutTimerId = setTimeout(() => {
|
|
15553
|
+
w.handleTimeout(e);
|
|
15554
|
+
}, i.timeoutMs)), w.injectState(i), w.tick(e);
|
|
15444
15555
|
}
|
|
15445
15556
|
/**
|
|
15446
15557
|
* 1回分のポーリング処理を実行し、継続する場合は次回を予約します。
|
|
@@ -15449,20 +15560,20 @@ const v = class v {
|
|
|
15449
15560
|
* @returns 処理完了の Promise
|
|
15450
15561
|
*/
|
|
15451
15562
|
static async tick(e) {
|
|
15452
|
-
const t =
|
|
15563
|
+
const t = w.registrations.get(e);
|
|
15453
15564
|
if (!t || t.stopped || t.fetching)
|
|
15454
15565
|
return;
|
|
15455
15566
|
if (t.intervalTimerId = null, !e.isConnected) {
|
|
15456
|
-
await
|
|
15567
|
+
await w.stop(e, t, "detached");
|
|
15457
15568
|
return;
|
|
15458
15569
|
}
|
|
15459
|
-
const r =
|
|
15460
|
-
if (r !== t.paused && (t.paused = r, await
|
|
15461
|
-
|
|
15570
|
+
const r = w.isHidden(e) || w.isDisabled(t.fragment);
|
|
15571
|
+
if (r !== t.paused && (t.paused = r, await w.injectState(t)), r) {
|
|
15572
|
+
w.schedule(e, t);
|
|
15462
15573
|
return;
|
|
15463
15574
|
}
|
|
15464
|
-
if (
|
|
15465
|
-
await
|
|
15575
|
+
if (w.isUntilSatisfied(t.fragment)) {
|
|
15576
|
+
await w.stop(e, t, "until");
|
|
15466
15577
|
return;
|
|
15467
15578
|
}
|
|
15468
15579
|
t.fetching = !0, t.count += 1;
|
|
@@ -15473,22 +15584,22 @@ const v = class v {
|
|
|
15473
15584
|
"poll"
|
|
15474
15585
|
).runWithResult();
|
|
15475
15586
|
} catch (n) {
|
|
15476
|
-
|
|
15587
|
+
g.error("[Haori]", "Poll procedure execution error:", n);
|
|
15477
15588
|
} finally {
|
|
15478
15589
|
t.fetching = !1;
|
|
15479
15590
|
}
|
|
15480
|
-
if (!(
|
|
15591
|
+
if (!(w.registrations.get(e) !== t || t.stopped)) {
|
|
15481
15592
|
if (i)
|
|
15482
15593
|
t.consecutiveErrors = 0;
|
|
15483
15594
|
else if (t.consecutiveErrors += 1, t.errorLimit !== null && t.consecutiveErrors >= t.errorLimit) {
|
|
15484
|
-
await
|
|
15595
|
+
await w.stop(e, t, "error");
|
|
15485
15596
|
return;
|
|
15486
15597
|
}
|
|
15487
|
-
if (i &&
|
|
15488
|
-
await
|
|
15598
|
+
if (i && w.isUntilSatisfied(t.fragment)) {
|
|
15599
|
+
await w.stop(e, t, "until");
|
|
15489
15600
|
return;
|
|
15490
15601
|
}
|
|
15491
|
-
|
|
15602
|
+
w.schedule(e, t);
|
|
15492
15603
|
}
|
|
15493
15604
|
}
|
|
15494
15605
|
/**
|
|
@@ -15503,7 +15614,7 @@ const v = class v {
|
|
|
15503
15614
|
*/
|
|
15504
15615
|
static schedule(e, t) {
|
|
15505
15616
|
t.stopped || t.intervalTimerId !== null || (t.intervalTimerId = setTimeout(() => {
|
|
15506
|
-
|
|
15617
|
+
w.tick(e);
|
|
15507
15618
|
}, t.intervalMs));
|
|
15508
15619
|
}
|
|
15509
15620
|
/**
|
|
@@ -15513,12 +15624,12 @@ const v = class v {
|
|
|
15513
15624
|
* @returns 処理完了の Promise
|
|
15514
15625
|
*/
|
|
15515
15626
|
static async handleTimeout(e) {
|
|
15516
|
-
const t =
|
|
15627
|
+
const t = w.registrations.get(e);
|
|
15517
15628
|
!t || t.stopped || (t.timeoutTimerId = null, t.timedOut = !0, e.isConnected && O.pollTimeout(
|
|
15518
15629
|
e,
|
|
15519
15630
|
t.count,
|
|
15520
|
-
|
|
15521
|
-
), await
|
|
15631
|
+
w.elapsed(t)
|
|
15632
|
+
), await w.stop(e, t, "timeout"));
|
|
15522
15633
|
}
|
|
15523
15634
|
/**
|
|
15524
15635
|
* ポーリングを恒久停止します。
|
|
@@ -15530,15 +15641,15 @@ const v = class v {
|
|
|
15530
15641
|
*/
|
|
15531
15642
|
static async stop(e, t, r) {
|
|
15532
15643
|
if (!t.stopped) {
|
|
15533
|
-
if (t.stopped = !0, t.stopReason = r, t.paused = !1,
|
|
15534
|
-
|
|
15644
|
+
if (t.stopped = !0, t.stopReason = r, t.paused = !1, w.clearTimers(t), r === "detached") {
|
|
15645
|
+
w.registrations.delete(e);
|
|
15535
15646
|
return;
|
|
15536
15647
|
}
|
|
15537
|
-
await
|
|
15648
|
+
await w.injectState(t), e.isConnected && O.pollStop(
|
|
15538
15649
|
e,
|
|
15539
15650
|
r,
|
|
15540
15651
|
t.count,
|
|
15541
|
-
|
|
15652
|
+
w.elapsed(t)
|
|
15542
15653
|
);
|
|
15543
15654
|
}
|
|
15544
15655
|
}
|
|
@@ -15550,7 +15661,7 @@ const v = class v {
|
|
|
15550
15661
|
* @returns 戻り値はありません。
|
|
15551
15662
|
*/
|
|
15552
15663
|
static teardown(e, t) {
|
|
15553
|
-
|
|
15664
|
+
w.clearTimers(t), w.registrations.delete(e);
|
|
15554
15665
|
}
|
|
15555
15666
|
/**
|
|
15556
15667
|
* 登録情報が持つタイマーをすべて破棄します。
|
|
@@ -15579,16 +15690,16 @@ const v = class v {
|
|
|
15579
15690
|
* @returns 戻り値はありません。
|
|
15580
15691
|
*/
|
|
15581
15692
|
static ensureVisibilityListener() {
|
|
15582
|
-
if (
|
|
15693
|
+
if (w.visibilityListener || typeof document > "u")
|
|
15583
15694
|
return;
|
|
15584
15695
|
const e = () => {
|
|
15585
|
-
document.visibilityState === "visible" && Array.from(
|
|
15696
|
+
document.visibilityState === "visible" && Array.from(w.registrations.entries()).forEach(
|
|
15586
15697
|
([t, r]) => {
|
|
15587
|
-
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null),
|
|
15698
|
+
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null), w.tick(t));
|
|
15588
15699
|
}
|
|
15589
15700
|
);
|
|
15590
15701
|
};
|
|
15591
|
-
|
|
15702
|
+
w.visibilityListener = e, document.addEventListener("visibilitychange", e);
|
|
15592
15703
|
}
|
|
15593
15704
|
/**
|
|
15594
15705
|
* `_poll` 状態を注入先のバインディングデータへ反映します。
|
|
@@ -15602,7 +15713,7 @@ const v = class v {
|
|
|
15602
15713
|
* @returns 注入完了の Promise
|
|
15603
15714
|
*/
|
|
15604
15715
|
static injectState(e) {
|
|
15605
|
-
const t =
|
|
15716
|
+
const t = w.resolveStateFragments(e);
|
|
15606
15717
|
if (t.length === 0)
|
|
15607
15718
|
return Promise.resolve();
|
|
15608
15719
|
const r = {
|
|
@@ -15612,7 +15723,7 @@ const v = class v {
|
|
|
15612
15723
|
timedOut: e.timedOut,
|
|
15613
15724
|
stopReason: e.stopReason,
|
|
15614
15725
|
count: e.count,
|
|
15615
|
-
elapsedMs:
|
|
15726
|
+
elapsedMs: w.elapsed(e)
|
|
15616
15727
|
};
|
|
15617
15728
|
return Promise.all(
|
|
15618
15729
|
t.map((i) => {
|
|
@@ -15653,7 +15764,7 @@ const v = class v {
|
|
|
15653
15764
|
document
|
|
15654
15765
|
);
|
|
15655
15766
|
if (n.length === 0)
|
|
15656
|
-
return
|
|
15767
|
+
return g.error("[Haori]", `Poll state element not found: ${i}`), [];
|
|
15657
15768
|
const s = [];
|
|
15658
15769
|
return n.forEach((a) => {
|
|
15659
15770
|
if (!a.isConnected)
|
|
@@ -15674,15 +15785,15 @@ const v = class v {
|
|
|
15674
15785
|
static resolveInterval(e) {
|
|
15675
15786
|
const t = `${c.prefix}poll-interval`;
|
|
15676
15787
|
if (!e.hasAttribute(t))
|
|
15677
|
-
return
|
|
15678
|
-
const r =
|
|
15679
|
-
return r === null ? (
|
|
15788
|
+
return w.DEFAULT_INTERVAL_MS;
|
|
15789
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15790
|
+
return r === null ? (g.warn(
|
|
15680
15791
|
"[Haori]",
|
|
15681
|
-
`${t} は数値で指定してください。既定値 ${
|
|
15682
|
-
),
|
|
15792
|
+
`${t} は数値で指定してください。既定値 ${w.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
15793
|
+
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (g.warn(
|
|
15683
15794
|
"[Haori]",
|
|
15684
|
-
`${t} の下限は ${
|
|
15685
|
-
),
|
|
15795
|
+
`${t} の下限は ${w.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
15796
|
+
), w.MIN_INTERVAL_MS) : r;
|
|
15686
15797
|
}
|
|
15687
15798
|
/**
|
|
15688
15799
|
* `data-poll-timeout` を解決します。
|
|
@@ -15694,8 +15805,8 @@ const v = class v {
|
|
|
15694
15805
|
const t = `${c.prefix}poll-timeout`;
|
|
15695
15806
|
if (!e.hasAttribute(t))
|
|
15696
15807
|
return null;
|
|
15697
|
-
const r =
|
|
15698
|
-
return r === null || r <= 0 ? (
|
|
15808
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15809
|
+
return r === null || r <= 0 ? (g.warn(
|
|
15699
15810
|
"[Haori]",
|
|
15700
15811
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
15701
15812
|
), null) : r;
|
|
@@ -15710,8 +15821,8 @@ const v = class v {
|
|
|
15710
15821
|
const t = `${c.prefix}poll-error-limit`;
|
|
15711
15822
|
if (!e.hasAttribute(t))
|
|
15712
15823
|
return null;
|
|
15713
|
-
const r =
|
|
15714
|
-
return r === null || r < 1 ? (
|
|
15824
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15825
|
+
return r === null || r < 1 ? (g.warn(
|
|
15715
15826
|
"[Haori]",
|
|
15716
15827
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
15717
15828
|
), null) : Math.floor(r);
|
|
@@ -15752,7 +15863,7 @@ const v = class v {
|
|
|
15752
15863
|
*/
|
|
15753
15864
|
static isDisabled(e) {
|
|
15754
15865
|
const t = `${c.prefix}poll-disabled`;
|
|
15755
|
-
return e.hasAttribute(t) ?
|
|
15866
|
+
return e.hasAttribute(t) ? w.isTruthy(e.getAttribute(t)) : !1;
|
|
15756
15867
|
}
|
|
15757
15868
|
/**
|
|
15758
15869
|
* `data-poll-until` の条件が成立したかどうかを判定します。
|
|
@@ -15770,12 +15881,12 @@ const v = class v {
|
|
|
15770
15881
|
if (!e.hasAttribute(t))
|
|
15771
15882
|
return !1;
|
|
15772
15883
|
const r = e.getAttributeEvaluation(t);
|
|
15773
|
-
return r ? r.hasUnresolvedReference ? (
|
|
15884
|
+
return r ? r.hasUnresolvedReference ? (g.warn(
|
|
15774
15885
|
"[Haori]",
|
|
15775
15886
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
15776
15887
|
e.getRawAttribute(t),
|
|
15777
15888
|
e.getTarget()
|
|
15778
|
-
), !1) :
|
|
15889
|
+
), !1) : w.isTruthy(r.value) : !1;
|
|
15779
15890
|
}
|
|
15780
15891
|
/**
|
|
15781
15892
|
* 属性の評価値を真偽値として解釈します。
|
|
@@ -15798,16 +15909,16 @@ const v = class v {
|
|
|
15798
15909
|
return !!e;
|
|
15799
15910
|
}
|
|
15800
15911
|
};
|
|
15801
|
-
|
|
15912
|
+
w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
15802
15913
|
"interval",
|
|
15803
15914
|
"timeout",
|
|
15804
15915
|
"until",
|
|
15805
15916
|
"error-limit",
|
|
15806
15917
|
"disabled",
|
|
15807
15918
|
"state"
|
|
15808
|
-
]),
|
|
15809
|
-
let we =
|
|
15810
|
-
const Jt = "0.
|
|
15919
|
+
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
15920
|
+
let we = w;
|
|
15921
|
+
const Jt = "0.60.0";
|
|
15811
15922
|
function Zt(b) {
|
|
15812
15923
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => b()) : Promise.resolve().then(b);
|
|
15813
15924
|
}
|
|
@@ -15850,7 +15961,7 @@ const L = class L {
|
|
|
15850
15961
|
return;
|
|
15851
15962
|
const i = L.resolveVarName(r);
|
|
15852
15963
|
if (i === "") {
|
|
15853
|
-
t && (t.observer.disconnect(), L.registrations.delete(e)),
|
|
15964
|
+
t && (t.observer.disconnect(), L.registrations.delete(e)), g.warn(
|
|
15854
15965
|
"[Haori]",
|
|
15855
15966
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
15856
15967
|
);
|
|
@@ -15868,9 +15979,9 @@ const L = class L {
|
|
|
15868
15979
|
if (!u)
|
|
15869
15980
|
return;
|
|
15870
15981
|
let d = !1;
|
|
15871
|
-
l.forEach((
|
|
15872
|
-
const y =
|
|
15873
|
-
u.observedRows.has(y) && (
|
|
15982
|
+
l.forEach((m) => {
|
|
15983
|
+
const y = m.target;
|
|
15984
|
+
u.observedRows.has(y) && (m.isIntersecting ? u.visibleRows.has(y) || (u.visibleRows.add(y), d = !0) : u.visibleRows.delete(y) && (d = !0));
|
|
15874
15985
|
}), d && L.scheduleCompute(u);
|
|
15875
15986
|
},
|
|
15876
15987
|
{
|
|
@@ -15947,7 +16058,7 @@ const L = class L {
|
|
|
15947
16058
|
if (typeof r != "string" || r.trim() === "")
|
|
15948
16059
|
return null;
|
|
15949
16060
|
const i = j.query(r, t, document);
|
|
15950
|
-
return L.isHtmlElement(i) ? i : (
|
|
16061
|
+
return L.isHtmlElement(i) ? i : (g.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
15951
16062
|
}
|
|
15952
16063
|
/**
|
|
15953
16064
|
* rootMargin を解決します。
|
|
@@ -16046,7 +16157,7 @@ const L = class L {
|
|
|
16046
16157
|
static publish(e, t) {
|
|
16047
16158
|
const r = L.resolveBindOwner(e.fragment);
|
|
16048
16159
|
if (!r) {
|
|
16049
|
-
|
|
16160
|
+
g.warn(
|
|
16050
16161
|
"[Haori]",
|
|
16051
16162
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
16052
16163
|
);
|
|
@@ -16065,7 +16176,7 @@ const L = class L {
|
|
|
16065
16176
|
kind: "nonSupply",
|
|
16066
16177
|
sequence: S.nextSequence()
|
|
16067
16178
|
}).catch((o) => {
|
|
16068
|
-
|
|
16179
|
+
g.error("[Haori]", "Failed to publish visible range:", o);
|
|
16069
16180
|
});
|
|
16070
16181
|
}
|
|
16071
16182
|
/**
|
|
@@ -16114,11 +16225,11 @@ const B = class B {
|
|
|
16114
16225
|
C.scan(document.head),
|
|
16115
16226
|
C.scan(document.body)
|
|
16116
16227
|
]), [r, i] = t;
|
|
16117
|
-
r.status !== "fulfilled" &&
|
|
16228
|
+
r.status !== "fulfilled" && g.error(
|
|
16118
16229
|
"[Haori]",
|
|
16119
16230
|
"Failed to build head fragment:",
|
|
16120
16231
|
r.reason
|
|
16121
|
-
), i.status !== "fulfilled" &&
|
|
16232
|
+
), i.status !== "fulfilled" && g.error(
|
|
16122
16233
|
"[Haori]",
|
|
16123
16234
|
"Failed to build body fragment:",
|
|
16124
16235
|
i.reason
|
|
@@ -16370,7 +16481,7 @@ const B = class B {
|
|
|
16370
16481
|
break;
|
|
16371
16482
|
}
|
|
16372
16483
|
case "characterData": {
|
|
16373
|
-
r.target instanceof Text || r.target instanceof Comment ? C.changeText(r.target, r.target.textContent) :
|
|
16484
|
+
r.target instanceof Text || r.target instanceof Comment ? C.changeText(r.target, r.target.textContent) : g.warn(
|
|
16374
16485
|
"[Haori]",
|
|
16375
16486
|
"Unsupported character data type:",
|
|
16376
16487
|
r.target
|
|
@@ -16378,27 +16489,27 @@ const B = class B {
|
|
|
16378
16489
|
break;
|
|
16379
16490
|
}
|
|
16380
16491
|
default:
|
|
16381
|
-
|
|
16492
|
+
g.warn("[Haori]", "Unknown mutation type:", r.type);
|
|
16382
16493
|
continue;
|
|
16383
16494
|
}
|
|
16384
16495
|
} catch (i) {
|
|
16385
|
-
|
|
16496
|
+
g.error("[Haori]", "Error processing mutation:", i);
|
|
16386
16497
|
}
|
|
16387
16498
|
}
|
|
16388
16499
|
};
|
|
16389
16500
|
B._initialized = !1, B._mutationObservers = [], B._dispatcher = null, B._initialIntakes = null;
|
|
16390
|
-
let
|
|
16391
|
-
te.setMutationCapture((b) =>
|
|
16392
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
16501
|
+
let Ne = B;
|
|
16502
|
+
te.setMutationCapture((b) => Ne.captureMutations(b));
|
|
16503
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Ne.init) : Ne.init();
|
|
16393
16504
|
const Qt = () => Te.waitForRenders(), _t = Te.enhancers;
|
|
16394
16505
|
export {
|
|
16395
16506
|
C as Core,
|
|
16396
16507
|
te as Enhance,
|
|
16397
16508
|
c as Env,
|
|
16398
|
-
|
|
16509
|
+
k as Form,
|
|
16399
16510
|
T as Fragment,
|
|
16400
16511
|
Te as Haori,
|
|
16401
|
-
|
|
16512
|
+
g as Log,
|
|
16402
16513
|
z as Queue,
|
|
16403
16514
|
Te as default,
|
|
16404
16515
|
_t as enhancers,
|