haori 0.45.2 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +22 -18
- package/dist/haori.es.js +994 -780
- package/dist/haori.iife.js +22 -18
- package/dist/index.d.ts +13 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -429,7 +429,7 @@ function _e(m, e) {
|
|
|
429
429
|
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), l = Number(r.second);
|
|
430
430
|
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) ? null : Qe(i, n, s, a, o, l);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Ce(m, e = Ze, t) {
|
|
433
433
|
if (m == null || m === "")
|
|
434
434
|
return "";
|
|
435
435
|
const r = m instanceof Date ? m : new Date(m);
|
|
@@ -456,7 +456,7 @@ function Me(m, e = Ze, t) {
|
|
|
456
456
|
}
|
|
457
457
|
const Et = "yyyy-MM-dd";
|
|
458
458
|
function et(m = Ze, e) {
|
|
459
|
-
return
|
|
459
|
+
return Ce(/* @__PURE__ */ new Date(), m, e);
|
|
460
460
|
}
|
|
461
461
|
function tt(m = 0, e = Et, t) {
|
|
462
462
|
const r = Number.isFinite(m) ? Math.trunc(m) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
@@ -471,7 +471,7 @@ function tt(m = 0, e = Et, t) {
|
|
|
471
471
|
n = l.getFullYear(), s = l.getMonth() + 1, a = l.getDate();
|
|
472
472
|
}
|
|
473
473
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
474
|
-
return
|
|
474
|
+
return Ce(o, e, "UTC");
|
|
475
475
|
}
|
|
476
476
|
function rt(m, e) {
|
|
477
477
|
if (m == null)
|
|
@@ -550,7 +550,7 @@ function Te(m, e) {
|
|
|
550
550
|
const t = Number(m);
|
|
551
551
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function ke(m, e) {
|
|
554
554
|
if (typeof m != "string")
|
|
555
555
|
return "";
|
|
556
556
|
const t = At.exec(m.trim());
|
|
@@ -564,7 +564,7 @@ function xe(m, e) {
|
|
|
564
564
|
}
|
|
565
565
|
function St(m) {
|
|
566
566
|
if (typeof m == "string" && m.trim() !== "")
|
|
567
|
-
return
|
|
567
|
+
return ke(m, 0);
|
|
568
568
|
const e = /* @__PURE__ */ new Date();
|
|
569
569
|
return `${String(e.getFullYear()).padStart(4, "0")}-${ne(e.getMonth() + 1)}`;
|
|
570
570
|
}
|
|
@@ -577,7 +577,7 @@ function st(m, e) {
|
|
|
577
577
|
return [];
|
|
578
578
|
const i = Math.min(t, vt), n = [];
|
|
579
579
|
for (let s = 0; s <= i; s += 1) {
|
|
580
|
-
const a =
|
|
580
|
+
const a = ke(r, -s);
|
|
581
581
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
582
582
|
}
|
|
583
583
|
return n;
|
|
@@ -649,13 +649,13 @@ function dt(m, e) {
|
|
|
649
649
|
return r;
|
|
650
650
|
}
|
|
651
651
|
const wt = Object.freeze({
|
|
652
|
-
date:
|
|
652
|
+
date: Ce,
|
|
653
653
|
now: et,
|
|
654
654
|
today: tt,
|
|
655
655
|
number: rt,
|
|
656
656
|
pages: nt,
|
|
657
657
|
range: it,
|
|
658
|
-
monthAdd:
|
|
658
|
+
monthAdd: ke,
|
|
659
659
|
monthRange: st,
|
|
660
660
|
pageSummary: at,
|
|
661
661
|
findBy: ot,
|
|
@@ -1493,9 +1493,9 @@ ${t}`;
|
|
|
1493
1493
|
if (p.compileFailed || p.evaluator === null)
|
|
1494
1494
|
return { value: null, unresolvedReference: !1 };
|
|
1495
1495
|
try {
|
|
1496
|
-
const g = [],
|
|
1496
|
+
const g = [], E = this.wrapBoundValues(a);
|
|
1497
1497
|
p.bindKeys.forEach((D) => {
|
|
1498
|
-
g.push(
|
|
1498
|
+
g.push(E[D]);
|
|
1499
1499
|
});
|
|
1500
1500
|
const v = this.withBlockedPropertyAccess(
|
|
1501
1501
|
() => p.evaluator(...g)
|
|
@@ -1509,19 +1509,19 @@ ${t}`;
|
|
|
1509
1509
|
};
|
|
1510
1510
|
} catch (g) {
|
|
1511
1511
|
if (o && g instanceof ReferenceError) {
|
|
1512
|
-
const
|
|
1513
|
-
if (
|
|
1514
|
-
a[
|
|
1512
|
+
const E = this.extractMissingIdentifier(g);
|
|
1513
|
+
if (E !== null && this.canRecoverMissingIdentifier(E, a)) {
|
|
1514
|
+
a[E] = void 0;
|
|
1515
1515
|
continue;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
if (this.warnBlockedIdentifiers(e), g instanceof ReferenceError && u.length > 0) {
|
|
1519
|
-
const
|
|
1519
|
+
const E = this.evaluateAsCondition(
|
|
1520
1520
|
e,
|
|
1521
1521
|
a,
|
|
1522
1522
|
u
|
|
1523
1523
|
);
|
|
1524
|
-
return
|
|
1524
|
+
return E !== void 0 ? { value: E, unresolvedReference: !1 } : (this.recordUnresolvedIdentifiers(
|
|
1525
1525
|
this.extractUninitializedIdentifiers(g, u),
|
|
1526
1526
|
e
|
|
1527
1527
|
), { value: void 0, unresolvedReference: !0 });
|
|
@@ -1563,12 +1563,12 @@ ${t}`;
|
|
|
1563
1563
|
};
|
|
1564
1564
|
const d = this.buildAssignments(n), p = this.buildShadowDeclarations(o), g = this.toGuardedMemberExpression(
|
|
1565
1565
|
this.toOptionalChainExpression(e)
|
|
1566
|
-
),
|
|
1566
|
+
), E = d ? `"use strict";
|
|
1567
1567
|
${d};
|
|
1568
1568
|
return (${g});${p}` : `"use strict";
|
|
1569
1569
|
return (${g});${p}`;
|
|
1570
1570
|
try {
|
|
1571
|
-
return u = new Function(...n,
|
|
1571
|
+
return u = new Function(...n, E), this.EXPRESSION_CACHE.set(l, u), this.compileFailedExpressions.delete(e), {
|
|
1572
1572
|
bindKeys: n,
|
|
1573
1573
|
evaluator: u,
|
|
1574
1574
|
compileFailed: !1
|
|
@@ -1853,6 +1853,13 @@ return (${g});${p}`;
|
|
|
1853
1853
|
}
|
|
1854
1854
|
if (s === "/" && (e[n + 1] === "/" || e[n + 1] === "*"))
|
|
1855
1855
|
return null;
|
|
1856
|
+
if (s === "/" && this.startsRegexpLiteral(t)) {
|
|
1857
|
+
const o = this.readRegexpToken(e, n);
|
|
1858
|
+
if (o === null)
|
|
1859
|
+
return null;
|
|
1860
|
+
t.push(o.token), n = o.nextIndex;
|
|
1861
|
+
continue;
|
|
1862
|
+
}
|
|
1856
1863
|
if (s === '"' || s === "'") {
|
|
1857
1864
|
const o = this.readStringToken(e, n);
|
|
1858
1865
|
if (o === null)
|
|
@@ -1885,6 +1892,75 @@ return (${g});${p}`;
|
|
|
1885
1892
|
}
|
|
1886
1893
|
return t;
|
|
1887
1894
|
}
|
|
1895
|
+
/**
|
|
1896
|
+
* `/` が正規表現リテラルの開始かどうかを判定します。
|
|
1897
|
+
*
|
|
1898
|
+
* 正規表現リテラルは「値が来る位置」にだけ現れます。直前が値(識別子・数値・
|
|
1899
|
+
* 文字列・正規表現リテラル)またはグループの閉じ(`)` / `]` / `}`)であれば、
|
|
1900
|
+
* その `/` は除算演算子です(仕様「正規表現リテラル」の「`/` が正規表現
|
|
1901
|
+
* リテラルの開始になるのは、値が来る位置に限られます」)。
|
|
1902
|
+
*
|
|
1903
|
+
* 後置の `++` / `--` も値を返すため除算です。トークン列は空白を落としているので
|
|
1904
|
+
* `a++ /` と `a + + /` を区別できませんが、除算へ倒せば従来どおり評価でき、
|
|
1905
|
+
* 中身も通常のトークンとして検証されます(リテラルへ倒すと検証を飛ばした本体を
|
|
1906
|
+
* JavaScript が除算として実行し得るため、安全側は除算です)。
|
|
1907
|
+
*
|
|
1908
|
+
* @param tokens ここまでに読み取ったトークン列
|
|
1909
|
+
* @returns 正規表現リテラルの開始であれば true
|
|
1910
|
+
*/
|
|
1911
|
+
static startsRegexpLiteral(e) {
|
|
1912
|
+
const t = e[e.length - 1];
|
|
1913
|
+
if (t === void 0)
|
|
1914
|
+
return !0;
|
|
1915
|
+
if (t.type !== "operator" || t.value === ")" || t.value === "]" || t.value === "}")
|
|
1916
|
+
return !1;
|
|
1917
|
+
const r = e[e.length - 2];
|
|
1918
|
+
return !((t.value === "+" || t.value === "-") && r?.value === t.value);
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* 正規表現リテラルを読み取ります。
|
|
1922
|
+
*
|
|
1923
|
+
* 本体は `\` エスケープと `[…]` 文字クラスを追跡して終端の `/` を探します。
|
|
1924
|
+
* 文字クラスの中の `/` は終端になりません(仕様「正規表現リテラル」の
|
|
1925
|
+
* 「文字クラスの中の `/` は終端になりません」)。終端に続く英字はフラグです。
|
|
1926
|
+
*
|
|
1927
|
+
* **本体の改行は判定しません。** 改行を含む正規表現リテラルは JavaScript の
|
|
1928
|
+
* 構文として不正なので、読み取りを打ち切っても打ち切らなくても式は評価できず
|
|
1929
|
+
* (打ち切れば許可構文の検証で、読み切ればコンパイルで失敗する)、観測できる
|
|
1930
|
+
* 差がありません。
|
|
1931
|
+
*
|
|
1932
|
+
* @param expression 式全体
|
|
1933
|
+
* @param start 開始位置(`/` の位置)
|
|
1934
|
+
* @returns トークンと次の位置。終端の `/` が無い場合は null
|
|
1935
|
+
*/
|
|
1936
|
+
static readRegexpToken(e, t) {
|
|
1937
|
+
let r = t + 1, i = !1;
|
|
1938
|
+
for (; r < e.length; ) {
|
|
1939
|
+
const n = e[r];
|
|
1940
|
+
if (n === "\\") {
|
|
1941
|
+
r += 2;
|
|
1942
|
+
continue;
|
|
1943
|
+
}
|
|
1944
|
+
if (n === "[")
|
|
1945
|
+
i = !0;
|
|
1946
|
+
else if (n === "]")
|
|
1947
|
+
i = !1;
|
|
1948
|
+
else if (n === "/" && !i) {
|
|
1949
|
+
for (r += 1; r < e.length && /[A-Za-z]/.test(e[r]); )
|
|
1950
|
+
r += 1;
|
|
1951
|
+
return {
|
|
1952
|
+
token: {
|
|
1953
|
+
type: "regexp",
|
|
1954
|
+
value: e.slice(t, r),
|
|
1955
|
+
position: t
|
|
1956
|
+
},
|
|
1957
|
+
nextIndex: r
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
r += 1;
|
|
1961
|
+
}
|
|
1962
|
+
return null;
|
|
1963
|
+
}
|
|
1888
1964
|
/**
|
|
1889
1965
|
* 文字列リテラルを読み取ります。
|
|
1890
1966
|
*
|
|
@@ -1963,12 +2039,13 @@ return (${g});${p}`;
|
|
|
1963
2039
|
* 文字列リテラルも基点に含めます。含めないと `""["constructor"]` の `[` を配列
|
|
1964
2040
|
* リテラルの開始と誤って分類し、メンバーアクセスに対する禁止プロパティ名の検証
|
|
1965
2041
|
* (`hasAllowedSyntax()`)を素通りして `String` へ到達できてしまいます。
|
|
2042
|
+
* 正規表現リテラルも同じ理由で基点に含めます(`/a/["constructor"]`)。
|
|
1966
2043
|
*
|
|
1967
2044
|
* @param previous 直前のトークン
|
|
1968
2045
|
* @returns メンバーアクセスであればtrue
|
|
1969
2046
|
*/
|
|
1970
2047
|
static startsMemberAccess(e) {
|
|
1971
|
-
return e === null ? !1 : e.type === "identifier" || e.type === "number" || e.type === "string" ? !0 : e.value === ")" || e.value === "]" || e.value === "?.";
|
|
2048
|
+
return e === null ? !1 : e.type === "identifier" || e.type === "number" || e.type === "string" || e.type === "regexp" ? !0 : e.value === ")" || e.value === "]" || e.value === "?.";
|
|
1972
2049
|
}
|
|
1973
2050
|
/**
|
|
1974
2051
|
* object literal 内で次のトークンがキー位置かどうかを判定します。
|
|
@@ -2033,6 +2110,14 @@ return (${g});${p}`;
|
|
|
2033
2110
|
/**
|
|
2034
2111
|
* 危険なプロパティアクセスを防ぐために値を再帰的にラップします。
|
|
2035
2112
|
*
|
|
2113
|
+
* **ラップは冪等です。** すでにこの仕組みでラップした値は、新しい層を重ねずに
|
|
2114
|
+
* そのまま返します(仕様「評価メカニズム」の「すでにこの仕組みでラップした値を
|
|
2115
|
+
* もう一度ラップの対象にしたときは、同じ Proxy をそのまま返します」)。式の
|
|
2116
|
+
* 評価結果はラップ済みの値なので、それが何らかの経路でバインドデータへ入ると
|
|
2117
|
+
* 次の評価で層が 1 つ増えます。層が増えるとプロパティアクセス 1 回あたりの
|
|
2118
|
+
* トラップ通過数が層の数だけ増え、操作を重ねるほど再評価が遅くなります。
|
|
2119
|
+
* 遮断の内容は層の数によらないため、重ねる意味はありません。
|
|
2120
|
+
*
|
|
2036
2121
|
* @param value ラップ対象の値
|
|
2037
2122
|
* @param cache 既存Proxyのキャッシュ
|
|
2038
2123
|
* @returns ラップ済みの値
|
|
@@ -2040,7 +2125,10 @@ return (${g});${p}`;
|
|
|
2040
2125
|
static wrapBoundValue(e, t) {
|
|
2041
2126
|
if (!this.shouldWrapValue(e))
|
|
2042
2127
|
return e;
|
|
2043
|
-
const r = e
|
|
2128
|
+
const r = e;
|
|
2129
|
+
if (this.WRAPPED_VALUES.has(r))
|
|
2130
|
+
return r;
|
|
2131
|
+
const i = t.get(r);
|
|
2044
2132
|
if (i !== void 0)
|
|
2045
2133
|
return i;
|
|
2046
2134
|
const n = new Proxy(r, {
|
|
@@ -2072,7 +2160,7 @@ return (${g});${p}`;
|
|
|
2072
2160
|
t
|
|
2073
2161
|
)
|
|
2074
2162
|
});
|
|
2075
|
-
return t.set(r, n), n;
|
|
2163
|
+
return this.WRAPPED_VALUES.add(n), t.set(r, n), n;
|
|
2076
2164
|
}
|
|
2077
2165
|
/**
|
|
2078
2166
|
* Proxy ラップ対象の値かどうかを判定します。
|
|
@@ -2374,14 +2462,14 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2374
2462
|
"/",
|
|
2375
2463
|
"%",
|
|
2376
2464
|
"..."
|
|
2377
|
-
]), T.strictComparisonSplits = /* @__PURE__ */ new Map();
|
|
2465
|
+
]), T.strictComparisonSplits = /* @__PURE__ */ new Map(), T.WRAPPED_VALUES = /* @__PURE__ */ new WeakSet();
|
|
2378
2466
|
let Q = T;
|
|
2379
|
-
const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fieldset",
|
|
2467
|
+
const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fieldset", P = class P {
|
|
2380
2468
|
/**
|
|
2381
2469
|
* 集計状態を初期化します。
|
|
2382
2470
|
*/
|
|
2383
2471
|
static reset() {
|
|
2384
|
-
|
|
2472
|
+
P.ELEMENT_STORES.clear(), P.ensureGlobalAccess();
|
|
2385
2473
|
}
|
|
2386
2474
|
/**
|
|
2387
2475
|
* 集計を開始します。
|
|
@@ -2389,7 +2477,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2389
2477
|
* @returns 戻り値はありません。
|
|
2390
2478
|
*/
|
|
2391
2479
|
static start() {
|
|
2392
|
-
|
|
2480
|
+
P.collecting = !0;
|
|
2393
2481
|
}
|
|
2394
2482
|
/**
|
|
2395
2483
|
* 集計を停止します。
|
|
@@ -2397,7 +2485,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2397
2485
|
* @returns 戻り値はありません。
|
|
2398
2486
|
*/
|
|
2399
2487
|
static stop() {
|
|
2400
|
-
|
|
2488
|
+
P.collecting = !1;
|
|
2401
2489
|
}
|
|
2402
2490
|
/**
|
|
2403
2491
|
* 集計中かどうかを返します。
|
|
@@ -2405,7 +2493,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2405
2493
|
* @returns 集計中なら true
|
|
2406
2494
|
*/
|
|
2407
2495
|
static isCollecting() {
|
|
2408
|
-
return
|
|
2496
|
+
return P.collecting && j.isEnabled();
|
|
2409
2497
|
}
|
|
2410
2498
|
/**
|
|
2411
2499
|
* 現在の集計結果スナップショットを返します。
|
|
@@ -2413,7 +2501,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2413
2501
|
* @returns エレメントごとの集計結果
|
|
2414
2502
|
*/
|
|
2415
2503
|
static snapshot() {
|
|
2416
|
-
return
|
|
2504
|
+
return P.ensureGlobalAccess(), [...P.ELEMENT_STORES.entries()].map(([e, t]) => ({
|
|
2417
2505
|
elementId: e,
|
|
2418
2506
|
tagName: t.tagName,
|
|
2419
2507
|
attributes: [...t.attributes.entries()].map(([r, i]) => ({
|
|
@@ -2422,7 +2510,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2422
2510
|
calls: i.calls,
|
|
2423
2511
|
totalDurationMs: i.totalDurationMs,
|
|
2424
2512
|
maxDurationMs: i.maxDurationMs,
|
|
2425
|
-
placeholders:
|
|
2513
|
+
placeholders: P.sortPlaceholders(
|
|
2426
2514
|
i.placeholders
|
|
2427
2515
|
)
|
|
2428
2516
|
})).sort((r, i) => i.calls - r.calls),
|
|
@@ -2432,7 +2520,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2432
2520
|
calls: i.calls,
|
|
2433
2521
|
totalDurationMs: i.totalDurationMs,
|
|
2434
2522
|
maxDurationMs: i.maxDurationMs,
|
|
2435
|
-
placeholders:
|
|
2523
|
+
placeholders: P.sortPlaceholders(
|
|
2436
2524
|
i.placeholders
|
|
2437
2525
|
)
|
|
2438
2526
|
})).sort((r, i) => i.calls - r.calls)
|
|
@@ -2441,6 +2529,98 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2441
2529
|
return t.attributes.reduce((n, s) => n + s.calls, 0) + t.texts.reduce((n, s) => n + s.calls, 0) - r;
|
|
2442
2530
|
});
|
|
2443
2531
|
}
|
|
2532
|
+
/**
|
|
2533
|
+
* 所要時間の合計が大きい宣言から順に並べた要約を返します。
|
|
2534
|
+
*
|
|
2535
|
+
* `snapshot()` は要素ごとの生の集計なので、どの宣言が時間を使ったかを知るには
|
|
2536
|
+
* 集計する側でまとめ直す必要があります。遅い操作の原因を報告してもらうときに
|
|
2537
|
+
* 手作業の集計を挟まないよう、順位付きの要約をここで組み立てます
|
|
2538
|
+
* (仕様「重い宣言の一覧(`report`)」)。
|
|
2539
|
+
*
|
|
2540
|
+
* **まとめる単位は宣言です。** `data-each` の行テンプレートに書いた 1 つの宣言は
|
|
2541
|
+
* 行の数だけ要素に現れるため、要素単位のままでは同じ宣言が行の数だけ並び、
|
|
2542
|
+
* いずれも `calls` が 1 になって「どの宣言が重いか」が読めません。
|
|
2543
|
+
*
|
|
2544
|
+
* @param limit 出力する宣言の数。既定は 20
|
|
2545
|
+
* @returns 要約。合計は `limit` で絞る前の全件から求める
|
|
2546
|
+
*/
|
|
2547
|
+
static report(e = P.DEFAULT_REPORT_LIMIT) {
|
|
2548
|
+
const t = /* @__PURE__ */ new Map();
|
|
2549
|
+
let r = 0, i = 0;
|
|
2550
|
+
const n = (l, u, d) => {
|
|
2551
|
+
r += d.totalDurationMs, i += d.calls;
|
|
2552
|
+
const p = t.get(l);
|
|
2553
|
+
if (p === void 0) {
|
|
2554
|
+
t.set(l, {
|
|
2555
|
+
where: u,
|
|
2556
|
+
template: d.template,
|
|
2557
|
+
elements: 1,
|
|
2558
|
+
calls: d.calls,
|
|
2559
|
+
totalDurationMs: d.totalDurationMs,
|
|
2560
|
+
maxDurationMs: d.maxDurationMs,
|
|
2561
|
+
sharePercent: 0,
|
|
2562
|
+
representativeDurationMs: d.totalDurationMs
|
|
2563
|
+
});
|
|
2564
|
+
return;
|
|
2565
|
+
}
|
|
2566
|
+
p.elements += 1, p.calls += d.calls, p.totalDurationMs += d.totalDurationMs, p.maxDurationMs = Math.max(
|
|
2567
|
+
p.maxDurationMs,
|
|
2568
|
+
d.maxDurationMs
|
|
2569
|
+
), d.totalDurationMs > p.representativeDurationMs && (p.where = u, p.representativeDurationMs = d.totalDurationMs);
|
|
2570
|
+
};
|
|
2571
|
+
P.snapshot().forEach((l) => {
|
|
2572
|
+
l.attributes.forEach((u) => {
|
|
2573
|
+
n(
|
|
2574
|
+
`@${u.name}
|
|
2575
|
+
${u.template}`,
|
|
2576
|
+
`${l.elementId} @${u.name}`,
|
|
2577
|
+
u
|
|
2578
|
+
);
|
|
2579
|
+
}), l.texts.forEach((u) => {
|
|
2580
|
+
n(
|
|
2581
|
+
`#${u.childIndex}
|
|
2582
|
+
${u.template}`,
|
|
2583
|
+
`${l.elementId} #${u.childIndex}`,
|
|
2584
|
+
u
|
|
2585
|
+
);
|
|
2586
|
+
});
|
|
2587
|
+
});
|
|
2588
|
+
const s = [...t.values()].map(
|
|
2589
|
+
({ representativeDurationMs: l, ...u }) => u
|
|
2590
|
+
);
|
|
2591
|
+
s.sort((l, u) => u.totalDurationMs - l.totalDurationMs);
|
|
2592
|
+
const a = s.slice(0, e).map((l) => ({
|
|
2593
|
+
...l,
|
|
2594
|
+
sharePercent: r > 0 ? Math.round(l.totalDurationMs / r * 1e3) / 10 : 0
|
|
2595
|
+
})), o = {
|
|
2596
|
+
totalDurationMs: r,
|
|
2597
|
+
totalCalls: i,
|
|
2598
|
+
entryCount: s.length,
|
|
2599
|
+
top: a
|
|
2600
|
+
};
|
|
2601
|
+
return P.logReport(o), o;
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* 要約を表形式でコンソールへ出力します。
|
|
2605
|
+
*
|
|
2606
|
+
* 戻り値をそのまま読むと入れ子が深く、コンソールで折り畳まれて読みにくいため、
|
|
2607
|
+
* 貼り付けやすい形でも出します。
|
|
2608
|
+
*
|
|
2609
|
+
* @param report 出力する要約
|
|
2610
|
+
* @returns 戻り値はありません。
|
|
2611
|
+
*/
|
|
2612
|
+
static logReport(e) {
|
|
2613
|
+
const t = e.top.map((r, i) => {
|
|
2614
|
+
const n = String(i + 1).padStart(2), s = r.totalDurationMs.toFixed(1).padStart(9), a = `${r.sharePercent.toFixed(1)}%`.padStart(6), o = String(r.calls).padStart(6), l = String(r.elements).padStart(4), u = r.maxDurationMs.toFixed(1).padStart(8);
|
|
2615
|
+
return `${n}. ${s}ms ${a} calls=${o} elements=${l} max=${u}ms ${r.where} ${r.template}`;
|
|
2616
|
+
});
|
|
2617
|
+
y.info(
|
|
2618
|
+
"[Haori][evaluation-profile]",
|
|
2619
|
+
`total=${e.totalDurationMs.toFixed(1)}ms calls=${e.totalCalls} declarations=${e.entryCount}
|
|
2620
|
+
` + t.join(`
|
|
2621
|
+
`)
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2444
2624
|
/**
|
|
2445
2625
|
* 評価呼び出しを記録します。
|
|
2446
2626
|
*
|
|
@@ -2448,30 +2628,30 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2448
2628
|
* @param expressions 今回評価した式一覧
|
|
2449
2629
|
*/
|
|
2450
2630
|
static record(e, t, r) {
|
|
2451
|
-
if (!j.isEnabled() || !e || t.length === 0 || (
|
|
2631
|
+
if (!j.isEnabled() || !e || t.length === 0 || (P.ensureGlobalAccess(), !P.isCollecting()))
|
|
2452
2632
|
return;
|
|
2453
|
-
const i =
|
|
2633
|
+
const i = P.getOrCreateElementStore(
|
|
2454
2634
|
e.element
|
|
2455
2635
|
);
|
|
2456
2636
|
if (e.kind === "attribute") {
|
|
2457
|
-
const s =
|
|
2637
|
+
const s = P.getOrCreateCounter(
|
|
2458
2638
|
i.attributes,
|
|
2459
2639
|
e.rawName,
|
|
2460
2640
|
e.template
|
|
2461
2641
|
);
|
|
2462
|
-
|
|
2642
|
+
P.updateCounter(
|
|
2463
2643
|
s,
|
|
2464
2644
|
t,
|
|
2465
2645
|
r
|
|
2466
2646
|
);
|
|
2467
2647
|
return;
|
|
2468
2648
|
}
|
|
2469
|
-
const n =
|
|
2649
|
+
const n = P.getOrCreateCounter(
|
|
2470
2650
|
i.texts,
|
|
2471
2651
|
String(e.childIndex),
|
|
2472
2652
|
e.template
|
|
2473
2653
|
);
|
|
2474
|
-
|
|
2654
|
+
P.updateCounter(
|
|
2475
2655
|
n,
|
|
2476
2656
|
t,
|
|
2477
2657
|
r
|
|
@@ -2484,11 +2664,12 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2484
2664
|
if (!j.isEnabled())
|
|
2485
2665
|
return;
|
|
2486
2666
|
const e = globalThis;
|
|
2487
|
-
e[
|
|
2488
|
-
start: () =>
|
|
2489
|
-
stop: () =>
|
|
2490
|
-
reset: () =>
|
|
2491
|
-
snapshot: () =>
|
|
2667
|
+
e[P.GLOBAL_KEY] === void 0 && (e[P.GLOBAL_KEY] = {
|
|
2668
|
+
start: () => P.start(),
|
|
2669
|
+
stop: () => P.stop(),
|
|
2670
|
+
reset: () => P.reset(),
|
|
2671
|
+
snapshot: () => P.snapshot(),
|
|
2672
|
+
report: (t) => P.report(t)
|
|
2492
2673
|
});
|
|
2493
2674
|
}
|
|
2494
2675
|
/**
|
|
@@ -2498,7 +2679,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2498
2679
|
* @returns 集計ストア
|
|
2499
2680
|
*/
|
|
2500
2681
|
static getOrCreateElementStore(e) {
|
|
2501
|
-
const t =
|
|
2682
|
+
const t = P.createElementId(e), r = P.ELEMENT_STORES.get(t);
|
|
2502
2683
|
if (r)
|
|
2503
2684
|
return r;
|
|
2504
2685
|
const i = {
|
|
@@ -2506,7 +2687,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2506
2687
|
attributes: /* @__PURE__ */ new Map(),
|
|
2507
2688
|
texts: /* @__PURE__ */ new Map()
|
|
2508
2689
|
};
|
|
2509
|
-
return
|
|
2690
|
+
return P.ELEMENT_STORES.set(t, i), i;
|
|
2510
2691
|
}
|
|
2511
2692
|
/**
|
|
2512
2693
|
* カウンタを取得または初期化します。
|
|
@@ -2556,7 +2737,7 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2556
2737
|
*/
|
|
2557
2738
|
static updateCounter(e, t, r) {
|
|
2558
2739
|
e.calls += 1, e.totalDurationMs += r, e.maxDurationMs = Math.max(e.maxDurationMs, r), t.forEach((i) => {
|
|
2559
|
-
const n =
|
|
2740
|
+
const n = P.getOrCreatePlaceholder(
|
|
2560
2741
|
e.placeholders,
|
|
2561
2742
|
i.expression
|
|
2562
2743
|
);
|
|
@@ -2595,12 +2776,12 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2595
2776
|
* @returns 結果と所要時間
|
|
2596
2777
|
*/
|
|
2597
2778
|
static measure(e) {
|
|
2598
|
-
if (!
|
|
2779
|
+
if (!P.isCollecting())
|
|
2599
2780
|
return { value: e(), durationMs: 0 };
|
|
2600
|
-
const t =
|
|
2781
|
+
const t = P.now();
|
|
2601
2782
|
return {
|
|
2602
2783
|
value: e(),
|
|
2603
|
-
durationMs:
|
|
2784
|
+
durationMs: P.now() - t
|
|
2604
2785
|
};
|
|
2605
2786
|
}
|
|
2606
2787
|
/**
|
|
@@ -2627,8 +2808,8 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2627
2808
|
return t.join(" > ");
|
|
2628
2809
|
}
|
|
2629
2810
|
};
|
|
2630
|
-
|
|
2631
|
-
let Ne =
|
|
2811
|
+
P.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", P.ELEMENT_STORES = /* @__PURE__ */ new Map(), P.collecting = !1, P.DEFAULT_REPORT_LIMIT = 20;
|
|
2812
|
+
let Ne = P;
|
|
2632
2813
|
const ce = class ce {
|
|
2633
2814
|
/**
|
|
2634
2815
|
* フラグメントのコンストラクタ。
|
|
@@ -2761,8 +2942,8 @@ const ce = class ce {
|
|
|
2761
2942
|
}
|
|
2762
2943
|
};
|
|
2763
2944
|
ce.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
2764
|
-
let
|
|
2765
|
-
const R = class R extends
|
|
2945
|
+
let x = ce;
|
|
2946
|
+
const R = class R extends x {
|
|
2766
2947
|
/**
|
|
2767
2948
|
* エレメントフラグメントのコンストラクタ。
|
|
2768
2949
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -2777,7 +2958,7 @@ const R = class R extends C {
|
|
|
2777
2958
|
this.attributeMap.set(t, i);
|
|
2778
2959
|
}
|
|
2779
2960
|
}), e.childNodes.forEach((t) => {
|
|
2780
|
-
const r =
|
|
2961
|
+
const r = x.get(t);
|
|
2781
2962
|
r.setParent(this), this.children.push(r);
|
|
2782
2963
|
});
|
|
2783
2964
|
}
|
|
@@ -3697,7 +3878,7 @@ const R = class R extends C {
|
|
|
3697
3878
|
const t = this.getTarget().closest("select");
|
|
3698
3879
|
if (!t)
|
|
3699
3880
|
return !1;
|
|
3700
|
-
const r =
|
|
3881
|
+
const r = x.get(t);
|
|
3701
3882
|
return r instanceof R ? r.hasPendingUserEdit() : !1;
|
|
3702
3883
|
}
|
|
3703
3884
|
/**
|
|
@@ -3962,7 +4143,7 @@ const R = class R extends C {
|
|
|
3962
4143
|
const t = this.getTarget().closest("select");
|
|
3963
4144
|
if (!t)
|
|
3964
4145
|
return;
|
|
3965
|
-
const r =
|
|
4146
|
+
const r = x.get(t);
|
|
3966
4147
|
r instanceof R && r.syncValue();
|
|
3967
4148
|
}
|
|
3968
4149
|
/**
|
|
@@ -4094,7 +4275,7 @@ const R = class R extends C {
|
|
|
4094
4275
|
element: l,
|
|
4095
4276
|
rawName: e,
|
|
4096
4277
|
template: r
|
|
4097
|
-
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && R.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), g = o.isSingleExpression(),
|
|
4278
|
+
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && R.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), g = o.isSingleExpression(), E = se.joinEvaluateResults(u.results), v = u.results.length === 1 ? u.results[0] : E, D = t === "value" && R.resolveDeclaredValueType(l) === "boolean", M = v === !1 && !D, H = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || v === null || v === void 0 || M : p ? u.hasUnresolvedReference || v === null || v === void 0 || v === !1 : g ? u.hasUnresolvedReference || v === null || v === void 0 || M : d && E === "");
|
|
4098
4279
|
if (H && u.hasUnresolvedReference && R.warnUnresolvedAttribute(
|
|
4099
4280
|
e,
|
|
4100
4281
|
t,
|
|
@@ -4112,14 +4293,14 @@ const R = class R extends C {
|
|
|
4112
4293
|
l
|
|
4113
4294
|
);
|
|
4114
4295
|
}
|
|
4115
|
-
const
|
|
4116
|
-
if (!_ && !
|
|
4296
|
+
const A = o.isForceEvaluation() ? r : g ? v : E, S = i && o.isEvaluate && t === "value" && R.isValuePropertyTarget(l), C = l.getRootNode(), V = S && R.isUserEditableValue(l) && (l === C.activeElement || this.hasPendingUserEdit()), L = H || A === null || A === !1 && !D ? null : String(A), _ = e !== t && l.getAttribute(e) !== r, k = L === null ? l.hasAttribute(t) : l.getAttribute(t) !== L, q = L === null ? "" : L, X = S && !V && l.value !== q, Y = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), te = t === "selected" && l instanceof HTMLOptionElement, be = C.activeElement, ue = be !== null && (Y && l === be || te && l.closest("select") === be) || (Y || te) && this.hasPendingCheckableUserEdit(te), we = L !== null, $e = Y && !ue && l.checked !== we, Re = te && !ue && l.selected !== we;
|
|
4297
|
+
if (!_ && !k && !X && !$e && !Re)
|
|
4117
4298
|
return S && !V && (this.value = this.normalizeValueForElement(
|
|
4118
4299
|
l,
|
|
4119
4300
|
q
|
|
4120
4301
|
), this.clearUnappliedValueWrite()), (Y || te) && !ue && this.syncCheckableValueFromDom(te), Promise.resolve();
|
|
4121
4302
|
const We = K.enqueue(() => {
|
|
4122
|
-
_ && l.setAttribute(e, r),
|
|
4303
|
+
_ && l.setAttribute(e, r), L === null ? l.removeAttribute(t) : k && (l.setAttribute(t, L), t === `${c.prefix}bind` && this.recordSelfWrittenBind(L)), S && !V && (this.value = this.normalizeValueForElement(
|
|
4123
4304
|
l,
|
|
4124
4305
|
q
|
|
4125
4306
|
), X && (l.value = q), this.recordValueWriteResult(l.value === q)), $e && (l.checked = we), Re && (l.selected = we), ($e || Re) && this.syncCheckableValueFromDom(Re);
|
|
@@ -4227,7 +4408,7 @@ const R = class R extends C {
|
|
|
4227
4408
|
const i = t ? r.nextSibling : r;
|
|
4228
4409
|
let n = t ? r.nextSibling : r;
|
|
4229
4410
|
for (; n !== null; ) {
|
|
4230
|
-
const s =
|
|
4411
|
+
const s = x.get(n);
|
|
4231
4412
|
if (s !== null) {
|
|
4232
4413
|
const a = this.children.indexOf(s);
|
|
4233
4414
|
if (a !== -1)
|
|
@@ -4489,7 +4670,7 @@ R.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, R.VALUE
|
|
|
4489
4670
|
"week"
|
|
4490
4671
|
], R.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), R.sequenceCounter = 0, R.bindingWorkActiveCount = 0, R.pendingMutationFlusher = null, R.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), R.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
4491
4672
|
let I = R;
|
|
4492
|
-
class ee extends
|
|
4673
|
+
class ee extends x {
|
|
4493
4674
|
/**
|
|
4494
4675
|
* テキストフラグメントのコンストラクタ。
|
|
4495
4676
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -4575,7 +4756,7 @@ class ee extends C {
|
|
|
4575
4756
|
});
|
|
4576
4757
|
}
|
|
4577
4758
|
}
|
|
4578
|
-
class Ve extends
|
|
4759
|
+
class Ve extends x {
|
|
4579
4760
|
/**
|
|
4580
4761
|
* コメントフラグメントのコンストラクタ。
|
|
4581
4762
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -4616,7 +4797,7 @@ class Ve extends C {
|
|
|
4616
4797
|
}));
|
|
4617
4798
|
}
|
|
4618
4799
|
}
|
|
4619
|
-
const
|
|
4800
|
+
const Me = class Me {
|
|
4620
4801
|
/**
|
|
4621
4802
|
* コンストラクタ。
|
|
4622
4803
|
*
|
|
@@ -4624,7 +4805,7 @@ const ke = class ke {
|
|
|
4624
4805
|
*/
|
|
4625
4806
|
constructor(e) {
|
|
4626
4807
|
this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = e;
|
|
4627
|
-
const t = [...e.matchAll(
|
|
4808
|
+
const t = [...e.matchAll(Me.PLACEHOLDER_REGEX)];
|
|
4628
4809
|
let r = 0, i = !1, n = !1;
|
|
4629
4810
|
for (const s of t) {
|
|
4630
4811
|
s.index > r && this.contents.push({
|
|
@@ -4755,8 +4936,8 @@ const ke = class ke {
|
|
|
4755
4936
|
), { results: n, hasUnresolvedReference: o };
|
|
4756
4937
|
}
|
|
4757
4938
|
};
|
|
4758
|
-
|
|
4759
|
-
let se =
|
|
4939
|
+
Me.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
|
|
4940
|
+
let se = Me;
|
|
4760
4941
|
const Z = class Z extends se {
|
|
4761
4942
|
/**
|
|
4762
4943
|
* コンストラクタ。
|
|
@@ -4982,7 +5163,7 @@ const ge = class ge {
|
|
|
4982
5163
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
4983
5164
|
*/
|
|
4984
5165
|
static date(e, t, r) {
|
|
4985
|
-
return
|
|
5166
|
+
return Ce(e, t, r);
|
|
4986
5167
|
}
|
|
4987
5168
|
/**
|
|
4988
5169
|
* 現在日時を指定フォーマットの文字列へ整形します。
|
|
@@ -5059,7 +5240,7 @@ const ge = class ge {
|
|
|
5059
5240
|
* @returns 加算後の年月(`YYYY-MM` 形式)。不正な入力は空文字
|
|
5060
5241
|
*/
|
|
5061
5242
|
static monthAdd(e, t) {
|
|
5062
|
-
return
|
|
5243
|
+
return ke(e, t);
|
|
5063
5244
|
}
|
|
5064
5245
|
/**
|
|
5065
5246
|
* 基準月から過去方向へ `count + 1` 個の年月配列を降順で返します。
|
|
@@ -5168,7 +5349,7 @@ function Ye() {
|
|
|
5168
5349
|
(r) => typeof e?.[r] == "function"
|
|
5169
5350
|
) ? e : ye;
|
|
5170
5351
|
}
|
|
5171
|
-
const
|
|
5352
|
+
const h = class h {
|
|
5172
5353
|
/**
|
|
5173
5354
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
5174
5355
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -5179,7 +5360,7 @@ const f = class f {
|
|
|
5179
5360
|
*/
|
|
5180
5361
|
static getValues(e) {
|
|
5181
5362
|
const t = {}, r = /* @__PURE__ */ new Set();
|
|
5182
|
-
return
|
|
5363
|
+
return h.getPartValues(e, t, null, r), h.registerCollectedExcludedKeys(t, r), t;
|
|
5183
5364
|
}
|
|
5184
5365
|
/**
|
|
5185
5366
|
* 入力エレメントから収集する値を解決します。
|
|
@@ -5200,11 +5381,11 @@ const f = class f {
|
|
|
5200
5381
|
*/
|
|
5201
5382
|
static resolveCollectedValue(e) {
|
|
5202
5383
|
const t = e.getTarget();
|
|
5203
|
-
if (
|
|
5384
|
+
if (h.isFileInput(e)) {
|
|
5204
5385
|
const r = t, i = r.files ? Array.from(r.files) : [];
|
|
5205
5386
|
return r.multiple ? i : i.length > 0 ? i[0] : null;
|
|
5206
5387
|
}
|
|
5207
|
-
if (
|
|
5388
|
+
if (h.isBooleanCheckbox(e)) {
|
|
5208
5389
|
const r = t;
|
|
5209
5390
|
return r.value === "false" ? !r.checked : r.checked;
|
|
5210
5391
|
}
|
|
@@ -5257,13 +5438,13 @@ const f = class f {
|
|
|
5257
5438
|
* @returns 戻り値はありません。
|
|
5258
5439
|
*/
|
|
5259
5440
|
static clearRowUserEditMarksForChangedKeys(e, t) {
|
|
5260
|
-
const r =
|
|
5441
|
+
const r = h.getValues(e), i = /* @__PURE__ */ new Set();
|
|
5261
5442
|
for (const n of /* @__PURE__ */ new Set([
|
|
5262
5443
|
...Object.keys(r),
|
|
5263
5444
|
...Object.keys(t)
|
|
5264
5445
|
]))
|
|
5265
|
-
|
|
5266
|
-
i.size !== 0 &&
|
|
5446
|
+
h.isSameCollectedValue(r[n], t[n]) || i.add(n);
|
|
5447
|
+
i.size !== 0 && h.clearUserEditMarksForKeys(e, e, i);
|
|
5267
5448
|
}
|
|
5268
5449
|
/**
|
|
5269
5450
|
* 収集値と要素データの値が同じ内容かどうかを判定します。
|
|
@@ -5292,9 +5473,9 @@ const f = class f {
|
|
|
5292
5473
|
* @returns 戻り値はありません。
|
|
5293
5474
|
*/
|
|
5294
5475
|
static clearUserEditMarksForKeys(e, t, r) {
|
|
5295
|
-
const i =
|
|
5476
|
+
const i = h.resolveRowTopLevelKey(e, t);
|
|
5296
5477
|
i !== null && r.has(i) && e.clearUserEditMark(), e.getChildElementFragments().forEach((n) => {
|
|
5297
|
-
|
|
5478
|
+
h.clearUserEditMarksForKeys(n, t, r);
|
|
5298
5479
|
});
|
|
5299
5480
|
}
|
|
5300
5481
|
/**
|
|
@@ -5310,7 +5491,7 @@ const f = class f {
|
|
|
5310
5491
|
static resolveRowTopLevelKey(e, t) {
|
|
5311
5492
|
let r = null, i = e;
|
|
5312
5493
|
for (; i !== null && i !== t; ) {
|
|
5313
|
-
const n = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) ||
|
|
5494
|
+
const n = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) || h.resolveFieldName(i);
|
|
5314
5495
|
n != null && String(n) !== "" && (r = String(n)), i = i.getParent();
|
|
5315
5496
|
}
|
|
5316
5497
|
return r;
|
|
@@ -5351,7 +5532,7 @@ const f = class f {
|
|
|
5351
5532
|
const r = e.getTarget();
|
|
5352
5533
|
if (!(r instanceof HTMLInputElement) || r.type !== "radio" || r.hasAttribute("name") && !r.hasAttribute(ze))
|
|
5353
5534
|
return;
|
|
5354
|
-
const i =
|
|
5535
|
+
const i = h.resolveGroupScope(e), n = `${String(t)}--haori${h.resolveGroupScopeId(
|
|
5355
5536
|
i
|
|
5356
5537
|
)}`;
|
|
5357
5538
|
if (r.getAttribute("name") !== n)
|
|
@@ -5385,8 +5566,8 @@ const f = class f {
|
|
|
5385
5566
|
* @returns スコープの識別番号
|
|
5386
5567
|
*/
|
|
5387
5568
|
static resolveGroupScopeId(e) {
|
|
5388
|
-
const t =
|
|
5389
|
-
return t !== void 0 ? t : (
|
|
5569
|
+
const t = h.GROUP_SCOPE_IDS.get(e);
|
|
5570
|
+
return t !== void 0 ? t : (h.groupScopeSequence += 1, h.GROUP_SCOPE_IDS.set(e, h.groupScopeSequence), h.groupScopeSequence);
|
|
5390
5571
|
}
|
|
5391
5572
|
/**
|
|
5392
5573
|
* 宣言バインドで値・状態が決まり、その評価が解決している入力かどうかを判定します。
|
|
@@ -5404,17 +5585,17 @@ const f = class f {
|
|
|
5404
5585
|
* @returns 宣言バインドで値・状態が決まり、その評価が解決している場合 true
|
|
5405
5586
|
*/
|
|
5406
5587
|
static hasResolvedDeclarativeState(e) {
|
|
5407
|
-
if (!
|
|
5588
|
+
if (!h.isDeclarativeStateBound(e))
|
|
5408
5589
|
return !1;
|
|
5409
5590
|
const t = e.getTarget();
|
|
5410
5591
|
if (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio"))
|
|
5411
|
-
return
|
|
5412
|
-
if (
|
|
5413
|
-
return
|
|
5592
|
+
return h.isDeclarationResolved(e, "checked");
|
|
5593
|
+
if (h.hasDeclarativeBinding(e, "value"))
|
|
5594
|
+
return h.isDeclarationResolved(e, "value");
|
|
5414
5595
|
if (t instanceof HTMLSelectElement) {
|
|
5415
5596
|
for (const r of Array.from(t.options)) {
|
|
5416
|
-
const i =
|
|
5417
|
-
if (i instanceof I &&
|
|
5597
|
+
const i = x.get(r);
|
|
5598
|
+
if (i instanceof I && h.hasDeclarativeBinding(i, "selected") && !h.isDeclarationResolved(i, "selected"))
|
|
5418
5599
|
return !1;
|
|
5419
5600
|
}
|
|
5420
5601
|
return !0;
|
|
@@ -5457,7 +5638,7 @@ const f = class f {
|
|
|
5457
5638
|
*/
|
|
5458
5639
|
static isDeclarativeStateBound(e) {
|
|
5459
5640
|
const t = e.getTarget();
|
|
5460
|
-
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ?
|
|
5641
|
+
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? h.hasDeclarativeBinding(e, "checked") : I.isValuePropertyTarget(t) ? h.hasDeclarativeBinding(e, "value") ? !0 : t instanceof HTMLSelectElement ? h.hasDeclarativeSelectedOption(t) : !1 : !1;
|
|
5461
5642
|
}
|
|
5462
5643
|
/**
|
|
5463
5644
|
* 対象の部分木にある入力欄を、ネイティブのフォームリセットと同じ既定値へ戻します。
|
|
@@ -5477,7 +5658,7 @@ const f = class f {
|
|
|
5477
5658
|
const t = "input, textarea, select", r = [];
|
|
5478
5659
|
e.matches(t) && r.push(e), r.push(...e.querySelectorAll(t));
|
|
5479
5660
|
for (const i of r)
|
|
5480
|
-
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement &&
|
|
5661
|
+
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement && h.restoreDefaultSelection(i);
|
|
5481
5662
|
}
|
|
5482
5663
|
/**
|
|
5483
5664
|
* `<select>` の選択状態を既定の選択(`defaultSelected`)へ戻します。
|
|
@@ -5507,14 +5688,14 @@ const f = class f {
|
|
|
5507
5688
|
* @return 戻り値はありません。
|
|
5508
5689
|
*/
|
|
5509
5690
|
static clearDeclarativeStateFromDom(e) {
|
|
5510
|
-
if (
|
|
5691
|
+
if (h.isDeclarativeStateBound(e)) {
|
|
5511
5692
|
const t = e.getTarget();
|
|
5512
5693
|
t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked = !1 : t instanceof HTMLSelectElement ? (Array.from(t.options).forEach((r) => {
|
|
5513
5694
|
r.selected = !1;
|
|
5514
5695
|
}), t.selectedIndex = -1) : (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = "");
|
|
5515
5696
|
}
|
|
5516
5697
|
e.getChildren().forEach((t) => {
|
|
5517
|
-
t instanceof I &&
|
|
5698
|
+
t instanceof I && h.clearDeclarativeStateFromDom(t);
|
|
5518
5699
|
});
|
|
5519
5700
|
}
|
|
5520
5701
|
/**
|
|
@@ -5543,8 +5724,8 @@ const f = class f {
|
|
|
5543
5724
|
*/
|
|
5544
5725
|
static hasDeclarativeSelectedOption(e) {
|
|
5545
5726
|
for (const t of Array.from(e.options)) {
|
|
5546
|
-
const r =
|
|
5547
|
-
if (r instanceof I &&
|
|
5727
|
+
const r = x.get(t);
|
|
5728
|
+
if (r instanceof I && h.hasDeclarativeBinding(r, "selected"))
|
|
5548
5729
|
return !0;
|
|
5549
5730
|
}
|
|
5550
5731
|
return !1;
|
|
@@ -5575,7 +5756,7 @@ const f = class f {
|
|
|
5575
5756
|
* @returns 編集された入力欄だけを含む値のオブジェクト
|
|
5576
5757
|
*/
|
|
5577
5758
|
static getValuesEditedAfter(e, t) {
|
|
5578
|
-
return
|
|
5759
|
+
return h.getPartValues(e, {}, t);
|
|
5579
5760
|
}
|
|
5580
5761
|
/**
|
|
5581
5762
|
* 利用者が編集した入力欄に対応するバインドデータの経路を集めます。
|
|
@@ -5617,10 +5798,10 @@ const f = class f {
|
|
|
5617
5798
|
*/
|
|
5618
5799
|
static collectEditedPaths(e, t, r = "", i = null) {
|
|
5619
5800
|
const n = /* @__PURE__ */ new Map();
|
|
5620
|
-
for (const a of
|
|
5801
|
+
for (const a of h.collectUserEditSequences(e)) {
|
|
5621
5802
|
const o = /* @__PURE__ */ new Set();
|
|
5622
|
-
|
|
5623
|
-
|
|
5803
|
+
h.walkEditedPaths(
|
|
5804
|
+
h.getValuesEditedAfter(e, a - 1),
|
|
5624
5805
|
r,
|
|
5625
5806
|
o
|
|
5626
5807
|
);
|
|
@@ -5628,7 +5809,7 @@ const f = class f {
|
|
|
5628
5809
|
n.has(l) || n.set(l, a);
|
|
5629
5810
|
}
|
|
5630
5811
|
const s = /* @__PURE__ */ new Set();
|
|
5631
|
-
|
|
5812
|
+
h.walkExcludedPaths(i ?? h.getValues(e), r, s);
|
|
5632
5813
|
for (const a of s)
|
|
5633
5814
|
n.has(a) || n.set(a, t);
|
|
5634
5815
|
return n;
|
|
@@ -5641,7 +5822,7 @@ const f = class f {
|
|
|
5641
5822
|
*/
|
|
5642
5823
|
static collectUserEditSequences(e) {
|
|
5643
5824
|
const t = /* @__PURE__ */ new Set();
|
|
5644
|
-
return
|
|
5825
|
+
return h.walkUserEditSequences(e, t), [...t].sort((r, i) => i - r);
|
|
5645
5826
|
}
|
|
5646
5827
|
/**
|
|
5647
5828
|
* 部分木をたどってユーザー編集の通番を集めます。
|
|
@@ -5654,7 +5835,7 @@ const f = class f {
|
|
|
5654
5835
|
const r = e.getUserEditSequence();
|
|
5655
5836
|
r > 0 && t.add(r);
|
|
5656
5837
|
for (const i of e.getChildElementFragments())
|
|
5657
|
-
|
|
5838
|
+
h.walkUserEditSequences(i, t);
|
|
5658
5839
|
}
|
|
5659
5840
|
/**
|
|
5660
5841
|
* 収集値をたどって、除外されたキーの経路を集めます。
|
|
@@ -5669,15 +5850,15 @@ const f = class f {
|
|
|
5669
5850
|
static walkExcludedPaths(e, t, r) {
|
|
5670
5851
|
if (Array.isArray(e))
|
|
5671
5852
|
return;
|
|
5672
|
-
const i =
|
|
5853
|
+
const i = h.asPlainRecord(e);
|
|
5673
5854
|
if (i === null)
|
|
5674
5855
|
return;
|
|
5675
|
-
const n =
|
|
5856
|
+
const n = h.COLLECTED_EXCLUDED_KEYS.get(i);
|
|
5676
5857
|
if (n)
|
|
5677
5858
|
for (const s of n)
|
|
5678
5859
|
s in i || r.add(t === "" ? s : `${t}.${s}`);
|
|
5679
5860
|
for (const [s, a] of Object.entries(i))
|
|
5680
|
-
|
|
5861
|
+
h.walkExcludedPaths(
|
|
5681
5862
|
a,
|
|
5682
5863
|
t === "" ? s : `${t}.${s}`,
|
|
5683
5864
|
r
|
|
@@ -5693,10 +5874,10 @@ const f = class f {
|
|
|
5693
5874
|
static walkEditedPaths(e, t, r) {
|
|
5694
5875
|
if (Array.isArray(e))
|
|
5695
5876
|
return;
|
|
5696
|
-
const i =
|
|
5877
|
+
const i = h.asPlainRecord(e);
|
|
5697
5878
|
if (i !== null) {
|
|
5698
5879
|
for (const [n, s] of Object.entries(i))
|
|
5699
|
-
|
|
5880
|
+
h.walkEditedPaths(
|
|
5700
5881
|
s,
|
|
5701
5882
|
t === "" ? n : `${t}.${n}`,
|
|
5702
5883
|
r
|
|
@@ -5722,48 +5903,48 @@ const f = class f {
|
|
|
5722
5903
|
return t;
|
|
5723
5904
|
if (e.getTarget().hasAttribute(`${c.prefix}if-false`)) {
|
|
5724
5905
|
if (i !== null)
|
|
5725
|
-
for (const u of
|
|
5906
|
+
for (const u of h.collectDeclaredKeysInFragment(e))
|
|
5726
5907
|
i.add(u);
|
|
5727
5908
|
return t;
|
|
5728
5909
|
}
|
|
5729
|
-
const n =
|
|
5910
|
+
const n = h.resolveFieldName(e), s = e.getAttribute(`${c.prefix}form-object`), a = e.getAttribute(`${c.prefix}form-list`), o = e.hasAttribute(`${c.prefix}form-list`), l = r !== null && e.getUserEditSequence() <= r;
|
|
5730
5911
|
if (n) {
|
|
5731
|
-
if (r !== null &&
|
|
5732
|
-
const u =
|
|
5912
|
+
if (r !== null && h.isGroupedCheckable(e)) {
|
|
5913
|
+
const u = h.collectGroupSelection(
|
|
5733
5914
|
e,
|
|
5734
5915
|
o,
|
|
5735
5916
|
r
|
|
5736
5917
|
);
|
|
5737
5918
|
u.edited && (t[String(n)] = u.value);
|
|
5738
|
-
} else if (o &&
|
|
5919
|
+
} else if (o && h.isGroupedCheckable(e)) {
|
|
5739
5920
|
const u = String(n), d = e.getTarget();
|
|
5740
5921
|
r === null && !Array.isArray(t[u]) && (t[u] = []), !l && d.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(d.value));
|
|
5741
5922
|
} else if (o && l)
|
|
5742
5923
|
Array.isArray(t[String(n)]) ? t[String(n)].push(null) : t[String(n)] = [null];
|
|
5743
5924
|
else if (!l) if (o) {
|
|
5744
|
-
const u =
|
|
5925
|
+
const u = h.resolveCollectedValue(e), d = h.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
5745
5926
|
Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
|
|
5746
|
-
} else if (
|
|
5747
|
-
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, p = u instanceof HTMLInputElement ? u.value : e.getValue(), g = d ? p : null,
|
|
5748
|
-
g === null ?
|
|
5927
|
+
} else if (h.isGroupedCheckable(e)) {
|
|
5928
|
+
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, p = u instanceof HTMLInputElement ? u.value : e.getValue(), g = d ? p : null, E = String(n);
|
|
5929
|
+
g === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = g : Array.isArray(t[E]) ? t[E].push(g) : t[E] = [t[E], g];
|
|
5749
5930
|
} else
|
|
5750
|
-
t[String(n)] =
|
|
5931
|
+
t[String(n)] = h.resolveCollectedValue(e);
|
|
5751
5932
|
s && y.warn(
|
|
5752
5933
|
"Haori",
|
|
5753
5934
|
`Element cannot have both ${c.prefix}form-object and name attributes.`
|
|
5754
5935
|
);
|
|
5755
5936
|
for (const u of e.getChildElementFragments())
|
|
5756
|
-
|
|
5937
|
+
h.getPartValues(u, t, r, i);
|
|
5757
5938
|
} else if (s) {
|
|
5758
5939
|
const u = {}, d = i === null ? null : /* @__PURE__ */ new Set();
|
|
5759
5940
|
for (const p of e.getChildElementFragments())
|
|
5760
|
-
|
|
5941
|
+
h.getPartValues(
|
|
5761
5942
|
p,
|
|
5762
5943
|
u,
|
|
5763
5944
|
r,
|
|
5764
5945
|
d
|
|
5765
5946
|
);
|
|
5766
|
-
d !== null &&
|
|
5947
|
+
d !== null && h.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(s)), a && y.warn(
|
|
5767
5948
|
"Haori",
|
|
5768
5949
|
`Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
|
|
5769
5950
|
);
|
|
@@ -5771,26 +5952,26 @@ const f = class f {
|
|
|
5771
5952
|
const u = [], d = [];
|
|
5772
5953
|
let p = !1;
|
|
5773
5954
|
for (const g of e.getChildElementFragments()) {
|
|
5774
|
-
const
|
|
5775
|
-
|
|
5955
|
+
const E = {}, v = i === null ? null : /* @__PURE__ */ new Set();
|
|
5956
|
+
h.getPartValues(
|
|
5776
5957
|
g,
|
|
5777
|
-
|
|
5958
|
+
E,
|
|
5778
5959
|
r,
|
|
5779
5960
|
v
|
|
5780
|
-
), v !== null &&
|
|
5961
|
+
), v !== null && h.registerCollectedExcludedKeys(E, v), Object.keys(E).length > 0 ? (p = !0, u.push(E), d.push(g.getListKey())) : r !== null && (u.push({}), d.push(g.getListKey()));
|
|
5781
5962
|
}
|
|
5782
5963
|
if (r === null) {
|
|
5783
5964
|
const g = e.getAttribute(`${c.prefix}each-key`);
|
|
5784
|
-
|
|
5965
|
+
h.registerCollectedRowIdentity(
|
|
5785
5966
|
u,
|
|
5786
5967
|
g == null ? null : String(g),
|
|
5787
5968
|
d,
|
|
5788
|
-
|
|
5969
|
+
h.isCollectedListFromEachSource(e)
|
|
5789
5970
|
), t[String(a)] = u;
|
|
5790
5971
|
} else p && (t[String(a)] = u);
|
|
5791
5972
|
} else
|
|
5792
5973
|
for (const u of e.getChildElementFragments())
|
|
5793
|
-
|
|
5974
|
+
h.getPartValues(u, t, r, i);
|
|
5794
5975
|
return t;
|
|
5795
5976
|
}
|
|
5796
5977
|
/**
|
|
@@ -5803,7 +5984,7 @@ const f = class f {
|
|
|
5803
5984
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
5804
5985
|
*/
|
|
5805
5986
|
static setValues(e, t, r = !1) {
|
|
5806
|
-
return
|
|
5987
|
+
return h.setPartValues(e, t, r, !0);
|
|
5807
5988
|
}
|
|
5808
5989
|
/**
|
|
5809
5990
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -5816,7 +5997,7 @@ const f = class f {
|
|
|
5816
5997
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
5817
5998
|
*/
|
|
5818
5999
|
static syncValues(e, t, r = !1, i = null) {
|
|
5819
|
-
return
|
|
6000
|
+
return h.setPartValues(
|
|
5820
6001
|
e,
|
|
5821
6002
|
t,
|
|
5822
6003
|
r,
|
|
@@ -5839,7 +6020,7 @@ const f = class f {
|
|
|
5839
6020
|
* @returns 反映完了の Promise
|
|
5840
6021
|
*/
|
|
5841
6022
|
static syncRowValues(e, t, r = null) {
|
|
5842
|
-
return
|
|
6023
|
+
return h.setPartValues(
|
|
5843
6024
|
e,
|
|
5844
6025
|
t,
|
|
5845
6026
|
!1,
|
|
@@ -5869,7 +6050,7 @@ const f = class f {
|
|
|
5869
6050
|
if (!r)
|
|
5870
6051
|
return t;
|
|
5871
6052
|
const i = String(r);
|
|
5872
|
-
return Object.prototype.hasOwnProperty.call(t, i) ?
|
|
6053
|
+
return Object.prototype.hasOwnProperty.call(t, i) ? h.asPlainRecord(t[i]) ?? {} : h.resolveAncestorArgOwner(e, i)?.value ?? {};
|
|
5873
6054
|
}
|
|
5874
6055
|
/**
|
|
5875
6056
|
* `data-form-arg` のキーを所有する祖先を解決します。
|
|
@@ -5894,7 +6075,7 @@ const f = class f {
|
|
|
5894
6075
|
if (i && Object.prototype.hasOwnProperty.call(i, t)) {
|
|
5895
6076
|
if (r.getListKey() !== null)
|
|
5896
6077
|
return null;
|
|
5897
|
-
const n =
|
|
6078
|
+
const n = h.asPlainRecord(i[t]);
|
|
5898
6079
|
return n ? { owner: r, value: n } : null;
|
|
5899
6080
|
}
|
|
5900
6081
|
r = r.getParent();
|
|
@@ -5918,18 +6099,18 @@ const f = class f {
|
|
|
5918
6099
|
static buildConditionScope(e, t = null) {
|
|
5919
6100
|
const r = { ...e.getBindingData() }, i = t ? {
|
|
5920
6101
|
source: t,
|
|
5921
|
-
argKey:
|
|
5922
|
-
} :
|
|
6102
|
+
argKey: h.resolveFormArgKey(t)
|
|
6103
|
+
} : h.resolveConditionValueSource(e);
|
|
5923
6104
|
if (!i)
|
|
5924
6105
|
return r;
|
|
5925
|
-
const n =
|
|
6106
|
+
const n = h.getValues(i.source), s = h.collectDeclaredFieldKeys(i.source);
|
|
5926
6107
|
if (i.argKey === null) {
|
|
5927
6108
|
for (const o of s)
|
|
5928
6109
|
r[o] = n[o];
|
|
5929
6110
|
return r;
|
|
5930
6111
|
}
|
|
5931
6112
|
const a = {
|
|
5932
|
-
...
|
|
6113
|
+
...h.asPlainRecord(r[i.argKey]) ?? {}
|
|
5933
6114
|
};
|
|
5934
6115
|
for (const o of s)
|
|
5935
6116
|
a[o] = n[o];
|
|
@@ -5959,8 +6140,8 @@ const f = class f {
|
|
|
5959
6140
|
}
|
|
5960
6141
|
t = i;
|
|
5961
6142
|
}
|
|
5962
|
-
const r =
|
|
5963
|
-
return r ? { source: r, argKey:
|
|
6143
|
+
const r = h.getFormFragment(e);
|
|
6144
|
+
return r ? { source: r, argKey: h.resolveFormArgKey(r) } : null;
|
|
5964
6145
|
}
|
|
5965
6146
|
/**
|
|
5966
6147
|
* フォームコンテナの `data-form-arg` のキー名を返します。
|
|
@@ -5992,7 +6173,7 @@ const f = class f {
|
|
|
5992
6173
|
* @returns 宣言されている最上位のキー名
|
|
5993
6174
|
*/
|
|
5994
6175
|
static collectDeclaredFieldKeys(e) {
|
|
5995
|
-
return
|
|
6176
|
+
return h.collectDeclaredKeysInFragment(e);
|
|
5996
6177
|
}
|
|
5997
6178
|
/**
|
|
5998
6179
|
* フラグメントの配下で収集対象として**宣言されている**最上位のキー名を列挙します。
|
|
@@ -6004,7 +6185,7 @@ const f = class f {
|
|
|
6004
6185
|
* @returns 宣言されている最上位のキー名
|
|
6005
6186
|
*/
|
|
6006
6187
|
static collectDeclaredKeysInFragment(e) {
|
|
6007
|
-
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i =
|
|
6188
|
+
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = h.resolveFieldName(e);
|
|
6008
6189
|
i && t.add(String(i));
|
|
6009
6190
|
const n = `${c.prefix}form-object`, s = `${c.prefix}form-list`, a = r.getAttribute(n) ?? r.getAttribute(s);
|
|
6010
6191
|
if (a)
|
|
@@ -6018,8 +6199,8 @@ const f = class f {
|
|
|
6018
6199
|
p.hasAttribute(`${c.prefix}form-detach`) && (d = !0), (p.hasAttribute(n) || p.hasAttribute(s)) && (u = p), p = p.parentElement;
|
|
6019
6200
|
if (d)
|
|
6020
6201
|
return;
|
|
6021
|
-
const g = u ?? l,
|
|
6022
|
-
|
|
6202
|
+
const g = u ?? l, E = g.getAttribute(n) || g.getAttribute(s) || g.getAttribute(`${c.prefix}form-name`) || g.getAttribute("name");
|
|
6203
|
+
E && t.add(E);
|
|
6023
6204
|
}), t;
|
|
6024
6205
|
}
|
|
6025
6206
|
/**
|
|
@@ -6034,7 +6215,7 @@ const f = class f {
|
|
|
6034
6215
|
*/
|
|
6035
6216
|
static applyCustomValidity(e) {
|
|
6036
6217
|
const t = `${c.prefix}validity`, r = (i) => {
|
|
6037
|
-
i.hasAttribute(t) &&
|
|
6218
|
+
i.hasAttribute(t) && h.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
6038
6219
|
};
|
|
6039
6220
|
r(e);
|
|
6040
6221
|
}
|
|
@@ -6059,19 +6240,19 @@ const f = class f {
|
|
|
6059
6240
|
r.setCustomValidity("");
|
|
6060
6241
|
return;
|
|
6061
6242
|
}
|
|
6062
|
-
const n =
|
|
6063
|
-
|
|
6243
|
+
const n = h.buildConditionScope(e), s = Q.evaluateDetailed(
|
|
6244
|
+
h.unwrapConditionExpression(i),
|
|
6064
6245
|
n
|
|
6065
6246
|
);
|
|
6066
6247
|
if (s.unresolvedReference) {
|
|
6067
6248
|
y.warn(
|
|
6068
6249
|
"Haori",
|
|
6069
6250
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
6070
|
-
), r.setCustomValidity(
|
|
6251
|
+
), r.setCustomValidity(h.resolveValidityMessage(e));
|
|
6071
6252
|
return;
|
|
6072
6253
|
}
|
|
6073
6254
|
r.setCustomValidity(
|
|
6074
|
-
s.value ? "" :
|
|
6255
|
+
s.value ? "" : h.resolveValidityMessage(e)
|
|
6075
6256
|
);
|
|
6076
6257
|
}
|
|
6077
6258
|
/**
|
|
@@ -6133,7 +6314,7 @@ const f = class f {
|
|
|
6133
6314
|
* @param identifiesItems リストキーで収集先の配列要素を識別できるかどうか
|
|
6134
6315
|
*/
|
|
6135
6316
|
static registerCollectedRowIdentity(e, t, r, i) {
|
|
6136
|
-
|
|
6317
|
+
h.COLLECTED_ROW_IDENTITY.set(e, { keyArg: t, keys: r, identifiesItems: i });
|
|
6137
6318
|
}
|
|
6138
6319
|
/**
|
|
6139
6320
|
* 収集値の階層に、除外されたキーの集合を結び付けます。
|
|
@@ -6142,7 +6323,7 @@ const f = class f {
|
|
|
6142
6323
|
* @param keys 除外されたキー
|
|
6143
6324
|
*/
|
|
6144
6325
|
static registerCollectedExcludedKeys(e, t) {
|
|
6145
|
-
t.size > 0 &&
|
|
6326
|
+
t.size > 0 && h.COLLECTED_EXCLUDED_KEYS.set(e, t);
|
|
6146
6327
|
}
|
|
6147
6328
|
/**
|
|
6148
6329
|
* 収集値に控えた情報を、複製した値へ引き継ぎます。
|
|
@@ -6155,10 +6336,10 @@ const f = class f {
|
|
|
6155
6336
|
* @param to 複製した値
|
|
6156
6337
|
*/
|
|
6157
6338
|
static carryCollectedRowIdentity(e, t) {
|
|
6158
|
-
const r =
|
|
6159
|
-
r &&
|
|
6160
|
-
const i =
|
|
6161
|
-
i &&
|
|
6339
|
+
const r = h.COLLECTED_ROW_IDENTITY.get(e);
|
|
6340
|
+
r && h.COLLECTED_ROW_IDENTITY.set(t, r);
|
|
6341
|
+
const i = h.COLLECTED_EXCLUDED_KEYS.get(e);
|
|
6342
|
+
i && h.COLLECTED_EXCLUDED_KEYS.set(t, i);
|
|
6162
6343
|
}
|
|
6163
6344
|
/**
|
|
6164
6345
|
* 行の対応付けが出現順へ退いたことを、開発モードで一度だけ知らせます。
|
|
@@ -6170,7 +6351,7 @@ const f = class f {
|
|
|
6170
6351
|
* @param reason 退いた理由
|
|
6171
6352
|
*/
|
|
6172
6353
|
static warnPositionalRowFallback(e) {
|
|
6173
|
-
!j.isEnabled() ||
|
|
6354
|
+
!j.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e), y.warn(
|
|
6174
6355
|
"[Haori]",
|
|
6175
6356
|
`${c.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6176
6357
|
));
|
|
@@ -6208,8 +6389,8 @@ const f = class f {
|
|
|
6208
6389
|
static mergeCollectedValues(e, t) {
|
|
6209
6390
|
const r = { ...e ?? {} };
|
|
6210
6391
|
for (const [n, s] of Object.entries(t))
|
|
6211
|
-
|
|
6212
|
-
const i =
|
|
6392
|
+
h.UNSAFE_MERGE_KEYS.has(n) || (r[n] = h.overlayCollectedValue(e?.[n], s));
|
|
6393
|
+
const i = h.COLLECTED_EXCLUDED_KEYS.get(t);
|
|
6213
6394
|
if (i)
|
|
6214
6395
|
for (const n of i)
|
|
6215
6396
|
n in t || delete r[n];
|
|
@@ -6226,13 +6407,13 @@ const f = class f {
|
|
|
6226
6407
|
if (Array.isArray(t)) {
|
|
6227
6408
|
if (!Array.isArray(e))
|
|
6228
6409
|
return t;
|
|
6229
|
-
const n =
|
|
6410
|
+
const n = h.overlayIdentifiedRows(e, t);
|
|
6230
6411
|
return n !== null ? n : t.map(
|
|
6231
|
-
(s, a) =>
|
|
6412
|
+
(s, a) => h.overlayCollectedValue(e[a], s)
|
|
6232
6413
|
);
|
|
6233
6414
|
}
|
|
6234
|
-
const r =
|
|
6235
|
-
return r === null || i === null ? t :
|
|
6415
|
+
const r = h.asPlainRecord(t), i = h.asPlainRecord(e);
|
|
6416
|
+
return r === null || i === null ? t : h.mergeCollectedValues(i, r);
|
|
6236
6417
|
}
|
|
6237
6418
|
/**
|
|
6238
6419
|
* 式の先頭にある素の経路を返します。
|
|
@@ -6250,7 +6431,7 @@ const f = class f {
|
|
|
6250
6431
|
* @returns 先頭の経路。経路として読めない場合は null
|
|
6251
6432
|
*/
|
|
6252
6433
|
static resolveLeadingPath(e) {
|
|
6253
|
-
const t =
|
|
6434
|
+
const t = h.LEADING_PATH_PATTERN.exec(e);
|
|
6254
6435
|
if (!t)
|
|
6255
6436
|
return null;
|
|
6256
6437
|
const r = t[2].trim();
|
|
@@ -6287,7 +6468,7 @@ const f = class f {
|
|
|
6287
6468
|
const r = e.getRawAttribute(`${c.prefix}each`);
|
|
6288
6469
|
if (typeof r != "string" || r.trim() === "")
|
|
6289
6470
|
return !0;
|
|
6290
|
-
const i =
|
|
6471
|
+
const i = h.resolveLeadingPath(r);
|
|
6291
6472
|
if (i === null)
|
|
6292
6473
|
return !0;
|
|
6293
6474
|
const n = i.split(".");
|
|
@@ -6342,7 +6523,7 @@ const f = class f {
|
|
|
6342
6523
|
const i = e.map((s) => s.getListKey());
|
|
6343
6524
|
if (i.some((s) => s === null))
|
|
6344
6525
|
return null;
|
|
6345
|
-
const n =
|
|
6526
|
+
const n = h.createRowKeyIndexes(t, r);
|
|
6346
6527
|
return i.map((s) => {
|
|
6347
6528
|
const a = n.get(s);
|
|
6348
6529
|
return !a || a.length === 0 ? null : t[a.shift()];
|
|
@@ -6364,23 +6545,23 @@ const f = class f {
|
|
|
6364
6545
|
* @returns 重ね合わせた配列。対応付けができない場合は null(出現順へ退く)
|
|
6365
6546
|
*/
|
|
6366
6547
|
static overlayIdentifiedRows(e, t) {
|
|
6367
|
-
const r =
|
|
6548
|
+
const r = h.COLLECTED_ROW_IDENTITY.get(t);
|
|
6368
6549
|
if (r && !r.identifiesItems)
|
|
6369
6550
|
return null;
|
|
6370
6551
|
if (!r)
|
|
6371
|
-
return t.some((s) =>
|
|
6552
|
+
return t.some((s) => h.asPlainRecord(s) !== null) && h.warnPositionalRowFallback("識別情報が引き継がれていません"), null;
|
|
6372
6553
|
if (r.keys.length !== t.length)
|
|
6373
|
-
return
|
|
6554
|
+
return h.warnPositionalRowFallback("収集後に行の数が変わっています"), null;
|
|
6374
6555
|
if (r.keys.some((s) => s === null))
|
|
6375
6556
|
return null;
|
|
6376
|
-
const i =
|
|
6557
|
+
const i = h.createRowKeyIndexes(e, r.keyArg), n = [];
|
|
6377
6558
|
for (let s = 0; s < t.length; s += 1) {
|
|
6378
6559
|
const a = r.keys[s], o = i.get(a);
|
|
6379
6560
|
if (!o || o.length === 0)
|
|
6380
6561
|
continue;
|
|
6381
6562
|
const l = o.shift();
|
|
6382
6563
|
n.push(
|
|
6383
|
-
|
|
6564
|
+
h.overlayCollectedValue(e[l], t[s])
|
|
6384
6565
|
);
|
|
6385
6566
|
}
|
|
6386
6567
|
return n;
|
|
@@ -6401,11 +6582,11 @@ const f = class f {
|
|
|
6401
6582
|
*/
|
|
6402
6583
|
static syncAncestorArgForms(e, t, r = null) {
|
|
6403
6584
|
const i = [];
|
|
6404
|
-
for (const { form: n, key: s } of
|
|
6585
|
+
for (const { form: n, key: s } of h.collectArgForms(e)) {
|
|
6405
6586
|
if (n.wasResetAfter(t))
|
|
6406
6587
|
continue;
|
|
6407
|
-
const a =
|
|
6408
|
-
!a || a.owner !== e || i.push(
|
|
6588
|
+
const a = h.resolveAncestorArgOwner(n, s);
|
|
6589
|
+
!a || a.owner !== e || i.push(h.pushAncestorArgValue(n, s, a.value, r));
|
|
6409
6590
|
}
|
|
6410
6591
|
return Promise.all(i).then(() => {
|
|
6411
6592
|
});
|
|
@@ -6419,7 +6600,7 @@ const f = class f {
|
|
|
6419
6600
|
static collectArgForms(e) {
|
|
6420
6601
|
const t = `${c.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
6421
6602
|
return r.forEach((n) => {
|
|
6422
|
-
const s =
|
|
6603
|
+
const s = x.get(n);
|
|
6423
6604
|
if (!(s instanceof I))
|
|
6424
6605
|
return;
|
|
6425
6606
|
const a = s.getAttribute(t);
|
|
@@ -6443,13 +6624,13 @@ const f = class f {
|
|
|
6443
6624
|
* @returns 反映完了の Promise
|
|
6444
6625
|
*/
|
|
6445
6626
|
static pushAncestorArgValue(e, t, r, i = null) {
|
|
6446
|
-
const n = e.getTarget(), s =
|
|
6627
|
+
const n = e.getTarget(), s = h.createArgValueSignature(r);
|
|
6447
6628
|
if (s !== null) {
|
|
6448
|
-
if (
|
|
6629
|
+
if (h.LAST_ANCESTOR_ARG_VALUES.get(n) === s)
|
|
6449
6630
|
return Promise.resolve();
|
|
6450
|
-
|
|
6631
|
+
h.LAST_ANCESTOR_ARG_VALUES.set(n, s);
|
|
6451
6632
|
} else
|
|
6452
|
-
|
|
6633
|
+
h.LAST_ANCESTOR_ARG_VALUES.delete(n);
|
|
6453
6634
|
const a = e.getRawBindingData();
|
|
6454
6635
|
if (a && Object.prototype.hasOwnProperty.call(a, t)) {
|
|
6455
6636
|
const o = { ...a };
|
|
@@ -6458,7 +6639,7 @@ const f = class f {
|
|
|
6458
6639
|
sequence: i?.sequence ?? I.nextSequence()
|
|
6459
6640
|
});
|
|
6460
6641
|
}
|
|
6461
|
-
return
|
|
6642
|
+
return h.syncValues(e, r, !1, i);
|
|
6462
6643
|
}
|
|
6463
6644
|
/**
|
|
6464
6645
|
* 流し込み済み判定に使う値の署名を作ります。
|
|
@@ -6497,23 +6678,23 @@ const f = class f {
|
|
|
6497
6678
|
});
|
|
6498
6679
|
const r = [];
|
|
6499
6680
|
for (const i of t) {
|
|
6500
|
-
if (
|
|
6681
|
+
if (h.INITIAL_RESTORED_FORMS.has(i))
|
|
6501
6682
|
continue;
|
|
6502
|
-
const n =
|
|
6683
|
+
const n = x.get(i);
|
|
6503
6684
|
if (!(n instanceof I))
|
|
6504
6685
|
continue;
|
|
6505
|
-
const s = n.getRawBindingData(), a = n.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ?
|
|
6686
|
+
const s = n.getRawBindingData(), a = n.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ? h.resolveAncestorArgOwner(n, o) : null;
|
|
6506
6687
|
if (!(!s && !l)) {
|
|
6507
|
-
if (
|
|
6688
|
+
if (h.INITIAL_RESTORED_FORMS.add(i), l) {
|
|
6508
6689
|
r.push(
|
|
6509
|
-
|
|
6690
|
+
h.pushAncestorArgValue(n, o, l.value)
|
|
6510
6691
|
);
|
|
6511
6692
|
continue;
|
|
6512
6693
|
}
|
|
6513
6694
|
r.push(
|
|
6514
|
-
|
|
6695
|
+
h.syncValues(
|
|
6515
6696
|
n,
|
|
6516
|
-
|
|
6697
|
+
h.resolveSyncValues(n, s)
|
|
6517
6698
|
)
|
|
6518
6699
|
);
|
|
6519
6700
|
}
|
|
@@ -6548,9 +6729,9 @@ const f = class f {
|
|
|
6548
6729
|
*/
|
|
6549
6730
|
static collectGroupSelection(e, t, r) {
|
|
6550
6731
|
const i = [];
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
String(
|
|
6732
|
+
h.collectGroupMembers(
|
|
6733
|
+
h.resolveCollectionScope(e),
|
|
6734
|
+
String(h.resolveFieldName(e)),
|
|
6554
6735
|
i
|
|
6555
6736
|
);
|
|
6556
6737
|
let n = !1;
|
|
@@ -6560,9 +6741,9 @@ const f = class f {
|
|
|
6560
6741
|
const o = a.getTarget();
|
|
6561
6742
|
o instanceof HTMLInputElement && o.checked && s.push(o.value);
|
|
6562
6743
|
}
|
|
6563
|
-
return t ? { edited: n, value:
|
|
6744
|
+
return t ? { edited: n, value: h.markCompleteSet(s) } : s.length === 0 ? { edited: n, value: null } : {
|
|
6564
6745
|
edited: n,
|
|
6565
|
-
value: s.length === 1 ? s[0] :
|
|
6746
|
+
value: s.length === 1 ? s[0] : h.markCompleteSet(s)
|
|
6566
6747
|
};
|
|
6567
6748
|
}
|
|
6568
6749
|
/**
|
|
@@ -6577,7 +6758,7 @@ const f = class f {
|
|
|
6577
6758
|
* @returns 新しい階層を始める場合は true
|
|
6578
6759
|
*/
|
|
6579
6760
|
static startsCollectionLevel(e) {
|
|
6580
|
-
return
|
|
6761
|
+
return h.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${c.prefix}form-object`) || e.getAttribute(`${c.prefix}form-list`));
|
|
6581
6762
|
}
|
|
6582
6763
|
/**
|
|
6583
6764
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -6598,9 +6779,9 @@ const f = class f {
|
|
|
6598
6779
|
static resolveCollectionScope(e) {
|
|
6599
6780
|
let t = e, r = t.getParent();
|
|
6600
6781
|
for (; r !== null; ) {
|
|
6601
|
-
if (
|
|
6782
|
+
if (h.startsCollectionLevel(r))
|
|
6602
6783
|
return r.getAttribute(`${c.prefix}form-object`) ? r : t;
|
|
6603
|
-
if (
|
|
6784
|
+
if (h.isFormScopeRoot(r))
|
|
6604
6785
|
return r;
|
|
6605
6786
|
t = r, r = r.getParent();
|
|
6606
6787
|
}
|
|
@@ -6633,11 +6814,11 @@ const f = class f {
|
|
|
6633
6814
|
* @param members 集める先
|
|
6634
6815
|
*/
|
|
6635
6816
|
static collectGroupMembers(e, t, r) {
|
|
6636
|
-
|
|
6817
|
+
h.isGroupedCheckable(e) && String(h.resolveFieldName(e)) === t && r.push(e);
|
|
6637
6818
|
for (const i of e.getChildElementFragments())
|
|
6638
|
-
|
|
6819
|
+
h.startsCollectionLevel(i) || i.hasAttribute(`${c.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
6639
6820
|
// (`getPartValues()` と同じ理由)。
|
|
6640
|
-
i.getTarget().hasAttribute(`${c.prefix}if-false`) ||
|
|
6821
|
+
i.getTarget().hasAttribute(`${c.prefix}if-false`) || h.collectGroupMembers(i, t, r);
|
|
6641
6822
|
}
|
|
6642
6823
|
/**
|
|
6643
6824
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -6651,7 +6832,7 @@ const f = class f {
|
|
|
6651
6832
|
* @returns 同じ配列
|
|
6652
6833
|
*/
|
|
6653
6834
|
static markCompleteSet(e) {
|
|
6654
|
-
return
|
|
6835
|
+
return h.COMPLETE_SET_VALUES.add(e), e;
|
|
6655
6836
|
}
|
|
6656
6837
|
/**
|
|
6657
6838
|
* 「集合として完結した値」の印が付いているかを返します。
|
|
@@ -6664,7 +6845,7 @@ const f = class f {
|
|
|
6664
6845
|
* @returns 印が付いていれば true
|
|
6665
6846
|
*/
|
|
6666
6847
|
static isCompleteSetValue(e) {
|
|
6667
|
-
return e !== null && typeof e == "object" &&
|
|
6848
|
+
return e !== null && typeof e == "object" && h.COMPLETE_SET_VALUES.has(e);
|
|
6668
6849
|
}
|
|
6669
6850
|
/**
|
|
6670
6851
|
* 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
|
|
@@ -6716,51 +6897,51 @@ const f = class f {
|
|
|
6716
6897
|
const o = [];
|
|
6717
6898
|
if (e.hasAttribute(`${c.prefix}form-detach`) && !r)
|
|
6718
6899
|
return Promise.resolve();
|
|
6719
|
-
const l =
|
|
6900
|
+
const l = h.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), d = e.getAttribute(`${c.prefix}form-list`), p = e.hasAttribute(`${c.prefix}form-list`);
|
|
6720
6901
|
if (l) {
|
|
6721
|
-
const g = t[String(l)],
|
|
6902
|
+
const g = t[String(l)], E = n && h.hasResolvedDeclarativeState(e), v = n && typeof g > "u" && !h.isDeclarativeStateBound(e);
|
|
6722
6903
|
let D = g;
|
|
6723
|
-
if (
|
|
6904
|
+
if (E ? D = void 0 : v && (D = null), h.isFileInput(e))
|
|
6724
6905
|
return (D === null || D === "") && o.push(
|
|
6725
|
-
|
|
6906
|
+
h.applyFragmentValue(e, null, i, a)
|
|
6726
6907
|
), Promise.all(o).then(() => {
|
|
6727
6908
|
});
|
|
6728
6909
|
if (p && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
6729
6910
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
6730
6911
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
6731
|
-
!
|
|
6732
|
-
const
|
|
6733
|
-
s.set(
|
|
6734
|
-
|
|
6912
|
+
!h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
|
|
6913
|
+
const M = String(l), H = s.get(M) ?? 0;
|
|
6914
|
+
s.set(M, H + 1), o.push(
|
|
6915
|
+
h.applyFragmentValue(
|
|
6735
6916
|
e,
|
|
6736
6917
|
D[H] ?? null,
|
|
6737
6918
|
i,
|
|
6738
6919
|
a
|
|
6739
6920
|
)
|
|
6740
6921
|
);
|
|
6741
|
-
} else typeof D > "u" || (Array.isArray(D) &&
|
|
6742
|
-
|
|
6922
|
+
} else typeof D > "u" || (Array.isArray(D) && h.isGroupedCheckable(e) || Array.isArray(D) && h.isMultipleSelect(e) || typeof D == "string" || typeof D == "number" || typeof D == "boolean" || D === null ? o.push(
|
|
6923
|
+
h.applyFragmentValue(
|
|
6743
6924
|
e,
|
|
6744
6925
|
D,
|
|
6745
6926
|
i,
|
|
6746
6927
|
a
|
|
6747
6928
|
)
|
|
6748
6929
|
) : o.push(
|
|
6749
|
-
|
|
6930
|
+
h.applyFragmentValue(e, String(D), i, a)
|
|
6750
6931
|
));
|
|
6751
6932
|
} else if (u) {
|
|
6752
6933
|
const g = t[String(u)];
|
|
6753
6934
|
if (g && typeof g == "object") {
|
|
6754
|
-
const
|
|
6935
|
+
const E = /* @__PURE__ */ new Map();
|
|
6755
6936
|
for (const v of e.getChildElementFragments())
|
|
6756
6937
|
o.push(
|
|
6757
|
-
|
|
6938
|
+
h.setPartValues(
|
|
6758
6939
|
v,
|
|
6759
6940
|
g,
|
|
6760
6941
|
r,
|
|
6761
6942
|
i,
|
|
6762
6943
|
n,
|
|
6763
|
-
|
|
6944
|
+
E,
|
|
6764
6945
|
a
|
|
6765
6946
|
)
|
|
6766
6947
|
);
|
|
@@ -6768,18 +6949,18 @@ const f = class f {
|
|
|
6768
6949
|
} else if (d) {
|
|
6769
6950
|
const g = t[String(d)];
|
|
6770
6951
|
if (Array.isArray(g)) {
|
|
6771
|
-
const
|
|
6772
|
-
|
|
6952
|
+
const E = e.getChildElementFragments(), v = e.getAttribute(`${c.prefix}each-key`), D = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
|
|
6953
|
+
E,
|
|
6773
6954
|
g,
|
|
6774
6955
|
v == null ? null : String(v)
|
|
6775
6956
|
) : null;
|
|
6776
|
-
for (let
|
|
6777
|
-
const H =
|
|
6957
|
+
for (let M = 0; M < E.length; M++) {
|
|
6958
|
+
const H = E[M], A = D ? D[M] : g.length > M ? g[M] : null;
|
|
6778
6959
|
o.push(
|
|
6779
6960
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
6780
|
-
|
|
6961
|
+
h.setPartValues(
|
|
6781
6962
|
H,
|
|
6782
|
-
|
|
6963
|
+
h.asPlainRecord(A) ?? {},
|
|
6783
6964
|
r,
|
|
6784
6965
|
i,
|
|
6785
6966
|
n,
|
|
@@ -6792,7 +6973,7 @@ const f = class f {
|
|
|
6792
6973
|
} else
|
|
6793
6974
|
for (const g of e.getChildElementFragments())
|
|
6794
6975
|
o.push(
|
|
6795
|
-
|
|
6976
|
+
h.setPartValues(
|
|
6796
6977
|
g,
|
|
6797
6978
|
t,
|
|
6798
6979
|
r,
|
|
@@ -6821,46 +7002,46 @@ const f = class f {
|
|
|
6821
7002
|
* @returns すべての初期化処理が完了するPromise
|
|
6822
7003
|
*/
|
|
6823
7004
|
static async reset(e, t = I.nextSequence()) {
|
|
6824
|
-
const r =
|
|
7005
|
+
const r = h.collectBindingTargetForms(e);
|
|
6825
7006
|
if (r.length > 0 && r.every((n) => n.isSupplyStale(t)))
|
|
6826
7007
|
return;
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
7008
|
+
h.markResetSubtree(e, t), B.clearUserEditMarks(e, t), h.clearValues(e), await Promise.all([
|
|
7009
|
+
h.clearMessages(e),
|
|
7010
|
+
h.clearEachClones(e)
|
|
6830
7011
|
]), await K.enqueue(() => {
|
|
6831
|
-
const n =
|
|
7012
|
+
const n = h.collectEditsAfter(
|
|
6832
7013
|
e,
|
|
6833
7014
|
t
|
|
6834
7015
|
), s = e.getTarget();
|
|
6835
|
-
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()),
|
|
7016
|
+
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()), h.restoreDefaultValues(s)), h.clearDeclarativeStateFromDom(e), h.restoreEdits(n);
|
|
6836
7017
|
});
|
|
6837
7018
|
const i = r;
|
|
6838
7019
|
for (const n of i) {
|
|
6839
|
-
const s =
|
|
7020
|
+
const s = h.getInitialBindingData(n);
|
|
6840
7021
|
s === null && n.getRawBindingData() === null || await B.setBindingData(n.getTarget(), s ?? {}, {
|
|
6841
7022
|
sequence: t
|
|
6842
7023
|
});
|
|
6843
7024
|
}
|
|
6844
|
-
|
|
7025
|
+
h.syncValuesFromDom(e), await B.evaluateAll(e);
|
|
6845
7026
|
for (const n of i)
|
|
6846
|
-
|
|
7027
|
+
h.getInitialBindingData(n) !== null || n.getRawBindingData() !== null || await h.restoreAncestorArgValues(n, {
|
|
6847
7028
|
sequence: t,
|
|
6848
7029
|
kind: "supply"
|
|
6849
7030
|
});
|
|
6850
7031
|
for (const n of i) {
|
|
6851
|
-
const s =
|
|
7032
|
+
const s = h.getInitialBindingData(n);
|
|
6852
7033
|
if (n.getRawBindingData() === null && s === null)
|
|
6853
7034
|
continue;
|
|
6854
|
-
const a =
|
|
7035
|
+
const a = h.getValues(n), o = n.getAttribute(`${c.prefix}form-arg`);
|
|
6855
7036
|
let l = { ...s || {} };
|
|
6856
7037
|
if (o) {
|
|
6857
7038
|
const u = String(o);
|
|
6858
|
-
!Object.prototype.hasOwnProperty.call(s ?? {}, u) &&
|
|
7039
|
+
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && h.resolveAncestorArgOwner(n, u) !== null || (l[u] = h.mergeCollectedValues(
|
|
6859
7040
|
l[u] ?? null,
|
|
6860
7041
|
a
|
|
6861
7042
|
));
|
|
6862
7043
|
} else
|
|
6863
|
-
l =
|
|
7044
|
+
l = h.mergeCollectedValues(l, a);
|
|
6864
7045
|
await B.setBindingData(n.getTarget(), l, {
|
|
6865
7046
|
sequence: t
|
|
6866
7047
|
});
|
|
@@ -6885,7 +7066,7 @@ const f = class f {
|
|
|
6885
7066
|
const t = e.getTarget();
|
|
6886
7067
|
(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && e.syncValue();
|
|
6887
7068
|
for (const r of e.getChildElementFragments())
|
|
6888
|
-
|
|
7069
|
+
h.syncValuesFromDom(r);
|
|
6889
7070
|
}
|
|
6890
7071
|
/**
|
|
6891
7072
|
* リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
|
|
@@ -6901,7 +7082,7 @@ const f = class f {
|
|
|
6901
7082
|
t instanceof HTMLFormElement ? r.push(t) : r.push(...Array.from(t.querySelectorAll("form")));
|
|
6902
7083
|
const i = [];
|
|
6903
7084
|
for (const n of r) {
|
|
6904
|
-
const s =
|
|
7085
|
+
const s = x.get(n);
|
|
6905
7086
|
s instanceof I && i.push(s);
|
|
6906
7087
|
}
|
|
6907
7088
|
return i;
|
|
@@ -6940,7 +7121,7 @@ const f = class f {
|
|
|
6940
7121
|
static clearValues(e) {
|
|
6941
7122
|
e.clearValue();
|
|
6942
7123
|
for (const t of e.getChildElementFragments())
|
|
6943
|
-
|
|
7124
|
+
h.clearValues(t);
|
|
6944
7125
|
}
|
|
6945
7126
|
/**
|
|
6946
7127
|
* 指定した通番より後に編集された入力欄の DOM の状態を控えます。
|
|
@@ -6964,7 +7145,7 @@ const f = class f {
|
|
|
6964
7145
|
)
|
|
6965
7146
|
}) : r.push({ element: i, value: i.value }));
|
|
6966
7147
|
for (const n of e.getChildElementFragments())
|
|
6967
|
-
|
|
7148
|
+
h.collectEditsAfter(n, t, r);
|
|
6968
7149
|
return r;
|
|
6969
7150
|
}
|
|
6970
7151
|
/**
|
|
@@ -7006,8 +7187,8 @@ const f = class f {
|
|
|
7006
7187
|
const r = e.getAttribute(`${c.prefix}form-arg`);
|
|
7007
7188
|
if (!r)
|
|
7008
7189
|
return;
|
|
7009
|
-
const i = String(r), n =
|
|
7010
|
-
n && (
|
|
7190
|
+
const i = String(r), n = h.resolveAncestorArgOwner(e, i);
|
|
7191
|
+
n && (h.LAST_ANCESTOR_ARG_VALUES.delete(e.getTarget()), await h.pushAncestorArgValue(e, i, n.value, t));
|
|
7011
7192
|
}
|
|
7012
7193
|
/**
|
|
7013
7194
|
* 初期化の通番を部分木のすべてのフラグメントへ記録します。
|
|
@@ -7023,7 +7204,7 @@ const f = class f {
|
|
|
7023
7204
|
static markResetSubtree(e, t) {
|
|
7024
7205
|
e.markResetAt(t), e.markSupplyApplied(t);
|
|
7025
7206
|
for (const r of e.getChildElementFragments())
|
|
7026
|
-
|
|
7207
|
+
h.markResetSubtree(r, t);
|
|
7027
7208
|
}
|
|
7028
7209
|
/**
|
|
7029
7210
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -7046,7 +7227,7 @@ const f = class f {
|
|
|
7046
7227
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7047
7228
|
*/
|
|
7048
7229
|
static addErrorMessage(e, t, r) {
|
|
7049
|
-
return
|
|
7230
|
+
return h.addMessage(e, t, r, "error");
|
|
7050
7231
|
}
|
|
7051
7232
|
/**
|
|
7052
7233
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -7059,7 +7240,7 @@ const f = class f {
|
|
|
7059
7240
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7060
7241
|
*/
|
|
7061
7242
|
static addMessage(e, t, r, i) {
|
|
7062
|
-
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l =
|
|
7243
|
+
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.findFragmentsByKey(e, t);
|
|
7063
7244
|
return l.forEach((u) => {
|
|
7064
7245
|
n.push(o(u.getTarget()));
|
|
7065
7246
|
}), l.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
@@ -7073,7 +7254,7 @@ const f = class f {
|
|
|
7073
7254
|
* @returns 一致するフラグメントの配列
|
|
7074
7255
|
*/
|
|
7075
7256
|
static findFragmentsByKey(e, t) {
|
|
7076
|
-
return
|
|
7257
|
+
return h.findFragmentByKeyParts(e, t.split("."));
|
|
7077
7258
|
}
|
|
7078
7259
|
/**
|
|
7079
7260
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -7085,9 +7266,9 @@ const f = class f {
|
|
|
7085
7266
|
*/
|
|
7086
7267
|
static findFragmentByKeyParts(e, t) {
|
|
7087
7268
|
const r = [], i = t[0];
|
|
7088
|
-
if (t.length == 1 &&
|
|
7269
|
+
if (t.length == 1 && h.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${c.prefix}form-object`))
|
|
7089
7270
|
t.length > 1 && e.getAttribute(`${c.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
7090
|
-
r.push(...
|
|
7271
|
+
r.push(...h.findFragmentByKeyParts(s, t.slice(1)));
|
|
7091
7272
|
});
|
|
7092
7273
|
else if (e.hasAttribute(`${c.prefix}form-list`)) {
|
|
7093
7274
|
if (t.length > 1) {
|
|
@@ -7101,7 +7282,7 @@ const f = class f {
|
|
|
7101
7282
|
else {
|
|
7102
7283
|
const d = e.getChildElementFragments().filter((p) => p.hasAttribute(`${c.prefix}row`));
|
|
7103
7284
|
u < d.length && r.push(
|
|
7104
|
-
...
|
|
7285
|
+
...h.findFragmentByKeyParts(d[u], t.slice(1))
|
|
7105
7286
|
);
|
|
7106
7287
|
}
|
|
7107
7288
|
}
|
|
@@ -7109,7 +7290,7 @@ const f = class f {
|
|
|
7109
7290
|
}
|
|
7110
7291
|
} else
|
|
7111
7292
|
e.getChildElementFragments().forEach((n) => {
|
|
7112
|
-
r.push(...
|
|
7293
|
+
r.push(...h.findFragmentByKeyParts(n, t));
|
|
7113
7294
|
});
|
|
7114
7295
|
return r;
|
|
7115
7296
|
}
|
|
@@ -7132,13 +7313,13 @@ const f = class f {
|
|
|
7132
7313
|
return r ? this.getFormFragment(r) : null;
|
|
7133
7314
|
}
|
|
7134
7315
|
};
|
|
7135
|
-
|
|
7316
|
+
h.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), h.LAST_ANCESTOR_ARG_VALUES = /* @__PURE__ */ new WeakMap(), h.GROUP_SCOPE_IDS = /* @__PURE__ */ new WeakMap(), h.groupScopeSequence = 0, h.UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set([
|
|
7136
7317
|
"__proto__",
|
|
7137
7318
|
"constructor",
|
|
7138
7319
|
"prototype"
|
|
7139
|
-
]),
|
|
7140
|
-
let F =
|
|
7141
|
-
class
|
|
7320
|
+
]), h.COLLECTED_ROW_IDENTITY = /* @__PURE__ */ new WeakMap(), h.COMPLETE_SET_VALUES = /* @__PURE__ */ new WeakSet(), h.COLLECTED_EXCLUDED_KEYS = /* @__PURE__ */ new WeakMap(), h.warnedPositionalRowFallbacks = /* @__PURE__ */ new Set(), h.LEADING_PATH_PATTERN = /^\s*([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*([\s\S]*)$/;
|
|
7321
|
+
let F = h;
|
|
7322
|
+
class U {
|
|
7142
7323
|
/**
|
|
7143
7324
|
* カスタムイベントを発火します。
|
|
7144
7325
|
*
|
|
@@ -7162,7 +7343,7 @@ class O {
|
|
|
7162
7343
|
* @param version ライブラリバージョン
|
|
7163
7344
|
*/
|
|
7164
7345
|
static ready(e) {
|
|
7165
|
-
|
|
7346
|
+
U.dispatch(document, "ready", { version: e });
|
|
7166
7347
|
}
|
|
7167
7348
|
/**
|
|
7168
7349
|
* importstartイベントを発火します。
|
|
@@ -7171,7 +7352,7 @@ class O {
|
|
|
7171
7352
|
* @param url インポート対象URL
|
|
7172
7353
|
*/
|
|
7173
7354
|
static importStart(e, t) {
|
|
7174
|
-
|
|
7355
|
+
U.dispatch(e, "importstart", {
|
|
7175
7356
|
url: t,
|
|
7176
7357
|
startedAt: performance.now()
|
|
7177
7358
|
});
|
|
@@ -7185,7 +7366,7 @@ class O {
|
|
|
7185
7366
|
* @param startedAt 開始時刻
|
|
7186
7367
|
*/
|
|
7187
7368
|
static importEnd(e, t, r, i) {
|
|
7188
|
-
|
|
7369
|
+
U.dispatch(e, "importend", {
|
|
7189
7370
|
url: t,
|
|
7190
7371
|
bytes: r,
|
|
7191
7372
|
durationMs: performance.now() - i
|
|
@@ -7199,7 +7380,7 @@ class O {
|
|
|
7199
7380
|
* @param error エラー内容
|
|
7200
7381
|
*/
|
|
7201
7382
|
static importError(e, t, r) {
|
|
7202
|
-
|
|
7383
|
+
U.dispatch(e, "importerror", { url: t, error: r });
|
|
7203
7384
|
}
|
|
7204
7385
|
/**
|
|
7205
7386
|
* bindchangeイベントを発火します。
|
|
@@ -7215,7 +7396,7 @@ class O {
|
|
|
7215
7396
|
const u = t?.[l], d = r[l];
|
|
7216
7397
|
u !== d && n.push(l);
|
|
7217
7398
|
}
|
|
7218
|
-
|
|
7399
|
+
U.dispatch(e, "bindchange", {
|
|
7219
7400
|
previous: t || {},
|
|
7220
7401
|
next: r,
|
|
7221
7402
|
changedKeys: n,
|
|
@@ -7234,7 +7415,7 @@ class O {
|
|
|
7234
7415
|
* @param reason 変更理由
|
|
7235
7416
|
*/
|
|
7236
7417
|
static bindComplete(e, t = null, r = "other") {
|
|
7237
|
-
|
|
7418
|
+
U.dispatch(e, "bindcomplete", { bindArg: t, reason: r });
|
|
7238
7419
|
}
|
|
7239
7420
|
/**
|
|
7240
7421
|
* eachupdateイベントを発火します。
|
|
@@ -7245,7 +7426,7 @@ class O {
|
|
|
7245
7426
|
* @param order 現在の順序
|
|
7246
7427
|
*/
|
|
7247
7428
|
static eachUpdate(e, t, r, i) {
|
|
7248
|
-
|
|
7429
|
+
U.dispatch(e, "eachupdate", {
|
|
7249
7430
|
added: t,
|
|
7250
7431
|
removed: r,
|
|
7251
7432
|
order: i,
|
|
@@ -7261,7 +7442,7 @@ class O {
|
|
|
7261
7442
|
* @param item 行データ
|
|
7262
7443
|
*/
|
|
7263
7444
|
static rowAdd(e, t, r, i) {
|
|
7264
|
-
|
|
7445
|
+
U.dispatch(e, "rowadd", { key: t, index: r, item: i });
|
|
7265
7446
|
}
|
|
7266
7447
|
/**
|
|
7267
7448
|
* rowremoveイベントを発火します。
|
|
@@ -7271,7 +7452,7 @@ class O {
|
|
|
7271
7452
|
* @param index インデックス
|
|
7272
7453
|
*/
|
|
7273
7454
|
static rowRemove(e, t, r) {
|
|
7274
|
-
|
|
7455
|
+
U.dispatch(e, "rowremove", { key: t, index: r });
|
|
7275
7456
|
}
|
|
7276
7457
|
/**
|
|
7277
7458
|
* rowmoveイベントを発火します。
|
|
@@ -7282,7 +7463,7 @@ class O {
|
|
|
7282
7463
|
* @param to 移動後インデックス
|
|
7283
7464
|
*/
|
|
7284
7465
|
static rowMove(e, t, r, i) {
|
|
7285
|
-
|
|
7466
|
+
U.dispatch(e, "rowmove", { key: t, from: r, to: i });
|
|
7286
7467
|
}
|
|
7287
7468
|
/**
|
|
7288
7469
|
* showイベントを発火します。
|
|
@@ -7290,7 +7471,7 @@ class O {
|
|
|
7290
7471
|
* @param target data-if要素
|
|
7291
7472
|
*/
|
|
7292
7473
|
static show(e) {
|
|
7293
|
-
|
|
7474
|
+
U.dispatch(e, "show", { visible: !0 });
|
|
7294
7475
|
}
|
|
7295
7476
|
/**
|
|
7296
7477
|
* hideイベントを発火します。
|
|
@@ -7298,7 +7479,7 @@ class O {
|
|
|
7298
7479
|
* @param target data-if要素
|
|
7299
7480
|
*/
|
|
7300
7481
|
static hide(e) {
|
|
7301
|
-
|
|
7482
|
+
U.dispatch(e, "hide", { visible: !1 });
|
|
7302
7483
|
}
|
|
7303
7484
|
/**
|
|
7304
7485
|
* fetchstartイベントを発火します。
|
|
@@ -7311,7 +7492,7 @@ class O {
|
|
|
7311
7492
|
* @return 戻り値はありません。
|
|
7312
7493
|
*/
|
|
7313
7494
|
static fetchStart(e, t, r, i, n) {
|
|
7314
|
-
|
|
7495
|
+
U.dispatch(e, "fetchstart", {
|
|
7315
7496
|
url: t,
|
|
7316
7497
|
options: r || {},
|
|
7317
7498
|
payload: i,
|
|
@@ -7328,7 +7509,7 @@ class O {
|
|
|
7328
7509
|
* @param startedAt 開始時刻
|
|
7329
7510
|
*/
|
|
7330
7511
|
static fetchEnd(e, t, r, i) {
|
|
7331
|
-
|
|
7512
|
+
U.dispatch(e, "fetchend", {
|
|
7332
7513
|
url: t,
|
|
7333
7514
|
status: r,
|
|
7334
7515
|
durationMs: performance.now() - i
|
|
@@ -7344,7 +7525,7 @@ class O {
|
|
|
7344
7525
|
* @param startedAt 開始時刻(存在する場合)
|
|
7345
7526
|
*/
|
|
7346
7527
|
static fetchError(e, t, r, i, n) {
|
|
7347
|
-
|
|
7528
|
+
U.dispatch(e, "fetcherror", {
|
|
7348
7529
|
url: t,
|
|
7349
7530
|
status: i,
|
|
7350
7531
|
error: r,
|
|
@@ -7360,7 +7541,7 @@ class O {
|
|
|
7360
7541
|
* @return 戻り値はありません。
|
|
7361
7542
|
*/
|
|
7362
7543
|
static pollTimeout(e, t, r) {
|
|
7363
|
-
|
|
7544
|
+
U.dispatch(e, "polltimeout", { count: t, elapsedMs: r });
|
|
7364
7545
|
}
|
|
7365
7546
|
/**
|
|
7366
7547
|
* pollstopイベントを発火します。
|
|
@@ -7374,7 +7555,7 @@ class O {
|
|
|
7374
7555
|
* @return 戻り値はありません。
|
|
7375
7556
|
*/
|
|
7376
7557
|
static pollStop(e, t, r, i) {
|
|
7377
|
-
|
|
7558
|
+
U.dispatch(e, "pollstop", { reason: t, count: r, elapsedMs: i });
|
|
7378
7559
|
}
|
|
7379
7560
|
}
|
|
7380
7561
|
const Dt = {
|
|
@@ -7397,7 +7578,7 @@ function Nt(m, e) {
|
|
|
7397
7578
|
return null;
|
|
7398
7579
|
if (!t.includes("{{"))
|
|
7399
7580
|
return t;
|
|
7400
|
-
const r =
|
|
7581
|
+
const r = x.get(m), i = r instanceof I ? r.getBindingData() : {}, n = It(t, i);
|
|
7401
7582
|
return n === "" ? null : n;
|
|
7402
7583
|
}
|
|
7403
7584
|
function Ft(m, e, t) {
|
|
@@ -7898,7 +8079,7 @@ const N = class N {
|
|
|
7898
8079
|
).forEach((i) => {
|
|
7899
8080
|
if (!N.RESTORED_ELEMENTS.has(i))
|
|
7900
8081
|
return;
|
|
7901
|
-
const n =
|
|
8082
|
+
const n = x.get(i);
|
|
7902
8083
|
if (!(n instanceof I))
|
|
7903
8084
|
return;
|
|
7904
8085
|
const s = N.readDeclaration(n);
|
|
@@ -7952,7 +8133,7 @@ class ht {
|
|
|
7952
8133
|
}
|
|
7953
8134
|
}
|
|
7954
8135
|
}
|
|
7955
|
-
const
|
|
8136
|
+
const xt = [
|
|
7956
8137
|
"addErrorMessage",
|
|
7957
8138
|
"clearMessages",
|
|
7958
8139
|
"closeDialog",
|
|
@@ -7960,18 +8141,18 @@ const Ct = [
|
|
|
7960
8141
|
"dialog",
|
|
7961
8142
|
"openDialog",
|
|
7962
8143
|
"toast"
|
|
7963
|
-
],
|
|
8144
|
+
], Mt = "__haoriHistoryState__", Pe = "data-haori-click-lock";
|
|
7964
8145
|
function De() {
|
|
7965
8146
|
const e = globalThis.window?.Haori;
|
|
7966
|
-
return
|
|
8147
|
+
return xt.every(
|
|
7967
8148
|
(r) => typeof e?.[r] == "function"
|
|
7968
8149
|
) ? e : ye;
|
|
7969
8150
|
}
|
|
7970
|
-
const
|
|
7971
|
-
function
|
|
7972
|
-
return
|
|
8151
|
+
const Ct = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
8152
|
+
function Oe(m) {
|
|
8153
|
+
return Ct.has(m.toUpperCase());
|
|
7973
8154
|
}
|
|
7974
|
-
function
|
|
8155
|
+
function kt(m, e) {
|
|
7975
8156
|
for (const [t, r] of Object.entries(e))
|
|
7976
8157
|
r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
|
|
7977
8158
|
m.append(t, fe(i));
|
|
@@ -7990,7 +8171,7 @@ function fe(m) {
|
|
|
7990
8171
|
}
|
|
7991
8172
|
function pt(m, e) {
|
|
7992
8173
|
const t = new URL(m, window.location.href), r = new URLSearchParams(t.search);
|
|
7993
|
-
return
|
|
8174
|
+
return kt(r, e), t.search = r.toString(), t.toString();
|
|
7994
8175
|
}
|
|
7995
8176
|
function $t(m) {
|
|
7996
8177
|
if (m == null)
|
|
@@ -8065,7 +8246,7 @@ function Pt(m) {
|
|
|
8065
8246
|
}
|
|
8066
8247
|
function Lt(m, e) {
|
|
8067
8248
|
const t = { ...e || {} }, r = (t.method || "GET").toUpperCase();
|
|
8068
|
-
if (c.runtime !== "demo" ||
|
|
8249
|
+
if (c.runtime !== "demo" || Oe(r))
|
|
8069
8250
|
return {
|
|
8070
8251
|
url: m,
|
|
8071
8252
|
options: t,
|
|
@@ -8093,7 +8274,7 @@ function Lt(m, e) {
|
|
|
8093
8274
|
queryString: new URL(s, window.location.href).search || void 0
|
|
8094
8275
|
};
|
|
8095
8276
|
}
|
|
8096
|
-
function
|
|
8277
|
+
function Ot(m) {
|
|
8097
8278
|
return m == null ? null : typeof m == "string" ? m : m instanceof URLSearchParams ? m.toString() : m instanceof FormData ? Array.from(m.entries()).map(([e, t]) => t instanceof File ? [
|
|
8098
8279
|
e,
|
|
8099
8280
|
{
|
|
@@ -8109,15 +8290,15 @@ function Se(m) {
|
|
|
8109
8290
|
Se
|
|
8110
8291
|
) : !1;
|
|
8111
8292
|
}
|
|
8112
|
-
function
|
|
8293
|
+
function Bt(m) {
|
|
8113
8294
|
return Object.values(m).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
8114
8295
|
(t) => !(t instanceof Blob) && Se(t)
|
|
8115
8296
|
) : Se(e));
|
|
8116
8297
|
}
|
|
8117
8298
|
function Ie(m) {
|
|
8118
|
-
return
|
|
8299
|
+
return Be(F.getValues(m));
|
|
8119
8300
|
}
|
|
8120
|
-
function
|
|
8301
|
+
function Be(m) {
|
|
8121
8302
|
const e = (r) => {
|
|
8122
8303
|
if (r instanceof File)
|
|
8123
8304
|
return r.name;
|
|
@@ -8151,7 +8332,7 @@ function Ut(m, e) {
|
|
|
8151
8332
|
url: m,
|
|
8152
8333
|
method: String(e.method || "GET").toUpperCase(),
|
|
8153
8334
|
headers: r,
|
|
8154
|
-
body:
|
|
8335
|
+
body: Ot(e.body || null)
|
|
8155
8336
|
});
|
|
8156
8337
|
}
|
|
8157
8338
|
const b = class b {
|
|
@@ -8357,8 +8538,8 @@ const b = class b {
|
|
|
8357
8538
|
targetFragment: e
|
|
8358
8539
|
}, i = t ? b.attrName(t, "if") : b.attrName(null, "if", !0);
|
|
8359
8540
|
if (e.hasAttribute(i)) {
|
|
8360
|
-
const
|
|
8361
|
-
typeof
|
|
8541
|
+
const A = e.getRawAttribute(i);
|
|
8542
|
+
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) : y.warn(
|
|
8362
8543
|
"Haori",
|
|
8363
8544
|
`${i} に条件式が指定されていません。`
|
|
8364
8545
|
);
|
|
@@ -8371,12 +8552,12 @@ const b = class b {
|
|
|
8371
8552
|
b.attrName(t, "form")
|
|
8372
8553
|
);
|
|
8373
8554
|
if (S) {
|
|
8374
|
-
const
|
|
8555
|
+
const C = z.query(
|
|
8375
8556
|
S,
|
|
8376
8557
|
b.attrName(t, "form")
|
|
8377
8558
|
);
|
|
8378
|
-
|
|
8379
|
-
|
|
8559
|
+
C !== null ? r.formFragment = F.getFormFragment(
|
|
8560
|
+
x.get(C)
|
|
8380
8561
|
) : y.error(
|
|
8381
8562
|
"Haori",
|
|
8382
8563
|
`Form element not found: ${S} (${b.attrName(t, "form")})`
|
|
@@ -8397,16 +8578,16 @@ const b = class b {
|
|
|
8397
8578
|
${S}
|
|
8398
8579
|
`
|
|
8399
8580
|
);
|
|
8400
|
-
} catch (
|
|
8401
|
-
y.error("Haori", `Invalid before script: ${
|
|
8581
|
+
} catch (C) {
|
|
8582
|
+
y.error("Haori", `Invalid before script: ${C}`);
|
|
8402
8583
|
}
|
|
8403
8584
|
}
|
|
8404
|
-
const
|
|
8405
|
-
if (e.hasAttribute(
|
|
8406
|
-
const S = String(e.getAttribute(
|
|
8407
|
-
let
|
|
8585
|
+
const A = b.attrName(t, "run");
|
|
8586
|
+
if (e.hasAttribute(A)) {
|
|
8587
|
+
const S = String(e.getAttribute(A) ?? "");
|
|
8588
|
+
let C = null;
|
|
8408
8589
|
try {
|
|
8409
|
-
|
|
8590
|
+
C = new Function(
|
|
8410
8591
|
"event",
|
|
8411
8592
|
`"use strict"; return (
|
|
8412
8593
|
${S}
|
|
@@ -8414,70 +8595,70 @@ ${S}
|
|
|
8414
8595
|
);
|
|
8415
8596
|
} catch {
|
|
8416
8597
|
try {
|
|
8417
|
-
|
|
8598
|
+
C = new Function("event", `"use strict";
|
|
8418
8599
|
${S}
|
|
8419
8600
|
`);
|
|
8420
8601
|
} catch (V) {
|
|
8421
8602
|
y.error("Haori", `Invalid run script: ${V}`);
|
|
8422
8603
|
}
|
|
8423
8604
|
}
|
|
8424
|
-
|
|
8605
|
+
C && (r.runScript = C);
|
|
8425
8606
|
}
|
|
8426
8607
|
}
|
|
8427
8608
|
const n = b.attrName(t, "fetch"), s = e.hasAttribute(n);
|
|
8428
8609
|
if (s) {
|
|
8429
|
-
const
|
|
8430
|
-
|
|
8610
|
+
const A = e.getAttributeEvaluation(n);
|
|
8611
|
+
A && (r.fetchHasUnresolvedReference = A.hasUnresolvedReference, r.fetchUrl = A.hasUnresolvedReference ? null : A.value);
|
|
8431
8612
|
}
|
|
8432
8613
|
const a = {};
|
|
8433
8614
|
if (t) {
|
|
8434
|
-
const
|
|
8435
|
-
if (e.hasAttribute(
|
|
8436
|
-
const S = e.getAttributeEvaluation(
|
|
8615
|
+
const A = b.attrName(t, "fetch-method");
|
|
8616
|
+
if (e.hasAttribute(A)) {
|
|
8617
|
+
const S = e.getAttributeEvaluation(A);
|
|
8437
8618
|
S?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = S?.value;
|
|
8438
8619
|
}
|
|
8439
8620
|
} else {
|
|
8440
|
-
const
|
|
8441
|
-
if (e.hasAttribute(
|
|
8621
|
+
const A = b.attrName(null, "method", !0);
|
|
8622
|
+
if (e.hasAttribute(A)) {
|
|
8442
8623
|
const S = e.getAttributeEvaluation(
|
|
8443
|
-
|
|
8624
|
+
A
|
|
8444
8625
|
);
|
|
8445
8626
|
S?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = S?.value;
|
|
8446
8627
|
}
|
|
8447
8628
|
}
|
|
8448
8629
|
if (t) {
|
|
8449
|
-
const
|
|
8450
|
-
if (e.hasAttribute(
|
|
8630
|
+
const A = b.attrName(t, "fetch-headers");
|
|
8631
|
+
if (e.hasAttribute(A)) {
|
|
8451
8632
|
const S = e.getRawAttribute(
|
|
8452
|
-
|
|
8633
|
+
A
|
|
8453
8634
|
);
|
|
8454
8635
|
try {
|
|
8455
8636
|
a.headers = B.parseDataBind(S);
|
|
8456
|
-
} catch (
|
|
8457
|
-
y.error("Haori", `Invalid fetch headers: ${
|
|
8637
|
+
} catch (C) {
|
|
8638
|
+
y.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8458
8639
|
}
|
|
8459
8640
|
}
|
|
8460
8641
|
} else {
|
|
8461
|
-
const
|
|
8642
|
+
const A = b.attrName(
|
|
8462
8643
|
null,
|
|
8463
8644
|
"headers",
|
|
8464
8645
|
!0
|
|
8465
8646
|
);
|
|
8466
|
-
if (e.hasAttribute(
|
|
8647
|
+
if (e.hasAttribute(A)) {
|
|
8467
8648
|
const S = e.getRawAttribute(
|
|
8468
|
-
|
|
8649
|
+
A
|
|
8469
8650
|
);
|
|
8470
8651
|
try {
|
|
8471
8652
|
a.headers = B.parseDataBind(S);
|
|
8472
|
-
} catch (
|
|
8473
|
-
y.error("Haori", `Invalid fetch headers: ${
|
|
8653
|
+
} catch (C) {
|
|
8654
|
+
y.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8474
8655
|
}
|
|
8475
8656
|
}
|
|
8476
8657
|
}
|
|
8477
8658
|
if (t) {
|
|
8478
|
-
const
|
|
8479
|
-
if (e.hasAttribute(
|
|
8480
|
-
const S = e.getAttributeEvaluation(
|
|
8659
|
+
const A = b.attrName(t, "fetch-content-type");
|
|
8660
|
+
if (e.hasAttribute(A)) {
|
|
8661
|
+
const S = e.getAttributeEvaluation(A);
|
|
8481
8662
|
S?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), a.headers = {
|
|
8482
8663
|
...a.headers,
|
|
8483
8664
|
"Content-Type": S?.value
|
|
@@ -8493,13 +8674,13 @@ ${S}
|
|
|
8493
8674
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
8494
8675
|
});
|
|
8495
8676
|
} else {
|
|
8496
|
-
const
|
|
8677
|
+
const A = b.attrName(
|
|
8497
8678
|
null,
|
|
8498
8679
|
"content-type",
|
|
8499
8680
|
!0
|
|
8500
8681
|
);
|
|
8501
|
-
if (e.hasAttribute(
|
|
8502
|
-
const S = e.getAttributeEvaluation(
|
|
8682
|
+
if (e.hasAttribute(A)) {
|
|
8683
|
+
const S = e.getAttributeEvaluation(A);
|
|
8503
8684
|
S?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), a.headers = {
|
|
8504
8685
|
...a.headers,
|
|
8505
8686
|
"Content-Type": S?.value
|
|
@@ -8518,15 +8699,15 @@ ${S}
|
|
|
8518
8699
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
8519
8700
|
const o = t ? b.attrName(t, "bind") : b.attrName(null, "bind", !0);
|
|
8520
8701
|
if (e.hasAttribute(o)) {
|
|
8521
|
-
const
|
|
8522
|
-
if (
|
|
8523
|
-
const S = z.queryAll(
|
|
8524
|
-
S.length > 0 ? (r.bindFragments = [], S.forEach((
|
|
8525
|
-
const V =
|
|
8702
|
+
const A = z.read(e, o);
|
|
8703
|
+
if (A) {
|
|
8704
|
+
const S = z.queryAll(A, o);
|
|
8705
|
+
S.length > 0 ? (r.bindFragments = [], S.forEach((C) => {
|
|
8706
|
+
const V = x.get(C);
|
|
8526
8707
|
V && r.bindFragments.push(V);
|
|
8527
8708
|
})) : y.error(
|
|
8528
8709
|
"Haori",
|
|
8529
|
-
`Bind element not found: ${
|
|
8710
|
+
`Bind element not found: ${A} (${o})`
|
|
8530
8711
|
);
|
|
8531
8712
|
}
|
|
8532
8713
|
}
|
|
@@ -8536,40 +8717,40 @@ ${S}
|
|
|
8536
8717
|
) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
|
|
8537
8718
|
const p = t ? b.attrName(t, "bind-params") : b.attrName(null, "bind-params", !0);
|
|
8538
8719
|
if (e.hasAttribute(p)) {
|
|
8539
|
-
const
|
|
8540
|
-
r.bindParams =
|
|
8720
|
+
const A = e.getRawAttribute(p);
|
|
8721
|
+
r.bindParams = A.split("&").map((S) => S.trim());
|
|
8541
8722
|
}
|
|
8542
8723
|
const g = t ? b.attrName(t, "bind-append") : b.attrName(null, "bind-append", !0);
|
|
8543
8724
|
if (e.hasAttribute(g)) {
|
|
8544
|
-
const
|
|
8545
|
-
r.bindAppendParams =
|
|
8725
|
+
const A = e.getRawAttribute(g);
|
|
8726
|
+
r.bindAppendParams = A.split("&").map((S) => S.trim()).filter(Boolean);
|
|
8546
8727
|
}
|
|
8547
|
-
const
|
|
8548
|
-
e.hasAttribute(
|
|
8728
|
+
const E = t ? b.attrName(t, "bind-merge") : b.attrName(null, "bind-merge", !0);
|
|
8729
|
+
e.hasAttribute(E) && (r.bindMerge = !0);
|
|
8549
8730
|
const v = t ? b.attrName(t, "bind-transform") : b.attrName(null, "bind-transform", !0);
|
|
8550
8731
|
e.hasAttribute(v) && (r.bindTransform = e.getRawAttribute(v));
|
|
8551
8732
|
const D = t ? b.attrName(t, "copy-params") : null;
|
|
8552
8733
|
if (D && e.hasAttribute(D)) {
|
|
8553
|
-
const
|
|
8554
|
-
r.copyParams =
|
|
8734
|
+
const A = e.getRawAttribute(D);
|
|
8735
|
+
r.copyParams = A.split("&").map((S) => S.trim()).filter(Boolean);
|
|
8555
8736
|
}
|
|
8556
8737
|
if (t) {
|
|
8557
8738
|
if (e.hasAttribute(b.attrName(t, "adjust"))) {
|
|
8558
|
-
const
|
|
8739
|
+
const k = z.read(
|
|
8559
8740
|
e,
|
|
8560
8741
|
b.attrName(t, "adjust")
|
|
8561
8742
|
);
|
|
8562
|
-
if (
|
|
8743
|
+
if (k) {
|
|
8563
8744
|
const q = z.queryAll(
|
|
8564
|
-
|
|
8745
|
+
k,
|
|
8565
8746
|
b.attrName(t, "adjust")
|
|
8566
8747
|
);
|
|
8567
8748
|
q.length > 0 ? (r.adjustFragments = [], q.forEach((X) => {
|
|
8568
|
-
const Y =
|
|
8749
|
+
const Y = x.get(X);
|
|
8569
8750
|
Y && r.adjustFragments.push(Y);
|
|
8570
8751
|
})) : y.error(
|
|
8571
8752
|
"Haori",
|
|
8572
|
-
`Adjust element not found: ${
|
|
8753
|
+
`Adjust element not found: ${k} (${b.attrName(t, "adjust")})`
|
|
8573
8754
|
);
|
|
8574
8755
|
}
|
|
8575
8756
|
if (e.hasAttribute(b.attrName(t, "adjust-value"))) {
|
|
@@ -8580,7 +8761,7 @@ ${S}
|
|
|
8580
8761
|
}
|
|
8581
8762
|
}
|
|
8582
8763
|
if (e.hasAttribute(b.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(b.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(b.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(b.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${c.prefix}${t}-after-run`)) {
|
|
8583
|
-
const
|
|
8764
|
+
const k = e.getRawAttribute(
|
|
8584
8765
|
`${c.prefix}${t}-after-run`
|
|
8585
8766
|
);
|
|
8586
8767
|
try {
|
|
@@ -8588,7 +8769,7 @@ ${S}
|
|
|
8588
8769
|
"response",
|
|
8589
8770
|
`
|
|
8590
8771
|
"use strict";
|
|
8591
|
-
${
|
|
8772
|
+
${k}
|
|
8592
8773
|
`
|
|
8593
8774
|
);
|
|
8594
8775
|
} catch (q) {
|
|
@@ -8609,32 +8790,32 @@ ${x}
|
|
|
8609
8790
|
"toast",
|
|
8610
8791
|
b.attrName(t, "toast")
|
|
8611
8792
|
);
|
|
8612
|
-
const
|
|
8793
|
+
const k = e.getRawAttribute(
|
|
8613
8794
|
b.attrName(t, "toast-level")
|
|
8614
|
-
), X = ["info", "warning", "error", "success"].includes(
|
|
8615
|
-
r.toastLevel = X ?
|
|
8795
|
+
), X = ["info", "warning", "error", "success"].includes(k);
|
|
8796
|
+
r.toastLevel = X ? k : null;
|
|
8616
8797
|
}
|
|
8617
|
-
const
|
|
8618
|
-
if (
|
|
8798
|
+
const A = b.attrName(t, "redirect"), S = b.attrName(t, "redirect-replace"), C = e.hasAttribute(A), V = e.hasAttribute(S);
|
|
8799
|
+
if (C && (r.redirectUrl = b.readLateAttribute(
|
|
8619
8800
|
e,
|
|
8620
8801
|
r,
|
|
8621
8802
|
"redirect",
|
|
8622
|
-
|
|
8803
|
+
A
|
|
8623
8804
|
)), V && (r.redirectReplaceUrl = b.readLateAttribute(
|
|
8624
8805
|
e,
|
|
8625
8806
|
r,
|
|
8626
8807
|
"redirect-replace",
|
|
8627
8808
|
S
|
|
8628
|
-
)),
|
|
8629
|
-
const
|
|
8809
|
+
)), C || V) {
|
|
8810
|
+
const k = b.attrName(
|
|
8630
8811
|
t,
|
|
8631
8812
|
"redirect-return-param"
|
|
8632
8813
|
);
|
|
8633
|
-
e.hasAttribute(
|
|
8814
|
+
e.hasAttribute(k) && (r.redirectReturnParam = b.readLateAttribute(
|
|
8634
8815
|
e,
|
|
8635
8816
|
r,
|
|
8636
8817
|
"redirect-return-param",
|
|
8637
|
-
|
|
8818
|
+
k
|
|
8638
8819
|
));
|
|
8639
8820
|
}
|
|
8640
8821
|
if (e.hasAttribute(b.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(b.attrName(t, "scroll")) && (r.scrollTarget = b.readLateAttribute(
|
|
@@ -8648,20 +8829,20 @@ ${x}
|
|
|
8648
8829
|
"history",
|
|
8649
8830
|
b.attrName(t, "history")
|
|
8650
8831
|
)), e.hasAttribute(b.attrName(t, "history-data")) && (r.historyDataAttrName = b.attrName(t, "history-data")), e.hasAttribute(b.attrName(t, "history-form"))) {
|
|
8651
|
-
const
|
|
8832
|
+
const k = z.read(
|
|
8652
8833
|
e,
|
|
8653
8834
|
b.attrName(t, "history-form")
|
|
8654
8835
|
);
|
|
8655
|
-
if (
|
|
8836
|
+
if (k) {
|
|
8656
8837
|
const q = z.query(
|
|
8657
|
-
|
|
8838
|
+
k,
|
|
8658
8839
|
b.attrName(t, "history-form")
|
|
8659
8840
|
);
|
|
8660
8841
|
q !== null ? r.historyFormFragment = F.getFormFragment(
|
|
8661
|
-
|
|
8842
|
+
x.get(q)
|
|
8662
8843
|
) : y.error(
|
|
8663
8844
|
"Haori",
|
|
8664
|
-
`Form element not found: ${
|
|
8845
|
+
`Form element not found: ${k} (${b.attrName(t, "history-form")})`
|
|
8665
8846
|
);
|
|
8666
8847
|
} else
|
|
8667
8848
|
r.historyFormFragment = F.getFormFragment(e);
|
|
@@ -8674,23 +8855,23 @@ ${x}
|
|
|
8674
8855
|
"copy",
|
|
8675
8856
|
"open",
|
|
8676
8857
|
"close"
|
|
8677
|
-
].forEach((
|
|
8678
|
-
const q = b.attrName(t,
|
|
8858
|
+
].forEach((k) => {
|
|
8859
|
+
const q = b.attrName(t, k);
|
|
8679
8860
|
if (!e.hasAttribute(q))
|
|
8680
8861
|
return;
|
|
8681
8862
|
const X = z.read(e, q), Y = [];
|
|
8682
8863
|
if (X)
|
|
8683
8864
|
z.queryAll(X, q).forEach((be) => {
|
|
8684
|
-
const ue =
|
|
8865
|
+
const ue = x.get(be);
|
|
8685
8866
|
ue && Y.push(ue);
|
|
8686
8867
|
}), Y.length === 0 && y.error("Haori", `Element not found: ${X} (${q})`);
|
|
8687
|
-
else if (
|
|
8868
|
+
else if (k === "open" || k === "close") {
|
|
8688
8869
|
const te = e.getTarget().closest("dialog");
|
|
8689
|
-
te ? Y.push(
|
|
8870
|
+
te ? Y.push(x.get(te)) : y.error("Haori", `Ancestor <dialog> not found (${q})`);
|
|
8690
8871
|
} else
|
|
8691
8872
|
Y.push(e);
|
|
8692
8873
|
if (Y.length > 0)
|
|
8693
|
-
switch (
|
|
8874
|
+
switch (k) {
|
|
8694
8875
|
case "reset-before":
|
|
8695
8876
|
r.resetBeforeFragments = Y;
|
|
8696
8877
|
break;
|
|
@@ -8716,57 +8897,57 @@ ${x}
|
|
|
8716
8897
|
});
|
|
8717
8898
|
const _ = b.attrName(t, "copy-source");
|
|
8718
8899
|
if (e.hasAttribute(_)) {
|
|
8719
|
-
const
|
|
8720
|
-
if (
|
|
8721
|
-
const q = z.query(
|
|
8900
|
+
const k = z.read(e, _);
|
|
8901
|
+
if (k) {
|
|
8902
|
+
const q = z.query(k, _);
|
|
8722
8903
|
if (q !== null) {
|
|
8723
|
-
const X =
|
|
8904
|
+
const X = x.get(q);
|
|
8724
8905
|
X ? r.copySourceFragment = X : y.error(
|
|
8725
8906
|
"Haori",
|
|
8726
|
-
`Element is not managed by Haori: ${
|
|
8907
|
+
`Element is not managed by Haori: ${k} (${_})`
|
|
8727
8908
|
);
|
|
8728
8909
|
} else
|
|
8729
8910
|
y.error(
|
|
8730
8911
|
"Haori",
|
|
8731
|
-
`Element not found: ${
|
|
8912
|
+
`Element not found: ${k} (${_})`
|
|
8732
8913
|
);
|
|
8733
8914
|
} else
|
|
8734
8915
|
r.copySourceFragment = e;
|
|
8735
8916
|
}
|
|
8736
8917
|
}
|
|
8737
8918
|
if (!t && (e.hasAttribute(b.attrName(null, "data", !0)) && (r.dataAttrName = b.attrName(null, "data", !0)), e.hasAttribute(b.attrName(null, "form", !0)))) {
|
|
8738
|
-
const
|
|
8919
|
+
const A = z.read(
|
|
8739
8920
|
e,
|
|
8740
8921
|
b.attrName(null, "form", !0)
|
|
8741
8922
|
);
|
|
8742
|
-
if (
|
|
8923
|
+
if (A) {
|
|
8743
8924
|
const S = z.query(
|
|
8744
|
-
|
|
8925
|
+
A,
|
|
8745
8926
|
b.attrName(null, "form", !0)
|
|
8746
8927
|
);
|
|
8747
8928
|
S !== null ? r.formFragment = F.getFormFragment(
|
|
8748
|
-
|
|
8929
|
+
x.get(S)
|
|
8749
8930
|
) : y.error(
|
|
8750
8931
|
"Haori",
|
|
8751
|
-
`Form element not found: ${
|
|
8932
|
+
`Form element not found: ${A} (${b.attrName(null, "fetch-form", !0)})`
|
|
8752
8933
|
);
|
|
8753
8934
|
} else
|
|
8754
8935
|
r.formFragment = F.getFormFragment(e);
|
|
8755
8936
|
}
|
|
8756
|
-
const
|
|
8757
|
-
if (e.hasAttribute(
|
|
8758
|
-
const
|
|
8759
|
-
|
|
8760
|
-
const
|
|
8761
|
-
|
|
8937
|
+
const M = t ? b.attrName(t, "fetch-state") : b.attrName(null, "state", !0);
|
|
8938
|
+
if (e.hasAttribute(M)) {
|
|
8939
|
+
const A = z.read(e, M), S = [];
|
|
8940
|
+
A ? (z.queryAll(A, M).forEach((V) => {
|
|
8941
|
+
const L = x.get(V);
|
|
8942
|
+
L && S.push(L);
|
|
8762
8943
|
}), S.length === 0 && y.error(
|
|
8763
8944
|
"Haori",
|
|
8764
|
-
`Element not found: ${
|
|
8945
|
+
`Element not found: ${A} (${M})`
|
|
8765
8946
|
)) : S.push(e), S.length > 0 && (r.fetchStateFragments = S);
|
|
8766
8947
|
}
|
|
8767
8948
|
const H = t ? b.attrName(t, "store-clear") : b.attrName(null, "store-clear", !0);
|
|
8768
8949
|
if (e.hasAttribute(H)) {
|
|
8769
|
-
const
|
|
8950
|
+
const A = e.getRawAttribute(H), S = A === null ? "" : A.trim();
|
|
8770
8951
|
if (S === "")
|
|
8771
8952
|
y.error(
|
|
8772
8953
|
"Haori",
|
|
@@ -8774,9 +8955,9 @@ ${x}
|
|
|
8774
8955
|
);
|
|
8775
8956
|
else {
|
|
8776
8957
|
r.storeClearKey = S;
|
|
8777
|
-
const
|
|
8958
|
+
const C = e.getRawAttribute(
|
|
8778
8959
|
`${H}-type`
|
|
8779
|
-
), V =
|
|
8960
|
+
), V = C === null ? "session" : C.trim();
|
|
8780
8961
|
V === "local" || V === "session" ? r.storeClearKind = V : (y.warn(
|
|
8781
8962
|
"Haori",
|
|
8782
8963
|
`${H}-type は session または local を指定してください(session として扱います): ${V}`
|
|
@@ -8920,80 +9101,80 @@ ${x}
|
|
|
8920
9101
|
}
|
|
8921
9102
|
const l = Object.keys(i).length > 0;
|
|
8922
9103
|
if (n) {
|
|
8923
|
-
const p = (s?.method || "GET").toUpperCase(),
|
|
8924
|
-
|
|
9104
|
+
const p = (s?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && Pt(s) && !Oe(p) ? r.baseUrl ?? n : n, v = Lt(
|
|
9105
|
+
E,
|
|
8925
9106
|
s
|
|
8926
9107
|
);
|
|
8927
9108
|
n = v.url;
|
|
8928
|
-
const D = { ...v.options },
|
|
8929
|
-
if (
|
|
9109
|
+
const D = { ...v.options }, M = v.normalized ? v.requestedMethod : r.requestedMethod, H = v.effectiveMethod, A = r.transportMode === "query-get" || v.normalized, S = v.queryString ?? r.queryString;
|
|
9110
|
+
if (A && y.info("Haori demo fetch normalization", {
|
|
8930
9111
|
runtime: c.runtime,
|
|
8931
|
-
requestedMethod:
|
|
9112
|
+
requestedMethod: M,
|
|
8932
9113
|
effectiveMethod: H,
|
|
8933
9114
|
transportMode: "query-get",
|
|
8934
9115
|
url: n,
|
|
8935
9116
|
payload: l ? i : void 0,
|
|
8936
9117
|
queryString: S
|
|
8937
9118
|
}), this.options.targetFragment && n) {
|
|
8938
|
-
const
|
|
9119
|
+
const C = performance.now(), V = {
|
|
8939
9120
|
runtime: c.runtime,
|
|
8940
|
-
requestedMethod:
|
|
9121
|
+
requestedMethod: M,
|
|
8941
9122
|
effectiveMethod: H,
|
|
8942
|
-
transportMode:
|
|
8943
|
-
...
|
|
9123
|
+
transportMode: A ? "query-get" : "http",
|
|
9124
|
+
...A ? { queryString: S } : {}
|
|
8944
9125
|
};
|
|
8945
|
-
return
|
|
9126
|
+
return U.fetchStart(
|
|
8946
9127
|
this.options.targetFragment.getTarget(),
|
|
8947
9128
|
n,
|
|
8948
9129
|
D,
|
|
8949
9130
|
l ? i : void 0,
|
|
8950
9131
|
V
|
|
8951
|
-
), await this.injectFetchState("loading"), await fetch(n, D).then((
|
|
8952
|
-
|
|
9132
|
+
), await this.injectFetchState("loading"), await fetch(n, D).then((L) => this.handleFetchResult(
|
|
9133
|
+
L,
|
|
8953
9134
|
n || void 0,
|
|
8954
|
-
|
|
8955
|
-
)).catch(async (
|
|
8956
|
-
throw n &&
|
|
9135
|
+
C
|
|
9136
|
+
)).catch(async (L) => {
|
|
9137
|
+
throw n && U.fetchError(
|
|
8957
9138
|
this.options.targetFragment.getTarget(),
|
|
8958
9139
|
n,
|
|
8959
|
-
|
|
9140
|
+
L
|
|
8960
9141
|
), await this.injectFetchState(
|
|
8961
9142
|
"error",
|
|
8962
9143
|
null,
|
|
8963
|
-
|
|
8964
|
-
),
|
|
9144
|
+
L instanceof Error ? L.message : String(L)
|
|
9145
|
+
), L;
|
|
8965
9146
|
});
|
|
8966
9147
|
}
|
|
8967
|
-
return await fetch(n, D).then((
|
|
9148
|
+
return await fetch(n, D).then((C) => this.handleFetchResult(C, n || void 0));
|
|
8968
9149
|
}
|
|
8969
9150
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && l) {
|
|
8970
|
-
const p = this.options.formFragment, g = p.getTarget(),
|
|
8971
|
-
e && e.appliedDisabledAttribute && this.options.targetFragment &&
|
|
8972
|
-
const v = p.getRawBindingData(), D =
|
|
9151
|
+
const p = this.options.formFragment, g = p.getTarget(), E = /* @__PURE__ */ new Set();
|
|
9152
|
+
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
9153
|
+
const v = p.getRawBindingData(), D = Be(i), M = p.getAttribute(`${c.prefix}form-arg`);
|
|
8973
9154
|
let H;
|
|
8974
|
-
if (
|
|
9155
|
+
if (M) {
|
|
8975
9156
|
H = { ...v ?? {} };
|
|
8976
|
-
const
|
|
8977
|
-
H[
|
|
8978
|
-
(S ? S.value : H[
|
|
9157
|
+
const A = String(M), S = F.resolveAncestorArgOwner(p, A);
|
|
9158
|
+
H[A] = F.mergeCollectedValues(
|
|
9159
|
+
(S ? S.value : H[A]) ?? null,
|
|
8979
9160
|
D
|
|
8980
9161
|
);
|
|
8981
9162
|
} else
|
|
8982
9163
|
H = F.mergeCollectedValues(v, D);
|
|
8983
9164
|
await B.setBindingData(g, H, {
|
|
8984
|
-
skipFragments:
|
|
9165
|
+
skipFragments: E,
|
|
8985
9166
|
kind: "nonSupply",
|
|
8986
9167
|
sequence: this.operationSequence,
|
|
8987
9168
|
editedPaths: F.collectEditedPaths(
|
|
8988
9169
|
p,
|
|
8989
9170
|
this.operationSequence,
|
|
8990
|
-
|
|
9171
|
+
M ? String(M) : "",
|
|
8991
9172
|
D
|
|
8992
9173
|
)
|
|
8993
9174
|
});
|
|
8994
9175
|
}
|
|
8995
9176
|
this.suppressEmptyReplaceBind = !l && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input"), this.twoWayCommitBind = this.eventType === "change" || this.eventType === "input";
|
|
8996
|
-
const u = l ?
|
|
9177
|
+
const u = l ? Be(i) : {}, d = new Response(JSON.stringify(u), {
|
|
8997
9178
|
headers: { "Content-Type": "application/json" }
|
|
8998
9179
|
});
|
|
8999
9180
|
return await this.handleFetchResult(d);
|
|
@@ -9033,7 +9214,7 @@ ${x}
|
|
|
9033
9214
|
async handleFetchResult(e, t, r) {
|
|
9034
9215
|
const i = De();
|
|
9035
9216
|
if (!e.ok)
|
|
9036
|
-
return ft(e.status) || (this.options.targetFragment && t &&
|
|
9217
|
+
return ft(e.status) || (this.options.targetFragment && t && U.fetchError(
|
|
9037
9218
|
this.options.targetFragment.getTarget(),
|
|
9038
9219
|
t,
|
|
9039
9220
|
new Error(`${e.status} ${e.statusText}`),
|
|
@@ -9044,7 +9225,7 @@ ${x}
|
|
|
9044
9225
|
e.status,
|
|
9045
9226
|
e.statusText || null
|
|
9046
9227
|
)), !1;
|
|
9047
|
-
if (this.options.targetFragment && t && r &&
|
|
9228
|
+
if (this.options.targetFragment && t && r && U.fetchEnd(
|
|
9048
9229
|
this.options.targetFragment.getTarget(),
|
|
9049
9230
|
t,
|
|
9050
9231
|
e.status,
|
|
@@ -9069,17 +9250,17 @@ ${x}
|
|
|
9069
9250
|
}), this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
9070
9251
|
for (const g of this.options.clickFragments) {
|
|
9071
9252
|
await B.evaluateAll(g);
|
|
9072
|
-
const
|
|
9073
|
-
typeof
|
|
9253
|
+
const E = g.getTarget();
|
|
9254
|
+
typeof E.click == "function" ? E.click() : E.dispatchEvent(
|
|
9074
9255
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
9075
9256
|
);
|
|
9076
9257
|
}
|
|
9077
9258
|
this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((g) => {
|
|
9078
|
-
const
|
|
9079
|
-
|
|
9259
|
+
const E = g.getTarget();
|
|
9260
|
+
E instanceof HTMLElement ? s.push(i.openDialog(E)) : y.error("Haori", "Element is not an HTML element: ", E);
|
|
9080
9261
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((g) => {
|
|
9081
|
-
const
|
|
9082
|
-
|
|
9262
|
+
const E = g.getTarget();
|
|
9263
|
+
E instanceof HTMLElement ? s.push(i.closeDialog(E)) : y.error("Haori", "Element is not an HTML element: ", E);
|
|
9083
9264
|
}), await Promise.all(s);
|
|
9084
9265
|
const a = b.unescapeNewlines(
|
|
9085
9266
|
this.resolveLateAttribute("dialog", this.options.dialogMessage)
|
|
@@ -9113,15 +9294,15 @@ ${x}
|
|
|
9113
9294
|
const p = d || u;
|
|
9114
9295
|
if (p) {
|
|
9115
9296
|
let g = p;
|
|
9116
|
-
const
|
|
9297
|
+
const E = this.resolveLateAttribute(
|
|
9117
9298
|
"redirect-return-param",
|
|
9118
9299
|
this.options.redirectReturnParam
|
|
9119
9300
|
);
|
|
9120
|
-
if (
|
|
9121
|
-
const D = new URLSearchParams(window.location.search).get(
|
|
9301
|
+
if (E) {
|
|
9302
|
+
const D = new URLSearchParams(window.location.search).get(E);
|
|
9122
9303
|
if (D !== null) {
|
|
9123
|
-
const
|
|
9124
|
-
ht.isSafeLocalPath(
|
|
9304
|
+
const M = D.trim();
|
|
9305
|
+
ht.isSafeLocalPath(M) ? g = M : y.warn(
|
|
9125
9306
|
"Haori",
|
|
9126
9307
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${D}`
|
|
9127
9308
|
);
|
|
@@ -9188,7 +9369,7 @@ ${x}
|
|
|
9188
9369
|
p != null && (Array.isArray(p) ? p.forEach((g) => o.searchParams.append(d, String(g))) : typeof p == "object" ? o.searchParams.set(d, JSON.stringify(p)) : o.searchParams.set(d, String(p)));
|
|
9189
9370
|
};
|
|
9190
9371
|
n && l(r), s && l(i), history.pushState(
|
|
9191
|
-
{ [
|
|
9372
|
+
{ [Mt]: !0 },
|
|
9192
9373
|
"",
|
|
9193
9374
|
o.toString()
|
|
9194
9375
|
);
|
|
@@ -9220,12 +9401,12 @@ ${x}
|
|
|
9220
9401
|
const l = /* @__PURE__ */ new Map(), u = [];
|
|
9221
9402
|
for (const d of a)
|
|
9222
9403
|
if (d && typeof d == "object" && !Array.isArray(d)) {
|
|
9223
|
-
const p = d.key, g = d.message,
|
|
9404
|
+
const p = d.key, g = d.message, E = typeof p == "string" && p.length > 0 ? p : null, v = typeof g == "string" ? g : g != null ? String(g) : "";
|
|
9224
9405
|
if (v.length === 0)
|
|
9225
9406
|
continue;
|
|
9226
|
-
if (
|
|
9227
|
-
const D = l.get(
|
|
9228
|
-
D.push(v), l.set(
|
|
9407
|
+
if (E !== null) {
|
|
9408
|
+
const D = l.get(E) ?? [];
|
|
9409
|
+
D.push(v), l.set(E, D);
|
|
9229
9410
|
} else
|
|
9230
9411
|
u.push(v);
|
|
9231
9412
|
} else typeof d == "string" && d.length > 0 && u.push(d);
|
|
@@ -9464,13 +9645,13 @@ ${x}
|
|
|
9464
9645
|
attributeName: s,
|
|
9465
9646
|
syncWhenUnchanged: "reflect",
|
|
9466
9647
|
apply: (g) => {
|
|
9467
|
-
const
|
|
9648
|
+
const E = this.resolveCurrentRowItem(o, g), v = { ...E };
|
|
9468
9649
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
9469
|
-
const D =
|
|
9650
|
+
const D = E[p], M = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
|
|
9470
9651
|
v[p] = this.mergeAppendBindingData(
|
|
9471
9652
|
o,
|
|
9472
9653
|
i,
|
|
9473
|
-
|
|
9654
|
+
M
|
|
9474
9655
|
);
|
|
9475
9656
|
} else
|
|
9476
9657
|
v[p] = i;
|
|
@@ -9533,11 +9714,11 @@ ${x}
|
|
|
9533
9714
|
attributeName: s,
|
|
9534
9715
|
syncWhenUnchanged: "reflect",
|
|
9535
9716
|
apply: (p) => {
|
|
9536
|
-
const g = this.options.bindMerge ? this.resolveCurrentRowItem(o, p) : p,
|
|
9717
|
+
const g = this.options.bindMerge ? this.resolveCurrentRowItem(o, p) : p, E = this.mergeAppendBindingData(
|
|
9537
9718
|
o,
|
|
9538
9719
|
i,
|
|
9539
9720
|
g
|
|
9540
|
-
), v = this.options.bindMerge ? { ...g, ...
|
|
9721
|
+
), v = this.options.bindMerge ? { ...g, ...E } : E;
|
|
9541
9722
|
return this.reconcileRowUserEdits(o, v);
|
|
9542
9723
|
}
|
|
9543
9724
|
});
|
|
@@ -9563,7 +9744,7 @@ ${x}
|
|
|
9563
9744
|
return n.push(this.applyRowWrites(a)), Promise.all(n).then(() => {
|
|
9564
9745
|
const o = this.options.bindArg ?? null;
|
|
9565
9746
|
this.options.bindFragments.forEach((l) => {
|
|
9566
|
-
|
|
9747
|
+
U.bindComplete(l.getTarget(), o);
|
|
9567
9748
|
});
|
|
9568
9749
|
});
|
|
9569
9750
|
});
|
|
@@ -9841,10 +10022,10 @@ ${x}
|
|
|
9841
10022
|
let i = this.options.fetchUrl;
|
|
9842
10023
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
9843
10024
|
n.headers || void 0
|
|
9844
|
-
), a = (n.method || "GET").toUpperCase(), o = c.runtime === "demo" && !
|
|
10025
|
+
), a = (n.method || "GET").toUpperCase(), o = c.runtime === "demo" && !Oe(a), l = o ? "GET" : a;
|
|
9845
10026
|
if (n.method = l, Object.keys(t).length > 0 && Se(t)) {
|
|
9846
10027
|
const d = s.get("Content-Type") || "";
|
|
9847
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ?
|
|
10028
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Bt(t) && y.warn(
|
|
9848
10029
|
"Haori",
|
|
9849
10030
|
`A File value nested under ${c.prefix}form-object / ${c.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
9850
10031
|
) : y.warn(
|
|
@@ -9859,15 +10040,15 @@ ${x}
|
|
|
9859
10040
|
if (/multipart\/form-data/i.test(d)) {
|
|
9860
10041
|
s.delete("Content-Type");
|
|
9861
10042
|
const p = new FormData();
|
|
9862
|
-
for (const [g,
|
|
9863
|
-
|
|
10043
|
+
for (const [g, E] of Object.entries(t))
|
|
10044
|
+
E == null ? p.append(g, "") : E instanceof Blob ? p.append(g, E) : Array.isArray(E) ? E.forEach((v) => {
|
|
9864
10045
|
v instanceof Blob ? p.append(g, v) : p.append(g, fe(v));
|
|
9865
|
-
}) : p.append(g, fe(
|
|
10046
|
+
}) : p.append(g, fe(E));
|
|
9866
10047
|
n.body = p;
|
|
9867
10048
|
} else if (/application\/x-www-form-urlencoded/i.test(d)) {
|
|
9868
10049
|
const p = new URLSearchParams();
|
|
9869
|
-
for (const [g,
|
|
9870
|
-
|
|
10050
|
+
for (const [g, E] of Object.entries(t))
|
|
10051
|
+
E !== void 0 && (Array.isArray(E) ? E.forEach((v) => p.append(g, fe(v))) : p.append(g, fe(E)));
|
|
9871
10052
|
n.body = p;
|
|
9872
10053
|
} else
|
|
9873
10054
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
@@ -9993,7 +10174,7 @@ ${x}
|
|
|
9993
10174
|
"Haori",
|
|
9994
10175
|
`Row container not found: ${i} (${r})`
|
|
9995
10176
|
), null;
|
|
9996
|
-
const a =
|
|
10177
|
+
const a = x.get(s);
|
|
9997
10178
|
return a instanceof I ? a.hasAttribute(`${c.prefix}each`) ? a : (y.error(
|
|
9998
10179
|
"Haori",
|
|
9999
10180
|
`Row container must have ${c.prefix}each: ${i} (${r})`
|
|
@@ -10006,50 +10187,57 @@ ${x}
|
|
|
10006
10187
|
return n ? n.getParent() : null;
|
|
10007
10188
|
}
|
|
10008
10189
|
/**
|
|
10009
|
-
*
|
|
10190
|
+
* 行操作の書き戻し先となる配列と、その所有者を解決します。
|
|
10010
10191
|
*
|
|
10011
10192
|
* `data-each` の式を単純な識別子パス(`contracts` / `form.contracts` など)と
|
|
10012
10193
|
* みなし、根の識別子を持つ最も近い祖先(自身を含む)のバインディングデータを
|
|
10013
10194
|
* 所有者として扱います。関数呼び出しや演算を含む式は書き戻し先を一意に決められ
|
|
10014
|
-
* ないため、エラーログを出して null
|
|
10195
|
+
* ないため、エラーログを出して null を返します。ただし `data-each-array` で
|
|
10196
|
+
* 書き戻し先を宣言している場合は、`data-each` の式ではなくその宣言を解決します。
|
|
10015
10197
|
*
|
|
10016
10198
|
* @param container `data-each` コンテナのフラグメント
|
|
10017
|
-
* @returns
|
|
10199
|
+
* @returns 所有者・所有者データ・配列・経路と、表示位置と配列の位置が一致しない
|
|
10200
|
+
* (`data-each-array` による宣言)かどうか。解決できない場合は null
|
|
10018
10201
|
*/
|
|
10019
10202
|
static resolveEachArray(e) {
|
|
10020
10203
|
const t = e.getRawAttribute(`${c.prefix}each`);
|
|
10021
10204
|
if (t === null)
|
|
10022
10205
|
return y.error("Haori", `Row container has no ${c.prefix}each expression.`), null;
|
|
10023
|
-
const r = t.trim().split(".");
|
|
10024
|
-
if (!(
|
|
10206
|
+
const r = e.getRawAttribute(`${c.prefix}each-array`), i = r !== null, n = i ? `${c.prefix}each-array` : `${c.prefix}each`, s = i ? r : t, a = s.trim().split(".");
|
|
10207
|
+
if (!(a.length > 0 && a.every((E) => /^[A-Za-z_$][\w$]*$/.test(E))))
|
|
10025
10208
|
return y.error(
|
|
10026
10209
|
"Haori",
|
|
10027
|
-
`Row operations require a plain identifier path for ${
|
|
10210
|
+
`Row operations require a plain identifier path for ${n} (got: ${s}).` + (i ? "" : ` Declare ${c.prefix}each-array to specify the array to write back to.`)
|
|
10028
10211
|
), null;
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10212
|
+
if (i && e.getRawAttribute(`${c.prefix}each-key`) === null)
|
|
10213
|
+
return y.error(
|
|
10214
|
+
"Haori",
|
|
10215
|
+
`${c.prefix}each-array requires ${c.prefix}each-key (${c.prefix}each-array="${s}").`
|
|
10216
|
+
), null;
|
|
10217
|
+
const l = b.resolveRowScopeBase(e, a[0]);
|
|
10218
|
+
let u, d, p;
|
|
10219
|
+
if (l)
|
|
10220
|
+
u = l.owner, d = l.ownerData, p = [...l.path, ...a.slice(1)];
|
|
10033
10221
|
else {
|
|
10034
|
-
for (
|
|
10035
|
-
const
|
|
10036
|
-
if (
|
|
10037
|
-
|
|
10222
|
+
for (u = e, d = null; u; ) {
|
|
10223
|
+
const E = u.getRawBindingData();
|
|
10224
|
+
if (E && a[0] in E && !b.isRowScopeKey(u, a[0])) {
|
|
10225
|
+
d = E;
|
|
10038
10226
|
break;
|
|
10039
10227
|
}
|
|
10040
|
-
|
|
10228
|
+
u = u.getParent();
|
|
10041
10229
|
}
|
|
10042
|
-
|
|
10230
|
+
p = a;
|
|
10043
10231
|
}
|
|
10044
|
-
if (!
|
|
10232
|
+
if (!u || !d)
|
|
10045
10233
|
return y.error(
|
|
10046
10234
|
"Haori",
|
|
10047
|
-
`Binding data owner not found for ${
|
|
10235
|
+
`Binding data owner not found for ${n}="${s}".`
|
|
10048
10236
|
), null;
|
|
10049
|
-
const
|
|
10050
|
-
return Array.isArray(
|
|
10237
|
+
const g = b.readPathValue(d, p);
|
|
10238
|
+
return Array.isArray(g) ? { owner: u, ownerData: d, array: g, path: p, mapped: i } : (y.error(
|
|
10051
10239
|
"Haori",
|
|
10052
|
-
`${
|
|
10240
|
+
`${n}="${s}" does not resolve to an array.`
|
|
10053
10241
|
), null);
|
|
10054
10242
|
}
|
|
10055
10243
|
/**
|
|
@@ -10396,11 +10584,12 @@ ${x}
|
|
|
10396
10584
|
* @returns 処理結果のPromise
|
|
10397
10585
|
*/
|
|
10398
10586
|
movePrevRow() {
|
|
10399
|
-
return this.options.rowMovePrev !== !0 ? Promise.resolve() : this.spliceRows("row-prev", (e, t) => {
|
|
10400
|
-
|
|
10587
|
+
return this.options.rowMovePrev !== !0 ? Promise.resolve() : this.spliceRows("row-prev", (e, t, r) => {
|
|
10588
|
+
const i = r();
|
|
10589
|
+
if (i === null || t <= 0 || t >= e.length)
|
|
10401
10590
|
return !1;
|
|
10402
|
-
const [
|
|
10403
|
-
return e.splice(
|
|
10591
|
+
const [n] = e.splice(t, 1);
|
|
10592
|
+
return e.splice(i, 0, n), !0;
|
|
10404
10593
|
});
|
|
10405
10594
|
}
|
|
10406
10595
|
/**
|
|
@@ -10409,12 +10598,16 @@ ${x}
|
|
|
10409
10598
|
* @returns 処理結果のPromise
|
|
10410
10599
|
*/
|
|
10411
10600
|
moveNextRow() {
|
|
10412
|
-
return this.options.rowMoveNext !== !0 ? Promise.resolve() : this.spliceRows(
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10601
|
+
return this.options.rowMoveNext !== !0 ? Promise.resolve() : this.spliceRows(
|
|
10602
|
+
"row-next",
|
|
10603
|
+
(e, t, r, i) => {
|
|
10604
|
+
const n = i();
|
|
10605
|
+
if (n === null || t < 0 || t >= e.length - 1)
|
|
10606
|
+
return !1;
|
|
10607
|
+
const [s] = e.splice(t, 1);
|
|
10608
|
+
return e.splice(n, 0, s), !0;
|
|
10609
|
+
}
|
|
10610
|
+
);
|
|
10418
10611
|
}
|
|
10419
10612
|
/**
|
|
10420
10613
|
* `data-each` が参照する配列を書き換えて行を増減・並べ替えします。
|
|
@@ -10423,8 +10616,13 @@ ${x}
|
|
|
10423
10616
|
* `Core.setBindingData()` を適用します。DOM の行は差分更新で再描画されるため、
|
|
10424
10617
|
* DOM とバインディングデータが常に一致します。
|
|
10425
10618
|
*
|
|
10426
|
-
* `mutate` の第 2
|
|
10427
|
-
*
|
|
10619
|
+
* `mutate` の第 2 引数は操作対象の行に対応する配列のインデックス、第 3・第 4 引数は
|
|
10620
|
+
* 表示上の前後の行に対応するインデックスを返す関数(無ければ null を返す)です。
|
|
10621
|
+
* 属性値でコンテナを指定した場合(行の外に置いたボタン)は末尾の行を指し、
|
|
10622
|
+
* `row-add` では末尾へ追加されます。`data-each-array` を指定した場合、表示の並びと
|
|
10623
|
+
* 配列の並びは一致しないため、これらは `data-each-key` で対応付けた配列上の位置に
|
|
10624
|
+
* なります。前後の行の解決は関数越しにします。増減の操作では使わないため、
|
|
10625
|
+
* 対応する要素が無い隣の行について無関係な警告を出さないためです。
|
|
10428
10626
|
*
|
|
10429
10627
|
* @param attributeKey 属性のキー(`row-add` など)
|
|
10430
10628
|
* @param mutate 配列を書き換える関数。書き換えた場合は true を返す
|
|
@@ -10437,27 +10635,40 @@ ${x}
|
|
|
10437
10635
|
const i = b.resolveEachArray(r);
|
|
10438
10636
|
if (!i)
|
|
10439
10637
|
return Promise.reject(new Error("Row array not resolved."));
|
|
10440
|
-
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${c.prefix}row`) : null, a = b.getRowFragments(r), o = s ? a.indexOf(s) : a.length - 1, l = i.
|
|
10441
|
-
|
|
10638
|
+
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${c.prefix}row`) : null, a = b.getRowFragments(r), o = s ? a.indexOf(s) : a.length - 1, l = (g) => g < 0 || g >= a.length ? null : i.mapped ? b.resolveRowIndex(
|
|
10639
|
+
r,
|
|
10640
|
+
a[g],
|
|
10641
|
+
i.array,
|
|
10642
|
+
b.attrName(this.eventType, e)
|
|
10643
|
+
) : g, u = o >= 0 ? l(o) : i.mapped ? i.array.length - 1 : o;
|
|
10644
|
+
if (u === null)
|
|
10645
|
+
return Promise.resolve();
|
|
10646
|
+
const d = i.array.slice();
|
|
10647
|
+
if (!t(
|
|
10648
|
+
d,
|
|
10649
|
+
u,
|
|
10650
|
+
() => l(o - 1),
|
|
10651
|
+
() => l(o + 1)
|
|
10652
|
+
))
|
|
10442
10653
|
return Promise.resolve();
|
|
10443
|
-
const
|
|
10444
|
-
return a.forEach((
|
|
10445
|
-
const
|
|
10446
|
-
|
|
10447
|
-
}),
|
|
10448
|
-
if (b.isSameRowItem(i.array[
|
|
10654
|
+
const p = /* @__PURE__ */ new Map();
|
|
10655
|
+
return a.forEach((g) => {
|
|
10656
|
+
const E = g.getListKey();
|
|
10657
|
+
E !== null && !p.has(String(E)) && p.set(String(E), g);
|
|
10658
|
+
}), d.forEach((g, E) => {
|
|
10659
|
+
if (b.isSameRowItem(i.array[E], g))
|
|
10449
10660
|
return;
|
|
10450
|
-
const
|
|
10661
|
+
const v = p.get(
|
|
10451
10662
|
B.createListKey(
|
|
10452
|
-
|
|
10663
|
+
g,
|
|
10453
10664
|
null,
|
|
10454
|
-
|
|
10665
|
+
E
|
|
10455
10666
|
)
|
|
10456
10667
|
);
|
|
10457
|
-
|
|
10668
|
+
v && B.clearUserEditMarks(v);
|
|
10458
10669
|
}), B.setBindingData(
|
|
10459
10670
|
i.owner.getTarget(),
|
|
10460
|
-
b.withPathValue(i.ownerData, i.path,
|
|
10671
|
+
b.withPathValue(i.ownerData, i.path, d),
|
|
10461
10672
|
{
|
|
10462
10673
|
// 対象は配列の 1 要素だけなので、所有者の部分木を丸ごと供給の宛先にはしない
|
|
10463
10674
|
// (行の書き戻し `applyRowWrites()` と同じ扱い)。
|
|
@@ -10550,7 +10761,7 @@ class Ht {
|
|
|
10550
10761
|
}
|
|
10551
10762
|
}
|
|
10552
10763
|
}
|
|
10553
|
-
const
|
|
10764
|
+
const f = class f {
|
|
10554
10765
|
/**
|
|
10555
10766
|
* 遅延属性かどうか(完全名で判定)を判定します。
|
|
10556
10767
|
*
|
|
@@ -10558,7 +10769,7 @@ const h = class h {
|
|
|
10558
10769
|
* @returns 遅延属性かどうか
|
|
10559
10770
|
*/
|
|
10560
10771
|
static isDeferredAttributeName(e) {
|
|
10561
|
-
return
|
|
10772
|
+
return f.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
10562
10773
|
(t) => e === `${c.prefix}${t}`
|
|
10563
10774
|
);
|
|
10564
10775
|
}
|
|
@@ -10569,7 +10780,7 @@ const h = class h {
|
|
|
10569
10780
|
* @returns 除外対象かどうか
|
|
10570
10781
|
*/
|
|
10571
10782
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
10572
|
-
return
|
|
10783
|
+
return f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
10573
10784
|
(t) => e === `${c.prefix}${t}`
|
|
10574
10785
|
);
|
|
10575
10786
|
}
|
|
@@ -10581,7 +10792,7 @@ const h = class h {
|
|
|
10581
10792
|
* @returns 再評価する場合は true
|
|
10582
10793
|
*/
|
|
10583
10794
|
static shouldReevaluateAttribute(e, t) {
|
|
10584
|
-
return t !== null && !
|
|
10795
|
+
return t !== null && !f.isEvaluateAllExcludedAttributeName(e) && f.ATTRIBUTE_PLACEHOLDER_REGEX.test(t);
|
|
10585
10796
|
}
|
|
10586
10797
|
/**
|
|
10587
10798
|
* data-attr-* 形式の属性名から実際に更新する属性名を取得します。
|
|
@@ -10590,7 +10801,7 @@ const h = class h {
|
|
|
10590
10801
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
10591
10802
|
*/
|
|
10592
10803
|
static getAliasedAttributeName(e) {
|
|
10593
|
-
const t = `${c.prefix}${
|
|
10804
|
+
const t = `${c.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
10594
10805
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
10595
10806
|
}
|
|
10596
10807
|
/**
|
|
@@ -10601,9 +10812,9 @@ const h = class h {
|
|
|
10601
10812
|
* @returns data-attr-* の内部反映なら true
|
|
10602
10813
|
*/
|
|
10603
10814
|
static isAliasedAttributeReflection(e, t) {
|
|
10604
|
-
const r =
|
|
10815
|
+
const r = x.get(e);
|
|
10605
10816
|
return r instanceof I ? r.hasAttribute(
|
|
10606
|
-
`${c.prefix}${
|
|
10817
|
+
`${c.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
10607
10818
|
) : !1;
|
|
10608
10819
|
}
|
|
10609
10820
|
/**
|
|
@@ -10617,8 +10828,8 @@ const h = class h {
|
|
|
10617
10828
|
let t = Promise.resolve();
|
|
10618
10829
|
for (const r of e.getAttributeNames()) {
|
|
10619
10830
|
const i = e.getRawAttribute(r);
|
|
10620
|
-
|
|
10621
|
-
() =>
|
|
10831
|
+
f.shouldReevaluateAttribute(r, i) && (t = t.then(
|
|
10832
|
+
() => f.setAttribute(e.getTarget(), r, i)
|
|
10622
10833
|
));
|
|
10623
10834
|
}
|
|
10624
10835
|
return t.then(() => {
|
|
@@ -10633,7 +10844,7 @@ const h = class h {
|
|
|
10633
10844
|
static reevaluateChildren(e) {
|
|
10634
10845
|
const t = [];
|
|
10635
10846
|
return e.getChildren().forEach((r) => {
|
|
10636
|
-
r instanceof I ? t.push(
|
|
10847
|
+
r instanceof I ? t.push(f.evaluateAll(r)) : r instanceof ee && t.push(f.evaluateText(r));
|
|
10637
10848
|
}), Promise.all(t).then(() => {
|
|
10638
10849
|
});
|
|
10639
10850
|
}
|
|
@@ -10656,7 +10867,7 @@ const h = class h {
|
|
|
10656
10867
|
*/
|
|
10657
10868
|
static clearUserEditMarks(e, t = I.currentSequence()) {
|
|
10658
10869
|
e.clearUserEditMark(t), e.getChildren().forEach((r) => {
|
|
10659
|
-
r instanceof I &&
|
|
10870
|
+
r instanceof I && f.clearUserEditMarks(r, t);
|
|
10660
10871
|
});
|
|
10661
10872
|
}
|
|
10662
10873
|
/**
|
|
@@ -10666,7 +10877,7 @@ const h = class h {
|
|
|
10666
10877
|
* @returns 再評価状態
|
|
10667
10878
|
*/
|
|
10668
10879
|
static getReactiveFetchState(e) {
|
|
10669
|
-
const t =
|
|
10880
|
+
const t = f.REACTIVE_FETCH_STATES.get(e);
|
|
10670
10881
|
if (t)
|
|
10671
10882
|
return t;
|
|
10672
10883
|
const r = {
|
|
@@ -10674,7 +10885,7 @@ const h = class h {
|
|
|
10674
10885
|
running: !1,
|
|
10675
10886
|
rerunRequested: !1
|
|
10676
10887
|
};
|
|
10677
|
-
return
|
|
10888
|
+
return f.REACTIVE_FETCH_STATES.set(e, r), r;
|
|
10678
10889
|
}
|
|
10679
10890
|
/**
|
|
10680
10891
|
* data-import の再評価状態を取得します。
|
|
@@ -10683,7 +10894,7 @@ const h = class h {
|
|
|
10683
10894
|
* @returns 再評価状態
|
|
10684
10895
|
*/
|
|
10685
10896
|
static getReactiveImportState(e) {
|
|
10686
|
-
const t =
|
|
10897
|
+
const t = f.REACTIVE_IMPORT_STATES.get(e);
|
|
10687
10898
|
if (t)
|
|
10688
10899
|
return t;
|
|
10689
10900
|
const r = {
|
|
@@ -10691,7 +10902,7 @@ const h = class h {
|
|
|
10691
10902
|
running: !1,
|
|
10692
10903
|
rerunRequested: !1
|
|
10693
10904
|
};
|
|
10694
|
-
return
|
|
10905
|
+
return f.REACTIVE_IMPORT_STATES.set(e, r), r;
|
|
10695
10906
|
}
|
|
10696
10907
|
/**
|
|
10697
10908
|
* bind 更新時に data-fetch / data-import を専用ルートで再評価します。
|
|
@@ -10704,9 +10915,9 @@ const h = class h {
|
|
|
10704
10915
|
if (t.has(e))
|
|
10705
10916
|
return Promise.resolve();
|
|
10706
10917
|
const r = [];
|
|
10707
|
-
return e.hasAttribute(`${c.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${c.prefix}fetch`) && r.push(
|
|
10918
|
+
return e.hasAttribute(`${c.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${c.prefix}fetch`) && r.push(f.executeManagedFetch(e)), e.hasAttribute(`${c.prefix}import`) && r.push(f.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
10708
10919
|
i instanceof I && r.push(
|
|
10709
|
-
|
|
10920
|
+
f.reevaluateReactiveSpecialAttributes(i, t)
|
|
10710
10921
|
);
|
|
10711
10922
|
}), Promise.all(r).then(() => {
|
|
10712
10923
|
});
|
|
@@ -10718,7 +10929,7 @@ const h = class h {
|
|
|
10718
10929
|
* @returns 実行完了の Promise
|
|
10719
10930
|
*/
|
|
10720
10931
|
static executeManagedFetch(e) {
|
|
10721
|
-
const t = e.getTarget(), r =
|
|
10932
|
+
const t = e.getTarget(), r = f.getReactiveFetchState(t), i = re.resolveAutoFetchSignature(e);
|
|
10722
10933
|
if (r.running)
|
|
10723
10934
|
return (i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve();
|
|
10724
10935
|
if (i.hasUnresolvedReference || i.signature === null)
|
|
@@ -10730,7 +10941,7 @@ const h = class h {
|
|
|
10730
10941
|
return n.markReentrantBind(), n.runWithResult().then(() => {
|
|
10731
10942
|
}).finally(() => {
|
|
10732
10943
|
if (r.running = !1, r.rerunRequested)
|
|
10733
|
-
return r.rerunRequested = !1,
|
|
10944
|
+
return r.rerunRequested = !1, f.executeManagedFetch(e);
|
|
10734
10945
|
});
|
|
10735
10946
|
}
|
|
10736
10947
|
/**
|
|
@@ -10740,7 +10951,7 @@ const h = class h {
|
|
|
10740
10951
|
* @returns 実行完了の Promise
|
|
10741
10952
|
*/
|
|
10742
10953
|
static executeManagedImport(e) {
|
|
10743
|
-
const t = e.getTarget(), r =
|
|
10954
|
+
const t = e.getTarget(), r = f.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
10744
10955
|
`${c.prefix}import`
|
|
10745
10956
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
10746
10957
|
if (r.running)
|
|
@@ -10751,23 +10962,23 @@ const h = class h {
|
|
|
10751
10962
|
return Promise.resolve();
|
|
10752
10963
|
r.lastUrl = n, r.running = !0;
|
|
10753
10964
|
const s = performance.now();
|
|
10754
|
-
return t.setAttribute(`${c.prefix}importing`, ""),
|
|
10965
|
+
return t.setAttribute(`${c.prefix}importing`, ""), U.importStart(t, n), Ht.load(n).then((a) => {
|
|
10755
10966
|
const o = new TextEncoder().encode(a).length;
|
|
10756
10967
|
return K.enqueue(() => {
|
|
10757
10968
|
t.innerHTML = a;
|
|
10758
10969
|
}).then(() => {
|
|
10759
|
-
t.removeAttribute(`${c.prefix}importing`),
|
|
10970
|
+
t.removeAttribute(`${c.prefix}importing`), U.importEnd(t, n, o, s), f.adoptImportedChildren(e);
|
|
10760
10971
|
const l = [];
|
|
10761
10972
|
return e.getChildren().forEach((u) => {
|
|
10762
|
-
u instanceof I ? l.push(
|
|
10973
|
+
u instanceof I ? l.push(f.scan(u.getTarget())) : u instanceof ee && l.push(f.evaluateText(u));
|
|
10763
10974
|
}), Promise.all(l).then(() => {
|
|
10764
10975
|
});
|
|
10765
10976
|
});
|
|
10766
10977
|
}).catch((a) => {
|
|
10767
|
-
t.removeAttribute(`${c.prefix}importing`),
|
|
10978
|
+
t.removeAttribute(`${c.prefix}importing`), U.importError(t, n, a), y.error("[Haori]", "Failed to import HTML:", n, a);
|
|
10768
10979
|
}).finally(() => {
|
|
10769
10980
|
if (r.running = !1, r.rerunRequested)
|
|
10770
|
-
return r.rerunRequested = !1,
|
|
10981
|
+
return r.rerunRequested = !1, f.executeManagedImport(e);
|
|
10771
10982
|
});
|
|
10772
10983
|
}
|
|
10773
10984
|
/**
|
|
@@ -10787,7 +10998,7 @@ const h = class h {
|
|
|
10787
10998
|
e.getChildren().filter((r) => r.getTarget().parentNode !== t).forEach((r) => {
|
|
10788
10999
|
r.remove(!1);
|
|
10789
11000
|
}), t.childNodes.forEach((r) => {
|
|
10790
|
-
const i =
|
|
11001
|
+
const i = x.get(r);
|
|
10791
11002
|
i !== null && i.getParent() !== e && e.pushChild(i);
|
|
10792
11003
|
});
|
|
10793
11004
|
}
|
|
@@ -10798,8 +11009,8 @@ const h = class h {
|
|
|
10798
11009
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
10799
11010
|
*/
|
|
10800
11011
|
static scan(e) {
|
|
10801
|
-
const t =
|
|
10802
|
-
return t ?
|
|
11012
|
+
const t = x.get(e);
|
|
11013
|
+
return t ? f.initializeElementFragment(t, !1).then(() => F.restoreInitialValues(e)).then(() => {
|
|
10803
11014
|
ie.applySubtree(e);
|
|
10804
11015
|
}) : Promise.resolve();
|
|
10805
11016
|
}
|
|
@@ -10811,8 +11022,8 @@ const h = class h {
|
|
|
10811
11022
|
* @returns 初期化完了の Promise
|
|
10812
11023
|
*/
|
|
10813
11024
|
static initializeFreshEachRow(e) {
|
|
10814
|
-
return
|
|
10815
|
-
|
|
11025
|
+
return f.initializeElementFragment(e, !0).then(() => {
|
|
11026
|
+
f.needsScheduledEvaluateAll(e) && f.scheduleEvaluateAll(e), ie.applySubtree(e.getTarget());
|
|
10816
11027
|
});
|
|
10817
11028
|
}
|
|
10818
11029
|
/**
|
|
@@ -10823,16 +11034,16 @@ const h = class h {
|
|
|
10823
11034
|
* @returns 初期化完了の Promise
|
|
10824
11035
|
*/
|
|
10825
11036
|
static initializeElementFragment(e, t) {
|
|
10826
|
-
return
|
|
10827
|
-
if (
|
|
10828
|
-
|
|
11037
|
+
return f.syncMountedState(e), t && e.isFreshInitializationSkippable() ? Promise.resolve() : f.initializeElementAttributes(e).then(() => {
|
|
11038
|
+
if (f.shouldSkipChildInitialization(e, t)) {
|
|
11039
|
+
f.refreshDerivedSubtreeSignature(e);
|
|
10829
11040
|
return;
|
|
10830
11041
|
}
|
|
10831
11042
|
const r = [];
|
|
10832
11043
|
return e.getChildren().forEach((i) => {
|
|
10833
|
-
i instanceof I ? r.push(
|
|
11044
|
+
i instanceof I ? r.push(f.initializeElementFragment(i, t)) : i instanceof ee && r.push(f.evaluateText(i));
|
|
10834
11045
|
}), Promise.all(r).then(() => {
|
|
10835
|
-
|
|
11046
|
+
f.refreshDerivedSubtreeSignature(e);
|
|
10836
11047
|
});
|
|
10837
11048
|
});
|
|
10838
11049
|
}
|
|
@@ -10862,10 +11073,10 @@ const h = class h {
|
|
|
10862
11073
|
static initializeElementAttributes(e) {
|
|
10863
11074
|
let t = Promise.resolve();
|
|
10864
11075
|
const r = /* @__PURE__ */ new Set();
|
|
10865
|
-
for (const i of
|
|
11076
|
+
for (const i of f.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
10866
11077
|
const n = c.prefix + i;
|
|
10867
11078
|
e.hasAttribute(n) && (t = t.then(
|
|
10868
|
-
() =>
|
|
11079
|
+
() => f.setAttribute(
|
|
10869
11080
|
e.getTarget(),
|
|
10870
11081
|
n,
|
|
10871
11082
|
e.getRawAttribute(n)
|
|
@@ -10873,17 +11084,17 @@ const h = class h {
|
|
|
10873
11084
|
), r.add(n));
|
|
10874
11085
|
}
|
|
10875
11086
|
for (const i of e.getAttributeNames()) {
|
|
10876
|
-
if (r.has(i) ||
|
|
11087
|
+
if (r.has(i) || f.isDeferredAttributeName(i))
|
|
10877
11088
|
continue;
|
|
10878
11089
|
const n = e.getRawAttribute(i);
|
|
10879
11090
|
n !== null && (t = t.then(
|
|
10880
|
-
() =>
|
|
11091
|
+
() => f.setAttribute(e.getTarget(), i, n)
|
|
10881
11092
|
));
|
|
10882
11093
|
}
|
|
10883
|
-
for (const i of
|
|
11094
|
+
for (const i of f.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
10884
11095
|
const n = c.prefix + i;
|
|
10885
11096
|
e.hasAttribute(n) && (t = t.then(
|
|
10886
|
-
() =>
|
|
11097
|
+
() => f.setAttribute(
|
|
10887
11098
|
e.getTarget(),
|
|
10888
11099
|
n,
|
|
10889
11100
|
e.getRawAttribute(n)
|
|
@@ -10901,7 +11112,7 @@ const h = class h {
|
|
|
10901
11112
|
*/
|
|
10902
11113
|
static shouldSkipChildInitialization(e, t) {
|
|
10903
11114
|
const r = e.getAttribute(`${c.prefix}if`);
|
|
10904
|
-
return e.hasAttribute(`${c.prefix}if`) &&
|
|
11115
|
+
return e.hasAttribute(`${c.prefix}if`) && f.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${c.prefix}each`);
|
|
10905
11116
|
}
|
|
10906
11117
|
/**
|
|
10907
11118
|
* エレメントに属性を設定します。
|
|
@@ -10917,7 +11128,7 @@ const h = class h {
|
|
|
10917
11128
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
10918
11129
|
*/
|
|
10919
11130
|
static setAttribute(e, t, r, i = !1, n) {
|
|
10920
|
-
const s =
|
|
11131
|
+
const s = x.get(e), a = f.getAliasedAttributeName(t);
|
|
10921
11132
|
if (a !== null)
|
|
10922
11133
|
return r === null ? s.removeAliasedAttribute(t, a) : s.setAliasedAttribute(
|
|
10923
11134
|
t,
|
|
@@ -10931,16 +11142,16 @@ const h = class h {
|
|
|
10931
11142
|
case `${c.prefix}bind`: {
|
|
10932
11143
|
if (r !== null && i && s instanceof I && s.consumeSelfWrittenBind(r))
|
|
10933
11144
|
break;
|
|
10934
|
-
const p = r === null ? {} :
|
|
11145
|
+
const p = r === null ? {} : f.parseDataBind(r);
|
|
10935
11146
|
if (i) {
|
|
10936
11147
|
const g = n ?? I.nextSequence();
|
|
10937
11148
|
return r === null ? (o.push(
|
|
10938
|
-
|
|
11149
|
+
f.setBindingData(e, p, {
|
|
10939
11150
|
reflectToAttribute: !1,
|
|
10940
11151
|
sequence: g
|
|
10941
11152
|
})
|
|
10942
11153
|
), o.push(s.removeAttribute(t))) : o.push(
|
|
10943
|
-
|
|
11154
|
+
f.setBindingData(e, p, {
|
|
10944
11155
|
sequence: g
|
|
10945
11156
|
})
|
|
10946
11157
|
), Promise.all(o).then(() => {
|
|
@@ -10950,11 +11161,11 @@ const h = class h {
|
|
|
10950
11161
|
break;
|
|
10951
11162
|
}
|
|
10952
11163
|
case `${c.prefix}derive`:
|
|
10953
|
-
u =
|
|
11164
|
+
u = f.createDeriveInputSignature(
|
|
10954
11165
|
s,
|
|
10955
11166
|
r,
|
|
10956
11167
|
s.getRawAttribute(`${c.prefix}derive-name`)
|
|
10957
|
-
), l =
|
|
11168
|
+
), l = f.evaluateDerive(
|
|
10958
11169
|
s,
|
|
10959
11170
|
r,
|
|
10960
11171
|
s.getRawAttribute(`${c.prefix}derive-name`)
|
|
@@ -10962,11 +11173,11 @@ const h = class h {
|
|
|
10962
11173
|
}));
|
|
10963
11174
|
break;
|
|
10964
11175
|
case `${c.prefix}derive-name`:
|
|
10965
|
-
u =
|
|
11176
|
+
u = f.createDeriveInputSignature(
|
|
10966
11177
|
s,
|
|
10967
11178
|
s.getRawAttribute(`${c.prefix}derive`),
|
|
10968
11179
|
r
|
|
10969
|
-
), l =
|
|
11180
|
+
), l = f.evaluateDerive(
|
|
10970
11181
|
s,
|
|
10971
11182
|
s.getRawAttribute(`${c.prefix}derive`),
|
|
10972
11183
|
r
|
|
@@ -10974,16 +11185,16 @@ const h = class h {
|
|
|
10974
11185
|
}));
|
|
10975
11186
|
break;
|
|
10976
11187
|
case `${c.prefix}if`:
|
|
10977
|
-
o.push(
|
|
11188
|
+
o.push(f.evaluateIf(s));
|
|
10978
11189
|
break;
|
|
10979
11190
|
case `${c.prefix}each`:
|
|
10980
|
-
o.push(
|
|
11191
|
+
o.push(f.evaluateEach(s));
|
|
10981
11192
|
break;
|
|
10982
11193
|
case `${c.prefix}fetch`:
|
|
10983
|
-
d = () =>
|
|
11194
|
+
d = () => f.executeManagedFetch(s);
|
|
10984
11195
|
break;
|
|
10985
11196
|
case `${c.prefix}import`:
|
|
10986
|
-
typeof r == "string" && (d = () =>
|
|
11197
|
+
typeof r == "string" && (d = () => f.executeManagedImport(s));
|
|
10987
11198
|
break;
|
|
10988
11199
|
case `${c.prefix}store`:
|
|
10989
11200
|
r !== null && o.push(ve.restore(s));
|
|
@@ -10998,16 +11209,16 @@ const h = class h {
|
|
|
10998
11209
|
"Haori",
|
|
10999
11210
|
`${c.prefix}url-param を ${c.prefix}url-arg なしで ${c.prefix}store と併用すると復元した値が消えます(${c.prefix}url-arg を指定してください)。`
|
|
11000
11211
|
);
|
|
11001
|
-
const
|
|
11212
|
+
const E = {
|
|
11002
11213
|
reentrant: !0,
|
|
11003
11214
|
kind: "nonSupply",
|
|
11004
11215
|
sequence: I.nextSequence()
|
|
11005
11216
|
};
|
|
11006
11217
|
if (p === null)
|
|
11007
|
-
o.push(
|
|
11218
|
+
o.push(f.setBindingData(e, g, E));
|
|
11008
11219
|
else {
|
|
11009
11220
|
const v = s.getRawBindingData() || {};
|
|
11010
|
-
v[String(p)] = g, o.push(
|
|
11221
|
+
v[String(p)] = g, o.push(f.setBindingData(e, v, E));
|
|
11011
11222
|
}
|
|
11012
11223
|
break;
|
|
11013
11224
|
}
|
|
@@ -11018,7 +11229,7 @@ const h = class h {
|
|
|
11018
11229
|
if (l !== null)
|
|
11019
11230
|
return s.setDeriveInputSignature(u), l.then((p) => {
|
|
11020
11231
|
if (p)
|
|
11021
|
-
return
|
|
11232
|
+
return f.reevaluateChildren(s);
|
|
11022
11233
|
});
|
|
11023
11234
|
}).then(() => {
|
|
11024
11235
|
});
|
|
@@ -11050,37 +11261,37 @@ const h = class h {
|
|
|
11050
11261
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11051
11262
|
*/
|
|
11052
11263
|
static setBindingData(e, t, r = {}) {
|
|
11053
|
-
const i =
|
|
11264
|
+
const i = x.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", l = r.sequence ?? I.nextOperationSequence(), u = {
|
|
11054
11265
|
sequence: l,
|
|
11055
11266
|
kind: o,
|
|
11056
11267
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11057
11268
|
}, d = o === "supply";
|
|
11058
11269
|
d && i.markSupplyApplied(l);
|
|
11059
11270
|
const p = I.currentSequence(), g = i.getRawBindingData();
|
|
11060
|
-
d && (r.clearUserEdits ?? !0) &&
|
|
11061
|
-
const
|
|
11062
|
-
i.setBindingData(
|
|
11271
|
+
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i, l);
|
|
11272
|
+
const E = a ? f.resolveByPathAuthority(i, g, t, u) : t;
|
|
11273
|
+
i.setBindingData(E), a && (U.bindChange(e, g, E, "manual"), ve.mirror(i));
|
|
11063
11274
|
const v = () => {
|
|
11064
11275
|
i.markBindingWorkStart();
|
|
11065
|
-
const D = i.getRawBindingData() ??
|
|
11066
|
-
let
|
|
11067
|
-
return e.tagName === "FORM" && (
|
|
11276
|
+
const D = i.getRawBindingData() ?? E;
|
|
11277
|
+
let M = a ? i.setAttribute(`${c.prefix}bind`, JSON.stringify(D)) : Promise.resolve();
|
|
11278
|
+
return e.tagName === "FORM" && (M = M.then(() => {
|
|
11068
11279
|
if (i.wasResetAfter(p))
|
|
11069
11280
|
return;
|
|
11070
|
-
const H = i.getRawBindingData() ??
|
|
11281
|
+
const H = i.getRawBindingData() ?? E;
|
|
11071
11282
|
return F.syncValues(
|
|
11072
11283
|
i,
|
|
11073
11284
|
F.resolveSyncValues(i, H),
|
|
11074
11285
|
!1,
|
|
11075
11286
|
u
|
|
11076
11287
|
);
|
|
11077
|
-
})),
|
|
11288
|
+
})), M = M.then(
|
|
11078
11289
|
() => F.syncAncestorArgForms(i, p, u)
|
|
11079
|
-
),
|
|
11290
|
+
), M = M.then(() => f.evaluateAll(i, n)), M = M.then(
|
|
11080
11291
|
() => I.retryUnappliedValueWrites(e, p)
|
|
11081
|
-
),
|
|
11082
|
-
() =>
|
|
11083
|
-
),
|
|
11292
|
+
), M = M.then(
|
|
11293
|
+
() => f.reevaluateReactiveSpecialAttributes(i, n)
|
|
11294
|
+
), M.then(
|
|
11084
11295
|
() => i.markBindingWorkEnd(),
|
|
11085
11296
|
(H) => {
|
|
11086
11297
|
throw i.markBindingWorkEnd(), H;
|
|
@@ -11105,14 +11316,14 @@ const h = class h {
|
|
|
11105
11316
|
* @returns 適用を許した経路だけが `next` の値になったバインドデータ
|
|
11106
11317
|
*/
|
|
11107
11318
|
static resolveByPathAuthority(e, t, r, i) {
|
|
11108
|
-
const n =
|
|
11319
|
+
const n = f.mergePathAuthority(
|
|
11109
11320
|
e,
|
|
11110
11321
|
t ?? {},
|
|
11111
11322
|
r,
|
|
11112
11323
|
i,
|
|
11113
11324
|
""
|
|
11114
11325
|
);
|
|
11115
|
-
return n ===
|
|
11326
|
+
return n === f.ABSENT_PATH ? r : n;
|
|
11116
11327
|
}
|
|
11117
11328
|
/**
|
|
11118
11329
|
* 経路をたどりながら、変化した葉ごとに適用可否を判定します。
|
|
@@ -11125,41 +11336,41 @@ const h = class h {
|
|
|
11125
11336
|
* @returns 採用した値。その経路を持たせない場合は `ABSENT_PATH`
|
|
11126
11337
|
*/
|
|
11127
11338
|
static mergePathAuthority(e, t, r, i, n) {
|
|
11128
|
-
if (
|
|
11339
|
+
if (f.isPlainRecord(t) && f.isPlainRecord(r)) {
|
|
11129
11340
|
const u = t, d = r, p = {};
|
|
11130
11341
|
let g = Object.keys(u).some(
|
|
11131
11342
|
(v) => !Object.prototype.hasOwnProperty.call(d, v)
|
|
11132
11343
|
);
|
|
11133
|
-
const
|
|
11344
|
+
const E = /* @__PURE__ */ new Set([
|
|
11134
11345
|
...Object.keys(u),
|
|
11135
11346
|
...Object.keys(d)
|
|
11136
11347
|
]);
|
|
11137
|
-
for (const v of
|
|
11138
|
-
const D = n === "" ? v : `${n}.${v}`,
|
|
11348
|
+
for (const v of E) {
|
|
11349
|
+
const D = n === "" ? v : `${n}.${v}`, M = f.mergePathAuthority(
|
|
11139
11350
|
e,
|
|
11140
|
-
Object.prototype.hasOwnProperty.call(u, v) ? u[v] :
|
|
11141
|
-
Object.prototype.hasOwnProperty.call(d, v) ? d[v] :
|
|
11351
|
+
Object.prototype.hasOwnProperty.call(u, v) ? u[v] : f.ABSENT_PATH,
|
|
11352
|
+
Object.prototype.hasOwnProperty.call(d, v) ? d[v] : f.ABSENT_PATH,
|
|
11142
11353
|
i,
|
|
11143
11354
|
D
|
|
11144
11355
|
);
|
|
11145
|
-
|
|
11356
|
+
M !== f.ABSENT_PATH && (p[v] = M), M !== (Object.prototype.hasOwnProperty.call(d, v) ? d[v] : f.ABSENT_PATH) && (g = !0);
|
|
11146
11357
|
}
|
|
11147
11358
|
return g ? p : d;
|
|
11148
11359
|
}
|
|
11149
|
-
const s =
|
|
11360
|
+
const s = f.resolveArrayPairing(e, t, r, n);
|
|
11150
11361
|
if (s !== null) {
|
|
11151
11362
|
const u = t, d = r, p = d.map(
|
|
11152
|
-
(g,
|
|
11363
|
+
(g, E) => f.mergePathAuthority(
|
|
11153
11364
|
e,
|
|
11154
|
-
u[
|
|
11365
|
+
u[E],
|
|
11155
11366
|
g,
|
|
11156
11367
|
i,
|
|
11157
|
-
`${n}[${s[
|
|
11368
|
+
`${n}[${s[E]}]`
|
|
11158
11369
|
)
|
|
11159
11370
|
);
|
|
11160
|
-
return p.some((g,
|
|
11371
|
+
return p.some((g, E) => g !== d[E]) ? p : d;
|
|
11161
11372
|
}
|
|
11162
|
-
if (
|
|
11373
|
+
if (f.isSameBindingValue(t, r))
|
|
11163
11374
|
return r;
|
|
11164
11375
|
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit", l = {
|
|
11165
11376
|
sequence: a ?? i.sequence,
|
|
@@ -11185,14 +11396,14 @@ const h = class h {
|
|
|
11185
11396
|
static resolveArrayPairing(e, t, r, i) {
|
|
11186
11397
|
if (!Array.isArray(t) || !Array.isArray(r) || t.length !== r.length || r.length === 0)
|
|
11187
11398
|
return null;
|
|
11188
|
-
const n = r.some((o) =>
|
|
11189
|
-
(o, l) =>
|
|
11399
|
+
const n = r.some((o) => f.isPlainRecord(o)) ? f.resolveEachKeyArg(e, i) : null, s = t.map(
|
|
11400
|
+
(o, l) => f.createListKey(
|
|
11190
11401
|
o,
|
|
11191
11402
|
n,
|
|
11192
11403
|
l
|
|
11193
11404
|
)
|
|
11194
11405
|
), a = r.map(
|
|
11195
|
-
(o, l) =>
|
|
11406
|
+
(o, l) => f.createListKey(
|
|
11196
11407
|
o,
|
|
11197
11408
|
n,
|
|
11198
11409
|
l
|
|
@@ -11216,7 +11427,7 @@ const h = class h {
|
|
|
11216
11427
|
static resolveEachKeyArg(e, t) {
|
|
11217
11428
|
const r = `${c.prefix}each`, i = e.getTarget(), n = t.replace(/\[[^\]]*\]/g, ""), s = i.querySelectorAll(`[${r}]`);
|
|
11218
11429
|
for (const a of Array.from(s)) {
|
|
11219
|
-
const o =
|
|
11430
|
+
const o = f.resolveEachDeclarationPath(a, i);
|
|
11220
11431
|
if (o === null || o !== n)
|
|
11221
11432
|
continue;
|
|
11222
11433
|
const l = a.getAttribute(`${r}-key`);
|
|
@@ -11285,7 +11496,7 @@ const h = class h {
|
|
|
11285
11496
|
static isSameBindingValue(e, t) {
|
|
11286
11497
|
if (e === t)
|
|
11287
11498
|
return !0;
|
|
11288
|
-
if (e ===
|
|
11499
|
+
if (e === f.ABSENT_PATH || t === f.ABSENT_PATH)
|
|
11289
11500
|
return !1;
|
|
11290
11501
|
try {
|
|
11291
11502
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
@@ -11311,7 +11522,7 @@ const h = class h {
|
|
|
11311
11522
|
* `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
|
|
11312
11523
|
*/
|
|
11313
11524
|
static getBindingData(e, t = {}) {
|
|
11314
|
-
const r =
|
|
11525
|
+
const r = x.get(e);
|
|
11315
11526
|
return r instanceof I ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
11316
11527
|
}
|
|
11317
11528
|
/**
|
|
@@ -11330,7 +11541,7 @@ const h = class h {
|
|
|
11330
11541
|
* @return 解決済みスコープと各キーの由来情報
|
|
11331
11542
|
*/
|
|
11332
11543
|
static dumpScope(e) {
|
|
11333
|
-
const t =
|
|
11544
|
+
const t = f.collectScope(e);
|
|
11334
11545
|
return j.isEnabled() && y.info("[Haori]", "scope dump for", e, t), t;
|
|
11335
11546
|
}
|
|
11336
11547
|
/**
|
|
@@ -11344,11 +11555,11 @@ const h = class h {
|
|
|
11344
11555
|
* @return 解決済みスコープと各キーの由来情報
|
|
11345
11556
|
*/
|
|
11346
11557
|
static collectScope(e) {
|
|
11347
|
-
const t =
|
|
11558
|
+
const t = x.get(e);
|
|
11348
11559
|
if (!t)
|
|
11349
11560
|
return { resolved: {}, sources: {} };
|
|
11350
11561
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
11351
|
-
const u = l.getTarget(), d =
|
|
11562
|
+
const u = l.getTarget(), d = f.resolveElementId(u);
|
|
11352
11563
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
11353
11564
|
}, s = (l, u, d, p) => {
|
|
11354
11565
|
if (l)
|
|
@@ -11392,14 +11603,14 @@ const h = class h {
|
|
|
11392
11603
|
* @param node 追加するノード
|
|
11393
11604
|
*/
|
|
11394
11605
|
static addNode(e, t) {
|
|
11395
|
-
const r =
|
|
11606
|
+
const r = x.get(e);
|
|
11396
11607
|
if (r.isSkipMutationNodes())
|
|
11397
11608
|
return;
|
|
11398
|
-
const i =
|
|
11609
|
+
const i = x.get(t.nextSibling), n = x.get(t);
|
|
11399
11610
|
if (n) {
|
|
11400
11611
|
if (n.getParent() === r)
|
|
11401
11612
|
return;
|
|
11402
|
-
r.insertBefore(n, i), n instanceof I ?
|
|
11613
|
+
r.insertBefore(n, i), n instanceof I ? f.scan(n.getTarget()) : n instanceof ee && f.evaluateText(n);
|
|
11403
11614
|
}
|
|
11404
11615
|
}
|
|
11405
11616
|
/**
|
|
@@ -11408,7 +11619,7 @@ const h = class h {
|
|
|
11408
11619
|
* @param node 削除するノード
|
|
11409
11620
|
*/
|
|
11410
11621
|
static removeNode(e) {
|
|
11411
|
-
const t =
|
|
11622
|
+
const t = x.get(e);
|
|
11412
11623
|
if (t) {
|
|
11413
11624
|
const r = t.getParent();
|
|
11414
11625
|
if (r && r.isSkipMutationNodes())
|
|
@@ -11423,7 +11634,7 @@ const h = class h {
|
|
|
11423
11634
|
* @param text 新しいテキスト
|
|
11424
11635
|
*/
|
|
11425
11636
|
static changeText(e, t) {
|
|
11426
|
-
const r =
|
|
11637
|
+
const r = x.get(e);
|
|
11427
11638
|
r && r.setContent(t);
|
|
11428
11639
|
}
|
|
11429
11640
|
/**
|
|
@@ -11435,12 +11646,12 @@ const h = class h {
|
|
|
11435
11646
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11436
11647
|
*/
|
|
11437
11648
|
static changeValue(e, t) {
|
|
11438
|
-
const r =
|
|
11649
|
+
const r = x.get(e);
|
|
11439
11650
|
if (r.getValue() === t)
|
|
11440
11651
|
return Promise.resolve();
|
|
11441
11652
|
const i = [];
|
|
11442
11653
|
i.push(r.setValue(t));
|
|
11443
|
-
const n =
|
|
11654
|
+
const n = f.getFormFragment(r);
|
|
11444
11655
|
if (n) {
|
|
11445
11656
|
const s = F.getValues(n), a = n.getAttribute(`${c.prefix}form-arg`), o = n.getRawBindingData();
|
|
11446
11657
|
let l;
|
|
@@ -11456,7 +11667,7 @@ const h = class h {
|
|
|
11456
11667
|
i.push(
|
|
11457
11668
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
11458
11669
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
11459
|
-
|
|
11670
|
+
f.setBindingData(n.getTarget(), l, {
|
|
11460
11671
|
kind: "nonSupply",
|
|
11461
11672
|
sequence: I.nextSequence()
|
|
11462
11673
|
})
|
|
@@ -11475,7 +11686,7 @@ const h = class h {
|
|
|
11475
11686
|
if (e.getTarget() instanceof HTMLFormElement)
|
|
11476
11687
|
return e;
|
|
11477
11688
|
const t = e.getParent();
|
|
11478
|
-
return t ?
|
|
11689
|
+
return t ? f.getFormFragment(t) : null;
|
|
11479
11690
|
}
|
|
11480
11691
|
/**
|
|
11481
11692
|
* フラグメントとその子要素を評価します。
|
|
@@ -11486,21 +11697,21 @@ const h = class h {
|
|
|
11486
11697
|
static evaluateAll(e, t = /* @__PURE__ */ new Set()) {
|
|
11487
11698
|
if (t.has(e))
|
|
11488
11699
|
return Promise.resolve();
|
|
11489
|
-
let r =
|
|
11700
|
+
let r = f.reevaluateInterpolatedAttributes(e);
|
|
11490
11701
|
const i = e.hasAttribute(`${c.prefix}derive`), n = e.hasAttribute(`${c.prefix}if`), s = e.hasAttribute(`${c.prefix}each`), a = e.getRawAttribute(`${c.prefix}derive`), o = e.getRawAttribute(`${c.prefix}derive-name`);
|
|
11491
11702
|
let l = !1, u = !1, d = null;
|
|
11492
11703
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
11493
|
-
const p =
|
|
11704
|
+
const p = f.createDeriveInputSignature(
|
|
11494
11705
|
e,
|
|
11495
11706
|
a,
|
|
11496
11707
|
o
|
|
11497
11708
|
);
|
|
11498
11709
|
p === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
11499
|
-
() =>
|
|
11710
|
+
() => f.evaluateDerive(e, a, o).then(
|
|
11500
11711
|
() => {
|
|
11501
11712
|
}
|
|
11502
11713
|
)
|
|
11503
|
-
)) : e.getDeriveInputSignature() !== p && (r = r.then(() =>
|
|
11714
|
+
)) : e.getDeriveInputSignature() !== p && (r = r.then(() => f.evaluateDerive(
|
|
11504
11715
|
e,
|
|
11505
11716
|
a,
|
|
11506
11717
|
o
|
|
@@ -11508,16 +11719,16 @@ const h = class h {
|
|
|
11508
11719
|
e.setDeriveInputSignature(p);
|
|
11509
11720
|
})));
|
|
11510
11721
|
}
|
|
11511
|
-
return n && (r = r.then(() =>
|
|
11722
|
+
return n && (r = r.then(() => f.evaluateIf(e))), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => f.evaluateEach(e))) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
11512
11723
|
})) : (i && (r = r.then(() => {
|
|
11513
|
-
if (!
|
|
11514
|
-
e.setDeriveSubtreeSignature(null),
|
|
11724
|
+
if (!f.canSkipStableDerivedSubtree(e)) {
|
|
11725
|
+
e.setDeriveSubtreeSignature(null), f.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
11515
11726
|
return;
|
|
11516
11727
|
}
|
|
11517
|
-
d =
|
|
11728
|
+
d = f.createDescendantBindingSignature(
|
|
11518
11729
|
e,
|
|
11519
11730
|
"evaluateAll"
|
|
11520
|
-
), u = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d,
|
|
11731
|
+
), u = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d, f.logDerivedSubtreeProfileSnapshot(
|
|
11521
11732
|
e,
|
|
11522
11733
|
l ? "skip-hit" : "skip-miss"
|
|
11523
11734
|
);
|
|
@@ -11527,10 +11738,10 @@ const h = class h {
|
|
|
11527
11738
|
const p = [];
|
|
11528
11739
|
return e.getChildren().forEach((g) => {
|
|
11529
11740
|
if (g instanceof I) {
|
|
11530
|
-
if (
|
|
11741
|
+
if (f.canSkipUnchangedNestedEach(g))
|
|
11531
11742
|
return;
|
|
11532
|
-
p.push(
|
|
11533
|
-
} else g instanceof ee && p.push(
|
|
11743
|
+
p.push(f.evaluateAll(g, t));
|
|
11744
|
+
} else g instanceof ee && p.push(f.evaluateText(g));
|
|
11534
11745
|
}), Promise.all(p).then(() => {
|
|
11535
11746
|
});
|
|
11536
11747
|
}).then(() => {
|
|
@@ -11562,7 +11773,7 @@ const h = class h {
|
|
|
11562
11773
|
const a = {
|
|
11563
11774
|
[n]: s.value
|
|
11564
11775
|
};
|
|
11565
|
-
return
|
|
11776
|
+
return f.createBindingSignature(i) === f.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
|
|
11566
11777
|
}
|
|
11567
11778
|
/**
|
|
11568
11779
|
* テキストフラグメントを評価します。
|
|
@@ -11608,7 +11819,7 @@ const h = class h {
|
|
|
11608
11819
|
);
|
|
11609
11820
|
return;
|
|
11610
11821
|
}
|
|
11611
|
-
const { sources: r } =
|
|
11822
|
+
const { sources: r } = f.collectScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
11612
11823
|
let s = 0;
|
|
11613
11824
|
n.forEach((o) => {
|
|
11614
11825
|
const l = t.indexOf(o, s);
|
|
@@ -11635,10 +11846,10 @@ const h = class h {
|
|
|
11635
11846
|
*/
|
|
11636
11847
|
static evaluateIf(e) {
|
|
11637
11848
|
const t = [], r = e.getAttribute(`${c.prefix}if`);
|
|
11638
|
-
if (
|
|
11639
|
-
j.isEnabled() && e.isVisible() &&
|
|
11849
|
+
if (f.isHiddenIfCondition(r))
|
|
11850
|
+
j.isEnabled() && e.isVisible() && f.logFalsyIfDiagnostics(e), t.push(
|
|
11640
11851
|
e.hide().then(() => {
|
|
11641
|
-
|
|
11852
|
+
U.hide(e.getTarget());
|
|
11642
11853
|
})
|
|
11643
11854
|
);
|
|
11644
11855
|
else {
|
|
@@ -11646,11 +11857,11 @@ const h = class h {
|
|
|
11646
11857
|
const i = e.isVisible(), n = [];
|
|
11647
11858
|
e.getChildren().forEach((s) => {
|
|
11648
11859
|
s instanceof I ? n.push(
|
|
11649
|
-
s.isMounted() ?
|
|
11650
|
-
) : s instanceof ee && n.push(
|
|
11860
|
+
s.isMounted() ? f.evaluateAll(s) : f.scan(s.getTarget())
|
|
11861
|
+
) : s instanceof ee && n.push(f.evaluateText(s));
|
|
11651
11862
|
}), t.push(
|
|
11652
11863
|
e.show().then(() => {
|
|
11653
|
-
|
|
11864
|
+
U.show(e.getTarget()), i || (f.triggerLoadOnShow(e), ie.refreshSubtree(e.getTarget()));
|
|
11654
11865
|
})
|
|
11655
11866
|
), t.push(Promise.all(n).then(() => {
|
|
11656
11867
|
}));
|
|
@@ -11680,8 +11891,8 @@ const h = class h {
|
|
|
11680
11891
|
* @return 再入制御状態
|
|
11681
11892
|
*/
|
|
11682
11893
|
static getEachUpdateState(e) {
|
|
11683
|
-
let t =
|
|
11684
|
-
return t || (t = { running: !1, rerunRequested: !1, settled: null },
|
|
11894
|
+
let t = f.EACH_UPDATE_STATES.get(e);
|
|
11895
|
+
return t || (t = { running: !1, rerunRequested: !1, settled: null }, f.EACH_UPDATE_STATES.set(e, t)), t;
|
|
11685
11896
|
}
|
|
11686
11897
|
/**
|
|
11687
11898
|
* each要素を評価します。
|
|
@@ -11698,12 +11909,12 @@ const h = class h {
|
|
|
11698
11909
|
*/
|
|
11699
11910
|
static evaluateEach(e) {
|
|
11700
11911
|
if (j.isEnabled() && Q.recordRowScopeIdentifiers([
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
]), !e.isVisible() || !e.isMounted())
|
|
11912
|
+
f.getRowScopeName(e, "each-arg"),
|
|
11913
|
+
f.getRowScopeName(e, "each-index")
|
|
11914
|
+
]), e.isMounted() || f.syncMountedState(e), !e.isVisible() || !e.isMounted())
|
|
11704
11915
|
return Promise.resolve();
|
|
11705
|
-
const t =
|
|
11706
|
-
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) :
|
|
11916
|
+
const t = f.getEachUpdateState(e);
|
|
11917
|
+
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) : f.runEachUpdateLoop(e, t);
|
|
11707
11918
|
}
|
|
11708
11919
|
/**
|
|
11709
11920
|
* `data-each` が行スコープへ公開する名前を返します。
|
|
@@ -11728,7 +11939,7 @@ const h = class h {
|
|
|
11728
11939
|
* @returns 差分更新が実行中なら true
|
|
11729
11940
|
*/
|
|
11730
11941
|
static isEachUpdateRunning(e) {
|
|
11731
|
-
return
|
|
11942
|
+
return f.getEachUpdateState(e).running;
|
|
11732
11943
|
}
|
|
11733
11944
|
/**
|
|
11734
11945
|
* data-each の差分更新を、再評価要求が無くなるまで直列に繰り返し実行します。
|
|
@@ -11744,14 +11955,14 @@ const h = class h {
|
|
|
11744
11955
|
const r = (async () => {
|
|
11745
11956
|
try {
|
|
11746
11957
|
do
|
|
11747
|
-
t.rerunRequested = !1, await
|
|
11958
|
+
t.rerunRequested = !1, await f.performEachUpdate(e);
|
|
11748
11959
|
while (t.rerunRequested);
|
|
11749
11960
|
const i = e.getTarget();
|
|
11750
|
-
i.setAttribute(`${c.prefix}each-done`, ""), ie.refreshSubtree(i),
|
|
11961
|
+
i.setAttribute(`${c.prefix}each-done`, ""), ie.refreshSubtree(i), f.runEachRenderedScript(i);
|
|
11751
11962
|
} finally {
|
|
11752
11963
|
t.running = !1, t.settled = null;
|
|
11753
11964
|
}
|
|
11754
|
-
|
|
11965
|
+
f.runEachRenderedChange(e);
|
|
11755
11966
|
})();
|
|
11756
11967
|
return t.settled = r, r;
|
|
11757
11968
|
}
|
|
@@ -11821,14 +12032,14 @@ ${r}
|
|
|
11821
12032
|
return;
|
|
11822
12033
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
11823
12034
|
let n = !1;
|
|
11824
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (
|
|
12035
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (f.EACH_RENDERED_CHANGE_WARNED.has(r) || (f.EACH_RENDERED_CHANGE_WARNED.add(r), y.warn(
|
|
11825
12036
|
"[Haori]",
|
|
11826
12037
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
11827
|
-
))),
|
|
12038
|
+
))), f.countEachRenderedRows(e) !== 0) {
|
|
11828
12039
|
if (!n) {
|
|
11829
|
-
if (
|
|
12040
|
+
if (f.EACH_RENDERED_CHANGE_FIRED.has(r))
|
|
11830
12041
|
return;
|
|
11831
|
-
|
|
12042
|
+
f.EACH_RENDERED_CHANGE_FIRED.add(r);
|
|
11832
12043
|
}
|
|
11833
12044
|
try {
|
|
11834
12045
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -11860,11 +12071,11 @@ ${r}
|
|
|
11860
12071
|
* @return 差分更新完了の Promise
|
|
11861
12072
|
*/
|
|
11862
12073
|
static performEachUpdate(e) {
|
|
11863
|
-
const t =
|
|
12074
|
+
const t = f.resolveEachItems(e);
|
|
11864
12075
|
if (t === null)
|
|
11865
12076
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
11866
12077
|
let r = e.getTemplate();
|
|
11867
|
-
const i = e.getAttribute(`${c.prefix}each-key`), n =
|
|
12078
|
+
const i = e.getAttribute(`${c.prefix}each-key`), n = f.createBindingSignature({
|
|
11868
12079
|
key: i ? String(i) : null,
|
|
11869
12080
|
items: t
|
|
11870
12081
|
});
|
|
@@ -11874,7 +12085,7 @@ ${r}
|
|
|
11874
12085
|
if (!s && a instanceof I) {
|
|
11875
12086
|
if (a.hasAttribute(`${c.prefix}each-before`) || a.hasAttribute(`${c.prefix}each-after`))
|
|
11876
12087
|
return;
|
|
11877
|
-
r = a.clone(),
|
|
12088
|
+
r = a.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
11878
12089
|
const o = a.getTarget();
|
|
11879
12090
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
11880
12091
|
}
|
|
@@ -11884,10 +12095,10 @@ ${r}
|
|
|
11884
12095
|
(l) => !l.hasAttribute(`${c.prefix}each-before`) && !l.hasAttribute(`${c.prefix}each-after`)
|
|
11885
12096
|
).forEach((l) => {
|
|
11886
12097
|
if (!s) {
|
|
11887
|
-
const d =
|
|
11888
|
-
d instanceof I && (r = d.clone(),
|
|
12098
|
+
const d = x.get(l);
|
|
12099
|
+
d instanceof I && (r = d.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
11889
12100
|
}
|
|
11890
|
-
const u =
|
|
12101
|
+
const u = x.get(l);
|
|
11891
12102
|
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), l.parentNode && l.parentNode.removeChild(l);
|
|
11892
12103
|
});
|
|
11893
12104
|
}
|
|
@@ -11895,7 +12106,7 @@ ${r}
|
|
|
11895
12106
|
e.setEachInputSignature(n);
|
|
11896
12107
|
});
|
|
11897
12108
|
}
|
|
11898
|
-
return e.getEachInputSignature() === n ?
|
|
12109
|
+
return e.getEachInputSignature() === n ? f.reevaluateEachRows(e) : this.updateDiff(e, t).then(() => {
|
|
11899
12110
|
e.setEachInputSignature(n);
|
|
11900
12111
|
});
|
|
11901
12112
|
}
|
|
@@ -11909,12 +12120,12 @@ ${r}
|
|
|
11909
12120
|
* @returns 再評価完了の Promise
|
|
11910
12121
|
*/
|
|
11911
12122
|
static reevaluateEachRows(e) {
|
|
11912
|
-
if (
|
|
12123
|
+
if (f.isRowLocalEachTemplate(e))
|
|
11913
12124
|
return Promise.resolve();
|
|
11914
12125
|
const t = e.getChildElementFragments().filter(
|
|
11915
12126
|
(r) => !r.hasAttribute(`${c.prefix}each-before`) && !r.hasAttribute(`${c.prefix}each-after`)
|
|
11916
12127
|
);
|
|
11917
|
-
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) =>
|
|
12128
|
+
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) => f.evaluateAll(r))).then(
|
|
11918
12129
|
() => {
|
|
11919
12130
|
}
|
|
11920
12131
|
);
|
|
@@ -11940,12 +12151,12 @@ ${r}
|
|
|
11940
12151
|
if (!e.hasAttribute(`${c.prefix}each`) || e.getEachInputSignature() === null)
|
|
11941
12152
|
return !1;
|
|
11942
12153
|
const t = e.getParent();
|
|
11943
|
-
if (t?.closestByAttribute(`${c.prefix}derive`) || t?.closestByAttribute(`${c.prefix}derive-name`) || t?.closestByAttribute(`${c.prefix}if`) || t?.closestByAttribute(`${c.prefix}fetch`) || t?.closestByAttribute(`${c.prefix}import`) ||
|
|
12154
|
+
if (t?.closestByAttribute(`${c.prefix}derive`) || t?.closestByAttribute(`${c.prefix}derive-name`) || t?.closestByAttribute(`${c.prefix}if`) || t?.closestByAttribute(`${c.prefix}fetch`) || t?.closestByAttribute(`${c.prefix}import`) || f.hasNonEachDynamicElementState(e) || !f.isRowLocalEachTemplate(e))
|
|
11944
12155
|
return !1;
|
|
11945
|
-
const r =
|
|
12156
|
+
const r = f.resolveEachItems(e);
|
|
11946
12157
|
if (r === null)
|
|
11947
12158
|
return !1;
|
|
11948
|
-
const i = e.getAttribute(`${c.prefix}each-key`), n =
|
|
12159
|
+
const i = e.getAttribute(`${c.prefix}each-key`), n = f.createBindingSignature({
|
|
11949
12160
|
key: i ? String(i) : null,
|
|
11950
12161
|
items: r
|
|
11951
12162
|
});
|
|
@@ -11979,7 +12190,7 @@ ${r}
|
|
|
11979
12190
|
return e.setRowLocalTemplate(!1), !1;
|
|
11980
12191
|
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${c.prefix}each-index`);
|
|
11981
12192
|
s && n.add(String(s));
|
|
11982
|
-
const a =
|
|
12193
|
+
const a = f.isRowLocalSubtree(r, n);
|
|
11983
12194
|
return e.setRowLocalTemplate(a), a;
|
|
11984
12195
|
}
|
|
11985
12196
|
/**
|
|
@@ -11993,8 +12204,8 @@ ${r}
|
|
|
11993
12204
|
for (const i of e.getAttributeNames()) {
|
|
11994
12205
|
const n = e.getRawAttribute(i), s = typeof n == "string" ? n : "";
|
|
11995
12206
|
if (s.includes("{{")) {
|
|
11996
|
-
if (!
|
|
11997
|
-
|
|
12207
|
+
if (!f.areExpressionsRowLocal(
|
|
12208
|
+
f.extractInterpolations(s),
|
|
11998
12209
|
t
|
|
11999
12210
|
))
|
|
12000
12211
|
return !1;
|
|
@@ -12003,12 +12214,15 @@ ${r}
|
|
|
12003
12214
|
if (!i.startsWith(c.prefix))
|
|
12004
12215
|
continue;
|
|
12005
12216
|
const a = i.slice(c.prefix.length);
|
|
12006
|
-
if (
|
|
12007
|
-
if (!
|
|
12217
|
+
if (f.ROW_LOCAL_EXPRESSION_ATTRIBUTES.has(a)) {
|
|
12218
|
+
if (!f.areExpressionsRowLocal([s], t))
|
|
12008
12219
|
return !1;
|
|
12009
12220
|
continue;
|
|
12010
12221
|
}
|
|
12011
|
-
if (
|
|
12222
|
+
if (f.ROW_LOCAL_STATIC_ATTRIBUTES.has(a))
|
|
12223
|
+
continue;
|
|
12224
|
+
const o = a.indexOf("-");
|
|
12225
|
+
if (!(o !== -1 && f.ROW_LOCAL_ROW_OPERATIONS.has(a.slice(o + 1))))
|
|
12012
12226
|
return !1;
|
|
12013
12227
|
}
|
|
12014
12228
|
let r = t;
|
|
@@ -12023,12 +12237,12 @@ ${r}
|
|
|
12023
12237
|
}
|
|
12024
12238
|
for (const i of e.getChildren())
|
|
12025
12239
|
if (i instanceof I) {
|
|
12026
|
-
if (!
|
|
12240
|
+
if (!f.isRowLocalSubtree(i, r))
|
|
12027
12241
|
return !1;
|
|
12028
12242
|
} else if (i instanceof ee) {
|
|
12029
12243
|
const n = i.getRawText();
|
|
12030
|
-
if (n.includes("{{") && !
|
|
12031
|
-
|
|
12244
|
+
if (n.includes("{{") && !f.areExpressionsRowLocal(
|
|
12245
|
+
f.extractInterpolations(n),
|
|
12032
12246
|
t
|
|
12033
12247
|
))
|
|
12034
12248
|
return !1;
|
|
@@ -12076,7 +12290,7 @@ ${r}
|
|
|
12076
12290
|
* @returns 省略可能なら true
|
|
12077
12291
|
*/
|
|
12078
12292
|
static canSkipStableDerivedSubtree(e) {
|
|
12079
|
-
return !e.hasAttribute(`${c.prefix}derive`) || e.hasAttribute(`${c.prefix}if`) || e.hasAttribute(`${c.prefix}each`) || e.hasAttribute(`${c.prefix}fetch`) || e.hasAttribute(`${c.prefix}import`) ? !1 : !
|
|
12293
|
+
return !e.hasAttribute(`${c.prefix}derive`) || e.hasAttribute(`${c.prefix}if`) || e.hasAttribute(`${c.prefix}each`) || e.hasAttribute(`${c.prefix}fetch`) || e.hasAttribute(`${c.prefix}import`) ? !1 : !f.hasDisallowedDerivedSubtreeDescendant(e);
|
|
12080
12294
|
}
|
|
12081
12295
|
/**
|
|
12082
12296
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -12085,7 +12299,7 @@ ${r}
|
|
|
12085
12299
|
* @returns 含むなら true
|
|
12086
12300
|
*/
|
|
12087
12301
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12088
|
-
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${c.prefix}derive`) || t.hasAttribute(`${c.prefix}derive-name`) || t.hasAttribute(`${c.prefix}fetch`) || t.hasAttribute(`${c.prefix}import`) ? !0 :
|
|
12302
|
+
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${c.prefix}derive`) || t.hasAttribute(`${c.prefix}derive-name`) || t.hasAttribute(`${c.prefix}fetch`) || t.hasAttribute(`${c.prefix}import`) ? !0 : f.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
12089
12303
|
}
|
|
12090
12304
|
/**
|
|
12091
12305
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -12094,7 +12308,7 @@ ${r}
|
|
|
12094
12308
|
* @returns binding 署名
|
|
12095
12309
|
*/
|
|
12096
12310
|
static createDescendantBindingSignature(e, t) {
|
|
12097
|
-
return
|
|
12311
|
+
return f.recordDerivedSubtreeSignatureComputation(e, t), f.createBindingSignature(e.getDescendantBindingData());
|
|
12098
12312
|
}
|
|
12099
12313
|
/**
|
|
12100
12314
|
* data-derive 実行前の入力署名を返します。
|
|
@@ -12106,7 +12320,7 @@ ${r}
|
|
|
12106
12320
|
*/
|
|
12107
12321
|
static createDeriveInputSignature(e, t, r) {
|
|
12108
12322
|
const i = typeof r == "string" ? r.trim() : "";
|
|
12109
|
-
return !t || i === "" ? null :
|
|
12323
|
+
return !t || i === "" ? null : f.createBindingSignature({
|
|
12110
12324
|
expression: t,
|
|
12111
12325
|
name: i,
|
|
12112
12326
|
scope: e.getBindingData()
|
|
@@ -12118,13 +12332,13 @@ ${r}
|
|
|
12118
12332
|
* @param fragment 対象フラグメント
|
|
12119
12333
|
*/
|
|
12120
12334
|
static refreshDerivedSubtreeSignature(e) {
|
|
12121
|
-
if (!
|
|
12122
|
-
e.setDeriveSubtreeSignature(null),
|
|
12335
|
+
if (!f.canSkipStableDerivedSubtree(e)) {
|
|
12336
|
+
e.setDeriveSubtreeSignature(null), f.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
12123
12337
|
return;
|
|
12124
12338
|
}
|
|
12125
12339
|
e.setDeriveSubtreeSignature(
|
|
12126
|
-
|
|
12127
|
-
),
|
|
12340
|
+
f.createDescendantBindingSignature(e, "refresh")
|
|
12341
|
+
), f.logDerivedSubtreeProfileSnapshot(e, "refresh");
|
|
12128
12342
|
}
|
|
12129
12343
|
/**
|
|
12130
12344
|
* data-derive subtree skip のプロファイルを取得または初期化します。
|
|
@@ -12135,11 +12349,11 @@ ${r}
|
|
|
12135
12349
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
12136
12350
|
if (!j.isEnabled() || !e.hasAttribute(`${c.prefix}derive`))
|
|
12137
12351
|
return null;
|
|
12138
|
-
const t =
|
|
12352
|
+
const t = f.DERIVE_SUBTREE_PROFILES.get(e);
|
|
12139
12353
|
if (t)
|
|
12140
12354
|
return t;
|
|
12141
12355
|
const r = {
|
|
12142
|
-
hostId:
|
|
12356
|
+
hostId: f.createDerivedSubtreeHostId(e),
|
|
12143
12357
|
signatureComputeTotal: 0,
|
|
12144
12358
|
signatureComputeFromEvaluateAll: 0,
|
|
12145
12359
|
signatureComputeFromRefresh: 0,
|
|
@@ -12147,7 +12361,7 @@ ${r}
|
|
|
12147
12361
|
skipMissCount: 0,
|
|
12148
12362
|
skipIneligibleCount: 0
|
|
12149
12363
|
};
|
|
12150
|
-
return
|
|
12364
|
+
return f.DERIVE_SUBTREE_PROFILES.set(e, r), r;
|
|
12151
12365
|
}
|
|
12152
12366
|
/**
|
|
12153
12367
|
* 要素の `id` 属性を安全に取得します。
|
|
@@ -12178,7 +12392,7 @@ ${r}
|
|
|
12178
12392
|
if (!(i instanceof HTMLElement))
|
|
12179
12393
|
break;
|
|
12180
12394
|
let n = i.tagName.toLowerCase();
|
|
12181
|
-
const s =
|
|
12395
|
+
const s = f.resolveElementId(i).trim();
|
|
12182
12396
|
if (s !== "") {
|
|
12183
12397
|
n += `#${s}`, t.unshift(n);
|
|
12184
12398
|
break;
|
|
@@ -12201,7 +12415,7 @@ ${r}
|
|
|
12201
12415
|
* @param source 計算元
|
|
12202
12416
|
*/
|
|
12203
12417
|
static recordDerivedSubtreeSignatureComputation(e, t) {
|
|
12204
|
-
const r =
|
|
12418
|
+
const r = f.getOrCreateDerivedSubtreeProfile(e);
|
|
12205
12419
|
if (r !== null) {
|
|
12206
12420
|
if (r.signatureComputeTotal += 1, t === "refresh") {
|
|
12207
12421
|
r.signatureComputeFromRefresh += 1;
|
|
@@ -12217,7 +12431,7 @@ ${r}
|
|
|
12217
12431
|
* @param reason ログ理由
|
|
12218
12432
|
*/
|
|
12219
12433
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
12220
|
-
const r =
|
|
12434
|
+
const r = f.getOrCreateDerivedSubtreeProfile(e);
|
|
12221
12435
|
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), y.info("[Haori][derive-profile]", {
|
|
12222
12436
|
reason: t,
|
|
12223
12437
|
hostId: r.hostId,
|
|
@@ -12260,7 +12474,7 @@ ${r}
|
|
|
12260
12474
|
* @returns subtree 全体を省略可能なら true
|
|
12261
12475
|
*/
|
|
12262
12476
|
static markFreshInitializationSkippable(e) {
|
|
12263
|
-
const t = e.getAttributeNames().some((n) =>
|
|
12477
|
+
const t = e.getAttributeNames().some((n) => f.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof I ? !f.markFreshInitializationSkippable(n) : n instanceof ee ? n.hasDynamicContent() : !1), i = !t && !r;
|
|
12264
12478
|
return e.setFreshInitializationSkippable(i), i;
|
|
12265
12479
|
}
|
|
12266
12480
|
/**
|
|
@@ -12289,112 +12503,112 @@ ${r}
|
|
|
12289
12503
|
let i = e.getAttribute(`${c.prefix}each-index`);
|
|
12290
12504
|
i && (i = String(i));
|
|
12291
12505
|
const n = e.getAttribute(`${c.prefix}each-key`), s = e.getAttribute(`${c.prefix}each-arg`), a = t.map(
|
|
12292
|
-
(
|
|
12506
|
+
(A, S) => f.createListKey(A, n ? String(n) : null, S)
|
|
12293
12507
|
), o = new Set(a), l = /* @__PURE__ */ new Map();
|
|
12294
|
-
a.forEach((
|
|
12295
|
-
l.set(
|
|
12296
|
-
}), n && o.size !== a.length &&
|
|
12508
|
+
a.forEach((A) => {
|
|
12509
|
+
l.set(A, (l.get(A) ?? 0) + 1);
|
|
12510
|
+
}), n && o.size !== a.length && f.warnDuplicateEachKey(String(n));
|
|
12297
12511
|
const u = [];
|
|
12298
|
-
let d = e.getChildren().filter((
|
|
12299
|
-
(
|
|
12512
|
+
let d = e.getChildren().filter((A) => A instanceof I).filter(
|
|
12513
|
+
(A) => !A.hasAttribute(`${c.prefix}each-before`) && !A.hasAttribute(`${c.prefix}each-after`)
|
|
12300
12514
|
);
|
|
12301
|
-
const p = d.map((
|
|
12302
|
-
d = d.filter((
|
|
12303
|
-
const
|
|
12515
|
+
const p = d.map((A) => A.getListKey()), g = /* @__PURE__ */ new Set();
|
|
12516
|
+
d = d.filter((A, S) => {
|
|
12517
|
+
const C = String(A.getListKey()), V = l.get(C) ?? 0;
|
|
12304
12518
|
if (V === 0) {
|
|
12305
|
-
g.add(
|
|
12306
|
-
const
|
|
12307
|
-
return
|
|
12519
|
+
g.add(A);
|
|
12520
|
+
const L = A.getListKey();
|
|
12521
|
+
return L !== null && U.rowRemove(A.getTarget(), L, S), u.push(A.remove()), !1;
|
|
12308
12522
|
}
|
|
12309
|
-
return l.set(
|
|
12523
|
+
return l.set(C, V - 1), !0;
|
|
12310
12524
|
});
|
|
12311
|
-
const
|
|
12312
|
-
d.forEach((
|
|
12313
|
-
const S =
|
|
12525
|
+
const E = d.map((A) => A.getListKey()), v = /* @__PURE__ */ new Map();
|
|
12526
|
+
d.forEach((A) => {
|
|
12527
|
+
const S = A.getListKey();
|
|
12314
12528
|
if (S === null)
|
|
12315
12529
|
return;
|
|
12316
|
-
const
|
|
12317
|
-
|
|
12530
|
+
const C = v.get(S);
|
|
12531
|
+
C ? C.push(A) : v.set(S, [A]);
|
|
12318
12532
|
});
|
|
12319
|
-
const D = e.getChildElementFragments().filter((
|
|
12320
|
-
(
|
|
12533
|
+
const D = e.getChildElementFragments().filter((A) => !g.has(A)), M = D.filter(
|
|
12534
|
+
(A) => A.hasAttribute(`${c.prefix}each-before`)
|
|
12321
12535
|
).length;
|
|
12322
12536
|
let H = Promise.resolve();
|
|
12323
|
-
return a.forEach((
|
|
12324
|
-
const
|
|
12325
|
-
let
|
|
12326
|
-
const _ = v.get(
|
|
12537
|
+
return a.forEach((A, S) => {
|
|
12538
|
+
const C = t[S], V = S;
|
|
12539
|
+
let L;
|
|
12540
|
+
const _ = v.get(A)?.shift();
|
|
12327
12541
|
if (_) {
|
|
12328
|
-
|
|
12329
|
-
const
|
|
12542
|
+
L = _;
|
|
12543
|
+
const k = M + S;
|
|
12330
12544
|
H = H.then(
|
|
12331
|
-
() =>
|
|
12332
|
-
|
|
12333
|
-
|
|
12545
|
+
() => f.updateRowFragment(
|
|
12546
|
+
L,
|
|
12547
|
+
C,
|
|
12334
12548
|
i,
|
|
12335
12549
|
V,
|
|
12336
12550
|
s ? String(s) : null,
|
|
12337
|
-
|
|
12551
|
+
A
|
|
12338
12552
|
).then(
|
|
12339
12553
|
(q) => (
|
|
12340
12554
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
12341
12555
|
// ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
|
|
12342
12556
|
// される)で DOM の順序が古いまま残る。
|
|
12343
|
-
|
|
12557
|
+
f.repositionEachRow(
|
|
12344
12558
|
e,
|
|
12345
|
-
|
|
12559
|
+
L,
|
|
12346
12560
|
D,
|
|
12347
|
-
|
|
12561
|
+
k
|
|
12348
12562
|
).then((X) => {
|
|
12349
|
-
if (X !== null &&
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
X -
|
|
12563
|
+
if (X !== null && U.rowMove(
|
|
12564
|
+
L.getTarget(),
|
|
12565
|
+
A,
|
|
12566
|
+
X - M,
|
|
12353
12567
|
S
|
|
12354
|
-
),
|
|
12355
|
-
return
|
|
12356
|
-
() =>
|
|
12568
|
+
), !(!q && f.isRowLocalEachTemplate(e)))
|
|
12569
|
+
return f.evaluateAll(L).then(
|
|
12570
|
+
() => f.applyRowFormValues(e, L, C)
|
|
12357
12571
|
);
|
|
12358
12572
|
})
|
|
12359
12573
|
)
|
|
12360
12574
|
)
|
|
12361
12575
|
);
|
|
12362
12576
|
} else {
|
|
12363
|
-
|
|
12364
|
-
const
|
|
12577
|
+
L = r.clone();
|
|
12578
|
+
const k = M + S;
|
|
12365
12579
|
H = H.then(
|
|
12366
|
-
() =>
|
|
12367
|
-
|
|
12368
|
-
|
|
12580
|
+
() => f.updateRowFragment(
|
|
12581
|
+
L,
|
|
12582
|
+
C,
|
|
12369
12583
|
i,
|
|
12370
12584
|
V,
|
|
12371
12585
|
s ? String(s) : null,
|
|
12372
|
-
|
|
12586
|
+
A
|
|
12373
12587
|
).then(() => {
|
|
12374
|
-
const q = D[
|
|
12375
|
-
return e.insertBefore(
|
|
12376
|
-
D.splice(
|
|
12377
|
-
}).then(() =>
|
|
12378
|
-
|
|
12588
|
+
const q = D[k] ?? null;
|
|
12589
|
+
return e.insertBefore(L, q).then(() => {
|
|
12590
|
+
D.splice(k, 0, L);
|
|
12591
|
+
}).then(() => f.initializeFreshEachRow(L)).then(() => f.applyRowFormValues(e, L, C)).then(() => {
|
|
12592
|
+
U.rowAdd(L.getTarget(), A, V, C);
|
|
12379
12593
|
});
|
|
12380
12594
|
})
|
|
12381
12595
|
);
|
|
12382
12596
|
}
|
|
12383
12597
|
}), Promise.all(u).then(() => H).then(() => {
|
|
12384
|
-
const
|
|
12385
|
-
(
|
|
12386
|
-
), S =
|
|
12387
|
-
(
|
|
12388
|
-
),
|
|
12389
|
-
(
|
|
12598
|
+
const A = a.filter(
|
|
12599
|
+
(k) => k !== null
|
|
12600
|
+
), S = E.filter(
|
|
12601
|
+
(k) => k !== null
|
|
12602
|
+
), C = new Set(S), V = A.filter((k) => !C.has(k)), _ = p.filter(
|
|
12603
|
+
(k) => k !== null
|
|
12390
12604
|
).filter(
|
|
12391
|
-
(
|
|
12605
|
+
(k) => !o.has(k)
|
|
12392
12606
|
);
|
|
12393
|
-
|
|
12607
|
+
U.eachUpdate(
|
|
12394
12608
|
e.getTarget(),
|
|
12395
12609
|
V,
|
|
12396
12610
|
_,
|
|
12397
|
-
|
|
12611
|
+
A
|
|
12398
12612
|
);
|
|
12399
12613
|
});
|
|
12400
12614
|
}
|
|
@@ -12410,7 +12624,7 @@ ${r}
|
|
|
12410
12624
|
* @returns 戻り値はありません。
|
|
12411
12625
|
*/
|
|
12412
12626
|
static warnDuplicateEachKey(e) {
|
|
12413
|
-
!j.isEnabled() ||
|
|
12627
|
+
!j.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e), y.warn(
|
|
12414
12628
|
"[Haori]",
|
|
12415
12629
|
`${c.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
12416
12630
|
));
|
|
@@ -12512,7 +12726,7 @@ ${r}
|
|
|
12512
12726
|
`Primitive value requires '${c.prefix}each-arg' attribute: ${t}`
|
|
12513
12727
|
), Promise.resolve(!1);
|
|
12514
12728
|
r && (a[r] = i);
|
|
12515
|
-
const o = a, l =
|
|
12729
|
+
const o = a, l = f.createBindingSignature({
|
|
12516
12730
|
listKey: s,
|
|
12517
12731
|
bindingData: o
|
|
12518
12732
|
});
|
|
@@ -12530,7 +12744,7 @@ ${r}
|
|
|
12530
12744
|
const r = t.pop();
|
|
12531
12745
|
if (r.getChildElementFragments().forEach((i) => {
|
|
12532
12746
|
t.push(i);
|
|
12533
|
-
}), r !== e && !r.isMounted() &&
|
|
12747
|
+
}), r !== e && !r.isMounted() && f.hasMountSensitiveAttribute(r))
|
|
12534
12748
|
return !0;
|
|
12535
12749
|
}
|
|
12536
12750
|
return !1;
|
|
@@ -12577,7 +12791,7 @@ ${r}
|
|
|
12577
12791
|
if (t.has(e))
|
|
12578
12792
|
return `[Circular:${t.get(e)}]`;
|
|
12579
12793
|
const i = `array-${r.value}`;
|
|
12580
|
-
return r.value += 1, t.set(e, i), `[${e.map((n) =>
|
|
12794
|
+
return r.value += 1, t.set(e, i), `[${e.map((n) => f.createBindingSignature(n, t, r)).join(",")}]`;
|
|
12581
12795
|
}
|
|
12582
12796
|
if (typeof e == "object") {
|
|
12583
12797
|
if (t.has(e))
|
|
@@ -12586,7 +12800,7 @@ ${r}
|
|
|
12586
12800
|
r.value += 1, t.set(e, i);
|
|
12587
12801
|
const n = e;
|
|
12588
12802
|
return `{${Object.keys(n).sort().map(
|
|
12589
|
-
(s) => `${JSON.stringify(s)}:${
|
|
12803
|
+
(s) => `${JSON.stringify(s)}:${f.createBindingSignature(
|
|
12590
12804
|
n[s],
|
|
12591
12805
|
t,
|
|
12592
12806
|
r
|
|
@@ -12602,11 +12816,11 @@ ${r}
|
|
|
12602
12816
|
*/
|
|
12603
12817
|
static scheduleEvaluateAll(e) {
|
|
12604
12818
|
setTimeout(() => {
|
|
12605
|
-
|
|
12819
|
+
f.evaluateAll(e);
|
|
12606
12820
|
}, 100);
|
|
12607
12821
|
}
|
|
12608
12822
|
};
|
|
12609
|
-
|
|
12823
|
+
f.ATTRIBUTE_ALIAS_SUFFIX = "attr-", f.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
12610
12824
|
"bind",
|
|
12611
12825
|
// `store` は `bind`(既定値)の後、`url-param` の前に置く。URL クエリで明示
|
|
12612
12826
|
// された値を保存済みの値より優先するため。
|
|
@@ -12616,7 +12830,7 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
12616
12830
|
"derive",
|
|
12617
12831
|
"if",
|
|
12618
12832
|
"each"
|
|
12619
|
-
],
|
|
12833
|
+
], f.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
|
|
12620
12834
|
"bind",
|
|
12621
12835
|
"derive",
|
|
12622
12836
|
"derive-name",
|
|
@@ -12629,7 +12843,7 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
12629
12843
|
// 条件は評価結果を DOM 属性へ書かない(式は実行時に生値から評価する)。
|
|
12630
12844
|
"validity",
|
|
12631
12845
|
"validity-message"
|
|
12632
|
-
],
|
|
12846
|
+
], f.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, f.ROW_LOCAL_EXPRESSION_ATTRIBUTES = /* @__PURE__ */ new Set(["each", "if", "derive"]), f.ROW_LOCAL_STATIC_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
12633
12847
|
"each-arg",
|
|
12634
12848
|
"each-key",
|
|
12635
12849
|
"each-index",
|
|
@@ -12649,8 +12863,8 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
12649
12863
|
"store-type",
|
|
12650
12864
|
"enhance",
|
|
12651
12865
|
"enhance-new"
|
|
12652
|
-
]),
|
|
12653
|
-
let B =
|
|
12866
|
+
]), f.ROW_LOCAL_ROW_OPERATIONS = /* @__PURE__ */ new Set(["row-add", "row-remove", "row-prev", "row-next"]), f.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), f.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), f.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), f.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap(), f.EACH_RENDERED_CHANGE_FIRED = /* @__PURE__ */ new WeakSet(), f.EACH_RENDERED_CHANGE_WARNED = /* @__PURE__ */ new WeakSet(), f.WARNED_DUPLICATE_EACH_KEYS = /* @__PURE__ */ new Set(), f.ABSENT_PATH = Symbol("absent");
|
|
12867
|
+
let B = f;
|
|
12654
12868
|
const me = class me {
|
|
12655
12869
|
/**
|
|
12656
12870
|
* コンストラクタ。
|
|
@@ -12675,7 +12889,7 @@ const me = class me {
|
|
|
12675
12889
|
* @returns 戻り値はない。
|
|
12676
12890
|
*/
|
|
12677
12891
|
runWindowLoadProcedure() {
|
|
12678
|
-
const e = document.documentElement, t =
|
|
12892
|
+
const e = document.documentElement, t = x.get(e);
|
|
12679
12893
|
t && new re(t, "load").run();
|
|
12680
12894
|
}
|
|
12681
12895
|
/**
|
|
@@ -12799,7 +13013,7 @@ const me = class me {
|
|
|
12799
13013
|
this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
|
|
12800
13014
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
12801
13015
|
return;
|
|
12802
|
-
const n =
|
|
13016
|
+
const n = x.get(i);
|
|
12803
13017
|
n instanceof I && new re(n, "on", t).run().catch((s) => {
|
|
12804
13018
|
y.error("[Haori]", "Procedure execution error:", s);
|
|
12805
13019
|
});
|
|
@@ -12863,7 +13077,7 @@ const me = class me {
|
|
|
12863
13077
|
* @returns 戻り値はない。
|
|
12864
13078
|
*/
|
|
12865
13079
|
runProcedureFor(e, t, r) {
|
|
12866
|
-
const i =
|
|
13080
|
+
const i = x.get(e);
|
|
12867
13081
|
if (!i)
|
|
12868
13082
|
return;
|
|
12869
13083
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
@@ -12920,7 +13134,7 @@ const me = class me {
|
|
|
12920
13134
|
* @returns 戻り値はない。
|
|
12921
13135
|
*/
|
|
12922
13136
|
markUserEditOnly(e) {
|
|
12923
|
-
const t =
|
|
13137
|
+
const t = x.get(e);
|
|
12924
13138
|
t instanceof I && t.markUserEdit();
|
|
12925
13139
|
}
|
|
12926
13140
|
/**
|
|
@@ -12936,13 +13150,13 @@ const me = class me {
|
|
|
12936
13150
|
* @returns 戻り値はない。
|
|
12937
13151
|
*/
|
|
12938
13152
|
syncUserEdit(e, t) {
|
|
12939
|
-
const r =
|
|
13153
|
+
const r = x.get(e);
|
|
12940
13154
|
if (r instanceof I && (r.syncValue(), t ? r.markUserEditOnChange() : r.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
12941
13155
|
const i = document.getElementsByName(e.name);
|
|
12942
13156
|
for (const n of Array.from(i)) {
|
|
12943
13157
|
if (n === e || !(n instanceof HTMLInputElement) || n.type !== "radio" || n.form !== e.form)
|
|
12944
13158
|
continue;
|
|
12945
|
-
const s =
|
|
13159
|
+
const s = x.get(n);
|
|
12946
13160
|
s instanceof I && (s.syncValue(), s.markUserEdit());
|
|
12947
13161
|
}
|
|
12948
13162
|
}
|
|
@@ -13016,7 +13230,7 @@ const W = class W {
|
|
|
13016
13230
|
}));
|
|
13017
13231
|
}
|
|
13018
13232
|
static syncElement(e) {
|
|
13019
|
-
const t = W.registrations.get(e), r =
|
|
13233
|
+
const t = W.registrations.get(e), r = x.get(e);
|
|
13020
13234
|
if (!r || !W.shouldObserve(r)) {
|
|
13021
13235
|
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13022
13236
|
return;
|
|
@@ -13150,7 +13364,7 @@ const w = class w {
|
|
|
13150
13364
|
const t = w.registrations.get(e);
|
|
13151
13365
|
if (!t && !w.hasPollAttribute(e))
|
|
13152
13366
|
return;
|
|
13153
|
-
const r =
|
|
13367
|
+
const r = x.get(e);
|
|
13154
13368
|
if (!(r instanceof I) || !w.shouldObserve(r)) {
|
|
13155
13369
|
t && w.teardown(e, t);
|
|
13156
13370
|
return;
|
|
@@ -13359,7 +13573,7 @@ const w = class w {
|
|
|
13359
13573
|
*/
|
|
13360
13574
|
static async handleTimeout(e) {
|
|
13361
13575
|
const t = w.registrations.get(e);
|
|
13362
|
-
!t || t.stopped || (t.timeoutTimerId = null, t.timedOut = !0, e.isConnected &&
|
|
13576
|
+
!t || t.stopped || (t.timeoutTimerId = null, t.timedOut = !0, e.isConnected && U.pollTimeout(
|
|
13363
13577
|
e,
|
|
13364
13578
|
t.count,
|
|
13365
13579
|
w.elapsed(t)
|
|
@@ -13379,7 +13593,7 @@ const w = class w {
|
|
|
13379
13593
|
w.registrations.delete(e);
|
|
13380
13594
|
return;
|
|
13381
13595
|
}
|
|
13382
|
-
await w.injectState(t), e.isConnected &&
|
|
13596
|
+
await w.injectState(t), e.isConnected && U.pollStop(
|
|
13383
13597
|
e,
|
|
13384
13598
|
r,
|
|
13385
13599
|
t.count,
|
|
@@ -13520,7 +13734,7 @@ const w = class w {
|
|
|
13520
13734
|
return n.forEach((a) => {
|
|
13521
13735
|
if (!a.isConnected)
|
|
13522
13736
|
return;
|
|
13523
|
-
const o =
|
|
13737
|
+
const o = x.get(a);
|
|
13524
13738
|
o instanceof I && s.push(o);
|
|
13525
13739
|
}), s;
|
|
13526
13740
|
}
|
|
@@ -13669,11 +13883,11 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
13669
13883
|
"state"
|
|
13670
13884
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
13671
13885
|
let pe = w;
|
|
13672
|
-
const Vt = "0.
|
|
13886
|
+
const Vt = "0.46.0";
|
|
13673
13887
|
function qt(m) {
|
|
13674
13888
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => m()) : Promise.resolve().then(m);
|
|
13675
13889
|
}
|
|
13676
|
-
const
|
|
13890
|
+
const O = class O {
|
|
13677
13891
|
/**
|
|
13678
13892
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
13679
13893
|
*
|
|
@@ -13692,8 +13906,8 @@ const L = class L {
|
|
|
13692
13906
|
* @param root 走査の起点ノード
|
|
13693
13907
|
*/
|
|
13694
13908
|
static syncTree(e) {
|
|
13695
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
13696
|
-
|
|
13909
|
+
(e instanceof Element || e instanceof DocumentFragment) && (O.isHtmlElement(e) && O.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
13910
|
+
O.syncElement(t);
|
|
13697
13911
|
}));
|
|
13698
13912
|
}
|
|
13699
13913
|
/**
|
|
@@ -13703,42 +13917,42 @@ const L = class L {
|
|
|
13703
13917
|
* @param element 対象要素
|
|
13704
13918
|
*/
|
|
13705
13919
|
static syncElement(e) {
|
|
13706
|
-
const t =
|
|
13707
|
-
if (!(r instanceof I) || !
|
|
13708
|
-
t && (t.observer.disconnect(),
|
|
13920
|
+
const t = O.registrations.get(e), r = x.get(e);
|
|
13921
|
+
if (!(r instanceof I) || !O.shouldObserve(r)) {
|
|
13922
|
+
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
13709
13923
|
return;
|
|
13710
13924
|
}
|
|
13711
13925
|
if (typeof IntersectionObserver > "u")
|
|
13712
13926
|
return;
|
|
13713
|
-
const i =
|
|
13927
|
+
const i = O.resolveVarName(r);
|
|
13714
13928
|
if (i === "") {
|
|
13715
|
-
t && (t.observer.disconnect(),
|
|
13929
|
+
t && (t.observer.disconnect(), O.registrations.delete(e)), y.warn(
|
|
13716
13930
|
"[Haori]",
|
|
13717
13931
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
13718
13932
|
);
|
|
13719
13933
|
return;
|
|
13720
13934
|
}
|
|
13721
|
-
const n =
|
|
13935
|
+
const n = O.resolveRoot(r), s = O.resolveRootMargin(r);
|
|
13722
13936
|
if (t && t.observer.root === n && t.observer.rootMargin === s && t.varName === i) {
|
|
13723
|
-
t.fragment = r,
|
|
13937
|
+
t.fragment = r, O.refreshRows(t);
|
|
13724
13938
|
return;
|
|
13725
13939
|
}
|
|
13726
|
-
t && (t.observer.disconnect(),
|
|
13940
|
+
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
13727
13941
|
const a = new IntersectionObserver(
|
|
13728
13942
|
(l) => {
|
|
13729
|
-
const u =
|
|
13943
|
+
const u = O.registrations.get(e);
|
|
13730
13944
|
if (!u)
|
|
13731
13945
|
return;
|
|
13732
13946
|
let d = !1;
|
|
13733
13947
|
l.forEach((p) => {
|
|
13734
13948
|
const g = p.target;
|
|
13735
13949
|
u.observedRows.has(g) && (p.isIntersecting ? u.visibleRows.has(g) || (u.visibleRows.add(g), d = !0) : u.visibleRows.delete(g) && (d = !0));
|
|
13736
|
-
}), d &&
|
|
13950
|
+
}), d && O.scheduleCompute(u);
|
|
13737
13951
|
},
|
|
13738
13952
|
{
|
|
13739
13953
|
root: n,
|
|
13740
13954
|
rootMargin: s,
|
|
13741
|
-
threshold:
|
|
13955
|
+
threshold: O.THRESHOLD
|
|
13742
13956
|
}
|
|
13743
13957
|
), o = {
|
|
13744
13958
|
fragment: r,
|
|
@@ -13751,7 +13965,7 @@ const L = class L {
|
|
|
13751
13965
|
scheduled: !1,
|
|
13752
13966
|
lastSnapshot: null
|
|
13753
13967
|
};
|
|
13754
|
-
|
|
13968
|
+
O.registrations.set(e, o), O.refreshRows(o);
|
|
13755
13969
|
}
|
|
13756
13970
|
/**
|
|
13757
13971
|
* 指定ノード配下の監視登録を解放します。
|
|
@@ -13759,22 +13973,22 @@ const L = class L {
|
|
|
13759
13973
|
* @param root 走査の起点ノード
|
|
13760
13974
|
*/
|
|
13761
13975
|
static cleanupTree(e) {
|
|
13762
|
-
if (
|
|
13763
|
-
const t =
|
|
13764
|
-
t && (t.observer.disconnect(),
|
|
13976
|
+
if (O.isHtmlElement(e)) {
|
|
13977
|
+
const t = O.registrations.get(e);
|
|
13978
|
+
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
13765
13979
|
}
|
|
13766
13980
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
13767
|
-
const r =
|
|
13768
|
-
r && (r.observer.disconnect(),
|
|
13981
|
+
const r = O.registrations.get(t);
|
|
13982
|
+
r && (r.observer.disconnect(), O.registrations.delete(t));
|
|
13769
13983
|
});
|
|
13770
13984
|
}
|
|
13771
13985
|
/**
|
|
13772
13986
|
* すべての監視登録を解放します。
|
|
13773
13987
|
*/
|
|
13774
13988
|
static disconnectAll() {
|
|
13775
|
-
|
|
13989
|
+
O.registrations.forEach((e) => {
|
|
13776
13990
|
e.observer.disconnect();
|
|
13777
|
-
}),
|
|
13991
|
+
}), O.registrations.clear();
|
|
13778
13992
|
}
|
|
13779
13993
|
/**
|
|
13780
13994
|
* 監視対象(`data-each` かつ `data-each-visible`)かどうかを判定します。
|
|
@@ -13809,7 +14023,7 @@ const L = class L {
|
|
|
13809
14023
|
if (typeof r != "string" || r.trim() === "")
|
|
13810
14024
|
return null;
|
|
13811
14025
|
const i = z.query(r, t, document);
|
|
13812
|
-
return
|
|
14026
|
+
return O.isHtmlElement(i) ? i : (y.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
13813
14027
|
}
|
|
13814
14028
|
/**
|
|
13815
14029
|
* rootMargin を解決します。
|
|
@@ -13819,7 +14033,7 @@ const L = class L {
|
|
|
13819
14033
|
*/
|
|
13820
14034
|
static resolveRootMargin(e) {
|
|
13821
14035
|
const t = `${c.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
13822
|
-
return r === null || r === !1 || r === "" ?
|
|
14036
|
+
return r === null || r === !1 || r === "" ? O.DEFAULT_ROOT_MARGIN : String(r);
|
|
13823
14037
|
}
|
|
13824
14038
|
/**
|
|
13825
14039
|
* コンテナ直下の実際の行要素(`each-before`/`each-after` を除く)を描画順で返します。
|
|
@@ -13839,12 +14053,12 @@ const L = class L {
|
|
|
13839
14053
|
* @param registration 対象の登録
|
|
13840
14054
|
*/
|
|
13841
14055
|
static refreshRows(e) {
|
|
13842
|
-
const t =
|
|
14056
|
+
const t = O.realRowElements(e.fragment), r = new Set(t);
|
|
13843
14057
|
for (const i of [...e.observedRows])
|
|
13844
14058
|
r.has(i) || (e.observer.unobserve(i), e.observedRows.delete(i), e.visibleRows.delete(i));
|
|
13845
14059
|
for (const i of t)
|
|
13846
14060
|
e.observedRows.has(i) || (e.observer.observe(i), e.observedRows.add(i));
|
|
13847
|
-
|
|
14061
|
+
O.scheduleCompute(e);
|
|
13848
14062
|
}
|
|
13849
14063
|
/**
|
|
13850
14064
|
* 次フレームでの集計・公開を予約します(多発する交差イベントを 1 回にまとめる)。
|
|
@@ -13855,7 +14069,7 @@ const L = class L {
|
|
|
13855
14069
|
e.scheduled || (e.scheduled = !0, qt(() => {
|
|
13856
14070
|
e.scheduled = !1;
|
|
13857
14071
|
const t = e.fragment.getTarget();
|
|
13858
|
-
|
|
14072
|
+
O.registrations.get(t) === e && O.computeAndPublish(e);
|
|
13859
14073
|
}));
|
|
13860
14074
|
}
|
|
13861
14075
|
/**
|
|
@@ -13864,7 +14078,7 @@ const L = class L {
|
|
|
13864
14078
|
* @param registration 対象の登録
|
|
13865
14079
|
*/
|
|
13866
14080
|
static computeAndPublish(e) {
|
|
13867
|
-
const t =
|
|
14081
|
+
const t = O.realRowElements(e.fragment), r = /* @__PURE__ */ new Map();
|
|
13868
14082
|
t.forEach((a, o) => r.set(a, o));
|
|
13869
14083
|
const i = [];
|
|
13870
14084
|
for (const a of e.visibleRows) {
|
|
@@ -13897,7 +14111,7 @@ const L = class L {
|
|
|
13897
14111
|
};
|
|
13898
14112
|
}
|
|
13899
14113
|
const s = JSON.stringify(n);
|
|
13900
|
-
s !== e.lastSnapshot && (e.lastSnapshot = s,
|
|
14114
|
+
s !== e.lastSnapshot && (e.lastSnapshot = s, O.publish(e, n));
|
|
13901
14115
|
}
|
|
13902
14116
|
/**
|
|
13903
14117
|
* 可視範囲スナップショットを最近接の上位 `data-bind` スコープへ公開します。
|
|
@@ -13906,7 +14120,7 @@ const L = class L {
|
|
|
13906
14120
|
* @param snapshot 公開するスナップショット
|
|
13907
14121
|
*/
|
|
13908
14122
|
static publish(e, t) {
|
|
13909
|
-
const r =
|
|
14123
|
+
const r = O.resolveBindOwner(e.fragment);
|
|
13910
14124
|
if (!r) {
|
|
13911
14125
|
y.warn(
|
|
13912
14126
|
"[Haori]",
|
|
@@ -13948,8 +14162,8 @@ const L = class L {
|
|
|
13948
14162
|
return e.hasAttribute(t) ? e : null;
|
|
13949
14163
|
}
|
|
13950
14164
|
};
|
|
13951
|
-
|
|
13952
|
-
let oe =
|
|
14165
|
+
O.THRESHOLD = 0, O.DEFAULT_ROOT_MARGIN = "0px", O.registrations = /* @__PURE__ */ new Map();
|
|
14166
|
+
let oe = O;
|
|
13953
14167
|
const G = class G {
|
|
13954
14168
|
/**
|
|
13955
14169
|
* 既存の MutationObserver をすべて停止します。
|
|
@@ -13988,7 +14202,7 @@ const G = class G {
|
|
|
13988
14202
|
} finally {
|
|
13989
14203
|
e.release();
|
|
13990
14204
|
}
|
|
13991
|
-
|
|
14205
|
+
U.ready(Vt);
|
|
13992
14206
|
}
|
|
13993
14207
|
/**
|
|
13994
14208
|
* 稼働中の EventDispatcher を返します。
|
|
@@ -14126,15 +14340,15 @@ const G = class G {
|
|
|
14126
14340
|
}
|
|
14127
14341
|
};
|
|
14128
14342
|
G._initialized = !1, G._mutationObservers = [], G._dispatcher = null;
|
|
14129
|
-
let
|
|
14130
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
14343
|
+
let xe = G;
|
|
14344
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", xe.init) : xe.init();
|
|
14131
14345
|
const Wt = () => ye.waitForRenders(), jt = ye.enhancers;
|
|
14132
14346
|
export {
|
|
14133
14347
|
B as Core,
|
|
14134
14348
|
ie as Enhance,
|
|
14135
14349
|
c as Env,
|
|
14136
14350
|
F as Form,
|
|
14137
|
-
|
|
14351
|
+
x as Fragment,
|
|
14138
14352
|
ye as Haori,
|
|
14139
14353
|
y as Log,
|
|
14140
14354
|
K as Queue,
|