haori 0.41.1 → 0.41.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +6 -6
- package/dist/haori.es.js +123 -84
- package/dist/haori.iife.js +8 -8
- package/dist/index.d.ts +5 -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,10 @@ const M = class M extends N {
|
|
|
3349
3349
|
/**
|
|
3350
3350
|
* この入力欄がユーザーに編集されたことを記録します。
|
|
3351
3351
|
*
|
|
3352
|
-
* `change` / `input`
|
|
3353
|
-
*
|
|
3352
|
+
* DOM で `change` / `input` が発火した時点(内部値を DOM から同期した直後)に
|
|
3353
|
+
* 呼び出します。イベントを伴って値を反映した場合(`Form.setValues()` など)も、
|
|
3354
|
+
* その発火を通じて呼ばれます。イベントを伴わない反映(`syncBindingValue()` や
|
|
3355
|
+
* `Core.setBindingData()` 由来の書き戻し)では呼び出しません。
|
|
3354
3356
|
*
|
|
3355
3357
|
* @returns 発番した編集の通番
|
|
3356
3358
|
*/
|
|
@@ -3715,14 +3717,14 @@ const M = class M extends N {
|
|
|
3715
3717
|
r,
|
|
3716
3718
|
l
|
|
3717
3719
|
);
|
|
3718
|
-
const D = o.isForceEvaluation() ? r : y ? S : A,
|
|
3720
|
+
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
3721
|
if (!k && !x && !G && !xe && !ye)
|
|
3720
|
-
return
|
|
3722
|
+
return L && !v && (this.value = this.normalizeValueForElement(
|
|
3721
3723
|
l,
|
|
3722
3724
|
V
|
|
3723
3725
|
), this.clearUnappliedValueWrite()), (_ || Z) && !Fe && this.syncCheckableValueFromDom(Z), Promise.resolve();
|
|
3724
3726
|
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)),
|
|
3727
|
+
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
3728
|
l,
|
|
3727
3729
|
V
|
|
3728
3730
|
), G && (l.value = V), this.recordValueWriteResult(l.value === V)), xe && (l.checked = be), ye && (l.selected = be), (xe || ye) && this.syncCheckableValueFromDom(ye);
|
|
@@ -5995,8 +5997,8 @@ const p = class p {
|
|
|
5995
5997
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
5996
5998
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
5997
5999
|
!p.isGroupedCheckable(e) && !p.isMultipleSelect(e)) {
|
|
5998
|
-
const
|
|
5999
|
-
s.set(
|
|
6000
|
+
const L = String(l), E = s.get(L) ?? 0;
|
|
6001
|
+
s.set(L, E + 1), o.push(
|
|
6000
6002
|
p.applyFragmentValue(
|
|
6001
6003
|
e,
|
|
6002
6004
|
D[E] ?? null,
|
|
@@ -6045,8 +6047,8 @@ const p = class p {
|
|
|
6045
6047
|
A,
|
|
6046
6048
|
P == null ? null : String(P)
|
|
6047
6049
|
) : null;
|
|
6048
|
-
for (let
|
|
6049
|
-
const E = S[
|
|
6050
|
+
for (let L = 0; L < S.length; L++) {
|
|
6051
|
+
const E = S[L], v = D ? D[L] : A.length > L ? A[L] : null;
|
|
6050
6052
|
o.push(
|
|
6051
6053
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
6052
6054
|
p.setPartValues(
|
|
@@ -7338,7 +7340,7 @@ function me(g) {
|
|
|
7338
7340
|
me
|
|
7339
7341
|
) : !1;
|
|
7340
7342
|
}
|
|
7341
|
-
function
|
|
7343
|
+
function Lt(g) {
|
|
7342
7344
|
return Object.values(g).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
7343
7345
|
(t) => !(t instanceof Blob) && me(t)
|
|
7344
7346
|
) : me(e));
|
|
@@ -7370,7 +7372,7 @@ function $e(g) {
|
|
|
7370
7372
|
t[r] = e(i);
|
|
7371
7373
|
return F.carryCollectedRowIdentity(g, t), t;
|
|
7372
7374
|
}
|
|
7373
|
-
function
|
|
7375
|
+
function Bt(g, e) {
|
|
7374
7376
|
const t = new Headers(
|
|
7375
7377
|
e.headers || void 0
|
|
7376
7378
|
), r = Array.from(t.entries()).sort(
|
|
@@ -7988,22 +7990,22 @@ ${R}
|
|
|
7988
7990
|
`Element not found: ${E} (${D})`
|
|
7989
7991
|
)) : v.push(e), v.length > 0 && (r.fetchStateFragments = v);
|
|
7990
7992
|
}
|
|
7991
|
-
const
|
|
7992
|
-
if (e.hasAttribute(
|
|
7993
|
-
const E = e.getRawAttribute(
|
|
7993
|
+
const L = t ? b.attrName(t, "store-clear") : b.attrName(null, "store-clear", !0);
|
|
7994
|
+
if (e.hasAttribute(L)) {
|
|
7995
|
+
const E = e.getRawAttribute(L), v = E === null ? "" : E.trim();
|
|
7994
7996
|
if (v === "")
|
|
7995
7997
|
m.error(
|
|
7996
7998
|
"Haori",
|
|
7997
|
-
`ストレージキーが指定されていません (${
|
|
7999
|
+
`ストレージキーが指定されていません (${L})`
|
|
7998
8000
|
);
|
|
7999
8001
|
else {
|
|
8000
8002
|
r.storeClearKey = v;
|
|
8001
8003
|
const R = e.getRawAttribute(
|
|
8002
|
-
`${
|
|
8004
|
+
`${L}-type`
|
|
8003
8005
|
), k = R === null ? "session" : R.trim();
|
|
8004
8006
|
k === "local" || k === "session" ? r.storeClearKind = k : (m.warn(
|
|
8005
8007
|
"Haori",
|
|
8006
|
-
`${
|
|
8008
|
+
`${L}-type は session または local を指定してください(session として扱います): ${k}`
|
|
8007
8009
|
), r.storeClearKind = "session");
|
|
8008
8010
|
}
|
|
8009
8011
|
}
|
|
@@ -8149,11 +8151,11 @@ ${R}
|
|
|
8149
8151
|
s
|
|
8150
8152
|
);
|
|
8151
8153
|
n = S.url;
|
|
8152
|
-
const P = { ...S.options }, D = S.normalized ? S.requestedMethod : r.requestedMethod,
|
|
8154
|
+
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
8155
|
if (E && m.info("Haori demo fetch normalization", {
|
|
8154
8156
|
runtime: u.runtime,
|
|
8155
8157
|
requestedMethod: D,
|
|
8156
|
-
effectiveMethod:
|
|
8158
|
+
effectiveMethod: L,
|
|
8157
8159
|
transportMode: "query-get",
|
|
8158
8160
|
url: n,
|
|
8159
8161
|
payload: l ? i : void 0,
|
|
@@ -8162,7 +8164,7 @@ ${R}
|
|
|
8162
8164
|
const R = performance.now(), k = {
|
|
8163
8165
|
runtime: u.runtime,
|
|
8164
8166
|
requestedMethod: D,
|
|
8165
|
-
effectiveMethod:
|
|
8167
|
+
effectiveMethod: L,
|
|
8166
8168
|
transportMode: E ? "query-get" : "http",
|
|
8167
8169
|
...E ? { queryString: v } : {}
|
|
8168
8170
|
};
|
|
@@ -8194,17 +8196,17 @@ ${R}
|
|
|
8194
8196
|
const h = this.options.formFragment, y = h.getTarget(), A = /* @__PURE__ */ new Set();
|
|
8195
8197
|
e && e.appliedDisabledAttribute && this.options.targetFragment && A.add(this.options.targetFragment);
|
|
8196
8198
|
const S = h.getRawBindingData(), P = $e(i), D = h.getAttribute(`${u.prefix}form-arg`);
|
|
8197
|
-
let
|
|
8199
|
+
let L;
|
|
8198
8200
|
if (D) {
|
|
8199
|
-
|
|
8201
|
+
L = { ...S ?? {} };
|
|
8200
8202
|
const E = String(D), v = F.resolveAncestorArgOwner(h, E);
|
|
8201
|
-
|
|
8202
|
-
(v ? v.value :
|
|
8203
|
+
L[E] = F.mergeCollectedValues(
|
|
8204
|
+
(v ? v.value : L[E]) ?? null,
|
|
8203
8205
|
P
|
|
8204
8206
|
);
|
|
8205
8207
|
} else
|
|
8206
|
-
|
|
8207
|
-
await O.setBindingData(y,
|
|
8208
|
+
L = F.mergeCollectedValues(S, P);
|
|
8209
|
+
await O.setBindingData(y, L, {
|
|
8208
8210
|
skipFragments: A,
|
|
8209
8211
|
kind: "nonSupply",
|
|
8210
8212
|
sequence: this.operationSequence,
|
|
@@ -9059,7 +9061,7 @@ ${R}
|
|
|
9059
9061
|
), a = (n.method || "GET").toUpperCase(), o = u.runtime === "demo" && !Pe(a), l = o ? "GET" : a;
|
|
9060
9062
|
if (n.method = l, Object.keys(t).length > 0 && me(t)) {
|
|
9061
9063
|
const d = s.get("Content-Type") || "";
|
|
9062
|
-
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ?
|
|
9064
|
+
l !== "GET" && l !== "HEAD" && l !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Lt(t) && m.warn(
|
|
9063
9065
|
"Haori",
|
|
9064
9066
|
`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
9067
|
) : m.warn(
|
|
@@ -9099,7 +9101,7 @@ ${R}
|
|
|
9099
9101
|
effectiveMethod: l,
|
|
9100
9102
|
queryString: c,
|
|
9101
9103
|
transportMode: o ? "query-get" : "http",
|
|
9102
|
-
signature:
|
|
9104
|
+
signature: Bt(i, n)
|
|
9103
9105
|
};
|
|
9104
9106
|
}
|
|
9105
9107
|
/**
|
|
@@ -10168,10 +10170,10 @@ const f = class f {
|
|
|
10168
10170
|
return e.tagName === "FORM" && (D = D.then(() => {
|
|
10169
10171
|
if (i.wasResetAfter(h))
|
|
10170
10172
|
return;
|
|
10171
|
-
const
|
|
10173
|
+
const L = i.getRawBindingData() ?? A;
|
|
10172
10174
|
return F.syncValues(
|
|
10173
10175
|
i,
|
|
10174
|
-
F.resolveSyncValues(i,
|
|
10176
|
+
F.resolveSyncValues(i, L),
|
|
10175
10177
|
!1,
|
|
10176
10178
|
c
|
|
10177
10179
|
);
|
|
@@ -10183,8 +10185,8 @@ const f = class f {
|
|
|
10183
10185
|
() => f.reevaluateReactiveSpecialAttributes(i, n)
|
|
10184
10186
|
), D.then(
|
|
10185
10187
|
() => i.markBindingWorkEnd(),
|
|
10186
|
-
(
|
|
10187
|
-
throw i.markBindingWorkEnd(),
|
|
10188
|
+
(L) => {
|
|
10189
|
+
throw i.markBindingWorkEnd(), L;
|
|
10188
10190
|
}
|
|
10189
10191
|
);
|
|
10190
10192
|
};
|
|
@@ -11403,7 +11405,7 @@ ${r}
|
|
|
11403
11405
|
const P = e.getChildElementFragments().filter((E) => !y.has(E)), D = P.filter(
|
|
11404
11406
|
(E) => E.hasAttribute(`${u.prefix}each-before`)
|
|
11405
11407
|
).length;
|
|
11406
|
-
let
|
|
11408
|
+
let L = Promise.resolve();
|
|
11407
11409
|
return a.forEach((E, v) => {
|
|
11408
11410
|
const R = t[v], k = v;
|
|
11409
11411
|
let x;
|
|
@@ -11411,7 +11413,7 @@ ${r}
|
|
|
11411
11413
|
if (V) {
|
|
11412
11414
|
x = V;
|
|
11413
11415
|
const G = D + v;
|
|
11414
|
-
|
|
11416
|
+
L = L.then(
|
|
11415
11417
|
() => f.updateRowFragment(
|
|
11416
11418
|
x,
|
|
11417
11419
|
R,
|
|
@@ -11446,7 +11448,7 @@ ${r}
|
|
|
11446
11448
|
} else {
|
|
11447
11449
|
x = r.clone();
|
|
11448
11450
|
const G = D + v;
|
|
11449
|
-
|
|
11451
|
+
L = L.then(
|
|
11450
11452
|
() => f.updateRowFragment(
|
|
11451
11453
|
x,
|
|
11452
11454
|
R,
|
|
@@ -11464,7 +11466,7 @@ ${r}
|
|
|
11464
11466
|
})
|
|
11465
11467
|
);
|
|
11466
11468
|
}
|
|
11467
|
-
}), Promise.all(c).then(() =>
|
|
11469
|
+
}), Promise.all(c).then(() => L).then(() => {
|
|
11468
11470
|
const E = a.filter(
|
|
11469
11471
|
(G) => G !== null
|
|
11470
11472
|
), v = A.filter(
|
|
@@ -11923,8 +11925,10 @@ const fe = class fe {
|
|
|
11923
11925
|
if (r) {
|
|
11924
11926
|
if (t === "input") {
|
|
11925
11927
|
const i = `${u.prefix}input-`;
|
|
11926
|
-
if (!r.getAttributeNames().some((s) => s.startsWith(i)))
|
|
11928
|
+
if (!r.getAttributeNames().some((s) => s.startsWith(i))) {
|
|
11929
|
+
this.recordUserEdit(r);
|
|
11927
11930
|
return;
|
|
11931
|
+
}
|
|
11928
11932
|
}
|
|
11929
11933
|
if (r.hasAttribute(`${u.prefix}${t}-prevent`) && e.preventDefault(), this.deferred) {
|
|
11930
11934
|
this.deferredProcedures.push(() => {
|
|
@@ -11947,15 +11951,7 @@ const fe = class fe {
|
|
|
11947
11951
|
const i = N.get(e);
|
|
11948
11952
|
if (!i)
|
|
11949
11953
|
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
|
-
}
|
|
11954
|
+
(t === "change" || t === "input") && this.syncUserEdit(e);
|
|
11959
11955
|
const n = () => {
|
|
11960
11956
|
new ee(i, t, r).run().catch((s) => {
|
|
11961
11957
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
@@ -11967,6 +11963,49 @@ const fe = class fe {
|
|
|
11967
11963
|
}
|
|
11968
11964
|
n();
|
|
11969
11965
|
}
|
|
11966
|
+
/**
|
|
11967
|
+
* 手続きを起動しない `input` について、ユーザー編集だけを記録します。
|
|
11968
|
+
*
|
|
11969
|
+
* `data-input-*` を宣言していない入力欄でも、打鍵は編集として記録しなければ
|
|
11970
|
+
* なりません(記録しないと、反映待ちの書き込みが打鍵の後に着弾して打った文字を
|
|
11971
|
+
* 消します)。初期化中は手続きと同じく保留し、フラグメントが確定した後に記録
|
|
11972
|
+
* します。
|
|
11973
|
+
*
|
|
11974
|
+
* 対象は値を持つ入力要素だけです。`contenteditable` など値収集の対象でない要素で
|
|
11975
|
+
* `input` が発火しても、記録すべき編集はありません。
|
|
11976
|
+
*
|
|
11977
|
+
* @param element 編集された要素
|
|
11978
|
+
* @returns 戻り値はない。
|
|
11979
|
+
*/
|
|
11980
|
+
recordUserEdit(e) {
|
|
11981
|
+
if (!(!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement))) {
|
|
11982
|
+
if (this.deferred) {
|
|
11983
|
+
this.deferredProcedures.push(() => {
|
|
11984
|
+
e.isConnected && this.syncUserEdit(e);
|
|
11985
|
+
});
|
|
11986
|
+
return;
|
|
11987
|
+
}
|
|
11988
|
+
this.syncUserEdit(e);
|
|
11989
|
+
}
|
|
11990
|
+
}
|
|
11991
|
+
/**
|
|
11992
|
+
* `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
|
|
11993
|
+
*
|
|
11994
|
+
* @param element 編集された要素
|
|
11995
|
+
* @returns 戻り値はない。
|
|
11996
|
+
*/
|
|
11997
|
+
syncUserEdit(e) {
|
|
11998
|
+
const t = N.get(e);
|
|
11999
|
+
if (t instanceof T && (t.syncValue(), t.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
12000
|
+
const r = document.getElementsByName(e.name);
|
|
12001
|
+
for (const i of Array.from(r)) {
|
|
12002
|
+
if (i === e || !(i instanceof HTMLInputElement) || i.type !== "radio" || i.form !== e.form)
|
|
12003
|
+
continue;
|
|
12004
|
+
const n = N.get(i);
|
|
12005
|
+
n instanceof T && (n.syncValue(), n.markUserEdit());
|
|
12006
|
+
}
|
|
12007
|
+
}
|
|
12008
|
+
}
|
|
11970
12009
|
/**
|
|
11971
12010
|
* イベントのターゲットから HTMLElement を取得します。
|
|
11972
12011
|
*
|
|
@@ -12016,7 +12055,7 @@ fe.HISTORY_STATE_KEY = "__haoriHistoryState__", fe.BUILTIN_EVENT_NAMES = /* @__P
|
|
|
12016
12055
|
"input",
|
|
12017
12056
|
"load"
|
|
12018
12057
|
]);
|
|
12019
|
-
let
|
|
12058
|
+
let Le = fe;
|
|
12020
12059
|
const U = class U {
|
|
12021
12060
|
/**
|
|
12022
12061
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -12689,11 +12728,11 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
12689
12728
|
"state"
|
|
12690
12729
|
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
12691
12730
|
let ce = w;
|
|
12692
|
-
const Ht = "0.41.
|
|
12731
|
+
const Ht = "0.41.2";
|
|
12693
12732
|
function Ut(g) {
|
|
12694
12733
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => g()) : Promise.resolve().then(g);
|
|
12695
12734
|
}
|
|
12696
|
-
const
|
|
12735
|
+
const B = class B {
|
|
12697
12736
|
/**
|
|
12698
12737
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
12699
12738
|
*
|
|
@@ -12712,8 +12751,8 @@ const L = class L {
|
|
|
12712
12751
|
* @param root 走査の起点ノード
|
|
12713
12752
|
*/
|
|
12714
12753
|
static syncTree(e) {
|
|
12715
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
12716
|
-
|
|
12754
|
+
(e instanceof Element || e instanceof DocumentFragment) && (B.isHtmlElement(e) && B.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
12755
|
+
B.syncElement(t);
|
|
12717
12756
|
}));
|
|
12718
12757
|
}
|
|
12719
12758
|
/**
|
|
@@ -12723,42 +12762,42 @@ const L = class L {
|
|
|
12723
12762
|
* @param element 対象要素
|
|
12724
12763
|
*/
|
|
12725
12764
|
static syncElement(e) {
|
|
12726
|
-
const t =
|
|
12727
|
-
if (!(r instanceof T) || !
|
|
12728
|
-
t && (t.observer.disconnect(),
|
|
12765
|
+
const t = B.registrations.get(e), r = N.get(e);
|
|
12766
|
+
if (!(r instanceof T) || !B.shouldObserve(r)) {
|
|
12767
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12729
12768
|
return;
|
|
12730
12769
|
}
|
|
12731
12770
|
if (typeof IntersectionObserver > "u")
|
|
12732
12771
|
return;
|
|
12733
|
-
const i =
|
|
12772
|
+
const i = B.resolveVarName(r);
|
|
12734
12773
|
if (i === "") {
|
|
12735
|
-
t && (t.observer.disconnect(),
|
|
12774
|
+
t && (t.observer.disconnect(), B.registrations.delete(e)), m.warn(
|
|
12736
12775
|
"[Haori]",
|
|
12737
12776
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
12738
12777
|
);
|
|
12739
12778
|
return;
|
|
12740
12779
|
}
|
|
12741
|
-
const n =
|
|
12780
|
+
const n = B.resolveRoot(r), s = B.resolveRootMargin(r);
|
|
12742
12781
|
if (t && t.observer.root === n && t.observer.rootMargin === s && t.varName === i) {
|
|
12743
|
-
t.fragment = r,
|
|
12782
|
+
t.fragment = r, B.refreshRows(t);
|
|
12744
12783
|
return;
|
|
12745
12784
|
}
|
|
12746
|
-
t && (t.observer.disconnect(),
|
|
12785
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12747
12786
|
const a = new IntersectionObserver(
|
|
12748
12787
|
(l) => {
|
|
12749
|
-
const c =
|
|
12788
|
+
const c = B.registrations.get(e);
|
|
12750
12789
|
if (!c)
|
|
12751
12790
|
return;
|
|
12752
12791
|
let d = !1;
|
|
12753
12792
|
l.forEach((h) => {
|
|
12754
12793
|
const y = h.target;
|
|
12755
12794
|
c.observedRows.has(y) && (h.isIntersecting ? c.visibleRows.has(y) || (c.visibleRows.add(y), d = !0) : c.visibleRows.delete(y) && (d = !0));
|
|
12756
|
-
}), d &&
|
|
12795
|
+
}), d && B.scheduleCompute(c);
|
|
12757
12796
|
},
|
|
12758
12797
|
{
|
|
12759
12798
|
root: n,
|
|
12760
12799
|
rootMargin: s,
|
|
12761
|
-
threshold:
|
|
12800
|
+
threshold: B.THRESHOLD
|
|
12762
12801
|
}
|
|
12763
12802
|
), o = {
|
|
12764
12803
|
fragment: r,
|
|
@@ -12771,7 +12810,7 @@ const L = class L {
|
|
|
12771
12810
|
scheduled: !1,
|
|
12772
12811
|
lastSnapshot: null
|
|
12773
12812
|
};
|
|
12774
|
-
|
|
12813
|
+
B.registrations.set(e, o), B.refreshRows(o);
|
|
12775
12814
|
}
|
|
12776
12815
|
/**
|
|
12777
12816
|
* 指定ノード配下の監視登録を解放します。
|
|
@@ -12779,22 +12818,22 @@ const L = class L {
|
|
|
12779
12818
|
* @param root 走査の起点ノード
|
|
12780
12819
|
*/
|
|
12781
12820
|
static cleanupTree(e) {
|
|
12782
|
-
if (
|
|
12783
|
-
const t =
|
|
12784
|
-
t && (t.observer.disconnect(),
|
|
12821
|
+
if (B.isHtmlElement(e)) {
|
|
12822
|
+
const t = B.registrations.get(e);
|
|
12823
|
+
t && (t.observer.disconnect(), B.registrations.delete(e));
|
|
12785
12824
|
}
|
|
12786
12825
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
12787
|
-
const r =
|
|
12788
|
-
r && (r.observer.disconnect(),
|
|
12826
|
+
const r = B.registrations.get(t);
|
|
12827
|
+
r && (r.observer.disconnect(), B.registrations.delete(t));
|
|
12789
12828
|
});
|
|
12790
12829
|
}
|
|
12791
12830
|
/**
|
|
12792
12831
|
* すべての監視登録を解放します。
|
|
12793
12832
|
*/
|
|
12794
12833
|
static disconnectAll() {
|
|
12795
|
-
|
|
12834
|
+
B.registrations.forEach((e) => {
|
|
12796
12835
|
e.observer.disconnect();
|
|
12797
|
-
}),
|
|
12836
|
+
}), B.registrations.clear();
|
|
12798
12837
|
}
|
|
12799
12838
|
/**
|
|
12800
12839
|
* 監視対象(`data-each` かつ `data-each-visible`)かどうかを判定します。
|
|
@@ -12829,7 +12868,7 @@ const L = class L {
|
|
|
12829
12868
|
if (typeof r != "string" || r.trim() === "")
|
|
12830
12869
|
return null;
|
|
12831
12870
|
const i = z.query(r, t, document);
|
|
12832
|
-
return
|
|
12871
|
+
return B.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
12833
12872
|
}
|
|
12834
12873
|
/**
|
|
12835
12874
|
* rootMargin を解決します。
|
|
@@ -12839,7 +12878,7 @@ const L = class L {
|
|
|
12839
12878
|
*/
|
|
12840
12879
|
static resolveRootMargin(e) {
|
|
12841
12880
|
const t = `${u.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
12842
|
-
return r === null || r === !1 || r === "" ?
|
|
12881
|
+
return r === null || r === !1 || r === "" ? B.DEFAULT_ROOT_MARGIN : String(r);
|
|
12843
12882
|
}
|
|
12844
12883
|
/**
|
|
12845
12884
|
* コンテナ直下の実際の行要素(`each-before`/`each-after` を除く)を描画順で返します。
|
|
@@ -12859,12 +12898,12 @@ const L = class L {
|
|
|
12859
12898
|
* @param registration 対象の登録
|
|
12860
12899
|
*/
|
|
12861
12900
|
static refreshRows(e) {
|
|
12862
|
-
const t =
|
|
12901
|
+
const t = B.realRowElements(e.fragment), r = new Set(t);
|
|
12863
12902
|
for (const i of [...e.observedRows])
|
|
12864
12903
|
r.has(i) || (e.observer.unobserve(i), e.observedRows.delete(i), e.visibleRows.delete(i));
|
|
12865
12904
|
for (const i of t)
|
|
12866
12905
|
e.observedRows.has(i) || (e.observer.observe(i), e.observedRows.add(i));
|
|
12867
|
-
|
|
12906
|
+
B.scheduleCompute(e);
|
|
12868
12907
|
}
|
|
12869
12908
|
/**
|
|
12870
12909
|
* 次フレームでの集計・公開を予約します(多発する交差イベントを 1 回にまとめる)。
|
|
@@ -12875,7 +12914,7 @@ const L = class L {
|
|
|
12875
12914
|
e.scheduled || (e.scheduled = !0, Ut(() => {
|
|
12876
12915
|
e.scheduled = !1;
|
|
12877
12916
|
const t = e.fragment.getTarget();
|
|
12878
|
-
|
|
12917
|
+
B.registrations.get(t) === e && B.computeAndPublish(e);
|
|
12879
12918
|
}));
|
|
12880
12919
|
}
|
|
12881
12920
|
/**
|
|
@@ -12884,7 +12923,7 @@ const L = class L {
|
|
|
12884
12923
|
* @param registration 対象の登録
|
|
12885
12924
|
*/
|
|
12886
12925
|
static computeAndPublish(e) {
|
|
12887
|
-
const t =
|
|
12926
|
+
const t = B.realRowElements(e.fragment), r = /* @__PURE__ */ new Map();
|
|
12888
12927
|
t.forEach((a, o) => r.set(a, o));
|
|
12889
12928
|
const i = [];
|
|
12890
12929
|
for (const a of e.visibleRows) {
|
|
@@ -12917,7 +12956,7 @@ const L = class L {
|
|
|
12917
12956
|
};
|
|
12918
12957
|
}
|
|
12919
12958
|
const s = JSON.stringify(n);
|
|
12920
|
-
s !== e.lastSnapshot && (e.lastSnapshot = s,
|
|
12959
|
+
s !== e.lastSnapshot && (e.lastSnapshot = s, B.publish(e, n));
|
|
12921
12960
|
}
|
|
12922
12961
|
/**
|
|
12923
12962
|
* 可視範囲スナップショットを最近接の上位 `data-bind` スコープへ公開します。
|
|
@@ -12926,7 +12965,7 @@ const L = class L {
|
|
|
12926
12965
|
* @param snapshot 公開するスナップショット
|
|
12927
12966
|
*/
|
|
12928
12967
|
static publish(e, t) {
|
|
12929
|
-
const r =
|
|
12968
|
+
const r = B.resolveBindOwner(e.fragment);
|
|
12930
12969
|
if (!r) {
|
|
12931
12970
|
m.warn(
|
|
12932
12971
|
"[Haori]",
|
|
@@ -12968,8 +13007,8 @@ const L = class L {
|
|
|
12968
13007
|
return e.hasAttribute(t) ? e : null;
|
|
12969
13008
|
}
|
|
12970
13009
|
};
|
|
12971
|
-
|
|
12972
|
-
let se =
|
|
13010
|
+
B.THRESHOLD = 0, B.DEFAULT_ROOT_MARGIN = "0px", B.registrations = /* @__PURE__ */ new Map();
|
|
13011
|
+
let se = B;
|
|
12973
13012
|
const K = class K {
|
|
12974
13013
|
/**
|
|
12975
13014
|
* 既存の MutationObserver をすべて停止します。
|
|
@@ -12989,7 +13028,7 @@ const K = class K {
|
|
|
12989
13028
|
K._initialized = !0, K.disconnectMutationObservers(), T.setPendingMutationFlusher(() => {
|
|
12990
13029
|
K.flushPendingMutations();
|
|
12991
13030
|
});
|
|
12992
|
-
const e = new
|
|
13031
|
+
const e = new Le();
|
|
12993
13032
|
K._dispatcher = e, e.startDeferred();
|
|
12994
13033
|
try {
|
|
12995
13034
|
const t = await Promise.allSettled([
|