haori 0.46.0 → 0.46.2
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 +17 -18
- package/dist/haori.es.js +848 -765
- package/dist/haori.iife.js +18 -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 より後で使うアクション属性を読み取り、開始時の評価情報を記録します。
|
|
@@ -8375,6 +8375,28 @@ const b = class b {
|
|
|
8375
8375
|
hasUnresolvedReference: n?.hasUnresolvedReference ?? !1
|
|
8376
8376
|
}), n?.value ?? null;
|
|
8377
8377
|
}
|
|
8378
|
+
/**
|
|
8379
|
+
* 表示メッセージの評価値を文字列へ正規化します。
|
|
8380
|
+
*
|
|
8381
|
+
* `data-{event}-confirm` / `-dialog` / `-toast` の属性値には `{{式}}` を書けるため、
|
|
8382
|
+
* 評価結果は文字列に限りません(`null` / `false` / 数値になり、未解決参照は `null`
|
|
8383
|
+
* になります)。仕様「`data-{event}-confirm`」の「単体プレースホルダの評価結果が
|
|
8384
|
+
* `null` / `undefined` / `false` / 空文字 / `0`、または未解決参照になった場合は、
|
|
8385
|
+
* 確認を出さずに手続きを続けます」に従い、falsy は `null`(表示なし)へ寄せます。
|
|
8386
|
+
*
|
|
8387
|
+
* falsy 以外を文字列へ寄せるのは、同じ節の「それ以外の評価結果は**文字列にして
|
|
8388
|
+
* メッセージにします**」と、仕様「`data-{event}-dialog`」の「それ以外は文字列に
|
|
8389
|
+
* して表示します」のとおりです。数値などを表示なし側へ落とすと、確認したい場面で
|
|
8390
|
+
* 確認が黙って飛びます。表示する側を文字列へ寄せるのは、`haori.dialog()` などの
|
|
8391
|
+
* 差し替え実装が引数を文字列として扱うためです(`haori-bootstrap` は改行の復元で
|
|
8392
|
+
* `String.prototype.replace` を呼ぶため、数値を渡すと例外になります)。
|
|
8393
|
+
*
|
|
8394
|
+
* @param value 属性の評価値
|
|
8395
|
+
* @returns メッセージの文字列。表示しない場合は null
|
|
8396
|
+
*/
|
|
8397
|
+
static normalizeMessage(e) {
|
|
8398
|
+
return e ? String(e) : null;
|
|
8399
|
+
}
|
|
8378
8400
|
/**
|
|
8379
8401
|
* 属性値の `\n` 表記を改行へ復元します。
|
|
8380
8402
|
*
|
|
@@ -8467,11 +8489,11 @@ const b = class b {
|
|
|
8467
8489
|
return { value: e.replace(
|
|
8468
8490
|
b.DATA_PLACEHOLDER_REGEX,
|
|
8469
8491
|
(n, s, a, o) => {
|
|
8470
|
-
const
|
|
8492
|
+
const c = Q.evaluateDetailed(
|
|
8471
8493
|
s ?? a ?? "",
|
|
8472
8494
|
t
|
|
8473
8495
|
);
|
|
8474
|
-
return r = r ||
|
|
8496
|
+
return r = r || c.unresolvedReference, b.isJsonStringContext(e, o) ? b.stringifyJsonTemplateStringContent(c.value) : b.stringifyJsonTemplateValue(c.value);
|
|
8475
8497
|
}
|
|
8476
8498
|
), hasUnresolvedReference: r };
|
|
8477
8499
|
}
|
|
@@ -8508,13 +8530,13 @@ const b = class b {
|
|
|
8508
8530
|
hasUnresolvedReference: s
|
|
8509
8531
|
};
|
|
8510
8532
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
8511
|
-
const
|
|
8533
|
+
const c = b.resolveDataJsonStringDetailed(
|
|
8512
8534
|
r,
|
|
8513
8535
|
e.getBindingData()
|
|
8514
8536
|
);
|
|
8515
8537
|
return {
|
|
8516
|
-
value: B.parseDataBind(
|
|
8517
|
-
hasUnresolvedReference: s ||
|
|
8538
|
+
value: B.parseDataBind(c.value),
|
|
8539
|
+
hasUnresolvedReference: s || c.hasUnresolvedReference
|
|
8518
8540
|
};
|
|
8519
8541
|
}
|
|
8520
8542
|
const o = b.resolveDataParamStringDetailed(
|
|
@@ -8539,14 +8561,17 @@ const b = class b {
|
|
|
8539
8561
|
}, i = t ? b.attrName(t, "if") : b.attrName(null, "if", !0);
|
|
8540
8562
|
if (e.hasAttribute(i)) {
|
|
8541
8563
|
const A = e.getRawAttribute(i);
|
|
8542
|
-
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) :
|
|
8564
|
+
typeof A == "string" && A.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(A), r.conditionAttributeName = i) : m.warn(
|
|
8543
8565
|
"Haori",
|
|
8544
8566
|
`${i} に条件式が指定されていません。`
|
|
8545
8567
|
);
|
|
8546
8568
|
}
|
|
8547
8569
|
if (t) {
|
|
8548
|
-
if (e.hasAttribute(b.attrName(t, "validate")) && (r.valid = !0), e.hasAttribute(b.attrName(t, "confirm")) && (r.confirmMessage =
|
|
8549
|
-
|
|
8570
|
+
if (e.hasAttribute(b.attrName(t, "validate")) && (r.valid = !0), e.hasAttribute(b.attrName(t, "confirm")) && (r.confirmMessage = b.unescapeNewlines(
|
|
8571
|
+
b.normalizeMessage(
|
|
8572
|
+
e.getAttribute(b.attrName(t, "confirm"))
|
|
8573
|
+
)
|
|
8574
|
+
)), e.hasAttribute(b.attrName(t, "data")) && (r.dataAttrName = b.attrName(t, "data")), e.hasAttribute(b.attrName(t, "form"))) {
|
|
8550
8575
|
const S = z.read(
|
|
8551
8576
|
e,
|
|
8552
8577
|
b.attrName(t, "form")
|
|
@@ -8558,16 +8583,16 @@ const b = class b {
|
|
|
8558
8583
|
);
|
|
8559
8584
|
C !== null ? r.formFragment = F.getFormFragment(
|
|
8560
8585
|
x.get(C)
|
|
8561
|
-
) :
|
|
8586
|
+
) : m.error(
|
|
8562
8587
|
"Haori",
|
|
8563
8588
|
`Form element not found: ${S} (${b.attrName(t, "form")})`
|
|
8564
8589
|
);
|
|
8565
8590
|
} else
|
|
8566
8591
|
r.formFragment = F.getFormFragment(e);
|
|
8567
8592
|
} else (t === "change" || t === "input") && (r.formFragment = F.getFormFragment(e), r.formFragment === null && b.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
8568
|
-
if (e.hasAttribute(`${
|
|
8593
|
+
if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
|
|
8569
8594
|
const S = e.getRawAttribute(
|
|
8570
|
-
`${
|
|
8595
|
+
`${l.prefix}${t}-before-run`
|
|
8571
8596
|
);
|
|
8572
8597
|
try {
|
|
8573
8598
|
r.beforeCallback = new Function(
|
|
@@ -8579,7 +8604,7 @@ ${S}
|
|
|
8579
8604
|
`
|
|
8580
8605
|
);
|
|
8581
8606
|
} catch (C) {
|
|
8582
|
-
|
|
8607
|
+
m.error("Haori", `Invalid before script: ${C}`);
|
|
8583
8608
|
}
|
|
8584
8609
|
}
|
|
8585
8610
|
const A = b.attrName(t, "run");
|
|
@@ -8599,7 +8624,7 @@ ${S}
|
|
|
8599
8624
|
${S}
|
|
8600
8625
|
`);
|
|
8601
8626
|
} catch (V) {
|
|
8602
|
-
|
|
8627
|
+
m.error("Haori", `Invalid run script: ${V}`);
|
|
8603
8628
|
}
|
|
8604
8629
|
}
|
|
8605
8630
|
C && (r.runScript = C);
|
|
@@ -8635,7 +8660,7 @@ ${S}
|
|
|
8635
8660
|
try {
|
|
8636
8661
|
a.headers = B.parseDataBind(S);
|
|
8637
8662
|
} catch (C) {
|
|
8638
|
-
|
|
8663
|
+
m.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8639
8664
|
}
|
|
8640
8665
|
}
|
|
8641
8666
|
} else {
|
|
@@ -8651,7 +8676,7 @@ ${S}
|
|
|
8651
8676
|
try {
|
|
8652
8677
|
a.headers = B.parseDataBind(S);
|
|
8653
8678
|
} catch (C) {
|
|
8654
|
-
|
|
8679
|
+
m.error("Haori", `Invalid fetch headers: ${C}`);
|
|
8655
8680
|
}
|
|
8656
8681
|
}
|
|
8657
8682
|
}
|
|
@@ -8705,14 +8730,14 @@ ${S}
|
|
|
8705
8730
|
S.length > 0 ? (r.bindFragments = [], S.forEach((C) => {
|
|
8706
8731
|
const V = x.get(C);
|
|
8707
8732
|
V && r.bindFragments.push(V);
|
|
8708
|
-
})) :
|
|
8733
|
+
})) : m.error(
|
|
8709
8734
|
"Haori",
|
|
8710
8735
|
`Bind element not found: ${A} (${o})`
|
|
8711
8736
|
);
|
|
8712
8737
|
}
|
|
8713
8738
|
}
|
|
8714
|
-
const
|
|
8715
|
-
t ? e.hasAttribute(
|
|
8739
|
+
const c = b.attrName(t, "bind-arg"), u = b.attrName(null, "arg", !0), d = b.attrName(null, "bind-arg", !0);
|
|
8740
|
+
t ? e.hasAttribute(c) && (r.bindArg = e.getRawAttribute(c)) : e.hasAttribute(u) ? r.bindArg = e.getRawAttribute(
|
|
8716
8741
|
u
|
|
8717
8742
|
) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
|
|
8718
8743
|
const p = t ? b.attrName(t, "bind-params") : b.attrName(null, "bind-params", !0);
|
|
@@ -8748,7 +8773,7 @@ ${S}
|
|
|
8748
8773
|
q.length > 0 ? (r.adjustFragments = [], q.forEach((X) => {
|
|
8749
8774
|
const Y = x.get(X);
|
|
8750
8775
|
Y && r.adjustFragments.push(Y);
|
|
8751
|
-
})) :
|
|
8776
|
+
})) : m.error(
|
|
8752
8777
|
"Haori",
|
|
8753
8778
|
`Adjust element not found: ${k} (${b.attrName(t, "adjust")})`
|
|
8754
8779
|
);
|
|
@@ -8760,9 +8785,9 @@ ${S}
|
|
|
8760
8785
|
isNaN(X) || (r.adjustValue = X);
|
|
8761
8786
|
}
|
|
8762
8787
|
}
|
|
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(`${
|
|
8788
|
+
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
8789
|
const k = e.getRawAttribute(
|
|
8765
|
-
`${
|
|
8790
|
+
`${l.prefix}${t}-after-run`
|
|
8766
8791
|
);
|
|
8767
8792
|
try {
|
|
8768
8793
|
r.afterCallback = new Function(
|
|
@@ -8773,7 +8798,7 @@ ${k}
|
|
|
8773
8798
|
`
|
|
8774
8799
|
);
|
|
8775
8800
|
} catch (q) {
|
|
8776
|
-
|
|
8801
|
+
m.error("Haori", `Invalid after script: ${q}`);
|
|
8777
8802
|
}
|
|
8778
8803
|
}
|
|
8779
8804
|
if (e.hasAttribute(b.attrName(t, "dialog")) && (r.dialogMessage = b.unescapeNewlines(
|
|
@@ -8840,7 +8865,7 @@ ${k}
|
|
|
8840
8865
|
);
|
|
8841
8866
|
q !== null ? r.historyFormFragment = F.getFormFragment(
|
|
8842
8867
|
x.get(q)
|
|
8843
|
-
) :
|
|
8868
|
+
) : m.error(
|
|
8844
8869
|
"Haori",
|
|
8845
8870
|
`Form element not found: ${k} (${b.attrName(t, "history-form")})`
|
|
8846
8871
|
);
|
|
@@ -8864,10 +8889,10 @@ ${k}
|
|
|
8864
8889
|
z.queryAll(X, q).forEach((be) => {
|
|
8865
8890
|
const ue = x.get(be);
|
|
8866
8891
|
ue && Y.push(ue);
|
|
8867
|
-
}), Y.length === 0 &&
|
|
8892
|
+
}), Y.length === 0 && m.error("Haori", `Element not found: ${X} (${q})`);
|
|
8868
8893
|
else if (k === "open" || k === "close") {
|
|
8869
8894
|
const te = e.getTarget().closest("dialog");
|
|
8870
|
-
te ? Y.push(x.get(te)) :
|
|
8895
|
+
te ? Y.push(x.get(te)) : m.error("Haori", `Ancestor <dialog> not found (${q})`);
|
|
8871
8896
|
} else
|
|
8872
8897
|
Y.push(e);
|
|
8873
8898
|
if (Y.length > 0)
|
|
@@ -8902,12 +8927,12 @@ ${k}
|
|
|
8902
8927
|
const q = z.query(k, _);
|
|
8903
8928
|
if (q !== null) {
|
|
8904
8929
|
const X = x.get(q);
|
|
8905
|
-
X ? r.copySourceFragment = X :
|
|
8930
|
+
X ? r.copySourceFragment = X : m.error(
|
|
8906
8931
|
"Haori",
|
|
8907
8932
|
`Element is not managed by Haori: ${k} (${_})`
|
|
8908
8933
|
);
|
|
8909
8934
|
} else
|
|
8910
|
-
|
|
8935
|
+
m.error(
|
|
8911
8936
|
"Haori",
|
|
8912
8937
|
`Element not found: ${k} (${_})`
|
|
8913
8938
|
);
|
|
@@ -8927,7 +8952,7 @@ ${k}
|
|
|
8927
8952
|
);
|
|
8928
8953
|
S !== null ? r.formFragment = F.getFormFragment(
|
|
8929
8954
|
x.get(S)
|
|
8930
|
-
) :
|
|
8955
|
+
) : m.error(
|
|
8931
8956
|
"Haori",
|
|
8932
8957
|
`Form element not found: ${A} (${b.attrName(null, "fetch-form", !0)})`
|
|
8933
8958
|
);
|
|
@@ -8940,7 +8965,7 @@ ${k}
|
|
|
8940
8965
|
A ? (z.queryAll(A, M).forEach((V) => {
|
|
8941
8966
|
const L = x.get(V);
|
|
8942
8967
|
L && S.push(L);
|
|
8943
|
-
}), S.length === 0 &&
|
|
8968
|
+
}), S.length === 0 && m.error(
|
|
8944
8969
|
"Haori",
|
|
8945
8970
|
`Element not found: ${A} (${M})`
|
|
8946
8971
|
)) : S.push(e), S.length > 0 && (r.fetchStateFragments = S);
|
|
@@ -8949,7 +8974,7 @@ ${k}
|
|
|
8949
8974
|
if (e.hasAttribute(H)) {
|
|
8950
8975
|
const A = e.getRawAttribute(H), S = A === null ? "" : A.trim();
|
|
8951
8976
|
if (S === "")
|
|
8952
|
-
|
|
8977
|
+
m.error(
|
|
8953
8978
|
"Haori",
|
|
8954
8979
|
`ストレージキーが指定されていません (${H})`
|
|
8955
8980
|
);
|
|
@@ -8958,7 +8983,7 @@ ${k}
|
|
|
8958
8983
|
const C = e.getRawAttribute(
|
|
8959
8984
|
`${H}-type`
|
|
8960
8985
|
), V = C === null ? "session" : C.trim();
|
|
8961
|
-
V === "local" || V === "session" ? r.storeClearKind = V : (
|
|
8986
|
+
V === "local" || V === "session" ? r.storeClearKind = V : (m.warn(
|
|
8962
8987
|
"Haori",
|
|
8963
8988
|
`${H}-type は session または local を指定してください(session として扱います): ${V}`
|
|
8964
8989
|
), r.storeClearKind = "session");
|
|
@@ -8986,7 +9011,7 @@ ${k}
|
|
|
8986
9011
|
];
|
|
8987
9012
|
for (const i of r) {
|
|
8988
9013
|
const n = i.getParent();
|
|
8989
|
-
!n || !n.hasAttribute(`${
|
|
9014
|
+
!n || !n.hasAttribute(`${l.prefix}each`) || !n.hasAttribute(`${l.prefix}form-list`) || t.set(
|
|
8990
9015
|
i,
|
|
8991
9016
|
b.getRowFragments(n).includes(i) ? n : null
|
|
8992
9017
|
);
|
|
@@ -9003,7 +9028,7 @@ ${k}
|
|
|
9003
9028
|
*/
|
|
9004
9029
|
static isNamedInputFragment(e) {
|
|
9005
9030
|
const t = e.getTarget();
|
|
9006
|
-
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${
|
|
9031
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.getAttribute("name") !== null || e.hasAttribute(`${l.prefix}form-name`) : !1;
|
|
9007
9032
|
}
|
|
9008
9033
|
/**
|
|
9009
9034
|
* ElementFragment の構造的タイプガード。
|
|
@@ -9062,7 +9087,7 @@ ${k}
|
|
|
9062
9087
|
try {
|
|
9063
9088
|
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
9089
|
F.getFormFragment(this.options.targetFragment),
|
|
9065
|
-
`${
|
|
9090
|
+
`${l.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
9066
9091
|
), !this.evaluateExecutionCondition()))
|
|
9067
9092
|
return !1;
|
|
9068
9093
|
if (this.options.runScript) {
|
|
@@ -9074,7 +9099,7 @@ ${k}
|
|
|
9074
9099
|
);
|
|
9075
9100
|
g === !1 && this.domEvent && this.domEvent.preventDefault(), g != null && typeof g.then == "function" && await g;
|
|
9076
9101
|
} catch (g) {
|
|
9077
|
-
|
|
9102
|
+
m.error("Haori", `Run script execution error: ${g}`);
|
|
9078
9103
|
}
|
|
9079
9104
|
}
|
|
9080
9105
|
if (!await this.confirm())
|
|
@@ -9099,7 +9124,7 @@ ${k}
|
|
|
9099
9124
|
typeof p == "object" && (a = "fetchUrl" in p, o = "fetchOptions" in p, n = a ? p.fetchUrl : n, s = o ? p.fetchOptions : s);
|
|
9100
9125
|
}
|
|
9101
9126
|
}
|
|
9102
|
-
const
|
|
9127
|
+
const c = Object.keys(i).length > 0;
|
|
9103
9128
|
if (n) {
|
|
9104
9129
|
const p = (s?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && Pt(s) && !Oe(p) ? r.baseUrl ?? n : n, v = Lt(
|
|
9105
9130
|
E,
|
|
@@ -9107,17 +9132,17 @@ ${k}
|
|
|
9107
9132
|
);
|
|
9108
9133
|
n = v.url;
|
|
9109
9134
|
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:
|
|
9135
|
+
if (A && m.info("Haori demo fetch normalization", {
|
|
9136
|
+
runtime: l.runtime,
|
|
9112
9137
|
requestedMethod: M,
|
|
9113
9138
|
effectiveMethod: H,
|
|
9114
9139
|
transportMode: "query-get",
|
|
9115
9140
|
url: n,
|
|
9116
|
-
payload:
|
|
9141
|
+
payload: c ? i : void 0,
|
|
9117
9142
|
queryString: S
|
|
9118
9143
|
}), this.options.targetFragment && n) {
|
|
9119
9144
|
const C = performance.now(), V = {
|
|
9120
|
-
runtime:
|
|
9145
|
+
runtime: l.runtime,
|
|
9121
9146
|
requestedMethod: M,
|
|
9122
9147
|
effectiveMethod: H,
|
|
9123
9148
|
transportMode: A ? "query-get" : "http",
|
|
@@ -9127,7 +9152,7 @@ ${k}
|
|
|
9127
9152
|
this.options.targetFragment.getTarget(),
|
|
9128
9153
|
n,
|
|
9129
9154
|
D,
|
|
9130
|
-
|
|
9155
|
+
c ? i : void 0,
|
|
9131
9156
|
V
|
|
9132
9157
|
), await this.injectFetchState("loading"), await fetch(n, D).then((L) => this.handleFetchResult(
|
|
9133
9158
|
L,
|
|
@@ -9147,10 +9172,10 @@ ${k}
|
|
|
9147
9172
|
}
|
|
9148
9173
|
return await fetch(n, D).then((C) => this.handleFetchResult(C, n || void 0));
|
|
9149
9174
|
}
|
|
9150
|
-
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment &&
|
|
9175
|
+
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
|
|
9151
9176
|
const p = this.options.formFragment, g = p.getTarget(), E = /* @__PURE__ */ new Set();
|
|
9152
9177
|
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
9153
|
-
const v = p.getRawBindingData(), D = Be(i), M = p.getAttribute(`${
|
|
9178
|
+
const v = p.getRawBindingData(), D = Be(i), M = p.getAttribute(`${l.prefix}form-arg`);
|
|
9154
9179
|
let H;
|
|
9155
9180
|
if (M) {
|
|
9156
9181
|
H = { ...v ?? {} };
|
|
@@ -9173,8 +9198,8 @@ ${k}
|
|
|
9173
9198
|
)
|
|
9174
9199
|
});
|
|
9175
9200
|
}
|
|
9176
|
-
this.suppressEmptyReplaceBind = !
|
|
9177
|
-
const u =
|
|
9201
|
+
this.suppressEmptyReplaceBind = !c && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input"), this.twoWayCommitBind = this.eventType === "change" || this.eventType === "input";
|
|
9202
|
+
const u = c ? Be(i) : {}, d = new Response(JSON.stringify(u), {
|
|
9178
9203
|
headers: { "Content-Type": "application/json" }
|
|
9179
9204
|
});
|
|
9180
9205
|
return await this.handleFetchResult(d);
|
|
@@ -9193,7 +9218,7 @@ ${k}
|
|
|
9193
9218
|
const t = this.options.targetFragment.getTarget();
|
|
9194
9219
|
if (b.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Pe))
|
|
9195
9220
|
return !1;
|
|
9196
|
-
const r = t.hasAttribute(`${
|
|
9221
|
+
const r = t.hasAttribute(`${l.prefix}click-no-disabled`);
|
|
9197
9222
|
return b.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Pe, ""), r || t.setAttribute("disabled", ""), {
|
|
9198
9223
|
target: t,
|
|
9199
9224
|
appliedDisabledAttribute: !r
|
|
@@ -9257,26 +9282,27 @@ ${k}
|
|
|
9257
9282
|
}
|
|
9258
9283
|
this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((g) => {
|
|
9259
9284
|
const E = g.getTarget();
|
|
9260
|
-
E instanceof HTMLElement ? s.push(i.openDialog(E)) :
|
|
9285
|
+
E instanceof HTMLElement ? s.push(i.openDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
|
|
9261
9286
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((g) => {
|
|
9262
9287
|
const E = g.getTarget();
|
|
9263
|
-
E instanceof HTMLElement ? s.push(i.closeDialog(E)) :
|
|
9288
|
+
E instanceof HTMLElement ? s.push(i.closeDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
|
|
9264
9289
|
}), await Promise.all(s);
|
|
9265
9290
|
const a = b.unescapeNewlines(
|
|
9266
|
-
|
|
9291
|
+
b.normalizeMessage(
|
|
9292
|
+
this.resolveLateAttribute("dialog", this.options.dialogMessage)
|
|
9293
|
+
)
|
|
9267
9294
|
);
|
|
9268
9295
|
a && await i.dialog(a);
|
|
9269
|
-
const o =
|
|
9270
|
-
"toast",
|
|
9271
|
-
this.options.toastMessage
|
|
9296
|
+
const o = b.normalizeMessage(
|
|
9297
|
+
this.resolveLateAttribute("toast", this.options.toastMessage)
|
|
9272
9298
|
);
|
|
9273
9299
|
o && await i.toast(o, this.options.toastLevel ?? "info"), this.clearStore(), this.pushHistory();
|
|
9274
|
-
const
|
|
9300
|
+
const c = this.resolveLateAttribute(
|
|
9275
9301
|
"scroll",
|
|
9276
9302
|
this.options.scrollTarget
|
|
9277
9303
|
);
|
|
9278
|
-
|
|
9279
|
-
|
|
9304
|
+
c && z.query(
|
|
9305
|
+
c,
|
|
9280
9306
|
b.attrName(this.eventType, "scroll"),
|
|
9281
9307
|
document
|
|
9282
9308
|
)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
@@ -9287,7 +9313,7 @@ ${k}
|
|
|
9287
9313
|
"redirect-replace",
|
|
9288
9314
|
this.options.redirectReplaceUrl
|
|
9289
9315
|
);
|
|
9290
|
-
u && d &&
|
|
9316
|
+
u && d && m.warn(
|
|
9291
9317
|
"Haori",
|
|
9292
9318
|
`${b.attrName(this.eventType, "redirect")} と ${b.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
9293
9319
|
);
|
|
@@ -9302,7 +9328,7 @@ ${k}
|
|
|
9302
9328
|
const D = new URLSearchParams(window.location.search).get(E);
|
|
9303
9329
|
if (D !== null) {
|
|
9304
9330
|
const M = D.trim();
|
|
9305
|
-
ht.isSafeLocalPath(M) ? g = M :
|
|
9331
|
+
ht.isSafeLocalPath(M) ? g = M : m.warn(
|
|
9306
9332
|
"Haori",
|
|
9307
9333
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${D}`
|
|
9308
9334
|
);
|
|
@@ -9339,7 +9365,7 @@ ${k}
|
|
|
9339
9365
|
if (!i || !n || !n.hasAttribute(i.attributeName))
|
|
9340
9366
|
return r;
|
|
9341
9367
|
const s = n.getAttributeEvaluation(i.attributeName);
|
|
9342
|
-
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (j.isEnabled() &&
|
|
9368
|
+
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (j.isEnabled() && m.warn(
|
|
9343
9369
|
"Haori",
|
|
9344
9370
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
9345
9371
|
), r) : s.value ?? null;
|
|
@@ -9361,20 +9387,20 @@ ${k}
|
|
|
9361
9387
|
const a = t ? e : window.location.pathname, o = new URL(a, window.location.href);
|
|
9362
9388
|
if (o.origin !== window.location.origin) {
|
|
9363
9389
|
const u = "history.pushState: cross-origin URL is not allowed: " + o.toString();
|
|
9364
|
-
|
|
9390
|
+
m.error("Haori", u);
|
|
9365
9391
|
return;
|
|
9366
9392
|
}
|
|
9367
|
-
const
|
|
9393
|
+
const c = (u) => {
|
|
9368
9394
|
for (const [d, p] of Object.entries(u))
|
|
9369
9395
|
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
9396
|
};
|
|
9371
|
-
n &&
|
|
9397
|
+
n && c(r), s && c(i), history.pushState(
|
|
9372
9398
|
{ [Mt]: !0 },
|
|
9373
9399
|
"",
|
|
9374
9400
|
o.toString()
|
|
9375
9401
|
);
|
|
9376
9402
|
} catch (a) {
|
|
9377
|
-
|
|
9403
|
+
m.error("Haori", `history.pushState failed: ${a}`);
|
|
9378
9404
|
}
|
|
9379
9405
|
}
|
|
9380
9406
|
/**
|
|
@@ -9398,40 +9424,40 @@ ${k}
|
|
|
9398
9424
|
try {
|
|
9399
9425
|
const a = await e.json(), o = [];
|
|
9400
9426
|
if (Array.isArray(a)) {
|
|
9401
|
-
const
|
|
9427
|
+
const c = /* @__PURE__ */ new Map(), u = [];
|
|
9402
9428
|
for (const d of a)
|
|
9403
9429
|
if (d && typeof d == "object" && !Array.isArray(d)) {
|
|
9404
9430
|
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
9431
|
if (v.length === 0)
|
|
9406
9432
|
continue;
|
|
9407
9433
|
if (E !== null) {
|
|
9408
|
-
const D =
|
|
9409
|
-
D.push(v),
|
|
9434
|
+
const D = c.get(E) ?? [];
|
|
9435
|
+
D.push(v), c.set(E, D);
|
|
9410
9436
|
} else
|
|
9411
9437
|
u.push(v);
|
|
9412
9438
|
} else typeof d == "string" && d.length > 0 && u.push(d);
|
|
9413
|
-
for (const [d, p] of
|
|
9439
|
+
for (const [d, p] of c)
|
|
9414
9440
|
o.push({ key: d, message: p.join(`
|
|
9415
9441
|
`) });
|
|
9416
9442
|
for (const d of u)
|
|
9417
9443
|
o.push({ message: d });
|
|
9418
9444
|
} else if (a && typeof a == "object") {
|
|
9419
9445
|
if (typeof a.message == "string" && o.push({ message: a.message }), Array.isArray(a.messages))
|
|
9420
|
-
for (const
|
|
9421
|
-
typeof
|
|
9446
|
+
for (const c of a.messages)
|
|
9447
|
+
typeof c == "string" && o.push({ message: c });
|
|
9422
9448
|
if (a.errors && typeof a.errors == "object")
|
|
9423
|
-
for (const [
|
|
9424
|
-
Array.isArray(u) ? o.push({ key:
|
|
9425
|
-
`) }) : typeof u == "string" ? o.push({ key:
|
|
9449
|
+
for (const [c, u] of Object.entries(a.errors))
|
|
9450
|
+
Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9451
|
+
`) }) : typeof u == "string" ? o.push({ key: c, message: u }) : u != null && o.push({ key: c, message: String(u) });
|
|
9426
9452
|
if (o.length === 0)
|
|
9427
|
-
for (const [
|
|
9428
|
-
|
|
9429
|
-
`) }) : typeof u == "string" && o.push({ key:
|
|
9453
|
+
for (const [c, u] of Object.entries(a))
|
|
9454
|
+
c === "message" || c === "messages" || c === "errors" || (Array.isArray(u) ? o.push({ key: c, message: u.join(`
|
|
9455
|
+
`) }) : typeof u == "string" && o.push({ key: c, message: u }));
|
|
9430
9456
|
}
|
|
9431
9457
|
if (o.length === 0)
|
|
9432
9458
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
9433
|
-
for (const
|
|
9434
|
-
|
|
9459
|
+
for (const c of o)
|
|
9460
|
+
c.key && t ? await F.addErrorMessage(t, c.key, c.message) : await i(c.message);
|
|
9435
9461
|
return n(), !1;
|
|
9436
9462
|
} catch {
|
|
9437
9463
|
}
|
|
@@ -9454,7 +9480,7 @@ ${k}
|
|
|
9454
9480
|
if (this.options.valid !== !0)
|
|
9455
9481
|
return F.warnUnvalidatedCustomValidity(
|
|
9456
9482
|
e,
|
|
9457
|
-
`${
|
|
9483
|
+
`${l.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
9458
9484
|
), !0;
|
|
9459
9485
|
F.applyCustomValidity(e);
|
|
9460
9486
|
const t = this.findFirstInvalid(e);
|
|
@@ -9547,14 +9573,14 @@ ${k}
|
|
|
9547
9573
|
const r = this.options.targetFragment;
|
|
9548
9574
|
if (!r)
|
|
9549
9575
|
return !0;
|
|
9550
|
-
const i = this.options.conditionAttributeName ?? `${
|
|
9576
|
+
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n = F.buildConditionScope(
|
|
9551
9577
|
r,
|
|
9552
9578
|
this.options.formFragment ?? null
|
|
9553
9579
|
), s = Q.evaluateDetailed(t, n);
|
|
9554
|
-
return s.unresolvedReference ? (e ||
|
|
9580
|
+
return s.unresolvedReference ? (e || m.warn(
|
|
9555
9581
|
"Haori",
|
|
9556
9582
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
9557
|
-
), !1) : s.value ? !0 : (!e && j.isEnabled() &&
|
|
9583
|
+
), !1) : s.value ? !0 : (!e && j.isEnabled() && m.warn(
|
|
9558
9584
|
"Haori",
|
|
9559
9585
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
9560
9586
|
), !1);
|
|
@@ -9567,7 +9593,7 @@ ${k}
|
|
|
9567
9593
|
* @returns 最初の invalid 要素、なければ null
|
|
9568
9594
|
*/
|
|
9569
9595
|
findFirstInvalid(e) {
|
|
9570
|
-
if (e.getTarget().hasAttribute(`${
|
|
9596
|
+
if (e.getTarget().hasAttribute(`${l.prefix}if-false`))
|
|
9571
9597
|
return null;
|
|
9572
9598
|
let t = null;
|
|
9573
9599
|
for (const r of e.getChildElementFragments().reverse()) {
|
|
@@ -9616,31 +9642,31 @@ ${k}
|
|
|
9616
9642
|
response: i
|
|
9617
9643
|
});
|
|
9618
9644
|
} catch (o) {
|
|
9619
|
-
|
|
9645
|
+
m.error("Haori", `Invalid bind-transform: ${o}`);
|
|
9620
9646
|
}
|
|
9621
9647
|
if (this.options.bindParams) {
|
|
9622
9648
|
const o = {};
|
|
9623
|
-
this.options.bindParams.forEach((
|
|
9624
|
-
i && typeof i == "object" &&
|
|
9649
|
+
this.options.bindParams.forEach((c) => {
|
|
9650
|
+
i && typeof i == "object" && c in i && (o[c] = i[c]);
|
|
9625
9651
|
}), i = o;
|
|
9626
9652
|
}
|
|
9627
9653
|
if (this.suppressEmptyReplaceBind && !this.options.bindArg && !this.options.bindMerge && i !== null && typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0) {
|
|
9628
|
-
|
|
9654
|
+
m.warn(
|
|
9629
9655
|
"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 ${
|
|
9656
|
+
`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
9657
|
);
|
|
9632
9658
|
return;
|
|
9633
9659
|
}
|
|
9634
9660
|
const n = [], s = this.eventType ? b.attrName(this.eventType, "bind") : b.attrName(null, "bind", !0), a = [];
|
|
9635
9661
|
if (this.options.bindArg)
|
|
9636
9662
|
this.options.bindFragments.forEach((o) => {
|
|
9637
|
-
const
|
|
9638
|
-
if (
|
|
9663
|
+
const c = this.resolveRowWrite(o, s);
|
|
9664
|
+
if (c.kind === "skip")
|
|
9639
9665
|
return;
|
|
9640
|
-
if (
|
|
9666
|
+
if (c.kind === "row") {
|
|
9641
9667
|
const p = this.options.bindArg;
|
|
9642
9668
|
a.push({
|
|
9643
|
-
container:
|
|
9669
|
+
container: c.container,
|
|
9644
9670
|
row: o,
|
|
9645
9671
|
attributeName: s,
|
|
9646
9672
|
syncWhenUnchanged: "reflect",
|
|
@@ -9693,23 +9719,23 @@ ${k}
|
|
|
9693
9719
|
});
|
|
9694
9720
|
else if (typeof i == "string") {
|
|
9695
9721
|
if (this.options.defaultSelfBind) {
|
|
9696
|
-
|
|
9722
|
+
m.warn(
|
|
9697
9723
|
"Haori",
|
|
9698
9724
|
"string data is not bound because no bind target was specified."
|
|
9699
9725
|
);
|
|
9700
9726
|
return;
|
|
9701
9727
|
}
|
|
9702
|
-
return
|
|
9728
|
+
return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
9703
9729
|
new Error("string data cannot be bound without a bindArg.")
|
|
9704
9730
|
);
|
|
9705
9731
|
} else
|
|
9706
9732
|
this.options.bindFragments.forEach((o) => {
|
|
9707
|
-
const
|
|
9708
|
-
if (
|
|
9733
|
+
const c = this.resolveRowWrite(o, s);
|
|
9734
|
+
if (c.kind === "skip")
|
|
9709
9735
|
return;
|
|
9710
|
-
if (
|
|
9736
|
+
if (c.kind === "row") {
|
|
9711
9737
|
a.push({
|
|
9712
|
-
container:
|
|
9738
|
+
container: c.container,
|
|
9713
9739
|
row: o,
|
|
9714
9740
|
attributeName: s,
|
|
9715
9741
|
syncWhenUnchanged: "reflect",
|
|
@@ -9743,8 +9769,8 @@ ${k}
|
|
|
9743
9769
|
});
|
|
9744
9770
|
return n.push(this.applyRowWrites(a)), Promise.all(n).then(() => {
|
|
9745
9771
|
const o = this.options.bindArg ?? null;
|
|
9746
|
-
this.options.bindFragments.forEach((
|
|
9747
|
-
U.bindComplete(
|
|
9772
|
+
this.options.bindFragments.forEach((c) => {
|
|
9773
|
+
U.bindComplete(c.getTarget(), o);
|
|
9748
9774
|
});
|
|
9749
9775
|
});
|
|
9750
9776
|
});
|
|
@@ -9797,10 +9823,10 @@ ${k}
|
|
|
9797
9823
|
);
|
|
9798
9824
|
if (Object.keys(n).length === 0)
|
|
9799
9825
|
return t;
|
|
9800
|
-
const s = e.getAttribute(`${
|
|
9826
|
+
const s = e.getAttribute(`${l.prefix}form-arg`);
|
|
9801
9827
|
if (s) {
|
|
9802
|
-
const a = String(s), o = t[a],
|
|
9803
|
-
return { ...t, [a]: ae(
|
|
9828
|
+
const a = String(s), o = t[a], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9829
|
+
return { ...t, [a]: ae(c, n) };
|
|
9804
9830
|
}
|
|
9805
9831
|
return ae(t, n);
|
|
9806
9832
|
}
|
|
@@ -9853,8 +9879,8 @@ ${k}
|
|
|
9853
9879
|
const a = F.getValuesEditedAfter(n, r);
|
|
9854
9880
|
if (Object.keys(a).length === 0)
|
|
9855
9881
|
continue;
|
|
9856
|
-
const o = i[s],
|
|
9857
|
-
i = { ...i, [s]: ae(
|
|
9882
|
+
const o = i[s], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
9883
|
+
i = { ...i, [s]: ae(c, a) };
|
|
9858
9884
|
}
|
|
9859
9885
|
return i;
|
|
9860
9886
|
}
|
|
@@ -9888,7 +9914,7 @@ ${k}
|
|
|
9888
9914
|
row: s,
|
|
9889
9915
|
attributeName: r,
|
|
9890
9916
|
syncWhenUnchanged: "supply",
|
|
9891
|
-
apply: (
|
|
9917
|
+
apply: (c) => this.applyCopyToRowItem(s, c, t)
|
|
9892
9918
|
});
|
|
9893
9919
|
return;
|
|
9894
9920
|
}
|
|
@@ -10022,18 +10048,18 @@ ${k}
|
|
|
10022
10048
|
let i = this.options.fetchUrl;
|
|
10023
10049
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
10024
10050
|
n.headers || void 0
|
|
10025
|
-
), a = (n.method || "GET").toUpperCase(), o =
|
|
10026
|
-
if (n.method =
|
|
10051
|
+
), a = (n.method || "GET").toUpperCase(), o = l.runtime === "demo" && !Oe(a), c = o ? "GET" : a;
|
|
10052
|
+
if (n.method = c, Object.keys(t).length > 0 && Se(t)) {
|
|
10027
10053
|
const d = s.get("Content-Type") || "";
|
|
10028
|
-
|
|
10054
|
+
c !== "GET" && c !== "HEAD" && c !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Bt(t) && m.warn(
|
|
10029
10055
|
"Haori",
|
|
10030
|
-
`A File value nested under ${
|
|
10031
|
-
) :
|
|
10056
|
+
`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.`
|
|
10057
|
+
) : m.warn(
|
|
10032
10058
|
"Haori",
|
|
10033
|
-
`A File value cannot be sent without ${
|
|
10059
|
+
`A File value cannot be sent without ${l.prefix}fetch-content-type="multipart/form-data" and a body method such as POST.`
|
|
10034
10060
|
);
|
|
10035
10061
|
}
|
|
10036
|
-
if (
|
|
10062
|
+
if (c === "GET" || c === "HEAD" || c === "OPTIONS")
|
|
10037
10063
|
Object.keys(t).length > 0 && (i = pt(i, t));
|
|
10038
10064
|
else if (Object.keys(t).length > 0) {
|
|
10039
10065
|
const d = s.get("Content-Type") || "";
|
|
@@ -10062,7 +10088,7 @@ ${k}
|
|
|
10062
10088
|
payload: t,
|
|
10063
10089
|
hasUnresolvedReference: !1,
|
|
10064
10090
|
requestedMethod: a,
|
|
10065
|
-
effectiveMethod:
|
|
10091
|
+
effectiveMethod: c,
|
|
10066
10092
|
queryString: u,
|
|
10067
10093
|
transportMode: o ? "query-get" : "http",
|
|
10068
10094
|
signature: Ut(i, n)
|
|
@@ -10145,11 +10171,11 @@ ${k}
|
|
|
10145
10171
|
*/
|
|
10146
10172
|
getRowFragment() {
|
|
10147
10173
|
if (!this.options.targetFragment)
|
|
10148
|
-
return
|
|
10174
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
10149
10175
|
const e = this.options.targetFragment.closestByAttribute(
|
|
10150
|
-
`${
|
|
10176
|
+
`${l.prefix}row`
|
|
10151
10177
|
);
|
|
10152
|
-
return e || (
|
|
10178
|
+
return e || (m.error("Haori", "Row fragment not found."), null);
|
|
10153
10179
|
}
|
|
10154
10180
|
/**
|
|
10155
10181
|
* 行操作の対象となる `data-each` コンテナを解決します。
|
|
@@ -10165,20 +10191,20 @@ ${k}
|
|
|
10165
10191
|
resolveRowContainer(e) {
|
|
10166
10192
|
const t = this.options.targetFragment;
|
|
10167
10193
|
if (!t)
|
|
10168
|
-
return
|
|
10194
|
+
return m.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
10169
10195
|
const r = b.attrName(this.eventType, e), i = z.read(t, r);
|
|
10170
10196
|
if (i !== null && i.trim() !== "") {
|
|
10171
10197
|
const s = z.query(i, r, document);
|
|
10172
10198
|
if (s === null)
|
|
10173
|
-
return
|
|
10199
|
+
return m.error(
|
|
10174
10200
|
"Haori",
|
|
10175
10201
|
`Row container not found: ${i} (${r})`
|
|
10176
10202
|
), null;
|
|
10177
10203
|
const a = x.get(s);
|
|
10178
|
-
return a instanceof I ? a.hasAttribute(`${
|
|
10204
|
+
return a instanceof I ? a.hasAttribute(`${l.prefix}each`) ? a : (m.error(
|
|
10179
10205
|
"Haori",
|
|
10180
|
-
`Row container must have ${
|
|
10181
|
-
), null) : (
|
|
10206
|
+
`Row container must have ${l.prefix}each: ${i} (${r})`
|
|
10207
|
+
), null) : (m.error(
|
|
10182
10208
|
"Haori",
|
|
10183
10209
|
`Row container is not initialized: ${i} (${r})`
|
|
10184
10210
|
), null);
|
|
@@ -10196,48 +10222,56 @@ ${k}
|
|
|
10196
10222
|
* 書き戻し先を宣言している場合は、`data-each` の式ではなくその宣言を解決します。
|
|
10197
10223
|
*
|
|
10198
10224
|
* @param container `data-each` コンテナのフラグメント
|
|
10225
|
+
* @param quiet 解決に失敗した理由をログへ出さないかどうか。入れ子の解決から
|
|
10226
|
+
* 呼ぶときに指定します(呼び出し元が構成全体を指す 1 本のログを出すため、
|
|
10227
|
+
* ここで出すと祖先の事情だけを述べた紛らわしいログが重なります)
|
|
10199
10228
|
* @returns 所有者・所有者データ・配列・経路と、表示位置と配列の位置が一致しない
|
|
10200
10229
|
* (`data-each-array` による宣言)かどうか。解決できない場合は null
|
|
10201
10230
|
*/
|
|
10202
|
-
static resolveEachArray(e) {
|
|
10203
|
-
const
|
|
10204
|
-
if (
|
|
10205
|
-
return
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10231
|
+
static resolveEachArray(e, t = !1) {
|
|
10232
|
+
const r = e.getRawAttribute(`${l.prefix}each`);
|
|
10233
|
+
if (r === null)
|
|
10234
|
+
return t || m.error(
|
|
10235
|
+
"Haori",
|
|
10236
|
+
`Row container has no ${l.prefix}each expression.`
|
|
10237
|
+
), null;
|
|
10238
|
+
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(".");
|
|
10239
|
+
if (!(o.length > 0 && o.every((v) => /^[A-Za-z_$][\w$]*$/.test(v))))
|
|
10240
|
+
return t || m.error(
|
|
10209
10241
|
"Haori",
|
|
10210
|
-
`Row operations require a plain identifier path for ${
|
|
10242
|
+
`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
10243
|
), null;
|
|
10212
|
-
if (
|
|
10213
|
-
return
|
|
10244
|
+
if (n && e.getRawAttribute(`${l.prefix}each-key`) === null)
|
|
10245
|
+
return t || m.error(
|
|
10214
10246
|
"Haori",
|
|
10215
|
-
`${
|
|
10247
|
+
`${l.prefix}each-array requires ${l.prefix}each-key (${l.prefix}each-array="${a}").`
|
|
10216
10248
|
), null;
|
|
10217
|
-
const
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10249
|
+
const u = b.resolveRowScopeBase(e, o[0]);
|
|
10250
|
+
if (u === "unresolvable")
|
|
10251
|
+
return null;
|
|
10252
|
+
let d, p, g;
|
|
10253
|
+
if (u)
|
|
10254
|
+
d = u.owner, p = u.ownerData, g = [...u.path, ...o.slice(1)];
|
|
10221
10255
|
else {
|
|
10222
|
-
for (
|
|
10223
|
-
const
|
|
10224
|
-
if (
|
|
10225
|
-
|
|
10256
|
+
for (d = e, p = null; d; ) {
|
|
10257
|
+
const v = d.getRawBindingData();
|
|
10258
|
+
if (v && o[0] in v && !b.isRowScopeKey(d, o[0])) {
|
|
10259
|
+
p = v;
|
|
10226
10260
|
break;
|
|
10227
10261
|
}
|
|
10228
|
-
|
|
10262
|
+
d = d.getParent();
|
|
10229
10263
|
}
|
|
10230
|
-
|
|
10264
|
+
g = o;
|
|
10231
10265
|
}
|
|
10232
|
-
if (!
|
|
10233
|
-
return
|
|
10266
|
+
if (!d || !p)
|
|
10267
|
+
return t || m.error(
|
|
10234
10268
|
"Haori",
|
|
10235
|
-
`Binding data owner not found for ${
|
|
10269
|
+
`Binding data owner not found for ${s}="${a}".`
|
|
10236
10270
|
), null;
|
|
10237
|
-
const
|
|
10238
|
-
return Array.isArray(
|
|
10271
|
+
const E = b.readPathValue(p, g);
|
|
10272
|
+
return Array.isArray(E) ? { owner: d, ownerData: p, array: E, path: g, mapped: n } : (t || m.error(
|
|
10239
10273
|
"Haori",
|
|
10240
|
-
`${
|
|
10274
|
+
`${s}="${a}" does not resolve to an array.`
|
|
10241
10275
|
), null);
|
|
10242
10276
|
}
|
|
10243
10277
|
/**
|
|
@@ -10251,26 +10285,36 @@ ${k}
|
|
|
10251
10285
|
*
|
|
10252
10286
|
* @param container `data-each` コンテナのフラグメント
|
|
10253
10287
|
* @param rootName 経路の根の識別子
|
|
10254
|
-
* @returns 所有者・所有者データ・行までの経路。行スコープ名でない場合は null
|
|
10288
|
+
* @returns 所有者・所有者データ・行までの経路。行スコープ名でない場合は null。
|
|
10289
|
+
* 行スコープ名だが外側を書き戻し先として解決できない場合は `'unresolvable'`
|
|
10290
|
+
* (呼び出し元は祖先の探索へ進まずに打ち切ります。祖先には行スコープ名と
|
|
10291
|
+
* 同名のキーが無いため、進めても実態と違う理由のログになります)
|
|
10255
10292
|
*/
|
|
10256
10293
|
static resolveRowScopeBase(e, t) {
|
|
10257
10294
|
let r = e;
|
|
10258
10295
|
for (; r; ) {
|
|
10259
|
-
const i = r.closestByAttribute(`${
|
|
10296
|
+
const i = r.closestByAttribute(`${l.prefix}row`);
|
|
10260
10297
|
if (!i)
|
|
10261
10298
|
return null;
|
|
10262
10299
|
const n = i.getParent();
|
|
10263
10300
|
if (!n)
|
|
10264
10301
|
return null;
|
|
10265
|
-
if (n.getAttribute(`${
|
|
10266
|
-
const s = b.resolveEachArray(n);
|
|
10302
|
+
if (n.getAttribute(`${l.prefix}each-arg`) === t) {
|
|
10303
|
+
const s = b.resolveEachArray(n, !0);
|
|
10267
10304
|
if (!s)
|
|
10268
|
-
return
|
|
10305
|
+
return m.error(
|
|
10306
|
+
"Haori",
|
|
10307
|
+
`Row operations cannot resolve the write-back array for ${l.prefix}each="${e.getRawAttribute(
|
|
10308
|
+
`${l.prefix}each`
|
|
10309
|
+
)}": the ancestor container that supplies "${t}" (${l.prefix}each="${n.getRawAttribute(
|
|
10310
|
+
`${l.prefix}each`
|
|
10311
|
+
)}") 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.`
|
|
10312
|
+
), "unresolvable";
|
|
10269
10313
|
const a = b.resolveRowIndex(
|
|
10270
10314
|
n,
|
|
10271
10315
|
i,
|
|
10272
10316
|
s.array,
|
|
10273
|
-
`${
|
|
10317
|
+
`${l.prefix}each="${n.getRawAttribute(`${l.prefix}each`)}"`
|
|
10274
10318
|
);
|
|
10275
10319
|
return a === null ? null : {
|
|
10276
10320
|
owner: s.owner,
|
|
@@ -10294,10 +10338,10 @@ ${k}
|
|
|
10294
10338
|
* @returns 行データ由来なら true
|
|
10295
10339
|
*/
|
|
10296
10340
|
static isRowScopeKey(e, t) {
|
|
10297
|
-
if (!e.hasAttribute(`${
|
|
10341
|
+
if (!e.hasAttribute(`${l.prefix}row`))
|
|
10298
10342
|
return !1;
|
|
10299
10343
|
const r = e.getParent();
|
|
10300
|
-
return r ? r.getAttribute(`${
|
|
10344
|
+
return r ? r.getAttribute(`${l.prefix}each-arg`) === t || r.getAttribute(`${l.prefix}each-index`) === t : !1;
|
|
10301
10345
|
}
|
|
10302
10346
|
/**
|
|
10303
10347
|
* 経路をたどって値を読み出します。
|
|
@@ -10334,8 +10378,8 @@ ${k}
|
|
|
10334
10378
|
const i = { ...e };
|
|
10335
10379
|
let n = i;
|
|
10336
10380
|
for (let s = 0; s < t.length - 1; s += 1) {
|
|
10337
|
-
const a = t[s], o = n[a],
|
|
10338
|
-
n[a] =
|
|
10381
|
+
const a = t[s], o = n[a], c = Array.isArray(o) ? o.slice() : { ...o };
|
|
10382
|
+
n[a] = c, n = c;
|
|
10339
10383
|
}
|
|
10340
10384
|
return n[t[t.length - 1]] = r, i;
|
|
10341
10385
|
}
|
|
@@ -10349,7 +10393,7 @@ ${k}
|
|
|
10349
10393
|
*/
|
|
10350
10394
|
static getRowFragments(e) {
|
|
10351
10395
|
return e.getChildElementFragments().filter(
|
|
10352
|
-
(t) => !t.hasAttribute(`${
|
|
10396
|
+
(t) => !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
10353
10397
|
);
|
|
10354
10398
|
}
|
|
10355
10399
|
/**
|
|
@@ -10369,12 +10413,12 @@ ${k}
|
|
|
10369
10413
|
if (!r || !r.has(e))
|
|
10370
10414
|
return { kind: "plain" };
|
|
10371
10415
|
const i = r.get(e) ?? null;
|
|
10372
|
-
return i === null ? (
|
|
10416
|
+
return i === null ? (m.warn(
|
|
10373
10417
|
"Haori",
|
|
10374
|
-
`Target is not a row of the ${
|
|
10375
|
-
), { kind: "skip" }) : b.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (
|
|
10418
|
+
`Target is not a row of the ${l.prefix}each container (${t}).`
|
|
10419
|
+
), { kind: "skip" }) : b.getRowFragments(i).includes(e) ? { kind: "row", container: i } : (m.warn(
|
|
10376
10420
|
"Haori",
|
|
10377
|
-
`The target row is no longer in the ${
|
|
10421
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${t}).`
|
|
10378
10422
|
), { kind: "skip" });
|
|
10379
10423
|
}
|
|
10380
10424
|
/**
|
|
@@ -10407,7 +10451,7 @@ ${k}
|
|
|
10407
10451
|
continue;
|
|
10408
10452
|
const p = a[d];
|
|
10409
10453
|
if (p === null || typeof p != "object" || Array.isArray(p)) {
|
|
10410
|
-
|
|
10454
|
+
m.warn(
|
|
10411
10455
|
"Haori",
|
|
10412
10456
|
`Row data is not an object; the write was skipped (${u.attributeName}).`
|
|
10413
10457
|
);
|
|
@@ -10428,7 +10472,7 @@ ${k}
|
|
|
10428
10472
|
}
|
|
10429
10473
|
if (!o)
|
|
10430
10474
|
return;
|
|
10431
|
-
const
|
|
10475
|
+
const c = B.setBindingData(
|
|
10432
10476
|
s.owner.getTarget(),
|
|
10433
10477
|
b.withPathValue(s.ownerData, s.path, a),
|
|
10434
10478
|
{
|
|
@@ -10445,12 +10489,12 @@ ${k}
|
|
|
10445
10489
|
}
|
|
10446
10490
|
);
|
|
10447
10491
|
if (B.isEachUpdateRunning(n)) {
|
|
10448
|
-
|
|
10449
|
-
|
|
10492
|
+
c.catch((u) => {
|
|
10493
|
+
m.error("Haori", "Failed to write row data.", u);
|
|
10450
10494
|
});
|
|
10451
10495
|
return;
|
|
10452
10496
|
}
|
|
10453
|
-
r.push(
|
|
10497
|
+
r.push(c);
|
|
10454
10498
|
}), Promise.all(r).then(() => {
|
|
10455
10499
|
});
|
|
10456
10500
|
}
|
|
@@ -10532,27 +10576,27 @@ ${k}
|
|
|
10532
10576
|
static resolveRowIndex(e, t, r, i) {
|
|
10533
10577
|
const n = b.getRowFragments(e), s = n.indexOf(t);
|
|
10534
10578
|
if (s === -1)
|
|
10535
|
-
return
|
|
10579
|
+
return m.warn(
|
|
10536
10580
|
"Haori",
|
|
10537
|
-
`The target row is no longer in the ${
|
|
10581
|
+
`The target row is no longer in the ${l.prefix}each container; the write was skipped (${i}).`
|
|
10538
10582
|
), null;
|
|
10539
|
-
const a = e.getAttribute(`${
|
|
10583
|
+
const a = e.getAttribute(`${l.prefix}each-key`), o = t.getListKey();
|
|
10540
10584
|
if (a && o !== null) {
|
|
10541
|
-
const
|
|
10585
|
+
const c = [];
|
|
10542
10586
|
r.forEach((p, g) => {
|
|
10543
10587
|
B.createListKey(
|
|
10544
10588
|
p,
|
|
10545
10589
|
String(a),
|
|
10546
10590
|
g
|
|
10547
|
-
) === o &&
|
|
10591
|
+
) === o && c.push(g);
|
|
10548
10592
|
});
|
|
10549
|
-
const u = n.slice(0, s).filter((p) => p.getListKey() === o).length, d =
|
|
10550
|
-
return d === -1 ? (
|
|
10593
|
+
const u = n.slice(0, s).filter((p) => p.getListKey() === o).length, d = c[u] ?? -1;
|
|
10594
|
+
return d === -1 ? (m.warn(
|
|
10551
10595
|
"Haori",
|
|
10552
10596
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
10553
10597
|
), null) : d;
|
|
10554
10598
|
}
|
|
10555
|
-
return s >= r.length ? (
|
|
10599
|
+
return s >= r.length ? (m.warn(
|
|
10556
10600
|
"Haori",
|
|
10557
10601
|
`The target row index is out of range; the write was skipped (${i}).`
|
|
10558
10602
|
), null) : s;
|
|
@@ -10635,20 +10679,20 @@ ${k}
|
|
|
10635
10679
|
const i = b.resolveEachArray(r);
|
|
10636
10680
|
if (!i)
|
|
10637
10681
|
return Promise.reject(new Error("Row array not resolved."));
|
|
10638
|
-
const n = this.options.targetFragment, s = n ? n.closestByAttribute(`${
|
|
10682
|
+
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
10683
|
r,
|
|
10640
10684
|
a[g],
|
|
10641
10685
|
i.array,
|
|
10642
10686
|
b.attrName(this.eventType, e)
|
|
10643
|
-
) : g, u = o >= 0 ?
|
|
10687
|
+
) : g, u = o >= 0 ? c(o) : i.mapped ? i.array.length - 1 : o;
|
|
10644
10688
|
if (u === null)
|
|
10645
10689
|
return Promise.resolve();
|
|
10646
10690
|
const d = i.array.slice();
|
|
10647
10691
|
if (!t(
|
|
10648
10692
|
d,
|
|
10649
10693
|
u,
|
|
10650
|
-
() =>
|
|
10651
|
-
() =>
|
|
10694
|
+
() => c(o - 1),
|
|
10695
|
+
() => c(o + 1)
|
|
10652
10696
|
))
|
|
10653
10697
|
return Promise.resolve();
|
|
10654
10698
|
const p = /* @__PURE__ */ new Map();
|
|
@@ -10740,24 +10784,24 @@ class Ht {
|
|
|
10740
10784
|
try {
|
|
10741
10785
|
r = await fetch(e, t);
|
|
10742
10786
|
} catch (n) {
|
|
10743
|
-
throw
|
|
10787
|
+
throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
|
|
10744
10788
|
}
|
|
10745
10789
|
if (!r.ok) {
|
|
10746
10790
|
ft(r.status);
|
|
10747
10791
|
const n = `${r.status} ${r.statusText}`;
|
|
10748
|
-
throw
|
|
10792
|
+
throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
|
|
10749
10793
|
}
|
|
10750
10794
|
let i;
|
|
10751
10795
|
try {
|
|
10752
10796
|
i = await r.text();
|
|
10753
10797
|
} catch (n) {
|
|
10754
|
-
throw
|
|
10798
|
+
throw m.error("[Haori]", "Failed to read response text:", e, n), new Error(`Failed to read response from: ${e}`);
|
|
10755
10799
|
}
|
|
10756
10800
|
try {
|
|
10757
10801
|
const s = new DOMParser().parseFromString(i, "text/html");
|
|
10758
|
-
return s && s.body ? s.body.innerHTML : (
|
|
10802
|
+
return s && s.body ? s.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), i);
|
|
10759
10803
|
} catch (n) {
|
|
10760
|
-
return
|
|
10804
|
+
return m.error("[Haori]", "Failed to parse imported HTML:", e, n), i;
|
|
10761
10805
|
}
|
|
10762
10806
|
}
|
|
10763
10807
|
}
|
|
@@ -10770,7 +10814,7 @@ const f = class f {
|
|
|
10770
10814
|
*/
|
|
10771
10815
|
static isDeferredAttributeName(e) {
|
|
10772
10816
|
return f.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
10773
|
-
(t) => e === `${
|
|
10817
|
+
(t) => e === `${l.prefix}${t}`
|
|
10774
10818
|
);
|
|
10775
10819
|
}
|
|
10776
10820
|
/**
|
|
@@ -10781,7 +10825,7 @@ const f = class f {
|
|
|
10781
10825
|
*/
|
|
10782
10826
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
10783
10827
|
return f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
10784
|
-
(t) => e === `${
|
|
10828
|
+
(t) => e === `${l.prefix}${t}`
|
|
10785
10829
|
);
|
|
10786
10830
|
}
|
|
10787
10831
|
/**
|
|
@@ -10801,7 +10845,7 @@ const f = class f {
|
|
|
10801
10845
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
10802
10846
|
*/
|
|
10803
10847
|
static getAliasedAttributeName(e) {
|
|
10804
|
-
const t = `${
|
|
10848
|
+
const t = `${l.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
10805
10849
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
10806
10850
|
}
|
|
10807
10851
|
/**
|
|
@@ -10814,7 +10858,7 @@ const f = class f {
|
|
|
10814
10858
|
static isAliasedAttributeReflection(e, t) {
|
|
10815
10859
|
const r = x.get(e);
|
|
10816
10860
|
return r instanceof I ? r.hasAttribute(
|
|
10817
|
-
`${
|
|
10861
|
+
`${l.prefix}${f.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
10818
10862
|
) : !1;
|
|
10819
10863
|
}
|
|
10820
10864
|
/**
|
|
@@ -10915,7 +10959,7 @@ const f = class f {
|
|
|
10915
10959
|
if (t.has(e))
|
|
10916
10960
|
return Promise.resolve();
|
|
10917
10961
|
const r = [];
|
|
10918
|
-
return e.hasAttribute(`${
|
|
10962
|
+
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
10963
|
i instanceof I && r.push(
|
|
10920
10964
|
f.reevaluateReactiveSpecialAttributes(i, t)
|
|
10921
10965
|
);
|
|
@@ -10952,7 +10996,7 @@ const f = class f {
|
|
|
10952
10996
|
*/
|
|
10953
10997
|
static executeManagedImport(e) {
|
|
10954
10998
|
const t = e.getTarget(), r = f.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
10955
|
-
`${
|
|
10999
|
+
`${l.prefix}import`
|
|
10956
11000
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
10957
11001
|
if (r.running)
|
|
10958
11002
|
return n !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
|
|
@@ -10962,20 +11006,20 @@ const f = class f {
|
|
|
10962
11006
|
return Promise.resolve();
|
|
10963
11007
|
r.lastUrl = n, r.running = !0;
|
|
10964
11008
|
const s = performance.now();
|
|
10965
|
-
return t.setAttribute(`${
|
|
11009
|
+
return t.setAttribute(`${l.prefix}importing`, ""), U.importStart(t, n), Ht.load(n).then((a) => {
|
|
10966
11010
|
const o = new TextEncoder().encode(a).length;
|
|
10967
11011
|
return K.enqueue(() => {
|
|
10968
11012
|
t.innerHTML = a;
|
|
10969
11013
|
}).then(() => {
|
|
10970
|
-
t.removeAttribute(`${
|
|
10971
|
-
const
|
|
11014
|
+
t.removeAttribute(`${l.prefix}importing`), U.importEnd(t, n, o, s), f.adoptImportedChildren(e);
|
|
11015
|
+
const c = [];
|
|
10972
11016
|
return e.getChildren().forEach((u) => {
|
|
10973
|
-
u instanceof I ?
|
|
10974
|
-
}), Promise.all(
|
|
11017
|
+
u instanceof I ? c.push(f.scan(u.getTarget())) : u instanceof ee && c.push(f.evaluateText(u));
|
|
11018
|
+
}), Promise.all(c).then(() => {
|
|
10975
11019
|
});
|
|
10976
11020
|
});
|
|
10977
11021
|
}).catch((a) => {
|
|
10978
|
-
t.removeAttribute(`${
|
|
11022
|
+
t.removeAttribute(`${l.prefix}importing`), U.importError(t, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
|
|
10979
11023
|
}).finally(() => {
|
|
10980
11024
|
if (r.running = !1, r.rerunRequested)
|
|
10981
11025
|
return r.rerunRequested = !1, f.executeManagedImport(e);
|
|
@@ -11074,7 +11118,7 @@ const f = class f {
|
|
|
11074
11118
|
let t = Promise.resolve();
|
|
11075
11119
|
const r = /* @__PURE__ */ new Set();
|
|
11076
11120
|
for (const i of f.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
11077
|
-
const n =
|
|
11121
|
+
const n = l.prefix + i;
|
|
11078
11122
|
e.hasAttribute(n) && (t = t.then(
|
|
11079
11123
|
() => f.setAttribute(
|
|
11080
11124
|
e.getTarget(),
|
|
@@ -11092,7 +11136,7 @@ const f = class f {
|
|
|
11092
11136
|
));
|
|
11093
11137
|
}
|
|
11094
11138
|
for (const i of f.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
11095
|
-
const n =
|
|
11139
|
+
const n = l.prefix + i;
|
|
11096
11140
|
e.hasAttribute(n) && (t = t.then(
|
|
11097
11141
|
() => f.setAttribute(
|
|
11098
11142
|
e.getTarget(),
|
|
@@ -11111,8 +11155,8 @@ const f = class f {
|
|
|
11111
11155
|
* @returns 子孫初期化をスキップするなら true
|
|
11112
11156
|
*/
|
|
11113
11157
|
static shouldSkipChildInitialization(e, t) {
|
|
11114
|
-
const r = e.getAttribute(`${
|
|
11115
|
-
return e.hasAttribute(`${
|
|
11158
|
+
const r = e.getAttribute(`${l.prefix}if`);
|
|
11159
|
+
return e.hasAttribute(`${l.prefix}if`) && f.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${l.prefix}each`);
|
|
11116
11160
|
}
|
|
11117
11161
|
/**
|
|
11118
11162
|
* エレメントに属性を設定します。
|
|
@@ -11137,9 +11181,9 @@ const f = class f {
|
|
|
11137
11181
|
i
|
|
11138
11182
|
);
|
|
11139
11183
|
const o = [];
|
|
11140
|
-
let
|
|
11184
|
+
let c = null, u = null, d = null;
|
|
11141
11185
|
switch (t) {
|
|
11142
|
-
case `${
|
|
11186
|
+
case `${l.prefix}bind`: {
|
|
11143
11187
|
if (r !== null && i && s instanceof I && s.consumeSelfWrittenBind(r))
|
|
11144
11188
|
break;
|
|
11145
11189
|
const p = r === null ? {} : f.parseDataBind(r);
|
|
@@ -11160,54 +11204,54 @@ const f = class f {
|
|
|
11160
11204
|
r === null && s.clearBindingDataCache(), s.setBindingData(p);
|
|
11161
11205
|
break;
|
|
11162
11206
|
}
|
|
11163
|
-
case `${
|
|
11207
|
+
case `${l.prefix}derive`:
|
|
11164
11208
|
u = f.createDeriveInputSignature(
|
|
11165
11209
|
s,
|
|
11166
11210
|
r,
|
|
11167
|
-
s.getRawAttribute(`${
|
|
11168
|
-
),
|
|
11211
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
11212
|
+
), c = f.evaluateDerive(
|
|
11169
11213
|
s,
|
|
11170
11214
|
r,
|
|
11171
|
-
s.getRawAttribute(`${
|
|
11172
|
-
), o.push(
|
|
11215
|
+
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
11216
|
+
), o.push(c.then(() => {
|
|
11173
11217
|
}));
|
|
11174
11218
|
break;
|
|
11175
|
-
case `${
|
|
11219
|
+
case `${l.prefix}derive-name`:
|
|
11176
11220
|
u = f.createDeriveInputSignature(
|
|
11177
11221
|
s,
|
|
11178
|
-
s.getRawAttribute(`${
|
|
11222
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
11179
11223
|
r
|
|
11180
|
-
),
|
|
11224
|
+
), c = f.evaluateDerive(
|
|
11181
11225
|
s,
|
|
11182
|
-
s.getRawAttribute(`${
|
|
11226
|
+
s.getRawAttribute(`${l.prefix}derive`),
|
|
11183
11227
|
r
|
|
11184
|
-
), o.push(
|
|
11228
|
+
), o.push(c.then(() => {
|
|
11185
11229
|
}));
|
|
11186
11230
|
break;
|
|
11187
|
-
case `${
|
|
11231
|
+
case `${l.prefix}if`:
|
|
11188
11232
|
o.push(f.evaluateIf(s));
|
|
11189
11233
|
break;
|
|
11190
|
-
case `${
|
|
11234
|
+
case `${l.prefix}each`:
|
|
11191
11235
|
o.push(f.evaluateEach(s));
|
|
11192
11236
|
break;
|
|
11193
|
-
case `${
|
|
11237
|
+
case `${l.prefix}fetch`:
|
|
11194
11238
|
d = () => f.executeManagedFetch(s);
|
|
11195
11239
|
break;
|
|
11196
|
-
case `${
|
|
11240
|
+
case `${l.prefix}import`:
|
|
11197
11241
|
typeof r == "string" && (d = () => f.executeManagedImport(s));
|
|
11198
11242
|
break;
|
|
11199
|
-
case `${
|
|
11243
|
+
case `${l.prefix}store`:
|
|
11200
11244
|
r !== null && o.push(ve.restore(s));
|
|
11201
11245
|
break;
|
|
11202
|
-
case `${
|
|
11203
|
-
case `${
|
|
11246
|
+
case `${l.prefix}validity`:
|
|
11247
|
+
case `${l.prefix}validity-message`:
|
|
11204
11248
|
return r !== null && F.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
11205
11249
|
});
|
|
11206
|
-
case `${
|
|
11207
|
-
const p = s.getAttribute(`${
|
|
11208
|
-
p === null && s.hasAttribute(`${
|
|
11250
|
+
case `${l.prefix}url-param`: {
|
|
11251
|
+
const p = s.getAttribute(`${l.prefix}url-arg`), g = ht.readParams();
|
|
11252
|
+
p === null && s.hasAttribute(`${l.prefix}store`) && m.warn(
|
|
11209
11253
|
"Haori",
|
|
11210
|
-
`${
|
|
11254
|
+
`${l.prefix}url-param を ${l.prefix}url-arg なしで ${l.prefix}store と併用すると復元した値が消えます(${l.prefix}url-arg を指定してください)。`
|
|
11211
11255
|
);
|
|
11212
11256
|
const E = {
|
|
11213
11257
|
reentrant: !0,
|
|
@@ -11226,8 +11270,8 @@ const f = class f {
|
|
|
11226
11270
|
return r === null ? o.push(s.removeAttribute(t)) : o.push(s.setAttribute(t, r, i)), Promise.all(o).then(
|
|
11227
11271
|
() => d === null ? void 0 : d()
|
|
11228
11272
|
).then(() => {
|
|
11229
|
-
if (
|
|
11230
|
-
return s.setDeriveInputSignature(u),
|
|
11273
|
+
if (c !== null)
|
|
11274
|
+
return s.setDeriveInputSignature(u), c.then((p) => {
|
|
11231
11275
|
if (p)
|
|
11232
11276
|
return f.reevaluateChildren(s);
|
|
11233
11277
|
});
|
|
@@ -11261,20 +11305,20 @@ const f = class f {
|
|
|
11261
11305
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11262
11306
|
*/
|
|
11263
11307
|
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:
|
|
11308
|
+
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 = {
|
|
11309
|
+
sequence: c,
|
|
11266
11310
|
kind: o,
|
|
11267
11311
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11268
11312
|
}, d = o === "supply";
|
|
11269
|
-
d && i.markSupplyApplied(
|
|
11313
|
+
d && i.markSupplyApplied(c);
|
|
11270
11314
|
const p = I.currentSequence(), g = i.getRawBindingData();
|
|
11271
|
-
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i,
|
|
11315
|
+
d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i, c);
|
|
11272
11316
|
const E = a ? f.resolveByPathAuthority(i, g, t, u) : t;
|
|
11273
11317
|
i.setBindingData(E), a && (U.bindChange(e, g, E, "manual"), ve.mirror(i));
|
|
11274
11318
|
const v = () => {
|
|
11275
11319
|
i.markBindingWorkStart();
|
|
11276
11320
|
const D = i.getRawBindingData() ?? E;
|
|
11277
|
-
let M = a ? i.setAttribute(`${
|
|
11321
|
+
let M = a ? i.setAttribute(`${l.prefix}bind`, JSON.stringify(D)) : Promise.resolve();
|
|
11278
11322
|
return e.tagName === "FORM" && (M = M.then(() => {
|
|
11279
11323
|
if (i.wasResetAfter(p))
|
|
11280
11324
|
return;
|
|
@@ -11372,11 +11416,11 @@ const f = class f {
|
|
|
11372
11416
|
}
|
|
11373
11417
|
if (f.isSameBindingValue(t, r))
|
|
11374
11418
|
return r;
|
|
11375
|
-
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit",
|
|
11419
|
+
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit", c = {
|
|
11376
11420
|
sequence: a ?? i.sequence,
|
|
11377
11421
|
kind: o
|
|
11378
11422
|
};
|
|
11379
|
-
return e.canApplyPath(n,
|
|
11423
|
+
return e.canApplyPath(n, c) ? (e.markPathApplied(n, c), r) : t;
|
|
11380
11424
|
}
|
|
11381
11425
|
/**
|
|
11382
11426
|
* 配列を要素ごとの宛先として扱えるかを判定し、扱える場合は各要素のリストキーを
|
|
@@ -11397,19 +11441,19 @@ const f = class f {
|
|
|
11397
11441
|
if (!Array.isArray(t) || !Array.isArray(r) || t.length !== r.length || r.length === 0)
|
|
11398
11442
|
return null;
|
|
11399
11443
|
const n = r.some((o) => f.isPlainRecord(o)) ? f.resolveEachKeyArg(e, i) : null, s = t.map(
|
|
11400
|
-
(o,
|
|
11444
|
+
(o, c) => f.createListKey(
|
|
11401
11445
|
o,
|
|
11402
11446
|
n,
|
|
11403
|
-
|
|
11447
|
+
c
|
|
11404
11448
|
)
|
|
11405
11449
|
), a = r.map(
|
|
11406
|
-
(o,
|
|
11450
|
+
(o, c) => f.createListKey(
|
|
11407
11451
|
o,
|
|
11408
11452
|
n,
|
|
11409
|
-
|
|
11453
|
+
c
|
|
11410
11454
|
)
|
|
11411
11455
|
);
|
|
11412
|
-
return s.some((o,
|
|
11456
|
+
return s.some((o, c) => o !== a[c]) ? null : a;
|
|
11413
11457
|
}
|
|
11414
11458
|
/**
|
|
11415
11459
|
* 配列の経路に対応する `data-each-key` の指定を探します。
|
|
@@ -11425,13 +11469,13 @@ const f = class f {
|
|
|
11425
11469
|
* @returns リストキーに使うプロパティ名。宣言が無ければ null
|
|
11426
11470
|
*/
|
|
11427
11471
|
static resolveEachKeyArg(e, t) {
|
|
11428
|
-
const r = `${
|
|
11472
|
+
const r = `${l.prefix}each`, i = e.getTarget(), n = t.replace(/\[[^\]]*\]/g, ""), s = i.querySelectorAll(`[${r}]`);
|
|
11429
11473
|
for (const a of Array.from(s)) {
|
|
11430
11474
|
const o = f.resolveEachDeclarationPath(a, i);
|
|
11431
11475
|
if (o === null || o !== n)
|
|
11432
11476
|
continue;
|
|
11433
|
-
const
|
|
11434
|
-
return
|
|
11477
|
+
const c = a.getAttribute(`${r}-key`);
|
|
11478
|
+
return c === null ? null : c.trim();
|
|
11435
11479
|
}
|
|
11436
11480
|
return null;
|
|
11437
11481
|
}
|
|
@@ -11453,7 +11497,7 @@ const f = class f {
|
|
|
11453
11497
|
* @returns 絶対経路。式が空、または経路として扱えない場合は null
|
|
11454
11498
|
*/
|
|
11455
11499
|
static resolveEachDeclarationPath(e, t) {
|
|
11456
|
-
const r = `${
|
|
11500
|
+
const r = `${l.prefix}each`;
|
|
11457
11501
|
let i = e.getAttribute(r)?.trim() ?? "";
|
|
11458
11502
|
if (i === "")
|
|
11459
11503
|
return null;
|
|
@@ -11542,7 +11586,7 @@ const f = class f {
|
|
|
11542
11586
|
*/
|
|
11543
11587
|
static dumpScope(e) {
|
|
11544
11588
|
const t = f.collectScope(e);
|
|
11545
|
-
return j.isEnabled() &&
|
|
11589
|
+
return j.isEnabled() && m.info("[Haori]", "scope dump for", e, t), t;
|
|
11546
11590
|
}
|
|
11547
11591
|
/**
|
|
11548
11592
|
* スコープの解決結果と由来を収集します。
|
|
@@ -11558,14 +11602,14 @@ const f = class f {
|
|
|
11558
11602
|
const t = x.get(e);
|
|
11559
11603
|
if (!t)
|
|
11560
11604
|
return { resolved: {}, sources: {} };
|
|
11561
|
-
const r = t.getBindingData(), i = {}, n = (
|
|
11562
|
-
const u =
|
|
11605
|
+
const r = t.getBindingData(), i = {}, n = (c) => {
|
|
11606
|
+
const u = c.getTarget(), d = f.resolveElementId(u);
|
|
11563
11607
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
11564
|
-
}, s = (
|
|
11565
|
-
if (
|
|
11566
|
-
for (const g of Object.keys(
|
|
11608
|
+
}, s = (c, u, d, p) => {
|
|
11609
|
+
if (c)
|
|
11610
|
+
for (const g of Object.keys(c))
|
|
11567
11611
|
g in i || (i[g] = {
|
|
11568
|
-
value:
|
|
11612
|
+
value: c[g],
|
|
11569
11613
|
source: n(u),
|
|
11570
11614
|
kind: d,
|
|
11571
11615
|
depth: p
|
|
@@ -11587,7 +11631,7 @@ const f = class f {
|
|
|
11587
11631
|
try {
|
|
11588
11632
|
return JSON.parse(e);
|
|
11589
11633
|
} catch (t) {
|
|
11590
|
-
return
|
|
11634
|
+
return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
11591
11635
|
}
|
|
11592
11636
|
else {
|
|
11593
11637
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -11653,21 +11697,21 @@ const f = class f {
|
|
|
11653
11697
|
i.push(r.setValue(t));
|
|
11654
11698
|
const n = f.getFormFragment(r);
|
|
11655
11699
|
if (n) {
|
|
11656
|
-
const s = F.getValues(n), a = n.getAttribute(`${
|
|
11657
|
-
let
|
|
11700
|
+
const s = F.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`), o = n.getRawBindingData();
|
|
11701
|
+
let c;
|
|
11658
11702
|
if (a) {
|
|
11659
|
-
|
|
11703
|
+
c = { ...o ?? {} };
|
|
11660
11704
|
const u = String(a), d = F.resolveAncestorArgOwner(n, u);
|
|
11661
|
-
|
|
11662
|
-
(d ? d.value :
|
|
11705
|
+
c[u] = F.mergeCollectedValues(
|
|
11706
|
+
(d ? d.value : c[u]) ?? null,
|
|
11663
11707
|
s
|
|
11664
11708
|
);
|
|
11665
11709
|
} else
|
|
11666
|
-
|
|
11710
|
+
c = F.mergeCollectedValues(o, s);
|
|
11667
11711
|
i.push(
|
|
11668
11712
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
11669
11713
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
11670
|
-
f.setBindingData(n.getTarget(),
|
|
11714
|
+
f.setBindingData(n.getTarget(), c, {
|
|
11671
11715
|
kind: "nonSupply",
|
|
11672
11716
|
sequence: I.nextSequence()
|
|
11673
11717
|
})
|
|
@@ -11698,8 +11742,8 @@ const f = class f {
|
|
|
11698
11742
|
if (t.has(e))
|
|
11699
11743
|
return Promise.resolve();
|
|
11700
11744
|
let r = f.reevaluateInterpolatedAttributes(e);
|
|
11701
|
-
const i = e.hasAttribute(`${
|
|
11702
|
-
let
|
|
11745
|
+
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`);
|
|
11746
|
+
let c = !1, u = !1, d = null;
|
|
11703
11747
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
11704
11748
|
const p = f.createDeriveInputSignature(
|
|
11705
11749
|
e,
|
|
@@ -11728,12 +11772,12 @@ const f = class f {
|
|
|
11728
11772
|
d = f.createDescendantBindingSignature(
|
|
11729
11773
|
e,
|
|
11730
11774
|
"evaluateAll"
|
|
11731
|
-
), u = !0,
|
|
11775
|
+
), u = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d, f.logDerivedSubtreeProfileSnapshot(
|
|
11732
11776
|
e,
|
|
11733
|
-
|
|
11777
|
+
c ? "skip-hit" : "skip-miss"
|
|
11734
11778
|
);
|
|
11735
11779
|
})), r.then(() => {
|
|
11736
|
-
if (
|
|
11780
|
+
if (c)
|
|
11737
11781
|
return;
|
|
11738
11782
|
const p = [];
|
|
11739
11783
|
return e.getChildren().forEach((g) => {
|
|
@@ -11757,9 +11801,9 @@ const f = class f {
|
|
|
11757
11801
|
* @returns Promise (評価完了時に解決)
|
|
11758
11802
|
*/
|
|
11759
11803
|
static evaluateDerive(e, t = e.getRawAttribute(
|
|
11760
|
-
`${
|
|
11804
|
+
`${l.prefix}derive`
|
|
11761
11805
|
), r = e.getRawAttribute(
|
|
11762
|
-
`${
|
|
11806
|
+
`${l.prefix}derive-name`
|
|
11763
11807
|
)) {
|
|
11764
11808
|
const i = e.getRawDerivedBindingData(), n = typeof r == "string" ? r.trim() : "";
|
|
11765
11809
|
if (!t || n === "")
|
|
@@ -11808,11 +11852,11 @@ const f = class f {
|
|
|
11808
11852
|
* @return 戻り値はありません。
|
|
11809
11853
|
*/
|
|
11810
11854
|
static logFalsyIfDiagnostics(e) {
|
|
11811
|
-
const t = e.getRawAttribute(`${
|
|
11855
|
+
const t = e.getRawAttribute(`${l.prefix}if`);
|
|
11812
11856
|
if (typeof t != "string" || t.indexOf("{{") >= 0)
|
|
11813
11857
|
return;
|
|
11814
11858
|
if (Q.hasCompileFailure(t)) {
|
|
11815
|
-
|
|
11859
|
+
m.warn(
|
|
11816
11860
|
"[Haori]",
|
|
11817
11861
|
"data-if is hidden because the expression could not be compiled (see the preceding compile error):",
|
|
11818
11862
|
t
|
|
@@ -11822,13 +11866,13 @@ const f = class f {
|
|
|
11822
11866
|
const { sources: r } = f.collectScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
11823
11867
|
let s = 0;
|
|
11824
11868
|
n.forEach((o) => {
|
|
11825
|
-
const
|
|
11826
|
-
s =
|
|
11869
|
+
const c = t.indexOf(o, s);
|
|
11870
|
+
s = c + o.length, !(c > 0 && t[c - 1] === ".") && i.add(o);
|
|
11827
11871
|
});
|
|
11828
11872
|
const a = {};
|
|
11829
11873
|
i.forEach((o) => {
|
|
11830
11874
|
o in r && (a[o] = r[o]);
|
|
11831
|
-
}),
|
|
11875
|
+
}), m.info(
|
|
11832
11876
|
"[Haori]",
|
|
11833
11877
|
"data-if is falsy (hidden):",
|
|
11834
11878
|
t,
|
|
@@ -11845,7 +11889,7 @@ const f = class f {
|
|
|
11845
11889
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
11846
11890
|
*/
|
|
11847
11891
|
static evaluateIf(e) {
|
|
11848
|
-
const t = [], r = e.getAttribute(`${
|
|
11892
|
+
const t = [], r = e.getAttribute(`${l.prefix}if`);
|
|
11849
11893
|
if (f.isHiddenIfCondition(r))
|
|
11850
11894
|
j.isEnabled() && e.isVisible() && f.logFalsyIfDiagnostics(e), t.push(
|
|
11851
11895
|
e.hide().then(() => {
|
|
@@ -11879,9 +11923,9 @@ const f = class f {
|
|
|
11879
11923
|
* @return 戻り値はありません。
|
|
11880
11924
|
*/
|
|
11881
11925
|
static triggerLoadOnShow(e) {
|
|
11882
|
-
const t = `${
|
|
11926
|
+
const t = `${l.prefix}load-`;
|
|
11883
11927
|
e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new re(e, "load").run().catch((i) => {
|
|
11884
|
-
|
|
11928
|
+
m.error("[Haori]", "data-load procedure error (on show):", i);
|
|
11885
11929
|
});
|
|
11886
11930
|
}
|
|
11887
11931
|
/**
|
|
@@ -11924,7 +11968,7 @@ const f = class f {
|
|
|
11924
11968
|
* @returns 公開される名前。指定が無い場合は null
|
|
11925
11969
|
*/
|
|
11926
11970
|
static getRowScopeName(e, t) {
|
|
11927
|
-
const r = e.getAttribute(`${
|
|
11971
|
+
const r = e.getAttribute(`${l.prefix}${t}`);
|
|
11928
11972
|
return typeof r != "string" || r === "" ? null : r;
|
|
11929
11973
|
}
|
|
11930
11974
|
/**
|
|
@@ -11951,14 +11995,14 @@ const f = class f {
|
|
|
11951
11995
|
* @return すべての差分更新が安定するまでの完了 Promise
|
|
11952
11996
|
*/
|
|
11953
11997
|
static runEachUpdateLoop(e, t) {
|
|
11954
|
-
t.running = !0, e.getTarget().removeAttribute(`${
|
|
11998
|
+
t.running = !0, e.getTarget().removeAttribute(`${l.prefix}each-done`);
|
|
11955
11999
|
const r = (async () => {
|
|
11956
12000
|
try {
|
|
11957
12001
|
do
|
|
11958
12002
|
t.rerunRequested = !1, await f.performEachUpdate(e);
|
|
11959
12003
|
while (t.rerunRequested);
|
|
11960
12004
|
const i = e.getTarget();
|
|
11961
|
-
i.setAttribute(`${
|
|
12005
|
+
i.setAttribute(`${l.prefix}each-done`, ""), ie.refreshSubtree(i), f.runEachRenderedScript(i);
|
|
11962
12006
|
} finally {
|
|
11963
12007
|
t.running = !1, t.settled = null;
|
|
11964
12008
|
}
|
|
@@ -11977,7 +12021,7 @@ const f = class f {
|
|
|
11977
12021
|
* @param target data-each コンテナ要素
|
|
11978
12022
|
*/
|
|
11979
12023
|
static runEachRenderedScript(e) {
|
|
11980
|
-
const t = `${
|
|
12024
|
+
const t = `${l.prefix}each-rendered-run`;
|
|
11981
12025
|
if (!e.hasAttribute(t))
|
|
11982
12026
|
return;
|
|
11983
12027
|
const r = String(e.getAttribute(t) ?? "");
|
|
@@ -11994,14 +12038,14 @@ ${r}
|
|
|
11994
12038
|
${r}
|
|
11995
12039
|
`);
|
|
11996
12040
|
} catch (n) {
|
|
11997
|
-
|
|
12041
|
+
m.error("[Haori]", `Invalid each-rendered-run script: ${n}`);
|
|
11998
12042
|
}
|
|
11999
12043
|
}
|
|
12000
12044
|
if (i)
|
|
12001
12045
|
try {
|
|
12002
12046
|
i.call(e);
|
|
12003
12047
|
} catch (n) {
|
|
12004
|
-
|
|
12048
|
+
m.error("[Haori]", `each-rendered-run execution error: ${n}`);
|
|
12005
12049
|
}
|
|
12006
12050
|
}
|
|
12007
12051
|
/**
|
|
@@ -12027,12 +12071,12 @@ ${r}
|
|
|
12027
12071
|
* @param fragment data-each コンテナのフラグメント
|
|
12028
12072
|
*/
|
|
12029
12073
|
static runEachRenderedChange(e) {
|
|
12030
|
-
const t = `${
|
|
12074
|
+
const t = `${l.prefix}each-rendered-change`, r = e.getTarget();
|
|
12031
12075
|
if (!r.hasAttribute(t))
|
|
12032
12076
|
return;
|
|
12033
12077
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
12034
12078
|
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),
|
|
12079
|
+
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
12080
|
"[Haori]",
|
|
12037
12081
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
12038
12082
|
))), f.countEachRenderedRows(e) !== 0) {
|
|
@@ -12044,7 +12088,7 @@ ${r}
|
|
|
12044
12088
|
try {
|
|
12045
12089
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
12046
12090
|
} catch (s) {
|
|
12047
|
-
|
|
12091
|
+
m.error("[Haori]", `each-rendered-change dispatch error: ${s}`);
|
|
12048
12092
|
}
|
|
12049
12093
|
}
|
|
12050
12094
|
}
|
|
@@ -12061,7 +12105,7 @@ ${r}
|
|
|
12061
12105
|
static countEachRenderedRows(e) {
|
|
12062
12106
|
let t = 0;
|
|
12063
12107
|
for (const r of e.getChildElementFragments())
|
|
12064
|
-
r.getTarget().hasAttribute(`${
|
|
12108
|
+
r.getTarget().hasAttribute(`${l.prefix}row`) && (t += 1);
|
|
12065
12109
|
return t;
|
|
12066
12110
|
}
|
|
12067
12111
|
/**
|
|
@@ -12075,7 +12119,7 @@ ${r}
|
|
|
12075
12119
|
if (t === null)
|
|
12076
12120
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
12077
12121
|
let r = e.getTemplate();
|
|
12078
|
-
const i = e.getAttribute(`${
|
|
12122
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = f.createBindingSignature({
|
|
12079
12123
|
key: i ? String(i) : null,
|
|
12080
12124
|
items: t
|
|
12081
12125
|
});
|
|
@@ -12083,23 +12127,23 @@ ${r}
|
|
|
12083
12127
|
let s = !1;
|
|
12084
12128
|
if (e.getChildren().forEach((a) => {
|
|
12085
12129
|
if (!s && a instanceof I) {
|
|
12086
|
-
if (a.hasAttribute(`${
|
|
12130
|
+
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
12087
12131
|
return;
|
|
12088
12132
|
r = a.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
12089
12133
|
const o = a.getTarget();
|
|
12090
12134
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
12091
12135
|
}
|
|
12092
|
-
}), !s) {
|
|
12136
|
+
}), s && f.warnExtraEachChildren(e), !s) {
|
|
12093
12137
|
const a = e.getTarget();
|
|
12094
12138
|
Array.from(a.children).filter(
|
|
12095
|
-
(
|
|
12096
|
-
).forEach((
|
|
12139
|
+
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
12140
|
+
).forEach((c) => {
|
|
12097
12141
|
if (!s) {
|
|
12098
|
-
const d = x.get(
|
|
12142
|
+
const d = x.get(c);
|
|
12099
12143
|
d instanceof I && (r = d.clone(), f.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
12100
12144
|
}
|
|
12101
|
-
const u = x.get(
|
|
12102
|
-
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)),
|
|
12145
|
+
const u = x.get(c);
|
|
12146
|
+
u instanceof I && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), c.parentNode && c.parentNode.removeChild(c);
|
|
12103
12147
|
});
|
|
12104
12148
|
}
|
|
12105
12149
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -12123,7 +12167,7 @@ ${r}
|
|
|
12123
12167
|
if (f.isRowLocalEachTemplate(e))
|
|
12124
12168
|
return Promise.resolve();
|
|
12125
12169
|
const t = e.getChildElementFragments().filter(
|
|
12126
|
-
(r) => !r.hasAttribute(`${
|
|
12170
|
+
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12127
12171
|
);
|
|
12128
12172
|
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) => f.evaluateAll(r))).then(
|
|
12129
12173
|
() => {
|
|
@@ -12137,8 +12181,8 @@ ${r}
|
|
|
12137
12181
|
* @returns 配列。無効な場合は null
|
|
12138
12182
|
*/
|
|
12139
12183
|
static resolveEachItems(e) {
|
|
12140
|
-
const t = e.getAttributeEvaluation(`${
|
|
12141
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
12184
|
+
const t = e.getAttributeEvaluation(`${l.prefix}each`), r = t?.value;
|
|
12185
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
|
|
12142
12186
|
}
|
|
12143
12187
|
/**
|
|
12144
12188
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -12148,15 +12192,15 @@ ${r}
|
|
|
12148
12192
|
* @returns 省略可能なら true
|
|
12149
12193
|
*/
|
|
12150
12194
|
static canSkipUnchangedNestedEach(e) {
|
|
12151
|
-
if (!e.hasAttribute(`${
|
|
12195
|
+
if (!e.hasAttribute(`${l.prefix}each`) || e.getEachInputSignature() === null)
|
|
12152
12196
|
return !1;
|
|
12153
12197
|
const t = e.getParent();
|
|
12154
|
-
if (t?.closestByAttribute(`${
|
|
12198
|
+
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
12199
|
return !1;
|
|
12156
12200
|
const r = f.resolveEachItems(e);
|
|
12157
12201
|
if (r === null)
|
|
12158
12202
|
return !1;
|
|
12159
|
-
const i = e.getAttribute(`${
|
|
12203
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = f.createBindingSignature({
|
|
12160
12204
|
key: i ? String(i) : null,
|
|
12161
12205
|
items: r
|
|
12162
12206
|
});
|
|
@@ -12185,10 +12229,10 @@ ${r}
|
|
|
12185
12229
|
const t = e.getRowLocalTemplate();
|
|
12186
12230
|
if (t !== null)
|
|
12187
12231
|
return t;
|
|
12188
|
-
const r = e.getTemplate(), i = e.getAttribute(`${
|
|
12232
|
+
const r = e.getTemplate(), i = e.getAttribute(`${l.prefix}each-arg`);
|
|
12189
12233
|
if (r === null || !i)
|
|
12190
12234
|
return e.setRowLocalTemplate(!1), !1;
|
|
12191
|
-
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${
|
|
12235
|
+
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${l.prefix}each-index`);
|
|
12192
12236
|
s && n.add(String(s));
|
|
12193
12237
|
const a = f.isRowLocalSubtree(r, n);
|
|
12194
12238
|
return e.setRowLocalTemplate(a), a;
|
|
@@ -12211,9 +12255,9 @@ ${r}
|
|
|
12211
12255
|
return !1;
|
|
12212
12256
|
continue;
|
|
12213
12257
|
}
|
|
12214
|
-
if (!i.startsWith(
|
|
12258
|
+
if (!i.startsWith(l.prefix))
|
|
12215
12259
|
continue;
|
|
12216
|
-
const a = i.slice(
|
|
12260
|
+
const a = i.slice(l.prefix.length);
|
|
12217
12261
|
if (f.ROW_LOCAL_EXPRESSION_ATTRIBUTES.has(a)) {
|
|
12218
12262
|
if (!f.areExpressionsRowLocal([s], t))
|
|
12219
12263
|
return !1;
|
|
@@ -12226,13 +12270,13 @@ ${r}
|
|
|
12226
12270
|
return !1;
|
|
12227
12271
|
}
|
|
12228
12272
|
let r = t;
|
|
12229
|
-
if (e.hasAttribute(`${
|
|
12230
|
-
const i = e.getRawAttribute(`${
|
|
12273
|
+
if (e.hasAttribute(`${l.prefix}each`)) {
|
|
12274
|
+
const i = e.getRawAttribute(`${l.prefix}each-arg`);
|
|
12231
12275
|
if (typeof i != "string" || i === "")
|
|
12232
12276
|
return !1;
|
|
12233
12277
|
const n = new Set(t);
|
|
12234
12278
|
n.add(i);
|
|
12235
|
-
const s = e.getRawAttribute(`${
|
|
12279
|
+
const s = e.getRawAttribute(`${l.prefix}each-index`);
|
|
12236
12280
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
12237
12281
|
}
|
|
12238
12282
|
for (const i of e.getChildren())
|
|
@@ -12290,7 +12334,7 @@ ${r}
|
|
|
12290
12334
|
* @returns 省略可能なら true
|
|
12291
12335
|
*/
|
|
12292
12336
|
static canSkipStableDerivedSubtree(e) {
|
|
12293
|
-
return !e.hasAttribute(`${
|
|
12337
|
+
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
12338
|
}
|
|
12295
12339
|
/**
|
|
12296
12340
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -12299,7 +12343,7 @@ ${r}
|
|
|
12299
12343
|
* @returns 含むなら true
|
|
12300
12344
|
*/
|
|
12301
12345
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12302
|
-
return e.getChildren().some((t) => t instanceof I ? t.hasAttribute(`${
|
|
12346
|
+
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
12347
|
}
|
|
12304
12348
|
/**
|
|
12305
12349
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -12347,7 +12391,7 @@ ${r}
|
|
|
12347
12391
|
* @returns プロファイル
|
|
12348
12392
|
*/
|
|
12349
12393
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
12350
|
-
if (!j.isEnabled() || !e.hasAttribute(`${
|
|
12394
|
+
if (!j.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
12351
12395
|
return null;
|
|
12352
12396
|
const t = f.DERIVE_SUBTREE_PROFILES.get(e);
|
|
12353
12397
|
if (t)
|
|
@@ -12397,12 +12441,12 @@ ${r}
|
|
|
12397
12441
|
n += `#${s}`, t.unshift(n);
|
|
12398
12442
|
break;
|
|
12399
12443
|
}
|
|
12400
|
-
const a = r.getRawAttribute(`${
|
|
12401
|
-
typeof a == "string" && a.trim() !== "" && (n += `[${
|
|
12444
|
+
const a = r.getRawAttribute(`${l.prefix}derive-name`);
|
|
12445
|
+
typeof a == "string" && a.trim() !== "" && (n += `[${l.prefix}derive-name="${a.trim()}"]`);
|
|
12402
12446
|
const o = r.getParent();
|
|
12403
12447
|
if (o) {
|
|
12404
|
-
const
|
|
12405
|
-
n += `:nth-child(${
|
|
12448
|
+
const c = o.getChildren().filter((u) => u instanceof I).findIndex((u) => u === r);
|
|
12449
|
+
n += `:nth-child(${c + 1})`;
|
|
12406
12450
|
}
|
|
12407
12451
|
t.unshift(n), r = o;
|
|
12408
12452
|
}
|
|
@@ -12432,7 +12476,7 @@ ${r}
|
|
|
12432
12476
|
*/
|
|
12433
12477
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
12434
12478
|
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),
|
|
12479
|
+
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
12480
|
reason: t,
|
|
12437
12481
|
hostId: r.hostId,
|
|
12438
12482
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -12451,15 +12495,15 @@ ${r}
|
|
|
12451
12495
|
*/
|
|
12452
12496
|
static hasNonEachDynamicElementState(e) {
|
|
12453
12497
|
const t = /* @__PURE__ */ new Set([
|
|
12454
|
-
`${
|
|
12455
|
-
`${
|
|
12456
|
-
`${
|
|
12457
|
-
`${
|
|
12498
|
+
`${l.prefix}each`,
|
|
12499
|
+
`${l.prefix}each-key`,
|
|
12500
|
+
`${l.prefix}each-arg`,
|
|
12501
|
+
`${l.prefix}each-index`
|
|
12458
12502
|
]);
|
|
12459
12503
|
return e.getAttributeNames().some((i) => {
|
|
12460
12504
|
if (t.has(i))
|
|
12461
12505
|
return !1;
|
|
12462
|
-
if (i.startsWith(`${
|
|
12506
|
+
if (i.startsWith(`${l.prefix}attr-`) || i.startsWith(l.prefix))
|
|
12463
12507
|
return !0;
|
|
12464
12508
|
const n = e.getRawAttribute(i);
|
|
12465
12509
|
return typeof n == "string" && n.includes("{{");
|
|
@@ -12485,7 +12529,7 @@ ${r}
|
|
|
12485
12529
|
* @returns 再評価が必要なら true
|
|
12486
12530
|
*/
|
|
12487
12531
|
static isFreshInitializationDynamicAttribute(e, t) {
|
|
12488
|
-
if (t.startsWith(`${
|
|
12532
|
+
if (t.startsWith(`${l.prefix}attr-`) || t.startsWith(l.prefix))
|
|
12489
12533
|
return !0;
|
|
12490
12534
|
const r = e.getRawAttribute(t);
|
|
12491
12535
|
return typeof r == "string" && r.includes("{{");
|
|
@@ -12499,28 +12543,32 @@ ${r}
|
|
|
12499
12543
|
static updateDiff(e, t) {
|
|
12500
12544
|
const r = e.getTemplate();
|
|
12501
12545
|
if (r === null)
|
|
12502
|
-
return
|
|
12503
|
-
|
|
12546
|
+
return m.error(
|
|
12547
|
+
"[Haori]",
|
|
12548
|
+
`Template is not set for ${l.prefix}each="${e.getRawAttribute(`${l.prefix}each`)}". The container needs one element child as the row template.`,
|
|
12549
|
+
e.getTarget()
|
|
12550
|
+
), Promise.resolve();
|
|
12551
|
+
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
12504
12552
|
i && (i = String(i));
|
|
12505
|
-
const n = e.getAttribute(`${
|
|
12553
|
+
const n = e.getAttribute(`${l.prefix}each-key`), s = e.getAttribute(`${l.prefix}each-arg`), a = t.map(
|
|
12506
12554
|
(A, S) => f.createListKey(A, n ? String(n) : null, S)
|
|
12507
|
-
), o = new Set(a),
|
|
12555
|
+
), o = new Set(a), c = /* @__PURE__ */ new Map();
|
|
12508
12556
|
a.forEach((A) => {
|
|
12509
|
-
|
|
12557
|
+
c.set(A, (c.get(A) ?? 0) + 1);
|
|
12510
12558
|
}), n && o.size !== a.length && f.warnDuplicateEachKey(String(n));
|
|
12511
12559
|
const u = [];
|
|
12512
12560
|
let d = e.getChildren().filter((A) => A instanceof I).filter(
|
|
12513
|
-
(A) => !A.hasAttribute(`${
|
|
12561
|
+
(A) => !A.hasAttribute(`${l.prefix}each-before`) && !A.hasAttribute(`${l.prefix}each-after`)
|
|
12514
12562
|
);
|
|
12515
12563
|
const p = d.map((A) => A.getListKey()), g = /* @__PURE__ */ new Set();
|
|
12516
12564
|
d = d.filter((A, S) => {
|
|
12517
|
-
const C = String(A.getListKey()), V =
|
|
12565
|
+
const C = String(A.getListKey()), V = c.get(C) ?? 0;
|
|
12518
12566
|
if (V === 0) {
|
|
12519
12567
|
g.add(A);
|
|
12520
12568
|
const L = A.getListKey();
|
|
12521
12569
|
return L !== null && U.rowRemove(A.getTarget(), L, S), u.push(A.remove()), !1;
|
|
12522
12570
|
}
|
|
12523
|
-
return
|
|
12571
|
+
return c.set(C, V - 1), !0;
|
|
12524
12572
|
});
|
|
12525
12573
|
const E = d.map((A) => A.getListKey()), v = /* @__PURE__ */ new Map();
|
|
12526
12574
|
d.forEach((A) => {
|
|
@@ -12531,7 +12579,7 @@ ${r}
|
|
|
12531
12579
|
C ? C.push(A) : v.set(S, [A]);
|
|
12532
12580
|
});
|
|
12533
12581
|
const D = e.getChildElementFragments().filter((A) => !g.has(A)), M = D.filter(
|
|
12534
|
-
(A) => A.hasAttribute(`${
|
|
12582
|
+
(A) => A.hasAttribute(`${l.prefix}each-before`)
|
|
12535
12583
|
).length;
|
|
12536
12584
|
let H = Promise.resolve();
|
|
12537
12585
|
return a.forEach((A, S) => {
|
|
@@ -12612,6 +12660,41 @@ ${r}
|
|
|
12612
12660
|
);
|
|
12613
12661
|
});
|
|
12614
12662
|
}
|
|
12663
|
+
/**
|
|
12664
|
+
* `data-each` コンテナに要素の子が 2 つ以上あることを開発モードで警告します。
|
|
12665
|
+
*
|
|
12666
|
+
* 仕様「`data-each`」の配置ルールは、最初の要素の子だけをテンプレートとし、
|
|
12667
|
+
* 2 つめ以降は行に入りません。残った子はコンテナへそのまま留まるため、行スコープ
|
|
12668
|
+
* の名前を参照している式は解決できず(テキスト補間が展開されないまま表示され)、
|
|
12669
|
+
* 行操作のボタンは行に属さないため失敗します。どちらも例外にはならないので、
|
|
12670
|
+
* 気づけるようコンテナごとに一度だけ知らせます。
|
|
12671
|
+
*
|
|
12672
|
+
* テンプレート化の直後に呼ぶ前提です。この時点で残っている子はテンプレート化
|
|
12673
|
+
* されなかった残りだけなので、そのまま数えられます。テンプレート化はコンテナ
|
|
12674
|
+
* ごとに 1 回だけ通るため(`setTemplate()` を null へ戻す経路はありません)、
|
|
12675
|
+
* 警告済みの記録は持ちません。開発モード以外へ出さないのは `Log.warn()` 側の
|
|
12676
|
+
* 判定です。
|
|
12677
|
+
*
|
|
12678
|
+
* 数えるのは DOM の子ではなくフラグメントの子です。DOM を数えると、フラグメント木
|
|
12679
|
+
* と DOM の子が同期しない経路(テンプレート復旧のフォールバックが対象にしている
|
|
12680
|
+
* 状況)で残った未管理の要素まで数えてしまい、利用者が書いていない構成を指して
|
|
12681
|
+
* 警告することになります。
|
|
12682
|
+
*
|
|
12683
|
+
* @param fragment `data-each` コンテナのフラグメント
|
|
12684
|
+
* @returns 戻り値はありません。
|
|
12685
|
+
*/
|
|
12686
|
+
static warnExtraEachChildren(e) {
|
|
12687
|
+
const t = e.getChildren().filter(
|
|
12688
|
+
(r) => r instanceof I
|
|
12689
|
+
).filter(
|
|
12690
|
+
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12691
|
+
);
|
|
12692
|
+
t.length !== 0 && m.warn(
|
|
12693
|
+
"[Haori]",
|
|
12694
|
+
`${l.prefix}each="${e.getRawAttribute(`${l.prefix}each`)}" のコンテナに要素の子が 2 つ以上あります。テンプレートになるのは最初の子だけで、残り ${t.length} 個は行に入りません(${t.map((r) => r.getTarget().tagName.toLowerCase()).join(", ")})。行の中身は 1 つの要素で包んでください。`,
|
|
12695
|
+
e.getTarget()
|
|
12696
|
+
);
|
|
12697
|
+
}
|
|
12615
12698
|
/**
|
|
12616
12699
|
* `data-each-key` の値が重複していることを開発モードで警告します。
|
|
12617
12700
|
*
|
|
@@ -12624,9 +12707,9 @@ ${r}
|
|
|
12624
12707
|
* @returns 戻り値はありません。
|
|
12625
12708
|
*/
|
|
12626
12709
|
static warnDuplicateEachKey(e) {
|
|
12627
|
-
!j.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e),
|
|
12710
|
+
!j.isEnabled() || f.WARNED_DUPLICATE_EACH_KEYS.has(e) || (f.WARNED_DUPLICATE_EACH_KEYS.add(e), m.warn(
|
|
12628
12711
|
"[Haori]",
|
|
12629
|
-
`${
|
|
12712
|
+
`${l.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
12630
12713
|
));
|
|
12631
12714
|
}
|
|
12632
12715
|
/**
|
|
@@ -12676,7 +12759,7 @@ ${r}
|
|
|
12676
12759
|
* @returns 反映完了の Promise
|
|
12677
12760
|
*/
|
|
12678
12761
|
static applyRowFormValues(e, t, r) {
|
|
12679
|
-
return !e.hasAttribute(`${
|
|
12762
|
+
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
12763
|
}
|
|
12681
12764
|
/**
|
|
12682
12765
|
* リスト比較用のキーを生成します。
|
|
@@ -12721,16 +12804,16 @@ ${r}
|
|
|
12721
12804
|
else if (n)
|
|
12722
12805
|
a = { [n]: t };
|
|
12723
12806
|
else
|
|
12724
|
-
return
|
|
12807
|
+
return m.error(
|
|
12725
12808
|
"[Haori]",
|
|
12726
|
-
`Primitive value requires '${
|
|
12809
|
+
`Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
|
|
12727
12810
|
), Promise.resolve(!1);
|
|
12728
12811
|
r && (a[r] = i);
|
|
12729
|
-
const o = a,
|
|
12812
|
+
const o = a, c = f.createBindingSignature({
|
|
12730
12813
|
listKey: s,
|
|
12731
12814
|
bindingData: o
|
|
12732
12815
|
});
|
|
12733
|
-
return e.getListKey() === s && e.getRenderSignature() ===
|
|
12816
|
+
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
12817
|
}
|
|
12735
12818
|
/**
|
|
12736
12819
|
* 新規挿入行に遅延再評価が必要かどうかを判定します。
|
|
@@ -12757,7 +12840,7 @@ ${r}
|
|
|
12757
12840
|
*/
|
|
12758
12841
|
static hasMountSensitiveAttribute(e) {
|
|
12759
12842
|
return ["fetch", "import"].some(
|
|
12760
|
-
(t) => e.hasAttribute(`${
|
|
12843
|
+
(t) => e.hasAttribute(`${l.prefix}${t}`)
|
|
12761
12844
|
);
|
|
12762
12845
|
}
|
|
12763
12846
|
/**
|
|
@@ -12932,7 +13015,7 @@ const me = class me {
|
|
|
12932
13015
|
try {
|
|
12933
13016
|
t();
|
|
12934
13017
|
} catch (r) {
|
|
12935
|
-
|
|
13018
|
+
m.error("[Haori]", "Deferred event handling error:", r);
|
|
12936
13019
|
}
|
|
12937
13020
|
}
|
|
12938
13021
|
/**
|
|
@@ -12959,7 +13042,7 @@ const me = class me {
|
|
|
12959
13042
|
* @returns `data-on` 属性名
|
|
12960
13043
|
*/
|
|
12961
13044
|
get onAttributeName() {
|
|
12962
|
-
return `${
|
|
13045
|
+
return `${l.prefix}on`;
|
|
12963
13046
|
}
|
|
12964
13047
|
/**
|
|
12965
13048
|
* ルート配下に存在する `data-on` 宣言を走査し、カスタムイベントを購読します。
|
|
@@ -12985,7 +13068,7 @@ const me = class me {
|
|
|
12985
13068
|
if (e === null || e === "")
|
|
12986
13069
|
return;
|
|
12987
13070
|
if (me.BUILTIN_EVENT_NAMES.has(e)) {
|
|
12988
|
-
|
|
13071
|
+
m.warn(
|
|
12989
13072
|
"[Haori]",
|
|
12990
13073
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
12991
13074
|
);
|
|
@@ -13015,7 +13098,7 @@ const me = class me {
|
|
|
13015
13098
|
return;
|
|
13016
13099
|
const n = x.get(i);
|
|
13017
13100
|
n instanceof I && new re(n, "on", t).run().catch((s) => {
|
|
13018
|
-
|
|
13101
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
13019
13102
|
});
|
|
13020
13103
|
});
|
|
13021
13104
|
}
|
|
@@ -13053,13 +13136,13 @@ const me = class me {
|
|
|
13053
13136
|
const r = this.getElementFromTarget(e.target, t);
|
|
13054
13137
|
if (r) {
|
|
13055
13138
|
if (t === "input") {
|
|
13056
|
-
const i = `${
|
|
13139
|
+
const i = `${l.prefix}input-`;
|
|
13057
13140
|
if (!r.getAttributeNames().some((s) => s.startsWith(i))) {
|
|
13058
13141
|
this.recordUserEdit(r);
|
|
13059
13142
|
return;
|
|
13060
13143
|
}
|
|
13061
13144
|
}
|
|
13062
|
-
if (r.hasAttribute(`${
|
|
13145
|
+
if (r.hasAttribute(`${l.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
13063
13146
|
this.deferredProcedures.push(() => {
|
|
13064
13147
|
r.isConnected && this.runProcedureFor(r, t, e);
|
|
13065
13148
|
});
|
|
@@ -13083,10 +13166,10 @@ const me = class me {
|
|
|
13083
13166
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
13084
13167
|
const n = () => {
|
|
13085
13168
|
new re(i, t, r).run().catch((s) => {
|
|
13086
|
-
|
|
13169
|
+
m.error("[Haori]", "Procedure execution error:", s);
|
|
13087
13170
|
});
|
|
13088
13171
|
};
|
|
13089
|
-
if (t === "click" && e.hasAttribute(`${
|
|
13172
|
+
if (t === "click" && e.hasAttribute(`${l.prefix}click-defer`)) {
|
|
13090
13173
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => n()) : setTimeout(n, 0);
|
|
13091
13174
|
return;
|
|
13092
13175
|
}
|
|
@@ -13192,7 +13275,7 @@ const me = class me {
|
|
|
13192
13275
|
* @returns 処理対象要素。見つからない場合は null
|
|
13193
13276
|
*/
|
|
13194
13277
|
findClickableElement(e) {
|
|
13195
|
-
const t = `${
|
|
13278
|
+
const t = `${l.prefix}click-`, r = `${l.prefix}click-passive`;
|
|
13196
13279
|
let i = e;
|
|
13197
13280
|
for (; i; ) {
|
|
13198
13281
|
if (i.getAttributeNames().some((s) => s.startsWith(t) && s !== r))
|
|
@@ -13237,7 +13320,7 @@ const W = class W {
|
|
|
13237
13320
|
}
|
|
13238
13321
|
if (typeof IntersectionObserver > "u")
|
|
13239
13322
|
return;
|
|
13240
|
-
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${
|
|
13323
|
+
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
13241
13324
|
if (t && t.observer.root === i && t.observer.rootMargin === n && W.sameThreshold(
|
|
13242
13325
|
t.observer.thresholds,
|
|
13243
13326
|
s
|
|
@@ -13247,13 +13330,13 @@ const W = class W {
|
|
|
13247
13330
|
}
|
|
13248
13331
|
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13249
13332
|
const o = new IntersectionObserver(
|
|
13250
|
-
(
|
|
13333
|
+
(c) => {
|
|
13251
13334
|
const u = W.registrations.get(e);
|
|
13252
|
-
u &&
|
|
13335
|
+
u && c.forEach((d) => {
|
|
13253
13336
|
!d.isIntersecting || u.running || W.isDisabled(u.fragment) || (u.running = !0, new re(u.fragment, "intersect").runWithResult().then((p) => {
|
|
13254
13337
|
p && u.once && (u.observer.disconnect(), W.registrations.delete(e));
|
|
13255
13338
|
}).catch((p) => {
|
|
13256
|
-
|
|
13339
|
+
m.error(
|
|
13257
13340
|
"[Haori]",
|
|
13258
13341
|
"Intersect procedure execution error:",
|
|
13259
13342
|
p
|
|
@@ -13294,32 +13377,32 @@ const W = class W {
|
|
|
13294
13377
|
}
|
|
13295
13378
|
static shouldObserve(e) {
|
|
13296
13379
|
return e.getAttributeNames().some((t) => {
|
|
13297
|
-
if (!t.startsWith(`${
|
|
13380
|
+
if (!t.startsWith(`${l.prefix}intersect-`))
|
|
13298
13381
|
return !1;
|
|
13299
|
-
const r = t.slice(`${
|
|
13382
|
+
const r = t.slice(`${l.prefix}intersect-`.length);
|
|
13300
13383
|
return !W.CONFIG_KEYS.has(r);
|
|
13301
13384
|
});
|
|
13302
13385
|
}
|
|
13303
13386
|
static resolveRoot(e) {
|
|
13304
|
-
const t = `${
|
|
13387
|
+
const t = `${l.prefix}intersect-root`;
|
|
13305
13388
|
if (!e.hasAttribute(t))
|
|
13306
13389
|
return null;
|
|
13307
13390
|
const r = e.getAttribute(t);
|
|
13308
13391
|
if (typeof r != "string" || r.trim() === "")
|
|
13309
13392
|
return null;
|
|
13310
13393
|
const i = z.query(r, t, document);
|
|
13311
|
-
return W.isHtmlElement(i) ? i : (
|
|
13394
|
+
return W.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
13312
13395
|
}
|
|
13313
13396
|
static resolveRootMargin(e) {
|
|
13314
|
-
const t = `${
|
|
13397
|
+
const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
13315
13398
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
13316
13399
|
}
|
|
13317
13400
|
static resolveThreshold(e) {
|
|
13318
|
-
const t = `${
|
|
13401
|
+
const t = `${l.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
13319
13402
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
13320
13403
|
}
|
|
13321
13404
|
static isDisabled(e) {
|
|
13322
|
-
const t = `${
|
|
13405
|
+
const t = `${l.prefix}intersect-disabled`, r = e.getAttribute(t);
|
|
13323
13406
|
if (r === null || r === !1)
|
|
13324
13407
|
return !1;
|
|
13325
13408
|
if (typeof r == "boolean")
|
|
@@ -13434,7 +13517,7 @@ const w = class w {
|
|
|
13434
13517
|
* @returns `data-poll-*` を持つ場合は true
|
|
13435
13518
|
*/
|
|
13436
13519
|
static hasPollAttribute(e) {
|
|
13437
|
-
const t = `${
|
|
13520
|
+
const t = `${l.prefix}poll-`, r = e.attributes;
|
|
13438
13521
|
for (let i = 0; i < r.length; i += 1)
|
|
13439
13522
|
if (r[i].name.startsWith(t))
|
|
13440
13523
|
return !0;
|
|
@@ -13450,7 +13533,7 @@ const w = class w {
|
|
|
13450
13533
|
* @returns 監視対象の場合は true
|
|
13451
13534
|
*/
|
|
13452
13535
|
static shouldObserve(e) {
|
|
13453
|
-
const t = `${
|
|
13536
|
+
const t = `${l.prefix}poll-`;
|
|
13454
13537
|
return e.getAttributeNames().some((r) => r.startsWith(t) ? !w.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
13455
13538
|
}
|
|
13456
13539
|
/**
|
|
@@ -13467,7 +13550,7 @@ const w = class w {
|
|
|
13467
13550
|
* @returns 設定の同一性を表すキー
|
|
13468
13551
|
*/
|
|
13469
13552
|
static buildConfigKey(e) {
|
|
13470
|
-
const t = `${
|
|
13553
|
+
const t = `${l.prefix}poll-`;
|
|
13471
13554
|
return e.getAttributeNames().filter((r) => r.startsWith(t)).sort().map((r) => `${r}=${e.getRawAttribute(r) ?? ""}`).join(`
|
|
13472
13555
|
`);
|
|
13473
13556
|
}
|
|
@@ -13532,7 +13615,7 @@ const w = class w {
|
|
|
13532
13615
|
"poll"
|
|
13533
13616
|
).runWithResult();
|
|
13534
13617
|
} catch (n) {
|
|
13535
|
-
|
|
13618
|
+
m.error("[Haori]", "Poll procedure execution error:", n);
|
|
13536
13619
|
} finally {
|
|
13537
13620
|
t.fetching = !1;
|
|
13538
13621
|
}
|
|
@@ -13717,7 +13800,7 @@ const w = class w {
|
|
|
13717
13800
|
* @returns 注入先フラグメントのリスト
|
|
13718
13801
|
*/
|
|
13719
13802
|
static resolveStateFragments(e) {
|
|
13720
|
-
const t = `${
|
|
13803
|
+
const t = `${l.prefix}poll-state`, r = e.fragment;
|
|
13721
13804
|
if (!r.hasAttribute(t))
|
|
13722
13805
|
return [];
|
|
13723
13806
|
const i = r.getAttribute(t);
|
|
@@ -13729,7 +13812,7 @@ const w = class w {
|
|
|
13729
13812
|
document
|
|
13730
13813
|
);
|
|
13731
13814
|
if (n.length === 0)
|
|
13732
|
-
return
|
|
13815
|
+
return m.error("[Haori]", `Poll state element not found: ${i}`), [];
|
|
13733
13816
|
const s = [];
|
|
13734
13817
|
return n.forEach((a) => {
|
|
13735
13818
|
if (!a.isConnected)
|
|
@@ -13748,14 +13831,14 @@ const w = class w {
|
|
|
13748
13831
|
* @returns 取得間隔(ミリ秒)
|
|
13749
13832
|
*/
|
|
13750
13833
|
static resolveInterval(e) {
|
|
13751
|
-
const t = `${
|
|
13834
|
+
const t = `${l.prefix}poll-interval`;
|
|
13752
13835
|
if (!e.hasAttribute(t))
|
|
13753
13836
|
return w.DEFAULT_INTERVAL_MS;
|
|
13754
13837
|
const r = w.toNumber(e.getAttribute(t));
|
|
13755
|
-
return r === null ? (
|
|
13838
|
+
return r === null ? (m.warn(
|
|
13756
13839
|
"[Haori]",
|
|
13757
13840
|
`${t} は数値で指定してください。既定値 ${w.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
13758
|
-
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (
|
|
13841
|
+
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (m.warn(
|
|
13759
13842
|
"[Haori]",
|
|
13760
13843
|
`${t} の下限は ${w.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
13761
13844
|
), w.MIN_INTERVAL_MS) : r;
|
|
@@ -13767,11 +13850,11 @@ const w = class w {
|
|
|
13767
13850
|
* @returns 打ち切り時間(ミリ秒)。省略時や不正値の場合は null(無制限)
|
|
13768
13851
|
*/
|
|
13769
13852
|
static resolveTimeout(e) {
|
|
13770
|
-
const t = `${
|
|
13853
|
+
const t = `${l.prefix}poll-timeout`;
|
|
13771
13854
|
if (!e.hasAttribute(t))
|
|
13772
13855
|
return null;
|
|
13773
13856
|
const r = w.toNumber(e.getAttribute(t));
|
|
13774
|
-
return r === null || r <= 0 ? (
|
|
13857
|
+
return r === null || r <= 0 ? (m.warn(
|
|
13775
13858
|
"[Haori]",
|
|
13776
13859
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
13777
13860
|
), null) : r;
|
|
@@ -13783,11 +13866,11 @@ const w = class w {
|
|
|
13783
13866
|
* @returns 連続失敗の上限回数。省略時や不正値の場合は null(無制限)
|
|
13784
13867
|
*/
|
|
13785
13868
|
static resolveErrorLimit(e) {
|
|
13786
|
-
const t = `${
|
|
13869
|
+
const t = `${l.prefix}poll-error-limit`;
|
|
13787
13870
|
if (!e.hasAttribute(t))
|
|
13788
13871
|
return null;
|
|
13789
13872
|
const r = w.toNumber(e.getAttribute(t));
|
|
13790
|
-
return r === null || r < 1 ? (
|
|
13873
|
+
return r === null || r < 1 ? (m.warn(
|
|
13791
13874
|
"[Haori]",
|
|
13792
13875
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
13793
13876
|
), null) : Math.floor(r);
|
|
@@ -13818,7 +13901,7 @@ const w = class w {
|
|
|
13818
13901
|
* @returns 非表示の配下にある場合は true
|
|
13819
13902
|
*/
|
|
13820
13903
|
static isHidden(e) {
|
|
13821
|
-
return e.closest(`[${
|
|
13904
|
+
return e.closest(`[${l.prefix}if-false]`) !== null;
|
|
13822
13905
|
}
|
|
13823
13906
|
/**
|
|
13824
13907
|
* `data-poll-disabled` が真かどうかを判定します。
|
|
@@ -13827,7 +13910,7 @@ const w = class w {
|
|
|
13827
13910
|
* @returns 抑止中の場合は true
|
|
13828
13911
|
*/
|
|
13829
13912
|
static isDisabled(e) {
|
|
13830
|
-
const t = `${
|
|
13913
|
+
const t = `${l.prefix}poll-disabled`;
|
|
13831
13914
|
return e.hasAttribute(t) ? w.isTruthy(e.getAttribute(t)) : !1;
|
|
13832
13915
|
}
|
|
13833
13916
|
/**
|
|
@@ -13842,11 +13925,11 @@ const w = class w {
|
|
|
13842
13925
|
* @returns 条件が成立した場合は true
|
|
13843
13926
|
*/
|
|
13844
13927
|
static isUntilSatisfied(e) {
|
|
13845
|
-
const t = `${
|
|
13928
|
+
const t = `${l.prefix}poll-until`;
|
|
13846
13929
|
if (!e.hasAttribute(t))
|
|
13847
13930
|
return !1;
|
|
13848
13931
|
const r = e.getAttributeEvaluation(t);
|
|
13849
|
-
return r ? r.hasUnresolvedReference ? (
|
|
13932
|
+
return r ? r.hasUnresolvedReference ? (m.warn(
|
|
13850
13933
|
"[Haori]",
|
|
13851
13934
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
13852
13935
|
e.getRawAttribute(t),
|
|
@@ -13883,9 +13966,9 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
13883
13966
|
"state"
|
|
13884
13967
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
13885
13968
|
let pe = w;
|
|
13886
|
-
const Vt = "0.46.
|
|
13887
|
-
function qt(
|
|
13888
|
-
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() =>
|
|
13969
|
+
const Vt = "0.46.2";
|
|
13970
|
+
function qt(y) {
|
|
13971
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => y()) : Promise.resolve().then(y);
|
|
13889
13972
|
}
|
|
13890
13973
|
const O = class O {
|
|
13891
13974
|
/**
|
|
@@ -13926,7 +14009,7 @@ const O = class O {
|
|
|
13926
14009
|
return;
|
|
13927
14010
|
const i = O.resolveVarName(r);
|
|
13928
14011
|
if (i === "") {
|
|
13929
|
-
t && (t.observer.disconnect(), O.registrations.delete(e)),
|
|
14012
|
+
t && (t.observer.disconnect(), O.registrations.delete(e)), m.warn(
|
|
13930
14013
|
"[Haori]",
|
|
13931
14014
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
13932
14015
|
);
|
|
@@ -13939,12 +14022,12 @@ const O = class O {
|
|
|
13939
14022
|
}
|
|
13940
14023
|
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
13941
14024
|
const a = new IntersectionObserver(
|
|
13942
|
-
(
|
|
14025
|
+
(c) => {
|
|
13943
14026
|
const u = O.registrations.get(e);
|
|
13944
14027
|
if (!u)
|
|
13945
14028
|
return;
|
|
13946
14029
|
let d = !1;
|
|
13947
|
-
|
|
14030
|
+
c.forEach((p) => {
|
|
13948
14031
|
const g = p.target;
|
|
13949
14032
|
u.observedRows.has(g) && (p.isIntersecting ? u.visibleRows.has(g) || (u.visibleRows.add(g), d = !0) : u.visibleRows.delete(g) && (d = !0));
|
|
13950
14033
|
}), d && O.scheduleCompute(u);
|
|
@@ -13997,7 +14080,7 @@ const O = class O {
|
|
|
13997
14080
|
* @returns 監視対象なら true
|
|
13998
14081
|
*/
|
|
13999
14082
|
static shouldObserve(e) {
|
|
14000
|
-
return e.hasAttribute(`${
|
|
14083
|
+
return e.hasAttribute(`${l.prefix}each`) && e.hasAttribute(`${l.prefix}each-visible`);
|
|
14001
14084
|
}
|
|
14002
14085
|
/**
|
|
14003
14086
|
* 公開する変数名を解決します。
|
|
@@ -14006,7 +14089,7 @@ const O = class O {
|
|
|
14006
14089
|
* @returns 変数名。未指定なら空文字
|
|
14007
14090
|
*/
|
|
14008
14091
|
static resolveVarName(e) {
|
|
14009
|
-
const t = e.getRawAttribute(`${
|
|
14092
|
+
const t = e.getRawAttribute(`${l.prefix}each-visible`);
|
|
14010
14093
|
return typeof t == "string" ? t.trim() : "";
|
|
14011
14094
|
}
|
|
14012
14095
|
/**
|
|
@@ -14016,14 +14099,14 @@ const O = class O {
|
|
|
14016
14099
|
* @returns root 要素。未指定・不正ならビューポート(null)
|
|
14017
14100
|
*/
|
|
14018
14101
|
static resolveRoot(e) {
|
|
14019
|
-
const t = `${
|
|
14102
|
+
const t = `${l.prefix}each-visible-root`;
|
|
14020
14103
|
if (!e.hasAttribute(t))
|
|
14021
14104
|
return null;
|
|
14022
14105
|
const r = e.getAttribute(t);
|
|
14023
14106
|
if (typeof r != "string" || r.trim() === "")
|
|
14024
14107
|
return null;
|
|
14025
14108
|
const i = z.query(r, t, document);
|
|
14026
|
-
return O.isHtmlElement(i) ? i : (
|
|
14109
|
+
return O.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
14027
14110
|
}
|
|
14028
14111
|
/**
|
|
14029
14112
|
* rootMargin を解決します。
|
|
@@ -14032,7 +14115,7 @@ const O = class O {
|
|
|
14032
14115
|
* @returns rootMargin 文字列(未指定は既定値)
|
|
14033
14116
|
*/
|
|
14034
14117
|
static resolveRootMargin(e) {
|
|
14035
|
-
const t = `${
|
|
14118
|
+
const t = `${l.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
14036
14119
|
return r === null || r === !1 || r === "" ? O.DEFAULT_ROOT_MARGIN : String(r);
|
|
14037
14120
|
}
|
|
14038
14121
|
/**
|
|
@@ -14043,7 +14126,7 @@ const O = class O {
|
|
|
14043
14126
|
*/
|
|
14044
14127
|
static realRowElements(e) {
|
|
14045
14128
|
return e.getChildren().filter(
|
|
14046
|
-
(t) => t instanceof I && !t.hasAttribute(`${
|
|
14129
|
+
(t) => t instanceof I && !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
14047
14130
|
).map((t) => t.getTarget());
|
|
14048
14131
|
}
|
|
14049
14132
|
/**
|
|
@@ -14098,8 +14181,8 @@ const O = class O {
|
|
|
14098
14181
|
};
|
|
14099
14182
|
else {
|
|
14100
14183
|
let a = i[0], o = i[0];
|
|
14101
|
-
for (const
|
|
14102
|
-
|
|
14184
|
+
for (const c of i)
|
|
14185
|
+
c < a && (a = c), c > o && (o = c);
|
|
14103
14186
|
n = {
|
|
14104
14187
|
first: a,
|
|
14105
14188
|
last: o,
|
|
@@ -14122,7 +14205,7 @@ const O = class O {
|
|
|
14122
14205
|
static publish(e, t) {
|
|
14123
14206
|
const r = O.resolveBindOwner(e.fragment);
|
|
14124
14207
|
if (!r) {
|
|
14125
|
-
|
|
14208
|
+
m.warn(
|
|
14126
14209
|
"[Haori]",
|
|
14127
14210
|
"data-each-visible found no ancestor data-bind scope to publish into."
|
|
14128
14211
|
);
|
|
@@ -14141,7 +14224,7 @@ const O = class O {
|
|
|
14141
14224
|
kind: "nonSupply",
|
|
14142
14225
|
sequence: I.nextSequence()
|
|
14143
14226
|
}).catch((o) => {
|
|
14144
|
-
|
|
14227
|
+
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
14145
14228
|
});
|
|
14146
14229
|
}
|
|
14147
14230
|
/**
|
|
@@ -14152,7 +14235,7 @@ const O = class O {
|
|
|
14152
14235
|
* @returns 公開先フラグメント。無ければ null
|
|
14153
14236
|
*/
|
|
14154
14237
|
static resolveBindOwner(e) {
|
|
14155
|
-
const t = `${
|
|
14238
|
+
const t = `${l.prefix}bind`;
|
|
14156
14239
|
let r = e.getParent();
|
|
14157
14240
|
for (; r; ) {
|
|
14158
14241
|
if (r.hasAttribute(t))
|
|
@@ -14190,11 +14273,11 @@ const G = class G {
|
|
|
14190
14273
|
B.scan(document.head),
|
|
14191
14274
|
B.scan(document.body)
|
|
14192
14275
|
]), [r, i] = t;
|
|
14193
|
-
r.status !== "fulfilled" &&
|
|
14276
|
+
r.status !== "fulfilled" && m.error(
|
|
14194
14277
|
"[Haori]",
|
|
14195
14278
|
"Failed to build head fragment:",
|
|
14196
14279
|
r.reason
|
|
14197
|
-
), i.status !== "fulfilled" &&
|
|
14280
|
+
), i.status !== "fulfilled" && m.error(
|
|
14198
14281
|
"[Haori]",
|
|
14199
14282
|
"Failed to build body fragment:",
|
|
14200
14283
|
i.reason
|
|
@@ -14227,7 +14310,7 @@ const G = class G {
|
|
|
14227
14310
|
* @returns 外部管理サブツリーに属する場合 true
|
|
14228
14311
|
*/
|
|
14229
14312
|
static isExternallyManaged(e) {
|
|
14230
|
-
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${
|
|
14313
|
+
return (e instanceof Element ? e : e?.parentElement ?? null)?.closest(`[${l.prefix}external]`) != null;
|
|
14231
14314
|
}
|
|
14232
14315
|
/**
|
|
14233
14316
|
* 指定された要素を監視します。
|
|
@@ -14285,7 +14368,7 @@ const G = class G {
|
|
|
14285
14368
|
* @returns `data-bind` 属性の変更なら true
|
|
14286
14369
|
*/
|
|
14287
14370
|
static isBindAttributeRecord(e) {
|
|
14288
|
-
return e.type === "attributes" && e.attributeName === `${
|
|
14371
|
+
return e.type === "attributes" && e.attributeName === `${l.prefix}bind`;
|
|
14289
14372
|
}
|
|
14290
14373
|
/**
|
|
14291
14374
|
* DOM 変更のレコードを処理します。
|
|
@@ -14303,7 +14386,7 @@ const G = class G {
|
|
|
14303
14386
|
switch (r.type) {
|
|
14304
14387
|
case "attributes": {
|
|
14305
14388
|
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 === `${
|
|
14389
|
+
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
14390
|
break;
|
|
14308
14391
|
B.setAttribute(
|
|
14309
14392
|
i,
|
|
@@ -14323,7 +14406,7 @@ const G = class G {
|
|
|
14323
14406
|
break;
|
|
14324
14407
|
}
|
|
14325
14408
|
case "characterData": {
|
|
14326
|
-
r.target instanceof Text || r.target instanceof Comment ? B.changeText(r.target, r.target.textContent) :
|
|
14409
|
+
r.target instanceof Text || r.target instanceof Comment ? B.changeText(r.target, r.target.textContent) : m.warn(
|
|
14327
14410
|
"[Haori]",
|
|
14328
14411
|
"Unsupported character data type:",
|
|
14329
14412
|
r.target
|
|
@@ -14331,11 +14414,11 @@ const G = class G {
|
|
|
14331
14414
|
break;
|
|
14332
14415
|
}
|
|
14333
14416
|
default:
|
|
14334
|
-
|
|
14417
|
+
m.warn("[Haori]", "Unknown mutation type:", r.type);
|
|
14335
14418
|
continue;
|
|
14336
14419
|
}
|
|
14337
14420
|
} catch (i) {
|
|
14338
|
-
|
|
14421
|
+
m.error("[Haori]", "Error processing mutation:", i);
|
|
14339
14422
|
}
|
|
14340
14423
|
}
|
|
14341
14424
|
};
|
|
@@ -14346,11 +14429,11 @@ const Wt = () => ye.waitForRenders(), jt = ye.enhancers;
|
|
|
14346
14429
|
export {
|
|
14347
14430
|
B as Core,
|
|
14348
14431
|
ie as Enhance,
|
|
14349
|
-
|
|
14432
|
+
l as Env,
|
|
14350
14433
|
F as Form,
|
|
14351
14434
|
x as Fragment,
|
|
14352
14435
|
ye as Haori,
|
|
14353
|
-
|
|
14436
|
+
m as Log,
|
|
14354
14437
|
K as Queue,
|
|
14355
14438
|
ye as default,
|
|
14356
14439
|
jt as enhancers,
|