haori 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +2 -2
- package/dist/haori.es.js +367 -368
- package/dist/haori.iife.js +2 -2
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -95,9 +95,9 @@ const V = class V {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
V._prefix = "data-", V._runtime = pe;
|
|
98
|
-
let
|
|
99
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
100
|
-
class
|
|
98
|
+
let u = V;
|
|
99
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect();
|
|
100
|
+
class m {
|
|
101
101
|
/**
|
|
102
102
|
* 開発モードでのみコンソールに情報を出力します。
|
|
103
103
|
*
|
|
@@ -253,32 +253,32 @@ function Ce(f, e, t = {}) {
|
|
|
253
253
|
Math.max(Math.trunc(Number(e)) || 0, 0),
|
|
254
254
|
r - 1
|
|
255
255
|
), n = Math.max(0, Math.trunc(t.window ?? 2)), s = Math.max(0, Math.trunc(t.boundary ?? 1)), a = /* @__PURE__ */ new Set();
|
|
256
|
-
for (let
|
|
257
|
-
a.add(
|
|
258
|
-
for (let
|
|
259
|
-
a.add(
|
|
260
|
-
for (let
|
|
261
|
-
a.add(
|
|
262
|
-
const o = Array.from(a).sort((
|
|
256
|
+
for (let c = 0; c < s && c < r; c += 1)
|
|
257
|
+
a.add(c);
|
|
258
|
+
for (let c = Math.max(0, r - s); c < r; c += 1)
|
|
259
|
+
a.add(c);
|
|
260
|
+
for (let c = Math.max(0, i - n); c <= Math.min(r - 1, i + n); c += 1)
|
|
261
|
+
a.add(c);
|
|
262
|
+
const o = Array.from(a).sort((c, p) => c - p), l = [];
|
|
263
263
|
let d = null;
|
|
264
|
-
for (const
|
|
265
|
-
if (d !== null &&
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
264
|
+
for (const c of o) {
|
|
265
|
+
if (d !== null && c - d > 1)
|
|
266
|
+
if (c - d === 2) {
|
|
267
|
+
const p = d + 1;
|
|
268
268
|
l.push({
|
|
269
|
-
page:
|
|
270
|
-
label:
|
|
271
|
-
active:
|
|
269
|
+
page: p,
|
|
270
|
+
label: p + 1,
|
|
271
|
+
active: p === i,
|
|
272
272
|
ellipsis: !1
|
|
273
273
|
});
|
|
274
274
|
} else
|
|
275
275
|
l.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
276
276
|
l.push({
|
|
277
|
-
page:
|
|
278
|
-
label:
|
|
279
|
-
active:
|
|
277
|
+
page: c,
|
|
278
|
+
label: c + 1,
|
|
279
|
+
active: c === i,
|
|
280
280
|
ellipsis: !1
|
|
281
|
-
}), d =
|
|
281
|
+
}), d = c;
|
|
282
282
|
}
|
|
283
283
|
return l;
|
|
284
284
|
}
|
|
@@ -334,8 +334,8 @@ function $e(f, e) {
|
|
|
334
334
|
if (e !== void 0 && Number.isFinite(e))
|
|
335
335
|
l = Math.max(0, Math.trunc(e));
|
|
336
336
|
else {
|
|
337
|
-
const
|
|
338
|
-
l = Number.isFinite(
|
|
337
|
+
const c = ie(r.numberOfElements, NaN);
|
|
338
|
+
l = Number.isFinite(c) ? c : Math.min(s, i - a);
|
|
339
339
|
}
|
|
340
340
|
const d = Math.min(a + l, i);
|
|
341
341
|
return { start: o, end: Math.max(d, o), total: i, empty: !1 };
|
|
@@ -496,18 +496,18 @@ const Xe = Object.freeze({
|
|
|
496
496
|
*/
|
|
497
497
|
static evaluateDetailed(e, t = {}) {
|
|
498
498
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
499
|
-
return
|
|
499
|
+
return m.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
500
500
|
if (this.containsDangerousPatterns(e)) {
|
|
501
501
|
const l = this.detectDisallowedKeywords(e);
|
|
502
502
|
if (l.length > 0) {
|
|
503
|
-
const d = l.some((
|
|
504
|
-
|
|
503
|
+
const d = l.some((c) => c === "function" || c === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
|
|
504
|
+
m.warn(
|
|
505
505
|
"[Haori]",
|
|
506
506
|
e,
|
|
507
507
|
"Expression uses disallowed keyword(s): " + l.join(", ") + "." + d
|
|
508
508
|
);
|
|
509
509
|
} else
|
|
510
|
-
|
|
510
|
+
m.warn(
|
|
511
511
|
"[Haori]",
|
|
512
512
|
e,
|
|
513
513
|
"Expression contains dangerous patterns"
|
|
@@ -517,7 +517,7 @@ const Xe = Object.freeze({
|
|
|
517
517
|
const r = this.collectForbiddenKeys(t);
|
|
518
518
|
if (r.length > 0) {
|
|
519
519
|
const l = r.join(",");
|
|
520
|
-
this.loggedForbiddenKeySignatures.has(l) || (this.loggedForbiddenKeySignatures.add(l), this.scheduleForbiddenKeyLogReset(),
|
|
520
|
+
this.loggedForbiddenKeySignatures.has(l) || (this.loggedForbiddenKeySignatures.add(l), this.scheduleForbiddenKeyLogReset(), m.error(
|
|
521
521
|
"[Haori]",
|
|
522
522
|
"Binding keys are reserved and ignored: " + r.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
523
523
|
));
|
|
@@ -528,7 +528,7 @@ const Xe = Object.freeze({
|
|
|
528
528
|
/* @__PURE__ */ new WeakSet(),
|
|
529
529
|
i
|
|
530
530
|
))
|
|
531
|
-
return
|
|
531
|
+
return m.warn(
|
|
532
532
|
"[Haori]",
|
|
533
533
|
t,
|
|
534
534
|
"Binded values contain forbidden values"
|
|
@@ -539,7 +539,7 @@ const Xe = Object.freeze({
|
|
|
539
539
|
), s = this.BUILTIN_REFERENCE_PATTERN.test(
|
|
540
540
|
n
|
|
541
541
|
);
|
|
542
|
-
s && this.BUILTIN_NAMESPACE in t &&
|
|
542
|
+
s && this.BUILTIN_NAMESPACE in t && m.warn(
|
|
543
543
|
"[Haori]",
|
|
544
544
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
545
545
|
);
|
|
@@ -553,32 +553,32 @@ const Xe = Object.freeze({
|
|
|
553
553
|
if (d.compileFailed || d.evaluator === null)
|
|
554
554
|
return { value: null, unresolvedReference: !1 };
|
|
555
555
|
try {
|
|
556
|
-
const
|
|
556
|
+
const c = [], p = this.wrapBoundValues(a);
|
|
557
557
|
return d.bindKeys.forEach((y) => {
|
|
558
|
-
|
|
558
|
+
c.push(p[y]);
|
|
559
559
|
}), {
|
|
560
560
|
value: this.withBlockedPropertyAccess(
|
|
561
|
-
() => d.evaluator(...
|
|
561
|
+
() => d.evaluator(...c)
|
|
562
562
|
),
|
|
563
563
|
unresolvedReference: !1
|
|
564
564
|
};
|
|
565
|
-
} catch (
|
|
566
|
-
if (o &&
|
|
567
|
-
const y = this.extractMissingIdentifier(
|
|
565
|
+
} catch (c) {
|
|
566
|
+
if (o && c instanceof ReferenceError) {
|
|
567
|
+
const y = this.extractMissingIdentifier(c);
|
|
568
568
|
if (y !== null && this.canRecoverMissingIdentifier(y, a)) {
|
|
569
569
|
a[y] = void 0;
|
|
570
570
|
continue;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
const
|
|
574
|
-
return
|
|
573
|
+
const p = this.detectForbiddenIdentifiers(e);
|
|
574
|
+
return p.length > 0 && m.warn(
|
|
575
575
|
"[Haori]",
|
|
576
|
-
"Expression references blocked identifier(s): " +
|
|
576
|
+
"Expression references blocked identifier(s): " + p.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of this error). Use spread {...a, ...b} instead of Object.assign.",
|
|
577
577
|
e
|
|
578
|
-
),
|
|
578
|
+
), m.error("[Haori]", "Expression evaluation error:", e, c), c instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
return
|
|
581
|
+
return m.error(
|
|
582
582
|
"[Haori]",
|
|
583
583
|
"Failed to recover missing identifiers:",
|
|
584
584
|
e,
|
|
@@ -612,7 +612,7 @@ return (${e});`;
|
|
|
612
612
|
compileFailed: !1
|
|
613
613
|
};
|
|
614
614
|
} catch (o) {
|
|
615
|
-
return
|
|
615
|
+
return m.error(
|
|
616
616
|
"[Haori]",
|
|
617
617
|
"Failed to compile expression:",
|
|
618
618
|
e,
|
|
@@ -719,8 +719,8 @@ return (${e});`;
|
|
|
719
719
|
break;
|
|
720
720
|
}
|
|
721
721
|
case "[": {
|
|
722
|
-
const
|
|
723
|
-
r.push(
|
|
722
|
+
const c = this.startsMemberAccess(i) ? "member" : "array";
|
|
723
|
+
r.push(c);
|
|
724
724
|
break;
|
|
725
725
|
}
|
|
726
726
|
case "{":
|
|
@@ -1252,13 +1252,13 @@ class ye {
|
|
|
1252
1252
|
const r = await t.task();
|
|
1253
1253
|
t.resolve(r);
|
|
1254
1254
|
} catch (r) {
|
|
1255
|
-
t.reject(r),
|
|
1255
|
+
t.reject(r), m.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
1256
1256
|
}
|
|
1257
1257
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
1258
1258
|
break;
|
|
1259
1259
|
}
|
|
1260
1260
|
} catch (e) {
|
|
1261
|
-
|
|
1261
|
+
m.error("[Haori]", "Error processing queue:", e);
|
|
1262
1262
|
} finally {
|
|
1263
1263
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
1264
1264
|
}
|
|
@@ -1558,8 +1558,8 @@ const x = class x {
|
|
|
1558
1558
|
i += `#${n.trim()}`, t.unshift(i);
|
|
1559
1559
|
break;
|
|
1560
1560
|
}
|
|
1561
|
-
const s = r.getAttribute(`${
|
|
1562
|
-
s && s.trim() !== "" && (i += `[${
|
|
1561
|
+
const s = r.getAttribute(`${u.prefix}derive-name`);
|
|
1562
|
+
s && s.trim() !== "" && (i += `[${u.prefix}derive-name="${s.trim()}"]`);
|
|
1563
1563
|
const a = r.parentElement;
|
|
1564
1564
|
a && (i += `:nth-child(${[...a.children].indexOf(r) + 1})`), t.unshift(i), r = a;
|
|
1565
1565
|
}
|
|
@@ -1594,7 +1594,7 @@ const Q = class Q {
|
|
|
1594
1594
|
t = new ve(e);
|
|
1595
1595
|
break;
|
|
1596
1596
|
default:
|
|
1597
|
-
return
|
|
1597
|
+
return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
1598
1598
|
}
|
|
1599
1599
|
return t;
|
|
1600
1600
|
}
|
|
@@ -1724,7 +1724,7 @@ const z = class z extends S {
|
|
|
1724
1724
|
"month",
|
|
1725
1725
|
"time",
|
|
1726
1726
|
"week"
|
|
1727
|
-
], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${
|
|
1727
|
+
], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${u.prefix}bind`), e.getAttributeNames().forEach((t) => {
|
|
1728
1728
|
const r = e.getAttribute(t);
|
|
1729
1729
|
if (r !== null && !this.attributeMap.has(t)) {
|
|
1730
1730
|
const i = new oe(t, r);
|
|
@@ -1771,7 +1771,7 @@ const z = class z extends S {
|
|
|
1771
1771
|
removeChild(e) {
|
|
1772
1772
|
const t = this.children.indexOf(e);
|
|
1773
1773
|
if (t < 0) {
|
|
1774
|
-
|
|
1774
|
+
m.warn("[Haori]", "Child fragment not found.", e);
|
|
1775
1775
|
return;
|
|
1776
1776
|
}
|
|
1777
1777
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -1796,7 +1796,7 @@ const z = class z extends S {
|
|
|
1796
1796
|
* clone 時に runtime の hidden 状態だけを落とします。
|
|
1797
1797
|
*/
|
|
1798
1798
|
normalizeClonedVisibilityState() {
|
|
1799
|
-
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${
|
|
1799
|
+
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${u.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${u.prefix}if-false`)), this.children.forEach((e) => {
|
|
1800
1800
|
e instanceof z && e.normalizeClonedVisibilityState();
|
|
1801
1801
|
});
|
|
1802
1802
|
}
|
|
@@ -2113,7 +2113,7 @@ const z = class z extends S {
|
|
|
2113
2113
|
if (r instanceof HTMLInputElement && r.type === "file")
|
|
2114
2114
|
return e === null || e === "" ? (this.value = null, r.value === "" ? Promise.resolve() : I.enqueue(() => {
|
|
2115
2115
|
r.value = "";
|
|
2116
|
-
})) : (
|
|
2116
|
+
})) : (m.warn(
|
|
2117
2117
|
"[Haori]",
|
|
2118
2118
|
"A value cannot be assigned to input[type=file]; only clearing is supported.",
|
|
2119
2119
|
r
|
|
@@ -2145,7 +2145,7 @@ const z = class z extends S {
|
|
|
2145
2145
|
this.skipChangeValue = !1;
|
|
2146
2146
|
});
|
|
2147
2147
|
} else
|
|
2148
|
-
return
|
|
2148
|
+
return m.warn(
|
|
2149
2149
|
"[Haori]",
|
|
2150
2150
|
"setValue is not supported for this element type.",
|
|
2151
2151
|
r
|
|
@@ -2287,9 +2287,9 @@ const z = class z extends S {
|
|
|
2287
2287
|
element: a,
|
|
2288
2288
|
rawName: e,
|
|
2289
2289
|
template: r
|
|
2290
|
-
}), l = s.isEvaluate || s.isRawEvaluate, d = e === t && z.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()),
|
|
2290
|
+
}), l = s.isEvaluate || s.isRawEvaluate, d = e === t && z.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), c = s.isSingleExpression(), p = Y.joinEvaluateResults(o.results), y = o.results.length === 1 ? o.results[0] : p, T = !s.isForceEvaluation() && (t !== e || d || c ? o.hasUnresolvedReference || y === null || y === void 0 || y === !1 : l && p === ""), k = s.isForceEvaluation() ? r : c ? y : p, H = i && s.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), E = a.getRootNode(), b = H && a === E.activeElement, v = T || k === null || k === !1 ? null : String(k), R = e !== t && a.getAttribute(e) !== r, C = v === null ? a.hasAttribute(t) : a.getAttribute(t) !== v, F = H && !b && v !== null && a.value !== v, U = t === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), $ = t === "selected" && a instanceof HTMLOptionElement, W = E.activeElement, Ae = W !== null && (U && a === W || $ && a.closest("select") === W), re = v !== null, Se = U && !Ae && a.checked !== re, we = $ && !Ae && a.selected !== re;
|
|
2291
2291
|
return !R && !C && !F && !Se && !we ? (H && !b && v !== null && (this.value = this.normalizeValueForElement(a, v)), Promise.resolve()) : (this.skipMutationAttributes = !0, I.enqueue(() => {
|
|
2292
|
-
R && a.setAttribute(e, r), v === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, v), t === `${
|
|
2292
|
+
R && a.setAttribute(e, r), v === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, v), t === `${u.prefix}bind` && this.recordSelfWrittenBind(v)), H && !b && (this.value = this.normalizeValueForElement(a, v), F && (a.value = v))), Se && (a.checked = re), we && (a.selected = re);
|
|
2293
2293
|
}).finally(() => {
|
|
2294
2294
|
this.skipMutationAttributes = !1;
|
|
2295
2295
|
}));
|
|
@@ -2408,13 +2408,13 @@ const z = class z extends S {
|
|
|
2408
2408
|
if (this.skipMutationNodes)
|
|
2409
2409
|
return Promise.resolve();
|
|
2410
2410
|
if (e === this)
|
|
2411
|
-
return
|
|
2411
|
+
return m.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
2412
2412
|
const i = /* @__PURE__ */ new Set();
|
|
2413
2413
|
let n = this.parent;
|
|
2414
2414
|
for (; n; )
|
|
2415
2415
|
i.add(n), n = n.getParent();
|
|
2416
2416
|
if (i.has(e))
|
|
2417
|
-
return
|
|
2417
|
+
return m.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
2418
2418
|
const s = e.getParent() === this;
|
|
2419
2419
|
let a = -1, o = -1;
|
|
2420
2420
|
s && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
|
|
@@ -2424,26 +2424,26 @@ const z = class z extends S {
|
|
|
2424
2424
|
if (t === null)
|
|
2425
2425
|
this.children.push(e);
|
|
2426
2426
|
else {
|
|
2427
|
-
let
|
|
2428
|
-
if (s ? a !== -1 && a < o ?
|
|
2427
|
+
let p;
|
|
2428
|
+
if (s ? a !== -1 && a < o ? p = o - 1 : p = o : p = this.children.indexOf(t), p === -1) {
|
|
2429
2429
|
const y = this.resolveInsertionPointFromDom(
|
|
2430
2430
|
t,
|
|
2431
2431
|
!1
|
|
2432
2432
|
);
|
|
2433
|
-
y === null ? (
|
|
2433
|
+
y === null ? (m.warn(
|
|
2434
2434
|
"[Haori]",
|
|
2435
2435
|
"Reference child not found in children.",
|
|
2436
2436
|
t
|
|
2437
2437
|
), this.children.push(e)) : (this.children.splice(y.index, 0, e), d = y.referenceNode);
|
|
2438
2438
|
} else
|
|
2439
|
-
this.children.splice(
|
|
2439
|
+
this.children.splice(p, 0, e);
|
|
2440
2440
|
}
|
|
2441
2441
|
e.setParent(this), e.setMounted(this.mounted);
|
|
2442
|
-
const
|
|
2442
|
+
const c = this.skipMutationNodes;
|
|
2443
2443
|
return this.skipMutationNodes = !0, I.enqueue(() => {
|
|
2444
2444
|
this.target.insertBefore(e.getTarget(), d);
|
|
2445
2445
|
}).finally(() => {
|
|
2446
|
-
this.skipMutationNodes =
|
|
2446
|
+
this.skipMutationNodes = c;
|
|
2447
2447
|
});
|
|
2448
2448
|
}
|
|
2449
2449
|
/**
|
|
@@ -2462,7 +2462,7 @@ const z = class z extends S {
|
|
|
2462
2462
|
t,
|
|
2463
2463
|
!0
|
|
2464
2464
|
);
|
|
2465
|
-
return i === null ? (
|
|
2465
|
+
return i === null ? (m.warn(
|
|
2466
2466
|
"[Haori]",
|
|
2467
2467
|
"Reference child not found in children.",
|
|
2468
2468
|
t
|
|
@@ -2518,7 +2518,7 @@ const z = class z extends S {
|
|
|
2518
2518
|
return Promise.resolve();
|
|
2519
2519
|
this.visible = !1;
|
|
2520
2520
|
const e = this.getTarget();
|
|
2521
|
-
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${
|
|
2521
|
+
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${u.prefix}if-false`, ""), Promise.resolve();
|
|
2522
2522
|
}
|
|
2523
2523
|
/**
|
|
2524
2524
|
* エレメントを表示します。
|
|
@@ -2533,7 +2533,7 @@ const z = class z extends S {
|
|
|
2533
2533
|
"display",
|
|
2534
2534
|
this.display,
|
|
2535
2535
|
this.displayPriority ?? ""
|
|
2536
|
-
), this.display = null, this.displayPriority = null, e.removeAttribute(`${
|
|
2536
|
+
), this.display = null, this.displayPriority = null, e.removeAttribute(`${u.prefix}if-false`), this.visible = !0, Promise.resolve();
|
|
2537
2537
|
}
|
|
2538
2538
|
/**
|
|
2539
2539
|
* 指定した属性名を持つ最も近い親要素を返します。
|
|
@@ -2753,7 +2753,7 @@ const ue = class ue {
|
|
|
2753
2753
|
*/
|
|
2754
2754
|
checkRawExpressions() {
|
|
2755
2755
|
for (let e = 0; e < this.contents.length; e++)
|
|
2756
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
2756
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (m.error(
|
|
2757
2757
|
"[Haori]",
|
|
2758
2758
|
"Raw expressions are not allowed in multi-content expressions."
|
|
2759
2759
|
), this.contents[e].type = 1);
|
|
@@ -2801,15 +2801,15 @@ const ue = class ue {
|
|
|
2801
2801
|
if (r(l)) {
|
|
2802
2802
|
const d = ae.measure(
|
|
2803
2803
|
() => G.evaluateDetailed(l.text, e)
|
|
2804
|
-
),
|
|
2804
|
+
), c = d.value;
|
|
2805
2805
|
a += d.durationMs, s.push({
|
|
2806
2806
|
expression: l.text,
|
|
2807
2807
|
durationMs: d.durationMs
|
|
2808
|
-
}), o = o ||
|
|
2808
|
+
}), o = o || c.unresolvedReference, n.push(c.value);
|
|
2809
2809
|
} else
|
|
2810
2810
|
n.push(l.text);
|
|
2811
2811
|
} catch (d) {
|
|
2812
|
-
|
|
2812
|
+
m.error(
|
|
2813
2813
|
"[Haori]",
|
|
2814
2814
|
`Error evaluating ${i} expression: ${l.text}`,
|
|
2815
2815
|
d
|
|
@@ -2872,7 +2872,7 @@ const ce = class ce extends Y {
|
|
|
2872
2872
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
2873
2873
|
"attribute"
|
|
2874
2874
|
);
|
|
2875
|
-
return this.forceEvaluation && r.results.length > 1 ? (
|
|
2875
|
+
return this.forceEvaluation && r.results.length > 1 ? (m.error(
|
|
2876
2876
|
"[Haori]",
|
|
2877
2877
|
"each or if expressions must have a single content.",
|
|
2878
2878
|
r.results
|
|
@@ -2898,7 +2898,7 @@ class Z {
|
|
|
2898
2898
|
* @return 実行モード。
|
|
2899
2899
|
*/
|
|
2900
2900
|
static get runtime() {
|
|
2901
|
-
return
|
|
2901
|
+
return u.runtime;
|
|
2902
2902
|
}
|
|
2903
2903
|
/**
|
|
2904
2904
|
* 実行モードを設定します。
|
|
@@ -2907,7 +2907,7 @@ class Z {
|
|
|
2907
2907
|
* @return 戻り値はありません。
|
|
2908
2908
|
*/
|
|
2909
2909
|
static setRuntime(e) {
|
|
2910
|
-
|
|
2910
|
+
u.setRuntime(e);
|
|
2911
2911
|
}
|
|
2912
2912
|
/**
|
|
2913
2913
|
* 進行中・追従して投入されるものを含め、すべてのレンダリングタスクの完了を待ちます。
|
|
@@ -2967,7 +2967,7 @@ class Z {
|
|
|
2967
2967
|
*/
|
|
2968
2968
|
static openDialog(e) {
|
|
2969
2969
|
return I.enqueue(() => {
|
|
2970
|
-
e instanceof HTMLDialogElement ? (Z.clearMessagesSync(e), e.showModal()) :
|
|
2970
|
+
e instanceof HTMLDialogElement ? (Z.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2971
2971
|
}, !0);
|
|
2972
2972
|
}
|
|
2973
2973
|
/**
|
|
@@ -2977,7 +2977,7 @@ class Z {
|
|
|
2977
2977
|
*/
|
|
2978
2978
|
static closeDialog(e) {
|
|
2979
2979
|
return I.enqueue(() => {
|
|
2980
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
2980
|
+
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2981
2981
|
}, !0);
|
|
2982
2982
|
}
|
|
2983
2983
|
/**
|
|
@@ -3251,9 +3251,9 @@ class A {
|
|
|
3251
3251
|
* @returns values と同じオブジェクト
|
|
3252
3252
|
*/
|
|
3253
3253
|
static getPartValues(e, t) {
|
|
3254
|
-
if (e.getTarget().hasAttribute(`${
|
|
3254
|
+
if (e.getTarget().hasAttribute(`${u.prefix}if-false`))
|
|
3255
3255
|
return t;
|
|
3256
|
-
const r = e.getAttribute("name"), i = e.getAttribute(`${
|
|
3256
|
+
const r = e.getAttribute("name"), i = e.getAttribute(`${u.prefix}form-object`), n = e.getAttribute(`${u.prefix}form-list`);
|
|
3257
3257
|
if (r) {
|
|
3258
3258
|
if (n) {
|
|
3259
3259
|
const s = A.resolveCollectedValue(e), a = A.isFileInput(e) && Array.isArray(s) ? s : [s];
|
|
@@ -3263,9 +3263,9 @@ class A {
|
|
|
3263
3263
|
o === null ? l in t || (t[l] = null) : t[l] === null || t[l] === void 0 ? t[l] = o : Array.isArray(t[l]) ? t[l].push(o) : t[l] = [t[l], o];
|
|
3264
3264
|
} else
|
|
3265
3265
|
t[String(r)] = A.resolveCollectedValue(e);
|
|
3266
|
-
i &&
|
|
3266
|
+
i && m.warn(
|
|
3267
3267
|
"Haori",
|
|
3268
|
-
`Element cannot have both ${
|
|
3268
|
+
`Element cannot have both ${u.prefix}form-object and name attributes.`
|
|
3269
3269
|
);
|
|
3270
3270
|
for (const s of e.getChildElementFragments())
|
|
3271
3271
|
A.getPartValues(s, t);
|
|
@@ -3273,9 +3273,9 @@ class A {
|
|
|
3273
3273
|
const s = {};
|
|
3274
3274
|
for (const a of e.getChildElementFragments())
|
|
3275
3275
|
A.getPartValues(a, s);
|
|
3276
|
-
Object.keys(s).length > 0 && (t[String(i)] = s), n &&
|
|
3276
|
+
Object.keys(s).length > 0 && (t[String(i)] = s), n && m.warn(
|
|
3277
3277
|
"Haori",
|
|
3278
|
-
`Element cannot have both ${
|
|
3278
|
+
`Element cannot have both ${u.prefix}form-list and ${u.prefix}form-object attributes.`
|
|
3279
3279
|
);
|
|
3280
3280
|
} else if (n) {
|
|
3281
3281
|
const s = [];
|
|
@@ -3355,48 +3355,48 @@ class A {
|
|
|
3355
3355
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
3356
3356
|
*/
|
|
3357
3357
|
static setPartValues(e, t, r = null, i = !1, n = !0) {
|
|
3358
|
-
const s = [], a = e.getAttribute("name"), o = e.getAttribute(`${
|
|
3358
|
+
const s = [], a = e.getAttribute("name"), o = e.getAttribute(`${u.prefix}form-object`), l = e.getAttribute(`${u.prefix}form-list`), d = e.getAttribute(`${u.prefix}form-detach`);
|
|
3359
3359
|
if (a) {
|
|
3360
3360
|
if (!d || i) {
|
|
3361
|
-
const
|
|
3361
|
+
const c = t[String(a)];
|
|
3362
3362
|
if (A.isFileInput(e))
|
|
3363
|
-
return (
|
|
3363
|
+
return (c === null || c === "") && s.push(A.applyFragmentValue(e, null, n)), Promise.all(s).then(() => {
|
|
3364
3364
|
});
|
|
3365
|
-
l && Array.isArray(
|
|
3366
|
-
A.applyFragmentValue(e,
|
|
3367
|
-
) : typeof
|
|
3365
|
+
l && Array.isArray(c) && r !== null ? s.push(
|
|
3366
|
+
A.applyFragmentValue(e, c[r] ?? null, n)
|
|
3367
|
+
) : typeof c > "u" || (Array.isArray(c) && A.isGroupedCheckable(e) || Array.isArray(c) && A.isMultipleSelect(e) || typeof c == "string" || typeof c == "number" || typeof c == "boolean" || c === null ? s.push(
|
|
3368
3368
|
A.applyFragmentValue(
|
|
3369
3369
|
e,
|
|
3370
|
-
|
|
3370
|
+
c,
|
|
3371
3371
|
n
|
|
3372
3372
|
)
|
|
3373
3373
|
) : s.push(
|
|
3374
|
-
A.applyFragmentValue(e, String(
|
|
3374
|
+
A.applyFragmentValue(e, String(c), n)
|
|
3375
3375
|
));
|
|
3376
3376
|
}
|
|
3377
3377
|
} else if (o) {
|
|
3378
|
-
const
|
|
3379
|
-
if (
|
|
3380
|
-
for (const
|
|
3378
|
+
const c = t[String(o)];
|
|
3379
|
+
if (c && typeof c == "object")
|
|
3380
|
+
for (const p of e.getChildElementFragments())
|
|
3381
3381
|
s.push(
|
|
3382
3382
|
A.setPartValues(
|
|
3383
|
-
|
|
3384
|
-
|
|
3383
|
+
p,
|
|
3384
|
+
c,
|
|
3385
3385
|
null,
|
|
3386
3386
|
i,
|
|
3387
3387
|
n
|
|
3388
3388
|
)
|
|
3389
3389
|
);
|
|
3390
3390
|
} else if (l) {
|
|
3391
|
-
const
|
|
3392
|
-
if (Array.isArray(
|
|
3393
|
-
const
|
|
3394
|
-
for (let y = 0; y <
|
|
3395
|
-
const T =
|
|
3396
|
-
|
|
3391
|
+
const c = t[String(l)];
|
|
3392
|
+
if (Array.isArray(c)) {
|
|
3393
|
+
const p = e.getChildElementFragments();
|
|
3394
|
+
for (let y = 0; y < p.length; y++) {
|
|
3395
|
+
const T = p[y];
|
|
3396
|
+
c.length > y ? s.push(
|
|
3397
3397
|
A.setPartValues(
|
|
3398
3398
|
T,
|
|
3399
|
-
|
|
3399
|
+
c[y],
|
|
3400
3400
|
y,
|
|
3401
3401
|
i,
|
|
3402
3402
|
n
|
|
@@ -3405,9 +3405,9 @@ class A {
|
|
|
3405
3405
|
}
|
|
3406
3406
|
}
|
|
3407
3407
|
} else
|
|
3408
|
-
for (const
|
|
3408
|
+
for (const c of e.getChildElementFragments())
|
|
3409
3409
|
s.push(
|
|
3410
|
-
A.setPartValues(
|
|
3410
|
+
A.setPartValues(c, t, null, i, n)
|
|
3411
3411
|
);
|
|
3412
3412
|
return Promise.all(s).then(() => {
|
|
3413
3413
|
});
|
|
@@ -3446,7 +3446,7 @@ class A {
|
|
|
3446
3446
|
const i = A.getInitialBindingData(r);
|
|
3447
3447
|
if (r.getRawBindingData() === null && i === null)
|
|
3448
3448
|
continue;
|
|
3449
|
-
const n = A.getValues(r), s = r.getAttribute(`${
|
|
3449
|
+
const n = A.getValues(r), s = r.getAttribute(`${u.prefix}form-arg`), a = { ...i || {} };
|
|
3450
3450
|
s ? a[String(s)] = n : Object.assign(a, n), await P.setBindingData(r.getTarget(), a);
|
|
3451
3451
|
}
|
|
3452
3452
|
await P.evaluateAll(e);
|
|
@@ -3499,9 +3499,9 @@ class A {
|
|
|
3499
3499
|
*/
|
|
3500
3500
|
static clearEachClones(e) {
|
|
3501
3501
|
const t = [], r = (n) => {
|
|
3502
|
-
if (n.hasAttribute(`${
|
|
3502
|
+
if (n.hasAttribute(`${u.prefix}each`))
|
|
3503
3503
|
for (const s of n.getChildElementFragments()) {
|
|
3504
|
-
const a = s.hasAttribute(`${
|
|
3504
|
+
const a = s.hasAttribute(`${u.prefix}each-before`), o = s.hasAttribute(`${u.prefix}each-after`);
|
|
3505
3505
|
!a && !o && t.push(s.remove());
|
|
3506
3506
|
}
|
|
3507
3507
|
}, i = (n) => {
|
|
@@ -3585,23 +3585,23 @@ class A {
|
|
|
3585
3585
|
*/
|
|
3586
3586
|
static findFragmentByKeyParts(e, t) {
|
|
3587
3587
|
const r = [], i = t[0];
|
|
3588
|
-
if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${
|
|
3589
|
-
t.length > 1 && e.getAttribute(`${
|
|
3588
|
+
if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${u.prefix}form-object`))
|
|
3589
|
+
t.length > 1 && e.getAttribute(`${u.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
3590
3590
|
r.push(...A.findFragmentByKeyParts(s, t.slice(1)));
|
|
3591
3591
|
});
|
|
3592
|
-
else if (e.hasAttribute(`${
|
|
3592
|
+
else if (e.hasAttribute(`${u.prefix}form-list`)) {
|
|
3593
3593
|
if (t.length > 1) {
|
|
3594
|
-
const n = e.getAttribute(`${
|
|
3594
|
+
const n = e.getAttribute(`${u.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
|
|
3595
3595
|
if (s !== -1 && a !== -1 && s < a) {
|
|
3596
3596
|
const o = i.substring(0, s);
|
|
3597
3597
|
if (n === o) {
|
|
3598
3598
|
const l = i.substring(s + 1, a), d = Number(l);
|
|
3599
3599
|
if (isNaN(d))
|
|
3600
|
-
|
|
3600
|
+
m.error("Haori", `Invalid index: ${i}`);
|
|
3601
3601
|
else {
|
|
3602
|
-
const
|
|
3603
|
-
d <
|
|
3604
|
-
...A.findFragmentByKeyParts(
|
|
3602
|
+
const c = e.getChildElementFragments().filter((p) => p.hasAttribute(`${u.prefix}row`));
|
|
3603
|
+
d < c.length && r.push(
|
|
3604
|
+
...A.findFragmentByKeyParts(c[d], t.slice(1))
|
|
3605
3605
|
);
|
|
3606
3606
|
}
|
|
3607
3607
|
}
|
|
@@ -3626,7 +3626,7 @@ class A {
|
|
|
3626
3626
|
*/
|
|
3627
3627
|
static getFormFragment(e) {
|
|
3628
3628
|
const t = e.getTarget();
|
|
3629
|
-
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${
|
|
3629
|
+
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${u.prefix}form`))
|
|
3630
3630
|
return e;
|
|
3631
3631
|
const r = e.getParent();
|
|
3632
3632
|
return r ? this.getFormFragment(r) : null;
|
|
@@ -3706,8 +3706,8 @@ class N {
|
|
|
3706
3706
|
static bindChange(e, t, r, i = "other") {
|
|
3707
3707
|
const n = [], s = new Set(Object.keys(t || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
3708
3708
|
for (const l of o) {
|
|
3709
|
-
const d = t?.[l],
|
|
3710
|
-
d !==
|
|
3709
|
+
const d = t?.[l], c = r[l];
|
|
3710
|
+
d !== c && n.push(l);
|
|
3711
3711
|
}
|
|
3712
3712
|
N.dispatch(e, "bindchange", {
|
|
3713
3713
|
previous: t || {},
|
|
@@ -3886,7 +3886,7 @@ function je(f) {
|
|
|
3886
3886
|
const e = Ze[f];
|
|
3887
3887
|
if (e === void 0 || typeof document > "u")
|
|
3888
3888
|
return !1;
|
|
3889
|
-
const t = `${
|
|
3889
|
+
const t = `${u.prefix}${e}`, r = [];
|
|
3890
3890
|
document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
|
|
3891
3891
|
for (const i of r) {
|
|
3892
3892
|
const n = et(i, t);
|
|
@@ -4047,7 +4047,7 @@ const g = class g {
|
|
|
4047
4047
|
* 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
|
|
4048
4048
|
*/
|
|
4049
4049
|
static attrName(e, t, r = !1) {
|
|
4050
|
-
return e ? `${
|
|
4050
|
+
return e ? `${u.prefix}${e}-${t}` : r ? `${u.prefix}fetch-${t}` : `${u.prefix}${t}`;
|
|
4051
4051
|
}
|
|
4052
4052
|
/**
|
|
4053
4053
|
* data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
|
|
@@ -4231,16 +4231,16 @@ const g = class g {
|
|
|
4231
4231
|
const v = document.body.querySelector(b);
|
|
4232
4232
|
v !== null ? r.formFragment = A.getFormFragment(
|
|
4233
4233
|
S.get(v)
|
|
4234
|
-
) :
|
|
4234
|
+
) : m.error(
|
|
4235
4235
|
"Haori",
|
|
4236
4236
|
`Form element not found: ${b} (${g.attrName(t, "form")})`
|
|
4237
4237
|
);
|
|
4238
4238
|
} else
|
|
4239
4239
|
r.formFragment = A.getFormFragment(e);
|
|
4240
4240
|
} else (t === "change" || t === "input") && (r.formFragment = A.getFormFragment(e), r.formFragment === null && g.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
4241
|
-
if (e.hasAttribute(`${
|
|
4241
|
+
if (e.hasAttribute(`${u.prefix}${t}-before-run`)) {
|
|
4242
4242
|
const b = e.getRawAttribute(
|
|
4243
|
-
`${
|
|
4243
|
+
`${u.prefix}${t}-before-run`
|
|
4244
4244
|
);
|
|
4245
4245
|
try {
|
|
4246
4246
|
r.beforeCallback = new Function(
|
|
@@ -4252,7 +4252,7 @@ ${b}
|
|
|
4252
4252
|
`
|
|
4253
4253
|
);
|
|
4254
4254
|
} catch (v) {
|
|
4255
|
-
|
|
4255
|
+
m.error("Haori", `Invalid before script: ${v}`);
|
|
4256
4256
|
}
|
|
4257
4257
|
}
|
|
4258
4258
|
const E = g.attrName(t, "run");
|
|
@@ -4275,7 +4275,7 @@ ${b}
|
|
|
4275
4275
|
`
|
|
4276
4276
|
);
|
|
4277
4277
|
} catch (R) {
|
|
4278
|
-
|
|
4278
|
+
m.error("Haori", `Invalid run script: ${R}`);
|
|
4279
4279
|
}
|
|
4280
4280
|
}
|
|
4281
4281
|
v && (r.runScript = v);
|
|
@@ -4311,7 +4311,7 @@ ${b}
|
|
|
4311
4311
|
try {
|
|
4312
4312
|
s.headers = P.parseDataBind(b);
|
|
4313
4313
|
} catch (v) {
|
|
4314
|
-
|
|
4314
|
+
m.error("Haori", `Invalid fetch headers: ${v}`);
|
|
4315
4315
|
}
|
|
4316
4316
|
}
|
|
4317
4317
|
} else {
|
|
@@ -4327,7 +4327,7 @@ ${b}
|
|
|
4327
4327
|
try {
|
|
4328
4328
|
s.headers = P.parseDataBind(b);
|
|
4329
4329
|
} catch (v) {
|
|
4330
|
-
|
|
4330
|
+
m.error("Haori", `Invalid fetch headers: ${v}`);
|
|
4331
4331
|
}
|
|
4332
4332
|
}
|
|
4333
4333
|
}
|
|
@@ -4381,7 +4381,7 @@ ${b}
|
|
|
4381
4381
|
b.length > 0 ? (r.bindFragments = [], b.forEach((v) => {
|
|
4382
4382
|
const R = S.get(v);
|
|
4383
4383
|
R && r.bindFragments.push(R);
|
|
4384
|
-
})) :
|
|
4384
|
+
})) : m.error(
|
|
4385
4385
|
"Haori",
|
|
4386
4386
|
`Bind element not found: ${E} (${a})`
|
|
4387
4387
|
);
|
|
@@ -4399,14 +4399,14 @@ ${b}
|
|
|
4399
4399
|
t ? e.hasAttribute(o) && (r.bindArg = e.getRawAttribute(o)) : e.hasAttribute(l) ? r.bindArg = e.getRawAttribute(
|
|
4400
4400
|
l
|
|
4401
4401
|
) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
|
|
4402
|
-
const
|
|
4403
|
-
if (e.hasAttribute(
|
|
4404
|
-
const E = e.getRawAttribute(
|
|
4402
|
+
const c = t ? g.attrName(t, "bind-params") : g.attrName(null, "bind-params", !0);
|
|
4403
|
+
if (e.hasAttribute(c)) {
|
|
4404
|
+
const E = e.getRawAttribute(c);
|
|
4405
4405
|
r.bindParams = E.split("&").map((b) => b.trim());
|
|
4406
4406
|
}
|
|
4407
|
-
const
|
|
4408
|
-
if (e.hasAttribute(
|
|
4409
|
-
const E = e.getRawAttribute(
|
|
4407
|
+
const p = t ? g.attrName(t, "bind-append") : g.attrName(null, "bind-append", !0);
|
|
4408
|
+
if (e.hasAttribute(p)) {
|
|
4409
|
+
const E = e.getRawAttribute(p);
|
|
4410
4410
|
r.bindAppendParams = E.split("&").map((b) => b.trim()).filter(Boolean);
|
|
4411
4411
|
}
|
|
4412
4412
|
const y = t ? g.attrName(t, "bind-merge") : g.attrName(null, "bind-merge", !0);
|
|
@@ -4428,7 +4428,7 @@ ${b}
|
|
|
4428
4428
|
R.length > 0 ? (r.adjustFragments = [], R.forEach((C) => {
|
|
4429
4429
|
const F = S.get(C);
|
|
4430
4430
|
F && r.adjustFragments.push(F);
|
|
4431
|
-
})) :
|
|
4431
|
+
})) : m.error(
|
|
4432
4432
|
"Haori",
|
|
4433
4433
|
`Adjust element not found: ${v} (${g.attrName(t, "adjust")})`
|
|
4434
4434
|
);
|
|
@@ -4440,9 +4440,9 @@ ${b}
|
|
|
4440
4440
|
isNaN(C) || (r.adjustValue = C);
|
|
4441
4441
|
}
|
|
4442
4442
|
}
|
|
4443
|
-
if (e.hasAttribute(g.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(g.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(g.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(g.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${
|
|
4443
|
+
if (e.hasAttribute(g.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(g.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(g.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(g.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${u.prefix}${t}-after-run`)) {
|
|
4444
4444
|
const v = e.getRawAttribute(
|
|
4445
|
-
`${
|
|
4445
|
+
`${u.prefix}${t}-after-run`
|
|
4446
4446
|
);
|
|
4447
4447
|
try {
|
|
4448
4448
|
r.afterCallback = new Function(
|
|
@@ -4453,7 +4453,7 @@ ${v}
|
|
|
4453
4453
|
`
|
|
4454
4454
|
);
|
|
4455
4455
|
} catch (R) {
|
|
4456
|
-
|
|
4456
|
+
m.error("Haori", `Invalid after script: ${R}`);
|
|
4457
4457
|
}
|
|
4458
4458
|
}
|
|
4459
4459
|
if (e.hasAttribute(g.attrName(t, "dialog")) && (r.dialogMessage = e.getAttribute(g.attrName(t, "dialog")).replace(/\\n/g, `
|
|
@@ -4490,7 +4490,7 @@ ${v}
|
|
|
4490
4490
|
const R = document.body.querySelector(v);
|
|
4491
4491
|
R !== null ? r.historyFormFragment = A.getFormFragment(
|
|
4492
4492
|
S.get(R)
|
|
4493
|
-
) :
|
|
4493
|
+
) : m.error(
|
|
4494
4494
|
"Haori",
|
|
4495
4495
|
`Form element not found: ${v} (${g.attrName(t, "history-form")})`
|
|
4496
4496
|
);
|
|
@@ -4514,10 +4514,10 @@ ${v}
|
|
|
4514
4514
|
document.body.querySelectorAll(C).forEach(($) => {
|
|
4515
4515
|
const W = S.get($);
|
|
4516
4516
|
W && F.push(W);
|
|
4517
|
-
}), F.length === 0 &&
|
|
4517
|
+
}), F.length === 0 && m.error("Haori", `Element not found: ${C} (${R})`);
|
|
4518
4518
|
else if (v === "open" || v === "close") {
|
|
4519
4519
|
const U = e.getTarget().closest("dialog");
|
|
4520
|
-
U ? F.push(S.get(U)) :
|
|
4520
|
+
U ? F.push(S.get(U)) : m.error("Haori", `Ancestor <dialog> not found (${R})`);
|
|
4521
4521
|
} else
|
|
4522
4522
|
F.push(e);
|
|
4523
4523
|
if (F.length > 0)
|
|
@@ -4554,12 +4554,12 @@ ${v}
|
|
|
4554
4554
|
const R = document.body.querySelector(v);
|
|
4555
4555
|
if (R !== null) {
|
|
4556
4556
|
const C = S.get(R);
|
|
4557
|
-
C ? r.copySourceFragment = C :
|
|
4557
|
+
C ? r.copySourceFragment = C : m.error(
|
|
4558
4558
|
"Haori",
|
|
4559
4559
|
`Element is not managed by Haori: ${v} (${b})`
|
|
4560
4560
|
);
|
|
4561
4561
|
} else
|
|
4562
|
-
|
|
4562
|
+
m.error(
|
|
4563
4563
|
"Haori",
|
|
4564
4564
|
`Element not found: ${v} (${b})`
|
|
4565
4565
|
);
|
|
@@ -4575,7 +4575,7 @@ ${v}
|
|
|
4575
4575
|
const b = document.body.querySelector(E);
|
|
4576
4576
|
b !== null ? r.formFragment = A.getFormFragment(
|
|
4577
4577
|
S.get(b)
|
|
4578
|
-
) :
|
|
4578
|
+
) : m.error(
|
|
4579
4579
|
"Haori",
|
|
4580
4580
|
`Form element not found: ${E} (${g.attrName(null, "fetch-form", !0)})`
|
|
4581
4581
|
);
|
|
@@ -4588,7 +4588,7 @@ ${v}
|
|
|
4588
4588
|
E ? (document.body.querySelectorAll(E).forEach((R) => {
|
|
4589
4589
|
const C = S.get(R);
|
|
4590
4590
|
C && b.push(C);
|
|
4591
|
-
}), b.length === 0 &&
|
|
4591
|
+
}), b.length === 0 && m.error(
|
|
4592
4592
|
"Haori",
|
|
4593
4593
|
`Element not found: ${E} (${H})`
|
|
4594
4594
|
)) : b.push(e), b.length > 0 && (r.fetchStateFragments = b);
|
|
@@ -4667,13 +4667,13 @@ ${v}
|
|
|
4667
4667
|
if (this.options.runScript) {
|
|
4668
4668
|
const d = this.options.targetFragment?.getTarget() ?? null;
|
|
4669
4669
|
try {
|
|
4670
|
-
const
|
|
4670
|
+
const c = this.options.runScript.call(
|
|
4671
4671
|
d,
|
|
4672
4672
|
this.domEvent
|
|
4673
4673
|
);
|
|
4674
|
-
|
|
4675
|
-
} catch (
|
|
4676
|
-
|
|
4674
|
+
c === !1 && this.domEvent && this.domEvent.preventDefault(), c != null && typeof c.then == "function" && await c;
|
|
4675
|
+
} catch (c) {
|
|
4676
|
+
m.error("Haori", `Run script execution error: ${c}`);
|
|
4677
4677
|
}
|
|
4678
4678
|
}
|
|
4679
4679
|
if (!await this.confirm())
|
|
@@ -4698,20 +4698,20 @@ ${v}
|
|
|
4698
4698
|
}
|
|
4699
4699
|
const a = Object.keys(i).length > 0;
|
|
4700
4700
|
if (n) {
|
|
4701
|
-
const d = { ...s || {} },
|
|
4702
|
-
if (y &&
|
|
4703
|
-
runtime:
|
|
4704
|
-
requestedMethod:
|
|
4705
|
-
effectiveMethod:
|
|
4701
|
+
const d = { ...s || {} }, c = r.requestedMethod, p = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
|
|
4702
|
+
if (y && m.info("Haori demo fetch normalization", {
|
|
4703
|
+
runtime: u.runtime,
|
|
4704
|
+
requestedMethod: c,
|
|
4705
|
+
effectiveMethod: p,
|
|
4706
4706
|
transportMode: "query-get",
|
|
4707
4707
|
url: n,
|
|
4708
4708
|
payload: a ? i : void 0,
|
|
4709
4709
|
queryString: T
|
|
4710
4710
|
}), this.options.targetFragment && n) {
|
|
4711
4711
|
const k = performance.now(), H = {
|
|
4712
|
-
runtime:
|
|
4713
|
-
requestedMethod:
|
|
4714
|
-
effectiveMethod:
|
|
4712
|
+
runtime: u.runtime,
|
|
4713
|
+
requestedMethod: c,
|
|
4714
|
+
effectiveMethod: p,
|
|
4715
4715
|
transportMode: y ? "query-get" : "http",
|
|
4716
4716
|
...y ? { queryString: T } : {}
|
|
4717
4717
|
};
|
|
@@ -4740,10 +4740,10 @@ ${v}
|
|
|
4740
4740
|
return fetch(n, d).then((k) => this.handleFetchResult(k, n || void 0));
|
|
4741
4741
|
}
|
|
4742
4742
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
|
|
4743
|
-
const d = this.options.formFragment,
|
|
4744
|
-
e && e.appliedDisabledAttribute && this.options.targetFragment &&
|
|
4743
|
+
const d = this.options.formFragment, c = d.getTarget(), p = /* @__PURE__ */ new Set();
|
|
4744
|
+
e && e.appliedDisabledAttribute && this.options.targetFragment && p.add(this.options.targetFragment);
|
|
4745
4745
|
const y = d.getBindingData();
|
|
4746
|
-
Object.assign(y, me(i)), await P.setBindingData(
|
|
4746
|
+
Object.assign(y, me(i)), await P.setBindingData(c, y, p);
|
|
4747
4747
|
}
|
|
4748
4748
|
this.suppressEmptyReplaceBind = !a && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input");
|
|
4749
4749
|
const o = a ? me(i) : {}, l = new Response(JSON.stringify(o), {
|
|
@@ -4766,7 +4766,7 @@ ${v}
|
|
|
4766
4766
|
if (g.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(ge))
|
|
4767
4767
|
return !1;
|
|
4768
4768
|
const r = t.hasAttribute(
|
|
4769
|
-
`${
|
|
4769
|
+
`${u.prefix}click-no-disabled`
|
|
4770
4770
|
);
|
|
4771
4771
|
return g.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(ge, ""), r || t.setAttribute("disabled", ""), {
|
|
4772
4772
|
target: t,
|
|
@@ -4829,10 +4829,10 @@ ${v}
|
|
|
4829
4829
|
}
|
|
4830
4830
|
if (this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
|
|
4831
4831
|
const o = a.getTarget();
|
|
4832
|
-
o instanceof HTMLElement ? s.push(i.openDialog(o)) :
|
|
4832
|
+
o instanceof HTMLElement ? s.push(i.openDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
|
|
4833
4833
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
|
|
4834
4834
|
const o = a.getTarget();
|
|
4835
|
-
o instanceof HTMLElement ? s.push(i.closeDialog(o)) :
|
|
4835
|
+
o instanceof HTMLElement ? s.push(i.closeDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
|
|
4836
4836
|
}), await Promise.all(s), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
|
|
4837
4837
|
this.options.toastMessage,
|
|
4838
4838
|
this.options.toastLevel ?? "info"
|
|
@@ -4842,8 +4842,8 @@ ${v}
|
|
|
4842
4842
|
if (o) {
|
|
4843
4843
|
const d = new URLSearchParams(window.location.search).get(o);
|
|
4844
4844
|
if (d !== null) {
|
|
4845
|
-
const
|
|
4846
|
-
qe.isSafeLocalPath(
|
|
4845
|
+
const c = d.trim();
|
|
4846
|
+
qe.isSafeLocalPath(c) ? a = c : m.warn(
|
|
4847
4847
|
"Haori",
|
|
4848
4848
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${d}`
|
|
4849
4849
|
);
|
|
@@ -4867,12 +4867,12 @@ ${v}
|
|
|
4867
4867
|
const s = e ? this.options.historyUrl : window.location.pathname, a = new URL(s, window.location.href);
|
|
4868
4868
|
if (a.origin !== window.location.origin) {
|
|
4869
4869
|
const l = "history.pushState: cross-origin URL is not allowed: " + a.toString();
|
|
4870
|
-
|
|
4870
|
+
m.error("Haori", l);
|
|
4871
4871
|
return;
|
|
4872
4872
|
}
|
|
4873
4873
|
const o = (l) => {
|
|
4874
|
-
for (const [d,
|
|
4875
|
-
|
|
4874
|
+
for (const [d, c] of Object.entries(l))
|
|
4875
|
+
c != null && (Array.isArray(c) ? c.forEach((p) => a.searchParams.append(d, String(p))) : typeof c == "object" ? a.searchParams.set(d, JSON.stringify(c)) : a.searchParams.set(d, String(c)));
|
|
4876
4876
|
};
|
|
4877
4877
|
i && o(t), n && o(r), history.pushState(
|
|
4878
4878
|
{ [it]: !0 },
|
|
@@ -4880,7 +4880,7 @@ ${v}
|
|
|
4880
4880
|
a.toString()
|
|
4881
4881
|
);
|
|
4882
4882
|
} catch (s) {
|
|
4883
|
-
|
|
4883
|
+
m.error("Haori", `history.pushState failed: ${s}`);
|
|
4884
4884
|
}
|
|
4885
4885
|
}
|
|
4886
4886
|
/**
|
|
@@ -4905,9 +4905,9 @@ ${v}
|
|
|
4905
4905
|
const a = await e.json(), o = [];
|
|
4906
4906
|
if (Array.isArray(a)) {
|
|
4907
4907
|
const l = /* @__PURE__ */ new Map(), d = [];
|
|
4908
|
-
for (const
|
|
4909
|
-
if (
|
|
4910
|
-
const
|
|
4908
|
+
for (const c of a)
|
|
4909
|
+
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
4910
|
+
const p = c.key, y = c.message, T = typeof p == "string" && p.length > 0 ? p : null, k = typeof y == "string" ? y : y != null ? String(y) : "";
|
|
4911
4911
|
if (k.length === 0)
|
|
4912
4912
|
continue;
|
|
4913
4913
|
if (T !== null) {
|
|
@@ -4915,12 +4915,12 @@ ${v}
|
|
|
4915
4915
|
H.push(k), l.set(T, H);
|
|
4916
4916
|
} else
|
|
4917
4917
|
d.push(k);
|
|
4918
|
-
} else typeof
|
|
4919
|
-
for (const [
|
|
4920
|
-
o.push({ key:
|
|
4918
|
+
} else typeof c == "string" && c.length > 0 && d.push(c);
|
|
4919
|
+
for (const [c, p] of l)
|
|
4920
|
+
o.push({ key: c, message: p.join(`
|
|
4921
4921
|
`) });
|
|
4922
|
-
for (const
|
|
4923
|
-
o.push({ message:
|
|
4922
|
+
for (const c of d)
|
|
4923
|
+
o.push({ message: c });
|
|
4924
4924
|
} else if (a && typeof a == "object") {
|
|
4925
4925
|
if (typeof a.message == "string" && o.push({ message: a.message }), Array.isArray(a.messages))
|
|
4926
4926
|
for (const l of a.messages)
|
|
@@ -5017,7 +5017,7 @@ ${v}
|
|
|
5017
5017
|
response: i
|
|
5018
5018
|
});
|
|
5019
5019
|
} catch (s) {
|
|
5020
|
-
|
|
5020
|
+
m.error("Haori", `Invalid bind-transform: ${s}`);
|
|
5021
5021
|
}
|
|
5022
5022
|
if (this.options.bindParams) {
|
|
5023
5023
|
const s = {};
|
|
@@ -5026,9 +5026,9 @@ ${v}
|
|
|
5026
5026
|
}), i = s;
|
|
5027
5027
|
}
|
|
5028
5028
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
5029
|
-
|
|
5029
|
+
m.warn(
|
|
5030
5030
|
"Haori",
|
|
5031
|
-
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${
|
|
5031
|
+
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${u.prefix}${this.eventType}-form.`
|
|
5032
5032
|
);
|
|
5033
5033
|
return;
|
|
5034
5034
|
}
|
|
@@ -5060,13 +5060,13 @@ ${v}
|
|
|
5060
5060
|
});
|
|
5061
5061
|
else if (typeof i == "string") {
|
|
5062
5062
|
if (this.options.defaultSelfBind) {
|
|
5063
|
-
|
|
5063
|
+
m.warn(
|
|
5064
5064
|
"Haori",
|
|
5065
5065
|
"string data is not bound because no bind target was specified."
|
|
5066
5066
|
);
|
|
5067
5067
|
return;
|
|
5068
5068
|
}
|
|
5069
|
-
return
|
|
5069
|
+
return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
5070
5070
|
new Error("string data cannot be bound without a bindArg.")
|
|
5071
5071
|
);
|
|
5072
5072
|
} else
|
|
@@ -5187,34 +5187,34 @@ ${v}
|
|
|
5187
5187
|
let i = this.options.fetchUrl;
|
|
5188
5188
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
5189
5189
|
n.headers || void 0
|
|
5190
|
-
), a = (n.method || "GET").toUpperCase(), o =
|
|
5190
|
+
), a = (n.method || "GET").toUpperCase(), o = u.runtime === "demo" && !st(a), l = o ? "GET" : a;
|
|
5191
5191
|
if (n.method = l, Object.keys(t).length > 0 && te(t)) {
|
|
5192
|
-
const
|
|
5193
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(
|
|
5192
|
+
const c = s.get("Content-Type") || "";
|
|
5193
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(c) ? ut(t) && m.warn(
|
|
5194
5194
|
"Haori",
|
|
5195
|
-
`A File value nested under ${
|
|
5196
|
-
) :
|
|
5195
|
+
`A File value nested under ${u.prefix}form-object / ${u.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
5196
|
+
) : m.warn(
|
|
5197
5197
|
"Haori",
|
|
5198
|
-
`A File value cannot be sent without ${
|
|
5198
|
+
`A File value cannot be sent without ${u.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
5199
5199
|
);
|
|
5200
5200
|
}
|
|
5201
5201
|
if (l === "GET" || l === "HEAD" || l === "OPTIONS")
|
|
5202
5202
|
Object.keys(t).length > 0 && (i = ot(i, t));
|
|
5203
5203
|
else if (Object.keys(t).length > 0) {
|
|
5204
|
-
const
|
|
5205
|
-
if (/multipart\/form-data/i.test(
|
|
5204
|
+
const c = s.get("Content-Type") || "";
|
|
5205
|
+
if (/multipart\/form-data/i.test(c)) {
|
|
5206
5206
|
s.delete("Content-Type");
|
|
5207
|
-
const
|
|
5207
|
+
const p = new FormData();
|
|
5208
5208
|
for (const [y, T] of Object.entries(t))
|
|
5209
|
-
T == null ?
|
|
5210
|
-
k instanceof Blob ?
|
|
5211
|
-
}) : typeof T == "object" ?
|
|
5212
|
-
n.body =
|
|
5213
|
-
} else if (/application\/x-www-form-urlencoded/i.test(
|
|
5214
|
-
const
|
|
5209
|
+
T == null ? p.append(y, "") : T instanceof Blob ? p.append(y, T) : Array.isArray(T) ? T.forEach((k) => {
|
|
5210
|
+
k instanceof Blob ? p.append(y, k) : p.append(y, String(k));
|
|
5211
|
+
}) : typeof T == "object" ? p.append(y, JSON.stringify(T)) : p.append(y, String(T));
|
|
5212
|
+
n.body = p;
|
|
5213
|
+
} else if (/application\/x-www-form-urlencoded/i.test(c)) {
|
|
5214
|
+
const p = new URLSearchParams();
|
|
5215
5215
|
for (const [y, T] of Object.entries(t))
|
|
5216
|
-
T !== void 0 && (T === null ?
|
|
5217
|
-
n.body =
|
|
5216
|
+
T !== void 0 && (T === null ? p.append(y, "") : Array.isArray(T) ? T.forEach((k) => p.append(y, String(k))) : typeof T == "object" ? p.append(y, JSON.stringify(T)) : p.append(y, String(T)));
|
|
5217
|
+
n.body = p;
|
|
5218
5218
|
} else
|
|
5219
5219
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
5220
5220
|
}
|
|
@@ -5309,11 +5309,11 @@ ${v}
|
|
|
5309
5309
|
*/
|
|
5310
5310
|
getRowFragment() {
|
|
5311
5311
|
if (!this.options.targetFragment)
|
|
5312
|
-
return
|
|
5312
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
5313
5313
|
const e = this.options.targetFragment.closestByAttribute(
|
|
5314
|
-
`${
|
|
5314
|
+
`${u.prefix}row`
|
|
5315
5315
|
);
|
|
5316
|
-
return e || (
|
|
5316
|
+
return e || (m.error("Haori", "Row fragment not found."), null);
|
|
5317
5317
|
}
|
|
5318
5318
|
/**
|
|
5319
5319
|
* 行を追加します。
|
|
@@ -5344,7 +5344,7 @@ ${v}
|
|
|
5344
5344
|
if (!e)
|
|
5345
5345
|
return Promise.reject(new Error("Row fragment not found."));
|
|
5346
5346
|
const t = e.getParent();
|
|
5347
|
-
return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${
|
|
5347
|
+
return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${u.prefix}each-before`) && !i.hasAttribute(`${u.prefix}each-after`)).length <= 1 ? Promise.resolve() : e.remove();
|
|
5348
5348
|
}
|
|
5349
5349
|
/**
|
|
5350
5350
|
* 前の行へ移動します。
|
|
@@ -5437,24 +5437,24 @@ class dt {
|
|
|
5437
5437
|
try {
|
|
5438
5438
|
r = await fetch(e, t);
|
|
5439
5439
|
} catch (n) {
|
|
5440
|
-
throw
|
|
5440
|
+
throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
5441
5441
|
}
|
|
5442
5442
|
if (!r.ok) {
|
|
5443
5443
|
je(r.status);
|
|
5444
5444
|
const n = `${r.status} ${r.statusText}`;
|
|
5445
|
-
throw
|
|
5445
|
+
throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
5446
5446
|
}
|
|
5447
5447
|
let i;
|
|
5448
5448
|
try {
|
|
5449
5449
|
i = await r.text();
|
|
5450
5450
|
} catch (n) {
|
|
5451
|
-
throw
|
|
5451
|
+
throw m.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
5452
5452
|
}
|
|
5453
5453
|
try {
|
|
5454
5454
|
const s = new DOMParser().parseFromString(i, "text/html");
|
|
5455
|
-
return s && s.body ? s.body.innerHTML : (
|
|
5455
|
+
return s && s.body ? s.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), i);
|
|
5456
5456
|
} catch (n) {
|
|
5457
|
-
return
|
|
5457
|
+
return m.error("[Haori]", "Failed to parse imported HTML:", e, n), i;
|
|
5458
5458
|
}
|
|
5459
5459
|
}
|
|
5460
5460
|
}
|
|
@@ -5467,7 +5467,7 @@ const h = class h {
|
|
|
5467
5467
|
*/
|
|
5468
5468
|
static isDeferredAttributeName(e) {
|
|
5469
5469
|
return h.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
5470
|
-
(t) => e === `${
|
|
5470
|
+
(t) => e === `${u.prefix}${t}`
|
|
5471
5471
|
);
|
|
5472
5472
|
}
|
|
5473
5473
|
/**
|
|
@@ -5478,7 +5478,7 @@ const h = class h {
|
|
|
5478
5478
|
*/
|
|
5479
5479
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
5480
5480
|
return h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
5481
|
-
(t) => e === `${
|
|
5481
|
+
(t) => e === `${u.prefix}${t}`
|
|
5482
5482
|
);
|
|
5483
5483
|
}
|
|
5484
5484
|
/**
|
|
@@ -5498,7 +5498,7 @@ const h = class h {
|
|
|
5498
5498
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
5499
5499
|
*/
|
|
5500
5500
|
static getAliasedAttributeName(e) {
|
|
5501
|
-
const t = `${
|
|
5501
|
+
const t = `${u.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
5502
5502
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
5503
5503
|
}
|
|
5504
5504
|
/**
|
|
@@ -5511,7 +5511,7 @@ const h = class h {
|
|
|
5511
5511
|
static isAliasedAttributeReflection(e, t) {
|
|
5512
5512
|
const r = S.get(e);
|
|
5513
5513
|
return r instanceof M ? r.hasAttribute(
|
|
5514
|
-
`${
|
|
5514
|
+
`${u.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
5515
5515
|
) : !1;
|
|
5516
5516
|
}
|
|
5517
5517
|
/**
|
|
@@ -5590,7 +5590,7 @@ const h = class h {
|
|
|
5590
5590
|
if (t.has(e))
|
|
5591
5591
|
return Promise.resolve();
|
|
5592
5592
|
const r = [];
|
|
5593
|
-
return e.hasAttribute(`${
|
|
5593
|
+
return e.hasAttribute(`${u.prefix}fetch`) && r.push(h.executeManagedFetch(e)), e.hasAttribute(`${u.prefix}import`) && r.push(h.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
5594
5594
|
i instanceof M && r.push(
|
|
5595
5595
|
h.reevaluateReactiveSpecialAttributes(i, t)
|
|
5596
5596
|
);
|
|
@@ -5627,7 +5627,7 @@ const h = class h {
|
|
|
5627
5627
|
*/
|
|
5628
5628
|
static executeManagedImport(e) {
|
|
5629
5629
|
const t = e.getTarget(), r = h.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
5630
|
-
`${
|
|
5630
|
+
`${u.prefix}import`
|
|
5631
5631
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
5632
5632
|
if (r.running)
|
|
5633
5633
|
return n !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
|
|
@@ -5637,22 +5637,22 @@ const h = class h {
|
|
|
5637
5637
|
return Promise.resolve();
|
|
5638
5638
|
r.lastUrl = n, r.running = !0;
|
|
5639
5639
|
const s = performance.now();
|
|
5640
|
-
return t.setAttribute(`${
|
|
5640
|
+
return t.setAttribute(`${u.prefix}importing`, ""), N.importStart(t, n), dt.load(n).then((a) => {
|
|
5641
5641
|
const o = new TextEncoder().encode(a).length;
|
|
5642
5642
|
return I.enqueue(() => {
|
|
5643
5643
|
t.innerHTML = a;
|
|
5644
5644
|
}).then(() => {
|
|
5645
|
-
if (t.removeAttribute(`${
|
|
5645
|
+
if (t.removeAttribute(`${u.prefix}importing`), N.importEnd(t, n, o, s), !document.body.hasAttribute("data-haori-ready")) {
|
|
5646
5646
|
const l = [];
|
|
5647
5647
|
return t.childNodes.forEach((d) => {
|
|
5648
|
-
const
|
|
5649
|
-
|
|
5648
|
+
const c = S.get(d);
|
|
5649
|
+
c instanceof M ? l.push(h.scan(c.getTarget())) : c instanceof j && l.push(h.evaluateText(c));
|
|
5650
5650
|
}), Promise.all(l).then(() => {
|
|
5651
5651
|
});
|
|
5652
5652
|
}
|
|
5653
5653
|
});
|
|
5654
5654
|
}).catch((a) => {
|
|
5655
|
-
t.removeAttribute(`${
|
|
5655
|
+
t.removeAttribute(`${u.prefix}importing`), N.importError(t, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
|
|
5656
5656
|
}).finally(() => {
|
|
5657
5657
|
if (r.running = !1, r.rerunRequested)
|
|
5658
5658
|
return r.rerunRequested = !1, h.executeManagedImport(e);
|
|
@@ -5728,7 +5728,7 @@ const h = class h {
|
|
|
5728
5728
|
let t = Promise.resolve();
|
|
5729
5729
|
const r = /* @__PURE__ */ new Set();
|
|
5730
5730
|
for (const i of h.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
5731
|
-
const n =
|
|
5731
|
+
const n = u.prefix + i;
|
|
5732
5732
|
e.hasAttribute(n) && (t = t.then(
|
|
5733
5733
|
() => h.setAttribute(
|
|
5734
5734
|
e.getTarget(),
|
|
@@ -5746,7 +5746,7 @@ const h = class h {
|
|
|
5746
5746
|
));
|
|
5747
5747
|
}
|
|
5748
5748
|
for (const i of h.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
5749
|
-
const n =
|
|
5749
|
+
const n = u.prefix + i;
|
|
5750
5750
|
e.hasAttribute(n) && (t = t.then(
|
|
5751
5751
|
() => h.setAttribute(
|
|
5752
5752
|
e.getTarget(),
|
|
@@ -5766,8 +5766,8 @@ const h = class h {
|
|
|
5766
5766
|
* @returns 子孫初期化をスキップするなら true
|
|
5767
5767
|
*/
|
|
5768
5768
|
static shouldSkipChildInitialization(e, t) {
|
|
5769
|
-
const r = e.getAttribute(`${
|
|
5770
|
-
return e.hasAttribute(`${
|
|
5769
|
+
const r = e.getAttribute(`${u.prefix}if`);
|
|
5770
|
+
return e.hasAttribute(`${u.prefix}if`) && h.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${u.prefix}each`);
|
|
5771
5771
|
}
|
|
5772
5772
|
/**
|
|
5773
5773
|
* エレメントに属性を設定します。
|
|
@@ -5790,7 +5790,7 @@ const h = class h {
|
|
|
5790
5790
|
const a = [];
|
|
5791
5791
|
let o = null, l = null;
|
|
5792
5792
|
switch (t) {
|
|
5793
|
-
case `${
|
|
5793
|
+
case `${u.prefix}bind`: {
|
|
5794
5794
|
if (r === null)
|
|
5795
5795
|
n.clearBindingDataCache(), n.setBindingData({});
|
|
5796
5796
|
else {
|
|
@@ -5800,49 +5800,49 @@ const h = class h {
|
|
|
5800
5800
|
}
|
|
5801
5801
|
break;
|
|
5802
5802
|
}
|
|
5803
|
-
case `${
|
|
5803
|
+
case `${u.prefix}derive`:
|
|
5804
5804
|
l = h.createDeriveInputSignature(
|
|
5805
5805
|
n,
|
|
5806
5806
|
r,
|
|
5807
|
-
n.getRawAttribute(`${
|
|
5807
|
+
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
5808
5808
|
), o = h.evaluateDerive(
|
|
5809
5809
|
n,
|
|
5810
5810
|
r,
|
|
5811
|
-
n.getRawAttribute(`${
|
|
5811
|
+
n.getRawAttribute(`${u.prefix}derive-name`)
|
|
5812
5812
|
), a.push(o.then(() => {
|
|
5813
5813
|
}));
|
|
5814
5814
|
break;
|
|
5815
|
-
case `${
|
|
5815
|
+
case `${u.prefix}derive-name`:
|
|
5816
5816
|
l = h.createDeriveInputSignature(
|
|
5817
5817
|
n,
|
|
5818
|
-
n.getRawAttribute(`${
|
|
5818
|
+
n.getRawAttribute(`${u.prefix}derive`),
|
|
5819
5819
|
r
|
|
5820
5820
|
), o = h.evaluateDerive(
|
|
5821
5821
|
n,
|
|
5822
|
-
n.getRawAttribute(`${
|
|
5822
|
+
n.getRawAttribute(`${u.prefix}derive`),
|
|
5823
5823
|
r
|
|
5824
5824
|
), a.push(o.then(() => {
|
|
5825
5825
|
}));
|
|
5826
5826
|
break;
|
|
5827
|
-
case `${
|
|
5827
|
+
case `${u.prefix}if`:
|
|
5828
5828
|
a.push(h.evaluateIf(n));
|
|
5829
5829
|
break;
|
|
5830
|
-
case `${
|
|
5830
|
+
case `${u.prefix}each`:
|
|
5831
5831
|
a.push(h.evaluateEach(n));
|
|
5832
5832
|
break;
|
|
5833
|
-
case `${
|
|
5833
|
+
case `${u.prefix}fetch`:
|
|
5834
5834
|
a.push(h.executeManagedFetch(n));
|
|
5835
5835
|
break;
|
|
5836
|
-
case `${
|
|
5836
|
+
case `${u.prefix}import`:
|
|
5837
5837
|
typeof r == "string" && a.push(h.executeManagedImport(n));
|
|
5838
5838
|
break;
|
|
5839
|
-
case `${
|
|
5840
|
-
const d = n.getAttribute(`${
|
|
5839
|
+
case `${u.prefix}url-param`: {
|
|
5840
|
+
const d = n.getAttribute(`${u.prefix}url-arg`), c = qe.readParams();
|
|
5841
5841
|
if (d === null)
|
|
5842
|
-
a.push(h.setBindingData(e,
|
|
5842
|
+
a.push(h.setBindingData(e, c, /* @__PURE__ */ new Set(), !0));
|
|
5843
5843
|
else {
|
|
5844
|
-
const
|
|
5845
|
-
|
|
5844
|
+
const p = n.getRawBindingData() || {};
|
|
5845
|
+
p[String(d)] = c, a.push(h.setBindingData(e, p, /* @__PURE__ */ new Set(), !0));
|
|
5846
5846
|
}
|
|
5847
5847
|
break;
|
|
5848
5848
|
}
|
|
@@ -5880,17 +5880,16 @@ const h = class h {
|
|
|
5880
5880
|
const o = () => {
|
|
5881
5881
|
s.markBindingWorkStart();
|
|
5882
5882
|
const l = s.getRawBindingData() ?? t;
|
|
5883
|
-
let d = n ? s.setAttribute(`${
|
|
5884
|
-
|
|
5885
|
-
const
|
|
5886
|
-
|
|
5887
|
-
}
|
|
5888
|
-
return d = d.then(() => h.evaluateAll(s, r)), d = d.then(
|
|
5883
|
+
let d = n ? s.setAttribute(`${u.prefix}bind`, JSON.stringify(l)) : Promise.resolve();
|
|
5884
|
+
return e.tagName === "FORM" && (d = d.then(() => {
|
|
5885
|
+
const c = s.getRawBindingData() ?? t, p = s.getAttribute(`${u.prefix}form-arg`), y = p && c[String(p)] && typeof c[String(p)] == "object" && !Array.isArray(c[String(p)]) ? c[String(p)] : p ? {} : c;
|
|
5886
|
+
return A.syncValues(s, y);
|
|
5887
|
+
})), d = d.then(() => h.evaluateAll(s, r)), d = d.then(
|
|
5889
5888
|
() => h.reevaluateReactiveSpecialAttributes(s, r)
|
|
5890
5889
|
), d.then(
|
|
5891
5890
|
() => s.markBindingWorkEnd(),
|
|
5892
|
-
(
|
|
5893
|
-
throw s.markBindingWorkEnd(),
|
|
5891
|
+
(c) => {
|
|
5892
|
+
throw s.markBindingWorkEnd(), c;
|
|
5894
5893
|
}
|
|
5895
5894
|
);
|
|
5896
5895
|
};
|
|
@@ -5939,20 +5938,20 @@ const h = class h {
|
|
|
5939
5938
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
5940
5939
|
const d = l.getTarget();
|
|
5941
5940
|
return d.id ? `#${d.id}` : d.tagName.toLowerCase();
|
|
5942
|
-
}, s = (l, d,
|
|
5941
|
+
}, s = (l, d, c, p) => {
|
|
5943
5942
|
if (l)
|
|
5944
5943
|
for (const y of Object.keys(l))
|
|
5945
5944
|
y in i || (i[y] = {
|
|
5946
5945
|
value: l[y],
|
|
5947
5946
|
source: n(d),
|
|
5948
|
-
kind:
|
|
5949
|
-
depth:
|
|
5947
|
+
kind: c,
|
|
5948
|
+
depth: p
|
|
5950
5949
|
});
|
|
5951
5950
|
};
|
|
5952
5951
|
let a = t, o = 0;
|
|
5953
5952
|
for (; a; )
|
|
5954
5953
|
a !== t && s(a.getRawDerivedBindingData(), a, "derive", o), s(a.getRawBindingData(), a, "bind", o), a = a.getParent(), o += 1;
|
|
5955
|
-
return L.isEnabled() &&
|
|
5954
|
+
return L.isEnabled() && m.info("[Haori]", "scope dump for", e, { resolved: r, sources: i }), { resolved: r, sources: i };
|
|
5956
5955
|
}
|
|
5957
5956
|
/**
|
|
5958
5957
|
* data-bind 属性の値をパースします。
|
|
@@ -5965,7 +5964,7 @@ const h = class h {
|
|
|
5965
5964
|
try {
|
|
5966
5965
|
return JSON.parse(e);
|
|
5967
5966
|
} catch (t) {
|
|
5968
|
-
return
|
|
5967
|
+
return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
5969
5968
|
}
|
|
5970
5969
|
else {
|
|
5971
5970
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -6027,7 +6026,7 @@ const h = class h {
|
|
|
6027
6026
|
i.push(r.setValue(t));
|
|
6028
6027
|
const n = h.getFormFragment(r);
|
|
6029
6028
|
if (n) {
|
|
6030
|
-
const s = A.getValues(n), a = n.getAttribute(`${
|
|
6029
|
+
const s = A.getValues(n), a = n.getAttribute(`${u.prefix}form-arg`);
|
|
6031
6030
|
let o;
|
|
6032
6031
|
a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(h.setBindingData(n.getTarget(), o));
|
|
6033
6032
|
}
|
|
@@ -6056,25 +6055,25 @@ const h = class h {
|
|
|
6056
6055
|
if (t.has(e))
|
|
6057
6056
|
return Promise.resolve();
|
|
6058
6057
|
let r = h.reevaluateInterpolatedAttributes(e);
|
|
6059
|
-
const i = e.hasAttribute(`${
|
|
6060
|
-
let l = !1, d = !1,
|
|
6058
|
+
const i = e.hasAttribute(`${u.prefix}derive`), n = e.hasAttribute(`${u.prefix}if`), s = e.hasAttribute(`${u.prefix}each`), a = e.getRawAttribute(`${u.prefix}derive`), o = e.getRawAttribute(`${u.prefix}derive-name`);
|
|
6059
|
+
let l = !1, d = !1, c = null;
|
|
6061
6060
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
6062
|
-
const
|
|
6061
|
+
const p = h.createDeriveInputSignature(
|
|
6063
6062
|
e,
|
|
6064
6063
|
a,
|
|
6065
6064
|
o
|
|
6066
6065
|
);
|
|
6067
|
-
|
|
6066
|
+
p === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
6068
6067
|
() => h.evaluateDerive(e, a, o).then(
|
|
6069
6068
|
() => {
|
|
6070
6069
|
}
|
|
6071
6070
|
)
|
|
6072
|
-
)) : e.getDeriveInputSignature() !==
|
|
6071
|
+
)) : e.getDeriveInputSignature() !== p && (r = r.then(() => h.evaluateDerive(
|
|
6073
6072
|
e,
|
|
6074
6073
|
a,
|
|
6075
6074
|
o
|
|
6076
6075
|
).then(() => {
|
|
6077
|
-
e.setDeriveInputSignature(
|
|
6076
|
+
e.setDeriveInputSignature(p);
|
|
6078
6077
|
})));
|
|
6079
6078
|
}
|
|
6080
6079
|
return n && (r = r.then(() => h.evaluateIf(e))), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => h.evaluateEach(e))) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
@@ -6083,27 +6082,27 @@ const h = class h {
|
|
|
6083
6082
|
e.setDeriveSubtreeSignature(null), h.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
6084
6083
|
return;
|
|
6085
6084
|
}
|
|
6086
|
-
|
|
6085
|
+
c = h.createDescendantBindingSignature(
|
|
6087
6086
|
e,
|
|
6088
6087
|
"evaluateAll"
|
|
6089
|
-
), d = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() ===
|
|
6088
|
+
), d = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === c, h.logDerivedSubtreeProfileSnapshot(
|
|
6090
6089
|
e,
|
|
6091
6090
|
l ? "skip-hit" : "skip-miss"
|
|
6092
6091
|
);
|
|
6093
6092
|
})), r.then(() => {
|
|
6094
6093
|
if (l)
|
|
6095
6094
|
return;
|
|
6096
|
-
const
|
|
6095
|
+
const p = [];
|
|
6097
6096
|
return e.getChildren().forEach((y) => {
|
|
6098
6097
|
if (y instanceof M) {
|
|
6099
6098
|
if (h.canSkipUnchangedNestedEach(y))
|
|
6100
6099
|
return;
|
|
6101
|
-
|
|
6102
|
-
} else y instanceof j &&
|
|
6103
|
-
}), Promise.all(
|
|
6100
|
+
p.push(h.evaluateAll(y, t));
|
|
6101
|
+
} else y instanceof j && p.push(h.evaluateText(y));
|
|
6102
|
+
}), Promise.all(p).then(() => {
|
|
6104
6103
|
});
|
|
6105
6104
|
}).then(() => {
|
|
6106
|
-
d &&
|
|
6105
|
+
d && c !== null && e.setDeriveSubtreeSignature(c);
|
|
6107
6106
|
}));
|
|
6108
6107
|
}
|
|
6109
6108
|
/**
|
|
@@ -6115,9 +6114,9 @@ const h = class h {
|
|
|
6115
6114
|
* @returns Promise (評価完了時に解決)
|
|
6116
6115
|
*/
|
|
6117
6116
|
static evaluateDerive(e, t = e.getRawAttribute(
|
|
6118
|
-
`${
|
|
6117
|
+
`${u.prefix}derive`
|
|
6119
6118
|
), r = e.getRawAttribute(
|
|
6120
|
-
`${
|
|
6119
|
+
`${u.prefix}derive-name`
|
|
6121
6120
|
)) {
|
|
6122
6121
|
const i = e.getRawDerivedBindingData(), n = typeof r == "string" ? r.trim() : "";
|
|
6123
6122
|
if (!t || n === "")
|
|
@@ -6166,7 +6165,7 @@ const h = class h {
|
|
|
6166
6165
|
* @return 戻り値はありません。
|
|
6167
6166
|
*/
|
|
6168
6167
|
static logFalsyIfDiagnostics(e) {
|
|
6169
|
-
const t = e.getRawAttribute(`${
|
|
6168
|
+
const t = e.getRawAttribute(`${u.prefix}if`);
|
|
6170
6169
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
6171
6170
|
return;
|
|
6172
6171
|
const { sources: r } = h.dumpScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
@@ -6178,7 +6177,7 @@ const h = class h {
|
|
|
6178
6177
|
const a = {};
|
|
6179
6178
|
i.forEach((o) => {
|
|
6180
6179
|
o in r && (a[o] = r[o]);
|
|
6181
|
-
}),
|
|
6180
|
+
}), m.info(
|
|
6182
6181
|
"[Haori]",
|
|
6183
6182
|
"data-if is falsy (hidden):",
|
|
6184
6183
|
t,
|
|
@@ -6195,7 +6194,7 @@ const h = class h {
|
|
|
6195
6194
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
6196
6195
|
*/
|
|
6197
6196
|
static evaluateIf(e) {
|
|
6198
|
-
const t = [], r = e.getAttribute(`${
|
|
6197
|
+
const t = [], r = e.getAttribute(`${u.prefix}if`);
|
|
6199
6198
|
if (h.isHiddenIfCondition(r))
|
|
6200
6199
|
L.isEnabled() && h.logFalsyIfDiagnostics(e), t.push(
|
|
6201
6200
|
e.hide().then(() => {
|
|
@@ -6228,9 +6227,9 @@ const h = class h {
|
|
|
6228
6227
|
* @return 戻り値はありません。
|
|
6229
6228
|
*/
|
|
6230
6229
|
static triggerLoadOnShow(e) {
|
|
6231
|
-
const t = `${
|
|
6230
|
+
const t = `${u.prefix}load-`;
|
|
6232
6231
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new q(e, "load").run().catch((i) => {
|
|
6233
|
-
|
|
6232
|
+
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
6234
6233
|
});
|
|
6235
6234
|
}
|
|
6236
6235
|
/**
|
|
@@ -6272,14 +6271,14 @@ const h = class h {
|
|
|
6272
6271
|
* @return すべての差分更新が安定するまでの完了 Promise
|
|
6273
6272
|
*/
|
|
6274
6273
|
static runEachUpdateLoop(e, t) {
|
|
6275
|
-
t.running = !0, e.getTarget().removeAttribute(`${
|
|
6274
|
+
t.running = !0, e.getTarget().removeAttribute(`${u.prefix}each-done`);
|
|
6276
6275
|
const r = (async () => {
|
|
6277
6276
|
try {
|
|
6278
6277
|
do
|
|
6279
6278
|
t.rerunRequested = !1, await h.performEachUpdate(e);
|
|
6280
6279
|
while (t.rerunRequested);
|
|
6281
6280
|
const i = e.getTarget();
|
|
6282
|
-
i.setAttribute(`${
|
|
6281
|
+
i.setAttribute(`${u.prefix}each-done`, ""), h.runEachRenderedScript(i);
|
|
6283
6282
|
} finally {
|
|
6284
6283
|
t.running = !1, t.settled = null;
|
|
6285
6284
|
}
|
|
@@ -6298,7 +6297,7 @@ const h = class h {
|
|
|
6298
6297
|
* @param target data-each コンテナ要素
|
|
6299
6298
|
*/
|
|
6300
6299
|
static runEachRenderedScript(e) {
|
|
6301
|
-
const t = `${
|
|
6300
|
+
const t = `${u.prefix}each-rendered-run`;
|
|
6302
6301
|
if (!e.hasAttribute(t))
|
|
6303
6302
|
return;
|
|
6304
6303
|
const r = String(e.getAttribute(t) ?? "");
|
|
@@ -6315,14 +6314,14 @@ ${r}
|
|
|
6315
6314
|
${r}
|
|
6316
6315
|
`);
|
|
6317
6316
|
} catch (n) {
|
|
6318
|
-
|
|
6317
|
+
m.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
6319
6318
|
}
|
|
6320
6319
|
}
|
|
6321
6320
|
if (i)
|
|
6322
6321
|
try {
|
|
6323
6322
|
i.call(e);
|
|
6324
6323
|
} catch (n) {
|
|
6325
|
-
|
|
6324
|
+
m.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
6326
6325
|
}
|
|
6327
6326
|
}
|
|
6328
6327
|
/**
|
|
@@ -6348,12 +6347,12 @@ ${r}
|
|
|
6348
6347
|
* @param fragment data-each コンテナのフラグメント
|
|
6349
6348
|
*/
|
|
6350
6349
|
static runEachRenderedChange(e) {
|
|
6351
|
-
const t = `${
|
|
6350
|
+
const t = `${u.prefix}each-rendered-change`, r = e.getTarget();
|
|
6352
6351
|
if (!r.hasAttribute(t))
|
|
6353
6352
|
return;
|
|
6354
6353
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
6355
6354
|
let n = !1;
|
|
6356
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (h.EACH_RENDERED_CHANGE_WARNED.has(r) || (h.EACH_RENDERED_CHANGE_WARNED.add(r),
|
|
6355
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (h.EACH_RENDERED_CHANGE_WARNED.has(r) || (h.EACH_RENDERED_CHANGE_WARNED.add(r), m.warn(
|
|
6357
6356
|
"[Haori]",
|
|
6358
6357
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
6359
6358
|
))), h.countEachRenderedRows(e) !== 0) {
|
|
@@ -6365,7 +6364,7 @@ ${r}
|
|
|
6365
6364
|
try {
|
|
6366
6365
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
6367
6366
|
} catch (s) {
|
|
6368
|
-
|
|
6367
|
+
m.error("[Haori]", `each-rendered-change dispatch error: ${s}`);
|
|
6369
6368
|
}
|
|
6370
6369
|
}
|
|
6371
6370
|
}
|
|
@@ -6382,7 +6381,7 @@ ${r}
|
|
|
6382
6381
|
static countEachRenderedRows(e) {
|
|
6383
6382
|
let t = 0;
|
|
6384
6383
|
for (const r of e.getChildElementFragments())
|
|
6385
|
-
r.getTarget().hasAttribute(`${
|
|
6384
|
+
r.getTarget().hasAttribute(`${u.prefix}row`) && (t += 1);
|
|
6386
6385
|
return t;
|
|
6387
6386
|
}
|
|
6388
6387
|
/**
|
|
@@ -6396,7 +6395,7 @@ ${r}
|
|
|
6396
6395
|
if (t === null)
|
|
6397
6396
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
6398
6397
|
let r = e.getTemplate();
|
|
6399
|
-
const i = e.getAttribute(`${
|
|
6398
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = h.createBindingSignature({
|
|
6400
6399
|
key: i ? String(i) : null,
|
|
6401
6400
|
items: t
|
|
6402
6401
|
});
|
|
@@ -6404,7 +6403,7 @@ ${r}
|
|
|
6404
6403
|
let s = !1;
|
|
6405
6404
|
if (e.getChildren().forEach((a) => {
|
|
6406
6405
|
if (!s && a instanceof M) {
|
|
6407
|
-
if (a.hasAttribute(`${
|
|
6406
|
+
if (a.hasAttribute(`${u.prefix}each-before`) || a.hasAttribute(`${u.prefix}each-after`))
|
|
6408
6407
|
return;
|
|
6409
6408
|
r = a.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
6410
6409
|
const o = a.getTarget();
|
|
@@ -6413,11 +6412,11 @@ ${r}
|
|
|
6413
6412
|
}), !s) {
|
|
6414
6413
|
const a = e.getTarget();
|
|
6415
6414
|
Array.from(a.children).filter(
|
|
6416
|
-
(l) => !l.hasAttribute(`${
|
|
6415
|
+
(l) => !l.hasAttribute(`${u.prefix}each-before`) && !l.hasAttribute(`${u.prefix}each-after`)
|
|
6417
6416
|
).forEach((l) => {
|
|
6418
6417
|
if (!s) {
|
|
6419
|
-
const
|
|
6420
|
-
|
|
6418
|
+
const c = S.get(l);
|
|
6419
|
+
c instanceof M && (r = c.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
6421
6420
|
}
|
|
6422
6421
|
const d = S.get(l);
|
|
6423
6422
|
d instanceof M && e.getChildren().includes(d) && (e.removeChild(d), d.setMounted(!1)), l.parentNode && l.parentNode.removeChild(l);
|
|
@@ -6438,8 +6437,8 @@ ${r}
|
|
|
6438
6437
|
* @returns 配列。無効な場合は null
|
|
6439
6438
|
*/
|
|
6440
6439
|
static resolveEachItems(e) {
|
|
6441
|
-
const t = e.getAttributeEvaluation(`${
|
|
6442
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
6440
|
+
const t = e.getAttributeEvaluation(`${u.prefix}each`), r = t?.value;
|
|
6441
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
|
|
6443
6442
|
}
|
|
6444
6443
|
/**
|
|
6445
6444
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -6449,15 +6448,15 @@ ${r}
|
|
|
6449
6448
|
* @returns 省略可能なら true
|
|
6450
6449
|
*/
|
|
6451
6450
|
static canSkipUnchangedNestedEach(e) {
|
|
6452
|
-
if (!e.hasAttribute(`${
|
|
6451
|
+
if (!e.hasAttribute(`${u.prefix}each`) || e.getEachInputSignature() === null)
|
|
6453
6452
|
return !1;
|
|
6454
6453
|
const t = e.getParent();
|
|
6455
|
-
if (t?.closestByAttribute(`${
|
|
6454
|
+
if (t?.closestByAttribute(`${u.prefix}derive`) || t?.closestByAttribute(`${u.prefix}derive-name`) || t?.closestByAttribute(`${u.prefix}if`) || t?.closestByAttribute(`${u.prefix}fetch`) || t?.closestByAttribute(`${u.prefix}import`) || h.hasNonEachDynamicElementState(e))
|
|
6456
6455
|
return !1;
|
|
6457
6456
|
const r = h.resolveEachItems(e);
|
|
6458
6457
|
if (r === null)
|
|
6459
6458
|
return !1;
|
|
6460
|
-
const i = e.getAttribute(`${
|
|
6459
|
+
const i = e.getAttribute(`${u.prefix}each-key`), n = h.createBindingSignature({
|
|
6461
6460
|
key: i ? String(i) : null,
|
|
6462
6461
|
items: r
|
|
6463
6462
|
});
|
|
@@ -6471,7 +6470,7 @@ ${r}
|
|
|
6471
6470
|
* @returns 省略可能なら true
|
|
6472
6471
|
*/
|
|
6473
6472
|
static canSkipStableDerivedSubtree(e) {
|
|
6474
|
-
return !e.hasAttribute(`${
|
|
6473
|
+
return !e.hasAttribute(`${u.prefix}derive`) || e.hasAttribute(`${u.prefix}if`) || e.hasAttribute(`${u.prefix}each`) || e.hasAttribute(`${u.prefix}fetch`) || e.hasAttribute(`${u.prefix}import`) ? !1 : !h.hasDisallowedDerivedSubtreeDescendant(e);
|
|
6475
6474
|
}
|
|
6476
6475
|
/**
|
|
6477
6476
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -6480,7 +6479,7 @@ ${r}
|
|
|
6480
6479
|
* @returns 含むなら true
|
|
6481
6480
|
*/
|
|
6482
6481
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
6483
|
-
return e.getChildren().some((t) => t instanceof M ? t.hasAttribute(`${
|
|
6482
|
+
return e.getChildren().some((t) => t instanceof M ? t.hasAttribute(`${u.prefix}derive`) || t.hasAttribute(`${u.prefix}derive-name`) || t.hasAttribute(`${u.prefix}fetch`) || t.hasAttribute(`${u.prefix}import`) ? !0 : h.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
6484
6483
|
}
|
|
6485
6484
|
/**
|
|
6486
6485
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -6528,7 +6527,7 @@ ${r}
|
|
|
6528
6527
|
* @returns プロファイル
|
|
6529
6528
|
*/
|
|
6530
6529
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
6531
|
-
if (!L.isEnabled() || !e.hasAttribute(`${
|
|
6530
|
+
if (!L.isEnabled() || !e.hasAttribute(`${u.prefix}derive`))
|
|
6532
6531
|
return null;
|
|
6533
6532
|
const t = h.DERIVE_SUBTREE_PROFILES.get(e);
|
|
6534
6533
|
if (t)
|
|
@@ -6562,8 +6561,8 @@ ${r}
|
|
|
6562
6561
|
n += `#${i.id.trim()}`, t.unshift(n);
|
|
6563
6562
|
break;
|
|
6564
6563
|
}
|
|
6565
|
-
const s = r.getRawAttribute(`${
|
|
6566
|
-
typeof s == "string" && s.trim() !== "" && (n += `[${
|
|
6564
|
+
const s = r.getRawAttribute(`${u.prefix}derive-name`);
|
|
6565
|
+
typeof s == "string" && s.trim() !== "" && (n += `[${u.prefix}derive-name="${s.trim()}"]`);
|
|
6567
6566
|
const a = r.getParent();
|
|
6568
6567
|
if (a) {
|
|
6569
6568
|
const o = a.getChildren().filter((l) => l instanceof M).findIndex((l) => l === r);
|
|
@@ -6597,7 +6596,7 @@ ${r}
|
|
|
6597
6596
|
*/
|
|
6598
6597
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
6599
6598
|
const r = h.getOrCreateDerivedSubtreeProfile(e);
|
|
6600
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
6599
|
+
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
|
|
6601
6600
|
reason: t,
|
|
6602
6601
|
hostId: r.hostId,
|
|
6603
6602
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -6616,15 +6615,15 @@ ${r}
|
|
|
6616
6615
|
*/
|
|
6617
6616
|
static hasNonEachDynamicElementState(e) {
|
|
6618
6617
|
const t = /* @__PURE__ */ new Set([
|
|
6619
|
-
`${
|
|
6620
|
-
`${
|
|
6621
|
-
`${
|
|
6622
|
-
`${
|
|
6618
|
+
`${u.prefix}each`,
|
|
6619
|
+
`${u.prefix}each-key`,
|
|
6620
|
+
`${u.prefix}each-arg`,
|
|
6621
|
+
`${u.prefix}each-index`
|
|
6623
6622
|
]);
|
|
6624
6623
|
return e.getAttributeNames().some((i) => {
|
|
6625
6624
|
if (t.has(i))
|
|
6626
6625
|
return !1;
|
|
6627
|
-
if (i.startsWith(`${
|
|
6626
|
+
if (i.startsWith(`${u.prefix}attr-`) || i.startsWith(u.prefix))
|
|
6628
6627
|
return !0;
|
|
6629
6628
|
const n = e.getRawAttribute(i);
|
|
6630
6629
|
return typeof n == "string" && n.includes("{{");
|
|
@@ -6650,7 +6649,7 @@ ${r}
|
|
|
6650
6649
|
* @returns 再評価が必要なら true
|
|
6651
6650
|
*/
|
|
6652
6651
|
static isFreshInitializationDynamicAttribute(e, t) {
|
|
6653
|
-
if (t.startsWith(`${
|
|
6652
|
+
if (t.startsWith(`${u.prefix}attr-`) || t.startsWith(u.prefix))
|
|
6654
6653
|
return !0;
|
|
6655
6654
|
const r = e.getRawAttribute(t);
|
|
6656
6655
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -6664,10 +6663,10 @@ ${r}
|
|
|
6664
6663
|
static updateDiff(e, t) {
|
|
6665
6664
|
const r = e.getTemplate();
|
|
6666
6665
|
if (r === null)
|
|
6667
|
-
return
|
|
6668
|
-
let i = e.getAttribute(`${
|
|
6666
|
+
return m.error("[Haori]", "Template is not set for each element."), Promise.resolve();
|
|
6667
|
+
let i = e.getAttribute(`${u.prefix}each-index`);
|
|
6669
6668
|
i && (i = String(i));
|
|
6670
|
-
const n = e.getAttribute(`${
|
|
6669
|
+
const n = e.getAttribute(`${u.prefix}each-key`), s = e.getAttribute(`${u.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
6671
6670
|
t.forEach((b, v) => {
|
|
6672
6671
|
const R = h.createListKey(
|
|
6673
6672
|
b,
|
|
@@ -6677,18 +6676,18 @@ ${r}
|
|
|
6677
6676
|
o.push(R), a.set(R, { item: b, itemIndex: v });
|
|
6678
6677
|
});
|
|
6679
6678
|
const l = new Set(o), d = [];
|
|
6680
|
-
let
|
|
6681
|
-
(b) => !b.hasAttribute(`${
|
|
6679
|
+
let c = e.getChildren().filter((b) => b instanceof M).filter(
|
|
6680
|
+
(b) => !b.hasAttribute(`${u.prefix}each-before`) && !b.hasAttribute(`${u.prefix}each-after`)
|
|
6682
6681
|
);
|
|
6683
|
-
const
|
|
6684
|
-
|
|
6685
|
-
const y =
|
|
6686
|
-
|
|
6682
|
+
const p = c.map((b) => b.getListKey());
|
|
6683
|
+
c = c.filter((b) => l.has(String(b.getListKey())) ? !0 : (d.push(b.remove()), !1));
|
|
6684
|
+
const y = c.map((b) => b.getListKey()), T = /* @__PURE__ */ new Map();
|
|
6685
|
+
c.forEach((b) => {
|
|
6687
6686
|
const v = b.getListKey();
|
|
6688
6687
|
v !== null && !T.has(v) && T.set(v, b);
|
|
6689
6688
|
});
|
|
6690
6689
|
const k = e.getChildElementFragments().slice(), H = k.filter(
|
|
6691
|
-
(b) => b.hasAttribute(`${
|
|
6690
|
+
(b) => b.hasAttribute(`${u.prefix}each-before`)
|
|
6692
6691
|
).length;
|
|
6693
6692
|
let E = Promise.resolve();
|
|
6694
6693
|
return o.forEach((b, v) => {
|
|
@@ -6733,7 +6732,7 @@ ${r}
|
|
|
6733
6732
|
($) => $ !== null
|
|
6734
6733
|
), v = y.filter(
|
|
6735
6734
|
($) => $ !== null
|
|
6736
|
-
), R = new Set(v), C = b.filter(($) => !R.has($)), U =
|
|
6735
|
+
), R = new Set(v), C = b.filter(($) => !R.has($)), U = p.filter(
|
|
6737
6736
|
($) => $ !== null
|
|
6738
6737
|
).filter(
|
|
6739
6738
|
($) => !l.has($)
|
|
@@ -6788,15 +6787,15 @@ ${r}
|
|
|
6788
6787
|
[n]: t
|
|
6789
6788
|
}, r && (a[r] = i);
|
|
6790
6789
|
else
|
|
6791
|
-
return
|
|
6790
|
+
return m.error(
|
|
6792
6791
|
"[Haori]",
|
|
6793
|
-
`Primitive value requires '${
|
|
6792
|
+
`Primitive value requires '${u.prefix}each-arg' attribute: ${t}`
|
|
6794
6793
|
), Promise.resolve(!1);
|
|
6795
6794
|
const o = a, l = h.createBindingSignature({
|
|
6796
6795
|
listKey: s,
|
|
6797
6796
|
bindingData: o
|
|
6798
6797
|
});
|
|
6799
|
-
return e.getListKey() === s && e.getRenderSignature() === l ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(l), e.setBindingData(o), e.setAttribute(`${
|
|
6798
|
+
return e.getListKey() === s && e.getRenderSignature() === l ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(l), e.setBindingData(o), e.setAttribute(`${u.prefix}row`, s).then(() => !0));
|
|
6800
6799
|
}
|
|
6801
6800
|
/**
|
|
6802
6801
|
* 新規挿入行に遅延再評価が必要かどうかを判定します。
|
|
@@ -6823,7 +6822,7 @@ ${r}
|
|
|
6823
6822
|
*/
|
|
6824
6823
|
static hasMountSensitiveAttribute(e) {
|
|
6825
6824
|
return ["fetch", "import"].some(
|
|
6826
|
-
(t) => e.hasAttribute(`${
|
|
6825
|
+
(t) => e.hasAttribute(`${u.prefix}${t}`)
|
|
6827
6826
|
);
|
|
6828
6827
|
}
|
|
6829
6828
|
/**
|
|
@@ -6971,7 +6970,7 @@ const ee = class ee {
|
|
|
6971
6970
|
try {
|
|
6972
6971
|
t();
|
|
6973
6972
|
} catch (r) {
|
|
6974
|
-
|
|
6973
|
+
m.error("[Haori]", "Deferred event handling error:", r);
|
|
6975
6974
|
}
|
|
6976
6975
|
}
|
|
6977
6976
|
/**
|
|
@@ -6998,7 +6997,7 @@ const ee = class ee {
|
|
|
6998
6997
|
* @returns `data-on` 属性名
|
|
6999
6998
|
*/
|
|
7000
6999
|
get onAttributeName() {
|
|
7001
|
-
return `${
|
|
7000
|
+
return `${u.prefix}on`;
|
|
7002
7001
|
}
|
|
7003
7002
|
/**
|
|
7004
7003
|
* ルート配下に存在する `data-on` 宣言を走査し、カスタムイベントを購読します。
|
|
@@ -7026,7 +7025,7 @@ const ee = class ee {
|
|
|
7026
7025
|
if (e === null || e === "")
|
|
7027
7026
|
return;
|
|
7028
7027
|
if (ee.BUILTIN_EVENT_NAMES.has(e)) {
|
|
7029
|
-
|
|
7028
|
+
m.warn(
|
|
7030
7029
|
"[Haori]",
|
|
7031
7030
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
7032
7031
|
);
|
|
@@ -7056,7 +7055,7 @@ const ee = class ee {
|
|
|
7056
7055
|
return;
|
|
7057
7056
|
const n = S.get(i);
|
|
7058
7057
|
n instanceof M && new q(n, "on", t).run().catch((s) => {
|
|
7059
|
-
|
|
7058
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
7060
7059
|
});
|
|
7061
7060
|
});
|
|
7062
7061
|
}
|
|
@@ -7094,11 +7093,11 @@ const ee = class ee {
|
|
|
7094
7093
|
const r = this.getElementFromTarget(e.target, t);
|
|
7095
7094
|
if (r) {
|
|
7096
7095
|
if (t === "input") {
|
|
7097
|
-
const i = `${
|
|
7096
|
+
const i = `${u.prefix}input-`;
|
|
7098
7097
|
if (!r.getAttributeNames().some((s) => s.startsWith(i)))
|
|
7099
7098
|
return;
|
|
7100
7099
|
}
|
|
7101
|
-
if (r.hasAttribute(`${
|
|
7100
|
+
if (r.hasAttribute(`${u.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
7102
7101
|
this.deferredProcedures.push(() => {
|
|
7103
7102
|
r.isConnected && this.runProcedureFor(r, t, e);
|
|
7104
7103
|
});
|
|
@@ -7130,10 +7129,10 @@ const ee = class ee {
|
|
|
7130
7129
|
}
|
|
7131
7130
|
const n = () => {
|
|
7132
7131
|
new q(i, t, r).run().catch((s) => {
|
|
7133
|
-
|
|
7132
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
7134
7133
|
});
|
|
7135
7134
|
};
|
|
7136
|
-
if (t === "click" && e.hasAttribute(`${
|
|
7135
|
+
if (t === "click" && e.hasAttribute(`${u.prefix}click-defer`)) {
|
|
7137
7136
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => n()) : setTimeout(n, 0);
|
|
7138
7137
|
return;
|
|
7139
7138
|
}
|
|
@@ -7170,7 +7169,7 @@ const ee = class ee {
|
|
|
7170
7169
|
* @returns 処理対象要素。見つからない場合は null
|
|
7171
7170
|
*/
|
|
7172
7171
|
findClickableElement(e) {
|
|
7173
|
-
const t = `${
|
|
7172
|
+
const t = `${u.prefix}click-`, r = `${u.prefix}click-passive`;
|
|
7174
7173
|
let i = e;
|
|
7175
7174
|
for (; i; ) {
|
|
7176
7175
|
if (i.getAttributeNames().some((s) => s.startsWith(t) && s !== r))
|
|
@@ -7215,7 +7214,7 @@ const D = class D {
|
|
|
7215
7214
|
}
|
|
7216
7215
|
if (typeof IntersectionObserver > "u")
|
|
7217
7216
|
return;
|
|
7218
|
-
const i = D.resolveRoot(r), n = D.resolveRootMargin(r), s = D.resolveThreshold(r), a = r.hasAttribute(`${
|
|
7217
|
+
const i = D.resolveRoot(r), n = D.resolveRootMargin(r), s = D.resolveThreshold(r), a = r.hasAttribute(`${u.prefix}intersect-once`);
|
|
7219
7218
|
if (t && t.observer.root === i && t.observer.rootMargin === n && D.sameThreshold(
|
|
7220
7219
|
t.observer.thresholds,
|
|
7221
7220
|
s
|
|
@@ -7227,18 +7226,18 @@ const D = class D {
|
|
|
7227
7226
|
const o = new IntersectionObserver(
|
|
7228
7227
|
(l) => {
|
|
7229
7228
|
const d = D.registrations.get(e);
|
|
7230
|
-
d && l.forEach((
|
|
7231
|
-
!
|
|
7232
|
-
|
|
7233
|
-
}).catch((
|
|
7234
|
-
|
|
7229
|
+
d && l.forEach((c) => {
|
|
7230
|
+
!c.isIntersecting || d.running || D.isDisabled(d.fragment) || (d.running = !0, new q(d.fragment, "intersect").runWithResult().then((p) => {
|
|
7231
|
+
p && d.once && (d.observer.disconnect(), D.registrations.delete(e));
|
|
7232
|
+
}).catch((p) => {
|
|
7233
|
+
m.error(
|
|
7235
7234
|
"[Haori]",
|
|
7236
7235
|
"Intersect procedure execution error:",
|
|
7237
|
-
|
|
7236
|
+
p
|
|
7238
7237
|
);
|
|
7239
7238
|
}).finally(() => {
|
|
7240
|
-
const
|
|
7241
|
-
|
|
7239
|
+
const p = D.registrations.get(e);
|
|
7240
|
+
p && (p.running = !1);
|
|
7242
7241
|
}));
|
|
7243
7242
|
});
|
|
7244
7243
|
},
|
|
@@ -7272,32 +7271,32 @@ const D = class D {
|
|
|
7272
7271
|
}
|
|
7273
7272
|
static shouldObserve(e) {
|
|
7274
7273
|
return e.getAttributeNames().some((t) => {
|
|
7275
|
-
if (!t.startsWith(`${
|
|
7274
|
+
if (!t.startsWith(`${u.prefix}intersect-`))
|
|
7276
7275
|
return !1;
|
|
7277
|
-
const r = t.slice(`${
|
|
7276
|
+
const r = t.slice(`${u.prefix}intersect-`.length);
|
|
7278
7277
|
return !D.CONFIG_KEYS.has(r);
|
|
7279
7278
|
});
|
|
7280
7279
|
}
|
|
7281
7280
|
static resolveRoot(e) {
|
|
7282
|
-
const t = `${
|
|
7281
|
+
const t = `${u.prefix}intersect-root`;
|
|
7283
7282
|
if (!e.hasAttribute(t))
|
|
7284
7283
|
return null;
|
|
7285
7284
|
const r = e.getAttribute(t);
|
|
7286
7285
|
if (typeof r != "string" || r.trim() === "")
|
|
7287
7286
|
return null;
|
|
7288
7287
|
const i = document.querySelector(r);
|
|
7289
|
-
return D.isHtmlElement(i) ? i : (
|
|
7288
|
+
return D.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
7290
7289
|
}
|
|
7291
7290
|
static resolveRootMargin(e) {
|
|
7292
|
-
const t = `${
|
|
7291
|
+
const t = `${u.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
7293
7292
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
7294
7293
|
}
|
|
7295
7294
|
static resolveThreshold(e) {
|
|
7296
|
-
const t = `${
|
|
7295
|
+
const t = `${u.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
7297
7296
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
7298
7297
|
}
|
|
7299
7298
|
static isDisabled(e) {
|
|
7300
|
-
const t = `${
|
|
7299
|
+
const t = `${u.prefix}intersect-disabled`, r = e.getAttribute(t);
|
|
7301
7300
|
if (r === null || r === !1)
|
|
7302
7301
|
return !1;
|
|
7303
7302
|
if (typeof r == "boolean")
|
|
@@ -7359,7 +7358,7 @@ const w = class w {
|
|
|
7359
7358
|
return;
|
|
7360
7359
|
const i = w.resolveVarName(r);
|
|
7361
7360
|
if (i === "") {
|
|
7362
|
-
t && (t.observer.disconnect(), w.registrations.delete(e)),
|
|
7361
|
+
t && (t.observer.disconnect(), w.registrations.delete(e)), m.warn(
|
|
7363
7362
|
"[Haori]",
|
|
7364
7363
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
7365
7364
|
);
|
|
@@ -7376,11 +7375,11 @@ const w = class w {
|
|
|
7376
7375
|
const d = w.registrations.get(e);
|
|
7377
7376
|
if (!d)
|
|
7378
7377
|
return;
|
|
7379
|
-
let
|
|
7380
|
-
l.forEach((
|
|
7381
|
-
const y =
|
|
7382
|
-
d.observedRows.has(y) && (
|
|
7383
|
-
}),
|
|
7378
|
+
let c = !1;
|
|
7379
|
+
l.forEach((p) => {
|
|
7380
|
+
const y = p.target;
|
|
7381
|
+
d.observedRows.has(y) && (p.isIntersecting ? d.visibleRows.has(y) || (d.visibleRows.add(y), c = !0) : d.visibleRows.delete(y) && (c = !0));
|
|
7382
|
+
}), c && w.scheduleCompute(d);
|
|
7384
7383
|
},
|
|
7385
7384
|
{
|
|
7386
7385
|
root: n,
|
|
@@ -7430,7 +7429,7 @@ const w = class w {
|
|
|
7430
7429
|
* @returns 監視対象なら true
|
|
7431
7430
|
*/
|
|
7432
7431
|
static shouldObserve(e) {
|
|
7433
|
-
return e.hasAttribute(`${
|
|
7432
|
+
return e.hasAttribute(`${u.prefix}each`) && e.hasAttribute(`${u.prefix}each-visible`);
|
|
7434
7433
|
}
|
|
7435
7434
|
/**
|
|
7436
7435
|
* 公開する変数名を解決します。
|
|
@@ -7439,7 +7438,7 @@ const w = class w {
|
|
|
7439
7438
|
* @returns 変数名。未指定なら空文字
|
|
7440
7439
|
*/
|
|
7441
7440
|
static resolveVarName(e) {
|
|
7442
|
-
const t = e.getRawAttribute(`${
|
|
7441
|
+
const t = e.getRawAttribute(`${u.prefix}each-visible`);
|
|
7443
7442
|
return typeof t == "string" ? t.trim() : "";
|
|
7444
7443
|
}
|
|
7445
7444
|
/**
|
|
@@ -7449,14 +7448,14 @@ const w = class w {
|
|
|
7449
7448
|
* @returns root 要素。未指定・不正ならビューポート(null)
|
|
7450
7449
|
*/
|
|
7451
7450
|
static resolveRoot(e) {
|
|
7452
|
-
const t = `${
|
|
7451
|
+
const t = `${u.prefix}each-visible-root`;
|
|
7453
7452
|
if (!e.hasAttribute(t))
|
|
7454
7453
|
return null;
|
|
7455
7454
|
const r = e.getAttribute(t);
|
|
7456
7455
|
if (typeof r != "string" || r.trim() === "")
|
|
7457
7456
|
return null;
|
|
7458
7457
|
const i = document.querySelector(r);
|
|
7459
|
-
return w.isHtmlElement(i) ? i : (
|
|
7458
|
+
return w.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
7460
7459
|
}
|
|
7461
7460
|
/**
|
|
7462
7461
|
* rootMargin を解決します。
|
|
@@ -7465,7 +7464,7 @@ const w = class w {
|
|
|
7465
7464
|
* @returns rootMargin 文字列(未指定は既定値)
|
|
7466
7465
|
*/
|
|
7467
7466
|
static resolveRootMargin(e) {
|
|
7468
|
-
const t = `${
|
|
7467
|
+
const t = `${u.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
7469
7468
|
return r === null || r === !1 || r === "" ? w.DEFAULT_ROOT_MARGIN : String(r);
|
|
7470
7469
|
}
|
|
7471
7470
|
/**
|
|
@@ -7476,7 +7475,7 @@ const w = class w {
|
|
|
7476
7475
|
*/
|
|
7477
7476
|
static realRowElements(e) {
|
|
7478
7477
|
return e.getChildren().filter(
|
|
7479
|
-
(t) => t instanceof M && !t.hasAttribute(`${
|
|
7478
|
+
(t) => t instanceof M && !t.hasAttribute(`${u.prefix}each-before`) && !t.hasAttribute(`${u.prefix}each-after`)
|
|
7480
7479
|
).map((t) => t.getTarget());
|
|
7481
7480
|
}
|
|
7482
7481
|
/**
|
|
@@ -7555,7 +7554,7 @@ const w = class w {
|
|
|
7555
7554
|
static publish(e, t) {
|
|
7556
7555
|
const r = w.resolveBindOwner(e.fragment);
|
|
7557
7556
|
if (!r) {
|
|
7558
|
-
|
|
7557
|
+
m.warn(
|
|
7559
7558
|
"[Haori]",
|
|
7560
7559
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
7561
7560
|
);
|
|
@@ -7573,7 +7572,7 @@ const w = class w {
|
|
|
7573
7572
|
!1,
|
|
7574
7573
|
!1
|
|
7575
7574
|
).catch((o) => {
|
|
7576
|
-
|
|
7575
|
+
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
7577
7576
|
});
|
|
7578
7577
|
}
|
|
7579
7578
|
/**
|
|
@@ -7584,7 +7583,7 @@ const w = class w {
|
|
|
7584
7583
|
* @returns 公開先フラグメント。無ければ null
|
|
7585
7584
|
*/
|
|
7586
7585
|
static resolveBindOwner(e) {
|
|
7587
|
-
const t = `${
|
|
7586
|
+
const t = `${u.prefix}bind`;
|
|
7588
7587
|
let r = e.getParent();
|
|
7589
7588
|
for (; r; ) {
|
|
7590
7589
|
if (r.hasAttribute(t))
|
|
@@ -7620,11 +7619,11 @@ const O = class O {
|
|
|
7620
7619
|
P.scan(document.head),
|
|
7621
7620
|
P.scan(document.body)
|
|
7622
7621
|
]), [r, i] = t;
|
|
7623
|
-
r.status !== "fulfilled" &&
|
|
7622
|
+
r.status !== "fulfilled" && m.error(
|
|
7624
7623
|
"[Haori]",
|
|
7625
7624
|
"Failed to build head fragment:",
|
|
7626
7625
|
r.reason
|
|
7627
|
-
), i.status !== "fulfilled" &&
|
|
7626
|
+
), i.status !== "fulfilled" && m.error(
|
|
7628
7627
|
"[Haori]",
|
|
7629
7628
|
"Failed to build body fragment:",
|
|
7630
7629
|
i.reason
|
|
@@ -7656,7 +7655,7 @@ const O = class O {
|
|
|
7656
7655
|
* @returns 外部管理サブツリーに属する場合 true
|
|
7657
7656
|
*/
|
|
7658
7657
|
static isExternallyManaged(e) {
|
|
7659
|
-
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${
|
|
7658
|
+
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${u.prefix}external]`) != null;
|
|
7660
7659
|
}
|
|
7661
7660
|
/**
|
|
7662
7661
|
* 指定された要素を監視します。
|
|
@@ -7696,7 +7695,7 @@ const O = class O {
|
|
|
7696
7695
|
break;
|
|
7697
7696
|
}
|
|
7698
7697
|
case "characterData": {
|
|
7699
|
-
i.target instanceof Text || i.target instanceof Comment ? P.changeText(i.target, i.target.textContent) :
|
|
7698
|
+
i.target instanceof Text || i.target instanceof Comment ? P.changeText(i.target, i.target.textContent) : m.warn(
|
|
7700
7699
|
"[Haori]",
|
|
7701
7700
|
"Unsupported character data type:",
|
|
7702
7701
|
i.target
|
|
@@ -7704,11 +7703,11 @@ const O = class O {
|
|
|
7704
7703
|
break;
|
|
7705
7704
|
}
|
|
7706
7705
|
default:
|
|
7707
|
-
|
|
7706
|
+
m.warn("[Haori]", "Unknown mutation type:", i.type);
|
|
7708
7707
|
continue;
|
|
7709
7708
|
}
|
|
7710
7709
|
} catch (n) {
|
|
7711
|
-
|
|
7710
|
+
m.error("[Haori]", "Error processing mutation:", n);
|
|
7712
7711
|
}
|
|
7713
7712
|
});
|
|
7714
7713
|
t.observe(e, {
|
|
@@ -7722,14 +7721,14 @@ const O = class O {
|
|
|
7722
7721
|
O._initialized = !1, O._mutationObservers = [], O._dispatcher = null;
|
|
7723
7722
|
let le = O;
|
|
7724
7723
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", le.init) : le.init();
|
|
7725
|
-
const ft = () => Z.waitForRenders(), gt = "0.26.
|
|
7724
|
+
const ft = () => Z.waitForRenders(), gt = "0.26.1";
|
|
7726
7725
|
export {
|
|
7727
7726
|
P as Core,
|
|
7728
|
-
|
|
7727
|
+
u as Env,
|
|
7729
7728
|
A as Form,
|
|
7730
7729
|
S as Fragment,
|
|
7731
7730
|
Z as Haori,
|
|
7732
|
-
|
|
7731
|
+
m as Log,
|
|
7733
7732
|
I as Queue,
|
|
7734
7733
|
Z as default,
|
|
7735
7734
|
gt as version,
|