haori 0.47.2 → 0.47.4
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 +14 -14
- package/dist/haori.es.js +977 -776
- package/dist/haori.iife.js +14 -14
- package/dist/index.d.ts +158 -10
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -29,7 +29,7 @@ const he = class he {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
he.devMode = !1;
|
|
32
|
-
let
|
|
32
|
+
let V = he;
|
|
33
33
|
const Le = "embedded";
|
|
34
34
|
function Je(y) {
|
|
35
35
|
return y === "embedded" || y === "demo";
|
|
@@ -96,15 +96,15 @@ const Q = class Q {
|
|
|
96
96
|
}
|
|
97
97
|
if (e instanceof HTMLScriptElement && e.hasAttribute(`${Q._prefix}dev`)) {
|
|
98
98
|
const r = (e.getAttribute(`${Q._prefix}dev`) ?? "").trim().toLowerCase();
|
|
99
|
-
|
|
99
|
+
V.set(r !== "false" && r !== "off" && r !== "0");
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
const t = window.location.hostname;
|
|
103
103
|
if (t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "::1" || t.endsWith(".local")) {
|
|
104
|
-
|
|
104
|
+
V.set(!0);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
V.set(!1);
|
|
108
108
|
} catch {
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -128,7 +128,7 @@ class m {
|
|
|
128
128
|
* @param args 追加の引数
|
|
129
129
|
*/
|
|
130
130
|
static info(e, ...t) {
|
|
131
|
-
|
|
131
|
+
V.isEnabled() && console.log && console.log(e, ...t);
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* 開発モードでのみコンソールに警告を出力します。
|
|
@@ -137,7 +137,7 @@ class m {
|
|
|
137
137
|
* @param args 追加の引数
|
|
138
138
|
*/
|
|
139
139
|
static warn(e, ...t) {
|
|
140
|
-
|
|
140
|
+
V.isEnabled() && console.warn && console.warn(e, ...t);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* モードに関係なくコンソールにエラーを出力します。
|
|
@@ -149,7 +149,7 @@ class m {
|
|
|
149
149
|
console.error(e, ...t);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:",
|
|
152
|
+
const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:", C = class C {
|
|
153
153
|
/**
|
|
154
154
|
* 外部ライブラリ連携を登録します。
|
|
155
155
|
*
|
|
@@ -170,7 +170,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
170
170
|
m.error("[Haori]", `Enhancer "${r}" must have an init function.`);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
C.enhancers.set(r, t), C.warnedUnknownNames.delete(r), typeof document < "u" && document.body && C.applySubtree(document.body);
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* 登録済みの連携かどうかを返します。
|
|
@@ -179,7 +179,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
179
179
|
* @returns 登録済みなら true
|
|
180
180
|
*/
|
|
181
181
|
static has(e) {
|
|
182
|
-
return
|
|
182
|
+
return C.enhancers.has(e);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* 対象要素とその子孫へ、まだ適用していない連携を適用します。
|
|
@@ -190,8 +190,8 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
190
190
|
* @returns 戻り値はありません。
|
|
191
191
|
*/
|
|
192
192
|
static applySubtree(e) {
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
C.forEachTarget(e, (t) => {
|
|
194
|
+
C.applyElement(t);
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
@@ -204,8 +204,8 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
204
204
|
* @returns 戻り値はありません。
|
|
205
205
|
*/
|
|
206
206
|
static refreshSubtree(e) {
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
C.forEachTarget(e, (t) => {
|
|
208
|
+
C.refreshElement(t);
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
@@ -217,8 +217,8 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
217
217
|
* @returns 戻り値はありません。
|
|
218
218
|
*/
|
|
219
219
|
static destroySubtree(e) {
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
C.forEachTarget(e, (t) => {
|
|
221
|
+
C.destroyElement(t);
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
@@ -243,27 +243,27 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
243
243
|
* @returns 戻り値はありません。
|
|
244
244
|
*/
|
|
245
245
|
static applyElement(e) {
|
|
246
|
-
const t =
|
|
247
|
-
|
|
246
|
+
const t = C.instances.get(e) ?? null;
|
|
247
|
+
C.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
248
248
|
if (t?.has(r))
|
|
249
249
|
return;
|
|
250
|
-
const i =
|
|
250
|
+
const i = C.enhancers.get(r);
|
|
251
251
|
if (!i) {
|
|
252
|
-
|
|
252
|
+
C.warnUnknownName(r);
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
C.run(`enhance "${r}"`, () => {
|
|
256
256
|
const n = i.init(e);
|
|
257
|
-
|
|
257
|
+
C.appliedKeys(e).set(r, n);
|
|
258
258
|
});
|
|
259
|
-
}),
|
|
259
|
+
}), C.names(e, `${l.prefix}enhance-new`).forEach((r) => {
|
|
260
260
|
const i = `${je}${r}`;
|
|
261
|
-
if (
|
|
261
|
+
if (C.instances.get(e)?.has(i))
|
|
262
262
|
return;
|
|
263
|
-
const n =
|
|
264
|
-
n !== null &&
|
|
263
|
+
const n = C.resolveGlobal(r);
|
|
264
|
+
n !== null && C.run(`enhance-new "${r}"`, () => {
|
|
265
265
|
const s = new n(e);
|
|
266
|
-
|
|
266
|
+
C.appliedKeys(e).set(i, s);
|
|
267
267
|
});
|
|
268
268
|
});
|
|
269
269
|
}
|
|
@@ -274,15 +274,15 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
274
274
|
* @returns 戻り値はありません。
|
|
275
275
|
*/
|
|
276
276
|
static refreshElement(e) {
|
|
277
|
-
const t =
|
|
278
|
-
|
|
277
|
+
const t = C.instances.get(e);
|
|
278
|
+
C.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
279
279
|
if (!t || !t.has(r))
|
|
280
280
|
return;
|
|
281
|
-
const i =
|
|
282
|
-
!i || typeof i.refresh != "function" ||
|
|
281
|
+
const i = C.enhancers.get(r);
|
|
282
|
+
!i || typeof i.refresh != "function" || C.run(`enhance "${r}" refresh`, () => {
|
|
283
283
|
i.refresh(e, t.get(r));
|
|
284
284
|
});
|
|
285
|
-
}),
|
|
285
|
+
}), C.applyElement(e);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* 1 要素の連携を破棄します。
|
|
@@ -291,15 +291,15 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
291
291
|
* @returns 戻り値はありません。
|
|
292
292
|
*/
|
|
293
293
|
static destroyElement(e) {
|
|
294
|
-
const t =
|
|
294
|
+
const t = C.instances.get(e);
|
|
295
295
|
t && (t.forEach((r, i) => {
|
|
296
296
|
if (i.startsWith(je))
|
|
297
297
|
return;
|
|
298
|
-
const n =
|
|
299
|
-
!n || typeof n.destroy != "function" ||
|
|
298
|
+
const n = C.enhancers.get(i);
|
|
299
|
+
!n || typeof n.destroy != "function" || C.run(`enhance "${i}" destroy`, () => {
|
|
300
300
|
n.destroy(e, r);
|
|
301
301
|
});
|
|
302
|
-
}),
|
|
302
|
+
}), C.instances.delete(e));
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
305
|
* 要素の適用状況を返します(無ければ作成します)。
|
|
@@ -308,11 +308,11 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
308
308
|
* @returns キー → インスタンスの対応
|
|
309
309
|
*/
|
|
310
310
|
static appliedKeys(e) {
|
|
311
|
-
const t =
|
|
311
|
+
const t = C.instances.get(e);
|
|
312
312
|
if (t)
|
|
313
313
|
return t;
|
|
314
314
|
const r = /* @__PURE__ */ new Map();
|
|
315
|
-
return
|
|
315
|
+
return C.instances.set(e, r), r;
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
318
318
|
* 空白区切りの属性値を名前の一覧へ分解します。
|
|
@@ -353,7 +353,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
353
353
|
if (t = t[r], t === void 0)
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
|
-
return typeof t != "function" ? (
|
|
356
|
+
return typeof t != "function" ? (V.isEnabled() && !C.warnedMissingGlobals.has(e) && (C.warnedMissingGlobals.add(e), m.warn(
|
|
357
357
|
"[Haori]",
|
|
358
358
|
`${l.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
359
359
|
)), null) : t;
|
|
@@ -365,7 +365,7 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
365
365
|
* @returns 戻り値はありません。
|
|
366
366
|
*/
|
|
367
367
|
static warnUnknownName(e) {
|
|
368
|
-
!
|
|
368
|
+
!V.isEnabled() || C.warnedUnknownNames.has(e) || (C.warnedUnknownNames.add(e), m.warn(
|
|
369
369
|
"[Haori]",
|
|
370
370
|
`Enhancer "${e}" is not registered yet; the declaration is kept pending and applied when it is registered (Haori.enhancers.register('${e}', {init(el) {...}})).`
|
|
371
371
|
));
|
|
@@ -387,8 +387,8 @@ const yt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
|
-
|
|
391
|
-
let se =
|
|
390
|
+
C.enhancers = /* @__PURE__ */ new Map(), C.instances = /* @__PURE__ */ new WeakMap(), C.warnedUnknownNames = /* @__PURE__ */ new Set(), C.warnedMissingGlobals = /* @__PURE__ */ new Set();
|
|
391
|
+
let se = C;
|
|
392
392
|
const Ze = "yyyy/MM/dd HH:mm", bt = "en-US", Ke = 1e4;
|
|
393
393
|
function oe(y) {
|
|
394
394
|
return String(y).padStart(2, "0");
|
|
@@ -429,7 +429,7 @@ function _e(y, e) {
|
|
|
429
429
|
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), c = Number(r.second);
|
|
430
430
|
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : Qe(i, n, s, a, o, c);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Ce(y, e = Ze, t) {
|
|
433
433
|
if (y == null || y === "")
|
|
434
434
|
return "";
|
|
435
435
|
const r = y instanceof Date ? y : new Date(y);
|
|
@@ -456,7 +456,7 @@ function $e(y, e = Ze, t) {
|
|
|
456
456
|
}
|
|
457
457
|
const Et = "yyyy-MM-dd";
|
|
458
458
|
function et(y = Ze, e) {
|
|
459
|
-
return
|
|
459
|
+
return Ce(/* @__PURE__ */ new Date(), y, e);
|
|
460
460
|
}
|
|
461
461
|
function tt(y = 0, e = Et, t) {
|
|
462
462
|
const r = Number.isFinite(y) ? Math.trunc(y) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
@@ -471,7 +471,7 @@ function tt(y = 0, e = Et, t) {
|
|
|
471
471
|
n = c.getFullYear(), s = c.getMonth() + 1, a = c.getDate();
|
|
472
472
|
}
|
|
473
473
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
474
|
-
return
|
|
474
|
+
return Ce(o, e, "UTC");
|
|
475
475
|
}
|
|
476
476
|
function rt(y, e) {
|
|
477
477
|
if (y == null)
|
|
@@ -649,7 +649,7 @@ function dt(y, e) {
|
|
|
649
649
|
return r;
|
|
650
650
|
}
|
|
651
651
|
const wt = Object.freeze({
|
|
652
|
-
date:
|
|
652
|
+
date: Ce,
|
|
653
653
|
now: et,
|
|
654
654
|
today: tt,
|
|
655
655
|
number: rt,
|
|
@@ -795,7 +795,7 @@ const qe = class qe {
|
|
|
795
795
|
};
|
|
796
796
|
qe.ASYNC_QUEUE = new He();
|
|
797
797
|
let G = qe;
|
|
798
|
-
const
|
|
798
|
+
const D = class D {
|
|
799
799
|
/**
|
|
800
800
|
* ストレージを、参照が例外になる環境でも安全に読み出します。
|
|
801
801
|
*
|
|
@@ -833,8 +833,8 @@ const T = class T {
|
|
|
833
833
|
e.history,
|
|
834
834
|
// 参照だけで例外になり得るのはこの 2 つのみ(他は同一オリジンの自 window
|
|
835
835
|
// 由来で常に読める)。ホットパスなので、囲むのも必要な箇所だけに絞る。
|
|
836
|
-
|
|
837
|
-
|
|
836
|
+
D.readStorageSafely(() => e.localStorage),
|
|
837
|
+
D.readStorageSafely(() => e.sessionStorage),
|
|
838
838
|
e.fetch,
|
|
839
839
|
e.Function,
|
|
840
840
|
e.setTimeout,
|
|
@@ -941,7 +941,7 @@ const T = class T {
|
|
|
941
941
|
* @returns 戻り値はありません。
|
|
942
942
|
*/
|
|
943
943
|
static reportUnusableBindingKeys(e) {
|
|
944
|
-
if (e.length === 0 || !
|
|
944
|
+
if (e.length === 0 || !V.isEnabled())
|
|
945
945
|
return;
|
|
946
946
|
const t = e.filter(
|
|
947
947
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
@@ -1182,7 +1182,7 @@ let ${e.join(", ")};`;
|
|
|
1182
1182
|
s.push(c), c && n.push({
|
|
1183
1183
|
start: o.position + 1,
|
|
1184
1184
|
end: o.position + 1,
|
|
1185
|
-
text:
|
|
1185
|
+
text: D.MEMBER_KEY_GUARD_OPEN
|
|
1186
1186
|
});
|
|
1187
1187
|
} else o.value === "]" && s.pop() === !0 && n.push({
|
|
1188
1188
|
start: o.position,
|
|
@@ -1239,7 +1239,7 @@ let ${e.join(", ")};`;
|
|
|
1239
1239
|
);
|
|
1240
1240
|
return;
|
|
1241
1241
|
}
|
|
1242
|
-
|
|
1242
|
+
V.isEnabled() && (e.forEach((r) => {
|
|
1243
1243
|
this.pendingUnresolvedIdentifiers.add(r);
|
|
1244
1244
|
}), this.scheduleUnresolvedIdentifierReport());
|
|
1245
1245
|
}
|
|
@@ -1296,7 +1296,7 @@ let ${e.join(", ")};`;
|
|
|
1296
1296
|
* @return 戻り値はありません。
|
|
1297
1297
|
*/
|
|
1298
1298
|
static recordRowScopeIdentifiers(e) {
|
|
1299
|
-
if (
|
|
1299
|
+
if (V.isEnabled())
|
|
1300
1300
|
for (const t of e)
|
|
1301
1301
|
typeof t == "string" && t !== "" && this.rowScopeIdentifiers.add(t);
|
|
1302
1302
|
}
|
|
@@ -1466,14 +1466,14 @@ ${t}`;
|
|
|
1466
1466
|
s && (this.BUILTIN_DATA_REFERENCE_PATTERN.test(n) ? a[this.BUILTIN_NAMESPACE] = {
|
|
1467
1467
|
...this.BUILTIN_HELPERS,
|
|
1468
1468
|
[this.BUILTIN_DATA_PROPERTY]: { ...a }
|
|
1469
|
-
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a),
|
|
1469
|
+
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a), V.isEnabled() && this.recordSuppliedIdentifiers(a);
|
|
1470
1470
|
const o = this.canAttemptMissingIdentifierRecovery(e), c = this.extractFreeIdentifiers(e).filter(
|
|
1471
1471
|
(d) => !(d in a) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
1472
1472
|
// (二重宣言は構文エラーになる)。
|
|
1473
1473
|
!this.FORBIDDEN_NAMES.includes(d) && // 標準組み込み(`Math` など)は式から参照できる仕様のため遮蔽しない。
|
|
1474
1474
|
!this.ALLOWED_GLOBAL_IDENTIFIERS.has(d)
|
|
1475
1475
|
);
|
|
1476
|
-
if (
|
|
1476
|
+
if (V.isEnabled()) {
|
|
1477
1477
|
const d = this.extractBoundIdentifiers(e);
|
|
1478
1478
|
this.recordScopeMissingIdentifiers(
|
|
1479
1479
|
d.size === 0 ? c : c.filter((p) => !d.has(p)),
|
|
@@ -1724,14 +1724,14 @@ return (${g});${p}`;
|
|
|
1724
1724
|
* @returns 食い違っている場合は両辺の型。該当しない場合は null
|
|
1725
1725
|
*/
|
|
1726
1726
|
static diagnoseStrictComparison(e, t = {}) {
|
|
1727
|
-
const r =
|
|
1727
|
+
const r = D.splitStrictComparison(e);
|
|
1728
1728
|
if (r === null)
|
|
1729
1729
|
return null;
|
|
1730
|
-
const i =
|
|
1730
|
+
const i = D.evaluateDetailed(r.left, t), n = D.evaluateDetailed(r.right, t);
|
|
1731
1731
|
if (i.unresolvedReference || n.unresolvedReference)
|
|
1732
1732
|
return null;
|
|
1733
1733
|
const s = i.value, a = n.value;
|
|
1734
|
-
return typeof s == typeof a || !
|
|
1734
|
+
return typeof s == typeof a || !D.isLooselyEqual(s, a) ? null : { left: typeof s, right: typeof a };
|
|
1735
1735
|
}
|
|
1736
1736
|
/**
|
|
1737
1737
|
* 型をまたいだ緩い比較(`==`)を行います。
|
|
@@ -1758,11 +1758,11 @@ return (${g});${p}`;
|
|
|
1758
1758
|
* @returns 左辺と右辺。単一の厳密比較でない場合は null
|
|
1759
1759
|
*/
|
|
1760
1760
|
static splitStrictComparison(e) {
|
|
1761
|
-
const t =
|
|
1761
|
+
const t = D.strictComparisonSplits.get(e);
|
|
1762
1762
|
if (t !== void 0)
|
|
1763
1763
|
return t;
|
|
1764
|
-
const r =
|
|
1765
|
-
return
|
|
1764
|
+
const r = D.computeStrictComparisonSplit(e);
|
|
1765
|
+
return D.strictComparisonSplits.set(e, r), r;
|
|
1766
1766
|
}
|
|
1767
1767
|
/**
|
|
1768
1768
|
* 式を単一の厳密比較として分割します(記憶しない実体)。
|
|
@@ -1771,7 +1771,7 @@ return (${g});${p}`;
|
|
|
1771
1771
|
* @returns 左辺と右辺。単一の厳密比較でない場合は null
|
|
1772
1772
|
*/
|
|
1773
1773
|
static computeStrictComparisonSplit(e) {
|
|
1774
|
-
const t =
|
|
1774
|
+
const t = D.tokenizeExpression(e);
|
|
1775
1775
|
if (t === null)
|
|
1776
1776
|
return null;
|
|
1777
1777
|
let r = 0, i = null;
|
|
@@ -1787,7 +1787,7 @@ return (${g});${p}`;
|
|
|
1787
1787
|
}
|
|
1788
1788
|
if (r === 0) {
|
|
1789
1789
|
if (a.value === "&&")
|
|
1790
|
-
return
|
|
1790
|
+
return D.splitStrictComparison(
|
|
1791
1791
|
e.slice(0, a.position)
|
|
1792
1792
|
);
|
|
1793
1793
|
if (a.value === "===") {
|
|
@@ -1796,7 +1796,7 @@ return (${g});${p}`;
|
|
|
1796
1796
|
i = a;
|
|
1797
1797
|
continue;
|
|
1798
1798
|
}
|
|
1799
|
-
if (
|
|
1799
|
+
if (D.COMPOSING_OPERATORS.has(a.value))
|
|
1800
1800
|
return null;
|
|
1801
1801
|
}
|
|
1802
1802
|
}
|
|
@@ -2274,9 +2274,9 @@ return (${g});${p}`;
|
|
|
2274
2274
|
return this.forbiddenBindingValueCache.set(e, !1), !1;
|
|
2275
2275
|
}
|
|
2276
2276
|
};
|
|
2277
|
-
|
|
2277
|
+
D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HELPERS = {
|
|
2278
2278
|
...wt
|
|
2279
|
-
},
|
|
2279
|
+
}, D.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, D.BUILTIN_DATA_PROPERTY = "data", D.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, D.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, D.usableBindingKeyCache = /* @__PURE__ */ new Map(), D.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), D.compileFailedExpressions = /* @__PURE__ */ new Set(), D.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), D.forbiddenBindingValueCacheResetScheduled = !1, D.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), D.loggedForbiddenKeyResetScheduled = !1, D.FORBIDDEN_NAMES = [
|
|
2280
2280
|
// グローバルオブジェクト
|
|
2281
2281
|
"window",
|
|
2282
2282
|
"self",
|
|
@@ -2308,7 +2308,7 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2308
2308
|
"sessionStorage",
|
|
2309
2309
|
"IndexedDB",
|
|
2310
2310
|
"history"
|
|
2311
|
-
],
|
|
2311
|
+
], D.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], D.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set([
|
|
2312
2312
|
"location",
|
|
2313
2313
|
"history",
|
|
2314
2314
|
"document",
|
|
@@ -2316,23 +2316,23 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2316
2316
|
"localStorage",
|
|
2317
2317
|
"sessionStorage",
|
|
2318
2318
|
"IndexedDB"
|
|
2319
|
-
]),
|
|
2320
|
-
...
|
|
2321
|
-
(e) => !
|
|
2319
|
+
]), D.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
2320
|
+
...D.FORBIDDEN_NAMES.filter(
|
|
2321
|
+
(e) => !D.REBINDABLE_FORBIDDEN_NAMES.has(e)
|
|
2322
2322
|
),
|
|
2323
2323
|
"constructor",
|
|
2324
2324
|
"__proto__",
|
|
2325
2325
|
"prototype",
|
|
2326
|
-
...
|
|
2327
|
-
]),
|
|
2326
|
+
...D.STRICT_FORBIDDEN_NAMES
|
|
2327
|
+
]), D.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
|
|
2328
2328
|
"constructor",
|
|
2329
2329
|
"__proto__",
|
|
2330
2330
|
"prototype"
|
|
2331
|
-
]),
|
|
2331
|
+
]), D.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
|
|
2332
2332
|
"get",
|
|
2333
2333
|
"set",
|
|
2334
2334
|
"async"
|
|
2335
|
-
]),
|
|
2335
|
+
]), D.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
2336
2336
|
"await",
|
|
2337
2337
|
"break",
|
|
2338
2338
|
"case",
|
|
@@ -2366,7 +2366,7 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2366
2366
|
"while",
|
|
2367
2367
|
"with",
|
|
2368
2368
|
"yield"
|
|
2369
|
-
]),
|
|
2369
|
+
]), D.NON_SHADOWABLE_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
2370
2370
|
// リテラル・グローバル定数
|
|
2371
2371
|
"true",
|
|
2372
2372
|
"false",
|
|
@@ -2384,7 +2384,7 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2384
2384
|
"public",
|
|
2385
2385
|
"static",
|
|
2386
2386
|
"super"
|
|
2387
|
-
]),
|
|
2387
|
+
]), D.ALLOWED_GLOBAL_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
2388
2388
|
// 名前空間オブジェクト
|
|
2389
2389
|
"Math",
|
|
2390
2390
|
"JSON",
|
|
@@ -2440,10 +2440,10 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2440
2440
|
"encodeURIComponent",
|
|
2441
2441
|
"decodeURI",
|
|
2442
2442
|
"decodeURIComponent"
|
|
2443
|
-
]),
|
|
2443
|
+
]), D.EXPRESSION_CACHE = /* @__PURE__ */ new Map(), D.FREE_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), D.BOUND_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), D.OPTIONAL_CHAIN_CACHE = /* @__PURE__ */ new Map(), D.GUARDED_MEMBER_CACHE = /* @__PURE__ */ new Map(), D.MEMBER_KEY_GUARD_OPEN = "(_hk=>_hk==='constructor'||_hk==='__proto__'||_hk==='prototype'?undefined:_hk)(", D.FORBIDDEN_NAME_PATTERNS = D.FORBIDDEN_NAMES.map((e) => ({
|
|
2444
2444
|
name: e,
|
|
2445
2445
|
pattern: new RegExp(`(^|[^\\w$.])${e}(?![\\w$])`)
|
|
2446
|
-
})),
|
|
2446
|
+
})), D.FORBIDDEN_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), D.pendingUnresolvedIdentifiers = /* @__PURE__ */ new Set(), D.unresolvedReportScheduled = !1, D.suppliedIdentifiers = /* @__PURE__ */ new Set(), D.pendingScopeMissingIdentifiers = /* @__PURE__ */ new Map(), D.scopeMissingReportScheduled = !1, D.rowScopeIdentifiers = /* @__PURE__ */ new Set(), D.loggedScopeMissingIdentifiers = /* @__PURE__ */ new Set(), D.loggedBlockedIdentifierExpressions = /* @__PURE__ */ new Set(), D.COMPOSING_OPERATORS = /* @__PURE__ */ new Set([
|
|
2447
2447
|
"||",
|
|
2448
2448
|
"?",
|
|
2449
2449
|
":",
|
|
@@ -2462,14 +2462,14 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2462
2462
|
"/",
|
|
2463
2463
|
"%",
|
|
2464
2464
|
"..."
|
|
2465
|
-
]),
|
|
2466
|
-
let ee =
|
|
2467
|
-
const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fieldset",
|
|
2465
|
+
]), D.strictComparisonSplits = /* @__PURE__ */ new Map(), D.WRAPPED_VALUES = /* @__PURE__ */ new WeakSet();
|
|
2466
|
+
let ee = D;
|
|
2467
|
+
const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fieldset", P = class P {
|
|
2468
2468
|
/**
|
|
2469
2469
|
* 集計状態を初期化します。
|
|
2470
2470
|
*/
|
|
2471
2471
|
static reset() {
|
|
2472
|
-
|
|
2472
|
+
P.ELEMENT_STORES.clear(), P.ensureGlobalAccess();
|
|
2473
2473
|
}
|
|
2474
2474
|
/**
|
|
2475
2475
|
* 集計を開始します。
|
|
@@ -2477,7 +2477,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2477
2477
|
* @returns 戻り値はありません。
|
|
2478
2478
|
*/
|
|
2479
2479
|
static start() {
|
|
2480
|
-
|
|
2480
|
+
P.collecting = !0;
|
|
2481
2481
|
}
|
|
2482
2482
|
/**
|
|
2483
2483
|
* 集計を停止します。
|
|
@@ -2485,7 +2485,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2485
2485
|
* @returns 戻り値はありません。
|
|
2486
2486
|
*/
|
|
2487
2487
|
static stop() {
|
|
2488
|
-
|
|
2488
|
+
P.collecting = !1;
|
|
2489
2489
|
}
|
|
2490
2490
|
/**
|
|
2491
2491
|
* 集計中かどうかを返します。
|
|
@@ -2493,7 +2493,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2493
2493
|
* @returns 集計中なら true
|
|
2494
2494
|
*/
|
|
2495
2495
|
static isCollecting() {
|
|
2496
|
-
return
|
|
2496
|
+
return P.collecting && V.isEnabled();
|
|
2497
2497
|
}
|
|
2498
2498
|
/**
|
|
2499
2499
|
* 現在の集計結果スナップショットを返します。
|
|
@@ -2501,7 +2501,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2501
2501
|
* @returns エレメントごとの集計結果
|
|
2502
2502
|
*/
|
|
2503
2503
|
static snapshot() {
|
|
2504
|
-
return
|
|
2504
|
+
return P.ensureGlobalAccess(), [...P.ELEMENT_STORES.entries()].map(([e, t]) => ({
|
|
2505
2505
|
elementId: e,
|
|
2506
2506
|
tagName: t.tagName,
|
|
2507
2507
|
attributes: [...t.attributes.entries()].map(([r, i]) => ({
|
|
@@ -2510,7 +2510,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2510
2510
|
calls: i.calls,
|
|
2511
2511
|
totalDurationMs: i.totalDurationMs,
|
|
2512
2512
|
maxDurationMs: i.maxDurationMs,
|
|
2513
|
-
placeholders:
|
|
2513
|
+
placeholders: P.sortPlaceholders(
|
|
2514
2514
|
i.placeholders
|
|
2515
2515
|
)
|
|
2516
2516
|
})).sort((r, i) => i.calls - r.calls),
|
|
@@ -2520,7 +2520,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2520
2520
|
calls: i.calls,
|
|
2521
2521
|
totalDurationMs: i.totalDurationMs,
|
|
2522
2522
|
maxDurationMs: i.maxDurationMs,
|
|
2523
|
-
placeholders:
|
|
2523
|
+
placeholders: P.sortPlaceholders(
|
|
2524
2524
|
i.placeholders
|
|
2525
2525
|
)
|
|
2526
2526
|
})).sort((r, i) => i.calls - r.calls)
|
|
@@ -2544,7 +2544,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2544
2544
|
* @param limit 出力する宣言の数。既定は 20
|
|
2545
2545
|
* @returns 要約。合計は `limit` で絞る前の全件から求める
|
|
2546
2546
|
*/
|
|
2547
|
-
static report(e =
|
|
2547
|
+
static report(e = P.DEFAULT_REPORT_LIMIT) {
|
|
2548
2548
|
const t = /* @__PURE__ */ new Map();
|
|
2549
2549
|
let r = 0, i = 0;
|
|
2550
2550
|
const n = (c, u, d) => {
|
|
@@ -2568,7 +2568,7 @@ const ue = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2568
2568
|
d.maxDurationMs
|
|
2569
2569
|
), d.totalDurationMs > p.representativeDurationMs && (p.where = u, p.representativeDurationMs = d.totalDurationMs);
|
|
2570
2570
|
};
|
|
2571
|
-
|
|
2571
|
+
P.snapshot().forEach((c) => {
|
|
2572
2572
|
c.attributes.forEach((u) => {
|
|
2573
2573
|
n(
|
|
2574
2574
|
`@${u.name}
|
|
@@ -2598,7 +2598,7 @@ ${u.template}`,
|
|
|
2598
2598
|
entryCount: s.length,
|
|
2599
2599
|
top: a
|
|
2600
2600
|
};
|
|
2601
|
-
return
|
|
2601
|
+
return P.logReport(o), o;
|
|
2602
2602
|
}
|
|
2603
2603
|
/**
|
|
2604
2604
|
* 要約を表形式でコンソールへ出力します。
|
|
@@ -2628,30 +2628,30 @@ ${u.template}`,
|
|
|
2628
2628
|
* @param expressions 今回評価した式一覧
|
|
2629
2629
|
*/
|
|
2630
2630
|
static record(e, t, r) {
|
|
2631
|
-
if (!
|
|
2631
|
+
if (!V.isEnabled() || !e || t.length === 0 || (P.ensureGlobalAccess(), !P.isCollecting()))
|
|
2632
2632
|
return;
|
|
2633
|
-
const i =
|
|
2633
|
+
const i = P.getOrCreateElementStore(
|
|
2634
2634
|
e.element
|
|
2635
2635
|
);
|
|
2636
2636
|
if (e.kind === "attribute") {
|
|
2637
|
-
const s =
|
|
2637
|
+
const s = P.getOrCreateCounter(
|
|
2638
2638
|
i.attributes,
|
|
2639
2639
|
e.rawName,
|
|
2640
2640
|
e.template
|
|
2641
2641
|
);
|
|
2642
|
-
|
|
2642
|
+
P.updateCounter(
|
|
2643
2643
|
s,
|
|
2644
2644
|
t,
|
|
2645
2645
|
r
|
|
2646
2646
|
);
|
|
2647
2647
|
return;
|
|
2648
2648
|
}
|
|
2649
|
-
const n =
|
|
2649
|
+
const n = P.getOrCreateCounter(
|
|
2650
2650
|
i.texts,
|
|
2651
2651
|
String(e.childIndex),
|
|
2652
2652
|
e.template
|
|
2653
2653
|
);
|
|
2654
|
-
|
|
2654
|
+
P.updateCounter(
|
|
2655
2655
|
n,
|
|
2656
2656
|
t,
|
|
2657
2657
|
r
|
|
@@ -2661,15 +2661,15 @@ ${u.template}`,
|
|
|
2661
2661
|
* globalThis から dev-only の取得窓口を参照できるようにします。
|
|
2662
2662
|
*/
|
|
2663
2663
|
static ensureGlobalAccess() {
|
|
2664
|
-
if (!
|
|
2664
|
+
if (!V.isEnabled())
|
|
2665
2665
|
return;
|
|
2666
2666
|
const e = globalThis;
|
|
2667
|
-
e[
|
|
2668
|
-
start: () =>
|
|
2669
|
-
stop: () =>
|
|
2670
|
-
reset: () =>
|
|
2671
|
-
snapshot: () =>
|
|
2672
|
-
report: (t) =>
|
|
2667
|
+
e[P.GLOBAL_KEY] === void 0 && (e[P.GLOBAL_KEY] = {
|
|
2668
|
+
start: () => P.start(),
|
|
2669
|
+
stop: () => P.stop(),
|
|
2670
|
+
reset: () => P.reset(),
|
|
2671
|
+
snapshot: () => P.snapshot(),
|
|
2672
|
+
report: (t) => P.report(t)
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
2675
|
/**
|
|
@@ -2679,7 +2679,7 @@ ${u.template}`,
|
|
|
2679
2679
|
* @returns 集計ストア
|
|
2680
2680
|
*/
|
|
2681
2681
|
static getOrCreateElementStore(e) {
|
|
2682
|
-
const t =
|
|
2682
|
+
const t = P.createElementId(e), r = P.ELEMENT_STORES.get(t);
|
|
2683
2683
|
if (r)
|
|
2684
2684
|
return r;
|
|
2685
2685
|
const i = {
|
|
@@ -2687,7 +2687,7 @@ ${u.template}`,
|
|
|
2687
2687
|
attributes: /* @__PURE__ */ new Map(),
|
|
2688
2688
|
texts: /* @__PURE__ */ new Map()
|
|
2689
2689
|
};
|
|
2690
|
-
return
|
|
2690
|
+
return P.ELEMENT_STORES.set(t, i), i;
|
|
2691
2691
|
}
|
|
2692
2692
|
/**
|
|
2693
2693
|
* カウンタを取得または初期化します。
|
|
@@ -2737,7 +2737,7 @@ ${u.template}`,
|
|
|
2737
2737
|
*/
|
|
2738
2738
|
static updateCounter(e, t, r) {
|
|
2739
2739
|
e.calls += 1, e.totalDurationMs += r, e.maxDurationMs = Math.max(e.maxDurationMs, r), t.forEach((i) => {
|
|
2740
|
-
const n =
|
|
2740
|
+
const n = P.getOrCreatePlaceholder(
|
|
2741
2741
|
e.placeholders,
|
|
2742
2742
|
i.expression
|
|
2743
2743
|
);
|
|
@@ -2776,12 +2776,12 @@ ${u.template}`,
|
|
|
2776
2776
|
* @returns 結果と所要時間
|
|
2777
2777
|
*/
|
|
2778
2778
|
static measure(e) {
|
|
2779
|
-
if (!
|
|
2779
|
+
if (!P.isCollecting())
|
|
2780
2780
|
return { value: e(), durationMs: 0 };
|
|
2781
|
-
const t =
|
|
2781
|
+
const t = P.now();
|
|
2782
2782
|
return {
|
|
2783
2783
|
value: e(),
|
|
2784
|
-
durationMs:
|
|
2784
|
+
durationMs: P.now() - t
|
|
2785
2785
|
};
|
|
2786
2786
|
}
|
|
2787
2787
|
/**
|
|
@@ -2808,8 +2808,8 @@ ${u.template}`,
|
|
|
2808
2808
|
return t.join(" > ");
|
|
2809
2809
|
}
|
|
2810
2810
|
};
|
|
2811
|
-
|
|
2812
|
-
let
|
|
2811
|
+
P.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", P.ELEMENT_STORES = /* @__PURE__ */ new Map(), P.collecting = !1, P.DEFAULT_REPORT_LIMIT = 20;
|
|
2812
|
+
let Ne = P;
|
|
2813
2813
|
const pe = class pe {
|
|
2814
2814
|
/**
|
|
2815
2815
|
* フラグメントのコンストラクタ。
|
|
@@ -2827,7 +2827,7 @@ const pe = class pe {
|
|
|
2827
2827
|
let t;
|
|
2828
2828
|
switch (e.nodeType) {
|
|
2829
2829
|
case Node.ELEMENT_NODE:
|
|
2830
|
-
t = new
|
|
2830
|
+
t = new T(e);
|
|
2831
2831
|
break;
|
|
2832
2832
|
case Node.TEXT_NODE:
|
|
2833
2833
|
t = new re(e);
|
|
@@ -2954,7 +2954,7 @@ const w = class w extends M {
|
|
|
2954
2954
|
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, w.dropIfVisibilityArtifacts(e), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${l.prefix}bind`), e.getAttributeNames().forEach((t) => {
|
|
2955
2955
|
const r = e.getAttribute(t);
|
|
2956
2956
|
if (r !== null && !this.attributeMap.has(t)) {
|
|
2957
|
-
const i = new
|
|
2957
|
+
const i = new Fe(t, r);
|
|
2958
2958
|
this.attributeMap.set(t, i);
|
|
2959
2959
|
}
|
|
2960
2960
|
}), e.childNodes.forEach((t) => {
|
|
@@ -3122,10 +3122,46 @@ const w = class w extends M {
|
|
|
3122
3122
|
/**
|
|
3123
3123
|
* バインドデータを設定します。
|
|
3124
3124
|
*
|
|
3125
|
+
* 予約キー(`_` 始まりのエンジン管理変数)は、新しいデータが同じキーを持たない
|
|
3126
|
+
* 限り引き継ぎます(仕様「`data-bind`」)。予約キーは `data-bind` 属性へ書き出さ
|
|
3127
|
+
* ないため、宣言を取り込む側も外部から属性を書き換える側もこの値を運べません。
|
|
3128
|
+
* 引き継がないと、`data-if` が真になったときの子の初期化や外部からの書き換えの
|
|
3129
|
+
* たびに `_fetch` / `_poll` が消え、注入した状態が「まだ何も起きていない」状態と
|
|
3130
|
+
* 区別できなくなります。明示的に落とす場合はキー自体を持たせてください
|
|
3131
|
+
* (`{_fetch: undefined}`)。
|
|
3132
|
+
*
|
|
3125
3133
|
* @param data バインドデータ
|
|
3126
3134
|
*/
|
|
3127
3135
|
setBindingData(e) {
|
|
3128
|
-
this.bindingData = e, this.clearBindingDataCache();
|
|
3136
|
+
this.bindingData = this.withRetainedReservedKeys(e), this.clearBindingDataCache();
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* 新しいバインドデータへ、現在の予約キーのうち引き継ぐものを足します。
|
|
3140
|
+
*
|
|
3141
|
+
* @param data 新しいバインドデータ
|
|
3142
|
+
* @returns 予約キーを引き継いだバインドデータ
|
|
3143
|
+
*/
|
|
3144
|
+
withRetainedReservedKeys(e) {
|
|
3145
|
+
const t = this.bindingData;
|
|
3146
|
+
if (t === null)
|
|
3147
|
+
return e;
|
|
3148
|
+
const r = {};
|
|
3149
|
+
for (const i of Object.keys(t))
|
|
3150
|
+
w.isReservedBindingKey(i) && (r[i] = t[i]);
|
|
3151
|
+
return { ...r, ...e };
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* 予約キー(エンジン管理変数)かどうかを判定します。
|
|
3155
|
+
*
|
|
3156
|
+
* `_fetch` / `_poll` など、Haori が実行時に注入し、`data-bind` 属性へ書き出さない
|
|
3157
|
+
* 値が対象です(仕様「`data-bind`」)。`data-bind` 属性へのミラー
|
|
3158
|
+
* (`Core.setBindingData()`)も同じ判定で対象から外します。
|
|
3159
|
+
*
|
|
3160
|
+
* @param key 判定対象のキー
|
|
3161
|
+
* @returns 予約キーなら true
|
|
3162
|
+
*/
|
|
3163
|
+
static isReservedBindingKey(e) {
|
|
3164
|
+
return e.startsWith("_");
|
|
3129
3165
|
}
|
|
3130
3166
|
/**
|
|
3131
3167
|
* バインドデータ更新に伴う DOM 反映・再評価を、同一フラグメントでは呼出順
|
|
@@ -3848,7 +3884,7 @@ const w = class w extends M {
|
|
|
3848
3884
|
* @return 戻り値はありません。
|
|
3849
3885
|
*/
|
|
3850
3886
|
static warnUnresolvedAttribute(e, t, r, i) {
|
|
3851
|
-
if (!
|
|
3887
|
+
if (!V.isEnabled())
|
|
3852
3888
|
return;
|
|
3853
3889
|
const n = `${e} ${r}`;
|
|
3854
3890
|
w.loggedUnresolvedAttributes.has(n) || (w.loggedUnresolvedAttributes.add(n), m.warn(
|
|
@@ -4019,7 +4055,7 @@ const w = class w extends M {
|
|
|
4019
4055
|
* @returns 戻り値はありません。
|
|
4020
4056
|
*/
|
|
4021
4057
|
static warnValueTypeDeclaration(e, t, r) {
|
|
4022
|
-
if (!
|
|
4058
|
+
if (!V.isEnabled())
|
|
4023
4059
|
return;
|
|
4024
4060
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
4025
4061
|
w.loggedValueTypeDeclarations.has(n) || (w.loggedValueTypeDeclarations.add(n), m.warn(
|
|
@@ -4275,7 +4311,7 @@ const w = class w extends M {
|
|
|
4275
4311
|
);
|
|
4276
4312
|
if (r === null)
|
|
4277
4313
|
return e === t ? this.removeAttribute(e) : this.removeAliasedAttribute(e, t);
|
|
4278
|
-
const o = new
|
|
4314
|
+
const o = new Fe(e, r);
|
|
4279
4315
|
if (n) {
|
|
4280
4316
|
const ge = this.attributeMap.get(e);
|
|
4281
4317
|
if (ge && (ge.isEvaluate || ge.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
|
|
@@ -4292,13 +4328,13 @@ const w = class w extends M {
|
|
|
4292
4328
|
element: c,
|
|
4293
4329
|
rawName: e,
|
|
4294
4330
|
template: r
|
|
4295
|
-
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && w.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), g = o.isSingleExpression(), E = le.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, I = t === "value" && w.resolveDeclaredValueType(c) === "boolean",
|
|
4331
|
+
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && w.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), g = o.isSingleExpression(), E = le.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, I = t === "value" && w.resolveDeclaredValueType(c) === "boolean", $ = A === !1 && !I, W = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || $ : p ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : g ? u.hasUnresolvedReference || A === null || A === void 0 || $ : d && E === "");
|
|
4296
4332
|
if (W && u.hasUnresolvedReference && w.warnUnresolvedAttribute(
|
|
4297
4333
|
e,
|
|
4298
4334
|
t,
|
|
4299
4335
|
r,
|
|
4300
4336
|
c
|
|
4301
|
-
),
|
|
4337
|
+
), V.isEnabled() && A === !1 && g) {
|
|
4302
4338
|
const ge = o.getSingleExpression(), we = ge === null ? null : ee.diagnoseStrictComparison(
|
|
4303
4339
|
ge,
|
|
4304
4340
|
this.getBindingData()
|
|
@@ -4310,12 +4346,12 @@ const w = class w extends M {
|
|
|
4310
4346
|
c
|
|
4311
4347
|
);
|
|
4312
4348
|
}
|
|
4313
|
-
const x = o.isForceEvaluation() ? r : g ? A : E, U = i && o.isEvaluate && t === "value" && w.isValuePropertyTarget(c), K = c.getRootNode(), R = U && w.isUserEditableValue(c) && (c === K.activeElement || this.hasPendingUserEdit()), S = W || x === null || x === !1 && !I ? null : String(x), H = e !== t && c.getAttribute(e) !== r, B = S === null ? c.hasAttribute(t) : c.getAttribute(t) !== S, te = S === null ? "" : S, ie = U && !R && c.value !== te,
|
|
4349
|
+
const x = o.isForceEvaluation() ? r : g ? A : E, U = i && o.isEvaluate && t === "value" && w.isValuePropertyTarget(c), K = c.getRootNode(), R = U && w.isUserEditableValue(c) && (c === K.activeElement || this.hasPendingUserEdit()), S = W || x === null || x === !1 && !I ? null : String(x), H = e !== t && c.getAttribute(e) !== r, B = S === null ? c.hasAttribute(t) : c.getAttribute(t) !== S, te = S === null ? "" : S, ie = U && !R && c.value !== te, q = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), z = t === "selected" && c instanceof HTMLOptionElement, Z = K.activeElement, J = Z !== null && (q && c === Z || z && c.closest("select") === Z) || (q || z) && this.hasPendingCheckableUserEdit(z), ae = S !== null, Se = q && !J && c.checked !== ae, ce = z && !J && c.selected !== ae;
|
|
4314
4350
|
if (!H && !B && !ie && !Se && !ce)
|
|
4315
4351
|
return U && !R && (this.value = this.normalizeValueForElement(
|
|
4316
4352
|
c,
|
|
4317
4353
|
te
|
|
4318
|
-
), this.clearUnappliedValueWrite()), (
|
|
4354
|
+
), this.clearUnappliedValueWrite()), (q || z) && !J && this.syncCheckableValueFromDom(z), Promise.resolve();
|
|
4319
4355
|
const We = G.enqueue(() => {
|
|
4320
4356
|
H && c.setAttribute(e, r), S === null ? c.removeAttribute(t) : B && (c.setAttribute(t, S), t === `${l.prefix}bind` && this.recordSelfWrittenBind(S)), U && !R && (this.value = this.normalizeValueForElement(
|
|
4321
4357
|
c,
|
|
@@ -4686,7 +4722,7 @@ w.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, w.VALUE
|
|
|
4686
4722
|
"time",
|
|
4687
4723
|
"week"
|
|
4688
4724
|
], w.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), w.sequenceCounter = 0, w.bindingWorkActiveCount = 0, w.pendingMutationFlusher = null, w.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), w.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
4689
|
-
let
|
|
4725
|
+
let T = w;
|
|
4690
4726
|
class re extends M {
|
|
4691
4727
|
/**
|
|
4692
4728
|
* テキストフラグメントのコンストラクタ。
|
|
@@ -4814,7 +4850,7 @@ class Ve extends M {
|
|
|
4814
4850
|
}));
|
|
4815
4851
|
}
|
|
4816
4852
|
}
|
|
4817
|
-
const
|
|
4853
|
+
const $e = class $e {
|
|
4818
4854
|
/**
|
|
4819
4855
|
* コンストラクタ。
|
|
4820
4856
|
*
|
|
@@ -4822,7 +4858,7 @@ const Ce = class Ce {
|
|
|
4822
4858
|
*/
|
|
4823
4859
|
constructor(e) {
|
|
4824
4860
|
this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = e;
|
|
4825
|
-
const t = [...e.matchAll(
|
|
4861
|
+
const t = [...e.matchAll($e.PLACEHOLDER_REGEX)];
|
|
4826
4862
|
let r = 0, i = !1, n = !1;
|
|
4827
4863
|
for (const s of t) {
|
|
4828
4864
|
s.index > r && this.contents.push({
|
|
@@ -4927,7 +4963,7 @@ const Ce = class Ce {
|
|
|
4927
4963
|
return this.contents.forEach((c) => {
|
|
4928
4964
|
try {
|
|
4929
4965
|
if (r(c)) {
|
|
4930
|
-
const u =
|
|
4966
|
+
const u = Ne.measure(
|
|
4931
4967
|
() => ee.evaluateDetailed(c.text, e)
|
|
4932
4968
|
), d = u.value;
|
|
4933
4969
|
a += u.durationMs, s.push({
|
|
@@ -4946,15 +4982,15 @@ const Ce = class Ce {
|
|
|
4946
4982
|
durationMs: 0
|
|
4947
4983
|
}), n.push("");
|
|
4948
4984
|
}
|
|
4949
|
-
}),
|
|
4985
|
+
}), Ne.record(
|
|
4950
4986
|
t,
|
|
4951
4987
|
s,
|
|
4952
4988
|
a
|
|
4953
4989
|
), { results: n, hasUnresolvedReference: o };
|
|
4954
4990
|
}
|
|
4955
4991
|
};
|
|
4956
|
-
|
|
4957
|
-
let le =
|
|
4992
|
+
$e.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
|
|
4993
|
+
let le = $e;
|
|
4958
4994
|
const _ = class _ extends le {
|
|
4959
4995
|
/**
|
|
4960
4996
|
* コンストラクタ。
|
|
@@ -5034,7 +5070,7 @@ const _ = class _ extends le {
|
|
|
5034
5070
|
}
|
|
5035
5071
|
};
|
|
5036
5072
|
_.FORCE_EVALUATION_SUFFIXES = ["if", "each", "derive"], _.FORCE_EVALUATION_PREFIXES = ["data-", "hor-"], _.forceEvaluationNames = null, _.forceEvaluationPrefix = null;
|
|
5037
|
-
let
|
|
5073
|
+
let Fe = _;
|
|
5038
5074
|
const Ee = class Ee {
|
|
5039
5075
|
/**
|
|
5040
5076
|
* 実行モードを取得します。
|
|
@@ -5180,7 +5216,7 @@ const Ee = class Ee {
|
|
|
5180
5216
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
5181
5217
|
*/
|
|
5182
5218
|
static date(e, t, r) {
|
|
5183
|
-
return
|
|
5219
|
+
return Ce(e, t, r);
|
|
5184
5220
|
}
|
|
5185
5221
|
/**
|
|
5186
5222
|
* 現在日時を指定フォーマットの文字列へ整形します。
|
|
@@ -5366,7 +5402,7 @@ function Ye() {
|
|
|
5366
5402
|
(r) => typeof e?.[r] == "function"
|
|
5367
5403
|
) ? e : ve;
|
|
5368
5404
|
}
|
|
5369
|
-
const
|
|
5405
|
+
const f = class f {
|
|
5370
5406
|
/**
|
|
5371
5407
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
5372
5408
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -5377,7 +5413,7 @@ const h = class h {
|
|
|
5377
5413
|
*/
|
|
5378
5414
|
static getValues(e) {
|
|
5379
5415
|
const t = {}, r = /* @__PURE__ */ new Set();
|
|
5380
|
-
return
|
|
5416
|
+
return f.getPartValues(e, t, null, r), f.registerCollectedExcludedKeys(t, r), t;
|
|
5381
5417
|
}
|
|
5382
5418
|
/**
|
|
5383
5419
|
* 入力エレメントから収集する値を解決します。
|
|
@@ -5398,11 +5434,11 @@ const h = class h {
|
|
|
5398
5434
|
*/
|
|
5399
5435
|
static resolveCollectedValue(e) {
|
|
5400
5436
|
const t = e.getTarget();
|
|
5401
|
-
if (
|
|
5437
|
+
if (f.isFileInput(e)) {
|
|
5402
5438
|
const r = t, i = r.files ? Array.from(r.files) : [];
|
|
5403
5439
|
return r.multiple ? i : i.length > 0 ? i[0] : null;
|
|
5404
5440
|
}
|
|
5405
|
-
if (
|
|
5441
|
+
if (f.isBooleanCheckbox(e)) {
|
|
5406
5442
|
const r = t;
|
|
5407
5443
|
return r.value === "false" ? !r.checked : r.checked;
|
|
5408
5444
|
}
|
|
@@ -5455,13 +5491,13 @@ const h = class h {
|
|
|
5455
5491
|
* @returns 戻り値はありません。
|
|
5456
5492
|
*/
|
|
5457
5493
|
static clearRowUserEditMarksForChangedKeys(e, t) {
|
|
5458
|
-
const r =
|
|
5494
|
+
const r = f.getValues(e), i = /* @__PURE__ */ new Set();
|
|
5459
5495
|
for (const n of /* @__PURE__ */ new Set([
|
|
5460
5496
|
...Object.keys(r),
|
|
5461
5497
|
...Object.keys(t)
|
|
5462
5498
|
]))
|
|
5463
|
-
|
|
5464
|
-
i.size !== 0 &&
|
|
5499
|
+
f.isSameCollectedValue(r[n], t[n]) || i.add(n);
|
|
5500
|
+
i.size !== 0 && f.clearUserEditMarksForKeys(e, e, i);
|
|
5465
5501
|
}
|
|
5466
5502
|
/**
|
|
5467
5503
|
* 収集値と要素データの値が同じ内容かどうかを判定します。
|
|
@@ -5490,9 +5526,9 @@ const h = class h {
|
|
|
5490
5526
|
* @returns 戻り値はありません。
|
|
5491
5527
|
*/
|
|
5492
5528
|
static clearUserEditMarksForKeys(e, t, r) {
|
|
5493
|
-
const i =
|
|
5529
|
+
const i = f.resolveRowTopLevelKey(e, t);
|
|
5494
5530
|
i !== null && r.has(i) && e.clearUserEditMark(), e.getChildElementFragments().forEach((n) => {
|
|
5495
|
-
|
|
5531
|
+
f.clearUserEditMarksForKeys(n, t, r);
|
|
5496
5532
|
});
|
|
5497
5533
|
}
|
|
5498
5534
|
/**
|
|
@@ -5508,7 +5544,7 @@ const h = class h {
|
|
|
5508
5544
|
static resolveRowTopLevelKey(e, t) {
|
|
5509
5545
|
let r = null, i = e;
|
|
5510
5546
|
for (; i !== null && i !== t; ) {
|
|
5511
|
-
const n = i.getAttribute(`${l.prefix}form-object`) || i.getAttribute(`${l.prefix}form-list`) ||
|
|
5547
|
+
const n = i.getAttribute(`${l.prefix}form-object`) || i.getAttribute(`${l.prefix}form-list`) || f.resolveFieldName(i);
|
|
5512
5548
|
n != null && String(n) !== "" && (r = String(n)), i = i.getParent();
|
|
5513
5549
|
}
|
|
5514
5550
|
return r;
|
|
@@ -5549,7 +5585,7 @@ const h = class h {
|
|
|
5549
5585
|
const r = e.getTarget();
|
|
5550
5586
|
if (!(r instanceof HTMLInputElement) || r.type !== "radio" || r.hasAttribute("name") && !r.hasAttribute(Ge))
|
|
5551
5587
|
return;
|
|
5552
|
-
const i =
|
|
5588
|
+
const i = f.resolveGroupScope(e), n = `${String(t)}--haori${f.resolveGroupScopeId(
|
|
5553
5589
|
i
|
|
5554
5590
|
)}`;
|
|
5555
5591
|
if (r.getAttribute("name") !== n)
|
|
@@ -5583,8 +5619,8 @@ const h = class h {
|
|
|
5583
5619
|
* @returns スコープの識別番号
|
|
5584
5620
|
*/
|
|
5585
5621
|
static resolveGroupScopeId(e) {
|
|
5586
|
-
const t =
|
|
5587
|
-
return t !== void 0 ? t : (
|
|
5622
|
+
const t = f.GROUP_SCOPE_IDS.get(e);
|
|
5623
|
+
return t !== void 0 ? t : (f.groupScopeSequence += 1, f.GROUP_SCOPE_IDS.set(e, f.groupScopeSequence), f.groupScopeSequence);
|
|
5588
5624
|
}
|
|
5589
5625
|
/**
|
|
5590
5626
|
* 宣言バインドで値・状態が決まり、その評価が解決している入力かどうかを判定します。
|
|
@@ -5602,17 +5638,17 @@ const h = class h {
|
|
|
5602
5638
|
* @returns 宣言バインドで値・状態が決まり、その評価が解決している場合 true
|
|
5603
5639
|
*/
|
|
5604
5640
|
static hasResolvedDeclarativeState(e) {
|
|
5605
|
-
if (!
|
|
5641
|
+
if (!f.isDeclarativeStateBound(e))
|
|
5606
5642
|
return !1;
|
|
5607
5643
|
const t = e.getTarget();
|
|
5608
5644
|
if (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio"))
|
|
5609
|
-
return
|
|
5610
|
-
if (
|
|
5611
|
-
return
|
|
5645
|
+
return f.isDeclarationResolved(e, "checked");
|
|
5646
|
+
if (f.hasDeclarativeBinding(e, "value"))
|
|
5647
|
+
return f.isDeclarationResolved(e, "value");
|
|
5612
5648
|
if (t instanceof HTMLSelectElement) {
|
|
5613
5649
|
for (const r of Array.from(t.options)) {
|
|
5614
5650
|
const i = M.get(r);
|
|
5615
|
-
if (i instanceof
|
|
5651
|
+
if (i instanceof T && f.hasDeclarativeBinding(i, "selected") && !f.isDeclarationResolved(i, "selected"))
|
|
5616
5652
|
return !1;
|
|
5617
5653
|
}
|
|
5618
5654
|
return !0;
|
|
@@ -5655,7 +5691,7 @@ const h = class h {
|
|
|
5655
5691
|
*/
|
|
5656
5692
|
static isDeclarativeStateBound(e) {
|
|
5657
5693
|
const t = e.getTarget();
|
|
5658
|
-
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ?
|
|
5694
|
+
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? f.hasDeclarativeBinding(e, "checked") : T.isValuePropertyTarget(t) ? f.hasDeclarativeBinding(e, "value") ? !0 : t instanceof HTMLSelectElement ? f.hasDeclarativeSelectedOption(t) : !1 : !1;
|
|
5659
5695
|
}
|
|
5660
5696
|
/**
|
|
5661
5697
|
* 対象の部分木にある入力欄を、ネイティブのフォームリセットと同じ既定値へ戻します。
|
|
@@ -5675,7 +5711,7 @@ const h = class h {
|
|
|
5675
5711
|
const t = "input, textarea, select", r = [];
|
|
5676
5712
|
e.matches(t) && r.push(e), r.push(...e.querySelectorAll(t));
|
|
5677
5713
|
for (const i of r)
|
|
5678
|
-
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement &&
|
|
5714
|
+
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement && f.restoreDefaultSelection(i);
|
|
5679
5715
|
}
|
|
5680
5716
|
/**
|
|
5681
5717
|
* `<select>` の選択状態を既定の選択(`defaultSelected`)へ戻します。
|
|
@@ -5705,14 +5741,14 @@ const h = class h {
|
|
|
5705
5741
|
* @return 戻り値はありません。
|
|
5706
5742
|
*/
|
|
5707
5743
|
static clearDeclarativeStateFromDom(e) {
|
|
5708
|
-
if (
|
|
5744
|
+
if (f.isDeclarativeStateBound(e)) {
|
|
5709
5745
|
const t = e.getTarget();
|
|
5710
5746
|
t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked = !1 : t instanceof HTMLSelectElement ? (Array.from(t.options).forEach((r) => {
|
|
5711
5747
|
r.selected = !1;
|
|
5712
5748
|
}), t.selectedIndex = -1) : (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = "");
|
|
5713
5749
|
}
|
|
5714
5750
|
e.getChildren().forEach((t) => {
|
|
5715
|
-
t instanceof
|
|
5751
|
+
t instanceof T && f.clearDeclarativeStateFromDom(t);
|
|
5716
5752
|
});
|
|
5717
5753
|
}
|
|
5718
5754
|
/**
|
|
@@ -5742,7 +5778,7 @@ const h = class h {
|
|
|
5742
5778
|
static hasDeclarativeSelectedOption(e) {
|
|
5743
5779
|
for (const t of Array.from(e.options)) {
|
|
5744
5780
|
const r = M.get(t);
|
|
5745
|
-
if (r instanceof
|
|
5781
|
+
if (r instanceof T && f.hasDeclarativeBinding(r, "selected"))
|
|
5746
5782
|
return !0;
|
|
5747
5783
|
}
|
|
5748
5784
|
return !1;
|
|
@@ -5773,7 +5809,7 @@ const h = class h {
|
|
|
5773
5809
|
* @returns 編集された入力欄だけを含む値のオブジェクト
|
|
5774
5810
|
*/
|
|
5775
5811
|
static getValuesEditedAfter(e, t) {
|
|
5776
|
-
return
|
|
5812
|
+
return f.getPartValues(e, {}, t);
|
|
5777
5813
|
}
|
|
5778
5814
|
/**
|
|
5779
5815
|
* 利用者が編集した入力欄に対応するバインドデータの経路を集めます。
|
|
@@ -5815,10 +5851,10 @@ const h = class h {
|
|
|
5815
5851
|
*/
|
|
5816
5852
|
static collectEditedPaths(e, t, r = "", i = null) {
|
|
5817
5853
|
const n = /* @__PURE__ */ new Map();
|
|
5818
|
-
for (const a of
|
|
5854
|
+
for (const a of f.collectUserEditSequences(e)) {
|
|
5819
5855
|
const o = /* @__PURE__ */ new Set();
|
|
5820
|
-
|
|
5821
|
-
|
|
5856
|
+
f.walkEditedPaths(
|
|
5857
|
+
f.getValuesEditedAfter(e, a - 1),
|
|
5822
5858
|
r,
|
|
5823
5859
|
o
|
|
5824
5860
|
);
|
|
@@ -5826,7 +5862,7 @@ const h = class h {
|
|
|
5826
5862
|
n.has(c) || n.set(c, a);
|
|
5827
5863
|
}
|
|
5828
5864
|
const s = /* @__PURE__ */ new Set();
|
|
5829
|
-
|
|
5865
|
+
f.walkExcludedPaths(i ?? f.getValues(e), r, s);
|
|
5830
5866
|
for (const a of s)
|
|
5831
5867
|
n.has(a) || n.set(a, t);
|
|
5832
5868
|
return n;
|
|
@@ -5839,7 +5875,7 @@ const h = class h {
|
|
|
5839
5875
|
*/
|
|
5840
5876
|
static collectUserEditSequences(e) {
|
|
5841
5877
|
const t = /* @__PURE__ */ new Set();
|
|
5842
|
-
return
|
|
5878
|
+
return f.walkUserEditSequences(e, t), [...t].sort((r, i) => i - r);
|
|
5843
5879
|
}
|
|
5844
5880
|
/**
|
|
5845
5881
|
* 部分木をたどってユーザー編集の通番を集めます。
|
|
@@ -5852,7 +5888,7 @@ const h = class h {
|
|
|
5852
5888
|
const r = e.getUserEditSequence();
|
|
5853
5889
|
r > 0 && t.add(r);
|
|
5854
5890
|
for (const i of e.getChildElementFragments())
|
|
5855
|
-
|
|
5891
|
+
f.walkUserEditSequences(i, t);
|
|
5856
5892
|
}
|
|
5857
5893
|
/**
|
|
5858
5894
|
* 収集値をたどって、除外されたキーの経路を集めます。
|
|
@@ -5867,15 +5903,15 @@ const h = class h {
|
|
|
5867
5903
|
static walkExcludedPaths(e, t, r) {
|
|
5868
5904
|
if (Array.isArray(e))
|
|
5869
5905
|
return;
|
|
5870
|
-
const i =
|
|
5906
|
+
const i = f.asPlainRecord(e);
|
|
5871
5907
|
if (i === null)
|
|
5872
5908
|
return;
|
|
5873
|
-
const n =
|
|
5909
|
+
const n = f.COLLECTED_EXCLUDED_KEYS.get(i);
|
|
5874
5910
|
if (n)
|
|
5875
5911
|
for (const s of n)
|
|
5876
5912
|
s in i || r.add(t === "" ? s : `${t}.${s}`);
|
|
5877
5913
|
for (const [s, a] of Object.entries(i))
|
|
5878
|
-
|
|
5914
|
+
f.walkExcludedPaths(
|
|
5879
5915
|
a,
|
|
5880
5916
|
t === "" ? s : `${t}.${s}`,
|
|
5881
5917
|
r
|
|
@@ -5891,10 +5927,10 @@ const h = class h {
|
|
|
5891
5927
|
static walkEditedPaths(e, t, r) {
|
|
5892
5928
|
if (Array.isArray(e))
|
|
5893
5929
|
return;
|
|
5894
|
-
const i =
|
|
5930
|
+
const i = f.asPlainRecord(e);
|
|
5895
5931
|
if (i !== null) {
|
|
5896
5932
|
for (const [n, s] of Object.entries(i))
|
|
5897
|
-
|
|
5933
|
+
f.walkEditedPaths(
|
|
5898
5934
|
s,
|
|
5899
5935
|
t === "" ? n : `${t}.${n}`,
|
|
5900
5936
|
r
|
|
@@ -5920,48 +5956,48 @@ const h = class h {
|
|
|
5920
5956
|
return t;
|
|
5921
5957
|
if (e.getTarget().hasAttribute(`${l.prefix}if-false`)) {
|
|
5922
5958
|
if (i !== null)
|
|
5923
|
-
for (const u of
|
|
5959
|
+
for (const u of f.collectDeclaredKeysInFragment(e))
|
|
5924
5960
|
i.add(u);
|
|
5925
5961
|
return t;
|
|
5926
5962
|
}
|
|
5927
|
-
const n =
|
|
5963
|
+
const n = f.resolveFieldName(e), s = e.getAttribute(`${l.prefix}form-object`), a = e.getAttribute(`${l.prefix}form-list`), o = e.hasAttribute(`${l.prefix}form-list`), c = r !== null && e.getUserEditSequence() <= r;
|
|
5928
5964
|
if (n) {
|
|
5929
|
-
if (r !== null &&
|
|
5930
|
-
const u =
|
|
5965
|
+
if (r !== null && f.isGroupedCheckable(e)) {
|
|
5966
|
+
const u = f.collectGroupSelection(
|
|
5931
5967
|
e,
|
|
5932
5968
|
o,
|
|
5933
5969
|
r
|
|
5934
5970
|
);
|
|
5935
5971
|
u.edited && (t[String(n)] = u.value);
|
|
5936
|
-
} else if (o &&
|
|
5972
|
+
} else if (o && f.isGroupedCheckable(e)) {
|
|
5937
5973
|
const u = String(n), d = e.getTarget();
|
|
5938
5974
|
r === null && !Array.isArray(t[u]) && (t[u] = []), !c && d.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(d.value));
|
|
5939
5975
|
} else if (o && c)
|
|
5940
5976
|
Array.isArray(t[String(n)]) ? t[String(n)].push(null) : t[String(n)] = [null];
|
|
5941
5977
|
else if (!c) if (o) {
|
|
5942
|
-
const u =
|
|
5978
|
+
const u = f.resolveCollectedValue(e), d = f.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
5943
5979
|
Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
|
|
5944
|
-
} else if (
|
|
5980
|
+
} else if (f.isGroupedCheckable(e)) {
|
|
5945
5981
|
const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, p = u instanceof HTMLInputElement ? u.value : e.getValue(), g = d ? p : null, E = String(n);
|
|
5946
5982
|
g === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = g : Array.isArray(t[E]) ? t[E].push(g) : t[E] = [t[E], g];
|
|
5947
5983
|
} else
|
|
5948
|
-
t[String(n)] =
|
|
5984
|
+
t[String(n)] = f.resolveCollectedValue(e);
|
|
5949
5985
|
s && m.warn(
|
|
5950
5986
|
"Haori",
|
|
5951
5987
|
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
5952
5988
|
);
|
|
5953
5989
|
for (const u of e.getChildElementFragments())
|
|
5954
|
-
|
|
5990
|
+
f.getPartValues(u, t, r, i);
|
|
5955
5991
|
} else if (s) {
|
|
5956
5992
|
const u = {}, d = i === null ? null : /* @__PURE__ */ new Set();
|
|
5957
5993
|
for (const p of e.getChildElementFragments())
|
|
5958
|
-
|
|
5994
|
+
f.getPartValues(
|
|
5959
5995
|
p,
|
|
5960
5996
|
u,
|
|
5961
5997
|
r,
|
|
5962
5998
|
d
|
|
5963
5999
|
);
|
|
5964
|
-
d !== null &&
|
|
6000
|
+
d !== null && f.registerCollectedExcludedKeys(u, d), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (d?.size ?? 0) > 0 && i.add(String(s)), a && m.warn(
|
|
5965
6001
|
"Haori",
|
|
5966
6002
|
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
5967
6003
|
);
|
|
@@ -5970,25 +6006,25 @@ const h = class h {
|
|
|
5970
6006
|
let p = !1;
|
|
5971
6007
|
for (const g of e.getChildElementFragments()) {
|
|
5972
6008
|
const E = {}, A = i === null ? null : /* @__PURE__ */ new Set();
|
|
5973
|
-
|
|
6009
|
+
f.getPartValues(
|
|
5974
6010
|
g,
|
|
5975
6011
|
E,
|
|
5976
6012
|
r,
|
|
5977
6013
|
A
|
|
5978
|
-
), A !== null &&
|
|
6014
|
+
), A !== null && f.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (p = !0, u.push(E), d.push(g.getListKey())) : r !== null && (u.push({}), d.push(g.getListKey()));
|
|
5979
6015
|
}
|
|
5980
6016
|
if (r === null) {
|
|
5981
6017
|
const g = e.getAttribute(`${l.prefix}each-key`);
|
|
5982
|
-
|
|
6018
|
+
f.registerCollectedRowIdentity(
|
|
5983
6019
|
u,
|
|
5984
6020
|
g == null ? null : String(g),
|
|
5985
6021
|
d,
|
|
5986
|
-
|
|
5987
|
-
),
|
|
6022
|
+
f.isCollectedListFromEachSource(e)
|
|
6023
|
+
), f.warnDerivedRowsWithoutKey(e), t[String(a)] = u;
|
|
5988
6024
|
} else p && (t[String(a)] = u);
|
|
5989
6025
|
} else
|
|
5990
6026
|
for (const u of e.getChildElementFragments())
|
|
5991
|
-
|
|
6027
|
+
f.getPartValues(u, t, r, i);
|
|
5992
6028
|
return t;
|
|
5993
6029
|
}
|
|
5994
6030
|
/**
|
|
@@ -6001,7 +6037,7 @@ const h = class h {
|
|
|
6001
6037
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
6002
6038
|
*/
|
|
6003
6039
|
static setValues(e, t, r = !1) {
|
|
6004
|
-
return
|
|
6040
|
+
return f.setPartValues(e, t, r, !0);
|
|
6005
6041
|
}
|
|
6006
6042
|
/**
|
|
6007
6043
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -6014,7 +6050,7 @@ const h = class h {
|
|
|
6014
6050
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
6015
6051
|
*/
|
|
6016
6052
|
static syncValues(e, t, r = !1, i = null) {
|
|
6017
|
-
return
|
|
6053
|
+
return f.setPartValues(
|
|
6018
6054
|
e,
|
|
6019
6055
|
t,
|
|
6020
6056
|
r,
|
|
@@ -6037,7 +6073,7 @@ const h = class h {
|
|
|
6037
6073
|
* @returns 反映完了の Promise
|
|
6038
6074
|
*/
|
|
6039
6075
|
static syncRowValues(e, t, r = null) {
|
|
6040
|
-
return
|
|
6076
|
+
return f.setPartValues(
|
|
6041
6077
|
e,
|
|
6042
6078
|
t,
|
|
6043
6079
|
!1,
|
|
@@ -6067,38 +6103,88 @@ const h = class h {
|
|
|
6067
6103
|
if (!r)
|
|
6068
6104
|
return t;
|
|
6069
6105
|
const i = String(r);
|
|
6070
|
-
return Object.prototype.hasOwnProperty.call(t, i) ?
|
|
6106
|
+
return Object.prototype.hasOwnProperty.call(t, i) ? f.asPlainRecord(t[i]) ?? {} : f.resolveAncestorArgOwner(e, i)?.value ?? {};
|
|
6071
6107
|
}
|
|
6072
6108
|
/**
|
|
6073
|
-
*
|
|
6109
|
+
* キーを所有する祖先を、値の型を問わず解決します。
|
|
6074
6110
|
*
|
|
6075
6111
|
* 対象はフォームより外側の要素の**生バインドデータ**(`data-bind` で宣言・更新
|
|
6076
6112
|
* された値)だけです。`data-derive` の派生データと `data-each` の行データは対象外
|
|
6077
6113
|
* とします。どちらも描画のたびに作り直される仮想スコープで、行単位の書き戻しは
|
|
6078
6114
|
* `data-form-list` が担うため、ここで扱うと反映が行生成と競合します。
|
|
6079
6115
|
*
|
|
6080
|
-
*
|
|
6081
|
-
*
|
|
6082
|
-
*
|
|
6116
|
+
* 最も近い所有者だけを見ます。所有者が `data-each` の行である場合は、より外側は
|
|
6117
|
+
* 探しません(近い方が権威というシャドーの規則に従うため)。
|
|
6118
|
+
*
|
|
6119
|
+
* 値の型を問わないのは、収集キーの土台を解決する用途があるためです
|
|
6120
|
+
* (仕様「祖先が所有する値の反映(`data-form-arg` なし)」の「土台に使う値の型は
|
|
6121
|
+
* 問いません」)。`data-form-list` の収集キーは配列になるので、レコード限定に
|
|
6122
|
+
* すると土台が解決できません。`data-form-arg` のキーはレコードに限るため、
|
|
6123
|
+
* そちらは `resolveAncestorArgOwner()` が絞り込みます。
|
|
6083
6124
|
*
|
|
6084
6125
|
* @param form フォームのElementFragment
|
|
6085
|
-
* @param key
|
|
6126
|
+
* @param key キー名
|
|
6086
6127
|
* @returns 所有する祖先フラグメントとその値。見つからない場合は null
|
|
6087
6128
|
*/
|
|
6088
|
-
static
|
|
6129
|
+
static resolveAncestorKeyOwner(e, t) {
|
|
6089
6130
|
let r = e.getParent();
|
|
6090
6131
|
for (; r; ) {
|
|
6091
6132
|
const i = r.getRawBindingData();
|
|
6092
|
-
if (i && Object.prototype.hasOwnProperty.call(i, t))
|
|
6093
|
-
|
|
6094
|
-
return null;
|
|
6095
|
-
const n = h.asPlainRecord(i[t]);
|
|
6096
|
-
return n ? { owner: r, value: n } : null;
|
|
6097
|
-
}
|
|
6133
|
+
if (i && Object.prototype.hasOwnProperty.call(i, t))
|
|
6134
|
+
return r.getListKey() !== null ? null : { owner: r, value: i[t] };
|
|
6098
6135
|
r = r.getParent();
|
|
6099
6136
|
}
|
|
6100
6137
|
return null;
|
|
6101
6138
|
}
|
|
6139
|
+
/**
|
|
6140
|
+
* `data-form-arg` のキーを所有する祖先を解決します。
|
|
6141
|
+
*
|
|
6142
|
+
* `data-form-arg` はフォームの入力欄が**そのキーの配下**に対応することを宣言する
|
|
6143
|
+
* ため、値はレコードに限ります。レコードでない値を所有している場合は所有者なしと
|
|
6144
|
+
* して扱い、開発モードで警告します。黙って退くと収集値がそのままそのキーへ入り、
|
|
6145
|
+
* 配列を宣言していた場合は**型がオブジェクトへ変わります**(一覧を描く式が壊れる)。
|
|
6146
|
+
*
|
|
6147
|
+
* @param form フォームのElementFragment
|
|
6148
|
+
* @param key `data-form-arg` で指定されたキー名
|
|
6149
|
+
* @returns 所有する祖先フラグメントとその値。見つからない場合は null
|
|
6150
|
+
*/
|
|
6151
|
+
static resolveAncestorArgOwner(e, t) {
|
|
6152
|
+
const r = f.resolveAncestorKeyOwner(e, t);
|
|
6153
|
+
if (r === null)
|
|
6154
|
+
return null;
|
|
6155
|
+
const i = f.asPlainRecord(r.value);
|
|
6156
|
+
return i === null ? (f.warnArgOwnerIsNotRecord(e, t, r.value), null) : { owner: r.owner, value: i };
|
|
6157
|
+
}
|
|
6158
|
+
/**
|
|
6159
|
+
* 収集キーの土台を祖先から解決する関数を返します。
|
|
6160
|
+
*
|
|
6161
|
+
* `data-form-arg` を宣言しないフォームでも、収集キーを祖先が所有する構成では
|
|
6162
|
+
* その値が土台になります(仕様「祖先が所有する値の反映(`data-form-arg` なし)」の
|
|
6163
|
+
* 「コミット時は**収集したキーごとに、最も近い所有者の値を土台に収集値を
|
|
6164
|
+
* 重ねます**」)。`Form.mergeCollectedValues()` へ渡して使います。
|
|
6165
|
+
*
|
|
6166
|
+
* @param form フォームのElementFragment
|
|
6167
|
+
* @returns キーを受け取り、祖先が所有する値を返す関数(所有者が無ければ undefined)
|
|
6168
|
+
*/
|
|
6169
|
+
static ancestorBaseResolver(e) {
|
|
6170
|
+
return (t) => f.resolveAncestorKeyOwner(e, t)?.value;
|
|
6171
|
+
}
|
|
6172
|
+
/**
|
|
6173
|
+
* `data-form-arg` のキーをレコード以外で所有している構成を、開発モードで知らせます。
|
|
6174
|
+
*
|
|
6175
|
+
* @param form フォームのElementFragment
|
|
6176
|
+
* @param key `data-form-arg` で指定されたキー名
|
|
6177
|
+
* @param value 祖先が所有している値
|
|
6178
|
+
*/
|
|
6179
|
+
static warnArgOwnerIsNotRecord(e, t, r) {
|
|
6180
|
+
if (!V.isEnabled() || r == null)
|
|
6181
|
+
return;
|
|
6182
|
+
const i = e.getTarget(), n = f.warnedArgOwnerNotRecord.get(i);
|
|
6183
|
+
n?.has(t) || (n ? n.add(t) : f.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])), m.warn(
|
|
6184
|
+
"[Haori]",
|
|
6185
|
+
`${l.prefix}form-arg="${t}" のキーを祖先が${Array.isArray(r) ? "配列" : `${typeof r} 型の値`}で持っています。${l.prefix}form-arg はそのキーの配下に入力欄が対応することを宣言するため、値はレコード(オブジェクト)である必要があります。このままでは収集値がそのキーへ直接入り、値の型が変わります。`
|
|
6186
|
+
));
|
|
6187
|
+
}
|
|
6102
6188
|
/**
|
|
6103
6189
|
* 条件式(`data-validity` / `data-{event}-if`)の評価スコープを作ります。
|
|
6104
6190
|
*
|
|
@@ -6116,18 +6202,18 @@ const h = class h {
|
|
|
6116
6202
|
static buildConditionScope(e, t = null) {
|
|
6117
6203
|
const r = { ...e.getBindingData() }, i = t ? {
|
|
6118
6204
|
source: t,
|
|
6119
|
-
argKey:
|
|
6120
|
-
} :
|
|
6205
|
+
argKey: f.resolveFormArgKey(t)
|
|
6206
|
+
} : f.resolveConditionValueSource(e);
|
|
6121
6207
|
if (!i)
|
|
6122
6208
|
return r;
|
|
6123
|
-
const n =
|
|
6209
|
+
const n = f.getValues(i.source), s = f.collectDeclaredFieldKeys(i.source);
|
|
6124
6210
|
if (i.argKey === null) {
|
|
6125
6211
|
for (const o of s)
|
|
6126
6212
|
r[o] = n[o];
|
|
6127
6213
|
return r;
|
|
6128
6214
|
}
|
|
6129
6215
|
const a = {
|
|
6130
|
-
...
|
|
6216
|
+
...f.asPlainRecord(r[i.argKey]) ?? {}
|
|
6131
6217
|
};
|
|
6132
6218
|
for (const o of s)
|
|
6133
6219
|
a[o] = n[o];
|
|
@@ -6157,8 +6243,8 @@ const h = class h {
|
|
|
6157
6243
|
}
|
|
6158
6244
|
t = i;
|
|
6159
6245
|
}
|
|
6160
|
-
const r =
|
|
6161
|
-
return r ? { source: r, argKey:
|
|
6246
|
+
const r = f.getFormFragment(e);
|
|
6247
|
+
return r ? { source: r, argKey: f.resolveFormArgKey(r) } : null;
|
|
6162
6248
|
}
|
|
6163
6249
|
/**
|
|
6164
6250
|
* フォームコンテナの `data-form-arg` のキー名を返します。
|
|
@@ -6190,7 +6276,7 @@ const h = class h {
|
|
|
6190
6276
|
* @returns 宣言されている最上位のキー名
|
|
6191
6277
|
*/
|
|
6192
6278
|
static collectDeclaredFieldKeys(e) {
|
|
6193
|
-
return
|
|
6279
|
+
return f.collectDeclaredKeysInFragment(e);
|
|
6194
6280
|
}
|
|
6195
6281
|
/**
|
|
6196
6282
|
* フラグメントの配下で収集対象として**宣言されている**最上位のキー名を列挙します。
|
|
@@ -6202,7 +6288,7 @@ const h = class h {
|
|
|
6202
6288
|
* @returns 宣言されている最上位のキー名
|
|
6203
6289
|
*/
|
|
6204
6290
|
static collectDeclaredKeysInFragment(e) {
|
|
6205
|
-
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i =
|
|
6291
|
+
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = f.resolveFieldName(e);
|
|
6206
6292
|
i && t.add(String(i));
|
|
6207
6293
|
const n = `${l.prefix}form-object`, s = `${l.prefix}form-list`, a = r.getAttribute(n) ?? r.getAttribute(s);
|
|
6208
6294
|
if (a)
|
|
@@ -6232,7 +6318,7 @@ const h = class h {
|
|
|
6232
6318
|
*/
|
|
6233
6319
|
static applyCustomValidity(e) {
|
|
6234
6320
|
const t = `${l.prefix}validity`, r = (i) => {
|
|
6235
|
-
i.hasAttribute(t) &&
|
|
6321
|
+
i.hasAttribute(t) && f.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
6236
6322
|
};
|
|
6237
6323
|
r(e);
|
|
6238
6324
|
}
|
|
@@ -6257,19 +6343,19 @@ const h = class h {
|
|
|
6257
6343
|
r.setCustomValidity("");
|
|
6258
6344
|
return;
|
|
6259
6345
|
}
|
|
6260
|
-
const n =
|
|
6261
|
-
|
|
6346
|
+
const n = f.buildConditionScope(e), s = ee.evaluateDetailed(
|
|
6347
|
+
f.unwrapConditionExpression(i),
|
|
6262
6348
|
n
|
|
6263
6349
|
);
|
|
6264
6350
|
if (s.unresolvedReference) {
|
|
6265
6351
|
m.warn(
|
|
6266
6352
|
"Haori",
|
|
6267
6353
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
6268
|
-
), r.setCustomValidity(
|
|
6354
|
+
), r.setCustomValidity(f.resolveValidityMessage(e));
|
|
6269
6355
|
return;
|
|
6270
6356
|
}
|
|
6271
6357
|
r.setCustomValidity(
|
|
6272
|
-
s.value ? "" :
|
|
6358
|
+
s.value ? "" : f.resolveValidityMessage(e)
|
|
6273
6359
|
);
|
|
6274
6360
|
}
|
|
6275
6361
|
/**
|
|
@@ -6305,7 +6391,7 @@ const h = class h {
|
|
|
6305
6391
|
* @returns 戻り値はありません。
|
|
6306
6392
|
*/
|
|
6307
6393
|
static warnUnvalidatedCustomValidity(e, t) {
|
|
6308
|
-
if (!
|
|
6394
|
+
if (!V.isEnabled() || !e)
|
|
6309
6395
|
return;
|
|
6310
6396
|
const r = `${l.prefix}validity`;
|
|
6311
6397
|
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && m.warn(
|
|
@@ -6331,7 +6417,7 @@ const h = class h {
|
|
|
6331
6417
|
* @param identifiesItems リストキーで収集先の配列要素を識別できるかどうか
|
|
6332
6418
|
*/
|
|
6333
6419
|
static registerCollectedRowIdentity(e, t, r, i) {
|
|
6334
|
-
|
|
6420
|
+
f.COLLECTED_ROW_IDENTITY.set(e, { keyArg: t, keys: r, identifiesItems: i });
|
|
6335
6421
|
}
|
|
6336
6422
|
/**
|
|
6337
6423
|
* 収集値の階層に、除外されたキーの集合を結び付けます。
|
|
@@ -6340,7 +6426,7 @@ const h = class h {
|
|
|
6340
6426
|
* @param keys 除外されたキー
|
|
6341
6427
|
*/
|
|
6342
6428
|
static registerCollectedExcludedKeys(e, t) {
|
|
6343
|
-
t.size > 0 &&
|
|
6429
|
+
t.size > 0 && f.COLLECTED_EXCLUDED_KEYS.set(e, t);
|
|
6344
6430
|
}
|
|
6345
6431
|
/**
|
|
6346
6432
|
* 収集値に控えた情報を、複製した値へ引き継ぎます。
|
|
@@ -6353,10 +6439,10 @@ const h = class h {
|
|
|
6353
6439
|
* @param to 複製した値
|
|
6354
6440
|
*/
|
|
6355
6441
|
static carryCollectedRowIdentity(e, t) {
|
|
6356
|
-
const r =
|
|
6357
|
-
r &&
|
|
6358
|
-
const i =
|
|
6359
|
-
i &&
|
|
6442
|
+
const r = f.COLLECTED_ROW_IDENTITY.get(e);
|
|
6443
|
+
r && f.COLLECTED_ROW_IDENTITY.set(t, r);
|
|
6444
|
+
const i = f.COLLECTED_EXCLUDED_KEYS.get(e);
|
|
6445
|
+
i && f.COLLECTED_EXCLUDED_KEYS.set(t, i);
|
|
6360
6446
|
}
|
|
6361
6447
|
/**
|
|
6362
6448
|
* 行の対応付けが出現順へ退いたことを、開発モードで一度だけ知らせます。
|
|
@@ -6368,7 +6454,7 @@ const h = class h {
|
|
|
6368
6454
|
* @param reason 退いた理由
|
|
6369
6455
|
*/
|
|
6370
6456
|
static warnPositionalRowFallback(e) {
|
|
6371
|
-
!
|
|
6457
|
+
!V.isEnabled() || f.warnedPositionalRowFallbacks.has(e) || (f.warnedPositionalRowFallbacks.add(e), m.warn(
|
|
6372
6458
|
"[Haori]",
|
|
6373
6459
|
`${l.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6374
6460
|
));
|
|
@@ -6388,10 +6474,10 @@ const h = class h {
|
|
|
6388
6474
|
* @param container `data-form-list` を持つコンテナのフラグメント
|
|
6389
6475
|
*/
|
|
6390
6476
|
static warnDerivedRowsWithoutKey(e) {
|
|
6391
|
-
if (!
|
|
6477
|
+
if (!V.isEnabled() || e.getRawAttribute(`${l.prefix}each-key`) !== null)
|
|
6392
6478
|
return;
|
|
6393
6479
|
const t = e.getRawAttribute(`${l.prefix}each`);
|
|
6394
|
-
t === null ||
|
|
6480
|
+
t === null || f.resolveLeadingPath(t) !== null || f.warnedDerivedRowsWithoutKey.has(t) || (f.warnedDerivedRowsWithoutKey.add(t), m.warn(
|
|
6395
6481
|
"[Haori]",
|
|
6396
6482
|
`${l.prefix}each="${t}" の一覧を ${l.prefix}form-list で収集していますが、${l.prefix}each-key がありません。行と配列要素を出現順で対応付けるため、画面に出ていない要素があると行の値を取り違えます。${l.prefix}each-key を宣言してください。`
|
|
6397
6483
|
));
|
|
@@ -6422,19 +6508,32 @@ const h = class h {
|
|
|
6422
6508
|
* これらをバインドキーとして受け付けないため、載せても参照できず、`__proto__` に
|
|
6423
6509
|
* 至っては代入でオブジェクトのプロトタイプが差し替わってしまいます。
|
|
6424
6510
|
*
|
|
6511
|
+
* **土台に無いキーは `resolveBase` で解決します。** フォーム自身が収集キーを
|
|
6512
|
+
* 持たず祖先が持っている構成では、土台がここに無いためです(仕様「双方向
|
|
6513
|
+
* バインディングの自動更新」の「土台はフォーム自身のバインドデータに限りません」)。
|
|
6514
|
+
* 呼び出し側で土台を組み立ててから渡す形にしないのは、上のプロトタイプ汚染の
|
|
6515
|
+
* ガードを迂回させないためです(解決した値の代入もこのループの中で行います)。
|
|
6516
|
+
* 入れ子のレコードへ再帰する際は渡しません(解決するのはトップレベルの収集キー
|
|
6517
|
+
* だけで、入れ子のキーはバインドキーではないため)。
|
|
6518
|
+
*
|
|
6425
6519
|
* @param previous 直前のバインドデータ(無い場合は null)
|
|
6426
6520
|
* @param collected 収集値
|
|
6521
|
+
* @param resolveBase 土台に無いキーの土台を返す関数。省略時は解決しない
|
|
6427
6522
|
* @returns 収集値を重ねたバインドデータ
|
|
6428
6523
|
*/
|
|
6429
|
-
static mergeCollectedValues(e, t) {
|
|
6430
|
-
const
|
|
6431
|
-
for (const [
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6524
|
+
static mergeCollectedValues(e, t, r = null) {
|
|
6525
|
+
const i = { ...e ?? {} };
|
|
6526
|
+
for (const [s, a] of Object.entries(t)) {
|
|
6527
|
+
if (f.UNSAFE_MERGE_KEYS.has(s))
|
|
6528
|
+
continue;
|
|
6529
|
+
const o = e && Object.prototype.hasOwnProperty.call(e, s) ? e[s] : r?.(s);
|
|
6530
|
+
i[s] = f.overlayCollectedValue(o, a);
|
|
6531
|
+
}
|
|
6532
|
+
const n = f.COLLECTED_EXCLUDED_KEYS.get(t);
|
|
6533
|
+
if (n)
|
|
6534
|
+
for (const s of n)
|
|
6535
|
+
s in t || delete i[s];
|
|
6536
|
+
return i;
|
|
6438
6537
|
}
|
|
6439
6538
|
/**
|
|
6440
6539
|
* 収集値の 1 項目を、直前の値へ重ねます。
|
|
@@ -6447,13 +6546,13 @@ const h = class h {
|
|
|
6447
6546
|
if (Array.isArray(t)) {
|
|
6448
6547
|
if (!Array.isArray(e))
|
|
6449
6548
|
return t;
|
|
6450
|
-
const n =
|
|
6549
|
+
const n = f.overlayIdentifiedRows(e, t);
|
|
6451
6550
|
return n !== null ? n : t.map(
|
|
6452
|
-
(s, a) =>
|
|
6551
|
+
(s, a) => f.overlayCollectedValue(e[a], s)
|
|
6453
6552
|
);
|
|
6454
6553
|
}
|
|
6455
|
-
const r =
|
|
6456
|
-
return r === null || i === null ? t :
|
|
6554
|
+
const r = f.asPlainRecord(t), i = f.asPlainRecord(e);
|
|
6555
|
+
return r === null || i === null ? t : f.mergeCollectedValues(i, r);
|
|
6457
6556
|
}
|
|
6458
6557
|
/**
|
|
6459
6558
|
* 式の先頭にある素の経路を返します。
|
|
@@ -6471,7 +6570,7 @@ const h = class h {
|
|
|
6471
6570
|
* @returns 先頭の経路。経路として読めない場合は null
|
|
6472
6571
|
*/
|
|
6473
6572
|
static resolveLeadingPath(e) {
|
|
6474
|
-
const t =
|
|
6573
|
+
const t = f.LEADING_PATH_PATTERN.exec(e);
|
|
6475
6574
|
if (!t)
|
|
6476
6575
|
return null;
|
|
6477
6576
|
const r = t[2].trim();
|
|
@@ -6508,7 +6607,7 @@ const h = class h {
|
|
|
6508
6607
|
const r = e.getRawAttribute(`${l.prefix}each`);
|
|
6509
6608
|
if (typeof r != "string" || r.trim() === "")
|
|
6510
6609
|
return !0;
|
|
6511
|
-
const i =
|
|
6610
|
+
const i = f.resolveLeadingPath(r);
|
|
6512
6611
|
if (i === null)
|
|
6513
6612
|
return !0;
|
|
6514
6613
|
const n = i.split(".");
|
|
@@ -6532,7 +6631,7 @@ const h = class h {
|
|
|
6532
6631
|
static createRowKeyIndexes(e, t) {
|
|
6533
6632
|
const r = /* @__PURE__ */ new Map();
|
|
6534
6633
|
return e.forEach((i, n) => {
|
|
6535
|
-
const s =
|
|
6634
|
+
const s = k.createListKey(
|
|
6536
6635
|
i,
|
|
6537
6636
|
t,
|
|
6538
6637
|
n
|
|
@@ -6563,7 +6662,7 @@ const h = class h {
|
|
|
6563
6662
|
const i = e.map((s) => s.getListKey());
|
|
6564
6663
|
if (i.some((s) => s === null))
|
|
6565
6664
|
return null;
|
|
6566
|
-
const n =
|
|
6665
|
+
const n = f.createRowKeyIndexes(t, r);
|
|
6567
6666
|
return i.map((s) => {
|
|
6568
6667
|
const a = n.get(s);
|
|
6569
6668
|
return !a || a.length === 0 ? null : t[a.shift()];
|
|
@@ -6593,22 +6692,22 @@ const h = class h {
|
|
|
6593
6692
|
* @returns 重ね合わせた配列。対応付けができない場合は null(出現順へ退く)
|
|
6594
6693
|
*/
|
|
6595
6694
|
static overlayIdentifiedRows(e, t) {
|
|
6596
|
-
const r =
|
|
6695
|
+
const r = f.COLLECTED_ROW_IDENTITY.get(t);
|
|
6597
6696
|
if (r && !r.identifiesItems)
|
|
6598
6697
|
return null;
|
|
6599
6698
|
if (!r)
|
|
6600
|
-
return t.some((s) =>
|
|
6699
|
+
return t.some((s) => f.asPlainRecord(s) !== null) && f.warnPositionalRowFallback("識別情報が引き継がれていません"), null;
|
|
6601
6700
|
if (r.keys.length !== t.length)
|
|
6602
|
-
return
|
|
6701
|
+
return f.warnPositionalRowFallback("収集後に行の数が変わっています"), null;
|
|
6603
6702
|
if (r.keys.some((s) => s === null))
|
|
6604
6703
|
return null;
|
|
6605
|
-
const i =
|
|
6704
|
+
const i = f.createRowKeyIndexes(e, r.keyArg), n = e.slice();
|
|
6606
6705
|
for (let s = 0; s < t.length; s += 1) {
|
|
6607
6706
|
const a = r.keys[s], o = i.get(a);
|
|
6608
6707
|
if (!o || o.length === 0)
|
|
6609
6708
|
continue;
|
|
6610
6709
|
const c = o.shift();
|
|
6611
|
-
n[c] =
|
|
6710
|
+
n[c] = f.overlayCollectedValue(
|
|
6612
6711
|
e[c],
|
|
6613
6712
|
t[s]
|
|
6614
6713
|
);
|
|
@@ -6616,10 +6715,20 @@ const h = class h {
|
|
|
6616
6715
|
return n;
|
|
6617
6716
|
}
|
|
6618
6717
|
/**
|
|
6619
|
-
*
|
|
6718
|
+
* 祖先のバインドデータ更新を、配下のフォームへ反映します。
|
|
6620
6719
|
*
|
|
6621
|
-
*
|
|
6622
|
-
*
|
|
6720
|
+
* `data-form-arg` を宣言したフォームへは入力欄まで流し込みます。対象は「当該キーを
|
|
6721
|
+
* 所有するのが更新された祖先自身」であるフォームだけです。間に同名キーを持つ要素が
|
|
6722
|
+
* あればそちらが権威なので対象外とします。
|
|
6723
|
+
*
|
|
6724
|
+
* `data-form-arg` の無い収集単位(`<form>` と `data-form` コンテナ)には、双方向
|
|
6725
|
+
* コミットが作ったコピーの解除だけを行います(仕様「祖先が所有する値の反映
|
|
6726
|
+
* (`data-form-arg` なし)」の「祖先が当該キーを更新したときに解除するため、以降の
|
|
6727
|
+
* 更新が届かなくなることはありません」)。解除しないと、一度でも入力した収集単位は
|
|
6728
|
+
* 以降どの再取得も受け付けません。入力欄へ流し込まないのは、どのキーが対応するかを
|
|
6729
|
+
* 宣言していないためです(同節の「入力欄への流し込みは `data-form-arg` を宣言した
|
|
6730
|
+
* 場合だけです」)。行の入力欄は解除後の再評価で `data-each` の行単位の反映が
|
|
6731
|
+
* 拾います。
|
|
6623
6732
|
*
|
|
6624
6733
|
* 更新が始まった後に初期化されたフォームも対象外です。祖先の更新は初期化前の
|
|
6625
6734
|
* 状態を運んでいるため、流し込むとクリアしたはずの値が復活します。
|
|
@@ -6627,17 +6736,84 @@ const h = class h {
|
|
|
6627
6736
|
* @param fragment 更新された祖先のフラグメント
|
|
6628
6737
|
* @param resetSequence 更新が始まった時点の初期化の通番
|
|
6629
6738
|
* @param origin 値の由来(通番と種別)。渡すと入力欄ごとに適用可否を判定します
|
|
6739
|
+
* @param previous 更新前の祖先の生バインドデータ。渡すと値が変わったキーだけ解除する
|
|
6630
6740
|
* @returns 反映完了の Promise
|
|
6631
6741
|
*/
|
|
6632
|
-
static syncAncestorArgForms(e, t, r = null) {
|
|
6633
|
-
const
|
|
6634
|
-
for (const { form:
|
|
6635
|
-
if (
|
|
6742
|
+
static syncAncestorArgForms(e, t, r = null, i = null) {
|
|
6743
|
+
const n = [];
|
|
6744
|
+
for (const { form: a, key: o } of f.collectArgForms(e)) {
|
|
6745
|
+
if (a.wasResetAfter(t))
|
|
6636
6746
|
continue;
|
|
6637
|
-
const
|
|
6638
|
-
!
|
|
6747
|
+
const c = f.resolveAncestorArgOwner(a, o);
|
|
6748
|
+
!c || c.owner !== e || n.push(f.pushAncestorArgValue(a, o, c.value, r));
|
|
6639
6749
|
}
|
|
6640
|
-
|
|
6750
|
+
const s = e.getRawBindingData();
|
|
6751
|
+
for (const { form: a, keys: o } of f.collectShadowingContainers(e)) {
|
|
6752
|
+
if (a.wasResetAfter(t))
|
|
6753
|
+
continue;
|
|
6754
|
+
const c = o.filter(
|
|
6755
|
+
(u) => f.createArgValueSignature(i?.[u]) !== f.createArgValueSignature(s?.[u])
|
|
6756
|
+
);
|
|
6757
|
+
c.length !== 0 && n.push(f.releaseOwnCopy(a, c, r));
|
|
6758
|
+
}
|
|
6759
|
+
return Promise.all(n).then(() => {
|
|
6760
|
+
});
|
|
6761
|
+
}
|
|
6762
|
+
/**
|
|
6763
|
+
* 配下の収集単位のうち、祖先のキーをコピーでシャドーしているものを列挙します。
|
|
6764
|
+
*
|
|
6765
|
+
* 収集単位は `<form>` と `data-form` コンテナの両方です(`Form.getFormFragment()`
|
|
6766
|
+
* が対象にする範囲と揃えます)。どちらも双方向コミットの書き込み先になるため、
|
|
6767
|
+
* どちらもコピーを作って祖先をシャドーしえます。仕様「祖先が所有するレコードの
|
|
6768
|
+
* 反映(`data-form-arg`)」が `data-form` を対象外とするのは**入力欄への流し込み**
|
|
6769
|
+
* についてで、シャドーの解除には当てはまりません。
|
|
6770
|
+
*
|
|
6771
|
+
* `data-form-arg` を宣言した `<form>` は除きます。そちらは `collectArgForms()` が
|
|
6772
|
+
* 扱い、`pushAncestorArgValue()` が入力欄への流し込みまで行います。
|
|
6773
|
+
*
|
|
6774
|
+
* 列挙するキーは、収集単位自身の生バインドデータが持ち、かつ**初期 `data-bind`
|
|
6775
|
+
* 宣言に無い**キーに限ります。宣言のあるキーは双方向コミットが作ったコピーでは
|
|
6776
|
+
* なく自身の宣言なので、祖先が同名のキーを更新しても落としてはなりません。
|
|
6777
|
+
*
|
|
6778
|
+
* @param root 走査の起点フラグメント(更新された祖先)
|
|
6779
|
+
* @returns 収集単位のフラグメントと、それが `root` のキーをシャドーしているキー名の
|
|
6780
|
+
* 一覧。シャドーしているキーが無い収集単位は含みません
|
|
6781
|
+
*/
|
|
6782
|
+
static collectShadowingContainers(e) {
|
|
6783
|
+
const t = `${l.prefix}form-arg`, r = [];
|
|
6784
|
+
return e.getTarget().querySelectorAll(`form:not([${t}]), [${l.prefix}form]`).forEach((i) => {
|
|
6785
|
+
const n = M.get(i);
|
|
6786
|
+
if (!(n instanceof T))
|
|
6787
|
+
return;
|
|
6788
|
+
const s = n.getRawBindingData();
|
|
6789
|
+
if (s === null)
|
|
6790
|
+
return;
|
|
6791
|
+
const a = f.getInitialBindingData(n), o = Object.keys(s).filter((c) => Object.prototype.hasOwnProperty.call(a ?? {}, c) ? !1 : f.resolveAncestorKeyOwner(n, c)?.owner === e);
|
|
6792
|
+
o.length > 0 && r.push({ form: n, keys: o });
|
|
6793
|
+
}), r;
|
|
6794
|
+
}
|
|
6795
|
+
/**
|
|
6796
|
+
* 双方向コミットが作ったコピーを、フォーム自身のバインドデータから取り除きます。
|
|
6797
|
+
*
|
|
6798
|
+
* 取り除くと、フォーム内の式とフラグメントの継承は祖先の値を見るようになります。
|
|
6799
|
+
* 入力欄へは触りません(`data-each` の行は解除後の再評価で描き直され、行単位の
|
|
6800
|
+
* 反映が値を入れます)。
|
|
6801
|
+
*
|
|
6802
|
+
* @param form フォームのElementFragment
|
|
6803
|
+
* @param keys 取り除くキー名の一覧
|
|
6804
|
+
* @param origin 値の由来(通番と種別)。祖先の更新を起こした操作のものを引き継ぐ
|
|
6805
|
+
* @returns 反映完了の Promise
|
|
6806
|
+
*/
|
|
6807
|
+
static releaseOwnCopy(e, t, r = null) {
|
|
6808
|
+
const i = e.getRawBindingData();
|
|
6809
|
+
if (i === null)
|
|
6810
|
+
return Promise.resolve();
|
|
6811
|
+
const n = { ...i };
|
|
6812
|
+
for (const s of t)
|
|
6813
|
+
delete n[s];
|
|
6814
|
+
return k.setBindingData(e.getTarget(), n, {
|
|
6815
|
+
kind: r?.kind ?? "supply",
|
|
6816
|
+
sequence: r?.sequence ?? T.nextSequence()
|
|
6641
6817
|
});
|
|
6642
6818
|
}
|
|
6643
6819
|
/**
|
|
@@ -6650,7 +6826,7 @@ const h = class h {
|
|
|
6650
6826
|
const t = `${l.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
6651
6827
|
return r.forEach((n) => {
|
|
6652
6828
|
const s = M.get(n);
|
|
6653
|
-
if (!(s instanceof
|
|
6829
|
+
if (!(s instanceof T))
|
|
6654
6830
|
return;
|
|
6655
6831
|
const a = s.getAttribute(t);
|
|
6656
6832
|
a && i.push({ form: s, key: String(a) });
|
|
@@ -6673,22 +6849,15 @@ const h = class h {
|
|
|
6673
6849
|
* @returns 反映完了の Promise
|
|
6674
6850
|
*/
|
|
6675
6851
|
static pushAncestorArgValue(e, t, r, i = null) {
|
|
6676
|
-
const n = e.getTarget(), s =
|
|
6852
|
+
const n = e.getTarget(), s = f.createArgValueSignature(r);
|
|
6677
6853
|
if (s !== null) {
|
|
6678
|
-
if (
|
|
6854
|
+
if (f.LAST_ANCESTOR_ARG_VALUES.get(n) === s)
|
|
6679
6855
|
return Promise.resolve();
|
|
6680
|
-
|
|
6856
|
+
f.LAST_ANCESTOR_ARG_VALUES.set(n, s);
|
|
6681
6857
|
} else
|
|
6682
|
-
|
|
6858
|
+
f.LAST_ANCESTOR_ARG_VALUES.delete(n);
|
|
6683
6859
|
const a = e.getRawBindingData();
|
|
6684
|
-
|
|
6685
|
-
const o = { ...a };
|
|
6686
|
-
return delete o[t], L.setBindingData(n, o, {
|
|
6687
|
-
kind: i?.kind ?? "supply",
|
|
6688
|
-
sequence: i?.sequence ?? D.nextSequence()
|
|
6689
|
-
});
|
|
6690
|
-
}
|
|
6691
|
-
return h.syncValues(e, r, !1, i);
|
|
6860
|
+
return a && Object.prototype.hasOwnProperty.call(a, t) ? f.releaseOwnCopy(e, [t], i) : f.syncValues(e, r, !1, i);
|
|
6692
6861
|
}
|
|
6693
6862
|
/**
|
|
6694
6863
|
* 流し込み済み判定に使う値の署名を作ります。
|
|
@@ -6727,23 +6896,23 @@ const h = class h {
|
|
|
6727
6896
|
});
|
|
6728
6897
|
const r = [];
|
|
6729
6898
|
for (const i of t) {
|
|
6730
|
-
if (
|
|
6899
|
+
if (f.INITIAL_RESTORED_FORMS.has(i))
|
|
6731
6900
|
continue;
|
|
6732
6901
|
const n = M.get(i);
|
|
6733
|
-
if (!(n instanceof
|
|
6902
|
+
if (!(n instanceof T))
|
|
6734
6903
|
continue;
|
|
6735
|
-
const s = n.getRawBindingData(), a = n.getAttribute(`${l.prefix}form-arg`), o = a ? String(a) : null, c = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ?
|
|
6904
|
+
const s = n.getRawBindingData(), a = n.getAttribute(`${l.prefix}form-arg`), o = a ? String(a) : null, c = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ? f.resolveAncestorArgOwner(n, o) : null;
|
|
6736
6905
|
if (!(!s && !c)) {
|
|
6737
|
-
if (
|
|
6906
|
+
if (f.INITIAL_RESTORED_FORMS.add(i), c) {
|
|
6738
6907
|
r.push(
|
|
6739
|
-
|
|
6908
|
+
f.pushAncestorArgValue(n, o, c.value)
|
|
6740
6909
|
);
|
|
6741
6910
|
continue;
|
|
6742
6911
|
}
|
|
6743
6912
|
r.push(
|
|
6744
|
-
|
|
6913
|
+
f.syncValues(
|
|
6745
6914
|
n,
|
|
6746
|
-
|
|
6915
|
+
f.resolveSyncValues(n, s)
|
|
6747
6916
|
)
|
|
6748
6917
|
);
|
|
6749
6918
|
}
|
|
@@ -6778,9 +6947,9 @@ const h = class h {
|
|
|
6778
6947
|
*/
|
|
6779
6948
|
static collectGroupSelection(e, t, r) {
|
|
6780
6949
|
const i = [];
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
String(
|
|
6950
|
+
f.collectGroupMembers(
|
|
6951
|
+
f.resolveCollectionScope(e),
|
|
6952
|
+
String(f.resolveFieldName(e)),
|
|
6784
6953
|
i
|
|
6785
6954
|
);
|
|
6786
6955
|
let n = !1;
|
|
@@ -6790,9 +6959,9 @@ const h = class h {
|
|
|
6790
6959
|
const o = a.getTarget();
|
|
6791
6960
|
o instanceof HTMLInputElement && o.checked && s.push(o.value);
|
|
6792
6961
|
}
|
|
6793
|
-
return t ? { edited: n, value:
|
|
6962
|
+
return t ? { edited: n, value: f.markCompleteSet(s) } : s.length === 0 ? { edited: n, value: null } : {
|
|
6794
6963
|
edited: n,
|
|
6795
|
-
value: s.length === 1 ? s[0] :
|
|
6964
|
+
value: s.length === 1 ? s[0] : f.markCompleteSet(s)
|
|
6796
6965
|
};
|
|
6797
6966
|
}
|
|
6798
6967
|
/**
|
|
@@ -6807,7 +6976,7 @@ const h = class h {
|
|
|
6807
6976
|
* @returns 新しい階層を始める場合は true
|
|
6808
6977
|
*/
|
|
6809
6978
|
static startsCollectionLevel(e) {
|
|
6810
|
-
return
|
|
6979
|
+
return f.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${l.prefix}form-object`) || e.getAttribute(`${l.prefix}form-list`));
|
|
6811
6980
|
}
|
|
6812
6981
|
/**
|
|
6813
6982
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -6828,9 +6997,9 @@ const h = class h {
|
|
|
6828
6997
|
static resolveCollectionScope(e) {
|
|
6829
6998
|
let t = e, r = t.getParent();
|
|
6830
6999
|
for (; r !== null; ) {
|
|
6831
|
-
if (
|
|
7000
|
+
if (f.startsCollectionLevel(r))
|
|
6832
7001
|
return r.getAttribute(`${l.prefix}form-object`) ? r : t;
|
|
6833
|
-
if (
|
|
7002
|
+
if (f.isFormScopeRoot(r))
|
|
6834
7003
|
return r;
|
|
6835
7004
|
t = r, r = r.getParent();
|
|
6836
7005
|
}
|
|
@@ -6863,11 +7032,11 @@ const h = class h {
|
|
|
6863
7032
|
* @param members 集める先
|
|
6864
7033
|
*/
|
|
6865
7034
|
static collectGroupMembers(e, t, r) {
|
|
6866
|
-
|
|
7035
|
+
f.isGroupedCheckable(e) && String(f.resolveFieldName(e)) === t && r.push(e);
|
|
6867
7036
|
for (const i of e.getChildElementFragments())
|
|
6868
|
-
|
|
7037
|
+
f.startsCollectionLevel(i) || i.hasAttribute(`${l.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
6869
7038
|
// (`getPartValues()` と同じ理由)。
|
|
6870
|
-
i.getTarget().hasAttribute(`${l.prefix}if-false`) ||
|
|
7039
|
+
i.getTarget().hasAttribute(`${l.prefix}if-false`) || f.collectGroupMembers(i, t, r);
|
|
6871
7040
|
}
|
|
6872
7041
|
/**
|
|
6873
7042
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -6881,7 +7050,7 @@ const h = class h {
|
|
|
6881
7050
|
* @returns 同じ配列
|
|
6882
7051
|
*/
|
|
6883
7052
|
static markCompleteSet(e) {
|
|
6884
|
-
return
|
|
7053
|
+
return f.COMPLETE_SET_VALUES.add(e), e;
|
|
6885
7054
|
}
|
|
6886
7055
|
/**
|
|
6887
7056
|
* 「集合として完結した値」の印が付いているかを返します。
|
|
@@ -6894,7 +7063,7 @@ const h = class h {
|
|
|
6894
7063
|
* @returns 印が付いていれば true
|
|
6895
7064
|
*/
|
|
6896
7065
|
static isCompleteSetValue(e) {
|
|
6897
|
-
return e !== null && typeof e == "object" &&
|
|
7066
|
+
return e !== null && typeof e == "object" && f.COMPLETE_SET_VALUES.has(e);
|
|
6898
7067
|
}
|
|
6899
7068
|
/**
|
|
6900
7069
|
* 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
|
|
@@ -6946,37 +7115,37 @@ const h = class h {
|
|
|
6946
7115
|
const o = [];
|
|
6947
7116
|
if (e.hasAttribute(`${l.prefix}form-detach`) && !r)
|
|
6948
7117
|
return Promise.resolve();
|
|
6949
|
-
const c =
|
|
7118
|
+
const c = f.resolveFieldName(e), u = e.getAttribute(`${l.prefix}form-object`), d = e.getAttribute(`${l.prefix}form-list`), p = e.hasAttribute(`${l.prefix}form-list`);
|
|
6950
7119
|
if (c) {
|
|
6951
|
-
const g = t[String(c)], E = n &&
|
|
7120
|
+
const g = t[String(c)], E = n && f.hasResolvedDeclarativeState(e), A = n && typeof g > "u" && !f.isDeclarativeStateBound(e);
|
|
6952
7121
|
let I = g;
|
|
6953
|
-
if (E ? I = void 0 : A && (I = null),
|
|
7122
|
+
if (E ? I = void 0 : A && (I = null), f.isFileInput(e))
|
|
6954
7123
|
return (I === null || I === "") && o.push(
|
|
6955
|
-
|
|
7124
|
+
f.applyFragmentValue(e, null, i, a)
|
|
6956
7125
|
), Promise.all(o).then(() => {
|
|
6957
7126
|
});
|
|
6958
7127
|
if (p && Array.isArray(I) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
6959
7128
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
6960
7129
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
6961
|
-
!
|
|
6962
|
-
const
|
|
6963
|
-
s.set(
|
|
6964
|
-
|
|
7130
|
+
!f.isGroupedCheckable(e) && !f.isMultipleSelect(e)) {
|
|
7131
|
+
const $ = String(c), W = s.get($) ?? 0;
|
|
7132
|
+
s.set($, W + 1), o.push(
|
|
7133
|
+
f.applyFragmentValue(
|
|
6965
7134
|
e,
|
|
6966
7135
|
I[W] ?? null,
|
|
6967
7136
|
i,
|
|
6968
7137
|
a
|
|
6969
7138
|
)
|
|
6970
7139
|
);
|
|
6971
|
-
} else typeof I > "u" || (Array.isArray(I) &&
|
|
6972
|
-
|
|
7140
|
+
} else typeof I > "u" || (Array.isArray(I) && f.isGroupedCheckable(e) || Array.isArray(I) && f.isMultipleSelect(e) || typeof I == "string" || typeof I == "number" || typeof I == "boolean" || I === null ? o.push(
|
|
7141
|
+
f.applyFragmentValue(
|
|
6973
7142
|
e,
|
|
6974
7143
|
I,
|
|
6975
7144
|
i,
|
|
6976
7145
|
a
|
|
6977
7146
|
)
|
|
6978
7147
|
) : o.push(
|
|
6979
|
-
|
|
7148
|
+
f.applyFragmentValue(e, String(I), i, a)
|
|
6980
7149
|
));
|
|
6981
7150
|
} else if (u) {
|
|
6982
7151
|
const g = t[String(u)];
|
|
@@ -6984,7 +7153,7 @@ const h = class h {
|
|
|
6984
7153
|
const E = /* @__PURE__ */ new Map();
|
|
6985
7154
|
for (const A of e.getChildElementFragments())
|
|
6986
7155
|
o.push(
|
|
6987
|
-
|
|
7156
|
+
f.setPartValues(
|
|
6988
7157
|
A,
|
|
6989
7158
|
g,
|
|
6990
7159
|
r,
|
|
@@ -6998,18 +7167,18 @@ const h = class h {
|
|
|
6998
7167
|
} else if (d) {
|
|
6999
7168
|
const g = t[String(d)];
|
|
7000
7169
|
if (Array.isArray(g)) {
|
|
7001
|
-
const E = e.getChildElementFragments(), A = e.getAttribute(`${l.prefix}each-key`), I =
|
|
7170
|
+
const E = e.getChildElementFragments(), A = e.getAttribute(`${l.prefix}each-key`), I = f.isCollectedListFromEachSource(e) ? f.pairRowsWithItems(
|
|
7002
7171
|
E,
|
|
7003
7172
|
g,
|
|
7004
7173
|
A == null ? null : String(A)
|
|
7005
7174
|
) : null;
|
|
7006
|
-
for (let
|
|
7007
|
-
const W = E[
|
|
7175
|
+
for (let $ = 0; $ < E.length; $++) {
|
|
7176
|
+
const W = E[$], x = I ? I[$] : g.length > $ ? g[$] : null;
|
|
7008
7177
|
o.push(
|
|
7009
7178
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
7010
|
-
|
|
7179
|
+
f.setPartValues(
|
|
7011
7180
|
W,
|
|
7012
|
-
|
|
7181
|
+
f.asPlainRecord(x) ?? {},
|
|
7013
7182
|
r,
|
|
7014
7183
|
i,
|
|
7015
7184
|
n,
|
|
@@ -7022,7 +7191,7 @@ const h = class h {
|
|
|
7022
7191
|
} else
|
|
7023
7192
|
for (const g of e.getChildElementFragments())
|
|
7024
7193
|
o.push(
|
|
7025
|
-
|
|
7194
|
+
f.setPartValues(
|
|
7026
7195
|
g,
|
|
7027
7196
|
t,
|
|
7028
7197
|
r,
|
|
@@ -7050,52 +7219,66 @@ const h = class h {
|
|
|
7050
7219
|
* 番号を持つことになり、後勝ちが逆転する
|
|
7051
7220
|
* @returns すべての初期化処理が完了するPromise
|
|
7052
7221
|
*/
|
|
7053
|
-
static async reset(e, t =
|
|
7054
|
-
const r =
|
|
7222
|
+
static async reset(e, t = T.nextSequence()) {
|
|
7223
|
+
const r = f.collectBindingTargetForms(e);
|
|
7055
7224
|
if (r.length > 0 && r.every((n) => n.isSupplyStale(t)))
|
|
7056
7225
|
return;
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7226
|
+
f.markResetSubtree(e, t), k.clearUserEditMarks(e, t), f.clearValues(e), await Promise.all([
|
|
7227
|
+
f.clearMessages(e),
|
|
7228
|
+
f.clearEachClones(e)
|
|
7060
7229
|
]), await G.enqueue(() => {
|
|
7061
|
-
const n =
|
|
7230
|
+
const n = f.collectEditsAfter(
|
|
7062
7231
|
e,
|
|
7063
7232
|
t
|
|
7064
7233
|
), s = e.getTarget();
|
|
7065
|
-
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()),
|
|
7234
|
+
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()), f.restoreDefaultValues(s)), f.clearDeclarativeStateFromDom(e), f.restoreEdits(n);
|
|
7066
7235
|
});
|
|
7067
7236
|
const i = r;
|
|
7068
7237
|
for (const n of i) {
|
|
7069
|
-
const s =
|
|
7070
|
-
s === null && n.getRawBindingData() === null || await
|
|
7238
|
+
const s = f.getInitialBindingData(n);
|
|
7239
|
+
s === null && n.getRawBindingData() === null || await k.setBindingData(n.getTarget(), s ?? {}, {
|
|
7071
7240
|
sequence: t
|
|
7072
7241
|
});
|
|
7073
7242
|
}
|
|
7074
|
-
|
|
7243
|
+
f.syncValuesFromDom(e), await k.evaluateAll(e);
|
|
7075
7244
|
for (const n of i)
|
|
7076
|
-
|
|
7245
|
+
f.getInitialBindingData(n) !== null || n.getRawBindingData() !== null || await f.restoreAncestorArgValues(n, {
|
|
7077
7246
|
sequence: t,
|
|
7078
7247
|
kind: "supply"
|
|
7079
7248
|
});
|
|
7080
7249
|
for (const n of i) {
|
|
7081
|
-
const s =
|
|
7250
|
+
const s = f.getInitialBindingData(n);
|
|
7082
7251
|
if (n.getRawBindingData() === null && s === null)
|
|
7083
7252
|
continue;
|
|
7084
|
-
const a =
|
|
7253
|
+
const a = f.getValues(n), o = n.getAttribute(`${l.prefix}form-arg`);
|
|
7085
7254
|
let c = { ...s || {} };
|
|
7086
7255
|
if (o) {
|
|
7087
7256
|
const u = String(o);
|
|
7088
|
-
!Object.prototype.hasOwnProperty.call(s ?? {}, u) &&
|
|
7257
|
+
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && f.resolveAncestorArgOwner(n, u) !== null || (c[u] = f.mergeCollectedValues(
|
|
7089
7258
|
c[u] ?? null,
|
|
7090
7259
|
a
|
|
7091
7260
|
));
|
|
7092
7261
|
} else
|
|
7093
|
-
c =
|
|
7094
|
-
await
|
|
7262
|
+
c = f.mergeCollectedValues(c, a), f.deleteAncestorOwnedKeys(n, s, c);
|
|
7263
|
+
await k.setBindingData(n.getTarget(), c, {
|
|
7095
7264
|
sequence: t
|
|
7096
7265
|
});
|
|
7097
7266
|
}
|
|
7098
7267
|
}
|
|
7268
|
+
/**
|
|
7269
|
+
* 祖先が所有するキーを、リセットの書き込み対象から落とします。
|
|
7270
|
+
*
|
|
7271
|
+
* 落とすのは初期 `data-bind` 宣言に無いキーだけです。宣言のあるキーはフォーム
|
|
7272
|
+
* 自身が持つべき値で、祖先が同名のキーを持っていてもフォームの宣言が権威です。
|
|
7273
|
+
*
|
|
7274
|
+
* @param form フォームのElementFragment
|
|
7275
|
+
* @param initial 初期 `data-bind` 宣言(無い場合は null)
|
|
7276
|
+
* @param target リセットで書き込むバインドデータ(この場で書き換えます)
|
|
7277
|
+
*/
|
|
7278
|
+
static deleteAncestorOwnedKeys(e, t, r) {
|
|
7279
|
+
for (const i of Object.keys(r))
|
|
7280
|
+
Object.prototype.hasOwnProperty.call(t ?? {}, i) || f.resolveAncestorKeyOwner(e, i) !== null && delete r[i];
|
|
7281
|
+
}
|
|
7099
7282
|
/**
|
|
7100
7283
|
* data-bind 属性で宣言された初期バインドデータを取得します。
|
|
7101
7284
|
*
|
|
@@ -7104,7 +7287,7 @@ const h = class h {
|
|
|
7104
7287
|
*/
|
|
7105
7288
|
static getInitialBindingData(e) {
|
|
7106
7289
|
const t = e.getInitialBindAttribute();
|
|
7107
|
-
return t === null ? null :
|
|
7290
|
+
return t === null ? null : k.parseDataBind(t);
|
|
7108
7291
|
}
|
|
7109
7292
|
/**
|
|
7110
7293
|
* フラグメント配下の入力要素について、内部値を現在の DOM 値と再同期します。
|
|
@@ -7115,7 +7298,7 @@ const h = class h {
|
|
|
7115
7298
|
const t = e.getTarget();
|
|
7116
7299
|
(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && e.syncValue();
|
|
7117
7300
|
for (const r of e.getChildElementFragments())
|
|
7118
|
-
|
|
7301
|
+
f.syncValuesFromDom(r);
|
|
7119
7302
|
}
|
|
7120
7303
|
/**
|
|
7121
7304
|
* リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
|
|
@@ -7132,7 +7315,7 @@ const h = class h {
|
|
|
7132
7315
|
const i = [];
|
|
7133
7316
|
for (const n of r) {
|
|
7134
7317
|
const s = M.get(n);
|
|
7135
|
-
s instanceof
|
|
7318
|
+
s instanceof T && i.push(s);
|
|
7136
7319
|
}
|
|
7137
7320
|
return i;
|
|
7138
7321
|
}
|
|
@@ -7170,7 +7353,7 @@ const h = class h {
|
|
|
7170
7353
|
static clearValues(e) {
|
|
7171
7354
|
e.clearValue();
|
|
7172
7355
|
for (const t of e.getChildElementFragments())
|
|
7173
|
-
|
|
7356
|
+
f.clearValues(t);
|
|
7174
7357
|
}
|
|
7175
7358
|
/**
|
|
7176
7359
|
* 指定した通番より後に編集された入力欄の DOM の状態を控えます。
|
|
@@ -7194,7 +7377,7 @@ const h = class h {
|
|
|
7194
7377
|
)
|
|
7195
7378
|
}) : r.push({ element: i, value: i.value }));
|
|
7196
7379
|
for (const n of e.getChildElementFragments())
|
|
7197
|
-
|
|
7380
|
+
f.collectEditsAfter(n, t, r);
|
|
7198
7381
|
return r;
|
|
7199
7382
|
}
|
|
7200
7383
|
/**
|
|
@@ -7236,8 +7419,8 @@ const h = class h {
|
|
|
7236
7419
|
const r = e.getAttribute(`${l.prefix}form-arg`);
|
|
7237
7420
|
if (!r)
|
|
7238
7421
|
return;
|
|
7239
|
-
const i = String(r), n =
|
|
7240
|
-
n && (
|
|
7422
|
+
const i = String(r), n = f.resolveAncestorArgOwner(e, i);
|
|
7423
|
+
n && (f.LAST_ANCESTOR_ARG_VALUES.delete(e.getTarget()), await f.pushAncestorArgValue(e, i, n.value, t));
|
|
7241
7424
|
}
|
|
7242
7425
|
/**
|
|
7243
7426
|
* 初期化の通番を部分木のすべてのフラグメントへ記録します。
|
|
@@ -7253,7 +7436,7 @@ const h = class h {
|
|
|
7253
7436
|
static markResetSubtree(e, t) {
|
|
7254
7437
|
e.markResetAt(t), e.markSupplyApplied(t);
|
|
7255
7438
|
for (const r of e.getChildElementFragments())
|
|
7256
|
-
|
|
7439
|
+
f.markResetSubtree(r, t);
|
|
7257
7440
|
}
|
|
7258
7441
|
/**
|
|
7259
7442
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -7276,7 +7459,7 @@ const h = class h {
|
|
|
7276
7459
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7277
7460
|
*/
|
|
7278
7461
|
static addErrorMessage(e, t, r) {
|
|
7279
|
-
return
|
|
7462
|
+
return f.addMessage(e, t, r, "error");
|
|
7280
7463
|
}
|
|
7281
7464
|
/**
|
|
7282
7465
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -7289,7 +7472,7 @@ const h = class h {
|
|
|
7289
7472
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7290
7473
|
*/
|
|
7291
7474
|
static addMessage(e, t, r, i) {
|
|
7292
|
-
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), c =
|
|
7475
|
+
const n = [], s = Ye(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), c = f.findFragmentsByKey(e, t);
|
|
7293
7476
|
return c.forEach((u) => {
|
|
7294
7477
|
n.push(o(u.getTarget()));
|
|
7295
7478
|
}), c.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
@@ -7303,7 +7486,7 @@ const h = class h {
|
|
|
7303
7486
|
* @returns 一致するフラグメントの配列
|
|
7304
7487
|
*/
|
|
7305
7488
|
static findFragmentsByKey(e, t) {
|
|
7306
|
-
return
|
|
7489
|
+
return f.findFragmentByKeyParts(e, t.split("."));
|
|
7307
7490
|
}
|
|
7308
7491
|
/**
|
|
7309
7492
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -7315,9 +7498,9 @@ const h = class h {
|
|
|
7315
7498
|
*/
|
|
7316
7499
|
static findFragmentByKeyParts(e, t) {
|
|
7317
7500
|
const r = [], i = t[0];
|
|
7318
|
-
if (t.length == 1 &&
|
|
7501
|
+
if (t.length == 1 && f.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${l.prefix}form-object`))
|
|
7319
7502
|
t.length > 1 && e.getAttribute(`${l.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
7320
|
-
r.push(...
|
|
7503
|
+
r.push(...f.findFragmentByKeyParts(s, t.slice(1)));
|
|
7321
7504
|
});
|
|
7322
7505
|
else if (e.hasAttribute(`${l.prefix}form-list`)) {
|
|
7323
7506
|
if (t.length > 1) {
|
|
@@ -7331,7 +7514,7 @@ const h = class h {
|
|
|
7331
7514
|
else {
|
|
7332
7515
|
const d = e.getChildElementFragments().filter((p) => p.hasAttribute(`${l.prefix}row`));
|
|
7333
7516
|
u < d.length && r.push(
|
|
7334
|
-
...
|
|
7517
|
+
...f.findFragmentByKeyParts(d[u], t.slice(1))
|
|
7335
7518
|
);
|
|
7336
7519
|
}
|
|
7337
7520
|
}
|
|
@@ -7339,7 +7522,7 @@ const h = class h {
|
|
|
7339
7522
|
}
|
|
7340
7523
|
} else
|
|
7341
7524
|
e.getChildElementFragments().forEach((n) => {
|
|
7342
|
-
r.push(...
|
|
7525
|
+
r.push(...f.findFragmentByKeyParts(n, t));
|
|
7343
7526
|
});
|
|
7344
7527
|
return r;
|
|
7345
7528
|
}
|
|
@@ -7362,12 +7545,12 @@ const h = class h {
|
|
|
7362
7545
|
return r ? this.getFormFragment(r) : null;
|
|
7363
7546
|
}
|
|
7364
7547
|
};
|
|
7365
|
-
|
|
7548
|
+
f.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), f.LAST_ANCESTOR_ARG_VALUES = /* @__PURE__ */ new WeakMap(), f.GROUP_SCOPE_IDS = /* @__PURE__ */ new WeakMap(), f.groupScopeSequence = 0, f.warnedArgOwnerNotRecord = /* @__PURE__ */ new WeakMap(), f.UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set([
|
|
7366
7549
|
"__proto__",
|
|
7367
7550
|
"constructor",
|
|
7368
7551
|
"prototype"
|
|
7369
|
-
]),
|
|
7370
|
-
let
|
|
7552
|
+
]), f.COLLECTED_ROW_IDENTITY = /* @__PURE__ */ new WeakMap(), f.COMPLETE_SET_VALUES = /* @__PURE__ */ new WeakSet(), f.COLLECTED_EXCLUDED_KEYS = /* @__PURE__ */ new WeakMap(), f.warnedPositionalRowFallbacks = /* @__PURE__ */ new Set(), f.warnedDerivedRowsWithoutKey = /* @__PURE__ */ new Set(), f.LEADING_PATH_PATTERN = /^\s*([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*([\s\S]*)$/;
|
|
7553
|
+
let F = f;
|
|
7371
7554
|
class O {
|
|
7372
7555
|
/**
|
|
7373
7556
|
* カスタムイベントを発火します。
|
|
@@ -7627,10 +7810,10 @@ function xt(y, e) {
|
|
|
7627
7810
|
return null;
|
|
7628
7811
|
if (!t.includes("{{"))
|
|
7629
7812
|
return t;
|
|
7630
|
-
const r = M.get(y), i = r instanceof
|
|
7813
|
+
const r = M.get(y), i = r instanceof T ? r.getBindingData() : {}, n = It(t, i);
|
|
7631
7814
|
return n === "" ? null : n;
|
|
7632
7815
|
}
|
|
7633
|
-
function
|
|
7816
|
+
function Nt(y, e, t) {
|
|
7634
7817
|
const r = y.getAttribute(`${e}-return-param`);
|
|
7635
7818
|
if (r === null || r === "")
|
|
7636
7819
|
return t;
|
|
@@ -7653,7 +7836,7 @@ function ft(y) {
|
|
|
7653
7836
|
const n = xt(i, t);
|
|
7654
7837
|
if (n === null)
|
|
7655
7838
|
continue;
|
|
7656
|
-
const s =
|
|
7839
|
+
const s = Nt(i, t, n);
|
|
7657
7840
|
try {
|
|
7658
7841
|
if (new URL(s, window.location.href).href === window.location.href)
|
|
7659
7842
|
return !1;
|
|
@@ -7720,7 +7903,7 @@ class X {
|
|
|
7720
7903
|
}
|
|
7721
7904
|
}
|
|
7722
7905
|
}
|
|
7723
|
-
const
|
|
7906
|
+
const N = class N {
|
|
7724
7907
|
/**
|
|
7725
7908
|
* ストレージ種別に対応する `Storage` を解決します。
|
|
7726
7909
|
*
|
|
@@ -7738,7 +7921,7 @@ const F = class F {
|
|
|
7738
7921
|
throw new Error("storage is not available");
|
|
7739
7922
|
return t;
|
|
7740
7923
|
} catch (t) {
|
|
7741
|
-
return
|
|
7924
|
+
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), m.warn(
|
|
7742
7925
|
"Haori",
|
|
7743
7926
|
`${e}Storage が利用できないため ${l.prefix}store を無効にします:`,
|
|
7744
7927
|
t
|
|
@@ -7748,13 +7931,15 @@ const F = class F {
|
|
|
7748
7931
|
/**
|
|
7749
7932
|
* 予約キー(エンジン管理変数)かどうかを判定します。
|
|
7750
7933
|
*
|
|
7751
|
-
* `_fetch` / `_poll`
|
|
7934
|
+
* `_fetch` / `_poll` などのエンジン管理変数を保存対象から常に除外します。判定の
|
|
7935
|
+
* 規則は `ElementFragment` に集約しています(属性ミラーや `data-{event}-copy` の
|
|
7936
|
+
* 除外と同じ規則です)。
|
|
7752
7937
|
*
|
|
7753
7938
|
* @param key 判定対象のキー
|
|
7754
7939
|
* @returns 予約キーなら true
|
|
7755
7940
|
*/
|
|
7756
7941
|
static isReservedKey(e) {
|
|
7757
|
-
return
|
|
7942
|
+
return T.isReservedBindingKey(e);
|
|
7758
7943
|
}
|
|
7759
7944
|
/**
|
|
7760
7945
|
* 素の JSON オブジェクト(配列でないオブジェクト)かどうかを判定します。
|
|
@@ -7773,8 +7958,8 @@ const F = class F {
|
|
|
7773
7958
|
* @param message 警告メッセージ
|
|
7774
7959
|
*/
|
|
7775
7960
|
static warnOnce(e, t, r) {
|
|
7776
|
-
let i =
|
|
7777
|
-
i || (i = /* @__PURE__ */ new Set(),
|
|
7961
|
+
let i = N.WARNED_ELEMENTS.get(e);
|
|
7962
|
+
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t), m.warn("Haori", r));
|
|
7778
7963
|
}
|
|
7779
7964
|
/**
|
|
7780
7965
|
* `data-each` の行の内側かどうかを判定します。
|
|
@@ -7811,13 +7996,13 @@ const F = class F {
|
|
|
7811
7996
|
return null;
|
|
7812
7997
|
const i = r.trim();
|
|
7813
7998
|
if (i === "")
|
|
7814
|
-
return
|
|
7999
|
+
return N.warnOnce(
|
|
7815
8000
|
t,
|
|
7816
8001
|
"key",
|
|
7817
8002
|
`${l.prefix}store にストレージキーが指定されていません。`
|
|
7818
8003
|
), null;
|
|
7819
8004
|
if (i.includes("{{"))
|
|
7820
|
-
return
|
|
8005
|
+
return N.warnOnce(
|
|
7821
8006
|
t,
|
|
7822
8007
|
"expression",
|
|
7823
8008
|
`${l.prefix}store に式は使用できません(静的な文字列を指定してください): ${i}`
|
|
@@ -7826,7 +8011,7 @@ const F = class F {
|
|
|
7826
8011
|
let s = "session";
|
|
7827
8012
|
if (n !== null) {
|
|
7828
8013
|
const d = n.trim();
|
|
7829
|
-
d === "local" || d === "session" ? s = d :
|
|
8014
|
+
d === "local" || d === "session" ? s = d : N.warnOnce(
|
|
7830
8015
|
t,
|
|
7831
8016
|
"type",
|
|
7832
8017
|
`${l.prefix}store-type は session または local を指定してください(session として扱います): ${d}`
|
|
@@ -7835,14 +8020,14 @@ const F = class F {
|
|
|
7835
8020
|
const a = e.getRawAttribute(`${l.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), c = e.getRawAttribute(`${l.prefix}store-params`);
|
|
7836
8021
|
let u = null;
|
|
7837
8022
|
if (c !== null) {
|
|
7838
|
-
const d = c.split("&").map((g) => g.trim()).filter((g) => g !== ""), p = d.filter((g) => !
|
|
7839
|
-
p.length !== d.length &&
|
|
8023
|
+
const d = c.split("&").map((g) => g.trim()).filter((g) => g !== ""), p = d.filter((g) => !N.isReservedKey(g));
|
|
8024
|
+
p.length !== d.length && N.warnOnce(
|
|
7840
8025
|
t,
|
|
7841
8026
|
"reserved",
|
|
7842
8027
|
`${l.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
7843
8028
|
), u = p.length > 0 ? p : null;
|
|
7844
8029
|
}
|
|
7845
|
-
return u === null && o === null ? (
|
|
8030
|
+
return u === null && o === null ? (N.warnOnce(
|
|
7846
8031
|
t,
|
|
7847
8032
|
"target",
|
|
7848
8033
|
`${l.prefix}store には ${l.prefix}store-params または ${l.prefix}store-arg のいずれかが必要です。`
|
|
@@ -7859,7 +8044,7 @@ const F = class F {
|
|
|
7859
8044
|
* @returns レコード。読み取れない場合は null
|
|
7860
8045
|
*/
|
|
7861
8046
|
static readRecord(e) {
|
|
7862
|
-
const t =
|
|
8047
|
+
const t = N.resolveStorage(e.kind);
|
|
7863
8048
|
if (!t)
|
|
7864
8049
|
return null;
|
|
7865
8050
|
let r;
|
|
@@ -7884,7 +8069,7 @@ const F = class F {
|
|
|
7884
8069
|
n
|
|
7885
8070
|
), null;
|
|
7886
8071
|
}
|
|
7887
|
-
return
|
|
8072
|
+
return N.isPlainRecord(i) ? i : (m.warn(
|
|
7888
8073
|
"Haori",
|
|
7889
8074
|
`保存済みデータがオブジェクトではありません: ${e.key}`
|
|
7890
8075
|
), null);
|
|
@@ -7902,7 +8087,7 @@ const F = class F {
|
|
|
7902
8087
|
const s = t[e.arg];
|
|
7903
8088
|
if (s === void 0)
|
|
7904
8089
|
return {};
|
|
7905
|
-
if (!
|
|
8090
|
+
if (!N.isPlainRecord(s))
|
|
7906
8091
|
return m.warn(
|
|
7907
8092
|
"Haori",
|
|
7908
8093
|
`保存済みデータの ${e.arg} がオブジェクトではありません: ` + e.key
|
|
@@ -7911,7 +8096,7 @@ const F = class F {
|
|
|
7911
8096
|
}
|
|
7912
8097
|
const i = e.params ?? Object.keys(r), n = {};
|
|
7913
8098
|
for (const s of i)
|
|
7914
|
-
|
|
8099
|
+
N.isReservedKey(s) || Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
7915
8100
|
return n;
|
|
7916
8101
|
}
|
|
7917
8102
|
/**
|
|
@@ -7928,7 +8113,7 @@ const F = class F {
|
|
|
7928
8113
|
static selectFromData(e, t) {
|
|
7929
8114
|
const r = e.params ?? Object.keys(t), i = {};
|
|
7930
8115
|
for (const n of r) {
|
|
7931
|
-
if (
|
|
8116
|
+
if (N.isReservedKey(n) || !Object.prototype.hasOwnProperty.call(t, n))
|
|
7932
8117
|
continue;
|
|
7933
8118
|
const s = t[n];
|
|
7934
8119
|
s !== void 0 && (i[n] = s);
|
|
@@ -7987,12 +8172,12 @@ const F = class F {
|
|
|
7987
8172
|
* @param selected 基準にする選択内容
|
|
7988
8173
|
*/
|
|
7989
8174
|
static seedSignature(e, t) {
|
|
7990
|
-
const r =
|
|
8175
|
+
const r = N.stringify(t);
|
|
7991
8176
|
if (r === null) {
|
|
7992
|
-
|
|
8177
|
+
N.SIGNATURES.delete(e);
|
|
7993
8178
|
return;
|
|
7994
8179
|
}
|
|
7995
|
-
|
|
8180
|
+
N.SIGNATURES.set(e, { json: r, refs: N.createRefs(t) });
|
|
7996
8181
|
}
|
|
7997
8182
|
/**
|
|
7998
8183
|
* レコードへ選択内容を書き込みます。
|
|
@@ -8006,12 +8191,12 @@ const F = class F {
|
|
|
8006
8191
|
* @returns 書き込めたら true
|
|
8007
8192
|
*/
|
|
8008
8193
|
static writeRecord(e, t) {
|
|
8009
|
-
const r =
|
|
8194
|
+
const r = N.resolveStorage(e.kind);
|
|
8010
8195
|
if (!r)
|
|
8011
8196
|
return !1;
|
|
8012
|
-
const i =
|
|
8197
|
+
const i = N.readRecord(e) ?? {};
|
|
8013
8198
|
if (e.arg !== null) {
|
|
8014
|
-
const n = i[e.arg], s =
|
|
8199
|
+
const n = i[e.arg], s = N.isPlainRecord(n) ? { ...n } : {};
|
|
8015
8200
|
i[e.arg] = { ...s, ...t };
|
|
8016
8201
|
} else
|
|
8017
8202
|
Object.assign(i, t);
|
|
@@ -8036,22 +8221,22 @@ const F = class F {
|
|
|
8036
8221
|
* @returns 復元完了の Promise
|
|
8037
8222
|
*/
|
|
8038
8223
|
static restore(e) {
|
|
8039
|
-
const t =
|
|
8224
|
+
const t = N.readDeclaration(e);
|
|
8040
8225
|
if (!t)
|
|
8041
8226
|
return Promise.resolve();
|
|
8042
8227
|
const r = e.getTarget();
|
|
8043
|
-
if (
|
|
8044
|
-
return
|
|
8228
|
+
if (N.isInsideEachRow(e))
|
|
8229
|
+
return N.warnOnce(
|
|
8045
8230
|
r,
|
|
8046
8231
|
"each-row",
|
|
8047
8232
|
`${l.prefix}each の行の内側では ${l.prefix}store を使用できません(行データは親要素側で配列キーを指定してください)。`
|
|
8048
8233
|
), Promise.resolve();
|
|
8049
|
-
|
|
8050
|
-
const i =
|
|
8051
|
-
return
|
|
8234
|
+
N.RESTORED_ELEMENTS.add(r);
|
|
8235
|
+
const i = N.readRecord(t), n = i ? N.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
8236
|
+
return N.seedSignature(r, N.selectFromData(t, s)), Object.keys(n).length === 0 ? Promise.resolve() : k.setBindingData(r, s, {
|
|
8052
8237
|
reentrant: !0,
|
|
8053
8238
|
kind: "nonSupply",
|
|
8054
|
-
sequence:
|
|
8239
|
+
sequence: T.nextSequence()
|
|
8055
8240
|
});
|
|
8056
8241
|
}
|
|
8057
8242
|
/**
|
|
@@ -8065,22 +8250,22 @@ const F = class F {
|
|
|
8065
8250
|
* @param fragment 対象フラグメント
|
|
8066
8251
|
*/
|
|
8067
8252
|
static mirror(e) {
|
|
8068
|
-
const t =
|
|
8069
|
-
if (!t ||
|
|
8253
|
+
const t = N.readDeclaration(e);
|
|
8254
|
+
if (!t || N.isInsideEachRow(e))
|
|
8070
8255
|
return;
|
|
8071
8256
|
const r = e.getTarget();
|
|
8072
|
-
if (!
|
|
8257
|
+
if (!N.RESTORED_ELEMENTS.has(r))
|
|
8073
8258
|
return;
|
|
8074
8259
|
const i = e.getRawBindingData();
|
|
8075
8260
|
if (!i)
|
|
8076
8261
|
return;
|
|
8077
|
-
const n =
|
|
8262
|
+
const n = N.selectFromData(t, i);
|
|
8078
8263
|
if (Object.keys(n).length === 0)
|
|
8079
8264
|
return;
|
|
8080
|
-
const s =
|
|
8081
|
-
if (s &&
|
|
8265
|
+
const s = N.SIGNATURES.get(r);
|
|
8266
|
+
if (s && N.hasSameRefs(s, n))
|
|
8082
8267
|
return;
|
|
8083
|
-
const a =
|
|
8268
|
+
const a = N.stringify(n);
|
|
8084
8269
|
if (a === null) {
|
|
8085
8270
|
m.warn(
|
|
8086
8271
|
"Haori",
|
|
@@ -8089,10 +8274,10 @@ const F = class F {
|
|
|
8089
8274
|
return;
|
|
8090
8275
|
}
|
|
8091
8276
|
if (s && s.json === a) {
|
|
8092
|
-
s.refs =
|
|
8277
|
+
s.refs = N.createRefs(n);
|
|
8093
8278
|
return;
|
|
8094
8279
|
}
|
|
8095
|
-
|
|
8280
|
+
N.writeRecord(t, n) && N.SIGNATURES.set(r, { json: a, refs: N.createRefs(n) });
|
|
8096
8281
|
}
|
|
8097
8282
|
/**
|
|
8098
8283
|
* レコードを破棄します。
|
|
@@ -8105,7 +8290,7 @@ const F = class F {
|
|
|
8105
8290
|
* @param kind ストレージ種別
|
|
8106
8291
|
*/
|
|
8107
8292
|
static clear(e, t) {
|
|
8108
|
-
const r =
|
|
8293
|
+
const r = N.resolveStorage(t);
|
|
8109
8294
|
if (r) {
|
|
8110
8295
|
try {
|
|
8111
8296
|
r.removeItem(e);
|
|
@@ -8113,7 +8298,7 @@ const F = class F {
|
|
|
8113
8298
|
m.warn("Haori", `ストレージの破棄に失敗しました: ${e}`, i);
|
|
8114
8299
|
return;
|
|
8115
8300
|
}
|
|
8116
|
-
|
|
8301
|
+
N.reseedDeclaringElements(e, t);
|
|
8117
8302
|
}
|
|
8118
8303
|
}
|
|
8119
8304
|
/**
|
|
@@ -8126,24 +8311,24 @@ const F = class F {
|
|
|
8126
8311
|
document.querySelectorAll(
|
|
8127
8312
|
`[${l.prefix}store]`
|
|
8128
8313
|
).forEach((i) => {
|
|
8129
|
-
if (!
|
|
8314
|
+
if (!N.RESTORED_ELEMENTS.has(i))
|
|
8130
8315
|
return;
|
|
8131
8316
|
const n = M.get(i);
|
|
8132
|
-
if (!(n instanceof
|
|
8317
|
+
if (!(n instanceof T))
|
|
8133
8318
|
return;
|
|
8134
|
-
const s =
|
|
8319
|
+
const s = N.readDeclaration(n);
|
|
8135
8320
|
if (!s || s.key !== e || s.kind !== t)
|
|
8136
8321
|
return;
|
|
8137
8322
|
const a = n.getRawBindingData();
|
|
8138
|
-
|
|
8323
|
+
N.seedSignature(
|
|
8139
8324
|
i,
|
|
8140
|
-
a ?
|
|
8325
|
+
a ? N.selectFromData(s, a) : {}
|
|
8141
8326
|
);
|
|
8142
8327
|
});
|
|
8143
8328
|
}
|
|
8144
8329
|
};
|
|
8145
|
-
|
|
8146
|
-
let Re =
|
|
8330
|
+
N.SIGNATURES = /* @__PURE__ */ new WeakMap(), N.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), N.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), N.WARNED_KINDS = /* @__PURE__ */ new Set();
|
|
8331
|
+
let Re = N;
|
|
8147
8332
|
class ht {
|
|
8148
8333
|
/**
|
|
8149
8334
|
* URLのクエリパラメータを取得します。
|
|
@@ -8182,7 +8367,7 @@ class ht {
|
|
|
8182
8367
|
}
|
|
8183
8368
|
}
|
|
8184
8369
|
}
|
|
8185
|
-
const
|
|
8370
|
+
const Ft = [
|
|
8186
8371
|
"addErrorMessage",
|
|
8187
8372
|
"clearMessages",
|
|
8188
8373
|
"closeDialog",
|
|
@@ -8193,15 +8378,15 @@ const Nt = [
|
|
|
8193
8378
|
], Mt = "__haoriHistoryState__", Pe = "data-haori-click-lock";
|
|
8194
8379
|
function Ie() {
|
|
8195
8380
|
const e = globalThis.window?.Haori;
|
|
8196
|
-
return
|
|
8381
|
+
return Ft.every(
|
|
8197
8382
|
(r) => typeof e?.[r] == "function"
|
|
8198
8383
|
) ? e : ve;
|
|
8199
8384
|
}
|
|
8200
|
-
const
|
|
8385
|
+
const $t = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
8201
8386
|
function Oe(y) {
|
|
8202
|
-
return
|
|
8387
|
+
return $t.has(y.toUpperCase());
|
|
8203
8388
|
}
|
|
8204
|
-
function
|
|
8389
|
+
function Ct(y, e) {
|
|
8205
8390
|
for (const [t, r] of Object.entries(e))
|
|
8206
8391
|
r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
|
|
8207
8392
|
y.append(t, me(i));
|
|
@@ -8220,7 +8405,7 @@ function me(y) {
|
|
|
8220
8405
|
}
|
|
8221
8406
|
function pt(y, e) {
|
|
8222
8407
|
const t = new URL(y, window.location.href), r = new URLSearchParams(t.search);
|
|
8223
|
-
return
|
|
8408
|
+
return Ct(r, e), t.search = r.toString(), t.toString();
|
|
8224
8409
|
}
|
|
8225
8410
|
function kt(y) {
|
|
8226
8411
|
if (y == null)
|
|
@@ -8270,7 +8455,7 @@ function gt(y, e, t) {
|
|
|
8270
8455
|
r === void 0 ? y[e] = t : Array.isArray(r) ? r.push(t) : y[e] = [r, t];
|
|
8271
8456
|
}
|
|
8272
8457
|
function de(y, e) {
|
|
8273
|
-
if (
|
|
8458
|
+
if (F.isCompleteSetValue(e))
|
|
8274
8459
|
return e;
|
|
8275
8460
|
if (Array.isArray(e)) {
|
|
8276
8461
|
const t = Array.isArray(y) ? y.slice() : [];
|
|
@@ -8345,7 +8530,7 @@ function Bt(y) {
|
|
|
8345
8530
|
) : Te(e));
|
|
8346
8531
|
}
|
|
8347
8532
|
function xe(y) {
|
|
8348
|
-
return Be(
|
|
8533
|
+
return Be(F.getValues(y));
|
|
8349
8534
|
}
|
|
8350
8535
|
function Be(y) {
|
|
8351
8536
|
const e = (r) => {
|
|
@@ -8355,7 +8540,7 @@ function Be(y) {
|
|
|
8355
8540
|
return "";
|
|
8356
8541
|
if (Array.isArray(r)) {
|
|
8357
8542
|
const i = r.map(e);
|
|
8358
|
-
return
|
|
8543
|
+
return F.carryCollectedRowIdentity(r, i), i;
|
|
8359
8544
|
}
|
|
8360
8545
|
if (r !== null && typeof r == "object") {
|
|
8361
8546
|
const i = {};
|
|
@@ -8363,13 +8548,13 @@ function Be(y) {
|
|
|
8363
8548
|
r
|
|
8364
8549
|
))
|
|
8365
8550
|
i[n] = e(s);
|
|
8366
|
-
return
|
|
8551
|
+
return F.carryCollectedRowIdentity(r, i), i;
|
|
8367
8552
|
}
|
|
8368
8553
|
return r;
|
|
8369
8554
|
}, t = {};
|
|
8370
8555
|
for (const [r, i] of Object.entries(y))
|
|
8371
8556
|
t[r] = e(i);
|
|
8372
|
-
return
|
|
8557
|
+
return F.carryCollectedRowIdentity(y, t), t;
|
|
8373
8558
|
}
|
|
8374
8559
|
function Ut(y, e) {
|
|
8375
8560
|
const t = new Headers(
|
|
@@ -8393,7 +8578,7 @@ const b = class b {
|
|
|
8393
8578
|
* @param domEvent 起点となった DOM イベント
|
|
8394
8579
|
*/
|
|
8395
8580
|
constructor(e, t = null, r = null) {
|
|
8396
|
-
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.twoWayCommitBind = !1, this.operationSequence = r != null ?
|
|
8581
|
+
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.twoWayCommitBind = !1, this.operationSequence = r != null ? T.nextOperationSequence() : T.nextSequence(), b.isElementFragment(e) ? (this.options = b.buildOptions(e, t), this.eventType = t) : (this.options = e, this.eventType = null), this.domEvent = r;
|
|
8397
8582
|
}
|
|
8398
8583
|
/**
|
|
8399
8584
|
* イベント属性名を正しく生成します。
|
|
@@ -8579,7 +8764,7 @@ const b = class b {
|
|
|
8579
8764
|
const a = r.trim();
|
|
8580
8765
|
if (b.SINGLE_PLACEHOLDER_REGEX.test(a))
|
|
8581
8766
|
return {
|
|
8582
|
-
value:
|
|
8767
|
+
value: k.parseDataBind(n),
|
|
8583
8768
|
hasUnresolvedReference: s
|
|
8584
8769
|
};
|
|
8585
8770
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
@@ -8588,7 +8773,7 @@ const b = class b {
|
|
|
8588
8773
|
e.getBindingData()
|
|
8589
8774
|
);
|
|
8590
8775
|
return {
|
|
8591
|
-
value:
|
|
8776
|
+
value: k.parseDataBind(c.value),
|
|
8592
8777
|
hasUnresolvedReference: s || c.hasUnresolvedReference
|
|
8593
8778
|
};
|
|
8594
8779
|
}
|
|
@@ -8597,7 +8782,7 @@ const b = class b {
|
|
|
8597
8782
|
e.getBindingData()
|
|
8598
8783
|
);
|
|
8599
8784
|
return {
|
|
8600
|
-
value:
|
|
8785
|
+
value: k.parseDataBind(o.value),
|
|
8601
8786
|
hasUnresolvedReference: s || o.hasUnresolvedReference
|
|
8602
8787
|
};
|
|
8603
8788
|
}
|
|
@@ -8614,7 +8799,7 @@ const b = class b {
|
|
|
8614
8799
|
}, i = t ? b.attrName(t, "if") : b.attrName(null, "if", !0);
|
|
8615
8800
|
if (e.hasAttribute(i)) {
|
|
8616
8801
|
const R = e.getRawAttribute(i);
|
|
8617
|
-
typeof R == "string" && R.trim() !== "" ? (r.conditionExpression =
|
|
8802
|
+
typeof R == "string" && R.trim() !== "" ? (r.conditionExpression = F.unwrapConditionExpression(R), r.conditionAttributeName = i) : m.warn(
|
|
8618
8803
|
"Haori",
|
|
8619
8804
|
`${i} に条件式が指定されていません。`
|
|
8620
8805
|
);
|
|
@@ -8634,15 +8819,15 @@ const b = class b {
|
|
|
8634
8819
|
S,
|
|
8635
8820
|
b.attrName(t, "form")
|
|
8636
8821
|
);
|
|
8637
|
-
H !== null ? r.formFragment =
|
|
8822
|
+
H !== null ? r.formFragment = F.getFormFragment(
|
|
8638
8823
|
M.get(H)
|
|
8639
8824
|
) : m.error(
|
|
8640
8825
|
"Haori",
|
|
8641
8826
|
`Form element not found: ${S} (${b.attrName(t, "form")})`
|
|
8642
8827
|
);
|
|
8643
8828
|
} else
|
|
8644
|
-
r.formFragment =
|
|
8645
|
-
} else (t === "change" || t === "input") && (r.formFragment =
|
|
8829
|
+
r.formFragment = F.getFormFragment(e);
|
|
8830
|
+
} else (t === "change" || t === "input") && (r.formFragment = F.getFormFragment(e), r.formFragment === null && b.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
8646
8831
|
if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
|
|
8647
8832
|
const S = e.getRawAttribute(
|
|
8648
8833
|
`${l.prefix}${t}-before-run`
|
|
@@ -8700,7 +8885,7 @@ ${S}
|
|
|
8700
8885
|
R
|
|
8701
8886
|
);
|
|
8702
8887
|
try {
|
|
8703
|
-
a.headers =
|
|
8888
|
+
a.headers = k.parseDataBind(S);
|
|
8704
8889
|
} catch (H) {
|
|
8705
8890
|
m.error("Haori", `Invalid fetch headers: ${H}`);
|
|
8706
8891
|
}
|
|
@@ -8716,7 +8901,7 @@ ${S}
|
|
|
8716
8901
|
R
|
|
8717
8902
|
);
|
|
8718
8903
|
try {
|
|
8719
|
-
a.headers =
|
|
8904
|
+
a.headers = k.parseDataBind(S);
|
|
8720
8905
|
} catch (H) {
|
|
8721
8906
|
m.error("Haori", `Invalid fetch headers: ${H}`);
|
|
8722
8907
|
}
|
|
@@ -8779,8 +8964,8 @@ ${S}
|
|
|
8779
8964
|
const R = e.getRawAttribute(I);
|
|
8780
8965
|
r.bindAppendParams = R.split("&").map((S) => S.trim()).filter(Boolean);
|
|
8781
8966
|
}
|
|
8782
|
-
const
|
|
8783
|
-
e.hasAttribute(
|
|
8967
|
+
const $ = t ? b.attrName(t, "bind-merge") : b.attrName(null, "bind-merge", !0);
|
|
8968
|
+
e.hasAttribute($) && (r.bindMerge = !0);
|
|
8784
8969
|
const W = t ? b.attrName(t, "bind-transform") : b.attrName(null, "bind-transform", !0);
|
|
8785
8970
|
e.hasAttribute(W) && (r.bindTransform = e.getRawAttribute(W));
|
|
8786
8971
|
const x = t ? b.attrName(t, "copy-params") : null;
|
|
@@ -8790,13 +8975,13 @@ ${S}
|
|
|
8790
8975
|
}
|
|
8791
8976
|
if (t) {
|
|
8792
8977
|
if (e.hasAttribute(b.attrName(t, "adjust"))) {
|
|
8793
|
-
const
|
|
8978
|
+
const q = X.read(
|
|
8794
8979
|
e,
|
|
8795
8980
|
b.attrName(t, "adjust")
|
|
8796
8981
|
);
|
|
8797
|
-
if (
|
|
8982
|
+
if (q) {
|
|
8798
8983
|
const z = X.queryAll(
|
|
8799
|
-
|
|
8984
|
+
q,
|
|
8800
8985
|
b.attrName(t, "adjust")
|
|
8801
8986
|
);
|
|
8802
8987
|
z.length > 0 ? (r.adjustFragments = [], z.forEach((Z) => {
|
|
@@ -8804,7 +8989,7 @@ ${S}
|
|
|
8804
8989
|
J && r.adjustFragments.push(J);
|
|
8805
8990
|
})) : m.error(
|
|
8806
8991
|
"Haori",
|
|
8807
|
-
`Adjust element not found: ${
|
|
8992
|
+
`Adjust element not found: ${q} (${b.attrName(t, "adjust")})`
|
|
8808
8993
|
);
|
|
8809
8994
|
}
|
|
8810
8995
|
if (e.hasAttribute(b.attrName(t, "adjust-value"))) {
|
|
@@ -8815,7 +9000,7 @@ ${S}
|
|
|
8815
9000
|
}
|
|
8816
9001
|
}
|
|
8817
9002
|
if (e.hasAttribute(b.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(b.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(b.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(b.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
|
|
8818
|
-
const
|
|
9003
|
+
const q = e.getRawAttribute(
|
|
8819
9004
|
`${l.prefix}${t}-after-run`
|
|
8820
9005
|
);
|
|
8821
9006
|
try {
|
|
@@ -8823,7 +9008,7 @@ ${S}
|
|
|
8823
9008
|
"response",
|
|
8824
9009
|
`
|
|
8825
9010
|
"use strict";
|
|
8826
|
-
${
|
|
9011
|
+
${q}
|
|
8827
9012
|
`
|
|
8828
9013
|
);
|
|
8829
9014
|
} catch (z) {
|
|
@@ -8844,10 +9029,10 @@ ${V}
|
|
|
8844
9029
|
"toast",
|
|
8845
9030
|
b.attrName(t, "toast")
|
|
8846
9031
|
);
|
|
8847
|
-
const
|
|
9032
|
+
const q = e.getRawAttribute(
|
|
8848
9033
|
b.attrName(t, "toast-level")
|
|
8849
|
-
), Z = ["info", "warning", "error", "success"].includes(
|
|
8850
|
-
r.toastLevel = Z ?
|
|
9034
|
+
), Z = ["info", "warning", "error", "success"].includes(q);
|
|
9035
|
+
r.toastLevel = Z ? q : null;
|
|
8851
9036
|
}
|
|
8852
9037
|
const R = b.attrName(t, "redirect"), S = b.attrName(t, "redirect-replace"), H = e.hasAttribute(R), B = e.hasAttribute(S);
|
|
8853
9038
|
if (H && (r.redirectUrl = b.readLateAttribute(
|
|
@@ -8861,15 +9046,15 @@ ${V}
|
|
|
8861
9046
|
"redirect-replace",
|
|
8862
9047
|
S
|
|
8863
9048
|
)), H || B) {
|
|
8864
|
-
const
|
|
9049
|
+
const q = b.attrName(
|
|
8865
9050
|
t,
|
|
8866
9051
|
"redirect-return-param"
|
|
8867
9052
|
);
|
|
8868
|
-
e.hasAttribute(
|
|
9053
|
+
e.hasAttribute(q) && (r.redirectReturnParam = b.readLateAttribute(
|
|
8869
9054
|
e,
|
|
8870
9055
|
r,
|
|
8871
9056
|
"redirect-return-param",
|
|
8872
|
-
|
|
9057
|
+
q
|
|
8873
9058
|
));
|
|
8874
9059
|
}
|
|
8875
9060
|
if (e.hasAttribute(b.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(b.attrName(t, "scroll")) && (r.scrollTarget = b.readLateAttribute(
|
|
@@ -8883,23 +9068,23 @@ ${V}
|
|
|
8883
9068
|
"history",
|
|
8884
9069
|
b.attrName(t, "history")
|
|
8885
9070
|
)), e.hasAttribute(b.attrName(t, "history-data")) && (r.historyDataAttrName = b.attrName(t, "history-data")), e.hasAttribute(b.attrName(t, "history-form"))) {
|
|
8886
|
-
const
|
|
9071
|
+
const q = X.read(
|
|
8887
9072
|
e,
|
|
8888
9073
|
b.attrName(t, "history-form")
|
|
8889
9074
|
);
|
|
8890
|
-
if (
|
|
9075
|
+
if (q) {
|
|
8891
9076
|
const z = X.query(
|
|
8892
|
-
|
|
9077
|
+
q,
|
|
8893
9078
|
b.attrName(t, "history-form")
|
|
8894
9079
|
);
|
|
8895
|
-
z !== null ? r.historyFormFragment =
|
|
9080
|
+
z !== null ? r.historyFormFragment = F.getFormFragment(
|
|
8896
9081
|
M.get(z)
|
|
8897
9082
|
) : m.error(
|
|
8898
9083
|
"Haori",
|
|
8899
|
-
`Form element not found: ${
|
|
9084
|
+
`Form element not found: ${q} (${b.attrName(t, "history-form")})`
|
|
8900
9085
|
);
|
|
8901
9086
|
} else
|
|
8902
|
-
r.historyFormFragment =
|
|
9087
|
+
r.historyFormFragment = F.getFormFragment(e);
|
|
8903
9088
|
}
|
|
8904
9089
|
[
|
|
8905
9090
|
"reset-before",
|
|
@@ -8909,8 +9094,8 @@ ${V}
|
|
|
8909
9094
|
"copy",
|
|
8910
9095
|
"open",
|
|
8911
9096
|
"close"
|
|
8912
|
-
].forEach((
|
|
8913
|
-
const z = b.attrName(t,
|
|
9097
|
+
].forEach((q) => {
|
|
9098
|
+
const z = b.attrName(t, q);
|
|
8914
9099
|
if (!e.hasAttribute(z))
|
|
8915
9100
|
return;
|
|
8916
9101
|
const Z = X.read(e, z), J = [];
|
|
@@ -8919,13 +9104,13 @@ ${V}
|
|
|
8919
9104
|
const ce = M.get(Se);
|
|
8920
9105
|
ce && J.push(ce);
|
|
8921
9106
|
}), J.length === 0 && m.error("Haori", `Element not found: ${Z} (${z})`);
|
|
8922
|
-
else if (
|
|
9107
|
+
else if (q === "open" || q === "close") {
|
|
8923
9108
|
const ae = e.getTarget().closest("dialog");
|
|
8924
9109
|
ae ? J.push(M.get(ae)) : m.error("Haori", `Ancestor <dialog> not found (${z})`);
|
|
8925
9110
|
} else
|
|
8926
9111
|
J.push(e);
|
|
8927
9112
|
if (J.length > 0)
|
|
8928
|
-
switch (
|
|
9113
|
+
switch (q) {
|
|
8929
9114
|
case "reset-before":
|
|
8930
9115
|
r.resetBeforeFragments = J;
|
|
8931
9116
|
break;
|
|
@@ -8951,19 +9136,19 @@ ${V}
|
|
|
8951
9136
|
});
|
|
8952
9137
|
const ie = b.attrName(t, "copy-source");
|
|
8953
9138
|
if (e.hasAttribute(ie)) {
|
|
8954
|
-
const
|
|
8955
|
-
if (
|
|
8956
|
-
const z = X.query(
|
|
9139
|
+
const q = X.read(e, ie);
|
|
9140
|
+
if (q) {
|
|
9141
|
+
const z = X.query(q, ie);
|
|
8957
9142
|
if (z !== null) {
|
|
8958
9143
|
const Z = M.get(z);
|
|
8959
9144
|
Z ? r.copySourceFragment = Z : m.error(
|
|
8960
9145
|
"Haori",
|
|
8961
|
-
`Element is not managed by Haori: ${
|
|
9146
|
+
`Element is not managed by Haori: ${q} (${ie})`
|
|
8962
9147
|
);
|
|
8963
9148
|
} else
|
|
8964
9149
|
m.error(
|
|
8965
9150
|
"Haori",
|
|
8966
|
-
`Element not found: ${
|
|
9151
|
+
`Element not found: ${q} (${ie})`
|
|
8967
9152
|
);
|
|
8968
9153
|
} else
|
|
8969
9154
|
r.copySourceFragment = e;
|
|
@@ -8979,14 +9164,14 @@ ${V}
|
|
|
8979
9164
|
R,
|
|
8980
9165
|
b.attrName(null, "form", !0)
|
|
8981
9166
|
);
|
|
8982
|
-
S !== null ? r.formFragment =
|
|
9167
|
+
S !== null ? r.formFragment = F.getFormFragment(
|
|
8983
9168
|
M.get(S)
|
|
8984
9169
|
) : m.error(
|
|
8985
9170
|
"Haori",
|
|
8986
9171
|
`Form element not found: ${R} (${b.attrName(null, "fetch-form", !0)})`
|
|
8987
9172
|
);
|
|
8988
9173
|
} else
|
|
8989
|
-
r.formFragment =
|
|
9174
|
+
r.formFragment = F.getFormFragment(e);
|
|
8990
9175
|
}
|
|
8991
9176
|
const U = t ? b.attrName(t, "fetch-state") : b.attrName(null, "state", !0);
|
|
8992
9177
|
if (e.hasAttribute(U)) {
|
|
@@ -9114,8 +9299,8 @@ ${V}
|
|
|
9114
9299
|
if (e === !1)
|
|
9115
9300
|
return !1;
|
|
9116
9301
|
try {
|
|
9117
|
-
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || (!this.options.formFragment && this.options.targetFragment &&
|
|
9118
|
-
|
|
9302
|
+
if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || (!this.options.formFragment && this.options.targetFragment && F.warnUnvalidatedCustomValidity(
|
|
9303
|
+
F.getFormFragment(this.options.targetFragment),
|
|
9119
9304
|
`${l.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
9120
9305
|
), !this.evaluateExecutionCondition()))
|
|
9121
9306
|
return !1;
|
|
@@ -9135,11 +9320,11 @@ ${V}
|
|
|
9135
9320
|
return !1;
|
|
9136
9321
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
9137
9322
|
this.options.resetBeforeFragments.map(
|
|
9138
|
-
(p) =>
|
|
9323
|
+
(p) => F.reset(p, this.operationSequence)
|
|
9139
9324
|
)
|
|
9140
9325
|
), this.captureHistorySnapshots());
|
|
9141
9326
|
const r = this.prepareFetchRequest();
|
|
9142
|
-
this.requestUserEditSequence =
|
|
9327
|
+
this.requestUserEditSequence = T.currentSequence();
|
|
9143
9328
|
const i = r.payload;
|
|
9144
9329
|
let n = r.url, s = r.options, a = !1, o = !1;
|
|
9145
9330
|
if (this.options.beforeCallback) {
|
|
@@ -9160,10 +9345,10 @@ ${V}
|
|
|
9160
9345
|
s
|
|
9161
9346
|
);
|
|
9162
9347
|
n = A.url;
|
|
9163
|
-
const I = { ...A.options },
|
|
9348
|
+
const I = { ...A.options }, $ = A.normalized ? A.requestedMethod : r.requestedMethod, W = A.effectiveMethod, x = r.transportMode === "query-get" || A.normalized, U = A.queryString ?? r.queryString;
|
|
9164
9349
|
if (x && m.info("Haori demo fetch normalization", {
|
|
9165
9350
|
runtime: l.runtime,
|
|
9166
|
-
requestedMethod:
|
|
9351
|
+
requestedMethod: $,
|
|
9167
9352
|
effectiveMethod: W,
|
|
9168
9353
|
transportMode: "query-get",
|
|
9169
9354
|
url: n,
|
|
@@ -9172,7 +9357,7 @@ ${V}
|
|
|
9172
9357
|
}), this.options.targetFragment && n) {
|
|
9173
9358
|
const K = performance.now(), R = {
|
|
9174
9359
|
runtime: l.runtime,
|
|
9175
|
-
requestedMethod:
|
|
9360
|
+
requestedMethod: $,
|
|
9176
9361
|
effectiveMethod: W,
|
|
9177
9362
|
transportMode: x ? "query-get" : "http",
|
|
9178
9363
|
...x ? { queryString: U } : {}
|
|
@@ -9204,25 +9389,29 @@ ${V}
|
|
|
9204
9389
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
|
|
9205
9390
|
const p = this.options.formFragment, g = p.getTarget(), E = /* @__PURE__ */ new Set();
|
|
9206
9391
|
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
9207
|
-
const A = p.getRawBindingData(), I = Be(i),
|
|
9392
|
+
const A = p.getRawBindingData(), I = Be(i), $ = p.getAttribute(`${l.prefix}form-arg`);
|
|
9208
9393
|
let W;
|
|
9209
|
-
if (
|
|
9394
|
+
if ($) {
|
|
9210
9395
|
W = { ...A ?? {} };
|
|
9211
|
-
const x = String(
|
|
9212
|
-
W[x] =
|
|
9396
|
+
const x = String($), U = F.resolveAncestorArgOwner(p, x);
|
|
9397
|
+
W[x] = F.mergeCollectedValues(
|
|
9213
9398
|
(U ? U.value : W[x]) ?? null,
|
|
9214
9399
|
I
|
|
9215
9400
|
);
|
|
9216
9401
|
} else
|
|
9217
|
-
W =
|
|
9218
|
-
|
|
9402
|
+
W = F.mergeCollectedValues(
|
|
9403
|
+
A,
|
|
9404
|
+
I,
|
|
9405
|
+
F.ancestorBaseResolver(p)
|
|
9406
|
+
);
|
|
9407
|
+
await k.setBindingData(g, W, {
|
|
9219
9408
|
skipFragments: E,
|
|
9220
9409
|
kind: "nonSupply",
|
|
9221
9410
|
sequence: this.operationSequence,
|
|
9222
|
-
editedPaths:
|
|
9411
|
+
editedPaths: F.collectEditedPaths(
|
|
9223
9412
|
p,
|
|
9224
9413
|
this.operationSequence,
|
|
9225
|
-
|
|
9414
|
+
$ ? String($) : "",
|
|
9226
9415
|
I
|
|
9227
9416
|
)
|
|
9228
9417
|
});
|
|
@@ -9295,7 +9484,7 @@ ${V}
|
|
|
9295
9484
|
const n = [];
|
|
9296
9485
|
n.push(this.bindResult(e)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), await this.injectFetchState("success", e.status, null), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
9297
9486
|
this.options.resetFragments.map(
|
|
9298
|
-
(g) =>
|
|
9487
|
+
(g) => F.reset(g, this.operationSequence)
|
|
9299
9488
|
)
|
|
9300
9489
|
), await this.copy();
|
|
9301
9490
|
const s = [];
|
|
@@ -9303,7 +9492,7 @@ ${V}
|
|
|
9303
9492
|
s.push(new b(g, null).run());
|
|
9304
9493
|
}), this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
9305
9494
|
for (const g of this.options.clickFragments) {
|
|
9306
|
-
await
|
|
9495
|
+
await k.evaluateAll(g);
|
|
9307
9496
|
const E = g.getTarget();
|
|
9308
9497
|
typeof E.click == "function" ? E.click() : E.dispatchEvent(
|
|
9309
9498
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
@@ -9356,8 +9545,8 @@ ${V}
|
|
|
9356
9545
|
if (E) {
|
|
9357
9546
|
const I = new URLSearchParams(window.location.search).get(E);
|
|
9358
9547
|
if (I !== null) {
|
|
9359
|
-
const
|
|
9360
|
-
ht.isSafeLocalPath(
|
|
9548
|
+
const $ = I.trim();
|
|
9549
|
+
ht.isSafeLocalPath($) ? g = $ : m.warn(
|
|
9361
9550
|
"Haori",
|
|
9362
9551
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${I}`
|
|
9363
9552
|
);
|
|
@@ -9394,7 +9583,7 @@ ${V}
|
|
|
9394
9583
|
if (!i || !n || !n.hasAttribute(i.attributeName))
|
|
9395
9584
|
return r;
|
|
9396
9585
|
const s = n.getAttributeEvaluation(i.attributeName);
|
|
9397
|
-
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (
|
|
9586
|
+
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (V.isEnabled() && m.warn(
|
|
9398
9587
|
"Haori",
|
|
9399
9588
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
9400
9589
|
), r) : s.value ?? null;
|
|
@@ -9437,7 +9626,7 @@ ${V}
|
|
|
9437
9626
|
*/
|
|
9438
9627
|
async handleFetchError(e) {
|
|
9439
9628
|
let t = null;
|
|
9440
|
-
this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t =
|
|
9629
|
+
this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t = F.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
9441
9630
|
const r = t ? t.getTarget() : document.body;
|
|
9442
9631
|
await Ie().clearMessages(r);
|
|
9443
9632
|
const i = async (a) => {
|
|
@@ -9486,7 +9675,7 @@ ${V}
|
|
|
9486
9675
|
if (o.length === 0)
|
|
9487
9676
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
9488
9677
|
for (const c of o)
|
|
9489
|
-
c.key && t ? await
|
|
9678
|
+
c.key && t ? await F.addErrorMessage(t, c.key, c.message) : await i(c.message);
|
|
9490
9679
|
return n(), !1;
|
|
9491
9680
|
} catch {
|
|
9492
9681
|
}
|
|
@@ -9507,11 +9696,11 @@ ${V}
|
|
|
9507
9696
|
*/
|
|
9508
9697
|
validate(e) {
|
|
9509
9698
|
if (this.options.valid !== !0)
|
|
9510
|
-
return
|
|
9699
|
+
return F.warnUnvalidatedCustomValidity(
|
|
9511
9700
|
e,
|
|
9512
9701
|
`${l.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
9513
9702
|
), !0;
|
|
9514
|
-
|
|
9703
|
+
F.applyCustomValidity(e);
|
|
9515
9704
|
const t = this.findFirstInvalid(e);
|
|
9516
9705
|
if (t === null)
|
|
9517
9706
|
return !0;
|
|
@@ -9602,14 +9791,14 @@ ${V}
|
|
|
9602
9791
|
const r = this.options.targetFragment;
|
|
9603
9792
|
if (!r)
|
|
9604
9793
|
return !0;
|
|
9605
|
-
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n =
|
|
9794
|
+
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n = F.buildConditionScope(
|
|
9606
9795
|
r,
|
|
9607
9796
|
this.options.formFragment ?? null
|
|
9608
9797
|
), s = ee.evaluateDetailed(t, n);
|
|
9609
9798
|
return s.unresolvedReference ? (e || m.warn(
|
|
9610
9799
|
"Haori",
|
|
9611
9800
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
9612
|
-
), !1) : s.value ? !0 : (!e &&
|
|
9801
|
+
), !1) : s.value ? !0 : (!e && V.isEnabled() && m.warn(
|
|
9613
9802
|
"Haori",
|
|
9614
9803
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
9615
9804
|
), !1);
|
|
@@ -9702,11 +9891,11 @@ ${V}
|
|
|
9702
9891
|
apply: (g) => {
|
|
9703
9892
|
const E = this.resolveCurrentRowItem(o, g), A = { ...E };
|
|
9704
9893
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
9705
|
-
const I = E[p],
|
|
9894
|
+
const I = E[p], $ = I !== null && typeof I == "object" && !Array.isArray(I) ? I : {};
|
|
9706
9895
|
A[p] = this.mergeAppendBindingData(
|
|
9707
9896
|
o,
|
|
9708
9897
|
i,
|
|
9709
|
-
|
|
9898
|
+
$
|
|
9710
9899
|
);
|
|
9711
9900
|
} else
|
|
9712
9901
|
A[p] = i;
|
|
@@ -9726,7 +9915,7 @@ ${V}
|
|
|
9726
9915
|
} else
|
|
9727
9916
|
u[d] = i;
|
|
9728
9917
|
n.push(
|
|
9729
|
-
|
|
9918
|
+
k.setBindingData(
|
|
9730
9919
|
o.getTarget(),
|
|
9731
9920
|
this.reconcileUserEditsForBind(o, u),
|
|
9732
9921
|
{
|
|
@@ -9784,7 +9973,7 @@ ${V}
|
|
|
9784
9973
|
i
|
|
9785
9974
|
), d = this.options.bindMerge ? { ...o.getRawBindingData() ?? {}, ...u } : u;
|
|
9786
9975
|
n.push(
|
|
9787
|
-
|
|
9976
|
+
k.setBindingData(
|
|
9788
9977
|
o.getTarget(),
|
|
9789
9978
|
this.reconcileUserEditsForBind(o, d),
|
|
9790
9979
|
{
|
|
@@ -9840,13 +10029,13 @@ ${V}
|
|
|
9840
10029
|
if (r === null)
|
|
9841
10030
|
return t;
|
|
9842
10031
|
const i = this.eventType === "poll";
|
|
9843
|
-
if (!i && !this.twoWayCommitBind &&
|
|
10032
|
+
if (!i && !this.twoWayCommitBind && k.clearUserEditMarks(e, r), !(e.getTarget() instanceof HTMLFormElement))
|
|
9844
10033
|
return this.reconcileAncestorArgFormEdits(
|
|
9845
10034
|
e,
|
|
9846
10035
|
t,
|
|
9847
10036
|
i ? 0 : r
|
|
9848
10037
|
);
|
|
9849
|
-
const n =
|
|
10038
|
+
const n = F.getValuesEditedAfter(
|
|
9850
10039
|
e,
|
|
9851
10040
|
i ? 0 : r
|
|
9852
10041
|
);
|
|
@@ -9879,8 +10068,8 @@ ${V}
|
|
|
9879
10068
|
if (r === null)
|
|
9880
10069
|
return t;
|
|
9881
10070
|
const i = this.eventType === "poll";
|
|
9882
|
-
!i && !this.twoWayCommitBind &&
|
|
9883
|
-
const n =
|
|
10071
|
+
!i && !this.twoWayCommitBind && k.clearUserEditMarks(e, r);
|
|
10072
|
+
const n = F.getValuesEditedAfter(
|
|
9884
10073
|
e,
|
|
9885
10074
|
i ? 0 : r
|
|
9886
10075
|
);
|
|
@@ -9902,10 +10091,10 @@ ${V}
|
|
|
9902
10091
|
*/
|
|
9903
10092
|
reconcileAncestorArgFormEdits(e, t, r) {
|
|
9904
10093
|
let i = t;
|
|
9905
|
-
for (const { form: n, key: s } of
|
|
10094
|
+
for (const { form: n, key: s } of F.collectArgForms(e)) {
|
|
9906
10095
|
if (!Object.prototype.hasOwnProperty.call(i, s))
|
|
9907
10096
|
continue;
|
|
9908
|
-
const a =
|
|
10097
|
+
const a = F.getValuesEditedAfter(n, r);
|
|
9909
10098
|
if (Object.keys(a).length === 0)
|
|
9910
10099
|
continue;
|
|
9911
10100
|
const o = i[s], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
@@ -9952,7 +10141,7 @@ ${V}
|
|
|
9952
10141
|
...t
|
|
9953
10142
|
};
|
|
9954
10143
|
n.push(
|
|
9955
|
-
|
|
10144
|
+
k.setBindingData(s.getTarget(), o, {
|
|
9956
10145
|
// 通番はコピーを起こした操作のもの(フェッチ応答の反映と同じ理由)。
|
|
9957
10146
|
sequence: this.operationSequence
|
|
9958
10147
|
})
|
|
@@ -9985,7 +10174,7 @@ ${V}
|
|
|
9985
10174
|
* @returns 行の入力欄の状態を反映した要素データ
|
|
9986
10175
|
*/
|
|
9987
10176
|
resolveCurrentRowItem(e, t) {
|
|
9988
|
-
const r =
|
|
10177
|
+
const r = F.getValuesEditedAfter(e, 0);
|
|
9989
10178
|
return Object.keys(r).length === 0 ? t : de(t, r);
|
|
9990
10179
|
}
|
|
9991
10180
|
/**
|
|
@@ -10014,7 +10203,11 @@ ${V}
|
|
|
10014
10203
|
* @returns コピー元のデータ
|
|
10015
10204
|
*/
|
|
10016
10205
|
resolveCopySourceData() {
|
|
10017
|
-
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? xe(this.options.copySourceFragment) :
|
|
10206
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? xe(this.options.copySourceFragment) : k.withoutReservedBindingKeys(
|
|
10207
|
+
this.options.copySourceFragment.getRawBindingData() ?? {}
|
|
10208
|
+
) : this.options.formFragment ? xe(this.options.formFragment) : this.options.targetFragment ? k.withoutReservedBindingKeys(
|
|
10209
|
+
this.options.targetFragment.getRawBindingData() ?? {}
|
|
10210
|
+
) : {};
|
|
10018
10211
|
}
|
|
10019
10212
|
/**
|
|
10020
10213
|
* data 属性とフォーム値を統合した送信データを作成し、未解決参照の有無を返します。
|
|
@@ -10026,8 +10219,8 @@ ${V}
|
|
|
10026
10219
|
let t = !1;
|
|
10027
10220
|
const r = this.options.formFragment ?? this.options.selfValueFragment;
|
|
10028
10221
|
if (r) {
|
|
10029
|
-
const i =
|
|
10030
|
-
Object.assign(e, i),
|
|
10222
|
+
const i = F.getValues(r);
|
|
10223
|
+
Object.assign(e, i), F.carryCollectedRowIdentity(i, e);
|
|
10031
10224
|
}
|
|
10032
10225
|
if (this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
|
|
10033
10226
|
const i = b.resolveDataAttributeDetailed(
|
|
@@ -10230,7 +10423,7 @@ ${V}
|
|
|
10230
10423
|
`Row container not found: ${i} (${r})`
|
|
10231
10424
|
), null;
|
|
10232
10425
|
const a = M.get(s);
|
|
10233
|
-
return a instanceof
|
|
10426
|
+
return a instanceof T ? a.hasAttribute(`${l.prefix}each`) ? a : (m.error(
|
|
10234
10427
|
"Haori",
|
|
10235
10428
|
`Row container must have ${l.prefix}each: ${i} (${r})`
|
|
10236
10429
|
), null) : (m.error(
|
|
@@ -10497,11 +10690,11 @@ ${V}
|
|
|
10497
10690
|
);
|
|
10498
10691
|
continue;
|
|
10499
10692
|
}
|
|
10500
|
-
a[d] = g, o = !0, u.syncWhenUnchanged === "supply" &&
|
|
10693
|
+
a[d] = g, o = !0, u.syncWhenUnchanged === "supply" && F.clearRowUserEditMarksForChangedKeys(u.row, g);
|
|
10501
10694
|
}
|
|
10502
10695
|
if (!o)
|
|
10503
10696
|
return;
|
|
10504
|
-
const c =
|
|
10697
|
+
const c = k.setBindingData(
|
|
10505
10698
|
s.owner.getTarget(),
|
|
10506
10699
|
b.withPathValue(s.ownerData, s.path, a),
|
|
10507
10700
|
{
|
|
@@ -10517,7 +10710,7 @@ ${V}
|
|
|
10517
10710
|
sequence: this.operationSequence
|
|
10518
10711
|
}
|
|
10519
10712
|
);
|
|
10520
|
-
if (
|
|
10713
|
+
if (k.isEachUpdateRunning(n)) {
|
|
10521
10714
|
c.catch((u) => {
|
|
10522
10715
|
m.error("Haori", "Failed to write row data.", u);
|
|
10523
10716
|
});
|
|
@@ -10547,7 +10740,7 @@ ${V}
|
|
|
10547
10740
|
* @returns 反映完了の Promise
|
|
10548
10741
|
*/
|
|
10549
10742
|
static syncUnchangedRowValues(e, t, r) {
|
|
10550
|
-
return r === "supply" &&
|
|
10743
|
+
return r === "supply" && F.clearRowUserEditMarksForChangedKeys(e, t), F.syncRowValues(e, t);
|
|
10551
10744
|
}
|
|
10552
10745
|
/**
|
|
10553
10746
|
* 行の要素データが同じ内容かどうかを判定します。
|
|
@@ -10613,7 +10806,7 @@ ${V}
|
|
|
10613
10806
|
if (a && o !== null) {
|
|
10614
10807
|
const c = [];
|
|
10615
10808
|
r.forEach((p, g) => {
|
|
10616
|
-
|
|
10809
|
+
k.createListKey(
|
|
10617
10810
|
p,
|
|
10618
10811
|
String(a),
|
|
10619
10812
|
g
|
|
@@ -10732,14 +10925,14 @@ ${V}
|
|
|
10732
10925
|
if (b.isSameRowItem(i.array[E], g))
|
|
10733
10926
|
return;
|
|
10734
10927
|
const A = p.get(
|
|
10735
|
-
|
|
10928
|
+
k.createListKey(
|
|
10736
10929
|
g,
|
|
10737
10930
|
null,
|
|
10738
10931
|
E
|
|
10739
10932
|
)
|
|
10740
10933
|
);
|
|
10741
|
-
A &&
|
|
10742
|
-
}),
|
|
10934
|
+
A && k.clearUserEditMarks(A);
|
|
10935
|
+
}), k.setBindingData(
|
|
10743
10936
|
i.owner.getTarget(),
|
|
10744
10937
|
b.withPathValue(i.ownerData, i.path, d),
|
|
10745
10938
|
{
|
|
@@ -10782,7 +10975,7 @@ ${V}
|
|
|
10782
10975
|
...s.getRawBindingData() ?? {},
|
|
10783
10976
|
_fetch: n
|
|
10784
10977
|
};
|
|
10785
|
-
return
|
|
10978
|
+
return k.setBindingData(a, o, {
|
|
10786
10979
|
reflectToAttribute: !1,
|
|
10787
10980
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
10788
10981
|
// 解除しない)。
|
|
@@ -10834,7 +11027,7 @@ class Ht {
|
|
|
10834
11027
|
}
|
|
10835
11028
|
}
|
|
10836
11029
|
}
|
|
10837
|
-
const
|
|
11030
|
+
const h = class h {
|
|
10838
11031
|
/**
|
|
10839
11032
|
* 遅延属性かどうか(完全名で判定)を判定します。
|
|
10840
11033
|
*
|
|
@@ -10842,7 +11035,7 @@ const f = class f {
|
|
|
10842
11035
|
* @returns 遅延属性かどうか
|
|
10843
11036
|
*/
|
|
10844
11037
|
static isDeferredAttributeName(e) {
|
|
10845
|
-
return
|
|
11038
|
+
return h.DEFERRED_ATTRIBUTE_SUFFIXES.some(
|
|
10846
11039
|
(t) => e === `${l.prefix}${t}`
|
|
10847
11040
|
);
|
|
10848
11041
|
}
|
|
@@ -10853,7 +11046,7 @@ const f = class f {
|
|
|
10853
11046
|
* @returns 除外対象かどうか
|
|
10854
11047
|
*/
|
|
10855
11048
|
static isEvaluateAllExcludedAttributeName(e) {
|
|
10856
|
-
return
|
|
11049
|
+
return h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
|
|
10857
11050
|
(t) => e === `${l.prefix}${t}`
|
|
10858
11051
|
);
|
|
10859
11052
|
}
|
|
@@ -10865,7 +11058,7 @@ const f = class f {
|
|
|
10865
11058
|
* @returns 再評価する場合は true
|
|
10866
11059
|
*/
|
|
10867
11060
|
static shouldReevaluateAttribute(e, t) {
|
|
10868
|
-
return t !== null && !
|
|
11061
|
+
return t !== null && !h.isEvaluateAllExcludedAttributeName(e) && h.ATTRIBUTE_PLACEHOLDER_REGEX.test(t);
|
|
10869
11062
|
}
|
|
10870
11063
|
/**
|
|
10871
11064
|
* data-attr-* 形式の属性名から実際に更新する属性名を取得します。
|
|
@@ -10874,7 +11067,7 @@ const f = class f {
|
|
|
10874
11067
|
* @returns 実際の属性名。data-attr-* でない場合は null
|
|
10875
11068
|
*/
|
|
10876
11069
|
static getAliasedAttributeName(e) {
|
|
10877
|
-
const t = `${l.prefix}${
|
|
11070
|
+
const t = `${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}`;
|
|
10878
11071
|
return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
|
|
10879
11072
|
}
|
|
10880
11073
|
/**
|
|
@@ -10886,8 +11079,8 @@ const f = class f {
|
|
|
10886
11079
|
*/
|
|
10887
11080
|
static isAliasedAttributeReflection(e, t) {
|
|
10888
11081
|
const r = M.get(e);
|
|
10889
|
-
return r instanceof
|
|
10890
|
-
`${l.prefix}${
|
|
11082
|
+
return r instanceof T ? r.hasAttribute(
|
|
11083
|
+
`${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
10891
11084
|
) : !1;
|
|
10892
11085
|
}
|
|
10893
11086
|
/**
|
|
@@ -10901,8 +11094,8 @@ const f = class f {
|
|
|
10901
11094
|
let t = Promise.resolve();
|
|
10902
11095
|
for (const r of e.getAttributeNames()) {
|
|
10903
11096
|
const i = e.getRawAttribute(r);
|
|
10904
|
-
|
|
10905
|
-
() =>
|
|
11097
|
+
h.shouldReevaluateAttribute(r, i) && (t = t.then(
|
|
11098
|
+
() => h.setAttribute(e.getTarget(), r, i)
|
|
10906
11099
|
));
|
|
10907
11100
|
}
|
|
10908
11101
|
return t.then(() => {
|
|
@@ -10917,7 +11110,7 @@ const f = class f {
|
|
|
10917
11110
|
static reevaluateChildren(e) {
|
|
10918
11111
|
const t = [];
|
|
10919
11112
|
return e.getChildren().forEach((r) => {
|
|
10920
|
-
r instanceof
|
|
11113
|
+
r instanceof T ? t.push(h.evaluateAll(r)) : r instanceof re && t.push(h.evaluateText(r));
|
|
10921
11114
|
}), Promise.all(t).then(() => {
|
|
10922
11115
|
});
|
|
10923
11116
|
}
|
|
@@ -10938,9 +11131,9 @@ const f = class f {
|
|
|
10938
11131
|
* @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
|
|
10939
11132
|
* @return 戻り値はありません。
|
|
10940
11133
|
*/
|
|
10941
|
-
static clearUserEditMarks(e, t =
|
|
11134
|
+
static clearUserEditMarks(e, t = T.currentSequence()) {
|
|
10942
11135
|
e.clearUserEditMark(t), e.getChildren().forEach((r) => {
|
|
10943
|
-
r instanceof
|
|
11136
|
+
r instanceof T && h.clearUserEditMarks(r, t);
|
|
10944
11137
|
});
|
|
10945
11138
|
}
|
|
10946
11139
|
/**
|
|
@@ -10950,7 +11143,7 @@ const f = class f {
|
|
|
10950
11143
|
* @returns 再評価状態
|
|
10951
11144
|
*/
|
|
10952
11145
|
static getReactiveFetchState(e) {
|
|
10953
|
-
const t =
|
|
11146
|
+
const t = h.REACTIVE_FETCH_STATES.get(e);
|
|
10954
11147
|
if (t)
|
|
10955
11148
|
return t;
|
|
10956
11149
|
const r = {
|
|
@@ -10958,7 +11151,7 @@ const f = class f {
|
|
|
10958
11151
|
running: !1,
|
|
10959
11152
|
rerunRequested: !1
|
|
10960
11153
|
};
|
|
10961
|
-
return
|
|
11154
|
+
return h.REACTIVE_FETCH_STATES.set(e, r), r;
|
|
10962
11155
|
}
|
|
10963
11156
|
/**
|
|
10964
11157
|
* data-import の再評価状態を取得します。
|
|
@@ -10967,7 +11160,7 @@ const f = class f {
|
|
|
10967
11160
|
* @returns 再評価状態
|
|
10968
11161
|
*/
|
|
10969
11162
|
static getReactiveImportState(e) {
|
|
10970
|
-
const t =
|
|
11163
|
+
const t = h.REACTIVE_IMPORT_STATES.get(e);
|
|
10971
11164
|
if (t)
|
|
10972
11165
|
return t;
|
|
10973
11166
|
const r = {
|
|
@@ -10975,7 +11168,7 @@ const f = class f {
|
|
|
10975
11168
|
running: !1,
|
|
10976
11169
|
rerunRequested: !1
|
|
10977
11170
|
};
|
|
10978
|
-
return
|
|
11171
|
+
return h.REACTIVE_IMPORT_STATES.set(e, r), r;
|
|
10979
11172
|
}
|
|
10980
11173
|
/**
|
|
10981
11174
|
* bind 更新時に data-fetch / data-import を専用ルートで再評価します。
|
|
@@ -10988,9 +11181,9 @@ const f = class f {
|
|
|
10988
11181
|
if (t.has(e))
|
|
10989
11182
|
return Promise.resolve();
|
|
10990
11183
|
const r = [];
|
|
10991
|
-
return e.hasAttribute(`${l.prefix}validity`) &&
|
|
10992
|
-
i instanceof
|
|
10993
|
-
|
|
11184
|
+
return e.hasAttribute(`${l.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${l.prefix}fetch`) && r.push(h.executeManagedFetch(e)), e.hasAttribute(`${l.prefix}import`) && r.push(h.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
11185
|
+
i instanceof T && r.push(
|
|
11186
|
+
h.reevaluateReactiveSpecialAttributes(i, t)
|
|
10994
11187
|
);
|
|
10995
11188
|
}), Promise.all(r).then(() => {
|
|
10996
11189
|
});
|
|
@@ -11002,7 +11195,7 @@ const f = class f {
|
|
|
11002
11195
|
* @returns 実行完了の Promise
|
|
11003
11196
|
*/
|
|
11004
11197
|
static executeManagedFetch(e) {
|
|
11005
|
-
const t = e.getTarget(), r =
|
|
11198
|
+
const t = e.getTarget(), r = h.getReactiveFetchState(t), i = ne.resolveAutoFetchSignature(e);
|
|
11006
11199
|
if (r.running)
|
|
11007
11200
|
return (i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve();
|
|
11008
11201
|
if (i.hasUnresolvedReference || i.signature === null)
|
|
@@ -11014,7 +11207,7 @@ const f = class f {
|
|
|
11014
11207
|
return n.markReentrantBind(), n.runWithResult().then(() => {
|
|
11015
11208
|
}).finally(() => {
|
|
11016
11209
|
if (r.running = !1, r.rerunRequested)
|
|
11017
|
-
return r.rerunRequested = !1,
|
|
11210
|
+
return r.rerunRequested = !1, h.executeManagedFetch(e);
|
|
11018
11211
|
});
|
|
11019
11212
|
}
|
|
11020
11213
|
/**
|
|
@@ -11024,7 +11217,7 @@ const f = class f {
|
|
|
11024
11217
|
* @returns 実行完了の Promise
|
|
11025
11218
|
*/
|
|
11026
11219
|
static executeManagedImport(e) {
|
|
11027
|
-
const t = e.getTarget(), r =
|
|
11220
|
+
const t = e.getTarget(), r = h.getReactiveImportState(t), i = e.getAttributeEvaluation(
|
|
11028
11221
|
`${l.prefix}import`
|
|
11029
11222
|
), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
|
|
11030
11223
|
if (r.running)
|
|
@@ -11040,10 +11233,10 @@ const f = class f {
|
|
|
11040
11233
|
return G.enqueue(() => {
|
|
11041
11234
|
t.innerHTML = a;
|
|
11042
11235
|
}).then(() => {
|
|
11043
|
-
t.removeAttribute(`${l.prefix}importing`), O.importEnd(t, n, o, s),
|
|
11236
|
+
t.removeAttribute(`${l.prefix}importing`), O.importEnd(t, n, o, s), h.adoptImportedChildren(e);
|
|
11044
11237
|
const c = [];
|
|
11045
11238
|
return e.getChildren().forEach((u) => {
|
|
11046
|
-
u instanceof
|
|
11239
|
+
u instanceof T ? c.push(h.scan(u.getTarget())) : u instanceof re && c.push(h.evaluateText(u));
|
|
11047
11240
|
}), Promise.all(c).then(() => {
|
|
11048
11241
|
});
|
|
11049
11242
|
});
|
|
@@ -11051,7 +11244,7 @@ const f = class f {
|
|
|
11051
11244
|
t.removeAttribute(`${l.prefix}importing`), O.importError(t, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
|
|
11052
11245
|
}).finally(() => {
|
|
11053
11246
|
if (r.running = !1, r.rerunRequested)
|
|
11054
|
-
return r.rerunRequested = !1,
|
|
11247
|
+
return r.rerunRequested = !1, h.executeManagedImport(e);
|
|
11055
11248
|
});
|
|
11056
11249
|
}
|
|
11057
11250
|
/**
|
|
@@ -11083,7 +11276,7 @@ const f = class f {
|
|
|
11083
11276
|
*/
|
|
11084
11277
|
static scan(e) {
|
|
11085
11278
|
const t = M.get(e);
|
|
11086
|
-
return t ?
|
|
11279
|
+
return t ? h.initializeElementFragment(t, !1).then(() => F.restoreInitialValues(e)).then(() => {
|
|
11087
11280
|
se.applySubtree(e);
|
|
11088
11281
|
}) : Promise.resolve();
|
|
11089
11282
|
}
|
|
@@ -11095,8 +11288,8 @@ const f = class f {
|
|
|
11095
11288
|
* @returns 初期化完了の Promise
|
|
11096
11289
|
*/
|
|
11097
11290
|
static initializeFreshEachRow(e) {
|
|
11098
|
-
return
|
|
11099
|
-
|
|
11291
|
+
return h.initializeElementFragment(e, !0).then(() => {
|
|
11292
|
+
h.needsScheduledEvaluateAll(e) && h.scheduleEvaluateAll(e), se.applySubtree(e.getTarget());
|
|
11100
11293
|
});
|
|
11101
11294
|
}
|
|
11102
11295
|
/**
|
|
@@ -11107,16 +11300,16 @@ const f = class f {
|
|
|
11107
11300
|
* @returns 初期化完了の Promise
|
|
11108
11301
|
*/
|
|
11109
11302
|
static initializeElementFragment(e, t) {
|
|
11110
|
-
return
|
|
11111
|
-
if (
|
|
11112
|
-
|
|
11303
|
+
return h.syncMountedState(e), t && e.isFreshInitializationSkippable() ? Promise.resolve() : h.initializeElementAttributes(e).then(() => {
|
|
11304
|
+
if (h.shouldSkipChildInitialization(e, t)) {
|
|
11305
|
+
h.refreshDerivedSubtreeSignature(e);
|
|
11113
11306
|
return;
|
|
11114
11307
|
}
|
|
11115
11308
|
const r = [];
|
|
11116
11309
|
return e.getChildren().forEach((i) => {
|
|
11117
|
-
i instanceof
|
|
11310
|
+
i instanceof T ? r.push(h.initializeElementFragment(i, t)) : i instanceof re && r.push(h.evaluateText(i));
|
|
11118
11311
|
}), Promise.all(r).then(() => {
|
|
11119
|
-
|
|
11312
|
+
h.refreshDerivedSubtreeSignature(e);
|
|
11120
11313
|
});
|
|
11121
11314
|
});
|
|
11122
11315
|
}
|
|
@@ -11146,10 +11339,10 @@ const f = class f {
|
|
|
11146
11339
|
static initializeElementAttributes(e) {
|
|
11147
11340
|
let t = Promise.resolve();
|
|
11148
11341
|
const r = /* @__PURE__ */ new Set();
|
|
11149
|
-
for (const i of
|
|
11342
|
+
for (const i of h.PRIORITY_ATTRIBUTE_SUFFIXES) {
|
|
11150
11343
|
const n = l.prefix + i;
|
|
11151
11344
|
e.hasAttribute(n) && (t = t.then(
|
|
11152
|
-
() =>
|
|
11345
|
+
() => h.setAttribute(
|
|
11153
11346
|
e.getTarget(),
|
|
11154
11347
|
n,
|
|
11155
11348
|
e.getRawAttribute(n)
|
|
@@ -11157,24 +11350,24 @@ const f = class f {
|
|
|
11157
11350
|
), r.add(n));
|
|
11158
11351
|
}
|
|
11159
11352
|
for (const i of e.getAttributeNames()) {
|
|
11160
|
-
if (r.has(i) ||
|
|
11353
|
+
if (r.has(i) || h.isDeferredAttributeName(i))
|
|
11161
11354
|
continue;
|
|
11162
11355
|
const n = e.getRawAttribute(i);
|
|
11163
11356
|
n !== null && (t = t.then(
|
|
11164
|
-
() =>
|
|
11357
|
+
() => h.setAttribute(e.getTarget(), i, n)
|
|
11165
11358
|
));
|
|
11166
11359
|
}
|
|
11167
|
-
for (const i of
|
|
11360
|
+
for (const i of h.DEFERRED_ATTRIBUTE_SUFFIXES) {
|
|
11168
11361
|
const n = l.prefix + i;
|
|
11169
11362
|
e.hasAttribute(n) && (t = t.then(
|
|
11170
|
-
() =>
|
|
11363
|
+
() => h.setAttribute(
|
|
11171
11364
|
e.getTarget(),
|
|
11172
11365
|
n,
|
|
11173
11366
|
e.getRawAttribute(n)
|
|
11174
11367
|
)
|
|
11175
11368
|
), r.add(n));
|
|
11176
11369
|
}
|
|
11177
|
-
return t.then(() =>
|
|
11370
|
+
return t.then(() => F.prepareFormName(e));
|
|
11178
11371
|
}
|
|
11179
11372
|
/**
|
|
11180
11373
|
* 子孫初期化をスキップすべきかどうかを返します。
|
|
@@ -11185,7 +11378,7 @@ const f = class f {
|
|
|
11185
11378
|
*/
|
|
11186
11379
|
static shouldSkipChildInitialization(e, t) {
|
|
11187
11380
|
const r = e.getAttribute(`${l.prefix}if`);
|
|
11188
|
-
return e.hasAttribute(`${l.prefix}if`) &&
|
|
11381
|
+
return e.hasAttribute(`${l.prefix}if`) && h.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${l.prefix}each`);
|
|
11189
11382
|
}
|
|
11190
11383
|
/**
|
|
11191
11384
|
* エレメントに属性を設定します。
|
|
@@ -11201,7 +11394,7 @@ const f = class f {
|
|
|
11201
11394
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11202
11395
|
*/
|
|
11203
11396
|
static setAttribute(e, t, r, i = !1, n) {
|
|
11204
|
-
const s = M.get(e), a =
|
|
11397
|
+
const s = M.get(e), a = h.getAliasedAttributeName(t);
|
|
11205
11398
|
if (a !== null)
|
|
11206
11399
|
return r === null ? s.removeAliasedAttribute(t, a) : s.setAliasedAttribute(
|
|
11207
11400
|
t,
|
|
@@ -11213,18 +11406,18 @@ const f = class f {
|
|
|
11213
11406
|
let c = null, u = null, d = null;
|
|
11214
11407
|
switch (t) {
|
|
11215
11408
|
case `${l.prefix}bind`: {
|
|
11216
|
-
if (r !== null && i && s instanceof
|
|
11409
|
+
if (r !== null && i && s instanceof T && s.consumeSelfWrittenBind(r))
|
|
11217
11410
|
break;
|
|
11218
|
-
const p = r === null ? {} :
|
|
11411
|
+
const p = r === null ? {} : h.parseDataBind(r);
|
|
11219
11412
|
if (i) {
|
|
11220
|
-
const g = n ??
|
|
11413
|
+
const g = n ?? T.nextSequence();
|
|
11221
11414
|
return r === null ? (o.push(
|
|
11222
|
-
|
|
11415
|
+
h.setBindingData(e, p, {
|
|
11223
11416
|
reflectToAttribute: !1,
|
|
11224
11417
|
sequence: g
|
|
11225
11418
|
})
|
|
11226
11419
|
), o.push(s.removeAttribute(t))) : o.push(
|
|
11227
|
-
|
|
11420
|
+
h.setBindingData(e, p, {
|
|
11228
11421
|
sequence: g
|
|
11229
11422
|
})
|
|
11230
11423
|
), Promise.all(o).then(() => {
|
|
@@ -11234,11 +11427,11 @@ const f = class f {
|
|
|
11234
11427
|
break;
|
|
11235
11428
|
}
|
|
11236
11429
|
case `${l.prefix}derive`:
|
|
11237
|
-
u =
|
|
11430
|
+
u = h.createDeriveInputSignature(
|
|
11238
11431
|
s,
|
|
11239
11432
|
r,
|
|
11240
11433
|
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
11241
|
-
), c =
|
|
11434
|
+
), c = h.evaluateDerive(
|
|
11242
11435
|
s,
|
|
11243
11436
|
r,
|
|
11244
11437
|
s.getRawAttribute(`${l.prefix}derive-name`)
|
|
@@ -11246,11 +11439,11 @@ const f = class f {
|
|
|
11246
11439
|
}));
|
|
11247
11440
|
break;
|
|
11248
11441
|
case `${l.prefix}derive-name`:
|
|
11249
|
-
u =
|
|
11442
|
+
u = h.createDeriveInputSignature(
|
|
11250
11443
|
s,
|
|
11251
11444
|
s.getRawAttribute(`${l.prefix}derive`),
|
|
11252
11445
|
r
|
|
11253
|
-
), c =
|
|
11446
|
+
), c = h.evaluateDerive(
|
|
11254
11447
|
s,
|
|
11255
11448
|
s.getRawAttribute(`${l.prefix}derive`),
|
|
11256
11449
|
r
|
|
@@ -11258,23 +11451,23 @@ const f = class f {
|
|
|
11258
11451
|
}));
|
|
11259
11452
|
break;
|
|
11260
11453
|
case `${l.prefix}if`:
|
|
11261
|
-
d = () =>
|
|
11454
|
+
d = () => h.evaluateIf(s);
|
|
11262
11455
|
break;
|
|
11263
11456
|
case `${l.prefix}each`:
|
|
11264
|
-
d = () =>
|
|
11457
|
+
d = () => h.evaluateEach(s);
|
|
11265
11458
|
break;
|
|
11266
11459
|
case `${l.prefix}fetch`:
|
|
11267
|
-
d = () =>
|
|
11460
|
+
d = () => h.executeManagedFetch(s);
|
|
11268
11461
|
break;
|
|
11269
11462
|
case `${l.prefix}import`:
|
|
11270
|
-
typeof r == "string" && (d = () =>
|
|
11463
|
+
typeof r == "string" && (d = () => h.executeManagedImport(s));
|
|
11271
11464
|
break;
|
|
11272
11465
|
case `${l.prefix}store`:
|
|
11273
11466
|
r !== null && o.push(Re.restore(s));
|
|
11274
11467
|
break;
|
|
11275
11468
|
case `${l.prefix}validity`:
|
|
11276
11469
|
case `${l.prefix}validity-message`:
|
|
11277
|
-
return r !== null &&
|
|
11470
|
+
return r !== null && F.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
11278
11471
|
});
|
|
11279
11472
|
case `${l.prefix}url-param`: {
|
|
11280
11473
|
const p = s.getAttribute(`${l.prefix}url-arg`), g = ht.readParams();
|
|
@@ -11285,13 +11478,13 @@ const f = class f {
|
|
|
11285
11478
|
const E = {
|
|
11286
11479
|
reentrant: !0,
|
|
11287
11480
|
kind: "nonSupply",
|
|
11288
|
-
sequence:
|
|
11481
|
+
sequence: T.nextSequence()
|
|
11289
11482
|
};
|
|
11290
11483
|
if (p === null)
|
|
11291
|
-
o.push(
|
|
11484
|
+
o.push(h.setBindingData(e, g, E));
|
|
11292
11485
|
else {
|
|
11293
11486
|
const A = s.getRawBindingData() || {};
|
|
11294
|
-
A[String(p)] = g, o.push(
|
|
11487
|
+
A[String(p)] = g, o.push(h.setBindingData(e, A, E));
|
|
11295
11488
|
}
|
|
11296
11489
|
break;
|
|
11297
11490
|
}
|
|
@@ -11302,7 +11495,7 @@ const f = class f {
|
|
|
11302
11495
|
if (c !== null)
|
|
11303
11496
|
return s.setDeriveInputSignature(u), c.then((p) => {
|
|
11304
11497
|
if (p)
|
|
11305
|
-
return
|
|
11498
|
+
return h.reevaluateChildren(s);
|
|
11306
11499
|
});
|
|
11307
11500
|
}).then(() => {
|
|
11308
11501
|
});
|
|
@@ -11334,37 +11527,40 @@ const f = class f {
|
|
|
11334
11527
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11335
11528
|
*/
|
|
11336
11529
|
static setBindingData(e, t, r = {}) {
|
|
11337
|
-
const i = M.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", c = r.sequence ??
|
|
11530
|
+
const i = M.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", c = r.sequence ?? T.nextOperationSequence(), u = {
|
|
11338
11531
|
sequence: c,
|
|
11339
11532
|
kind: o,
|
|
11340
11533
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11341
11534
|
}, d = o === "supply";
|
|
11342
11535
|
d && i.markSupplyApplied(c);
|
|
11343
|
-
const p =
|
|
11344
|
-
d && (r.clearUserEdits ?? !0) &&
|
|
11345
|
-
const E = a ?
|
|
11536
|
+
const p = T.currentSequence(), g = i.getRawBindingData();
|
|
11537
|
+
d && (r.clearUserEdits ?? !0) && h.clearUserEditMarks(i, c);
|
|
11538
|
+
const E = a ? h.resolveByPathAuthority(i, g, t, u) : t;
|
|
11346
11539
|
i.setBindingData(E), a && (O.bindChange(e, g, E, "manual"), Re.mirror(i));
|
|
11347
11540
|
const A = () => {
|
|
11348
11541
|
i.markBindingWorkStart();
|
|
11349
11542
|
const I = i.getRawBindingData() ?? E;
|
|
11350
|
-
let
|
|
11351
|
-
|
|
11543
|
+
let $ = a ? i.setAttribute(
|
|
11544
|
+
`${l.prefix}bind`,
|
|
11545
|
+
JSON.stringify(h.withoutReservedBindingKeys(I))
|
|
11546
|
+
) : Promise.resolve();
|
|
11547
|
+
return e.tagName === "FORM" && ($ = $.then(() => {
|
|
11352
11548
|
if (i.wasResetAfter(p))
|
|
11353
11549
|
return;
|
|
11354
11550
|
const W = i.getRawBindingData() ?? E;
|
|
11355
|
-
return
|
|
11551
|
+
return F.syncValues(
|
|
11356
11552
|
i,
|
|
11357
|
-
|
|
11553
|
+
F.resolveSyncValues(i, W),
|
|
11358
11554
|
!1,
|
|
11359
11555
|
u
|
|
11360
11556
|
);
|
|
11361
|
-
})),
|
|
11362
|
-
() =>
|
|
11363
|
-
),
|
|
11364
|
-
() =>
|
|
11365
|
-
),
|
|
11366
|
-
() =>
|
|
11367
|
-
),
|
|
11557
|
+
})), $ = $.then(
|
|
11558
|
+
() => F.syncAncestorArgForms(i, p, u, g)
|
|
11559
|
+
), $ = $.then(() => h.evaluateAll(i, n)), $ = $.then(
|
|
11560
|
+
() => T.retryUnappliedValueWrites(e, p)
|
|
11561
|
+
), $ = $.then(
|
|
11562
|
+
() => h.reevaluateReactiveSpecialAttributes(i, n)
|
|
11563
|
+
), $.then(
|
|
11368
11564
|
() => i.markBindingWorkEnd(),
|
|
11369
11565
|
(W) => {
|
|
11370
11566
|
throw i.markBindingWorkEnd(), W;
|
|
@@ -11373,6 +11569,24 @@ const f = class f {
|
|
|
11373
11569
|
};
|
|
11374
11570
|
return s ? A() : i.enqueueBindingWork(A);
|
|
11375
11571
|
}
|
|
11572
|
+
/**
|
|
11573
|
+
* 宣言データとして外へ出すデータから予約キーを取り除きます。
|
|
11574
|
+
*
|
|
11575
|
+
* `_fetch` / `_poll` は内部バインディングデータにのみ持つ実行時の値で、宣言
|
|
11576
|
+
* データとしては外へ出しません(仕様「`data-bind`」)。内部データ側は予約キーを
|
|
11577
|
+
* 引き継ぐため(`ElementFragment.setBindingData()`)、出口の側で取り除かないと、
|
|
11578
|
+
* `data-bind` 属性が数秒ごとの状態遷移で書き換わり続け、`data-{event}-copy` は
|
|
11579
|
+
* 別の要素のフェッチ状態をコピー先へ運びます。
|
|
11580
|
+
*
|
|
11581
|
+
* @param data 外へ出すバインドデータ
|
|
11582
|
+
* @returns 予約キーを除いたデータ
|
|
11583
|
+
*/
|
|
11584
|
+
static withoutReservedBindingKeys(e) {
|
|
11585
|
+
const t = {};
|
|
11586
|
+
for (const r of Object.keys(e))
|
|
11587
|
+
T.isReservedBindingKey(r) || (t[r] = e[r]);
|
|
11588
|
+
return t;
|
|
11589
|
+
}
|
|
11376
11590
|
/**
|
|
11377
11591
|
* 変化した経路ごとに適用可否を判定し、棄却した経路を前の値のまま残したデータを
|
|
11378
11592
|
* 返します。
|
|
@@ -11389,14 +11603,14 @@ const f = class f {
|
|
|
11389
11603
|
* @returns 適用を許した経路だけが `next` の値になったバインドデータ
|
|
11390
11604
|
*/
|
|
11391
11605
|
static resolveByPathAuthority(e, t, r, i) {
|
|
11392
|
-
const n =
|
|
11606
|
+
const n = h.mergePathAuthority(
|
|
11393
11607
|
e,
|
|
11394
11608
|
t ?? {},
|
|
11395
11609
|
r,
|
|
11396
11610
|
i,
|
|
11397
11611
|
""
|
|
11398
11612
|
);
|
|
11399
|
-
return n ===
|
|
11613
|
+
return n === h.ABSENT_PATH ? r : n;
|
|
11400
11614
|
}
|
|
11401
11615
|
/**
|
|
11402
11616
|
* 経路をたどりながら、変化した葉ごとに適用可否を判定します。
|
|
@@ -11409,7 +11623,7 @@ const f = class f {
|
|
|
11409
11623
|
* @returns 採用した値。その経路を持たせない場合は `ABSENT_PATH`
|
|
11410
11624
|
*/
|
|
11411
11625
|
static mergePathAuthority(e, t, r, i, n) {
|
|
11412
|
-
if (
|
|
11626
|
+
if (h.isPlainRecord(t) && h.isPlainRecord(r)) {
|
|
11413
11627
|
const u = t, d = r, p = {};
|
|
11414
11628
|
let g = Object.keys(u).some(
|
|
11415
11629
|
(A) => !Object.prototype.hasOwnProperty.call(d, A)
|
|
@@ -11419,21 +11633,21 @@ const f = class f {
|
|
|
11419
11633
|
...Object.keys(d)
|
|
11420
11634
|
]);
|
|
11421
11635
|
for (const A of E) {
|
|
11422
|
-
const I = n === "" ? A : `${n}.${A}`,
|
|
11636
|
+
const I = n === "" ? A : `${n}.${A}`, $ = h.mergePathAuthority(
|
|
11423
11637
|
e,
|
|
11424
|
-
Object.prototype.hasOwnProperty.call(u, A) ? u[A] :
|
|
11425
|
-
Object.prototype.hasOwnProperty.call(d, A) ? d[A] :
|
|
11638
|
+
Object.prototype.hasOwnProperty.call(u, A) ? u[A] : h.ABSENT_PATH,
|
|
11639
|
+
Object.prototype.hasOwnProperty.call(d, A) ? d[A] : h.ABSENT_PATH,
|
|
11426
11640
|
i,
|
|
11427
11641
|
I
|
|
11428
11642
|
);
|
|
11429
|
-
|
|
11643
|
+
$ !== h.ABSENT_PATH && (p[A] = $), $ !== (Object.prototype.hasOwnProperty.call(d, A) ? d[A] : h.ABSENT_PATH) && (g = !0);
|
|
11430
11644
|
}
|
|
11431
11645
|
return g ? p : d;
|
|
11432
11646
|
}
|
|
11433
|
-
const s =
|
|
11647
|
+
const s = h.resolveArrayPairing(e, t, r, n);
|
|
11434
11648
|
if (s !== null) {
|
|
11435
11649
|
const u = t, d = r, p = d.map(
|
|
11436
|
-
(g, E) =>
|
|
11650
|
+
(g, E) => h.mergePathAuthority(
|
|
11437
11651
|
e,
|
|
11438
11652
|
u[E],
|
|
11439
11653
|
g,
|
|
@@ -11443,7 +11657,7 @@ const f = class f {
|
|
|
11443
11657
|
);
|
|
11444
11658
|
return p.some((g, E) => g !== d[E]) ? p : d;
|
|
11445
11659
|
}
|
|
11446
|
-
if (
|
|
11660
|
+
if (h.isSameBindingValue(t, r))
|
|
11447
11661
|
return r;
|
|
11448
11662
|
const a = i.editedPaths?.get(n), o = a === void 0 ? i.kind : "edit", c = {
|
|
11449
11663
|
sequence: a ?? i.sequence,
|
|
@@ -11469,14 +11683,14 @@ const f = class f {
|
|
|
11469
11683
|
static resolveArrayPairing(e, t, r, i) {
|
|
11470
11684
|
if (!Array.isArray(t) || !Array.isArray(r) || t.length !== r.length || r.length === 0)
|
|
11471
11685
|
return null;
|
|
11472
|
-
const n = r.some((o) =>
|
|
11473
|
-
(o, c) =>
|
|
11686
|
+
const n = r.some((o) => h.isPlainRecord(o)) ? h.resolveEachKeyArg(e, i) : null, s = t.map(
|
|
11687
|
+
(o, c) => h.createListKey(
|
|
11474
11688
|
o,
|
|
11475
11689
|
n,
|
|
11476
11690
|
c
|
|
11477
11691
|
)
|
|
11478
11692
|
), a = r.map(
|
|
11479
|
-
(o, c) =>
|
|
11693
|
+
(o, c) => h.createListKey(
|
|
11480
11694
|
o,
|
|
11481
11695
|
n,
|
|
11482
11696
|
c
|
|
@@ -11500,7 +11714,7 @@ const f = class f {
|
|
|
11500
11714
|
static resolveEachKeyArg(e, t) {
|
|
11501
11715
|
const r = `${l.prefix}each`, i = e.getTarget(), n = t.replace(/\[[^\]]*\]/g, ""), s = i.querySelectorAll(`[${r}]`);
|
|
11502
11716
|
for (const a of Array.from(s)) {
|
|
11503
|
-
const o =
|
|
11717
|
+
const o = h.resolveEachDeclarationPath(a, i);
|
|
11504
11718
|
if (o === null || o !== n)
|
|
11505
11719
|
continue;
|
|
11506
11720
|
const c = a.getAttribute(`${r}-key`);
|
|
@@ -11569,7 +11783,7 @@ const f = class f {
|
|
|
11569
11783
|
static isSameBindingValue(e, t) {
|
|
11570
11784
|
if (e === t)
|
|
11571
11785
|
return !0;
|
|
11572
|
-
if (e ===
|
|
11786
|
+
if (e === h.ABSENT_PATH || t === h.ABSENT_PATH)
|
|
11573
11787
|
return !1;
|
|
11574
11788
|
try {
|
|
11575
11789
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
@@ -11596,7 +11810,7 @@ const f = class f {
|
|
|
11596
11810
|
*/
|
|
11597
11811
|
static getBindingData(e, t = {}) {
|
|
11598
11812
|
const r = M.get(e);
|
|
11599
|
-
return r instanceof
|
|
11813
|
+
return r instanceof T ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
11600
11814
|
}
|
|
11601
11815
|
/**
|
|
11602
11816
|
* 指定要素の式評価で見えるバインディングスコープをダンプします(デバッグ用)。
|
|
@@ -11614,8 +11828,8 @@ const f = class f {
|
|
|
11614
11828
|
* @return 解決済みスコープと各キーの由来情報
|
|
11615
11829
|
*/
|
|
11616
11830
|
static dumpScope(e) {
|
|
11617
|
-
const t =
|
|
11618
|
-
return
|
|
11831
|
+
const t = h.collectScope(e);
|
|
11832
|
+
return V.isEnabled() && m.info("[Haori]", "scope dump for", e, t), t;
|
|
11619
11833
|
}
|
|
11620
11834
|
/**
|
|
11621
11835
|
* スコープの解決結果と由来を収集します。
|
|
@@ -11632,7 +11846,7 @@ const f = class f {
|
|
|
11632
11846
|
if (!t)
|
|
11633
11847
|
return { resolved: {}, sources: {} };
|
|
11634
11848
|
const r = t.getBindingData(), i = {}, n = (c) => {
|
|
11635
|
-
const u = c.getTarget(), d =
|
|
11849
|
+
const u = c.getTarget(), d = h.resolveElementId(u);
|
|
11636
11850
|
return d !== "" ? `#${d}` : u.tagName.toLowerCase();
|
|
11637
11851
|
}, s = (c, u, d, p) => {
|
|
11638
11852
|
if (c)
|
|
@@ -11683,7 +11897,7 @@ const f = class f {
|
|
|
11683
11897
|
if (n) {
|
|
11684
11898
|
if (n.getParent() === r)
|
|
11685
11899
|
return;
|
|
11686
|
-
r.insertBefore(n, i), n instanceof
|
|
11900
|
+
r.insertBefore(n, i), n instanceof T ? h.scan(n.getTarget()) : n instanceof re && h.evaluateText(n);
|
|
11687
11901
|
}
|
|
11688
11902
|
}
|
|
11689
11903
|
/**
|
|
@@ -11724,25 +11938,29 @@ const f = class f {
|
|
|
11724
11938
|
return Promise.resolve();
|
|
11725
11939
|
const i = [];
|
|
11726
11940
|
i.push(r.setValue(t));
|
|
11727
|
-
const n =
|
|
11941
|
+
const n = h.getFormFragment(r);
|
|
11728
11942
|
if (n) {
|
|
11729
|
-
const s =
|
|
11943
|
+
const s = F.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`), o = n.getRawBindingData();
|
|
11730
11944
|
let c;
|
|
11731
11945
|
if (a) {
|
|
11732
11946
|
c = { ...o ?? {} };
|
|
11733
|
-
const u = String(a), d =
|
|
11734
|
-
c[u] =
|
|
11947
|
+
const u = String(a), d = F.resolveAncestorArgOwner(n, u);
|
|
11948
|
+
c[u] = F.mergeCollectedValues(
|
|
11735
11949
|
(d ? d.value : c[u]) ?? null,
|
|
11736
11950
|
s
|
|
11737
11951
|
);
|
|
11738
11952
|
} else
|
|
11739
|
-
c =
|
|
11953
|
+
c = F.mergeCollectedValues(
|
|
11954
|
+
o,
|
|
11955
|
+
s,
|
|
11956
|
+
F.ancestorBaseResolver(n)
|
|
11957
|
+
);
|
|
11740
11958
|
i.push(
|
|
11741
11959
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
11742
11960
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
11743
|
-
|
|
11961
|
+
h.setBindingData(n.getTarget(), c, {
|
|
11744
11962
|
kind: "nonSupply",
|
|
11745
|
-
sequence:
|
|
11963
|
+
sequence: T.nextSequence()
|
|
11746
11964
|
})
|
|
11747
11965
|
);
|
|
11748
11966
|
}
|
|
@@ -11759,7 +11977,7 @@ const f = class f {
|
|
|
11759
11977
|
if (e.getTarget() instanceof HTMLFormElement)
|
|
11760
11978
|
return e;
|
|
11761
11979
|
const t = e.getParent();
|
|
11762
|
-
return t ?
|
|
11980
|
+
return t ? h.getFormFragment(t) : null;
|
|
11763
11981
|
}
|
|
11764
11982
|
/**
|
|
11765
11983
|
* フラグメントとその子要素を評価します。
|
|
@@ -11770,21 +11988,21 @@ const f = class f {
|
|
|
11770
11988
|
static evaluateAll(e, t = /* @__PURE__ */ new Set()) {
|
|
11771
11989
|
if (t.has(e))
|
|
11772
11990
|
return Promise.resolve();
|
|
11773
|
-
let r =
|
|
11991
|
+
let r = h.reevaluateInterpolatedAttributes(e);
|
|
11774
11992
|
const i = e.hasAttribute(`${l.prefix}derive`), n = e.hasAttribute(`${l.prefix}if`), s = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
|
|
11775
11993
|
let c = !1, u = !1, d = null;
|
|
11776
11994
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
11777
|
-
const p =
|
|
11995
|
+
const p = h.createDeriveInputSignature(
|
|
11778
11996
|
e,
|
|
11779
11997
|
a,
|
|
11780
11998
|
o
|
|
11781
11999
|
);
|
|
11782
12000
|
p === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
11783
|
-
() =>
|
|
12001
|
+
() => h.evaluateDerive(e, a, o).then(
|
|
11784
12002
|
() => {
|
|
11785
12003
|
}
|
|
11786
12004
|
)
|
|
11787
|
-
)) : e.getDeriveInputSignature() !== p && (r = r.then(() =>
|
|
12005
|
+
)) : e.getDeriveInputSignature() !== p && (r = r.then(() => h.evaluateDerive(
|
|
11788
12006
|
e,
|
|
11789
12007
|
a,
|
|
11790
12008
|
o
|
|
@@ -11792,16 +12010,16 @@ const f = class f {
|
|
|
11792
12010
|
e.setDeriveInputSignature(p);
|
|
11793
12011
|
})));
|
|
11794
12012
|
}
|
|
11795
|
-
return n && (r = r.then(() =>
|
|
12013
|
+
return n && (r = r.then(() => h.evaluateIf(e))), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => h.evaluateEachFixedChildren(e)).then(() => h.evaluateEach(e))) : n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
11796
12014
|
})) : (i && (r = r.then(() => {
|
|
11797
|
-
if (!
|
|
11798
|
-
e.setDeriveSubtreeSignature(null),
|
|
12015
|
+
if (!h.canSkipStableDerivedSubtree(e)) {
|
|
12016
|
+
e.setDeriveSubtreeSignature(null), h.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
11799
12017
|
return;
|
|
11800
12018
|
}
|
|
11801
|
-
d =
|
|
12019
|
+
d = h.createDescendantBindingSignature(
|
|
11802
12020
|
e,
|
|
11803
12021
|
"evaluateAll"
|
|
11804
|
-
), u = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d,
|
|
12022
|
+
), u = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === d, h.logDerivedSubtreeProfileSnapshot(
|
|
11805
12023
|
e,
|
|
11806
12024
|
c ? "skip-hit" : "skip-miss"
|
|
11807
12025
|
);
|
|
@@ -11810,11 +12028,11 @@ const f = class f {
|
|
|
11810
12028
|
return;
|
|
11811
12029
|
const p = [];
|
|
11812
12030
|
return e.getChildren().forEach((g) => {
|
|
11813
|
-
if (g instanceof
|
|
11814
|
-
if (
|
|
12031
|
+
if (g instanceof T) {
|
|
12032
|
+
if (h.canSkipUnchangedNestedEach(g))
|
|
11815
12033
|
return;
|
|
11816
|
-
p.push(
|
|
11817
|
-
} else g instanceof re && p.push(
|
|
12034
|
+
p.push(h.evaluateAll(g, t));
|
|
12035
|
+
} else g instanceof re && p.push(h.evaluateText(g));
|
|
11818
12036
|
}), Promise.all(p).then(() => {
|
|
11819
12037
|
});
|
|
11820
12038
|
}).then(() => {
|
|
@@ -11846,7 +12064,7 @@ const f = class f {
|
|
|
11846
12064
|
const a = {
|
|
11847
12065
|
[n]: s.value
|
|
11848
12066
|
};
|
|
11849
|
-
return
|
|
12067
|
+
return h.createBindingSignature(i) === h.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
|
|
11850
12068
|
}
|
|
11851
12069
|
/**
|
|
11852
12070
|
* テキストフラグメントを評価します。
|
|
@@ -11892,7 +12110,7 @@ const f = class f {
|
|
|
11892
12110
|
);
|
|
11893
12111
|
return;
|
|
11894
12112
|
}
|
|
11895
|
-
const { sources: r } =
|
|
12113
|
+
const { sources: r } = h.collectScope(e.getTarget()), i = /* @__PURE__ */ new Set(), n = t.match(/[A-Za-z_$][\w$]*/g) ?? [];
|
|
11896
12114
|
let s = 0;
|
|
11897
12115
|
n.forEach((o) => {
|
|
11898
12116
|
const c = t.indexOf(o, s);
|
|
@@ -11938,7 +12156,7 @@ const f = class f {
|
|
|
11938
12156
|
*/
|
|
11939
12157
|
static hasEachFixedChildren(e) {
|
|
11940
12158
|
return e.getChildren().some(
|
|
11941
|
-
(t) => t instanceof
|
|
12159
|
+
(t) => t instanceof T && h.isEachFixedChild(t)
|
|
11942
12160
|
);
|
|
11943
12161
|
}
|
|
11944
12162
|
/**
|
|
@@ -11960,7 +12178,7 @@ const f = class f {
|
|
|
11960
12178
|
static evaluateEachFixedChildren(e) {
|
|
11961
12179
|
const t = [];
|
|
11962
12180
|
return e.getChildren().forEach((r) => {
|
|
11963
|
-
r instanceof
|
|
12181
|
+
r instanceof T ? h.isEachFixedChild(r) && t.push(h.evaluateAll(r)) : r instanceof re && t.push(h.evaluateText(r));
|
|
11964
12182
|
}), Promise.all(t).then(() => {
|
|
11965
12183
|
});
|
|
11966
12184
|
}
|
|
@@ -11974,8 +12192,8 @@ const f = class f {
|
|
|
11974
12192
|
*/
|
|
11975
12193
|
static evaluateIf(e) {
|
|
11976
12194
|
const t = [], r = e.getAttribute(`${l.prefix}if`);
|
|
11977
|
-
if (
|
|
11978
|
-
|
|
12195
|
+
if (h.isHiddenIfCondition(r))
|
|
12196
|
+
V.isEnabled() && e.isVisible() && h.logFalsyIfDiagnostics(e), t.push(
|
|
11979
12197
|
e.hide().then(() => {
|
|
11980
12198
|
O.hide(e.getTarget());
|
|
11981
12199
|
})
|
|
@@ -11984,16 +12202,16 @@ const f = class f {
|
|
|
11984
12202
|
e.restoreFormControlsDisabledByIf();
|
|
11985
12203
|
const i = e.isVisible(), n = [], s = e.hasAttribute(`${l.prefix}each`);
|
|
11986
12204
|
e.getChildren().forEach((a) => {
|
|
11987
|
-
if (a instanceof
|
|
11988
|
-
if (s && !
|
|
12205
|
+
if (a instanceof T) {
|
|
12206
|
+
if (s && !h.isEachFixedChild(a))
|
|
11989
12207
|
return;
|
|
11990
12208
|
n.push(
|
|
11991
|
-
a.isMounted() ?
|
|
12209
|
+
a.isMounted() ? h.evaluateAll(a) : h.scan(a.getTarget())
|
|
11992
12210
|
);
|
|
11993
|
-
} else a instanceof re && n.push(
|
|
12211
|
+
} else a instanceof re && n.push(h.evaluateText(a));
|
|
11994
12212
|
}), t.push(
|
|
11995
12213
|
e.show().then(() => {
|
|
11996
|
-
O.show(e.getTarget()), i || (
|
|
12214
|
+
O.show(e.getTarget()), i || (h.triggerLoadOnShow(e), se.refreshSubtree(e.getTarget()));
|
|
11997
12215
|
})
|
|
11998
12216
|
), t.push(Promise.all(n).then(() => {
|
|
11999
12217
|
}));
|
|
@@ -12023,8 +12241,8 @@ const f = class f {
|
|
|
12023
12241
|
* @return 再入制御状態
|
|
12024
12242
|
*/
|
|
12025
12243
|
static getEachUpdateState(e) {
|
|
12026
|
-
let t =
|
|
12027
|
-
return t || (t = { running: !1, rerunRequested: !1, settled: null },
|
|
12244
|
+
let t = h.EACH_UPDATE_STATES.get(e);
|
|
12245
|
+
return t || (t = { running: !1, rerunRequested: !1, settled: null }, h.EACH_UPDATE_STATES.set(e, t)), t;
|
|
12028
12246
|
}
|
|
12029
12247
|
/**
|
|
12030
12248
|
* each要素を評価します。
|
|
@@ -12040,13 +12258,13 @@ const f = class f {
|
|
|
12040
12258
|
* @return 差分更新(再実行を含む)の完了 Promise
|
|
12041
12259
|
*/
|
|
12042
12260
|
static evaluateEach(e) {
|
|
12043
|
-
if (
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
]), e.isMounted() ||
|
|
12261
|
+
if (V.isEnabled() && ee.recordRowScopeIdentifiers([
|
|
12262
|
+
h.getRowScopeName(e, "each-arg"),
|
|
12263
|
+
h.getRowScopeName(e, "each-index")
|
|
12264
|
+
]), e.isMounted() || h.syncMountedState(e), !e.isVisible() || !e.isMounted())
|
|
12047
12265
|
return e.getTarget().removeAttribute(`${l.prefix}each-done`), Promise.resolve();
|
|
12048
|
-
const t =
|
|
12049
|
-
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) :
|
|
12266
|
+
const t = h.getEachUpdateState(e);
|
|
12267
|
+
return t.running ? (t.rerunRequested = !0, t.settled ?? Promise.resolve()) : h.runEachUpdateLoop(e, t);
|
|
12050
12268
|
}
|
|
12051
12269
|
/**
|
|
12052
12270
|
* `data-each` が行スコープへ公開する名前を返します。
|
|
@@ -12071,7 +12289,7 @@ const f = class f {
|
|
|
12071
12289
|
* @returns 差分更新が実行中なら true
|
|
12072
12290
|
*/
|
|
12073
12291
|
static isEachUpdateRunning(e) {
|
|
12074
|
-
return
|
|
12292
|
+
return h.getEachUpdateState(e).running;
|
|
12075
12293
|
}
|
|
12076
12294
|
/**
|
|
12077
12295
|
* data-each の差分更新を、再評価要求が無くなるまで直列に繰り返し実行します。
|
|
@@ -12087,14 +12305,14 @@ const f = class f {
|
|
|
12087
12305
|
const r = (async () => {
|
|
12088
12306
|
try {
|
|
12089
12307
|
do
|
|
12090
|
-
t.rerunRequested = !1, await
|
|
12308
|
+
t.rerunRequested = !1, await h.performEachUpdate(e);
|
|
12091
12309
|
while (t.rerunRequested);
|
|
12092
12310
|
const i = e.getTarget();
|
|
12093
|
-
i.setAttribute(`${l.prefix}each-done`, ""), se.refreshSubtree(i),
|
|
12311
|
+
i.setAttribute(`${l.prefix}each-done`, ""), se.refreshSubtree(i), h.runEachRenderedScript(i);
|
|
12094
12312
|
} finally {
|
|
12095
12313
|
t.running = !1, t.settled = null;
|
|
12096
12314
|
}
|
|
12097
|
-
|
|
12315
|
+
h.runEachRenderedChange(e);
|
|
12098
12316
|
})();
|
|
12099
12317
|
return t.settled = r, r;
|
|
12100
12318
|
}
|
|
@@ -12164,14 +12382,14 @@ ${r}
|
|
|
12164
12382
|
return;
|
|
12165
12383
|
const i = String(r.getAttribute(t) ?? "").trim().toLowerCase();
|
|
12166
12384
|
let n = !1;
|
|
12167
|
-
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (
|
|
12385
|
+
if (i === "always" ? n = !0 : i !== "" && i !== "once" && (h.EACH_RENDERED_CHANGE_WARNED.has(r) || (h.EACH_RENDERED_CHANGE_WARNED.add(r), m.warn(
|
|
12168
12386
|
"[Haori]",
|
|
12169
12387
|
`Invalid ${t} value: "${i}". Use "once" (default) or "always".`
|
|
12170
|
-
))),
|
|
12388
|
+
))), h.countEachRenderedRows(e) !== 0) {
|
|
12171
12389
|
if (!n) {
|
|
12172
|
-
if (
|
|
12390
|
+
if (h.EACH_RENDERED_CHANGE_FIRED.has(r))
|
|
12173
12391
|
return;
|
|
12174
|
-
|
|
12392
|
+
h.EACH_RENDERED_CHANGE_FIRED.add(r);
|
|
12175
12393
|
}
|
|
12176
12394
|
try {
|
|
12177
12395
|
r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -12203,42 +12421,42 @@ ${r}
|
|
|
12203
12421
|
* @return 差分更新完了の Promise
|
|
12204
12422
|
*/
|
|
12205
12423
|
static performEachUpdate(e) {
|
|
12206
|
-
const t =
|
|
12424
|
+
const t = h.resolveEachItems(e);
|
|
12207
12425
|
if (t === null)
|
|
12208
12426
|
return Promise.reject(new Error("Invalid each attribute."));
|
|
12209
12427
|
let r = e.getTemplate();
|
|
12210
|
-
const i = e.getAttribute(`${l.prefix}each-key`), n =
|
|
12428
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
|
|
12211
12429
|
key: i ? String(i) : null,
|
|
12212
12430
|
items: t
|
|
12213
12431
|
});
|
|
12214
12432
|
if (r === null) {
|
|
12215
12433
|
let s = !1;
|
|
12216
12434
|
if (e.getChildren().forEach((a) => {
|
|
12217
|
-
if (!s && a instanceof
|
|
12435
|
+
if (!s && a instanceof T) {
|
|
12218
12436
|
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
12219
12437
|
return;
|
|
12220
|
-
r = a.clone(),
|
|
12438
|
+
r = a.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
12221
12439
|
const o = a.getTarget();
|
|
12222
12440
|
o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
|
|
12223
12441
|
}
|
|
12224
|
-
}), s &&
|
|
12442
|
+
}), s && h.warnExtraEachChildren(e), !s) {
|
|
12225
12443
|
const a = e.getTarget();
|
|
12226
12444
|
Array.from(a.children).filter(
|
|
12227
12445
|
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
12228
12446
|
).forEach((c) => {
|
|
12229
12447
|
if (!s) {
|
|
12230
12448
|
const d = M.get(c);
|
|
12231
|
-
d instanceof
|
|
12449
|
+
d instanceof T && (r = d.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
12232
12450
|
}
|
|
12233
12451
|
const u = M.get(c);
|
|
12234
|
-
u instanceof
|
|
12452
|
+
u instanceof T && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), c.parentNode && c.parentNode.removeChild(c);
|
|
12235
12453
|
});
|
|
12236
12454
|
}
|
|
12237
12455
|
return this.updateDiff(e, t).then(() => {
|
|
12238
12456
|
e.setEachInputSignature(n);
|
|
12239
12457
|
});
|
|
12240
12458
|
}
|
|
12241
|
-
return e.getEachInputSignature() === n ?
|
|
12459
|
+
return e.getEachInputSignature() === n ? h.reevaluateEachRows(e) : this.updateDiff(e, t).then(() => {
|
|
12242
12460
|
e.setEachInputSignature(n);
|
|
12243
12461
|
});
|
|
12244
12462
|
}
|
|
@@ -12252,12 +12470,12 @@ ${r}
|
|
|
12252
12470
|
* @returns 再評価完了の Promise
|
|
12253
12471
|
*/
|
|
12254
12472
|
static reevaluateEachRows(e) {
|
|
12255
|
-
if (
|
|
12473
|
+
if (h.isRowLocalEachTemplate(e))
|
|
12256
12474
|
return Promise.resolve();
|
|
12257
12475
|
const t = e.getChildElementFragments().filter(
|
|
12258
12476
|
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12259
12477
|
);
|
|
12260
|
-
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) =>
|
|
12478
|
+
return t.length === 0 ? Promise.resolve() : Promise.all(t.map((r) => h.evaluateAll(r))).then(
|
|
12261
12479
|
() => {
|
|
12262
12480
|
}
|
|
12263
12481
|
);
|
|
@@ -12283,12 +12501,12 @@ ${r}
|
|
|
12283
12501
|
if (!e.hasAttribute(`${l.prefix}each`) || e.getEachInputSignature() === null)
|
|
12284
12502
|
return !1;
|
|
12285
12503
|
const t = e.getParent();
|
|
12286
|
-
if (t?.closestByAttribute(`${l.prefix}derive`) || t?.closestByAttribute(`${l.prefix}derive-name`) || t?.closestByAttribute(`${l.prefix}if`) || t?.closestByAttribute(`${l.prefix}fetch`) || t?.closestByAttribute(`${l.prefix}import`) ||
|
|
12504
|
+
if (t?.closestByAttribute(`${l.prefix}derive`) || t?.closestByAttribute(`${l.prefix}derive-name`) || t?.closestByAttribute(`${l.prefix}if`) || t?.closestByAttribute(`${l.prefix}fetch`) || t?.closestByAttribute(`${l.prefix}import`) || h.hasNonEachDynamicElementState(e) || !h.isRowLocalEachTemplate(e) || h.hasEachFixedChildren(e))
|
|
12287
12505
|
return !1;
|
|
12288
|
-
const r =
|
|
12506
|
+
const r = h.resolveEachItems(e);
|
|
12289
12507
|
if (r === null)
|
|
12290
12508
|
return !1;
|
|
12291
|
-
const i = e.getAttribute(`${l.prefix}each-key`), n =
|
|
12509
|
+
const i = e.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
|
|
12292
12510
|
key: i ? String(i) : null,
|
|
12293
12511
|
items: r
|
|
12294
12512
|
});
|
|
@@ -12322,7 +12540,7 @@ ${r}
|
|
|
12322
12540
|
return e.setRowLocalTemplate(!1), !1;
|
|
12323
12541
|
const n = /* @__PURE__ */ new Set([String(i)]), s = e.getAttribute(`${l.prefix}each-index`);
|
|
12324
12542
|
s && n.add(String(s));
|
|
12325
|
-
const a =
|
|
12543
|
+
const a = h.isRowLocalSubtree(r, n);
|
|
12326
12544
|
return e.setRowLocalTemplate(a), a;
|
|
12327
12545
|
}
|
|
12328
12546
|
/**
|
|
@@ -12336,8 +12554,8 @@ ${r}
|
|
|
12336
12554
|
for (const i of e.getAttributeNames()) {
|
|
12337
12555
|
const n = e.getRawAttribute(i), s = typeof n == "string" ? n : "";
|
|
12338
12556
|
if (s.includes("{{")) {
|
|
12339
|
-
if (!
|
|
12340
|
-
|
|
12557
|
+
if (!h.areExpressionsRowLocal(
|
|
12558
|
+
h.extractInterpolations(s),
|
|
12341
12559
|
t
|
|
12342
12560
|
))
|
|
12343
12561
|
return !1;
|
|
@@ -12346,15 +12564,15 @@ ${r}
|
|
|
12346
12564
|
if (!i.startsWith(l.prefix))
|
|
12347
12565
|
continue;
|
|
12348
12566
|
const a = i.slice(l.prefix.length);
|
|
12349
|
-
if (
|
|
12350
|
-
if (!
|
|
12567
|
+
if (h.ROW_LOCAL_EXPRESSION_ATTRIBUTES.has(a)) {
|
|
12568
|
+
if (!h.areExpressionsRowLocal([s], t))
|
|
12351
12569
|
return !1;
|
|
12352
12570
|
continue;
|
|
12353
12571
|
}
|
|
12354
|
-
if (
|
|
12572
|
+
if (h.ROW_LOCAL_STATIC_ATTRIBUTES.has(a))
|
|
12355
12573
|
continue;
|
|
12356
12574
|
const o = a.indexOf("-");
|
|
12357
|
-
if (!(o !== -1 &&
|
|
12575
|
+
if (!(o !== -1 && h.ROW_LOCAL_ROW_OPERATIONS.has(a.slice(o + 1))))
|
|
12358
12576
|
return !1;
|
|
12359
12577
|
}
|
|
12360
12578
|
let r = t;
|
|
@@ -12368,13 +12586,13 @@ ${r}
|
|
|
12368
12586
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
12369
12587
|
}
|
|
12370
12588
|
for (const i of e.getChildren())
|
|
12371
|
-
if (i instanceof
|
|
12372
|
-
if (!
|
|
12589
|
+
if (i instanceof T) {
|
|
12590
|
+
if (!h.isRowLocalSubtree(i, r))
|
|
12373
12591
|
return !1;
|
|
12374
12592
|
} else if (i instanceof re) {
|
|
12375
12593
|
const n = i.getRawText();
|
|
12376
|
-
if (n.includes("{{") && !
|
|
12377
|
-
|
|
12594
|
+
if (n.includes("{{") && !h.areExpressionsRowLocal(
|
|
12595
|
+
h.extractInterpolations(n),
|
|
12378
12596
|
t
|
|
12379
12597
|
))
|
|
12380
12598
|
return !1;
|
|
@@ -12422,7 +12640,7 @@ ${r}
|
|
|
12422
12640
|
* @returns 省略可能なら true
|
|
12423
12641
|
*/
|
|
12424
12642
|
static canSkipStableDerivedSubtree(e) {
|
|
12425
|
-
return !e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}if`) || e.hasAttribute(`${l.prefix}each`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !1 : !
|
|
12643
|
+
return !e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}if`) || e.hasAttribute(`${l.prefix}each`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !1 : !h.hasDisallowedDerivedSubtreeDescendant(e);
|
|
12426
12644
|
}
|
|
12427
12645
|
/**
|
|
12428
12646
|
* data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
|
|
@@ -12431,7 +12649,7 @@ ${r}
|
|
|
12431
12649
|
* @returns 含むなら true
|
|
12432
12650
|
*/
|
|
12433
12651
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12434
|
-
return e.getChildren().some((t) => t instanceof
|
|
12652
|
+
return e.getChildren().some((t) => t instanceof T ? t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}derive-name`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !0 : h.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
12435
12653
|
}
|
|
12436
12654
|
/**
|
|
12437
12655
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -12440,7 +12658,7 @@ ${r}
|
|
|
12440
12658
|
* @returns binding 署名
|
|
12441
12659
|
*/
|
|
12442
12660
|
static createDescendantBindingSignature(e, t) {
|
|
12443
|
-
return
|
|
12661
|
+
return h.recordDerivedSubtreeSignatureComputation(e, t), h.createBindingSignature(e.getDescendantBindingData());
|
|
12444
12662
|
}
|
|
12445
12663
|
/**
|
|
12446
12664
|
* data-derive 実行前の入力署名を返します。
|
|
@@ -12452,7 +12670,7 @@ ${r}
|
|
|
12452
12670
|
*/
|
|
12453
12671
|
static createDeriveInputSignature(e, t, r) {
|
|
12454
12672
|
const i = typeof r == "string" ? r.trim() : "";
|
|
12455
|
-
return !t || i === "" ? null :
|
|
12673
|
+
return !t || i === "" ? null : h.createBindingSignature({
|
|
12456
12674
|
expression: t,
|
|
12457
12675
|
name: i,
|
|
12458
12676
|
scope: e.getBindingData()
|
|
@@ -12464,13 +12682,13 @@ ${r}
|
|
|
12464
12682
|
* @param fragment 対象フラグメント
|
|
12465
12683
|
*/
|
|
12466
12684
|
static refreshDerivedSubtreeSignature(e) {
|
|
12467
|
-
if (!
|
|
12468
|
-
e.setDeriveSubtreeSignature(null),
|
|
12685
|
+
if (!h.canSkipStableDerivedSubtree(e)) {
|
|
12686
|
+
e.setDeriveSubtreeSignature(null), h.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
12469
12687
|
return;
|
|
12470
12688
|
}
|
|
12471
12689
|
e.setDeriveSubtreeSignature(
|
|
12472
|
-
|
|
12473
|
-
),
|
|
12690
|
+
h.createDescendantBindingSignature(e, "refresh")
|
|
12691
|
+
), h.logDerivedSubtreeProfileSnapshot(e, "refresh");
|
|
12474
12692
|
}
|
|
12475
12693
|
/**
|
|
12476
12694
|
* data-derive subtree skip のプロファイルを取得または初期化します。
|
|
@@ -12479,13 +12697,13 @@ ${r}
|
|
|
12479
12697
|
* @returns プロファイル
|
|
12480
12698
|
*/
|
|
12481
12699
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
12482
|
-
if (!
|
|
12700
|
+
if (!V.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
12483
12701
|
return null;
|
|
12484
|
-
const t =
|
|
12702
|
+
const t = h.DERIVE_SUBTREE_PROFILES.get(e);
|
|
12485
12703
|
if (t)
|
|
12486
12704
|
return t;
|
|
12487
12705
|
const r = {
|
|
12488
|
-
hostId:
|
|
12706
|
+
hostId: h.createDerivedSubtreeHostId(e),
|
|
12489
12707
|
signatureComputeTotal: 0,
|
|
12490
12708
|
signatureComputeFromEvaluateAll: 0,
|
|
12491
12709
|
signatureComputeFromRefresh: 0,
|
|
@@ -12493,7 +12711,7 @@ ${r}
|
|
|
12493
12711
|
skipMissCount: 0,
|
|
12494
12712
|
skipIneligibleCount: 0
|
|
12495
12713
|
};
|
|
12496
|
-
return
|
|
12714
|
+
return h.DERIVE_SUBTREE_PROFILES.set(e, r), r;
|
|
12497
12715
|
}
|
|
12498
12716
|
/**
|
|
12499
12717
|
* 要素の `id` 属性を安全に取得します。
|
|
@@ -12524,7 +12742,7 @@ ${r}
|
|
|
12524
12742
|
if (!(i instanceof HTMLElement))
|
|
12525
12743
|
break;
|
|
12526
12744
|
let n = i.tagName.toLowerCase();
|
|
12527
|
-
const s =
|
|
12745
|
+
const s = h.resolveElementId(i).trim();
|
|
12528
12746
|
if (s !== "") {
|
|
12529
12747
|
n += `#${s}`, t.unshift(n);
|
|
12530
12748
|
break;
|
|
@@ -12533,7 +12751,7 @@ ${r}
|
|
|
12533
12751
|
typeof a == "string" && a.trim() !== "" && (n += `[${l.prefix}derive-name="${a.trim()}"]`);
|
|
12534
12752
|
const o = r.getParent();
|
|
12535
12753
|
if (o) {
|
|
12536
|
-
const c = o.getChildren().filter((u) => u instanceof
|
|
12754
|
+
const c = o.getChildren().filter((u) => u instanceof T).findIndex((u) => u === r);
|
|
12537
12755
|
n += `:nth-child(${c + 1})`;
|
|
12538
12756
|
}
|
|
12539
12757
|
t.unshift(n), r = o;
|
|
@@ -12547,7 +12765,7 @@ ${r}
|
|
|
12547
12765
|
* @param source 計算元
|
|
12548
12766
|
*/
|
|
12549
12767
|
static recordDerivedSubtreeSignatureComputation(e, t) {
|
|
12550
|
-
const r =
|
|
12768
|
+
const r = h.getOrCreateDerivedSubtreeProfile(e);
|
|
12551
12769
|
if (r !== null) {
|
|
12552
12770
|
if (r.signatureComputeTotal += 1, t === "refresh") {
|
|
12553
12771
|
r.signatureComputeFromRefresh += 1;
|
|
@@ -12563,7 +12781,7 @@ ${r}
|
|
|
12563
12781
|
* @param reason ログ理由
|
|
12564
12782
|
*/
|
|
12565
12783
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
12566
|
-
const r =
|
|
12784
|
+
const r = h.getOrCreateDerivedSubtreeProfile(e);
|
|
12567
12785
|
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
|
|
12568
12786
|
reason: t,
|
|
12569
12787
|
hostId: r.hostId,
|
|
@@ -12606,7 +12824,7 @@ ${r}
|
|
|
12606
12824
|
* @returns subtree 全体を省略可能なら true
|
|
12607
12825
|
*/
|
|
12608
12826
|
static markFreshInitializationSkippable(e) {
|
|
12609
|
-
const t = e.getAttributeNames().some((n) =>
|
|
12827
|
+
const t = e.getAttributeNames().some((n) => h.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof T ? !h.markFreshInitializationSkippable(n) : n instanceof re ? n.hasDynamicContent() : !1), i = !t && !r;
|
|
12610
12828
|
return e.setFreshInitializationSkippable(i), i;
|
|
12611
12829
|
}
|
|
12612
12830
|
/**
|
|
@@ -12639,13 +12857,13 @@ ${r}
|
|
|
12639
12857
|
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
12640
12858
|
i && (i = String(i));
|
|
12641
12859
|
const n = e.getAttribute(`${l.prefix}each-key`), s = e.getAttribute(`${l.prefix}each-arg`), a = t.map(
|
|
12642
|
-
(x, U) =>
|
|
12860
|
+
(x, U) => h.createListKey(x, n ? String(n) : null, U)
|
|
12643
12861
|
), o = new Set(a), c = /* @__PURE__ */ new Map();
|
|
12644
12862
|
a.forEach((x) => {
|
|
12645
12863
|
c.set(x, (c.get(x) ?? 0) + 1);
|
|
12646
|
-
}), n && o.size !== a.length &&
|
|
12864
|
+
}), n && o.size !== a.length && h.warnDuplicateEachKey(String(n));
|
|
12647
12865
|
const u = [];
|
|
12648
|
-
let d = e.getChildren().filter((x) => x instanceof
|
|
12866
|
+
let d = e.getChildren().filter((x) => x instanceof T).filter(
|
|
12649
12867
|
(x) => !x.hasAttribute(`${l.prefix}each-before`) && !x.hasAttribute(`${l.prefix}each-after`)
|
|
12650
12868
|
);
|
|
12651
12869
|
const p = d.map((x) => x.getListKey()), g = /* @__PURE__ */ new Set();
|
|
@@ -12666,7 +12884,7 @@ ${r}
|
|
|
12666
12884
|
const K = A.get(U);
|
|
12667
12885
|
K ? K.push(x) : A.set(U, [x]);
|
|
12668
12886
|
});
|
|
12669
|
-
const I = e.getChildElementFragments().filter((x) => !g.has(x)),
|
|
12887
|
+
const I = e.getChildElementFragments().filter((x) => !g.has(x)), $ = I.filter(
|
|
12670
12888
|
(x) => x.hasAttribute(`${l.prefix}each-before`)
|
|
12671
12889
|
).length;
|
|
12672
12890
|
let W = Promise.resolve();
|
|
@@ -12676,9 +12894,9 @@ ${r}
|
|
|
12676
12894
|
const H = A.get(x)?.shift();
|
|
12677
12895
|
if (H) {
|
|
12678
12896
|
S = H;
|
|
12679
|
-
const B =
|
|
12897
|
+
const B = $ + U;
|
|
12680
12898
|
W = W.then(
|
|
12681
|
-
() =>
|
|
12899
|
+
() => h.updateRowFragment(
|
|
12682
12900
|
S,
|
|
12683
12901
|
K,
|
|
12684
12902
|
i,
|
|
@@ -12690,7 +12908,7 @@ ${r}
|
|
|
12690
12908
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
12691
12909
|
// ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
|
|
12692
12910
|
// される)で DOM の順序が古いまま残る。
|
|
12693
|
-
|
|
12911
|
+
h.repositionEachRow(
|
|
12694
12912
|
e,
|
|
12695
12913
|
S,
|
|
12696
12914
|
I,
|
|
@@ -12699,11 +12917,11 @@ ${r}
|
|
|
12699
12917
|
if (ie !== null && O.rowMove(
|
|
12700
12918
|
S.getTarget(),
|
|
12701
12919
|
x,
|
|
12702
|
-
ie -
|
|
12920
|
+
ie - $,
|
|
12703
12921
|
U
|
|
12704
|
-
), !(!te &&
|
|
12705
|
-
return
|
|
12706
|
-
() =>
|
|
12922
|
+
), !(!te && h.isRowLocalEachTemplate(e)))
|
|
12923
|
+
return h.evaluateAll(S).then(
|
|
12924
|
+
() => h.applyRowFormValues(e, S, K)
|
|
12707
12925
|
);
|
|
12708
12926
|
})
|
|
12709
12927
|
)
|
|
@@ -12711,9 +12929,9 @@ ${r}
|
|
|
12711
12929
|
);
|
|
12712
12930
|
} else {
|
|
12713
12931
|
S = r.clone();
|
|
12714
|
-
const B =
|
|
12932
|
+
const B = $ + U;
|
|
12715
12933
|
W = W.then(
|
|
12716
|
-
() =>
|
|
12934
|
+
() => h.updateRowFragment(
|
|
12717
12935
|
S,
|
|
12718
12936
|
K,
|
|
12719
12937
|
i,
|
|
@@ -12724,7 +12942,7 @@ ${r}
|
|
|
12724
12942
|
const te = I[B] ?? null;
|
|
12725
12943
|
return e.insertBefore(S, te).then(() => {
|
|
12726
12944
|
I.splice(B, 0, S);
|
|
12727
|
-
}).then(() =>
|
|
12945
|
+
}).then(() => h.initializeFreshEachRow(S)).then(() => h.applyRowFormValues(e, S, K)).then(() => {
|
|
12728
12946
|
O.rowAdd(S.getTarget(), x, R, K);
|
|
12729
12947
|
});
|
|
12730
12948
|
})
|
|
@@ -12773,7 +12991,7 @@ ${r}
|
|
|
12773
12991
|
*/
|
|
12774
12992
|
static warnExtraEachChildren(e) {
|
|
12775
12993
|
const t = e.getChildren().filter(
|
|
12776
|
-
(r) => r instanceof
|
|
12994
|
+
(r) => r instanceof T
|
|
12777
12995
|
).filter(
|
|
12778
12996
|
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
12779
12997
|
);
|
|
@@ -12795,7 +13013,7 @@ ${r}
|
|
|
12795
13013
|
* @returns 戻り値はありません。
|
|
12796
13014
|
*/
|
|
12797
13015
|
static warnDuplicateEachKey(e) {
|
|
12798
|
-
!
|
|
13016
|
+
!V.isEnabled() || h.WARNED_DUPLICATE_EACH_KEYS.has(e) || (h.WARNED_DUPLICATE_EACH_KEYS.add(e), m.warn(
|
|
12799
13017
|
"[Haori]",
|
|
12800
13018
|
`${l.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
12801
13019
|
));
|
|
@@ -12847,7 +13065,7 @@ ${r}
|
|
|
12847
13065
|
* @returns 反映完了の Promise
|
|
12848
13066
|
*/
|
|
12849
13067
|
static applyRowFormValues(e, t, r) {
|
|
12850
|
-
return !e.hasAttribute(`${l.prefix}form-list`) || !
|
|
13068
|
+
return !e.hasAttribute(`${l.prefix}form-list`) || !F.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : F.syncRowValues(t, r);
|
|
12851
13069
|
}
|
|
12852
13070
|
/**
|
|
12853
13071
|
* リスト比較用のキーを生成します。
|
|
@@ -12897,7 +13115,7 @@ ${r}
|
|
|
12897
13115
|
`Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
|
|
12898
13116
|
), Promise.resolve(!1);
|
|
12899
13117
|
r && (a[r] = i);
|
|
12900
|
-
const o = a, c =
|
|
13118
|
+
const o = a, c = h.createBindingSignature({
|
|
12901
13119
|
listKey: s,
|
|
12902
13120
|
bindingData: o
|
|
12903
13121
|
});
|
|
@@ -12915,7 +13133,7 @@ ${r}
|
|
|
12915
13133
|
const r = t.pop();
|
|
12916
13134
|
if (r.getChildElementFragments().forEach((i) => {
|
|
12917
13135
|
t.push(i);
|
|
12918
|
-
}), r !== e && !r.isMounted() &&
|
|
13136
|
+
}), r !== e && !r.isMounted() && h.hasMountSensitiveAttribute(r))
|
|
12919
13137
|
return !0;
|
|
12920
13138
|
}
|
|
12921
13139
|
return !1;
|
|
@@ -12962,7 +13180,7 @@ ${r}
|
|
|
12962
13180
|
if (t.has(e))
|
|
12963
13181
|
return `[Circular:${t.get(e)}]`;
|
|
12964
13182
|
const i = `array-${r.value}`;
|
|
12965
|
-
return r.value += 1, t.set(e, i), `[${e.map((n) =>
|
|
13183
|
+
return r.value += 1, t.set(e, i), `[${e.map((n) => h.createBindingSignature(n, t, r)).join(",")}]`;
|
|
12966
13184
|
}
|
|
12967
13185
|
if (typeof e == "object") {
|
|
12968
13186
|
if (t.has(e))
|
|
@@ -12971,7 +13189,7 @@ ${r}
|
|
|
12971
13189
|
r.value += 1, t.set(e, i);
|
|
12972
13190
|
const n = e;
|
|
12973
13191
|
return `{${Object.keys(n).sort().map(
|
|
12974
|
-
(s) => `${JSON.stringify(s)}:${
|
|
13192
|
+
(s) => `${JSON.stringify(s)}:${h.createBindingSignature(
|
|
12975
13193
|
n[s],
|
|
12976
13194
|
t,
|
|
12977
13195
|
r
|
|
@@ -12987,11 +13205,11 @@ ${r}
|
|
|
12987
13205
|
*/
|
|
12988
13206
|
static scheduleEvaluateAll(e) {
|
|
12989
13207
|
setTimeout(() => {
|
|
12990
|
-
|
|
13208
|
+
h.evaluateAll(e);
|
|
12991
13209
|
}, 100);
|
|
12992
13210
|
}
|
|
12993
13211
|
};
|
|
12994
|
-
|
|
13212
|
+
h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
12995
13213
|
"bind",
|
|
12996
13214
|
// `store` は `bind`(既定値)の後、`url-param` の前に置く。URL クエリで明示
|
|
12997
13215
|
// された値を保存済みの値より優先するため。
|
|
@@ -13001,7 +13219,7 @@ f.ATTRIBUTE_ALIAS_SUFFIX = "attr-", f.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
13001
13219
|
"derive",
|
|
13002
13220
|
"if",
|
|
13003
13221
|
"each"
|
|
13004
|
-
],
|
|
13222
|
+
], h.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
|
|
13005
13223
|
"bind",
|
|
13006
13224
|
"derive",
|
|
13007
13225
|
"derive-name",
|
|
@@ -13014,7 +13232,7 @@ f.ATTRIBUTE_ALIAS_SUFFIX = "attr-", f.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
13014
13232
|
// 条件は評価結果を DOM 属性へ書かない(式は実行時に生値から評価する)。
|
|
13015
13233
|
"validity",
|
|
13016
13234
|
"validity-message"
|
|
13017
|
-
],
|
|
13235
|
+
], h.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, h.ROW_LOCAL_EXPRESSION_ATTRIBUTES = /* @__PURE__ */ new Set(["each", "if", "derive"]), h.ROW_LOCAL_STATIC_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
13018
13236
|
"each-arg",
|
|
13019
13237
|
"each-key",
|
|
13020
13238
|
"each-index",
|
|
@@ -13034,8 +13252,8 @@ f.ATTRIBUTE_ALIAS_SUFFIX = "attr-", f.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
13034
13252
|
"store-type",
|
|
13035
13253
|
"enhance",
|
|
13036
13254
|
"enhance-new"
|
|
13037
|
-
]),
|
|
13038
|
-
let
|
|
13255
|
+
]), h.ROW_LOCAL_ROW_OPERATIONS = /* @__PURE__ */ new Set(["row-add", "row-remove", "row-prev", "row-next"]), h.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), h.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), h.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), h.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap(), h.EACH_RENDERED_CHANGE_FIRED = /* @__PURE__ */ new WeakSet(), h.EACH_RENDERED_CHANGE_WARNED = /* @__PURE__ */ new WeakSet(), h.WARNED_DUPLICATE_EACH_KEYS = /* @__PURE__ */ new Set(), h.ABSENT_PATH = Symbol("absent");
|
|
13256
|
+
let k = h;
|
|
13039
13257
|
const Ae = class Ae {
|
|
13040
13258
|
/**
|
|
13041
13259
|
* コンストラクタ。
|
|
@@ -13185,7 +13403,7 @@ const Ae = class Ae {
|
|
|
13185
13403
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
13186
13404
|
return;
|
|
13187
13405
|
const n = M.get(i);
|
|
13188
|
-
n instanceof
|
|
13406
|
+
n instanceof T && new ne(n, "on", t).run().catch((s) => {
|
|
13189
13407
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
13190
13408
|
});
|
|
13191
13409
|
});
|
|
@@ -13306,7 +13524,7 @@ const Ae = class Ae {
|
|
|
13306
13524
|
*/
|
|
13307
13525
|
markUserEditOnly(e) {
|
|
13308
13526
|
const t = M.get(e);
|
|
13309
|
-
t instanceof
|
|
13527
|
+
t instanceof T && t.markUserEdit();
|
|
13310
13528
|
}
|
|
13311
13529
|
/**
|
|
13312
13530
|
* `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
|
|
@@ -13322,13 +13540,13 @@ const Ae = class Ae {
|
|
|
13322
13540
|
*/
|
|
13323
13541
|
syncUserEdit(e, t) {
|
|
13324
13542
|
const r = M.get(e);
|
|
13325
|
-
if (r instanceof
|
|
13543
|
+
if (r instanceof T && (r.syncValue(), t ? r.markUserEditOnChange() : r.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
13326
13544
|
const i = document.getElementsByName(e.name);
|
|
13327
13545
|
for (const n of Array.from(i)) {
|
|
13328
13546
|
if (n === e || !(n instanceof HTMLInputElement) || n.type !== "radio" || n.form !== e.form)
|
|
13329
13547
|
continue;
|
|
13330
13548
|
const s = M.get(n);
|
|
13331
|
-
s instanceof
|
|
13549
|
+
s instanceof T && (s.syncValue(), s.markUserEdit());
|
|
13332
13550
|
}
|
|
13333
13551
|
}
|
|
13334
13552
|
}
|
|
@@ -13536,7 +13754,7 @@ const v = class v {
|
|
|
13536
13754
|
if (!t && !v.hasPollAttribute(e))
|
|
13537
13755
|
return;
|
|
13538
13756
|
const r = M.get(e);
|
|
13539
|
-
if (!(r instanceof
|
|
13757
|
+
if (!(r instanceof T) || !v.shouldObserve(r)) {
|
|
13540
13758
|
t && v.teardown(e, t);
|
|
13541
13759
|
return;
|
|
13542
13760
|
}
|
|
@@ -13714,7 +13932,7 @@ const v = class v {
|
|
|
13714
13932
|
await v.stop(e, t, "error");
|
|
13715
13933
|
return;
|
|
13716
13934
|
}
|
|
13717
|
-
if (
|
|
13935
|
+
if (i && v.isUntilSatisfied(t.fragment)) {
|
|
13718
13936
|
await v.stop(e, t, "until");
|
|
13719
13937
|
return;
|
|
13720
13938
|
}
|
|
@@ -13850,34 +14068,17 @@ const v = class v {
|
|
|
13850
14068
|
...i.getRawBindingData() ?? {},
|
|
13851
14069
|
_poll: r
|
|
13852
14070
|
};
|
|
13853
|
-
return
|
|
14071
|
+
return k.setBindingData(n, s, {
|
|
13854
14072
|
reflectToAttribute: !1,
|
|
13855
14073
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
13856
14074
|
// 解除しない)。
|
|
13857
14075
|
kind: "nonSupply",
|
|
13858
|
-
sequence:
|
|
14076
|
+
sequence: T.nextSequence()
|
|
13859
14077
|
});
|
|
13860
14078
|
})
|
|
13861
14079
|
).then(() => {
|
|
13862
14080
|
});
|
|
13863
14081
|
}
|
|
13864
|
-
/**
|
|
13865
|
-
* 手続きの実行で `_poll` が失われていた場合に注入し直します。
|
|
13866
|
-
*
|
|
13867
|
-
* `data-poll-bind` は既定でバインド先を全置換するため、注入先が bind 先と同じ
|
|
13868
|
-
* 要素(`data-poll-state` の値を省略して自要素を対象にした場合など)では、
|
|
13869
|
-
* 取得成功のたびに `_poll` が消えます。失われたときだけ書き戻すことで、毎回の
|
|
13870
|
-
* 注入による再評価コスト(`injectState()` のコメント参照)を避けながら状態を
|
|
13871
|
-
* 維持します。
|
|
13872
|
-
*
|
|
13873
|
-
* @param registration 登録情報
|
|
13874
|
-
* @returns 処理完了の Promise
|
|
13875
|
-
*/
|
|
13876
|
-
static async restoreStateIfCleared(e) {
|
|
13877
|
-
v.resolveStateFragments(e).some(
|
|
13878
|
-
(i) => (i.getRawBindingData() ?? {})._poll === void 0
|
|
13879
|
-
) && await v.injectState(e);
|
|
13880
|
-
}
|
|
13881
14082
|
/**
|
|
13882
14083
|
* `_poll` の注入先フラグメントを解決します。
|
|
13883
14084
|
*
|
|
@@ -13906,7 +14107,7 @@ const v = class v {
|
|
|
13906
14107
|
if (!a.isConnected)
|
|
13907
14108
|
return;
|
|
13908
14109
|
const o = M.get(a);
|
|
13909
|
-
o instanceof
|
|
14110
|
+
o instanceof T && s.push(o);
|
|
13910
14111
|
}), s;
|
|
13911
14112
|
}
|
|
13912
14113
|
/**
|
|
@@ -14054,11 +14255,11 @@ v.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
14054
14255
|
"state"
|
|
14055
14256
|
]), v.DEFAULT_INTERVAL_MS = 5e3, v.MIN_INTERVAL_MS = 100, v.registrations = /* @__PURE__ */ new Map(), v.visibilityListener = null;
|
|
14056
14257
|
let be = v;
|
|
14057
|
-
const Vt = "0.47.
|
|
14258
|
+
const Vt = "0.47.4";
|
|
14058
14259
|
function qt(y) {
|
|
14059
14260
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => y()) : Promise.resolve().then(y);
|
|
14060
14261
|
}
|
|
14061
|
-
const
|
|
14262
|
+
const L = class L {
|
|
14062
14263
|
/**
|
|
14063
14264
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
14064
14265
|
*
|
|
@@ -14077,8 +14278,8 @@ const P = class P {
|
|
|
14077
14278
|
* @param root 走査の起点ノード
|
|
14078
14279
|
*/
|
|
14079
14280
|
static syncTree(e) {
|
|
14080
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
14081
|
-
|
|
14281
|
+
(e instanceof Element || e instanceof DocumentFragment) && (L.isHtmlElement(e) && L.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
14282
|
+
L.syncElement(t);
|
|
14082
14283
|
}));
|
|
14083
14284
|
}
|
|
14084
14285
|
/**
|
|
@@ -14088,42 +14289,42 @@ const P = class P {
|
|
|
14088
14289
|
* @param element 対象要素
|
|
14089
14290
|
*/
|
|
14090
14291
|
static syncElement(e) {
|
|
14091
|
-
const t =
|
|
14092
|
-
if (!(r instanceof
|
|
14093
|
-
t && (t.observer.disconnect(),
|
|
14292
|
+
const t = L.registrations.get(e), r = M.get(e);
|
|
14293
|
+
if (!(r instanceof T) || !L.shouldObserve(r)) {
|
|
14294
|
+
t && (t.observer.disconnect(), L.registrations.delete(e));
|
|
14094
14295
|
return;
|
|
14095
14296
|
}
|
|
14096
14297
|
if (typeof IntersectionObserver > "u")
|
|
14097
14298
|
return;
|
|
14098
|
-
const i =
|
|
14299
|
+
const i = L.resolveVarName(r);
|
|
14099
14300
|
if (i === "") {
|
|
14100
|
-
t && (t.observer.disconnect(),
|
|
14301
|
+
t && (t.observer.disconnect(), L.registrations.delete(e)), m.warn(
|
|
14101
14302
|
"[Haori]",
|
|
14102
14303
|
'data-each-visible requires a variable name (e.g. data-each-visible="visibleRange").'
|
|
14103
14304
|
);
|
|
14104
14305
|
return;
|
|
14105
14306
|
}
|
|
14106
|
-
const n =
|
|
14307
|
+
const n = L.resolveRoot(r), s = L.resolveRootMargin(r);
|
|
14107
14308
|
if (t && t.observer.root === n && t.observer.rootMargin === s && t.varName === i) {
|
|
14108
|
-
t.fragment = r,
|
|
14309
|
+
t.fragment = r, L.refreshRows(t);
|
|
14109
14310
|
return;
|
|
14110
14311
|
}
|
|
14111
|
-
t && (t.observer.disconnect(),
|
|
14312
|
+
t && (t.observer.disconnect(), L.registrations.delete(e));
|
|
14112
14313
|
const a = new IntersectionObserver(
|
|
14113
14314
|
(c) => {
|
|
14114
|
-
const u =
|
|
14315
|
+
const u = L.registrations.get(e);
|
|
14115
14316
|
if (!u)
|
|
14116
14317
|
return;
|
|
14117
14318
|
let d = !1;
|
|
14118
14319
|
c.forEach((p) => {
|
|
14119
14320
|
const g = p.target;
|
|
14120
14321
|
u.observedRows.has(g) && (p.isIntersecting ? u.visibleRows.has(g) || (u.visibleRows.add(g), d = !0) : u.visibleRows.delete(g) && (d = !0));
|
|
14121
|
-
}), d &&
|
|
14322
|
+
}), d && L.scheduleCompute(u);
|
|
14122
14323
|
},
|
|
14123
14324
|
{
|
|
14124
14325
|
root: n,
|
|
14125
14326
|
rootMargin: s,
|
|
14126
|
-
threshold:
|
|
14327
|
+
threshold: L.THRESHOLD
|
|
14127
14328
|
}
|
|
14128
14329
|
), o = {
|
|
14129
14330
|
fragment: r,
|
|
@@ -14136,7 +14337,7 @@ const P = class P {
|
|
|
14136
14337
|
scheduled: !1,
|
|
14137
14338
|
lastSnapshot: null
|
|
14138
14339
|
};
|
|
14139
|
-
|
|
14340
|
+
L.registrations.set(e, o), L.refreshRows(o);
|
|
14140
14341
|
}
|
|
14141
14342
|
/**
|
|
14142
14343
|
* 指定ノード配下の監視登録を解放します。
|
|
@@ -14144,22 +14345,22 @@ const P = class P {
|
|
|
14144
14345
|
* @param root 走査の起点ノード
|
|
14145
14346
|
*/
|
|
14146
14347
|
static cleanupTree(e) {
|
|
14147
|
-
if (
|
|
14148
|
-
const t =
|
|
14149
|
-
t && (t.observer.disconnect(),
|
|
14348
|
+
if (L.isHtmlElement(e)) {
|
|
14349
|
+
const t = L.registrations.get(e);
|
|
14350
|
+
t && (t.observer.disconnect(), L.registrations.delete(e));
|
|
14150
14351
|
}
|
|
14151
14352
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
14152
|
-
const r =
|
|
14153
|
-
r && (r.observer.disconnect(),
|
|
14353
|
+
const r = L.registrations.get(t);
|
|
14354
|
+
r && (r.observer.disconnect(), L.registrations.delete(t));
|
|
14154
14355
|
});
|
|
14155
14356
|
}
|
|
14156
14357
|
/**
|
|
14157
14358
|
* すべての監視登録を解放します。
|
|
14158
14359
|
*/
|
|
14159
14360
|
static disconnectAll() {
|
|
14160
|
-
|
|
14361
|
+
L.registrations.forEach((e) => {
|
|
14161
14362
|
e.observer.disconnect();
|
|
14162
|
-
}),
|
|
14363
|
+
}), L.registrations.clear();
|
|
14163
14364
|
}
|
|
14164
14365
|
/**
|
|
14165
14366
|
* 監視対象(`data-each` かつ `data-each-visible`)かどうかを判定します。
|
|
@@ -14194,7 +14395,7 @@ const P = class P {
|
|
|
14194
14395
|
if (typeof r != "string" || r.trim() === "")
|
|
14195
14396
|
return null;
|
|
14196
14397
|
const i = X.query(r, t, document);
|
|
14197
|
-
return
|
|
14398
|
+
return L.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
|
|
14198
14399
|
}
|
|
14199
14400
|
/**
|
|
14200
14401
|
* rootMargin を解決します。
|
|
@@ -14204,7 +14405,7 @@ const P = class P {
|
|
|
14204
14405
|
*/
|
|
14205
14406
|
static resolveRootMargin(e) {
|
|
14206
14407
|
const t = `${l.prefix}each-visible-margin`, r = e.getAttribute(t);
|
|
14207
|
-
return r === null || r === !1 || r === "" ?
|
|
14408
|
+
return r === null || r === !1 || r === "" ? L.DEFAULT_ROOT_MARGIN : String(r);
|
|
14208
14409
|
}
|
|
14209
14410
|
/**
|
|
14210
14411
|
* コンテナ直下の実際の行要素(`each-before`/`each-after` を除く)を描画順で返します。
|
|
@@ -14214,7 +14415,7 @@ const P = class P {
|
|
|
14214
14415
|
*/
|
|
14215
14416
|
static realRowElements(e) {
|
|
14216
14417
|
return e.getChildren().filter(
|
|
14217
|
-
(t) => t instanceof
|
|
14418
|
+
(t) => t instanceof T && !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
14218
14419
|
).map((t) => t.getTarget());
|
|
14219
14420
|
}
|
|
14220
14421
|
/**
|
|
@@ -14224,12 +14425,12 @@ const P = class P {
|
|
|
14224
14425
|
* @param registration 対象の登録
|
|
14225
14426
|
*/
|
|
14226
14427
|
static refreshRows(e) {
|
|
14227
|
-
const t =
|
|
14428
|
+
const t = L.realRowElements(e.fragment), r = new Set(t);
|
|
14228
14429
|
for (const i of [...e.observedRows])
|
|
14229
14430
|
r.has(i) || (e.observer.unobserve(i), e.observedRows.delete(i), e.visibleRows.delete(i));
|
|
14230
14431
|
for (const i of t)
|
|
14231
14432
|
e.observedRows.has(i) || (e.observer.observe(i), e.observedRows.add(i));
|
|
14232
|
-
|
|
14433
|
+
L.scheduleCompute(e);
|
|
14233
14434
|
}
|
|
14234
14435
|
/**
|
|
14235
14436
|
* 次フレームでの集計・公開を予約します(多発する交差イベントを 1 回にまとめる)。
|
|
@@ -14240,7 +14441,7 @@ const P = class P {
|
|
|
14240
14441
|
e.scheduled || (e.scheduled = !0, qt(() => {
|
|
14241
14442
|
e.scheduled = !1;
|
|
14242
14443
|
const t = e.fragment.getTarget();
|
|
14243
|
-
|
|
14444
|
+
L.registrations.get(t) === e && L.computeAndPublish(e);
|
|
14244
14445
|
}));
|
|
14245
14446
|
}
|
|
14246
14447
|
/**
|
|
@@ -14249,7 +14450,7 @@ const P = class P {
|
|
|
14249
14450
|
* @param registration 対象の登録
|
|
14250
14451
|
*/
|
|
14251
14452
|
static computeAndPublish(e) {
|
|
14252
|
-
const t =
|
|
14453
|
+
const t = L.realRowElements(e.fragment), r = /* @__PURE__ */ new Map();
|
|
14253
14454
|
t.forEach((a, o) => r.set(a, o));
|
|
14254
14455
|
const i = [];
|
|
14255
14456
|
for (const a of e.visibleRows) {
|
|
@@ -14282,7 +14483,7 @@ const P = class P {
|
|
|
14282
14483
|
};
|
|
14283
14484
|
}
|
|
14284
14485
|
const s = JSON.stringify(n);
|
|
14285
|
-
s !== e.lastSnapshot && (e.lastSnapshot = s,
|
|
14486
|
+
s !== e.lastSnapshot && (e.lastSnapshot = s, L.publish(e, n));
|
|
14286
14487
|
}
|
|
14287
14488
|
/**
|
|
14288
14489
|
* 可視範囲スナップショットを最近接の上位 `data-bind` スコープへ公開します。
|
|
@@ -14291,7 +14492,7 @@ const P = class P {
|
|
|
14291
14492
|
* @param snapshot 公開するスナップショット
|
|
14292
14493
|
*/
|
|
14293
14494
|
static publish(e, t) {
|
|
14294
|
-
const r =
|
|
14495
|
+
const r = L.resolveBindOwner(e.fragment);
|
|
14295
14496
|
if (!r) {
|
|
14296
14497
|
m.warn(
|
|
14297
14498
|
"[Haori]",
|
|
@@ -14304,13 +14505,13 @@ const P = class P {
|
|
|
14304
14505
|
};
|
|
14305
14506
|
n[e.varName] = { ...t };
|
|
14306
14507
|
const s = e.fragment.getTarget(), a = i === s ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([e.fragment]);
|
|
14307
|
-
|
|
14508
|
+
k.setBindingData(i, n, {
|
|
14308
14509
|
skipFragments: a,
|
|
14309
14510
|
reflectToAttribute: !1,
|
|
14310
14511
|
// 可視範囲の公開は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
14311
14512
|
// 解除しない)。
|
|
14312
14513
|
kind: "nonSupply",
|
|
14313
|
-
sequence:
|
|
14514
|
+
sequence: T.nextSequence()
|
|
14314
14515
|
}).catch((o) => {
|
|
14315
14516
|
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
14316
14517
|
});
|
|
@@ -14333,8 +14534,8 @@ const P = class P {
|
|
|
14333
14534
|
return e.hasAttribute(t) ? e : null;
|
|
14334
14535
|
}
|
|
14335
14536
|
};
|
|
14336
|
-
|
|
14337
|
-
let fe =
|
|
14537
|
+
L.THRESHOLD = 0, L.DEFAULT_ROOT_MARGIN = "0px", L.registrations = /* @__PURE__ */ new Map();
|
|
14538
|
+
let fe = L;
|
|
14338
14539
|
const Y = class Y {
|
|
14339
14540
|
/**
|
|
14340
14541
|
* 既存の MutationObserver をすべて停止します。
|
|
@@ -14351,15 +14552,15 @@ const Y = class Y {
|
|
|
14351
14552
|
static async init() {
|
|
14352
14553
|
if (Y._initialized)
|
|
14353
14554
|
return;
|
|
14354
|
-
Y._initialized = !0, Y.disconnectMutationObservers(),
|
|
14555
|
+
Y._initialized = !0, Y.disconnectMutationObservers(), T.setPendingMutationFlusher(() => {
|
|
14355
14556
|
Y.flushPendingMutations();
|
|
14356
14557
|
});
|
|
14357
14558
|
const e = new Ue();
|
|
14358
14559
|
Y._dispatcher = e, e.startDeferred();
|
|
14359
14560
|
try {
|
|
14360
14561
|
const t = await Promise.allSettled([
|
|
14361
|
-
|
|
14362
|
-
|
|
14562
|
+
k.scan(document.head),
|
|
14563
|
+
k.scan(document.body)
|
|
14363
14564
|
]), [r, i] = t;
|
|
14364
14565
|
r.status !== "fulfilled" && m.error(
|
|
14365
14566
|
"[Haori]",
|
|
@@ -14444,7 +14645,7 @@ const Y = class Y {
|
|
|
14444
14645
|
const r = t.filter(Y.isBindAttributeRecord), i = t.filter(
|
|
14445
14646
|
(n) => !Y.isBindAttributeRecord(n)
|
|
14446
14647
|
);
|
|
14447
|
-
r.length > 0 && Y.processMutations(r,
|
|
14648
|
+
r.length > 0 && Y.processMutations(r, T.nextSequence()), i.length > 0 && Promise.resolve().then(() => {
|
|
14448
14649
|
Y.processMutations(i);
|
|
14449
14650
|
});
|
|
14450
14651
|
}
|
|
@@ -14474,9 +14675,9 @@ const Y = class Y {
|
|
|
14474
14675
|
switch (r.type) {
|
|
14475
14676
|
case "attributes": {
|
|
14476
14677
|
const i = r.target;
|
|
14477
|
-
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(ue) && (r.attributeName === "disabled" || r.attributeName === ue) || r.attributeName && (r.attributeName === `${l.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${l.prefix}if-false`)) || r.attributeName &&
|
|
14678
|
+
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(ue) && (r.attributeName === "disabled" || r.attributeName === ue) || r.attributeName && (r.attributeName === `${l.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${l.prefix}if-false`)) || r.attributeName && k.isAliasedAttributeReflection(i, r.attributeName))
|
|
14478
14679
|
break;
|
|
14479
|
-
|
|
14680
|
+
k.setAttribute(
|
|
14480
14681
|
i,
|
|
14481
14682
|
r.attributeName,
|
|
14482
14683
|
i.getAttribute(r.attributeName),
|
|
@@ -14487,14 +14688,14 @@ const Y = class Y {
|
|
|
14487
14688
|
}
|
|
14488
14689
|
case "childList": {
|
|
14489
14690
|
Array.from(r.removedNodes).forEach((i) => {
|
|
14490
|
-
ye.cleanupTree(i), be.cleanupTree(i), fe.cleanupTree(i),
|
|
14691
|
+
ye.cleanupTree(i), be.cleanupTree(i), fe.cleanupTree(i), k.removeNode(i);
|
|
14491
14692
|
}), Array.from(r.addedNodes).forEach((i) => {
|
|
14492
|
-
i.parentElement instanceof Element && (
|
|
14693
|
+
i.parentElement instanceof Element && (k.addNode(i.parentElement, i), ye.syncTree(i), be.syncTree(i), fe.syncTree(i));
|
|
14493
14694
|
}), r.target instanceof Element && fe.syncElement(r.target);
|
|
14494
14695
|
break;
|
|
14495
14696
|
}
|
|
14496
14697
|
case "characterData": {
|
|
14497
|
-
r.target instanceof Text || r.target instanceof Comment ?
|
|
14698
|
+
r.target instanceof Text || r.target instanceof Comment ? k.changeText(r.target, r.target.textContent) : m.warn(
|
|
14498
14699
|
"[Haori]",
|
|
14499
14700
|
"Unsupported character data type:",
|
|
14500
14701
|
r.target
|
|
@@ -14515,10 +14716,10 @@ let Me = Y;
|
|
|
14515
14716
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Me.init) : Me.init();
|
|
14516
14717
|
const Wt = () => ve.waitForRenders(), jt = ve.enhancers;
|
|
14517
14718
|
export {
|
|
14518
|
-
|
|
14719
|
+
k as Core,
|
|
14519
14720
|
se as Enhance,
|
|
14520
14721
|
l as Env,
|
|
14521
|
-
|
|
14722
|
+
F as Form,
|
|
14522
14723
|
M as Fragment,
|
|
14523
14724
|
ve as Haori,
|
|
14524
14725
|
m as Log,
|