haori 0.4.7 → 0.4.8
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 +7 -7
- package/dist/haori.cjs.js.map +1 -1
- package/dist/haori.es.js +212 -205
- package/dist/haori.es.js.map +1 -1
- package/dist/haori.iife.js +8 -8
- package/dist/haori.iife.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/package.json +1 -1
- package/dist/src/core.d.ts.map +1 -1
- package/dist/src/core.js +16 -1
- package/dist/src/core.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/observer.d.ts.map +1 -1
- package/dist/src/observer.js +3 -0
- package/dist/src/observer.js.map +1 -1
- package/dist/tests/observer.test.d.ts +2 -0
- package/dist/tests/observer.test.d.ts.map +1 -0
- package/dist/tests/observer.test.js +64 -0
- package/dist/tests/observer.test.js.map +1 -0
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -31,11 +31,11 @@ const C = class C {
|
|
|
31
31
|
C.devMode = !1;
|
|
32
32
|
let B = C;
|
|
33
33
|
const z = "embedded";
|
|
34
|
-
function rt(
|
|
35
|
-
return
|
|
34
|
+
function rt(P) {
|
|
35
|
+
return P === "embedded" || P === "demo";
|
|
36
36
|
}
|
|
37
|
-
function it(
|
|
38
|
-
return
|
|
37
|
+
function it(P) {
|
|
38
|
+
return P === null ? null : rt(P) ? P : z;
|
|
39
39
|
}
|
|
40
40
|
const D = class D {
|
|
41
41
|
/**
|
|
@@ -221,7 +221,7 @@ const _ = class _ {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
_.ASYNC_QUEUE = new st();
|
|
224
|
-
let
|
|
224
|
+
let F = _;
|
|
225
225
|
class X {
|
|
226
226
|
/**
|
|
227
227
|
* 実行モードを取得します。
|
|
@@ -247,7 +247,7 @@ class X {
|
|
|
247
247
|
* @returns 通知が閉じられると解決されるPromise
|
|
248
248
|
*/
|
|
249
249
|
static dialog(t) {
|
|
250
|
-
return
|
|
250
|
+
return F.enqueue(() => {
|
|
251
251
|
window.alert(t);
|
|
252
252
|
}, !0);
|
|
253
253
|
}
|
|
@@ -275,7 +275,7 @@ class X {
|
|
|
275
275
|
* @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
|
|
276
276
|
*/
|
|
277
277
|
static confirm(t) {
|
|
278
|
-
return
|
|
278
|
+
return F.enqueue(() => window.confirm(t), !0);
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
281
|
* ダイアログを開きます。
|
|
@@ -283,7 +283,7 @@ class X {
|
|
|
283
283
|
* @param element 開くダイアログのHTML要素
|
|
284
284
|
*/
|
|
285
285
|
static openDialog(t) {
|
|
286
|
-
return
|
|
286
|
+
return F.enqueue(() => {
|
|
287
287
|
t instanceof HTMLDialogElement ? t.showModal() : d.error("[Haori]", "Element is not a dialog: ", t);
|
|
288
288
|
}, !0);
|
|
289
289
|
}
|
|
@@ -293,7 +293,7 @@ class X {
|
|
|
293
293
|
* @param element 閉じるダイアログのHTML要素
|
|
294
294
|
*/
|
|
295
295
|
static closeDialog(t) {
|
|
296
|
-
return
|
|
296
|
+
return F.enqueue(() => {
|
|
297
297
|
t instanceof HTMLDialogElement ? t.close() : d.error("[Haori]", "Element is not a dialog: ", t);
|
|
298
298
|
}, !0);
|
|
299
299
|
}
|
|
@@ -314,7 +314,7 @@ class X {
|
|
|
314
314
|
* @param level メッセージのレベル(省略可能)
|
|
315
315
|
*/
|
|
316
316
|
static addMessage(t, e, r) {
|
|
317
|
-
return
|
|
317
|
+
return F.enqueue(() => {
|
|
318
318
|
const i = t instanceof HTMLFormElement ? t : t.parentElement ?? t;
|
|
319
319
|
i.setAttribute("data-message", e), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
|
|
320
320
|
}, !0);
|
|
@@ -325,7 +325,7 @@ class X {
|
|
|
325
325
|
* @param parent メッセージをクリアする親要素
|
|
326
326
|
*/
|
|
327
327
|
static clearMessages(t) {
|
|
328
|
-
return
|
|
328
|
+
return F.enqueue(() => {
|
|
329
329
|
t.removeAttribute("data-message"), t.removeAttribute("data-message-level"), t.querySelectorAll("[data-message]").forEach((e) => {
|
|
330
330
|
e.removeAttribute("data-message"), e.removeAttribute("data-message-level");
|
|
331
331
|
});
|
|
@@ -434,50 +434,50 @@ class y {
|
|
|
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(`${l.prefix}form-object`), h = t.getAttribute(`${l.prefix}form-list`),
|
|
437
|
+
const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), h = t.getAttribute(`${l.prefix}form-list`), b = t.getAttribute(`${l.prefix}form-detach`);
|
|
438
438
|
if (a) {
|
|
439
|
-
if (!
|
|
440
|
-
const
|
|
441
|
-
h && Array.isArray(
|
|
442
|
-
y.applyFragmentValue(t,
|
|
443
|
-
) : typeof
|
|
444
|
-
y.applyFragmentValue(t, String(
|
|
439
|
+
if (!b || i) {
|
|
440
|
+
const g = e[String(a)];
|
|
441
|
+
h && Array.isArray(g) && r !== null ? s.push(
|
|
442
|
+
y.applyFragmentValue(t, g[r] ?? null, n)
|
|
443
|
+
) : typeof g > "u" || (typeof g == "string" || typeof g == "number" || typeof g == "boolean" || g === null ? s.push(y.applyFragmentValue(t, g, n)) : s.push(
|
|
444
|
+
y.applyFragmentValue(t, String(g), n)
|
|
445
445
|
));
|
|
446
446
|
}
|
|
447
447
|
} else if (o) {
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
448
|
+
const g = e[String(o)];
|
|
449
|
+
if (g && typeof g == "object")
|
|
450
450
|
for (const E of t.getChildElementFragments())
|
|
451
451
|
s.push(
|
|
452
452
|
y.setPartValues(
|
|
453
453
|
E,
|
|
454
|
-
|
|
454
|
+
g,
|
|
455
455
|
null,
|
|
456
456
|
i,
|
|
457
457
|
n
|
|
458
458
|
)
|
|
459
459
|
);
|
|
460
460
|
} else if (h) {
|
|
461
|
-
const
|
|
462
|
-
if (Array.isArray(
|
|
461
|
+
const g = e[String(h)];
|
|
462
|
+
if (Array.isArray(g)) {
|
|
463
463
|
const E = t.getChildElementFragments();
|
|
464
|
-
for (let
|
|
465
|
-
const c = E[
|
|
466
|
-
|
|
464
|
+
for (let v = 0; v < E.length; v++) {
|
|
465
|
+
const c = E[v];
|
|
466
|
+
g.length > v ? s.push(
|
|
467
467
|
y.setPartValues(
|
|
468
468
|
c,
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
g[v],
|
|
470
|
+
v,
|
|
471
471
|
i,
|
|
472
472
|
n
|
|
473
473
|
)
|
|
474
|
-
) : s.push(y.setPartValues(c, {},
|
|
474
|
+
) : s.push(y.setPartValues(c, {}, v, i, n));
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
} else
|
|
478
|
-
for (const
|
|
478
|
+
for (const g of t.getChildElementFragments())
|
|
479
479
|
s.push(
|
|
480
|
-
y.setPartValues(
|
|
480
|
+
y.setPartValues(g, e, null, i, n)
|
|
481
481
|
);
|
|
482
482
|
return Promise.all(s).then(() => {
|
|
483
483
|
});
|
|
@@ -493,7 +493,7 @@ class y {
|
|
|
493
493
|
y.clearValues(t), await Promise.all([
|
|
494
494
|
y.clearMessages(t),
|
|
495
495
|
y.clearEachClones(t)
|
|
496
|
-
]), await
|
|
496
|
+
]), await F.enqueue(() => {
|
|
497
497
|
const e = t.getTarget();
|
|
498
498
|
if (e instanceof HTMLFormElement)
|
|
499
499
|
e.reset();
|
|
@@ -574,9 +574,9 @@ class y {
|
|
|
574
574
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
575
575
|
*/
|
|
576
576
|
static addMessage(t, e, r, i) {
|
|
577
|
-
const n = [], s = et(), a = s.addMessage, o = (
|
|
578
|
-
return h.forEach((
|
|
579
|
-
n.push(o(
|
|
577
|
+
const n = [], s = et(), a = s.addMessage, o = (b) => typeof a == "function" ? a.call(s, b, r, i) : s.addErrorMessage(b, r), h = y.findFragmentsByKey(t, e);
|
|
578
|
+
return h.forEach((b) => {
|
|
579
|
+
n.push(o(b.getTarget()));
|
|
580
580
|
}), h.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
|
|
581
581
|
});
|
|
582
582
|
}
|
|
@@ -610,13 +610,13 @@ class y {
|
|
|
610
610
|
if (s !== -1 && a !== -1 && s < a) {
|
|
611
611
|
const o = i.substring(0, s);
|
|
612
612
|
if (n === o) {
|
|
613
|
-
const h = i.substring(s + 1, a),
|
|
614
|
-
if (isNaN(
|
|
613
|
+
const h = i.substring(s + 1, a), b = Number(h);
|
|
614
|
+
if (isNaN(b))
|
|
615
615
|
d.error("Haori", `Invalid index: ${i}`);
|
|
616
616
|
else {
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
...y.findFragmentByKeyParts(b
|
|
617
|
+
const g = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
|
|
618
|
+
b < g.length && r.push(
|
|
619
|
+
...y.findFragmentByKeyParts(g[b], e.slice(1))
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
@@ -753,12 +753,12 @@ 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, h = e[n - 2] || null,
|
|
756
|
+
const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, h = e[n - 2] || null, b = e[n - 3] || null;
|
|
757
757
|
if (this.startsObjectKey(
|
|
758
758
|
o,
|
|
759
759
|
i,
|
|
760
760
|
h,
|
|
761
|
-
|
|
761
|
+
b
|
|
762
762
|
) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
|
|
763
763
|
this.decodeStringLiteral(s.value)
|
|
764
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(
|
|
@@ -775,8 +775,8 @@ return (${t});`;
|
|
|
775
775
|
break;
|
|
776
776
|
}
|
|
777
777
|
case "[": {
|
|
778
|
-
const
|
|
779
|
-
r.push(
|
|
778
|
+
const g = this.startsMemberAccess(i) ? "member" : "array";
|
|
779
|
+
r.push(g);
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
782
782
|
case "{":
|
|
@@ -1296,7 +1296,7 @@ const I = class I {
|
|
|
1296
1296
|
return Promise.resolve();
|
|
1297
1297
|
if (this.parent) {
|
|
1298
1298
|
const t = this.parent, e = t.skipMutationNodes;
|
|
1299
|
-
return
|
|
1299
|
+
return F.enqueue(() => {
|
|
1300
1300
|
t.skipMutationNodes = !0, this.target.parentNode === t.getTarget() && t.getTarget().removeChild(this.target), this.mounted = !1;
|
|
1301
1301
|
}).finally(() => {
|
|
1302
1302
|
t.skipMutationNodes = e;
|
|
@@ -1304,7 +1304,7 @@ const I = class I {
|
|
|
1304
1304
|
} else {
|
|
1305
1305
|
const t = this.target.parentNode;
|
|
1306
1306
|
if (t)
|
|
1307
|
-
return
|
|
1307
|
+
return F.enqueue(() => {
|
|
1308
1308
|
this.target.parentNode === t && t.removeChild(this.target), this.mounted = !1;
|
|
1309
1309
|
});
|
|
1310
1310
|
this.mounted = !1;
|
|
@@ -1321,7 +1321,7 @@ const I = class I {
|
|
|
1321
1321
|
return Promise.resolve();
|
|
1322
1322
|
if (this.parent) {
|
|
1323
1323
|
const t = this.parent, e = t.skipMutationNodes;
|
|
1324
|
-
return
|
|
1324
|
+
return F.enqueue(() => {
|
|
1325
1325
|
t.skipMutationNodes = !0, this.target.parentNode !== t.getTarget() && t.getTarget().appendChild(this.target), this.mounted = !0;
|
|
1326
1326
|
}).finally(() => {
|
|
1327
1327
|
t.skipMutationNodes = e;
|
|
@@ -1608,12 +1608,12 @@ class x extends w {
|
|
|
1608
1608
|
if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
|
|
1609
1609
|
const i = this.getAttribute("value"), n = r.type === "checkbox" && i === "true";
|
|
1610
1610
|
let s;
|
|
1611
|
-
return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : s = i === String(t), this.value = n ? s : s ? t : null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0,
|
|
1611
|
+
return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : s = i === String(t), this.value = n ? s : s ? t : null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, F.enqueue(() => {
|
|
1612
1612
|
r.checked = s, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1613
1613
|
}).finally(() => {
|
|
1614
1614
|
this.skipChangeValue = !1;
|
|
1615
1615
|
}));
|
|
1616
|
-
} else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0,
|
|
1616
|
+
} else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0, F.enqueue(() => {
|
|
1617
1617
|
r.value = t === null ? "" : String(t), e && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
1618
1618
|
}).finally(() => {
|
|
1619
1619
|
this.skipChangeValue = !1;
|
|
@@ -1693,7 +1693,7 @@ class x extends w {
|
|
|
1693
1693
|
return Promise.resolve();
|
|
1694
1694
|
this.attributeMap.delete(t), this.skipMutationAttributes = !0;
|
|
1695
1695
|
const r = this.getTarget();
|
|
1696
|
-
return
|
|
1696
|
+
return F.enqueue(() => {
|
|
1697
1697
|
r.removeAttribute(t), e !== t && r.removeAttribute(e);
|
|
1698
1698
|
}).finally(() => {
|
|
1699
1699
|
this.skipMutationAttributes = !1;
|
|
@@ -1716,7 +1716,7 @@ class x extends w {
|
|
|
1716
1716
|
const n = new U(t, r);
|
|
1717
1717
|
this.attributeMap.set(t, n), this.skipMutationAttributes = !0;
|
|
1718
1718
|
const s = this.getTarget(), a = n.isForceEvaluation() ? r : this.getAttribute(t);
|
|
1719
|
-
return
|
|
1719
|
+
return F.enqueue(() => {
|
|
1720
1720
|
if (s.getAttribute(t) !== r && s.setAttribute(t, r), a === null || a === !1)
|
|
1721
1721
|
s.removeAttribute(e);
|
|
1722
1722
|
else {
|
|
@@ -1738,7 +1738,7 @@ class x extends w {
|
|
|
1738
1738
|
return Promise.resolve();
|
|
1739
1739
|
this.attributeMap.delete(t), this.skipMutationAttributes = !0;
|
|
1740
1740
|
const e = this.getTarget();
|
|
1741
|
-
return
|
|
1741
|
+
return F.enqueue(() => {
|
|
1742
1742
|
e.removeAttribute(t);
|
|
1743
1743
|
}).finally(() => {
|
|
1744
1744
|
this.skipMutationAttributes = !1;
|
|
@@ -1833,30 +1833,30 @@ class x extends w {
|
|
|
1833
1833
|
s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
|
|
1834
1834
|
const h = t.getParent();
|
|
1835
1835
|
h !== null && h.removeChild(t);
|
|
1836
|
-
let
|
|
1836
|
+
let b = r === void 0 ? e?.getTarget() || null : r;
|
|
1837
1837
|
if (e === null)
|
|
1838
1838
|
this.children.push(t);
|
|
1839
1839
|
else {
|
|
1840
1840
|
let E;
|
|
1841
1841
|
if (s ? a !== -1 && a < o ? E = o - 1 : E = o : E = this.children.indexOf(e), E === -1) {
|
|
1842
|
-
const
|
|
1842
|
+
const v = this.resolveInsertionPointFromDom(
|
|
1843
1843
|
e,
|
|
1844
1844
|
!1
|
|
1845
1845
|
);
|
|
1846
|
-
|
|
1846
|
+
v === null ? (d.warn(
|
|
1847
1847
|
"[Haori]",
|
|
1848
1848
|
"Reference child not found in children.",
|
|
1849
1849
|
e
|
|
1850
|
-
), this.children.push(t)) : (this.children.splice(
|
|
1850
|
+
), this.children.push(t)) : (this.children.splice(v.index, 0, t), b = v.referenceNode);
|
|
1851
1851
|
} else
|
|
1852
1852
|
this.children.splice(E, 0, t);
|
|
1853
1853
|
}
|
|
1854
1854
|
t.setParent(this), t.setMounted(this.mounted);
|
|
1855
|
-
const
|
|
1856
|
-
return this.skipMutationNodes = !0,
|
|
1857
|
-
this.target.insertBefore(t.getTarget(),
|
|
1855
|
+
const g = this.skipMutationNodes;
|
|
1856
|
+
return this.skipMutationNodes = !0, F.enqueue(() => {
|
|
1857
|
+
this.target.insertBefore(t.getTarget(), b);
|
|
1858
1858
|
}).finally(() => {
|
|
1859
|
-
this.skipMutationNodes =
|
|
1859
|
+
this.skipMutationNodes = g;
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
1862
|
/**
|
|
@@ -1995,7 +1995,7 @@ class O extends w {
|
|
|
1995
1995
|
evaluate() {
|
|
1996
1996
|
return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
|
|
1997
1997
|
new Error("Parent fragment is required for raw evaluation")
|
|
1998
|
-
) :
|
|
1998
|
+
) : F.enqueue(() => {
|
|
1999
1999
|
this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
|
|
2000
2000
|
this.parent.getBindingData()
|
|
2001
2001
|
)[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
|
|
@@ -2040,7 +2040,7 @@ class Z extends w {
|
|
|
2040
2040
|
* @return 更新のPromise
|
|
2041
2041
|
*/
|
|
2042
2042
|
setContent(t) {
|
|
2043
|
-
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t,
|
|
2043
|
+
return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, F.enqueue(() => {
|
|
2044
2044
|
this.skipMutation = !0, this.target.textContent = this.text;
|
|
2045
2045
|
}).finally(() => {
|
|
2046
2046
|
this.skipMutation = !1;
|
|
@@ -2188,7 +2188,7 @@ G.FORCE_EVALUATION_ATTRIBUTES = [
|
|
|
2188
2188
|
"hor-each"
|
|
2189
2189
|
];
|
|
2190
2190
|
let U = G;
|
|
2191
|
-
class
|
|
2191
|
+
class N {
|
|
2192
2192
|
/**
|
|
2193
2193
|
* カスタムイベントを発火します。
|
|
2194
2194
|
*
|
|
@@ -2212,7 +2212,7 @@ class T {
|
|
|
2212
2212
|
* @param version ライブラリバージョン
|
|
2213
2213
|
*/
|
|
2214
2214
|
static ready(t) {
|
|
2215
|
-
|
|
2215
|
+
N.dispatch(document, "ready", { version: t });
|
|
2216
2216
|
}
|
|
2217
2217
|
/**
|
|
2218
2218
|
* renderイベントを発火します。
|
|
@@ -2220,7 +2220,7 @@ class T {
|
|
|
2220
2220
|
* @param target 評価対象要素
|
|
2221
2221
|
*/
|
|
2222
2222
|
static render(t) {
|
|
2223
|
-
|
|
2223
|
+
N.dispatch(t, "render", { target: t });
|
|
2224
2224
|
}
|
|
2225
2225
|
/**
|
|
2226
2226
|
* importstartイベントを発火します。
|
|
@@ -2229,7 +2229,7 @@ class T {
|
|
|
2229
2229
|
* @param url インポート対象URL
|
|
2230
2230
|
*/
|
|
2231
2231
|
static importStart(t, e) {
|
|
2232
|
-
|
|
2232
|
+
N.dispatch(t, "importstart", {
|
|
2233
2233
|
url: e,
|
|
2234
2234
|
startedAt: performance.now()
|
|
2235
2235
|
});
|
|
@@ -2243,7 +2243,7 @@ class T {
|
|
|
2243
2243
|
* @param startedAt 開始時刻
|
|
2244
2244
|
*/
|
|
2245
2245
|
static importEnd(t, e, r, i) {
|
|
2246
|
-
|
|
2246
|
+
N.dispatch(t, "importend", {
|
|
2247
2247
|
url: e,
|
|
2248
2248
|
bytes: r,
|
|
2249
2249
|
durationMs: performance.now() - i
|
|
@@ -2257,7 +2257,7 @@ class T {
|
|
|
2257
2257
|
* @param error エラー内容
|
|
2258
2258
|
*/
|
|
2259
2259
|
static importError(t, e, r) {
|
|
2260
|
-
|
|
2260
|
+
N.dispatch(t, "importerror", { url: e, error: r });
|
|
2261
2261
|
}
|
|
2262
2262
|
/**
|
|
2263
2263
|
* bindchangeイベントを発火します。
|
|
@@ -2270,10 +2270,10 @@ class T {
|
|
|
2270
2270
|
static bindChange(t, e, r, i = "other") {
|
|
2271
2271
|
const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
2272
2272
|
for (const h of o) {
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2273
|
+
const b = e?.[h], g = r[h];
|
|
2274
|
+
b !== g && n.push(h);
|
|
2275
2275
|
}
|
|
2276
|
-
|
|
2276
|
+
N.dispatch(t, "bindchange", {
|
|
2277
2277
|
previous: e || {},
|
|
2278
2278
|
next: r,
|
|
2279
2279
|
changedKeys: n,
|
|
@@ -2289,7 +2289,7 @@ class T {
|
|
|
2289
2289
|
* @param order 現在の順序
|
|
2290
2290
|
*/
|
|
2291
2291
|
static eachUpdate(t, e, r, i) {
|
|
2292
|
-
|
|
2292
|
+
N.dispatch(t, "eachupdate", {
|
|
2293
2293
|
added: e,
|
|
2294
2294
|
removed: r,
|
|
2295
2295
|
order: i,
|
|
@@ -2305,7 +2305,7 @@ class T {
|
|
|
2305
2305
|
* @param item 行データ
|
|
2306
2306
|
*/
|
|
2307
2307
|
static rowAdd(t, e, r, i) {
|
|
2308
|
-
|
|
2308
|
+
N.dispatch(t, "rowadd", { key: e, index: r, item: i });
|
|
2309
2309
|
}
|
|
2310
2310
|
/**
|
|
2311
2311
|
* rowremoveイベントを発火します。
|
|
@@ -2315,7 +2315,7 @@ class T {
|
|
|
2315
2315
|
* @param index インデックス
|
|
2316
2316
|
*/
|
|
2317
2317
|
static rowRemove(t, e, r) {
|
|
2318
|
-
|
|
2318
|
+
N.dispatch(t, "rowremove", { key: e, index: r });
|
|
2319
2319
|
}
|
|
2320
2320
|
/**
|
|
2321
2321
|
* rowmoveイベントを発火します。
|
|
@@ -2326,7 +2326,7 @@ class T {
|
|
|
2326
2326
|
* @param to 移動後インデックス
|
|
2327
2327
|
*/
|
|
2328
2328
|
static rowMove(t, e, r, i) {
|
|
2329
|
-
|
|
2329
|
+
N.dispatch(t, "rowmove", { key: e, from: r, to: i });
|
|
2330
2330
|
}
|
|
2331
2331
|
/**
|
|
2332
2332
|
* showイベントを発火します。
|
|
@@ -2334,7 +2334,7 @@ class T {
|
|
|
2334
2334
|
* @param target data-if要素
|
|
2335
2335
|
*/
|
|
2336
2336
|
static show(t) {
|
|
2337
|
-
|
|
2337
|
+
N.dispatch(t, "show", { visible: !0 });
|
|
2338
2338
|
}
|
|
2339
2339
|
/**
|
|
2340
2340
|
* hideイベントを発火します。
|
|
@@ -2342,7 +2342,7 @@ class T {
|
|
|
2342
2342
|
* @param target data-if要素
|
|
2343
2343
|
*/
|
|
2344
2344
|
static hide(t) {
|
|
2345
|
-
|
|
2345
|
+
N.dispatch(t, "hide", { visible: !1 });
|
|
2346
2346
|
}
|
|
2347
2347
|
/**
|
|
2348
2348
|
* fetchstartイベントを発火します。
|
|
@@ -2355,7 +2355,7 @@ class T {
|
|
|
2355
2355
|
* @return 戻り値はありません。
|
|
2356
2356
|
*/
|
|
2357
2357
|
static fetchStart(t, e, r, i, n) {
|
|
2358
|
-
|
|
2358
|
+
N.dispatch(t, "fetchstart", {
|
|
2359
2359
|
url: e,
|
|
2360
2360
|
options: r || {},
|
|
2361
2361
|
payload: i,
|
|
@@ -2372,7 +2372,7 @@ class T {
|
|
|
2372
2372
|
* @param startedAt 開始時刻
|
|
2373
2373
|
*/
|
|
2374
2374
|
static fetchEnd(t, e, r, i) {
|
|
2375
|
-
|
|
2375
|
+
N.dispatch(t, "fetchend", {
|
|
2376
2376
|
url: e,
|
|
2377
2377
|
status: r,
|
|
2378
2378
|
durationMs: performance.now() - i
|
|
@@ -2388,7 +2388,7 @@ class T {
|
|
|
2388
2388
|
* @param startedAt 開始時刻(存在する場合)
|
|
2389
2389
|
*/
|
|
2390
2390
|
static fetchError(t, e, r, i, n) {
|
|
2391
|
-
|
|
2391
|
+
N.dispatch(t, "fetcherror", {
|
|
2392
2392
|
url: e,
|
|
2393
2393
|
status: i,
|
|
2394
2394
|
error: r,
|
|
@@ -2411,17 +2411,17 @@ function W() {
|
|
|
2411
2411
|
) ? t : X;
|
|
2412
2412
|
}
|
|
2413
2413
|
const lt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
2414
|
-
function ut(
|
|
2415
|
-
return lt.has(
|
|
2414
|
+
function ut(P) {
|
|
2415
|
+
return lt.has(P.toUpperCase());
|
|
2416
2416
|
}
|
|
2417
|
-
function ct(
|
|
2417
|
+
function ct(P, t) {
|
|
2418
2418
|
for (const [e, r] of Object.entries(t))
|
|
2419
|
-
r !== void 0 && (r === null ?
|
|
2420
|
-
|
|
2421
|
-
}) : typeof r == "object" || typeof r == "function" ?
|
|
2419
|
+
r !== void 0 && (r === null ? P.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
|
|
2420
|
+
P.append(e, String(i));
|
|
2421
|
+
}) : typeof r == "object" || typeof r == "function" ? P.append(e, JSON.stringify(r)) : P.append(e, String(r)));
|
|
2422
2422
|
}
|
|
2423
|
-
function ht(
|
|
2424
|
-
const e = new URL(
|
|
2423
|
+
function ht(P, t) {
|
|
2424
|
+
const e = new URL(P, window.location.href), r = new URLSearchParams(e.search);
|
|
2425
2425
|
return ct(r, t), e.search = r.toString(), e.toString();
|
|
2426
2426
|
}
|
|
2427
2427
|
const u = class u {
|
|
@@ -2619,8 +2619,8 @@ ${c}
|
|
|
2619
2619
|
);
|
|
2620
2620
|
try {
|
|
2621
2621
|
s.headers = R.parseDataBind(f);
|
|
2622
|
-
} catch (
|
|
2623
|
-
d.error("Haori", `Invalid fetch headers: ${
|
|
2622
|
+
} catch (m) {
|
|
2623
|
+
d.error("Haori", `Invalid fetch headers: ${m}`);
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
} else {
|
|
@@ -2635,8 +2635,8 @@ ${c}
|
|
|
2635
2635
|
);
|
|
2636
2636
|
try {
|
|
2637
2637
|
s.headers = R.parseDataBind(f);
|
|
2638
|
-
} catch (
|
|
2639
|
-
d.error("Haori", `Invalid fetch headers: ${
|
|
2638
|
+
} catch (m) {
|
|
2639
|
+
d.error("Haori", `Invalid fetch headers: ${m}`);
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
}
|
|
@@ -2688,8 +2688,8 @@ ${c}
|
|
|
2688
2688
|
const c = t.getRawAttribute(a);
|
|
2689
2689
|
if (c) {
|
|
2690
2690
|
const f = document.body.querySelectorAll(c);
|
|
2691
|
-
f.length > 0 ? (r.bindFragments = [], f.forEach((
|
|
2692
|
-
const A = w.get(
|
|
2691
|
+
f.length > 0 ? (r.bindFragments = [], f.forEach((m) => {
|
|
2692
|
+
const A = w.get(m);
|
|
2693
2693
|
A && r.bindFragments.push(A);
|
|
2694
2694
|
})) : d.error(
|
|
2695
2695
|
"Haori",
|
|
@@ -2701,17 +2701,17 @@ ${c}
|
|
|
2701
2701
|
null,
|
|
2702
2702
|
"arg",
|
|
2703
2703
|
!0
|
|
2704
|
-
),
|
|
2704
|
+
), b = u.attrName(
|
|
2705
2705
|
null,
|
|
2706
2706
|
"bind-arg",
|
|
2707
2707
|
!0
|
|
2708
2708
|
);
|
|
2709
2709
|
e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(h) ? r.bindArg = t.getRawAttribute(
|
|
2710
2710
|
h
|
|
2711
|
-
) : t.hasAttribute(
|
|
2712
|
-
const
|
|
2713
|
-
if (t.hasAttribute(
|
|
2714
|
-
const c = t.getRawAttribute(
|
|
2711
|
+
) : t.hasAttribute(b) && (r.bindArg = t.getRawAttribute(b));
|
|
2712
|
+
const g = e ? u.attrName(e, "bind-params") : u.attrName(null, "bind-params", !0);
|
|
2713
|
+
if (t.hasAttribute(g)) {
|
|
2714
|
+
const c = t.getRawAttribute(g);
|
|
2715
2715
|
r.bindParams = c.split("&").map((f) => f.trim());
|
|
2716
2716
|
}
|
|
2717
2717
|
const E = e ? u.attrName(e, "bind-append") : u.attrName(null, "bind-append", !0);
|
|
@@ -2719,10 +2719,10 @@ ${c}
|
|
|
2719
2719
|
const c = t.getRawAttribute(E);
|
|
2720
2720
|
r.bindAppendParams = c.split("&").map((f) => f.trim()).filter(Boolean);
|
|
2721
2721
|
}
|
|
2722
|
-
const
|
|
2723
|
-
if (
|
|
2722
|
+
const v = e ? u.attrName(e, "copy-params") : null;
|
|
2723
|
+
if (v && t.hasAttribute(v)) {
|
|
2724
2724
|
const c = t.getRawAttribute(
|
|
2725
|
-
|
|
2725
|
+
v
|
|
2726
2726
|
);
|
|
2727
2727
|
r.copyParams = c.split("&").map((f) => f.trim()).filter(Boolean);
|
|
2728
2728
|
}
|
|
@@ -2732,19 +2732,19 @@ ${c}
|
|
|
2732
2732
|
u.attrName(e, "adjust")
|
|
2733
2733
|
);
|
|
2734
2734
|
if (f) {
|
|
2735
|
-
const
|
|
2736
|
-
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2735
|
+
const m = document.body.querySelectorAll(f);
|
|
2736
|
+
m.length > 0 ? (r.adjustFragments = [], m.forEach((A) => {
|
|
2737
|
+
const T = w.get(A);
|
|
2738
|
+
T && r.adjustFragments.push(T);
|
|
2739
2739
|
})) : d.error(
|
|
2740
2740
|
"Haori",
|
|
2741
2741
|
`Adjust element not found: ${f} (${u.attrName(e, "adjust")})`
|
|
2742
2742
|
);
|
|
2743
2743
|
}
|
|
2744
2744
|
if (t.hasAttribute(u.attrName(e, "adjust-value"))) {
|
|
2745
|
-
const
|
|
2745
|
+
const m = t.getRawAttribute(
|
|
2746
2746
|
u.attrName(e, "adjust-value")
|
|
2747
|
-
), A = Number(
|
|
2747
|
+
), A = Number(m);
|
|
2748
2748
|
isNaN(A) || (r.adjustValue = A);
|
|
2749
2749
|
}
|
|
2750
2750
|
}
|
|
@@ -2760,8 +2760,8 @@ ${c}
|
|
|
2760
2760
|
${f}
|
|
2761
2761
|
`
|
|
2762
2762
|
);
|
|
2763
|
-
} catch (
|
|
2764
|
-
d.error("Haori", `Invalid after script: ${
|
|
2763
|
+
} catch (m) {
|
|
2764
|
+
d.error("Haori", `Invalid after script: ${m}`);
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
2767
|
if (t.hasAttribute(u.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
|
|
@@ -2790,9 +2790,9 @@ ${f}
|
|
|
2790
2790
|
u.attrName(e, "history-form")
|
|
2791
2791
|
);
|
|
2792
2792
|
if (f) {
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2795
|
-
w.get(
|
|
2793
|
+
const m = document.body.querySelector(f);
|
|
2794
|
+
m !== null ? r.historyFormFragment = y.getFormFragment(
|
|
2795
|
+
w.get(m)
|
|
2796
2796
|
) : d.error(
|
|
2797
2797
|
"Haori",
|
|
2798
2798
|
`Form element not found: ${f} (${u.attrName(e, "history-form")})`
|
|
@@ -2808,32 +2808,32 @@ ${f}
|
|
|
2808
2808
|
"open",
|
|
2809
2809
|
"close"
|
|
2810
2810
|
].forEach((f) => {
|
|
2811
|
-
const
|
|
2812
|
-
if (!t.hasAttribute(
|
|
2811
|
+
const m = u.attrName(e, f);
|
|
2812
|
+
if (!t.hasAttribute(m))
|
|
2813
2813
|
return;
|
|
2814
|
-
const A = t.getRawAttribute(
|
|
2814
|
+
const A = t.getRawAttribute(m), T = [];
|
|
2815
2815
|
if (A ? (document.body.querySelectorAll(A).forEach((J) => {
|
|
2816
2816
|
const tt = w.get(J);
|
|
2817
|
-
tt &&
|
|
2818
|
-
}),
|
|
2817
|
+
tt && T.push(tt);
|
|
2818
|
+
}), T.length === 0 && d.error("Haori", `Element not found: ${A} (${m})`)) : T.push(t), T.length > 0)
|
|
2819
2819
|
switch (f) {
|
|
2820
2820
|
case "reset":
|
|
2821
|
-
r.resetFragments =
|
|
2821
|
+
r.resetFragments = T;
|
|
2822
2822
|
break;
|
|
2823
2823
|
case "refetch":
|
|
2824
|
-
r.refetchFragments =
|
|
2824
|
+
r.refetchFragments = T;
|
|
2825
2825
|
break;
|
|
2826
2826
|
case "click":
|
|
2827
|
-
r.clickFragments =
|
|
2827
|
+
r.clickFragments = T;
|
|
2828
2828
|
break;
|
|
2829
2829
|
case "copy":
|
|
2830
|
-
r.copyFragments =
|
|
2830
|
+
r.copyFragments = T;
|
|
2831
2831
|
break;
|
|
2832
2832
|
case "open":
|
|
2833
|
-
r.openFragments =
|
|
2833
|
+
r.openFragments = T;
|
|
2834
2834
|
break;
|
|
2835
2835
|
case "close":
|
|
2836
|
-
r.closeFragments =
|
|
2836
|
+
r.closeFragments = T;
|
|
2837
2837
|
break;
|
|
2838
2838
|
}
|
|
2839
2839
|
});
|
|
@@ -2926,7 +2926,7 @@ ${f}
|
|
|
2926
2926
|
if (e) {
|
|
2927
2927
|
const o = { ...r || {} }, h = new Headers(
|
|
2928
2928
|
o.headers || void 0
|
|
2929
|
-
),
|
|
2929
|
+
), b = (o.method || "GET").toUpperCase(), g = l.runtime === "demo" && !ut(b), E = g ? "GET" : b;
|
|
2930
2930
|
if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
|
|
2931
2931
|
n && (e = ht(e, i));
|
|
2932
2932
|
else if (n) {
|
|
@@ -2934,51 +2934,51 @@ ${f}
|
|
|
2934
2934
|
if (/multipart\/form-data/i.test(c)) {
|
|
2935
2935
|
h.delete("Content-Type");
|
|
2936
2936
|
const f = new FormData();
|
|
2937
|
-
for (const [
|
|
2938
|
-
A == null ? f.append(
|
|
2937
|
+
for (const [m, A] of Object.entries(i))
|
|
2938
|
+
A == null ? f.append(m, "") : A instanceof Blob ? f.append(m, A) : Array.isArray(A) ? A.forEach((T) => f.append(m, String(T))) : typeof A == "object" ? f.append(m, JSON.stringify(A)) : f.append(m, String(A));
|
|
2939
2939
|
o.body = f;
|
|
2940
2940
|
} else if (/application\/x-www-form-urlencoded/i.test(c)) {
|
|
2941
2941
|
const f = new URLSearchParams();
|
|
2942
|
-
for (const [
|
|
2943
|
-
A !== void 0 && (A === null ? f.append(
|
|
2942
|
+
for (const [m, A] of Object.entries(i))
|
|
2943
|
+
A !== void 0 && (A === null ? f.append(m, "") : Array.isArray(A) ? A.forEach((T) => f.append(m, String(T))) : typeof A == "object" ? f.append(m, JSON.stringify(A)) : f.append(m, String(A)));
|
|
2944
2944
|
o.body = f;
|
|
2945
2945
|
} else
|
|
2946
2946
|
h.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
|
|
2947
2947
|
}
|
|
2948
2948
|
o.headers = h;
|
|
2949
|
-
let
|
|
2950
|
-
if (
|
|
2949
|
+
let v;
|
|
2950
|
+
if (g && (v = e && new URL(e, window.location.href).search || void 0, h.delete("Content-Type"), d.info("Haori demo fetch normalization", {
|
|
2951
2951
|
runtime: l.runtime,
|
|
2952
|
-
requestedMethod:
|
|
2952
|
+
requestedMethod: b,
|
|
2953
2953
|
effectiveMethod: E,
|
|
2954
2954
|
transportMode: "query-get",
|
|
2955
2955
|
url: e,
|
|
2956
2956
|
payload: n ? i : void 0,
|
|
2957
|
-
queryString:
|
|
2957
|
+
queryString: v
|
|
2958
2958
|
})), this.options.targetFragment && e) {
|
|
2959
2959
|
const c = performance.now(), f = {
|
|
2960
2960
|
runtime: l.runtime,
|
|
2961
|
-
requestedMethod:
|
|
2961
|
+
requestedMethod: b,
|
|
2962
2962
|
effectiveMethod: E,
|
|
2963
|
-
transportMode:
|
|
2964
|
-
...
|
|
2963
|
+
transportMode: g ? "query-get" : "http",
|
|
2964
|
+
...g ? { queryString: v } : {}
|
|
2965
2965
|
};
|
|
2966
|
-
return
|
|
2966
|
+
return N.fetchStart(
|
|
2967
2967
|
this.options.targetFragment.getTarget(),
|
|
2968
2968
|
e,
|
|
2969
2969
|
o,
|
|
2970
2970
|
n ? i : void 0,
|
|
2971
2971
|
f
|
|
2972
|
-
), fetch(e, o).then((
|
|
2973
|
-
|
|
2972
|
+
), fetch(e, o).then((m) => this.handleFetchResult(
|
|
2973
|
+
m,
|
|
2974
2974
|
e || void 0,
|
|
2975
2975
|
c
|
|
2976
|
-
)).catch((
|
|
2977
|
-
throw e &&
|
|
2976
|
+
)).catch((m) => {
|
|
2977
|
+
throw e && N.fetchError(
|
|
2978
2978
|
this.options.targetFragment.getTarget(),
|
|
2979
2979
|
e,
|
|
2980
|
-
|
|
2981
|
-
),
|
|
2980
|
+
m
|
|
2981
|
+
), m;
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
2984
2984
|
return fetch(e, o).then((c) => this.handleFetchResult(c, e || void 0));
|
|
@@ -2989,8 +2989,8 @@ ${f}
|
|
|
2989
2989
|
`${l.prefix}bind`,
|
|
2990
2990
|
JSON.stringify(i)
|
|
2991
2991
|
);
|
|
2992
|
-
const
|
|
2993
|
-
Object.assign(
|
|
2992
|
+
const b = o.getBindingData();
|
|
2993
|
+
Object.assign(b, i), await R.setBindingData(h, b);
|
|
2994
2994
|
}
|
|
2995
2995
|
const s = n ? i : {}, a = new Response(JSON.stringify(s), {
|
|
2996
2996
|
headers: { "Content-Type": "application/json" }
|
|
@@ -3003,14 +3003,14 @@ ${f}
|
|
|
3003
3003
|
async handleFetchResult(t, e, r) {
|
|
3004
3004
|
const i = W();
|
|
3005
3005
|
if (!t.ok)
|
|
3006
|
-
return this.options.targetFragment && e &&
|
|
3006
|
+
return this.options.targetFragment && e && N.fetchError(
|
|
3007
3007
|
this.options.targetFragment.getTarget(),
|
|
3008
3008
|
e,
|
|
3009
3009
|
new Error(`${t.status} ${t.statusText}`),
|
|
3010
3010
|
t.status,
|
|
3011
3011
|
r
|
|
3012
3012
|
), await this.handleFetchError(t), !1;
|
|
3013
|
-
if (this.options.targetFragment && e && r &&
|
|
3013
|
+
if (this.options.targetFragment && e && r && N.fetchEnd(
|
|
3014
3014
|
this.options.targetFragment.getTarget(),
|
|
3015
3015
|
e,
|
|
3016
3016
|
t.status,
|
|
@@ -3068,7 +3068,7 @@ ${f}
|
|
|
3068
3068
|
}
|
|
3069
3069
|
const s = (a) => {
|
|
3070
3070
|
for (const [o, h] of Object.entries(a))
|
|
3071
|
-
h != null && (Array.isArray(h) ? h.forEach((
|
|
3071
|
+
h != null && (Array.isArray(h) ? h.forEach((b) => n.searchParams.append(o, String(b))) : typeof h == "object" ? n.searchParams.set(o, JSON.stringify(h)) : n.searchParams.set(o, String(h)));
|
|
3072
3072
|
};
|
|
3073
3073
|
e && s(this.options.historyData), r && s(
|
|
3074
3074
|
y.getValues(
|
|
@@ -3580,16 +3580,23 @@ const p = class p {
|
|
|
3580
3580
|
case `${l.prefix}import`: {
|
|
3581
3581
|
if (typeof r == "string") {
|
|
3582
3582
|
const a = i.getTarget(), o = performance.now();
|
|
3583
|
-
a.setAttribute(`${l.prefix}importing`, ""),
|
|
3583
|
+
a.setAttribute(`${l.prefix}importing`, ""), N.importStart(a, r), s.push(
|
|
3584
3584
|
dt.load(r).then((h) => {
|
|
3585
|
-
const
|
|
3586
|
-
return
|
|
3585
|
+
const b = new TextEncoder().encode(h).length;
|
|
3586
|
+
return F.enqueue(() => {
|
|
3587
3587
|
a.innerHTML = h;
|
|
3588
3588
|
}).then(() => {
|
|
3589
|
-
a.removeAttribute(`${l.prefix}importing`),
|
|
3589
|
+
if (a.removeAttribute(`${l.prefix}importing`), N.importEnd(a, r, b, o), !document.body.hasAttribute("data-haori-ready")) {
|
|
3590
|
+
const g = [];
|
|
3591
|
+
return a.childNodes.forEach((E) => {
|
|
3592
|
+
const v = w.get(E);
|
|
3593
|
+
v instanceof x ? g.push(p.scan(v.getTarget())) : v instanceof O && g.push(p.evaluateText(v));
|
|
3594
|
+
}), Promise.all(g).then(() => {
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3590
3597
|
});
|
|
3591
3598
|
}).catch((h) => {
|
|
3592
|
-
a.removeAttribute(`${l.prefix}importing`),
|
|
3599
|
+
a.removeAttribute(`${l.prefix}importing`), N.importError(a, r, h), d.error("[Haori]", "Failed to import HTML:", r, h);
|
|
3593
3600
|
})
|
|
3594
3601
|
);
|
|
3595
3602
|
}
|
|
@@ -3628,7 +3635,7 @@ const p = class p {
|
|
|
3628
3635
|
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
3636
|
n = n.then(() => y.syncValues(r, a));
|
|
3630
3637
|
}
|
|
3631
|
-
return n = n.then(() => p.evaluateAll(r)),
|
|
3638
|
+
return n = n.then(() => p.evaluateAll(r)), N.bindChange(t, i, e, "manual"), n.then(() => {
|
|
3632
3639
|
});
|
|
3633
3640
|
}
|
|
3634
3641
|
/**
|
|
@@ -3763,7 +3770,7 @@ const p = class p {
|
|
|
3763
3770
|
if (r === !1 || r === void 0 || r === null || Number.isNaN(r))
|
|
3764
3771
|
e.push(
|
|
3765
3772
|
t.hide().then(() => {
|
|
3766
|
-
|
|
3773
|
+
N.hide(t.getTarget());
|
|
3767
3774
|
})
|
|
3768
3775
|
);
|
|
3769
3776
|
else {
|
|
@@ -3772,7 +3779,7 @@ const p = class p {
|
|
|
3772
3779
|
n instanceof x ? i.push(p.evaluateAll(n)) : n instanceof O && i.push(p.evaluateText(n));
|
|
3773
3780
|
}), e.push(
|
|
3774
3781
|
t.show().then(() => {
|
|
3775
|
-
|
|
3782
|
+
N.show(t.getTarget());
|
|
3776
3783
|
})
|
|
3777
3784
|
), e.push(Promise.all(i).then(() => {
|
|
3778
3785
|
}));
|
|
@@ -3821,30 +3828,30 @@ const p = class p {
|
|
|
3821
3828
|
i && (i = String(i));
|
|
3822
3829
|
const n = t.getAttribute(`${l.prefix}each-key`), s = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
3823
3830
|
e.forEach((c, f) => {
|
|
3824
|
-
const
|
|
3831
|
+
const m = p.createListKey(
|
|
3825
3832
|
c,
|
|
3826
3833
|
n ? String(n) : null,
|
|
3827
3834
|
f
|
|
3828
3835
|
);
|
|
3829
|
-
o.push(
|
|
3836
|
+
o.push(m), a.set(m, { item: c, itemIndex: f });
|
|
3830
3837
|
});
|
|
3831
3838
|
const h = [];
|
|
3832
|
-
let
|
|
3839
|
+
let b = t.getChildren().filter((c) => c instanceof x).filter(
|
|
3833
3840
|
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
3834
3841
|
);
|
|
3835
|
-
|
|
3836
|
-
const
|
|
3837
|
-
let
|
|
3842
|
+
b = b.filter((c) => o.indexOf(String(c.getListKey())) === -1 ? (h.push(c.remove()), !1) : !0);
|
|
3843
|
+
const g = b.map((c) => c.getListKey()), E = t.getChildren().filter((c) => c instanceof x).filter((c) => c.hasAttribute(`${l.prefix}each-before`)).length;
|
|
3844
|
+
let v = Promise.resolve();
|
|
3838
3845
|
return o.forEach((c, f) => {
|
|
3839
|
-
const
|
|
3846
|
+
const m = g.indexOf(c), { item: A, itemIndex: T } = a.get(c);
|
|
3840
3847
|
let k;
|
|
3841
|
-
if (
|
|
3842
|
-
k = m
|
|
3848
|
+
if (m !== -1)
|
|
3849
|
+
k = b[m], v = v.then(
|
|
3843
3850
|
() => p.updateRowFragment(
|
|
3844
3851
|
k,
|
|
3845
3852
|
A,
|
|
3846
3853
|
i,
|
|
3847
|
-
|
|
3854
|
+
T,
|
|
3848
3855
|
s ? String(s) : null,
|
|
3849
3856
|
c
|
|
3850
3857
|
).then(() => p.evaluateAll(k)).then(() => p.scheduleEvaluateAll(k))
|
|
@@ -3852,12 +3859,12 @@ const p = class p {
|
|
|
3852
3859
|
else {
|
|
3853
3860
|
k = r.clone();
|
|
3854
3861
|
const J = E + f;
|
|
3855
|
-
|
|
3862
|
+
v = v.then(
|
|
3856
3863
|
() => p.updateRowFragment(
|
|
3857
3864
|
k,
|
|
3858
3865
|
A,
|
|
3859
3866
|
i,
|
|
3860
|
-
|
|
3867
|
+
T,
|
|
3861
3868
|
s ? String(s) : null,
|
|
3862
3869
|
c
|
|
3863
3870
|
).then(
|
|
@@ -3868,19 +3875,19 @@ const p = class p {
|
|
|
3868
3875
|
)
|
|
3869
3876
|
);
|
|
3870
3877
|
}
|
|
3871
|
-
}), Promise.all(h).then(() =>
|
|
3878
|
+
}), Promise.all(h).then(() => v).then(() => {
|
|
3872
3879
|
const c = o.filter(
|
|
3873
|
-
(
|
|
3874
|
-
), f =
|
|
3875
|
-
(
|
|
3876
|
-
),
|
|
3877
|
-
(
|
|
3880
|
+
(T) => T !== null
|
|
3881
|
+
), f = g.filter(
|
|
3882
|
+
(T) => T !== null
|
|
3883
|
+
), m = c.filter(
|
|
3884
|
+
(T) => !f.includes(T)
|
|
3878
3885
|
), A = f.filter(
|
|
3879
|
-
(
|
|
3886
|
+
(T) => !c.includes(T)
|
|
3880
3887
|
);
|
|
3881
|
-
|
|
3888
|
+
N.eachUpdate(
|
|
3882
3889
|
t.getTarget(),
|
|
3883
|
-
|
|
3890
|
+
m,
|
|
3884
3891
|
A,
|
|
3885
3892
|
c
|
|
3886
3893
|
);
|
|
@@ -4009,35 +4016,35 @@ const Y = class Y {
|
|
|
4009
4016
|
};
|
|
4010
4017
|
Y.HISTORY_STATE_KEY = "__haoriHistoryState__";
|
|
4011
4018
|
let Q = Y;
|
|
4012
|
-
const
|
|
4019
|
+
const S = class S {
|
|
4013
4020
|
static syncTree(t) {
|
|
4014
|
-
(t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement &&
|
|
4015
|
-
|
|
4021
|
+
(t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement && S.syncElement(t), t.querySelectorAll("*").forEach((e) => {
|
|
4022
|
+
S.syncElement(e);
|
|
4016
4023
|
}));
|
|
4017
4024
|
}
|
|
4018
4025
|
static syncElement(t) {
|
|
4019
|
-
const e =
|
|
4020
|
-
if (!r || !
|
|
4021
|
-
e && (e.observer.disconnect(),
|
|
4026
|
+
const e = S.registrations.get(t), r = w.get(t);
|
|
4027
|
+
if (!r || !S.shouldObserve(r)) {
|
|
4028
|
+
e && (e.observer.disconnect(), S.registrations.delete(t));
|
|
4022
4029
|
return;
|
|
4023
4030
|
}
|
|
4024
4031
|
if (typeof IntersectionObserver > "u")
|
|
4025
4032
|
return;
|
|
4026
|
-
const i =
|
|
4027
|
-
if (e && e.observer.root === i && e.observer.rootMargin === n &&
|
|
4033
|
+
const i = S.resolveRoot(r), n = S.resolveRootMargin(r), s = S.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
4034
|
+
if (e && e.observer.root === i && e.observer.rootMargin === n && S.sameThreshold(
|
|
4028
4035
|
e.observer.thresholds,
|
|
4029
4036
|
s
|
|
4030
4037
|
) && e.once === a) {
|
|
4031
4038
|
e.fragment = r;
|
|
4032
4039
|
return;
|
|
4033
4040
|
}
|
|
4034
|
-
e && (e.observer.disconnect(),
|
|
4041
|
+
e && (e.observer.disconnect(), S.registrations.delete(t));
|
|
4035
4042
|
const o = new IntersectionObserver(
|
|
4036
4043
|
(h) => {
|
|
4037
|
-
const
|
|
4038
|
-
|
|
4039
|
-
!
|
|
4040
|
-
E &&
|
|
4044
|
+
const b = S.registrations.get(t);
|
|
4045
|
+
b && h.forEach((g) => {
|
|
4046
|
+
!g.isIntersecting || b.running || S.isDisabled(b.fragment) || (b.running = !0, new V(b.fragment, "intersect").runWithResult().then((E) => {
|
|
4047
|
+
E && b.once && (b.observer.disconnect(), S.registrations.delete(t));
|
|
4041
4048
|
}).catch((E) => {
|
|
4042
4049
|
d.error(
|
|
4043
4050
|
"[Haori]",
|
|
@@ -4045,7 +4052,7 @@ const N = class N {
|
|
|
4045
4052
|
E
|
|
4046
4053
|
);
|
|
4047
4054
|
}).finally(() => {
|
|
4048
|
-
const E =
|
|
4055
|
+
const E = S.registrations.get(t);
|
|
4049
4056
|
E && (E.running = !1);
|
|
4050
4057
|
}));
|
|
4051
4058
|
});
|
|
@@ -4056,7 +4063,7 @@ const N = class N {
|
|
|
4056
4063
|
threshold: s
|
|
4057
4064
|
}
|
|
4058
4065
|
);
|
|
4059
|
-
o.observe(t),
|
|
4066
|
+
o.observe(t), S.registrations.set(t, {
|
|
4060
4067
|
fragment: r,
|
|
4061
4068
|
observer: o,
|
|
4062
4069
|
once: a,
|
|
@@ -4065,25 +4072,25 @@ const N = class N {
|
|
|
4065
4072
|
}
|
|
4066
4073
|
static cleanupTree(t) {
|
|
4067
4074
|
if (t instanceof HTMLElement) {
|
|
4068
|
-
const e =
|
|
4069
|
-
e && (e.observer.disconnect(),
|
|
4075
|
+
const e = S.registrations.get(t);
|
|
4076
|
+
e && (e.observer.disconnect(), S.registrations.delete(t));
|
|
4070
4077
|
}
|
|
4071
4078
|
(t instanceof Element || t instanceof DocumentFragment) && t.querySelectorAll("*").forEach((e) => {
|
|
4072
|
-
const r =
|
|
4073
|
-
r && (r.observer.disconnect(),
|
|
4079
|
+
const r = S.registrations.get(e);
|
|
4080
|
+
r && (r.observer.disconnect(), S.registrations.delete(e));
|
|
4074
4081
|
});
|
|
4075
4082
|
}
|
|
4076
4083
|
static disconnectAll() {
|
|
4077
|
-
|
|
4084
|
+
S.registrations.forEach((t) => {
|
|
4078
4085
|
t.observer.disconnect();
|
|
4079
|
-
}),
|
|
4086
|
+
}), S.registrations.clear();
|
|
4080
4087
|
}
|
|
4081
4088
|
static shouldObserve(t) {
|
|
4082
4089
|
return t.getAttributeNames().some((e) => {
|
|
4083
4090
|
if (!e.startsWith(`${l.prefix}intersect-`))
|
|
4084
4091
|
return !1;
|
|
4085
4092
|
const r = e.slice(`${l.prefix}intersect-`.length);
|
|
4086
|
-
return !
|
|
4093
|
+
return !S.CONFIG_KEYS.has(r);
|
|
4087
4094
|
});
|
|
4088
4095
|
}
|
|
4089
4096
|
static resolveRoot(t) {
|
|
@@ -4117,14 +4124,14 @@ const N = class N {
|
|
|
4117
4124
|
return t.length === 1 && t[0] === e;
|
|
4118
4125
|
}
|
|
4119
4126
|
};
|
|
4120
|
-
|
|
4127
|
+
S.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
4121
4128
|
"root",
|
|
4122
4129
|
"root-margin",
|
|
4123
4130
|
"threshold",
|
|
4124
4131
|
"disabled",
|
|
4125
4132
|
"once"
|
|
4126
|
-
]),
|
|
4127
|
-
let L =
|
|
4133
|
+
]), S.registrations = /* @__PURE__ */ new Map();
|
|
4134
|
+
let L = S;
|
|
4128
4135
|
const H = class H {
|
|
4129
4136
|
/**
|
|
4130
4137
|
* 初期化メソッド。
|
|
@@ -4138,7 +4145,7 @@ const H = class H {
|
|
|
4138
4145
|
R.scan(document.head),
|
|
4139
4146
|
R.scan(document.body)
|
|
4140
4147
|
]), [e, r] = t;
|
|
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);
|
|
4148
|
+
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), await F.wait(), document.body.setAttribute("data-haori-ready", ""), H.observe(document.head), H.observe(document.body), new Q().start(), L.syncTree(document.body);
|
|
4142
4149
|
}
|
|
4143
4150
|
/**
|
|
4144
4151
|
* 指定された要素を監視します。
|
|
@@ -4214,7 +4221,7 @@ const H = class H {
|
|
|
4214
4221
|
H._initialized = !1;
|
|
4215
4222
|
let q = H;
|
|
4216
4223
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", q.init) : q.init();
|
|
4217
|
-
const pt = "0.4.
|
|
4224
|
+
const pt = "0.4.8";
|
|
4218
4225
|
export {
|
|
4219
4226
|
R as Core,
|
|
4220
4227
|
l as Env,
|
|
@@ -4222,7 +4229,7 @@ export {
|
|
|
4222
4229
|
w as Fragment,
|
|
4223
4230
|
X as Haori,
|
|
4224
4231
|
d as Log,
|
|
4225
|
-
|
|
4232
|
+
F as Queue,
|
|
4226
4233
|
X as default,
|
|
4227
4234
|
pt as version
|
|
4228
4235
|
};
|