haori 0.46.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +18 -18
- package/dist/haori.es.js +816 -759
- package/dist/haori.iife.js +19 -19
- package/dist/index.d.ts +25 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -31,11 +31,11 @@ const le = class le {
|
|
|
31
31
|
le.devMode = !1;
|
|
32
32
|
let j = le;
|
|
33
33
|
const Le = "embedded";
|
|
34
|
-
function Je(
|
|
35
|
-
return
|
|
34
|
+
function Je(y) {
|
|
35
|
+
return y === "embedded" || y === "demo";
|
|
36
36
|
}
|
|
37
|
-
function mt(
|
|
38
|
-
return
|
|
37
|
+
function mt(y) {
|
|
38
|
+
return y === null ? null : Je(y) ? y : Le;
|
|
39
39
|
}
|
|
40
40
|
const J = class J {
|
|
41
41
|
/**
|
|
@@ -118,9 +118,9 @@ const J = class J {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
J._prefix = "data-", J._runtime = Le, J._strictBind = !1;
|
|
121
|
-
let
|
|
122
|
-
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
123
|
-
class
|
|
121
|
+
let l = J;
|
|
122
|
+
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect());
|
|
123
|
+
class m {
|
|
124
124
|
/**
|
|
125
125
|
* 開発モードでのみコンソールに情報を出力します。
|
|
126
126
|
*
|
|
@@ -163,11 +163,11 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
163
163
|
static register(e, t) {
|
|
164
164
|
const r = typeof e == "string" ? e.trim() : "";
|
|
165
165
|
if (r === "") {
|
|
166
|
-
|
|
166
|
+
m.error("[Haori]", "Enhancer name is required.");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
if (!t || typeof t.init != "function") {
|
|
170
|
-
|
|
170
|
+
m.error("[Haori]", `Enhancer "${r}" must have an init function.`);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
$.enhancers.set(r, t), $.warnedUnknownNames.delete(r), typeof document < "u" && document.body && $.applySubtree(document.body);
|
|
@@ -231,7 +231,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
231
231
|
static forEachTarget(e, t) {
|
|
232
232
|
if (!e || typeof e.querySelectorAll != "function")
|
|
233
233
|
return;
|
|
234
|
-
const r = `[${
|
|
234
|
+
const r = `[${l.prefix}enhance],[${l.prefix}enhance-new]`;
|
|
235
235
|
typeof e.matches == "function" && e.matches(r) && t(e), e.querySelectorAll(r).forEach((i) => {
|
|
236
236
|
t(i);
|
|
237
237
|
});
|
|
@@ -244,7 +244,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
244
244
|
*/
|
|
245
245
|
static applyElement(e) {
|
|
246
246
|
const t = $.instances.get(e) ?? null;
|
|
247
|
-
$.names(e, `${
|
|
247
|
+
$.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
248
248
|
if (t?.has(r))
|
|
249
249
|
return;
|
|
250
250
|
const i = $.enhancers.get(r);
|
|
@@ -256,7 +256,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
256
256
|
const n = i.init(e);
|
|
257
257
|
$.appliedKeys(e).set(r, n);
|
|
258
258
|
});
|
|
259
|
-
}), $.names(e, `${
|
|
259
|
+
}), $.names(e, `${l.prefix}enhance-new`).forEach((r) => {
|
|
260
260
|
const i = `${je}${r}`;
|
|
261
261
|
if ($.instances.get(e)?.has(i))
|
|
262
262
|
return;
|
|
@@ -275,7 +275,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
275
275
|
*/
|
|
276
276
|
static refreshElement(e) {
|
|
277
277
|
const t = $.instances.get(e);
|
|
278
|
-
$.names(e, `${
|
|
278
|
+
$.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
279
279
|
if (!t || !t.has(r))
|
|
280
280
|
return;
|
|
281
281
|
const i = $.enhancers.get(r);
|
|
@@ -340,9 +340,9 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
340
340
|
*/
|
|
341
341
|
static resolveGlobal(e) {
|
|
342
342
|
if (!yt.test(e))
|
|
343
|
-
return
|
|
343
|
+
return m.error(
|
|
344
344
|
"[Haori]",
|
|
345
|
-
`${
|
|
345
|
+
`${l.prefix}enhance-new accepts a dot-separated global reference only: ${e}`
|
|
346
346
|
), null;
|
|
347
347
|
let t = globalThis;
|
|
348
348
|
for (const r of e.split(".")) {
|
|
@@ -353,9 +353,9 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
353
353
|
if (t = t[r], t === void 0)
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
|
-
return typeof t != "function" ? (j.isEnabled() && !$.warnedMissingGlobals.has(e) && ($.warnedMissingGlobals.add(e),
|
|
356
|
+
return typeof t != "function" ? (j.isEnabled() && !$.warnedMissingGlobals.has(e) && ($.warnedMissingGlobals.add(e), m.warn(
|
|
357
357
|
"[Haori]",
|
|
358
|
-
`${
|
|
358
|
+
`${l.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
359
359
|
)), null) : t;
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
@@ -365,7 +365,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
365
365
|
* @returns 戻り値はありません。
|
|
366
366
|
*/
|
|
367
367
|
static warnUnknownName(e) {
|
|
368
|
-
!j.isEnabled() || $.warnedUnknownNames.has(e) || ($.warnedUnknownNames.add(e),
|
|
368
|
+
!j.isEnabled() || $.warnedUnknownNames.has(e) || ($.warnedUnknownNames.add(e), m.warn(
|
|
369
369
|
"[Haori]",
|
|
370
370
|
`Enhancer "${e}" is not registered yet; the declaration is kept pending and applied when it is registered (Haori.enhancers.register('${e}', {init(el) {...}})).`
|
|
371
371
|
));
|
|
@@ -383,20 +383,20 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
383
383
|
try {
|
|
384
384
|
t();
|
|
385
385
|
} catch (r) {
|
|
386
|
-
|
|
386
|
+
m.error("[Haori]", `${e} failed:`, r);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
$.enhancers = /* @__PURE__ */ new Map(), $.instances = /* @__PURE__ */ new WeakMap(), $.warnedUnknownNames = /* @__PURE__ */ new Set(), $.warnedMissingGlobals = /* @__PURE__ */ new Set();
|
|
391
391
|
let ie = $;
|
|
392
392
|
const Ze = "yyyy/MM/dd HH:mm", bt = "en-US", Ke = 1e4;
|
|
393
|
-
function ne(
|
|
394
|
-
return String(
|
|
393
|
+
function ne(y) {
|
|
394
|
+
return String(y).padStart(2, "0");
|
|
395
395
|
}
|
|
396
|
-
function Qe(
|
|
396
|
+
function Qe(y, e, t, r, i, n) {
|
|
397
397
|
return {
|
|
398
|
-
yyyy: String(
|
|
399
|
-
yy: ne(
|
|
398
|
+
yyyy: String(y).padStart(4, "0"),
|
|
399
|
+
yy: ne(y % 100),
|
|
400
400
|
MM: ne(e),
|
|
401
401
|
M: String(e),
|
|
402
402
|
dd: ne(t),
|
|
@@ -407,7 +407,7 @@ function Qe(m, e, t, r, i, n) {
|
|
|
407
407
|
ss: ne(n)
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
function _e(
|
|
410
|
+
function _e(y, e) {
|
|
411
411
|
let t;
|
|
412
412
|
try {
|
|
413
413
|
t = new Intl.DateTimeFormat("en-US", {
|
|
@@ -419,20 +419,20 @@ function _e(m, e) {
|
|
|
419
419
|
hour: "2-digit",
|
|
420
420
|
minute: "2-digit",
|
|
421
421
|
second: "2-digit"
|
|
422
|
-
}).formatToParts(
|
|
422
|
+
}).formatToParts(y);
|
|
423
423
|
} catch {
|
|
424
424
|
return null;
|
|
425
425
|
}
|
|
426
426
|
const r = {};
|
|
427
427
|
for (const u of t)
|
|
428
428
|
u.type !== "literal" && (r[u.type] = u.value);
|
|
429
|
-
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute),
|
|
430
|
-
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(
|
|
429
|
+
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), c = Number(r.second);
|
|
430
|
+
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : Qe(i, n, s, a, o, c);
|
|
431
431
|
}
|
|
432
|
-
function Ce(
|
|
433
|
-
if (
|
|
432
|
+
function Ce(y, e = Ze, t) {
|
|
433
|
+
if (y == null || y === "")
|
|
434
434
|
return "";
|
|
435
|
-
const r =
|
|
435
|
+
const r = y instanceof Date ? y : new Date(y);
|
|
436
436
|
if (Number.isNaN(r.getTime()))
|
|
437
437
|
return "";
|
|
438
438
|
let i;
|
|
@@ -455,32 +455,32 @@ function Ce(m, e = Ze, t) {
|
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
457
|
const Et = "yyyy-MM-dd";
|
|
458
|
-
function et(
|
|
459
|
-
return Ce(/* @__PURE__ */ new Date(),
|
|
458
|
+
function et(y = Ze, e) {
|
|
459
|
+
return Ce(/* @__PURE__ */ new Date(), y, e);
|
|
460
460
|
}
|
|
461
|
-
function tt(
|
|
462
|
-
const r = Number.isFinite(
|
|
461
|
+
function tt(y = 0, e = Et, t) {
|
|
462
|
+
const r = Number.isFinite(y) ? Math.trunc(y) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
463
463
|
let n, s, a;
|
|
464
464
|
if (i !== "") {
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
465
|
+
const c = _e(/* @__PURE__ */ new Date(), i);
|
|
466
|
+
if (c === null)
|
|
467
467
|
return "";
|
|
468
|
-
n = Number(
|
|
468
|
+
n = Number(c.yyyy), s = Number(c.MM), a = Number(c.dd);
|
|
469
469
|
} else {
|
|
470
|
-
const
|
|
471
|
-
n =
|
|
470
|
+
const c = /* @__PURE__ */ new Date();
|
|
471
|
+
n = c.getFullYear(), s = c.getMonth() + 1, a = c.getDate();
|
|
472
472
|
}
|
|
473
473
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
474
474
|
return Ce(o, e, "UTC");
|
|
475
475
|
}
|
|
476
|
-
function rt(
|
|
477
|
-
if (
|
|
476
|
+
function rt(y, e) {
|
|
477
|
+
if (y == null)
|
|
478
478
|
return "";
|
|
479
479
|
let t;
|
|
480
|
-
if (typeof
|
|
481
|
-
t =
|
|
480
|
+
if (typeof y == "number")
|
|
481
|
+
t = y;
|
|
482
482
|
else {
|
|
483
|
-
const i = String(
|
|
483
|
+
const i = String(y).trim();
|
|
484
484
|
if (i === "")
|
|
485
485
|
return "";
|
|
486
486
|
t = Number(i);
|
|
@@ -494,9 +494,9 @@ function rt(m, e) {
|
|
|
494
494
|
}
|
|
495
495
|
return new Intl.NumberFormat(bt, r).format(t);
|
|
496
496
|
}
|
|
497
|
-
function it(
|
|
497
|
+
function it(y, e, t) {
|
|
498
498
|
let r, i, n;
|
|
499
|
-
if (e === void 0 ? (r = 0, i =
|
|
499
|
+
if (e === void 0 ? (r = 0, i = y, n = 1) : (r = y, i = e, n = t === void 0 ? 1 : t), !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(n) || n === 0)
|
|
500
500
|
return [];
|
|
501
501
|
r = Math.trunc(r), i = Math.trunc(i), n = Math.trunc(n);
|
|
502
502
|
const s = [];
|
|
@@ -508,8 +508,8 @@ function it(m, e, t) {
|
|
|
508
508
|
s.push(a);
|
|
509
509
|
return s;
|
|
510
510
|
}
|
|
511
|
-
function nt(
|
|
512
|
-
const r = Math.trunc(Number(
|
|
511
|
+
function nt(y, e, t = {}) {
|
|
512
|
+
const r = Math.trunc(Number(y));
|
|
513
513
|
if (!Number.isFinite(r) || r <= 0)
|
|
514
514
|
return [];
|
|
515
515
|
const i = Math.min(
|
|
@@ -522,38 +522,38 @@ function nt(m, e, t = {}) {
|
|
|
522
522
|
a.add(d);
|
|
523
523
|
for (let d = Math.max(0, i - n); d <= Math.min(r - 1, i + n); d += 1)
|
|
524
524
|
a.add(d);
|
|
525
|
-
const o = Array.from(a).sort((d, p) => d - p),
|
|
525
|
+
const o = Array.from(a).sort((d, p) => d - p), c = [];
|
|
526
526
|
let u = null;
|
|
527
527
|
for (const d of o) {
|
|
528
528
|
if (u !== null && d - u > 1)
|
|
529
529
|
if (d - u === 2) {
|
|
530
530
|
const p = u + 1;
|
|
531
|
-
|
|
531
|
+
c.push({
|
|
532
532
|
page: p,
|
|
533
533
|
label: p + 1,
|
|
534
534
|
active: p === i,
|
|
535
535
|
ellipsis: !1
|
|
536
536
|
});
|
|
537
537
|
} else
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
c.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
539
|
+
c.push({
|
|
540
540
|
page: d,
|
|
541
541
|
label: d + 1,
|
|
542
542
|
active: d === i,
|
|
543
543
|
ellipsis: !1
|
|
544
544
|
}), u = d;
|
|
545
545
|
}
|
|
546
|
-
return
|
|
546
|
+
return c;
|
|
547
547
|
}
|
|
548
548
|
const At = /^(\d{4})-(\d{1,2})$/, vt = 1200;
|
|
549
|
-
function Te(
|
|
550
|
-
const t = Number(
|
|
549
|
+
function Te(y, e) {
|
|
550
|
+
const t = Number(y);
|
|
551
551
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
552
552
|
}
|
|
553
|
-
function ke(
|
|
554
|
-
if (typeof
|
|
553
|
+
function ke(y, e) {
|
|
554
|
+
if (typeof y != "string")
|
|
555
555
|
return "";
|
|
556
|
-
const t = At.exec(
|
|
556
|
+
const t = At.exec(y.trim());
|
|
557
557
|
if (!t)
|
|
558
558
|
return "";
|
|
559
559
|
const r = Number(t[1]), i = Number(t[2]);
|
|
@@ -562,14 +562,14 @@ function ke(m, e) {
|
|
|
562
562
|
const n = Number.isFinite(e) ? Math.trunc(e) : 0, s = r * 12 + (i - 1) + n, a = Math.floor(s / 12), o = s - a * 12 + 1;
|
|
563
563
|
return `${String(a).padStart(4, "0")}-${ne(o)}`;
|
|
564
564
|
}
|
|
565
|
-
function St(
|
|
566
|
-
if (typeof
|
|
567
|
-
return ke(
|
|
565
|
+
function St(y) {
|
|
566
|
+
if (typeof y == "string" && y.trim() !== "")
|
|
567
|
+
return ke(y, 0);
|
|
568
568
|
const e = /* @__PURE__ */ new Date();
|
|
569
569
|
return `${String(e.getFullYear()).padStart(4, "0")}-${ne(e.getMonth() + 1)}`;
|
|
570
570
|
}
|
|
571
|
-
function st(
|
|
572
|
-
const t = Math.trunc(Number(
|
|
571
|
+
function st(y, e) {
|
|
572
|
+
const t = Math.trunc(Number(y));
|
|
573
573
|
if (!Number.isFinite(t) || t < 0)
|
|
574
574
|
return [];
|
|
575
575
|
const r = St(e);
|
|
@@ -582,37 +582,37 @@ function st(m, e) {
|
|
|
582
582
|
}
|
|
583
583
|
return n;
|
|
584
584
|
}
|
|
585
|
-
function at(
|
|
585
|
+
function at(y, e) {
|
|
586
586
|
const t = { start: 0, end: 0, total: 0, empty: !0 };
|
|
587
|
-
if (!
|
|
587
|
+
if (!y || typeof y != "object")
|
|
588
588
|
return t;
|
|
589
|
-
const r =
|
|
589
|
+
const r = y, i = Te(r.totalElements ?? r.totalCount, 0);
|
|
590
590
|
if (i <= 0)
|
|
591
591
|
return t;
|
|
592
592
|
const n = Math.max(0, Te(r.number, 0)), s = Math.max(0, Te(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
|
|
593
|
-
let
|
|
593
|
+
let c;
|
|
594
594
|
if (e !== void 0 && Number.isFinite(e))
|
|
595
|
-
|
|
595
|
+
c = Math.max(0, Math.trunc(e));
|
|
596
596
|
else {
|
|
597
597
|
const d = Te(r.numberOfElements, NaN);
|
|
598
|
-
|
|
598
|
+
c = Number.isFinite(d) ? d : Math.min(s, i - a);
|
|
599
599
|
}
|
|
600
|
-
const u = Math.min(a +
|
|
600
|
+
const u = Math.min(a + c, i);
|
|
601
601
|
return { start: o, end: Math.max(u, o), total: i, empty: !1 };
|
|
602
602
|
}
|
|
603
|
-
function ot(
|
|
604
|
-
if (!Array.isArray(
|
|
603
|
+
function ot(y, e, t) {
|
|
604
|
+
if (!Array.isArray(y) || y.length === 0)
|
|
605
605
|
return null;
|
|
606
|
-
const r = String(t), i =
|
|
606
|
+
const r = String(t), i = y.find(
|
|
607
607
|
(n) => n != null && String(n[e]) === r
|
|
608
608
|
);
|
|
609
609
|
return i === void 0 ? null : i;
|
|
610
610
|
}
|
|
611
|
-
function lt(
|
|
612
|
-
if (!Array.isArray(
|
|
611
|
+
function lt(y, e) {
|
|
612
|
+
if (!Array.isArray(y))
|
|
613
613
|
return 0;
|
|
614
614
|
let t = 0;
|
|
615
|
-
for (const r of
|
|
615
|
+
for (const r of y) {
|
|
616
616
|
const i = e == null ? r : r?.[e];
|
|
617
617
|
if (i == null || i === "")
|
|
618
618
|
continue;
|
|
@@ -621,24 +621,24 @@ function lt(m, e) {
|
|
|
621
621
|
}
|
|
622
622
|
return t;
|
|
623
623
|
}
|
|
624
|
-
function ct(
|
|
625
|
-
return e == null ||
|
|
624
|
+
function ct(y, e) {
|
|
625
|
+
return e == null || y == null ? String(y) : String(y[e]);
|
|
626
626
|
}
|
|
627
|
-
function ut(
|
|
628
|
-
if (!Array.isArray(
|
|
627
|
+
function ut(y, e) {
|
|
628
|
+
if (!Array.isArray(y))
|
|
629
629
|
return [];
|
|
630
630
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
631
|
-
for (const i of
|
|
631
|
+
for (const i of y) {
|
|
632
632
|
const n = ct(i, e);
|
|
633
633
|
t.has(n) || (t.add(n), r.push(i));
|
|
634
634
|
}
|
|
635
635
|
return r;
|
|
636
636
|
}
|
|
637
|
-
function dt(
|
|
638
|
-
if (!Array.isArray(
|
|
637
|
+
function dt(y, e) {
|
|
638
|
+
if (!Array.isArray(y))
|
|
639
639
|
return [];
|
|
640
640
|
const t = /* @__PURE__ */ new Map(), r = [];
|
|
641
|
-
for (const i of
|
|
641
|
+
for (const i of y) {
|
|
642
642
|
const n = ct(i, e), s = t.get(n);
|
|
643
643
|
if (s === void 0) {
|
|
644
644
|
const a = i == null ? i : i[e];
|
|
@@ -705,13 +705,13 @@ class He {
|
|
|
705
705
|
const r = await t.task();
|
|
706
706
|
t.resolve(r);
|
|
707
707
|
} catch (r) {
|
|
708
|
-
t.reject(r),
|
|
708
|
+
t.reject(r), m.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
709
709
|
}
|
|
710
710
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
711
711
|
break;
|
|
712
712
|
}
|
|
713
713
|
} catch (e) {
|
|
714
|
-
|
|
714
|
+
m.error("[Haori]", "Error processing queue:", e);
|
|
715
715
|
} finally {
|
|
716
716
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
717
717
|
}
|
|
@@ -946,9 +946,9 @@ const T = class T {
|
|
|
946
946
|
const t = e.filter(
|
|
947
947
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
948
948
|
);
|
|
949
|
-
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)),
|
|
949
|
+
t.length !== 0 && (t.forEach((r) => this.loggedUnusableBindingKeys.add(r)), m.warn(
|
|
950
950
|
"[Haori]",
|
|
951
|
-
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${
|
|
951
|
+
`Binding key(s) that cannot be used as identifiers are excluded from expressions: ${t.join(", ")}. Read them as haori.data['key'], or use ${l.prefix}form-object to collect nested values.`
|
|
952
952
|
));
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
@@ -1043,19 +1043,19 @@ const T = class T {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
if (a.value !== ")")
|
|
1045
1045
|
continue;
|
|
1046
|
-
let o = 0,
|
|
1046
|
+
let o = 0, c = 0;
|
|
1047
1047
|
for (let u = s - 1; u >= 0; u -= 1) {
|
|
1048
1048
|
const d = i[u].value;
|
|
1049
1049
|
if (d === ")" || d === "]" || d === "}") {
|
|
1050
|
-
o += 1, d === ")" && (
|
|
1050
|
+
o += 1, d === ")" && (c += 1);
|
|
1051
1051
|
continue;
|
|
1052
1052
|
}
|
|
1053
1053
|
if (d === "(" || d === "[" || d === "{") {
|
|
1054
|
-
if (o -= 1, d === "(" && (
|
|
1054
|
+
if (o -= 1, d === "(" && (c -= 1), o === 0)
|
|
1055
1055
|
break;
|
|
1056
1056
|
continue;
|
|
1057
1057
|
}
|
|
1058
|
-
|
|
1058
|
+
c === 1 && i[u].type === "identifier" && n.has(i[u - 1]?.value ?? "") && r.add(i[u].value);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
@@ -1090,7 +1090,7 @@ let ${e.join(", ")};`;
|
|
|
1090
1090
|
if (this.loggedBlockedIdentifierExpressions.has(e))
|
|
1091
1091
|
return;
|
|
1092
1092
|
const t = this.detectForbiddenIdentifiers(e);
|
|
1093
|
-
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e),
|
|
1093
|
+
t.length !== 0 && (this.loggedBlockedIdentifierExpressions.add(e), m.warn(
|
|
1094
1094
|
"[Haori]",
|
|
1095
1095
|
"Expression references blocked identifier(s): " + t.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of an empty result). Use spread {...a, ...b} instead of Object.assign.",
|
|
1096
1096
|
e
|
|
@@ -1178,8 +1178,8 @@ let ${e.join(", ")};`;
|
|
|
1178
1178
|
let a = null;
|
|
1179
1179
|
for (const o of r) {
|
|
1180
1180
|
if (o.value === "[") {
|
|
1181
|
-
const
|
|
1182
|
-
s.push(
|
|
1181
|
+
const c = this.startsMemberAccess(a);
|
|
1182
|
+
s.push(c), c && n.push({
|
|
1183
1183
|
start: o.position + 1,
|
|
1184
1184
|
end: o.position + 1,
|
|
1185
1185
|
text: T.MEMBER_KEY_GUARD_OPEN
|
|
@@ -1192,8 +1192,8 @@ let ${e.join(", ")};`;
|
|
|
1192
1192
|
a = o;
|
|
1193
1193
|
}
|
|
1194
1194
|
for (let o = n.length - 1; o >= 0; o -= 1) {
|
|
1195
|
-
const
|
|
1196
|
-
i = i.slice(0,
|
|
1195
|
+
const c = n[o];
|
|
1196
|
+
i = i.slice(0, c.start) + c.text + i.slice(c.end);
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
return this.GUARDED_MEMBER_CACHE.set(e, i), i;
|
|
@@ -1231,8 +1231,8 @@ let ${e.join(", ")};`;
|
|
|
1231
1231
|
*/
|
|
1232
1232
|
static recordUnresolvedIdentifiers(e, t) {
|
|
1233
1233
|
if (e.length !== 0) {
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1234
|
+
if (l.strictBind) {
|
|
1235
|
+
m.error(
|
|
1236
1236
|
"[Haori]",
|
|
1237
1237
|
"Expression references key(s) that are not in the binding data: " + e.join(", ") + ". The result is treated as an unresolved reference.",
|
|
1238
1238
|
t
|
|
@@ -1263,7 +1263,7 @@ let ${e.join(", ")};`;
|
|
|
1263
1263
|
if (this.pendingUnresolvedIdentifiers.size === 0)
|
|
1264
1264
|
return;
|
|
1265
1265
|
const e = Array.from(this.pendingUnresolvedIdentifiers);
|
|
1266
|
-
this.pendingUnresolvedIdentifiers.clear(),
|
|
1266
|
+
this.pendingUnresolvedIdentifiers.clear(), m.warn(
|
|
1267
1267
|
"[Haori]",
|
|
1268
1268
|
"Expression key(s) were never provided by any binding: " + e.join(", ") + ". They are treated as unresolved references (rendered as empty). Check for typos if this is unexpected."
|
|
1269
1269
|
);
|
|
@@ -1344,7 +1344,7 @@ let ${e.join(", ")};`;
|
|
|
1344
1344
|
${t}`;
|
|
1345
1345
|
this.loggedScopeMissingIdentifiers.has(s) || (this.loggedScopeMissingIdentifiers.add(s), i.push(n));
|
|
1346
1346
|
}
|
|
1347
|
-
i.length !== 0 &&
|
|
1347
|
+
i.length !== 0 && m.warn(
|
|
1348
1348
|
"[Haori]",
|
|
1349
1349
|
`Expression key(s) are missing from this scope but are provided in another scope: ${i.join(", ")}. A binding is visible only to the target element itself and its descendants, so bind the response to this element or one of its ancestors (data-fetch-bind / data-{event}-bind):`,
|
|
1350
1350
|
t
|
|
@@ -1373,7 +1373,7 @@ ${t}`;
|
|
|
1373
1373
|
const n = this.prepareEvaluator(e, i);
|
|
1374
1374
|
if (!(n.compileFailed || n.evaluator === null))
|
|
1375
1375
|
try {
|
|
1376
|
-
const s = this.wrapBoundValues(i), a = n.bindKeys.map((
|
|
1376
|
+
const s = this.wrapBoundValues(i), a = n.bindKeys.map((c) => s[c]), o = this.withBlockedPropertyAccess(
|
|
1377
1377
|
() => n.evaluator(...a)
|
|
1378
1378
|
);
|
|
1379
1379
|
return typeof o == "boolean" ? o : void 0;
|
|
@@ -1413,18 +1413,18 @@ ${t}`;
|
|
|
1413
1413
|
*/
|
|
1414
1414
|
static evaluateDetailed(e, t = {}) {
|
|
1415
1415
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
1416
|
-
return
|
|
1416
|
+
return m.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
1417
1417
|
if (this.containsDangerousPatterns(e)) {
|
|
1418
1418
|
const d = this.detectDisallowedKeywords(e);
|
|
1419
1419
|
if (d.length > 0) {
|
|
1420
1420
|
const p = d.some((g) => g === "function" || g === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
|
|
1421
|
-
|
|
1421
|
+
m.warn(
|
|
1422
1422
|
"[Haori]",
|
|
1423
1423
|
e,
|
|
1424
1424
|
"Expression uses disallowed keyword(s): " + d.join(", ") + "." + p
|
|
1425
1425
|
);
|
|
1426
1426
|
} else
|
|
1427
|
-
|
|
1427
|
+
m.warn(
|
|
1428
1428
|
"[Haori]",
|
|
1429
1429
|
e,
|
|
1430
1430
|
"Expression contains dangerous patterns"
|
|
@@ -1434,7 +1434,7 @@ ${t}`;
|
|
|
1434
1434
|
const r = this.collectForbiddenKeys(t);
|
|
1435
1435
|
if (r.length > 0) {
|
|
1436
1436
|
const d = r.join(",");
|
|
1437
|
-
this.loggedForbiddenKeySignatures.has(d) || (this.loggedForbiddenKeySignatures.add(d), this.scheduleForbiddenKeyLogReset(),
|
|
1437
|
+
this.loggedForbiddenKeySignatures.has(d) || (this.loggedForbiddenKeySignatures.add(d), this.scheduleForbiddenKeyLogReset(), m.error(
|
|
1438
1438
|
"[Haori]",
|
|
1439
1439
|
"Binding keys are reserved and ignored: " + r.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
1440
1440
|
));
|
|
@@ -1445,7 +1445,7 @@ ${t}`;
|
|
|
1445
1445
|
/* @__PURE__ */ new WeakSet(),
|
|
1446
1446
|
i
|
|
1447
1447
|
))
|
|
1448
|
-
return
|
|
1448
|
+
return m.warn(
|
|
1449
1449
|
"[Haori]",
|
|
1450
1450
|
t,
|
|
1451
1451
|
"Binded values contain forbidden values"
|
|
@@ -1456,7 +1456,7 @@ ${t}`;
|
|
|
1456
1456
|
), s = this.BUILTIN_REFERENCE_PATTERN.test(
|
|
1457
1457
|
n
|
|
1458
1458
|
);
|
|
1459
|
-
s && this.BUILTIN_NAMESPACE in t &&
|
|
1459
|
+
s && this.BUILTIN_NAMESPACE in t && m.warn(
|
|
1460
1460
|
"[Haori]",
|
|
1461
1461
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
1462
1462
|
);
|
|
@@ -1467,7 +1467,7 @@ ${t}`;
|
|
|
1467
1467
|
...this.BUILTIN_HELPERS,
|
|
1468
1468
|
[this.BUILTIN_DATA_PROPERTY]: { ...a }
|
|
1469
1469
|
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a), j.isEnabled() && this.recordSuppliedIdentifiers(a);
|
|
1470
|
-
const o = this.canAttemptMissingIdentifierRecovery(e),
|
|
1470
|
+
const o = this.canAttemptMissingIdentifierRecovery(e), c = this.extractFreeIdentifiers(e).filter(
|
|
1471
1471
|
(d) => !(d in a) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
1472
1472
|
// (二重宣言は構文エラーになる)。
|
|
1473
1473
|
!this.FORBIDDEN_NAMES.includes(d) && // 標準組み込み(`Math` など)は式から参照できる仕様のため遮蔽しない。
|
|
@@ -1476,14 +1476,14 @@ ${t}`;
|
|
|
1476
1476
|
if (j.isEnabled()) {
|
|
1477
1477
|
const d = this.extractBoundIdentifiers(e);
|
|
1478
1478
|
this.recordScopeMissingIdentifiers(
|
|
1479
|
-
d.size === 0 ?
|
|
1479
|
+
d.size === 0 ? c : c.filter((p) => !d.has(p)),
|
|
1480
1480
|
e
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
1483
|
-
o &&
|
|
1483
|
+
o && c.forEach((d) => {
|
|
1484
1484
|
a[d] = void 0;
|
|
1485
1485
|
});
|
|
1486
|
-
const u = o ? [] :
|
|
1486
|
+
const u = o ? [] : c;
|
|
1487
1487
|
for (let d = 0; d <= this.MAX_IDENTIFIER_RECOVERY_COUNT; d += 1) {
|
|
1488
1488
|
const p = this.prepareEvaluator(
|
|
1489
1489
|
e,
|
|
@@ -1526,10 +1526,10 @@ ${t}`;
|
|
|
1526
1526
|
e
|
|
1527
1527
|
), { value: void 0, unresolvedReference: !0 });
|
|
1528
1528
|
}
|
|
1529
|
-
return
|
|
1529
|
+
return m.error("[Haori]", "Expression evaluation error:", e, g), g instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
|
-
return
|
|
1532
|
+
return m.error(
|
|
1533
1533
|
"[Haori]",
|
|
1534
1534
|
"Failed to recover missing identifiers:",
|
|
1535
1535
|
e,
|
|
@@ -1551,10 +1551,10 @@ ${t}`;
|
|
|
1551
1551
|
i.forEach((v) => {
|
|
1552
1552
|
this.isUsableBindingKey(v) ? n.push(v) : s.push(v);
|
|
1553
1553
|
}), n.sort(), this.reportUnusableBindingKeys(s);
|
|
1554
|
-
const a = new Set(n), o = r.filter((v) => !a.has(v)),
|
|
1554
|
+
const a = new Set(n), o = r.filter((v) => !a.has(v)), c = `${e}:${n.join(",")}:${o.join(
|
|
1555
1555
|
","
|
|
1556
1556
|
)}`;
|
|
1557
|
-
let u = this.EXPRESSION_CACHE.get(
|
|
1557
|
+
let u = this.EXPRESSION_CACHE.get(c) || null;
|
|
1558
1558
|
if (u !== null)
|
|
1559
1559
|
return this.compileFailedExpressions.delete(e), {
|
|
1560
1560
|
bindKeys: n,
|
|
@@ -1568,17 +1568,17 @@ ${d};
|
|
|
1568
1568
|
return (${g});${p}` : `"use strict";
|
|
1569
1569
|
return (${g});${p}`;
|
|
1570
1570
|
try {
|
|
1571
|
-
return u = new Function(...n, E), this.EXPRESSION_CACHE.set(
|
|
1571
|
+
return u = new Function(...n, E), this.EXPRESSION_CACHE.set(c, u), this.compileFailedExpressions.delete(e), {
|
|
1572
1572
|
bindKeys: n,
|
|
1573
1573
|
evaluator: u,
|
|
1574
1574
|
compileFailed: !1
|
|
1575
1575
|
};
|
|
1576
1576
|
} catch (v) {
|
|
1577
|
-
return o.length > 0 ? (
|
|
1577
|
+
return o.length > 0 ? (m.warn(
|
|
1578
1578
|
"[Haori]",
|
|
1579
1579
|
"Failed to shadow undeclared identifier(s): " + o.join(", ") + ". Falling back to evaluation without shadowing.",
|
|
1580
1580
|
e
|
|
1581
|
-
), this.prepareEvaluator(e, t, [])) : (
|
|
1581
|
+
), this.prepareEvaluator(e, t, [])) : (m.error("[Haori]", "Failed to compile expression:", e, v), this.compileFailedExpressions.add(e), {
|
|
1582
1582
|
bindKeys: n,
|
|
1583
1583
|
evaluator: null,
|
|
1584
1584
|
compileFailed: !0
|
|
@@ -1656,11 +1656,11 @@ return (${g});${p}`;
|
|
|
1656
1656
|
const r = [];
|
|
1657
1657
|
let i = null;
|
|
1658
1658
|
for (let n = 0; n < t.length; n++) {
|
|
1659
|
-
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null,
|
|
1659
|
+
const s = t[n], a = t[n + 1] || null, o = r[r.length - 1] || null, c = t[n - 2] || null, u = t[n - 3] || null;
|
|
1660
1660
|
if (this.startsObjectKey(
|
|
1661
1661
|
o,
|
|
1662
1662
|
i,
|
|
1663
|
-
|
|
1663
|
+
c,
|
|
1664
1664
|
u
|
|
1665
1665
|
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
1666
1666
|
this.decodeStringLiteral(s.value)
|
|
@@ -2135,8 +2135,8 @@ return (${g});${p}`;
|
|
|
2135
2135
|
get: (s, a, o) => {
|
|
2136
2136
|
if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
|
|
2137
2137
|
return;
|
|
2138
|
-
const
|
|
2139
|
-
return typeof a == "symbol" ?
|
|
2138
|
+
const c = Reflect.get(s, a, o);
|
|
2139
|
+
return typeof a == "symbol" ? c : this.wrapBoundValue(c, t);
|
|
2140
2140
|
},
|
|
2141
2141
|
has: (s, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(s, a),
|
|
2142
2142
|
getOwnPropertyDescriptor: (s, a) => {
|
|
@@ -2144,12 +2144,12 @@ return (${g});${p}`;
|
|
|
2144
2144
|
return Reflect.getOwnPropertyDescriptor(s, a);
|
|
2145
2145
|
},
|
|
2146
2146
|
apply: (s, a, o) => {
|
|
2147
|
-
const
|
|
2147
|
+
const c = Reflect.apply(
|
|
2148
2148
|
s,
|
|
2149
2149
|
a,
|
|
2150
2150
|
o
|
|
2151
2151
|
);
|
|
2152
|
-
return this.isIteratorLike(
|
|
2152
|
+
return this.isIteratorLike(c) ? c : this.wrapBoundValue(c, t);
|
|
2153
2153
|
},
|
|
2154
2154
|
construct: (s, a, o) => this.wrapBoundValue(
|
|
2155
2155
|
Reflect.construct(
|
|
@@ -2547,11 +2547,11 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2547
2547
|
static report(e = P.DEFAULT_REPORT_LIMIT) {
|
|
2548
2548
|
const t = /* @__PURE__ */ new Map();
|
|
2549
2549
|
let r = 0, i = 0;
|
|
2550
|
-
const n = (
|
|
2550
|
+
const n = (c, u, d) => {
|
|
2551
2551
|
r += d.totalDurationMs, i += d.calls;
|
|
2552
|
-
const p = t.get(
|
|
2552
|
+
const p = t.get(c);
|
|
2553
2553
|
if (p === void 0) {
|
|
2554
|
-
t.set(
|
|
2554
|
+
t.set(c, {
|
|
2555
2555
|
where: u,
|
|
2556
2556
|
template: d.template,
|
|
2557
2557
|
elements: 1,
|
|
@@ -2568,30 +2568,30 @@ const Ae = "data-haori-if-disabled", Ge = "input, select, textarea, button, fiel
|
|
|
2568
2568
|
d.maxDurationMs
|
|
2569
2569
|
), d.totalDurationMs > p.representativeDurationMs && (p.where = u, p.representativeDurationMs = d.totalDurationMs);
|
|
2570
2570
|
};
|
|
2571
|
-
P.snapshot().forEach((
|
|
2572
|
-
|
|
2571
|
+
P.snapshot().forEach((c) => {
|
|
2572
|
+
c.attributes.forEach((u) => {
|
|
2573
2573
|
n(
|
|
2574
2574
|
`@${u.name}
|
|
2575
2575
|
${u.template}`,
|
|
2576
|
-
`${
|
|
2576
|
+
`${c.elementId} @${u.name}`,
|
|
2577
2577
|
u
|
|
2578
2578
|
);
|
|
2579
|
-
}),
|
|
2579
|
+
}), c.texts.forEach((u) => {
|
|
2580
2580
|
n(
|
|
2581
2581
|
`#${u.childIndex}
|
|
2582
2582
|
${u.template}`,
|
|
2583
|
-
`${
|
|
2583
|
+
`${c.elementId} #${u.childIndex}`,
|
|
2584
2584
|
u
|
|
2585
2585
|
);
|
|
2586
2586
|
});
|
|
2587
2587
|
});
|
|
2588
2588
|
const s = [...t.values()].map(
|
|
2589
|
-
({ representativeDurationMs:
|
|
2589
|
+
({ representativeDurationMs: c, ...u }) => u
|
|
2590
2590
|
);
|
|
2591
|
-
s.sort((
|
|
2592
|
-
const a = s.slice(0, e).map((
|
|
2593
|
-
...
|
|
2594
|
-
sharePercent: r > 0 ? Math.round(
|
|
2591
|
+
s.sort((c, u) => u.totalDurationMs - c.totalDurationMs);
|
|
2592
|
+
const a = s.slice(0, e).map((c) => ({
|
|
2593
|
+
...c,
|
|
2594
|
+
sharePercent: r > 0 ? Math.round(c.totalDurationMs / r * 1e3) / 10 : 0
|
|
2595
2595
|
})), o = {
|
|
2596
2596
|
totalDurationMs: r,
|
|
2597
2597
|
totalCalls: i,
|
|
@@ -2611,10 +2611,10 @@ ${u.template}`,
|
|
|
2611
2611
|
*/
|
|
2612
2612
|
static logReport(e) {
|
|
2613
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),
|
|
2615
|
-
return `${n}. ${s}ms ${a} calls=${o} elements=${
|
|
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), c = String(r.elements).padStart(4), u = r.maxDurationMs.toFixed(1).padStart(8);
|
|
2615
|
+
return `${n}. ${s}ms ${a} calls=${o} elements=${c} max=${u}ms ${r.where} ${r.template}`;
|
|
2616
2616
|
});
|
|
2617
|
-
|
|
2617
|
+
m.info(
|
|
2618
2618
|
"[Haori][evaluation-profile]",
|
|
2619
2619
|
`total=${e.totalDurationMs.toFixed(1)}ms calls=${e.totalCalls} declarations=${e.entryCount}
|
|
2620
2620
|
` + t.join(`
|
|
@@ -2800,8 +2800,8 @@ ${u.template}`,
|
|
|
2800
2800
|
i += `#${n.trim()}`, t.unshift(i);
|
|
2801
2801
|
break;
|
|
2802
2802
|
}
|
|
2803
|
-
const s = r.getAttribute(`${
|
|
2804
|
-
s && s.trim() !== "" && (i += `[${
|
|
2803
|
+
const s = r.getAttribute(`${l.prefix}derive-name`);
|
|
2804
|
+
s && s.trim() !== "" && (i += `[${l.prefix}derive-name="${s.trim()}"]`);
|
|
2805
2805
|
const a = r.parentElement;
|
|
2806
2806
|
a && (i += `:nth-child(${[...a.children].indexOf(r) + 1})`), t.unshift(i), r = a;
|
|
2807
2807
|
}
|
|
@@ -2836,7 +2836,7 @@ const ce = class ce {
|
|
|
2836
2836
|
t = new Ve(e);
|
|
2837
2837
|
break;
|
|
2838
2838
|
default:
|
|
2839
|
-
return
|
|
2839
|
+
return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
2840
2840
|
}
|
|
2841
2841
|
return t;
|
|
2842
2842
|
}
|
|
@@ -2951,7 +2951,7 @@ const R = class R extends x {
|
|
|
2951
2951
|
* @param target 対象エレメント
|
|
2952
2952
|
*/
|
|
2953
2953
|
constructor(e) {
|
|
2954
|
-
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, this.syncValue(), this.initialBindAttribute = e.getAttribute(`${
|
|
2954
|
+
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, this.syncValue(), this.initialBindAttribute = e.getAttribute(`${l.prefix}bind`), e.getAttributeNames().forEach((t) => {
|
|
2955
2955
|
const r = e.getAttribute(t);
|
|
2956
2956
|
if (r !== null && !this.attributeMap.has(t)) {
|
|
2957
2957
|
const i = new Fe(t, r);
|
|
@@ -2998,7 +2998,7 @@ const R = class R extends x {
|
|
|
2998
2998
|
removeChild(e) {
|
|
2999
2999
|
const t = this.children.indexOf(e);
|
|
3000
3000
|
if (t < 0) {
|
|
3001
|
-
|
|
3001
|
+
m.warn("[Haori]", "Child fragment not found.", e);
|
|
3002
3002
|
return;
|
|
3003
3003
|
}
|
|
3004
3004
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -3023,7 +3023,7 @@ const R = class R extends x {
|
|
|
3023
3023
|
* clone 時に runtime の hidden 状態だけを落とします。
|
|
3024
3024
|
*/
|
|
3025
3025
|
normalizeClonedVisibilityState() {
|
|
3026
|
-
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${
|
|
3026
|
+
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${l.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${l.prefix}if-false`), this.restoreFormControlsDisabledByIf()), this.children.forEach((e) => {
|
|
3027
3027
|
e instanceof R && e.normalizeClonedVisibilityState();
|
|
3028
3028
|
});
|
|
3029
3029
|
}
|
|
@@ -3424,7 +3424,7 @@ const R = class R extends x {
|
|
|
3424
3424
|
if (i instanceof HTMLInputElement && i.type === "file")
|
|
3425
3425
|
return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : K.enqueue(() => {
|
|
3426
3426
|
i.value = "";
|
|
3427
|
-
})) : (
|
|
3427
|
+
})) : (m.warn(
|
|
3428
3428
|
"[Haori]",
|
|
3429
3429
|
"A value cannot be assigned to input[type=file]; only clearing is supported.",
|
|
3430
3430
|
i
|
|
@@ -3445,7 +3445,7 @@ const R = class R extends x {
|
|
|
3445
3445
|
Array.isArray(e) ? e.join(",") : e,
|
|
3446
3446
|
t,
|
|
3447
3447
|
r
|
|
3448
|
-
) : (
|
|
3448
|
+
) : (m.warn(
|
|
3449
3449
|
"[Haori]",
|
|
3450
3450
|
"setValue is not supported for this element type.",
|
|
3451
3451
|
i
|
|
@@ -3490,8 +3490,8 @@ const R = class R extends x {
|
|
|
3490
3490
|
let s = !1;
|
|
3491
3491
|
const a = /* @__PURE__ */ new Set();
|
|
3492
3492
|
Array.from(i.options).forEach((o) => {
|
|
3493
|
-
const
|
|
3494
|
-
o.selected !==
|
|
3493
|
+
const c = e.includes(o.value);
|
|
3494
|
+
o.selected !== c && (o.selected = c, s = !0), c && a.add(o.value);
|
|
3495
3495
|
}), this.recordValueWriteResult(
|
|
3496
3496
|
e.every((o) => a.has(o))
|
|
3497
3497
|
), s && t && i.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -3834,7 +3834,7 @@ const R = class R extends x {
|
|
|
3834
3834
|
if (!j.isEnabled())
|
|
3835
3835
|
return;
|
|
3836
3836
|
const n = `${e} ${r}`;
|
|
3837
|
-
R.loggedUnresolvedAttributes.has(n) || (R.loggedUnresolvedAttributes.add(n),
|
|
3837
|
+
R.loggedUnresolvedAttributes.has(n) || (R.loggedUnresolvedAttributes.add(n), m.warn(
|
|
3838
3838
|
"[Haori]",
|
|
3839
3839
|
`Attribute "${t}" was not applied because the expression has an unresolved reference; the attribute is removed and the synchronized value is emptied: ${e}="${r}"`,
|
|
3840
3840
|
i
|
|
@@ -3857,9 +3857,9 @@ const R = class R extends x {
|
|
|
3857
3857
|
*/
|
|
3858
3858
|
static warnTypeMismatchedComparison(e, t, r, i) {
|
|
3859
3859
|
const n = `${e} ${t}`;
|
|
3860
|
-
R.loggedTypeMismatchedComparisons.has(n) || (R.loggedTypeMismatchedComparisons.add(n),
|
|
3860
|
+
R.loggedTypeMismatchedComparisons.has(n) || (R.loggedTypeMismatchedComparisons.add(n), m.warn(
|
|
3861
3861
|
"[Haori]",
|
|
3862
|
-
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${
|
|
3862
|
+
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${l.prefix}value-type) or compare converted values: ${e}="${t}"`,
|
|
3863
3863
|
i
|
|
3864
3864
|
));
|
|
3865
3865
|
}
|
|
@@ -3964,7 +3964,7 @@ const R = class R extends x {
|
|
|
3964
3964
|
* @returns 宣言された型。宣言が無い場合と無視する場合は null
|
|
3965
3965
|
*/
|
|
3966
3966
|
static resolveDeclaredValueType(e) {
|
|
3967
|
-
const t = e.getAttribute(`${
|
|
3967
|
+
const t = e.getAttribute(`${l.prefix}value-type`);
|
|
3968
3968
|
if (t === null)
|
|
3969
3969
|
return null;
|
|
3970
3970
|
const r = t.trim().toLowerCase();
|
|
@@ -4005,9 +4005,9 @@ const R = class R extends x {
|
|
|
4005
4005
|
if (!j.isEnabled())
|
|
4006
4006
|
return;
|
|
4007
4007
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
4008
|
-
R.loggedValueTypeDeclarations.has(n) || (R.loggedValueTypeDeclarations.add(n),
|
|
4008
|
+
R.loggedValueTypeDeclarations.has(n) || (R.loggedValueTypeDeclarations.add(n), m.warn(
|
|
4009
4009
|
"Haori",
|
|
4010
|
-
`${
|
|
4010
|
+
`${l.prefix}value-type="${t}" を無視しました(${r}):`,
|
|
4011
4011
|
e
|
|
4012
4012
|
));
|
|
4013
4013
|
}
|
|
@@ -4270,17 +4270,17 @@ const R = class R extends x {
|
|
|
4270
4270
|
}
|
|
4271
4271
|
}
|
|
4272
4272
|
this.attributeMap.set(e, o);
|
|
4273
|
-
const
|
|
4273
|
+
const c = this.getTarget(), u = o.evaluateDetailed(this.getBindingData(), {
|
|
4274
4274
|
kind: "attribute",
|
|
4275
|
-
element:
|
|
4275
|
+
element: c,
|
|
4276
4276
|
rawName: e,
|
|
4277
4277
|
template: r
|
|
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(
|
|
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(c) === "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 === "");
|
|
4279
4279
|
if (H && u.hasUnresolvedReference && R.warnUnresolvedAttribute(
|
|
4280
4280
|
e,
|
|
4281
4281
|
t,
|
|
4282
4282
|
r,
|
|
4283
|
-
|
|
4283
|
+
c
|
|
4284
4284
|
), j.isEnabled() && v === !1 && g) {
|
|
4285
4285
|
const de = o.getSingleExpression(), Ee = de === null ? null : Q.diagnoseStrictComparison(
|
|
4286
4286
|
de,
|
|
@@ -4290,20 +4290,20 @@ const R = class R extends x {
|
|
|
4290
4290
|
e,
|
|
4291
4291
|
r,
|
|
4292
4292
|
Ee,
|
|
4293
|
-
|
|
4293
|
+
c
|
|
4294
4294
|
);
|
|
4295
4295
|
}
|
|
4296
|
-
const A = o.isForceEvaluation() ? r : g ? v : E, S = i && o.isEvaluate && t === "value" && R.isValuePropertyTarget(
|
|
4296
|
+
const A = o.isForceEvaluation() ? r : g ? v : E, S = i && o.isEvaluate && t === "value" && R.isValuePropertyTarget(c), C = c.getRootNode(), V = S && R.isUserEditableValue(c) && (c === C.activeElement || this.hasPendingUserEdit()), L = H || A === null || A === !1 && !D ? null : String(A), _ = e !== t && c.getAttribute(e) !== r, k = L === null ? c.hasAttribute(t) : c.getAttribute(t) !== L, q = L === null ? "" : L, X = S && !V && c.value !== q, Y = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), te = t === "selected" && c instanceof HTMLOptionElement, be = C.activeElement, ue = be !== null && (Y && c === be || te && c.closest("select") === be) || (Y || te) && this.hasPendingCheckableUserEdit(te), we = L !== null, $e = Y && !ue && c.checked !== we, Re = te && !ue && c.selected !== we;
|
|
4297
4297
|
if (!_ && !k && !X && !$e && !Re)
|
|
4298
4298
|
return S && !V && (this.value = this.normalizeValueForElement(
|
|
4299
|
-
|
|
4299
|
+
c,
|
|
4300
4300
|
q
|
|
4301
4301
|
), this.clearUnappliedValueWrite()), (Y || te) && !ue && this.syncCheckableValueFromDom(te), Promise.resolve();
|
|
4302
4302
|
const We = K.enqueue(() => {
|
|
4303
|
-
_ &&
|
|
4304
|
-
|
|
4303
|
+
_ && c.setAttribute(e, r), L === null ? c.removeAttribute(t) : k && (c.setAttribute(t, L), t === `${l.prefix}bind` && this.recordSelfWrittenBind(L)), S && !V && (this.value = this.normalizeValueForElement(
|
|
4304
|
+
c,
|
|
4305
4305
|
q
|
|
4306
|
-
), X && (
|
|
4306
|
+
), X && (c.value = q), this.recordValueWriteResult(c.value === q)), $e && (c.checked = we), Re && (c.selected = we), ($e || Re) && this.syncCheckableValueFromDom(Re);
|
|
4307
4307
|
}).finally(() => {
|
|
4308
4308
|
this.releaseSelfWritingAttributes(s);
|
|
4309
4309
|
});
|
|
@@ -4430,18 +4430,18 @@ const R = class R extends x {
|
|
|
4430
4430
|
if (this.skipMutationNodes)
|
|
4431
4431
|
return Promise.resolve();
|
|
4432
4432
|
if (e === this)
|
|
4433
|
-
return
|
|
4433
|
+
return m.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
4434
4434
|
const i = /* @__PURE__ */ new Set();
|
|
4435
4435
|
let n = this.parent;
|
|
4436
4436
|
for (; n; )
|
|
4437
4437
|
i.add(n), n = n.getParent();
|
|
4438
4438
|
if (i.has(e))
|
|
4439
|
-
return
|
|
4439
|
+
return m.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
4440
4440
|
const s = e.getParent() === this;
|
|
4441
4441
|
let a = -1, o = -1;
|
|
4442
4442
|
s && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
|
|
4443
|
-
const
|
|
4444
|
-
|
|
4443
|
+
const c = e.getParent();
|
|
4444
|
+
c !== null && c.removeChild(e);
|
|
4445
4445
|
let u = r === void 0 ? t?.getTarget() || null : r;
|
|
4446
4446
|
if (t === null)
|
|
4447
4447
|
this.children.push(e);
|
|
@@ -4452,7 +4452,7 @@ const R = class R extends x {
|
|
|
4452
4452
|
t,
|
|
4453
4453
|
!1
|
|
4454
4454
|
);
|
|
4455
|
-
g === null ? (
|
|
4455
|
+
g === null ? (m.warn(
|
|
4456
4456
|
"[Haori]",
|
|
4457
4457
|
"Reference child not found in children.",
|
|
4458
4458
|
t
|
|
@@ -4484,7 +4484,7 @@ const R = class R extends x {
|
|
|
4484
4484
|
t,
|
|
4485
4485
|
!0
|
|
4486
4486
|
);
|
|
4487
|
-
return i === null ? (
|
|
4487
|
+
return i === null ? (m.warn(
|
|
4488
4488
|
"[Haori]",
|
|
4489
4489
|
"Reference child not found in children.",
|
|
4490
4490
|
t
|
|
@@ -4540,7 +4540,7 @@ const R = class R extends x {
|
|
|
4540
4540
|
return Promise.resolve();
|
|
4541
4541
|
this.visible = !1;
|
|
4542
4542
|
const e = this.getTarget();
|
|
4543
|
-
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${
|
|
4543
|
+
return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${l.prefix}if-false`, ""), R.disableFormControlsInBranch(e), Promise.resolve();
|
|
4544
4544
|
}
|
|
4545
4545
|
/**
|
|
4546
4546
|
* 分岐配下のフォームコントロールを順に処理します。
|
|
@@ -4557,7 +4557,7 @@ const R = class R extends x {
|
|
|
4557
4557
|
e.matches(Ge) && t(e);
|
|
4558
4558
|
const r = (i) => {
|
|
4559
4559
|
Array.from(i.children).forEach((n) => {
|
|
4560
|
-
n.hasAttribute(`${
|
|
4560
|
+
n.hasAttribute(`${l.prefix}if-false`) || (n instanceof HTMLElement && n.matches(Ge) && t(n), r(n));
|
|
4561
4561
|
});
|
|
4562
4562
|
};
|
|
4563
4563
|
r(e);
|
|
@@ -4609,7 +4609,7 @@ const R = class R extends x {
|
|
|
4609
4609
|
"display",
|
|
4610
4610
|
this.display,
|
|
4611
4611
|
this.displayPriority ?? ""
|
|
4612
|
-
), this.display = null, this.displayPriority = null, e.removeAttribute(`${
|
|
4612
|
+
), this.display = null, this.displayPriority = null, e.removeAttribute(`${l.prefix}if-false`), this.restoreFormControlsDisabledByIf(), this.visible = !0, Promise.resolve();
|
|
4613
4613
|
}
|
|
4614
4614
|
/**
|
|
4615
4615
|
* 指定した属性名を持つ最も近い親要素を返します。
|
|
@@ -4864,7 +4864,7 @@ const Me = class Me {
|
|
|
4864
4864
|
*/
|
|
4865
4865
|
checkRawExpressions() {
|
|
4866
4866
|
for (let e = 0; e < this.contents.length; e++)
|
|
4867
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
4867
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (m.error(
|
|
4868
4868
|
"[Haori]",
|
|
4869
4869
|
"Raw expressions are not allowed in multi-content expressions."
|
|
4870
4870
|
), this.contents[e].type = 1);
|
|
@@ -4907,25 +4907,25 @@ const Me = class Me {
|
|
|
4907
4907
|
evaluateWithProfile(e, t, r, i) {
|
|
4908
4908
|
const n = [], s = [];
|
|
4909
4909
|
let a = 0, o = !1;
|
|
4910
|
-
return this.contents.forEach((
|
|
4910
|
+
return this.contents.forEach((c) => {
|
|
4911
4911
|
try {
|
|
4912
|
-
if (r(
|
|
4912
|
+
if (r(c)) {
|
|
4913
4913
|
const u = Ne.measure(
|
|
4914
|
-
() => Q.evaluateDetailed(
|
|
4914
|
+
() => Q.evaluateDetailed(c.text, e)
|
|
4915
4915
|
), d = u.value;
|
|
4916
4916
|
a += u.durationMs, s.push({
|
|
4917
|
-
expression:
|
|
4917
|
+
expression: c.text,
|
|
4918
4918
|
durationMs: u.durationMs
|
|
4919
4919
|
}), o = o || d.unresolvedReference, n.push(d.value);
|
|
4920
4920
|
} else
|
|
4921
|
-
n.push(
|
|
4921
|
+
n.push(c.text);
|
|
4922
4922
|
} catch (u) {
|
|
4923
|
-
|
|
4923
|
+
m.error(
|
|
4924
4924
|
"[Haori]",
|
|
4925
|
-
`Error evaluating ${i} expression: ${
|
|
4925
|
+
`Error evaluating ${i} expression: ${c.text}`,
|
|
4926
4926
|
u
|
|
4927
4927
|
), s.push({
|
|
4928
|
-
expression:
|
|
4928
|
+
expression: c.text,
|
|
4929
4929
|
durationMs: 0
|
|
4930
4930
|
}), n.push("");
|
|
4931
4931
|
}
|
|
@@ -4959,15 +4959,15 @@ const Z = class Z extends se {
|
|
|
4959
4959
|
* @returns 強制評価の対象なら true
|
|
4960
4960
|
*/
|
|
4961
4961
|
static needsForceEvaluation(e) {
|
|
4962
|
-
if (Z.forceEvaluationNames === null || Z.forceEvaluationPrefix !==
|
|
4962
|
+
if (Z.forceEvaluationNames === null || Z.forceEvaluationPrefix !== l.prefix) {
|
|
4963
4963
|
const t = /* @__PURE__ */ new Set();
|
|
4964
4964
|
for (const r of [
|
|
4965
|
-
|
|
4965
|
+
l.prefix,
|
|
4966
4966
|
...Z.FORCE_EVALUATION_PREFIXES
|
|
4967
4967
|
])
|
|
4968
4968
|
for (const i of Z.FORCE_EVALUATION_SUFFIXES)
|
|
4969
4969
|
t.add(`${r}${i}`);
|
|
4970
|
-
Z.forceEvaluationNames = t, Z.forceEvaluationPrefix =
|
|
4970
|
+
Z.forceEvaluationNames = t, Z.forceEvaluationPrefix = l.prefix;
|
|
4971
4971
|
}
|
|
4972
4972
|
return Z.forceEvaluationNames.has(e);
|
|
4973
4973
|
}
|
|
@@ -5006,7 +5006,7 @@ const Z = class Z extends se {
|
|
|
5006
5006
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
5007
5007
|
"attribute"
|
|
5008
5008
|
);
|
|
5009
|
-
return this.forceEvaluation && r.results.length > 1 ? (
|
|
5009
|
+
return this.forceEvaluation && r.results.length > 1 ? (m.error(
|
|
5010
5010
|
"[Haori]",
|
|
5011
5011
|
"each or if expressions must have a single content.",
|
|
5012
5012
|
r.results
|
|
@@ -5025,7 +5025,7 @@ const ge = class ge {
|
|
|
5025
5025
|
* @return 実行モード。
|
|
5026
5026
|
*/
|
|
5027
5027
|
static get runtime() {
|
|
5028
|
-
return
|
|
5028
|
+
return l.runtime;
|
|
5029
5029
|
}
|
|
5030
5030
|
/**
|
|
5031
5031
|
* 実行モードを設定します。
|
|
@@ -5034,7 +5034,7 @@ const ge = class ge {
|
|
|
5034
5034
|
* @return 戻り値はありません。
|
|
5035
5035
|
*/
|
|
5036
5036
|
static setRuntime(e) {
|
|
5037
|
-
|
|
5037
|
+
l.setRuntime(e);
|
|
5038
5038
|
}
|
|
5039
5039
|
/**
|
|
5040
5040
|
* 進行中・追従して投入されるものを含め、すべてのレンダリングタスクの完了を待ちます。
|
|
@@ -5094,7 +5094,7 @@ const ge = class ge {
|
|
|
5094
5094
|
*/
|
|
5095
5095
|
static openDialog(e) {
|
|
5096
5096
|
return K.enqueue(() => {
|
|
5097
|
-
e instanceof HTMLDialogElement ? (ge.clearMessagesSync(e), e.showModal()) :
|
|
5097
|
+
e instanceof HTMLDialogElement ? (ge.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
5098
5098
|
}, !0);
|
|
5099
5099
|
}
|
|
5100
5100
|
/**
|
|
@@ -5104,7 +5104,7 @@ const ge = class ge {
|
|
|
5104
5104
|
*/
|
|
5105
5105
|
static closeDialog(e) {
|
|
5106
5106
|
return K.enqueue(() => {
|
|
5107
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
5107
|
+
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
5108
5108
|
}, !0);
|
|
5109
5109
|
}
|
|
5110
5110
|
/**
|
|
@@ -5415,7 +5415,7 @@ const h = class h {
|
|
|
5415
5415
|
* @returns 収集キー。どちらも無い場合は null
|
|
5416
5416
|
*/
|
|
5417
5417
|
static resolveFieldName(e) {
|
|
5418
|
-
const t = e.getAttribute(`${
|
|
5418
|
+
const t = e.getAttribute(`${l.prefix}form-name`);
|
|
5419
5419
|
return t || e.getAttribute("name");
|
|
5420
5420
|
}
|
|
5421
5421
|
/**
|
|
@@ -5491,7 +5491,7 @@ const h = class h {
|
|
|
5491
5491
|
static resolveRowTopLevelKey(e, t) {
|
|
5492
5492
|
let r = null, i = e;
|
|
5493
5493
|
for (; i !== null && i !== t; ) {
|
|
5494
|
-
const n = i.getAttribute(`${
|
|
5494
|
+
const n = i.getAttribute(`${l.prefix}form-object`) || i.getAttribute(`${l.prefix}form-list`) || h.resolveFieldName(i);
|
|
5495
5495
|
n != null && String(n) !== "" && (r = String(n)), i = i.getParent();
|
|
5496
5496
|
}
|
|
5497
5497
|
return r;
|
|
@@ -5518,13 +5518,13 @@ const h = class h {
|
|
|
5518
5518
|
* @returns 属性設定の Promise。処理が不要な場合は undefined
|
|
5519
5519
|
*/
|
|
5520
5520
|
static prepareFormName(e) {
|
|
5521
|
-
if (!e.hasAttribute(`${
|
|
5521
|
+
if (!e.hasAttribute(`${l.prefix}form-name`))
|
|
5522
5522
|
return;
|
|
5523
|
-
const t = e.getAttribute(`${
|
|
5523
|
+
const t = e.getAttribute(`${l.prefix}form-name`);
|
|
5524
5524
|
if (!t) {
|
|
5525
|
-
|
|
5525
|
+
m.warn(
|
|
5526
5526
|
"Haori",
|
|
5527
|
-
`${
|
|
5527
|
+
`${l.prefix}form-name evaluated to an empty key; the field falls back to the name attribute or is not collected.`,
|
|
5528
5528
|
e.getTarget()
|
|
5529
5529
|
);
|
|
5530
5530
|
return;
|
|
@@ -5551,9 +5551,9 @@ const h = class h {
|
|
|
5551
5551
|
static resolveGroupScope(e) {
|
|
5552
5552
|
let t = e, r = t.getParent();
|
|
5553
5553
|
for (; r !== null; ) {
|
|
5554
|
-
if (r.hasAttribute(`${
|
|
5554
|
+
if (r.hasAttribute(`${l.prefix}form-list`))
|
|
5555
5555
|
return t;
|
|
5556
|
-
if (r.getTarget() instanceof HTMLFormElement || r.hasAttribute(`${
|
|
5556
|
+
if (r.getTarget() instanceof HTMLFormElement || r.hasAttribute(`${l.prefix}form`))
|
|
5557
5557
|
return r;
|
|
5558
5558
|
t = r, r = r.getParent();
|
|
5559
5559
|
}
|
|
@@ -5613,7 +5613,7 @@ const h = class h {
|
|
|
5613
5613
|
* @returns 未解決参照が無い場合 true
|
|
5614
5614
|
*/
|
|
5615
5615
|
static isDeclarationResolved(e, t) {
|
|
5616
|
-
for (const r of [`${
|
|
5616
|
+
for (const r of [`${l.prefix}attr-${t}`, t]) {
|
|
5617
5617
|
const i = e.getAttributeEvaluation(r);
|
|
5618
5618
|
if (i !== null)
|
|
5619
5619
|
return !i.hasUnresolvedReference;
|
|
@@ -5707,7 +5707,7 @@ const h = class h {
|
|
|
5707
5707
|
* @returns 宣言バインドの場合 true
|
|
5708
5708
|
*/
|
|
5709
5709
|
static hasDeclarativeBinding(e, t) {
|
|
5710
|
-
if (e.hasAttribute(`${
|
|
5710
|
+
if (e.hasAttribute(`${l.prefix}attr-${t}`))
|
|
5711
5711
|
return !0;
|
|
5712
5712
|
const r = e.getRawAttribute(t);
|
|
5713
5713
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -5805,8 +5805,8 @@ const h = class h {
|
|
|
5805
5805
|
r,
|
|
5806
5806
|
o
|
|
5807
5807
|
);
|
|
5808
|
-
for (const
|
|
5809
|
-
n.has(
|
|
5808
|
+
for (const c of o)
|
|
5809
|
+
n.has(c) || n.set(c, a);
|
|
5810
5810
|
}
|
|
5811
5811
|
const s = /* @__PURE__ */ new Set();
|
|
5812
5812
|
h.walkExcludedPaths(i ?? h.getValues(e), r, s);
|
|
@@ -5899,15 +5899,15 @@ const h = class h {
|
|
|
5899
5899
|
* @returns values と同じオブジェクト
|
|
5900
5900
|
*/
|
|
5901
5901
|
static getPartValues(e, t, r = null, i = null) {
|
|
5902
|
-
if (e.hasAttribute(`${
|
|
5902
|
+
if (e.hasAttribute(`${l.prefix}form-detach`))
|
|
5903
5903
|
return t;
|
|
5904
|
-
if (e.getTarget().hasAttribute(`${
|
|
5904
|
+
if (e.getTarget().hasAttribute(`${l.prefix}if-false`)) {
|
|
5905
5905
|
if (i !== null)
|
|
5906
5906
|
for (const u of h.collectDeclaredKeysInFragment(e))
|
|
5907
5907
|
i.add(u);
|
|
5908
5908
|
return t;
|
|
5909
5909
|
}
|
|
5910
|
-
const n = h.resolveFieldName(e), s = e.getAttribute(`${
|
|
5910
|
+
const n = h.resolveFieldName(e), s = e.getAttribute(`${l.prefix}form-object`), a = e.getAttribute(`${l.prefix}form-list`), o = e.hasAttribute(`${l.prefix}form-list`), c = r !== null && e.getUserEditSequence() <= r;
|
|
5911
5911
|
if (n) {
|
|
5912
5912
|
if (r !== null && h.isGroupedCheckable(e)) {
|
|
5913
5913
|
const u = h.collectGroupSelection(
|
|
@@ -5918,10 +5918,10 @@ const h = class h {
|
|
|
5918
5918
|
u.edited && (t[String(n)] = u.value);
|
|
5919
5919
|
} else if (o && h.isGroupedCheckable(e)) {
|
|
5920
5920
|
const u = String(n), d = e.getTarget();
|
|
5921
|
-
r === null && !Array.isArray(t[u]) && (t[u] = []), !
|
|
5922
|
-
} else if (o &&
|
|
5921
|
+
r === null && !Array.isArray(t[u]) && (t[u] = []), !c && d.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(d.value));
|
|
5922
|
+
} else if (o && c)
|
|
5923
5923
|
Array.isArray(t[String(n)]) ? t[String(n)].push(null) : t[String(n)] = [null];
|
|
5924
|
-
else if (!
|
|
5924
|
+
else if (!c) if (o) {
|
|
5925
5925
|
const u = h.resolveCollectedValue(e), d = h.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
5926
5926
|
Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
|
|
5927
5927
|
} else if (h.isGroupedCheckable(e)) {
|
|
@@ -5929,9 +5929,9 @@ const h = class h {
|
|
|
5929
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];
|
|
5930
5930
|
} else
|
|
5931
5931
|
t[String(n)] = h.resolveCollectedValue(e);
|
|
5932
|
-
s &&
|
|
5932
|
+
s && m.warn(
|
|
5933
5933
|
"Haori",
|
|
5934
|
-
`Element cannot have both ${
|
|
5934
|
+
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
5935
5935
|
);
|
|
5936
5936
|
for (const u of e.getChildElementFragments())
|
|
5937
5937
|
h.getPartValues(u, t, r, i);
|
|
@@ -5944,9 +5944,9 @@ const h = class h {
|
|
|
5944
5944
|
r,
|
|
5945
5945
|
d
|
|
5946
5946
|
);
|
|
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 &&
|
|
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 && m.warn(
|
|
5948
5948
|
"Haori",
|
|
5949
|
-
`Element cannot have both ${
|
|
5949
|
+
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
5950
5950
|
);
|
|
5951
5951
|
} else if (a) {
|
|
5952
5952
|
const u = [], d = [];
|
|
@@ -5961,7 +5961,7 @@ const h = class h {
|
|
|
5961
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()));
|
|
5962
5962
|
}
|
|
5963
5963
|
if (r === null) {
|
|
5964
|
-
const g = e.getAttribute(`${
|
|
5964
|
+
const g = e.getAttribute(`${l.prefix}each-key`);
|
|
5965
5965
|
h.registerCollectedRowIdentity(
|
|
5966
5966
|
u,
|
|
5967
5967
|
g == null ? null : String(g),
|
|
@@ -6046,7 +6046,7 @@ const h = class h {
|
|
|
6046
6046
|
* @returns 入力欄へ書き戻す値
|
|
6047
6047
|
*/
|
|
6048
6048
|
static resolveSyncValues(e, t) {
|
|
6049
|
-
const r = e.getAttribute(`${
|
|
6049
|
+
const r = e.getAttribute(`${l.prefix}form-arg`);
|
|
6050
6050
|
if (!r)
|
|
6051
6051
|
return t;
|
|
6052
6052
|
const i = String(r);
|
|
@@ -6131,8 +6131,8 @@ const h = class h {
|
|
|
6131
6131
|
let t = e;
|
|
6132
6132
|
for (; t; ) {
|
|
6133
6133
|
const i = t.getParent();
|
|
6134
|
-
if (i && i.hasAttribute(`${
|
|
6135
|
-
const n = i.getRawAttribute(`${
|
|
6134
|
+
if (i && i.hasAttribute(`${l.prefix}each`) && i.hasAttribute(`${l.prefix}form-list`)) {
|
|
6135
|
+
const n = i.getRawAttribute(`${l.prefix}each-arg`);
|
|
6136
6136
|
return {
|
|
6137
6137
|
source: t,
|
|
6138
6138
|
argKey: typeof n == "string" && n !== "" ? n : null
|
|
@@ -6150,7 +6150,7 @@ const h = class h {
|
|
|
6150
6150
|
* @returns キー名。指定が無い場合は null
|
|
6151
6151
|
*/
|
|
6152
6152
|
static resolveFormArgKey(e) {
|
|
6153
|
-
const t = e.getAttribute(`${
|
|
6153
|
+
const t = e.getAttribute(`${l.prefix}form-arg`);
|
|
6154
6154
|
return t ? String(t) : null;
|
|
6155
6155
|
}
|
|
6156
6156
|
/**
|
|
@@ -6187,19 +6187,19 @@ const h = class h {
|
|
|
6187
6187
|
static collectDeclaredKeysInFragment(e) {
|
|
6188
6188
|
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = h.resolveFieldName(e);
|
|
6189
6189
|
i && t.add(String(i));
|
|
6190
|
-
const n = `${
|
|
6190
|
+
const n = `${l.prefix}form-object`, s = `${l.prefix}form-list`, a = r.getAttribute(n) ?? r.getAttribute(s);
|
|
6191
6191
|
if (a)
|
|
6192
6192
|
return t.add(a), t;
|
|
6193
|
-
const o = `input[name],select[name],textarea[name],[${
|
|
6194
|
-
return r.querySelectorAll(o).forEach((
|
|
6195
|
-
if (!(
|
|
6193
|
+
const o = `input[name],select[name],textarea[name],[${l.prefix}form-name],[${n}],[${s}]`;
|
|
6194
|
+
return r.querySelectorAll(o).forEach((c) => {
|
|
6195
|
+
if (!(c instanceof HTMLElement))
|
|
6196
6196
|
return;
|
|
6197
|
-
let u = null, d = !1, p =
|
|
6197
|
+
let u = null, d = !1, p = c;
|
|
6198
6198
|
for (; p && p !== r; )
|
|
6199
|
-
p.hasAttribute(`${
|
|
6199
|
+
p.hasAttribute(`${l.prefix}form-detach`) && (d = !0), (p.hasAttribute(n) || p.hasAttribute(s)) && (u = p), p = p.parentElement;
|
|
6200
6200
|
if (d)
|
|
6201
6201
|
return;
|
|
6202
|
-
const g = u ??
|
|
6202
|
+
const g = u ?? c, E = g.getAttribute(n) || g.getAttribute(s) || g.getAttribute(`${l.prefix}form-name`) || g.getAttribute("name");
|
|
6203
6203
|
E && t.add(E);
|
|
6204
6204
|
}), t;
|
|
6205
6205
|
}
|
|
@@ -6214,7 +6214,7 @@ const h = class h {
|
|
|
6214
6214
|
* @returns 戻り値はありません。
|
|
6215
6215
|
*/
|
|
6216
6216
|
static applyCustomValidity(e) {
|
|
6217
|
-
const t = `${
|
|
6217
|
+
const t = `${l.prefix}validity`, r = (i) => {
|
|
6218
6218
|
i.hasAttribute(t) && h.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
6219
6219
|
};
|
|
6220
6220
|
r(e);
|
|
@@ -6229,7 +6229,7 @@ const h = class h {
|
|
|
6229
6229
|
static applyOneCustomValidity(e, t) {
|
|
6230
6230
|
const r = e.getTarget();
|
|
6231
6231
|
if (!(r instanceof HTMLInputElement) && !(r instanceof HTMLSelectElement) && !(r instanceof HTMLTextAreaElement)) {
|
|
6232
|
-
|
|
6232
|
+
m.warn(
|
|
6233
6233
|
"Haori",
|
|
6234
6234
|
`${t} は入力要素にのみ指定できます: ${r.tagName}`
|
|
6235
6235
|
);
|
|
@@ -6245,7 +6245,7 @@ const h = class h {
|
|
|
6245
6245
|
n
|
|
6246
6246
|
);
|
|
6247
6247
|
if (s.unresolvedReference) {
|
|
6248
|
-
|
|
6248
|
+
m.warn(
|
|
6249
6249
|
"Haori",
|
|
6250
6250
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
6251
6251
|
), r.setCustomValidity(h.resolveValidityMessage(e));
|
|
@@ -6262,7 +6262,7 @@ const h = class h {
|
|
|
6262
6262
|
* @returns 表示する文言
|
|
6263
6263
|
*/
|
|
6264
6264
|
static resolveValidityMessage(e) {
|
|
6265
|
-
const t = e.getAttribute(`${
|
|
6265
|
+
const t = e.getAttribute(`${l.prefix}validity-message`);
|
|
6266
6266
|
return typeof t == "string" && t.trim() !== "" ? t : Rt;
|
|
6267
6267
|
}
|
|
6268
6268
|
/**
|
|
@@ -6290,10 +6290,10 @@ const h = class h {
|
|
|
6290
6290
|
static warnUnvalidatedCustomValidity(e, t) {
|
|
6291
6291
|
if (!j.isEnabled() || !e)
|
|
6292
6292
|
return;
|
|
6293
|
-
const r = `${
|
|
6294
|
-
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) &&
|
|
6293
|
+
const r = `${l.prefix}validity`;
|
|
6294
|
+
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && m.warn(
|
|
6295
6295
|
"Haori",
|
|
6296
|
-
`${r} は指定されていますが検証は行われません(${t})。${
|
|
6296
|
+
`${r} は指定されていますが検証は行われません(${t})。${l.prefix}{event}-validate を指定するか、${l.prefix}{event}-if を使用してください。`
|
|
6297
6297
|
);
|
|
6298
6298
|
}
|
|
6299
6299
|
/**
|
|
@@ -6351,9 +6351,9 @@ const h = class h {
|
|
|
6351
6351
|
* @param reason 退いた理由
|
|
6352
6352
|
*/
|
|
6353
6353
|
static warnPositionalRowFallback(e) {
|
|
6354
|
-
!j.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e),
|
|
6354
|
+
!j.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e), m.warn(
|
|
6355
6355
|
"[Haori]",
|
|
6356
|
-
`${
|
|
6356
|
+
`${l.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6357
6357
|
));
|
|
6358
6358
|
}
|
|
6359
6359
|
/**
|
|
@@ -6462,10 +6462,10 @@ const h = class h {
|
|
|
6462
6462
|
* @returns 同じ配列を指す場合、または判定できない場合は true
|
|
6463
6463
|
*/
|
|
6464
6464
|
static isCollectedListFromEachSource(e) {
|
|
6465
|
-
const t = e.getAttribute(`${
|
|
6465
|
+
const t = e.getAttribute(`${l.prefix}form-list`);
|
|
6466
6466
|
if (t == null || t === "")
|
|
6467
6467
|
return !0;
|
|
6468
|
-
const r = e.getRawAttribute(`${
|
|
6468
|
+
const r = e.getRawAttribute(`${l.prefix}each`);
|
|
6469
6469
|
if (typeof r != "string" || r.trim() === "")
|
|
6470
6470
|
return !0;
|
|
6471
6471
|
const i = h.resolveLeadingPath(r);
|
|
@@ -6559,9 +6559,9 @@ const h = class h {
|
|
|
6559
6559
|
const a = r.keys[s], o = i.get(a);
|
|
6560
6560
|
if (!o || o.length === 0)
|
|
6561
6561
|
continue;
|
|
6562
|
-
const
|
|
6562
|
+
const c = o.shift();
|
|
6563
6563
|
n.push(
|
|
6564
|
-
h.overlayCollectedValue(e[
|
|
6564
|
+
h.overlayCollectedValue(e[c], t[s])
|
|
6565
6565
|
);
|
|
6566
6566
|
}
|
|
6567
6567
|
return n;
|
|
@@ -6598,7 +6598,7 @@ const h = class h {
|
|
|
6598
6598
|
* @returns フォームフラグメントと `data-form-arg` のキー名の組
|
|
6599
6599
|
*/
|
|
6600
6600
|
static collectArgForms(e) {
|
|
6601
|
-
const t = `${
|
|
6601
|
+
const t = `${l.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
6602
6602
|
return r.forEach((n) => {
|
|
6603
6603
|
const s = x.get(n);
|
|
6604
6604
|
if (!(s instanceof I))
|
|
@@ -6683,11 +6683,11 @@ const h = class h {
|
|
|
6683
6683
|
const n = x.get(i);
|
|
6684
6684
|
if (!(n instanceof I))
|
|
6685
6685
|
continue;
|
|
6686
|
-
const s = n.getRawBindingData(), a = n.getAttribute(`${
|
|
6687
|
-
if (!(!s && !
|
|
6688
|
-
if (h.INITIAL_RESTORED_FORMS.add(i),
|
|
6686
|
+
const s = n.getRawBindingData(), a = n.getAttribute(`${l.prefix}form-arg`), o = a ? String(a) : null, c = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ? h.resolveAncestorArgOwner(n, o) : null;
|
|
6687
|
+
if (!(!s && !c)) {
|
|
6688
|
+
if (h.INITIAL_RESTORED_FORMS.add(i), c) {
|
|
6689
6689
|
r.push(
|
|
6690
|
-
h.pushAncestorArgValue(n, o,
|
|
6690
|
+
h.pushAncestorArgValue(n, o, c.value)
|
|
6691
6691
|
);
|
|
6692
6692
|
continue;
|
|
6693
6693
|
}
|
|
@@ -6758,7 +6758,7 @@ const h = class h {
|
|
|
6758
6758
|
* @returns 新しい階層を始める場合は true
|
|
6759
6759
|
*/
|
|
6760
6760
|
static startsCollectionLevel(e) {
|
|
6761
|
-
return h.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${
|
|
6761
|
+
return h.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${l.prefix}form-object`) || e.getAttribute(`${l.prefix}form-list`));
|
|
6762
6762
|
}
|
|
6763
6763
|
/**
|
|
6764
6764
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -6780,7 +6780,7 @@ const h = class h {
|
|
|
6780
6780
|
let t = e, r = t.getParent();
|
|
6781
6781
|
for (; r !== null; ) {
|
|
6782
6782
|
if (h.startsCollectionLevel(r))
|
|
6783
|
-
return r.getAttribute(`${
|
|
6783
|
+
return r.getAttribute(`${l.prefix}form-object`) ? r : t;
|
|
6784
6784
|
if (h.isFormScopeRoot(r))
|
|
6785
6785
|
return r;
|
|
6786
6786
|
t = r, r = r.getParent();
|
|
@@ -6794,7 +6794,7 @@ const h = class h {
|
|
|
6794
6794
|
* @returns フォームの範囲の根であれば true
|
|
6795
6795
|
*/
|
|
6796
6796
|
static isFormScopeRoot(e) {
|
|
6797
|
-
return e.getTarget() instanceof HTMLFormElement || e.hasAttribute(`${
|
|
6797
|
+
return e.getTarget() instanceof HTMLFormElement || e.hasAttribute(`${l.prefix}form`);
|
|
6798
6798
|
}
|
|
6799
6799
|
/**
|
|
6800
6800
|
* 階層の中から、同じ収集キーを持つ群の欄を集めます。
|
|
@@ -6816,9 +6816,9 @@ const h = class h {
|
|
|
6816
6816
|
static collectGroupMembers(e, t, r) {
|
|
6817
6817
|
h.isGroupedCheckable(e) && String(h.resolveFieldName(e)) === t && r.push(e);
|
|
6818
6818
|
for (const i of e.getChildElementFragments())
|
|
6819
|
-
h.startsCollectionLevel(i) || i.hasAttribute(`${
|
|
6819
|
+
h.startsCollectionLevel(i) || i.hasAttribute(`${l.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
6820
6820
|
// (`getPartValues()` と同じ理由)。
|
|
6821
|
-
i.getTarget().hasAttribute(`${
|
|
6821
|
+
i.getTarget().hasAttribute(`${l.prefix}if-false`) || h.collectGroupMembers(i, t, r);
|
|
6822
6822
|
}
|
|
6823
6823
|
/**
|
|
6824
6824
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -6895,11 +6895,11 @@ const h = class h {
|
|
|
6895
6895
|
*/
|
|
6896
6896
|
static setPartValues(e, t, r = !1, i = !0, n = !1, s = /* @__PURE__ */ new Map(), a = null) {
|
|
6897
6897
|
const o = [];
|
|
6898
|
-
if (e.hasAttribute(`${
|
|
6898
|
+
if (e.hasAttribute(`${l.prefix}form-detach`) && !r)
|
|
6899
6899
|
return Promise.resolve();
|
|
6900
|
-
const
|
|
6901
|
-
if (
|
|
6902
|
-
const g = t[String(
|
|
6900
|
+
const c = h.resolveFieldName(e), u = e.getAttribute(`${l.prefix}form-object`), d = e.getAttribute(`${l.prefix}form-list`), p = e.hasAttribute(`${l.prefix}form-list`);
|
|
6901
|
+
if (c) {
|
|
6902
|
+
const g = t[String(c)], E = n && h.hasResolvedDeclarativeState(e), v = n && typeof g > "u" && !h.isDeclarativeStateBound(e);
|
|
6903
6903
|
let D = g;
|
|
6904
6904
|
if (E ? D = void 0 : v && (D = null), h.isFileInput(e))
|
|
6905
6905
|
return (D === null || D === "") && o.push(
|
|
@@ -6910,7 +6910,7 @@ const h = class h {
|
|
|
6910
6910
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
6911
6911
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
6912
6912
|
!h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
|
|
6913
|
-
const M = String(
|
|
6913
|
+
const M = String(c), H = s.get(M) ?? 0;
|
|
6914
6914
|
s.set(M, H + 1), o.push(
|
|
6915
6915
|
h.applyFragmentValue(
|
|
6916
6916
|
e,
|
|
@@ -6949,7 +6949,7 @@ const h = class h {
|
|
|
6949
6949
|
} else if (d) {
|
|
6950
6950
|
const g = t[String(d)];
|
|
6951
6951
|
if (Array.isArray(g)) {
|
|
6952
|
-
const E = e.getChildElementFragments(), v = e.getAttribute(`${
|
|
6952
|
+
const E = e.getChildElementFragments(), v = e.getAttribute(`${l.prefix}each-key`), D = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
|
|
6953
6953
|
E,
|
|
6954
6954
|
g,
|
|
6955
6955
|
v == null ? null : String(v)
|
|
@@ -7032,17 +7032,17 @@ const h = class h {
|
|
|
7032
7032
|
const s = h.getInitialBindingData(n);
|
|
7033
7033
|
if (n.getRawBindingData() === null && s === null)
|
|
7034
7034
|
continue;
|
|
7035
|
-
const a = h.getValues(n), o = n.getAttribute(`${
|
|
7036
|
-
let
|
|
7035
|
+
const a = h.getValues(n), o = n.getAttribute(`${l.prefix}form-arg`);
|
|
7036
|
+
let c = { ...s || {} };
|
|
7037
7037
|
if (o) {
|
|
7038
7038
|
const u = String(o);
|
|
7039
|
-
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && h.resolveAncestorArgOwner(n, u) !== null || (
|
|
7040
|
-
|
|
7039
|
+
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && h.resolveAncestorArgOwner(n, u) !== null || (c[u] = h.mergeCollectedValues(
|
|
7040
|
+
c[u] ?? null,
|
|
7041
7041
|
a
|
|
7042
7042
|
));
|
|
7043
7043
|
} else
|
|
7044
|
-
|
|
7045
|
-
await B.setBindingData(n.getTarget(),
|
|
7044
|
+
c = h.mergeCollectedValues(c, a);
|
|
7045
|
+
await B.setBindingData(n.getTarget(), c, {
|
|
7046
7046
|
sequence: t
|
|
7047
7047
|
});
|
|
7048
7048
|
}
|
|
@@ -7095,9 +7095,9 @@ const h = class h {
|
|
|
7095
7095
|
*/
|
|
7096
7096
|
static clearEachClones(e) {
|
|
7097
7097
|
const t = [], r = (n) => {
|
|
7098
|
-
if (n.hasAttribute(`${
|
|
7098
|
+
if (n.hasAttribute(`${l.prefix}each`)) {
|
|
7099
7099
|
for (const s of n.getChildElementFragments()) {
|
|
7100
|
-
const a = s.hasAttribute(`${
|
|
7100
|
+
const a = s.hasAttribute(`${l.prefix}each-before`), o = s.hasAttribute(`${l.prefix}each-after`);
|
|
7101
7101
|
!a && !o && t.push(s.remove());
|
|
7102
7102
|
}
|
|
7103
7103
|
n.setEachInputSignature(null);
|
|
@@ -7184,7 +7184,7 @@ const h = class h {
|
|
|
7184
7184
|
* @returns 反映完了の Promise
|
|
7185
7185
|
*/
|
|
7186
7186
|
static async restoreAncestorArgValues(e, t = null) {
|
|
7187
|
-
const r = e.getAttribute(`${
|
|
7187
|
+
const r = e.getAttribute(`${l.prefix}form-arg`);
|
|
7188
7188
|
if (!r)
|
|
7189
7189
|
return;
|
|
7190
7190
|
const i = String(r), n = h.resolveAncestorArgOwner(e, i);
|
|
@@ -7240,10 +7240,10 @@ const h = class h {
|
|
|
7240
7240
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7241
7241
|
*/
|
|
7242
7242
|
static addMessage(e, t, r, i) {
|
|
7243
|
-
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r),
|
|
7244
|
-
return
|
|
7243
|
+
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), c = h.findFragmentsByKey(e, t);
|
|
7244
|
+
return c.forEach((u) => {
|
|
7245
7245
|
n.push(o(u.getTarget()));
|
|
7246
|
-
}),
|
|
7246
|
+
}), c.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
7247
7247
|
});
|
|
7248
7248
|
}
|
|
7249
7249
|
/**
|
|
@@ -7266,21 +7266,21 @@ const h = class h {
|
|
|
7266
7266
|
*/
|
|
7267
7267
|
static findFragmentByKeyParts(e, t) {
|
|
7268
7268
|
const r = [], i = t[0];
|
|
7269
|
-
if (t.length == 1 && h.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${
|
|
7270
|
-
t.length > 1 && e.getAttribute(`${
|
|
7269
|
+
if (t.length == 1 && h.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${l.prefix}form-object`))
|
|
7270
|
+
t.length > 1 && e.getAttribute(`${l.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
7271
7271
|
r.push(...h.findFragmentByKeyParts(s, t.slice(1)));
|
|
7272
7272
|
});
|
|
7273
|
-
else if (e.hasAttribute(`${
|
|
7273
|
+
else if (e.hasAttribute(`${l.prefix}form-list`)) {
|
|
7274
7274
|
if (t.length > 1) {
|
|
7275
|
-
const n = e.getAttribute(`${
|
|
7275
|
+
const n = e.getAttribute(`${l.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
|
|
7276
7276
|
if (s !== -1 && a !== -1 && s < a) {
|
|
7277
7277
|
const o = i.substring(0, s);
|
|
7278
7278
|
if (n === o) {
|
|
7279
|
-
const
|
|
7279
|
+
const c = i.substring(s + 1, a), u = Number(c);
|
|
7280
7280
|
if (isNaN(u))
|
|
7281
|
-
|
|
7281
|
+
m.error("Haori", `Invalid index: ${i}`);
|
|
7282
7282
|
else {
|
|
7283
|
-
const d = e.getChildElementFragments().filter((p) => p.hasAttribute(`${
|
|
7283
|
+
const d = e.getChildElementFragments().filter((p) => p.hasAttribute(`${l.prefix}row`));
|
|
7284
7284
|
u < d.length && r.push(
|
|
7285
7285
|
...h.findFragmentByKeyParts(d[u], t.slice(1))
|
|
7286
7286
|
);
|
|
@@ -7307,7 +7307,7 @@ const h = class h {
|
|
|
7307
7307
|
*/
|
|
7308
7308
|
static getFormFragment(e) {
|
|
7309
7309
|
const t = e.getTarget();
|
|
7310
|
-
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${
|
|
7310
|
+
if (t instanceof HTMLFormElement || t instanceof HTMLElement && t.hasAttribute(`${l.prefix}form`))
|
|
7311
7311
|
return e;
|
|
7312
7312
|
const r = e.getParent();
|
|
7313
7313
|
return r ? this.getFormFragment(r) : null;
|
|
@@ -7392,9 +7392,9 @@ class U {
|
|
|
7392
7392
|
*/
|
|
7393
7393
|
static bindChange(e, t, r, i = "other") {
|
|
7394
7394
|
const n = [], s = new Set(Object.keys(t || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
7395
|
-
for (const
|
|
7396
|
-
const u = t?.[
|
|
7397
|
-
u !== d && n.push(
|
|
7395
|
+
for (const c of o) {
|
|
7396
|
+
const u = t?.[c], d = r[c];
|
|
7397
|
+
u !== d && n.push(c);
|
|
7398
7398
|
}
|
|
7399
7399
|
U.dispatch(e, "bindchange", {
|
|
7400
7400
|
previous: t || {},
|
|
@@ -7562,8 +7562,8 @@ const Dt = {
|
|
|
7562
7562
|
401: "unauthorized-redirect",
|
|
7563
7563
|
403: "forbidden-redirect"
|
|
7564
7564
|
};
|
|
7565
|
-
function It(
|
|
7566
|
-
return
|
|
7565
|
+
function It(y, e) {
|
|
7566
|
+
return y.replace(/\{\{([\s\S]+?)\}\}/g, (t, r) => {
|
|
7567
7567
|
try {
|
|
7568
7568
|
const i = Q.evaluate(String(r).trim(), e);
|
|
7569
7569
|
return i == null ? "" : String(i);
|
|
@@ -7572,17 +7572,17 @@ function It(m, e) {
|
|
|
7572
7572
|
}
|
|
7573
7573
|
});
|
|
7574
7574
|
}
|
|
7575
|
-
function Nt(
|
|
7576
|
-
const t =
|
|
7575
|
+
function Nt(y, e) {
|
|
7576
|
+
const t = y.getAttribute(e);
|
|
7577
7577
|
if (t === null || t === "")
|
|
7578
7578
|
return null;
|
|
7579
7579
|
if (!t.includes("{{"))
|
|
7580
7580
|
return t;
|
|
7581
|
-
const r = x.get(
|
|
7581
|
+
const r = x.get(y), i = r instanceof I ? r.getBindingData() : {}, n = It(t, i);
|
|
7582
7582
|
return n === "" ? null : n;
|
|
7583
7583
|
}
|
|
7584
|
-
function Ft(
|
|
7585
|
-
const r =
|
|
7584
|
+
function Ft(y, e, t) {
|
|
7585
|
+
const r = y.getAttribute(`${e}-return-param`);
|
|
7586
7586
|
if (r === null || r === "")
|
|
7587
7587
|
return t;
|
|
7588
7588
|
try {
|
|
@@ -7591,14 +7591,14 @@ function Ft(m, e, t) {
|
|
|
7591
7591
|
} catch {
|
|
7592
7592
|
return t;
|
|
7593
7593
|
}
|
|
7594
|
-
const i = window.location.pathname + window.location.search + window.location.hash, s = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "",
|
|
7595
|
-
return `${
|
|
7594
|
+
const i = window.location.pathname + window.location.search + window.location.hash, s = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "", c = a >= 0 ? t.slice(0, a) : t, u = c.includes("?") ? "&" : "?";
|
|
7595
|
+
return `${c}${u}${s}${o}`;
|
|
7596
7596
|
}
|
|
7597
|
-
function ft(
|
|
7598
|
-
const e = Dt[
|
|
7597
|
+
function ft(y) {
|
|
7598
|
+
const e = Dt[y];
|
|
7599
7599
|
if (e === void 0 || typeof document > "u")
|
|
7600
7600
|
return !1;
|
|
7601
|
-
const t = `${
|
|
7601
|
+
const t = `${l.prefix}${e}`, r = [];
|
|
7602
7602
|
document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
|
|
7603
7603
|
for (const i of r) {
|
|
7604
7604
|
const n = Nt(i, t);
|
|
@@ -7644,7 +7644,7 @@ class z {
|
|
|
7644
7644
|
try {
|
|
7645
7645
|
return Array.from(r.querySelectorAll(e));
|
|
7646
7646
|
} catch (i) {
|
|
7647
|
-
return
|
|
7647
|
+
return m.error(
|
|
7648
7648
|
"Haori",
|
|
7649
7649
|
`Invalid selector: ${e} (${t})`,
|
|
7650
7650
|
i
|
|
@@ -7663,7 +7663,7 @@ class z {
|
|
|
7663
7663
|
try {
|
|
7664
7664
|
return r.querySelector(e);
|
|
7665
7665
|
} catch (i) {
|
|
7666
|
-
return
|
|
7666
|
+
return m.error(
|
|
7667
7667
|
"Haori",
|
|
7668
7668
|
`Invalid selector: ${e} (${t})`,
|
|
7669
7669
|
i
|
|
@@ -7689,9 +7689,9 @@ const N = class N {
|
|
|
7689
7689
|
throw new Error("storage is not available");
|
|
7690
7690
|
return t;
|
|
7691
7691
|
} catch (t) {
|
|
7692
|
-
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e),
|
|
7692
|
+
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), m.warn(
|
|
7693
7693
|
"Haori",
|
|
7694
|
-
`${e}Storage が利用できないため ${
|
|
7694
|
+
`${e}Storage が利用できないため ${l.prefix}store を無効にします:`,
|
|
7695
7695
|
t
|
|
7696
7696
|
)), null;
|
|
7697
7697
|
}
|
|
@@ -7725,7 +7725,7 @@ const N = class N {
|
|
|
7725
7725
|
*/
|
|
7726
7726
|
static warnOnce(e, t, r) {
|
|
7727
7727
|
let i = N.WARNED_ELEMENTS.get(e);
|
|
7728
|
-
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t),
|
|
7728
|
+
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t), m.warn("Haori", r));
|
|
7729
7729
|
}
|
|
7730
7730
|
/**
|
|
7731
7731
|
* `data-each` の行の内側かどうかを判定します。
|
|
@@ -7757,7 +7757,7 @@ const N = class N {
|
|
|
7757
7757
|
* @returns 宣言内容。宣言が無い、または無効な場合は null
|
|
7758
7758
|
*/
|
|
7759
7759
|
static readDeclaration(e) {
|
|
7760
|
-
const t = e.getTarget(), r = e.getRawAttribute(`${
|
|
7760
|
+
const t = e.getTarget(), r = e.getRawAttribute(`${l.prefix}store`);
|
|
7761
7761
|
if (r === null)
|
|
7762
7762
|
return null;
|
|
7763
7763
|
const i = r.trim();
|
|
@@ -7765,38 +7765,38 @@ const N = class N {
|
|
|
7765
7765
|
return N.warnOnce(
|
|
7766
7766
|
t,
|
|
7767
7767
|
"key",
|
|
7768
|
-
`${
|
|
7768
|
+
`${l.prefix}store にストレージキーが指定されていません。`
|
|
7769
7769
|
), null;
|
|
7770
7770
|
if (i.includes("{{"))
|
|
7771
7771
|
return N.warnOnce(
|
|
7772
7772
|
t,
|
|
7773
7773
|
"expression",
|
|
7774
|
-
`${
|
|
7774
|
+
`${l.prefix}store に式は使用できません(静的な文字列を指定してください): ${i}`
|
|
7775
7775
|
), null;
|
|
7776
|
-
const n = e.getRawAttribute(`${
|
|
7776
|
+
const n = e.getRawAttribute(`${l.prefix}store-type`);
|
|
7777
7777
|
let s = "session";
|
|
7778
7778
|
if (n !== null) {
|
|
7779
7779
|
const d = n.trim();
|
|
7780
7780
|
d === "local" || d === "session" ? s = d : N.warnOnce(
|
|
7781
7781
|
t,
|
|
7782
7782
|
"type",
|
|
7783
|
-
`${
|
|
7783
|
+
`${l.prefix}store-type は session または local を指定してください(session として扱います): ${d}`
|
|
7784
7784
|
);
|
|
7785
7785
|
}
|
|
7786
|
-
const a = e.getRawAttribute(`${
|
|
7786
|
+
const a = e.getRawAttribute(`${l.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), c = e.getRawAttribute(`${l.prefix}store-params`);
|
|
7787
7787
|
let u = null;
|
|
7788
|
-
if (
|
|
7789
|
-
const d =
|
|
7788
|
+
if (c !== null) {
|
|
7789
|
+
const d = c.split("&").map((g) => g.trim()).filter((g) => g !== ""), p = d.filter((g) => !N.isReservedKey(g));
|
|
7790
7790
|
p.length !== d.length && N.warnOnce(
|
|
7791
7791
|
t,
|
|
7792
7792
|
"reserved",
|
|
7793
|
-
`${
|
|
7793
|
+
`${l.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
7794
7794
|
), u = p.length > 0 ? p : null;
|
|
7795
7795
|
}
|
|
7796
7796
|
return u === null && o === null ? (N.warnOnce(
|
|
7797
7797
|
t,
|
|
7798
7798
|
"target",
|
|
7799
|
-
`${
|
|
7799
|
+
`${l.prefix}store には ${l.prefix}store-params または ${l.prefix}store-arg のいずれかが必要です。`
|
|
7800
7800
|
), null) : { key: i, kind: s, params: u, arg: o };
|
|
7801
7801
|
}
|
|
7802
7802
|
/**
|
|
@@ -7817,7 +7817,7 @@ const N = class N {
|
|
|
7817
7817
|
try {
|
|
7818
7818
|
r = t.getItem(e.key);
|
|
7819
7819
|
} catch (n) {
|
|
7820
|
-
return
|
|
7820
|
+
return m.warn(
|
|
7821
7821
|
"Haori",
|
|
7822
7822
|
`ストレージの読み取りに失敗しました: ${e.key}`,
|
|
7823
7823
|
n
|
|
@@ -7829,13 +7829,13 @@ const N = class N {
|
|
|
7829
7829
|
try {
|
|
7830
7830
|
i = JSON.parse(r);
|
|
7831
7831
|
} catch (n) {
|
|
7832
|
-
return
|
|
7832
|
+
return m.warn(
|
|
7833
7833
|
"Haori",
|
|
7834
7834
|
`保存済みデータが JSON として解釈できません: ${e.key}`,
|
|
7835
7835
|
n
|
|
7836
7836
|
), null;
|
|
7837
7837
|
}
|
|
7838
|
-
return N.isPlainRecord(i) ? i : (
|
|
7838
|
+
return N.isPlainRecord(i) ? i : (m.warn(
|
|
7839
7839
|
"Haori",
|
|
7840
7840
|
`保存済みデータがオブジェクトではありません: ${e.key}`
|
|
7841
7841
|
), null);
|
|
@@ -7854,7 +7854,7 @@ const N = class N {
|
|
|
7854
7854
|
if (s === void 0)
|
|
7855
7855
|
return {};
|
|
7856
7856
|
if (!N.isPlainRecord(s))
|
|
7857
|
-
return
|
|
7857
|
+
return m.warn(
|
|
7858
7858
|
"Haori",
|
|
7859
7859
|
`保存済みデータの ${e.arg} がオブジェクトではありません: ` + e.key
|
|
7860
7860
|
), {};
|
|
@@ -7969,7 +7969,7 @@ const N = class N {
|
|
|
7969
7969
|
try {
|
|
7970
7970
|
return r.setItem(e.key, JSON.stringify(i)), !0;
|
|
7971
7971
|
} catch (n) {
|
|
7972
|
-
return
|
|
7972
|
+
return m.warn(
|
|
7973
7973
|
"Haori",
|
|
7974
7974
|
`ストレージへの保存に失敗しました: ${e.key}`,
|
|
7975
7975
|
n
|
|
@@ -7995,7 +7995,7 @@ const N = class N {
|
|
|
7995
7995
|
return N.warnOnce(
|
|
7996
7996
|
r,
|
|
7997
7997
|
"each-row",
|
|
7998
|
-
`${
|
|
7998
|
+
`${l.prefix}each の行の内側では ${l.prefix}store を使用できません(行データは親要素側で配列キーを指定してください)。`
|
|
7999
7999
|
), Promise.resolve();
|
|
8000
8000
|
N.RESTORED_ELEMENTS.add(r);
|
|
8001
8001
|
const i = N.readRecord(t), n = i ? N.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
@@ -8033,7 +8033,7 @@ const N = class N {
|
|
|
8033
8033
|
return;
|
|
8034
8034
|
const a = N.stringify(n);
|
|
8035
8035
|
if (a === null) {
|
|
8036
|
-
|
|
8036
|
+
m.warn(
|
|
8037
8037
|
"Haori",
|
|
8038
8038
|
`保存対象を直列化できないためミラーを行いません: ${t.key}`
|
|
8039
8039
|
);
|
|
@@ -8061,7 +8061,7 @@ const N = class N {
|
|
|
8061
8061
|
try {
|
|
8062
8062
|
r.removeItem(e);
|
|
8063
8063
|
} catch (i) {
|
|
8064
|
-
|
|
8064
|
+
m.warn("Haori", `ストレージの破棄に失敗しました: ${e}`, i);
|
|
8065
8065
|
return;
|
|
8066
8066
|
}
|
|
8067
8067
|
N.reseedDeclaringElements(e, t);
|
|
@@ -8075,7 +8075,7 @@ const N = class N {
|
|
|
8075
8075
|
*/
|
|
8076
8076
|
static reseedDeclaringElements(e, t) {
|
|
8077
8077
|
document.querySelectorAll(
|
|
8078
|
-
`[${
|
|
8078
|
+
`[${l.prefix}store]`
|
|
8079
8079
|
).forEach((i) => {
|
|
8080
8080
|
if (!N.RESTORED_ELEMENTS.has(i))
|
|
8081
8081
|
return;
|
|
@@ -8149,35 +8149,35 @@ function De() {
|
|
|
8149
8149
|
) ? e : ye;
|
|
8150
8150
|
}
|
|
8151
8151
|
const Ct = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
8152
|
-
function Oe(
|
|
8153
|
-
return Ct.has(
|
|
8152
|
+
function Oe(y) {
|
|
8153
|
+
return Ct.has(y.toUpperCase());
|
|
8154
8154
|
}
|
|
8155
|
-
function kt(
|
|
8155
|
+
function kt(y, e) {
|
|
8156
8156
|
for (const [t, r] of Object.entries(e))
|
|
8157
8157
|
r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
|
|
8158
|
-
|
|
8159
|
-
}) :
|
|
8158
|
+
y.append(t, fe(i));
|
|
8159
|
+
}) : y.append(t, fe(r)));
|
|
8160
8160
|
}
|
|
8161
|
-
function fe(
|
|
8162
|
-
if (
|
|
8161
|
+
function fe(y) {
|
|
8162
|
+
if (y == null)
|
|
8163
8163
|
return "";
|
|
8164
|
-
if (typeof
|
|
8164
|
+
if (typeof y == "object" || typeof y == "function")
|
|
8165
8165
|
try {
|
|
8166
|
-
return JSON.stringify(
|
|
8166
|
+
return JSON.stringify(y) ?? "";
|
|
8167
8167
|
} catch {
|
|
8168
8168
|
return "";
|
|
8169
8169
|
}
|
|
8170
|
-
return String(
|
|
8170
|
+
return String(y);
|
|
8171
8171
|
}
|
|
8172
|
-
function pt(
|
|
8173
|
-
const t = new URL(
|
|
8172
|
+
function pt(y, e) {
|
|
8173
|
+
const t = new URL(y, window.location.href), r = new URLSearchParams(t.search);
|
|
8174
8174
|
return kt(r, e), t.search = r.toString(), t.toString();
|
|
8175
8175
|
}
|
|
8176
|
-
function $t(
|
|
8177
|
-
if (
|
|
8176
|
+
function $t(y) {
|
|
8177
|
+
if (y == null)
|
|
8178
8178
|
return { payload: {}, dropped: !1 };
|
|
8179
|
-
if (typeof
|
|
8180
|
-
const e =
|
|
8179
|
+
if (typeof y == "string") {
|
|
8180
|
+
const e = y.trim();
|
|
8181
8181
|
if (e === "")
|
|
8182
8182
|
return { payload: {}, dropped: !1 };
|
|
8183
8183
|
if (e.startsWith("{")) {
|
|
@@ -8194,12 +8194,12 @@ function $t(m) {
|
|
|
8194
8194
|
dropped: !1
|
|
8195
8195
|
} : { payload: {}, dropped: !0 };
|
|
8196
8196
|
}
|
|
8197
|
-
if (
|
|
8198
|
-
return { payload: Xe(
|
|
8199
|
-
if (typeof FormData < "u" &&
|
|
8197
|
+
if (y instanceof URLSearchParams)
|
|
8198
|
+
return { payload: Xe(y), dropped: !1 };
|
|
8199
|
+
if (typeof FormData < "u" && y instanceof FormData) {
|
|
8200
8200
|
const e = {};
|
|
8201
8201
|
let t = !1;
|
|
8202
|
-
for (const [r, i] of
|
|
8202
|
+
for (const [r, i] of y.entries()) {
|
|
8203
8203
|
if (typeof i != "string") {
|
|
8204
8204
|
t = !0;
|
|
8205
8205
|
continue;
|
|
@@ -8210,28 +8210,28 @@ function $t(m) {
|
|
|
8210
8210
|
}
|
|
8211
8211
|
return { payload: {}, dropped: !0 };
|
|
8212
8212
|
}
|
|
8213
|
-
function Xe(
|
|
8213
|
+
function Xe(y) {
|
|
8214
8214
|
const e = {};
|
|
8215
|
-
for (const [t, r] of
|
|
8215
|
+
for (const [t, r] of y.entries())
|
|
8216
8216
|
gt(e, t, r);
|
|
8217
8217
|
return e;
|
|
8218
8218
|
}
|
|
8219
|
-
function gt(
|
|
8220
|
-
const r =
|
|
8221
|
-
r === void 0 ?
|
|
8219
|
+
function gt(y, e, t) {
|
|
8220
|
+
const r = y[e];
|
|
8221
|
+
r === void 0 ? y[e] = t : Array.isArray(r) ? r.push(t) : y[e] = [r, t];
|
|
8222
8222
|
}
|
|
8223
|
-
function ae(
|
|
8223
|
+
function ae(y, e) {
|
|
8224
8224
|
if (F.isCompleteSetValue(e))
|
|
8225
8225
|
return e;
|
|
8226
8226
|
if (Array.isArray(e)) {
|
|
8227
|
-
const t = Array.isArray(
|
|
8227
|
+
const t = Array.isArray(y) ? y.slice() : [];
|
|
8228
8228
|
let r = !1;
|
|
8229
8229
|
return e.forEach((i, n) => {
|
|
8230
8230
|
i != null && (typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (t[n] = ae(t[n], i), r = !0));
|
|
8231
|
-
}), r ? t :
|
|
8231
|
+
}), r ? t : y;
|
|
8232
8232
|
}
|
|
8233
8233
|
if (e !== null && typeof e == "object") {
|
|
8234
|
-
const t =
|
|
8234
|
+
const t = y !== null && typeof y == "object" && !Array.isArray(y) ? { ...y } : {};
|
|
8235
8235
|
for (const [r, i] of Object.entries(
|
|
8236
8236
|
e
|
|
8237
8237
|
))
|
|
@@ -8240,15 +8240,15 @@ function ae(m, e) {
|
|
|
8240
8240
|
}
|
|
8241
8241
|
return e;
|
|
8242
8242
|
}
|
|
8243
|
-
function Pt(
|
|
8244
|
-
const e =
|
|
8243
|
+
function Pt(y) {
|
|
8244
|
+
const e = y?.body;
|
|
8245
8245
|
return e == null ? !1 : typeof e == "string" ? e !== "" : !0;
|
|
8246
8246
|
}
|
|
8247
|
-
function Lt(
|
|
8247
|
+
function Lt(y, e) {
|
|
8248
8248
|
const t = { ...e || {} }, r = (t.method || "GET").toUpperCase();
|
|
8249
|
-
if (
|
|
8249
|
+
if (l.runtime !== "demo" || Oe(r))
|
|
8250
8250
|
return {
|
|
8251
|
-
url:
|
|
8251
|
+
url: y,
|
|
8252
8252
|
options: t,
|
|
8253
8253
|
requestedMethod: r,
|
|
8254
8254
|
effectiveMethod: r,
|
|
@@ -8257,10 +8257,10 @@ function Lt(m, e) {
|
|
|
8257
8257
|
const { payload: i, dropped: n } = $t(
|
|
8258
8258
|
t.body
|
|
8259
8259
|
);
|
|
8260
|
-
let s =
|
|
8261
|
-
Object.keys(i).length > 0 && (s = pt(s, i)), n &&
|
|
8260
|
+
let s = y;
|
|
8261
|
+
Object.keys(i).length > 0 && (s = pt(s, i)), n && m.warn(
|
|
8262
8262
|
"Haori",
|
|
8263
|
-
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${
|
|
8263
|
+
`The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${l.prefix}{event}-data / ${l.prefix}{event}-form, or use the embedded runtime.`
|
|
8264
8264
|
), delete t.body, t.method = "GET";
|
|
8265
8265
|
const a = new Headers(
|
|
8266
8266
|
t.headers || void 0
|
|
@@ -8274,8 +8274,8 @@ function Lt(m, e) {
|
|
|
8274
8274
|
queryString: new URL(s, window.location.href).search || void 0
|
|
8275
8275
|
};
|
|
8276
8276
|
}
|
|
8277
|
-
function Ot(
|
|
8278
|
-
return
|
|
8277
|
+
function Ot(y) {
|
|
8278
|
+
return y == null ? null : typeof y == "string" ? y : y instanceof URLSearchParams ? y.toString() : y instanceof FormData ? Array.from(y.entries()).map(([e, t]) => t instanceof File ? [
|
|
8279
8279
|
e,
|
|
8280
8280
|
{
|
|
8281
8281
|
type: "file",
|
|
@@ -8283,22 +8283,22 @@ function Ot(m) {
|
|
|
8283
8283
|
size: t.size,
|
|
8284
8284
|
mimeType: t.type
|
|
8285
8285
|
}
|
|
8286
|
-
] : [e, String(t)]) : String(
|
|
8286
|
+
] : [e, String(t)]) : String(y);
|
|
8287
8287
|
}
|
|
8288
|
-
function Se(
|
|
8289
|
-
return
|
|
8288
|
+
function Se(y) {
|
|
8289
|
+
return y instanceof Blob ? !0 : Array.isArray(y) ? y.some(Se) : y !== null && typeof y == "object" ? Object.values(y).some(
|
|
8290
8290
|
Se
|
|
8291
8291
|
) : !1;
|
|
8292
8292
|
}
|
|
8293
|
-
function Bt(
|
|
8294
|
-
return Object.values(
|
|
8293
|
+
function Bt(y) {
|
|
8294
|
+
return Object.values(y).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
8295
8295
|
(t) => !(t instanceof Blob) && Se(t)
|
|
8296
8296
|
) : Se(e));
|
|
8297
8297
|
}
|
|
8298
|
-
function Ie(
|
|
8299
|
-
return Be(F.getValues(
|
|
8298
|
+
function Ie(y) {
|
|
8299
|
+
return Be(F.getValues(y));
|
|
8300
8300
|
}
|
|
8301
|
-
function Be(
|
|
8301
|
+
function Be(y) {
|
|
8302
8302
|
const e = (r) => {
|
|
8303
8303
|
if (r instanceof File)
|
|
8304
8304
|
return r.name;
|
|
@@ -8318,18 +8318,18 @@ function Be(m) {
|
|
|
8318
8318
|
}
|
|
8319
8319
|
return r;
|
|
8320
8320
|
}, t = {};
|
|
8321
|
-
for (const [r, i] of Object.entries(
|
|
8321
|
+
for (const [r, i] of Object.entries(y))
|
|
8322
8322
|
t[r] = e(i);
|
|
8323
|
-
return F.carryCollectedRowIdentity(
|
|
8323
|
+
return F.carryCollectedRowIdentity(y, t), t;
|
|
8324
8324
|
}
|
|
8325
|
-
function Ut(
|
|
8325
|
+
function Ut(y, e) {
|
|
8326
8326
|
const t = new Headers(
|
|
8327
8327
|
e.headers || void 0
|
|
8328
8328
|
), r = Array.from(t.entries()).sort(
|
|
8329
8329
|
([i], [n]) => i.localeCompare(n)
|
|
8330
8330
|
);
|
|
8331
8331
|
return JSON.stringify({
|
|
8332
|
-
url:
|
|
8332
|
+
url: y,
|
|
8333
8333
|
method: String(e.method || "GET").toUpperCase(),
|
|
8334
8334
|
headers: r,
|
|
8335
8335
|
body: Ot(e.body || null)
|
|
@@ -8354,7 +8354,7 @@ const b = class b {
|
|
|
8354
8354
|
* 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
|
|
8355
8355
|
*/
|
|
8356
8356
|
static attrName(e, t, r = !1) {
|
|
8357
|
-
return e ? `${
|
|
8357
|
+
return e ? `${l.prefix}${e}-${t}` : r ? `${l.prefix}fetch-${t}` : `${l.prefix}${t}`;
|
|
8358
8358
|
}
|
|
8359
8359
|
/**
|
|
8360
8360
|
* bind より後で使うアクション属性を読み取り、開始時の評価情報を記録します。
|
|
@@ -8467,11 +8467,11 @@ const b = class b {
|
|
|
8467
8467
|
return { value: e.replace(
|
|
8468
8468
|
b.DATA_PLACEHOLDER_REGEX,
|
|
8469
8469
|
(n, s, a, o) => {
|
|
8470
|
-
const
|
|
8470
|
+
const c = Q.evaluateDetailed(
|
|
8471
8471
|
s ?? a ?? "",
|
|
8472
8472
|
t
|
|
8473
8473
|
);
|
|
8474
|
-
return r = r ||
|
|
8474
|
+
return r = r || c.unresolvedReference, b.isJsonStringContext(e, o) ? b.stringifyJsonTemplateStringContent(c.value) : b.stringifyJsonTemplateValue(c.value);
|
|
8475
8475
|
}
|
|
8476
8476
|
), hasUnresolvedReference: r };
|
|
8477
8477
|
}
|
|
@@ -8508,13 +8508,13 @@ const b = class b {
|
|
|
8508
8508
|
hasUnresolvedReference: s
|
|
8509
8509
|
};
|
|
8510
8510
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
8511
|
-
const
|
|
8511
|
+
const c = b.resolveDataJsonStringDetailed(
|
|
8512
8512
|
r,
|
|
8513
8513
|
e.getBindingData()
|
|
8514
8514
|
);
|
|
8515
8515
|
return {
|
|
8516
|
-
value: B.parseDataBind(
|
|
8517
|
-
hasUnresolvedReference: s ||
|
|
8516
|
+
value: B.parseDataBind(c.value),
|
|
8517
|
+
hasUnresolvedReference: s || c.hasUnresolvedReference
|
|
8518
8518
|
};
|
|
8519
8519
|
}
|
|
8520
8520
|
const o = b.resolveDataParamStringDetailed(
|
|
@@ -8539,7 +8539,7 @@ const b = class b {
|
|
|
8539
8539
|
}, i = t ? b.attrName(t, "if") : b.attrName(null, "if", !0);
|
|
8540
8540
|
if (e.hasAttribute(i)) {
|
|
8541
8541
|
const A = e.getRawAttribute(i);
|
|
8542
|
-
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) :
|
|
8542
|
+
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) : m.warn(
|
|
8543
8543
|
"Haori",
|
|
8544
8544
|
`${i} に条件式が指定されていません。`
|
|
8545
8545
|
);
|
|
@@ -8558,16 +8558,16 @@ const b = class b {
|
|
|
8558
8558
|
);
|
|
8559
8559
|
C !== null ? r.formFragment = F.getFormFragment(
|
|
8560
8560
|
x.get(C)
|
|
8561
|
-
) :
|
|
8561
|
+
) : m.error(
|
|
8562
8562
|
"Haori",
|
|
8563
8563
|
`Form element not found: ${S} (${b.attrName(t, "form")})`
|
|
8564
8564
|
);
|
|
8565
8565
|
} else
|
|
8566
8566
|
r.formFragment = F.getFormFragment(e);
|
|
8567
8567
|
} else (t === "change" || t === "input") && (r.formFragment = F.getFormFragment(e), r.formFragment === null && b.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
8568
|
-
if (e.hasAttribute(`${
|
|
8568
|
+
if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
|
|
8569
8569
|
const S = e.getRawAttribute(
|
|
8570
|
-
`${
|
|
8570
|
+
`${l.prefix}${t}-before-run`
|
|
8571
8571
|
);
|
|
8572
8572
|
try {
|
|
8573
8573
|
r.beforeCallback = new Function(
|
|
@@ -8579,7 +8579,7 @@ ${S}
|
|
|
8579
8579
|
`
|
|
8580
8580
|
);
|
|
8581
8581
|
} catch (C) {
|
|
8582
|
-
|
|
8582
|
+
m.error("Haori", `Invalid before script: ${C}`);
|
|
8583
8583
|
}
|
|
8584
8584
|
}
|
|
8585
8585
|
const A = b.attrName(t, "run");
|
|
@@ -8599,7 +8599,7 @@ ${S}
|
|
|
8599
8599
|
${S}
|
|
8600
8600
|
`);
|
|
8601
8601
|
} catch (V) {
|
|
8602
|
-
|
|
8602
|
+
m.error("Haori", `Invalid run script: ${V}`);
|
|
8603
8603
|
}
|
|
8604
8604
|
}
|
|
8605
8605
|
C && (r.runScript = C);
|
|
@@ -8635,7 +8635,7 @@ ${S}
|
|
|
8635
8635
|
try {
|
|
8636
8636
|
a.headers = B.parseDataBind(S);
|
|
8637
8637
|
} catch (C) {
|
|
8638
|
-
|
|
8638
|
+
m.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8639
8639
|
}
|
|
8640
8640
|
}
|
|
8641
8641
|
} else {
|
|
@@ -8651,7 +8651,7 @@ ${S}
|
|
|
8651
8651
|
try {
|
|
8652
8652
|
a.headers = B.parseDataBind(S);
|
|
8653
8653
|
} catch (C) {
|
|
8654
|
-
|
|
8654
|
+
m.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8655
8655
|
}
|
|
8656
8656
|
}
|
|
8657
8657
|
}
|
|
@@ -8705,14 +8705,14 @@ ${S}
|
|
|
8705
8705
|
S.length > 0 ? (r.bindFragments = [], S.forEach((C) => {
|
|
8706
8706
|
const V = x.get(C);
|
|
8707
8707
|
V && r.bindFragments.push(V);
|
|
8708
|
-
})) :
|
|
8708
|
+
})) : m.error(
|
|
8709
8709
|
"Haori",
|
|
8710
8710
|
`Bind element not found: ${A} (${o})`
|
|
8711
8711
|
);
|
|
8712
8712
|
}
|
|
8713
8713
|
}
|
|
8714
|
-
const
|
|
8715
|
-
t ? e.hasAttribute(
|
|
8714
|
+
const c = b.attrName(t, "bind-arg"), u = b.attrName(null, "arg", !0), d = b.attrName(null, "bind-arg", !0);
|
|
8715
|
+
t ? e.hasAttribute(c) && (r.bindArg = e.getRawAttribute(c)) : e.hasAttribute(u) ? r.bindArg = e.getRawAttribute(
|
|
8716
8716
|
u
|
|
8717
8717
|
) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
|
|
8718
8718
|
const p = t ? b.attrName(t, "bind-params") : b.attrName(null, "bind-params", !0);
|
|
@@ -8748,7 +8748,7 @@ ${S}
|
|
|
8748
8748
|
q.length > 0 ? (r.adjustFragments = [], q.forEach((X) => {
|
|
8749
8749
|
const Y = x.get(X);
|
|
8750
8750
|
Y && r.adjustFragments.push(Y);
|
|
8751
|
-
})) :
|
|
8751
|
+
})) : m.error(
|
|
8752
8752
|
"Haori",
|
|
8753
8753
|
`Adjust element not found: ${k} (${b.attrName(t, "adjust")})`
|
|
8754
8754
|
);
|
|
@@ -8760,9 +8760,9 @@ ${S}
|
|
|
8760
8760
|
isNaN(X) || (r.adjustValue = X);
|
|
8761
8761
|
}
|
|
8762
8762
|
}
|
|
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(`${
|
|
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(`${l.prefix}${t}-after-run`)) {
|
|
8764
8764
|
const k = e.getRawAttribute(
|
|
8765
|
-
`${
|
|
8765
|
+
`${l.prefix}${t}-after-run`
|
|
8766
8766
|
);
|
|
8767
8767
|
try {
|
|
8768
8768
|
r.afterCallback = new Function(
|
|
@@ -8773,7 +8773,7 @@ ${k}
|
|
|
8773
8773
|
`
|
|
8774
8774
|
);
|
|
8775
8775
|
} catch (q) {
|
|
8776
|
-
|
|
8776
|
+
m.error("Haori", `Invalid after script: ${q}`);
|
|
8777
8777
|
}
|
|
8778
8778
|
}
|
|
8779
8779
|
if (e.hasAttribute(b.attrName(t, "dialog")) && (r.dialogMessage = b.unescapeNewlines(
|
|
@@ -8840,7 +8840,7 @@ ${k}
|
|
|
8840
8840
|
);
|
|
8841
8841
|
q !== null ? r.historyFormFragment = F.getFormFragment(
|
|
8842
8842
|
x.get(q)
|
|
8843
|
-
) :
|
|
8843
|
+
) : m.error(
|
|
8844
8844
|
"Haori",
|
|
8845
8845
|
`Form element not found: ${k} (${b.attrName(t, "history-form")})`
|
|
8846
8846
|
);
|
|
@@ -8864,10 +8864,10 @@ ${k}
|
|
|
8864
8864
|
z.queryAll(X, q).forEach((be) => {
|
|
8865
8865
|
const ue = x.get(be);
|
|
8866
8866
|
ue && Y.push(ue);
|
|
8867
|
-
}), Y.length === 0 &&
|
|
8867
|
+
}), Y.length === 0 && m.error("Haori", `Element not found: ${X} (${q})`);
|
|
8868
8868
|
else if (k === "open" || k === "close") {
|
|
8869
8869
|
const te = e.getTarget().closest("dialog");
|
|
8870
|
-
te ? Y.push(x.get(te)) :
|
|
8870
|
+
te ? Y.push(x.get(te)) : m.error("Haori", `Ancestor <dialog> not found (${q})`);
|
|
8871
8871
|
} else
|
|
8872
8872
|
Y.push(e);
|
|
8873
8873
|
if (Y.length > 0)
|
|
@@ -8902,12 +8902,12 @@ ${k}
|
|
|
8902
8902
|
const q = z.query(k, _);
|
|
8903
8903
|
if (q !== null) {
|
|
8904
8904
|
const X = x.get(q);
|
|
8905
|
-
X ? r.copySourceFragment = X :
|
|
8905
|
+
X ? r.copySourceFragment = X : m.error(
|
|
8906
8906
|
"Haori",
|
|
8907
8907
|
`Element is not managed by Haori: ${k} (${_})`
|
|
8908
8908
|
);
|
|
8909
8909
|
} else
|
|
8910
|
-
|
|
8910
|
+
m.error(
|
|
8911
8911
|
"Haori",
|
|
8912
8912
|
`Element not found: ${k} (${_})`
|
|
8913
8913
|
);
|
|
@@ -8927,7 +8927,7 @@ ${k}
|
|
|
8927
8927
|
);
|
|
8928
8928
|
S !== null ? r.formFragment = F.getFormFragment(
|
|
8929
8929
|
x.get(S)
|
|
8930
|
-
) :
|
|
8930
|
+
) : m.error(
|
|
8931
8931
|
"Haori",
|
|
8932
8932
|
`Form element not found: ${A} (${b.attrName(null, "fetch-form", !0)})`
|
|
8933
8933
|
);
|
|
@@ -8940,7 +8940,7 @@ ${k}
|
|
|
8940
8940
|
A ? (z.queryAll(A, M).forEach((V) => {
|
|
8941
8941
|
const L = x.get(V);
|
|
8942
8942
|
L && S.push(L);
|
|
8943
|
-
}), S.length === 0 &&
|
|
8943
|
+
}), S.length === 0 && m.error(
|
|
8944
8944
|
"Haori",
|
|
8945
8945
|
`Element not found: ${A} (${M})`
|
|
8946
8946
|
)) : S.push(e), S.length > 0 && (r.fetchStateFragments = S);
|
|
@@ -8949,7 +8949,7 @@ ${k}
|
|
|
8949
8949
|
if (e.hasAttribute(H)) {
|
|
8950
8950
|
const A = e.getRawAttribute(H), S = A === null ? "" : A.trim();
|
|
8951
8951
|
if (S === "")
|
|
8952
|
-
|
|
8952
|
+
m.error(
|
|
8953
8953
|
"Haori",
|
|
8954
8954
|
`ストレージキーが指定されていません (${H})`
|
|
8955
8955
|
);
|
|
@@ -8958,7 +8958,7 @@ ${k}
|
|
|
8958
8958
|
const C = e.getRawAttribute(
|
|
8959
8959
|
`${H}-type`
|
|
8960
8960
|
), V = C === null ? "session" : C.trim();
|
|
8961
|
-
V === "local" || V === "session" ? r.storeClearKind = V : (
|
|
8961
|
+
V === "local" || V === "session" ? r.storeClearKind = V : (m.warn(
|
|
8962
8962
|
"Haori",
|
|
8963
8963
|
`${H}-type は session または local を指定してください(session として扱います): ${V}`
|
|
8964
8964
|
), r.storeClearKind = "session");
|
|
@@ -8986,7 +8986,7 @@ ${k}
|
|
|
8986
8986
|
];
|
|
8987
8987
|
for (const i of r) {
|
|
8988
8988
|
const n = i.getParent();
|
|
8989
|
-
!n || !n.hasAttribute(`${
|
|
8989
|
+
!n || !n.hasAttribute(`${l.prefix}each`) || !n.hasAttribute(`${l.prefix}form-list`) || t.set(
|
|
8990
8990
|
i,
|
|
8991
8991
|
b.getRowFragments(n).includes(i) ? n : null
|
|
8992
8992
|
);
|
|
@@ -9003,7 +9003,7 @@ ${k}
|
|
|
9003
9003
|
*/
|
|
9004
9004
|
static isNamedInputFragment(e) {
|
|
9005
9005
|
const t = e.getTarget();
|
|
9006
|
-
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${
|
|
9006
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${l.prefix}form-name`) : !1;
|
|
9007
9007
|
}
|
|
9008
9008
|
/**
|
|
9009
9009
|
* ElementFragment の構造的タイプガード。
|
|
@@ -9062,7 +9062,7 @@ ${k}
|
|
|
9062
9062
|
try {
|
|
9063
9063
|
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || (!this.options.formFragment && this.options.targetFragment && F.warnUnvalidatedCustomValidity(
|
|
9064
9064
|
F.getFormFragment(this.options.targetFragment),
|
|
9065
|
-
`${
|
|
9065
|
+
`${l.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
9066
9066
|
), !this.evaluateExecutionCondition()))
|
|
9067
9067
|
return !1;
|
|
9068
9068
|
if (this.options.runScript) {
|
|
@@ -9074,7 +9074,7 @@ ${k}
|
|
|
9074
9074
|
);
|
|
9075
9075
|
g === !1 && this.domEvent && this.domEvent.preventDefault(), g != null && typeof g.then == "function" && await g;
|
|
9076
9076
|
} catch (g) {
|
|
9077
|
-
|
|
9077
|
+
m.error("Haori", `Run script execution error: ${g}`);
|
|
9078
9078
|
}
|
|
9079
9079
|
}
|
|
9080
9080
|
if (!await this.confirm())
|
|
@@ -9099,7 +9099,7 @@ ${k}
|
|
|
9099
9099
|
typeof p == "object" && (a = "fetchUrl" in p, o = "fetchOptions" in p, n = a ? p.fetchUrl : n, s = o ? p.fetchOptions : s);
|
|
9100
9100
|
}
|
|
9101
9101
|
}
|
|
9102
|
-
const
|
|
9102
|
+
const c = Object.keys(i).length > 0;
|
|
9103
9103
|
if (n) {
|
|
9104
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
9105
|
E,
|
|
@@ -9107,17 +9107,17 @@ ${k}
|
|
|
9107
9107
|
);
|
|
9108
9108
|
n = v.url;
|
|
9109
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 &&
|
|
9111
|
-
runtime:
|
|
9110
|
+
if (A && m.info("Haori demo fetch normalization", {
|
|
9111
|
+
runtime: l.runtime,
|
|
9112
9112
|
requestedMethod: M,
|
|
9113
9113
|
effectiveMethod: H,
|
|
9114
9114
|
transportMode: "query-get",
|
|
9115
9115
|
url: n,
|
|
9116
|
-
payload:
|
|
9116
|
+
payload: c ? i : void 0,
|
|
9117
9117
|
queryString: S
|
|
9118
9118
|
}), this.options.targetFragment && n) {
|
|
9119
9119
|
const C = performance.now(), V = {
|
|
9120
|
-
runtime:
|
|
9120
|
+
runtime: l.runtime,
|
|
9121
9121
|
requestedMethod: M,
|
|
9122
9122
|
effectiveMethod: H,
|
|
9123
9123
|
transportMode: A ? "query-get" : "http",
|
|
@@ -9127,7 +9127,7 @@ ${k}
|
|
|
9127
9127
|
this.options.targetFragment.getTarget(),
|
|
9128
9128
|
n,
|
|
9129
9129
|
D,
|
|
9130
|
-
|
|
9130
|
+
c ? i : void 0,
|
|
9131
9131
|
V
|
|
9132
9132
|
), await this.injectFetchState("loading"), await fetch(n, D).then((L) => this.handleFetchResult(
|
|
9133
9133
|
L,
|
|
@@ -9147,10 +9147,10 @@ ${k}
|
|
|
9147
9147
|
}
|
|
9148
9148
|
return await fetch(n, D).then((C) => this.handleFetchResult(C, n || void 0));
|
|
9149
9149
|
}
|
|
9150
|
-
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment &&
|
|
9150
|
+
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
|
|
9151
9151
|
const p = this.options.formFragment, g = p.getTarget(), E = /* @__PURE__ */ new Set();
|
|
9152
9152
|
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
9153
|
-
const v = p.getRawBindingData(), D = Be(i), M = p.getAttribute(`${
|
|
9153
|
+
const v = p.getRawBindingData(), D = Be(i), M = p.getAttribute(`${l.prefix}form-arg`);
|
|
9154
9154
|
let H;
|
|
9155
9155
|
if (M) {
|
|
9156
9156
|
H = { ...v ?? {} };
|
|
@@ -9173,8 +9173,8 @@ ${k}
|
|
|
9173
9173
|
)
|
|
9174
9174
|
});
|
|
9175
9175
|
}
|
|
9176
|
-
this.suppressEmptyReplaceBind = !
|
|
9177
|
-
const u =
|
|
9176
|
+
this.suppressEmptyReplaceBind = !c && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input"), this.twoWayCommitBind = this.eventType === "change" || this.eventType === "input";
|
|
9177
|
+
const u = c ? Be(i) : {}, d = new Response(JSON.stringify(u), {
|
|
9178
9178
|
headers: { "Content-Type": "application/json" }
|
|
9179
9179
|
});
|
|
9180
9180
|
return await this.handleFetchResult(d);
|
|
@@ -9193,7 +9193,7 @@ ${k}
|
|
|
9193
9193
|
const t = this.options.targetFragment.getTarget();
|
|
9194
9194
|
if (b.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Pe))
|
|
9195
9195
|
return !1;
|
|
9196
|
-
const r = t.hasAttribute(`${
|
|
9196
|
+
const r = t.hasAttribute(`${l.prefix}click-no-disabled`);
|
|
9197
9197
|
return b.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Pe, ""), r || t.setAttribute("disabled", ""), {
|
|
9198
9198
|
target: t,
|
|
9199
9199
|
appliedDisabledAttribute: !r
|
|
@@ -9257,10 +9257,10 @@ ${k}
|
|
|
9257
9257
|
}
|
|
9258
9258
|
this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((g) => {
|
|
9259
9259
|
const E = g.getTarget();
|
|
9260
|
-
E instanceof HTMLElement ? s.push(i.openDialog(E)) :
|
|
9260
|
+
E instanceof HTMLElement ? s.push(i.openDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
|
|
9261
9261
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((g) => {
|
|
9262
9262
|
const E = g.getTarget();
|
|
9263
|
-
E instanceof HTMLElement ? s.push(i.closeDialog(E)) :
|
|
9263
|
+
E instanceof HTMLElement ? s.push(i.closeDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
|
|
9264
9264
|
}), await Promise.all(s);
|
|
9265
9265
|
const a = b.unescapeNewlines(
|
|
9266
9266
|
this.resolveLateAttribute("dialog", this.options.dialogMessage)
|
|
@@ -9271,12 +9271,12 @@ ${k}
|
|
|
9271
9271
|
this.options.toastMessage
|
|
9272
9272
|
);
|
|
9273
9273
|
o && await i.toast(o, this.options.toastLevel ?? "info"), this.clearStore(), this.pushHistory();
|
|
9274
|
-
const
|
|
9274
|
+
const c = this.resolveLateAttribute(
|
|
9275
9275
|
"scroll",
|
|
9276
9276
|
this.options.scrollTarget
|
|
9277
9277
|
);
|
|
9278
|
-
|
|
9279
|
-
|
|
9278
|
+
c && z.query(
|
|
9279
|
+
c,
|
|
9280
9280
|
b.attrName(this.eventType, "scroll"),
|
|
9281
9281
|
document
|
|
9282
9282
|
)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
@@ -9287,7 +9287,7 @@ ${k}
|
|
|
9287
9287
|
"redirect-replace",
|
|
9288
9288
|
this.options.redirectReplaceUrl
|
|
9289
9289
|
);
|
|
9290
|
-
u && d &&
|
|
9290
|
+
u && d && m.warn(
|
|
9291
9291
|
"Haori",
|
|
9292
9292
|
`${b.attrName(this.eventType, "redirect")} と ${b.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
9293
9293
|
);
|
|
@@ -9302,7 +9302,7 @@ ${k}
|
|
|
9302
9302
|
const D = new URLSearchParams(window.location.search).get(E);
|
|
9303
9303
|
if (D !== null) {
|
|
9304
9304
|
const M = D.trim();
|
|
9305
|
-
ht.isSafeLocalPath(M) ? g = M :
|
|
9305
|
+
ht.isSafeLocalPath(M) ? g = M : m.warn(
|
|
9306
9306
|
"Haori",
|
|
9307
9307
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${D}`
|
|
9308
9308
|
);
|
|
@@ -9339,7 +9339,7 @@ ${k}
|
|
|
9339
9339
|
if (!i || !n || !n.hasAttribute(i.attributeName))
|
|
9340
9340
|
return r;
|
|
9341
9341
|
const s = n.getAttributeEvaluation(i.attributeName);
|
|
9342
|
-
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (j.isEnabled() &&
|
|
9342
|
+
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (j.isEnabled() && m.warn(
|
|
9343
9343
|
"Haori",
|
|
9344
9344
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
9345
9345
|
), r) : s.value ?? null;
|
|
@@ -9361,20 +9361,20 @@ ${k}
|
|
|
9361
9361
|
const a = t ? e : window.location.pathname, o = new URL(a, window.location.href);
|
|
9362
9362
|
if (o.origin !== window.location.origin) {
|
|
9363
9363
|
const u = "history.pushState: cross-origin URL is not allowed: " + o.toString();
|
|
9364
|
-
|
|
9364
|
+
m.error("Haori", u);
|
|
9365
9365
|
return;
|
|
9366
9366
|
}
|
|
9367
|
-
const
|
|
9367
|
+
const c = (u) => {
|
|
9368
9368
|
for (const [d, p] of Object.entries(u))
|
|
9369
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)));
|
|
9370
9370
|
};
|
|
9371
|
-
n &&
|
|
9371
|
+
n && c(r), s && c(i), history.pushState(
|
|
9372
9372
|
{ [Mt]: !0 },
|
|
9373
9373
|
"",
|
|
9374
9374
|
o.toString()
|
|
9375
9375
|
);
|
|
9376
9376
|
} catch (a) {
|
|
9377
|
-
|
|
9377
|
+
m.error("Haori", `history.pushState failed: ${a}`);
|
|
9378
9378
|
}
|
|
9379
9379
|
}
|
|
9380
9380
|
/**
|
|
@@ -9398,40 +9398,40 @@ ${k}
|
|
|
9398
9398
|
try {
|
|
9399
9399
|
const a = await e.json(), o = [];
|
|
9400
9400
|
if (Array.isArray(a)) {
|
|
9401
|
-
const
|
|
9401
|
+
const c = /* @__PURE__ */ new Map(), u = [];
|
|
9402
9402
|
for (const d of a)
|
|
9403
9403
|
if (d && typeof d == "object" && !Array.isArray(d)) {
|
|
9404
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) : "";
|
|
9405
9405
|
if (v.length === 0)
|
|
9406
9406
|
continue;
|
|
9407
9407
|
if (E !== null) {
|
|
9408
|
-
const D =
|
|
9409
|
-
D.push(v),
|
|
9408
|
+
const D = c.get(E) ?? [];
|
|
9409
|
+
D.push(v), c.set(E, D);
|
|
9410
9410
|
} else
|
|
9411
9411
|
u.push(v);
|
|
9412
9412
|
} else typeof d == "string" && d.length > 0 && u.push(d);
|
|
9413
|
-
for (const [d, p] of
|
|
9413
|
+
for (const [d, p] of c)
|
|
9414
9414
|
o.push({ key: d, message: p.join(`
|
|
9415
9415
|
`) });
|
|
9416
9416
|
for (const d of u)
|
|
9417
9417
|
o.push({ message: d });
|
|
9418
9418
|
} else if (a && typeof a == "object") {
|
|
9419
9419
|
if (typeof a.message == "string" && o.push({ message: a.message }), Array.isArray(a.messages))
|
|
9420
|
-
for (const
|
|
9421
|
-
typeof
|
|
9420
|
+
for (const c of a.messages)
|
|
9421
|
+
typeof c == "string" && o.push({ message: c });
|
|
9422
9422
|
if (a.errors && typeof a.errors == "object")
|
|
9423
|
-
for (const [
|
|
9424
|
-
Array.isArray(u) ? o.push({ key:
|
|
9425
|
-
`) }) : typeof u == "string" ? o.push({ key:
|
|
9423
|
+
for (const [c, u] of Object.entries(a.errors))
|
|
9424
|
+
Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9425
|
+
`) }) : typeof u == "string" ? o.push({ key: c, message: u }) : u != null && o.push({ key: c, message: String(u) });
|
|
9426
9426
|
if (o.length === 0)
|
|
9427
|
-
for (const [
|
|
9428
|
-
|
|
9429
|
-
`) }) : typeof u == "string" && o.push({ key:
|
|
9427
|
+
for (const [c, u] of Object.entries(a))
|
|
9428
|
+
c === "message" || c === "messages" || c === "errors" || (Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9429
|
+
`) }) : typeof u == "string" && o.push({ key: c, message: u }));
|
|
9430
9430
|
}
|
|
9431
9431
|
if (o.length === 0)
|
|
9432
9432
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
9433
|
-
for (const
|
|
9434
|
-
|
|
9433
|
+
for (const c of o)
|
|
9434
|
+
c.key && t ? await F.addErrorMessage(t, c.key, c.message) : await i(c.message);
|
|
9435
9435
|
return n(), !1;
|
|
9436
9436
|
} catch {
|
|
9437
9437
|
}
|
|
@@ -9454,7 +9454,7 @@ ${k}
|
|
|
9454
9454
|
if (this.options.valid !== !0)
|
|
9455
9455
|
return F.warnUnvalidatedCustomValidity(
|
|
9456
9456
|
e,
|
|
9457
|
-
`${
|
|
9457
|
+
`${l.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
9458
9458
|
), !0;
|
|
9459
9459
|
F.applyCustomValidity(e);
|
|
9460
9460
|
const t = this.findFirstInvalid(e);
|
|
@@ -9547,14 +9547,14 @@ ${k}
|
|
|
9547
9547
|
const r = this.options.targetFragment;
|
|
9548
9548
|
if (!r)
|
|
9549
9549
|
return !0;
|
|
9550
|
-
const i = this.options.conditionAttributeName ?? `${
|
|
9550
|
+
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n = F.buildConditionScope(
|
|
9551
9551
|
r,
|
|
9552
9552
|
this.options.formFragment ?? null
|
|
9553
9553
|
), s = Q.evaluateDetailed(t, n);
|
|
9554
|
-
return s.unresolvedReference ? (e ||
|
|
9554
|
+
return s.unresolvedReference ? (e || m.warn(
|
|
9555
9555
|
"Haori",
|
|
9556
9556
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
9557
|
-
), !1) : s.value ? !0 : (!e && j.isEnabled() &&
|
|
9557
|
+
), !1) : s.value ? !0 : (!e && j.isEnabled() && m.warn(
|
|
9558
9558
|
"Haori",
|
|
9559
9559
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
9560
9560
|
), !1);
|
|
@@ -9567,7 +9567,7 @@ ${k}
|
|
|
9567
9567
|
* @returns 最初の invalid 要素、なければ null
|
|
9568
9568
|
*/
|
|
9569
9569
|
findFirstInvalid(e) {
|
|
9570
|
-
if (e.getTarget().hasAttribute(`${
|
|
9570
|
+
if (e.getTarget().hasAttribute(`${l.prefix}if-false`))
|
|
9571
9571
|
return null;
|
|
9572
9572
|
let t = null;
|
|
9573
9573
|
for (const r of e.getChildElementFragments().reverse()) {
|
|
@@ -9616,31 +9616,31 @@ ${k}
|
|
|
9616
9616
|
response: i
|
|
9617
9617
|
});
|
|
9618
9618
|
} catch (o) {
|
|
9619
|
-
|
|
9619
|
+
m.error("Haori", `Invalid bind-transform: ${o}`);
|
|
9620
9620
|
}
|
|
9621
9621
|
if (this.options.bindParams) {
|
|
9622
9622
|
const o = {};
|
|
9623
|
-
this.options.bindParams.forEach((
|
|
9624
|
-
i && typeof i == "object" &&
|
|
9623
|
+
this.options.bindParams.forEach((c) => {
|
|
9624
|
+
i && typeof i == "object" && c in i && (o[c] = i[c]);
|
|
9625
9625
|
}), i = o;
|
|
9626
9626
|
}
|
|
9627
9627
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
9628
|
-
|
|
9628
|
+
m.warn(
|
|
9629
9629
|
"Haori",
|
|
9630
|
-
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${
|
|
9630
|
+
`Skipped binding because the input has no value to collect; the bind target would be replaced with an empty object. Add a name attribute to the input, or specify ${l.prefix}${this.eventType}-form.`
|
|
9631
9631
|
);
|
|
9632
9632
|
return;
|
|
9633
9633
|
}
|
|
9634
9634
|
const n = [], s = this.eventType ? b.attrName(this.eventType, "bind") : b.attrName(null, "bind", !0), a = [];
|
|
9635
9635
|
if (this.options.bindArg)
|
|
9636
9636
|
this.options.bindFragments.forEach((o) => {
|
|
9637
|
-
const
|
|
9638
|
-
if (
|
|
9637
|
+
const c = this.resolveRowWrite(o, s);
|
|
9638
|
+
if (c.kind === "skip")
|
|
9639
9639
|
return;
|
|
9640
|
-
if (
|
|
9640
|
+
if (c.kind === "row") {
|
|
9641
9641
|
const p = this.options.bindArg;
|
|
9642
9642
|
a.push({
|
|
9643
|
-
container:
|
|
9643
|
+
container: c.container,
|
|
9644
9644
|
row: o,
|
|
9645
9645
|
attributeName: s,
|
|
9646
9646
|
syncWhenUnchanged: "reflect",
|
|
@@ -9693,23 +9693,23 @@ ${k}
|
|
|
9693
9693
|
});
|
|
9694
9694
|
else if (typeof i == "string") {
|
|
9695
9695
|
if (this.options.defaultSelfBind) {
|
|
9696
|
-
|
|
9696
|
+
m.warn(
|
|
9697
9697
|
"Haori",
|
|
9698
9698
|
"string data is not bound because no bind target was specified."
|
|
9699
9699
|
);
|
|
9700
9700
|
return;
|
|
9701
9701
|
}
|
|
9702
|
-
return
|
|
9702
|
+
return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
9703
9703
|
new Error("string data cannot be bound without a bindArg.")
|
|
9704
9704
|
);
|
|
9705
9705
|
} else
|
|
9706
9706
|
this.options.bindFragments.forEach((o) => {
|
|
9707
|
-
const
|
|
9708
|
-
if (
|
|
9707
|
+
const c = this.resolveRowWrite(o, s);
|
|
9708
|
+
if (c.kind === "skip")
|
|
9709
9709
|
return;
|
|
9710
|
-
if (
|
|
9710
|
+
if (c.kind === "row") {
|
|
9711
9711
|
a.push({
|
|
9712
|
-
container:
|
|
9712
|
+
container: c.container,
|
|
9713
9713
|
row: o,
|
|
9714
9714
|
attributeName: s,
|
|
9715
9715
|
syncWhenUnchanged: "reflect",
|
|
@@ -9743,8 +9743,8 @@ ${k}
|
|
|
9743
9743
|
});
|
|
9744
9744
|
return n.push(this.applyRowWrites(a)), Promise.all(n).then(() => {
|
|
9745
9745
|
const o = this.options.bindArg ?? null;
|
|
9746
|
-
this.options.bindFragments.forEach((
|
|
9747
|
-
U.bindComplete(
|
|
9746
|
+
this.options.bindFragments.forEach((c) => {
|
|
9747
|
+
U.bindComplete(c.getTarget(), o);
|
|
9748
9748
|
});
|
|
9749
9749
|
});
|
|
9750
9750
|
});
|
|
@@ -9797,10 +9797,10 @@ ${k}
|
|
|
9797
9797
|
);
|
|
9798
9798
|
if (Object.keys(n).length === 0)
|
|
9799
9799
|
return t;
|
|
9800
|
-
const s = e.getAttribute(`${
|
|
9800
|
+
const s = e.getAttribute(`${l.prefix}form-arg`);
|
|
9801
9801
|
if (s) {
|
|
9802
|
-
const a = String(s), o = t[a],
|
|
9803
|
-
return { ...t, [a]: ae(
|
|
9802
|
+
const a = String(s), o = t[a], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9803
|
+
return { ...t, [a]: ae(c, n) };
|
|
9804
9804
|
}
|
|
9805
9805
|
return ae(t, n);
|
|
9806
9806
|
}
|
|
@@ -9853,8 +9853,8 @@ ${k}
|
|
|
9853
9853
|
const a = F.getValuesEditedAfter(n, r);
|
|
9854
9854
|
if (Object.keys(a).length === 0)
|
|
9855
9855
|
continue;
|
|
9856
|
-
const o = i[s],
|
|
9857
|
-
i = { ...i, [s]: ae(
|
|
9856
|
+
const o = i[s], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9857
|
+
i = { ...i, [s]: ae(c, a) };
|
|
9858
9858
|
}
|
|
9859
9859
|
return i;
|
|
9860
9860
|
}
|
|
@@ -9888,7 +9888,7 @@ ${k}
|
|
|
9888
9888
|
row: s,
|
|
9889
9889
|
attributeName: r,
|
|
9890
9890
|
syncWhenUnchanged: "supply",
|
|
9891
|
-
apply: (
|
|
9891
|
+
apply: (c) => this.applyCopyToRowItem(s, c, t)
|
|
9892
9892
|
});
|
|
9893
9893
|
return;
|
|
9894
9894
|
}
|
|
@@ -10022,18 +10022,18 @@ ${k}
|
|
|
10022
10022
|
let i = this.options.fetchUrl;
|
|
10023
10023
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
10024
10024
|
n.headers || void 0
|
|
10025
|
-
), a = (n.method || "GET").toUpperCase(), o =
|
|
10026
|
-
if (n.method =
|
|
10025
|
+
), a = (n.method || "GET").toUpperCase(), o = l.runtime === "demo" && !Oe(a), c = o ? "GET" : a;
|
|
10026
|
+
if (n.method = c, Object.keys(t).length > 0 && Se(t)) {
|
|
10027
10027
|
const d = s.get("Content-Type") || "";
|
|
10028
|
-
|
|
10028
|
+
c !== "GET" && c !== "HEAD" && c !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Bt(t) && m.warn(
|
|
10029
10029
|
"Haori",
|
|
10030
|
-
`A File value nested under ${
|
|
10031
|
-
) :
|
|
10030
|
+
`A File value nested under ${l.prefix}form-object / ${l.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
10031
|
+
) : m.warn(
|
|
10032
10032
|
"Haori",
|
|
10033
|
-
`A File value cannot be sent without ${
|
|
10033
|
+
`A File value cannot be sent without ${l.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
10034
10034
|
);
|
|
10035
10035
|
}
|
|
10036
|
-
if (
|
|
10036
|
+
if (c === "GET" || c === "HEAD" || c === "OPTIONS")
|
|
10037
10037
|
Object.keys(t).length > 0 && (i = pt(i, t));
|
|
10038
10038
|
else if (Object.keys(t).length > 0) {
|
|
10039
10039
|
const d = s.get("Content-Type") || "";
|
|
@@ -10062,7 +10062,7 @@ ${k}
|
|
|
10062
10062
|
payload: t,
|
|
10063
10063
|
hasUnresolvedReference: !1,
|
|
10064
10064
|
requestedMethod: a,
|
|
10065
|
-
effectiveMethod:
|
|
10065
|
+
effectiveMethod: c,
|
|
10066
10066
|
queryString: u,
|
|
10067
10067
|
transportMode: o ? "query-get" : "http",
|
|
10068
10068
|
signature: Ut(i, n)
|
|
@@ -10145,11 +10145,11 @@ ${k}
|
|
|
10145
10145
|
*/
|
|
10146
10146
|
getRowFragment() {
|
|
10147
10147
|
if (!this.options.targetFragment)
|
|
10148
|
-
return
|
|
10148
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
10149
10149
|
const e = this.options.targetFragment.closestByAttribute(
|
|
10150
|
-
`${
|
|
10150
|
+
`${l.prefix}row`
|
|
10151
10151
|
);
|
|
10152
|
-
return e || (
|
|
10152
|
+
return e || (m.error("Haori", "Row fragment not found."), null);
|
|
10153
10153
|
}
|
|
10154
10154
|
/**
|
|
10155
10155
|
* 行操作の対象となる `data-each` コンテナを解決します。
|
|
@@ -10165,20 +10165,20 @@ ${k}
|
|
|
10165
10165
|
resolveRowContainer(e) {
|
|
10166
10166
|
const t = this.options.targetFragment;
|
|
10167
10167
|
if (!t)
|
|
10168
|
-
return
|
|
10168
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
10169
10169
|
const r = b.attrName(this.eventType, e), i = z.read(t, r);
|
|
10170
10170
|
if (i !== null && i.trim() !== "") {
|
|
10171
10171
|
const s = z.query(i, r, document);
|
|
10172
10172
|
if (s === null)
|
|
10173
|
-
return
|
|
10173
|
+
return m.error(
|
|
10174
10174
|
"Haori",
|
|
10175
10175
|
`Row container not found: ${i} (${r})`
|
|
10176
10176
|
), null;
|
|
10177
10177
|
const a = x.get(s);
|
|
10178
|
-
return a instanceof I ? a.hasAttribute(`${
|
|
10178
|
+
return a instanceof I ? a.hasAttribute(`${l.prefix}each`) ? a : (m.error(
|
|
10179
10179
|
"Haori",
|
|
10180
|
-
`Row container must have ${
|
|
10181
|
-
), null) : (
|
|
10180
|
+
`Row container must have ${l.prefix}each: ${i} (${r})`
|
|
10181
|
+
), null) : (m.error(
|
|
10182
10182
|
"Haori",
|
|
10183
10183
|
`Row container is not initialized: ${i} (${r})`
|
|
10184
10184
|
), null);
|
|
@@ -10196,48 +10196,56 @@ ${k}
|
|
|
10196
10196
|
* 書き戻し先を宣言している場合は、`data-each` の式ではなくその宣言を解決します。
|
|
10197
10197
|
*
|
|
10198
10198
|
* @param container `data-each` コンテナのフラグメント
|
|
10199
|
+
* @param quiet 解決に失敗した理由をログへ出さないかどうか。入れ子の解決から
|
|
10200
|
+
* 呼ぶときに指定します(呼び出し元が構成全体を指す 1 本のログを出すため、
|
|
10201
|
+
* ここで出すと祖先の事情だけを述べた紛らわしいログが重なります)
|
|
10199
10202
|
* @returns 所有者・所有者データ・配列・経路と、表示位置と配列の位置が一致しない
|
|
10200
10203
|
* (`data-each-array` による宣言)かどうか。解決できない場合は null
|
|
10201
10204
|
*/
|
|
10202
|
-
static resolveEachArray(e) {
|
|
10203
|
-
const
|
|
10204
|
-
if (
|
|
10205
|
-
return
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10205
|
+
static resolveEachArray(e, t = !1) {
|
|
10206
|
+
const r = e.getRawAttribute(`${l.prefix}each`);
|
|
10207
|
+
if (r === null)
|
|
10208
|
+
return t || m.error(
|
|
10209
|
+
"Haori",
|
|
10210
|
+
`Row container has no ${l.prefix}each expression.`
|
|
10211
|
+
), null;
|
|
10212
|
+
const i = e.getRawAttribute(`${l.prefix}each-array`), n = i !== null, s = n ? `${l.prefix}each-array` : `${l.prefix}each`, a = n ? i : r, o = a.trim().split(".");
|
|
10213
|
+
if (!(o.length > 0 && o.every((v) => /^[A-Za-z_$][\w$]*$/.test(v))))
|
|
10214
|
+
return t || m.error(
|
|
10209
10215
|
"Haori",
|
|
10210
|
-
`Row operations require a plain identifier path for ${
|
|
10216
|
+
`Row operations require a plain identifier path for ${s} (got: ${a}).` + (n ? "" : ` Declare ${l.prefix}each-array to specify the array to write back to.`)
|
|
10211
10217
|
), null;
|
|
10212
|
-
if (
|
|
10213
|
-
return
|
|
10218
|
+
if (n && e.getRawAttribute(`${l.prefix}each-key`) === null)
|
|
10219
|
+
return t || m.error(
|
|
10214
10220
|
"Haori",
|
|
10215
|
-
`${
|
|
10221
|
+
`${l.prefix}each-array requires ${l.prefix}each-key (${l.prefix}each-array="${a}").`
|
|
10216
10222
|
), null;
|
|
10217
|
-
const
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10223
|
+
const u = b.resolveRowScopeBase(e, o[0]);
|
|
10224
|
+
if (u === "unresolvable")
|
|
10225
|
+
return null;
|
|
10226
|
+
let d, p, g;
|
|
10227
|
+
if (u)
|
|
10228
|
+
d = u.owner, p = u.ownerData, g = [...u.path, ...o.slice(1)];
|
|
10221
10229
|
else {
|
|
10222
|
-
for (
|
|
10223
|
-
const
|
|
10224
|
-
if (
|
|
10225
|
-
|
|
10230
|
+
for (d = e, p = null; d; ) {
|
|
10231
|
+
const v = d.getRawBindingData();
|
|
10232
|
+
if (v && o[0] in v && !b.isRowScopeKey(d, o[0])) {
|
|
10233
|
+
p = v;
|
|
10226
10234
|
break;
|
|
10227
10235
|
}
|
|
10228
|
-
|
|
10236
|
+
d = d.getParent();
|
|
10229
10237
|
}
|
|
10230
|
-
|
|
10238
|
+
g = o;
|
|
10231
10239
|
}
|
|
10232
|
-
if (!
|
|
10233
|
-
return
|
|
10240
|
+
if (!d || !p)
|
|
10241
|
+
return t || m.error(
|
|
10234
10242
|
"Haori",
|
|
10235
|
-
`Binding data owner not found for ${
|
|
10243
|
+
`Binding data owner not found for ${s}="${a}".`
|
|
10236
10244
|
), null;
|
|
10237
|
-
const
|
|
10238
|
-
return Array.isArray(
|
|
10245
|
+
const E = b.readPathValue(p, g);
|
|
10246
|
+
return Array.isArray(E) ? { owner: d, ownerData: p, array: E, path: g, mapped: n } : (t || m.error(
|
|
10239
10247
|
"Haori",
|
|
10240
|
-
`${
|
|
10248
|
+
`${s}="${a}" does not resolve to an array.`
|
|
10241
10249
|
), null);
|
|
10242
10250
|
}
|
|
10243
10251
|
/**
|
|
@@ -10251,26 +10259,36 @@ ${k}
|
|
|
10251
10259
|
*
|
|
10252
10260
|
* @param container `data-each` コンテナのフラグメント
|
|
10253
10261
|
* @param rootName 経路の根の識別子
|
|
10254
|
-
* @returns 所有者・所有者データ・行までの経路。行スコープ名でない場合は null
|
|
10262
|
+
* @returns 所有者・所有者データ・行までの経路。行スコープ名でない場合は null。
|
|
10263
|
+
* 行スコープ名だが外側を書き戻し先として解決できない場合は `'unresolvable'`
|
|
10264
|
+
* (呼び出し元は祖先の探索へ進まずに打ち切ります。祖先には行スコープ名と
|
|
10265
|
+
* 同名のキーが無いため、進めても実態と違う理由のログになります)
|
|
10255
10266
|
*/
|
|
10256
10267
|
static resolveRowScopeBase(e, t) {
|
|
10257
10268
|
let r = e;
|
|
10258
10269
|
for (; r; ) {
|
|
10259
|
-
const i = r.closestByAttribute(`${
|
|
10270
|
+
const i = r.closestByAttribute(`${l.prefix}row`);
|
|
10260
10271
|
if (!i)
|
|
10261
10272
|
return null;
|
|
10262
10273
|
const n = i.getParent();
|
|
10263
10274
|
if (!n)
|
|
10264
10275
|
return null;
|
|
10265
|
-
if (n.getAttribute(`${
|
|
10266
|
-
const s = b.resolveEachArray(n);
|
|
10276
|
+
if (n.getAttribute(`${l.prefix}each-arg`) === t) {
|
|
10277
|
+
const s = b.resolveEachArray(n, !0);
|
|
10267
10278
|
if (!s)
|
|
10268
|
-
return
|
|
10279
|
+
return m.error(
|
|
10280
|
+
"Haori",
|
|
10281
|
+
`Row operations cannot resolve the write-back array for ${l.prefix}each="${e.getRawAttribute(
|
|
10282
|
+
`${l.prefix}each`
|
|
10283
|
+
)}": the ancestor container that supplies "${t}" (${l.prefix}each="${n.getRawAttribute(
|
|
10284
|
+
`${l.prefix}each`
|
|
10285
|
+
)}") does not resolve to a writable array. Build the outer list with ${l.prefix}derive and declare ${l.prefix}each-array on this ${l.prefix}each.`
|
|
10286
|
+
), "unresolvable";
|
|
10269
10287
|
const a = b.resolveRowIndex(
|
|
10270
10288
|
n,
|
|
10271
10289
|
i,
|
|
10272
10290
|
s.array,
|
|
10273
|
-
`${
|
|
10291
|
+
`${l.prefix}each="${n.getRawAttribute(`${l.prefix}each`)}"`
|
|
10274
10292
|
);
|
|
10275
10293
|
return a === null ? null : {
|
|
10276
10294
|
owner: s.owner,
|
|
@@ -10294,10 +10312,10 @@ ${k}
|
|
|
10294
10312
|
* @returns 行データ由来なら true
|
|
10295
10313
|
*/
|
|
10296
10314
|
static isRowScopeKey(e, t) {
|
|
10297
|
-
if (!e.hasAttribute(`${
|
|
10315
|
+
if (!e.hasAttribute(`${l.prefix}row`))
|
|
10298
10316
|
return !1;
|
|
10299
10317
|
const r = e.getParent();
|
|
10300
|
-
return r ? r.getAttribute(`${
|
|
10318
|
+
return r ? r.getAttribute(`${l.prefix}each-arg`) === t || r.getAttribute(`${l.prefix}each-index`) === t : !1;
|
|
10301
10319
|
}
|
|
10302
10320
|
/**
|
|
10303
10321
|
* 経路をたどって値を読み出します。
|
|
@@ -10334,8 +10352,8 @@ ${k}
|
|
|
10334
10352
|
const i = { ...e };
|
|
10335
10353
|
let n = i;
|
|
10336
10354
|
for (let s = 0; s < t.length - 1; s += 1) {
|
|
10337
|
-
const a = t[s], o = n[a],
|
|
10338
|
-
n[a] =
|
|
10355
|
+
const a = t[s], o = n[a], c = Array.isArray(o) ? o.slice() : { ...o };
|
|
10356
|
+
n[a] = c, n = c;
|
|
10339
10357
|
}
|
|
10340
10358
|
return n[t[t.length - 1]] = r, i;
|
|
10341
10359
|
}
|
|
@@ -10349,7 +10367,7 @@ ${k}
|
|
|
10349
10367
|
*/
|
|
10350
10368
|
static getRowFragments(e) {
|
|
10351
10369
|
return e.getChildElementFragments().filter(
|
|
10352
|
-
(t) => !t.hasAttribute(`${
|
|
10370
|
+
(t) => !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
10353
10371
|
);
|
|
10354
10372
|
}
|
|
10355
10373
|
/**
|
|
@@ -10369,12 +10387,12 @@ ${k}
|
|
|
10369
10387
|
if (!r || !r.has(e))
|
|
10370
10388
|
return { kind: "plain" };
|
|
10371
10389
|
const i = r.get(e) ?? null;
|
|
10372
|
-
return i === null ? (
|
|
10390
|
+
return i === null ? (m.warn(
|
|
10373
10391
|
"Haori",
|
|
10374
|
-
`Target is not a row of the ${
|
|
10375
|
-
), { kind: "skip" }) : b.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (
|
|
10392
|
+
`Target is not a row of the ${l.prefix}each container (${t}).`
|
|
10393
|
+
), { kind: "skip" }) : b.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (m.warn(
|
|
10376
10394
|
"Haori",
|
|
10377
|
-
`The target row is no longer in the ${
|
|
10395
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${t}).`
|
|
10378
10396
|
), { kind: "skip" });
|
|
10379
10397
|
}
|
|
10380
10398
|
/**
|
|
@@ -10407,7 +10425,7 @@ ${k}
|
|
|
10407
10425
|
continue;
|
|
10408
10426
|
const p = a[d];
|
|
10409
10427
|
if (p === null || typeof p != "object" || Array.isArray(p)) {
|
|
10410
|
-
|
|
10428
|
+
m.warn(
|
|
10411
10429
|
"Haori",
|
|
10412
10430
|
`Row data is not an object; the write was skipped (${u.attributeName}).`
|
|
10413
10431
|
);
|
|
@@ -10428,7 +10446,7 @@ ${k}
|
|
|
10428
10446
|
}
|
|
10429
10447
|
if (!o)
|
|
10430
10448
|
return;
|
|
10431
|
-
const
|
|
10449
|
+
const c = B.setBindingData(
|
|
10432
10450
|
s.owner.getTarget(),
|
|
10433
10451
|
b.withPathValue(s.ownerData, s.path, a),
|
|
10434
10452
|
{
|
|
@@ -10445,12 +10463,12 @@ ${k}
|
|
|
10445
10463
|
}
|
|
10446
10464
|
);
|
|
10447
10465
|
if (B.isEachUpdateRunning(n)) {
|
|
10448
|
-
|
|
10449
|
-
|
|
10466
|
+
c.catch((u) => {
|
|
10467
|
+
m.error("Haori", "Failed to write row data.", u);
|
|
10450
10468
|
});
|
|
10451
10469
|
return;
|
|
10452
10470
|
}
|
|
10453
|
-
r.push(
|
|
10471
|
+
r.push(c);
|
|
10454
10472
|
}), Promise.all(r).then(() => {
|
|
10455
10473
|
});
|
|
10456
10474
|
}
|
|
@@ -10532,27 +10550,27 @@ ${k}
|
|
|
10532
10550
|
static resolveRowIndex(e, t, r, i) {
|
|
10533
10551
|
const n = b.getRowFragments(e), s = n.indexOf(t);
|
|
10534
10552
|
if (s === -1)
|
|
10535
|
-
return
|
|
10553
|
+
return m.warn(
|
|
10536
10554
|
"Haori",
|
|
10537
|
-
`The target row is no longer in the ${
|
|
10555
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${i}).`
|
|
10538
10556
|
), null;
|
|
10539
|
-
const a = e.getAttribute(`${
|
|
10557
|
+
const a = e.getAttribute(`${l.prefix}each-key`), o = t.getListKey();
|
|
10540
10558
|
if (a && o !== null) {
|
|
10541
|
-
const
|
|
10559
|
+
const c = [];
|
|
10542
10560
|
r.forEach((p, g) => {
|
|
10543
10561
|
B.createListKey(
|
|
10544
10562
|
p,
|
|
10545
10563
|
String(a),
|
|
10546
10564
|
g
|
|
10547
|
-
) === o &&
|
|
10565
|
+
) === o && c.push(g);
|
|
10548
10566
|
});
|
|
10549
|
-
const u = n.slice(0, s).filter((p) => p.getListKey() === o).length, d =
|
|
10550
|
-
return d === -1 ? (
|
|
10567
|
+
const u = n.slice(0, s).filter((p) => p.getListKey() === o).length, d = c[u] ?? -1;
|
|
10568
|
+
return d === -1 ? (m.warn(
|
|
10551
10569
|
"Haori",
|
|
10552
10570
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
10553
10571
|
), null) : d;
|
|
10554
10572
|
}
|
|
10555
|
-
return s >= r.length ? (
|
|
10573
|
+
return s >= r.length ? (m.warn(
|
|
10556
10574
|
"Haori",
|
|
10557
10575
|
`The target row index is out of range; the write was skipped (${i}).`
|
|
10558
10576
|
), null) : s;
|
|
@@ -10635,20 +10653,20 @@ ${k}
|
|
|
10635
10653
|
const i = b.resolveEachArray(r);
|
|
10636
10654
|
if (!i)
|
|
10637
10655
|
return Promise.reject(new Error("Row array not resolved."));
|
|
10638
|
-
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${
|
|
10656
|
+
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${l.prefix}row`) : null, a = b.getRowFragments(r), o = s ? a.indexOf(s) : a.length - 1, c = (g) => g < 0 || g >= a.length ? null : i.mapped ? b.resolveRowIndex(
|
|
10639
10657
|
r,
|
|
10640
10658
|
a[g],
|
|
10641
10659
|
i.array,
|
|
10642
10660
|
b.attrName(this.eventType, e)
|
|
10643
|
-
) : g, u = o >= 0 ?
|
|
10661
|
+
) : g, u = o >= 0 ? c(o) : i.mapped ? i.array.length - 1 : o;
|
|
10644
10662
|
if (u === null)
|
|
10645
10663
|
return Promise.resolve();
|
|
10646
10664
|
const d = i.array.slice();
|
|
10647
10665
|
if (!t(
|
|
10648
10666
|
d,
|
|
10649
10667
|
u,
|
|
10650
|
-
() =>
|
|
10651
|
-
() =>
|
|
10668
|
+
() => c(o - 1),
|
|
10669
|
+
() => c(o + 1)
|
|
10652
10670
|
))
|
|
10653
10671
|
return Promise.resolve();
|
|
10654
10672
|
const p = /* @__PURE__ */ new Map();
|
|
@@ -10740,24 +10758,24 @@ class Ht {
|
|
|
10740
10758
|
try {
|
|
10741
10759
|
r = await fetch(e, t);
|
|
10742
10760
|
} catch (n) {
|
|
10743
|
-
throw
|
|
10761
|
+
throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
10744
10762
|
}
|
|
10745
10763
|
if (!r.ok) {
|
|
10746
10764
|
ft(r.status);
|
|
10747
10765
|
const n = `${r.status} ${r.statusText}`;
|
|
10748
|
-
throw
|
|
10766
|
+
throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
10749
10767
|
}
|
|
10750
10768
|
let i;
|
|
10751
10769
|
try {
|
|
10752
10770
|
i = await r.text();
|
|
10753
10771
|
} catch (n) {
|
|
10754
|
-
throw
|
|
10772
|
+
throw m.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
10755
10773
|
}
|
|
10756
10774
|
try {
|
|
10757
10775
|
const s = new DOMParser().parseFromString(i, "text/html");
|
|
10758
|
-
return s && s.body ? s.body.innerHTML : (
|
|
10776
|
+
return s && s.body ? s.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), i);
|
|
10759
10777
|
} catch (n) {
|
|
10760
|
-
return
|
|
10778
|
+
return m.error("[Haori]", "Failed to parse imported HTML:", e, n), i;
|
|
10761
10779
|
}
|
|
10762
10780
|
}
|
|
10763
10781
|
}
|
|
@@ -10770,7 +10788,7 @@ const f = class f {
|
|
|
10770
10788
|
*/
|
|
10771
10789
|
static isDeferredAttributeName(e) {
|
|
10772
10790
|
return f.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
10773
|
-
(t) => e === `${
|
|
10791
|
+
(t) => e === `${l.prefix}${t}`
|
|
10774
10792
|
);
|
|
10775
10793
|
}
|
|
10776
10794
|
/**
|
|
@@ -10781,7 +10799,7 @@ const f = class f {
|
|
|
10781
10799
|
*/
|
|
10782
10800
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
10783
10801
|
return f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
10784
|
-
(t) => e === `${
|
|
10802
|
+
(t) => e === `${l.prefix}${t}`
|
|
10785
10803
|
);
|
|
10786
10804
|
}
|
|
10787
10805
|
/**
|
|
@@ -10801,7 +10819,7 @@ const f = class f {
|
|
|
10801
10819
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
10802
10820
|
*/
|
|
10803
10821
|
static getAliasedAttributeName(e) {
|
|
10804
|
-
const t = `${
|
|
10822
|
+
const t = `${l.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
10805
10823
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
10806
10824
|
}
|
|
10807
10825
|
/**
|
|
@@ -10814,7 +10832,7 @@ const f = class f {
|
|
|
10814
10832
|
static isAliasedAttributeReflection(e, t) {
|
|
10815
10833
|
const r = x.get(e);
|
|
10816
10834
|
return r instanceof I ? r.hasAttribute(
|
|
10817
|
-
`${
|
|
10835
|
+
`${l.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
10818
10836
|
) : !1;
|
|
10819
10837
|
}
|
|
10820
10838
|
/**
|
|
@@ -10915,7 +10933,7 @@ const f = class f {
|
|
|
10915
10933
|
if (t.has(e))
|
|
10916
10934
|
return Promise.resolve();
|
|
10917
10935
|
const r = [];
|
|
10918
|
-
return e.hasAttribute(`${
|
|
10936
|
+
return e.hasAttribute(`${l.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${l.prefix}fetch`) && r.push(f.executeManagedFetch(e)), e.hasAttribute(`${l.prefix}import`) && r.push(f.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
10919
10937
|
i instanceof I && r.push(
|
|
10920
10938
|
f.reevaluateReactiveSpecialAttributes(i, t)
|
|
10921
10939
|
);
|
|
@@ -10952,7 +10970,7 @@ const f = class f {
|
|
|
10952
10970
|
*/
|
|
10953
10971
|
static executeManagedImport(e) {
|
|
10954
10972
|
const t = e.getTarget(), r = f.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
10955
|
-
`${
|
|
10973
|
+
`${l.prefix}import`
|
|
10956
10974
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
10957
10975
|
if (r.running)
|
|
10958
10976
|
return n !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
|
|
@@ -10962,20 +10980,20 @@ const f = class f {
|
|
|
10962
10980
|
return Promise.resolve();
|
|
10963
10981
|
r.lastUrl = n, r.running = !0;
|
|
10964
10982
|
const s = performance.now();
|
|
10965
|
-
return t.setAttribute(`${
|
|
10983
|
+
return t.setAttribute(`${l.prefix}importing`, ""), U.importStart(t, n), Ht.load(n).then((a) => {
|
|
10966
10984
|
const o = new TextEncoder().encode(a).length;
|
|
10967
10985
|
return K.enqueue(() => {
|
|
10968
10986
|
t.innerHTML = a;
|
|
10969
10987
|
}).then(() => {
|
|
10970
|
-
t.removeAttribute(`${
|
|
10971
|
-
const
|
|
10988
|
+
t.removeAttribute(`${l.prefix}importing`), U.importEnd(t, n, o, s), f.adoptImportedChildren(e);
|
|
10989
|
+
const c = [];
|
|
10972
10990
|
return e.getChildren().forEach((u) => {
|
|
10973
|
-
u instanceof I ?
|
|
10974
|
-
}), Promise.all(
|
|
10991
|
+
u instanceof I ? c.push(f.scan(u.getTarget())) : u instanceof ee && c.push(f.evaluateText(u));
|
|
10992
|
+
}), Promise.all(c).then(() => {
|
|
10975
10993
|
});
|
|
10976
10994
|
});
|
|
10977
10995
|
}).catch((a) => {
|
|
10978
|
-
t.removeAttribute(`${
|
|
10996
|
+
t.removeAttribute(`${l.prefix}importing`), U.importError(t, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
|
|
10979
10997
|
}).finally(() => {
|
|
10980
10998
|
if (r.running = !1, r.rerunRequested)
|
|
10981
10999
|
return r.rerunRequested = !1, f.executeManagedImport(e);
|
|
@@ -11074,7 +11092,7 @@ const f = class f {
|
|
|
11074
11092
|
let t = Promise.resolve();
|
|
11075
11093
|
const r = /* @__PURE__ */ new Set();
|
|
11076
11094
|
for (const i of f.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
11077
|
-
const n =
|
|
11095
|
+
const n = l.prefix + i;
|
|
11078
11096
|
e.hasAttribute(n) && (t = t.then(
|
|
11079
11097
|
() => f.setAttribute(
|
|
11080
11098
|
e.getTarget(),
|
|
@@ -11092,7 +11110,7 @@ const f = class f {
|
|
|
11092
11110
|
));
|
|
11093
11111
|
}
|
|
11094
11112
|
for (const i of f.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
11095
|
-
const n =
|
|
11113
|
+
const n = l.prefix + i;
|
|
11096
11114
|
e.hasAttribute(n) && (t = t.then(
|
|
11097
11115
|
() => f.setAttribute(
|
|
11098
11116
|
e.getTarget(),
|
|
@@ -11111,8 +11129,8 @@ const f = class f {
|
|
|
11111
11129
|
* @returns 子孫初期化をスキップするなら true
|
|
11112
11130
|
*/
|
|
11113
11131
|
static shouldSkipChildInitialization(e, t) {
|
|
11114
|
-
const r = e.getAttribute(`${
|
|
11115
|
-
return e.hasAttribute(`${
|
|
11132
|
+
const r = e.getAttribute(`${l.prefix}if`);
|
|
11133
|
+
return e.hasAttribute(`${l.prefix}if`) && f.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${l.prefix}each`);
|
|
11116
11134
|
}
|
|
11117
11135
|
/**
|
|
11118
11136
|
* エレメントに属性を設定します。
|
|
@@ -11137,9 +11155,9 @@ const f = class f {
|
|
|
11137
11155
|
i
|
|
11138
11156
|
);
|
|
11139
11157
|
const o = [];
|
|
11140
|
-
let
|
|
11158
|
+
let c = null, u = null, d = null;
|
|
11141
11159
|
switch (t) {
|
|
11142
|
-
case `${
|
|
11160
|
+
case `${l.prefix}bind`: {
|
|
11143
11161
|
if (r !== null && i && s instanceof I && s.consumeSelfWrittenBind(r))
|
|
11144
11162
|
break;
|
|
11145
11163
|
const p = r === null ? {} : f.parseDataBind(r);
|
|
@@ -11160,54 +11178,54 @@ const f = class f {
|
|
|
11160
11178
|
r === null && s.clearBindingDataCache(), s.setBindingData(p);
|
|
11161
11179
|
break;
|
|
11162
11180
|
}
|
|
11163
|
-
case `${
|
|
11181
|
+
case `${l.prefix}derive`:
|
|
11164
11182
|
u = f.createDeriveInputSignature(
|
|
11165
11183
|
s,
|
|
11166
11184
|
r,
|
|
11167
|
-
s.getRawAttribute(`${
|
|
11168
|
-
),
|
|
11185
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
11186
|
+
), c = f.evaluateDerive(
|
|
11169
11187
|
s,
|
|
11170
11188
|
r,
|
|
11171
|
-
s.getRawAttribute(`${
|
|
11172
|
-
), o.push(
|
|
11189
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
11190
|
+
), o.push(c.then(() => {
|
|
11173
11191
|
}));
|
|
11174
11192
|
break;
|
|
11175
|
-
case `${
|
|
11193
|
+
case `${l.prefix}derive-name`:
|
|
11176
11194
|
u = f.createDeriveInputSignature(
|
|
11177
11195
|
s,
|
|
11178
|
-
s.getRawAttribute(`${
|
|
11196
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
11179
11197
|
r
|
|
11180
|
-
),
|
|
11198
|
+
), c = f.evaluateDerive(
|
|
11181
11199
|
s,
|
|
11182
|
-
s.getRawAttribute(`${
|
|
11200
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
11183
11201
|
r
|
|
11184
|
-
), o.push(
|
|
11202
|
+
), o.push(c.then(() => {
|
|
11185
11203
|
}));
|
|
11186
11204
|
break;
|
|
11187
|
-
case `${
|
|
11205
|
+
case `${l.prefix}if`:
|
|
11188
11206
|
o.push(f.evaluateIf(s));
|
|
11189
11207
|
break;
|
|
11190
|
-
case `${
|
|
11208
|
+
case `${l.prefix}each`:
|
|
11191
11209
|
o.push(f.evaluateEach(s));
|
|
11192
11210
|
break;
|
|
11193
|
-
case `${
|
|
11211
|
+
case `${l.prefix}fetch`:
|
|
11194
11212
|
d = () => f.executeManagedFetch(s);
|
|
11195
11213
|
break;
|
|
11196
|
-
case `${
|
|
11214
|
+
case `${l.prefix}import`:
|
|
11197
11215
|
typeof r == "string" && (d = () => f.executeManagedImport(s));
|
|
11198
11216
|
break;
|
|
11199
|
-
case `${
|
|
11217
|
+
case `${l.prefix}store`:
|
|
11200
11218
|
r !== null && o.push(ve.restore(s));
|
|
11201
11219
|
break;
|
|
11202
|
-
case `${
|
|
11203
|
-
case `${
|
|
11220
|
+
case `${l.prefix}validity`:
|
|
11221
|
+
case `${l.prefix}validity-message`:
|
|
11204
11222
|
return r !== null && F.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
11205
11223
|
});
|
|
11206
|
-
case `${
|
|
11207
|
-
const p = s.getAttribute(`${
|
|
11208
|
-
p === null && s.hasAttribute(`${
|
|
11224
|
+
case `${l.prefix}url-param`: {
|
|
11225
|
+
const p = s.getAttribute(`${l.prefix}url-arg`), g = ht.readParams();
|
|
11226
|
+
p === null && s.hasAttribute(`${l.prefix}store`) && m.warn(
|
|
11209
11227
|
"Haori",
|
|
11210
|
-
`${
|
|
11228
|
+
`${l.prefix}url-param を ${l.prefix}url-arg なしで ${l.prefix}store と併用すると復元した値が消えます(${l.prefix}url-arg を指定してください)。`
|
|
11211
11229
|
);
|
|
11212
11230
|
const E = {
|
|
11213
11231
|
reentrant: !0,
|
|
@@ -11226,8 +11244,8 @@ const f = class f {
|
|
|
11226
11244
|
return r === null ? o.push(s.removeAttribute(t)) : o.push(s.setAttribute(t, r, i)), Promise.all(o).then(
|
|
11227
11245
|
() => d === null ? void 0 : d()
|
|
11228
11246
|
).then(() => {
|
|
11229
|
-
if (
|
|
11230
|
-
return s.setDeriveInputSignature(u),
|
|
11247
|
+
if (c !== null)
|
|
11248
|
+
return s.setDeriveInputSignature(u), c.then((p) => {
|
|
11231
11249
|
if (p)
|
|
11232
11250
|
return f.reevaluateChildren(s);
|
|
11233
11251
|
});
|
|
@@ -11261,20 +11279,20 @@ const f = class f {
|
|
|
11261
11279
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11262
11280
|
*/
|
|
11263
11281
|
static setBindingData(e, t, r = {}) {
|
|
11264
|
-
const i = x.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply",
|
|
11265
|
-
sequence:
|
|
11282
|
+
const i = x.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", c = r.sequence ?? I.nextOperationSequence(), u = {
|
|
11283
|
+
sequence: c,
|
|
11266
11284
|
kind: o,
|
|
11267
11285
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11268
11286
|
}, d = o === "supply";
|
|
11269
|
-
d && i.markSupplyApplied(
|
|
11287
|
+
d && i.markSupplyApplied(c);
|
|
11270
11288
|
const p = I.currentSequence(), g = i.getRawBindingData();
|
|
11271
|
-
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i,
|
|
11289
|
+
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i, c);
|
|
11272
11290
|
const E = a ? f.resolveByPathAuthority(i, g, t, u) : t;
|
|
11273
11291
|
i.setBindingData(E), a && (U.bindChange(e, g, E, "manual"), ve.mirror(i));
|
|
11274
11292
|
const v = () => {
|
|
11275
11293
|
i.markBindingWorkStart();
|
|
11276
11294
|
const D = i.getRawBindingData() ?? E;
|
|
11277
|
-
let M = a ? i.setAttribute(`${
|
|
11295
|
+
let M = a ? i.setAttribute(`${l.prefix}bind`, JSON.stringify(D)) : Promise.resolve();
|
|
11278
11296
|
return e.tagName === "FORM" && (M = M.then(() => {
|
|
11279
11297
|
if (i.wasResetAfter(p))
|
|
11280
11298
|
return;
|
|
@@ -11372,11 +11390,11 @@ const f = class f {
|
|
|
11372
11390
|
}
|
|
11373
11391
|
if (f.isSameBindingValue(t, r))
|
|
11374
11392
|
return r;
|
|
11375
|
-
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit",
|
|
11393
|
+
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit", c = {
|
|
11376
11394
|
sequence: a ?? i.sequence,
|
|
11377
11395
|
kind: o
|
|
11378
11396
|
};
|
|
11379
|
-
return e.canApplyPath(n,
|
|
11397
|
+
return e.canApplyPath(n, c) ? (e.markPathApplied(n, c), r) : t;
|
|
11380
11398
|
}
|
|
11381
11399
|
/**
|
|
11382
11400
|
* 配列を要素ごとの宛先として扱えるかを判定し、扱える場合は各要素のリストキーを
|
|
@@ -11397,19 +11415,19 @@ const f = class f {
|
|
|
11397
11415
|
if (!Array.isArray(t) || !Array.isArray(r) || t.length !== r.length || r.length === 0)
|
|
11398
11416
|
return null;
|
|
11399
11417
|
const n = r.some((o) => f.isPlainRecord(o)) ? f.resolveEachKeyArg(e, i) : null, s = t.map(
|
|
11400
|
-
(o,
|
|
11418
|
+
(o, c) => f.createListKey(
|
|
11401
11419
|
o,
|
|
11402
11420
|
n,
|
|
11403
|
-
|
|
11421
|
+
c
|
|
11404
11422
|
)
|
|
11405
11423
|
), a = r.map(
|
|
11406
|
-
(o,
|
|
11424
|
+
(o, c) => f.createListKey(
|
|
11407
11425
|
o,
|
|
11408
11426
|
n,
|
|
11409
|
-
|
|
11427
|
+
c
|
|
11410
11428
|
)
|
|
11411
11429
|
);
|
|
11412
|
-
return s.some((o,
|
|
11430
|
+
return s.some((o, c) => o !== a[c]) ? null : a;
|
|
11413
11431
|
}
|
|
11414
11432
|
/**
|
|
11415
11433
|
* 配列の経路に対応する `data-each-key` の指定を探します。
|
|
@@ -11425,13 +11443,13 @@ const f = class f {
|
|
|
11425
11443
|
* @returns リストキーに使うプロパティ名。宣言が無ければ null
|
|
11426
11444
|
*/
|
|
11427
11445
|
static resolveEachKeyArg(e, t) {
|
|
11428
|
-
const r = `${
|
|
11446
|
+
const r = `${l.prefix}each`, i = e.getTarget(), n = t.replace(/\[[^\]]*\]/g, ""), s = i.querySelectorAll(`[${r}]`);
|
|
11429
11447
|
for (const a of Array.from(s)) {
|
|
11430
11448
|
const o = f.resolveEachDeclarationPath(a, i);
|
|
11431
11449
|
if (o === null || o !== n)
|
|
11432
11450
|
continue;
|
|
11433
|
-
const
|
|
11434
|
-
return
|
|
11451
|
+
const c = a.getAttribute(`${r}-key`);
|
|
11452
|
+
return c === null ? null : c.trim();
|
|
11435
11453
|
}
|
|
11436
11454
|
return null;
|
|
11437
11455
|
}
|
|
@@ -11453,7 +11471,7 @@ const f = class f {
|
|
|
11453
11471
|
* @returns 絶対経路。式が空、または経路として扱えない場合は null
|
|
11454
11472
|
*/
|
|
11455
11473
|
static resolveEachDeclarationPath(e, t) {
|
|
11456
|
-
const r = `${
|
|
11474
|
+
const r = `${l.prefix}each`;
|
|
11457
11475
|
let i = e.getAttribute(r)?.trim() ?? "";
|
|
11458
11476
|
if (i === "")
|
|
11459
11477
|
return null;
|
|
@@ -11542,7 +11560,7 @@ const f = class f {
|
|
|
11542
11560
|
*/
|
|
11543
11561
|
static dumpScope(e) {
|
|
11544
11562
|
const t = f.collectScope(e);
|
|
11545
|
-
return j.isEnabled() &&
|
|
11563
|
+
return j.isEnabled() && m.info("[Haori]", "scope dump for", e, t), t;
|
|
11546
11564
|
}
|
|
11547
11565
|
/**
|
|
11548
11566
|
* スコープの解決結果と由来を収集します。
|
|
@@ -11558,14 +11576,14 @@ const f = class f {
|
|
|
11558
11576
|
const t = x.get(e);
|
|
11559
11577
|
if (!t)
|
|
11560
11578
|
return { resolved: {}, sources: {} };
|
|
11561
|
-
const r = t.getBindingData(), i = {}, n = (
|
|
11562
|
-
const u =
|
|
11579
|
+
const r = t.getBindingData(), i = {}, n = (c) => {
|
|
11580
|
+
const u = c.getTarget(), d = f.resolveElementId(u);
|
|
11563
11581
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
11564
|
-
}, s = (
|
|
11565
|
-
if (
|
|
11566
|
-
for (const g of Object.keys(
|
|
11582
|
+
}, s = (c, u, d, p) => {
|
|
11583
|
+
if (c)
|
|
11584
|
+
for (const g of Object.keys(c))
|
|
11567
11585
|
g in i || (i[g] = {
|
|
11568
|
-
value:
|
|
11586
|
+
value: c[g],
|
|
11569
11587
|
source: n(u),
|
|
11570
11588
|
kind: d,
|
|
11571
11589
|
depth: p
|
|
@@ -11587,7 +11605,7 @@ const f = class f {
|
|
|
11587
11605
|
try {
|
|
11588
11606
|
return JSON.parse(e);
|
|
11589
11607
|
} catch (t) {
|
|
11590
|
-
return
|
|
11608
|
+
return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
11591
11609
|
}
|
|
11592
11610
|
else {
|
|
11593
11611
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -11653,21 +11671,21 @@ const f = class f {
|
|
|
11653
11671
|
i.push(r.setValue(t));
|
|
11654
11672
|
const n = f.getFormFragment(r);
|
|
11655
11673
|
if (n) {
|
|
11656
|
-
const s = F.getValues(n), a = n.getAttribute(`${
|
|
11657
|
-
let
|
|
11674
|
+
const s = F.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`), o = n.getRawBindingData();
|
|
11675
|
+
let c;
|
|
11658
11676
|
if (a) {
|
|
11659
|
-
|
|
11677
|
+
c = { ...o ?? {} };
|
|
11660
11678
|
const u = String(a), d = F.resolveAncestorArgOwner(n, u);
|
|
11661
|
-
|
|
11662
|
-
(d ? d.value :
|
|
11679
|
+
c[u] = F.mergeCollectedValues(
|
|
11680
|
+
(d ? d.value : c[u]) ?? null,
|
|
11663
11681
|
s
|
|
11664
11682
|
);
|
|
11665
11683
|
} else
|
|
11666
|
-
|
|
11684
|
+
c = F.mergeCollectedValues(o, s);
|
|
11667
11685
|
i.push(
|
|
11668
11686
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
11669
11687
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
11670
|
-
f.setBindingData(n.getTarget(),
|
|
11688
|
+
f.setBindingData(n.getTarget(), c, {
|
|
11671
11689
|
kind: "nonSupply",
|
|
11672
11690
|
sequence: I.nextSequence()
|
|
11673
11691
|
})
|
|
@@ -11698,8 +11716,8 @@ const f = class f {
|
|
|
11698
11716
|
if (t.has(e))
|
|
11699
11717
|
return Promise.resolve();
|
|
11700
11718
|
let r = f.reevaluateInterpolatedAttributes(e);
|
|
11701
|
-
const i = e.hasAttribute(`${
|
|
11702
|
-
let
|
|
11719
|
+
const i = e.hasAttribute(`${l.prefix}derive`), n = e.hasAttribute(`${l.prefix}if`), s = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
|
|
11720
|
+
let c = !1, u = !1, d = null;
|
|
11703
11721
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
11704
11722
|
const p = f.createDeriveInputSignature(
|
|
11705
11723
|
e,
|
|
@@ -11728,12 +11746,12 @@ const f = class f {
|
|
|
11728
11746
|
d = f.createDescendantBindingSignature(
|
|
11729
11747
|
e,
|
|
11730
11748
|
"evaluateAll"
|
|
11731
|
-
), u = !0,
|
|
11749
|
+
), u = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d, f.logDerivedSubtreeProfileSnapshot(
|
|
11732
11750
|
e,
|
|
11733
|
-
|
|
11751
|
+
c ? "skip-hit" : "skip-miss"
|
|
11734
11752
|
);
|
|
11735
11753
|
})), r.then(() => {
|
|
11736
|
-
if (
|
|
11754
|
+
if (c)
|
|
11737
11755
|
return;
|
|
11738
11756
|
const p = [];
|
|
11739
11757
|
return e.getChildren().forEach((g) => {
|
|
@@ -11757,9 +11775,9 @@ const f = class f {
|
|
|
11757
11775
|
* @returns Promise (評価完了時に解決)
|
|
11758
11776
|
*/
|
|
11759
11777
|
static evaluateDerive(e, t = e.getRawAttribute(
|
|
11760
|
-
`${
|
|
11778
|
+
`${l.prefix}derive`
|
|
11761
11779
|
), r = e.getRawAttribute(
|
|
11762
|
-
`${
|
|
11780
|
+
`${l.prefix}derive-name`
|
|
11763
11781
|
)) {
|
|
11764
11782
|
const i = e.getRawDerivedBindingData(), n = typeof r == "string" ? r.trim() : "";
|
|
11765
11783
|
if (!t || n === "")
|
|
@@ -11808,11 +11826,11 @@ const f = class f {
|
|
|
11808
11826
|
* @return 戻り値はありません。
|
|
11809
11827
|
*/
|
|
11810
11828
|
static logFalsyIfDiagnostics(e) {
|
|
11811
|
-
const t = e.getRawAttribute(`${
|
|
11829
|
+
const t = e.getRawAttribute(`${l.prefix}if`);
|
|
11812
11830
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
11813
11831
|
return;
|
|
11814
11832
|
if (Q.hasCompileFailure(t)) {
|
|
11815
|
-
|
|
11833
|
+
m.warn(
|
|
11816
11834
|
"[Haori]",
|
|
11817
11835
|
"data-if is hidden because the expression could not be compiled (see the preceding compile error):",
|
|
11818
11836
|
t
|
|
@@ -11822,13 +11840,13 @@ const f = class f {
|
|
|
11822
11840
|
const { sources: r } = f.collectScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
11823
11841
|
let s = 0;
|
|
11824
11842
|
n.forEach((o) => {
|
|
11825
|
-
const
|
|
11826
|
-
s =
|
|
11843
|
+
const c = t.indexOf(o, s);
|
|
11844
|
+
s = c + o.length, !(c > 0 && t[c - 1] === ".") && i.add(o);
|
|
11827
11845
|
});
|
|
11828
11846
|
const a = {};
|
|
11829
11847
|
i.forEach((o) => {
|
|
11830
11848
|
o in r && (a[o] = r[o]);
|
|
11831
|
-
}),
|
|
11849
|
+
}), m.info(
|
|
11832
11850
|
"[Haori]",
|
|
11833
11851
|
"data-if is falsy (hidden):",
|
|
11834
11852
|
t,
|
|
@@ -11845,7 +11863,7 @@ const f = class f {
|
|
|
11845
11863
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
11846
11864
|
*/
|
|
11847
11865
|
static evaluateIf(e) {
|
|
11848
|
-
const t = [], r = e.getAttribute(`${
|
|
11866
|
+
const t = [], r = e.getAttribute(`${l.prefix}if`);
|
|
11849
11867
|
if (f.isHiddenIfCondition(r))
|
|
11850
11868
|
j.isEnabled() && e.isVisible() && f.logFalsyIfDiagnostics(e), t.push(
|
|
11851
11869
|
e.hide().then(() => {
|
|
@@ -11879,9 +11897,9 @@ const f = class f {
|
|
|
11879
11897
|
* @return 戻り値はありません。
|
|
11880
11898
|
*/
|
|
11881
11899
|
static triggerLoadOnShow(e) {
|
|
11882
|
-
const t = `${
|
|
11900
|
+
const t = `${l.prefix}load-`;
|
|
11883
11901
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new re(e, "load").run().catch((i) => {
|
|
11884
|
-
|
|
11902
|
+
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
11885
11903
|
});
|
|
11886
11904
|
}
|
|
11887
11905
|
/**
|
|
@@ -11924,7 +11942,7 @@ const f = class f {
|
|
|
11924
11942
|
* @returns 公開される名前。指定が無い場合は null
|
|
11925
11943
|
*/
|
|
11926
11944
|
static getRowScopeName(e, t) {
|
|
11927
|
-
const r = e.getAttribute(`${
|
|
11945
|
+
const r = e.getAttribute(`${l.prefix}${t}`);
|
|
11928
11946
|
return typeof r != "string" || r === "" ? null : r;
|
|
11929
11947
|
}
|
|
11930
11948
|
/**
|
|
@@ -11951,14 +11969,14 @@ const f = class f {
|
|
|
11951
11969
|
* @return すべての差分更新が安定するまでの完了 Promise
|
|
11952
11970
|
*/
|
|
11953
11971
|
static runEachUpdateLoop(e, t) {
|
|
11954
|
-
t.running = !0, e.getTarget().removeAttribute(`${
|
|
11972
|
+
t.running = !0, e.getTarget().removeAttribute(`${l.prefix}each-done`);
|
|
11955
11973
|
const r = (async () => {
|
|
11956
11974
|
try {
|
|
11957
11975
|
do
|
|
11958
11976
|
t.rerunRequested = !1, await f.performEachUpdate(e);
|
|
11959
11977
|
while (t.rerunRequested);
|
|
11960
11978
|
const i = e.getTarget();
|
|
11961
|
-
i.setAttribute(`${
|
|
11979
|
+
i.setAttribute(`${l.prefix}each-done`, ""), ie.refreshSubtree(i), f.runEachRenderedScript(i);
|
|
11962
11980
|
} finally {
|
|
11963
11981
|
t.running = !1, t.settled = null;
|
|
11964
11982
|
}
|
|
@@ -11977,7 +11995,7 @@ const f = class f {
|
|
|
11977
11995
|
* @param target data-each コンテナ要素
|
|
11978
11996
|
*/
|
|
11979
11997
|
static runEachRenderedScript(e) {
|
|
11980
|
-
const t = `${
|
|
11998
|
+
const t = `${l.prefix}each-rendered-run`;
|
|
11981
11999
|
if (!e.hasAttribute(t))
|
|
11982
12000
|
return;
|
|
11983
12001
|
const r = String(e.getAttribute(t) ?? "");
|
|
@@ -11994,14 +12012,14 @@ ${r}
|
|
|
11994
12012
|
${r}
|
|
11995
12013
|
`);
|
|
11996
12014
|
} catch (n) {
|
|
11997
|
-
|
|
12015
|
+
m.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
11998
12016
|
}
|
|
11999
12017
|
}
|
|
12000
12018
|
if (i)
|
|
12001
12019
|
try {
|
|
12002
12020
|
i.call(e);
|
|
12003
12021
|
} catch (n) {
|
|
12004
|
-
|
|
12022
|
+
m.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
12005
12023
|
}
|
|
12006
12024
|
}
|
|
12007
12025
|
/**
|
|
@@ -12027,12 +12045,12 @@ ${r}
|
|
|
12027
12045
|
* @param fragment data-each コンテナのフラグメント
|
|
12028
12046
|
*/
|
|
12029
12047
|
static runEachRenderedChange(e) {
|
|
12030
|
-
const t = `${
|
|
12048
|
+
const t = `${l.prefix}each-rendered-change`, r = e.getTarget();
|
|
12031
12049
|
if (!r.hasAttribute(t))
|
|
12032
12050
|
return;
|
|
12033
12051
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
12034
12052
|
let n = !1;
|
|
12035
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (f.EACH_RENDERED_CHANGE_WARNED.has(r) || (f.EACH_RENDERED_CHANGE_WARNED.add(r),
|
|
12053
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (f.EACH_RENDERED_CHANGE_WARNED.has(r) || (f.EACH_RENDERED_CHANGE_WARNED.add(r), m.warn(
|
|
12036
12054
|
"[Haori]",
|
|
12037
12055
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
12038
12056
|
))), f.countEachRenderedRows(e) !== 0) {
|
|
@@ -12044,7 +12062,7 @@ ${r}
|
|
|
12044
12062
|
try {
|
|
12045
12063
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
12046
12064
|
} catch (s) {
|
|
12047
|
-
|
|
12065
|
+
m.error("[Haori]", `each-rendered-change dispatch error: ${s}`);
|
|
12048
12066
|
}
|
|
12049
12067
|
}
|
|
12050
12068
|
}
|
|
@@ -12061,7 +12079,7 @@ ${r}
|
|
|
12061
12079
|
static countEachRenderedRows(e) {
|
|
12062
12080
|
let t = 0;
|
|
12063
12081
|
for (const r of e.getChildElementFragments())
|
|
12064
|
-
r.getTarget().hasAttribute(`${
|
|
12082
|
+
r.getTarget().hasAttribute(`${l.prefix}row`) && (t += 1);
|
|
12065
12083
|
return t;
|
|
12066
12084
|
}
|
|
12067
12085
|
/**
|
|
@@ -12075,7 +12093,7 @@ ${r}
|
|
|
12075
12093
|
if (t === null)
|
|
12076
12094
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
12077
12095
|
let r = e.getTemplate();
|
|
12078
|
-
const i = e.getAttribute(`${
|
|
12096
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = f.createBindingSignature({
|
|
12079
12097
|
key: i ? String(i) : null,
|
|
12080
12098
|
items: t
|
|
12081
12099
|
});
|
|
@@ -12083,23 +12101,23 @@ ${r}
|
|
|
12083
12101
|
let s = !1;
|
|
12084
12102
|
if (e.getChildren().forEach((a) => {
|
|
12085
12103
|
if (!s && a instanceof I) {
|
|
12086
|
-
if (a.hasAttribute(`${
|
|
12104
|
+
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
12087
12105
|
return;
|
|
12088
12106
|
r = a.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
12089
12107
|
const o = a.getTarget();
|
|
12090
12108
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
12091
12109
|
}
|
|
12092
|
-
}), !s) {
|
|
12110
|
+
}), s && f.warnExtraEachChildren(e), !s) {
|
|
12093
12111
|
const a = e.getTarget();
|
|
12094
12112
|
Array.from(a.children).filter(
|
|
12095
|
-
(
|
|
12096
|
-
).forEach((
|
|
12113
|
+
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
12114
|
+
).forEach((c) => {
|
|
12097
12115
|
if (!s) {
|
|
12098
|
-
const d = x.get(
|
|
12116
|
+
const d = x.get(c);
|
|
12099
12117
|
d instanceof I && (r = d.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
12100
12118
|
}
|
|
12101
|
-
const u = x.get(
|
|
12102
|
-
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)),
|
|
12119
|
+
const u = x.get(c);
|
|
12120
|
+
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), c.parentNode && c.parentNode.removeChild(c);
|
|
12103
12121
|
});
|
|
12104
12122
|
}
|
|
12105
12123
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -12123,7 +12141,7 @@ ${r}
|
|
|
12123
12141
|
if (f.isRowLocalEachTemplate(e))
|
|
12124
12142
|
return Promise.resolve();
|
|
12125
12143
|
const t = e.getChildElementFragments().filter(
|
|
12126
|
-
(r) => !r.hasAttribute(`${
|
|
12144
|
+
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12127
12145
|
);
|
|
12128
12146
|
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) => f.evaluateAll(r))).then(
|
|
12129
12147
|
() => {
|
|
@@ -12137,8 +12155,8 @@ ${r}
|
|
|
12137
12155
|
* @returns 配列。無効な場合は null
|
|
12138
12156
|
*/
|
|
12139
12157
|
static resolveEachItems(e) {
|
|
12140
|
-
const t = e.getAttributeEvaluation(`${
|
|
12141
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
12158
|
+
const t = e.getAttributeEvaluation(`${l.prefix}each`), r = t?.value;
|
|
12159
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
|
|
12142
12160
|
}
|
|
12143
12161
|
/**
|
|
12144
12162
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -12148,15 +12166,15 @@ ${r}
|
|
|
12148
12166
|
* @returns 省略可能なら true
|
|
12149
12167
|
*/
|
|
12150
12168
|
static canSkipUnchangedNestedEach(e) {
|
|
12151
|
-
if (!e.hasAttribute(`${
|
|
12169
|
+
if (!e.hasAttribute(`${l.prefix}each`) || e.getEachInputSignature() === null)
|
|
12152
12170
|
return !1;
|
|
12153
12171
|
const t = e.getParent();
|
|
12154
|
-
if (t?.closestByAttribute(`${
|
|
12172
|
+
if (t?.closestByAttribute(`${l.prefix}derive`) || t?.closestByAttribute(`${l.prefix}derive-name`) || t?.closestByAttribute(`${l.prefix}if`) || t?.closestByAttribute(`${l.prefix}fetch`) || t?.closestByAttribute(`${l.prefix}import`) || f.hasNonEachDynamicElementState(e) || !f.isRowLocalEachTemplate(e))
|
|
12155
12173
|
return !1;
|
|
12156
12174
|
const r = f.resolveEachItems(e);
|
|
12157
12175
|
if (r === null)
|
|
12158
12176
|
return !1;
|
|
12159
|
-
const i = e.getAttribute(`${
|
|
12177
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = f.createBindingSignature({
|
|
12160
12178
|
key: i ? String(i) : null,
|
|
12161
12179
|
items: r
|
|
12162
12180
|
});
|
|
@@ -12185,10 +12203,10 @@ ${r}
|
|
|
12185
12203
|
const t = e.getRowLocalTemplate();
|
|
12186
12204
|
if (t !== null)
|
|
12187
12205
|
return t;
|
|
12188
|
-
const r = e.getTemplate(), i = e.getAttribute(`${
|
|
12206
|
+
const r = e.getTemplate(), i = e.getAttribute(`${l.prefix}each-arg`);
|
|
12189
12207
|
if (r === null || !i)
|
|
12190
12208
|
return e.setRowLocalTemplate(!1), !1;
|
|
12191
|
-
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${
|
|
12209
|
+
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${l.prefix}each-index`);
|
|
12192
12210
|
s && n.add(String(s));
|
|
12193
12211
|
const a = f.isRowLocalSubtree(r, n);
|
|
12194
12212
|
return e.setRowLocalTemplate(a), a;
|
|
@@ -12211,9 +12229,9 @@ ${r}
|
|
|
12211
12229
|
return !1;
|
|
12212
12230
|
continue;
|
|
12213
12231
|
}
|
|
12214
|
-
if (!i.startsWith(
|
|
12232
|
+
if (!i.startsWith(l.prefix))
|
|
12215
12233
|
continue;
|
|
12216
|
-
const a = i.slice(
|
|
12234
|
+
const a = i.slice(l.prefix.length);
|
|
12217
12235
|
if (f.ROW_LOCAL_EXPRESSION_ATTRIBUTES.has(a)) {
|
|
12218
12236
|
if (!f.areExpressionsRowLocal([s], t))
|
|
12219
12237
|
return !1;
|
|
@@ -12226,13 +12244,13 @@ ${r}
|
|
|
12226
12244
|
return !1;
|
|
12227
12245
|
}
|
|
12228
12246
|
let r = t;
|
|
12229
|
-
if (e.hasAttribute(`${
|
|
12230
|
-
const i = e.getRawAttribute(`${
|
|
12247
|
+
if (e.hasAttribute(`${l.prefix}each`)) {
|
|
12248
|
+
const i = e.getRawAttribute(`${l.prefix}each-arg`);
|
|
12231
12249
|
if (typeof i != "string" || i === "")
|
|
12232
12250
|
return !1;
|
|
12233
12251
|
const n = new Set(t);
|
|
12234
12252
|
n.add(i);
|
|
12235
|
-
const s = e.getRawAttribute(`${
|
|
12253
|
+
const s = e.getRawAttribute(`${l.prefix}each-index`);
|
|
12236
12254
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
12237
12255
|
}
|
|
12238
12256
|
for (const i of e.getChildren())
|
|
@@ -12290,7 +12308,7 @@ ${r}
|
|
|
12290
12308
|
* @returns 省略可能なら true
|
|
12291
12309
|
*/
|
|
12292
12310
|
static canSkipStableDerivedSubtree(e) {
|
|
12293
|
-
return !e.hasAttribute(`${
|
|
12311
|
+
return !e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}if`) || e.hasAttribute(`${l.prefix}each`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !1 : !f.hasDisallowedDerivedSubtreeDescendant(e);
|
|
12294
12312
|
}
|
|
12295
12313
|
/**
|
|
12296
12314
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -12299,7 +12317,7 @@ ${r}
|
|
|
12299
12317
|
* @returns 含むなら true
|
|
12300
12318
|
*/
|
|
12301
12319
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12302
|
-
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${
|
|
12320
|
+
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}derive-name`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !0 : f.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
12303
12321
|
}
|
|
12304
12322
|
/**
|
|
12305
12323
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -12347,7 +12365,7 @@ ${r}
|
|
|
12347
12365
|
* @returns プロファイル
|
|
12348
12366
|
*/
|
|
12349
12367
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
12350
|
-
if (!j.isEnabled() || !e.hasAttribute(`${
|
|
12368
|
+
if (!j.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
12351
12369
|
return null;
|
|
12352
12370
|
const t = f.DERIVE_SUBTREE_PROFILES.get(e);
|
|
12353
12371
|
if (t)
|
|
@@ -12397,12 +12415,12 @@ ${r}
|
|
|
12397
12415
|
n += `#${s}`, t.unshift(n);
|
|
12398
12416
|
break;
|
|
12399
12417
|
}
|
|
12400
|
-
const a = r.getRawAttribute(`${
|
|
12401
|
-
typeof a == "string" && a.trim() !== "" && (n += `[${
|
|
12418
|
+
const a = r.getRawAttribute(`${l.prefix}derive-name`);
|
|
12419
|
+
typeof a == "string" && a.trim() !== "" && (n += `[${l.prefix}derive-name="${a.trim()}"]`);
|
|
12402
12420
|
const o = r.getParent();
|
|
12403
12421
|
if (o) {
|
|
12404
|
-
const
|
|
12405
|
-
n += `:nth-child(${
|
|
12422
|
+
const c = o.getChildren().filter((u) => u instanceof I).findIndex((u) => u === r);
|
|
12423
|
+
n += `:nth-child(${c + 1})`;
|
|
12406
12424
|
}
|
|
12407
12425
|
t.unshift(n), r = o;
|
|
12408
12426
|
}
|
|
@@ -12432,7 +12450,7 @@ ${r}
|
|
|
12432
12450
|
*/
|
|
12433
12451
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
12434
12452
|
const r = f.getOrCreateDerivedSubtreeProfile(e);
|
|
12435
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
12453
|
+
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
|
|
12436
12454
|
reason: t,
|
|
12437
12455
|
hostId: r.hostId,
|
|
12438
12456
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -12451,15 +12469,15 @@ ${r}
|
|
|
12451
12469
|
*/
|
|
12452
12470
|
static hasNonEachDynamicElementState(e) {
|
|
12453
12471
|
const t = /* @__PURE__ */ new Set([
|
|
12454
|
-
`${
|
|
12455
|
-
`${
|
|
12456
|
-
`${
|
|
12457
|
-
`${
|
|
12472
|
+
`${l.prefix}each`,
|
|
12473
|
+
`${l.prefix}each-key`,
|
|
12474
|
+
`${l.prefix}each-arg`,
|
|
12475
|
+
`${l.prefix}each-index`
|
|
12458
12476
|
]);
|
|
12459
12477
|
return e.getAttributeNames().some((i) => {
|
|
12460
12478
|
if (t.has(i))
|
|
12461
12479
|
return !1;
|
|
12462
|
-
if (i.startsWith(`${
|
|
12480
|
+
if (i.startsWith(`${l.prefix}attr-`) || i.startsWith(l.prefix))
|
|
12463
12481
|
return !0;
|
|
12464
12482
|
const n = e.getRawAttribute(i);
|
|
12465
12483
|
return typeof n == "string" && n.includes("{{");
|
|
@@ -12485,7 +12503,7 @@ ${r}
|
|
|
12485
12503
|
* @returns 再評価が必要なら true
|
|
12486
12504
|
*/
|
|
12487
12505
|
static isFreshInitializationDynamicAttribute(e, t) {
|
|
12488
|
-
if (t.startsWith(`${
|
|
12506
|
+
if (t.startsWith(`${l.prefix}attr-`) || t.startsWith(l.prefix))
|
|
12489
12507
|
return !0;
|
|
12490
12508
|
const r = e.getRawAttribute(t);
|
|
12491
12509
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -12499,28 +12517,32 @@ ${r}
|
|
|
12499
12517
|
static updateDiff(e, t) {
|
|
12500
12518
|
const r = e.getTemplate();
|
|
12501
12519
|
if (r === null)
|
|
12502
|
-
return
|
|
12503
|
-
|
|
12520
|
+
return m.error(
|
|
12521
|
+
"[Haori]",
|
|
12522
|
+
`Template is not set for ${l.prefix}each="${e.getRawAttribute(`${l.prefix}each`)}". The container needs one element child as the row template.`,
|
|
12523
|
+
e.getTarget()
|
|
12524
|
+
), Promise.resolve();
|
|
12525
|
+
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
12504
12526
|
i && (i = String(i));
|
|
12505
|
-
const n = e.getAttribute(`${
|
|
12527
|
+
const n = e.getAttribute(`${l.prefix}each-key`), s = e.getAttribute(`${l.prefix}each-arg`), a = t.map(
|
|
12506
12528
|
(A, S) => f.createListKey(A, n ? String(n) : null, S)
|
|
12507
|
-
), o = new Set(a),
|
|
12529
|
+
), o = new Set(a), c = /* @__PURE__ */ new Map();
|
|
12508
12530
|
a.forEach((A) => {
|
|
12509
|
-
|
|
12531
|
+
c.set(A, (c.get(A) ?? 0) + 1);
|
|
12510
12532
|
}), n && o.size !== a.length && f.warnDuplicateEachKey(String(n));
|
|
12511
12533
|
const u = [];
|
|
12512
12534
|
let d = e.getChildren().filter((A) => A instanceof I).filter(
|
|
12513
|
-
(A) => !A.hasAttribute(`${
|
|
12535
|
+
(A) => !A.hasAttribute(`${l.prefix}each-before`) && !A.hasAttribute(`${l.prefix}each-after`)
|
|
12514
12536
|
);
|
|
12515
12537
|
const p = d.map((A) => A.getListKey()), g = /* @__PURE__ */ new Set();
|
|
12516
12538
|
d = d.filter((A, S) => {
|
|
12517
|
-
const C = String(A.getListKey()), V =
|
|
12539
|
+
const C = String(A.getListKey()), V = c.get(C) ?? 0;
|
|
12518
12540
|
if (V === 0) {
|
|
12519
12541
|
g.add(A);
|
|
12520
12542
|
const L = A.getListKey();
|
|
12521
12543
|
return L !== null && U.rowRemove(A.getTarget(), L, S), u.push(A.remove()), !1;
|
|
12522
12544
|
}
|
|
12523
|
-
return
|
|
12545
|
+
return c.set(C, V - 1), !0;
|
|
12524
12546
|
});
|
|
12525
12547
|
const E = d.map((A) => A.getListKey()), v = /* @__PURE__ */ new Map();
|
|
12526
12548
|
d.forEach((A) => {
|
|
@@ -12531,7 +12553,7 @@ ${r}
|
|
|
12531
12553
|
C ? C.push(A) : v.set(S, [A]);
|
|
12532
12554
|
});
|
|
12533
12555
|
const D = e.getChildElementFragments().filter((A) => !g.has(A)), M = D.filter(
|
|
12534
|
-
(A) => A.hasAttribute(`${
|
|
12556
|
+
(A) => A.hasAttribute(`${l.prefix}each-before`)
|
|
12535
12557
|
).length;
|
|
12536
12558
|
let H = Promise.resolve();
|
|
12537
12559
|
return a.forEach((A, S) => {
|
|
@@ -12612,6 +12634,41 @@ ${r}
|
|
|
12612
12634
|
);
|
|
12613
12635
|
});
|
|
12614
12636
|
}
|
|
12637
|
+
/**
|
|
12638
|
+
* `data-each` コンテナに要素の子が 2 つ以上あることを開発モードで警告します。
|
|
12639
|
+
*
|
|
12640
|
+
* 仕様「`data-each`」の配置ルールは、最初の要素の子だけをテンプレートとし、
|
|
12641
|
+
* 2 つめ以降は行に入りません。残った子はコンテナへそのまま留まるため、行スコープ
|
|
12642
|
+
* の名前を参照している式は解決できず(テキスト補間が展開されないまま表示され)、
|
|
12643
|
+
* 行操作のボタンは行に属さないため失敗します。どちらも例外にはならないので、
|
|
12644
|
+
* 気づけるようコンテナごとに一度だけ知らせます。
|
|
12645
|
+
*
|
|
12646
|
+
* テンプレート化の直後に呼ぶ前提です。この時点で残っている子はテンプレート化
|
|
12647
|
+
* されなかった残りだけなので、そのまま数えられます。テンプレート化はコンテナ
|
|
12648
|
+
* ごとに 1 回だけ通るため(`setTemplate()` を null へ戻す経路はありません)、
|
|
12649
|
+
* 警告済みの記録は持ちません。開発モード以外へ出さないのは `Log.warn()` 側の
|
|
12650
|
+
* 判定です。
|
|
12651
|
+
*
|
|
12652
|
+
* 数えるのは DOM の子ではなくフラグメントの子です。DOM を数えると、フラグメント木
|
|
12653
|
+
* と DOM の子が同期しない経路(テンプレート復旧のフォールバックが対象にしている
|
|
12654
|
+
* 状況)で残った未管理の要素まで数えてしまい、利用者が書いていない構成を指して
|
|
12655
|
+
* 警告することになります。
|
|
12656
|
+
*
|
|
12657
|
+
* @param fragment `data-each` コンテナのフラグメント
|
|
12658
|
+
* @returns 戻り値はありません。
|
|
12659
|
+
*/
|
|
12660
|
+
static warnExtraEachChildren(e) {
|
|
12661
|
+
const t = e.getChildren().filter(
|
|
12662
|
+
(r) => r instanceof I
|
|
12663
|
+
).filter(
|
|
12664
|
+
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12665
|
+
);
|
|
12666
|
+
t.length !== 0 && m.warn(
|
|
12667
|
+
"[Haori]",
|
|
12668
|
+
`${l.prefix}each="${e.getRawAttribute(`${l.prefix}each`)}" のコンテナに要素の子が 2 つ以上あります。テンプレートになるのは最初の子だけで、残り ${t.length} 個は行に入りません(${t.map((r) => r.getTarget().tagName.toLowerCase()).join(", ")})。行の中身は 1 つの要素で包んでください。`,
|
|
12669
|
+
e.getTarget()
|
|
12670
|
+
);
|
|
12671
|
+
}
|
|
12615
12672
|
/**
|
|
12616
12673
|
* `data-each-key` の値が重複していることを開発モードで警告します。
|
|
12617
12674
|
*
|
|
@@ -12624,9 +12681,9 @@ ${r}
|
|
|
12624
12681
|
* @returns 戻り値はありません。
|
|
12625
12682
|
*/
|
|
12626
12683
|
static warnDuplicateEachKey(e) {
|
|
12627
|
-
!j.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e),
|
|
12684
|
+
!j.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e), m.warn(
|
|
12628
12685
|
"[Haori]",
|
|
12629
|
-
`${
|
|
12686
|
+
`${l.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
12630
12687
|
));
|
|
12631
12688
|
}
|
|
12632
12689
|
/**
|
|
@@ -12676,7 +12733,7 @@ ${r}
|
|
|
12676
12733
|
* @returns 反映完了の Promise
|
|
12677
12734
|
*/
|
|
12678
12735
|
static applyRowFormValues(e, t, r) {
|
|
12679
|
-
return !e.hasAttribute(`${
|
|
12736
|
+
return !e.hasAttribute(`${l.prefix}form-list`) || !F.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : F.syncRowValues(t, r);
|
|
12680
12737
|
}
|
|
12681
12738
|
/**
|
|
12682
12739
|
* リスト比較用のキーを生成します。
|
|
@@ -12721,16 +12778,16 @@ ${r}
|
|
|
12721
12778
|
else if (n)
|
|
12722
12779
|
a = { [n]: t };
|
|
12723
12780
|
else
|
|
12724
|
-
return
|
|
12781
|
+
return m.error(
|
|
12725
12782
|
"[Haori]",
|
|
12726
|
-
`Primitive value requires '${
|
|
12783
|
+
`Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
|
|
12727
12784
|
), Promise.resolve(!1);
|
|
12728
12785
|
r && (a[r] = i);
|
|
12729
|
-
const o = a,
|
|
12786
|
+
const o = a, c = f.createBindingSignature({
|
|
12730
12787
|
listKey: s,
|
|
12731
12788
|
bindingData: o
|
|
12732
12789
|
});
|
|
12733
|
-
return e.getListKey() === s && e.getRenderSignature() ===
|
|
12790
|
+
return e.getListKey() === s && e.getRenderSignature() === c ? Promise.resolve(!1) : (e.setListKey(s), e.setRenderSignature(c), e.setBindingData(o), e.setAttribute(`${l.prefix}row`, s).then(() => !0));
|
|
12734
12791
|
}
|
|
12735
12792
|
/**
|
|
12736
12793
|
* 新規挿入行に遅延再評価が必要かどうかを判定します。
|
|
@@ -12757,7 +12814,7 @@ ${r}
|
|
|
12757
12814
|
*/
|
|
12758
12815
|
static hasMountSensitiveAttribute(e) {
|
|
12759
12816
|
return ["fetch", "import"].some(
|
|
12760
|
-
(t) => e.hasAttribute(`${
|
|
12817
|
+
(t) => e.hasAttribute(`${l.prefix}${t}`)
|
|
12761
12818
|
);
|
|
12762
12819
|
}
|
|
12763
12820
|
/**
|
|
@@ -12932,7 +12989,7 @@ const me = class me {
|
|
|
12932
12989
|
try {
|
|
12933
12990
|
t();
|
|
12934
12991
|
} catch (r) {
|
|
12935
|
-
|
|
12992
|
+
m.error("[Haori]", "Deferred event handling error:", r);
|
|
12936
12993
|
}
|
|
12937
12994
|
}
|
|
12938
12995
|
/**
|
|
@@ -12959,7 +13016,7 @@ const me = class me {
|
|
|
12959
13016
|
* @returns `data-on` 属性名
|
|
12960
13017
|
*/
|
|
12961
13018
|
get onAttributeName() {
|
|
12962
|
-
return `${
|
|
13019
|
+
return `${l.prefix}on`;
|
|
12963
13020
|
}
|
|
12964
13021
|
/**
|
|
12965
13022
|
* ルート配下に存在する `data-on` 宣言を走査し、カスタムイベントを購読します。
|
|
@@ -12985,7 +13042,7 @@ const me = class me {
|
|
|
12985
13042
|
if (e === null || e === "")
|
|
12986
13043
|
return;
|
|
12987
13044
|
if (me.BUILTIN_EVENT_NAMES.has(e)) {
|
|
12988
|
-
|
|
13045
|
+
m.warn(
|
|
12989
13046
|
"[Haori]",
|
|
12990
13047
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
12991
13048
|
);
|
|
@@ -13015,7 +13072,7 @@ const me = class me {
|
|
|
13015
13072
|
return;
|
|
13016
13073
|
const n = x.get(i);
|
|
13017
13074
|
n instanceof I && new re(n, "on", t).run().catch((s) => {
|
|
13018
|
-
|
|
13075
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
13019
13076
|
});
|
|
13020
13077
|
});
|
|
13021
13078
|
}
|
|
@@ -13053,13 +13110,13 @@ const me = class me {
|
|
|
13053
13110
|
const r = this.getElementFromTarget(e.target, t);
|
|
13054
13111
|
if (r) {
|
|
13055
13112
|
if (t === "input") {
|
|
13056
|
-
const i = `${
|
|
13113
|
+
const i = `${l.prefix}input-`;
|
|
13057
13114
|
if (!r.getAttributeNames().some((s) => s.startsWith(i))) {
|
|
13058
13115
|
this.recordUserEdit(r);
|
|
13059
13116
|
return;
|
|
13060
13117
|
}
|
|
13061
13118
|
}
|
|
13062
|
-
if (r.hasAttribute(`${
|
|
13119
|
+
if (r.hasAttribute(`${l.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
13063
13120
|
this.deferredProcedures.push(() => {
|
|
13064
13121
|
r.isConnected && this.runProcedureFor(r, t, e);
|
|
13065
13122
|
});
|
|
@@ -13083,10 +13140,10 @@ const me = class me {
|
|
|
13083
13140
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
13084
13141
|
const n = () => {
|
|
13085
13142
|
new re(i, t, r).run().catch((s) => {
|
|
13086
|
-
|
|
13143
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
13087
13144
|
});
|
|
13088
13145
|
};
|
|
13089
|
-
if (t === "click" && e.hasAttribute(`${
|
|
13146
|
+
if (t === "click" && e.hasAttribute(`${l.prefix}click-defer`)) {
|
|
13090
13147
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => n()) : setTimeout(n, 0);
|
|
13091
13148
|
return;
|
|
13092
13149
|
}
|
|
@@ -13192,7 +13249,7 @@ const me = class me {
|
|
|
13192
13249
|
* @returns 処理対象要素。見つからない場合は null
|
|
13193
13250
|
*/
|
|
13194
13251
|
findClickableElement(e) {
|
|
13195
|
-
const t = `${
|
|
13252
|
+
const t = `${l.prefix}click-`, r = `${l.prefix}click-passive`;
|
|
13196
13253
|
let i = e;
|
|
13197
13254
|
for (; i; ) {
|
|
13198
13255
|
if (i.getAttributeNames().some((s) => s.startsWith(t) && s !== r))
|
|
@@ -13237,7 +13294,7 @@ const W = class W {
|
|
|
13237
13294
|
}
|
|
13238
13295
|
if (typeof IntersectionObserver > "u")
|
|
13239
13296
|
return;
|
|
13240
|
-
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${
|
|
13297
|
+
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
13241
13298
|
if (t && t.observer.root === i && t.observer.rootMargin === n && W.sameThreshold(
|
|
13242
13299
|
t.observer.thresholds,
|
|
13243
13300
|
s
|
|
@@ -13247,13 +13304,13 @@ const W = class W {
|
|
|
13247
13304
|
}
|
|
13248
13305
|
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13249
13306
|
const o = new IntersectionObserver(
|
|
13250
|
-
(
|
|
13307
|
+
(c) => {
|
|
13251
13308
|
const u = W.registrations.get(e);
|
|
13252
|
-
u &&
|
|
13309
|
+
u && c.forEach((d) => {
|
|
13253
13310
|
!d.isIntersecting || u.running || W.isDisabled(u.fragment) || (u.running = !0, new re(u.fragment, "intersect").runWithResult().then((p) => {
|
|
13254
13311
|
p && u.once && (u.observer.disconnect(), W.registrations.delete(e));
|
|
13255
13312
|
}).catch((p) => {
|
|
13256
|
-
|
|
13313
|
+
m.error(
|
|
13257
13314
|
"[Haori]",
|
|
13258
13315
|
"Intersect procedure execution error:",
|
|
13259
13316
|
p
|
|
@@ -13294,32 +13351,32 @@ const W = class W {
|
|
|
13294
13351
|
}
|
|
13295
13352
|
static shouldObserve(e) {
|
|
13296
13353
|
return e.getAttributeNames().some((t) => {
|
|
13297
|
-
if (!t.startsWith(`${
|
|
13354
|
+
if (!t.startsWith(`${l.prefix}intersect-`))
|
|
13298
13355
|
return !1;
|
|
13299
|
-
const r = t.slice(`${
|
|
13356
|
+
const r = t.slice(`${l.prefix}intersect-`.length);
|
|
13300
13357
|
return !W.CONFIG_KEYS.has(r);
|
|
13301
13358
|
});
|
|
13302
13359
|
}
|
|
13303
13360
|
static resolveRoot(e) {
|
|
13304
|
-
const t = `${
|
|
13361
|
+
const t = `${l.prefix}intersect-root`;
|
|
13305
13362
|
if (!e.hasAttribute(t))
|
|
13306
13363
|
return null;
|
|
13307
13364
|
const r = e.getAttribute(t);
|
|
13308
13365
|
if (typeof r != "string" || r.trim() === "")
|
|
13309
13366
|
return null;
|
|
13310
13367
|
const i = z.query(r, t, document);
|
|
13311
|
-
return W.isHtmlElement(i) ? i : (
|
|
13368
|
+
return W.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
13312
13369
|
}
|
|
13313
13370
|
static resolveRootMargin(e) {
|
|
13314
|
-
const t = `${
|
|
13371
|
+
const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
13315
13372
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
13316
13373
|
}
|
|
13317
13374
|
static resolveThreshold(e) {
|
|
13318
|
-
const t = `${
|
|
13375
|
+
const t = `${l.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
13319
13376
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
13320
13377
|
}
|
|
13321
13378
|
static isDisabled(e) {
|
|
13322
|
-
const t = `${
|
|
13379
|
+
const t = `${l.prefix}intersect-disabled`, r = e.getAttribute(t);
|
|
13323
13380
|
if (r === null || r === !1)
|
|
13324
13381
|
return !1;
|
|
13325
13382
|
if (typeof r == "boolean")
|
|
@@ -13434,7 +13491,7 @@ const w = class w {
|
|
|
13434
13491
|
* @returns `data-poll-*` を持つ場合は true
|
|
13435
13492
|
*/
|
|
13436
13493
|
static hasPollAttribute(e) {
|
|
13437
|
-
const t = `${
|
|
13494
|
+
const t = `${l.prefix}poll-`, r = e.attributes;
|
|
13438
13495
|
for (let i = 0; i < r.length; i += 1)
|
|
13439
13496
|
if (r[i].name.startsWith(t))
|
|
13440
13497
|
return !0;
|
|
@@ -13450,7 +13507,7 @@ const w = class w {
|
|
|
13450
13507
|
* @returns 監視対象の場合は true
|
|
13451
13508
|
*/
|
|
13452
13509
|
static shouldObserve(e) {
|
|
13453
|
-
const t = `${
|
|
13510
|
+
const t = `${l.prefix}poll-`;
|
|
13454
13511
|
return e.getAttributeNames().some((r) => r.startsWith(t) ? !w.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
13455
13512
|
}
|
|
13456
13513
|
/**
|
|
@@ -13467,7 +13524,7 @@ const w = class w {
|
|
|
13467
13524
|
* @returns 設定の同一性を表すキー
|
|
13468
13525
|
*/
|
|
13469
13526
|
static buildConfigKey(e) {
|
|
13470
|
-
const t = `${
|
|
13527
|
+
const t = `${l.prefix}poll-`;
|
|
13471
13528
|
return e.getAttributeNames().filter((r) => r.startsWith(t)).sort().map((r) => `${r}=${e.getRawAttribute(r) ?? ""}`).join(`
|
|
13472
13529
|
`);
|
|
13473
13530
|
}
|
|
@@ -13532,7 +13589,7 @@ const w = class w {
|
|
|
13532
13589
|
"poll"
|
|
13533
13590
|
).runWithResult();
|
|
13534
13591
|
} catch (n) {
|
|
13535
|
-
|
|
13592
|
+
m.error("[Haori]", "Poll procedure execution error:", n);
|
|
13536
13593
|
} finally {
|
|
13537
13594
|
t.fetching = !1;
|
|
13538
13595
|
}
|
|
@@ -13717,7 +13774,7 @@ const w = class w {
|
|
|
13717
13774
|
* @returns 注入先フラグメントのリスト
|
|
13718
13775
|
*/
|
|
13719
13776
|
static resolveStateFragments(e) {
|
|
13720
|
-
const t = `${
|
|
13777
|
+
const t = `${l.prefix}poll-state`, r = e.fragment;
|
|
13721
13778
|
if (!r.hasAttribute(t))
|
|
13722
13779
|
return [];
|
|
13723
13780
|
const i = r.getAttribute(t);
|
|
@@ -13729,7 +13786,7 @@ const w = class w {
|
|
|
13729
13786
|
document
|
|
13730
13787
|
);
|
|
13731
13788
|
if (n.length === 0)
|
|
13732
|
-
return
|
|
13789
|
+
return m.error("[Haori]", `Poll state element not found: ${i}`), [];
|
|
13733
13790
|
const s = [];
|
|
13734
13791
|
return n.forEach((a) => {
|
|
13735
13792
|
if (!a.isConnected)
|
|
@@ -13748,14 +13805,14 @@ const w = class w {
|
|
|
13748
13805
|
* @returns 取得間隔(ミリ秒)
|
|
13749
13806
|
*/
|
|
13750
13807
|
static resolveInterval(e) {
|
|
13751
|
-
const t = `${
|
|
13808
|
+
const t = `${l.prefix}poll-interval`;
|
|
13752
13809
|
if (!e.hasAttribute(t))
|
|
13753
13810
|
return w.DEFAULT_INTERVAL_MS;
|
|
13754
13811
|
const r = w.toNumber(e.getAttribute(t));
|
|
13755
|
-
return r === null ? (
|
|
13812
|
+
return r === null ? (m.warn(
|
|
13756
13813
|
"[Haori]",
|
|
13757
13814
|
`${t} は数値で指定してください。既定値 ${w.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
13758
|
-
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (
|
|
13815
|
+
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (m.warn(
|
|
13759
13816
|
"[Haori]",
|
|
13760
13817
|
`${t} の下限は ${w.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
13761
13818
|
), w.MIN_INTERVAL_MS) : r;
|
|
@@ -13767,11 +13824,11 @@ const w = class w {
|
|
|
13767
13824
|
* @returns 打ち切り時間(ミリ秒)。省略時や不正値の場合は null(無制限)
|
|
13768
13825
|
*/
|
|
13769
13826
|
static resolveTimeout(e) {
|
|
13770
|
-
const t = `${
|
|
13827
|
+
const t = `${l.prefix}poll-timeout`;
|
|
13771
13828
|
if (!e.hasAttribute(t))
|
|
13772
13829
|
return null;
|
|
13773
13830
|
const r = w.toNumber(e.getAttribute(t));
|
|
13774
|
-
return r === null || r <= 0 ? (
|
|
13831
|
+
return r === null || r <= 0 ? (m.warn(
|
|
13775
13832
|
"[Haori]",
|
|
13776
13833
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
13777
13834
|
), null) : r;
|
|
@@ -13783,11 +13840,11 @@ const w = class w {
|
|
|
13783
13840
|
* @returns 連続失敗の上限回数。省略時や不正値の場合は null(無制限)
|
|
13784
13841
|
*/
|
|
13785
13842
|
static resolveErrorLimit(e) {
|
|
13786
|
-
const t = `${
|
|
13843
|
+
const t = `${l.prefix}poll-error-limit`;
|
|
13787
13844
|
if (!e.hasAttribute(t))
|
|
13788
13845
|
return null;
|
|
13789
13846
|
const r = w.toNumber(e.getAttribute(t));
|
|
13790
|
-
return r === null || r < 1 ? (
|
|
13847
|
+
return r === null || r < 1 ? (m.warn(
|
|
13791
13848
|
"[Haori]",
|
|
13792
13849
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
13793
13850
|
), null) : Math.floor(r);
|
|
@@ -13818,7 +13875,7 @@ const w = class w {
|
|
|
13818
13875
|
* @returns 非表示の配下にある場合は true
|
|
13819
13876
|
*/
|
|
13820
13877
|
static isHidden(e) {
|
|
13821
|
-
return e.closest(`[${
|
|
13878
|
+
return e.closest(`[${l.prefix}if-false]`) !== null;
|
|
13822
13879
|
}
|
|
13823
13880
|
/**
|
|
13824
13881
|
* `data-poll-disabled` が真かどうかを判定します。
|
|
@@ -13827,7 +13884,7 @@ const w = class w {
|
|
|
13827
13884
|
* @returns 抑止中の場合は true
|
|
13828
13885
|
*/
|
|
13829
13886
|
static isDisabled(e) {
|
|
13830
|
-
const t = `${
|
|
13887
|
+
const t = `${l.prefix}poll-disabled`;
|
|
13831
13888
|
return e.hasAttribute(t) ? w.isTruthy(e.getAttribute(t)) : !1;
|
|
13832
13889
|
}
|
|
13833
13890
|
/**
|
|
@@ -13842,11 +13899,11 @@ const w = class w {
|
|
|
13842
13899
|
* @returns 条件が成立した場合は true
|
|
13843
13900
|
*/
|
|
13844
13901
|
static isUntilSatisfied(e) {
|
|
13845
|
-
const t = `${
|
|
13902
|
+
const t = `${l.prefix}poll-until`;
|
|
13846
13903
|
if (!e.hasAttribute(t))
|
|
13847
13904
|
return !1;
|
|
13848
13905
|
const r = e.getAttributeEvaluation(t);
|
|
13849
|
-
return r ? r.hasUnresolvedReference ? (
|
|
13906
|
+
return r ? r.hasUnresolvedReference ? (m.warn(
|
|
13850
13907
|
"[Haori]",
|
|
13851
13908
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
13852
13909
|
e.getRawAttribute(t),
|
|
@@ -13883,9 +13940,9 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
13883
13940
|
"state"
|
|
13884
13941
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
13885
13942
|
let pe = w;
|
|
13886
|
-
const Vt = "0.46.
|
|
13887
|
-
function qt(
|
|
13888
|
-
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() =>
|
|
13943
|
+
const Vt = "0.46.1";
|
|
13944
|
+
function qt(y) {
|
|
13945
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => y()) : Promise.resolve().then(y);
|
|
13889
13946
|
}
|
|
13890
13947
|
const O = class O {
|
|
13891
13948
|
/**
|
|
@@ -13926,7 +13983,7 @@ const O = class O {
|
|
|
13926
13983
|
return;
|
|
13927
13984
|
const i = O.resolveVarName(r);
|
|
13928
13985
|
if (i === "") {
|
|
13929
|
-
t && (t.observer.disconnect(), O.registrations.delete(e)),
|
|
13986
|
+
t && (t.observer.disconnect(), O.registrations.delete(e)), m.warn(
|
|
13930
13987
|
"[Haori]",
|
|
13931
13988
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
13932
13989
|
);
|
|
@@ -13939,12 +13996,12 @@ const O = class O {
|
|
|
13939
13996
|
}
|
|
13940
13997
|
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
13941
13998
|
const a = new IntersectionObserver(
|
|
13942
|
-
(
|
|
13999
|
+
(c) => {
|
|
13943
14000
|
const u = O.registrations.get(e);
|
|
13944
14001
|
if (!u)
|
|
13945
14002
|
return;
|
|
13946
14003
|
let d = !1;
|
|
13947
|
-
|
|
14004
|
+
c.forEach((p) => {
|
|
13948
14005
|
const g = p.target;
|
|
13949
14006
|
u.observedRows.has(g) && (p.isIntersecting ? u.visibleRows.has(g) || (u.visibleRows.add(g), d = !0) : u.visibleRows.delete(g) && (d = !0));
|
|
13950
14007
|
}), d && O.scheduleCompute(u);
|
|
@@ -13997,7 +14054,7 @@ const O = class O {
|
|
|
13997
14054
|
* @returns 監視対象なら true
|
|
13998
14055
|
*/
|
|
13999
14056
|
static shouldObserve(e) {
|
|
14000
|
-
return e.hasAttribute(`${
|
|
14057
|
+
return e.hasAttribute(`${l.prefix}each`) && e.hasAttribute(`${l.prefix}each-visible`);
|
|
14001
14058
|
}
|
|
14002
14059
|
/**
|
|
14003
14060
|
* 公開する変数名を解決します。
|
|
@@ -14006,7 +14063,7 @@ const O = class O {
|
|
|
14006
14063
|
* @returns 変数名。未指定なら空文字
|
|
14007
14064
|
*/
|
|
14008
14065
|
static resolveVarName(e) {
|
|
14009
|
-
const t = e.getRawAttribute(`${
|
|
14066
|
+
const t = e.getRawAttribute(`${l.prefix}each-visible`);
|
|
14010
14067
|
return typeof t == "string" ? t.trim() : "";
|
|
14011
14068
|
}
|
|
14012
14069
|
/**
|
|
@@ -14016,14 +14073,14 @@ const O = class O {
|
|
|
14016
14073
|
* @returns root 要素。未指定・不正ならビューポート(null)
|
|
14017
14074
|
*/
|
|
14018
14075
|
static resolveRoot(e) {
|
|
14019
|
-
const t = `${
|
|
14076
|
+
const t = `${l.prefix}each-visible-root`;
|
|
14020
14077
|
if (!e.hasAttribute(t))
|
|
14021
14078
|
return null;
|
|
14022
14079
|
const r = e.getAttribute(t);
|
|
14023
14080
|
if (typeof r != "string" || r.trim() === "")
|
|
14024
14081
|
return null;
|
|
14025
14082
|
const i = z.query(r, t, document);
|
|
14026
|
-
return O.isHtmlElement(i) ? i : (
|
|
14083
|
+
return O.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
14027
14084
|
}
|
|
14028
14085
|
/**
|
|
14029
14086
|
* rootMargin を解決します。
|
|
@@ -14032,7 +14089,7 @@ const O = class O {
|
|
|
14032
14089
|
* @returns rootMargin 文字列(未指定は既定値)
|
|
14033
14090
|
*/
|
|
14034
14091
|
static resolveRootMargin(e) {
|
|
14035
|
-
const t = `${
|
|
14092
|
+
const t = `${l.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
14036
14093
|
return r === null || r === !1 || r === "" ? O.DEFAULT_ROOT_MARGIN : String(r);
|
|
14037
14094
|
}
|
|
14038
14095
|
/**
|
|
@@ -14043,7 +14100,7 @@ const O = class O {
|
|
|
14043
14100
|
*/
|
|
14044
14101
|
static realRowElements(e) {
|
|
14045
14102
|
return e.getChildren().filter(
|
|
14046
|
-
(t) => t instanceof I && !t.hasAttribute(`${
|
|
14103
|
+
(t) => t instanceof I && !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
14047
14104
|
).map((t) => t.getTarget());
|
|
14048
14105
|
}
|
|
14049
14106
|
/**
|
|
@@ -14098,8 +14155,8 @@ const O = class O {
|
|
|
14098
14155
|
};
|
|
14099
14156
|
else {
|
|
14100
14157
|
let a = i[0], o = i[0];
|
|
14101
|
-
for (const
|
|
14102
|
-
|
|
14158
|
+
for (const c of i)
|
|
14159
|
+
c < a && (a = c), c > o && (o = c);
|
|
14103
14160
|
n = {
|
|
14104
14161
|
first: a,
|
|
14105
14162
|
last: o,
|
|
@@ -14122,7 +14179,7 @@ const O = class O {
|
|
|
14122
14179
|
static publish(e, t) {
|
|
14123
14180
|
const r = O.resolveBindOwner(e.fragment);
|
|
14124
14181
|
if (!r) {
|
|
14125
|
-
|
|
14182
|
+
m.warn(
|
|
14126
14183
|
"[Haori]",
|
|
14127
14184
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
14128
14185
|
);
|
|
@@ -14141,7 +14198,7 @@ const O = class O {
|
|
|
14141
14198
|
kind: "nonSupply",
|
|
14142
14199
|
sequence: I.nextSequence()
|
|
14143
14200
|
}).catch((o) => {
|
|
14144
|
-
|
|
14201
|
+
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
14145
14202
|
});
|
|
14146
14203
|
}
|
|
14147
14204
|
/**
|
|
@@ -14152,7 +14209,7 @@ const O = class O {
|
|
|
14152
14209
|
* @returns 公開先フラグメント。無ければ null
|
|
14153
14210
|
*/
|
|
14154
14211
|
static resolveBindOwner(e) {
|
|
14155
|
-
const t = `${
|
|
14212
|
+
const t = `${l.prefix}bind`;
|
|
14156
14213
|
let r = e.getParent();
|
|
14157
14214
|
for (; r; ) {
|
|
14158
14215
|
if (r.hasAttribute(t))
|
|
@@ -14190,11 +14247,11 @@ const G = class G {
|
|
|
14190
14247
|
B.scan(document.head),
|
|
14191
14248
|
B.scan(document.body)
|
|
14192
14249
|
]), [r, i] = t;
|
|
14193
|
-
r.status !== "fulfilled" &&
|
|
14250
|
+
r.status !== "fulfilled" && m.error(
|
|
14194
14251
|
"[Haori]",
|
|
14195
14252
|
"Failed to build head fragment:",
|
|
14196
14253
|
r.reason
|
|
14197
|
-
), i.status !== "fulfilled" &&
|
|
14254
|
+
), i.status !== "fulfilled" && m.error(
|
|
14198
14255
|
"[Haori]",
|
|
14199
14256
|
"Failed to build body fragment:",
|
|
14200
14257
|
i.reason
|
|
@@ -14227,7 +14284,7 @@ const G = class G {
|
|
|
14227
14284
|
* @returns 外部管理サブツリーに属する場合 true
|
|
14228
14285
|
*/
|
|
14229
14286
|
static isExternallyManaged(e) {
|
|
14230
|
-
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${
|
|
14287
|
+
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${l.prefix}external]`) != null;
|
|
14231
14288
|
}
|
|
14232
14289
|
/**
|
|
14233
14290
|
* 指定された要素を監視します。
|
|
@@ -14285,7 +14342,7 @@ const G = class G {
|
|
|
14285
14342
|
* @returns `data-bind` 属性の変更なら true
|
|
14286
14343
|
*/
|
|
14287
14344
|
static isBindAttributeRecord(e) {
|
|
14288
|
-
return e.type === "attributes" && e.attributeName === `${
|
|
14345
|
+
return e.type === "attributes" && e.attributeName === `${l.prefix}bind`;
|
|
14289
14346
|
}
|
|
14290
14347
|
/**
|
|
14291
14348
|
* DOM 変更のレコードを処理します。
|
|
@@ -14303,7 +14360,7 @@ const G = class G {
|
|
|
14303
14360
|
switch (r.type) {
|
|
14304
14361
|
case "attributes": {
|
|
14305
14362
|
const i = r.target;
|
|
14306
|
-
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(Ae) && (r.attributeName === "disabled" || r.attributeName === Ae) || r.attributeName && (r.attributeName === `${
|
|
14363
|
+
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(Ae) && (r.attributeName === "disabled" || r.attributeName === Ae) || r.attributeName && (r.attributeName === `${l.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${l.prefix}if-false`)) || r.attributeName && B.isAliasedAttributeReflection(i, r.attributeName))
|
|
14307
14364
|
break;
|
|
14308
14365
|
B.setAttribute(
|
|
14309
14366
|
i,
|
|
@@ -14323,7 +14380,7 @@ const G = class G {
|
|
|
14323
14380
|
break;
|
|
14324
14381
|
}
|
|
14325
14382
|
case "characterData": {
|
|
14326
|
-
r.target instanceof Text || r.target instanceof Comment ? B.changeText(r.target, r.target.textContent) :
|
|
14383
|
+
r.target instanceof Text || r.target instanceof Comment ? B.changeText(r.target, r.target.textContent) : m.warn(
|
|
14327
14384
|
"[Haori]",
|
|
14328
14385
|
"Unsupported character data type:",
|
|
14329
14386
|
r.target
|
|
@@ -14331,11 +14388,11 @@ const G = class G {
|
|
|
14331
14388
|
break;
|
|
14332
14389
|
}
|
|
14333
14390
|
default:
|
|
14334
|
-
|
|
14391
|
+
m.warn("[Haori]", "Unknown mutation type:", r.type);
|
|
14335
14392
|
continue;
|
|
14336
14393
|
}
|
|
14337
14394
|
} catch (i) {
|
|
14338
|
-
|
|
14395
|
+
m.error("[Haori]", "Error processing mutation:", i);
|
|
14339
14396
|
}
|
|
14340
14397
|
}
|
|
14341
14398
|
};
|
|
@@ -14346,11 +14403,11 @@ const Wt = () => ye.waitForRenders(), jt = ye.enhancers;
|
|
|
14346
14403
|
export {
|
|
14347
14404
|
B as Core,
|
|
14348
14405
|
ie as Enhance,
|
|
14349
|
-
|
|
14406
|
+
l as Env,
|
|
14350
14407
|
F as Form,
|
|
14351
14408
|
x as Fragment,
|
|
14352
14409
|
ye as Haori,
|
|
14353
|
-
|
|
14410
|
+
m as Log,
|
|
14354
14411
|
K as Queue,
|
|
14355
14412
|
ye as default,
|
|
14356
14413
|
jt as enhancers,
|