haori 0.41.1 → 0.41.3
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 +6 -6
- package/dist/haori.es.js +150 -84
- package/dist/haori.iife.js +8 -8
- package/dist/index.d.ts +8 -3
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -662,7 +662,7 @@ const vt = Object.freeze({
|
|
|
662
662
|
distinct: lt,
|
|
663
663
|
groupBy: ut
|
|
664
664
|
});
|
|
665
|
-
class
|
|
665
|
+
class Be {
|
|
666
666
|
constructor() {
|
|
667
667
|
this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
|
|
668
668
|
}
|
|
@@ -752,7 +752,7 @@ class Le {
|
|
|
752
752
|
async waitForIdle(e = 1e3) {
|
|
753
753
|
let t = 0, r = 0;
|
|
754
754
|
for (; t < 2 && r < e; )
|
|
755
|
-
this.processing || this.queue.length > 0 ? (await this.wait(), t = 0) : t += 1, await
|
|
755
|
+
this.processing || this.queue.length > 0 ? (await this.wait(), t = 0) : t += 1, await Be.nextTick(), r += 1;
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
758
758
|
* 次のフレーム(または 1 マクロタスク)まで待機します。
|
|
@@ -792,7 +792,7 @@ const He = class He {
|
|
|
792
792
|
return this.ASYNC_QUEUE.waitForIdle(e);
|
|
793
793
|
}
|
|
794
794
|
};
|
|
795
|
-
He.ASYNC_QUEUE = new
|
|
795
|
+
He.ASYNC_QUEUE = new Be();
|
|
796
796
|
let W = He;
|
|
797
797
|
const C = class C {
|
|
798
798
|
/**
|
|
@@ -3349,8 +3349,13 @@ const M = class M extends N {
|
|
|
3349
3349
|
/**
|
|
3350
3350
|
* この入力欄がユーザーに編集されたことを記録します。
|
|
3351
3351
|
*
|
|
3352
|
-
* `change` / `input`
|
|
3353
|
-
*
|
|
3352
|
+
* DOM で `change` / `input` が発火した時点に呼び出します。イベントを伴って値を
|
|
3353
|
+
* 反映した場合(`Form.setValues()` など)も、その発火を通じて呼ばれます。
|
|
3354
|
+
* イベントを伴わない反映(`syncBindingValue()` や `Core.setBindingData()` 由来の
|
|
3355
|
+
* 書き戻し)では呼び出しません。
|
|
3356
|
+
*
|
|
3357
|
+
* 内部値の同期(`syncValue()`)とは独立です。手続きを起動しない `input` では
|
|
3358
|
+
* 発番だけを行い、内部値は同期しません(`EventDispatcher.recordUserEdit()`)。
|
|
3354
3359
|
*
|
|
3355
3360
|
* @returns 発番した編集の通番
|
|
3356
3361
|
*/
|
|
@@ -3715,14 +3720,14 @@ const M = class M extends N {
|
|
|
3715
3720
|
r,
|
|
3716
3721
|
l
|
|
3717
3722
|
);
|
|
3718
|
-
const D = o.isForceEvaluation() ? r : y ? S : A,
|
|
3723
|
+
const D = o.isForceEvaluation() ? r : y ? S : A, L = i && o.isEvaluate && t === "value" && M.isValuePropertyTarget(l), E = l.getRootNode(), v = L && (l === E.activeElement || this.hasPendingUserEdit()), R = P || D === null || D === !1 ? null : String(D), k = e !== t && l.getAttribute(e) !== r, x = R === null ? l.hasAttribute(t) : l.getAttribute(t) !== R, V = R === null ? "" : R, G = L && !v && l.value !== V, _ = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), Z = t === "selected" && l instanceof HTMLOptionElement, Ne = E.activeElement, Fe = Ne !== null && (_ && l === Ne || Z && l.closest("select") === Ne) || (_ || Z) && this.hasPendingCheckableUserEdit(Z), be = R !== null, xe = _ && !Fe && l.checked !== be, ye = Z && !Fe && l.selected !== be;
|
|
3719
3724
|
if (!k && !x && !G && !xe && !ye)
|
|
3720
|
-
return
|
|
3725
|
+
return L && !v && (this.value = this.normalizeValueForElement(
|
|
3721
3726
|
l,
|
|
3722
3727
|
V
|
|
3723
3728
|
), this.clearUnappliedValueWrite()), (_ || Z) && !Fe && this.syncCheckableValueFromDom(Z), Promise.resolve();
|
|
3724
3729
|
const Ue = W.enqueue(() => {
|
|
3725
|
-
k && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : x && (l.setAttribute(t, R), t === `${u.prefix}bind` && this.recordSelfWrittenBind(R)),
|
|
3730
|
+
k && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : x && (l.setAttribute(t, R), t === `${u.prefix}bind` && this.recordSelfWrittenBind(R)), L && !v && (this.value = this.normalizeValueForElement(
|
|
3726
3731
|
l,
|
|
3727
3732
|
V
|
|
3728
3733
|
), G && (l.value = V), this.recordValueWriteResult(l.value === V)), xe && (l.checked = be), ye && (l.selected = be), (xe || ye) && this.syncCheckableValueFromDom(ye);
|
|
@@ -5995,8 +6000,8 @@ const p = class p {
|
|
|
5995
6000
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
5996
6001
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
5997
6002
|
!p.isGroupedCheckable(e) && !p.isMultipleSelect(e)) {
|
|
5998
|
-
const
|
|
5999
|
-
s.set(
|
|
6003
|
+
const L = String(l), E = s.get(L) ?? 0;
|
|
6004
|
+
s.set(L, E + 1), o.push(
|
|
6000
6005
|
p.applyFragmentValue(
|
|
6001
6006
|
e,
|
|
6002
6007
|
D[E] ?? null,
|
|
@@ -6045,8 +6050,8 @@ const p = class p {
|
|
|
6045
6050
|
A,
|
|
6046
6051
|
P == null ? null : String(P)
|
|
6047
6052
|
) : null;
|
|
6048
|
-
for (let
|
|
6049
|
-
const E = S[
|
|
6053
|
+
for (let L = 0; L < S.length; L++) {
|
|
6054
|
+
const E = S[L], v = D ? D[L] : A.length > L ? A[L] : null;
|
|
6050
6055
|
o.push(
|
|
6051
6056
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
6052
6057
|
p.setPartValues(
|
|
@@ -7338,7 +7343,7 @@ function me(g) {
|
|
|
7338
7343
|
me
|
|
7339
7344
|
) : !1;
|
|
7340
7345
|
}
|
|
7341
|
-
function
|
|
7346
|
+
function Lt(g) {
|
|
7342
7347
|
return Object.values(g).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
7343
7348
|
(t) => !(t instanceof Blob) && me(t)
|
|
7344
7349
|
) : me(e));
|
|
@@ -7370,7 +7375,7 @@ function $e(g) {
|
|
|
7370
7375
|
t[r] = e(i);
|
|
7371
7376
|
return F.carryCollectedRowIdentity(g, t), t;
|
|
7372
7377
|
}
|
|
7373
|
-
function
|
|
7378
|
+
function Bt(g, e) {
|
|
7374
7379
|
const t = new Headers(
|
|
7375
7380
|
e.headers || void 0
|
|
7376
7381
|
), r = Array.from(t.entries()).sort(
|
|
@@ -7988,22 +7993,22 @@ ${R}
|
|
|
7988
7993
|
`Element not found: ${E} (${D})`
|
|
7989
7994
|
)) : v.push(e), v.length > 0 && (r.fetchStateFragments = v);
|
|
7990
7995
|
}
|
|
7991
|
-
const
|
|
7992
|
-
if (e.hasAttribute(
|
|
7993
|
-
const E = e.getRawAttribute(
|
|
7996
|
+
const L = t ? b.attrName(t, "store-clear") : b.attrName(null, "store-clear", !0);
|
|
7997
|
+
if (e.hasAttribute(L)) {
|
|
7998
|
+
const E = e.getRawAttribute(L), v = E === null ? "" : E.trim();
|
|
7994
7999
|
if (v === "")
|
|
7995
8000
|
m.error(
|
|
7996
8001
|
"Haori",
|
|
7997
|
-
`ストレージキーが指定されていません (${
|
|
8002
|
+
`ストレージキーが指定されていません (${L})`
|
|
7998
8003
|
);
|
|
7999
8004
|
else {
|
|
8000
8005
|
r.storeClearKey = v;
|
|
8001
8006
|
const R = e.getRawAttribute(
|
|
8002
|
-
`${
|
|
8007
|
+
`${L}-type`
|
|
8003
8008
|
), k = R === null ? "session" : R.trim();
|
|
8004
8009
|
k === "local" || k === "session" ? r.storeClearKind = k : (m.warn(
|
|
8005
8010
|
"Haori",
|
|
8006
|
-
`${
|
|
8011
|
+
`${L}-type は session または local を指定してください(session として扱います): ${k}`
|
|
8007
8012
|
), r.storeClearKind = "session");
|
|
8008
8013
|
}
|
|
8009
8014
|
}
|
|
@@ -8149,11 +8154,11 @@ ${R}
|
|
|
8149
8154
|
s
|
|
8150
8155
|
);
|
|
8151
8156
|
n = S.url;
|
|
8152
|
-
const P = { ...S.options }, D = S.normalized ? S.requestedMethod : r.requestedMethod,
|
|
8157
|
+
const P = { ...S.options }, D = S.normalized ? S.requestedMethod : r.requestedMethod, L = S.effectiveMethod, E = r.transportMode === "query-get" || S.normalized, v = S.queryString ?? r.queryString;
|
|
8153
8158
|
if (E && m.info("Haori demo fetch normalization", {
|
|
8154
8159
|
runtime: u.runtime,
|
|
8155
8160
|
requestedMethod: D,
|
|
8156
|
-
effectiveMethod:
|
|
8161
|
+
effectiveMethod: L,
|
|
8157
8162
|
transportMode: "query-get",
|
|
8158
8163
|
url: n,
|
|
8159
8164
|
payload: l ? i : void 0,
|
|
@@ -8162,7 +8167,7 @@ ${R}
|
|
|
8162
8167
|
const R = performance.now(), k = {
|
|
8163
8168
|
runtime: u.runtime,
|
|
8164
8169
|
requestedMethod: D,
|
|
8165
|
-
effectiveMethod:
|
|
8170
|
+
effectiveMethod: L,
|
|
8166
8171
|
transportMode: E ? "query-get" : "http",
|
|
8167
8172
|
...E ? { queryString: v } : {}
|
|
8168
8173
|
};
|
|
@@ -8194,17 +8199,17 @@ ${R}
|
|
|
8194
8199
|
const h = this.options.formFragment, y = h.getTarget(), A = /* @__PURE__ */ new Set();
|
|
8195
8200
|
e && e.appliedDisabledAttribute && this.options.targetFragment && A.add(this.options.targetFragment);
|
|
8196
8201
|
const S = h.getRawBindingData(), P = $e(i), D = h.getAttribute(`${u.prefix}form-arg`);
|
|
8197
|
-
let
|
|
8202
|
+
let L;
|
|
8198
8203
|
if (D) {
|
|
8199
|
-
|
|
8204
|
+
L = { ...S ?? {} };
|
|
8200
8205
|
const E = String(D), v = F.resolveAncestorArgOwner(h, E);
|
|
8201
|
-
|
|
8202
|
-
(v ? v.value :
|
|
8206
|
+
L[E] = F.mergeCollectedValues(
|
|
8207
|
+
(v ? v.value : L[E]) ?? null,
|
|
8203
8208
|
P
|
|
8204
8209
|
);
|
|
8205
8210
|
} else
|
|
8206
|
-
|
|
8207
|
-
await O.setBindingData(y,
|
|
8211
|
+
L = F.mergeCollectedValues(S, P);
|
|
8212
|
+
await O.setBindingData(y, L, {
|
|
8208
8213
|
skipFragments: A,
|
|
8209
8214
|
kind: "nonSupply",
|
|
8210
8215
|
sequence: this.operationSequence,
|
|
@@ -9059,7 +9064,7 @@ ${R}
|
|
|
9059
9064
|
), a = (n.method || "GET").toUpperCase(), o = u.runtime === "demo" && !Pe(a), l = o ? "GET" : a;
|
|
9060
9065
|
if (n.method = l, Object.keys(t).length > 0 && me(t)) {
|
|
9061
9066
|
const d = s.get("Content-Type") || "";
|
|
9062
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ?
|
|
9067
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Lt(t) && m.warn(
|
|
9063
9068
|
"Haori",
|
|
9064
9069
|
`A File value nested under ${u.prefix}form-object / ${u.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
9065
9070
|
) : m.warn(
|
|
@@ -9099,7 +9104,7 @@ ${R}
|
|
|
9099
9104
|
effectiveMethod: l,
|
|
9100
9105
|
queryString: c,
|
|
9101
9106
|
transportMode: o ? "query-get" : "http",
|
|
9102
|
-
signature:
|
|
9107
|
+
signature: Bt(i, n)
|
|
9103
9108
|
};
|
|
9104
9109
|
}
|
|
9105
9110
|
/**
|
|
@@ -10168,10 +10173,10 @@ const f = class f {
|
|
|
10168
10173
|
return e.tagName === "FORM" && (D = D.then(() => {
|
|
10169
10174
|
if (i.wasResetAfter(h))
|
|
10170
10175
|
return;
|
|
10171
|
-
const
|
|
10176
|
+
const L = i.getRawBindingData() ?? A;
|
|
10172
10177
|
return F.syncValues(
|
|
10173
10178
|
i,
|
|
10174
|
-
F.resolveSyncValues(i,
|
|
10179
|
+
F.resolveSyncValues(i, L),
|
|
10175
10180
|
!1,
|
|
10176
10181
|
c
|
|
10177
10182
|
);
|
|
@@ -10183,8 +10188,8 @@ const f = class f {
|
|
|
10183
10188
|
() => f.reevaluateReactiveSpecialAttributes(i, n)
|
|
10184
10189
|
), D.then(
|
|
10185
10190
|
() => i.markBindingWorkEnd(),
|
|
10186
|
-
(
|
|
10187
|
-
throw i.markBindingWorkEnd(),
|
|
10191
|
+
(L) => {
|
|
10192
|
+
throw i.markBindingWorkEnd(), L;
|
|
10188
10193
|
}
|
|
10189
10194
|
);
|
|
10190
10195
|
};
|
|
@@ -11403,7 +11408,7 @@ ${r}
|
|
|
11403
11408
|
const P = e.getChildElementFragments().filter((E) => !y.has(E)), D = P.filter(
|
|
11404
11409
|
(E) => E.hasAttribute(`${u.prefix}each-before`)
|
|
11405
11410
|
).length;
|
|
11406
|
-
let
|
|
11411
|
+
let L = Promise.resolve();
|
|
11407
11412
|
return a.forEach((E, v) => {
|
|
11408
11413
|
const R = t[v], k = v;
|
|
11409
11414
|
let x;
|
|
@@ -11411,7 +11416,7 @@ ${r}
|
|
|
11411
11416
|
if (V) {
|
|
11412
11417
|
x = V;
|
|
11413
11418
|
const G = D + v;
|
|
11414
|
-
|
|
11419
|
+
L = L.then(
|
|
11415
11420
|
() => f.updateRowFragment(
|
|
11416
11421
|
x,
|
|
11417
11422
|
R,
|
|
@@ -11446,7 +11451,7 @@ ${r}
|
|
|
11446
11451
|
} else {
|
|
11447
11452
|
x = r.clone();
|
|
11448
11453
|
const G = D + v;
|
|
11449
|
-
|
|
11454
|
+
L = L.then(
|
|
11450
11455
|
() => f.updateRowFragment(
|
|
11451
11456
|
x,
|
|
11452
11457
|
R,
|
|
@@ -11464,7 +11469,7 @@ ${r}
|
|
|
11464
11469
|
})
|
|
11465
11470
|
);
|
|
11466
11471
|
}
|
|
11467
|
-
}), Promise.all(c).then(() =>
|
|
11472
|
+
}), Promise.all(c).then(() => L).then(() => {
|
|
11468
11473
|
const E = a.filter(
|
|
11469
11474
|
(G) => G !== null
|
|
11470
11475
|
), v = A.filter(
|
|
@@ -11923,8 +11928,10 @@ const fe = class fe {
|
|
|
11923
11928
|
if (r) {
|
|
11924
11929
|
if (t === "input") {
|
|
11925
11930
|
const i = `${u.prefix}input-`;
|
|
11926
|
-
if (!r.getAttributeNames().some((s) => s.startsWith(i)))
|
|
11931
|
+
if (!r.getAttributeNames().some((s) => s.startsWith(i))) {
|
|
11932
|
+
this.recordUserEdit(r);
|
|
11927
11933
|
return;
|
|
11934
|
+
}
|
|
11928
11935
|
}
|
|
11929
11936
|
if (r.hasAttribute(`${u.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
11930
11937
|
this.deferredProcedures.push(() => {
|
|
@@ -11947,15 +11954,7 @@ const fe = class fe {
|
|
|
11947
11954
|
const i = N.get(e);
|
|
11948
11955
|
if (!i)
|
|
11949
11956
|
return;
|
|
11950
|
-
|
|
11951
|
-
const s = document.getElementsByName(e.name);
|
|
11952
|
-
for (const a of Array.from(s)) {
|
|
11953
|
-
if (a === e || !(a instanceof HTMLInputElement) || a.type !== "radio" || a.form !== e.form)
|
|
11954
|
-
continue;
|
|
11955
|
-
const o = N.get(a);
|
|
11956
|
-
o instanceof T && (o.syncValue(), o.markUserEdit());
|
|
11957
|
-
}
|
|
11958
|
-
}
|
|
11957
|
+
(t === "change" || t === "input") && this.syncUserEdit(e);
|
|
11959
11958
|
const n = () => {
|
|
11960
11959
|
new ee(i, t, r).run().catch((s) => {
|
|
11961
11960
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
@@ -11967,6 +11966,73 @@ const fe = class fe {
|
|
|
11967
11966
|
}
|
|
11968
11967
|
n();
|
|
11969
11968
|
}
|
|
11969
|
+
/**
|
|
11970
|
+
* 手続きを起動しない `input` について、ユーザー編集の通番だけを発番します。
|
|
11971
|
+
*
|
|
11972
|
+
* `data-input-*` を宣言していない入力欄でも、打鍵は編集として記録しなければ
|
|
11973
|
+
* なりません(記録しないと、反映待ちの書き込みが打鍵の後に着弾して打った文字を
|
|
11974
|
+
* 消します)。初期化中は手続きと同じく保留し、フラグメントが確定した後に記録
|
|
11975
|
+
* します。
|
|
11976
|
+
*
|
|
11977
|
+
* **内部値は同期しません**(`syncUserEdit()` との違い)。内部値は「バインドデータへ
|
|
11978
|
+
* 載っている値」を表し、DOM が先に進むことは許されています(値収集は DOM を真として
|
|
11979
|
+
* 読みます。`ElementFragment.getValueForCollection()`)。ここで同期すると、まだ
|
|
11980
|
+
* バインドデータへ載っていない値が内部値だけに載った状態になり、次の逆方向同期
|
|
11981
|
+
* (`Form.syncValues()`)が古いバインドデータで入力欄を上書きして値を消します。
|
|
11982
|
+
* 反映待ちの書き込みからの保護は通番の発番だけで成立します。
|
|
11983
|
+
*
|
|
11984
|
+
* 内部値を DOM から取り込むのは、値がバインドデータへ載る機会(`change` の双方向
|
|
11985
|
+
* コミット、または `data-input-*` を宣言した要素の手続き)と同じ時点だけです。
|
|
11986
|
+
*
|
|
11987
|
+
* 対象は値を持つ入力要素だけです。`contenteditable` など値収集の対象でない要素で
|
|
11988
|
+
* `input` が発火しても、記録すべき編集はありません。
|
|
11989
|
+
*
|
|
11990
|
+
* @param element 編集された要素
|
|
11991
|
+
* @returns 戻り値はない。
|
|
11992
|
+
*/
|
|
11993
|
+
recordUserEdit(e) {
|
|
11994
|
+
if (!(!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement))) {
|
|
11995
|
+
if (this.deferred) {
|
|
11996
|
+
this.deferredProcedures.push(() => {
|
|
11997
|
+
e.isConnected && this.markUserEditOnly(e);
|
|
11998
|
+
});
|
|
11999
|
+
return;
|
|
12000
|
+
}
|
|
12001
|
+
this.markUserEditOnly(e);
|
|
12002
|
+
}
|
|
12003
|
+
}
|
|
12004
|
+
/**
|
|
12005
|
+
* 内部値を同期せず、ユーザー編集の通番だけを発番します。
|
|
12006
|
+
*
|
|
12007
|
+
* @param element 編集された要素
|
|
12008
|
+
* @returns 戻り値はない。
|
|
12009
|
+
*/
|
|
12010
|
+
markUserEditOnly(e) {
|
|
12011
|
+
const t = N.get(e);
|
|
12012
|
+
t instanceof T && t.markUserEdit();
|
|
12013
|
+
}
|
|
12014
|
+
/**
|
|
12015
|
+
* `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
|
|
12016
|
+
*
|
|
12017
|
+
* 呼び出すのは、値がバインドデータへ載る機会と同じ時点に限ります(`change` の
|
|
12018
|
+
* 双方向コミット、または `data-input-*` を宣言した要素の手続き)。手続きを
|
|
12019
|
+
* 起動しない `input` では内部値を同期してはいけません(`recordUserEdit()`)。
|
|
12020
|
+
*
|
|
12021
|
+
* @param element 編集された要素
|
|
12022
|
+
* @returns 戻り値はない。
|
|
12023
|
+
*/
|
|
12024
|
+
syncUserEdit(e) {
|
|
12025
|
+
const t = N.get(e);
|
|
12026
|
+
if (t instanceof T && (t.syncValue(), t.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
12027
|
+
const r = document.getElementsByName(e.name);
|
|
12028
|
+
for (const i of Array.from(r)) {
|
|
12029
|
+
if (i === e || !(i instanceof HTMLInputElement) || i.type !== "radio" || i.form !== e.form)
|
|
12030
|
+
continue;
|
|
12031
|
+
const n = N.get(i);
|
|
12032
|
+
n instanceof T && (n.syncValue(), n.markUserEdit());
|
|
12033
|
+
}
|
|
12034
|
+
}
|
|
12035
|
+
}
|
|
11970
12036
|
/**
|
|
11971
12037
|
* イベントのターゲットから HTMLElement を取得します。
|
|
11972
12038
|
*
|
|
@@ -12016,7 +12082,7 @@ fe.HISTORY_STATE_KEY = "__haoriHistoryState__", fe.BUILTIN_EVENT_NAMES = /* @__P
|
|
|
12016
12082
|
"input",
|
|
12017
12083
|
"load"
|
|
12018
12084
|
]);
|
|
12019
|
-
let
|
|
12085
|
+
let Le = fe;
|
|
12020
12086
|
const U = class U {
|
|
12021
12087
|
/**
|
|
12022
12088
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -12689,11 +12755,11 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
12689
12755
|
"state"
|
|
12690
12756
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
12691
12757
|
let ce = w;
|
|
12692
|
-
const Ht = "0.41.
|
|
12758
|
+
const Ht = "0.41.3";
|
|
12693
12759
|
function Ut(g) {
|
|
12694
12760
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => g()) : Promise.resolve().then(g);
|
|
12695
12761
|
}
|
|
12696
|
-
const
|
|
12762
|
+
const B = class B {
|
|
12697
12763
|
/**
|
|
12698
12764
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
12699
12765
|
*
|
|
@@ -12712,8 +12778,8 @@ const L = class L {
|
|
|
12712
12778
|
* @param root 走査の起点ノード
|
|
12713
12779
|
*/
|
|
12714
12780
|
static syncTree(e) {
|
|
12715
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
12716
|
-
|
|
12781
|
+
(e instanceof Element || e instanceof DocumentFragment) && (B.isHtmlElement(e) && B.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
12782
|
+
B.syncElement(t);
|
|
12717
12783
|
}));
|
|
12718
12784
|
}
|
|
12719
12785
|
/**
|
|
@@ -12723,42 +12789,42 @@ const L = class L {
|
|
|
12723
12789
|
* @param element 対象要素
|
|
12724
12790
|
*/
|
|
12725
12791
|
static syncElement(e) {
|
|
12726
|
-
const t =
|
|
12727
|
-
if (!(r instanceof T) || !
|
|
12728
|
-
t && (t.observer.disconnect(),
|
|
12792
|
+
const t = B.registrations.get(e), r = N.get(e);
|
|
12793
|
+
if (!(r instanceof T) || !B.shouldObserve(r)) {
|
|
12794
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12729
12795
|
return;
|
|
12730
12796
|
}
|
|
12731
12797
|
if (typeof IntersectionObserver > "u")
|
|
12732
12798
|
return;
|
|
12733
|
-
const i =
|
|
12799
|
+
const i = B.resolveVarName(r);
|
|
12734
12800
|
if (i === "") {
|
|
12735
|
-
t && (t.observer.disconnect(),
|
|
12801
|
+
t && (t.observer.disconnect(), B.registrations.delete(e)), m.warn(
|
|
12736
12802
|
"[Haori]",
|
|
12737
12803
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
12738
12804
|
);
|
|
12739
12805
|
return;
|
|
12740
12806
|
}
|
|
12741
|
-
const n =
|
|
12807
|
+
const n = B.resolveRoot(r), s = B.resolveRootMargin(r);
|
|
12742
12808
|
if (t && t.observer.root === n && t.observer.rootMargin === s && t.varName === i) {
|
|
12743
|
-
t.fragment = r,
|
|
12809
|
+
t.fragment = r, B.refreshRows(t);
|
|
12744
12810
|
return;
|
|
12745
12811
|
}
|
|
12746
|
-
t && (t.observer.disconnect(),
|
|
12812
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12747
12813
|
const a = new IntersectionObserver(
|
|
12748
12814
|
(l) => {
|
|
12749
|
-
const c =
|
|
12815
|
+
const c = B.registrations.get(e);
|
|
12750
12816
|
if (!c)
|
|
12751
12817
|
return;
|
|
12752
12818
|
let d = !1;
|
|
12753
12819
|
l.forEach((h) => {
|
|
12754
12820
|
const y = h.target;
|
|
12755
12821
|
c.observedRows.has(y) && (h.isIntersecting ? c.visibleRows.has(y) || (c.visibleRows.add(y), d = !0) : c.visibleRows.delete(y) && (d = !0));
|
|
12756
|
-
}), d &&
|
|
12822
|
+
}), d && B.scheduleCompute(c);
|
|
12757
12823
|
},
|
|
12758
12824
|
{
|
|
12759
12825
|
root: n,
|
|
12760
12826
|
rootMargin: s,
|
|
12761
|
-
threshold:
|
|
12827
|
+
threshold: B.THRESHOLD
|
|
12762
12828
|
}
|
|
12763
12829
|
), o = {
|
|
12764
12830
|
fragment: r,
|
|
@@ -12771,7 +12837,7 @@ const L = class L {
|
|
|
12771
12837
|
scheduled: !1,
|
|
12772
12838
|
lastSnapshot: null
|
|
12773
12839
|
};
|
|
12774
|
-
|
|
12840
|
+
B.registrations.set(e, o), B.refreshRows(o);
|
|
12775
12841
|
}
|
|
12776
12842
|
/**
|
|
12777
12843
|
* 指定ノード配下の監視登録を解放します。
|
|
@@ -12779,22 +12845,22 @@ const L = class L {
|
|
|
12779
12845
|
* @param root 走査の起点ノード
|
|
12780
12846
|
*/
|
|
12781
12847
|
static cleanupTree(e) {
|
|
12782
|
-
if (
|
|
12783
|
-
const t =
|
|
12784
|
-
t && (t.observer.disconnect(),
|
|
12848
|
+
if (B.isHtmlElement(e)) {
|
|
12849
|
+
const t = B.registrations.get(e);
|
|
12850
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12785
12851
|
}
|
|
12786
12852
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
12787
|
-
const r =
|
|
12788
|
-
r && (r.observer.disconnect(),
|
|
12853
|
+
const r = B.registrations.get(t);
|
|
12854
|
+
r && (r.observer.disconnect(), B.registrations.delete(t));
|
|
12789
12855
|
});
|
|
12790
12856
|
}
|
|
12791
12857
|
/**
|
|
12792
12858
|
* すべての監視登録を解放します。
|
|
12793
12859
|
*/
|
|
12794
12860
|
static disconnectAll() {
|
|
12795
|
-
|
|
12861
|
+
B.registrations.forEach((e) => {
|
|
12796
12862
|
e.observer.disconnect();
|
|
12797
|
-
}),
|
|
12863
|
+
}), B.registrations.clear();
|
|
12798
12864
|
}
|
|
12799
12865
|
/**
|
|
12800
12866
|
* 監視対象(`data-each` かつ `data-each-visible`)かどうかを判定します。
|
|
@@ -12829,7 +12895,7 @@ const L = class L {
|
|
|
12829
12895
|
if (typeof r != "string" || r.trim() === "")
|
|
12830
12896
|
return null;
|
|
12831
12897
|
const i = z.query(r, t, document);
|
|
12832
|
-
return
|
|
12898
|
+
return B.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
12833
12899
|
}
|
|
12834
12900
|
/**
|
|
12835
12901
|
* rootMargin を解決します。
|
|
@@ -12839,7 +12905,7 @@ const L = class L {
|
|
|
12839
12905
|
*/
|
|
12840
12906
|
static resolveRootMargin(e) {
|
|
12841
12907
|
const t = `${u.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
12842
|
-
return r === null || r === !1 || r === "" ?
|
|
12908
|
+
return r === null || r === !1 || r === "" ? B.DEFAULT_ROOT_MARGIN : String(r);
|
|
12843
12909
|
}
|
|
12844
12910
|
/**
|
|
12845
12911
|
* コンテナ直下の実際の行要素(`each-before`/`each-after` を除く)を描画順で返します。
|
|
@@ -12859,12 +12925,12 @@ const L = class L {
|
|
|
12859
12925
|
* @param registration 対象の登録
|
|
12860
12926
|
*/
|
|
12861
12927
|
static refreshRows(e) {
|
|
12862
|
-
const t =
|
|
12928
|
+
const t = B.realRowElements(e.fragment), r = new Set(t);
|
|
12863
12929
|
for (const i of [...e.observedRows])
|
|
12864
12930
|
r.has(i) || (e.observer.unobserve(i), e.observedRows.delete(i), e.visibleRows.delete(i));
|
|
12865
12931
|
for (const i of t)
|
|
12866
12932
|
e.observedRows.has(i) || (e.observer.observe(i), e.observedRows.add(i));
|
|
12867
|
-
|
|
12933
|
+
B.scheduleCompute(e);
|
|
12868
12934
|
}
|
|
12869
12935
|
/**
|
|
12870
12936
|
* 次フレームでの集計・公開を予約します(多発する交差イベントを 1 回にまとめる)。
|
|
@@ -12875,7 +12941,7 @@ const L = class L {
|
|
|
12875
12941
|
e.scheduled || (e.scheduled = !0, Ut(() => {
|
|
12876
12942
|
e.scheduled = !1;
|
|
12877
12943
|
const t = e.fragment.getTarget();
|
|
12878
|
-
|
|
12944
|
+
B.registrations.get(t) === e && B.computeAndPublish(e);
|
|
12879
12945
|
}));
|
|
12880
12946
|
}
|
|
12881
12947
|
/**
|
|
@@ -12884,7 +12950,7 @@ const L = class L {
|
|
|
12884
12950
|
* @param registration 対象の登録
|
|
12885
12951
|
*/
|
|
12886
12952
|
static computeAndPublish(e) {
|
|
12887
|
-
const t =
|
|
12953
|
+
const t = B.realRowElements(e.fragment), r = /* @__PURE__ */ new Map();
|
|
12888
12954
|
t.forEach((a, o) => r.set(a, o));
|
|
12889
12955
|
const i = [];
|
|
12890
12956
|
for (const a of e.visibleRows) {
|
|
@@ -12917,7 +12983,7 @@ const L = class L {
|
|
|
12917
12983
|
};
|
|
12918
12984
|
}
|
|
12919
12985
|
const s = JSON.stringify(n);
|
|
12920
|
-
s !== e.lastSnapshot && (e.lastSnapshot = s,
|
|
12986
|
+
s !== e.lastSnapshot && (e.lastSnapshot = s, B.publish(e, n));
|
|
12921
12987
|
}
|
|
12922
12988
|
/**
|
|
12923
12989
|
* 可視範囲スナップショットを最近接の上位 `data-bind` スコープへ公開します。
|
|
@@ -12926,7 +12992,7 @@ const L = class L {
|
|
|
12926
12992
|
* @param snapshot 公開するスナップショット
|
|
12927
12993
|
*/
|
|
12928
12994
|
static publish(e, t) {
|
|
12929
|
-
const r =
|
|
12995
|
+
const r = B.resolveBindOwner(e.fragment);
|
|
12930
12996
|
if (!r) {
|
|
12931
12997
|
m.warn(
|
|
12932
12998
|
"[Haori]",
|
|
@@ -12968,8 +13034,8 @@ const L = class L {
|
|
|
12968
13034
|
return e.hasAttribute(t) ? e : null;
|
|
12969
13035
|
}
|
|
12970
13036
|
};
|
|
12971
|
-
|
|
12972
|
-
let se =
|
|
13037
|
+
B.THRESHOLD = 0, B.DEFAULT_ROOT_MARGIN = "0px", B.registrations = /* @__PURE__ */ new Map();
|
|
13038
|
+
let se = B;
|
|
12973
13039
|
const K = class K {
|
|
12974
13040
|
/**
|
|
12975
13041
|
* 既存の MutationObserver をすべて停止します。
|
|
@@ -12989,7 +13055,7 @@ const K = class K {
|
|
|
12989
13055
|
K._initialized = !0, K.disconnectMutationObservers(), T.setPendingMutationFlusher(() => {
|
|
12990
13056
|
K.flushPendingMutations();
|
|
12991
13057
|
});
|
|
12992
|
-
const e = new
|
|
13058
|
+
const e = new Le();
|
|
12993
13059
|
K._dispatcher = e, e.startDeferred();
|
|
12994
13060
|
try {
|
|
12995
13061
|
const t = await Promise.allSettled([
|