haori 0.4.5 → 0.4.7
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 +2 -1
- package/README.md +2 -1
- package/dist/haori.cjs.js +11 -11
- package/dist/haori.cjs.js.map +1 -1
- package/dist/haori.es.js +460 -399
- package/dist/haori.es.js.map +1 -1
- package/dist/haori.iife.js +9 -9
- package/dist/haori.iife.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/package.json +1 -1
- package/dist/src/core.d.ts +6 -0
- package/dist/src/core.d.ts.map +1 -1
- package/dist/src/core.js +34 -13
- package/dist/src/core.js.map +1 -1
- package/dist/src/expression.d.ts +10 -0
- package/dist/src/expression.d.ts.map +1 -1
- package/dist/src/expression.js +63 -0
- package/dist/src/expression.js.map +1 -1
- package/dist/src/fragment.d.ts +4 -0
- package/dist/src/fragment.d.ts.map +1 -1
- package/dist/src/fragment.js +20 -1
- package/dist/src/fragment.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/tests/core.test.js +84 -1
- package/dist/tests/core.test.js.map +1 -1
- package/dist/tests/data-fetch-tbody-dom.test.js +9 -26
- package/dist/tests/data-fetch-tbody-dom.test.js.map +1 -1
- package/dist/tests/expression.test.js +59 -0
- package/dist/tests/expression.test.js.map +1 -1
- package/dist/tests/fetch-and-procedure-scenarios.test.js +19 -11
- package/dist/tests/fetch-and-procedure-scenarios.test.js.map +1 -1
- package/dist/tests/fragment.test.js +8 -0
- package/dist/tests/fragment.test.js.map +1 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C = class C {
|
|
2
2
|
/**
|
|
3
3
|
* 開発モードの状態を取得します。
|
|
4
4
|
*
|
|
5
5
|
* @returns 開発モードならtrue、そうでなければfalse
|
|
6
6
|
*/
|
|
7
7
|
static isEnabled() {
|
|
8
|
-
return
|
|
8
|
+
return C.devMode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* 開発モードを有効化します。
|
|
12
12
|
*/
|
|
13
13
|
static enable() {
|
|
14
|
-
|
|
14
|
+
C.devMode = !0;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* 開発モードを無効化します。
|
|
18
18
|
*/
|
|
19
19
|
static disable() {
|
|
20
|
-
|
|
20
|
+
C.devMode = !1;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* 開発モードを切り替えます。
|
|
@@ -25,11 +25,11 @@ const O = class O {
|
|
|
25
25
|
* @param enabled trueで有効化、falseで無効化
|
|
26
26
|
*/
|
|
27
27
|
static set(t) {
|
|
28
|
-
|
|
28
|
+
C.devMode = t;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
let B =
|
|
31
|
+
C.devMode = !1;
|
|
32
|
+
let B = C;
|
|
33
33
|
const z = "embedded";
|
|
34
34
|
function rt(F) {
|
|
35
35
|
return F === "embedded" || F === "demo";
|
|
@@ -95,8 +95,8 @@ const D = class D {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
D._prefix = "data-", D._runtime = z;
|
|
98
|
-
let
|
|
99
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
98
|
+
let l = D;
|
|
99
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
|
|
100
100
|
class d {
|
|
101
101
|
/**
|
|
102
102
|
* 開発モードでのみコンソールに情報を出力します。
|
|
@@ -222,14 +222,14 @@ const _ = class _ {
|
|
|
222
222
|
};
|
|
223
223
|
_.ASYNC_QUEUE = new st();
|
|
224
224
|
let P = _;
|
|
225
|
-
class
|
|
225
|
+
class X {
|
|
226
226
|
/**
|
|
227
227
|
* 実行モードを取得します。
|
|
228
228
|
*
|
|
229
229
|
* @return 実行モード。
|
|
230
230
|
*/
|
|
231
231
|
static get runtime() {
|
|
232
|
-
return
|
|
232
|
+
return l.runtime;
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* 実行モードを設定します。
|
|
@@ -238,7 +238,7 @@ class J {
|
|
|
238
238
|
* @return 戻り値はありません。
|
|
239
239
|
*/
|
|
240
240
|
static setRuntime(t) {
|
|
241
|
-
|
|
241
|
+
l.setRuntime(t);
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* 通知ダイアログを表示します。
|
|
@@ -304,7 +304,7 @@ class J {
|
|
|
304
304
|
* @param message エラーメッセージ
|
|
305
305
|
*/
|
|
306
306
|
static addErrorMessage(t, e) {
|
|
307
|
-
return
|
|
307
|
+
return X.addMessage(t, e, "error");
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
310
|
* メッセージをレベル付きで追加します。
|
|
@@ -337,9 +337,9 @@ function et() {
|
|
|
337
337
|
const t = globalThis.window?.Haori;
|
|
338
338
|
return nt.every(
|
|
339
339
|
(r) => typeof t?.[r] == "function"
|
|
340
|
-
) ? t :
|
|
340
|
+
) ? t : X;
|
|
341
341
|
}
|
|
342
|
-
class
|
|
342
|
+
class y {
|
|
343
343
|
/**
|
|
344
344
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
345
345
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -350,7 +350,7 @@ class b {
|
|
|
350
350
|
*/
|
|
351
351
|
static getValues(t) {
|
|
352
352
|
const e = {};
|
|
353
|
-
return
|
|
353
|
+
return y.getPartValues(t, e);
|
|
354
354
|
}
|
|
355
355
|
/**
|
|
356
356
|
* フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
|
|
@@ -361,32 +361,32 @@ class b {
|
|
|
361
361
|
* @returns values と同じオブジェクト
|
|
362
362
|
*/
|
|
363
363
|
static getPartValues(t, e) {
|
|
364
|
-
const r = t.getAttribute("name"), i = t.getAttribute(`${
|
|
364
|
+
const r = t.getAttribute("name"), i = t.getAttribute(`${l.prefix}form-object`), n = t.getAttribute(`${l.prefix}form-list`);
|
|
365
365
|
if (r) {
|
|
366
366
|
n ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && d.warn(
|
|
367
367
|
"Haori",
|
|
368
|
-
`Element cannot have both ${
|
|
368
|
+
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
369
369
|
);
|
|
370
370
|
for (const s of t.getChildElementFragments())
|
|
371
|
-
|
|
371
|
+
y.getPartValues(s, e);
|
|
372
372
|
} else if (i) {
|
|
373
373
|
const s = {};
|
|
374
374
|
for (const a of t.getChildElementFragments())
|
|
375
|
-
|
|
375
|
+
y.getPartValues(a, s);
|
|
376
376
|
Object.keys(s).length > 0 && (e[String(i)] = s), n && d.warn(
|
|
377
377
|
"Haori",
|
|
378
|
-
`Element cannot have both ${
|
|
378
|
+
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
379
379
|
);
|
|
380
380
|
} else if (n) {
|
|
381
381
|
const s = [];
|
|
382
382
|
for (const a of t.getChildElementFragments()) {
|
|
383
383
|
const o = {};
|
|
384
|
-
|
|
384
|
+
y.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
|
|
385
385
|
}
|
|
386
386
|
s.length > 0 && (e[String(n)] = s);
|
|
387
387
|
} else
|
|
388
388
|
for (const s of t.getChildElementFragments())
|
|
389
|
-
|
|
389
|
+
y.getPartValues(s, e);
|
|
390
390
|
return e;
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
@@ -399,7 +399,7 @@ class b {
|
|
|
399
399
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
400
400
|
*/
|
|
401
401
|
static setValues(t, e, r = !1) {
|
|
402
|
-
return
|
|
402
|
+
return y.setPartValues(t, e, null, r, !0);
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -411,7 +411,7 @@ class b {
|
|
|
411
411
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
412
412
|
*/
|
|
413
413
|
static syncValues(t, e, r = !1) {
|
|
414
|
-
return
|
|
414
|
+
return y.setPartValues(t, e, null, r, !1);
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* 単一フラグメントへ値を設定します。
|
|
@@ -434,50 +434,50 @@ class b {
|
|
|
434
434
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
435
435
|
*/
|
|
436
436
|
static setPartValues(t, e, r = null, i = !1, n = !0) {
|
|
437
|
-
const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${
|
|
437
|
+
const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), h = t.getAttribute(`${l.prefix}form-list`), m = t.getAttribute(`${l.prefix}form-detach`);
|
|
438
438
|
if (a) {
|
|
439
439
|
if (!m || i) {
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
) : typeof
|
|
444
|
-
|
|
440
|
+
const b = e[String(a)];
|
|
441
|
+
h && Array.isArray(b) && r !== null ? s.push(
|
|
442
|
+
y.applyFragmentValue(t, b[r] ?? null, n)
|
|
443
|
+
) : typeof b > "u" || (typeof b == "string" || typeof b == "number" || typeof b == "boolean" || b === null ? s.push(y.applyFragmentValue(t, b, n)) : s.push(
|
|
444
|
+
y.applyFragmentValue(t, String(b), n)
|
|
445
445
|
));
|
|
446
446
|
}
|
|
447
447
|
} else if (o) {
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
448
|
+
const b = e[String(o)];
|
|
449
|
+
if (b && typeof b == "object")
|
|
450
450
|
for (const E of t.getChildElementFragments())
|
|
451
451
|
s.push(
|
|
452
|
-
|
|
452
|
+
y.setPartValues(
|
|
453
453
|
E,
|
|
454
|
-
|
|
454
|
+
b,
|
|
455
455
|
null,
|
|
456
456
|
i,
|
|
457
457
|
n
|
|
458
458
|
)
|
|
459
459
|
);
|
|
460
|
-
} else if (
|
|
461
|
-
const
|
|
462
|
-
if (Array.isArray(
|
|
460
|
+
} else if (h) {
|
|
461
|
+
const b = e[String(h)];
|
|
462
|
+
if (Array.isArray(b)) {
|
|
463
463
|
const E = t.getChildElementFragments();
|
|
464
464
|
for (let S = 0; S < E.length; S++) {
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
465
|
+
const c = E[S];
|
|
466
|
+
b.length > S ? s.push(
|
|
467
|
+
y.setPartValues(
|
|
468
|
+
c,
|
|
469
|
+
b[S],
|
|
470
470
|
S,
|
|
471
471
|
i,
|
|
472
472
|
n
|
|
473
473
|
)
|
|
474
|
-
) : s.push(
|
|
474
|
+
) : s.push(y.setPartValues(c, {}, S, i, n));
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
} else
|
|
478
|
-
for (const
|
|
478
|
+
for (const b of t.getChildElementFragments())
|
|
479
479
|
s.push(
|
|
480
|
-
|
|
480
|
+
y.setPartValues(b, e, null, i, n)
|
|
481
481
|
);
|
|
482
482
|
return Promise.all(s).then(() => {
|
|
483
483
|
});
|
|
@@ -490,9 +490,9 @@ class b {
|
|
|
490
490
|
* @returns すべての初期化処理が完了するPromise
|
|
491
491
|
*/
|
|
492
492
|
static async reset(t) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
y.clearValues(t), await Promise.all([
|
|
494
|
+
y.clearMessages(t),
|
|
495
|
+
y.clearEachClones(t)
|
|
496
496
|
]), await P.enqueue(() => {
|
|
497
497
|
const e = t.getTarget();
|
|
498
498
|
if (e instanceof HTMLFormElement)
|
|
@@ -514,9 +514,9 @@ class b {
|
|
|
514
514
|
*/
|
|
515
515
|
static clearEachClones(t) {
|
|
516
516
|
const e = [], r = (n) => {
|
|
517
|
-
if (n.hasAttribute(`${
|
|
517
|
+
if (n.hasAttribute(`${l.prefix}each`))
|
|
518
518
|
for (const s of n.getChildElementFragments()) {
|
|
519
|
-
const a = s.hasAttribute(`${
|
|
519
|
+
const a = s.hasAttribute(`${l.prefix}each-before`), o = s.hasAttribute(`${l.prefix}each-after`);
|
|
520
520
|
!a && !o && e.push(s.remove());
|
|
521
521
|
}
|
|
522
522
|
}, i = (n) => {
|
|
@@ -538,7 +538,7 @@ class b {
|
|
|
538
538
|
static clearValues(t) {
|
|
539
539
|
t.clearValue();
|
|
540
540
|
for (const e of t.getChildElementFragments())
|
|
541
|
-
|
|
541
|
+
y.clearValues(e);
|
|
542
542
|
}
|
|
543
543
|
/**
|
|
544
544
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -561,7 +561,7 @@ class b {
|
|
|
561
561
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
562
562
|
*/
|
|
563
563
|
static addErrorMessage(t, e, r) {
|
|
564
|
-
return
|
|
564
|
+
return y.addMessage(t, e, r, "error");
|
|
565
565
|
}
|
|
566
566
|
/**
|
|
567
567
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -574,10 +574,10 @@ class b {
|
|
|
574
574
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
575
575
|
*/
|
|
576
576
|
static addMessage(t, e, r, i) {
|
|
577
|
-
const n = [], s = et(), a = s.addMessage, o = (m) => typeof a == "function" ? a.call(s, m, r, i) : s.addErrorMessage(m, r),
|
|
578
|
-
return
|
|
577
|
+
const n = [], s = et(), a = s.addMessage, o = (m) => typeof a == "function" ? a.call(s, m, r, i) : s.addErrorMessage(m, r), h = y.findFragmentsByKey(t, e);
|
|
578
|
+
return h.forEach((m) => {
|
|
579
579
|
n.push(o(m.getTarget()));
|
|
580
|
-
}),
|
|
580
|
+
}), h.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
@@ -588,7 +588,7 @@ class b {
|
|
|
588
588
|
* @returns 一致するフラグメントの配列
|
|
589
589
|
*/
|
|
590
590
|
static findFragmentsByKey(t, e) {
|
|
591
|
-
return
|
|
591
|
+
return y.findFragmentByKeyParts(t, e.split("."));
|
|
592
592
|
}
|
|
593
593
|
/**
|
|
594
594
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -600,23 +600,23 @@ class b {
|
|
|
600
600
|
*/
|
|
601
601
|
static findFragmentByKeyParts(t, e) {
|
|
602
602
|
const r = [], i = e[0];
|
|
603
|
-
if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${
|
|
604
|
-
e.length > 1 && t.getAttribute(`${
|
|
605
|
-
r.push(...
|
|
603
|
+
if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
|
|
604
|
+
e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
|
|
605
|
+
r.push(...y.findFragmentByKeyParts(s, e.slice(1)));
|
|
606
606
|
});
|
|
607
|
-
else if (t.hasAttribute(`${
|
|
607
|
+
else if (t.hasAttribute(`${l.prefix}form-list`)) {
|
|
608
608
|
if (e.length > 1) {
|
|
609
|
-
const n = t.getAttribute(`${
|
|
609
|
+
const n = t.getAttribute(`${l.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
|
|
610
610
|
if (s !== -1 && a !== -1 && s < a) {
|
|
611
611
|
const o = i.substring(0, s);
|
|
612
612
|
if (n === o) {
|
|
613
|
-
const
|
|
613
|
+
const h = i.substring(s + 1, a), m = Number(h);
|
|
614
614
|
if (isNaN(m))
|
|
615
615
|
d.error("Haori", `Invalid index: ${i}`);
|
|
616
616
|
else {
|
|
617
|
-
const
|
|
618
|
-
m <
|
|
619
|
-
...
|
|
617
|
+
const b = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
|
|
618
|
+
m < b.length && r.push(
|
|
619
|
+
...y.findFragmentByKeyParts(b[m], e.slice(1))
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
@@ -624,7 +624,7 @@ class b {
|
|
|
624
624
|
}
|
|
625
625
|
} else
|
|
626
626
|
t.getChildElementFragments().forEach((n) => {
|
|
627
|
-
r.push(...
|
|
627
|
+
r.push(...y.findFragmentByKeyParts(n, e));
|
|
628
628
|
});
|
|
629
629
|
return r;
|
|
630
630
|
}
|
|
@@ -753,8 +753,15 @@ return (${t});`;
|
|
|
753
753
|
const r = [];
|
|
754
754
|
let i = null;
|
|
755
755
|
for (let n = 0; n < e.length; n++) {
|
|
756
|
-
const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null;
|
|
757
|
-
if (
|
|
756
|
+
const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, h = e[n - 2] || null, m = e[n - 3] || null;
|
|
757
|
+
if (this.startsObjectKey(
|
|
758
|
+
o,
|
|
759
|
+
i,
|
|
760
|
+
h,
|
|
761
|
+
m
|
|
762
|
+
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
763
|
+
this.decodeStringLiteral(s.value)
|
|
764
|
+
)) || s.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(s.value) || this.STRICT_FORBIDDEN_NAMES.includes(s.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(s.value)) || o === "member" && s.value !== "]" && s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
758
765
|
this.decodeStringLiteral(s.value)
|
|
759
766
|
) || s.value === "." && a?.type !== "identifier" || s.value === "?." && a?.type !== "identifier" && a?.value !== "[" && a?.value !== "(")
|
|
760
767
|
return !1;
|
|
@@ -768,15 +775,23 @@ return (${t});`;
|
|
|
768
775
|
break;
|
|
769
776
|
}
|
|
770
777
|
case "[": {
|
|
771
|
-
const
|
|
772
|
-
r.push(
|
|
778
|
+
const b = this.startsMemberAccess(i) ? "member" : "array";
|
|
779
|
+
r.push(b);
|
|
773
780
|
break;
|
|
774
781
|
}
|
|
782
|
+
case "{":
|
|
783
|
+
r.push("object");
|
|
784
|
+
break;
|
|
775
785
|
case "]": {
|
|
776
786
|
if (r.pop() === void 0)
|
|
777
787
|
return !1;
|
|
778
788
|
break;
|
|
779
789
|
}
|
|
790
|
+
case "}": {
|
|
791
|
+
if (r.pop() !== "object")
|
|
792
|
+
return !1;
|
|
793
|
+
break;
|
|
794
|
+
}
|
|
780
795
|
}
|
|
781
796
|
i = s;
|
|
782
797
|
}
|
|
@@ -804,6 +819,8 @@ return (${t});`;
|
|
|
804
819
|
], i = /* @__PURE__ */ new Set([
|
|
805
820
|
"(",
|
|
806
821
|
")",
|
|
822
|
+
"{",
|
|
823
|
+
"}",
|
|
807
824
|
"[",
|
|
808
825
|
"]",
|
|
809
826
|
".",
|
|
@@ -941,6 +958,16 @@ return (${t});`;
|
|
|
941
958
|
static startsMemberAccess(t) {
|
|
942
959
|
return t === null ? !1 : t.type === "identifier" || t.type === "number" ? !0 : t.value === ")" || t.value === "]" || t.value === "?.";
|
|
943
960
|
}
|
|
961
|
+
/**
|
|
962
|
+
* object literal 内で次のトークンがキー位置かどうかを判定します。
|
|
963
|
+
*
|
|
964
|
+
* @param activeGroup 現在のグループ種別
|
|
965
|
+
* @param previous 直前のトークン
|
|
966
|
+
* @returns object literal のキー位置であれば true
|
|
967
|
+
*/
|
|
968
|
+
static startsObjectKey(t, e, r, i) {
|
|
969
|
+
return t !== "object" ? !1 : e?.value === "{" || e?.value === "," || e?.type === "identifier" && this.OBJECT_PROPERTY_MODIFIERS.has(e.value) && (r?.value === "{" || r?.value === ",") ? !0 : e?.value !== "*" ? !1 : r?.value === "{" || r?.value === "," ? !0 : r?.type === "identifier" && r.value === "async" && (i?.value === "{" || i?.value === ",");
|
|
970
|
+
}
|
|
944
971
|
/**
|
|
945
972
|
* 文字列リテラルをプレーン文字列へ変換します。
|
|
946
973
|
*
|
|
@@ -949,6 +976,9 @@ return (${t});`;
|
|
|
949
976
|
*/
|
|
950
977
|
static decodeStringLiteral(t) {
|
|
951
978
|
return t.slice(1, -1).replace(
|
|
979
|
+
/\\u\{([0-9a-fA-F]+)\}/g,
|
|
980
|
+
(e, r) => String.fromCodePoint(parseInt(r, 16))
|
|
981
|
+
).replace(
|
|
952
982
|
/\\u([0-9a-fA-F]{4})/g,
|
|
953
983
|
(e, r) => String.fromCharCode(parseInt(r, 16))
|
|
954
984
|
).replace(
|
|
@@ -1005,9 +1035,9 @@ return (${t});`;
|
|
|
1005
1035
|
get: (s, a, o) => {
|
|
1006
1036
|
if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
|
|
1007
1037
|
return;
|
|
1008
|
-
const
|
|
1009
|
-
return typeof a == "symbol" ?
|
|
1010
|
-
|
|
1038
|
+
const h = Reflect.get(s, a, o);
|
|
1039
|
+
return typeof a == "symbol" ? h : this.wrapBoundValue(
|
|
1040
|
+
h,
|
|
1011
1041
|
e
|
|
1012
1042
|
);
|
|
1013
1043
|
},
|
|
@@ -1017,12 +1047,12 @@ return (${t});`;
|
|
|
1017
1047
|
return Reflect.getOwnPropertyDescriptor(s, a);
|
|
1018
1048
|
},
|
|
1019
1049
|
apply: (s, a, o) => {
|
|
1020
|
-
const
|
|
1050
|
+
const h = Reflect.apply(
|
|
1021
1051
|
s,
|
|
1022
1052
|
a,
|
|
1023
1053
|
o
|
|
1024
1054
|
);
|
|
1025
|
-
return this.isIteratorLike(
|
|
1055
|
+
return this.isIteratorLike(h) ? h : this.wrapBoundValue(h, e);
|
|
1026
1056
|
},
|
|
1027
1057
|
construct: (s, a, o) => this.wrapBoundValue(
|
|
1028
1058
|
Reflect.construct(
|
|
@@ -1178,6 +1208,10 @@ M.FORBIDDEN_NAMES = [
|
|
|
1178
1208
|
"constructor",
|
|
1179
1209
|
"__proto__",
|
|
1180
1210
|
"prototype"
|
|
1211
|
+
]), M.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
|
|
1212
|
+
"get",
|
|
1213
|
+
"set",
|
|
1214
|
+
"async"
|
|
1181
1215
|
]), M.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
1182
1216
|
"await",
|
|
1183
1217
|
"break",
|
|
@@ -1214,27 +1248,27 @@ M.FORBIDDEN_NAMES = [
|
|
|
1214
1248
|
"yield"
|
|
1215
1249
|
]), M.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
|
|
1216
1250
|
let j = M;
|
|
1217
|
-
const
|
|
1251
|
+
const I = class I {
|
|
1218
1252
|
/**
|
|
1219
1253
|
* フラグメントのコンストラクタ。
|
|
1220
1254
|
*
|
|
1221
1255
|
* @param target 対象ノード
|
|
1222
1256
|
*/
|
|
1223
1257
|
constructor(t) {
|
|
1224
|
-
this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = t,
|
|
1258
|
+
this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = t, I.FRAGMENT_CACHE.set(t, this);
|
|
1225
1259
|
}
|
|
1226
1260
|
static get(t) {
|
|
1227
1261
|
if (t == null)
|
|
1228
1262
|
return null;
|
|
1229
|
-
if (
|
|
1230
|
-
return
|
|
1263
|
+
if (I.FRAGMENT_CACHE.has(t))
|
|
1264
|
+
return I.FRAGMENT_CACHE.get(t);
|
|
1231
1265
|
let e;
|
|
1232
1266
|
switch (t.nodeType) {
|
|
1233
1267
|
case Node.ELEMENT_NODE:
|
|
1234
1268
|
e = new x(t);
|
|
1235
1269
|
break;
|
|
1236
1270
|
case Node.TEXT_NODE:
|
|
1237
|
-
e = new
|
|
1271
|
+
e = new O(t);
|
|
1238
1272
|
break;
|
|
1239
1273
|
case Node.COMMENT_NODE:
|
|
1240
1274
|
e = new Z(t);
|
|
@@ -1318,7 +1352,7 @@ const C = class C {
|
|
|
1318
1352
|
* @return 除去のPromise
|
|
1319
1353
|
*/
|
|
1320
1354
|
remove(t = !0) {
|
|
1321
|
-
return this.parent && this.parent.removeChild(this),
|
|
1355
|
+
return this.parent && this.parent.removeChild(this), I.FRAGMENT_CACHE.delete(this.target), t ? this.unmount() : Promise.resolve();
|
|
1322
1356
|
}
|
|
1323
1357
|
/**
|
|
1324
1358
|
* 対象ノードを取得します。
|
|
@@ -1345,9 +1379,9 @@ const C = class C {
|
|
|
1345
1379
|
this.parent = t;
|
|
1346
1380
|
}
|
|
1347
1381
|
};
|
|
1348
|
-
|
|
1349
|
-
let
|
|
1350
|
-
class x extends
|
|
1382
|
+
I.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
1383
|
+
let w = I;
|
|
1384
|
+
class x extends w {
|
|
1351
1385
|
/**
|
|
1352
1386
|
* エレメントフラグメントのコンストラクタ。
|
|
1353
1387
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -1377,7 +1411,7 @@ class x extends T {
|
|
|
1377
1411
|
this.attributeMap.set(e, i);
|
|
1378
1412
|
}
|
|
1379
1413
|
}), t.childNodes.forEach((e) => {
|
|
1380
|
-
const r =
|
|
1414
|
+
const r = w.get(e);
|
|
1381
1415
|
r.setParent(this), this.children.push(r);
|
|
1382
1416
|
});
|
|
1383
1417
|
}
|
|
@@ -1436,7 +1470,15 @@ class x extends T {
|
|
|
1436
1470
|
}), this.children.forEach((e) => {
|
|
1437
1471
|
const r = e.clone();
|
|
1438
1472
|
t.getTarget().appendChild(r.getTarget()), t.pushChild(r);
|
|
1439
|
-
}), t.mounted = !1, t.bindingData = this.bindingData, t.clearBindingDataCache(), t.visible =
|
|
1473
|
+
}), t.mounted = !1, t.bindingData = this.bindingData, t.clearBindingDataCache(), t.visible = !0, t.display = this.display, t.template = this.template, t.normalizeClonedVisibilityState(), t;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* clone 時に runtime の hidden 状態だけを落とします。
|
|
1477
|
+
*/
|
|
1478
|
+
normalizeClonedVisibilityState() {
|
|
1479
|
+
(this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${l.prefix}if-false`)) && (this.visible = !0, this.display = "", this.getTarget().style.display = "", this.getTarget().removeAttribute(`${l.prefix}if-false`)), this.children.forEach((t) => {
|
|
1480
|
+
t instanceof x && t.normalizeClonedVisibilityState();
|
|
1481
|
+
});
|
|
1440
1482
|
}
|
|
1441
1483
|
/**
|
|
1442
1484
|
* フラグメントとノードを削除します。
|
|
@@ -1714,7 +1756,7 @@ class x extends T {
|
|
|
1714
1756
|
if (e === void 0)
|
|
1715
1757
|
return null;
|
|
1716
1758
|
const r = e.evaluate(this.getBindingData());
|
|
1717
|
-
return r.length === 1 ? r[0] :
|
|
1759
|
+
return r.length === 1 ? r[0] : $.joinEvaluateResults(r);
|
|
1718
1760
|
}
|
|
1719
1761
|
/**
|
|
1720
1762
|
* 属性の生の値を取得します。
|
|
@@ -1757,7 +1799,7 @@ class x extends T {
|
|
|
1757
1799
|
const i = e ? r.nextSibling : r;
|
|
1758
1800
|
let n = e ? r.nextSibling : r;
|
|
1759
1801
|
for (; n !== null; ) {
|
|
1760
|
-
const s =
|
|
1802
|
+
const s = w.get(n);
|
|
1761
1803
|
if (s !== null) {
|
|
1762
1804
|
const a = this.children.indexOf(s);
|
|
1763
1805
|
if (a !== -1)
|
|
@@ -1789,8 +1831,8 @@ class x extends T {
|
|
|
1789
1831
|
const s = t.getParent() === this;
|
|
1790
1832
|
let a = -1, o = -1;
|
|
1791
1833
|
s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1834
|
+
const h = t.getParent();
|
|
1835
|
+
h !== null && h.removeChild(t);
|
|
1794
1836
|
let m = r === void 0 ? e?.getTarget() || null : r;
|
|
1795
1837
|
if (e === null)
|
|
1796
1838
|
this.children.push(t);
|
|
@@ -1810,11 +1852,11 @@ class x extends T {
|
|
|
1810
1852
|
this.children.splice(E, 0, t);
|
|
1811
1853
|
}
|
|
1812
1854
|
t.setParent(this), t.setMounted(this.mounted);
|
|
1813
|
-
const
|
|
1855
|
+
const b = this.skipMutationNodes;
|
|
1814
1856
|
return this.skipMutationNodes = !0, P.enqueue(() => {
|
|
1815
1857
|
this.target.insertBefore(t.getTarget(), m);
|
|
1816
1858
|
}).finally(() => {
|
|
1817
|
-
this.skipMutationNodes =
|
|
1859
|
+
this.skipMutationNodes = b;
|
|
1818
1860
|
});
|
|
1819
1861
|
}
|
|
1820
1862
|
/**
|
|
@@ -1885,7 +1927,7 @@ class x extends T {
|
|
|
1885
1927
|
* @returns エレメントの非表示のPromise
|
|
1886
1928
|
*/
|
|
1887
1929
|
hide() {
|
|
1888
|
-
return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${
|
|
1930
|
+
return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${l.prefix}if-false`, ""), Promise.resolve();
|
|
1889
1931
|
}
|
|
1890
1932
|
/**
|
|
1891
1933
|
* エレメントを表示します。
|
|
@@ -1893,7 +1935,7 @@ class x extends T {
|
|
|
1893
1935
|
* @return エレメントの表示のPromise
|
|
1894
1936
|
*/
|
|
1895
1937
|
show() {
|
|
1896
|
-
return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${
|
|
1938
|
+
return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${l.prefix}if-false`), this.visible = !0, Promise.resolve();
|
|
1897
1939
|
}
|
|
1898
1940
|
/**
|
|
1899
1941
|
* 指定した属性名を持つ最も近い親要素を返します。
|
|
@@ -1909,7 +1951,7 @@ class x extends T {
|
|
|
1909
1951
|
return e === null ? null : e.closestByAttribute(t);
|
|
1910
1952
|
}
|
|
1911
1953
|
}
|
|
1912
|
-
class
|
|
1954
|
+
class O extends w {
|
|
1913
1955
|
/**
|
|
1914
1956
|
* テキストフラグメントのコンストラクタ。
|
|
1915
1957
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -1917,7 +1959,7 @@ class H extends T {
|
|
|
1917
1959
|
* @param target 対象テキストノード
|
|
1918
1960
|
*/
|
|
1919
1961
|
constructor(t) {
|
|
1920
|
-
super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new
|
|
1962
|
+
super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new $(this.text);
|
|
1921
1963
|
}
|
|
1922
1964
|
/**
|
|
1923
1965
|
* フラグメントをクローンします。
|
|
@@ -1925,7 +1967,7 @@ class H extends T {
|
|
|
1925
1967
|
* @returns クローンされたフラグメント
|
|
1926
1968
|
*/
|
|
1927
1969
|
clone() {
|
|
1928
|
-
const t = new
|
|
1970
|
+
const t = new O(this.target.cloneNode(!0));
|
|
1929
1971
|
return t.mounted = !1, t.text = this.text, t.contents = this.contents, t;
|
|
1930
1972
|
}
|
|
1931
1973
|
/**
|
|
@@ -1943,7 +1985,7 @@ class H extends T {
|
|
|
1943
1985
|
* @returns 更新のPromise
|
|
1944
1986
|
*/
|
|
1945
1987
|
setContent(t) {
|
|
1946
|
-
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new
|
|
1988
|
+
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new $(t), this.evaluate());
|
|
1947
1989
|
}
|
|
1948
1990
|
/**
|
|
1949
1991
|
* フラグメントを評価します。
|
|
@@ -1956,7 +1998,7 @@ class H extends T {
|
|
|
1956
1998
|
) : P.enqueue(() => {
|
|
1957
1999
|
this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
|
|
1958
2000
|
this.parent.getBindingData()
|
|
1959
|
-
)[0] : this.contents.isEvaluate ? this.target.textContent =
|
|
2001
|
+
)[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
|
|
1960
2002
|
this.contents.evaluate(this.parent.getBindingData())
|
|
1961
2003
|
) : this.target.textContent = this.text;
|
|
1962
2004
|
}).finally(() => {
|
|
@@ -1964,7 +2006,7 @@ class H extends T {
|
|
|
1964
2006
|
});
|
|
1965
2007
|
}
|
|
1966
2008
|
}
|
|
1967
|
-
class Z extends
|
|
2009
|
+
class Z extends w {
|
|
1968
2010
|
/**
|
|
1969
2011
|
* コメントフラグメントのコンストラクタ。
|
|
1970
2012
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -2089,8 +2131,8 @@ const K = class K {
|
|
|
2089
2131
|
}
|
|
2090
2132
|
};
|
|
2091
2133
|
K.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
|
|
2092
|
-
let
|
|
2093
|
-
const G = class G extends
|
|
2134
|
+
let $ = K;
|
|
2135
|
+
const G = class G extends $ {
|
|
2094
2136
|
/**
|
|
2095
2137
|
* コンストラクタ。
|
|
2096
2138
|
*
|
|
@@ -2146,7 +2188,7 @@ G.FORCE_EVALUATION_ATTRIBUTES = [
|
|
|
2146
2188
|
"hor-each"
|
|
2147
2189
|
];
|
|
2148
2190
|
let U = G;
|
|
2149
|
-
class
|
|
2191
|
+
class T {
|
|
2150
2192
|
/**
|
|
2151
2193
|
* カスタムイベントを発火します。
|
|
2152
2194
|
*
|
|
@@ -2170,7 +2212,7 @@ class w {
|
|
|
2170
2212
|
* @param version ライブラリバージョン
|
|
2171
2213
|
*/
|
|
2172
2214
|
static ready(t) {
|
|
2173
|
-
|
|
2215
|
+
T.dispatch(document, "ready", { version: t });
|
|
2174
2216
|
}
|
|
2175
2217
|
/**
|
|
2176
2218
|
* renderイベントを発火します。
|
|
@@ -2178,7 +2220,7 @@ class w {
|
|
|
2178
2220
|
* @param target 評価対象要素
|
|
2179
2221
|
*/
|
|
2180
2222
|
static render(t) {
|
|
2181
|
-
|
|
2223
|
+
T.dispatch(t, "render", { target: t });
|
|
2182
2224
|
}
|
|
2183
2225
|
/**
|
|
2184
2226
|
* importstartイベントを発火します。
|
|
@@ -2187,7 +2229,7 @@ class w {
|
|
|
2187
2229
|
* @param url インポート対象URL
|
|
2188
2230
|
*/
|
|
2189
2231
|
static importStart(t, e) {
|
|
2190
|
-
|
|
2232
|
+
T.dispatch(t, "importstart", {
|
|
2191
2233
|
url: e,
|
|
2192
2234
|
startedAt: performance.now()
|
|
2193
2235
|
});
|
|
@@ -2201,7 +2243,7 @@ class w {
|
|
|
2201
2243
|
* @param startedAt 開始時刻
|
|
2202
2244
|
*/
|
|
2203
2245
|
static importEnd(t, e, r, i) {
|
|
2204
|
-
|
|
2246
|
+
T.dispatch(t, "importend", {
|
|
2205
2247
|
url: e,
|
|
2206
2248
|
bytes: r,
|
|
2207
2249
|
durationMs: performance.now() - i
|
|
@@ -2215,7 +2257,7 @@ class w {
|
|
|
2215
2257
|
* @param error エラー内容
|
|
2216
2258
|
*/
|
|
2217
2259
|
static importError(t, e, r) {
|
|
2218
|
-
|
|
2260
|
+
T.dispatch(t, "importerror", { url: e, error: r });
|
|
2219
2261
|
}
|
|
2220
2262
|
/**
|
|
2221
2263
|
* bindchangeイベントを発火します。
|
|
@@ -2227,11 +2269,11 @@ class w {
|
|
|
2227
2269
|
*/
|
|
2228
2270
|
static bindChange(t, e, r, i = "other") {
|
|
2229
2271
|
const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
2230
|
-
for (const
|
|
2231
|
-
const m = e?.[
|
|
2232
|
-
m !==
|
|
2272
|
+
for (const h of o) {
|
|
2273
|
+
const m = e?.[h], b = r[h];
|
|
2274
|
+
m !== b && n.push(h);
|
|
2233
2275
|
}
|
|
2234
|
-
|
|
2276
|
+
T.dispatch(t, "bindchange", {
|
|
2235
2277
|
previous: e || {},
|
|
2236
2278
|
next: r,
|
|
2237
2279
|
changedKeys: n,
|
|
@@ -2247,7 +2289,7 @@ class w {
|
|
|
2247
2289
|
* @param order 現在の順序
|
|
2248
2290
|
*/
|
|
2249
2291
|
static eachUpdate(t, e, r, i) {
|
|
2250
|
-
|
|
2292
|
+
T.dispatch(t, "eachupdate", {
|
|
2251
2293
|
added: e,
|
|
2252
2294
|
removed: r,
|
|
2253
2295
|
order: i,
|
|
@@ -2263,7 +2305,7 @@ class w {
|
|
|
2263
2305
|
* @param item 行データ
|
|
2264
2306
|
*/
|
|
2265
2307
|
static rowAdd(t, e, r, i) {
|
|
2266
|
-
|
|
2308
|
+
T.dispatch(t, "rowadd", { key: e, index: r, item: i });
|
|
2267
2309
|
}
|
|
2268
2310
|
/**
|
|
2269
2311
|
* rowremoveイベントを発火します。
|
|
@@ -2273,7 +2315,7 @@ class w {
|
|
|
2273
2315
|
* @param index インデックス
|
|
2274
2316
|
*/
|
|
2275
2317
|
static rowRemove(t, e, r) {
|
|
2276
|
-
|
|
2318
|
+
T.dispatch(t, "rowremove", { key: e, index: r });
|
|
2277
2319
|
}
|
|
2278
2320
|
/**
|
|
2279
2321
|
* rowmoveイベントを発火します。
|
|
@@ -2284,7 +2326,7 @@ class w {
|
|
|
2284
2326
|
* @param to 移動後インデックス
|
|
2285
2327
|
*/
|
|
2286
2328
|
static rowMove(t, e, r, i) {
|
|
2287
|
-
|
|
2329
|
+
T.dispatch(t, "rowmove", { key: e, from: r, to: i });
|
|
2288
2330
|
}
|
|
2289
2331
|
/**
|
|
2290
2332
|
* showイベントを発火します。
|
|
@@ -2292,7 +2334,7 @@ class w {
|
|
|
2292
2334
|
* @param target data-if要素
|
|
2293
2335
|
*/
|
|
2294
2336
|
static show(t) {
|
|
2295
|
-
|
|
2337
|
+
T.dispatch(t, "show", { visible: !0 });
|
|
2296
2338
|
}
|
|
2297
2339
|
/**
|
|
2298
2340
|
* hideイベントを発火します。
|
|
@@ -2300,7 +2342,7 @@ class w {
|
|
|
2300
2342
|
* @param target data-if要素
|
|
2301
2343
|
*/
|
|
2302
2344
|
static hide(t) {
|
|
2303
|
-
|
|
2345
|
+
T.dispatch(t, "hide", { visible: !1 });
|
|
2304
2346
|
}
|
|
2305
2347
|
/**
|
|
2306
2348
|
* fetchstartイベントを発火します。
|
|
@@ -2313,7 +2355,7 @@ class w {
|
|
|
2313
2355
|
* @return 戻り値はありません。
|
|
2314
2356
|
*/
|
|
2315
2357
|
static fetchStart(t, e, r, i, n) {
|
|
2316
|
-
|
|
2358
|
+
T.dispatch(t, "fetchstart", {
|
|
2317
2359
|
url: e,
|
|
2318
2360
|
options: r || {},
|
|
2319
2361
|
payload: i,
|
|
@@ -2330,7 +2372,7 @@ class w {
|
|
|
2330
2372
|
* @param startedAt 開始時刻
|
|
2331
2373
|
*/
|
|
2332
2374
|
static fetchEnd(t, e, r, i) {
|
|
2333
|
-
|
|
2375
|
+
T.dispatch(t, "fetchend", {
|
|
2334
2376
|
url: e,
|
|
2335
2377
|
status: r,
|
|
2336
2378
|
durationMs: performance.now() - i
|
|
@@ -2346,7 +2388,7 @@ class w {
|
|
|
2346
2388
|
* @param startedAt 開始時刻(存在する場合)
|
|
2347
2389
|
*/
|
|
2348
2390
|
static fetchError(t, e, r, i, n) {
|
|
2349
|
-
|
|
2391
|
+
T.dispatch(t, "fetcherror", {
|
|
2350
2392
|
url: e,
|
|
2351
2393
|
status: i,
|
|
2352
2394
|
error: r,
|
|
@@ -2362,17 +2404,17 @@ const at = [
|
|
|
2362
2404
|
"openDialog",
|
|
2363
2405
|
"toast"
|
|
2364
2406
|
], ot = "__haoriHistoryState__";
|
|
2365
|
-
function
|
|
2407
|
+
function W() {
|
|
2366
2408
|
const t = globalThis.window?.Haori;
|
|
2367
2409
|
return at.every(
|
|
2368
2410
|
(r) => typeof t?.[r] == "function"
|
|
2369
|
-
) ? t :
|
|
2411
|
+
) ? t : X;
|
|
2370
2412
|
}
|
|
2371
2413
|
const lt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
2372
|
-
function
|
|
2414
|
+
function ut(F) {
|
|
2373
2415
|
return lt.has(F.toUpperCase());
|
|
2374
2416
|
}
|
|
2375
|
-
function
|
|
2417
|
+
function ct(F, t) {
|
|
2376
2418
|
for (const [e, r] of Object.entries(t))
|
|
2377
2419
|
r !== void 0 && (r === null ? F.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
|
|
2378
2420
|
F.append(e, String(i));
|
|
@@ -2380,9 +2422,9 @@ function ut(F, t) {
|
|
|
2380
2422
|
}
|
|
2381
2423
|
function ht(F, t) {
|
|
2382
2424
|
const e = new URL(F, window.location.href), r = new URLSearchParams(e.search);
|
|
2383
|
-
return
|
|
2425
|
+
return ct(r, t), e.search = r.toString(), e.toString();
|
|
2384
2426
|
}
|
|
2385
|
-
const
|
|
2427
|
+
const u = class u {
|
|
2386
2428
|
/**
|
|
2387
2429
|
* イベント属性名を正しく生成します。
|
|
2388
2430
|
* 例: ("click", "fetch") => "data-click-fetch"
|
|
@@ -2391,7 +2433,7 @@ const l = class l {
|
|
|
2391
2433
|
* 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
|
|
2392
2434
|
*/
|
|
2393
2435
|
static attrName(t, e, r = !1) {
|
|
2394
|
-
return t ? `${
|
|
2436
|
+
return t ? `${l.prefix}${t}-${e}` : r ? `${l.prefix}fetch-${e}` : `${l.prefix}${e}`;
|
|
2395
2437
|
}
|
|
2396
2438
|
/**
|
|
2397
2439
|
* data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
|
|
@@ -2402,7 +2444,7 @@ const l = class l {
|
|
|
2402
2444
|
*/
|
|
2403
2445
|
static resolveDataParamString(t, e) {
|
|
2404
2446
|
return t.replace(
|
|
2405
|
-
|
|
2447
|
+
u.DATA_PLACEHOLDER_REGEX,
|
|
2406
2448
|
(r, i, n) => {
|
|
2407
2449
|
const s = j.evaluate(
|
|
2408
2450
|
i ?? n ?? "",
|
|
@@ -2459,7 +2501,7 @@ const l = class l {
|
|
|
2459
2501
|
static stringifyJsonTemplateStringContent(t) {
|
|
2460
2502
|
if (t == null || Number.isNaN(t))
|
|
2461
2503
|
return "";
|
|
2462
|
-
const e = typeof t == "object" ?
|
|
2504
|
+
const e = typeof t == "object" ? u.stringifyJsonTemplateValue(t) : String(t);
|
|
2463
2505
|
return JSON.stringify(e).slice(1, -1);
|
|
2464
2506
|
}
|
|
2465
2507
|
/**
|
|
@@ -2471,13 +2513,13 @@ const l = class l {
|
|
|
2471
2513
|
*/
|
|
2472
2514
|
static resolveDataJsonString(t, e) {
|
|
2473
2515
|
return t.replace(
|
|
2474
|
-
|
|
2516
|
+
u.DATA_PLACEHOLDER_REGEX,
|
|
2475
2517
|
(r, i, n, s) => {
|
|
2476
2518
|
const a = j.evaluate(
|
|
2477
2519
|
i ?? n ?? "",
|
|
2478
2520
|
e
|
|
2479
2521
|
);
|
|
2480
|
-
return
|
|
2522
|
+
return u.isJsonStringContext(t, s) ? u.stringifyJsonTemplateStringContent(a) : u.stringifyJsonTemplateValue(a);
|
|
2481
2523
|
}
|
|
2482
2524
|
);
|
|
2483
2525
|
}
|
|
@@ -2495,13 +2537,13 @@ const l = class l {
|
|
|
2495
2537
|
if (typeof i != "string" || r === null)
|
|
2496
2538
|
return null;
|
|
2497
2539
|
const n = r.trim();
|
|
2498
|
-
return
|
|
2499
|
-
|
|
2540
|
+
return u.SINGLE_PLACEHOLDER_REGEX.test(n) ? R.parseDataBind(i) : n.startsWith("{") || n.startsWith("[") ? R.parseDataBind(
|
|
2541
|
+
u.resolveDataJsonString(
|
|
2500
2542
|
r,
|
|
2501
2543
|
t.getBindingData()
|
|
2502
2544
|
)
|
|
2503
2545
|
) : R.parseDataBind(
|
|
2504
|
-
|
|
2546
|
+
u.resolveDataParamString(r, t.getBindingData())
|
|
2505
2547
|
);
|
|
2506
2548
|
}
|
|
2507
2549
|
/**
|
|
@@ -2516,30 +2558,30 @@ const l = class l {
|
|
|
2516
2558
|
targetFragment: t
|
|
2517
2559
|
};
|
|
2518
2560
|
if (e) {
|
|
2519
|
-
if (t.hasAttribute(
|
|
2520
|
-
|
|
2561
|
+
if (t.hasAttribute(u.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(u.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
|
|
2562
|
+
u.attrName(e, "confirm")
|
|
2521
2563
|
).replace(/\\n/g, `
|
|
2522
|
-
`)), t.hasAttribute(
|
|
2564
|
+
`)), t.hasAttribute(u.attrName(e, "data")) && (r.data = u.resolveDataAttribute(
|
|
2523
2565
|
t,
|
|
2524
|
-
|
|
2525
|
-
)), t.hasAttribute(
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2566
|
+
u.attrName(e, "data")
|
|
2567
|
+
)), t.hasAttribute(u.attrName(e, "form"))) {
|
|
2568
|
+
const c = t.getRawAttribute(
|
|
2569
|
+
u.attrName(e, "form")
|
|
2528
2570
|
);
|
|
2529
|
-
if (
|
|
2530
|
-
const f = document.body.querySelector(
|
|
2531
|
-
f !== null ? r.formFragment =
|
|
2532
|
-
|
|
2571
|
+
if (c) {
|
|
2572
|
+
const f = document.body.querySelector(c);
|
|
2573
|
+
f !== null ? r.formFragment = y.getFormFragment(
|
|
2574
|
+
w.get(f)
|
|
2533
2575
|
) : d.error(
|
|
2534
2576
|
"Haori",
|
|
2535
|
-
`Form element not found: ${
|
|
2577
|
+
`Form element not found: ${c} (${u.attrName(e, "form")})`
|
|
2536
2578
|
);
|
|
2537
2579
|
} else
|
|
2538
|
-
r.formFragment =
|
|
2539
|
-
} else e === "change" && (r.formFragment =
|
|
2540
|
-
if (t.hasAttribute(`${
|
|
2541
|
-
const
|
|
2542
|
-
`${
|
|
2580
|
+
r.formFragment = y.getFormFragment(t);
|
|
2581
|
+
} else e === "change" && (r.formFragment = y.getFormFragment(t));
|
|
2582
|
+
if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
|
|
2583
|
+
const c = t.getRawAttribute(
|
|
2584
|
+
`${l.prefix}${e}-before-run`
|
|
2543
2585
|
);
|
|
2544
2586
|
try {
|
|
2545
2587
|
r.beforeCallback = new Function(
|
|
@@ -2547,7 +2589,7 @@ const l = class l {
|
|
|
2547
2589
|
"fetchOptions",
|
|
2548
2590
|
`
|
|
2549
2591
|
"use strict";
|
|
2550
|
-
${
|
|
2592
|
+
${c}
|
|
2551
2593
|
`
|
|
2552
2594
|
);
|
|
2553
2595
|
} catch (f) {
|
|
@@ -2555,25 +2597,25 @@ ${h}
|
|
|
2555
2597
|
}
|
|
2556
2598
|
}
|
|
2557
2599
|
}
|
|
2558
|
-
const i =
|
|
2600
|
+
const i = u.attrName(e, "fetch"), n = t.hasAttribute(i);
|
|
2559
2601
|
n && (r.fetchUrl = t.getAttribute(i));
|
|
2560
2602
|
const s = {};
|
|
2561
2603
|
if (e) {
|
|
2562
|
-
const
|
|
2563
|
-
t.hasAttribute(
|
|
2564
|
-
|
|
2604
|
+
const c = u.attrName(e, "fetch-method");
|
|
2605
|
+
t.hasAttribute(c) && (s.method = t.getAttribute(
|
|
2606
|
+
c
|
|
2565
2607
|
));
|
|
2566
2608
|
} else {
|
|
2567
|
-
const
|
|
2568
|
-
t.hasAttribute(
|
|
2569
|
-
|
|
2609
|
+
const c = u.attrName(null, "method", !0);
|
|
2610
|
+
t.hasAttribute(c) && (s.method = t.getAttribute(
|
|
2611
|
+
c
|
|
2570
2612
|
));
|
|
2571
2613
|
}
|
|
2572
2614
|
if (e) {
|
|
2573
|
-
const
|
|
2574
|
-
if (t.hasAttribute(
|
|
2615
|
+
const c = u.attrName(e, "fetch-headers");
|
|
2616
|
+
if (t.hasAttribute(c)) {
|
|
2575
2617
|
const f = t.getRawAttribute(
|
|
2576
|
-
|
|
2618
|
+
c
|
|
2577
2619
|
);
|
|
2578
2620
|
try {
|
|
2579
2621
|
s.headers = R.parseDataBind(f);
|
|
@@ -2582,14 +2624,14 @@ ${h}
|
|
|
2582
2624
|
}
|
|
2583
2625
|
}
|
|
2584
2626
|
} else {
|
|
2585
|
-
const
|
|
2627
|
+
const c = u.attrName(
|
|
2586
2628
|
null,
|
|
2587
2629
|
"headers",
|
|
2588
2630
|
!0
|
|
2589
2631
|
);
|
|
2590
|
-
if (t.hasAttribute(
|
|
2632
|
+
if (t.hasAttribute(c)) {
|
|
2591
2633
|
const f = t.getRawAttribute(
|
|
2592
|
-
|
|
2634
|
+
c
|
|
2593
2635
|
);
|
|
2594
2636
|
try {
|
|
2595
2637
|
s.headers = R.parseDataBind(f);
|
|
@@ -2599,14 +2641,14 @@ ${h}
|
|
|
2599
2641
|
}
|
|
2600
2642
|
}
|
|
2601
2643
|
if (e) {
|
|
2602
|
-
const
|
|
2644
|
+
const c = u.attrName(
|
|
2603
2645
|
e,
|
|
2604
2646
|
"fetch-content-type"
|
|
2605
2647
|
);
|
|
2606
|
-
if (t.hasAttribute(
|
|
2648
|
+
if (t.hasAttribute(c))
|
|
2607
2649
|
s.headers = {
|
|
2608
2650
|
...s.headers,
|
|
2609
|
-
"Content-Type": t.getAttribute(
|
|
2651
|
+
"Content-Type": t.getAttribute(c)
|
|
2610
2652
|
};
|
|
2611
2653
|
else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
|
|
2612
2654
|
let f = !1;
|
|
@@ -2619,15 +2661,15 @@ ${h}
|
|
|
2619
2661
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
2620
2662
|
});
|
|
2621
2663
|
} else {
|
|
2622
|
-
const
|
|
2664
|
+
const c = u.attrName(
|
|
2623
2665
|
null,
|
|
2624
2666
|
"content-type",
|
|
2625
2667
|
!0
|
|
2626
2668
|
);
|
|
2627
|
-
if (t.hasAttribute(
|
|
2669
|
+
if (t.hasAttribute(c))
|
|
2628
2670
|
s.headers = {
|
|
2629
2671
|
...s.headers,
|
|
2630
|
-
"Content-Type": t.getAttribute(
|
|
2672
|
+
"Content-Type": t.getAttribute(c)
|
|
2631
2673
|
};
|
|
2632
2674
|
else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
|
|
2633
2675
|
let f = !1;
|
|
@@ -2641,74 +2683,74 @@ ${h}
|
|
|
2641
2683
|
});
|
|
2642
2684
|
}
|
|
2643
2685
|
Object.keys(s).length > 0 && (r.fetchOptions = s);
|
|
2644
|
-
const a = e ?
|
|
2686
|
+
const a = e ? u.attrName(e, "bind") : u.attrName(null, "bind", !0);
|
|
2645
2687
|
if (t.hasAttribute(a)) {
|
|
2646
|
-
const
|
|
2647
|
-
if (
|
|
2648
|
-
const f = document.body.querySelectorAll(
|
|
2688
|
+
const c = t.getRawAttribute(a);
|
|
2689
|
+
if (c) {
|
|
2690
|
+
const f = document.body.querySelectorAll(c);
|
|
2649
2691
|
f.length > 0 ? (r.bindFragments = [], f.forEach((g) => {
|
|
2650
|
-
const A =
|
|
2692
|
+
const A = w.get(g);
|
|
2651
2693
|
A && r.bindFragments.push(A);
|
|
2652
2694
|
})) : d.error(
|
|
2653
2695
|
"Haori",
|
|
2654
|
-
`Bind element not found: ${
|
|
2696
|
+
`Bind element not found: ${c} (${a})`
|
|
2655
2697
|
);
|
|
2656
2698
|
}
|
|
2657
2699
|
}
|
|
2658
|
-
const o =
|
|
2700
|
+
const o = u.attrName(e, "bind-arg"), h = u.attrName(
|
|
2659
2701
|
null,
|
|
2660
2702
|
"arg",
|
|
2661
2703
|
!0
|
|
2662
|
-
), m =
|
|
2704
|
+
), m = u.attrName(
|
|
2663
2705
|
null,
|
|
2664
2706
|
"bind-arg",
|
|
2665
2707
|
!0
|
|
2666
2708
|
);
|
|
2667
|
-
e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(
|
|
2668
|
-
|
|
2709
|
+
e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(h) ? r.bindArg = t.getRawAttribute(
|
|
2710
|
+
h
|
|
2669
2711
|
) : t.hasAttribute(m) && (r.bindArg = t.getRawAttribute(m));
|
|
2670
|
-
const
|
|
2671
|
-
if (t.hasAttribute(
|
|
2672
|
-
const
|
|
2673
|
-
r.bindParams =
|
|
2712
|
+
const b = e ? u.attrName(e, "bind-params") : u.attrName(null, "bind-params", !0);
|
|
2713
|
+
if (t.hasAttribute(b)) {
|
|
2714
|
+
const c = t.getRawAttribute(b);
|
|
2715
|
+
r.bindParams = c.split("&").map((f) => f.trim());
|
|
2674
2716
|
}
|
|
2675
|
-
const E = e ?
|
|
2717
|
+
const E = e ? u.attrName(e, "bind-append") : u.attrName(null, "bind-append", !0);
|
|
2676
2718
|
if (t.hasAttribute(E)) {
|
|
2677
|
-
const
|
|
2678
|
-
r.bindAppendParams =
|
|
2719
|
+
const c = t.getRawAttribute(E);
|
|
2720
|
+
r.bindAppendParams = c.split("&").map((f) => f.trim()).filter(Boolean);
|
|
2679
2721
|
}
|
|
2680
|
-
const S = e ?
|
|
2722
|
+
const S = e ? u.attrName(e, "copy-params") : null;
|
|
2681
2723
|
if (S && t.hasAttribute(S)) {
|
|
2682
|
-
const
|
|
2724
|
+
const c = t.getRawAttribute(
|
|
2683
2725
|
S
|
|
2684
2726
|
);
|
|
2685
|
-
r.copyParams =
|
|
2727
|
+
r.copyParams = c.split("&").map((f) => f.trim()).filter(Boolean);
|
|
2686
2728
|
}
|
|
2687
2729
|
if (e) {
|
|
2688
|
-
if (t.hasAttribute(
|
|
2730
|
+
if (t.hasAttribute(u.attrName(e, "adjust"))) {
|
|
2689
2731
|
const f = t.getRawAttribute(
|
|
2690
|
-
|
|
2732
|
+
u.attrName(e, "adjust")
|
|
2691
2733
|
);
|
|
2692
2734
|
if (f) {
|
|
2693
2735
|
const g = document.body.querySelectorAll(f);
|
|
2694
2736
|
g.length > 0 ? (r.adjustFragments = [], g.forEach((A) => {
|
|
2695
|
-
const v =
|
|
2737
|
+
const v = w.get(A);
|
|
2696
2738
|
v && r.adjustFragments.push(v);
|
|
2697
2739
|
})) : d.error(
|
|
2698
2740
|
"Haori",
|
|
2699
|
-
`Adjust element not found: ${f} (${
|
|
2741
|
+
`Adjust element not found: ${f} (${u.attrName(e, "adjust")})`
|
|
2700
2742
|
);
|
|
2701
2743
|
}
|
|
2702
|
-
if (t.hasAttribute(
|
|
2744
|
+
if (t.hasAttribute(u.attrName(e, "adjust-value"))) {
|
|
2703
2745
|
const g = t.getRawAttribute(
|
|
2704
|
-
|
|
2746
|
+
u.attrName(e, "adjust-value")
|
|
2705
2747
|
), A = Number(g);
|
|
2706
2748
|
isNaN(A) || (r.adjustValue = A);
|
|
2707
2749
|
}
|
|
2708
2750
|
}
|
|
2709
|
-
if (t.hasAttribute(
|
|
2751
|
+
if (t.hasAttribute(u.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(u.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(u.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(u.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${l.prefix}${e}-after-run`)) {
|
|
2710
2752
|
const f = t.getRawAttribute(
|
|
2711
|
-
`${
|
|
2753
|
+
`${l.prefix}${e}-after-run`
|
|
2712
2754
|
);
|
|
2713
2755
|
try {
|
|
2714
2756
|
r.afterCallback = new Function(
|
|
@@ -2722,41 +2764,41 @@ ${f}
|
|
|
2722
2764
|
d.error("Haori", `Invalid after script: ${g}`);
|
|
2723
2765
|
}
|
|
2724
2766
|
}
|
|
2725
|
-
if (t.hasAttribute(
|
|
2726
|
-
|
|
2767
|
+
if (t.hasAttribute(u.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
|
|
2768
|
+
u.attrName(e, "dialog")
|
|
2727
2769
|
).replace(/\\n/g, `
|
|
2728
|
-
`)), t.hasAttribute(
|
|
2770
|
+
`)), t.hasAttribute(u.attrName(e, "toast"))) {
|
|
2729
2771
|
r.toastMessage = t.getAttribute(
|
|
2730
|
-
|
|
2772
|
+
u.attrName(e, "toast")
|
|
2731
2773
|
);
|
|
2732
2774
|
const f = t.getRawAttribute(
|
|
2733
|
-
|
|
2775
|
+
u.attrName(e, "toast-level")
|
|
2734
2776
|
), A = ["info", "warning", "error", "success"].includes(f);
|
|
2735
2777
|
r.toastLevel = A ? f : null;
|
|
2736
2778
|
}
|
|
2737
|
-
if (t.hasAttribute(
|
|
2738
|
-
|
|
2739
|
-
)), t.hasAttribute(
|
|
2740
|
-
|
|
2741
|
-
)), t.hasAttribute(
|
|
2742
|
-
|
|
2743
|
-
)), t.hasAttribute(
|
|
2779
|
+
if (t.hasAttribute(u.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
|
|
2780
|
+
u.attrName(e, "redirect")
|
|
2781
|
+
)), t.hasAttribute(u.attrName(e, "scroll-error")) && (r.scrollOnError = !0), t.hasAttribute(u.attrName(e, "scroll")) && (r.scrollTarget = t.getAttribute(
|
|
2782
|
+
u.attrName(e, "scroll")
|
|
2783
|
+
)), t.hasAttribute(u.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
|
|
2784
|
+
u.attrName(e, "history")
|
|
2785
|
+
)), t.hasAttribute(u.attrName(e, "history-data")) && (r.historyData = u.resolveDataAttribute(
|
|
2744
2786
|
t,
|
|
2745
|
-
|
|
2746
|
-
)), t.hasAttribute(
|
|
2787
|
+
u.attrName(e, "history-data")
|
|
2788
|
+
)), t.hasAttribute(u.attrName(e, "history-form"))) {
|
|
2747
2789
|
const f = t.getRawAttribute(
|
|
2748
|
-
|
|
2790
|
+
u.attrName(e, "history-form")
|
|
2749
2791
|
);
|
|
2750
2792
|
if (f) {
|
|
2751
2793
|
const g = document.body.querySelector(f);
|
|
2752
|
-
g !== null ? r.historyFormFragment =
|
|
2753
|
-
|
|
2794
|
+
g !== null ? r.historyFormFragment = y.getFormFragment(
|
|
2795
|
+
w.get(g)
|
|
2754
2796
|
) : d.error(
|
|
2755
2797
|
"Haori",
|
|
2756
|
-
`Form element not found: ${f} (${
|
|
2798
|
+
`Form element not found: ${f} (${u.attrName(e, "history-form")})`
|
|
2757
2799
|
);
|
|
2758
2800
|
} else
|
|
2759
|
-
r.historyFormFragment =
|
|
2801
|
+
r.historyFormFragment = y.getFormFragment(t);
|
|
2760
2802
|
}
|
|
2761
2803
|
[
|
|
2762
2804
|
"reset",
|
|
@@ -2766,12 +2808,12 @@ ${f}
|
|
|
2766
2808
|
"open",
|
|
2767
2809
|
"close"
|
|
2768
2810
|
].forEach((f) => {
|
|
2769
|
-
const g =
|
|
2811
|
+
const g = u.attrName(e, f);
|
|
2770
2812
|
if (!t.hasAttribute(g))
|
|
2771
2813
|
return;
|
|
2772
2814
|
const A = t.getRawAttribute(g), v = [];
|
|
2773
|
-
if (A ? (document.body.querySelectorAll(A).forEach((
|
|
2774
|
-
const tt =
|
|
2815
|
+
if (A ? (document.body.querySelectorAll(A).forEach((J) => {
|
|
2816
|
+
const tt = w.get(J);
|
|
2775
2817
|
tt && v.push(tt);
|
|
2776
2818
|
}), v.length === 0 && d.error("Haori", `Element not found: ${A} (${g})`)) : v.push(t), v.length > 0)
|
|
2777
2819
|
switch (f) {
|
|
@@ -2796,23 +2838,23 @@ ${f}
|
|
|
2796
2838
|
}
|
|
2797
2839
|
});
|
|
2798
2840
|
}
|
|
2799
|
-
if (!e && (t.hasAttribute(
|
|
2841
|
+
if (!e && (t.hasAttribute(u.attrName(null, "data", !0)) && (r.data = u.resolveDataAttribute(
|
|
2800
2842
|
t,
|
|
2801
|
-
|
|
2802
|
-
)), t.hasAttribute(
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2843
|
+
u.attrName(null, "data", !0)
|
|
2844
|
+
)), t.hasAttribute(u.attrName(null, "form", !0)))) {
|
|
2845
|
+
const c = t.getRawAttribute(
|
|
2846
|
+
u.attrName(null, "form", !0)
|
|
2805
2847
|
);
|
|
2806
|
-
if (
|
|
2807
|
-
const f = document.body.querySelector(
|
|
2808
|
-
f !== null ? r.formFragment =
|
|
2809
|
-
|
|
2848
|
+
if (c) {
|
|
2849
|
+
const f = document.body.querySelector(c);
|
|
2850
|
+
f !== null ? r.formFragment = y.getFormFragment(
|
|
2851
|
+
w.get(f)
|
|
2810
2852
|
) : d.error(
|
|
2811
2853
|
"Haori",
|
|
2812
|
-
`Form element not found: ${
|
|
2854
|
+
`Form element not found: ${c} (${u.attrName(null, "fetch-form", !0)})`
|
|
2813
2855
|
);
|
|
2814
2856
|
} else
|
|
2815
|
-
r.formFragment =
|
|
2857
|
+
r.formFragment = y.getFormFragment(t);
|
|
2816
2858
|
}
|
|
2817
2859
|
return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
|
|
2818
2860
|
}
|
|
@@ -2835,7 +2877,7 @@ ${f}
|
|
|
2835
2877
|
* @param arg2 イベント名
|
|
2836
2878
|
*/
|
|
2837
2879
|
constructor(t, e = null) {
|
|
2838
|
-
|
|
2880
|
+
u.isElementFragment(t) ? this.options = u.buildOptions(t, e) : this.options = t;
|
|
2839
2881
|
}
|
|
2840
2882
|
/**
|
|
2841
2883
|
* 一連の処理を実行します。オプションが空の場合は即座にresolveされます。
|
|
@@ -2876,37 +2918,37 @@ ${f}
|
|
|
2876
2918
|
}
|
|
2877
2919
|
const i = {};
|
|
2878
2920
|
if (this.options.formFragment) {
|
|
2879
|
-
const o =
|
|
2921
|
+
const o = y.getValues(this.options.formFragment);
|
|
2880
2922
|
Object.assign(i, o);
|
|
2881
2923
|
}
|
|
2882
2924
|
this.options.data && typeof this.options.data == "object" && Object.assign(i, this.options.data);
|
|
2883
2925
|
const n = Object.keys(i).length > 0;
|
|
2884
2926
|
if (e) {
|
|
2885
|
-
const o = { ...r || {} },
|
|
2927
|
+
const o = { ...r || {} }, h = new Headers(
|
|
2886
2928
|
o.headers || void 0
|
|
2887
|
-
), m = (o.method || "GET").toUpperCase(),
|
|
2929
|
+
), m = (o.method || "GET").toUpperCase(), b = l.runtime === "demo" && !ut(m), E = b ? "GET" : m;
|
|
2888
2930
|
if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
|
|
2889
2931
|
n && (e = ht(e, i));
|
|
2890
2932
|
else if (n) {
|
|
2891
|
-
const
|
|
2892
|
-
if (/multipart\/form-data/i.test(
|
|
2893
|
-
|
|
2933
|
+
const c = h.get("Content-Type") || "";
|
|
2934
|
+
if (/multipart\/form-data/i.test(c)) {
|
|
2935
|
+
h.delete("Content-Type");
|
|
2894
2936
|
const f = new FormData();
|
|
2895
2937
|
for (const [g, A] of Object.entries(i))
|
|
2896
2938
|
A == null ? f.append(g, "") : A instanceof Blob ? f.append(g, A) : Array.isArray(A) ? A.forEach((v) => f.append(g, String(v))) : typeof A == "object" ? f.append(g, JSON.stringify(A)) : f.append(g, String(A));
|
|
2897
2939
|
o.body = f;
|
|
2898
|
-
} else if (/application\/x-www-form-urlencoded/i.test(
|
|
2940
|
+
} else if (/application\/x-www-form-urlencoded/i.test(c)) {
|
|
2899
2941
|
const f = new URLSearchParams();
|
|
2900
2942
|
for (const [g, A] of Object.entries(i))
|
|
2901
2943
|
A !== void 0 && (A === null ? f.append(g, "") : Array.isArray(A) ? A.forEach((v) => f.append(g, String(v))) : typeof A == "object" ? f.append(g, JSON.stringify(A)) : f.append(g, String(A)));
|
|
2902
2944
|
o.body = f;
|
|
2903
2945
|
} else
|
|
2904
|
-
|
|
2946
|
+
h.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
|
|
2905
2947
|
}
|
|
2906
|
-
o.headers =
|
|
2948
|
+
o.headers = h;
|
|
2907
2949
|
let S;
|
|
2908
|
-
if (
|
|
2909
|
-
runtime:
|
|
2950
|
+
if (b && (S = e && new URL(e, window.location.href).search || void 0, h.delete("Content-Type"), d.info("Haori demo fetch normalization", {
|
|
2951
|
+
runtime: l.runtime,
|
|
2910
2952
|
requestedMethod: m,
|
|
2911
2953
|
effectiveMethod: E,
|
|
2912
2954
|
transportMode: "query-get",
|
|
@@ -2914,14 +2956,14 @@ ${f}
|
|
|
2914
2956
|
payload: n ? i : void 0,
|
|
2915
2957
|
queryString: S
|
|
2916
2958
|
})), this.options.targetFragment && e) {
|
|
2917
|
-
const
|
|
2918
|
-
runtime:
|
|
2959
|
+
const c = performance.now(), f = {
|
|
2960
|
+
runtime: l.runtime,
|
|
2919
2961
|
requestedMethod: m,
|
|
2920
2962
|
effectiveMethod: E,
|
|
2921
|
-
transportMode:
|
|
2922
|
-
...
|
|
2963
|
+
transportMode: b ? "query-get" : "http",
|
|
2964
|
+
...b ? { queryString: S } : {}
|
|
2923
2965
|
};
|
|
2924
|
-
return
|
|
2966
|
+
return T.fetchStart(
|
|
2925
2967
|
this.options.targetFragment.getTarget(),
|
|
2926
2968
|
e,
|
|
2927
2969
|
o,
|
|
@@ -2930,25 +2972,25 @@ ${f}
|
|
|
2930
2972
|
), fetch(e, o).then((g) => this.handleFetchResult(
|
|
2931
2973
|
g,
|
|
2932
2974
|
e || void 0,
|
|
2933
|
-
|
|
2975
|
+
c
|
|
2934
2976
|
)).catch((g) => {
|
|
2935
|
-
throw e &&
|
|
2977
|
+
throw e && T.fetchError(
|
|
2936
2978
|
this.options.targetFragment.getTarget(),
|
|
2937
2979
|
e,
|
|
2938
2980
|
g
|
|
2939
2981
|
), g;
|
|
2940
2982
|
});
|
|
2941
2983
|
}
|
|
2942
|
-
return fetch(e, o).then((
|
|
2984
|
+
return fetch(e, o).then((c) => this.handleFetchResult(c, e || void 0));
|
|
2943
2985
|
}
|
|
2944
2986
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && n) {
|
|
2945
|
-
const o = this.options.formFragment,
|
|
2946
|
-
|
|
2947
|
-
`${
|
|
2987
|
+
const o = this.options.formFragment, h = o.getTarget();
|
|
2988
|
+
h.setAttribute(
|
|
2989
|
+
`${l.prefix}bind`,
|
|
2948
2990
|
JSON.stringify(i)
|
|
2949
2991
|
);
|
|
2950
2992
|
const m = o.getBindingData();
|
|
2951
|
-
Object.assign(m, i), await R.setBindingData(
|
|
2993
|
+
Object.assign(m, i), await R.setBindingData(h, m);
|
|
2952
2994
|
}
|
|
2953
2995
|
const s = n ? i : {}, a = new Response(JSON.stringify(s), {
|
|
2954
2996
|
headers: { "Content-Type": "application/json" }
|
|
@@ -2959,16 +3001,16 @@ ${f}
|
|
|
2959
3001
|
* フェッチ後の処理を実行します。
|
|
2960
3002
|
*/
|
|
2961
3003
|
async handleFetchResult(t, e, r) {
|
|
2962
|
-
const i =
|
|
3004
|
+
const i = W();
|
|
2963
3005
|
if (!t.ok)
|
|
2964
|
-
return this.options.targetFragment && e &&
|
|
3006
|
+
return this.options.targetFragment && e && T.fetchError(
|
|
2965
3007
|
this.options.targetFragment.getTarget(),
|
|
2966
3008
|
e,
|
|
2967
3009
|
new Error(`${t.status} ${t.statusText}`),
|
|
2968
3010
|
t.status,
|
|
2969
3011
|
r
|
|
2970
3012
|
), await this.handleFetchError(t), !1;
|
|
2971
|
-
if (this.options.targetFragment && e && r &&
|
|
3013
|
+
if (this.options.targetFragment && e && r && T.fetchEnd(
|
|
2972
3014
|
this.options.targetFragment.getTarget(),
|
|
2973
3015
|
e,
|
|
2974
3016
|
t.status,
|
|
@@ -2983,11 +3025,11 @@ ${f}
|
|
|
2983
3025
|
}
|
|
2984
3026
|
const n = [];
|
|
2985
3027
|
n.push(this.bindResult(t)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
2986
|
-
this.options.resetFragments.map((a) =>
|
|
3028
|
+
this.options.resetFragments.map((a) => y.reset(a))
|
|
2987
3029
|
), await this.copy();
|
|
2988
3030
|
const s = [];
|
|
2989
3031
|
return this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
|
|
2990
|
-
s.push(new
|
|
3032
|
+
s.push(new u(a, null).run());
|
|
2991
3033
|
}), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((a) => {
|
|
2992
3034
|
const o = a.getTarget();
|
|
2993
3035
|
typeof o.click == "function" ? o.click() : o.dispatchEvent(
|
|
@@ -3025,11 +3067,11 @@ ${f}
|
|
|
3025
3067
|
return;
|
|
3026
3068
|
}
|
|
3027
3069
|
const s = (a) => {
|
|
3028
|
-
for (const [o,
|
|
3029
|
-
|
|
3070
|
+
for (const [o, h] of Object.entries(a))
|
|
3071
|
+
h != null && (Array.isArray(h) ? h.forEach((m) => n.searchParams.append(o, String(m))) : typeof h == "object" ? n.searchParams.set(o, JSON.stringify(h)) : n.searchParams.set(o, String(h)));
|
|
3030
3072
|
};
|
|
3031
3073
|
e && s(this.options.historyData), r && s(
|
|
3032
|
-
|
|
3074
|
+
y.getValues(
|
|
3033
3075
|
this.options.historyFormFragment
|
|
3034
3076
|
)
|
|
3035
3077
|
), history.pushState(
|
|
@@ -3046,10 +3088,10 @@ ${f}
|
|
|
3046
3088
|
*/
|
|
3047
3089
|
async handleFetchError(t) {
|
|
3048
3090
|
let e = null;
|
|
3049
|
-
this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e =
|
|
3091
|
+
this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = y.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
3050
3092
|
const r = async (s) => {
|
|
3051
3093
|
const a = e ? e.getTarget() : document.body;
|
|
3052
|
-
await
|
|
3094
|
+
await W().addErrorMessage(a, s);
|
|
3053
3095
|
}, i = () => {
|
|
3054
3096
|
if (!this.options.scrollOnError)
|
|
3055
3097
|
return;
|
|
@@ -3064,18 +3106,18 @@ ${f}
|
|
|
3064
3106
|
for (const o of s.messages)
|
|
3065
3107
|
typeof o == "string" && a.push({ message: o });
|
|
3066
3108
|
if (s.errors && typeof s.errors == "object")
|
|
3067
|
-
for (const [o,
|
|
3068
|
-
Array.isArray(
|
|
3069
|
-
`) }) : typeof
|
|
3109
|
+
for (const [o, h] of Object.entries(s.errors))
|
|
3110
|
+
Array.isArray(h) ? a.push({ key: o, message: h.join(`
|
|
3111
|
+
`) }) : typeof h == "string" ? a.push({ key: o, message: h }) : h != null && a.push({ key: o, message: String(h) });
|
|
3070
3112
|
if (a.length === 0)
|
|
3071
|
-
for (const [o,
|
|
3072
|
-
o === "message" || o === "messages" || o === "errors" || (Array.isArray(
|
|
3073
|
-
`) }) : typeof
|
|
3113
|
+
for (const [o, h] of Object.entries(s))
|
|
3114
|
+
o === "message" || o === "messages" || o === "errors" || (Array.isArray(h) ? a.push({ key: o, message: h.join(`
|
|
3115
|
+
`) }) : typeof h == "string" && a.push({ key: o, message: h }));
|
|
3074
3116
|
}
|
|
3075
3117
|
if (a.length === 0)
|
|
3076
3118
|
return await r(`${t.status} ${t.statusText}`), i(), !1;
|
|
3077
3119
|
for (const o of a)
|
|
3078
|
-
o.key && e ? await
|
|
3120
|
+
o.key && e ? await y.addErrorMessage(e, o.key, o.message) : await r(o.message);
|
|
3079
3121
|
return i(), !1;
|
|
3080
3122
|
} catch {
|
|
3081
3123
|
}
|
|
@@ -3134,7 +3176,7 @@ ${f}
|
|
|
3134
3176
|
*/
|
|
3135
3177
|
confirm() {
|
|
3136
3178
|
const t = this.options.confirmMessage;
|
|
3137
|
-
return t == null ? Promise.resolve(!0) :
|
|
3179
|
+
return t == null ? Promise.resolve(!0) : W().confirm(t);
|
|
3138
3180
|
}
|
|
3139
3181
|
/**
|
|
3140
3182
|
* 結果データを対象のフラグメントにバインドします。
|
|
@@ -3154,11 +3196,11 @@ ${f}
|
|
|
3154
3196
|
this.options.bindFragments.forEach((n) => {
|
|
3155
3197
|
const s = n.getBindingData(), a = this.options.bindArg;
|
|
3156
3198
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
3157
|
-
const o = s[a],
|
|
3199
|
+
const o = s[a], h = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
3158
3200
|
s[a] = this.mergeAppendBindingData(
|
|
3159
3201
|
n,
|
|
3160
3202
|
r,
|
|
3161
|
-
|
|
3203
|
+
h
|
|
3162
3204
|
);
|
|
3163
3205
|
} else
|
|
3164
3206
|
s[a] = r;
|
|
@@ -3219,7 +3261,7 @@ ${f}
|
|
|
3219
3261
|
* copy のコピー元データを取得します。
|
|
3220
3262
|
*/
|
|
3221
3263
|
resolveCopySourceData() {
|
|
3222
|
-
return this.options.formFragment ?
|
|
3264
|
+
return this.options.formFragment ? y.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
|
|
3223
3265
|
}
|
|
3224
3266
|
/**
|
|
3225
3267
|
* copy-params が指定されている場合は対象キーだけ抽出します。
|
|
@@ -3257,7 +3299,7 @@ ${f}
|
|
|
3257
3299
|
if (!this.options.targetFragment)
|
|
3258
3300
|
return d.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
3259
3301
|
const t = this.options.targetFragment.closestByAttribute(
|
|
3260
|
-
`${
|
|
3302
|
+
`${l.prefix}row`
|
|
3261
3303
|
);
|
|
3262
3304
|
return t || (d.error("Haori", "Row fragment not found."), null);
|
|
3263
3305
|
}
|
|
@@ -3275,7 +3317,7 @@ ${f}
|
|
|
3275
3317
|
const e = [], r = t.clone();
|
|
3276
3318
|
return e.push(
|
|
3277
3319
|
t.getParent().insertAfter(r, t)
|
|
3278
|
-
), e.push(R.evaluateAll(r)), e.push(
|
|
3320
|
+
), e.push(R.evaluateAll(r)), e.push(y.reset(r)), Promise.all(e).then(() => {
|
|
3279
3321
|
});
|
|
3280
3322
|
}
|
|
3281
3323
|
/**
|
|
@@ -3290,7 +3332,7 @@ ${f}
|
|
|
3290
3332
|
if (!t)
|
|
3291
3333
|
return Promise.reject(new Error("Row fragment not found."));
|
|
3292
3334
|
const e = t.getParent();
|
|
3293
|
-
return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${
|
|
3335
|
+
return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${l.prefix}each-before`) && !i.hasAttribute(`${l.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
|
|
3294
3336
|
}
|
|
3295
3337
|
/**
|
|
3296
3338
|
* 前の行へ移動します。
|
|
@@ -3327,8 +3369,8 @@ ${f}
|
|
|
3327
3369
|
return r ? r.insertAfter(t, e) : Promise.resolve();
|
|
3328
3370
|
}
|
|
3329
3371
|
};
|
|
3330
|
-
|
|
3331
|
-
let V =
|
|
3372
|
+
u.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, u.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
|
|
3373
|
+
let V = u;
|
|
3332
3374
|
class ft {
|
|
3333
3375
|
/**
|
|
3334
3376
|
* URLのクエリパラメータを取得します。
|
|
@@ -3389,7 +3431,7 @@ const p = class p {
|
|
|
3389
3431
|
*/
|
|
3390
3432
|
static isDeferredAttributeName(t) {
|
|
3391
3433
|
return p.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
3392
|
-
(e) => t === `${
|
|
3434
|
+
(e) => t === `${l.prefix}${e}`
|
|
3393
3435
|
);
|
|
3394
3436
|
}
|
|
3395
3437
|
/**
|
|
@@ -3400,7 +3442,7 @@ const p = class p {
|
|
|
3400
3442
|
*/
|
|
3401
3443
|
static isEvaluateAllExcludedAttributeName(t) {
|
|
3402
3444
|
return p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
3403
|
-
(e) => t === `${
|
|
3445
|
+
(e) => t === `${l.prefix}${e}`
|
|
3404
3446
|
);
|
|
3405
3447
|
}
|
|
3406
3448
|
/**
|
|
@@ -3420,7 +3462,7 @@ const p = class p {
|
|
|
3420
3462
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
3421
3463
|
*/
|
|
3422
3464
|
static getAliasedAttributeName(t) {
|
|
3423
|
-
const e = `${
|
|
3465
|
+
const e = `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
3424
3466
|
return !t.startsWith(e) || t.length <= e.length ? null : t.slice(e.length);
|
|
3425
3467
|
}
|
|
3426
3468
|
/**
|
|
@@ -3431,9 +3473,9 @@ const p = class p {
|
|
|
3431
3473
|
* @returns data-attr-* の内部反映なら true
|
|
3432
3474
|
*/
|
|
3433
3475
|
static isAliasedAttributeReflection(t, e) {
|
|
3434
|
-
const r =
|
|
3476
|
+
const r = w.get(t);
|
|
3435
3477
|
return r instanceof x ? r.hasAttribute(
|
|
3436
|
-
`${
|
|
3478
|
+
`${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
|
|
3437
3479
|
) : !1;
|
|
3438
3480
|
}
|
|
3439
3481
|
/**
|
|
@@ -3461,14 +3503,14 @@ const p = class p {
|
|
|
3461
3503
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
3462
3504
|
*/
|
|
3463
3505
|
static scan(t) {
|
|
3464
|
-
const e =
|
|
3506
|
+
const e = w.get(t);
|
|
3465
3507
|
if (!e)
|
|
3466
3508
|
return Promise.resolve();
|
|
3467
|
-
t.parentNode && (
|
|
3509
|
+
t.parentNode && (w.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
|
|
3468
3510
|
let r = Promise.resolve();
|
|
3469
3511
|
const i = /* @__PURE__ */ new Set();
|
|
3470
3512
|
for (const n of p.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
3471
|
-
const s =
|
|
3513
|
+
const s = l.prefix + n;
|
|
3472
3514
|
e.hasAttribute(s) && (r = r.then(
|
|
3473
3515
|
() => p.setAttribute(
|
|
3474
3516
|
e.getTarget(),
|
|
@@ -3486,7 +3528,7 @@ const p = class p {
|
|
|
3486
3528
|
));
|
|
3487
3529
|
}
|
|
3488
3530
|
for (const n of p.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
3489
|
-
const s =
|
|
3531
|
+
const s = l.prefix + n;
|
|
3490
3532
|
e.hasAttribute(s) && (r = r.then(
|
|
3491
3533
|
() => p.setAttribute(
|
|
3492
3534
|
e.getTarget(),
|
|
@@ -3498,7 +3540,7 @@ const p = class p {
|
|
|
3498
3540
|
return r.then(() => {
|
|
3499
3541
|
const n = [];
|
|
3500
3542
|
return e.getChildren().forEach((s) => {
|
|
3501
|
-
s instanceof x ? n.push(p.scan(s.getTarget())) : s instanceof
|
|
3543
|
+
s instanceof x ? n.push(p.scan(s.getTarget())) : s instanceof O && n.push(p.evaluateText(s));
|
|
3502
3544
|
}), Promise.all(n).then(() => {
|
|
3503
3545
|
});
|
|
3504
3546
|
}).then(() => {
|
|
@@ -3514,52 +3556,52 @@ const p = class p {
|
|
|
3514
3556
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
3515
3557
|
*/
|
|
3516
3558
|
static setAttribute(t, e, r) {
|
|
3517
|
-
const i =
|
|
3559
|
+
const i = w.get(t), n = p.getAliasedAttributeName(e);
|
|
3518
3560
|
if (n !== null)
|
|
3519
3561
|
return r === null ? i.removeAliasedAttribute(e, n) : i.setAliasedAttribute(e, n, r);
|
|
3520
3562
|
const s = [];
|
|
3521
3563
|
switch (e) {
|
|
3522
|
-
case `${
|
|
3564
|
+
case `${l.prefix}bind`: {
|
|
3523
3565
|
r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(p.parseDataBind(r));
|
|
3524
3566
|
break;
|
|
3525
3567
|
}
|
|
3526
|
-
case `${
|
|
3568
|
+
case `${l.prefix}if`:
|
|
3527
3569
|
s.push(p.evaluateIf(i));
|
|
3528
3570
|
break;
|
|
3529
|
-
case `${
|
|
3571
|
+
case `${l.prefix}each`:
|
|
3530
3572
|
s.push(p.evaluateEach(i));
|
|
3531
3573
|
break;
|
|
3532
|
-
case `${
|
|
3574
|
+
case `${l.prefix}fetch`:
|
|
3533
3575
|
s.push(
|
|
3534
3576
|
new V(i, null).run().then(() => {
|
|
3535
3577
|
})
|
|
3536
3578
|
);
|
|
3537
3579
|
break;
|
|
3538
|
-
case `${
|
|
3580
|
+
case `${l.prefix}import`: {
|
|
3539
3581
|
if (typeof r == "string") {
|
|
3540
3582
|
const a = i.getTarget(), o = performance.now();
|
|
3541
|
-
|
|
3542
|
-
dt.load(r).then((
|
|
3543
|
-
const m = new TextEncoder().encode(
|
|
3583
|
+
a.setAttribute(`${l.prefix}importing`, ""), T.importStart(a, r), s.push(
|
|
3584
|
+
dt.load(r).then((h) => {
|
|
3585
|
+
const m = new TextEncoder().encode(h).length;
|
|
3544
3586
|
return P.enqueue(() => {
|
|
3545
|
-
a.innerHTML =
|
|
3587
|
+
a.innerHTML = h;
|
|
3546
3588
|
}).then(() => {
|
|
3547
|
-
|
|
3589
|
+
a.removeAttribute(`${l.prefix}importing`), T.importEnd(a, r, m, o);
|
|
3548
3590
|
});
|
|
3549
|
-
}).catch((
|
|
3550
|
-
|
|
3591
|
+
}).catch((h) => {
|
|
3592
|
+
a.removeAttribute(`${l.prefix}importing`), T.importError(a, r, h), d.error("[Haori]", "Failed to import HTML:", r, h);
|
|
3551
3593
|
})
|
|
3552
3594
|
);
|
|
3553
3595
|
}
|
|
3554
3596
|
break;
|
|
3555
3597
|
}
|
|
3556
|
-
case `${
|
|
3557
|
-
const a = i.getAttribute(`${
|
|
3598
|
+
case `${l.prefix}url-param`: {
|
|
3599
|
+
const a = i.getAttribute(`${l.prefix}url-arg`), o = ft.readParams();
|
|
3558
3600
|
if (a === null)
|
|
3559
3601
|
s.push(p.setBindingData(t, o));
|
|
3560
3602
|
else {
|
|
3561
|
-
const
|
|
3562
|
-
|
|
3603
|
+
const h = i.getRawBindingData() || {};
|
|
3604
|
+
h[String(a)] = o, s.push(p.setBindingData(t, h));
|
|
3563
3605
|
}
|
|
3564
3606
|
break;
|
|
3565
3607
|
}
|
|
@@ -3576,17 +3618,17 @@ const p = class p {
|
|
|
3576
3618
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
3577
3619
|
*/
|
|
3578
3620
|
static setBindingData(t, e) {
|
|
3579
|
-
const r =
|
|
3621
|
+
const r = w.get(t), i = r.getRawBindingData();
|
|
3580
3622
|
r.setBindingData(e);
|
|
3581
3623
|
let n = r.setAttribute(
|
|
3582
|
-
`${
|
|
3624
|
+
`${l.prefix}bind`,
|
|
3583
3625
|
JSON.stringify(e)
|
|
3584
3626
|
);
|
|
3585
3627
|
if (t.tagName === "FORM") {
|
|
3586
|
-
const s = r.getAttribute(`${
|
|
3587
|
-
n = n.then(() =>
|
|
3628
|
+
const s = r.getAttribute(`${l.prefix}form-arg`), a = s && e[String(s)] && typeof e[String(s)] == "object" && !Array.isArray(e[String(s)]) ? e[String(s)] : s ? {} : e;
|
|
3629
|
+
n = n.then(() => y.syncValues(r, a));
|
|
3588
3630
|
}
|
|
3589
|
-
return n = n.then(() => p.evaluateAll(r)),
|
|
3631
|
+
return n = n.then(() => p.evaluateAll(r)), T.bindChange(t, i, e, "manual"), n.then(() => {
|
|
3590
3632
|
});
|
|
3591
3633
|
}
|
|
3592
3634
|
/**
|
|
@@ -3616,11 +3658,11 @@ const p = class p {
|
|
|
3616
3658
|
* @param node 追加するノード
|
|
3617
3659
|
*/
|
|
3618
3660
|
static addNode(t, e) {
|
|
3619
|
-
const r =
|
|
3661
|
+
const r = w.get(t);
|
|
3620
3662
|
if (r.isSkipMutationNodes())
|
|
3621
3663
|
return;
|
|
3622
|
-
const i =
|
|
3623
|
-
n && (r.insertBefore(n, i), n instanceof x ? p.scan(n.getTarget()) : n instanceof
|
|
3664
|
+
const i = w.get(e.nextSibling), n = w.get(e);
|
|
3665
|
+
n && (r.insertBefore(n, i), n instanceof x ? p.scan(n.getTarget()) : n instanceof O && p.evaluateText(n));
|
|
3624
3666
|
}
|
|
3625
3667
|
/**
|
|
3626
3668
|
* ノードを親要素から削除します。
|
|
@@ -3628,7 +3670,7 @@ const p = class p {
|
|
|
3628
3670
|
* @param node 削除するノード
|
|
3629
3671
|
*/
|
|
3630
3672
|
static removeNode(t) {
|
|
3631
|
-
const e =
|
|
3673
|
+
const e = w.get(t);
|
|
3632
3674
|
if (e) {
|
|
3633
3675
|
const r = e.getParent();
|
|
3634
3676
|
if (r && r.isSkipMutationNodes())
|
|
@@ -3643,7 +3685,7 @@ const p = class p {
|
|
|
3643
3685
|
* @param text 新しいテキスト
|
|
3644
3686
|
*/
|
|
3645
3687
|
static changeText(t, e) {
|
|
3646
|
-
const r =
|
|
3688
|
+
const r = w.get(t);
|
|
3647
3689
|
r && r.setContent(e);
|
|
3648
3690
|
}
|
|
3649
3691
|
/**
|
|
@@ -3655,14 +3697,14 @@ const p = class p {
|
|
|
3655
3697
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
3656
3698
|
*/
|
|
3657
3699
|
static changeValue(t, e) {
|
|
3658
|
-
const r =
|
|
3700
|
+
const r = w.get(t);
|
|
3659
3701
|
if (r.getValue() === e)
|
|
3660
3702
|
return Promise.resolve();
|
|
3661
3703
|
const i = [];
|
|
3662
3704
|
i.push(r.setValue(e));
|
|
3663
3705
|
const n = p.getFormFragment(r);
|
|
3664
3706
|
if (n) {
|
|
3665
|
-
const s =
|
|
3707
|
+
const s = y.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`);
|
|
3666
3708
|
let o;
|
|
3667
3709
|
a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(p.setBindingData(n.getTarget(), o));
|
|
3668
3710
|
}
|
|
@@ -3689,14 +3731,14 @@ const p = class p {
|
|
|
3689
3731
|
*/
|
|
3690
3732
|
static evaluateAll(t) {
|
|
3691
3733
|
const e = [];
|
|
3692
|
-
return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${
|
|
3734
|
+
return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${l.prefix}if`) && e.push(p.evaluateIf(t)), t.hasAttribute(`${l.prefix}each`) ? Promise.all(e).then(() => p.evaluateEach(t)).then(() => {
|
|
3693
3735
|
const r = [];
|
|
3694
3736
|
return t.getChildren().forEach((i) => {
|
|
3695
|
-
i instanceof x ? r.push(p.evaluateAll(i)) : i instanceof
|
|
3737
|
+
i instanceof x ? r.push(p.evaluateAll(i)) : i instanceof O && r.push(p.evaluateText(i));
|
|
3696
3738
|
}), Promise.all(r).then(() => {
|
|
3697
3739
|
});
|
|
3698
3740
|
}) : (t.getChildren().forEach((r) => {
|
|
3699
|
-
r instanceof x ? e.push(p.evaluateAll(r)) : r instanceof
|
|
3741
|
+
r instanceof x ? e.push(p.evaluateAll(r)) : r instanceof O && e.push(p.evaluateText(r));
|
|
3700
3742
|
}), Promise.all(e).then(() => {
|
|
3701
3743
|
}));
|
|
3702
3744
|
}
|
|
@@ -3717,16 +3759,25 @@ const p = class p {
|
|
|
3717
3759
|
* @return Promise (DOM操作が完了したときに解決される)
|
|
3718
3760
|
*/
|
|
3719
3761
|
static evaluateIf(t) {
|
|
3720
|
-
const e = [], r = t.getAttribute(`${
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3762
|
+
const e = [], r = t.getAttribute(`${l.prefix}if`);
|
|
3763
|
+
if (r === !1 || r === void 0 || r === null || Number.isNaN(r))
|
|
3764
|
+
e.push(
|
|
3765
|
+
t.hide().then(() => {
|
|
3766
|
+
T.hide(t.getTarget());
|
|
3767
|
+
})
|
|
3768
|
+
);
|
|
3769
|
+
else {
|
|
3770
|
+
const i = [];
|
|
3771
|
+
t.getChildren().forEach((n) => {
|
|
3772
|
+
n instanceof x ? i.push(p.evaluateAll(n)) : n instanceof O && i.push(p.evaluateText(n));
|
|
3773
|
+
}), e.push(
|
|
3774
|
+
t.show().then(() => {
|
|
3775
|
+
T.show(t.getTarget());
|
|
3776
|
+
})
|
|
3777
|
+
), e.push(Promise.all(i).then(() => {
|
|
3778
|
+
}));
|
|
3779
|
+
}
|
|
3780
|
+
return Promise.all(e).then(() => {
|
|
3730
3781
|
});
|
|
3731
3782
|
}
|
|
3732
3783
|
/**
|
|
@@ -3743,17 +3794,17 @@ const p = class p {
|
|
|
3743
3794
|
let i = !1;
|
|
3744
3795
|
t.getChildren().forEach((s) => {
|
|
3745
3796
|
if (!i && s instanceof x) {
|
|
3746
|
-
if (s.hasAttribute(`${
|
|
3797
|
+
if (s.hasAttribute(`${l.prefix}each-before`) || s.hasAttribute(`${l.prefix}each-after`))
|
|
3747
3798
|
return;
|
|
3748
3799
|
e = s.clone(), t.setTemplate(e), i = !0, t.removeChild(s);
|
|
3749
3800
|
const a = s.getTarget();
|
|
3750
3801
|
a.parentNode && a.parentNode.removeChild(a), s.setMounted(!1);
|
|
3751
3802
|
}
|
|
3752
3803
|
});
|
|
3753
|
-
const n = t.getAttribute(`${
|
|
3804
|
+
const n = t.getAttribute(`${l.prefix}each`);
|
|
3754
3805
|
return Array.isArray(n) ? this.updateDiff(t, n) : (d.error("[Haori]", "Invalid each attribute:", n), Promise.reject(new Error("Invalid each attribute.")));
|
|
3755
3806
|
}
|
|
3756
|
-
const r = t.getAttribute(`${
|
|
3807
|
+
const r = t.getAttribute(`${l.prefix}each`);
|
|
3757
3808
|
return Array.isArray(r) ? this.updateDiff(t, r) : (d.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
|
|
3758
3809
|
}
|
|
3759
3810
|
/**
|
|
@@ -3766,26 +3817,26 @@ const p = class p {
|
|
|
3766
3817
|
const r = t.getTemplate();
|
|
3767
3818
|
if (r === null)
|
|
3768
3819
|
return d.error("[Haori]", "Template is not set for each element."), Promise.resolve();
|
|
3769
|
-
let i = t.getAttribute(`${
|
|
3820
|
+
let i = t.getAttribute(`${l.prefix}each-index`);
|
|
3770
3821
|
i && (i = String(i));
|
|
3771
|
-
const n = t.getAttribute(`${
|
|
3772
|
-
e.forEach((
|
|
3822
|
+
const n = t.getAttribute(`${l.prefix}each-key`), s = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
3823
|
+
e.forEach((c, f) => {
|
|
3773
3824
|
const g = p.createListKey(
|
|
3774
|
-
|
|
3825
|
+
c,
|
|
3775
3826
|
n ? String(n) : null,
|
|
3776
3827
|
f
|
|
3777
3828
|
);
|
|
3778
|
-
o.push(g), a.set(g, { item:
|
|
3829
|
+
o.push(g), a.set(g, { item: c, itemIndex: f });
|
|
3779
3830
|
});
|
|
3780
|
-
const
|
|
3781
|
-
let m = t.getChildren().filter((
|
|
3782
|
-
(
|
|
3831
|
+
const h = [];
|
|
3832
|
+
let m = t.getChildren().filter((c) => c instanceof x).filter(
|
|
3833
|
+
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
3783
3834
|
);
|
|
3784
|
-
m = m.filter((
|
|
3785
|
-
const
|
|
3835
|
+
m = m.filter((c) => o.indexOf(String(c.getListKey())) === -1 ? (h.push(c.remove()), !1) : !0);
|
|
3836
|
+
const b = m.map((c) => c.getListKey()), E = t.getChildren().filter((c) => c instanceof x).filter((c) => c.hasAttribute(`${l.prefix}each-before`)).length;
|
|
3786
3837
|
let S = Promise.resolve();
|
|
3787
|
-
return o.forEach((
|
|
3788
|
-
const g =
|
|
3838
|
+
return o.forEach((c, f) => {
|
|
3839
|
+
const g = b.indexOf(c), { item: A, itemIndex: v } = a.get(c);
|
|
3789
3840
|
let k;
|
|
3790
3841
|
if (g !== -1)
|
|
3791
3842
|
k = m[g], S = S.then(
|
|
@@ -3795,12 +3846,12 @@ const p = class p {
|
|
|
3795
3846
|
i,
|
|
3796
3847
|
v,
|
|
3797
3848
|
s ? String(s) : null,
|
|
3798
|
-
|
|
3799
|
-
).then(() => p.evaluateAll(k))
|
|
3849
|
+
c
|
|
3850
|
+
).then(() => p.evaluateAll(k)).then(() => p.scheduleEvaluateAll(k))
|
|
3800
3851
|
);
|
|
3801
3852
|
else {
|
|
3802
3853
|
k = r.clone();
|
|
3803
|
-
const
|
|
3854
|
+
const J = E + f;
|
|
3804
3855
|
S = S.then(
|
|
3805
3856
|
() => p.updateRowFragment(
|
|
3806
3857
|
k,
|
|
@@ -3808,30 +3859,30 @@ const p = class p {
|
|
|
3808
3859
|
i,
|
|
3809
3860
|
v,
|
|
3810
3861
|
s ? String(s) : null,
|
|
3811
|
-
|
|
3862
|
+
c
|
|
3812
3863
|
).then(
|
|
3813
3864
|
() => t.insertBefore(
|
|
3814
3865
|
k,
|
|
3815
|
-
t.getChildren()[
|
|
3816
|
-
).then(() => p.evaluateAll(k))
|
|
3866
|
+
t.getChildren()[J] || null
|
|
3867
|
+
).then(() => p.evaluateAll(k)).then(() => p.scheduleEvaluateAll(k))
|
|
3817
3868
|
)
|
|
3818
3869
|
);
|
|
3819
3870
|
}
|
|
3820
|
-
}), Promise.all(
|
|
3821
|
-
const
|
|
3871
|
+
}), Promise.all(h).then(() => S).then(() => {
|
|
3872
|
+
const c = o.filter(
|
|
3822
3873
|
(v) => v !== null
|
|
3823
|
-
), f =
|
|
3874
|
+
), f = b.filter(
|
|
3824
3875
|
(v) => v !== null
|
|
3825
|
-
), g =
|
|
3876
|
+
), g = c.filter(
|
|
3826
3877
|
(v) => !f.includes(v)
|
|
3827
3878
|
), A = f.filter(
|
|
3828
|
-
(v) => !
|
|
3879
|
+
(v) => !c.includes(v)
|
|
3829
3880
|
);
|
|
3830
|
-
|
|
3881
|
+
T.eachUpdate(
|
|
3831
3882
|
t.getTarget(),
|
|
3832
3883
|
g,
|
|
3833
3884
|
A,
|
|
3834
|
-
|
|
3885
|
+
c
|
|
3835
3886
|
);
|
|
3836
3887
|
});
|
|
3837
3888
|
}
|
|
@@ -3879,9 +3930,19 @@ const p = class p {
|
|
|
3879
3930
|
else
|
|
3880
3931
|
return d.error(
|
|
3881
3932
|
"[Haori]",
|
|
3882
|
-
`Primitive value requires '${
|
|
3933
|
+
`Primitive value requires '${l.prefix}each-arg' attribute: ${e}`
|
|
3883
3934
|
), Promise.resolve();
|
|
3884
|
-
return t.setListKey(s), t.setBindingData(a), t.setAttribute(`${
|
|
3935
|
+
return t.setListKey(s), t.setBindingData(a), t.setAttribute(`${l.prefix}row`, s);
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* フラグメントの再評価を次のイベントループで実行します。
|
|
3939
|
+
*
|
|
3940
|
+
* @param fragment 再評価対象のフラグメント
|
|
3941
|
+
*/
|
|
3942
|
+
static scheduleEvaluateAll(t) {
|
|
3943
|
+
setTimeout(() => {
|
|
3944
|
+
p.evaluateAll(t);
|
|
3945
|
+
}, 100);
|
|
3885
3946
|
}
|
|
3886
3947
|
};
|
|
3887
3948
|
p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if", "each"], p.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch", "url-param"], p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
|
|
@@ -3893,7 +3954,7 @@ p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if
|
|
|
3893
3954
|
"url-param"
|
|
3894
3955
|
], p.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;
|
|
3895
3956
|
let R = p;
|
|
3896
|
-
const
|
|
3957
|
+
const Y = class Y {
|
|
3897
3958
|
/**
|
|
3898
3959
|
* コンストラクタ。
|
|
3899
3960
|
*
|
|
@@ -3901,11 +3962,11 @@ const X = class X {
|
|
|
3901
3962
|
*/
|
|
3902
3963
|
constructor(t = document) {
|
|
3903
3964
|
this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
|
|
3904
|
-
const e = document.documentElement, r =
|
|
3965
|
+
const e = document.documentElement, r = w.get(e);
|
|
3905
3966
|
r && new V(r, "load").run();
|
|
3906
3967
|
}, this.onPopstate = (e) => {
|
|
3907
3968
|
const r = e.state;
|
|
3908
|
-
!r || r[
|
|
3969
|
+
!r || r[Y.HISTORY_STATE_KEY] !== !0 || location.reload();
|
|
3909
3970
|
}, this.root = t;
|
|
3910
3971
|
}
|
|
3911
3972
|
/**
|
|
@@ -3931,7 +3992,7 @@ const X = class X {
|
|
|
3931
3992
|
const r = this.getElementFromTarget(t.target);
|
|
3932
3993
|
if (!r)
|
|
3933
3994
|
return;
|
|
3934
|
-
const i =
|
|
3995
|
+
const i = w.get(r);
|
|
3935
3996
|
i && (e === "change" && i instanceof x && i.syncValue(), new V(i, e).run().catch((n) => {
|
|
3936
3997
|
d.error("[Haori]", "Procedure execution error:", n);
|
|
3937
3998
|
}));
|
|
@@ -3946,8 +4007,8 @@ const X = class X {
|
|
|
3946
4007
|
return t ? t instanceof HTMLElement ? t : t instanceof Node ? t.parentElement : null : null;
|
|
3947
4008
|
}
|
|
3948
4009
|
};
|
|
3949
|
-
|
|
3950
|
-
let Q =
|
|
4010
|
+
Y.HISTORY_STATE_KEY = "__haoriHistoryState__";
|
|
4011
|
+
let Q = Y;
|
|
3951
4012
|
const N = class N {
|
|
3952
4013
|
static syncTree(t) {
|
|
3953
4014
|
(t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement && N.syncElement(t), t.querySelectorAll("*").forEach((e) => {
|
|
@@ -3955,14 +4016,14 @@ const N = class N {
|
|
|
3955
4016
|
}));
|
|
3956
4017
|
}
|
|
3957
4018
|
static syncElement(t) {
|
|
3958
|
-
const e = N.registrations.get(t), r =
|
|
4019
|
+
const e = N.registrations.get(t), r = w.get(t);
|
|
3959
4020
|
if (!r || !N.shouldObserve(r)) {
|
|
3960
4021
|
e && (e.observer.disconnect(), N.registrations.delete(t));
|
|
3961
4022
|
return;
|
|
3962
4023
|
}
|
|
3963
4024
|
if (typeof IntersectionObserver > "u")
|
|
3964
4025
|
return;
|
|
3965
|
-
const i = N.resolveRoot(r), n = N.resolveRootMargin(r), s = N.resolveThreshold(r), a = r.hasAttribute(`${
|
|
4026
|
+
const i = N.resolveRoot(r), n = N.resolveRootMargin(r), s = N.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
3966
4027
|
if (e && e.observer.root === i && e.observer.rootMargin === n && N.sameThreshold(
|
|
3967
4028
|
e.observer.thresholds,
|
|
3968
4029
|
s
|
|
@@ -3972,10 +4033,10 @@ const N = class N {
|
|
|
3972
4033
|
}
|
|
3973
4034
|
e && (e.observer.disconnect(), N.registrations.delete(t));
|
|
3974
4035
|
const o = new IntersectionObserver(
|
|
3975
|
-
(
|
|
4036
|
+
(h) => {
|
|
3976
4037
|
const m = N.registrations.get(t);
|
|
3977
|
-
m &&
|
|
3978
|
-
!
|
|
4038
|
+
m && h.forEach((b) => {
|
|
4039
|
+
!b.isIntersecting || m.running || N.isDisabled(m.fragment) || (m.running = !0, new V(m.fragment, "intersect").runWithResult().then((E) => {
|
|
3979
4040
|
E && m.once && (m.observer.disconnect(), N.registrations.delete(t));
|
|
3980
4041
|
}).catch((E) => {
|
|
3981
4042
|
d.error(
|
|
@@ -4019,14 +4080,14 @@ const N = class N {
|
|
|
4019
4080
|
}
|
|
4020
4081
|
static shouldObserve(t) {
|
|
4021
4082
|
return t.getAttributeNames().some((e) => {
|
|
4022
|
-
if (!e.startsWith(`${
|
|
4083
|
+
if (!e.startsWith(`${l.prefix}intersect-`))
|
|
4023
4084
|
return !1;
|
|
4024
|
-
const r = e.slice(`${
|
|
4085
|
+
const r = e.slice(`${l.prefix}intersect-`.length);
|
|
4025
4086
|
return !N.CONFIG_KEYS.has(r);
|
|
4026
4087
|
});
|
|
4027
4088
|
}
|
|
4028
4089
|
static resolveRoot(t) {
|
|
4029
|
-
const e = `${
|
|
4090
|
+
const e = `${l.prefix}intersect-root`;
|
|
4030
4091
|
if (!t.hasAttribute(e))
|
|
4031
4092
|
return null;
|
|
4032
4093
|
const r = t.getAttribute(e);
|
|
@@ -4036,15 +4097,15 @@ const N = class N {
|
|
|
4036
4097
|
return i instanceof HTMLElement ? i : (d.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
4037
4098
|
}
|
|
4038
4099
|
static resolveRootMargin(t) {
|
|
4039
|
-
const e = `${
|
|
4100
|
+
const e = `${l.prefix}intersect-root-margin`, r = t.getAttribute(e);
|
|
4040
4101
|
return r === null || r === !1 || r === "" ? "0px" : String(r);
|
|
4041
4102
|
}
|
|
4042
4103
|
static resolveThreshold(t) {
|
|
4043
|
-
const e = `${
|
|
4104
|
+
const e = `${l.prefix}intersect-threshold`, r = t.getAttribute(e), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
|
|
4044
4105
|
return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
|
|
4045
4106
|
}
|
|
4046
4107
|
static isDisabled(t) {
|
|
4047
|
-
const e = `${
|
|
4108
|
+
const e = `${l.prefix}intersect-disabled`, r = t.getAttribute(e);
|
|
4048
4109
|
if (r === null || r === !1)
|
|
4049
4110
|
return !1;
|
|
4050
4111
|
if (typeof r == "boolean")
|
|
@@ -4063,21 +4124,21 @@ N.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
4063
4124
|
"disabled",
|
|
4064
4125
|
"once"
|
|
4065
4126
|
]), N.registrations = /* @__PURE__ */ new Map();
|
|
4066
|
-
let
|
|
4067
|
-
const
|
|
4127
|
+
let L = N;
|
|
4128
|
+
const H = class H {
|
|
4068
4129
|
/**
|
|
4069
4130
|
* 初期化メソッド。
|
|
4070
4131
|
* ドキュメントのheadとbodyを監視対象として設定します。
|
|
4071
4132
|
*/
|
|
4072
4133
|
static async init() {
|
|
4073
|
-
if (
|
|
4134
|
+
if (H._initialized)
|
|
4074
4135
|
return;
|
|
4075
|
-
|
|
4136
|
+
H._initialized = !0;
|
|
4076
4137
|
const t = await Promise.allSettled([
|
|
4077
4138
|
R.scan(document.head),
|
|
4078
4139
|
R.scan(document.body)
|
|
4079
4140
|
]), [e, r] = t;
|
|
4080
|
-
e.status !== "fulfilled" && d.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && d.error("[Haori]", "Failed to build body fragment:", r.reason),
|
|
4141
|
+
e.status !== "fulfilled" && d.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && d.error("[Haori]", "Failed to build body fragment:", r.reason), H.observe(document.head), H.observe(document.body), new Q().start(), L.syncTree(document.body);
|
|
4081
4142
|
}
|
|
4082
4143
|
/**
|
|
4083
4144
|
* 指定された要素を監視します。
|
|
@@ -4106,7 +4167,7 @@ const I = class I {
|
|
|
4106
4167
|
n,
|
|
4107
4168
|
i.attributeName,
|
|
4108
4169
|
n.getAttribute(i.attributeName)
|
|
4109
|
-
),
|
|
4170
|
+
), L.syncElement(n);
|
|
4110
4171
|
break;
|
|
4111
4172
|
}
|
|
4112
4173
|
case "childList": {
|
|
@@ -4116,9 +4177,9 @@ const I = class I {
|
|
|
4116
4177
|
Array.from(i.removedNodes).map((n) => n.nodeName),
|
|
4117
4178
|
Array.from(i.addedNodes).map((n) => n.nodeName)
|
|
4118
4179
|
), Array.from(i.removedNodes).forEach((n) => {
|
|
4119
|
-
|
|
4180
|
+
L.cleanupTree(n), R.removeNode(n);
|
|
4120
4181
|
}), Array.from(i.addedNodes).forEach((n) => {
|
|
4121
|
-
n.parentElement instanceof HTMLElement && (R.addNode(n.parentElement, n),
|
|
4182
|
+
n.parentElement instanceof HTMLElement && (R.addNode(n.parentElement, n), L.syncTree(n));
|
|
4122
4183
|
});
|
|
4123
4184
|
break;
|
|
4124
4185
|
}
|
|
@@ -4150,19 +4211,19 @@ const I = class I {
|
|
|
4150
4211
|
}), d.info("[Haori]", "Observer initialized for", t);
|
|
4151
4212
|
}
|
|
4152
4213
|
};
|
|
4153
|
-
|
|
4154
|
-
let q =
|
|
4214
|
+
H._initialized = !1;
|
|
4215
|
+
let q = H;
|
|
4155
4216
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", q.init) : q.init();
|
|
4156
|
-
const pt = "0.4.
|
|
4217
|
+
const pt = "0.4.7";
|
|
4157
4218
|
export {
|
|
4158
4219
|
R as Core,
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4220
|
+
l as Env,
|
|
4221
|
+
y as Form,
|
|
4222
|
+
w as Fragment,
|
|
4223
|
+
X as Haori,
|
|
4163
4224
|
d as Log,
|
|
4164
4225
|
P as Queue,
|
|
4165
|
-
|
|
4226
|
+
X as default,
|
|
4166
4227
|
pt as version
|
|
4167
4228
|
};
|
|
4168
4229
|
//# sourceMappingURL=haori.es.js.map
|