haori 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/haori.cjs.js +11 -10
- package/dist/haori.es.js +389 -309
- package/dist/haori.iife.js +11 -10
- package/dist/index.d.ts +29 -3
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -31,11 +31,11 @@ const G = class G {
|
|
|
31
31
|
G.devMode = !1;
|
|
32
32
|
let H = G;
|
|
33
33
|
const ct = "embedded";
|
|
34
|
-
function
|
|
34
|
+
function Et(p) {
|
|
35
35
|
return p === "embedded" || p === "demo";
|
|
36
36
|
}
|
|
37
37
|
function xt(p) {
|
|
38
|
-
return p === null ? null :
|
|
38
|
+
return p === null ? null : Et(p) ? p : ct;
|
|
39
39
|
}
|
|
40
40
|
const L = class L {
|
|
41
41
|
/**
|
|
@@ -53,7 +53,7 @@ const L = class L {
|
|
|
53
53
|
* @return 戻り値はありません。
|
|
54
54
|
*/
|
|
55
55
|
static setRuntime(t) {
|
|
56
|
-
L._runtime =
|
|
56
|
+
L._runtime = Et(t) ? t : ct;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 実行環境からプレフィックスと開発モードかどうかを自動検出します。
|
|
@@ -126,11 +126,11 @@ class m {
|
|
|
126
126
|
console.error(t, ...e);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const kt = "yyyy/MM/dd HH:mm", Pt = "en-US", vt = 1e4;
|
|
130
130
|
function q(p) {
|
|
131
131
|
return String(p).padStart(2, "0");
|
|
132
132
|
}
|
|
133
|
-
function At(p, t =
|
|
133
|
+
function At(p, t = kt) {
|
|
134
134
|
if (p == null || p === "")
|
|
135
135
|
return "";
|
|
136
136
|
const e = p instanceof Date ? p : new Date(p);
|
|
@@ -172,7 +172,7 @@ function St(p, t) {
|
|
|
172
172
|
const i = Math.max(0, Math.trunc(t));
|
|
173
173
|
r.minimumFractionDigits = i, r.maximumFractionDigits = i;
|
|
174
174
|
}
|
|
175
|
-
return new Intl.NumberFormat(
|
|
175
|
+
return new Intl.NumberFormat(Pt, r).format(e);
|
|
176
176
|
}
|
|
177
177
|
function Tt(p, t, e) {
|
|
178
178
|
let r, i, n;
|
|
@@ -196,18 +196,18 @@ function wt(p, t, e = {}) {
|
|
|
196
196
|
Math.max(Math.trunc(Number(t)) || 0, 0),
|
|
197
197
|
r - 1
|
|
198
198
|
), n = Math.max(0, Math.trunc(e.window ?? 2)), s = Math.max(0, Math.trunc(e.boundary ?? 1)), a = /* @__PURE__ */ new Set();
|
|
199
|
-
for (let
|
|
200
|
-
a.add(
|
|
201
|
-
for (let
|
|
202
|
-
a.add(
|
|
203
|
-
for (let
|
|
204
|
-
a.add(
|
|
205
|
-
const o = Array.from(a).sort((
|
|
206
|
-
let
|
|
207
|
-
for (const
|
|
208
|
-
if (
|
|
209
|
-
if (
|
|
210
|
-
const g =
|
|
199
|
+
for (let d = 0; d < s && d < r; d += 1)
|
|
200
|
+
a.add(d);
|
|
201
|
+
for (let d = Math.max(0, r - s); d < r; d += 1)
|
|
202
|
+
a.add(d);
|
|
203
|
+
for (let d = Math.max(0, i - n); d <= Math.min(r - 1, i + n); d += 1)
|
|
204
|
+
a.add(d);
|
|
205
|
+
const o = Array.from(a).sort((d, g) => d - g), u = [];
|
|
206
|
+
let h = null;
|
|
207
|
+
for (const d of o) {
|
|
208
|
+
if (h !== null && d - h > 1)
|
|
209
|
+
if (d - h === 2) {
|
|
210
|
+
const g = h + 1;
|
|
211
211
|
u.push({
|
|
212
212
|
page: g,
|
|
213
213
|
label: g + 1,
|
|
@@ -217,15 +217,15 @@ function wt(p, t, e = {}) {
|
|
|
217
217
|
} else
|
|
218
218
|
u.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
219
219
|
u.push({
|
|
220
|
-
page:
|
|
221
|
-
label:
|
|
222
|
-
active:
|
|
220
|
+
page: d,
|
|
221
|
+
label: d + 1,
|
|
222
|
+
active: d === i,
|
|
223
223
|
ellipsis: !1
|
|
224
|
-
}),
|
|
224
|
+
}), h = d;
|
|
225
225
|
}
|
|
226
226
|
return u;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
228
|
+
const It = /^(\d{4})-(\d{1,2})$/, Ct = 1200;
|
|
229
229
|
function tt(p, t) {
|
|
230
230
|
const e = Number(p);
|
|
231
231
|
return Number.isFinite(e) ? Math.trunc(e) : t;
|
|
@@ -233,7 +233,7 @@ function tt(p, t) {
|
|
|
233
233
|
function at(p, t) {
|
|
234
234
|
if (typeof p != "string")
|
|
235
235
|
return "";
|
|
236
|
-
const e =
|
|
236
|
+
const e = It.exec(p.trim());
|
|
237
237
|
if (!e)
|
|
238
238
|
return "";
|
|
239
239
|
const r = Number(e[1]), i = Number(e[2]);
|
|
@@ -255,7 +255,7 @@ function Dt(p, t) {
|
|
|
255
255
|
const r = Bt(t);
|
|
256
256
|
if (r === "")
|
|
257
257
|
return [];
|
|
258
|
-
const i = Math.min(e,
|
|
258
|
+
const i = Math.min(e, Ct), n = [];
|
|
259
259
|
for (let s = 0; s <= i; s += 1) {
|
|
260
260
|
const a = at(r, -s);
|
|
261
261
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
@@ -277,11 +277,11 @@ function Rt(p, t) {
|
|
|
277
277
|
if (t !== void 0 && Number.isFinite(t))
|
|
278
278
|
u = Math.max(0, Math.trunc(t));
|
|
279
279
|
else {
|
|
280
|
-
const
|
|
281
|
-
u = Number.isFinite(
|
|
280
|
+
const d = tt(r.numberOfElements, NaN);
|
|
281
|
+
u = Number.isFinite(d) ? d : Math.min(s, i - a);
|
|
282
282
|
}
|
|
283
|
-
const
|
|
284
|
-
return { start: o, end: Math.max(
|
|
283
|
+
const h = Math.min(a + u, i);
|
|
284
|
+
return { start: o, end: Math.max(h, o), total: i, empty: !1 };
|
|
285
285
|
}
|
|
286
286
|
function Nt(p, t, e) {
|
|
287
287
|
if (!Array.isArray(p) || p.length === 0)
|
|
@@ -401,7 +401,7 @@ const $t = Object.freeze({
|
|
|
401
401
|
if (this.containsDangerousPatterns(t)) {
|
|
402
402
|
const o = this.detectDisallowedKeywords(t);
|
|
403
403
|
if (o.length > 0) {
|
|
404
|
-
const u = o.some((
|
|
404
|
+
const u = o.some((h) => h === "function" || h === "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.";
|
|
405
405
|
m.warn(
|
|
406
406
|
"[Haori]",
|
|
407
407
|
t,
|
|
@@ -444,29 +444,29 @@ const $t = Object.freeze({
|
|
|
444
444
|
if (u.compileFailed || u.evaluator === null)
|
|
445
445
|
return { value: null, unresolvedReference: !1 };
|
|
446
446
|
try {
|
|
447
|
-
const
|
|
447
|
+
const h = [], d = this.wrapBoundValues(s);
|
|
448
448
|
return u.bindKeys.forEach((g) => {
|
|
449
|
-
|
|
449
|
+
h.push(d[g]);
|
|
450
450
|
}), {
|
|
451
451
|
value: this.withBlockedPropertyAccess(
|
|
452
|
-
() => u.evaluator(...
|
|
452
|
+
() => u.evaluator(...h)
|
|
453
453
|
),
|
|
454
454
|
unresolvedReference: !1
|
|
455
455
|
};
|
|
456
|
-
} catch (
|
|
457
|
-
if (a &&
|
|
458
|
-
const g = this.extractMissingIdentifier(
|
|
456
|
+
} catch (h) {
|
|
457
|
+
if (a && h instanceof ReferenceError) {
|
|
458
|
+
const g = this.extractMissingIdentifier(h);
|
|
459
459
|
if (g !== null && this.canRecoverMissingIdentifier(g, s)) {
|
|
460
460
|
s[g] = void 0;
|
|
461
461
|
continue;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
return
|
|
464
|
+
const d = this.detectForbiddenIdentifiers(t);
|
|
465
|
+
return d.length > 0 && m.warn(
|
|
466
466
|
"[Haori]",
|
|
467
|
-
"Expression references blocked identifier(s): " +
|
|
467
|
+
"Expression references blocked identifier(s): " + d.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of this error). Use spread {...a, ...b} instead of Object.assign.",
|
|
468
468
|
t
|
|
469
|
-
), m.error("[Haori]", "Expression evaluation error:", t,
|
|
469
|
+
), m.error("[Haori]", "Expression evaluation error:", t, h), h instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
return m.error(
|
|
@@ -588,12 +588,12 @@ return (${t});`;
|
|
|
588
588
|
const r = [];
|
|
589
589
|
let i = null;
|
|
590
590
|
for (let n = 0; n < e.length; n++) {
|
|
591
|
-
const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, u = e[n - 2] || null,
|
|
591
|
+
const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, u = e[n - 2] || null, h = e[n - 3] || null;
|
|
592
592
|
if (this.startsObjectKey(
|
|
593
593
|
o,
|
|
594
594
|
i,
|
|
595
595
|
u,
|
|
596
|
-
|
|
596
|
+
h
|
|
597
597
|
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
598
598
|
this.decodeStringLiteral(s.value)
|
|
599
599
|
)) || s.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(s.value) || this.STRICT_FORBIDDEN_NAMES.includes(s.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(s.value)) || o === "member" && s.value !== "]" && s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
@@ -610,8 +610,8 @@ return (${t});`;
|
|
|
610
610
|
break;
|
|
611
611
|
}
|
|
612
612
|
case "[": {
|
|
613
|
-
const
|
|
614
|
-
r.push(
|
|
613
|
+
const d = this.startsMemberAccess(i) ? "member" : "array";
|
|
614
|
+
r.push(d);
|
|
615
615
|
break;
|
|
616
616
|
}
|
|
617
617
|
case "{":
|
|
@@ -1216,7 +1216,7 @@ const pt = class pt {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
};
|
|
1218
1218
|
pt.ASYNC_QUEUE = new dt();
|
|
1219
|
-
let
|
|
1219
|
+
let k = pt;
|
|
1220
1220
|
const N = class N {
|
|
1221
1221
|
/**
|
|
1222
1222
|
* 集計状態を初期化します。
|
|
@@ -1491,7 +1491,7 @@ const Y = class Y {
|
|
|
1491
1491
|
return Promise.resolve();
|
|
1492
1492
|
if (this.parent) {
|
|
1493
1493
|
const t = this.parent, e = t.skipMutationNodes;
|
|
1494
|
-
return
|
|
1494
|
+
return k.enqueue(() => {
|
|
1495
1495
|
t.skipMutationNodes = !0, this.target.parentNode === t.getTarget() && t.getTarget().removeChild(this.target), this.mounted = !1;
|
|
1496
1496
|
}).finally(() => {
|
|
1497
1497
|
t.skipMutationNodes = e;
|
|
@@ -1499,7 +1499,7 @@ const Y = class Y {
|
|
|
1499
1499
|
} else {
|
|
1500
1500
|
const t = this.target.parentNode;
|
|
1501
1501
|
if (t)
|
|
1502
|
-
return
|
|
1502
|
+
return k.enqueue(() => {
|
|
1503
1503
|
this.target.parentNode === t && t.removeChild(this.target), this.mounted = !1;
|
|
1504
1504
|
});
|
|
1505
1505
|
this.mounted = !1;
|
|
@@ -1516,7 +1516,7 @@ const Y = class Y {
|
|
|
1516
1516
|
return Promise.resolve();
|
|
1517
1517
|
if (this.parent) {
|
|
1518
1518
|
const t = this.parent, e = t.skipMutationNodes;
|
|
1519
|
-
return
|
|
1519
|
+
return k.enqueue(() => {
|
|
1520
1520
|
t.skipMutationNodes = !0, this.target.parentNode !== t.getTarget() && t.getTarget().appendChild(this.target), this.mounted = !0;
|
|
1521
1521
|
}).finally(() => {
|
|
1522
1522
|
t.skipMutationNodes = e;
|
|
@@ -1575,8 +1575,8 @@ const Y = class Y {
|
|
|
1575
1575
|
}
|
|
1576
1576
|
};
|
|
1577
1577
|
Y.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
1578
|
-
let
|
|
1579
|
-
const W = class W extends
|
|
1578
|
+
let w = Y;
|
|
1579
|
+
const W = class W extends w {
|
|
1580
1580
|
/**
|
|
1581
1581
|
* エレメントフラグメントのコンストラクタ。
|
|
1582
1582
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -1599,14 +1599,14 @@ const W = class W extends T {
|
|
|
1599
1599
|
"month",
|
|
1600
1600
|
"time",
|
|
1601
1601
|
"week"
|
|
1602
|
-
], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), 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 = t.getAttribute(`${l.prefix}bind`), t.getAttributeNames().forEach((e) => {
|
|
1602
|
+
], 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 = t.getAttribute(`${l.prefix}bind`), t.getAttributeNames().forEach((e) => {
|
|
1603
1603
|
const r = t.getAttribute(e);
|
|
1604
1604
|
if (r !== null && !this.attributeMap.has(e)) {
|
|
1605
1605
|
const i = new rt(e, r);
|
|
1606
1606
|
this.attributeMap.set(e, i);
|
|
1607
1607
|
}
|
|
1608
1608
|
}), t.childNodes.forEach((e) => {
|
|
1609
|
-
const r =
|
|
1609
|
+
const r = w.get(e);
|
|
1610
1610
|
r.setParent(this), this.children.push(r);
|
|
1611
1611
|
});
|
|
1612
1612
|
}
|
|
@@ -1767,12 +1767,35 @@ const W = class W extends T {
|
|
|
1767
1767
|
* フラグでの「再入即時実行」を行っていましたが、await をまたいで届く**独立した
|
|
1768
1768
|
* 並行呼出**まで再入扱いしてインライン実行し、`skipMutationAttributes` 中の
|
|
1769
1769
|
* `data-bind` 書き込みが破棄されて古い値が後勝ちする競合の原因になっていました。
|
|
1770
|
-
*
|
|
1771
|
-
*
|
|
1770
|
+
* 真の再入(`data-url-param` の再評価、マネージド `data-fetch` の同一フラグメント
|
|
1771
|
+
* への bind-back)は呼出側が `reentrant=true` でキューを介さず実行するため、
|
|
1772
|
+
* ここでは一律にチェーンへ積みます。
|
|
1772
1773
|
*
|
|
1773
1774
|
* @param work 直列化したいバインドデータ更新処理
|
|
1774
1775
|
* @returns work の完了 Promise
|
|
1775
1776
|
*/
|
|
1777
|
+
/**
|
|
1778
|
+
* このフラグメントのバインドワークが実行中(await をまたぐ期間を含む)かどうかを
|
|
1779
|
+
* 返します。マネージド `data-fetch` の bind-back を reentrant 実行へ切り替えるべきか
|
|
1780
|
+
* の判定に使います。
|
|
1781
|
+
*
|
|
1782
|
+
* @return 実行中なら true
|
|
1783
|
+
*/
|
|
1784
|
+
isExecutingBindingWork() {
|
|
1785
|
+
return this.bindingWorkActive > 0;
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* バインドワークの実行開始を記録します(`Core.setBindingData` の work 開始時に呼ぶ)。
|
|
1789
|
+
*/
|
|
1790
|
+
markBindingWorkStart() {
|
|
1791
|
+
this.bindingWorkActive++;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* バインドワークの実行終了を記録します(work 完了時に呼ぶ)。
|
|
1795
|
+
*/
|
|
1796
|
+
markBindingWorkEnd() {
|
|
1797
|
+
this.bindingWorkActive > 0 && this.bindingWorkActive--;
|
|
1798
|
+
}
|
|
1776
1799
|
enqueueBindingWork(t) {
|
|
1777
1800
|
const e = this.bindingWorkChain.then(t, t);
|
|
1778
1801
|
return this.bindingWorkChain = e.then(
|
|
@@ -1965,14 +1988,14 @@ const W = class W extends T {
|
|
|
1965
1988
|
if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
|
|
1966
1989
|
const i = this.getAttribute("value"), n = r.type === "checkbox" && i === "true";
|
|
1967
1990
|
let s;
|
|
1968
|
-
return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : Array.isArray(t) ? s = t.map(String).includes(String(i)) : s = i === String(t), n ? this.value = s : s ? Array.isArray(t) ? this.value = String(i) : this.value = t : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0,
|
|
1991
|
+
return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : Array.isArray(t) ? s = t.map(String).includes(String(i)) : s = i === String(t), n ? this.value = s : s ? Array.isArray(t) ? this.value = String(i) : this.value = t : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, k.enqueue(() => {
|
|
1969
1992
|
r.checked = s, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1970
1993
|
}).finally(() => {
|
|
1971
1994
|
this.skipChangeValue = !1;
|
|
1972
1995
|
}));
|
|
1973
1996
|
} else if (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement) {
|
|
1974
1997
|
const i = Array.isArray(t) ? t.join(",") : t;
|
|
1975
|
-
return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0,
|
|
1998
|
+
return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0, k.enqueue(() => {
|
|
1976
1999
|
r.value = i === null ? "" : String(i), e && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
1977
2000
|
}).finally(() => {
|
|
1978
2001
|
this.skipChangeValue = !1;
|
|
@@ -2080,7 +2103,7 @@ const W = class W extends T {
|
|
|
2080
2103
|
return Promise.resolve();
|
|
2081
2104
|
this.attributeMap.delete(t), this.skipMutationAttributes = !0;
|
|
2082
2105
|
const r = this.getTarget();
|
|
2083
|
-
return
|
|
2106
|
+
return k.enqueue(() => {
|
|
2084
2107
|
r.removeAttribute(t), e !== t && r.removeAttribute(e);
|
|
2085
2108
|
}).finally(() => {
|
|
2086
2109
|
this.skipMutationAttributes = !1;
|
|
@@ -2104,7 +2127,7 @@ const W = class W extends T {
|
|
|
2104
2127
|
if (n) {
|
|
2105
2128
|
const ot = this.attributeMap.get(t);
|
|
2106
2129
|
if (ot && (ot.isEvaluate || ot.isForceEvaluation()) && !s.isEvaluate && !s.isForceEvaluation())
|
|
2107
|
-
return this.skipMutationAttributes = !0,
|
|
2130
|
+
return this.skipMutationAttributes = !0, k.enqueue(() => {
|
|
2108
2131
|
}).finally(() => {
|
|
2109
2132
|
this.skipMutationAttributes = !1;
|
|
2110
2133
|
});
|
|
@@ -2115,8 +2138,8 @@ const W = class W extends T {
|
|
|
2115
2138
|
element: a,
|
|
2116
2139
|
rawName: t,
|
|
2117
2140
|
template: r
|
|
2118
|
-
}), u = s.isEvaluate || s.isRawEvaluate,
|
|
2119
|
-
return !F && !I && !$ && !mt && !bt ? (A && !b && S !== null && (this.value = this.normalizeValueForElement(a, S)), Promise.resolve()) : (this.skipMutationAttributes = !0,
|
|
2141
|
+
}), u = s.isEvaluate || s.isRawEvaluate, h = t === e && W.BOOLEAN_ATTRIBUTES.has(e.toLowerCase()), d = s.isSingleExpression(), g = K.joinEvaluateResults(o.results), y = o.results.length === 1 ? o.results[0] : g, T = !s.isForceEvaluation() && (e !== t || h || d ? o.hasUnresolvedReference || y === null || y === void 0 || y === !1 : u && g === ""), P = s.isForceEvaluation() ? r : d ? y : g, A = i && s.isEvaluate && e === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), v = a.getRootNode(), b = A && a === v.activeElement, S = T || P === null || P === !1 ? null : String(P), F = t !== e && a.getAttribute(t) !== r, I = S === null ? a.hasAttribute(e) : a.getAttribute(e) !== S, $ = A && !b && S !== null && a.value !== S, V = e === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), C = e === "selected" && a instanceof HTMLOptionElement, Q = v.activeElement, gt = Q !== null && (V && a === Q || C && a.closest("select") === Q), _ = S !== null, mt = V && !gt && a.checked !== _, bt = C && !gt && a.selected !== _;
|
|
2142
|
+
return !F && !I && !$ && !mt && !bt ? (A && !b && S !== null && (this.value = this.normalizeValueForElement(a, S)), Promise.resolve()) : (this.skipMutationAttributes = !0, k.enqueue(() => {
|
|
2120
2143
|
F && a.setAttribute(t, r), S === null ? a.removeAttribute(e) : (I && (a.setAttribute(e, S), e === `${l.prefix}bind` && this.recordSelfWrittenBind(S)), A && !b && (this.value = this.normalizeValueForElement(a, S), $ && (a.value = S))), mt && (a.checked = _), bt && (a.selected = _);
|
|
2121
2144
|
}).finally(() => {
|
|
2122
2145
|
this.skipMutationAttributes = !1;
|
|
@@ -2133,7 +2156,7 @@ const W = class W extends T {
|
|
|
2133
2156
|
return Promise.resolve();
|
|
2134
2157
|
this.attributeMap.delete(t), this.skipMutationAttributes = !0;
|
|
2135
2158
|
const e = this.getTarget();
|
|
2136
|
-
return
|
|
2159
|
+
return k.enqueue(() => {
|
|
2137
2160
|
e.removeAttribute(t);
|
|
2138
2161
|
}).finally(() => {
|
|
2139
2162
|
this.skipMutationAttributes = !1;
|
|
@@ -2214,7 +2237,7 @@ const W = class W extends T {
|
|
|
2214
2237
|
const i = e ? r.nextSibling : r;
|
|
2215
2238
|
let n = e ? r.nextSibling : r;
|
|
2216
2239
|
for (; n !== null; ) {
|
|
2217
|
-
const s =
|
|
2240
|
+
const s = w.get(n);
|
|
2218
2241
|
if (s !== null) {
|
|
2219
2242
|
const a = this.children.indexOf(s);
|
|
2220
2243
|
if (a !== -1)
|
|
@@ -2248,30 +2271,30 @@ const W = class W extends T {
|
|
|
2248
2271
|
s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
|
|
2249
2272
|
const u = t.getParent();
|
|
2250
2273
|
u !== null && u.removeChild(t);
|
|
2251
|
-
let
|
|
2274
|
+
let h = r === void 0 ? e?.getTarget() || null : r;
|
|
2252
2275
|
if (e === null)
|
|
2253
2276
|
this.children.push(t);
|
|
2254
2277
|
else {
|
|
2255
2278
|
let g;
|
|
2256
2279
|
if (s ? a !== -1 && a < o ? g = o - 1 : g = o : g = this.children.indexOf(e), g === -1) {
|
|
2257
|
-
const
|
|
2280
|
+
const y = this.resolveInsertionPointFromDom(
|
|
2258
2281
|
e,
|
|
2259
2282
|
!1
|
|
2260
2283
|
);
|
|
2261
|
-
|
|
2284
|
+
y === null ? (m.warn(
|
|
2262
2285
|
"[Haori]",
|
|
2263
2286
|
"Reference child not found in children.",
|
|
2264
2287
|
e
|
|
2265
|
-
), this.children.push(t)) : (this.children.splice(
|
|
2288
|
+
), this.children.push(t)) : (this.children.splice(y.index, 0, t), h = y.referenceNode);
|
|
2266
2289
|
} else
|
|
2267
2290
|
this.children.splice(g, 0, t);
|
|
2268
2291
|
}
|
|
2269
2292
|
t.setParent(this), t.setMounted(this.mounted);
|
|
2270
|
-
const
|
|
2271
|
-
return this.skipMutationNodes = !0,
|
|
2272
|
-
this.target.insertBefore(t.getTarget(),
|
|
2293
|
+
const d = this.skipMutationNodes;
|
|
2294
|
+
return this.skipMutationNodes = !0, k.enqueue(() => {
|
|
2295
|
+
this.target.insertBefore(t.getTarget(), h);
|
|
2273
2296
|
}).finally(() => {
|
|
2274
|
-
this.skipMutationNodes =
|
|
2297
|
+
this.skipMutationNodes = d;
|
|
2275
2298
|
});
|
|
2276
2299
|
}
|
|
2277
2300
|
/**
|
|
@@ -2403,7 +2426,7 @@ W.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
2403
2426
|
"selected"
|
|
2404
2427
|
]);
|
|
2405
2428
|
let M = W;
|
|
2406
|
-
class U extends
|
|
2429
|
+
class U extends w {
|
|
2407
2430
|
/**
|
|
2408
2431
|
* テキストフラグメントのコンストラクタ。
|
|
2409
2432
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -2455,7 +2478,7 @@ class U extends T {
|
|
|
2455
2478
|
evaluate() {
|
|
2456
2479
|
return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
|
|
2457
2480
|
new Error("Parent fragment is required for raw evaluation")
|
|
2458
|
-
) :
|
|
2481
|
+
) : k.enqueue(() => {
|
|
2459
2482
|
this.skipMutation = !0;
|
|
2460
2483
|
let t = this.text;
|
|
2461
2484
|
this.contents.isRawEvaluate ? t = this.contents.evaluate(
|
|
@@ -2481,7 +2504,7 @@ class U extends T {
|
|
|
2481
2504
|
});
|
|
2482
2505
|
}
|
|
2483
2506
|
}
|
|
2484
|
-
class ft extends
|
|
2507
|
+
class ft extends w {
|
|
2485
2508
|
/**
|
|
2486
2509
|
* コメントフラグメントのコンストラクタ。
|
|
2487
2510
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -2515,7 +2538,7 @@ class ft extends T {
|
|
|
2515
2538
|
* @return 更新のPromise
|
|
2516
2539
|
*/
|
|
2517
2540
|
setContent(t) {
|
|
2518
|
-
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t,
|
|
2541
|
+
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, k.enqueue(() => {
|
|
2519
2542
|
this.skipMutation = !0, this.target.textContent = this.text;
|
|
2520
2543
|
}).finally(() => {
|
|
2521
2544
|
this.skipMutation = !1;
|
|
@@ -2627,20 +2650,20 @@ const nt = class nt {
|
|
|
2627
2650
|
return this.contents.forEach((u) => {
|
|
2628
2651
|
try {
|
|
2629
2652
|
if (r(u)) {
|
|
2630
|
-
const
|
|
2653
|
+
const h = et.measure(
|
|
2631
2654
|
() => z.evaluateDetailed(u.text, t)
|
|
2632
|
-
),
|
|
2633
|
-
a +=
|
|
2655
|
+
), d = h.value;
|
|
2656
|
+
a += h.durationMs, s.push({
|
|
2634
2657
|
expression: u.text,
|
|
2635
|
-
durationMs:
|
|
2636
|
-
}), o = o ||
|
|
2658
|
+
durationMs: h.durationMs
|
|
2659
|
+
}), o = o || d.unresolvedReference, n.push(d.value);
|
|
2637
2660
|
} else
|
|
2638
2661
|
n.push(u.text);
|
|
2639
|
-
} catch (
|
|
2662
|
+
} catch (h) {
|
|
2640
2663
|
m.error(
|
|
2641
2664
|
"[Haori]",
|
|
2642
2665
|
`Error evaluating ${i} expression: ${u.text}`,
|
|
2643
|
-
|
|
2666
|
+
h
|
|
2644
2667
|
), s.push({
|
|
2645
2668
|
expression: u.text,
|
|
2646
2669
|
durationMs: 0
|
|
@@ -2749,7 +2772,7 @@ class Z {
|
|
|
2749
2772
|
* @return すべてのレンダリングが完了したら解決される Promise
|
|
2750
2773
|
*/
|
|
2751
2774
|
static waitForRenders() {
|
|
2752
|
-
return
|
|
2775
|
+
return k.waitForIdle();
|
|
2753
2776
|
}
|
|
2754
2777
|
/**
|
|
2755
2778
|
* 通知ダイアログを表示します。
|
|
@@ -2758,7 +2781,7 @@ class Z {
|
|
|
2758
2781
|
* @returns 通知が閉じられると解決されるPromise
|
|
2759
2782
|
*/
|
|
2760
2783
|
static dialog(t) {
|
|
2761
|
-
return
|
|
2784
|
+
return k.enqueue(() => {
|
|
2762
2785
|
window.alert(t);
|
|
2763
2786
|
}, !0);
|
|
2764
2787
|
}
|
|
@@ -2786,7 +2809,7 @@ class Z {
|
|
|
2786
2809
|
* @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
|
|
2787
2810
|
*/
|
|
2788
2811
|
static confirm(t) {
|
|
2789
|
-
return
|
|
2812
|
+
return k.enqueue(() => window.confirm(t), !0);
|
|
2790
2813
|
}
|
|
2791
2814
|
/**
|
|
2792
2815
|
* ダイアログを開きます。
|
|
@@ -2794,7 +2817,7 @@ class Z {
|
|
|
2794
2817
|
* @param element 開くダイアログのHTML要素
|
|
2795
2818
|
*/
|
|
2796
2819
|
static openDialog(t) {
|
|
2797
|
-
return
|
|
2820
|
+
return k.enqueue(() => {
|
|
2798
2821
|
t instanceof HTMLDialogElement ? t.showModal() : m.error("[Haori]", "Element is not a dialog: ", t);
|
|
2799
2822
|
}, !0);
|
|
2800
2823
|
}
|
|
@@ -2804,7 +2827,7 @@ class Z {
|
|
|
2804
2827
|
* @param element 閉じるダイアログのHTML要素
|
|
2805
2828
|
*/
|
|
2806
2829
|
static closeDialog(t) {
|
|
2807
|
-
return
|
|
2830
|
+
return k.enqueue(() => {
|
|
2808
2831
|
t instanceof HTMLDialogElement ? t.close() : m.error("[Haori]", "Element is not a dialog: ", t);
|
|
2809
2832
|
}, !0);
|
|
2810
2833
|
}
|
|
@@ -2825,7 +2848,7 @@ class Z {
|
|
|
2825
2848
|
* @param level メッセージのレベル(省略可能)
|
|
2826
2849
|
*/
|
|
2827
2850
|
static addMessage(t, e, r) {
|
|
2828
|
-
return
|
|
2851
|
+
return k.enqueue(() => {
|
|
2829
2852
|
const i = t instanceof HTMLFormElement ? t : t.parentElement ?? t;
|
|
2830
2853
|
i.setAttribute("data-message", e), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
|
|
2831
2854
|
}, !0);
|
|
@@ -2836,7 +2859,7 @@ class Z {
|
|
|
2836
2859
|
* @param parent メッセージをクリアする親要素
|
|
2837
2860
|
*/
|
|
2838
2861
|
static clearMessages(t) {
|
|
2839
|
-
return
|
|
2862
|
+
return k.enqueue(() => {
|
|
2840
2863
|
t.removeAttribute("data-message"), t.removeAttribute("data-message-level"), t.querySelectorAll("[data-message]").forEach((e) => {
|
|
2841
2864
|
e.removeAttribute("data-message"), e.removeAttribute("data-message-level");
|
|
2842
2865
|
});
|
|
@@ -2957,13 +2980,13 @@ class Z {
|
|
|
2957
2980
|
}
|
|
2958
2981
|
}
|
|
2959
2982
|
const Ot = ["addErrorMessage", "clearMessages"];
|
|
2960
|
-
function
|
|
2983
|
+
function yt() {
|
|
2961
2984
|
const t = globalThis.window?.Haori;
|
|
2962
2985
|
return Ot.every(
|
|
2963
2986
|
(r) => typeof t?.[r] == "function"
|
|
2964
2987
|
) ? t : Z;
|
|
2965
2988
|
}
|
|
2966
|
-
class
|
|
2989
|
+
class E {
|
|
2967
2990
|
/**
|
|
2968
2991
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
2969
2992
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -2974,7 +2997,7 @@ class y {
|
|
|
2974
2997
|
*/
|
|
2975
2998
|
static getValues(t) {
|
|
2976
2999
|
const e = {};
|
|
2977
|
-
return
|
|
3000
|
+
return E.getPartValues(t, e);
|
|
2978
3001
|
}
|
|
2979
3002
|
/**
|
|
2980
3003
|
* フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
|
|
@@ -2989,7 +3012,7 @@ class y {
|
|
|
2989
3012
|
if (r) {
|
|
2990
3013
|
if (n)
|
|
2991
3014
|
Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()];
|
|
2992
|
-
else if (
|
|
3015
|
+
else if (E.isGroupedCheckable(t)) {
|
|
2993
3016
|
const s = t.getValue(), a = String(r);
|
|
2994
3017
|
s === null ? a in e || (e[a] = null) : e[a] === null || e[a] === void 0 ? e[a] = s : Array.isArray(e[a]) ? e[a].push(s) : e[a] = [e[a], s];
|
|
2995
3018
|
} else
|
|
@@ -2999,11 +3022,11 @@ class y {
|
|
|
2999
3022
|
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
3000
3023
|
);
|
|
3001
3024
|
for (const s of t.getChildElementFragments())
|
|
3002
|
-
|
|
3025
|
+
E.getPartValues(s, e);
|
|
3003
3026
|
} else if (i) {
|
|
3004
3027
|
const s = {};
|
|
3005
3028
|
for (const a of t.getChildElementFragments())
|
|
3006
|
-
|
|
3029
|
+
E.getPartValues(a, s);
|
|
3007
3030
|
Object.keys(s).length > 0 && (e[String(i)] = s), n && m.warn(
|
|
3008
3031
|
"Haori",
|
|
3009
3032
|
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
@@ -3012,12 +3035,12 @@ class y {
|
|
|
3012
3035
|
const s = [];
|
|
3013
3036
|
for (const a of t.getChildElementFragments()) {
|
|
3014
3037
|
const o = {};
|
|
3015
|
-
|
|
3038
|
+
E.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
|
|
3016
3039
|
}
|
|
3017
3040
|
s.length > 0 && (e[String(n)] = s);
|
|
3018
3041
|
} else
|
|
3019
3042
|
for (const s of t.getChildElementFragments())
|
|
3020
|
-
|
|
3043
|
+
E.getPartValues(s, e);
|
|
3021
3044
|
return e;
|
|
3022
3045
|
}
|
|
3023
3046
|
/**
|
|
@@ -3030,7 +3053,7 @@ class y {
|
|
|
3030
3053
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
3031
3054
|
*/
|
|
3032
3055
|
static setValues(t, e, r = !1) {
|
|
3033
|
-
return
|
|
3056
|
+
return E.setPartValues(t, e, null, r, !0);
|
|
3034
3057
|
}
|
|
3035
3058
|
/**
|
|
3036
3059
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -3042,7 +3065,7 @@ class y {
|
|
|
3042
3065
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
3043
3066
|
*/
|
|
3044
3067
|
static syncValues(t, e, r = !1) {
|
|
3045
|
-
return
|
|
3068
|
+
return E.setPartValues(t, e, null, r, !1);
|
|
3046
3069
|
}
|
|
3047
3070
|
/**
|
|
3048
3071
|
* 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
|
|
@@ -3076,56 +3099,56 @@ class y {
|
|
|
3076
3099
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
3077
3100
|
*/
|
|
3078
3101
|
static setPartValues(t, e, r = null, i = !1, n = !0) {
|
|
3079
|
-
const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), u = t.getAttribute(`${l.prefix}form-list`),
|
|
3102
|
+
const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), u = t.getAttribute(`${l.prefix}form-list`), h = t.getAttribute(`${l.prefix}form-detach`);
|
|
3080
3103
|
if (a) {
|
|
3081
|
-
if (!
|
|
3082
|
-
const
|
|
3083
|
-
u && Array.isArray(
|
|
3084
|
-
|
|
3085
|
-
) : typeof
|
|
3086
|
-
|
|
3104
|
+
if (!h || i) {
|
|
3105
|
+
const d = e[String(a)];
|
|
3106
|
+
u && Array.isArray(d) && r !== null ? s.push(
|
|
3107
|
+
E.applyFragmentValue(t, d[r] ?? null, n)
|
|
3108
|
+
) : typeof d > "u" || (Array.isArray(d) && E.isGroupedCheckable(t) || typeof d == "string" || typeof d == "number" || typeof d == "boolean" || d === null ? s.push(
|
|
3109
|
+
E.applyFragmentValue(
|
|
3087
3110
|
t,
|
|
3088
|
-
|
|
3111
|
+
d,
|
|
3089
3112
|
n
|
|
3090
3113
|
)
|
|
3091
3114
|
) : s.push(
|
|
3092
|
-
|
|
3115
|
+
E.applyFragmentValue(t, String(d), n)
|
|
3093
3116
|
));
|
|
3094
3117
|
}
|
|
3095
3118
|
} else if (o) {
|
|
3096
|
-
const
|
|
3097
|
-
if (
|
|
3119
|
+
const d = e[String(o)];
|
|
3120
|
+
if (d && typeof d == "object")
|
|
3098
3121
|
for (const g of t.getChildElementFragments())
|
|
3099
3122
|
s.push(
|
|
3100
|
-
|
|
3123
|
+
E.setPartValues(
|
|
3101
3124
|
g,
|
|
3102
|
-
|
|
3125
|
+
d,
|
|
3103
3126
|
null,
|
|
3104
3127
|
i,
|
|
3105
3128
|
n
|
|
3106
3129
|
)
|
|
3107
3130
|
);
|
|
3108
3131
|
} else if (u) {
|
|
3109
|
-
const
|
|
3110
|
-
if (Array.isArray(
|
|
3132
|
+
const d = e[String(u)];
|
|
3133
|
+
if (Array.isArray(d)) {
|
|
3111
3134
|
const g = t.getChildElementFragments();
|
|
3112
|
-
for (let
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3135
|
+
for (let y = 0; y < g.length; y++) {
|
|
3136
|
+
const T = g[y];
|
|
3137
|
+
d.length > y ? s.push(
|
|
3138
|
+
E.setPartValues(
|
|
3139
|
+
T,
|
|
3140
|
+
d[y],
|
|
3141
|
+
y,
|
|
3119
3142
|
i,
|
|
3120
3143
|
n
|
|
3121
3144
|
)
|
|
3122
|
-
) : s.push(
|
|
3145
|
+
) : s.push(E.setPartValues(T, {}, y, i, n));
|
|
3123
3146
|
}
|
|
3124
3147
|
}
|
|
3125
3148
|
} else
|
|
3126
|
-
for (const
|
|
3149
|
+
for (const d of t.getChildElementFragments())
|
|
3127
3150
|
s.push(
|
|
3128
|
-
|
|
3151
|
+
E.setPartValues(d, e, null, i, n)
|
|
3129
3152
|
);
|
|
3130
3153
|
return Promise.all(s).then(() => {
|
|
3131
3154
|
});
|
|
@@ -3138,10 +3161,10 @@ class y {
|
|
|
3138
3161
|
* @returns すべての初期化処理が完了するPromise
|
|
3139
3162
|
*/
|
|
3140
3163
|
static async reset(t) {
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
]), await
|
|
3164
|
+
E.clearValues(t), await Promise.all([
|
|
3165
|
+
E.clearMessages(t),
|
|
3166
|
+
E.clearEachClones(t)
|
|
3167
|
+
]), await k.enqueue(() => {
|
|
3145
3168
|
const r = t.getTarget();
|
|
3146
3169
|
if (r instanceof HTMLFormElement)
|
|
3147
3170
|
r.reset();
|
|
@@ -3154,17 +3177,17 @@ class y {
|
|
|
3154
3177
|
}
|
|
3155
3178
|
}
|
|
3156
3179
|
});
|
|
3157
|
-
const e =
|
|
3180
|
+
const e = E.collectBindingTargetForms(t);
|
|
3158
3181
|
for (const r of e) {
|
|
3159
|
-
const i =
|
|
3182
|
+
const i = E.getInitialBindingData(r);
|
|
3160
3183
|
i && await x.setBindingData(r.getTarget(), i);
|
|
3161
3184
|
}
|
|
3162
|
-
|
|
3185
|
+
E.syncValuesFromDom(t);
|
|
3163
3186
|
for (const r of e) {
|
|
3164
|
-
const i =
|
|
3187
|
+
const i = E.getInitialBindingData(r);
|
|
3165
3188
|
if (r.getRawBindingData() === null && i === null)
|
|
3166
3189
|
continue;
|
|
3167
|
-
const n =
|
|
3190
|
+
const n = E.getValues(r), s = r.getAttribute(`${l.prefix}form-arg`), a = { ...i || {} };
|
|
3168
3191
|
s ? a[String(s)] = n : Object.assign(a, n), await x.setBindingData(r.getTarget(), a);
|
|
3169
3192
|
}
|
|
3170
3193
|
await x.evaluateAll(t);
|
|
@@ -3188,7 +3211,7 @@ class y {
|
|
|
3188
3211
|
const e = t.getTarget();
|
|
3189
3212
|
(e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) && t.syncValue();
|
|
3190
3213
|
for (const r of t.getChildElementFragments())
|
|
3191
|
-
|
|
3214
|
+
E.syncValuesFromDom(r);
|
|
3192
3215
|
}
|
|
3193
3216
|
/**
|
|
3194
3217
|
* リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
|
|
@@ -3204,7 +3227,7 @@ class y {
|
|
|
3204
3227
|
e instanceof HTMLFormElement ? r.push(e) : r.push(...Array.from(e.querySelectorAll("form")));
|
|
3205
3228
|
const i = [];
|
|
3206
3229
|
for (const n of r) {
|
|
3207
|
-
const s =
|
|
3230
|
+
const s = w.get(n);
|
|
3208
3231
|
s instanceof M && i.push(s);
|
|
3209
3232
|
}
|
|
3210
3233
|
return i;
|
|
@@ -3241,7 +3264,7 @@ class y {
|
|
|
3241
3264
|
static clearValues(t) {
|
|
3242
3265
|
t.clearValue();
|
|
3243
3266
|
for (const e of t.getChildElementFragments())
|
|
3244
|
-
|
|
3267
|
+
E.clearValues(e);
|
|
3245
3268
|
}
|
|
3246
3269
|
/**
|
|
3247
3270
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -3250,7 +3273,7 @@ class y {
|
|
|
3250
3273
|
* @returns Promise(メッセージのクリアが完了したら解決される)
|
|
3251
3274
|
*/
|
|
3252
3275
|
static clearMessages(t) {
|
|
3253
|
-
return
|
|
3276
|
+
return yt().clearMessages(
|
|
3254
3277
|
t.getTarget()
|
|
3255
3278
|
);
|
|
3256
3279
|
}
|
|
@@ -3264,7 +3287,7 @@ class y {
|
|
|
3264
3287
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
3265
3288
|
*/
|
|
3266
3289
|
static addErrorMessage(t, e, r) {
|
|
3267
|
-
return
|
|
3290
|
+
return E.addMessage(t, e, r, "error");
|
|
3268
3291
|
}
|
|
3269
3292
|
/**
|
|
3270
3293
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -3277,9 +3300,9 @@ class y {
|
|
|
3277
3300
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
3278
3301
|
*/
|
|
3279
3302
|
static addMessage(t, e, r, i) {
|
|
3280
|
-
const n = [], s =
|
|
3281
|
-
return u.forEach((
|
|
3282
|
-
n.push(o(
|
|
3303
|
+
const n = [], s = yt(), a = s.addMessage, o = (h) => typeof a == "function" ? a.call(s, h, r, i) : s.addErrorMessage(h, r), u = E.findFragmentsByKey(t, e);
|
|
3304
|
+
return u.forEach((h) => {
|
|
3305
|
+
n.push(o(h.getTarget()));
|
|
3283
3306
|
}), u.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
|
|
3284
3307
|
});
|
|
3285
3308
|
}
|
|
@@ -3291,7 +3314,7 @@ class y {
|
|
|
3291
3314
|
* @returns 一致するフラグメントの配列
|
|
3292
3315
|
*/
|
|
3293
3316
|
static findFragmentsByKey(t, e) {
|
|
3294
|
-
return
|
|
3317
|
+
return E.findFragmentByKeyParts(t, e.split("."));
|
|
3295
3318
|
}
|
|
3296
3319
|
/**
|
|
3297
3320
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -3305,7 +3328,7 @@ class y {
|
|
|
3305
3328
|
const r = [], i = e[0];
|
|
3306
3329
|
if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
|
|
3307
3330
|
e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
|
|
3308
|
-
r.push(...
|
|
3331
|
+
r.push(...E.findFragmentByKeyParts(s, e.slice(1)));
|
|
3309
3332
|
});
|
|
3310
3333
|
else if (t.hasAttribute(`${l.prefix}form-list`)) {
|
|
3311
3334
|
if (e.length > 1) {
|
|
@@ -3313,13 +3336,13 @@ class y {
|
|
|
3313
3336
|
if (s !== -1 && a !== -1 && s < a) {
|
|
3314
3337
|
const o = i.substring(0, s);
|
|
3315
3338
|
if (n === o) {
|
|
3316
|
-
const u = i.substring(s + 1, a),
|
|
3317
|
-
if (isNaN(
|
|
3339
|
+
const u = i.substring(s + 1, a), h = Number(u);
|
|
3340
|
+
if (isNaN(h))
|
|
3318
3341
|
m.error("Haori", `Invalid index: ${i}`);
|
|
3319
3342
|
else {
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3322
|
-
...
|
|
3343
|
+
const d = t.getChildElementFragments().filter((g) => g.hasAttribute(`${l.prefix}row`));
|
|
3344
|
+
h < d.length && r.push(
|
|
3345
|
+
...E.findFragmentByKeyParts(d[h], e.slice(1))
|
|
3323
3346
|
);
|
|
3324
3347
|
}
|
|
3325
3348
|
}
|
|
@@ -3327,7 +3350,7 @@ class y {
|
|
|
3327
3350
|
}
|
|
3328
3351
|
} else
|
|
3329
3352
|
t.getChildElementFragments().forEach((n) => {
|
|
3330
|
-
r.push(...
|
|
3353
|
+
r.push(...E.findFragmentByKeyParts(n, e));
|
|
3331
3354
|
});
|
|
3332
3355
|
return r;
|
|
3333
3356
|
}
|
|
@@ -3432,8 +3455,8 @@ class R {
|
|
|
3432
3455
|
static bindChange(t, e, r, i = "other") {
|
|
3433
3456
|
const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
3434
3457
|
for (const u of o) {
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3458
|
+
const h = e?.[u], d = r[u];
|
|
3459
|
+
h !== d && n.push(u);
|
|
3437
3460
|
}
|
|
3438
3461
|
R.dispatch(t, "bindchange", {
|
|
3439
3462
|
previous: e || {},
|
|
@@ -3592,7 +3615,7 @@ function Ut(p, t) {
|
|
|
3592
3615
|
return null;
|
|
3593
3616
|
if (!e.includes("{{"))
|
|
3594
3617
|
return e;
|
|
3595
|
-
const r =
|
|
3618
|
+
const r = w.get(p), i = r instanceof M ? r.getBindingData() : {}, n = Lt(e, i);
|
|
3596
3619
|
return n === "" ? null : n;
|
|
3597
3620
|
}
|
|
3598
3621
|
function Mt(p) {
|
|
@@ -3667,6 +3690,16 @@ function Yt(p, t) {
|
|
|
3667
3690
|
});
|
|
3668
3691
|
}
|
|
3669
3692
|
const f = class f {
|
|
3693
|
+
/**
|
|
3694
|
+
* コンストラクタ。
|
|
3695
|
+
*
|
|
3696
|
+
* @param arg1 オプションもしくはフラグメント
|
|
3697
|
+
* @param arg2 イベント名
|
|
3698
|
+
* @param domEvent 起点となった DOM イベント
|
|
3699
|
+
*/
|
|
3700
|
+
constructor(t, e = null, r = null) {
|
|
3701
|
+
this.reentrantBind = !1, f.isElementFragment(t) ? (this.options = f.buildOptions(t, e), this.eventType = e) : (this.options = t, this.eventType = null), this.domEvent = r;
|
|
3702
|
+
}
|
|
3670
3703
|
/**
|
|
3671
3704
|
* イベント属性名を正しく生成します。
|
|
3672
3705
|
* 例: ("click", "fetch") => "data-click-fetch"
|
|
@@ -3857,15 +3890,15 @@ const f = class f {
|
|
|
3857
3890
|
);
|
|
3858
3891
|
if (v) {
|
|
3859
3892
|
const b = document.body.querySelector(v);
|
|
3860
|
-
b !== null ? r.formFragment =
|
|
3861
|
-
|
|
3893
|
+
b !== null ? r.formFragment = E.getFormFragment(
|
|
3894
|
+
w.get(b)
|
|
3862
3895
|
) : m.error(
|
|
3863
3896
|
"Haori",
|
|
3864
3897
|
`Form element not found: ${v} (${f.attrName(e, "form")})`
|
|
3865
3898
|
);
|
|
3866
3899
|
} else
|
|
3867
|
-
r.formFragment =
|
|
3868
|
-
} else (e === "change" || e === "input") && (r.formFragment =
|
|
3900
|
+
r.formFragment = E.getFormFragment(t);
|
|
3901
|
+
} else (e === "change" || e === "input") && (r.formFragment = E.getFormFragment(t));
|
|
3869
3902
|
if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
|
|
3870
3903
|
const v = t.getRawAttribute(
|
|
3871
3904
|
`${l.prefix}${e}-before-run`
|
|
@@ -3997,7 +4030,7 @@ ${v}
|
|
|
3997
4030
|
if (A) {
|
|
3998
4031
|
const v = document.body.querySelectorAll(A);
|
|
3999
4032
|
v.length > 0 ? (r.bindFragments = [], v.forEach((b) => {
|
|
4000
|
-
const S =
|
|
4033
|
+
const S = w.get(b);
|
|
4001
4034
|
S && r.bindFragments.push(S);
|
|
4002
4035
|
})) : m.error(
|
|
4003
4036
|
"Haori",
|
|
@@ -4009,17 +4042,17 @@ ${v}
|
|
|
4009
4042
|
null,
|
|
4010
4043
|
"arg",
|
|
4011
4044
|
!0
|
|
4012
|
-
),
|
|
4045
|
+
), h = f.attrName(
|
|
4013
4046
|
null,
|
|
4014
4047
|
"bind-arg",
|
|
4015
4048
|
!0
|
|
4016
4049
|
);
|
|
4017
4050
|
e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(u) ? r.bindArg = t.getRawAttribute(
|
|
4018
4051
|
u
|
|
4019
|
-
) : t.hasAttribute(
|
|
4020
|
-
const
|
|
4021
|
-
if (t.hasAttribute(
|
|
4022
|
-
const A = t.getRawAttribute(
|
|
4052
|
+
) : t.hasAttribute(h) && (r.bindArg = t.getRawAttribute(h));
|
|
4053
|
+
const d = e ? f.attrName(e, "bind-params") : f.attrName(null, "bind-params", !0);
|
|
4054
|
+
if (t.hasAttribute(d)) {
|
|
4055
|
+
const A = t.getRawAttribute(d);
|
|
4023
4056
|
r.bindParams = A.split("&").map((v) => v.trim());
|
|
4024
4057
|
}
|
|
4025
4058
|
const g = e ? f.attrName(e, "bind-append") : f.attrName(null, "bind-append", !0);
|
|
@@ -4027,13 +4060,13 @@ ${v}
|
|
|
4027
4060
|
const A = t.getRawAttribute(g);
|
|
4028
4061
|
r.bindAppendParams = A.split("&").map((v) => v.trim()).filter(Boolean);
|
|
4029
4062
|
}
|
|
4030
|
-
const
|
|
4031
|
-
t.hasAttribute(
|
|
4032
|
-
const
|
|
4033
|
-
t.hasAttribute(
|
|
4034
|
-
const
|
|
4035
|
-
if (
|
|
4036
|
-
const A = t.getRawAttribute(
|
|
4063
|
+
const y = e ? f.attrName(e, "bind-merge") : f.attrName(null, "bind-merge", !0);
|
|
4064
|
+
t.hasAttribute(y) && (r.bindMerge = !0);
|
|
4065
|
+
const T = e ? f.attrName(e, "bind-transform") : f.attrName(null, "bind-transform", !0);
|
|
4066
|
+
t.hasAttribute(T) && (r.bindTransform = t.getRawAttribute(T));
|
|
4067
|
+
const P = e ? f.attrName(e, "copy-params") : null;
|
|
4068
|
+
if (P && t.hasAttribute(P)) {
|
|
4069
|
+
const A = t.getRawAttribute(P);
|
|
4037
4070
|
r.copyParams = A.split("&").map((v) => v.trim()).filter(Boolean);
|
|
4038
4071
|
}
|
|
4039
4072
|
if (e) {
|
|
@@ -4044,7 +4077,7 @@ ${v}
|
|
|
4044
4077
|
if (b) {
|
|
4045
4078
|
const S = document.body.querySelectorAll(b);
|
|
4046
4079
|
S.length > 0 ? (r.adjustFragments = [], S.forEach((F) => {
|
|
4047
|
-
const I =
|
|
4080
|
+
const I = w.get(F);
|
|
4048
4081
|
I && r.adjustFragments.push(I);
|
|
4049
4082
|
})) : m.error(
|
|
4050
4083
|
"Haori",
|
|
@@ -4096,14 +4129,14 @@ ${b}
|
|
|
4096
4129
|
);
|
|
4097
4130
|
if (b) {
|
|
4098
4131
|
const S = document.body.querySelector(b);
|
|
4099
|
-
S !== null ? r.historyFormFragment =
|
|
4100
|
-
|
|
4132
|
+
S !== null ? r.historyFormFragment = E.getFormFragment(
|
|
4133
|
+
w.get(S)
|
|
4101
4134
|
) : m.error(
|
|
4102
4135
|
"Haori",
|
|
4103
4136
|
`Form element not found: ${b} (${f.attrName(e, "history-form")})`
|
|
4104
4137
|
);
|
|
4105
4138
|
} else
|
|
4106
|
-
r.historyFormFragment =
|
|
4139
|
+
r.historyFormFragment = E.getFormFragment(t);
|
|
4107
4140
|
}
|
|
4108
4141
|
[
|
|
4109
4142
|
"reset-before",
|
|
@@ -4119,7 +4152,7 @@ ${b}
|
|
|
4119
4152
|
return;
|
|
4120
4153
|
const F = t.getRawAttribute(S), I = [];
|
|
4121
4154
|
if (F ? (document.body.querySelectorAll(F).forEach((V) => {
|
|
4122
|
-
const C =
|
|
4155
|
+
const C = w.get(V);
|
|
4123
4156
|
C && I.push(C);
|
|
4124
4157
|
}), I.length === 0 && m.error("Haori", `Element not found: ${F} (${S})`)) : I.push(t), I.length > 0)
|
|
4125
4158
|
switch (b) {
|
|
@@ -4154,7 +4187,7 @@ ${b}
|
|
|
4154
4187
|
if (b) {
|
|
4155
4188
|
const S = document.body.querySelector(b);
|
|
4156
4189
|
if (S !== null) {
|
|
4157
|
-
const F =
|
|
4190
|
+
const F = w.get(S);
|
|
4158
4191
|
F ? r.copySourceFragment = F : m.error(
|
|
4159
4192
|
"Haori",
|
|
4160
4193
|
`Element is not managed by Haori: ${b} (${v})`
|
|
@@ -4174,14 +4207,14 @@ ${b}
|
|
|
4174
4207
|
);
|
|
4175
4208
|
if (A) {
|
|
4176
4209
|
const v = document.body.querySelector(A);
|
|
4177
|
-
v !== null ? r.formFragment =
|
|
4178
|
-
|
|
4210
|
+
v !== null ? r.formFragment = E.getFormFragment(
|
|
4211
|
+
w.get(v)
|
|
4179
4212
|
) : m.error(
|
|
4180
4213
|
"Haori",
|
|
4181
4214
|
`Form element not found: ${A} (${f.attrName(null, "fetch-form", !0)})`
|
|
4182
4215
|
);
|
|
4183
4216
|
} else
|
|
4184
|
-
r.formFragment =
|
|
4217
|
+
r.formFragment = E.getFormFragment(t);
|
|
4185
4218
|
}
|
|
4186
4219
|
return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
|
|
4187
4220
|
}
|
|
@@ -4197,16 +4230,6 @@ ${b}
|
|
|
4197
4230
|
const e = t;
|
|
4198
4231
|
return typeof e.getTarget == "function" && typeof e.getChildElementFragments == "function";
|
|
4199
4232
|
}
|
|
4200
|
-
/**
|
|
4201
|
-
* コンストラクタ。
|
|
4202
|
-
*
|
|
4203
|
-
* @param arg1 オプションもしくはフラグメント
|
|
4204
|
-
* @param arg2 イベント名
|
|
4205
|
-
* @param domEvent 起点となった DOM イベント
|
|
4206
|
-
*/
|
|
4207
|
-
constructor(t, e = null, r = null) {
|
|
4208
|
-
f.isElementFragment(t) ? (this.options = f.buildOptions(t, e), this.eventType = e) : (this.options = t, this.eventType = null), this.domEvent = r;
|
|
4209
|
-
}
|
|
4210
4233
|
/**
|
|
4211
4234
|
* 非イベント data-fetch の自動再評価用シグネチャを解決します。
|
|
4212
4235
|
*
|
|
@@ -4225,6 +4248,13 @@ ${b}
|
|
|
4225
4248
|
return this.runWithResult().then(() => {
|
|
4226
4249
|
});
|
|
4227
4250
|
}
|
|
4251
|
+
/**
|
|
4252
|
+
* bind 結果の反映を reentrant(即時実行)で行うよう指定します。マネージド
|
|
4253
|
+
* `data-fetch` の自動再評価から生成した Procedure に対して使います。
|
|
4254
|
+
*/
|
|
4255
|
+
markReentrantBind() {
|
|
4256
|
+
this.reentrantBind = !0;
|
|
4257
|
+
}
|
|
4228
4258
|
/**
|
|
4229
4259
|
* 一連の処理を実行し、成功したかどうかを返します。
|
|
4230
4260
|
*
|
|
@@ -4246,65 +4276,65 @@ ${b}
|
|
|
4246
4276
|
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1)
|
|
4247
4277
|
return !1;
|
|
4248
4278
|
if (this.options.runScript) {
|
|
4249
|
-
const
|
|
4279
|
+
const h = this.options.targetFragment?.getTarget() ?? null;
|
|
4250
4280
|
try {
|
|
4251
4281
|
this.options.runScript.call(
|
|
4252
|
-
|
|
4282
|
+
h,
|
|
4253
4283
|
this.domEvent
|
|
4254
4284
|
) === !1 && this.domEvent && this.domEvent.preventDefault();
|
|
4255
|
-
} catch (
|
|
4256
|
-
m.error("Haori", `Run script execution error: ${
|
|
4285
|
+
} catch (d) {
|
|
4286
|
+
m.error("Haori", `Run script execution error: ${d}`);
|
|
4257
4287
|
}
|
|
4258
4288
|
}
|
|
4259
4289
|
if (!await this.confirm())
|
|
4260
4290
|
return !1;
|
|
4261
4291
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
4262
4292
|
this.options.resetBeforeFragments.map(
|
|
4263
|
-
(
|
|
4293
|
+
(h) => E.reset(h)
|
|
4264
4294
|
)
|
|
4265
4295
|
), this.captureHistorySnapshots());
|
|
4266
4296
|
const r = this.prepareFetchRequest(), i = r.payload;
|
|
4267
4297
|
let n = r.url, s = r.options;
|
|
4268
4298
|
if (this.options.beforeCallback) {
|
|
4269
|
-
const
|
|
4299
|
+
const h = this.options.beforeCallback(
|
|
4270
4300
|
n || null,
|
|
4271
4301
|
s || null
|
|
4272
4302
|
);
|
|
4273
|
-
if (
|
|
4274
|
-
if (
|
|
4303
|
+
if (h != null) {
|
|
4304
|
+
if (h === !1 || typeof h == "object" && h.stop)
|
|
4275
4305
|
return !1;
|
|
4276
|
-
typeof
|
|
4306
|
+
typeof h == "object" && (n = "fetchUrl" in h ? h.fetchUrl : n, s = "fetchOptions" in h ? h.fetchOptions : s);
|
|
4277
4307
|
}
|
|
4278
4308
|
}
|
|
4279
4309
|
const a = Object.keys(i).length > 0;
|
|
4280
4310
|
if (n) {
|
|
4281
|
-
const
|
|
4282
|
-
if (
|
|
4311
|
+
const h = { ...s || {} }, d = r.requestedMethod, g = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
|
|
4312
|
+
if (y && m.info("Haori demo fetch normalization", {
|
|
4283
4313
|
runtime: l.runtime,
|
|
4284
|
-
requestedMethod:
|
|
4314
|
+
requestedMethod: d,
|
|
4285
4315
|
effectiveMethod: g,
|
|
4286
4316
|
transportMode: "query-get",
|
|
4287
4317
|
url: n,
|
|
4288
4318
|
payload: a ? i : void 0,
|
|
4289
|
-
queryString:
|
|
4319
|
+
queryString: T
|
|
4290
4320
|
}), this.options.targetFragment && n) {
|
|
4291
|
-
const
|
|
4321
|
+
const P = performance.now(), A = {
|
|
4292
4322
|
runtime: l.runtime,
|
|
4293
|
-
requestedMethod:
|
|
4323
|
+
requestedMethod: d,
|
|
4294
4324
|
effectiveMethod: g,
|
|
4295
|
-
transportMode:
|
|
4296
|
-
...
|
|
4325
|
+
transportMode: y ? "query-get" : "http",
|
|
4326
|
+
...y ? { queryString: T } : {}
|
|
4297
4327
|
};
|
|
4298
4328
|
return R.fetchStart(
|
|
4299
4329
|
this.options.targetFragment.getTarget(),
|
|
4300
4330
|
n,
|
|
4301
|
-
|
|
4331
|
+
h,
|
|
4302
4332
|
a ? i : void 0,
|
|
4303
4333
|
A
|
|
4304
|
-
), fetch(n,
|
|
4334
|
+
), fetch(n, h).then((v) => this.handleFetchResult(
|
|
4305
4335
|
v,
|
|
4306
4336
|
n || void 0,
|
|
4307
|
-
|
|
4337
|
+
P
|
|
4308
4338
|
)).catch((v) => {
|
|
4309
4339
|
throw n && R.fetchError(
|
|
4310
4340
|
this.options.targetFragment.getTarget(),
|
|
@@ -4313,13 +4343,13 @@ ${b}
|
|
|
4313
4343
|
), v;
|
|
4314
4344
|
});
|
|
4315
4345
|
}
|
|
4316
|
-
return fetch(n,
|
|
4346
|
+
return fetch(n, h).then((P) => this.handleFetchResult(P, n || void 0));
|
|
4317
4347
|
}
|
|
4318
4348
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
|
|
4319
|
-
const
|
|
4349
|
+
const h = this.options.formFragment, d = h.getTarget(), g = /* @__PURE__ */ new Set();
|
|
4320
4350
|
t && t.appliedDisabledAttribute && this.options.targetFragment && g.add(this.options.targetFragment);
|
|
4321
|
-
const
|
|
4322
|
-
Object.assign(
|
|
4351
|
+
const y = h.getBindingData();
|
|
4352
|
+
Object.assign(y, i), await x.setBindingData(d, y, g);
|
|
4323
4353
|
}
|
|
4324
4354
|
const o = a ? i : {}, u = new Response(JSON.stringify(o), {
|
|
4325
4355
|
headers: { "Content-Type": "application/json" }
|
|
@@ -4385,7 +4415,7 @@ ${b}
|
|
|
4385
4415
|
}
|
|
4386
4416
|
const n = [];
|
|
4387
4417
|
n.push(this.bindResult(t)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
4388
|
-
this.options.resetFragments.map((a) =>
|
|
4418
|
+
this.options.resetFragments.map((a) => E.reset(a))
|
|
4389
4419
|
), await this.copy();
|
|
4390
4420
|
const s = [];
|
|
4391
4421
|
if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
|
|
@@ -4427,8 +4457,8 @@ ${b}
|
|
|
4427
4457
|
return;
|
|
4428
4458
|
}
|
|
4429
4459
|
const o = (u) => {
|
|
4430
|
-
for (const [
|
|
4431
|
-
|
|
4460
|
+
for (const [h, d] of Object.entries(u))
|
|
4461
|
+
d != null && (Array.isArray(d) ? d.forEach((g) => a.searchParams.append(h, String(g))) : typeof d == "object" ? a.searchParams.set(h, JSON.stringify(d)) : a.searchParams.set(h, String(d)));
|
|
4432
4462
|
};
|
|
4433
4463
|
i && o(e), n && o(r), history.pushState(
|
|
4434
4464
|
{ [jt]: !0 },
|
|
@@ -4444,7 +4474,7 @@ ${b}
|
|
|
4444
4474
|
*/
|
|
4445
4475
|
async handleFetchError(t) {
|
|
4446
4476
|
let e = null;
|
|
4447
|
-
this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e =
|
|
4477
|
+
this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = E.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
4448
4478
|
const r = async (s) => {
|
|
4449
4479
|
const a = e ? e.getTarget() : document.body;
|
|
4450
4480
|
await ut().addErrorMessage(a, s);
|
|
@@ -4457,7 +4487,25 @@ ${b}
|
|
|
4457
4487
|
if ((t.headers.get("Content-Type") || "").includes("application/json"))
|
|
4458
4488
|
try {
|
|
4459
4489
|
const s = await t.json(), a = [];
|
|
4460
|
-
if (s
|
|
4490
|
+
if (Array.isArray(s)) {
|
|
4491
|
+
const o = /* @__PURE__ */ new Map(), u = [];
|
|
4492
|
+
for (const h of s)
|
|
4493
|
+
if (h && typeof h == "object" && !Array.isArray(h)) {
|
|
4494
|
+
const d = h.key, g = h.message, y = typeof d == "string" && d.length > 0 ? d : null, T = typeof g == "string" ? g : g != null ? String(g) : "";
|
|
4495
|
+
if (T.length === 0)
|
|
4496
|
+
continue;
|
|
4497
|
+
if (y !== null) {
|
|
4498
|
+
const P = o.get(y) ?? [];
|
|
4499
|
+
P.push(T), o.set(y, P);
|
|
4500
|
+
} else
|
|
4501
|
+
u.push(T);
|
|
4502
|
+
} else typeof h == "string" && h.length > 0 && u.push(h);
|
|
4503
|
+
for (const [h, d] of o)
|
|
4504
|
+
a.push({ key: h, message: d.join(`
|
|
4505
|
+
`) });
|
|
4506
|
+
for (const h of u)
|
|
4507
|
+
a.push({ message: h });
|
|
4508
|
+
} else if (s && typeof s == "object") {
|
|
4461
4509
|
if (typeof s.message == "string" && a.push({ message: s.message }), Array.isArray(s.messages))
|
|
4462
4510
|
for (const o of s.messages)
|
|
4463
4511
|
typeof o == "string" && a.push({ message: o });
|
|
@@ -4473,7 +4521,7 @@ ${b}
|
|
|
4473
4521
|
if (a.length === 0)
|
|
4474
4522
|
return await r(`${t.status} ${t.statusText}`), i(), !1;
|
|
4475
4523
|
for (const o of a)
|
|
4476
|
-
o.key && e ? await
|
|
4524
|
+
o.key && e ? await E.addErrorMessage(e, o.key, o.message) : await r(o.message);
|
|
4477
4525
|
return i(), !1;
|
|
4478
4526
|
} catch {
|
|
4479
4527
|
}
|
|
@@ -4568,7 +4616,18 @@ ${b}
|
|
|
4568
4616
|
);
|
|
4569
4617
|
} else
|
|
4570
4618
|
s[a] = r;
|
|
4571
|
-
i.push(
|
|
4619
|
+
i.push(
|
|
4620
|
+
x.setBindingData(
|
|
4621
|
+
n.getTarget(),
|
|
4622
|
+
s,
|
|
4623
|
+
/* @__PURE__ */ new Set(),
|
|
4624
|
+
// マネージド fetch の bind かつ、bind 先が実行中のバインドワークを
|
|
4625
|
+
// 持つ(= 自分自身を await している)ときだけ reentrant(即時実行)に
|
|
4626
|
+
// する。これで自己デッドロックのみを解消し、idle なフラグメントへの
|
|
4627
|
+
// bind は従来どおり FIFO で適用順を保証する。
|
|
4628
|
+
this.reentrantBind && n.isExecutingBindingWork()
|
|
4629
|
+
)
|
|
4630
|
+
);
|
|
4572
4631
|
});
|
|
4573
4632
|
else {
|
|
4574
4633
|
if (typeof r == "string")
|
|
@@ -4580,7 +4639,15 @@ ${b}
|
|
|
4580
4639
|
n,
|
|
4581
4640
|
r
|
|
4582
4641
|
), a = this.options.bindMerge ? { ...n.getRawBindingData() ?? {}, ...s } : s;
|
|
4583
|
-
i.push(
|
|
4642
|
+
i.push(
|
|
4643
|
+
x.setBindingData(
|
|
4644
|
+
n.getTarget(),
|
|
4645
|
+
a,
|
|
4646
|
+
/* @__PURE__ */ new Set(),
|
|
4647
|
+
// 自己デッドロックのみを解消する限定 reentrant(上の bindArg 分岐と同様)。
|
|
4648
|
+
this.reentrantBind && n.isExecutingBindingWork()
|
|
4649
|
+
)
|
|
4650
|
+
);
|
|
4584
4651
|
});
|
|
4585
4652
|
}
|
|
4586
4653
|
return Promise.all(i).then(() => {
|
|
@@ -4624,7 +4691,7 @@ ${b}
|
|
|
4624
4691
|
* copy のコピー元データを取得します。
|
|
4625
4692
|
*/
|
|
4626
4693
|
resolveCopySourceData() {
|
|
4627
|
-
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ?
|
|
4694
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? E.getValues(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? E.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
|
|
4628
4695
|
}
|
|
4629
4696
|
/**
|
|
4630
4697
|
* data 属性とフォーム値を統合した送信データを作成します。
|
|
@@ -4642,7 +4709,7 @@ ${b}
|
|
|
4642
4709
|
buildPayloadResolution() {
|
|
4643
4710
|
const t = {};
|
|
4644
4711
|
let e = !1;
|
|
4645
|
-
if (this.options.formFragment && Object.assign(t,
|
|
4712
|
+
if (this.options.formFragment && Object.assign(t, E.getValues(this.options.formFragment)), this.options.data && typeof this.options.data == "object" && Object.assign(t, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
|
|
4646
4713
|
const r = f.resolveDataAttributeDetailed(
|
|
4647
4714
|
this.options.targetFragment,
|
|
4648
4715
|
this.options.dataAttrName
|
|
@@ -4688,31 +4755,31 @@ ${b}
|
|
|
4688
4755
|
if (n.method = u, u === "GET" || u === "HEAD" || u === "OPTIONS")
|
|
4689
4756
|
Object.keys(e).length > 0 && (i = Kt(i, e));
|
|
4690
4757
|
else if (Object.keys(e).length > 0) {
|
|
4691
|
-
const
|
|
4692
|
-
if (/multipart\/form-data/i.test(
|
|
4758
|
+
const d = s.get("Content-Type") || "";
|
|
4759
|
+
if (/multipart\/form-data/i.test(d)) {
|
|
4693
4760
|
s.delete("Content-Type");
|
|
4694
4761
|
const g = new FormData();
|
|
4695
|
-
for (const [
|
|
4696
|
-
|
|
4762
|
+
for (const [y, T] of Object.entries(e))
|
|
4763
|
+
T == null ? g.append(y, "") : T instanceof Blob ? g.append(y, T) : Array.isArray(T) ? T.forEach((P) => g.append(y, String(P))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T));
|
|
4697
4764
|
n.body = g;
|
|
4698
|
-
} else if (/application\/x-www-form-urlencoded/i.test(
|
|
4765
|
+
} else if (/application\/x-www-form-urlencoded/i.test(d)) {
|
|
4699
4766
|
const g = new URLSearchParams();
|
|
4700
|
-
for (const [
|
|
4701
|
-
|
|
4767
|
+
for (const [y, T] of Object.entries(e))
|
|
4768
|
+
T !== void 0 && (T === null ? g.append(y, "") : Array.isArray(T) ? T.forEach((P) => g.append(y, String(P))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T)));
|
|
4702
4769
|
n.body = g;
|
|
4703
4770
|
} else
|
|
4704
4771
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(e);
|
|
4705
4772
|
}
|
|
4706
4773
|
n.headers = s;
|
|
4707
|
-
let
|
|
4708
|
-
return o && (
|
|
4774
|
+
let h;
|
|
4775
|
+
return o && (h = new URL(i, window.location.href).search || void 0, s.delete("Content-Type")), {
|
|
4709
4776
|
url: i,
|
|
4710
4777
|
options: n,
|
|
4711
4778
|
payload: e,
|
|
4712
4779
|
hasUnresolvedReference: !1,
|
|
4713
4780
|
requestedMethod: a,
|
|
4714
4781
|
effectiveMethod: u,
|
|
4715
|
-
queryString:
|
|
4782
|
+
queryString: h,
|
|
4716
4783
|
transportMode: o ? "query-get" : "http",
|
|
4717
4784
|
signature: Yt(i, n)
|
|
4718
4785
|
};
|
|
@@ -4724,7 +4791,7 @@ ${b}
|
|
|
4724
4791
|
this.options.targetFragment && this.options.historyDataAttrName ? this.historyDataSnapshot = f.resolveDataAttribute(
|
|
4725
4792
|
this.options.targetFragment,
|
|
4726
4793
|
this.options.historyDataAttrName
|
|
4727
|
-
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ?
|
|
4794
|
+
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? E.getValues(this.options.historyFormFragment) : void 0;
|
|
4728
4795
|
}
|
|
4729
4796
|
/**
|
|
4730
4797
|
* history-data の評価値を取得します。
|
|
@@ -4746,7 +4813,7 @@ ${b}
|
|
|
4746
4813
|
if (this.historyFormSnapshot !== void 0)
|
|
4747
4814
|
return this.historyFormSnapshot;
|
|
4748
4815
|
if (this.options.historyFormFragment)
|
|
4749
|
-
return
|
|
4816
|
+
return E.getValues(this.options.historyFormFragment);
|
|
4750
4817
|
}
|
|
4751
4818
|
/**
|
|
4752
4819
|
* copy-params が指定されている場合は include / exclude を考慮して抽出します。
|
|
@@ -4814,7 +4881,7 @@ ${b}
|
|
|
4814
4881
|
const e = [], r = t.clone();
|
|
4815
4882
|
return e.push(
|
|
4816
4883
|
t.getParent().insertAfter(r, t)
|
|
4817
|
-
), e.push(x.evaluateAll(r)), e.push(
|
|
4884
|
+
), e.push(x.evaluateAll(r)), e.push(E.reset(r)), Promise.all(e).then(() => {
|
|
4818
4885
|
});
|
|
4819
4886
|
}
|
|
4820
4887
|
/**
|
|
@@ -4971,7 +5038,7 @@ const c = class c {
|
|
|
4971
5038
|
* @returns data-attr-* の内部反映なら true
|
|
4972
5039
|
*/
|
|
4973
5040
|
static isAliasedAttributeReflection(t, e) {
|
|
4974
|
-
const r =
|
|
5041
|
+
const r = w.get(t);
|
|
4975
5042
|
return r instanceof M ? r.hasAttribute(
|
|
4976
5043
|
`${l.prefix}${c.ATTRIBUTE_ALIAS_SUFFIX}${e}`
|
|
4977
5044
|
) : !1;
|
|
@@ -5067,11 +5134,19 @@ const c = class c {
|
|
|
5067
5134
|
*/
|
|
5068
5135
|
static executeManagedFetch(t) {
|
|
5069
5136
|
const e = t.getTarget(), r = c.getReactiveFetchState(e), i = j.resolveAutoFetchSignature(t);
|
|
5070
|
-
|
|
5137
|
+
if (r.running)
|
|
5138
|
+
return (i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve();
|
|
5139
|
+
if (i.hasUnresolvedReference || i.signature === null)
|
|
5140
|
+
return r.lastSignature = null, Promise.resolve();
|
|
5141
|
+
if (r.lastSignature === i.signature)
|
|
5142
|
+
return Promise.resolve();
|
|
5143
|
+
r.lastSignature = i.signature, r.running = !0;
|
|
5144
|
+
const n = new j(t, null);
|
|
5145
|
+
return n.markReentrantBind(), n.runWithResult().then(() => {
|
|
5071
5146
|
}).finally(() => {
|
|
5072
5147
|
if (r.running = !1, r.rerunRequested)
|
|
5073
5148
|
return r.rerunRequested = !1, c.executeManagedFetch(t);
|
|
5074
|
-
})
|
|
5149
|
+
});
|
|
5075
5150
|
}
|
|
5076
5151
|
/**
|
|
5077
5152
|
* data-import を URL 比較付きで実行します。
|
|
@@ -5093,14 +5168,14 @@ const c = class c {
|
|
|
5093
5168
|
const s = performance.now();
|
|
5094
5169
|
return e.setAttribute(`${l.prefix}importing`, ""), R.importStart(e, n), Jt.load(n).then((a) => {
|
|
5095
5170
|
const o = new TextEncoder().encode(a).length;
|
|
5096
|
-
return
|
|
5171
|
+
return k.enqueue(() => {
|
|
5097
5172
|
e.innerHTML = a;
|
|
5098
5173
|
}).then(() => {
|
|
5099
5174
|
if (e.removeAttribute(`${l.prefix}importing`), R.importEnd(e, n, o, s), !document.body.hasAttribute("data-haori-ready")) {
|
|
5100
5175
|
const u = [];
|
|
5101
|
-
return e.childNodes.forEach((
|
|
5102
|
-
const
|
|
5103
|
-
|
|
5176
|
+
return e.childNodes.forEach((h) => {
|
|
5177
|
+
const d = w.get(h);
|
|
5178
|
+
d instanceof M ? u.push(c.scan(d.getTarget())) : d instanceof U && u.push(c.evaluateText(d));
|
|
5104
5179
|
}), Promise.all(u).then(() => {
|
|
5105
5180
|
});
|
|
5106
5181
|
}
|
|
@@ -5119,7 +5194,7 @@ const c = class c {
|
|
|
5119
5194
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
5120
5195
|
*/
|
|
5121
5196
|
static scan(t) {
|
|
5122
|
-
const e =
|
|
5197
|
+
const e = w.get(t);
|
|
5123
5198
|
return e ? c.initializeElementFragment(e, !1) : Promise.resolve();
|
|
5124
5199
|
}
|
|
5125
5200
|
/**
|
|
@@ -5233,7 +5308,7 @@ const c = class c {
|
|
|
5233
5308
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5234
5309
|
*/
|
|
5235
5310
|
static setAttribute(t, e, r, i = !1) {
|
|
5236
|
-
const n =
|
|
5311
|
+
const n = w.get(t), s = c.getAliasedAttributeName(e);
|
|
5237
5312
|
if (s !== null)
|
|
5238
5313
|
return r === null ? n.removeAliasedAttribute(e, s) : n.setAliasedAttribute(
|
|
5239
5314
|
e,
|
|
@@ -5291,20 +5366,20 @@ const c = class c {
|
|
|
5291
5366
|
typeof r == "string" && a.push(c.executeManagedImport(n));
|
|
5292
5367
|
break;
|
|
5293
5368
|
case `${l.prefix}url-param`: {
|
|
5294
|
-
const
|
|
5295
|
-
if (
|
|
5296
|
-
a.push(c.setBindingData(t,
|
|
5369
|
+
const h = n.getAttribute(`${l.prefix}url-arg`), d = Xt.readParams();
|
|
5370
|
+
if (h === null)
|
|
5371
|
+
a.push(c.setBindingData(t, d, /* @__PURE__ */ new Set(), !0));
|
|
5297
5372
|
else {
|
|
5298
5373
|
const g = n.getRawBindingData() || {};
|
|
5299
|
-
g[String(
|
|
5374
|
+
g[String(h)] = d, a.push(c.setBindingData(t, g, /* @__PURE__ */ new Set(), !0));
|
|
5300
5375
|
}
|
|
5301
5376
|
break;
|
|
5302
5377
|
}
|
|
5303
5378
|
}
|
|
5304
5379
|
return r === null ? a.push(n.removeAttribute(e)) : a.push(n.setAttribute(e, r, i)), Promise.all(a).then(() => {
|
|
5305
5380
|
if (o !== null)
|
|
5306
|
-
return n.setDeriveInputSignature(u), o.then((
|
|
5307
|
-
if (
|
|
5381
|
+
return n.setDeriveInputSignature(u), o.then((h) => {
|
|
5382
|
+
if (h)
|
|
5308
5383
|
return c.reevaluateChildren(n);
|
|
5309
5384
|
});
|
|
5310
5385
|
}).then(() => {
|
|
@@ -5319,22 +5394,27 @@ const c = class c {
|
|
|
5319
5394
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5320
5395
|
*/
|
|
5321
5396
|
static setBindingData(t, e, r = /* @__PURE__ */ new Set(), i = !1) {
|
|
5322
|
-
const n =
|
|
5397
|
+
const n = w.get(t), s = n.getRawBindingData();
|
|
5323
5398
|
n.setBindingData(e), R.bindChange(t, s, e, "manual");
|
|
5324
5399
|
const a = () => {
|
|
5400
|
+
n.markBindingWorkStart();
|
|
5325
5401
|
const o = n.getRawBindingData() ?? e;
|
|
5326
5402
|
let u = n.setAttribute(
|
|
5327
5403
|
`${l.prefix}bind`,
|
|
5328
5404
|
JSON.stringify(o)
|
|
5329
5405
|
);
|
|
5330
5406
|
if (t.tagName === "FORM") {
|
|
5331
|
-
const
|
|
5332
|
-
u = u.then(() =>
|
|
5407
|
+
const h = n.getAttribute(`${l.prefix}form-arg`), d = h && o[String(h)] && typeof o[String(h)] == "object" && !Array.isArray(o[String(h)]) ? o[String(h)] : h ? {} : o;
|
|
5408
|
+
u = u.then(() => E.syncValues(n, d));
|
|
5333
5409
|
}
|
|
5334
5410
|
return u = u.then(() => c.evaluateAll(n, r)), u = u.then(
|
|
5335
5411
|
() => c.reevaluateReactiveSpecialAttributes(n, r)
|
|
5336
|
-
), u.then(
|
|
5337
|
-
|
|
5412
|
+
), u.then(
|
|
5413
|
+
() => n.markBindingWorkEnd(),
|
|
5414
|
+
(h) => {
|
|
5415
|
+
throw n.markBindingWorkEnd(), h;
|
|
5416
|
+
}
|
|
5417
|
+
);
|
|
5338
5418
|
};
|
|
5339
5419
|
return i ? a() : n.enqueueBindingWork(a);
|
|
5340
5420
|
}
|
|
@@ -5356,7 +5436,7 @@ const c = class c {
|
|
|
5356
5436
|
* `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
|
|
5357
5437
|
*/
|
|
5358
5438
|
static getBindingData(t, e = {}) {
|
|
5359
|
-
const r =
|
|
5439
|
+
const r = w.get(t);
|
|
5360
5440
|
return r instanceof M ? e.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
5361
5441
|
}
|
|
5362
5442
|
/**
|
|
@@ -5375,19 +5455,19 @@ const c = class c {
|
|
|
5375
5455
|
* @return 解決済みスコープと各キーの由来情報
|
|
5376
5456
|
*/
|
|
5377
5457
|
static dumpScope(t) {
|
|
5378
|
-
const e =
|
|
5458
|
+
const e = w.get(t);
|
|
5379
5459
|
if (!e)
|
|
5380
5460
|
return { resolved: {}, sources: {} };
|
|
5381
5461
|
const r = e.getBindingData(), i = {}, n = (u) => {
|
|
5382
|
-
const
|
|
5383
|
-
return
|
|
5384
|
-
}, s = (u,
|
|
5462
|
+
const h = u.getTarget();
|
|
5463
|
+
return h.id ? `#${h.id}` : h.tagName.toLowerCase();
|
|
5464
|
+
}, s = (u, h, d, g) => {
|
|
5385
5465
|
if (u)
|
|
5386
|
-
for (const
|
|
5387
|
-
|
|
5388
|
-
value: u[
|
|
5389
|
-
source: n(
|
|
5390
|
-
kind:
|
|
5466
|
+
for (const y of Object.keys(u))
|
|
5467
|
+
y in i || (i[y] = {
|
|
5468
|
+
value: u[y],
|
|
5469
|
+
source: n(h),
|
|
5470
|
+
kind: d,
|
|
5391
5471
|
depth: g
|
|
5392
5472
|
});
|
|
5393
5473
|
};
|
|
@@ -5423,10 +5503,10 @@ const c = class c {
|
|
|
5423
5503
|
* @param node 追加するノード
|
|
5424
5504
|
*/
|
|
5425
5505
|
static addNode(t, e) {
|
|
5426
|
-
const r =
|
|
5506
|
+
const r = w.get(t);
|
|
5427
5507
|
if (r.isSkipMutationNodes())
|
|
5428
5508
|
return;
|
|
5429
|
-
const i =
|
|
5509
|
+
const i = w.get(e.nextSibling), n = w.get(e);
|
|
5430
5510
|
n && (r.insertBefore(n, i), n instanceof M ? c.scan(n.getTarget()) : n instanceof U && c.evaluateText(n));
|
|
5431
5511
|
}
|
|
5432
5512
|
/**
|
|
@@ -5435,7 +5515,7 @@ const c = class c {
|
|
|
5435
5515
|
* @param node 削除するノード
|
|
5436
5516
|
*/
|
|
5437
5517
|
static removeNode(t) {
|
|
5438
|
-
const e =
|
|
5518
|
+
const e = w.get(t);
|
|
5439
5519
|
if (e) {
|
|
5440
5520
|
const r = e.getParent();
|
|
5441
5521
|
if (r && r.isSkipMutationNodes())
|
|
@@ -5450,7 +5530,7 @@ const c = class c {
|
|
|
5450
5530
|
* @param text 新しいテキスト
|
|
5451
5531
|
*/
|
|
5452
5532
|
static changeText(t, e) {
|
|
5453
|
-
const r =
|
|
5533
|
+
const r = w.get(t);
|
|
5454
5534
|
r && r.setContent(e);
|
|
5455
5535
|
}
|
|
5456
5536
|
/**
|
|
@@ -5462,14 +5542,14 @@ const c = class c {
|
|
|
5462
5542
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5463
5543
|
*/
|
|
5464
5544
|
static changeValue(t, e) {
|
|
5465
|
-
const r =
|
|
5545
|
+
const r = w.get(t);
|
|
5466
5546
|
if (r.getValue() === e)
|
|
5467
5547
|
return Promise.resolve();
|
|
5468
5548
|
const i = [];
|
|
5469
5549
|
i.push(r.setValue(e));
|
|
5470
5550
|
const n = c.getFormFragment(r);
|
|
5471
5551
|
if (n) {
|
|
5472
|
-
const s =
|
|
5552
|
+
const s = E.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`);
|
|
5473
5553
|
let o;
|
|
5474
5554
|
a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(c.setBindingData(n.getTarget(), o));
|
|
5475
5555
|
}
|
|
@@ -5499,7 +5579,7 @@ const c = class c {
|
|
|
5499
5579
|
return Promise.resolve();
|
|
5500
5580
|
let r = c.reevaluateInterpolatedAttributes(t);
|
|
5501
5581
|
const i = t.hasAttribute(`${l.prefix}derive`), n = t.hasAttribute(`${l.prefix}if`), s = t.hasAttribute(`${l.prefix}each`), a = t.getRawAttribute(`${l.prefix}derive`), o = t.getRawAttribute(`${l.prefix}derive-name`);
|
|
5502
|
-
let u = !1,
|
|
5582
|
+
let u = !1, h = !1, d = null;
|
|
5503
5583
|
if (!i && t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), !i && t.getDeriveInputSignature() !== null && t.setDeriveInputSignature(null), i) {
|
|
5504
5584
|
const g = c.createDeriveInputSignature(
|
|
5505
5585
|
t,
|
|
@@ -5525,10 +5605,10 @@ const c = class c {
|
|
|
5525
5605
|
t.setDeriveSubtreeSignature(null), c.logDerivedSubtreeProfileSnapshot(t, "skip-ineligible");
|
|
5526
5606
|
return;
|
|
5527
5607
|
}
|
|
5528
|
-
|
|
5608
|
+
d = c.createDescendantBindingSignature(
|
|
5529
5609
|
t,
|
|
5530
5610
|
"evaluateAll"
|
|
5531
|
-
),
|
|
5611
|
+
), h = !0, u = t.getDeriveSubtreeSignature() !== null && t.getDeriveSubtreeSignature() === d, c.logDerivedSubtreeProfileSnapshot(
|
|
5532
5612
|
t,
|
|
5533
5613
|
u ? "skip-hit" : "skip-miss"
|
|
5534
5614
|
);
|
|
@@ -5536,16 +5616,16 @@ const c = class c {
|
|
|
5536
5616
|
if (u)
|
|
5537
5617
|
return;
|
|
5538
5618
|
const g = [];
|
|
5539
|
-
return t.getChildren().forEach((
|
|
5540
|
-
if (
|
|
5541
|
-
if (c.canSkipUnchangedNestedEach(
|
|
5619
|
+
return t.getChildren().forEach((y) => {
|
|
5620
|
+
if (y instanceof M) {
|
|
5621
|
+
if (c.canSkipUnchangedNestedEach(y))
|
|
5542
5622
|
return;
|
|
5543
|
-
g.push(c.evaluateAll(
|
|
5544
|
-
} else
|
|
5623
|
+
g.push(c.evaluateAll(y, e));
|
|
5624
|
+
} else y instanceof U && g.push(c.evaluateText(y));
|
|
5545
5625
|
}), Promise.all(g).then(() => {
|
|
5546
5626
|
});
|
|
5547
5627
|
}).then(() => {
|
|
5548
|
-
|
|
5628
|
+
h && d !== null && t.setDeriveSubtreeSignature(d);
|
|
5549
5629
|
}));
|
|
5550
5630
|
}
|
|
5551
5631
|
/**
|
|
@@ -5758,11 +5838,11 @@ const c = class c {
|
|
|
5758
5838
|
(u) => !u.hasAttribute(`${l.prefix}each-before`) && !u.hasAttribute(`${l.prefix}each-after`)
|
|
5759
5839
|
).forEach((u) => {
|
|
5760
5840
|
if (!s) {
|
|
5761
|
-
const
|
|
5762
|
-
|
|
5841
|
+
const d = w.get(u);
|
|
5842
|
+
d instanceof M && (r = d.clone(), c.markFreshInitializationSkippable(r), t.setTemplate(r), s = !0);
|
|
5763
5843
|
}
|
|
5764
|
-
const
|
|
5765
|
-
|
|
5844
|
+
const h = w.get(u);
|
|
5845
|
+
h instanceof M && t.getChildren().includes(h) && (t.removeChild(h), h.setMounted(!1)), u.parentNode && u.parentNode.removeChild(u);
|
|
5766
5846
|
});
|
|
5767
5847
|
}
|
|
5768
5848
|
return this.updateDiff(t, e).then(() => {
|
|
@@ -6018,25 +6098,25 @@ const c = class c {
|
|
|
6018
6098
|
);
|
|
6019
6099
|
o.push(F), a.set(F, { item: b, itemIndex: S });
|
|
6020
6100
|
});
|
|
6021
|
-
const u = new Set(o),
|
|
6022
|
-
let
|
|
6101
|
+
const u = new Set(o), h = [];
|
|
6102
|
+
let d = t.getChildren().filter((b) => b instanceof M).filter(
|
|
6023
6103
|
(b) => !b.hasAttribute(`${l.prefix}each-before`) && !b.hasAttribute(`${l.prefix}each-after`)
|
|
6024
6104
|
);
|
|
6025
|
-
const g =
|
|
6026
|
-
|
|
6027
|
-
const
|
|
6028
|
-
|
|
6105
|
+
const g = d.map((b) => b.getListKey());
|
|
6106
|
+
d = d.filter((b) => u.has(String(b.getListKey())) ? !0 : (h.push(b.remove()), !1));
|
|
6107
|
+
const y = d.map((b) => b.getListKey()), T = /* @__PURE__ */ new Map();
|
|
6108
|
+
d.forEach((b) => {
|
|
6029
6109
|
const S = b.getListKey();
|
|
6030
|
-
S !== null && !
|
|
6110
|
+
S !== null && !T.has(S) && T.set(S, b);
|
|
6031
6111
|
});
|
|
6032
|
-
const
|
|
6112
|
+
const P = t.getChildElementFragments().slice(), A = P.filter(
|
|
6033
6113
|
(b) => b.hasAttribute(`${l.prefix}each-before`)
|
|
6034
6114
|
).length;
|
|
6035
6115
|
let v = Promise.resolve();
|
|
6036
6116
|
return o.forEach((b, S) => {
|
|
6037
6117
|
const { item: F, itemIndex: I } = a.get(b);
|
|
6038
6118
|
let $;
|
|
6039
|
-
const V =
|
|
6119
|
+
const V = T.get(b);
|
|
6040
6120
|
if (V)
|
|
6041
6121
|
$ = V, v = v.then(
|
|
6042
6122
|
() => c.updateRowFragment(
|
|
@@ -6063,17 +6143,17 @@ const c = class c {
|
|
|
6063
6143
|
s ? String(s) : null,
|
|
6064
6144
|
b
|
|
6065
6145
|
).then(() => {
|
|
6066
|
-
const Q =
|
|
6146
|
+
const Q = P[C] ?? null;
|
|
6067
6147
|
return t.insertBefore($, Q).then(() => {
|
|
6068
|
-
|
|
6148
|
+
P.splice(C, 0, $);
|
|
6069
6149
|
}).then(() => c.initializeFreshEachRow($));
|
|
6070
6150
|
})
|
|
6071
6151
|
);
|
|
6072
6152
|
}
|
|
6073
|
-
}), Promise.all(
|
|
6153
|
+
}), Promise.all(h).then(() => v).then(() => {
|
|
6074
6154
|
const b = o.filter(
|
|
6075
6155
|
(C) => C !== null
|
|
6076
|
-
), S =
|
|
6156
|
+
), S = y.filter(
|
|
6077
6157
|
(C) => C !== null
|
|
6078
6158
|
), F = new Set(S), I = b.filter((C) => !F.has(C)), V = g.filter(
|
|
6079
6159
|
(C) => C !== null
|
|
@@ -6250,7 +6330,7 @@ const J = class J {
|
|
|
6250
6330
|
*/
|
|
6251
6331
|
constructor(t = document) {
|
|
6252
6332
|
this.customEventHandlers = /* @__PURE__ */ new Map(), this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onInput = (e) => this.delegate(e, "input"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
|
|
6253
|
-
const e = document.documentElement, r =
|
|
6333
|
+
const e = document.documentElement, r = w.get(e);
|
|
6254
6334
|
r && new j(r, "load").run();
|
|
6255
6335
|
}, this.onPopstate = (e) => {
|
|
6256
6336
|
const r = e.state;
|
|
@@ -6329,7 +6409,7 @@ const J = class J {
|
|
|
6329
6409
|
this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
|
|
6330
6410
|
if (i.getAttribute(this.onAttributeName) !== t)
|
|
6331
6411
|
return;
|
|
6332
|
-
const n =
|
|
6412
|
+
const n = w.get(i);
|
|
6333
6413
|
n instanceof M && new j(n, "on", e).run().catch((s) => {
|
|
6334
6414
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
6335
6415
|
});
|
|
@@ -6375,7 +6455,7 @@ const J = class J {
|
|
|
6375
6455
|
return;
|
|
6376
6456
|
}
|
|
6377
6457
|
r.hasAttribute(`${l.prefix}${e}-prevent`) && t.preventDefault();
|
|
6378
|
-
const i =
|
|
6458
|
+
const i = w.get(r);
|
|
6379
6459
|
if (!i)
|
|
6380
6460
|
return;
|
|
6381
6461
|
(e === "change" || e === "input") && i instanceof M && i.syncValue();
|
|
@@ -6459,7 +6539,7 @@ const D = class D {
|
|
|
6459
6539
|
}));
|
|
6460
6540
|
}
|
|
6461
6541
|
static syncElement(t) {
|
|
6462
|
-
const e = D.registrations.get(t), r =
|
|
6542
|
+
const e = D.registrations.get(t), r = w.get(t);
|
|
6463
6543
|
if (!r || !D.shouldObserve(r)) {
|
|
6464
6544
|
e && (e.observer.disconnect(), D.registrations.delete(t));
|
|
6465
6545
|
return;
|
|
@@ -6477,10 +6557,10 @@ const D = class D {
|
|
|
6477
6557
|
e && (e.observer.disconnect(), D.registrations.delete(t));
|
|
6478
6558
|
const o = new IntersectionObserver(
|
|
6479
6559
|
(u) => {
|
|
6480
|
-
const
|
|
6481
|
-
|
|
6482
|
-
!
|
|
6483
|
-
g &&
|
|
6560
|
+
const h = D.registrations.get(t);
|
|
6561
|
+
h && u.forEach((d) => {
|
|
6562
|
+
!d.isIntersecting || h.running || D.isDisabled(h.fragment) || (h.running = !0, new j(h.fragment, "intersect").runWithResult().then((g) => {
|
|
6563
|
+
g && h.once && (h.observer.disconnect(), D.registrations.delete(t));
|
|
6484
6564
|
}).catch((g) => {
|
|
6485
6565
|
m.error(
|
|
6486
6566
|
"[Haori]",
|
|
@@ -6589,7 +6669,7 @@ const O = class O {
|
|
|
6589
6669
|
x.scan(document.head),
|
|
6590
6670
|
x.scan(document.body)
|
|
6591
6671
|
]), [e, r] = t;
|
|
6592
|
-
e.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await
|
|
6672
|
+
e.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await k.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ht().start(), X.syncTree(document.body);
|
|
6593
6673
|
}
|
|
6594
6674
|
/**
|
|
6595
6675
|
* 指定された要素を監視します。
|
|
@@ -6651,15 +6731,15 @@ const O = class O {
|
|
|
6651
6731
|
O._initialized = !1, O._mutationObservers = [];
|
|
6652
6732
|
let it = O;
|
|
6653
6733
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", it.init) : it.init();
|
|
6654
|
-
const Qt = () => Z.waitForRenders(), Zt = "0.
|
|
6734
|
+
const Qt = () => Z.waitForRenders(), Zt = "0.18.0";
|
|
6655
6735
|
export {
|
|
6656
6736
|
x as Core,
|
|
6657
6737
|
l as Env,
|
|
6658
|
-
|
|
6659
|
-
|
|
6738
|
+
E as Form,
|
|
6739
|
+
w as Fragment,
|
|
6660
6740
|
Z as Haori,
|
|
6661
6741
|
m as Log,
|
|
6662
|
-
|
|
6742
|
+
k as Queue,
|
|
6663
6743
|
Z as default,
|
|
6664
6744
|
Zt as version,
|
|
6665
6745
|
Qt as waitForRenders
|