haori 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +2 -2
- package/README.md +2 -2
- package/dist/haori.cjs.js +17 -17
- package/dist/haori.es.js +990 -697
- package/dist/haori.iife.js +17 -17
- package/dist/index.d.ts +81 -4
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ye = class ye {
|
|
2
2
|
/**
|
|
3
3
|
* 開発モードの状態を取得します。
|
|
4
4
|
*
|
|
5
5
|
* @returns 開発モードならtrue、そうでなければfalse
|
|
6
6
|
*/
|
|
7
7
|
static isEnabled() {
|
|
8
|
-
return
|
|
8
|
+
return ye.devMode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* 開発モードを有効化します。
|
|
12
12
|
*/
|
|
13
13
|
static enable() {
|
|
14
|
-
|
|
14
|
+
ye.devMode = !0;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* 開発モードを無効化します。
|
|
18
18
|
*/
|
|
19
19
|
static disable() {
|
|
20
|
-
|
|
20
|
+
ye.devMode = !1;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* 開発モードを切り替えます。
|
|
@@ -25,11 +25,11 @@ const me = class me {
|
|
|
25
25
|
* @param enabled trueで有効化、falseで無効化
|
|
26
26
|
*/
|
|
27
27
|
static set(e) {
|
|
28
|
-
|
|
28
|
+
ye.devMode = e;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
let
|
|
31
|
+
ye.devMode = !1;
|
|
32
|
+
let V = ye;
|
|
33
33
|
const Oe = "embedded";
|
|
34
34
|
function Ze(b) {
|
|
35
35
|
return b === "embedded" || b === "demo";
|
|
@@ -96,15 +96,15 @@ const ee = class ee {
|
|
|
96
96
|
}
|
|
97
97
|
if (e instanceof HTMLScriptElement && e.hasAttribute(`${ee._prefix}dev`)) {
|
|
98
98
|
const r = (e.getAttribute(`${ee._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,12 +149,13 @@ class m {
|
|
|
149
149
|
console.error(e, ...t);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:",
|
|
152
|
+
const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:", k = class k {
|
|
153
153
|
/**
|
|
154
154
|
* 外部ライブラリ連携を登録します。
|
|
155
155
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
156
|
+
* 適用を保留していた要素(Haori の適用処理が一度通った要素)へ遡って適用する
|
|
157
|
+
* ため、スクリプトの読み込み順に依存しません(登録の時点で `document.body` 配下を
|
|
158
|
+
* 走査します)。まだ Haori が走査していない要素には、走査の最後に適用します。
|
|
158
159
|
*
|
|
159
160
|
* @param name `data-enhance` に書く名前
|
|
160
161
|
* @param enhancer 連携の定義
|
|
@@ -170,7 +171,19 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
170
171
|
m.error("[Haori]", `Enhancer "${r}" must have an init function.`);
|
|
171
172
|
return;
|
|
172
173
|
}
|
|
173
|
-
|
|
174
|
+
k.enhancers.set(r, t), k.warnedUnknownNames.delete(r), typeof document < "u" && document.body && k.forEachTarget(document.body, (i) => {
|
|
175
|
+
k.visited.has(i) && k.applyElement(i);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 連携の呼び出しが起こした DOM 変更を取り込む処理を登録します。
|
|
180
|
+
*
|
|
181
|
+
* @internal `Observer` が、監視の開始前の取り込みに使います。
|
|
182
|
+
* @param capture 呼び出しを包んで実行する処理。解除する場合は `null`
|
|
183
|
+
* @returns 戻り値はありません。
|
|
184
|
+
*/
|
|
185
|
+
static setMutationCapture(e) {
|
|
186
|
+
k.mutationCapture = e;
|
|
174
187
|
}
|
|
175
188
|
/**
|
|
176
189
|
* 登録済みの連携かどうかを返します。
|
|
@@ -179,7 +192,7 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
179
192
|
* @returns 登録済みなら true
|
|
180
193
|
*/
|
|
181
194
|
static has(e) {
|
|
182
|
-
return
|
|
195
|
+
return k.enhancers.has(e);
|
|
183
196
|
}
|
|
184
197
|
/**
|
|
185
198
|
* 対象要素とその子孫へ、まだ適用していない連携を適用します。
|
|
@@ -190,8 +203,8 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
190
203
|
* @returns 戻り値はありません。
|
|
191
204
|
*/
|
|
192
205
|
static applySubtree(e) {
|
|
193
|
-
|
|
194
|
-
|
|
206
|
+
k.forEachTarget(e, (t) => {
|
|
207
|
+
k.visited.add(t), k.applyElement(t);
|
|
195
208
|
});
|
|
196
209
|
}
|
|
197
210
|
/**
|
|
@@ -204,8 +217,8 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
204
217
|
* @returns 戻り値はありません。
|
|
205
218
|
*/
|
|
206
219
|
static refreshSubtree(e) {
|
|
207
|
-
|
|
208
|
-
|
|
220
|
+
k.forEachTarget(e, (t) => {
|
|
221
|
+
k.refreshElement(t);
|
|
209
222
|
});
|
|
210
223
|
}
|
|
211
224
|
/**
|
|
@@ -217,8 +230,8 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
217
230
|
* @returns 戻り値はありません。
|
|
218
231
|
*/
|
|
219
232
|
static destroySubtree(e) {
|
|
220
|
-
|
|
221
|
-
|
|
233
|
+
k.forEachTarget(e, (t) => {
|
|
234
|
+
k.destroyElement(t);
|
|
222
235
|
});
|
|
223
236
|
}
|
|
224
237
|
/**
|
|
@@ -243,27 +256,27 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
243
256
|
* @returns 戻り値はありません。
|
|
244
257
|
*/
|
|
245
258
|
static applyElement(e) {
|
|
246
|
-
const t =
|
|
247
|
-
|
|
259
|
+
const t = k.instances.get(e) ?? null;
|
|
260
|
+
k.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
248
261
|
if (t?.has(r))
|
|
249
262
|
return;
|
|
250
|
-
const i =
|
|
263
|
+
const i = k.enhancers.get(r);
|
|
251
264
|
if (!i) {
|
|
252
|
-
|
|
265
|
+
k.warnUnknownName(r);
|
|
253
266
|
return;
|
|
254
267
|
}
|
|
255
|
-
|
|
268
|
+
k.run(`enhance "${r}"`, () => {
|
|
256
269
|
const n = i.init(e);
|
|
257
|
-
|
|
270
|
+
k.appliedKeys(e).set(r, n);
|
|
258
271
|
});
|
|
259
|
-
}),
|
|
272
|
+
}), k.names(e, `${l.prefix}enhance-new`).forEach((r) => {
|
|
260
273
|
const i = `${je}${r}`;
|
|
261
|
-
if (
|
|
274
|
+
if (k.instances.get(e)?.has(i))
|
|
262
275
|
return;
|
|
263
|
-
const n =
|
|
264
|
-
n !== null &&
|
|
276
|
+
const n = k.resolveGlobal(r);
|
|
277
|
+
n !== null && k.run(`enhance-new "${r}"`, () => {
|
|
265
278
|
const s = new n(e);
|
|
266
|
-
|
|
279
|
+
k.appliedKeys(e).set(i, s);
|
|
267
280
|
});
|
|
268
281
|
});
|
|
269
282
|
}
|
|
@@ -274,15 +287,15 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
274
287
|
* @returns 戻り値はありません。
|
|
275
288
|
*/
|
|
276
289
|
static refreshElement(e) {
|
|
277
|
-
const t =
|
|
278
|
-
|
|
290
|
+
const t = k.instances.get(e);
|
|
291
|
+
k.names(e, `${l.prefix}enhance`).forEach((r) => {
|
|
279
292
|
if (!t || !t.has(r))
|
|
280
293
|
return;
|
|
281
|
-
const i =
|
|
282
|
-
!i || typeof i.refresh != "function" ||
|
|
294
|
+
const i = k.enhancers.get(r);
|
|
295
|
+
!i || typeof i.refresh != "function" || k.run(`enhance "${r}" refresh`, () => {
|
|
283
296
|
i.refresh(e, t.get(r));
|
|
284
297
|
});
|
|
285
|
-
}),
|
|
298
|
+
}), k.applyElement(e);
|
|
286
299
|
}
|
|
287
300
|
/**
|
|
288
301
|
* 1 要素の連携を破棄します。
|
|
@@ -291,15 +304,15 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
291
304
|
* @returns 戻り値はありません。
|
|
292
305
|
*/
|
|
293
306
|
static destroyElement(e) {
|
|
294
|
-
const t =
|
|
307
|
+
const t = k.instances.get(e);
|
|
295
308
|
t && (t.forEach((r, i) => {
|
|
296
309
|
if (i.startsWith(je))
|
|
297
310
|
return;
|
|
298
|
-
const n =
|
|
299
|
-
!n || typeof n.destroy != "function" ||
|
|
311
|
+
const n = k.enhancers.get(i);
|
|
312
|
+
!n || typeof n.destroy != "function" || k.run(`enhance "${i}" destroy`, () => {
|
|
300
313
|
n.destroy(e, r);
|
|
301
314
|
});
|
|
302
|
-
}),
|
|
315
|
+
}), k.instances.delete(e));
|
|
303
316
|
}
|
|
304
317
|
/**
|
|
305
318
|
* 要素の適用状況を返します(無ければ作成します)。
|
|
@@ -308,11 +321,11 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
308
321
|
* @returns キー → インスタンスの対応
|
|
309
322
|
*/
|
|
310
323
|
static appliedKeys(e) {
|
|
311
|
-
const t =
|
|
324
|
+
const t = k.instances.get(e);
|
|
312
325
|
if (t)
|
|
313
326
|
return t;
|
|
314
327
|
const r = /* @__PURE__ */ new Map();
|
|
315
|
-
return
|
|
328
|
+
return k.instances.set(e, r), r;
|
|
316
329
|
}
|
|
317
330
|
/**
|
|
318
331
|
* 空白区切りの属性値を名前の一覧へ分解します。
|
|
@@ -353,7 +366,7 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
353
366
|
if (t = t[r], t === void 0)
|
|
354
367
|
break;
|
|
355
368
|
}
|
|
356
|
-
return typeof t != "function" ? (
|
|
369
|
+
return typeof t != "function" ? (V.isEnabled() && !k.warnedMissingGlobals.has(e) && (k.warnedMissingGlobals.add(e), m.warn(
|
|
357
370
|
"[Haori]",
|
|
358
371
|
`${l.prefix}enhance-new could not resolve the global reference (load the library before Haori runs): ${e}`
|
|
359
372
|
)), null) : t;
|
|
@@ -365,7 +378,7 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
365
378
|
* @returns 戻り値はありません。
|
|
366
379
|
*/
|
|
367
380
|
static warnUnknownName(e) {
|
|
368
|
-
!
|
|
381
|
+
!V.isEnabled() || k.warnedUnknownNames.has(e) || (k.warnedUnknownNames.add(e), m.warn(
|
|
369
382
|
"[Haori]",
|
|
370
383
|
`Enhancer "${e}" is not registered yet; the declaration is kept pending and applied when it is registered (Haori.enhancers.register('${e}', {init(el) {...}})).`
|
|
371
384
|
));
|
|
@@ -374,21 +387,25 @@ const bt = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, je = "new:
|
|
|
374
387
|
* 連携の呼び出しを例外から保護して実行します。
|
|
375
388
|
*
|
|
376
389
|
* 1 つの連携の失敗で他の要素の適用や描画を止めないため、例外は記録して続行します。
|
|
390
|
+
* 取り込みの処理(`setMutationCapture()`)が登録されていれば、それで包んで呼び出します。
|
|
377
391
|
*
|
|
378
392
|
* @param label ログに出す処理名
|
|
379
393
|
* @param callback 実行する処理
|
|
380
394
|
* @returns 戻り値はありません。
|
|
381
395
|
*/
|
|
382
396
|
static run(e, t) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
397
|
+
const r = () => {
|
|
398
|
+
try {
|
|
399
|
+
t();
|
|
400
|
+
} catch (i) {
|
|
401
|
+
m.error("[Haori]", `${e} failed:`, i);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
k.mutationCapture ? k.mutationCapture(r) : r();
|
|
388
405
|
}
|
|
389
406
|
};
|
|
390
|
-
|
|
391
|
-
let ae =
|
|
407
|
+
k.enhancers = /* @__PURE__ */ new Map(), k.instances = /* @__PURE__ */ new WeakMap(), k.warnedUnknownNames = /* @__PURE__ */ new Set(), k.warnedMissingGlobals = /* @__PURE__ */ new Set(), k.visited = /* @__PURE__ */ new WeakSet(), k.mutationCapture = null;
|
|
408
|
+
let ae = k;
|
|
392
409
|
const Qe = "yyyy/MM/dd HH:mm", Et = "en-US", Ke = 1e4;
|
|
393
410
|
function de(b) {
|
|
394
411
|
return String(b).padStart(2, "0");
|
|
@@ -546,7 +563,7 @@ function st(b, e, t = {}) {
|
|
|
546
563
|
return c;
|
|
547
564
|
}
|
|
548
565
|
const vt = /^(\d{4})-(\d{1,2})$/, St = 1200;
|
|
549
|
-
function
|
|
566
|
+
function Fe(b, e) {
|
|
550
567
|
const t = Number(b);
|
|
551
568
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
552
569
|
}
|
|
@@ -586,15 +603,15 @@ function ot(b, e) {
|
|
|
586
603
|
const t = { start: 0, end: 0, total: 0, empty: !0 };
|
|
587
604
|
if (!b || typeof b != "object")
|
|
588
605
|
return t;
|
|
589
|
-
const r = b, i =
|
|
606
|
+
const r = b, i = Fe(r.totalElements ?? r.totalCount, 0);
|
|
590
607
|
if (i <= 0)
|
|
591
608
|
return t;
|
|
592
|
-
const n = Math.max(0,
|
|
609
|
+
const n = Math.max(0, Fe(r.number, 0)), s = Math.max(0, Fe(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
|
|
593
610
|
let c;
|
|
594
611
|
if (e !== void 0 && Number.isFinite(e))
|
|
595
612
|
c = Math.max(0, Math.trunc(e));
|
|
596
613
|
else {
|
|
597
|
-
const d =
|
|
614
|
+
const d = Fe(r.numberOfElements, NaN);
|
|
598
615
|
c = Number.isFinite(d) ? d : Math.min(s, i - a);
|
|
599
616
|
}
|
|
600
617
|
const u = Math.min(a + c, i);
|
|
@@ -794,7 +811,7 @@ const We = class We {
|
|
|
794
811
|
}
|
|
795
812
|
};
|
|
796
813
|
We.ASYNC_QUEUE = new Ve();
|
|
797
|
-
let
|
|
814
|
+
let K = We;
|
|
798
815
|
const T = class T {
|
|
799
816
|
/**
|
|
800
817
|
* ストレージを、参照が例外になる環境でも安全に読み出します。
|
|
@@ -941,7 +958,7 @@ const T = class T {
|
|
|
941
958
|
* @returns 戻り値はありません。
|
|
942
959
|
*/
|
|
943
960
|
static reportUnusableBindingKeys(e) {
|
|
944
|
-
if (e.length === 0 || !
|
|
961
|
+
if (e.length === 0 || !V.isEnabled())
|
|
945
962
|
return;
|
|
946
963
|
const t = e.filter(
|
|
947
964
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
@@ -1239,7 +1256,7 @@ let ${e.join(", ")};`;
|
|
|
1239
1256
|
);
|
|
1240
1257
|
return;
|
|
1241
1258
|
}
|
|
1242
|
-
|
|
1259
|
+
V.isEnabled() && (e.forEach((r) => {
|
|
1243
1260
|
this.pendingUnresolvedIdentifiers.add(r);
|
|
1244
1261
|
}), this.scheduleUnresolvedIdentifierReport());
|
|
1245
1262
|
}
|
|
@@ -1250,7 +1267,7 @@ let ${e.join(", ")};`;
|
|
|
1250
1267
|
* @return 戻り値はありません。
|
|
1251
1268
|
*/
|
|
1252
1269
|
static scheduleUnresolvedIdentifierReport() {
|
|
1253
|
-
this.unresolvedReportScheduled || (this.unresolvedReportScheduled = !0,
|
|
1270
|
+
this.unresolvedReportScheduled || (this.unresolvedReportScheduled = !0, K.waitForIdle().then(() => {
|
|
1254
1271
|
this.unresolvedReportScheduled = !1, this.reportUnresolvedIdentifiers();
|
|
1255
1272
|
}));
|
|
1256
1273
|
}
|
|
@@ -1296,7 +1313,7 @@ let ${e.join(", ")};`;
|
|
|
1296
1313
|
* @return 戻り値はありません。
|
|
1297
1314
|
*/
|
|
1298
1315
|
static recordRowScopeIdentifiers(e) {
|
|
1299
|
-
if (
|
|
1316
|
+
if (V.isEnabled())
|
|
1300
1317
|
for (const t of e)
|
|
1301
1318
|
typeof t == "string" && t !== "" && this.rowScopeIdentifiers.add(t);
|
|
1302
1319
|
}
|
|
@@ -1317,7 +1334,7 @@ let ${e.join(", ")};`;
|
|
|
1317
1334
|
this.pendingScopeMissingIdentifiers.delete(t);
|
|
1318
1335
|
return;
|
|
1319
1336
|
}
|
|
1320
|
-
this.pendingScopeMissingIdentifiers.set(t, new Set(e)), !this.scopeMissingReportScheduled && (this.scopeMissingReportScheduled = !0,
|
|
1337
|
+
this.pendingScopeMissingIdentifiers.set(t, new Set(e)), !this.scopeMissingReportScheduled && (this.scopeMissingReportScheduled = !0, K.waitForIdle().then(() => {
|
|
1321
1338
|
this.scopeMissingReportScheduled = !1, this.reportScopeMissingIdentifiers();
|
|
1322
1339
|
}));
|
|
1323
1340
|
}
|
|
@@ -1466,14 +1483,14 @@ ${t}`;
|
|
|
1466
1483
|
s && (this.BUILTIN_DATA_REFERENCE_PATTERN.test(n) ? a[this.BUILTIN_NAMESPACE] = {
|
|
1467
1484
|
...this.BUILTIN_HELPERS,
|
|
1468
1485
|
[this.BUILTIN_DATA_PROPERTY]: { ...a }
|
|
1469
|
-
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a),
|
|
1486
|
+
} : a[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(a), V.isEnabled() && this.recordSuppliedIdentifiers(a);
|
|
1470
1487
|
const o = this.canAttemptMissingIdentifierRecovery(e), c = this.extractFreeIdentifiers(e).filter(
|
|
1471
1488
|
(d) => !(d in a) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
1472
1489
|
// (二重宣言は構文エラーになる)。
|
|
1473
1490
|
!this.FORBIDDEN_NAMES.includes(d) && // 標準組み込み(`Math` など)は式から参照できる仕様のため遮蔽しない。
|
|
1474
1491
|
!this.ALLOWED_GLOBAL_IDENTIFIERS.has(d)
|
|
1475
1492
|
);
|
|
1476
|
-
if (
|
|
1493
|
+
if (V.isEnabled()) {
|
|
1477
1494
|
const d = this.extractBoundIdentifiers(e);
|
|
1478
1495
|
this.recordScopeMissingIdentifiers(
|
|
1479
1496
|
d.size === 0 ? c : c.filter((p) => !d.has(p)),
|
|
@@ -2464,12 +2481,12 @@ T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HE
|
|
|
2464
2481
|
"..."
|
|
2465
2482
|
]), T.strictComparisonSplits = /* @__PURE__ */ new Map(), T.WRAPPED_VALUES = /* @__PURE__ */ new WeakSet();
|
|
2466
2483
|
let re = T;
|
|
2467
|
-
const
|
|
2484
|
+
const pe = "data-haori-if-disabled", ze = "input, select, textarea, button, fieldset", L = class L {
|
|
2468
2485
|
/**
|
|
2469
2486
|
* 集計状態を初期化します。
|
|
2470
2487
|
*/
|
|
2471
2488
|
static reset() {
|
|
2472
|
-
|
|
2489
|
+
L.ELEMENT_STORES.clear(), L.ensureGlobalAccess();
|
|
2473
2490
|
}
|
|
2474
2491
|
/**
|
|
2475
2492
|
* 集計を開始します。
|
|
@@ -2477,7 +2494,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2477
2494
|
* @returns 戻り値はありません。
|
|
2478
2495
|
*/
|
|
2479
2496
|
static start() {
|
|
2480
|
-
|
|
2497
|
+
L.collecting = !0;
|
|
2481
2498
|
}
|
|
2482
2499
|
/**
|
|
2483
2500
|
* 集計を停止します。
|
|
@@ -2485,7 +2502,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2485
2502
|
* @returns 戻り値はありません。
|
|
2486
2503
|
*/
|
|
2487
2504
|
static stop() {
|
|
2488
|
-
|
|
2505
|
+
L.collecting = !1;
|
|
2489
2506
|
}
|
|
2490
2507
|
/**
|
|
2491
2508
|
* 集計中かどうかを返します。
|
|
@@ -2493,7 +2510,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2493
2510
|
* @returns 集計中なら true
|
|
2494
2511
|
*/
|
|
2495
2512
|
static isCollecting() {
|
|
2496
|
-
return
|
|
2513
|
+
return L.collecting && V.isEnabled();
|
|
2497
2514
|
}
|
|
2498
2515
|
/**
|
|
2499
2516
|
* 現在の集計結果スナップショットを返します。
|
|
@@ -2501,7 +2518,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2501
2518
|
* @returns エレメントごとの集計結果
|
|
2502
2519
|
*/
|
|
2503
2520
|
static snapshot() {
|
|
2504
|
-
return
|
|
2521
|
+
return L.ensureGlobalAccess(), [...L.ELEMENT_STORES.entries()].map(([e, t]) => ({
|
|
2505
2522
|
elementId: e,
|
|
2506
2523
|
tagName: t.tagName,
|
|
2507
2524
|
attributes: [...t.attributes.entries()].map(([r, i]) => ({
|
|
@@ -2510,7 +2527,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2510
2527
|
calls: i.calls,
|
|
2511
2528
|
totalDurationMs: i.totalDurationMs,
|
|
2512
2529
|
maxDurationMs: i.maxDurationMs,
|
|
2513
|
-
placeholders:
|
|
2530
|
+
placeholders: L.sortPlaceholders(
|
|
2514
2531
|
i.placeholders
|
|
2515
2532
|
)
|
|
2516
2533
|
})).sort((r, i) => i.calls - r.calls),
|
|
@@ -2520,7 +2537,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2520
2537
|
calls: i.calls,
|
|
2521
2538
|
totalDurationMs: i.totalDurationMs,
|
|
2522
2539
|
maxDurationMs: i.maxDurationMs,
|
|
2523
|
-
placeholders:
|
|
2540
|
+
placeholders: L.sortPlaceholders(
|
|
2524
2541
|
i.placeholders
|
|
2525
2542
|
)
|
|
2526
2543
|
})).sort((r, i) => i.calls - r.calls)
|
|
@@ -2544,7 +2561,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2544
2561
|
* @param limit 出力する宣言の数。既定は 20
|
|
2545
2562
|
* @returns 要約。合計は `limit` で絞る前の全件から求める
|
|
2546
2563
|
*/
|
|
2547
|
-
static report(e =
|
|
2564
|
+
static report(e = L.DEFAULT_REPORT_LIMIT) {
|
|
2548
2565
|
const t = /* @__PURE__ */ new Map();
|
|
2549
2566
|
let r = 0, i = 0;
|
|
2550
2567
|
const n = (c, u, d) => {
|
|
@@ -2568,7 +2585,7 @@ const he = "data-haori-if-disabled", ze = "input, select, textarea, button, fiel
|
|
|
2568
2585
|
d.maxDurationMs
|
|
2569
2586
|
), d.totalDurationMs > p.representativeDurationMs && (p.where = u, p.representativeDurationMs = d.totalDurationMs);
|
|
2570
2587
|
};
|
|
2571
|
-
|
|
2588
|
+
L.snapshot().forEach((c) => {
|
|
2572
2589
|
c.attributes.forEach((u) => {
|
|
2573
2590
|
n(
|
|
2574
2591
|
`@${u.name}
|
|
@@ -2598,7 +2615,7 @@ ${u.template}`,
|
|
|
2598
2615
|
entryCount: s.length,
|
|
2599
2616
|
top: a
|
|
2600
2617
|
};
|
|
2601
|
-
return
|
|
2618
|
+
return L.logReport(o), o;
|
|
2602
2619
|
}
|
|
2603
2620
|
/**
|
|
2604
2621
|
* 要約を表形式でコンソールへ出力します。
|
|
@@ -2628,30 +2645,30 @@ ${u.template}`,
|
|
|
2628
2645
|
* @param expressions 今回評価した式一覧
|
|
2629
2646
|
*/
|
|
2630
2647
|
static record(e, t, r) {
|
|
2631
|
-
if (!
|
|
2648
|
+
if (!V.isEnabled() || !e || t.length === 0 || (L.ensureGlobalAccess(), !L.isCollecting()))
|
|
2632
2649
|
return;
|
|
2633
|
-
const i =
|
|
2650
|
+
const i = L.getOrCreateElementStore(
|
|
2634
2651
|
e.element
|
|
2635
2652
|
);
|
|
2636
2653
|
if (e.kind === "attribute") {
|
|
2637
|
-
const s =
|
|
2654
|
+
const s = L.getOrCreateCounter(
|
|
2638
2655
|
i.attributes,
|
|
2639
2656
|
e.rawName,
|
|
2640
2657
|
e.template
|
|
2641
2658
|
);
|
|
2642
|
-
|
|
2659
|
+
L.updateCounter(
|
|
2643
2660
|
s,
|
|
2644
2661
|
t,
|
|
2645
2662
|
r
|
|
2646
2663
|
);
|
|
2647
2664
|
return;
|
|
2648
2665
|
}
|
|
2649
|
-
const n =
|
|
2666
|
+
const n = L.getOrCreateCounter(
|
|
2650
2667
|
i.texts,
|
|
2651
2668
|
String(e.childIndex),
|
|
2652
2669
|
e.template
|
|
2653
2670
|
);
|
|
2654
|
-
|
|
2671
|
+
L.updateCounter(
|
|
2655
2672
|
n,
|
|
2656
2673
|
t,
|
|
2657
2674
|
r
|
|
@@ -2661,15 +2678,15 @@ ${u.template}`,
|
|
|
2661
2678
|
* globalThis から dev-only の取得窓口を参照できるようにします。
|
|
2662
2679
|
*/
|
|
2663
2680
|
static ensureGlobalAccess() {
|
|
2664
|
-
if (!
|
|
2681
|
+
if (!V.isEnabled())
|
|
2665
2682
|
return;
|
|
2666
2683
|
const e = globalThis;
|
|
2667
|
-
e[
|
|
2668
|
-
start: () =>
|
|
2669
|
-
stop: () =>
|
|
2670
|
-
reset: () =>
|
|
2671
|
-
snapshot: () =>
|
|
2672
|
-
report: (t) =>
|
|
2684
|
+
e[L.GLOBAL_KEY] === void 0 && (e[L.GLOBAL_KEY] = {
|
|
2685
|
+
start: () => L.start(),
|
|
2686
|
+
stop: () => L.stop(),
|
|
2687
|
+
reset: () => L.reset(),
|
|
2688
|
+
snapshot: () => L.snapshot(),
|
|
2689
|
+
report: (t) => L.report(t)
|
|
2673
2690
|
});
|
|
2674
2691
|
}
|
|
2675
2692
|
/**
|
|
@@ -2679,7 +2696,7 @@ ${u.template}`,
|
|
|
2679
2696
|
* @returns 集計ストア
|
|
2680
2697
|
*/
|
|
2681
2698
|
static getOrCreateElementStore(e) {
|
|
2682
|
-
const t =
|
|
2699
|
+
const t = L.createElementId(e), r = L.ELEMENT_STORES.get(t);
|
|
2683
2700
|
if (r)
|
|
2684
2701
|
return r;
|
|
2685
2702
|
const i = {
|
|
@@ -2687,7 +2704,7 @@ ${u.template}`,
|
|
|
2687
2704
|
attributes: /* @__PURE__ */ new Map(),
|
|
2688
2705
|
texts: /* @__PURE__ */ new Map()
|
|
2689
2706
|
};
|
|
2690
|
-
return
|
|
2707
|
+
return L.ELEMENT_STORES.set(t, i), i;
|
|
2691
2708
|
}
|
|
2692
2709
|
/**
|
|
2693
2710
|
* カウンタを取得または初期化します。
|
|
@@ -2737,7 +2754,7 @@ ${u.template}`,
|
|
|
2737
2754
|
*/
|
|
2738
2755
|
static updateCounter(e, t, r) {
|
|
2739
2756
|
e.calls += 1, e.totalDurationMs += r, e.maxDurationMs = Math.max(e.maxDurationMs, r), t.forEach((i) => {
|
|
2740
|
-
const n =
|
|
2757
|
+
const n = L.getOrCreatePlaceholder(
|
|
2741
2758
|
e.placeholders,
|
|
2742
2759
|
i.expression
|
|
2743
2760
|
);
|
|
@@ -2776,12 +2793,12 @@ ${u.template}`,
|
|
|
2776
2793
|
* @returns 結果と所要時間
|
|
2777
2794
|
*/
|
|
2778
2795
|
static measure(e) {
|
|
2779
|
-
if (!
|
|
2796
|
+
if (!L.isCollecting())
|
|
2780
2797
|
return { value: e(), durationMs: 0 };
|
|
2781
|
-
const t =
|
|
2798
|
+
const t = L.now();
|
|
2782
2799
|
return {
|
|
2783
2800
|
value: e(),
|
|
2784
|
-
durationMs:
|
|
2801
|
+
durationMs: L.now() - t
|
|
2785
2802
|
};
|
|
2786
2803
|
}
|
|
2787
2804
|
/**
|
|
@@ -2808,26 +2825,26 @@ ${u.template}`,
|
|
|
2808
2825
|
return t.join(" > ");
|
|
2809
2826
|
}
|
|
2810
2827
|
};
|
|
2811
|
-
|
|
2812
|
-
let
|
|
2813
|
-
const
|
|
2828
|
+
L.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", L.ELEMENT_STORES = /* @__PURE__ */ new Map(), L.collecting = !1, L.DEFAULT_REPORT_LIMIT = 20;
|
|
2829
|
+
let ke = L;
|
|
2830
|
+
const fe = class fe {
|
|
2814
2831
|
/**
|
|
2815
2832
|
* フラグメントのコンストラクタ。
|
|
2816
2833
|
*
|
|
2817
2834
|
* @param target 対象ノード
|
|
2818
2835
|
*/
|
|
2819
2836
|
constructor(e) {
|
|
2820
|
-
this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = e,
|
|
2837
|
+
this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = e, fe.FRAGMENT_CACHE.set(e, this);
|
|
2821
2838
|
}
|
|
2822
2839
|
static get(e) {
|
|
2823
2840
|
if (e == null)
|
|
2824
2841
|
return null;
|
|
2825
|
-
if (
|
|
2826
|
-
return
|
|
2842
|
+
if (fe.FRAGMENT_CACHE.has(e))
|
|
2843
|
+
return fe.FRAGMENT_CACHE.get(e);
|
|
2827
2844
|
let t;
|
|
2828
2845
|
switch (e.nodeType) {
|
|
2829
2846
|
case Node.ELEMENT_NODE:
|
|
2830
|
-
t = new
|
|
2847
|
+
t = new w(e);
|
|
2831
2848
|
break;
|
|
2832
2849
|
case Node.TEXT_NODE:
|
|
2833
2850
|
t = new ne(e);
|
|
@@ -2840,6 +2857,19 @@ const ye = class ye {
|
|
|
2840
2857
|
}
|
|
2841
2858
|
return t;
|
|
2842
2859
|
}
|
|
2860
|
+
/**
|
|
2861
|
+
* キャッシュ済みのフラグメントを返します。無ければ作成せず `null` を返します。
|
|
2862
|
+
*
|
|
2863
|
+
* `get()` はフラグメントを作成するため、「Haori が既に知っているノードか」の
|
|
2864
|
+
* 判定には使えません。
|
|
2865
|
+
*
|
|
2866
|
+
* @internal 監視と木の組み立てで、既知のノードかを判定するために使います。
|
|
2867
|
+
* @param node 対象ノード
|
|
2868
|
+
* @returns キャッシュ済みのフラグメント。無ければ `null`
|
|
2869
|
+
*/
|
|
2870
|
+
static peek(e) {
|
|
2871
|
+
return fe.FRAGMENT_CACHE.get(e) ?? null;
|
|
2872
|
+
}
|
|
2843
2873
|
/**
|
|
2844
2874
|
* skipMutationNodesフラグの値を取得します。
|
|
2845
2875
|
*
|
|
@@ -2858,7 +2888,7 @@ const ye = class ye {
|
|
|
2858
2888
|
return Promise.resolve();
|
|
2859
2889
|
if (this.parent) {
|
|
2860
2890
|
const e = this.parent, t = e.skipMutationNodes;
|
|
2861
|
-
return
|
|
2891
|
+
return K.enqueue(() => {
|
|
2862
2892
|
e.skipMutationNodes = !0, this.target.parentNode === e.getTarget() && e.getTarget().removeChild(this.target), this.mounted = !1;
|
|
2863
2893
|
}).finally(() => {
|
|
2864
2894
|
e.skipMutationNodes = t;
|
|
@@ -2866,7 +2896,7 @@ const ye = class ye {
|
|
|
2866
2896
|
} else {
|
|
2867
2897
|
const e = this.target.parentNode;
|
|
2868
2898
|
if (e)
|
|
2869
|
-
return
|
|
2899
|
+
return K.enqueue(() => {
|
|
2870
2900
|
this.target.parentNode === e && e.removeChild(this.target), this.mounted = !1;
|
|
2871
2901
|
});
|
|
2872
2902
|
this.mounted = !1;
|
|
@@ -2883,7 +2913,7 @@ const ye = class ye {
|
|
|
2883
2913
|
return Promise.resolve();
|
|
2884
2914
|
if (this.parent) {
|
|
2885
2915
|
const e = this.parent, t = e.skipMutationNodes;
|
|
2886
|
-
return
|
|
2916
|
+
return K.enqueue(() => {
|
|
2887
2917
|
e.skipMutationNodes = !0, this.target.parentNode !== e.getTarget() && e.getTarget().appendChild(this.target), this.mounted = !0;
|
|
2888
2918
|
}).finally(() => {
|
|
2889
2919
|
e.skipMutationNodes = t;
|
|
@@ -2914,7 +2944,7 @@ const ye = class ye {
|
|
|
2914
2944
|
* @return 除去のPromise
|
|
2915
2945
|
*/
|
|
2916
2946
|
remove(e = !0) {
|
|
2917
|
-
return this.parent && this.parent.removeChild(this),
|
|
2947
|
+
return this.parent && this.parent.removeChild(this), fe.FRAGMENT_CACHE.delete(this.target), e ? this.unmount() : Promise.resolve();
|
|
2918
2948
|
}
|
|
2919
2949
|
/**
|
|
2920
2950
|
* 対象ノードを取得します。
|
|
@@ -2941,9 +2971,9 @@ const ye = class ye {
|
|
|
2941
2971
|
this.parent = e;
|
|
2942
2972
|
}
|
|
2943
2973
|
};
|
|
2944
|
-
|
|
2945
|
-
let
|
|
2946
|
-
const S = class S extends
|
|
2974
|
+
fe.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
2975
|
+
let x = fe;
|
|
2976
|
+
const S = class S extends x {
|
|
2947
2977
|
/**
|
|
2948
2978
|
* エレメントフラグメントのコンストラクタ。
|
|
2949
2979
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -2958,10 +2988,34 @@ const S = class S extends N {
|
|
|
2958
2988
|
this.attributeMap.set(t, i);
|
|
2959
2989
|
}
|
|
2960
2990
|
}), e.childNodes.forEach((t) => {
|
|
2961
|
-
|
|
2991
|
+
if (S.isOwnedWithinExternal(t))
|
|
2992
|
+
return;
|
|
2993
|
+
const r = x.get(t);
|
|
2962
2994
|
r.setParent(this), this.children.push(r);
|
|
2963
2995
|
});
|
|
2964
2996
|
}
|
|
2997
|
+
/**
|
|
2998
|
+
* ノードの断片が、同じ `data-external` の要素の内側で既に別の親に属しているかを返します。
|
|
2999
|
+
*
|
|
3000
|
+
* 外部ライブラリが `data-external` の配下に生成したコンテナの断片が、内部の走査
|
|
3001
|
+
* (全要素に `Fragment.get()` を呼ぶ処理など)で作られると、そのコンストラクタが
|
|
3002
|
+
* 既知の子(書いた `<select>` など)の断片を奪い、元の親の子の一覧と親の指す先が
|
|
3003
|
+
* 食い違います。その後の移動で、書いた入力が収集から落ちます(仕様「`data-external`」、
|
|
3004
|
+
* 課題 #43)。`data-external` の外では従来どおり奪います(移動の処理がこの付け替えに
|
|
3005
|
+
* 依存しているため)。親がその子を一覧に載せているかは確かめません(`data-external`
|
|
3006
|
+
* の内側で断片の親が古くなる経路は無く、確かめる行を外しても結果が変わらないことを
|
|
3007
|
+
* 確認済み)。
|
|
3008
|
+
*
|
|
3009
|
+
* @param node 子ノード
|
|
3010
|
+
* @returns 取り込まない場合 true
|
|
3011
|
+
*/
|
|
3012
|
+
static isOwnedWithinExternal(e) {
|
|
3013
|
+
const r = x.peek(e)?.getParent() ?? null;
|
|
3014
|
+
if (r === null)
|
|
3015
|
+
return !1;
|
|
3016
|
+
const i = r.getTarget().closest(`[${l.prefix}external]`);
|
|
3017
|
+
return i !== null && i.contains(e);
|
|
3018
|
+
}
|
|
2965
3019
|
/**
|
|
2966
3020
|
* 子フラグメントのリストを取得します。
|
|
2967
3021
|
*
|
|
@@ -3049,7 +3103,7 @@ const S = class S extends N {
|
|
|
3049
3103
|
*/
|
|
3050
3104
|
static dropIfVisibilityArtifacts(e) {
|
|
3051
3105
|
e.hasAttribute(`${l.prefix}if-false`) && (e.style.removeProperty("display"), e.getAttribute("style")?.trim() === "" && e.removeAttribute("style"), e.removeAttribute(`${l.prefix}if-false`), S.forEachFormControlInBranch(e, (t) => {
|
|
3052
|
-
t.hasAttribute(
|
|
3106
|
+
t.hasAttribute(pe) && (t.removeAttribute(pe), t.removeAttribute("disabled"));
|
|
3053
3107
|
}));
|
|
3054
3108
|
}
|
|
3055
3109
|
/**
|
|
@@ -3060,10 +3114,28 @@ const S = class S extends N {
|
|
|
3060
3114
|
*/
|
|
3061
3115
|
remove(e = !0) {
|
|
3062
3116
|
const t = [];
|
|
3063
|
-
return e && ae.destroySubtree(this.getTarget()), this.children.forEach((r) => {
|
|
3117
|
+
return e && ae.destroySubtree(this.getTarget()), this.getTarget().hasAttribute(`${l.prefix}external`) ? this.detachPreservingSubtree(e) : (this.children.forEach((r) => {
|
|
3064
3118
|
t.push(r.remove(!1));
|
|
3065
3119
|
}), this.children.length = 0, this.attributeMap.clear(), this.bindingData = null, this.bindingDataCache = null, this.derivedBindingData = null, this.descendantBindingDataCache = null, this.template && (t.push(this.template.remove(!1)), this.template = null), this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.clearUnappliedValueWrite(), t.push(super.remove(e)), Promise.all(t).then(() => {
|
|
3066
|
-
});
|
|
3120
|
+
}));
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* `data-external` の要素を、内部のフラグメント木を保ったまま親から外します。
|
|
3124
|
+
*
|
|
3125
|
+
* 外した木を捨てると、付け直し(移動を含む)で DOM から組み立て直すことになり、
|
|
3126
|
+
* 外部ライブラリが配下に生成した DOM ごと取り込んでフォーム値の収集に載せます
|
|
3127
|
+
* (仕様「`data-external`」の「付け直した場合も、配下は走査した時点の構成のまま
|
|
3128
|
+
* 扱う」、課題 #42)。子の断片・属性・キャッシュ登録は保ち、付け直しでは
|
|
3129
|
+
* `Core.addNode()` がこの断片をそのまま挿入して走査します。バインドデータの
|
|
3130
|
+
* キャッシュは、付け直しで親を設定するとき(`setParent()`)に部分木ごと捨てられる
|
|
3131
|
+
* ため、ここでは捨てません(捨てる行を外しても結果が変わらないことを確認済み)。
|
|
3132
|
+
*
|
|
3133
|
+
* @param unmount DOM からの除去を行うかどうか
|
|
3134
|
+
* @returns 除去の Promise
|
|
3135
|
+
*/
|
|
3136
|
+
detachPreservingSubtree(e) {
|
|
3137
|
+
const t = this.getParent();
|
|
3138
|
+
return t && t.removeChild(this), e ? this.unmount() : Promise.resolve();
|
|
3067
3139
|
}
|
|
3068
3140
|
/**
|
|
3069
3141
|
* フラグメントの対象エレメントを取得します。
|
|
@@ -3483,7 +3555,7 @@ const S = class S extends N {
|
|
|
3483
3555
|
return Promise.resolve();
|
|
3484
3556
|
const i = this.getTarget();
|
|
3485
3557
|
if (i instanceof HTMLInputElement && i.type === "file")
|
|
3486
|
-
return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() :
|
|
3558
|
+
return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : K.enqueue(() => {
|
|
3487
3559
|
i.value = "";
|
|
3488
3560
|
})) : (m.warn(
|
|
3489
3561
|
"[Haori]",
|
|
@@ -3569,7 +3641,7 @@ const S = class S extends N {
|
|
|
3569
3641
|
*/
|
|
3570
3642
|
enqueueValueWrite(e) {
|
|
3571
3643
|
this.skipChangeValue = !0;
|
|
3572
|
-
const t =
|
|
3644
|
+
const t = K.enqueue(e).finally(() => {
|
|
3573
3645
|
this.skipChangeValue = !1;
|
|
3574
3646
|
});
|
|
3575
3647
|
return this.pendingValueWrite = t, t;
|
|
@@ -3892,7 +3964,7 @@ const S = class S extends N {
|
|
|
3892
3964
|
* @return 戻り値はありません。
|
|
3893
3965
|
*/
|
|
3894
3966
|
static warnUnresolvedAttribute(e, t, r, i) {
|
|
3895
|
-
if (!
|
|
3967
|
+
if (!V.isEnabled())
|
|
3896
3968
|
return;
|
|
3897
3969
|
const n = `${e} ${r}`;
|
|
3898
3970
|
S.loggedUnresolvedAttributes.has(n) || (S.loggedUnresolvedAttributes.add(n), m.warn(
|
|
@@ -3939,7 +4011,7 @@ const S = class S extends N {
|
|
|
3939
4011
|
const t = this.getTarget().closest("select");
|
|
3940
4012
|
if (!t)
|
|
3941
4013
|
return !1;
|
|
3942
|
-
const r =
|
|
4014
|
+
const r = x.get(t);
|
|
3943
4015
|
return r instanceof S ? r.hasPendingUserEdit() : !1;
|
|
3944
4016
|
}
|
|
3945
4017
|
/**
|
|
@@ -4063,7 +4135,7 @@ const S = class S extends N {
|
|
|
4063
4135
|
* @returns 戻り値はありません。
|
|
4064
4136
|
*/
|
|
4065
4137
|
static warnValueTypeDeclaration(e, t, r) {
|
|
4066
|
-
if (!
|
|
4138
|
+
if (!V.isEnabled())
|
|
4067
4139
|
return;
|
|
4068
4140
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
4069
4141
|
S.loggedValueTypeDeclarations.has(n) || (S.loggedValueTypeDeclarations.add(n), m.warn(
|
|
@@ -4204,7 +4276,7 @@ const S = class S extends N {
|
|
|
4204
4276
|
const t = this.getTarget().closest("select");
|
|
4205
4277
|
if (!t)
|
|
4206
4278
|
return;
|
|
4207
|
-
const r =
|
|
4279
|
+
const r = x.get(t);
|
|
4208
4280
|
r instanceof S && r.syncValue();
|
|
4209
4281
|
}
|
|
4210
4282
|
/**
|
|
@@ -4288,7 +4360,7 @@ const S = class S extends N {
|
|
|
4288
4360
|
const i = this.getTarget(), n = i.hasAttribute(e), s = t !== e && i.hasAttribute(t);
|
|
4289
4361
|
if (!n && !s)
|
|
4290
4362
|
return Promise.resolve();
|
|
4291
|
-
const a =
|
|
4363
|
+
const a = K.enqueue(() => {
|
|
4292
4364
|
n && i.removeAttribute(e), s && i.removeAttribute(t);
|
|
4293
4365
|
}).finally(() => {
|
|
4294
4366
|
this.releaseSelfWritingAttributes(r);
|
|
@@ -4323,7 +4395,7 @@ const S = class S extends N {
|
|
|
4323
4395
|
if (n) {
|
|
4324
4396
|
const ce = this.attributeMap.get(e);
|
|
4325
4397
|
if (ce && (ce.isEvaluate || ce.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
|
|
4326
|
-
const ue =
|
|
4398
|
+
const ue = K.enqueue(() => {
|
|
4327
4399
|
}).finally(() => {
|
|
4328
4400
|
this.releaseSelfWritingAttributes(s);
|
|
4329
4401
|
});
|
|
@@ -4336,13 +4408,13 @@ const S = class S extends N {
|
|
|
4336
4408
|
element: c,
|
|
4337
4409
|
rawName: e,
|
|
4338
4410
|
template: r
|
|
4339
|
-
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && S.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E =
|
|
4340
|
-
if (
|
|
4411
|
+
}), d = o.isEvaluate || o.isRawEvaluate, p = e === t && S.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E = he.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, D = t === "value" && S.resolveDeclaredValueType(c) === "boolean", C = A === !1 && !D, H = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || C : p ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : y ? u.hasUnresolvedReference || A === null || A === void 0 || C : d && E === "");
|
|
4412
|
+
if (H && u.hasUnresolvedReference && S.warnUnresolvedAttribute(
|
|
4341
4413
|
e,
|
|
4342
4414
|
t,
|
|
4343
4415
|
r,
|
|
4344
4416
|
c
|
|
4345
|
-
),
|
|
4417
|
+
), V.isEnabled() && A === !1 && y) {
|
|
4346
4418
|
const ce = o.getSingleExpression(), ue = ce === null ? null : re.diagnoseStrictComparison(
|
|
4347
4419
|
ce,
|
|
4348
4420
|
this.getBindingData()
|
|
@@ -4354,17 +4426,17 @@ const S = class S extends N {
|
|
|
4354
4426
|
c
|
|
4355
4427
|
);
|
|
4356
4428
|
}
|
|
4357
|
-
const
|
|
4358
|
-
if (!ie && !
|
|
4359
|
-
return
|
|
4429
|
+
const F = o.isForceEvaluation() ? r : y ? A : E, j = i && o.isEvaluate && t === "value" && S.isValuePropertyTarget(c), Y = c.getRootNode(), Q = j && S.isUserEditableValue(c) && (c === Y.activeElement || this.hasPendingUserEdit()), P = H || F === null || F === !1 && !D ? null : String(F), ie = e !== t && c.getAttribute(e) !== r, R = P === null ? c.hasAttribute(t) : c.getAttribute(t) !== P, $ = P === null ? "" : P, G = j && !Q && c.value !== $, Z = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), oe = t === "selected" && c instanceof HTMLOptionElement, le = Y.activeElement, q = le !== null && (Z && c === le || oe && c.closest("select") === le) || (Z || oe) && this.hasPendingCheckableUserEdit(oe), z = P !== null, _ = Z && o.isEvaluate && !q && c.checked !== z, J = oe && o.isEvaluate && !q && c.selected !== z;
|
|
4430
|
+
if (!ie && !R && !G && !_ && !J)
|
|
4431
|
+
return j && !Q && (this.value = this.normalizeValueForElement(
|
|
4360
4432
|
c,
|
|
4361
|
-
|
|
4362
|
-
), this.clearUnappliedValueWrite()), (Z || oe) && !
|
|
4363
|
-
const be =
|
|
4364
|
-
ie && c.setAttribute(e, r),
|
|
4433
|
+
$
|
|
4434
|
+
), this.clearUnappliedValueWrite()), (Z || oe) && !q && this.syncCheckableValueFromDom(oe), Promise.resolve();
|
|
4435
|
+
const be = K.enqueue(() => {
|
|
4436
|
+
ie && c.setAttribute(e, r), P === null ? c.removeAttribute(t) : R && (c.setAttribute(t, P), t === `${l.prefix}bind` && this.recordSelfWrittenBind(P)), t === "style" && this.captureAndHideDisplay(), j && !Q && (this.value = this.normalizeValueForElement(
|
|
4365
4437
|
c,
|
|
4366
|
-
|
|
4367
|
-
),
|
|
4438
|
+
$
|
|
4439
|
+
), G && (c.value = $), this.recordValueWriteResult(c.value === $)), _ && (c.checked = z), J && (c.selected = z), (_ || J) && this.syncCheckableValueFromDom(J);
|
|
4368
4440
|
}).finally(() => {
|
|
4369
4441
|
this.releaseSelfWritingAttributes(s);
|
|
4370
4442
|
});
|
|
@@ -4387,7 +4459,7 @@ const S = class S extends N {
|
|
|
4387
4459
|
const t = this.getTarget();
|
|
4388
4460
|
if (!t.hasAttribute(e))
|
|
4389
4461
|
return Promise.resolve();
|
|
4390
|
-
const r =
|
|
4462
|
+
const r = K.enqueue(() => {
|
|
4391
4463
|
t.removeAttribute(e);
|
|
4392
4464
|
}).finally(() => {
|
|
4393
4465
|
this.releaseSelfWritingAttributes([e]);
|
|
@@ -4424,7 +4496,7 @@ const S = class S extends N {
|
|
|
4424
4496
|
value: r.results[0],
|
|
4425
4497
|
hasUnresolvedReference: r.hasUnresolvedReference
|
|
4426
4498
|
} : {
|
|
4427
|
-
value:
|
|
4499
|
+
value: he.joinEvaluateResults(r.results),
|
|
4428
4500
|
hasUnresolvedReference: r.hasUnresolvedReference
|
|
4429
4501
|
};
|
|
4430
4502
|
}
|
|
@@ -4469,7 +4541,7 @@ const S = class S extends N {
|
|
|
4469
4541
|
const i = t ? r.nextSibling : r;
|
|
4470
4542
|
let n = t ? r.nextSibling : r;
|
|
4471
4543
|
for (; n !== null; ) {
|
|
4472
|
-
const s =
|
|
4544
|
+
const s = x.get(n);
|
|
4473
4545
|
if (s !== null) {
|
|
4474
4546
|
const a = this.children.indexOf(s);
|
|
4475
4547
|
if (a !== -1)
|
|
@@ -4523,7 +4595,7 @@ const S = class S extends N {
|
|
|
4523
4595
|
}
|
|
4524
4596
|
e.setParent(this), e.setMounted(this.mounted);
|
|
4525
4597
|
const d = this.skipMutationNodes;
|
|
4526
|
-
return this.skipMutationNodes = !0,
|
|
4598
|
+
return this.skipMutationNodes = !0, K.enqueue(() => {
|
|
4527
4599
|
this.target.insertBefore(e.getTarget(), u);
|
|
4528
4600
|
}).finally(() => {
|
|
4529
4601
|
this.skipMutationNodes = d;
|
|
@@ -4658,7 +4730,7 @@ const S = class S extends N {
|
|
|
4658
4730
|
* @returns 戻り値はありません。
|
|
4659
4731
|
*/
|
|
4660
4732
|
static reassertHiddenDisplay(e) {
|
|
4661
|
-
const t =
|
|
4733
|
+
const t = x.get(e);
|
|
4662
4734
|
t instanceof S && t.hideDisplayWithoutCapture();
|
|
4663
4735
|
}
|
|
4664
4736
|
/**
|
|
@@ -4710,7 +4782,7 @@ const S = class S extends N {
|
|
|
4710
4782
|
*/
|
|
4711
4783
|
static disableFormControlsInBranch(e) {
|
|
4712
4784
|
S.forEachFormControlInBranch(e, (t) => {
|
|
4713
|
-
t.hasAttribute("disabled") || (t.setAttribute(
|
|
4785
|
+
t.hasAttribute("disabled") || (t.setAttribute(pe, ""), t.setAttribute("disabled", ""));
|
|
4714
4786
|
});
|
|
4715
4787
|
}
|
|
4716
4788
|
/**
|
|
@@ -4724,7 +4796,7 @@ const S = class S extends N {
|
|
|
4724
4796
|
*/
|
|
4725
4797
|
restoreFormControlsDisabledByIf() {
|
|
4726
4798
|
S.forEachFormControlInBranch(this.getTarget(), (e) => {
|
|
4727
|
-
e.hasAttribute(
|
|
4799
|
+
e.hasAttribute(pe) && (e.removeAttribute(pe), e.removeAttribute("disabled"));
|
|
4728
4800
|
});
|
|
4729
4801
|
}
|
|
4730
4802
|
/**
|
|
@@ -4800,8 +4872,8 @@ S.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, S.VALUE
|
|
|
4800
4872
|
"time",
|
|
4801
4873
|
"week"
|
|
4802
4874
|
], S.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), S.sequenceCounter = 0, S.bindingWorkActiveCount = 0, S.pendingMutationFlusher = null, S.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), S.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
4803
|
-
let
|
|
4804
|
-
class ne extends
|
|
4875
|
+
let w = S;
|
|
4876
|
+
class ne extends x {
|
|
4805
4877
|
/**
|
|
4806
4878
|
* テキストフラグメントのコンストラクタ。
|
|
4807
4879
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -4809,7 +4881,7 @@ class ne extends N {
|
|
|
4809
4881
|
* @param target 対象テキストノード
|
|
4810
4882
|
*/
|
|
4811
4883
|
constructor(e) {
|
|
4812
|
-
super(e), this.skipMutation = !1, this.renderedText = null, this.text = e.textContent || "", this.contents = new
|
|
4884
|
+
super(e), this.skipMutation = !1, this.renderedText = null, this.text = e.textContent || "", this.contents = new he(this.text);
|
|
4813
4885
|
}
|
|
4814
4886
|
/**
|
|
4815
4887
|
* フラグメントをクローンします。
|
|
@@ -4854,7 +4926,7 @@ class ne extends N {
|
|
|
4854
4926
|
* @returns 更新のPromise
|
|
4855
4927
|
*/
|
|
4856
4928
|
setContent(e) {
|
|
4857
|
-
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, this.contents = new
|
|
4929
|
+
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, this.contents = new he(e), this.evaluate());
|
|
4858
4930
|
}
|
|
4859
4931
|
/**
|
|
4860
4932
|
* フラグメントを評価します。
|
|
@@ -4864,7 +4936,7 @@ class ne extends N {
|
|
|
4864
4936
|
evaluate() {
|
|
4865
4937
|
return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
|
|
4866
4938
|
new Error("Parent fragment is required for raw evaluation")
|
|
4867
|
-
) :
|
|
4939
|
+
) : K.enqueue(() => {
|
|
4868
4940
|
this.skipMutation = !0;
|
|
4869
4941
|
let e = this.text;
|
|
4870
4942
|
this.contents.isRawEvaluate ? e = this.contents.evaluate(this.parent.getBindingData(), {
|
|
@@ -4872,7 +4944,7 @@ class ne extends N {
|
|
|
4872
4944
|
element: this.parent.getTarget(),
|
|
4873
4945
|
childIndex: this.parent.getChildren().indexOf(this),
|
|
4874
4946
|
template: this.text
|
|
4875
|
-
})[0] : this.contents.isEvaluate && (e =
|
|
4947
|
+
})[0] : this.contents.isEvaluate && (e = he.joinEvaluateResults(
|
|
4876
4948
|
this.contents.evaluate(this.parent.getBindingData(), {
|
|
4877
4949
|
kind: "text",
|
|
4878
4950
|
element: this.parent.getTarget(),
|
|
@@ -4887,7 +4959,7 @@ class ne extends N {
|
|
|
4887
4959
|
});
|
|
4888
4960
|
}
|
|
4889
4961
|
}
|
|
4890
|
-
class qe extends
|
|
4962
|
+
class qe extends x {
|
|
4891
4963
|
/**
|
|
4892
4964
|
* コメントフラグメントのコンストラクタ。
|
|
4893
4965
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -4921,7 +4993,7 @@ class qe extends N {
|
|
|
4921
4993
|
* @return 更新のPromise
|
|
4922
4994
|
*/
|
|
4923
4995
|
setContent(e) {
|
|
4924
|
-
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e,
|
|
4996
|
+
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, K.enqueue(() => {
|
|
4925
4997
|
this.skipMutation = !0, this.target.textContent = this.text;
|
|
4926
4998
|
}).finally(() => {
|
|
4927
4999
|
this.skipMutation = !1;
|
|
@@ -5041,7 +5113,7 @@ const Me = class Me {
|
|
|
5041
5113
|
return this.contents.forEach((c) => {
|
|
5042
5114
|
try {
|
|
5043
5115
|
if (r(c)) {
|
|
5044
|
-
const u =
|
|
5116
|
+
const u = ke.measure(
|
|
5045
5117
|
() => re.evaluateDetailed(c.text, e)
|
|
5046
5118
|
), d = u.value;
|
|
5047
5119
|
a += u.durationMs, s.push({
|
|
@@ -5060,7 +5132,7 @@ const Me = class Me {
|
|
|
5060
5132
|
durationMs: 0
|
|
5061
5133
|
}), n.push("");
|
|
5062
5134
|
}
|
|
5063
|
-
}),
|
|
5135
|
+
}), ke.record(
|
|
5064
5136
|
t,
|
|
5065
5137
|
s,
|
|
5066
5138
|
a
|
|
@@ -5068,8 +5140,8 @@ const Me = class Me {
|
|
|
5068
5140
|
}
|
|
5069
5141
|
};
|
|
5070
5142
|
Me.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
|
|
5071
|
-
let
|
|
5072
|
-
const te = class te extends
|
|
5143
|
+
let he = Me;
|
|
5144
|
+
const te = class te extends he {
|
|
5073
5145
|
/**
|
|
5074
5146
|
* コンストラクタ。
|
|
5075
5147
|
*
|
|
@@ -5179,7 +5251,7 @@ const Se = class Se {
|
|
|
5179
5251
|
* @return すべてのレンダリングが完了したら解決される Promise
|
|
5180
5252
|
*/
|
|
5181
5253
|
static waitForRenders() {
|
|
5182
|
-
return
|
|
5254
|
+
return K.waitForIdle();
|
|
5183
5255
|
}
|
|
5184
5256
|
/**
|
|
5185
5257
|
* 通知ダイアログを表示します。
|
|
@@ -5188,7 +5260,7 @@ const Se = class Se {
|
|
|
5188
5260
|
* @returns 通知が閉じられると解決されるPromise
|
|
5189
5261
|
*/
|
|
5190
5262
|
static dialog(e) {
|
|
5191
|
-
return
|
|
5263
|
+
return K.enqueue(() => {
|
|
5192
5264
|
window.alert(e);
|
|
5193
5265
|
}, !0);
|
|
5194
5266
|
}
|
|
@@ -5216,7 +5288,7 @@ const Se = class Se {
|
|
|
5216
5288
|
* @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
|
|
5217
5289
|
*/
|
|
5218
5290
|
static confirm(e) {
|
|
5219
|
-
return
|
|
5291
|
+
return K.enqueue(() => window.confirm(e), !0);
|
|
5220
5292
|
}
|
|
5221
5293
|
/**
|
|
5222
5294
|
* ダイアログを開きます。
|
|
@@ -5224,7 +5296,7 @@ const Se = class Se {
|
|
|
5224
5296
|
* @param element 開くダイアログのHTML要素
|
|
5225
5297
|
*/
|
|
5226
5298
|
static openDialog(e) {
|
|
5227
|
-
return
|
|
5299
|
+
return K.enqueue(() => {
|
|
5228
5300
|
e instanceof HTMLDialogElement ? (Se.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
5229
5301
|
}, !0);
|
|
5230
5302
|
}
|
|
@@ -5234,7 +5306,7 @@ const Se = class Se {
|
|
|
5234
5306
|
* @param element 閉じるダイアログのHTML要素
|
|
5235
5307
|
*/
|
|
5236
5308
|
static closeDialog(e) {
|
|
5237
|
-
return
|
|
5309
|
+
return K.enqueue(() => {
|
|
5238
5310
|
e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
5239
5311
|
}, !0);
|
|
5240
5312
|
}
|
|
@@ -5255,7 +5327,7 @@ const Se = class Se {
|
|
|
5255
5327
|
* @param level メッセージのレベル(省略可能)
|
|
5256
5328
|
*/
|
|
5257
5329
|
static addMessage(e, t, r) {
|
|
5258
|
-
return
|
|
5330
|
+
return K.enqueue(() => {
|
|
5259
5331
|
const i = e instanceof HTMLFormElement ? e : e.parentElement ?? e;
|
|
5260
5332
|
i.setAttribute("data-message", t), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
|
|
5261
5333
|
}, !0);
|
|
@@ -5266,7 +5338,7 @@ const Se = class Se {
|
|
|
5266
5338
|
* @param parent メッセージをクリアする親要素
|
|
5267
5339
|
*/
|
|
5268
5340
|
static clearMessages(e) {
|
|
5269
|
-
return
|
|
5341
|
+
return K.enqueue(() => {
|
|
5270
5342
|
Se.clearMessagesSync(e);
|
|
5271
5343
|
}, !0);
|
|
5272
5344
|
}
|
|
@@ -5725,8 +5797,8 @@ const f = class f {
|
|
|
5725
5797
|
return f.isDeclarationResolved(e, "value");
|
|
5726
5798
|
if (t instanceof HTMLSelectElement) {
|
|
5727
5799
|
for (const r of Array.from(t.options)) {
|
|
5728
|
-
const i =
|
|
5729
|
-
if (i instanceof
|
|
5800
|
+
const i = x.get(r);
|
|
5801
|
+
if (i instanceof w && f.hasDeclarativeBinding(i, "selected") && !f.isDeclarationResolved(i, "selected"))
|
|
5730
5802
|
return !1;
|
|
5731
5803
|
}
|
|
5732
5804
|
return !0;
|
|
@@ -5769,7 +5841,7 @@ const f = class f {
|
|
|
5769
5841
|
*/
|
|
5770
5842
|
static isDeclarativeStateBound(e) {
|
|
5771
5843
|
const t = e.getTarget();
|
|
5772
|
-
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? f.hasDeclarativeBinding(e, "checked") :
|
|
5844
|
+
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? f.hasDeclarativeBinding(e, "checked") : w.isValuePropertyTarget(t) ? f.hasDeclarativeBinding(e, "value") ? !0 : t instanceof HTMLSelectElement ? f.hasDeclarativeSelectedOption(t) : !1 : !1;
|
|
5773
5845
|
}
|
|
5774
5846
|
/**
|
|
5775
5847
|
* 対象の部分木にある入力欄を、ネイティブのフォームリセットと同じ既定値へ戻します。
|
|
@@ -5826,7 +5898,7 @@ const f = class f {
|
|
|
5826
5898
|
}), t.selectedIndex = -1) : (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = "");
|
|
5827
5899
|
}
|
|
5828
5900
|
e.getChildren().forEach((t) => {
|
|
5829
|
-
t instanceof
|
|
5901
|
+
t instanceof w && f.clearDeclarativeStateFromDom(t);
|
|
5830
5902
|
});
|
|
5831
5903
|
}
|
|
5832
5904
|
/**
|
|
@@ -5855,8 +5927,8 @@ const f = class f {
|
|
|
5855
5927
|
*/
|
|
5856
5928
|
static hasDeclarativeSelectedOption(e) {
|
|
5857
5929
|
for (const t of Array.from(e.options)) {
|
|
5858
|
-
const r =
|
|
5859
|
-
if (r instanceof
|
|
5930
|
+
const r = x.get(t);
|
|
5931
|
+
if (r instanceof w && f.hasDeclarativeBinding(r, "selected"))
|
|
5860
5932
|
return !0;
|
|
5861
5933
|
}
|
|
5862
5934
|
return !1;
|
|
@@ -6263,7 +6335,7 @@ const f = class f {
|
|
|
6263
6335
|
* @param value 祖先が所有している値
|
|
6264
6336
|
*/
|
|
6265
6337
|
static warnArgOwnerIsNotRecord(e, t, r) {
|
|
6266
|
-
if (!
|
|
6338
|
+
if (!V.isEnabled() || r == null)
|
|
6267
6339
|
return;
|
|
6268
6340
|
const i = e.getTarget(), n = f.warnedArgOwnerNotRecord.get(i);
|
|
6269
6341
|
n?.has(t) || (n ? n.add(t) : f.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])), m.warn(
|
|
@@ -6477,7 +6549,7 @@ const f = class f {
|
|
|
6477
6549
|
* @returns 戻り値はありません。
|
|
6478
6550
|
*/
|
|
6479
6551
|
static warnUnvalidatedCustomValidity(e, t) {
|
|
6480
|
-
if (!
|
|
6552
|
+
if (!V.isEnabled() || !e)
|
|
6481
6553
|
return;
|
|
6482
6554
|
const r = `${l.prefix}validity`;
|
|
6483
6555
|
(e.hasAttribute(r) || e.getTarget().querySelector(`[${r}]`) !== null) && m.warn(
|
|
@@ -6540,7 +6612,7 @@ const f = class f {
|
|
|
6540
6612
|
* @param reason 退いた理由
|
|
6541
6613
|
*/
|
|
6542
6614
|
static warnPositionalRowFallback(e) {
|
|
6543
|
-
!
|
|
6615
|
+
!V.isEnabled() || f.warnedPositionalRowFallbacks.has(e) || (f.warnedPositionalRowFallbacks.add(e), m.warn(
|
|
6544
6616
|
"[Haori]",
|
|
6545
6617
|
`${l.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
6546
6618
|
));
|
|
@@ -6560,7 +6632,7 @@ const f = class f {
|
|
|
6560
6632
|
* @param container `data-form-list` を持つコンテナのフラグメント
|
|
6561
6633
|
*/
|
|
6562
6634
|
static warnDerivedRowsWithoutKey(e) {
|
|
6563
|
-
if (!
|
|
6635
|
+
if (!V.isEnabled() || e.getRawAttribute(`${l.prefix}each-key`) !== null)
|
|
6564
6636
|
return;
|
|
6565
6637
|
const t = e.getRawAttribute(`${l.prefix}each`);
|
|
6566
6638
|
t === null || f.resolveLeadingPath(t) !== null || f.warnedDerivedRowsWithoutKey.has(t) || (f.warnedDerivedRowsWithoutKey.add(t), m.warn(
|
|
@@ -6717,7 +6789,7 @@ const f = class f {
|
|
|
6717
6789
|
static createRowKeyIndexes(e, t) {
|
|
6718
6790
|
const r = /* @__PURE__ */ new Map();
|
|
6719
6791
|
return e.forEach((i, n) => {
|
|
6720
|
-
const s =
|
|
6792
|
+
const s = M.createListKey(
|
|
6721
6793
|
i,
|
|
6722
6794
|
t,
|
|
6723
6795
|
n
|
|
@@ -6868,8 +6940,8 @@ const f = class f {
|
|
|
6868
6940
|
static collectShadowingContainers(e) {
|
|
6869
6941
|
const t = `${l.prefix}form-arg`, r = [];
|
|
6870
6942
|
return e.getTarget().querySelectorAll(`form:not([${t}]), [${l.prefix}form]`).forEach((i) => {
|
|
6871
|
-
const n =
|
|
6872
|
-
if (!(n instanceof
|
|
6943
|
+
const n = x.get(i);
|
|
6944
|
+
if (!(n instanceof w))
|
|
6873
6945
|
return;
|
|
6874
6946
|
const s = n.getRawBindingData();
|
|
6875
6947
|
if (s === null)
|
|
@@ -6897,9 +6969,9 @@ const f = class f {
|
|
|
6897
6969
|
const n = { ...i };
|
|
6898
6970
|
for (const s of t)
|
|
6899
6971
|
delete n[s];
|
|
6900
|
-
return
|
|
6972
|
+
return M.setBindingData(e.getTarget(), n, {
|
|
6901
6973
|
kind: r?.kind ?? "supply",
|
|
6902
|
-
sequence: r?.sequence ??
|
|
6974
|
+
sequence: r?.sequence ?? w.nextSequence()
|
|
6903
6975
|
});
|
|
6904
6976
|
}
|
|
6905
6977
|
/**
|
|
@@ -6911,8 +6983,8 @@ const f = class f {
|
|
|
6911
6983
|
static collectArgForms(e) {
|
|
6912
6984
|
const t = `${l.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
6913
6985
|
return r.forEach((n) => {
|
|
6914
|
-
const s =
|
|
6915
|
-
if (!(s instanceof
|
|
6986
|
+
const s = x.get(n);
|
|
6987
|
+
if (!(s instanceof w))
|
|
6916
6988
|
return;
|
|
6917
6989
|
const a = s.getAttribute(t);
|
|
6918
6990
|
a && i.push({ form: s, key: String(a) });
|
|
@@ -6984,8 +7056,8 @@ const f = class f {
|
|
|
6984
7056
|
for (const i of t) {
|
|
6985
7057
|
if (f.INITIAL_RESTORED_FORMS.has(i))
|
|
6986
7058
|
continue;
|
|
6987
|
-
const n =
|
|
6988
|
-
if (!(n instanceof
|
|
7059
|
+
const n = x.get(i);
|
|
7060
|
+
if (!(n instanceof w))
|
|
6989
7061
|
continue;
|
|
6990
7062
|
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;
|
|
6991
7063
|
if (!(!s && !c)) {
|
|
@@ -7214,11 +7286,11 @@ const f = class f {
|
|
|
7214
7286
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
7215
7287
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
7216
7288
|
!f.isGroupedCheckable(e) && !f.isMultipleSelect(e)) {
|
|
7217
|
-
const C = String(c),
|
|
7218
|
-
s.set(C,
|
|
7289
|
+
const C = String(c), H = s.get(C) ?? 0;
|
|
7290
|
+
s.set(C, H + 1), o.push(
|
|
7219
7291
|
f.applyFragmentValue(
|
|
7220
7292
|
e,
|
|
7221
|
-
D[
|
|
7293
|
+
D[H] ?? null,
|
|
7222
7294
|
i,
|
|
7223
7295
|
a
|
|
7224
7296
|
)
|
|
@@ -7259,12 +7331,12 @@ const f = class f {
|
|
|
7259
7331
|
A == null ? null : String(A)
|
|
7260
7332
|
) : null;
|
|
7261
7333
|
for (let C = 0; C < E.length; C++) {
|
|
7262
|
-
const
|
|
7334
|
+
const H = E[C], F = D ? D[C] : y.length > C ? y[C] : null;
|
|
7263
7335
|
o.push(
|
|
7264
7336
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
7265
7337
|
f.setPartValues(
|
|
7266
|
-
|
|
7267
|
-
f.asPlainRecord(
|
|
7338
|
+
H,
|
|
7339
|
+
f.asPlainRecord(F) ?? {},
|
|
7268
7340
|
r,
|
|
7269
7341
|
i,
|
|
7270
7342
|
n,
|
|
@@ -7305,14 +7377,14 @@ const f = class f {
|
|
|
7305
7377
|
* 番号を持つことになり、後勝ちが逆転する
|
|
7306
7378
|
* @returns すべての初期化処理が完了するPromise
|
|
7307
7379
|
*/
|
|
7308
|
-
static async reset(e, t =
|
|
7380
|
+
static async reset(e, t = w.nextSequence()) {
|
|
7309
7381
|
const r = f.collectBindingTargetForms(e);
|
|
7310
7382
|
if (r.length > 0 && r.every((n) => n.isSupplyStale(t)))
|
|
7311
7383
|
return;
|
|
7312
|
-
f.markResetSubtree(e, t),
|
|
7384
|
+
f.markResetSubtree(e, t), M.clearUserEditMarks(e, t), f.clearValues(e), await Promise.all([
|
|
7313
7385
|
f.clearMessages(e),
|
|
7314
7386
|
f.clearEachClones(e)
|
|
7315
|
-
]), await
|
|
7387
|
+
]), await K.enqueue(() => {
|
|
7316
7388
|
const n = f.collectEditsAfter(
|
|
7317
7389
|
e,
|
|
7318
7390
|
t
|
|
@@ -7323,16 +7395,16 @@ const f = class f {
|
|
|
7323
7395
|
} finally {
|
|
7324
7396
|
f.internalResetDepth -= 1;
|
|
7325
7397
|
}
|
|
7326
|
-
f.clearDeclarativeStateFromDom(e), f.restoreEdits(n);
|
|
7398
|
+
f.clearDeclarativeStateFromDom(e), M.invalidateDerivedSubtreeSignatures(e), f.restoreEdits(n);
|
|
7327
7399
|
});
|
|
7328
7400
|
const i = r;
|
|
7329
7401
|
for (const n of i) {
|
|
7330
7402
|
const s = f.getInitialBindingData(n);
|
|
7331
|
-
s === null && n.getRawBindingData() === null || await
|
|
7403
|
+
s === null && n.getRawBindingData() === null || await M.setBindingData(n.getTarget(), s ?? {}, {
|
|
7332
7404
|
sequence: t
|
|
7333
7405
|
});
|
|
7334
7406
|
}
|
|
7335
|
-
f.syncValuesFromDom(e), await
|
|
7407
|
+
f.syncValuesFromDom(e), await M.evaluateAll(e);
|
|
7336
7408
|
for (const n of i)
|
|
7337
7409
|
f.getInitialBindingData(n) !== null || n.getRawBindingData() !== null || await f.restoreAncestorArgValues(n, {
|
|
7338
7410
|
sequence: t,
|
|
@@ -7352,7 +7424,7 @@ const f = class f {
|
|
|
7352
7424
|
));
|
|
7353
7425
|
} else
|
|
7354
7426
|
c = f.mergeCollectedValues(c, a), f.deleteAncestorOwnedKeys(n, s, c);
|
|
7355
|
-
await
|
|
7427
|
+
await M.setBindingData(n.getTarget(), c, {
|
|
7356
7428
|
sequence: t
|
|
7357
7429
|
});
|
|
7358
7430
|
}
|
|
@@ -7380,7 +7452,7 @@ const f = class f {
|
|
|
7380
7452
|
*/
|
|
7381
7453
|
static getInitialBindingData(e) {
|
|
7382
7454
|
const t = e.getInitialBindAttribute();
|
|
7383
|
-
return t === null ? null :
|
|
7455
|
+
return t === null ? null : M.parseDataBind(t);
|
|
7384
7456
|
}
|
|
7385
7457
|
/**
|
|
7386
7458
|
* フラグメント配下の入力要素について、内部値を現在の DOM 値と再同期します。
|
|
@@ -7407,8 +7479,8 @@ const f = class f {
|
|
|
7407
7479
|
t instanceof HTMLFormElement ? r.push(t) : r.push(...Array.from(t.querySelectorAll("form")));
|
|
7408
7480
|
const i = [];
|
|
7409
7481
|
for (const n of r) {
|
|
7410
|
-
const s =
|
|
7411
|
-
s instanceof
|
|
7482
|
+
const s = x.get(n);
|
|
7483
|
+
s instanceof w && i.push(s);
|
|
7412
7484
|
}
|
|
7413
7485
|
return i;
|
|
7414
7486
|
}
|
|
@@ -7643,7 +7715,7 @@ f.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), f.LAST_ANCESTOR_ARG_VA
|
|
|
7643
7715
|
"constructor",
|
|
7644
7716
|
"prototype"
|
|
7645
7717
|
]), 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]*)$/;
|
|
7646
|
-
let
|
|
7718
|
+
let I = f;
|
|
7647
7719
|
class B {
|
|
7648
7720
|
/**
|
|
7649
7721
|
* カスタムイベントを発火します。
|
|
@@ -7883,11 +7955,11 @@ class B {
|
|
|
7883
7955
|
B.dispatch(e, "pollstop", { reason: t, count: r, elapsedMs: i });
|
|
7884
7956
|
}
|
|
7885
7957
|
}
|
|
7886
|
-
const
|
|
7958
|
+
const It = {
|
|
7887
7959
|
401: "unauthorized-redirect",
|
|
7888
7960
|
403: "forbidden-redirect"
|
|
7889
7961
|
};
|
|
7890
|
-
function
|
|
7962
|
+
function xt(b, e) {
|
|
7891
7963
|
return b.replace(/\{\{([\s\S]+?)\}\}/g, (t, r) => {
|
|
7892
7964
|
try {
|
|
7893
7965
|
const i = re.evaluate(String(r).trim(), e);
|
|
@@ -7897,13 +7969,13 @@ function It(b, e) {
|
|
|
7897
7969
|
}
|
|
7898
7970
|
});
|
|
7899
7971
|
}
|
|
7900
|
-
function
|
|
7972
|
+
function Ft(b, e) {
|
|
7901
7973
|
const t = b.getAttribute(e);
|
|
7902
7974
|
if (t === null || t === "")
|
|
7903
7975
|
return null;
|
|
7904
7976
|
if (!t.includes("{{"))
|
|
7905
7977
|
return t;
|
|
7906
|
-
const r =
|
|
7978
|
+
const r = x.get(b), i = r instanceof w ? r.getBindingData() : {}, n = xt(t, i);
|
|
7907
7979
|
return n === "" ? null : n;
|
|
7908
7980
|
}
|
|
7909
7981
|
function Nt(b, e, t) {
|
|
@@ -7920,13 +7992,13 @@ function Nt(b, e, t) {
|
|
|
7920
7992
|
return `${c}${u}${s}${o}`;
|
|
7921
7993
|
}
|
|
7922
7994
|
function ht(b) {
|
|
7923
|
-
const e =
|
|
7995
|
+
const e = It[b];
|
|
7924
7996
|
if (e === void 0 || typeof document > "u")
|
|
7925
7997
|
return !1;
|
|
7926
7998
|
const t = `${l.prefix}${e}`, r = [];
|
|
7927
7999
|
document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
|
|
7928
8000
|
for (const i of r) {
|
|
7929
|
-
const n =
|
|
8001
|
+
const n = Ft(i, t);
|
|
7930
8002
|
if (n === null)
|
|
7931
8003
|
continue;
|
|
7932
8004
|
const s = Nt(i, t, n);
|
|
@@ -7996,7 +8068,7 @@ class X {
|
|
|
7996
8068
|
}
|
|
7997
8069
|
}
|
|
7998
8070
|
}
|
|
7999
|
-
const
|
|
8071
|
+
const N = class N {
|
|
8000
8072
|
/**
|
|
8001
8073
|
* ストレージ種別に対応する `Storage` を解決します。
|
|
8002
8074
|
*
|
|
@@ -8014,7 +8086,7 @@ const x = class x {
|
|
|
8014
8086
|
throw new Error("storage is not available");
|
|
8015
8087
|
return t;
|
|
8016
8088
|
} catch (t) {
|
|
8017
|
-
return
|
|
8089
|
+
return N.WARNED_KINDS.has(e) || (N.WARNED_KINDS.add(e), m.warn(
|
|
8018
8090
|
"Haori",
|
|
8019
8091
|
`${e}Storage が利用できないため ${l.prefix}store を無効にします:`,
|
|
8020
8092
|
t
|
|
@@ -8032,7 +8104,7 @@ const x = class x {
|
|
|
8032
8104
|
* @returns 予約キーなら true
|
|
8033
8105
|
*/
|
|
8034
8106
|
static isReservedKey(e) {
|
|
8035
|
-
return
|
|
8107
|
+
return w.isReservedBindingKey(e);
|
|
8036
8108
|
}
|
|
8037
8109
|
/**
|
|
8038
8110
|
* 素の JSON オブジェクト(配列でないオブジェクト)かどうかを判定します。
|
|
@@ -8051,8 +8123,8 @@ const x = class x {
|
|
|
8051
8123
|
* @param message 警告メッセージ
|
|
8052
8124
|
*/
|
|
8053
8125
|
static warnOnce(e, t, r) {
|
|
8054
|
-
let i =
|
|
8055
|
-
i || (i = /* @__PURE__ */ new Set(),
|
|
8126
|
+
let i = N.WARNED_ELEMENTS.get(e);
|
|
8127
|
+
i || (i = /* @__PURE__ */ new Set(), N.WARNED_ELEMENTS.set(e, i)), !i.has(t) && (i.add(t), m.warn("Haori", r));
|
|
8056
8128
|
}
|
|
8057
8129
|
/**
|
|
8058
8130
|
* `data-each` の行の内側かどうかを判定します。
|
|
@@ -8089,13 +8161,13 @@ const x = class x {
|
|
|
8089
8161
|
return null;
|
|
8090
8162
|
const i = r.trim();
|
|
8091
8163
|
if (i === "")
|
|
8092
|
-
return
|
|
8164
|
+
return N.warnOnce(
|
|
8093
8165
|
t,
|
|
8094
8166
|
"key",
|
|
8095
8167
|
`${l.prefix}store にストレージキーが指定されていません。`
|
|
8096
8168
|
), null;
|
|
8097
8169
|
if (i.includes("{{"))
|
|
8098
|
-
return
|
|
8170
|
+
return N.warnOnce(
|
|
8099
8171
|
t,
|
|
8100
8172
|
"expression",
|
|
8101
8173
|
`${l.prefix}store に式は使用できません(静的な文字列を指定してください): ${i}`
|
|
@@ -8104,7 +8176,7 @@ const x = class x {
|
|
|
8104
8176
|
let s = "session";
|
|
8105
8177
|
if (n !== null) {
|
|
8106
8178
|
const d = n.trim();
|
|
8107
|
-
d === "local" || d === "session" ? s = d :
|
|
8179
|
+
d === "local" || d === "session" ? s = d : N.warnOnce(
|
|
8108
8180
|
t,
|
|
8109
8181
|
"type",
|
|
8110
8182
|
`${l.prefix}store-type は session または local を指定してください(session として扱います): ${d}`
|
|
@@ -8113,14 +8185,14 @@ const x = class x {
|
|
|
8113
8185
|
const a = e.getRawAttribute(`${l.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), c = e.getRawAttribute(`${l.prefix}store-params`);
|
|
8114
8186
|
let u = null;
|
|
8115
8187
|
if (c !== null) {
|
|
8116
|
-
const d = c.split("&").map((y) => y.trim()).filter((y) => y !== ""), p = d.filter((y) => !
|
|
8117
|
-
p.length !== d.length &&
|
|
8188
|
+
const d = c.split("&").map((y) => y.trim()).filter((y) => y !== ""), p = d.filter((y) => !N.isReservedKey(y));
|
|
8189
|
+
p.length !== d.length && N.warnOnce(
|
|
8118
8190
|
t,
|
|
8119
8191
|
"reserved",
|
|
8120
8192
|
`${l.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
8121
8193
|
), u = p.length > 0 ? p : null;
|
|
8122
8194
|
}
|
|
8123
|
-
return u === null && o === null ? (
|
|
8195
|
+
return u === null && o === null ? (N.warnOnce(
|
|
8124
8196
|
t,
|
|
8125
8197
|
"target",
|
|
8126
8198
|
`${l.prefix}store には ${l.prefix}store-params または ${l.prefix}store-arg のいずれかが必要です。`
|
|
@@ -8137,7 +8209,7 @@ const x = class x {
|
|
|
8137
8209
|
* @returns レコード。読み取れない場合は null
|
|
8138
8210
|
*/
|
|
8139
8211
|
static readRecord(e) {
|
|
8140
|
-
const t =
|
|
8212
|
+
const t = N.resolveStorage(e.kind);
|
|
8141
8213
|
if (!t)
|
|
8142
8214
|
return null;
|
|
8143
8215
|
let r;
|
|
@@ -8162,7 +8234,7 @@ const x = class x {
|
|
|
8162
8234
|
n
|
|
8163
8235
|
), null;
|
|
8164
8236
|
}
|
|
8165
|
-
return
|
|
8237
|
+
return N.isPlainRecord(i) ? i : (m.warn(
|
|
8166
8238
|
"Haori",
|
|
8167
8239
|
`保存済みデータがオブジェクトではありません: ${e.key}`
|
|
8168
8240
|
), null);
|
|
@@ -8180,7 +8252,7 @@ const x = class x {
|
|
|
8180
8252
|
const s = t[e.arg];
|
|
8181
8253
|
if (s === void 0)
|
|
8182
8254
|
return {};
|
|
8183
|
-
if (!
|
|
8255
|
+
if (!N.isPlainRecord(s))
|
|
8184
8256
|
return m.warn(
|
|
8185
8257
|
"Haori",
|
|
8186
8258
|
`保存済みデータの ${e.arg} がオブジェクトではありません: ` + e.key
|
|
@@ -8189,7 +8261,7 @@ const x = class x {
|
|
|
8189
8261
|
}
|
|
8190
8262
|
const i = e.params ?? Object.keys(r), n = {};
|
|
8191
8263
|
for (const s of i)
|
|
8192
|
-
|
|
8264
|
+
N.isReservedKey(s) || Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
8193
8265
|
return n;
|
|
8194
8266
|
}
|
|
8195
8267
|
/**
|
|
@@ -8206,7 +8278,7 @@ const x = class x {
|
|
|
8206
8278
|
static selectFromData(e, t) {
|
|
8207
8279
|
const r = e.params ?? Object.keys(t), i = {};
|
|
8208
8280
|
for (const n of r) {
|
|
8209
|
-
if (
|
|
8281
|
+
if (N.isReservedKey(n) || !Object.prototype.hasOwnProperty.call(t, n))
|
|
8210
8282
|
continue;
|
|
8211
8283
|
const s = t[n];
|
|
8212
8284
|
s !== void 0 && (i[n] = s);
|
|
@@ -8265,12 +8337,12 @@ const x = class x {
|
|
|
8265
8337
|
* @param selected 基準にする選択内容
|
|
8266
8338
|
*/
|
|
8267
8339
|
static seedSignature(e, t) {
|
|
8268
|
-
const r =
|
|
8340
|
+
const r = N.stringify(t);
|
|
8269
8341
|
if (r === null) {
|
|
8270
|
-
|
|
8342
|
+
N.SIGNATURES.delete(e);
|
|
8271
8343
|
return;
|
|
8272
8344
|
}
|
|
8273
|
-
|
|
8345
|
+
N.SIGNATURES.set(e, { json: r, refs: N.createRefs(t) });
|
|
8274
8346
|
}
|
|
8275
8347
|
/**
|
|
8276
8348
|
* レコードへ選択内容を書き込みます。
|
|
@@ -8284,12 +8356,12 @@ const x = class x {
|
|
|
8284
8356
|
* @returns 書き込めたら true
|
|
8285
8357
|
*/
|
|
8286
8358
|
static writeRecord(e, t) {
|
|
8287
|
-
const r =
|
|
8359
|
+
const r = N.resolveStorage(e.kind);
|
|
8288
8360
|
if (!r)
|
|
8289
8361
|
return !1;
|
|
8290
|
-
const i =
|
|
8362
|
+
const i = N.readRecord(e) ?? {};
|
|
8291
8363
|
if (e.arg !== null) {
|
|
8292
|
-
const n = i[e.arg], s =
|
|
8364
|
+
const n = i[e.arg], s = N.isPlainRecord(n) ? { ...n } : {};
|
|
8293
8365
|
i[e.arg] = { ...s, ...t };
|
|
8294
8366
|
} else
|
|
8295
8367
|
Object.assign(i, t);
|
|
@@ -8314,22 +8386,22 @@ const x = class x {
|
|
|
8314
8386
|
* @returns 復元完了の Promise
|
|
8315
8387
|
*/
|
|
8316
8388
|
static restore(e) {
|
|
8317
|
-
const t =
|
|
8389
|
+
const t = N.readDeclaration(e);
|
|
8318
8390
|
if (!t)
|
|
8319
8391
|
return Promise.resolve();
|
|
8320
8392
|
const r = e.getTarget();
|
|
8321
|
-
if (
|
|
8322
|
-
return
|
|
8393
|
+
if (N.isInsideEachRow(e))
|
|
8394
|
+
return N.warnOnce(
|
|
8323
8395
|
r,
|
|
8324
8396
|
"each-row",
|
|
8325
8397
|
`${l.prefix}each の行の内側では ${l.prefix}store を使用できません(行データは親要素側で配列キーを指定してください)。`
|
|
8326
8398
|
), Promise.resolve();
|
|
8327
|
-
|
|
8328
|
-
const i =
|
|
8329
|
-
return
|
|
8399
|
+
N.RESTORED_ELEMENTS.add(r);
|
|
8400
|
+
const i = N.readRecord(t), n = i ? N.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
8401
|
+
return N.seedSignature(r, N.selectFromData(t, s)), Object.keys(n).length === 0 ? Promise.resolve() : M.setBindingData(r, s, {
|
|
8330
8402
|
reentrant: !0,
|
|
8331
8403
|
kind: "nonSupply",
|
|
8332
|
-
sequence:
|
|
8404
|
+
sequence: w.nextSequence()
|
|
8333
8405
|
});
|
|
8334
8406
|
}
|
|
8335
8407
|
/**
|
|
@@ -8343,22 +8415,22 @@ const x = class x {
|
|
|
8343
8415
|
* @param fragment 対象フラグメント
|
|
8344
8416
|
*/
|
|
8345
8417
|
static mirror(e) {
|
|
8346
|
-
const t =
|
|
8347
|
-
if (!t ||
|
|
8418
|
+
const t = N.readDeclaration(e);
|
|
8419
|
+
if (!t || N.isInsideEachRow(e))
|
|
8348
8420
|
return;
|
|
8349
8421
|
const r = e.getTarget();
|
|
8350
|
-
if (!
|
|
8422
|
+
if (!N.RESTORED_ELEMENTS.has(r))
|
|
8351
8423
|
return;
|
|
8352
8424
|
const i = e.getRawBindingData();
|
|
8353
8425
|
if (!i)
|
|
8354
8426
|
return;
|
|
8355
|
-
const n =
|
|
8427
|
+
const n = N.selectFromData(t, i);
|
|
8356
8428
|
if (Object.keys(n).length === 0)
|
|
8357
8429
|
return;
|
|
8358
|
-
const s =
|
|
8359
|
-
if (s &&
|
|
8430
|
+
const s = N.SIGNATURES.get(r);
|
|
8431
|
+
if (s && N.hasSameRefs(s, n))
|
|
8360
8432
|
return;
|
|
8361
|
-
const a =
|
|
8433
|
+
const a = N.stringify(n);
|
|
8362
8434
|
if (a === null) {
|
|
8363
8435
|
m.warn(
|
|
8364
8436
|
"Haori",
|
|
@@ -8367,10 +8439,10 @@ const x = class x {
|
|
|
8367
8439
|
return;
|
|
8368
8440
|
}
|
|
8369
8441
|
if (s && s.json === a) {
|
|
8370
|
-
s.refs =
|
|
8442
|
+
s.refs = N.createRefs(n);
|
|
8371
8443
|
return;
|
|
8372
8444
|
}
|
|
8373
|
-
|
|
8445
|
+
N.writeRecord(t, n) && N.SIGNATURES.set(r, { json: a, refs: N.createRefs(n) });
|
|
8374
8446
|
}
|
|
8375
8447
|
/**
|
|
8376
8448
|
* レコードを破棄します。
|
|
@@ -8383,7 +8455,7 @@ const x = class x {
|
|
|
8383
8455
|
* @param kind ストレージ種別
|
|
8384
8456
|
*/
|
|
8385
8457
|
static clear(e, t) {
|
|
8386
|
-
const r =
|
|
8458
|
+
const r = N.resolveStorage(t);
|
|
8387
8459
|
if (r) {
|
|
8388
8460
|
try {
|
|
8389
8461
|
r.removeItem(e);
|
|
@@ -8391,7 +8463,7 @@ const x = class x {
|
|
|
8391
8463
|
m.warn("Haori", `ストレージの破棄に失敗しました: ${e}`, i);
|
|
8392
8464
|
return;
|
|
8393
8465
|
}
|
|
8394
|
-
|
|
8466
|
+
N.reseedDeclaringElements(e, t);
|
|
8395
8467
|
}
|
|
8396
8468
|
}
|
|
8397
8469
|
/**
|
|
@@ -8404,24 +8476,24 @@ const x = class x {
|
|
|
8404
8476
|
document.querySelectorAll(
|
|
8405
8477
|
`[${l.prefix}store]`
|
|
8406
8478
|
).forEach((i) => {
|
|
8407
|
-
if (!
|
|
8479
|
+
if (!N.RESTORED_ELEMENTS.has(i))
|
|
8408
8480
|
return;
|
|
8409
|
-
const n =
|
|
8410
|
-
if (!(n instanceof
|
|
8481
|
+
const n = x.get(i);
|
|
8482
|
+
if (!(n instanceof w))
|
|
8411
8483
|
return;
|
|
8412
|
-
const s =
|
|
8484
|
+
const s = N.readDeclaration(n);
|
|
8413
8485
|
if (!s || s.key !== e || s.kind !== t)
|
|
8414
8486
|
return;
|
|
8415
8487
|
const a = n.getRawBindingData();
|
|
8416
|
-
|
|
8488
|
+
N.seedSignature(
|
|
8417
8489
|
i,
|
|
8418
|
-
a ?
|
|
8490
|
+
a ? N.selectFromData(s, a) : {}
|
|
8419
8491
|
);
|
|
8420
8492
|
});
|
|
8421
8493
|
}
|
|
8422
8494
|
};
|
|
8423
|
-
|
|
8424
|
-
let De =
|
|
8495
|
+
N.SIGNATURES = /* @__PURE__ */ new WeakMap(), N.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), N.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), N.WARNED_KINDS = /* @__PURE__ */ new Set();
|
|
8496
|
+
let De = N;
|
|
8425
8497
|
class pt {
|
|
8426
8498
|
/**
|
|
8427
8499
|
* URLのクエリパラメータを取得します。
|
|
@@ -8460,7 +8532,7 @@ class pt {
|
|
|
8460
8532
|
}
|
|
8461
8533
|
}
|
|
8462
8534
|
}
|
|
8463
|
-
const
|
|
8535
|
+
const kt = [
|
|
8464
8536
|
"addErrorMessage",
|
|
8465
8537
|
"clearMessages",
|
|
8466
8538
|
"closeDialog",
|
|
@@ -8468,10 +8540,10 @@ const Ct = [
|
|
|
8468
8540
|
"dialog",
|
|
8469
8541
|
"openDialog",
|
|
8470
8542
|
"toast"
|
|
8471
|
-
],
|
|
8543
|
+
], Ct = "__haoriHistoryState__", Le = "data-haori-click-lock", Xe = "ファイルを保存できませんでした";
|
|
8472
8544
|
function Te() {
|
|
8473
8545
|
const e = globalThis.window?.Haori;
|
|
8474
|
-
return
|
|
8546
|
+
return kt.every(
|
|
8475
8547
|
(r) => typeof e?.[r] == "function"
|
|
8476
8548
|
) ? e : Re;
|
|
8477
8549
|
}
|
|
@@ -8547,14 +8619,14 @@ function mt(b, e, t) {
|
|
|
8547
8619
|
const r = b[e];
|
|
8548
8620
|
r === void 0 ? b[e] = t : Array.isArray(r) ? r.push(t) : b[e] = [r, t];
|
|
8549
8621
|
}
|
|
8550
|
-
function
|
|
8551
|
-
if (
|
|
8622
|
+
function ge(b, e) {
|
|
8623
|
+
if (I.isCompleteSetValue(e))
|
|
8552
8624
|
return e;
|
|
8553
8625
|
if (Array.isArray(e)) {
|
|
8554
8626
|
const t = Array.isArray(b) ? b.slice() : [];
|
|
8555
8627
|
let r = !1;
|
|
8556
8628
|
return e.forEach((i, n) => {
|
|
8557
|
-
i != null && (typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (t[n] =
|
|
8629
|
+
i != null && (typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (t[n] = ge(t[n], i), r = !0));
|
|
8558
8630
|
}), r ? t : b;
|
|
8559
8631
|
}
|
|
8560
8632
|
if (e !== null && typeof e == "object") {
|
|
@@ -8562,7 +8634,7 @@ function pe(b, e) {
|
|
|
8562
8634
|
for (const [r, i] of Object.entries(
|
|
8563
8635
|
e
|
|
8564
8636
|
))
|
|
8565
|
-
t[r] =
|
|
8637
|
+
t[r] = ge(t[r], i);
|
|
8566
8638
|
return t;
|
|
8567
8639
|
}
|
|
8568
8640
|
return e;
|
|
@@ -8612,18 +8684,18 @@ function Bt(b) {
|
|
|
8612
8684
|
}
|
|
8613
8685
|
] : [e, String(t)]) : String(b);
|
|
8614
8686
|
}
|
|
8615
|
-
function
|
|
8616
|
-
return b instanceof Blob ? !0 : Array.isArray(b) ? b.some(
|
|
8617
|
-
|
|
8687
|
+
function Ie(b) {
|
|
8688
|
+
return b instanceof Blob ? !0 : Array.isArray(b) ? b.some(Ie) : b !== null && typeof b == "object" ? Object.values(b).some(
|
|
8689
|
+
Ie
|
|
8618
8690
|
) : !1;
|
|
8619
8691
|
}
|
|
8620
8692
|
function Ut(b) {
|
|
8621
8693
|
return Object.values(b).some((e) => e instanceof Blob ? !1 : Array.isArray(e) ? e.some(
|
|
8622
|
-
(t) => !(t instanceof Blob) &&
|
|
8623
|
-
) :
|
|
8694
|
+
(t) => !(t instanceof Blob) && Ie(t)
|
|
8695
|
+
) : Ie(e));
|
|
8624
8696
|
}
|
|
8625
|
-
function
|
|
8626
|
-
return Ue(
|
|
8697
|
+
function Ne(b) {
|
|
8698
|
+
return Ue(I.getValues(b));
|
|
8627
8699
|
}
|
|
8628
8700
|
function Ue(b) {
|
|
8629
8701
|
const e = (r) => {
|
|
@@ -8633,7 +8705,7 @@ function Ue(b) {
|
|
|
8633
8705
|
return "";
|
|
8634
8706
|
if (Array.isArray(r)) {
|
|
8635
8707
|
const i = r.map(e);
|
|
8636
|
-
return
|
|
8708
|
+
return I.carryCollectedRowIdentity(r, i), i;
|
|
8637
8709
|
}
|
|
8638
8710
|
if (r !== null && typeof r == "object") {
|
|
8639
8711
|
const i = {};
|
|
@@ -8641,13 +8713,13 @@ function Ue(b) {
|
|
|
8641
8713
|
r
|
|
8642
8714
|
))
|
|
8643
8715
|
i[n] = e(s);
|
|
8644
|
-
return
|
|
8716
|
+
return I.carryCollectedRowIdentity(r, i), i;
|
|
8645
8717
|
}
|
|
8646
8718
|
return r;
|
|
8647
8719
|
}, t = {};
|
|
8648
8720
|
for (const [r, i] of Object.entries(b))
|
|
8649
8721
|
t[r] = e(i);
|
|
8650
|
-
return
|
|
8722
|
+
return I.carryCollectedRowIdentity(b, t), t;
|
|
8651
8723
|
}
|
|
8652
8724
|
function Ht(b, e) {
|
|
8653
8725
|
const t = new Headers(
|
|
@@ -8671,7 +8743,7 @@ const g = class g {
|
|
|
8671
8743
|
* @param domEvent 起点となった DOM イベント
|
|
8672
8744
|
*/
|
|
8673
8745
|
constructor(e, t = null, r = null) {
|
|
8674
|
-
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.twoWayCommitBind = !1, this.skipped = !1, this.operationSequence = r != null ?
|
|
8746
|
+
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.twoWayCommitBind = !1, this.skipped = !1, this.operationSequence = r != null ? w.nextOperationSequence() : w.nextSequence(), g.isElementFragment(e) ? (this.options = g.buildOptions(e, t), this.eventType = t) : (this.options = e, this.eventType = null), this.domEvent = r;
|
|
8675
8747
|
}
|
|
8676
8748
|
/**
|
|
8677
8749
|
* クリックで起動した手続きの結果を控えます。
|
|
@@ -8769,7 +8841,7 @@ const g = class g {
|
|
|
8769
8841
|
const r = e.getRawAttribute(t);
|
|
8770
8842
|
let i;
|
|
8771
8843
|
try {
|
|
8772
|
-
i =
|
|
8844
|
+
i = M.parseDataBind(r);
|
|
8773
8845
|
} catch (n) {
|
|
8774
8846
|
return m.error("Haori", `Invalid fetch headers: ${n}`), null;
|
|
8775
8847
|
}
|
|
@@ -8967,7 +9039,7 @@ const g = class g {
|
|
|
8967
9039
|
const a = r.trim();
|
|
8968
9040
|
if (g.SINGLE_PLACEHOLDER_REGEX.test(a))
|
|
8969
9041
|
return {
|
|
8970
|
-
value:
|
|
9042
|
+
value: M.parseDataBind(n),
|
|
8971
9043
|
hasUnresolvedReference: s
|
|
8972
9044
|
};
|
|
8973
9045
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
@@ -8976,7 +9048,7 @@ const g = class g {
|
|
|
8976
9048
|
e.getBindingData()
|
|
8977
9049
|
);
|
|
8978
9050
|
return {
|
|
8979
|
-
value:
|
|
9051
|
+
value: M.parseDataBind(c.value),
|
|
8980
9052
|
hasUnresolvedReference: s || c.hasUnresolvedReference
|
|
8981
9053
|
};
|
|
8982
9054
|
}
|
|
@@ -8985,7 +9057,7 @@ const g = class g {
|
|
|
8985
9057
|
e.getBindingData()
|
|
8986
9058
|
);
|
|
8987
9059
|
return {
|
|
8988
|
-
value:
|
|
9060
|
+
value: M.parseDataBind(o.value),
|
|
8989
9061
|
hasUnresolvedReference: s || o.hasUnresolvedReference
|
|
8990
9062
|
};
|
|
8991
9063
|
}
|
|
@@ -9001,8 +9073,8 @@ const g = class g {
|
|
|
9001
9073
|
targetFragment: e
|
|
9002
9074
|
}, i = t ? g.attrName(t, "if") : g.attrName(null, "if", !0);
|
|
9003
9075
|
if (e.hasAttribute(i)) {
|
|
9004
|
-
const
|
|
9005
|
-
typeof
|
|
9076
|
+
const R = e.getRawAttribute(i);
|
|
9077
|
+
typeof R == "string" && R.trim() !== "" ? (r.conditionExpression = I.unwrapConditionExpression(R), r.conditionAttributeName = i) : m.warn(
|
|
9006
9078
|
"Haori",
|
|
9007
9079
|
`${i} に条件式が指定されていません。`
|
|
9008
9080
|
);
|
|
@@ -9013,26 +9085,26 @@ const g = class g {
|
|
|
9013
9085
|
e.getAttribute(g.attrName(t, "confirm"))
|
|
9014
9086
|
)
|
|
9015
9087
|
)), e.hasAttribute(g.attrName(t, "data")) && (r.dataAttrName = g.attrName(t, "data")), e.hasAttribute(g.attrName(t, "form"))) {
|
|
9016
|
-
const
|
|
9088
|
+
const $ = X.read(
|
|
9017
9089
|
e,
|
|
9018
9090
|
g.attrName(t, "form")
|
|
9019
9091
|
);
|
|
9020
|
-
if (
|
|
9021
|
-
const
|
|
9022
|
-
|
|
9092
|
+
if ($) {
|
|
9093
|
+
const G = X.query(
|
|
9094
|
+
$,
|
|
9023
9095
|
g.attrName(t, "form")
|
|
9024
9096
|
);
|
|
9025
|
-
|
|
9026
|
-
|
|
9097
|
+
G !== null ? r.formFragment = I.getFormFragment(
|
|
9098
|
+
x.get(G)
|
|
9027
9099
|
) : m.error(
|
|
9028
9100
|
"Haori",
|
|
9029
|
-
`Form element not found: ${
|
|
9101
|
+
`Form element not found: ${$} (${g.attrName(t, "form")})`
|
|
9030
9102
|
);
|
|
9031
9103
|
} else
|
|
9032
|
-
r.formFragment =
|
|
9033
|
-
} else (t === "change" || t === "input") && (r.formFragment =
|
|
9104
|
+
r.formFragment = I.getFormFragment(e);
|
|
9105
|
+
} else (t === "change" || t === "input") && (r.formFragment = I.getFormFragment(e), r.formFragment === null && g.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
9034
9106
|
if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
|
|
9035
|
-
const
|
|
9107
|
+
const $ = e.getRawAttribute(
|
|
9036
9108
|
`${l.prefix}${t}-before-run`
|
|
9037
9109
|
);
|
|
9038
9110
|
try {
|
|
@@ -9041,45 +9113,45 @@ const g = class g {
|
|
|
9041
9113
|
"fetchOptions",
|
|
9042
9114
|
`
|
|
9043
9115
|
"use strict";
|
|
9044
|
-
${
|
|
9116
|
+
${$}
|
|
9045
9117
|
`
|
|
9046
9118
|
);
|
|
9047
|
-
} catch (
|
|
9048
|
-
m.error("Haori", `Invalid before script: ${
|
|
9119
|
+
} catch (G) {
|
|
9120
|
+
m.error("Haori", `Invalid before script: ${G}`);
|
|
9049
9121
|
}
|
|
9050
9122
|
}
|
|
9051
|
-
const
|
|
9052
|
-
if (e.hasAttribute(
|
|
9053
|
-
const
|
|
9054
|
-
let
|
|
9123
|
+
const R = g.attrName(t, "run");
|
|
9124
|
+
if (e.hasAttribute(R)) {
|
|
9125
|
+
const $ = String(e.getAttribute(R) ?? "");
|
|
9126
|
+
let G = null;
|
|
9055
9127
|
try {
|
|
9056
|
-
|
|
9128
|
+
G = new Function(
|
|
9057
9129
|
"event",
|
|
9058
9130
|
`"use strict"; return (
|
|
9059
|
-
${
|
|
9131
|
+
${$}
|
|
9060
9132
|
);`
|
|
9061
9133
|
);
|
|
9062
9134
|
} catch {
|
|
9063
9135
|
try {
|
|
9064
|
-
|
|
9065
|
-
${
|
|
9136
|
+
G = new Function("event", `"use strict";
|
|
9137
|
+
${$}
|
|
9066
9138
|
`);
|
|
9067
9139
|
} catch (Z) {
|
|
9068
9140
|
m.error("Haori", `Invalid run script: ${Z}`);
|
|
9069
9141
|
}
|
|
9070
9142
|
}
|
|
9071
|
-
|
|
9143
|
+
G && (r.runScript = G);
|
|
9072
9144
|
}
|
|
9073
9145
|
}
|
|
9074
9146
|
const n = g.attrName(t, "fetch"), s = e.hasAttribute(n);
|
|
9075
9147
|
if (s) {
|
|
9076
|
-
const
|
|
9077
|
-
|
|
9148
|
+
const R = e.getAttributeEvaluation(n);
|
|
9149
|
+
R && (r.fetchHasUnresolvedReference = R.hasUnresolvedReference, r.fetchUrl = R.hasUnresolvedReference ? null : R.value);
|
|
9078
9150
|
}
|
|
9079
9151
|
const a = {}, o = t ? g.attrName(t, "fetch-method") : g.attrName(null, "method", !0);
|
|
9080
9152
|
if (e.hasAttribute(o)) {
|
|
9081
|
-
const
|
|
9082
|
-
|
|
9153
|
+
const R = e.getAttributeEvaluation(o);
|
|
9154
|
+
R?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = g.normalizeAttributeText(R?.value) ?? void 0;
|
|
9083
9155
|
}
|
|
9084
9156
|
const c = t ? g.attrName(t, "fetch-headers") : g.attrName(null, "headers", !0), u = g.readFetchHeaders(
|
|
9085
9157
|
e,
|
|
@@ -9089,9 +9161,9 @@ ${k}
|
|
|
9089
9161
|
const d = t ? g.attrName(t, "fetch-content-type") : g.attrName(null, "content-type", !0);
|
|
9090
9162
|
let p = null;
|
|
9091
9163
|
if (e.hasAttribute(d)) {
|
|
9092
|
-
const
|
|
9093
|
-
|
|
9094
|
-
|
|
9164
|
+
const R = e.getAttributeEvaluation(d);
|
|
9165
|
+
R?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), p = g.normalizeAttributeText(
|
|
9166
|
+
R?.value
|
|
9095
9167
|
);
|
|
9096
9168
|
}
|
|
9097
9169
|
if (p !== null)
|
|
@@ -9100,10 +9172,10 @@ ${k}
|
|
|
9100
9172
|
p
|
|
9101
9173
|
);
|
|
9102
9174
|
else if (a.method && !g.hasDeclaredContentType(a.headers)) {
|
|
9103
|
-
const
|
|
9175
|
+
const R = a.method.toUpperCase();
|
|
9104
9176
|
a.headers = g.withContentType(
|
|
9105
9177
|
a.headers,
|
|
9106
|
-
|
|
9178
|
+
R === "GET" || R === "HEAD" || R === "OPTIONS" ? "application/x-www-form-urlencoded" : "application/json"
|
|
9107
9179
|
);
|
|
9108
9180
|
}
|
|
9109
9181
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
@@ -9115,20 +9187,20 @@ ${k}
|
|
|
9115
9187
|
);
|
|
9116
9188
|
else if (e.hasAttribute(y)) {
|
|
9117
9189
|
r.download = !0;
|
|
9118
|
-
const
|
|
9119
|
-
r.downloadFileName =
|
|
9190
|
+
const R = e.getAttributeEvaluation(y);
|
|
9191
|
+
r.downloadFileName = R?.hasUnresolvedReference ? null : g.normalizeAttributeText(R?.value);
|
|
9120
9192
|
}
|
|
9121
9193
|
const E = t ? g.attrName(t, "bind") : g.attrName(null, "bind", !0);
|
|
9122
9194
|
if (e.hasAttribute(E)) {
|
|
9123
|
-
const
|
|
9124
|
-
if (
|
|
9125
|
-
const
|
|
9126
|
-
|
|
9127
|
-
const Z =
|
|
9195
|
+
const R = X.read(e, E);
|
|
9196
|
+
if (R) {
|
|
9197
|
+
const $ = X.queryAll(R, E);
|
|
9198
|
+
$.length > 0 ? (r.bindFragments = [], $.forEach((G) => {
|
|
9199
|
+
const Z = x.get(G);
|
|
9128
9200
|
Z && r.bindFragments.push(Z);
|
|
9129
9201
|
})) : m.error(
|
|
9130
9202
|
"Haori",
|
|
9131
|
-
`Bind element not found: ${
|
|
9203
|
+
`Bind element not found: ${R} (${E})`
|
|
9132
9204
|
);
|
|
9133
9205
|
}
|
|
9134
9206
|
}
|
|
@@ -9136,53 +9208,53 @@ ${k}
|
|
|
9136
9208
|
t ? e.hasAttribute(A) && (r.bindArg = e.getRawAttribute(A)) : e.hasAttribute(D) ? r.bindArg = e.getRawAttribute(
|
|
9137
9209
|
D
|
|
9138
9210
|
) : e.hasAttribute(C) && (r.bindArg = e.getRawAttribute(C));
|
|
9139
|
-
const
|
|
9140
|
-
if (e.hasAttribute(
|
|
9141
|
-
const
|
|
9142
|
-
r.bindParams =
|
|
9143
|
-
}
|
|
9144
|
-
const
|
|
9145
|
-
if (e.hasAttribute(
|
|
9146
|
-
const
|
|
9147
|
-
r.bindAppendParams =
|
|
9148
|
-
}
|
|
9149
|
-
const
|
|
9150
|
-
e.hasAttribute(
|
|
9151
|
-
const
|
|
9152
|
-
e.hasAttribute(
|
|
9211
|
+
const H = t ? g.attrName(t, "bind-params") : g.attrName(null, "bind-params", !0);
|
|
9212
|
+
if (e.hasAttribute(H)) {
|
|
9213
|
+
const R = e.getRawAttribute(H);
|
|
9214
|
+
r.bindParams = R.split("&").map(($) => $.trim());
|
|
9215
|
+
}
|
|
9216
|
+
const F = t ? g.attrName(t, "bind-append") : g.attrName(null, "bind-append", !0);
|
|
9217
|
+
if (e.hasAttribute(F)) {
|
|
9218
|
+
const R = e.getRawAttribute(F);
|
|
9219
|
+
r.bindAppendParams = R.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9220
|
+
}
|
|
9221
|
+
const j = t ? g.attrName(t, "bind-merge") : g.attrName(null, "bind-merge", !0);
|
|
9222
|
+
e.hasAttribute(j) && (r.bindMerge = !0);
|
|
9223
|
+
const Y = t ? g.attrName(t, "bind-transform") : g.attrName(null, "bind-transform", !0);
|
|
9224
|
+
e.hasAttribute(Y) && (r.bindTransform = e.getRawAttribute(Y));
|
|
9153
9225
|
const Q = t ? g.attrName(t, "copy-params") : null;
|
|
9154
9226
|
if (Q && e.hasAttribute(Q)) {
|
|
9155
|
-
const
|
|
9156
|
-
r.copyParams =
|
|
9227
|
+
const R = e.getRawAttribute(Q);
|
|
9228
|
+
r.copyParams = R.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9157
9229
|
}
|
|
9158
9230
|
if (t) {
|
|
9159
9231
|
if (e.hasAttribute(g.attrName(t, "adjust"))) {
|
|
9160
|
-
const
|
|
9232
|
+
const q = X.read(
|
|
9161
9233
|
e,
|
|
9162
9234
|
g.attrName(t, "adjust")
|
|
9163
9235
|
);
|
|
9164
|
-
if (
|
|
9165
|
-
const
|
|
9166
|
-
|
|
9236
|
+
if (q) {
|
|
9237
|
+
const z = X.queryAll(
|
|
9238
|
+
q,
|
|
9167
9239
|
g.attrName(t, "adjust")
|
|
9168
9240
|
);
|
|
9169
|
-
|
|
9170
|
-
const J =
|
|
9241
|
+
z.length > 0 ? (r.adjustFragments = [], z.forEach((_) => {
|
|
9242
|
+
const J = x.get(_);
|
|
9171
9243
|
J && r.adjustFragments.push(J);
|
|
9172
9244
|
})) : m.error(
|
|
9173
9245
|
"Haori",
|
|
9174
|
-
`Adjust element not found: ${
|
|
9246
|
+
`Adjust element not found: ${q} (${g.attrName(t, "adjust")})`
|
|
9175
9247
|
);
|
|
9176
9248
|
}
|
|
9177
9249
|
if (e.hasAttribute(g.attrName(t, "adjust-value"))) {
|
|
9178
|
-
const
|
|
9250
|
+
const z = e.getRawAttribute(
|
|
9179
9251
|
g.attrName(t, "adjust-value")
|
|
9180
|
-
), _ = Number(
|
|
9252
|
+
), _ = Number(z);
|
|
9181
9253
|
isNaN(_) || (r.adjustValue = _);
|
|
9182
9254
|
}
|
|
9183
9255
|
}
|
|
9184
9256
|
if (e.hasAttribute(g.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(g.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(g.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(g.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
|
|
9185
|
-
const
|
|
9257
|
+
const q = e.getRawAttribute(
|
|
9186
9258
|
`${l.prefix}${t}-after-run`
|
|
9187
9259
|
);
|
|
9188
9260
|
try {
|
|
@@ -9190,11 +9262,11 @@ ${k}
|
|
|
9190
9262
|
"response",
|
|
9191
9263
|
`
|
|
9192
9264
|
"use strict";
|
|
9193
|
-
${
|
|
9265
|
+
${q}
|
|
9194
9266
|
`
|
|
9195
9267
|
);
|
|
9196
|
-
} catch (
|
|
9197
|
-
m.error("Haori", `Invalid after script: ${
|
|
9268
|
+
} catch (z) {
|
|
9269
|
+
m.error("Haori", `Invalid after script: ${z}`);
|
|
9198
9270
|
}
|
|
9199
9271
|
}
|
|
9200
9272
|
if (e.hasAttribute(g.attrName(t, "dialog")) && (r.dialogMessage = g.unescapeNewlines(
|
|
@@ -9211,32 +9283,32 @@ ${V}
|
|
|
9211
9283
|
"toast",
|
|
9212
9284
|
g.attrName(t, "toast")
|
|
9213
9285
|
);
|
|
9214
|
-
const
|
|
9286
|
+
const q = e.getRawAttribute(
|
|
9215
9287
|
g.attrName(t, "toast-level")
|
|
9216
|
-
), _ = ["info", "warning", "error", "success"].includes(
|
|
9217
|
-
r.toastLevel = _ ?
|
|
9288
|
+
), _ = ["info", "warning", "error", "success"].includes(q);
|
|
9289
|
+
r.toastLevel = _ ? q : null;
|
|
9218
9290
|
}
|
|
9219
|
-
const
|
|
9220
|
-
if (
|
|
9291
|
+
const R = g.attrName(t, "redirect"), $ = g.attrName(t, "redirect-replace"), G = e.hasAttribute(R), Z = e.hasAttribute($);
|
|
9292
|
+
if (G && (r.redirectUrl = g.readLateAttribute(
|
|
9221
9293
|
e,
|
|
9222
9294
|
r,
|
|
9223
9295
|
"redirect",
|
|
9224
|
-
|
|
9296
|
+
R
|
|
9225
9297
|
)), Z && (r.redirectReplaceUrl = g.readLateAttribute(
|
|
9226
9298
|
e,
|
|
9227
9299
|
r,
|
|
9228
9300
|
"redirect-replace",
|
|
9229
|
-
|
|
9230
|
-
)),
|
|
9231
|
-
const
|
|
9301
|
+
$
|
|
9302
|
+
)), G || Z) {
|
|
9303
|
+
const q = g.attrName(
|
|
9232
9304
|
t,
|
|
9233
9305
|
"redirect-return-param"
|
|
9234
9306
|
);
|
|
9235
|
-
e.hasAttribute(
|
|
9307
|
+
e.hasAttribute(q) && (r.redirectReturnParam = g.readLateAttribute(
|
|
9236
9308
|
e,
|
|
9237
9309
|
r,
|
|
9238
9310
|
"redirect-return-param",
|
|
9239
|
-
|
|
9311
|
+
q
|
|
9240
9312
|
));
|
|
9241
9313
|
}
|
|
9242
9314
|
if (e.hasAttribute(g.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(g.attrName(t, "scroll")) && (r.scrollTarget = g.readLateAttribute(
|
|
@@ -9250,23 +9322,23 @@ ${V}
|
|
|
9250
9322
|
"history",
|
|
9251
9323
|
g.attrName(t, "history")
|
|
9252
9324
|
)), e.hasAttribute(g.attrName(t, "history-data")) && (r.historyDataAttrName = g.attrName(t, "history-data")), e.hasAttribute(g.attrName(t, "history-form"))) {
|
|
9253
|
-
const
|
|
9325
|
+
const q = X.read(
|
|
9254
9326
|
e,
|
|
9255
9327
|
g.attrName(t, "history-form")
|
|
9256
9328
|
);
|
|
9257
|
-
if (
|
|
9258
|
-
const
|
|
9259
|
-
|
|
9329
|
+
if (q) {
|
|
9330
|
+
const z = X.query(
|
|
9331
|
+
q,
|
|
9260
9332
|
g.attrName(t, "history-form")
|
|
9261
9333
|
);
|
|
9262
|
-
|
|
9263
|
-
|
|
9334
|
+
z !== null ? r.historyFormFragment = I.getFormFragment(
|
|
9335
|
+
x.get(z)
|
|
9264
9336
|
) : m.error(
|
|
9265
9337
|
"Haori",
|
|
9266
|
-
`Form element not found: ${
|
|
9338
|
+
`Form element not found: ${q} (${g.attrName(t, "history-form")})`
|
|
9267
9339
|
);
|
|
9268
9340
|
} else
|
|
9269
|
-
r.historyFormFragment =
|
|
9341
|
+
r.historyFormFragment = I.getFormFragment(e);
|
|
9270
9342
|
}
|
|
9271
9343
|
[
|
|
9272
9344
|
"reset-before",
|
|
@@ -9276,23 +9348,23 @@ ${V}
|
|
|
9276
9348
|
"copy",
|
|
9277
9349
|
"open",
|
|
9278
9350
|
"close"
|
|
9279
|
-
].forEach((
|
|
9280
|
-
const
|
|
9281
|
-
if (!e.hasAttribute(
|
|
9351
|
+
].forEach((q) => {
|
|
9352
|
+
const z = g.attrName(t, q);
|
|
9353
|
+
if (!e.hasAttribute(z))
|
|
9282
9354
|
return;
|
|
9283
|
-
const _ = X.read(e,
|
|
9355
|
+
const _ = X.read(e, z), J = [];
|
|
9284
9356
|
if (_)
|
|
9285
|
-
X.queryAll(_,
|
|
9286
|
-
const ue =
|
|
9357
|
+
X.queryAll(_, z).forEach((ce) => {
|
|
9358
|
+
const ue = x.get(ce);
|
|
9287
9359
|
ue && J.push(ue);
|
|
9288
|
-
}), J.length === 0 && m.error("Haori", `Element not found: ${_} (${
|
|
9289
|
-
else if (
|
|
9360
|
+
}), J.length === 0 && m.error("Haori", `Element not found: ${_} (${z})`);
|
|
9361
|
+
else if (q === "open" || q === "close") {
|
|
9290
9362
|
const be = e.getTarget().closest("dialog");
|
|
9291
|
-
be ? J.push(
|
|
9363
|
+
be ? J.push(x.get(be)) : m.error("Haori", `Ancestor <dialog> not found (${z})`);
|
|
9292
9364
|
} else
|
|
9293
9365
|
J.push(e);
|
|
9294
9366
|
if (J.length > 0)
|
|
9295
|
-
switch (
|
|
9367
|
+
switch (q) {
|
|
9296
9368
|
case "reset-before":
|
|
9297
9369
|
r.resetBeforeFragments = J;
|
|
9298
9370
|
break;
|
|
@@ -9303,7 +9375,7 @@ ${V}
|
|
|
9303
9375
|
r.refetchFragments = J;
|
|
9304
9376
|
break;
|
|
9305
9377
|
case "click":
|
|
9306
|
-
r.clickFragments = J, r.clickAwait = e.hasAttribute(`${
|
|
9378
|
+
r.clickFragments = J, r.clickAwait = e.hasAttribute(`${z}-await`);
|
|
9307
9379
|
break;
|
|
9308
9380
|
case "copy":
|
|
9309
9381
|
r.copyFragments = J;
|
|
@@ -9318,67 +9390,67 @@ ${V}
|
|
|
9318
9390
|
});
|
|
9319
9391
|
const le = g.attrName(t, "copy-source");
|
|
9320
9392
|
if (e.hasAttribute(le)) {
|
|
9321
|
-
const
|
|
9322
|
-
if (
|
|
9323
|
-
const
|
|
9324
|
-
if (
|
|
9325
|
-
const _ =
|
|
9393
|
+
const q = X.read(e, le);
|
|
9394
|
+
if (q) {
|
|
9395
|
+
const z = X.query(q, le);
|
|
9396
|
+
if (z !== null) {
|
|
9397
|
+
const _ = x.get(z);
|
|
9326
9398
|
_ ? r.copySourceFragment = _ : m.error(
|
|
9327
9399
|
"Haori",
|
|
9328
|
-
`Element is not managed by Haori: ${
|
|
9400
|
+
`Element is not managed by Haori: ${q} (${le})`
|
|
9329
9401
|
);
|
|
9330
9402
|
} else
|
|
9331
9403
|
m.error(
|
|
9332
9404
|
"Haori",
|
|
9333
|
-
`Element not found: ${
|
|
9405
|
+
`Element not found: ${q} (${le})`
|
|
9334
9406
|
);
|
|
9335
9407
|
} else
|
|
9336
9408
|
r.copySourceFragment = e;
|
|
9337
9409
|
}
|
|
9338
9410
|
}
|
|
9339
9411
|
if (!t && (e.hasAttribute(g.attrName(null, "data", !0)) && (r.dataAttrName = g.attrName(null, "data", !0)), e.hasAttribute(g.attrName(null, "form", !0)))) {
|
|
9340
|
-
const
|
|
9412
|
+
const R = X.read(
|
|
9341
9413
|
e,
|
|
9342
9414
|
g.attrName(null, "form", !0)
|
|
9343
9415
|
);
|
|
9344
|
-
if (
|
|
9345
|
-
const
|
|
9346
|
-
|
|
9416
|
+
if (R) {
|
|
9417
|
+
const $ = X.query(
|
|
9418
|
+
R,
|
|
9347
9419
|
g.attrName(null, "form", !0)
|
|
9348
9420
|
);
|
|
9349
|
-
|
|
9350
|
-
|
|
9421
|
+
$ !== null ? r.formFragment = I.getFormFragment(
|
|
9422
|
+
x.get($)
|
|
9351
9423
|
) : m.error(
|
|
9352
9424
|
"Haori",
|
|
9353
|
-
`Form element not found: ${
|
|
9425
|
+
`Form element not found: ${R} (${g.attrName(null, "fetch-form", !0)})`
|
|
9354
9426
|
);
|
|
9355
9427
|
} else
|
|
9356
|
-
r.formFragment =
|
|
9357
|
-
}
|
|
9358
|
-
const
|
|
9359
|
-
if (e.hasAttribute(
|
|
9360
|
-
const
|
|
9361
|
-
|
|
9362
|
-
const oe =
|
|
9363
|
-
oe &&
|
|
9364
|
-
}),
|
|
9428
|
+
r.formFragment = I.getFormFragment(e);
|
|
9429
|
+
}
|
|
9430
|
+
const P = t ? g.attrName(t, "fetch-state") : g.attrName(null, "state", !0);
|
|
9431
|
+
if (e.hasAttribute(P)) {
|
|
9432
|
+
const R = X.read(e, P), $ = [];
|
|
9433
|
+
R ? (X.queryAll(R, P).forEach((Z) => {
|
|
9434
|
+
const oe = x.get(Z);
|
|
9435
|
+
oe && $.push(oe);
|
|
9436
|
+
}), $.length === 0 && m.error(
|
|
9365
9437
|
"Haori",
|
|
9366
|
-
`Element not found: ${
|
|
9367
|
-
)) :
|
|
9438
|
+
`Element not found: ${R} (${P})`
|
|
9439
|
+
)) : $.push(e), $.length > 0 && (r.fetchStateFragments = $);
|
|
9368
9440
|
}
|
|
9369
9441
|
const ie = t ? g.attrName(t, "store-clear") : g.attrName(null, "store-clear", !0);
|
|
9370
9442
|
if (e.hasAttribute(ie)) {
|
|
9371
|
-
const
|
|
9372
|
-
if (
|
|
9443
|
+
const R = e.getRawAttribute(ie), $ = R === null ? "" : R.trim();
|
|
9444
|
+
if ($ === "")
|
|
9373
9445
|
m.error(
|
|
9374
9446
|
"Haori",
|
|
9375
9447
|
`ストレージキーが指定されていません (${ie})`
|
|
9376
9448
|
);
|
|
9377
9449
|
else {
|
|
9378
|
-
r.storeClearKey =
|
|
9379
|
-
const
|
|
9450
|
+
r.storeClearKey = $;
|
|
9451
|
+
const G = e.getRawAttribute(
|
|
9380
9452
|
`${ie}-type`
|
|
9381
|
-
), Z =
|
|
9453
|
+
), Z = G === null ? "session" : G.trim();
|
|
9382
9454
|
Z === "local" || Z === "session" ? r.storeClearKind = Z : (m.warn(
|
|
9383
9455
|
"Haori",
|
|
9384
9456
|
`${ie}-type は session または local を指定してください(session として扱います): ${Z}`
|
|
@@ -9495,8 +9567,8 @@ ${V}
|
|
|
9495
9567
|
return this.skipped = !0, !1;
|
|
9496
9568
|
if (this.options.formFragment && this.validate(this.options.formFragment) === !1)
|
|
9497
9569
|
return !1;
|
|
9498
|
-
if (!this.options.formFragment && this.options.targetFragment &&
|
|
9499
|
-
|
|
9570
|
+
if (!this.options.formFragment && this.options.targetFragment && I.warnUnvalidatedCustomValidity(
|
|
9571
|
+
I.getFormFragment(this.options.targetFragment),
|
|
9500
9572
|
`${l.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
9501
9573
|
), !this.evaluateExecutionCondition())
|
|
9502
9574
|
return this.skipped = !0, !1;
|
|
@@ -9516,11 +9588,11 @@ ${V}
|
|
|
9516
9588
|
return !1;
|
|
9517
9589
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
9518
9590
|
this.options.resetBeforeFragments.map(
|
|
9519
|
-
(p) =>
|
|
9591
|
+
(p) => I.reset(p, this.operationSequence)
|
|
9520
9592
|
)
|
|
9521
9593
|
), this.captureHistorySnapshots());
|
|
9522
9594
|
const r = this.prepareFetchRequest();
|
|
9523
|
-
this.requestUserEditSequence =
|
|
9595
|
+
this.requestUserEditSequence = w.currentSequence();
|
|
9524
9596
|
const i = r.payload;
|
|
9525
9597
|
let n = r.url, s = r.options, a = !1, o = !1;
|
|
9526
9598
|
if (this.options.beforeCallback) {
|
|
@@ -9541,22 +9613,22 @@ ${V}
|
|
|
9541
9613
|
s
|
|
9542
9614
|
);
|
|
9543
9615
|
n = A.url;
|
|
9544
|
-
const D = { ...A.options }, C = A.normalized ? A.requestedMethod : r.requestedMethod,
|
|
9545
|
-
if (
|
|
9616
|
+
const D = { ...A.options }, C = A.normalized ? A.requestedMethod : r.requestedMethod, H = A.effectiveMethod, F = r.transportMode === "query-get" || A.normalized, j = A.queryString ?? r.queryString;
|
|
9617
|
+
if (F && m.info("Haori demo fetch normalization", {
|
|
9546
9618
|
runtime: l.runtime,
|
|
9547
9619
|
requestedMethod: C,
|
|
9548
|
-
effectiveMethod:
|
|
9620
|
+
effectiveMethod: H,
|
|
9549
9621
|
transportMode: "query-get",
|
|
9550
9622
|
url: n,
|
|
9551
9623
|
payload: c ? i : void 0,
|
|
9552
|
-
queryString:
|
|
9624
|
+
queryString: j
|
|
9553
9625
|
}), this.options.targetFragment && n) {
|
|
9554
|
-
const
|
|
9626
|
+
const Y = performance.now(), Q = {
|
|
9555
9627
|
runtime: l.runtime,
|
|
9556
9628
|
requestedMethod: C,
|
|
9557
|
-
effectiveMethod:
|
|
9558
|
-
transportMode:
|
|
9559
|
-
...
|
|
9629
|
+
effectiveMethod: H,
|
|
9630
|
+
transportMode: F ? "query-get" : "http",
|
|
9631
|
+
...F ? { queryString: j } : {}
|
|
9560
9632
|
};
|
|
9561
9633
|
return B.fetchStart(
|
|
9562
9634
|
this.options.targetFragment.getTarget(),
|
|
@@ -9564,47 +9636,47 @@ ${V}
|
|
|
9564
9636
|
D,
|
|
9565
9637
|
c ? i : void 0,
|
|
9566
9638
|
Q
|
|
9567
|
-
), await this.injectFetchState("loading"), await g.invokeFetch(n, D).then((
|
|
9568
|
-
|
|
9639
|
+
), await this.injectFetchState("loading"), await g.invokeFetch(n, D).then((P) => this.handleFetchResult(
|
|
9640
|
+
P,
|
|
9569
9641
|
n || void 0,
|
|
9570
|
-
|
|
9571
|
-
)).catch(async (
|
|
9642
|
+
Y
|
|
9643
|
+
)).catch(async (P) => {
|
|
9572
9644
|
throw n && B.fetchError(
|
|
9573
9645
|
this.options.targetFragment.getTarget(),
|
|
9574
9646
|
n,
|
|
9575
|
-
|
|
9647
|
+
P
|
|
9576
9648
|
), await this.injectFetchState(
|
|
9577
9649
|
"error",
|
|
9578
9650
|
null,
|
|
9579
|
-
|
|
9580
|
-
),
|
|
9651
|
+
P instanceof Error ? P.message : String(P)
|
|
9652
|
+
), P;
|
|
9581
9653
|
});
|
|
9582
9654
|
}
|
|
9583
|
-
return await fetch(n, D).then((
|
|
9655
|
+
return await fetch(n, D).then((Y) => this.handleFetchResult(Y, n || void 0));
|
|
9584
9656
|
}
|
|
9585
9657
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
|
|
9586
9658
|
const p = this.options.formFragment, y = p.getTarget(), E = /* @__PURE__ */ new Set();
|
|
9587
9659
|
e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
|
|
9588
9660
|
const A = p.getRawBindingData(), D = Ue(i), C = p.getAttribute(`${l.prefix}form-arg`);
|
|
9589
|
-
let
|
|
9661
|
+
let H;
|
|
9590
9662
|
if (C) {
|
|
9591
|
-
|
|
9592
|
-
const
|
|
9593
|
-
|
|
9594
|
-
(
|
|
9663
|
+
H = { ...A ?? {} };
|
|
9664
|
+
const F = String(C), j = I.resolveAncestorArgOwner(p, F);
|
|
9665
|
+
H[F] = I.mergeCollectedValues(
|
|
9666
|
+
(j ? j.value : H[F]) ?? null,
|
|
9595
9667
|
D
|
|
9596
9668
|
);
|
|
9597
9669
|
} else
|
|
9598
|
-
|
|
9670
|
+
H = I.mergeCollectedValues(
|
|
9599
9671
|
A,
|
|
9600
9672
|
D,
|
|
9601
|
-
|
|
9673
|
+
I.ancestorBaseResolver(p)
|
|
9602
9674
|
);
|
|
9603
|
-
await
|
|
9675
|
+
await M.setBindingData(y, H, {
|
|
9604
9676
|
skipFragments: E,
|
|
9605
9677
|
kind: "nonSupply",
|
|
9606
9678
|
sequence: this.operationSequence,
|
|
9607
|
-
editedPaths:
|
|
9679
|
+
editedPaths: I.collectEditedPaths(
|
|
9608
9680
|
p,
|
|
9609
9681
|
this.operationSequence,
|
|
9610
9682
|
C ? String(C) : "",
|
|
@@ -9629,23 +9701,69 @@ ${V}
|
|
|
9629
9701
|
acquireExecutionLock() {
|
|
9630
9702
|
if (this.eventType !== "click" || !this.options.targetFragment)
|
|
9631
9703
|
return null;
|
|
9632
|
-
const
|
|
9704
|
+
const e = this.options.targetFragment, t = e.getTarget();
|
|
9633
9705
|
if (g.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Le))
|
|
9634
9706
|
return !1;
|
|
9635
9707
|
const r = t.hasAttribute(`${l.prefix}click-no-disabled`);
|
|
9636
9708
|
return g.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Le, ""), r || t.setAttribute("disabled", ""), {
|
|
9637
9709
|
target: t,
|
|
9710
|
+
fragment: e,
|
|
9638
9711
|
appliedDisabledAttribute: !r
|
|
9639
9712
|
};
|
|
9640
9713
|
}
|
|
9714
|
+
/**
|
|
9715
|
+
* 起点要素が持つ `disabled` の宣言を探します。
|
|
9716
|
+
*
|
|
9717
|
+
* `data-attr-disabled` は値によらず宣言です。素の `disabled` は、生値に式を含む
|
|
9718
|
+
* ときだけ宣言として扱います(静的な `disabled` を持つ要素は、そもそもロックを
|
|
9719
|
+
* 取得しません)。
|
|
9720
|
+
*
|
|
9721
|
+
* 宣言はロックを取得した時点のフラグメントから読みます。要素から引き直すと、
|
|
9722
|
+
* 走査対象から外れていた場合にロックが付けた `disabled` を宣言として取り込んだ
|
|
9723
|
+
* 新しいフラグメントができてしまいます。
|
|
9724
|
+
*
|
|
9725
|
+
* @param fragment 起点要素のフラグメント
|
|
9726
|
+
* @returns 宣言の属性名と生値。宣言が無ければ null
|
|
9727
|
+
*/
|
|
9728
|
+
static findDisabledDeclaration(e) {
|
|
9729
|
+
const t = `${l.prefix}attr-disabled`, r = e.getRawAttribute(t);
|
|
9730
|
+
if (r !== null)
|
|
9731
|
+
return { name: t, value: r };
|
|
9732
|
+
const i = e.getRawAttribute("disabled");
|
|
9733
|
+
return i !== null && i.includes("{{") ? { name: "disabled", value: i } : null;
|
|
9734
|
+
}
|
|
9641
9735
|
/**
|
|
9642
9736
|
* 取得済みの実行ロックを解放します。
|
|
9643
9737
|
*
|
|
9738
|
+
* ロックが付けた `disabled` は、その時点の宣言の評価結果へ揃えます(仕様
|
|
9739
|
+
* 「`data-{event}-fetch`」)。無条件に外すと、押下の手続きが書いた
|
|
9740
|
+
* `data-attr-disabled` の評価結果まで消え、押したボタンだけが「条件は真なのに
|
|
9741
|
+
* 活性」という状態で残ります。
|
|
9742
|
+
*
|
|
9644
9743
|
* @param executionLock 解放対象のロック情報。
|
|
9645
9744
|
* @returns 戻り値はありません。
|
|
9646
9745
|
*/
|
|
9647
9746
|
releaseExecutionLock(e) {
|
|
9648
|
-
|
|
9747
|
+
if (!e)
|
|
9748
|
+
return;
|
|
9749
|
+
const t = e.target;
|
|
9750
|
+
if (g.RUNNING_CLICK_TARGETS.delete(t), t.removeAttribute(Le), !e.appliedDisabledAttribute)
|
|
9751
|
+
return;
|
|
9752
|
+
const r = g.findDisabledDeclaration(
|
|
9753
|
+
e.fragment
|
|
9754
|
+
);
|
|
9755
|
+
if (r === null) {
|
|
9756
|
+
t.removeAttribute("disabled");
|
|
9757
|
+
return;
|
|
9758
|
+
}
|
|
9759
|
+
M.setAttribute(t, r.name, r.value).catch(
|
|
9760
|
+
(i) => {
|
|
9761
|
+
m.error(
|
|
9762
|
+
"Haori",
|
|
9763
|
+
`ロックの解除で ${r.name} を適用し直せませんでした: ${i}`
|
|
9764
|
+
);
|
|
9765
|
+
}
|
|
9766
|
+
);
|
|
9649
9767
|
}
|
|
9650
9768
|
/**
|
|
9651
9769
|
* 応答本文をファイルとして保存します。
|
|
@@ -9686,7 +9804,7 @@ ${V}
|
|
|
9686
9804
|
* @returns 表示の完了 Promise
|
|
9687
9805
|
*/
|
|
9688
9806
|
async showDownloadFailure() {
|
|
9689
|
-
const e = this.options.formFragment ?? (this.options.targetFragment ?
|
|
9807
|
+
const e = this.options.formFragment ?? (this.options.targetFragment ? I.getFormFragment(this.options.targetFragment) || this.options.targetFragment : null), t = e ? e.getTarget() : document.body, r = Te();
|
|
9690
9808
|
await r.clearMessages(t), await r.addErrorMessage(t, Xe);
|
|
9691
9809
|
}
|
|
9692
9810
|
/**
|
|
@@ -9805,7 +9923,7 @@ ${V}
|
|
|
9805
9923
|
const n = [];
|
|
9806
9924
|
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(
|
|
9807
9925
|
this.options.resetFragments.map(
|
|
9808
|
-
(E) =>
|
|
9926
|
+
(E) => I.reset(E, this.operationSequence)
|
|
9809
9927
|
)
|
|
9810
9928
|
), await this.copy();
|
|
9811
9929
|
const s = [];
|
|
@@ -9815,7 +9933,7 @@ ${V}
|
|
|
9815
9933
|
let a = !1;
|
|
9816
9934
|
if (this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
9817
9935
|
for (const E of this.options.clickFragments) {
|
|
9818
|
-
await
|
|
9936
|
+
await M.evaluateAll(E);
|
|
9819
9937
|
const A = E.getTarget();
|
|
9820
9938
|
if (this.options.clickAwait && g.takeClickOutcome(A), typeof A.click == "function" ? A.click() : A.dispatchEvent(
|
|
9821
9939
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
@@ -9882,8 +10000,8 @@ ${V}
|
|
|
9882
10000
|
if (A) {
|
|
9883
10001
|
const C = new URLSearchParams(window.location.search).get(A);
|
|
9884
10002
|
if (C !== null) {
|
|
9885
|
-
const
|
|
9886
|
-
pt.isSafeLocalPath(
|
|
10003
|
+
const H = C.trim();
|
|
10004
|
+
pt.isSafeLocalPath(H) ? E = H : m.warn(
|
|
9887
10005
|
"Haori",
|
|
9888
10006
|
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${C}`
|
|
9889
10007
|
);
|
|
@@ -9920,7 +10038,7 @@ ${V}
|
|
|
9920
10038
|
if (!i || !n || !n.hasAttribute(i.attributeName))
|
|
9921
10039
|
return r;
|
|
9922
10040
|
const s = n.getAttributeEvaluation(i.attributeName);
|
|
9923
|
-
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (
|
|
10041
|
+
return s === null ? r : s.hasUnresolvedReference && !i.hasUnresolvedReference ? (V.isEnabled() && m.warn(
|
|
9924
10042
|
"Haori",
|
|
9925
10043
|
`${i.attributeName} の参照が手続きの途中で解決できなくなったため、手続き開始時の値を使います`
|
|
9926
10044
|
), r) : s.value ?? null;
|
|
@@ -9950,10 +10068,10 @@ ${V}
|
|
|
9950
10068
|
p != null && (Array.isArray(p) ? p.forEach((y) => o.searchParams.append(d, String(y))) : typeof p == "object" ? o.searchParams.set(d, JSON.stringify(p)) : o.searchParams.set(d, String(p)));
|
|
9951
10069
|
};
|
|
9952
10070
|
n && c(r), s && c(i), history.pushState(
|
|
9953
|
-
{ [
|
|
10071
|
+
{ [Ct]: !0 },
|
|
9954
10072
|
"",
|
|
9955
10073
|
o.toString()
|
|
9956
|
-
);
|
|
10074
|
+
), M.refreshUrlParams();
|
|
9957
10075
|
} catch (a) {
|
|
9958
10076
|
m.error("Haori", `history.pushState failed: ${a}`);
|
|
9959
10077
|
}
|
|
@@ -9963,7 +10081,7 @@ ${V}
|
|
|
9963
10081
|
*/
|
|
9964
10082
|
async handleFetchError(e) {
|
|
9965
10083
|
let t = null;
|
|
9966
|
-
this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t =
|
|
10084
|
+
this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t = I.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
9967
10085
|
const r = t ? t.getTarget() : document.body;
|
|
9968
10086
|
await Te().clearMessages(r);
|
|
9969
10087
|
const i = async (a) => {
|
|
@@ -10012,7 +10130,7 @@ ${V}
|
|
|
10012
10130
|
if (o.length === 0)
|
|
10013
10131
|
return await i(`${e.status} ${e.statusText}`), n(), !1;
|
|
10014
10132
|
for (const c of o)
|
|
10015
|
-
c.key && t ? await
|
|
10133
|
+
c.key && t ? await I.addErrorMessage(t, c.key, c.message) : await i(c.message);
|
|
10016
10134
|
return n(), !1;
|
|
10017
10135
|
} catch {
|
|
10018
10136
|
}
|
|
@@ -10033,11 +10151,11 @@ ${V}
|
|
|
10033
10151
|
*/
|
|
10034
10152
|
validate(e) {
|
|
10035
10153
|
if (this.options.valid !== !0)
|
|
10036
|
-
return
|
|
10154
|
+
return I.warnUnvalidatedCustomValidity(
|
|
10037
10155
|
e,
|
|
10038
10156
|
`${l.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
10039
10157
|
), !0;
|
|
10040
|
-
|
|
10158
|
+
I.applyCustomValidity(e);
|
|
10041
10159
|
const t = this.findFirstInvalid(e);
|
|
10042
10160
|
if (t === null)
|
|
10043
10161
|
return !0;
|
|
@@ -10128,14 +10246,14 @@ ${V}
|
|
|
10128
10246
|
const r = this.options.targetFragment;
|
|
10129
10247
|
if (!r)
|
|
10130
10248
|
return !0;
|
|
10131
|
-
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n =
|
|
10249
|
+
const i = this.options.conditionAttributeName ?? `${l.prefix}if`, n = I.buildConditionScope(
|
|
10132
10250
|
r,
|
|
10133
10251
|
this.options.formFragment ?? null
|
|
10134
10252
|
), s = re.evaluateDetailed(t, n);
|
|
10135
10253
|
return s.unresolvedReference ? (e || m.warn(
|
|
10136
10254
|
"Haori",
|
|
10137
10255
|
`${i} の参照が解決できないため実行しません: ${t}`
|
|
10138
|
-
), !1) : s.value ? !0 : (!e &&
|
|
10256
|
+
), !1) : s.value ? !0 : (!e && V.isEnabled() && m.warn(
|
|
10139
10257
|
"Haori",
|
|
10140
10258
|
`${i} の条件が偽のため手続きを中断しました: ${t}`
|
|
10141
10259
|
), !1);
|
|
@@ -10252,7 +10370,7 @@ ${V}
|
|
|
10252
10370
|
} else
|
|
10253
10371
|
u[d] = i;
|
|
10254
10372
|
n.push(
|
|
10255
|
-
|
|
10373
|
+
M.setBindingData(
|
|
10256
10374
|
o.getTarget(),
|
|
10257
10375
|
this.reconcileUserEditsForBind(o, u),
|
|
10258
10376
|
{
|
|
@@ -10310,7 +10428,7 @@ ${V}
|
|
|
10310
10428
|
i
|
|
10311
10429
|
), d = this.options.bindMerge ? { ...o.getRawBindingData() ?? {}, ...u } : u;
|
|
10312
10430
|
n.push(
|
|
10313
|
-
|
|
10431
|
+
M.setBindingData(
|
|
10314
10432
|
o.getTarget(),
|
|
10315
10433
|
this.reconcileUserEditsForBind(o, d),
|
|
10316
10434
|
{
|
|
@@ -10366,13 +10484,13 @@ ${V}
|
|
|
10366
10484
|
if (r === null)
|
|
10367
10485
|
return t;
|
|
10368
10486
|
const i = this.eventType === "poll";
|
|
10369
|
-
if (!i && !this.twoWayCommitBind &&
|
|
10487
|
+
if (!i && !this.twoWayCommitBind && M.clearUserEditMarks(e, r), !(e.getTarget() instanceof HTMLFormElement))
|
|
10370
10488
|
return this.reconcileAncestorArgFormEdits(
|
|
10371
10489
|
e,
|
|
10372
10490
|
t,
|
|
10373
10491
|
i ? 0 : r
|
|
10374
10492
|
);
|
|
10375
|
-
const n =
|
|
10493
|
+
const n = I.getValuesEditedAfter(
|
|
10376
10494
|
e,
|
|
10377
10495
|
i ? 0 : r
|
|
10378
10496
|
);
|
|
@@ -10381,9 +10499,9 @@ ${V}
|
|
|
10381
10499
|
const s = e.getAttribute(`${l.prefix}form-arg`);
|
|
10382
10500
|
if (s) {
|
|
10383
10501
|
const a = String(s), o = t[a], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
10384
|
-
return { ...t, [a]:
|
|
10502
|
+
return { ...t, [a]: ge(c, n) };
|
|
10385
10503
|
}
|
|
10386
|
-
return
|
|
10504
|
+
return ge(t, n);
|
|
10387
10505
|
}
|
|
10388
10506
|
/**
|
|
10389
10507
|
* 編集可能な行へのバインドについて、送信後の編集を要素データへ上書きし直します。
|
|
@@ -10405,12 +10523,12 @@ ${V}
|
|
|
10405
10523
|
if (r === null)
|
|
10406
10524
|
return t;
|
|
10407
10525
|
const i = this.eventType === "poll";
|
|
10408
|
-
!i && !this.twoWayCommitBind &&
|
|
10409
|
-
const n =
|
|
10526
|
+
!i && !this.twoWayCommitBind && M.clearUserEditMarks(e, r);
|
|
10527
|
+
const n = I.getValuesEditedAfter(
|
|
10410
10528
|
e,
|
|
10411
10529
|
i ? 0 : r
|
|
10412
10530
|
);
|
|
10413
|
-
return Object.keys(n).length === 0 ? t :
|
|
10531
|
+
return Object.keys(n).length === 0 ? t : ge(t, n);
|
|
10414
10532
|
}
|
|
10415
10533
|
/**
|
|
10416
10534
|
* 祖先へのバインドについて、配下の `data-form-arg` フォームで送信後に行われた
|
|
@@ -10428,14 +10546,14 @@ ${V}
|
|
|
10428
10546
|
*/
|
|
10429
10547
|
reconcileAncestorArgFormEdits(e, t, r) {
|
|
10430
10548
|
let i = t;
|
|
10431
|
-
for (const { form: n, key: s } of
|
|
10549
|
+
for (const { form: n, key: s } of I.collectArgForms(e)) {
|
|
10432
10550
|
if (!Object.prototype.hasOwnProperty.call(i, s))
|
|
10433
10551
|
continue;
|
|
10434
|
-
const a =
|
|
10552
|
+
const a = I.getValuesEditedAfter(n, r);
|
|
10435
10553
|
if (Object.keys(a).length === 0)
|
|
10436
10554
|
continue;
|
|
10437
10555
|
const o = i[s], c = o && typeof o == "object" && !Array.isArray(o) ? o : {};
|
|
10438
|
-
i = { ...i, [s]:
|
|
10556
|
+
i = { ...i, [s]: ge(c, a) };
|
|
10439
10557
|
}
|
|
10440
10558
|
return i;
|
|
10441
10559
|
}
|
|
@@ -10478,7 +10596,7 @@ ${V}
|
|
|
10478
10596
|
...t
|
|
10479
10597
|
};
|
|
10480
10598
|
n.push(
|
|
10481
|
-
|
|
10599
|
+
M.setBindingData(s.getTarget(), o, {
|
|
10482
10600
|
// 通番はコピーを起こした操作のもの(フェッチ応答の反映と同じ理由)。
|
|
10483
10601
|
sequence: this.operationSequence
|
|
10484
10602
|
})
|
|
@@ -10511,8 +10629,8 @@ ${V}
|
|
|
10511
10629
|
* @returns 行の入力欄の状態を反映した要素データ
|
|
10512
10630
|
*/
|
|
10513
10631
|
resolveCurrentRowItem(e, t) {
|
|
10514
|
-
const r =
|
|
10515
|
-
return Object.keys(r).length === 0 ? t :
|
|
10632
|
+
const r = I.getValuesEditedAfter(e, 0);
|
|
10633
|
+
return Object.keys(r).length === 0 ? t : ge(t, r);
|
|
10516
10634
|
}
|
|
10517
10635
|
/**
|
|
10518
10636
|
* 行の要素データへコピーの値を反映します。
|
|
@@ -10540,9 +10658,9 @@ ${V}
|
|
|
10540
10658
|
* @returns コピー元のデータ
|
|
10541
10659
|
*/
|
|
10542
10660
|
resolveCopySourceData() {
|
|
10543
|
-
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ?
|
|
10661
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? Ne(this.options.copySourceFragment) : M.withoutReservedBindingKeys(
|
|
10544
10662
|
this.options.copySourceFragment.getRawBindingData() ?? {}
|
|
10545
|
-
) : this.options.formFragment ?
|
|
10663
|
+
) : this.options.formFragment ? Ne(this.options.formFragment) : this.options.targetFragment ? M.withoutReservedBindingKeys(
|
|
10546
10664
|
this.options.targetFragment.getRawBindingData() ?? {}
|
|
10547
10665
|
) : {};
|
|
10548
10666
|
}
|
|
@@ -10556,8 +10674,8 @@ ${V}
|
|
|
10556
10674
|
let t = !1;
|
|
10557
10675
|
const r = this.options.formFragment ?? this.options.selfValueFragment;
|
|
10558
10676
|
if (r) {
|
|
10559
|
-
const i =
|
|
10560
|
-
Object.assign(e, i),
|
|
10677
|
+
const i = I.getValues(r);
|
|
10678
|
+
Object.assign(e, i), I.carryCollectedRowIdentity(i, e);
|
|
10561
10679
|
}
|
|
10562
10680
|
if (this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
|
|
10563
10681
|
const i = g.resolveDataAttributeDetailed(
|
|
@@ -10608,7 +10726,7 @@ ${V}
|
|
|
10608
10726
|
const n = { ...this.options.fetchOptions || {} }, s = new Headers(
|
|
10609
10727
|
n.headers || void 0
|
|
10610
10728
|
), a = (n.method || "GET").toUpperCase(), o = l.runtime === "demo" && !Be(a), c = o ? "GET" : a;
|
|
10611
|
-
if (n.method = c, Object.keys(t).length > 0 &&
|
|
10729
|
+
if (n.method = c, Object.keys(t).length > 0 && Ie(t)) {
|
|
10612
10730
|
const d = s.get("Content-Type") || "";
|
|
10613
10731
|
c !== "GET" && c !== "HEAD" && c !== "OPTIONS" && /multipart\/form-data/i.test(d) ? Ut(t) && m.warn(
|
|
10614
10732
|
"Haori",
|
|
@@ -10660,7 +10778,7 @@ ${V}
|
|
|
10660
10778
|
this.options.targetFragment && this.options.historyDataAttrName ? this.historyDataSnapshot = g.resolveDataAttribute(
|
|
10661
10779
|
this.options.targetFragment,
|
|
10662
10780
|
this.options.historyDataAttrName
|
|
10663
|
-
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ?
|
|
10781
|
+
) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? Ne(this.options.historyFormFragment) : void 0;
|
|
10664
10782
|
}
|
|
10665
10783
|
/**
|
|
10666
10784
|
* history-data の評価値を取得します。
|
|
@@ -10682,7 +10800,7 @@ ${V}
|
|
|
10682
10800
|
if (this.historyFormSnapshot !== void 0)
|
|
10683
10801
|
return this.historyFormSnapshot;
|
|
10684
10802
|
if (this.options.historyFormFragment)
|
|
10685
|
-
return
|
|
10803
|
+
return Ne(this.options.historyFormFragment);
|
|
10686
10804
|
}
|
|
10687
10805
|
/**
|
|
10688
10806
|
* copy-params が指定されている場合は include / exclude を考慮して抽出します。
|
|
@@ -10759,8 +10877,8 @@ ${V}
|
|
|
10759
10877
|
"Haori",
|
|
10760
10878
|
`Row container not found: ${i} (${r})`
|
|
10761
10879
|
), null;
|
|
10762
|
-
const a =
|
|
10763
|
-
return a instanceof
|
|
10880
|
+
const a = x.get(s);
|
|
10881
|
+
return a instanceof w ? a.hasAttribute(`${l.prefix}each`) ? a : (m.error(
|
|
10764
10882
|
"Haori",
|
|
10765
10883
|
`Row container must have ${l.prefix}each: ${i} (${r})`
|
|
10766
10884
|
), null) : (m.error(
|
|
@@ -11027,11 +11145,11 @@ ${V}
|
|
|
11027
11145
|
);
|
|
11028
11146
|
continue;
|
|
11029
11147
|
}
|
|
11030
|
-
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" &&
|
|
11148
|
+
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" && I.clearRowUserEditMarksForChangedKeys(u.row, y);
|
|
11031
11149
|
}
|
|
11032
11150
|
if (!o)
|
|
11033
11151
|
return;
|
|
11034
|
-
const c =
|
|
11152
|
+
const c = M.setBindingData(
|
|
11035
11153
|
s.owner.getTarget(),
|
|
11036
11154
|
g.withPathValue(s.ownerData, s.path, a),
|
|
11037
11155
|
{
|
|
@@ -11047,7 +11165,7 @@ ${V}
|
|
|
11047
11165
|
sequence: this.operationSequence
|
|
11048
11166
|
}
|
|
11049
11167
|
);
|
|
11050
|
-
if (
|
|
11168
|
+
if (M.isEachUpdateRunning(n)) {
|
|
11051
11169
|
c.catch((u) => {
|
|
11052
11170
|
m.error("Haori", "Failed to write row data.", u);
|
|
11053
11171
|
});
|
|
@@ -11077,7 +11195,7 @@ ${V}
|
|
|
11077
11195
|
* @returns 反映完了の Promise
|
|
11078
11196
|
*/
|
|
11079
11197
|
static syncUnchangedRowValues(e, t, r) {
|
|
11080
|
-
return r === "supply" &&
|
|
11198
|
+
return r === "supply" && I.clearRowUserEditMarksForChangedKeys(e, t), I.syncRowValues(e, t);
|
|
11081
11199
|
}
|
|
11082
11200
|
/**
|
|
11083
11201
|
* 行の要素データが同じ内容かどうかを判定します。
|
|
@@ -11143,7 +11261,7 @@ ${V}
|
|
|
11143
11261
|
if (a && o !== null) {
|
|
11144
11262
|
const c = [];
|
|
11145
11263
|
r.forEach((p, y) => {
|
|
11146
|
-
|
|
11264
|
+
M.createListKey(
|
|
11147
11265
|
p,
|
|
11148
11266
|
String(a),
|
|
11149
11267
|
y
|
|
@@ -11262,14 +11380,14 @@ ${V}
|
|
|
11262
11380
|
if (g.isSameRowItem(i.array[E], y))
|
|
11263
11381
|
return;
|
|
11264
11382
|
const A = p.get(
|
|
11265
|
-
|
|
11383
|
+
M.createListKey(
|
|
11266
11384
|
y,
|
|
11267
11385
|
null,
|
|
11268
11386
|
E
|
|
11269
11387
|
)
|
|
11270
11388
|
);
|
|
11271
|
-
A &&
|
|
11272
|
-
}),
|
|
11389
|
+
A && M.clearUserEditMarks(A);
|
|
11390
|
+
}), M.setBindingData(
|
|
11273
11391
|
i.owner.getTarget(),
|
|
11274
11392
|
g.withPathValue(i.ownerData, i.path, d),
|
|
11275
11393
|
{
|
|
@@ -11312,7 +11430,7 @@ ${V}
|
|
|
11312
11430
|
...s.getRawBindingData() ?? {},
|
|
11313
11431
|
_fetch: n
|
|
11314
11432
|
};
|
|
11315
|
-
return
|
|
11433
|
+
return M.setBindingData(a, o, {
|
|
11316
11434
|
reflectToAttribute: !1,
|
|
11317
11435
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
11318
11436
|
// 解除しない)。
|
|
@@ -11415,8 +11533,8 @@ const h = class h {
|
|
|
11415
11533
|
* @returns data-attr-* の内部反映なら true
|
|
11416
11534
|
*/
|
|
11417
11535
|
static isAliasedAttributeReflection(e, t) {
|
|
11418
|
-
const r =
|
|
11419
|
-
return r instanceof
|
|
11536
|
+
const r = x.get(e);
|
|
11537
|
+
return r instanceof w ? r.hasAttribute(
|
|
11420
11538
|
`${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
11421
11539
|
) : !1;
|
|
11422
11540
|
}
|
|
@@ -11447,7 +11565,7 @@ const h = class h {
|
|
|
11447
11565
|
static reevaluateChildren(e) {
|
|
11448
11566
|
const t = [];
|
|
11449
11567
|
return e.getChildren().forEach((r) => {
|
|
11450
|
-
r instanceof
|
|
11568
|
+
r instanceof w ? t.push(h.evaluateAll(r)) : r instanceof ne && t.push(h.evaluateText(r));
|
|
11451
11569
|
}), Promise.all(t).then(() => {
|
|
11452
11570
|
});
|
|
11453
11571
|
}
|
|
@@ -11468,9 +11586,9 @@ const h = class h {
|
|
|
11468
11586
|
* @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
|
|
11469
11587
|
* @return 戻り値はありません。
|
|
11470
11588
|
*/
|
|
11471
|
-
static clearUserEditMarks(e, t =
|
|
11589
|
+
static clearUserEditMarks(e, t = w.currentSequence()) {
|
|
11472
11590
|
e.clearUserEditMark(t), e.getChildren().forEach((r) => {
|
|
11473
|
-
r instanceof
|
|
11591
|
+
r instanceof w && h.clearUserEditMarks(r, t);
|
|
11474
11592
|
});
|
|
11475
11593
|
}
|
|
11476
11594
|
/**
|
|
@@ -11518,8 +11636,8 @@ const h = class h {
|
|
|
11518
11636
|
if (t.has(e))
|
|
11519
11637
|
return Promise.resolve();
|
|
11520
11638
|
const r = [];
|
|
11521
|
-
return e.hasAttribute(`${l.prefix}validity`) &&
|
|
11522
|
-
i instanceof
|
|
11639
|
+
return e.hasAttribute(`${l.prefix}validity`) && I.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) => {
|
|
11640
|
+
i instanceof w && r.push(
|
|
11523
11641
|
h.reevaluateReactiveSpecialAttributes(i, t)
|
|
11524
11642
|
);
|
|
11525
11643
|
}), Promise.all(r).then(() => {
|
|
@@ -11567,13 +11685,13 @@ const h = class h {
|
|
|
11567
11685
|
const s = performance.now();
|
|
11568
11686
|
return t.setAttribute(`${l.prefix}importing`, ""), B.importStart(t, n), Vt.load(n).then((a) => {
|
|
11569
11687
|
const o = new TextEncoder().encode(a).length;
|
|
11570
|
-
return
|
|
11688
|
+
return K.enqueue(() => {
|
|
11571
11689
|
t.innerHTML = a;
|
|
11572
11690
|
}).then(() => {
|
|
11573
11691
|
t.removeAttribute(`${l.prefix}importing`), B.importEnd(t, n, o, s), h.adoptImportedChildren(e);
|
|
11574
11692
|
const c = [];
|
|
11575
11693
|
return e.getChildren().forEach((u) => {
|
|
11576
|
-
u instanceof
|
|
11694
|
+
u instanceof w ? c.push(h.scan(u.getTarget())) : u instanceof ne && c.push(h.evaluateText(u));
|
|
11577
11695
|
}), Promise.all(c).then(() => {
|
|
11578
11696
|
});
|
|
11579
11697
|
});
|
|
@@ -11601,7 +11719,7 @@ const h = class h {
|
|
|
11601
11719
|
e.getChildren().filter((r) => r.getTarget().parentNode !== t).forEach((r) => {
|
|
11602
11720
|
r.remove(!1);
|
|
11603
11721
|
}), t.childNodes.forEach((r) => {
|
|
11604
|
-
const i =
|
|
11722
|
+
const i = x.get(r);
|
|
11605
11723
|
i !== null && i.getParent() !== e && e.pushChild(i);
|
|
11606
11724
|
});
|
|
11607
11725
|
}
|
|
@@ -11612,8 +11730,8 @@ const h = class h {
|
|
|
11612
11730
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
11613
11731
|
*/
|
|
11614
11732
|
static scan(e) {
|
|
11615
|
-
const t =
|
|
11616
|
-
return t ? h.initializeElementFragment(t, !1).then(() =>
|
|
11733
|
+
const t = x.get(e);
|
|
11734
|
+
return t ? h.initializeElementFragment(t, !1).then(() => I.restoreInitialValues(e)).then(() => {
|
|
11617
11735
|
ae.applySubtree(e);
|
|
11618
11736
|
}) : Promise.resolve();
|
|
11619
11737
|
}
|
|
@@ -11644,7 +11762,7 @@ const h = class h {
|
|
|
11644
11762
|
}
|
|
11645
11763
|
const r = [];
|
|
11646
11764
|
return e.getChildren().forEach((i) => {
|
|
11647
|
-
i instanceof
|
|
11765
|
+
i instanceof w ? r.push(h.initializeElementFragment(i, t)) : i instanceof ne && r.push(h.evaluateText(i));
|
|
11648
11766
|
}), Promise.all(r).then(() => {
|
|
11649
11767
|
h.refreshDerivedSubtreeSignature(e);
|
|
11650
11768
|
});
|
|
@@ -11704,7 +11822,7 @@ const h = class h {
|
|
|
11704
11822
|
)
|
|
11705
11823
|
), r.add(n));
|
|
11706
11824
|
}
|
|
11707
|
-
return t.then(() =>
|
|
11825
|
+
return t.then(() => I.prepareFormName(e));
|
|
11708
11826
|
}
|
|
11709
11827
|
/**
|
|
11710
11828
|
* 子孫初期化をスキップすべきかどうかを返します。
|
|
@@ -11731,7 +11849,7 @@ const h = class h {
|
|
|
11731
11849
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11732
11850
|
*/
|
|
11733
11851
|
static setAttribute(e, t, r, i = !1, n) {
|
|
11734
|
-
const s =
|
|
11852
|
+
const s = x.get(e), a = h.getAliasedAttributeName(t);
|
|
11735
11853
|
if (a !== null)
|
|
11736
11854
|
return r === null ? s.removeAliasedAttribute(t, a) : s.setAliasedAttribute(
|
|
11737
11855
|
t,
|
|
@@ -11743,11 +11861,11 @@ const h = class h {
|
|
|
11743
11861
|
let c = null, u = null, d = null;
|
|
11744
11862
|
switch (t) {
|
|
11745
11863
|
case `${l.prefix}bind`: {
|
|
11746
|
-
if (r !== null && i && s instanceof
|
|
11864
|
+
if (r !== null && i && s instanceof w && s.consumeSelfWrittenBind(r))
|
|
11747
11865
|
break;
|
|
11748
11866
|
const p = r === null ? {} : h.parseDataBind(r);
|
|
11749
11867
|
if (i) {
|
|
11750
|
-
const y = n ??
|
|
11868
|
+
const y = n ?? w.nextSequence();
|
|
11751
11869
|
return r === null ? (o.push(
|
|
11752
11870
|
h.setBindingData(e, p, {
|
|
11753
11871
|
reflectToAttribute: !1,
|
|
@@ -11804,7 +11922,7 @@ const h = class h {
|
|
|
11804
11922
|
break;
|
|
11805
11923
|
case `${l.prefix}validity`:
|
|
11806
11924
|
case `${l.prefix}validity-message`:
|
|
11807
|
-
return r !== null &&
|
|
11925
|
+
return r !== null && I.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
11808
11926
|
});
|
|
11809
11927
|
case `${l.prefix}url-param`: {
|
|
11810
11928
|
const p = s.getAttribute(`${l.prefix}url-arg`), y = pt.readParams();
|
|
@@ -11815,7 +11933,7 @@ const h = class h {
|
|
|
11815
11933
|
const E = {
|
|
11816
11934
|
reentrant: !0,
|
|
11817
11935
|
kind: "nonSupply",
|
|
11818
|
-
sequence:
|
|
11936
|
+
sequence: w.nextSequence()
|
|
11819
11937
|
};
|
|
11820
11938
|
if (p === null)
|
|
11821
11939
|
o.push(h.setBindingData(e, y, E));
|
|
@@ -11864,13 +11982,13 @@ const h = class h {
|
|
|
11864
11982
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
11865
11983
|
*/
|
|
11866
11984
|
static setBindingData(e, t, r = {}) {
|
|
11867
|
-
const i =
|
|
11985
|
+
const i = x.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", c = r.sequence ?? w.nextOperationSequence(), u = {
|
|
11868
11986
|
sequence: c,
|
|
11869
11987
|
kind: o,
|
|
11870
11988
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
11871
11989
|
}, d = o === "supply";
|
|
11872
11990
|
d && i.markSupplyApplied(c);
|
|
11873
|
-
const p =
|
|
11991
|
+
const p = w.currentSequence(), y = i.getRawBindingData();
|
|
11874
11992
|
d && (r.clearUserEdits ?? !0) && h.clearUserEditMarks(i, c);
|
|
11875
11993
|
const E = a ? h.resolveByPathAuthority(i, y, t, u) : t;
|
|
11876
11994
|
i.setBindingData(E), a && (B.bindChange(e, y, E, "manual"), De.mirror(i));
|
|
@@ -11884,23 +12002,23 @@ const h = class h {
|
|
|
11884
12002
|
return e.tagName === "FORM" && (C = C.then(() => {
|
|
11885
12003
|
if (i.wasResetAfter(p))
|
|
11886
12004
|
return;
|
|
11887
|
-
const
|
|
11888
|
-
return
|
|
12005
|
+
const H = i.getRawBindingData() ?? E;
|
|
12006
|
+
return I.syncValues(
|
|
11889
12007
|
i,
|
|
11890
|
-
|
|
12008
|
+
I.resolveSyncValues(i, H),
|
|
11891
12009
|
!1,
|
|
11892
12010
|
u
|
|
11893
12011
|
);
|
|
11894
12012
|
})), C = C.then(
|
|
11895
|
-
() =>
|
|
12013
|
+
() => I.syncAncestorArgForms(i, p, u, y)
|
|
11896
12014
|
), C = C.then(() => h.evaluateAll(i, n)), C = C.then(
|
|
11897
|
-
() =>
|
|
12015
|
+
() => w.retryUnappliedValueWrites(e, p)
|
|
11898
12016
|
), C = C.then(
|
|
11899
12017
|
() => h.reevaluateReactiveSpecialAttributes(i, n)
|
|
11900
12018
|
), C.then(
|
|
11901
12019
|
() => i.markBindingWorkEnd(),
|
|
11902
|
-
(
|
|
11903
|
-
throw i.markBindingWorkEnd(),
|
|
12020
|
+
(H) => {
|
|
12021
|
+
throw i.markBindingWorkEnd(), H;
|
|
11904
12022
|
}
|
|
11905
12023
|
);
|
|
11906
12024
|
};
|
|
@@ -11921,7 +12039,7 @@ const h = class h {
|
|
|
11921
12039
|
static withoutReservedBindingKeys(e) {
|
|
11922
12040
|
const t = {};
|
|
11923
12041
|
for (const r of Object.keys(e))
|
|
11924
|
-
|
|
12042
|
+
w.isReservedBindingKey(r) || (t[r] = e[r]);
|
|
11925
12043
|
return t;
|
|
11926
12044
|
}
|
|
11927
12045
|
/**
|
|
@@ -12146,8 +12264,8 @@ const h = class h {
|
|
|
12146
12264
|
* `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
|
|
12147
12265
|
*/
|
|
12148
12266
|
static getBindingData(e, t = {}) {
|
|
12149
|
-
const r =
|
|
12150
|
-
return r instanceof
|
|
12267
|
+
const r = x.get(e);
|
|
12268
|
+
return r instanceof w ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
12151
12269
|
}
|
|
12152
12270
|
/**
|
|
12153
12271
|
* 指定要素の式評価で見えるバインディングスコープをダンプします(デバッグ用)。
|
|
@@ -12166,7 +12284,7 @@ const h = class h {
|
|
|
12166
12284
|
*/
|
|
12167
12285
|
static dumpScope(e) {
|
|
12168
12286
|
const t = h.collectScope(e);
|
|
12169
|
-
return
|
|
12287
|
+
return V.isEnabled() && m.info("[Haori]", "scope dump for", e, t), t;
|
|
12170
12288
|
}
|
|
12171
12289
|
/**
|
|
12172
12290
|
* スコープの解決結果と由来を収集します。
|
|
@@ -12179,7 +12297,7 @@ const h = class h {
|
|
|
12179
12297
|
* @return 解決済みスコープと各キーの由来情報
|
|
12180
12298
|
*/
|
|
12181
12299
|
static collectScope(e) {
|
|
12182
|
-
const t =
|
|
12300
|
+
const t = x.get(e);
|
|
12183
12301
|
if (!t)
|
|
12184
12302
|
return { resolved: {}, sources: {} };
|
|
12185
12303
|
const r = t.getBindingData(), i = {}, n = (c) => {
|
|
@@ -12225,17 +12343,22 @@ const h = class h {
|
|
|
12225
12343
|
*
|
|
12226
12344
|
* @param parentElement 親エレメント
|
|
12227
12345
|
* @param node 追加するノード
|
|
12346
|
+
* @returns 追加したノードの走査(評価)の Promise。走査しない場合は解決済みの Promise
|
|
12228
12347
|
*/
|
|
12229
12348
|
static addNode(e, t) {
|
|
12230
|
-
const r =
|
|
12349
|
+
const r = x.get(e);
|
|
12231
12350
|
if (r.isSkipMutationNodes())
|
|
12232
|
-
return;
|
|
12233
|
-
const i =
|
|
12351
|
+
return Promise.resolve();
|
|
12352
|
+
const i = x.get(t.nextSibling), n = x.get(t);
|
|
12234
12353
|
if (n) {
|
|
12235
12354
|
if (n.getParent() === r)
|
|
12236
|
-
return;
|
|
12237
|
-
r.insertBefore(n, i), n instanceof
|
|
12355
|
+
return Promise.resolve();
|
|
12356
|
+
if (r.insertBefore(n, i), n instanceof w)
|
|
12357
|
+
return h.scan(n.getTarget());
|
|
12358
|
+
if (n instanceof ne)
|
|
12359
|
+
return h.evaluateText(n);
|
|
12238
12360
|
}
|
|
12361
|
+
return Promise.resolve();
|
|
12239
12362
|
}
|
|
12240
12363
|
/**
|
|
12241
12364
|
* ノードを親要素から削除します。
|
|
@@ -12243,7 +12366,7 @@ const h = class h {
|
|
|
12243
12366
|
* @param node 削除するノード
|
|
12244
12367
|
*/
|
|
12245
12368
|
static removeNode(e) {
|
|
12246
|
-
const t =
|
|
12369
|
+
const t = x.get(e);
|
|
12247
12370
|
if (t) {
|
|
12248
12371
|
const r = t.getParent();
|
|
12249
12372
|
if (r && r.isSkipMutationNodes())
|
|
@@ -12258,7 +12381,7 @@ const h = class h {
|
|
|
12258
12381
|
* @param text 新しいテキスト
|
|
12259
12382
|
*/
|
|
12260
12383
|
static changeText(e, t) {
|
|
12261
|
-
const r =
|
|
12384
|
+
const r = x.get(e);
|
|
12262
12385
|
r && r.setContent(t);
|
|
12263
12386
|
}
|
|
12264
12387
|
/**
|
|
@@ -12270,34 +12393,34 @@ const h = class h {
|
|
|
12270
12393
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
12271
12394
|
*/
|
|
12272
12395
|
static changeValue(e, t) {
|
|
12273
|
-
const r =
|
|
12396
|
+
const r = x.get(e);
|
|
12274
12397
|
if (r.getValue() === t)
|
|
12275
12398
|
return Promise.resolve();
|
|
12276
12399
|
const i = [];
|
|
12277
12400
|
i.push(r.setValue(t));
|
|
12278
12401
|
const n = h.getFormFragment(r);
|
|
12279
12402
|
if (n) {
|
|
12280
|
-
const s =
|
|
12403
|
+
const s = I.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`), o = n.getRawBindingData();
|
|
12281
12404
|
let c;
|
|
12282
12405
|
if (a) {
|
|
12283
12406
|
c = { ...o ?? {} };
|
|
12284
|
-
const u = String(a), d =
|
|
12285
|
-
c[u] =
|
|
12407
|
+
const u = String(a), d = I.resolveAncestorArgOwner(n, u);
|
|
12408
|
+
c[u] = I.mergeCollectedValues(
|
|
12286
12409
|
(d ? d.value : c[u]) ?? null,
|
|
12287
12410
|
s
|
|
12288
12411
|
);
|
|
12289
12412
|
} else
|
|
12290
|
-
c =
|
|
12413
|
+
c = I.mergeCollectedValues(
|
|
12291
12414
|
o,
|
|
12292
12415
|
s,
|
|
12293
|
-
|
|
12416
|
+
I.ancestorBaseResolver(n)
|
|
12294
12417
|
);
|
|
12295
12418
|
i.push(
|
|
12296
12419
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
12297
12420
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
12298
12421
|
h.setBindingData(n.getTarget(), c, {
|
|
12299
12422
|
kind: "nonSupply",
|
|
12300
|
-
sequence:
|
|
12423
|
+
sequence: w.nextSequence()
|
|
12301
12424
|
})
|
|
12302
12425
|
);
|
|
12303
12426
|
}
|
|
@@ -12365,7 +12488,7 @@ const h = class h {
|
|
|
12365
12488
|
return;
|
|
12366
12489
|
const p = [];
|
|
12367
12490
|
return e.getChildren().forEach((y) => {
|
|
12368
|
-
if (y instanceof
|
|
12491
|
+
if (y instanceof w) {
|
|
12369
12492
|
if (h.canSkipUnchangedNestedEach(y))
|
|
12370
12493
|
return;
|
|
12371
12494
|
p.push(h.evaluateAll(y, t));
|
|
@@ -12493,7 +12616,7 @@ const h = class h {
|
|
|
12493
12616
|
*/
|
|
12494
12617
|
static hasEachFixedChildren(e) {
|
|
12495
12618
|
return e.getChildren().some(
|
|
12496
|
-
(t) => t instanceof
|
|
12619
|
+
(t) => t instanceof w && h.isEachFixedChild(t)
|
|
12497
12620
|
);
|
|
12498
12621
|
}
|
|
12499
12622
|
/**
|
|
@@ -12515,7 +12638,7 @@ const h = class h {
|
|
|
12515
12638
|
static evaluateEachFixedChildren(e) {
|
|
12516
12639
|
const t = [];
|
|
12517
12640
|
return e.getChildren().forEach((r) => {
|
|
12518
|
-
r instanceof
|
|
12641
|
+
r instanceof w ? h.isEachFixedChild(r) && t.push(h.evaluateAll(r)) : r instanceof ne && t.push(h.evaluateText(r));
|
|
12519
12642
|
}), Promise.all(t).then(() => {
|
|
12520
12643
|
});
|
|
12521
12644
|
}
|
|
@@ -12530,7 +12653,7 @@ const h = class h {
|
|
|
12530
12653
|
static evaluateIf(e) {
|
|
12531
12654
|
const t = [], r = e.getAttribute(`${l.prefix}if`);
|
|
12532
12655
|
if (h.isHiddenIfCondition(r))
|
|
12533
|
-
|
|
12656
|
+
V.isEnabled() && e.isVisible() && h.logFalsyIfDiagnostics(e), t.push(
|
|
12534
12657
|
e.hide().then(() => {
|
|
12535
12658
|
B.hide(e.getTarget());
|
|
12536
12659
|
})
|
|
@@ -12539,7 +12662,7 @@ const h = class h {
|
|
|
12539
12662
|
e.restoreFormControlsDisabledByIf();
|
|
12540
12663
|
const i = e.isVisible(), n = [], s = e.hasAttribute(`${l.prefix}each`);
|
|
12541
12664
|
e.getChildren().forEach((a) => {
|
|
12542
|
-
if (a instanceof
|
|
12665
|
+
if (a instanceof w) {
|
|
12543
12666
|
if (s && !h.isEachFixedChild(a))
|
|
12544
12667
|
return;
|
|
12545
12668
|
n.push(
|
|
@@ -12595,7 +12718,7 @@ const h = class h {
|
|
|
12595
12718
|
* @return 差分更新(再実行を含む)の完了 Promise
|
|
12596
12719
|
*/
|
|
12597
12720
|
static evaluateEach(e) {
|
|
12598
|
-
if (
|
|
12721
|
+
if (V.isEnabled() && re.recordRowScopeIdentifiers([
|
|
12599
12722
|
h.getRowScopeName(e, "each-arg"),
|
|
12600
12723
|
h.getRowScopeName(e, "each-index")
|
|
12601
12724
|
]), e.isMounted() || h.syncMountedState(e), !e.isVisible() || !e.isMounted())
|
|
@@ -12769,7 +12892,7 @@ ${r}
|
|
|
12769
12892
|
if (r === null) {
|
|
12770
12893
|
let s = !1;
|
|
12771
12894
|
if (e.getChildren().forEach((a) => {
|
|
12772
|
-
if (!s && a instanceof
|
|
12895
|
+
if (!s && a instanceof w) {
|
|
12773
12896
|
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
12774
12897
|
return;
|
|
12775
12898
|
r = a.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
@@ -12782,11 +12905,11 @@ ${r}
|
|
|
12782
12905
|
(c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
|
|
12783
12906
|
).forEach((c) => {
|
|
12784
12907
|
if (!s) {
|
|
12785
|
-
const d =
|
|
12786
|
-
d instanceof
|
|
12908
|
+
const d = x.get(c);
|
|
12909
|
+
d instanceof w && (r = d.clone(), h.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
12787
12910
|
}
|
|
12788
|
-
const u =
|
|
12789
|
-
u instanceof
|
|
12911
|
+
const u = x.get(c);
|
|
12912
|
+
u instanceof w && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), c.parentNode && c.parentNode.removeChild(c);
|
|
12790
12913
|
});
|
|
12791
12914
|
}
|
|
12792
12915
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -12923,7 +13046,7 @@ ${r}
|
|
|
12923
13046
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
12924
13047
|
}
|
|
12925
13048
|
for (const i of e.getChildren())
|
|
12926
|
-
if (i instanceof
|
|
13049
|
+
if (i instanceof w) {
|
|
12927
13050
|
if (!h.isRowLocalSubtree(i, r))
|
|
12928
13051
|
return !1;
|
|
12929
13052
|
} else if (i instanceof ne) {
|
|
@@ -12986,7 +13109,7 @@ ${r}
|
|
|
12986
13109
|
* @returns 含むなら true
|
|
12987
13110
|
*/
|
|
12988
13111
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
12989
|
-
return e.getChildren().some((t) => t instanceof
|
|
13112
|
+
return e.getChildren().some((t) => t instanceof w ? 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);
|
|
12990
13113
|
}
|
|
12991
13114
|
/**
|
|
12992
13115
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -13013,6 +13136,54 @@ ${r}
|
|
|
13013
13136
|
scope: e.getBindingData()
|
|
13014
13137
|
});
|
|
13015
13138
|
}
|
|
13139
|
+
/**
|
|
13140
|
+
* URL が変わったときに `data-url-param` の取り込みをやり直します。
|
|
13141
|
+
*
|
|
13142
|
+
* 対象は、宣言を持つ要素のうち**すでに走査済み**のものだけです。未走査の要素は
|
|
13143
|
+
* 走査したときに読むため、ここで触ると宣言を持たないフラグメントを作ってしまい
|
|
13144
|
+
* ます。再評価では呼びません(仕様「`data-url-param`」の「取り込みの契機」)。
|
|
13145
|
+
*
|
|
13146
|
+
* @returns 読み直しの完了 Promise
|
|
13147
|
+
*/
|
|
13148
|
+
static refreshUrlParams() {
|
|
13149
|
+
const e = `${l.prefix}url-param`, r = Array.from(
|
|
13150
|
+
document.querySelectorAll(`[${e}]`)
|
|
13151
|
+
).map((i) => {
|
|
13152
|
+
const n = x.peek(i);
|
|
13153
|
+
return n instanceof w ? h.setAttribute(
|
|
13154
|
+
i,
|
|
13155
|
+
e,
|
|
13156
|
+
n.getRawAttribute(e) ?? ""
|
|
13157
|
+
) : Promise.resolve();
|
|
13158
|
+
});
|
|
13159
|
+
return Promise.all(r).then(() => {
|
|
13160
|
+
}).catch((i) => {
|
|
13161
|
+
m.error("Haori", `${e} を読み直せませんでした: ${i}`);
|
|
13162
|
+
});
|
|
13163
|
+
}
|
|
13164
|
+
/**
|
|
13165
|
+
* `data-derive` の「配下の再評価を省く」記録を破棄します。
|
|
13166
|
+
*
|
|
13167
|
+
* この記録は「配下へ公開するデータが前回と同じなら、配下の DOM も前回の評価結果
|
|
13168
|
+
* のまま」という前提に立ちます。リセットのように DOM を直接書き換えた場合は前提が
|
|
13169
|
+
* 崩れるため、書き換えた側が破棄します。破棄しないと、入れ直しの再評価が配下へ
|
|
13170
|
+
* 届かず、空へ揃えた入力欄がそのまま残ります(仕様「`data-{event}-reset`」)。
|
|
13171
|
+
*
|
|
13172
|
+
* 破棄の範囲は、書き換えた範囲の配下と、その範囲を覆う祖先です。
|
|
13173
|
+
*
|
|
13174
|
+
* @param root 書き換えた範囲の根フラグメント
|
|
13175
|
+
* @returns 戻り値はありません。
|
|
13176
|
+
*/
|
|
13177
|
+
static invalidateDerivedSubtreeSignatures(e) {
|
|
13178
|
+
for (let r = e.getParent(); r !== null; r = r.getParent())
|
|
13179
|
+
r.setDeriveSubtreeSignature(null);
|
|
13180
|
+
const t = (r) => {
|
|
13181
|
+
r.setDeriveSubtreeSignature(null), r.getChildren().forEach((i) => {
|
|
13182
|
+
i instanceof w && t(i);
|
|
13183
|
+
});
|
|
13184
|
+
};
|
|
13185
|
+
t(e);
|
|
13186
|
+
}
|
|
13016
13187
|
/**
|
|
13017
13188
|
* data-derive subtree skip 用の署名を現在状態で更新します。
|
|
13018
13189
|
*
|
|
@@ -13034,7 +13205,7 @@ ${r}
|
|
|
13034
13205
|
* @returns プロファイル
|
|
13035
13206
|
*/
|
|
13036
13207
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
13037
|
-
if (!
|
|
13208
|
+
if (!V.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
13038
13209
|
return null;
|
|
13039
13210
|
const t = h.DERIVE_SUBTREE_PROFILES.get(e);
|
|
13040
13211
|
if (t)
|
|
@@ -13088,7 +13259,7 @@ ${r}
|
|
|
13088
13259
|
typeof a == "string" && a.trim() !== "" && (n += `[${l.prefix}derive-name="${a.trim()}"]`);
|
|
13089
13260
|
const o = r.getParent();
|
|
13090
13261
|
if (o) {
|
|
13091
|
-
const c = o.getChildren().filter((u) => u instanceof
|
|
13262
|
+
const c = o.getChildren().filter((u) => u instanceof w).findIndex((u) => u === r);
|
|
13092
13263
|
n += `:nth-child(${c + 1})`;
|
|
13093
13264
|
}
|
|
13094
13265
|
t.unshift(n), r = o;
|
|
@@ -13161,7 +13332,7 @@ ${r}
|
|
|
13161
13332
|
* @returns subtree 全体を省略可能なら true
|
|
13162
13333
|
*/
|
|
13163
13334
|
static markFreshInitializationSkippable(e) {
|
|
13164
|
-
const t = e.getAttributeNames().some((n) => h.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof
|
|
13335
|
+
const t = e.getAttributeNames().some((n) => h.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof w ? !h.markFreshInitializationSkippable(n) : n instanceof ne ? n.hasDynamicContent() : !1), i = !t && !r;
|
|
13165
13336
|
return e.setFreshInitializationSkippable(i), i;
|
|
13166
13337
|
}
|
|
13167
13338
|
/**
|
|
@@ -13194,112 +13365,112 @@ ${r}
|
|
|
13194
13365
|
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
13195
13366
|
i && (i = String(i));
|
|
13196
13367
|
const n = e.getAttribute(`${l.prefix}each-key`), s = e.getAttribute(`${l.prefix}each-arg`), a = t.map(
|
|
13197
|
-
(
|
|
13368
|
+
(F, j) => h.createListKey(F, n ? String(n) : null, j)
|
|
13198
13369
|
), o = new Set(a), c = /* @__PURE__ */ new Map();
|
|
13199
|
-
a.forEach((
|
|
13200
|
-
c.set(
|
|
13370
|
+
a.forEach((F) => {
|
|
13371
|
+
c.set(F, (c.get(F) ?? 0) + 1);
|
|
13201
13372
|
}), n && o.size !== a.length && h.warnDuplicateEachKey(String(n));
|
|
13202
13373
|
const u = [];
|
|
13203
|
-
let d = e.getChildren().filter((
|
|
13204
|
-
(
|
|
13374
|
+
let d = e.getChildren().filter((F) => F instanceof w).filter(
|
|
13375
|
+
(F) => !F.hasAttribute(`${l.prefix}each-before`) && !F.hasAttribute(`${l.prefix}each-after`)
|
|
13205
13376
|
);
|
|
13206
|
-
const p = d.map((
|
|
13207
|
-
d = d.filter((
|
|
13208
|
-
const
|
|
13377
|
+
const p = d.map((F) => F.getListKey()), y = /* @__PURE__ */ new Set();
|
|
13378
|
+
d = d.filter((F, j) => {
|
|
13379
|
+
const Y = String(F.getListKey()), Q = c.get(Y) ?? 0;
|
|
13209
13380
|
if (Q === 0) {
|
|
13210
|
-
y.add(
|
|
13211
|
-
const
|
|
13212
|
-
return
|
|
13381
|
+
y.add(F);
|
|
13382
|
+
const P = F.getListKey();
|
|
13383
|
+
return P !== null && B.rowRemove(F.getTarget(), P, j), u.push(F.remove()), !1;
|
|
13213
13384
|
}
|
|
13214
|
-
return c.set(
|
|
13385
|
+
return c.set(Y, Q - 1), !0;
|
|
13215
13386
|
});
|
|
13216
|
-
const E = d.map((
|
|
13217
|
-
d.forEach((
|
|
13218
|
-
const
|
|
13219
|
-
if (
|
|
13387
|
+
const E = d.map((F) => F.getListKey()), A = /* @__PURE__ */ new Map();
|
|
13388
|
+
d.forEach((F) => {
|
|
13389
|
+
const j = F.getListKey();
|
|
13390
|
+
if (j === null)
|
|
13220
13391
|
return;
|
|
13221
|
-
const
|
|
13222
|
-
|
|
13392
|
+
const Y = A.get(j);
|
|
13393
|
+
Y ? Y.push(F) : A.set(j, [F]);
|
|
13223
13394
|
});
|
|
13224
|
-
const D = e.getChildElementFragments().filter((
|
|
13225
|
-
(
|
|
13395
|
+
const D = e.getChildElementFragments().filter((F) => !y.has(F)), C = D.filter(
|
|
13396
|
+
(F) => F.hasAttribute(`${l.prefix}each-before`)
|
|
13226
13397
|
).length;
|
|
13227
|
-
let
|
|
13228
|
-
return a.forEach((
|
|
13229
|
-
const
|
|
13230
|
-
let
|
|
13231
|
-
const ie = A.get(
|
|
13398
|
+
let H = Promise.resolve();
|
|
13399
|
+
return a.forEach((F, j) => {
|
|
13400
|
+
const Y = t[j], Q = j;
|
|
13401
|
+
let P;
|
|
13402
|
+
const ie = A.get(F)?.shift();
|
|
13232
13403
|
if (ie) {
|
|
13233
|
-
|
|
13234
|
-
const
|
|
13235
|
-
|
|
13404
|
+
P = ie;
|
|
13405
|
+
const R = C + j;
|
|
13406
|
+
H = H.then(
|
|
13236
13407
|
() => h.updateRowFragment(
|
|
13237
|
-
|
|
13238
|
-
|
|
13408
|
+
P,
|
|
13409
|
+
Y,
|
|
13239
13410
|
i,
|
|
13240
13411
|
Q,
|
|
13241
13412
|
s ? String(s) : null,
|
|
13242
|
-
|
|
13413
|
+
F
|
|
13243
13414
|
).then(
|
|
13244
|
-
(
|
|
13415
|
+
($) => (
|
|
13245
13416
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
13246
13417
|
// ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
|
|
13247
13418
|
// される)で DOM の順序が古いまま残る。
|
|
13248
13419
|
h.repositionEachRow(
|
|
13249
13420
|
e,
|
|
13250
|
-
|
|
13421
|
+
P,
|
|
13251
13422
|
D,
|
|
13252
|
-
|
|
13253
|
-
).then((
|
|
13254
|
-
if (
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
), !(
|
|
13260
|
-
return h.evaluateAll(
|
|
13261
|
-
() => h.applyRowFormValues(e,
|
|
13423
|
+
R
|
|
13424
|
+
).then((G) => {
|
|
13425
|
+
if (G !== null && B.rowMove(
|
|
13426
|
+
P.getTarget(),
|
|
13427
|
+
F,
|
|
13428
|
+
G - C,
|
|
13429
|
+
j
|
|
13430
|
+
), !(!$ && h.isRowLocalEachTemplate(e)))
|
|
13431
|
+
return h.evaluateAll(P).then(
|
|
13432
|
+
() => h.applyRowFormValues(e, P, Y)
|
|
13262
13433
|
);
|
|
13263
13434
|
})
|
|
13264
13435
|
)
|
|
13265
13436
|
)
|
|
13266
13437
|
);
|
|
13267
13438
|
} else {
|
|
13268
|
-
|
|
13269
|
-
const
|
|
13270
|
-
|
|
13439
|
+
P = r.clone();
|
|
13440
|
+
const R = C + j;
|
|
13441
|
+
H = H.then(
|
|
13271
13442
|
() => h.updateRowFragment(
|
|
13272
|
-
|
|
13273
|
-
|
|
13443
|
+
P,
|
|
13444
|
+
Y,
|
|
13274
13445
|
i,
|
|
13275
13446
|
Q,
|
|
13276
13447
|
s ? String(s) : null,
|
|
13277
|
-
|
|
13448
|
+
F
|
|
13278
13449
|
).then(() => {
|
|
13279
|
-
const
|
|
13280
|
-
return e.insertBefore(
|
|
13281
|
-
D.splice(
|
|
13282
|
-
}).then(() => h.initializeFreshEachRow(
|
|
13283
|
-
B.rowAdd(
|
|
13450
|
+
const $ = D[R] ?? null;
|
|
13451
|
+
return e.insertBefore(P, $).then(() => {
|
|
13452
|
+
D.splice(R, 0, P);
|
|
13453
|
+
}).then(() => h.initializeFreshEachRow(P)).then(() => h.applyRowFormValues(e, P, Y)).then(() => {
|
|
13454
|
+
B.rowAdd(P.getTarget(), F, Q, Y);
|
|
13284
13455
|
});
|
|
13285
13456
|
})
|
|
13286
13457
|
);
|
|
13287
13458
|
}
|
|
13288
|
-
}), Promise.all(u).then(() =>
|
|
13289
|
-
const
|
|
13290
|
-
(
|
|
13291
|
-
),
|
|
13292
|
-
(
|
|
13293
|
-
),
|
|
13294
|
-
(
|
|
13459
|
+
}), Promise.all(u).then(() => H).then(() => {
|
|
13460
|
+
const F = a.filter(
|
|
13461
|
+
(R) => R !== null
|
|
13462
|
+
), j = E.filter(
|
|
13463
|
+
(R) => R !== null
|
|
13464
|
+
), Y = new Set(j), Q = F.filter((R) => !Y.has(R)), ie = p.filter(
|
|
13465
|
+
(R) => R !== null
|
|
13295
13466
|
).filter(
|
|
13296
|
-
(
|
|
13467
|
+
(R) => !o.has(R)
|
|
13297
13468
|
);
|
|
13298
13469
|
B.eachUpdate(
|
|
13299
13470
|
e.getTarget(),
|
|
13300
13471
|
Q,
|
|
13301
13472
|
ie,
|
|
13302
|
-
|
|
13473
|
+
F
|
|
13303
13474
|
);
|
|
13304
13475
|
});
|
|
13305
13476
|
}
|
|
@@ -13328,7 +13499,7 @@ ${r}
|
|
|
13328
13499
|
*/
|
|
13329
13500
|
static warnExtraEachChildren(e) {
|
|
13330
13501
|
const t = e.getChildren().filter(
|
|
13331
|
-
(r) => r instanceof
|
|
13502
|
+
(r) => r instanceof w
|
|
13332
13503
|
).filter(
|
|
13333
13504
|
(r) => !r.hasAttribute(`${l.prefix}each-before`) && !r.hasAttribute(`${l.prefix}each-after`)
|
|
13334
13505
|
);
|
|
@@ -13350,7 +13521,7 @@ ${r}
|
|
|
13350
13521
|
* @returns 戻り値はありません。
|
|
13351
13522
|
*/
|
|
13352
13523
|
static warnDuplicateEachKey(e) {
|
|
13353
|
-
!
|
|
13524
|
+
!V.isEnabled() || h.WARNED_DUPLICATE_EACH_KEYS.has(e) || (h.WARNED_DUPLICATE_EACH_KEYS.add(e), m.warn(
|
|
13354
13525
|
"[Haori]",
|
|
13355
13526
|
`${l.prefix}each-key="${e}" の値が配列の中で重複しています。行は出現順で対応付けますが、キーによる行の識別はできません。`
|
|
13356
13527
|
));
|
|
@@ -13402,7 +13573,7 @@ ${r}
|
|
|
13402
13573
|
* @returns 反映完了の Promise
|
|
13403
13574
|
*/
|
|
13404
13575
|
static applyRowFormValues(e, t, r) {
|
|
13405
|
-
return !e.hasAttribute(`${l.prefix}form-list`) || !
|
|
13576
|
+
return !e.hasAttribute(`${l.prefix}form-list`) || !I.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : I.syncRowValues(t, r);
|
|
13406
13577
|
}
|
|
13407
13578
|
/**
|
|
13408
13579
|
* リスト比較用のキーを生成します。
|
|
@@ -13590,7 +13761,7 @@ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
13590
13761
|
"enhance",
|
|
13591
13762
|
"enhance-new"
|
|
13592
13763
|
]), 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");
|
|
13593
|
-
let
|
|
13764
|
+
let M = h;
|
|
13594
13765
|
const we = class we {
|
|
13595
13766
|
/**
|
|
13596
13767
|
* コンストラクタ。
|
|
@@ -13599,7 +13770,7 @@ const we = class we {
|
|
|
13599
13770
|
*/
|
|
13600
13771
|
constructor(e = document) {
|
|
13601
13772
|
this.customEventHandlers = /* @__PURE__ */ new Map(), this.builtinListenersAdded = !1, this.deferred = !1, this.deferredProcedures = [], this.onClick = (t) => this.delegate(t, "click"), this.onReset = (t) => {
|
|
13602
|
-
if (t.defaultPrevented ||
|
|
13773
|
+
if (t.defaultPrevented || I.isResettingInternally())
|
|
13603
13774
|
return;
|
|
13604
13775
|
const r = t.target;
|
|
13605
13776
|
r instanceof HTMLElement && setTimeout(() => ae.refreshSubtree(r), 0);
|
|
@@ -13611,7 +13782,11 @@ const we = class we {
|
|
|
13611
13782
|
this.runWindowLoadProcedure();
|
|
13612
13783
|
}, this.onPopstate = (t) => {
|
|
13613
13784
|
const r = t.state;
|
|
13614
|
-
!r || r[we.HISTORY_STATE_KEY] !== !0
|
|
13785
|
+
if (!r || r[we.HISTORY_STATE_KEY] !== !0) {
|
|
13786
|
+
M.refreshUrlParams();
|
|
13787
|
+
return;
|
|
13788
|
+
}
|
|
13789
|
+
location.reload();
|
|
13615
13790
|
}, this.root = e;
|
|
13616
13791
|
}
|
|
13617
13792
|
/**
|
|
@@ -13620,7 +13795,7 @@ const we = class we {
|
|
|
13620
13795
|
* @returns 戻り値はない。
|
|
13621
13796
|
*/
|
|
13622
13797
|
runWindowLoadProcedure() {
|
|
13623
|
-
const e = document.documentElement, t =
|
|
13798
|
+
const e = document.documentElement, t = x.get(e);
|
|
13624
13799
|
t && new se(t, "load").run();
|
|
13625
13800
|
}
|
|
13626
13801
|
/**
|
|
@@ -13744,8 +13919,8 @@ const we = class we {
|
|
|
13744
13919
|
this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
|
|
13745
13920
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
13746
13921
|
return;
|
|
13747
|
-
const n =
|
|
13748
|
-
n instanceof
|
|
13922
|
+
const n = x.get(i);
|
|
13923
|
+
n instanceof w && new se(n, "on", t).run().catch((s) => {
|
|
13749
13924
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
13750
13925
|
});
|
|
13751
13926
|
});
|
|
@@ -13808,7 +13983,7 @@ const we = class we {
|
|
|
13808
13983
|
* @returns 戻り値はない。
|
|
13809
13984
|
*/
|
|
13810
13985
|
runProcedureFor(e, t, r) {
|
|
13811
|
-
const i =
|
|
13986
|
+
const i = x.get(e);
|
|
13812
13987
|
if (!i)
|
|
13813
13988
|
return;
|
|
13814
13989
|
(t === "change" || t === "input") && this.syncUserEdit(e, t === "change");
|
|
@@ -13868,8 +14043,8 @@ const we = class we {
|
|
|
13868
14043
|
* @returns 戻り値はない。
|
|
13869
14044
|
*/
|
|
13870
14045
|
markUserEditOnly(e) {
|
|
13871
|
-
const t =
|
|
13872
|
-
t instanceof
|
|
14046
|
+
const t = x.get(e);
|
|
14047
|
+
t instanceof w && t.markUserEdit();
|
|
13873
14048
|
}
|
|
13874
14049
|
/**
|
|
13875
14050
|
* `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
|
|
@@ -13884,14 +14059,14 @@ const we = class we {
|
|
|
13884
14059
|
* @returns 戻り値はない。
|
|
13885
14060
|
*/
|
|
13886
14061
|
syncUserEdit(e, t) {
|
|
13887
|
-
const r =
|
|
13888
|
-
if (r instanceof
|
|
14062
|
+
const r = x.get(e);
|
|
14063
|
+
if (r instanceof w && (r.syncValue(), t ? r.markUserEditOnChange() : r.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
13889
14064
|
const i = document.getElementsByName(e.name);
|
|
13890
14065
|
for (const n of Array.from(i)) {
|
|
13891
14066
|
if (n === e || !(n instanceof HTMLInputElement) || n.type !== "radio" || n.form !== e.form)
|
|
13892
14067
|
continue;
|
|
13893
|
-
const s =
|
|
13894
|
-
s instanceof
|
|
14068
|
+
const s = x.get(n);
|
|
14069
|
+
s instanceof w && (s.syncValue(), s.markUserEdit());
|
|
13895
14070
|
}
|
|
13896
14071
|
}
|
|
13897
14072
|
}
|
|
@@ -13945,7 +14120,7 @@ we.HISTORY_STATE_KEY = "__haoriHistoryState__", we.BUILTIN_EVENT_NAMES = /* @__P
|
|
|
13945
14120
|
"load"
|
|
13946
14121
|
]);
|
|
13947
14122
|
let He = we;
|
|
13948
|
-
const
|
|
14123
|
+
const W = class W {
|
|
13949
14124
|
/**
|
|
13950
14125
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
13951
14126
|
*
|
|
@@ -13959,33 +14134,33 @@ const q = class q {
|
|
|
13959
14134
|
return typeof t < "u" && e instanceof t;
|
|
13960
14135
|
}
|
|
13961
14136
|
static syncTree(e) {
|
|
13962
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
13963
|
-
|
|
14137
|
+
(e instanceof Element || e instanceof DocumentFragment) && (W.isHtmlElement(e) && W.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
14138
|
+
W.syncElement(t);
|
|
13964
14139
|
}));
|
|
13965
14140
|
}
|
|
13966
14141
|
static syncElement(e) {
|
|
13967
|
-
const t =
|
|
13968
|
-
if (!r || !
|
|
13969
|
-
t && (t.observer.disconnect(),
|
|
14142
|
+
const t = W.registrations.get(e), r = x.get(e);
|
|
14143
|
+
if (!r || !W.shouldObserve(r)) {
|
|
14144
|
+
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13970
14145
|
return;
|
|
13971
14146
|
}
|
|
13972
14147
|
if (typeof IntersectionObserver > "u")
|
|
13973
14148
|
return;
|
|
13974
|
-
const i =
|
|
13975
|
-
if (t && t.observer.root === i && t.observer.rootMargin === n &&
|
|
14149
|
+
const i = W.resolveRoot(r), n = W.resolveRootMargin(r), s = W.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
|
|
14150
|
+
if (t && t.observer.root === i && t.observer.rootMargin === n && W.sameThreshold(
|
|
13976
14151
|
t.observer.thresholds,
|
|
13977
14152
|
s
|
|
13978
14153
|
) && t.once === a) {
|
|
13979
14154
|
t.fragment = r;
|
|
13980
14155
|
return;
|
|
13981
14156
|
}
|
|
13982
|
-
t && (t.observer.disconnect(),
|
|
14157
|
+
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
13983
14158
|
const o = new IntersectionObserver(
|
|
13984
14159
|
(c) => {
|
|
13985
|
-
const u =
|
|
14160
|
+
const u = W.registrations.get(e);
|
|
13986
14161
|
u && c.forEach((d) => {
|
|
13987
|
-
!d.isIntersecting || u.running ||
|
|
13988
|
-
p && u.once && (u.observer.disconnect(),
|
|
14162
|
+
!d.isIntersecting || u.running || W.isDisabled(u.fragment) || (u.running = !0, new se(u.fragment, "intersect").runWithResult().then((p) => {
|
|
14163
|
+
p && u.once && (u.observer.disconnect(), W.registrations.delete(e));
|
|
13989
14164
|
}).catch((p) => {
|
|
13990
14165
|
m.error(
|
|
13991
14166
|
"[Haori]",
|
|
@@ -13993,7 +14168,7 @@ const q = class q {
|
|
|
13993
14168
|
p
|
|
13994
14169
|
);
|
|
13995
14170
|
}).finally(() => {
|
|
13996
|
-
const p =
|
|
14171
|
+
const p = W.registrations.get(e);
|
|
13997
14172
|
p && (p.running = !1);
|
|
13998
14173
|
}));
|
|
13999
14174
|
});
|
|
@@ -14004,7 +14179,7 @@ const q = class q {
|
|
|
14004
14179
|
threshold: s
|
|
14005
14180
|
}
|
|
14006
14181
|
);
|
|
14007
|
-
o.observe(e),
|
|
14182
|
+
o.observe(e), W.registrations.set(e, {
|
|
14008
14183
|
fragment: r,
|
|
14009
14184
|
observer: o,
|
|
14010
14185
|
once: a,
|
|
@@ -14012,26 +14187,26 @@ const q = class q {
|
|
|
14012
14187
|
});
|
|
14013
14188
|
}
|
|
14014
14189
|
static cleanupTree(e) {
|
|
14015
|
-
if (
|
|
14016
|
-
const t =
|
|
14017
|
-
t && (t.observer.disconnect(),
|
|
14190
|
+
if (W.isHtmlElement(e)) {
|
|
14191
|
+
const t = W.registrations.get(e);
|
|
14192
|
+
t && (t.observer.disconnect(), W.registrations.delete(e));
|
|
14018
14193
|
}
|
|
14019
14194
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
14020
|
-
const r =
|
|
14021
|
-
r && (r.observer.disconnect(),
|
|
14195
|
+
const r = W.registrations.get(t);
|
|
14196
|
+
r && (r.observer.disconnect(), W.registrations.delete(t));
|
|
14022
14197
|
});
|
|
14023
14198
|
}
|
|
14024
14199
|
static disconnectAll() {
|
|
14025
|
-
|
|
14200
|
+
W.registrations.forEach((e) => {
|
|
14026
14201
|
e.observer.disconnect();
|
|
14027
|
-
}),
|
|
14202
|
+
}), W.registrations.clear();
|
|
14028
14203
|
}
|
|
14029
14204
|
static shouldObserve(e) {
|
|
14030
14205
|
return e.getAttributeNames().some((t) => {
|
|
14031
14206
|
if (!t.startsWith(`${l.prefix}intersect-`))
|
|
14032
14207
|
return !1;
|
|
14033
14208
|
const r = t.slice(`${l.prefix}intersect-`.length);
|
|
14034
|
-
return !
|
|
14209
|
+
return !W.CONFIG_KEYS.has(r);
|
|
14035
14210
|
});
|
|
14036
14211
|
}
|
|
14037
14212
|
static resolveRoot(e) {
|
|
@@ -14042,7 +14217,7 @@ const q = class q {
|
|
|
14042
14217
|
if (typeof r != "string" || r.trim() === "")
|
|
14043
14218
|
return null;
|
|
14044
14219
|
const i = X.query(r, t, document);
|
|
14045
|
-
return
|
|
14220
|
+
return W.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
14046
14221
|
}
|
|
14047
14222
|
static resolveRootMargin(e) {
|
|
14048
14223
|
const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
@@ -14065,14 +14240,14 @@ const q = class q {
|
|
|
14065
14240
|
return e.length === 1 && e[0] === t;
|
|
14066
14241
|
}
|
|
14067
14242
|
};
|
|
14068
|
-
|
|
14243
|
+
W.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
14069
14244
|
"root",
|
|
14070
14245
|
"root-margin",
|
|
14071
14246
|
"threshold",
|
|
14072
14247
|
"disabled",
|
|
14073
14248
|
"once"
|
|
14074
|
-
]),
|
|
14075
|
-
let Ae =
|
|
14249
|
+
]), W.registrations = /* @__PURE__ */ new Map();
|
|
14250
|
+
let Ae = W;
|
|
14076
14251
|
const v = class v {
|
|
14077
14252
|
/**
|
|
14078
14253
|
* 指定ノードとその子孫を走査し、`data-poll-*` の監視状態を同期します。
|
|
@@ -14098,8 +14273,8 @@ const v = class v {
|
|
|
14098
14273
|
const t = v.registrations.get(e);
|
|
14099
14274
|
if (!t && !v.hasPollAttribute(e))
|
|
14100
14275
|
return;
|
|
14101
|
-
const r =
|
|
14102
|
-
if (!(r instanceof
|
|
14276
|
+
const r = x.get(e);
|
|
14277
|
+
if (!(r instanceof w) || !v.shouldObserve(r)) {
|
|
14103
14278
|
t && v.teardown(e, t);
|
|
14104
14279
|
return;
|
|
14105
14280
|
}
|
|
@@ -14413,12 +14588,12 @@ const v = class v {
|
|
|
14413
14588
|
...i.getRawBindingData() ?? {},
|
|
14414
14589
|
_poll: r
|
|
14415
14590
|
};
|
|
14416
|
-
return
|
|
14591
|
+
return M.setBindingData(n, s, {
|
|
14417
14592
|
reflectToAttribute: !1,
|
|
14418
14593
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
14419
14594
|
// 解除しない)。
|
|
14420
14595
|
kind: "nonSupply",
|
|
14421
|
-
sequence:
|
|
14596
|
+
sequence: w.nextSequence()
|
|
14422
14597
|
});
|
|
14423
14598
|
})
|
|
14424
14599
|
).then(() => {
|
|
@@ -14451,8 +14626,8 @@ const v = class v {
|
|
|
14451
14626
|
return n.forEach((a) => {
|
|
14452
14627
|
if (!a.isConnected)
|
|
14453
14628
|
return;
|
|
14454
|
-
const o =
|
|
14455
|
-
o instanceof
|
|
14629
|
+
const o = x.get(a);
|
|
14630
|
+
o instanceof w && s.push(o);
|
|
14456
14631
|
}), s;
|
|
14457
14632
|
}
|
|
14458
14633
|
/**
|
|
@@ -14600,7 +14775,7 @@ v.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
14600
14775
|
"state"
|
|
14601
14776
|
]), v.DEFAULT_INTERVAL_MS = 5e3, v.MIN_INTERVAL_MS = 100, v.registrations = /* @__PURE__ */ new Map(), v.visibilityListener = null;
|
|
14602
14777
|
let ve = v;
|
|
14603
|
-
const qt = "0.
|
|
14778
|
+
const qt = "0.49.0";
|
|
14604
14779
|
function Wt(b) {
|
|
14605
14780
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => b()) : Promise.resolve().then(b);
|
|
14606
14781
|
}
|
|
@@ -14634,8 +14809,8 @@ const O = class O {
|
|
|
14634
14809
|
* @param element 対象要素
|
|
14635
14810
|
*/
|
|
14636
14811
|
static syncElement(e) {
|
|
14637
|
-
const t = O.registrations.get(e), r =
|
|
14638
|
-
if (!(r instanceof
|
|
14812
|
+
const t = O.registrations.get(e), r = x.get(e);
|
|
14813
|
+
if (!(r instanceof w) || !O.shouldObserve(r)) {
|
|
14639
14814
|
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
14640
14815
|
return;
|
|
14641
14816
|
}
|
|
@@ -14760,7 +14935,7 @@ const O = class O {
|
|
|
14760
14935
|
*/
|
|
14761
14936
|
static realRowElements(e) {
|
|
14762
14937
|
return e.getChildren().filter(
|
|
14763
|
-
(t) => t instanceof
|
|
14938
|
+
(t) => t instanceof w && !t.hasAttribute(`${l.prefix}each-before`) && !t.hasAttribute(`${l.prefix}each-after`)
|
|
14764
14939
|
).map((t) => t.getTarget());
|
|
14765
14940
|
}
|
|
14766
14941
|
/**
|
|
@@ -14850,13 +15025,13 @@ const O = class O {
|
|
|
14850
15025
|
};
|
|
14851
15026
|
n[e.varName] = { ...t };
|
|
14852
15027
|
const s = e.fragment.getTarget(), a = i === s ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([e.fragment]);
|
|
14853
|
-
|
|
15028
|
+
M.setBindingData(i, n, {
|
|
14854
15029
|
skipFragments: a,
|
|
14855
15030
|
reflectToAttribute: !1,
|
|
14856
15031
|
// 可視範囲の公開は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
14857
15032
|
// 解除しない)。
|
|
14858
15033
|
kind: "nonSupply",
|
|
14859
|
-
sequence:
|
|
15034
|
+
sequence: w.nextSequence()
|
|
14860
15035
|
}).catch((o) => {
|
|
14861
15036
|
m.error("[Haori]", "Failed to publish visible range:", o);
|
|
14862
15037
|
});
|
|
@@ -14880,32 +15055,32 @@ const O = class O {
|
|
|
14880
15055
|
}
|
|
14881
15056
|
};
|
|
14882
15057
|
O.THRESHOLD = 0, O.DEFAULT_ROOT_MARGIN = "0px", O.registrations = /* @__PURE__ */ new Map();
|
|
14883
|
-
let
|
|
14884
|
-
const
|
|
15058
|
+
let me = O;
|
|
15059
|
+
const U = class U {
|
|
14885
15060
|
/**
|
|
14886
15061
|
* 既存の MutationObserver をすべて停止します。
|
|
14887
15062
|
*/
|
|
14888
15063
|
static disconnectMutationObservers() {
|
|
14889
|
-
|
|
15064
|
+
U._mutationObservers.forEach((e) => {
|
|
14890
15065
|
e.disconnect();
|
|
14891
|
-
}),
|
|
15066
|
+
}), U._mutationObservers.length = 0;
|
|
14892
15067
|
}
|
|
14893
15068
|
/**
|
|
14894
15069
|
* 初期化メソッド。
|
|
14895
15070
|
* ドキュメントのheadとbodyを監視対象として設定します。
|
|
14896
15071
|
*/
|
|
14897
15072
|
static async init() {
|
|
14898
|
-
if (
|
|
15073
|
+
if (U._initialized)
|
|
14899
15074
|
return;
|
|
14900
|
-
|
|
14901
|
-
|
|
15075
|
+
U._initialized = !0, U.disconnectMutationObservers(), w.setPendingMutationFlusher(() => {
|
|
15076
|
+
U.flushPendingMutations();
|
|
14902
15077
|
});
|
|
14903
15078
|
const e = new He();
|
|
14904
|
-
|
|
15079
|
+
U._dispatcher = e, e.startDeferred(), U._initialIntakes = [];
|
|
14905
15080
|
try {
|
|
14906
15081
|
const t = await Promise.allSettled([
|
|
14907
|
-
|
|
14908
|
-
|
|
15082
|
+
M.scan(document.head),
|
|
15083
|
+
M.scan(document.body)
|
|
14909
15084
|
]), [r, i] = t;
|
|
14910
15085
|
r.status !== "fulfilled" && m.error(
|
|
14911
15086
|
"[Haori]",
|
|
@@ -14915,9 +15090,9 @@ const Y = class Y {
|
|
|
14915
15090
|
"[Haori]",
|
|
14916
15091
|
"Failed to build body fragment:",
|
|
14917
15092
|
i.reason
|
|
14918
|
-
), await
|
|
15093
|
+
), await U.waitInitialIntakes(), await K.wait(), document.body.setAttribute("data-haori-ready", ""), U.observe(document.head), U.observe(document.body), Ae.syncTree(document.body), ve.syncTree(document.body), me.syncTree(document.body);
|
|
14919
15094
|
} finally {
|
|
14920
|
-
e.release();
|
|
15095
|
+
U._initialIntakes = null, e.release();
|
|
14921
15096
|
}
|
|
14922
15097
|
B.ready(qt);
|
|
14923
15098
|
}
|
|
@@ -14928,7 +15103,120 @@ const Y = class Y {
|
|
|
14928
15103
|
* @returns 稼働中の EventDispatcher。未初期化の場合は null。
|
|
14929
15104
|
*/
|
|
14930
15105
|
static getDispatcher() {
|
|
14931
|
-
return
|
|
15106
|
+
return U._dispatcher;
|
|
15107
|
+
}
|
|
15108
|
+
/**
|
|
15109
|
+
* 初期化の途中で取り込んだ DOM 変更の処理を、すべて待ちます。
|
|
15110
|
+
*
|
|
15111
|
+
* 初期スキャン中の連携の呼び出しが起こした変更は、`captureMutations()` が取り込んで
|
|
15112
|
+
* 処理(要素の追加の走査、属性の反映など)を始めています。仕様
|
|
15113
|
+
* 「data-haori-ready 属性」の「すべての DOM 操作の完了後」を保つため、それらの完了を
|
|
15114
|
+
* 待ってから付与へ進みます。待っている間の取り込みで増えた分も待ちます。
|
|
15115
|
+
*
|
|
15116
|
+
* @returns 待機完了の Promise
|
|
15117
|
+
*/
|
|
15118
|
+
static async waitInitialIntakes() {
|
|
15119
|
+
const e = U._initialIntakes;
|
|
15120
|
+
for (; e !== null && e.length > 0; )
|
|
15121
|
+
await Promise.allSettled(e.splice(0));
|
|
15122
|
+
}
|
|
15123
|
+
/**
|
|
15124
|
+
* 連携の呼び出しを実行し、呼び出しが起こした DOM 変更を取り込みます。
|
|
15125
|
+
*
|
|
15126
|
+
* DOM の監視は初期スキャンの後に始まるため、初期スキャン中の連携の呼び出しが
|
|
15127
|
+
* 起こした変更(要素の生成、`{{式}}` を含む宣言の追加など)は、そのままでは
|
|
15128
|
+
* 取り込まれません。仕様「`data-enhance`」の「初期スキャンの途中でも、後から追加
|
|
15129
|
+
* されたノードと同じく取り込みます」のため、監視の開始前に限り一時的な
|
|
15130
|
+
* `MutationObserver` で包み、呼び出しの直後に引き取った記録から既にある要素の
|
|
15131
|
+
* 取り外しと、既にある要素を包む追加を除いて(`toCapturedRecord()`)、通常の監視と
|
|
15132
|
+
* 同じ処理へ渡します。監視の開始後は、通常の監視が受け取るため何もしません。
|
|
15133
|
+
*
|
|
15134
|
+
* @internal `Enhance` の連携の呼び出しから使います(`Enhance.setMutationCapture()`)。
|
|
15135
|
+
* @param callback 連携の呼び出し
|
|
15136
|
+
* @returns 戻り値はありません。
|
|
15137
|
+
*/
|
|
15138
|
+
static captureMutations(e) {
|
|
15139
|
+
if (U._mutationObservers.length > 0) {
|
|
15140
|
+
e();
|
|
15141
|
+
return;
|
|
15142
|
+
}
|
|
15143
|
+
const t = new MutationObserver(() => {
|
|
15144
|
+
});
|
|
15145
|
+
t.observe(document.documentElement, {
|
|
15146
|
+
childList: !0,
|
|
15147
|
+
subtree: !0,
|
|
15148
|
+
attributes: !0,
|
|
15149
|
+
characterData: !0
|
|
15150
|
+
});
|
|
15151
|
+
try {
|
|
15152
|
+
e();
|
|
15153
|
+
} finally {
|
|
15154
|
+
const r = t.takeRecords().map((i) => U.toCapturedRecord(i));
|
|
15155
|
+
t.disconnect(), U.processMutations(r);
|
|
15156
|
+
}
|
|
15157
|
+
}
|
|
15158
|
+
/**
|
|
15159
|
+
* 監視の開始前に引き取った記録から、既にある要素の取り外しと、既にある要素を包む
|
|
15160
|
+
* 追加を除きます。
|
|
15161
|
+
*
|
|
15162
|
+
* 連携の呼び出しが新しく生成した要素の追加と、属性・テキストの変更は取り込みます
|
|
15163
|
+
* (仕様「`data-enhance`」の「初期スキャンの途中でも、後から追加されたノードと同じく
|
|
15164
|
+
* 取り込みます」)。既にある要素の取り外しと、既にある要素を生成した要素で包むことは
|
|
15165
|
+
* 取り込みません(同じ節の「既にある要素の取り外しと、既にある要素を生成した要素で
|
|
15166
|
+
* 包むことは、初期スキャンの途中では取り込みません」)。取り外しを取り込むと、DOM を
|
|
15167
|
+
* 動かすライブラリを `data-external` なしで使ったとき、移動に伴う取り外しで `init` の
|
|
15168
|
+
* 直後に `destroy` と取り外しが走り、書いた要素が初期表示で DOM から消えます。既にある
|
|
15169
|
+
* 要素を包む追加を取り込むと、生成した要素の断片がその要素を子にする一方で元の親の子の
|
|
15170
|
+
* 一覧にも残り、値が二重に収集されます。
|
|
15171
|
+
*
|
|
15172
|
+
* @param record 引き取った記録
|
|
15173
|
+
* @returns 処理する記録
|
|
15174
|
+
*/
|
|
15175
|
+
static toCapturedRecord(e) {
|
|
15176
|
+
return e.type !== "childList" ? e : {
|
|
15177
|
+
type: e.type,
|
|
15178
|
+
target: e.target,
|
|
15179
|
+
addedNodes: Array.from(e.addedNodes).filter(
|
|
15180
|
+
(t) => !U.hasKnownDescendant(t)
|
|
15181
|
+
),
|
|
15182
|
+
removedNodes: []
|
|
15183
|
+
};
|
|
15184
|
+
}
|
|
15185
|
+
/**
|
|
15186
|
+
* ノードの子孫の要素に、Haori が既に知っているものがあるかを返します。
|
|
15187
|
+
*
|
|
15188
|
+
* ノード自身が既に知っている要素かは確かめません。既にある要素そのものの追加は、
|
|
15189
|
+
* 取り外しを除いていれば断片の付け替えになるだけで、`destroy` も二重の収集も起こさない
|
|
15190
|
+
* ためです(確かめる行を外しても、既存のテストと、移した要素の `data-fetch` の回数に
|
|
15191
|
+
* 差が出ないことを確認済み)。
|
|
15192
|
+
*
|
|
15193
|
+
* @param node 対象ノード
|
|
15194
|
+
* @returns 既に知っている要素を子孫に含む場合 true
|
|
15195
|
+
*/
|
|
15196
|
+
static hasKnownDescendant(e) {
|
|
15197
|
+
return e instanceof Element && Array.from(e.querySelectorAll("*")).some(
|
|
15198
|
+
(t) => w.peek(t) !== null
|
|
15199
|
+
);
|
|
15200
|
+
}
|
|
15201
|
+
/**
|
|
15202
|
+
* 取り除いた記録が、`data-external` の内側の断片に対する古い記録かどうかを返します。
|
|
15203
|
+
*
|
|
15204
|
+
* `data-external` の配下で起きた変更は `isExternallyManaged()` で読み飛ばしますが、
|
|
15205
|
+
* その判定は処理の時点の祖先で行います。外部ライブラリの `destroy` が生成コンテナを
|
|
15206
|
+
* 取り除くと、コンテナの中で起きた変更(元の要素を戻したことなど)の記録は、処理の
|
|
15207
|
+
* 時点で対象が切り離されていて配下と判定できません。そのまま処理すると、
|
|
15208
|
+
* `data-external` の要素が保っている断片が木から外れ、書いた入力が収集から落ちます
|
|
15209
|
+
* (課題 #43)。記録の親と、ノードの断片の親が食い違い、かつその親が
|
|
15210
|
+
* `data-external` の要素かその配下なら、古い記録として捨てます。`data-external` の
|
|
15211
|
+
* 外では、移動の処理で断片の親が先に付け替わることがあるため適用しません。
|
|
15212
|
+
*
|
|
15213
|
+
* @param mutation 取り除いた記録
|
|
15214
|
+
* @param node 取り除かれたノード
|
|
15215
|
+
* @returns 捨てる場合 true
|
|
15216
|
+
*/
|
|
15217
|
+
static isStaleExternalRemoval(e, t) {
|
|
15218
|
+
const r = w.peek(t)?.getParent() ?? null;
|
|
15219
|
+
return r === null || r.getTarget() === e.target ? !1 : r.getTarget().closest(`[${l.prefix}external]`) !== null;
|
|
14932
15220
|
}
|
|
14933
15221
|
/**
|
|
14934
15222
|
* 指定ノードが「外部管理」サブツリーに属するかどうかを判定します。
|
|
@@ -14953,14 +15241,14 @@ const Y = class Y {
|
|
|
14953
15241
|
*/
|
|
14954
15242
|
static observe(e) {
|
|
14955
15243
|
const t = new MutationObserver((r) => {
|
|
14956
|
-
|
|
15244
|
+
U.processMutations(r);
|
|
14957
15245
|
});
|
|
14958
15246
|
t.observe(e, {
|
|
14959
15247
|
childList: !0,
|
|
14960
15248
|
subtree: !0,
|
|
14961
15249
|
attributes: !0,
|
|
14962
15250
|
characterData: !0
|
|
14963
|
-
}),
|
|
15251
|
+
}), U._mutationObservers.push(t);
|
|
14964
15252
|
}
|
|
14965
15253
|
/**
|
|
14966
15254
|
* 保留中の DOM 変更を同期的に引き取って処理へ載せます。
|
|
@@ -14983,15 +15271,15 @@ const Y = class Y {
|
|
|
14983
15271
|
* @returns 戻り値はありません。
|
|
14984
15272
|
*/
|
|
14985
15273
|
static flushPendingMutations() {
|
|
14986
|
-
for (const e of
|
|
15274
|
+
for (const e of U._mutationObservers) {
|
|
14987
15275
|
const t = e.takeRecords();
|
|
14988
15276
|
if (t.length === 0)
|
|
14989
15277
|
continue;
|
|
14990
|
-
const r = t.filter(
|
|
14991
|
-
(n) => !
|
|
15278
|
+
const r = t.filter(U.isBindAttributeRecord), i = t.filter(
|
|
15279
|
+
(n) => !U.isBindAttributeRecord(n)
|
|
14992
15280
|
);
|
|
14993
|
-
r.length > 0 &&
|
|
14994
|
-
|
|
15281
|
+
r.length > 0 && U.processMutations(r, w.nextSequence()), i.length > 0 && Promise.resolve().then(() => {
|
|
15282
|
+
U.processMutations(i);
|
|
14995
15283
|
});
|
|
14996
15284
|
}
|
|
14997
15285
|
}
|
|
@@ -15015,38 +15303,42 @@ const Y = class Y {
|
|
|
15015
15303
|
static processMutations(e, t) {
|
|
15016
15304
|
for (const r of e)
|
|
15017
15305
|
try {
|
|
15018
|
-
if (
|
|
15306
|
+
if (U.isExternallyManaged(r.target))
|
|
15019
15307
|
continue;
|
|
15020
15308
|
switch (r.type) {
|
|
15021
15309
|
case "attributes": {
|
|
15022
15310
|
const i = r.target;
|
|
15023
|
-
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(
|
|
15311
|
+
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(pe) && (r.attributeName === "disabled" || r.attributeName === pe))
|
|
15024
15312
|
break;
|
|
15025
15313
|
if (r.attributeName && (r.attributeName === `${l.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${l.prefix}if-false`))) {
|
|
15026
|
-
r.attributeName === "style" &&
|
|
15314
|
+
r.attributeName === "style" && w.reassertHiddenDisplay(i);
|
|
15027
15315
|
break;
|
|
15028
15316
|
}
|
|
15029
|
-
if (r.attributeName &&
|
|
15317
|
+
if (r.attributeName && M.isAliasedAttributeReflection(i, r.attributeName))
|
|
15030
15318
|
break;
|
|
15031
|
-
|
|
15319
|
+
const n = M.setAttribute(
|
|
15032
15320
|
i,
|
|
15033
15321
|
r.attributeName,
|
|
15034
15322
|
i.getAttribute(r.attributeName),
|
|
15035
15323
|
!0,
|
|
15036
15324
|
t
|
|
15037
|
-
)
|
|
15325
|
+
);
|
|
15326
|
+
U._initialIntakes?.push(n), Ae.syncElement(i), ve.syncElement(i), me.syncElement(i);
|
|
15038
15327
|
break;
|
|
15039
15328
|
}
|
|
15040
15329
|
case "childList": {
|
|
15041
15330
|
Array.from(r.removedNodes).forEach((i) => {
|
|
15042
|
-
Ae.cleanupTree(i), ve.cleanupTree(i),
|
|
15331
|
+
U.isStaleExternalRemoval(r, i) || (Ae.cleanupTree(i), ve.cleanupTree(i), me.cleanupTree(i), M.removeNode(i));
|
|
15043
15332
|
}), Array.from(r.addedNodes).forEach((i) => {
|
|
15044
|
-
|
|
15045
|
-
|
|
15333
|
+
if (!(i.parentElement instanceof Element))
|
|
15334
|
+
return;
|
|
15335
|
+
const n = M.addNode(i.parentElement, i);
|
|
15336
|
+
U._initialIntakes?.push(n), Ae.syncTree(i), ve.syncTree(i), me.syncTree(i);
|
|
15337
|
+
}), r.target instanceof Element && me.syncElement(r.target);
|
|
15046
15338
|
break;
|
|
15047
15339
|
}
|
|
15048
15340
|
case "characterData": {
|
|
15049
|
-
r.target instanceof Text || r.target instanceof Comment ?
|
|
15341
|
+
r.target instanceof Text || r.target instanceof Comment ? M.changeText(r.target, r.target.textContent) : m.warn(
|
|
15050
15342
|
"[Haori]",
|
|
15051
15343
|
"Unsupported character data type:",
|
|
15052
15344
|
r.target
|
|
@@ -15062,19 +15354,20 @@ const Y = class Y {
|
|
|
15062
15354
|
}
|
|
15063
15355
|
}
|
|
15064
15356
|
};
|
|
15065
|
-
|
|
15066
|
-
let
|
|
15067
|
-
|
|
15357
|
+
U._initialized = !1, U._mutationObservers = [], U._dispatcher = null, U._initialIntakes = null;
|
|
15358
|
+
let xe = U;
|
|
15359
|
+
ae.setMutationCapture((b) => xe.captureMutations(b));
|
|
15360
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", xe.init) : xe.init();
|
|
15068
15361
|
const jt = () => Re.waitForRenders(), Kt = Re.enhancers;
|
|
15069
15362
|
export {
|
|
15070
|
-
|
|
15363
|
+
M as Core,
|
|
15071
15364
|
ae as Enhance,
|
|
15072
15365
|
l as Env,
|
|
15073
|
-
|
|
15074
|
-
|
|
15366
|
+
I as Form,
|
|
15367
|
+
x as Fragment,
|
|
15075
15368
|
Re as Haori,
|
|
15076
15369
|
m as Log,
|
|
15077
|
-
|
|
15370
|
+
K as Queue,
|
|
15078
15371
|
Re as default,
|
|
15079
15372
|
Kt as enhancers,
|
|
15080
15373
|
qt as version,
|