haori 0.6.2 → 0.7.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/dist/haori.cjs.js +10 -10
- package/dist/haori.cjs.js.map +1 -1
- package/dist/haori.es.js +382 -358
- package/dist/haori.es.js.map +1 -1
- package/dist/haori.iife.js +10 -10
- package/dist/haori.iife.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/procedure.d.ts +2 -0
- package/dist/src/procedure.d.ts.map +1 -1
- package/dist/src/procedure.js +37 -2
- package/dist/src/procedure.js.map +1 -1
- package/dist/tests/procedure-action-operations.test.js +128 -0
- package/dist/tests/procedure-action-operations.test.js.map +1 -1
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -29,13 +29,13 @@ const q = class q {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
q.devMode = !1;
|
|
32
|
-
let
|
|
32
|
+
let U = q;
|
|
33
33
|
const se = "embedded";
|
|
34
|
-
function ue(
|
|
35
|
-
return
|
|
34
|
+
function ue(D) {
|
|
35
|
+
return D === "embedded" || D === "demo";
|
|
36
36
|
}
|
|
37
|
-
function he(
|
|
38
|
-
return
|
|
37
|
+
function he(D) {
|
|
38
|
+
return D === null ? null : ue(D) ? D : se;
|
|
39
39
|
}
|
|
40
40
|
const $ = class $ {
|
|
41
41
|
/**
|
|
@@ -73,15 +73,15 @@ const $ = class $ {
|
|
|
73
73
|
i !== null && ($._runtime = i);
|
|
74
74
|
}
|
|
75
75
|
if (e instanceof HTMLScriptElement && e.hasAttribute(`${$._prefix}dev`)) {
|
|
76
|
-
|
|
76
|
+
U.set(!0);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const t = window.location.hostname;
|
|
80
80
|
if (t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "::1" || t.endsWith(".local")) {
|
|
81
|
-
|
|
81
|
+
U.set(!0);
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
U.set(!1);
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -97,7 +97,7 @@ const $ = class $ {
|
|
|
97
97
|
$._prefix = "data-", $._runtime = se;
|
|
98
98
|
let l = $;
|
|
99
99
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
|
|
100
|
-
class
|
|
100
|
+
class g {
|
|
101
101
|
/**
|
|
102
102
|
* 開発モードでのみコンソールに情報を出力します。
|
|
103
103
|
*
|
|
@@ -105,7 +105,7 @@ class m {
|
|
|
105
105
|
* @param args 追加の引数
|
|
106
106
|
*/
|
|
107
107
|
static info(e, ...t) {
|
|
108
|
-
|
|
108
|
+
U.isEnabled() && console.log && console.log(e, ...t);
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* 開発モードでのみコンソールに警告を出力します。
|
|
@@ -114,7 +114,7 @@ class m {
|
|
|
114
114
|
* @param args 追加の引数
|
|
115
115
|
*/
|
|
116
116
|
static warn(e, ...t) {
|
|
117
|
-
|
|
117
|
+
U.isEnabled() && console.warn && console.warn(e, ...t);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* モードに関係なくコンソールにエラーを出力します。
|
|
@@ -126,7 +126,7 @@ class m {
|
|
|
126
126
|
console.error(e, ...t);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const C = class C {
|
|
130
130
|
/**
|
|
131
131
|
* 明示バインド内に持ち込まれてはならない危険値を返します。
|
|
132
132
|
*
|
|
@@ -197,18 +197,18 @@ const P = class P {
|
|
|
197
197
|
*/
|
|
198
198
|
static evaluateDetailed(e, t = {}) {
|
|
199
199
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
200
|
-
return
|
|
200
|
+
return g.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
201
201
|
if (this.containsDangerousPatterns(e))
|
|
202
|
-
return
|
|
202
|
+
return g.warn("[Haori]", e, "Expression contains dangerous patterns"), { value: null, unresolvedReference: !1 };
|
|
203
203
|
if (this.containsForbiddenKeys(t))
|
|
204
|
-
return
|
|
204
|
+
return g.warn("[Haori]", t, "Binded values contain forbidden keys"), { value: null, unresolvedReference: !1 };
|
|
205
205
|
const r = this.getForbiddenBindingValueSet();
|
|
206
206
|
if (this.containsForbiddenBindingValues(
|
|
207
207
|
t,
|
|
208
208
|
/* @__PURE__ */ new WeakSet(),
|
|
209
209
|
r
|
|
210
210
|
))
|
|
211
|
-
return
|
|
211
|
+
return g.warn(
|
|
212
212
|
"[Haori]",
|
|
213
213
|
t,
|
|
214
214
|
"Binded values contain forbidden values"
|
|
@@ -236,10 +236,10 @@ const P = class P {
|
|
|
236
236
|
continue;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
return
|
|
239
|
+
return g.error("[Haori]", "Expression evaluation error:", e, o), o instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
return
|
|
242
|
+
return g.error(
|
|
243
243
|
"[Haori]",
|
|
244
244
|
"Failed to recover missing identifiers:",
|
|
245
245
|
e,
|
|
@@ -273,7 +273,7 @@ return (${e});`;
|
|
|
273
273
|
compileFailed: !1
|
|
274
274
|
};
|
|
275
275
|
} catch (o) {
|
|
276
|
-
return
|
|
276
|
+
return g.error(
|
|
277
277
|
"[Haori]",
|
|
278
278
|
"Failed to compile expression:",
|
|
279
279
|
e,
|
|
@@ -755,7 +755,7 @@ return (${e});`;
|
|
|
755
755
|
return this.forbiddenBindingValueCache.set(e, !1), !1;
|
|
756
756
|
}
|
|
757
757
|
};
|
|
758
|
-
|
|
758
|
+
C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), C.forbiddenBindingValueCacheResetScheduled = !1, C.FORBIDDEN_NAMES = [
|
|
759
759
|
// グローバルオブジェクト
|
|
760
760
|
"window",
|
|
761
761
|
"self",
|
|
@@ -787,23 +787,23 @@ P.MAX_IDENTIFIER_RECOVERY_COUNT = 8, P.forbiddenBindingValueCache = /* @__PURE__
|
|
|
787
787
|
"sessionStorage",
|
|
788
788
|
"IndexedDB",
|
|
789
789
|
"history"
|
|
790
|
-
],
|
|
791
|
-
...
|
|
792
|
-
(e) => !
|
|
790
|
+
], C.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], C.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), C.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
791
|
+
...C.FORBIDDEN_NAMES.filter(
|
|
792
|
+
(e) => !C.REBINDABLE_FORBIDDEN_NAMES.has(e)
|
|
793
793
|
),
|
|
794
794
|
"constructor",
|
|
795
795
|
"__proto__",
|
|
796
796
|
"prototype",
|
|
797
|
-
...
|
|
798
|
-
]),
|
|
797
|
+
...C.STRICT_FORBIDDEN_NAMES
|
|
798
|
+
]), C.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
|
|
799
799
|
"constructor",
|
|
800
800
|
"__proto__",
|
|
801
801
|
"prototype"
|
|
802
|
-
]),
|
|
802
|
+
]), C.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
|
|
803
803
|
"get",
|
|
804
804
|
"set",
|
|
805
805
|
"async"
|
|
806
|
-
]),
|
|
806
|
+
]), C.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
807
807
|
"await",
|
|
808
808
|
"break",
|
|
809
809
|
"case",
|
|
@@ -837,8 +837,8 @@ P.MAX_IDENTIFIER_RECOVERY_COUNT = 8, P.forbiddenBindingValueCache = /* @__PURE__
|
|
|
837
837
|
"while",
|
|
838
838
|
"with",
|
|
839
839
|
"yield"
|
|
840
|
-
]),
|
|
841
|
-
let W =
|
|
840
|
+
]), C.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
|
|
841
|
+
let W = C;
|
|
842
842
|
class de {
|
|
843
843
|
constructor() {
|
|
844
844
|
this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
|
|
@@ -881,13 +881,13 @@ class de {
|
|
|
881
881
|
const r = await t.task();
|
|
882
882
|
t.resolve(r);
|
|
883
883
|
} catch (r) {
|
|
884
|
-
t.reject(r),
|
|
884
|
+
t.reject(r), g.error("[Haori]", `Task ${t.timestamp} failed:`, r);
|
|
885
885
|
}
|
|
886
886
|
if (performance.now() - e > this.MAX_BUDGET)
|
|
887
887
|
break;
|
|
888
888
|
}
|
|
889
889
|
} catch (e) {
|
|
890
|
-
|
|
890
|
+
g.error("[Haori]", "Error processing queue:", e);
|
|
891
891
|
} finally {
|
|
892
892
|
this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
|
|
893
893
|
}
|
|
@@ -934,7 +934,7 @@ const oe = class oe {
|
|
|
934
934
|
}
|
|
935
935
|
};
|
|
936
936
|
oe.ASYNC_QUEUE = new de();
|
|
937
|
-
let
|
|
937
|
+
let x = oe;
|
|
938
938
|
class te {
|
|
939
939
|
/**
|
|
940
940
|
* 実行モードを取得します。
|
|
@@ -960,7 +960,7 @@ class te {
|
|
|
960
960
|
* @returns 通知が閉じられると解決されるPromise
|
|
961
961
|
*/
|
|
962
962
|
static dialog(e) {
|
|
963
|
-
return
|
|
963
|
+
return x.enqueue(() => {
|
|
964
964
|
window.alert(e);
|
|
965
965
|
}, !0);
|
|
966
966
|
}
|
|
@@ -988,7 +988,7 @@ class te {
|
|
|
988
988
|
* @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
|
|
989
989
|
*/
|
|
990
990
|
static confirm(e) {
|
|
991
|
-
return
|
|
991
|
+
return x.enqueue(() => window.confirm(e), !0);
|
|
992
992
|
}
|
|
993
993
|
/**
|
|
994
994
|
* ダイアログを開きます。
|
|
@@ -996,8 +996,8 @@ class te {
|
|
|
996
996
|
* @param element 開くダイアログのHTML要素
|
|
997
997
|
*/
|
|
998
998
|
static openDialog(e) {
|
|
999
|
-
return
|
|
1000
|
-
e instanceof HTMLDialogElement ? e.showModal() :
|
|
999
|
+
return x.enqueue(() => {
|
|
1000
|
+
e instanceof HTMLDialogElement ? e.showModal() : g.error("[Haori]", "Element is not a dialog: ", e);
|
|
1001
1001
|
}, !0);
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
@@ -1006,8 +1006,8 @@ class te {
|
|
|
1006
1006
|
* @param element 閉じるダイアログのHTML要素
|
|
1007
1007
|
*/
|
|
1008
1008
|
static closeDialog(e) {
|
|
1009
|
-
return
|
|
1010
|
-
e instanceof HTMLDialogElement ? e.close() :
|
|
1009
|
+
return x.enqueue(() => {
|
|
1010
|
+
e instanceof HTMLDialogElement ? e.close() : g.error("[Haori]", "Element is not a dialog: ", e);
|
|
1011
1011
|
}, !0);
|
|
1012
1012
|
}
|
|
1013
1013
|
/**
|
|
@@ -1027,7 +1027,7 @@ class te {
|
|
|
1027
1027
|
* @param level メッセージのレベル(省略可能)
|
|
1028
1028
|
*/
|
|
1029
1029
|
static addMessage(e, t, r) {
|
|
1030
|
-
return
|
|
1030
|
+
return x.enqueue(() => {
|
|
1031
1031
|
const i = e instanceof HTMLFormElement ? e : e.parentElement ?? e;
|
|
1032
1032
|
i.setAttribute("data-message", t), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
|
|
1033
1033
|
}, !0);
|
|
@@ -1038,7 +1038,7 @@ class te {
|
|
|
1038
1038
|
* @param parent メッセージをクリアする親要素
|
|
1039
1039
|
*/
|
|
1040
1040
|
static clearMessages(e) {
|
|
1041
|
-
return
|
|
1041
|
+
return x.enqueue(() => {
|
|
1042
1042
|
e.removeAttribute("data-message"), e.removeAttribute("data-message-level"), e.querySelectorAll("[data-message]").forEach((t) => {
|
|
1043
1043
|
t.removeAttribute("data-message"), t.removeAttribute("data-message-level");
|
|
1044
1044
|
});
|
|
@@ -1076,7 +1076,7 @@ class E {
|
|
|
1076
1076
|
static getPartValues(e, t) {
|
|
1077
1077
|
const r = e.getAttribute("name"), i = e.getAttribute(`${l.prefix}form-object`), s = e.getAttribute(`${l.prefix}form-list`);
|
|
1078
1078
|
if (r) {
|
|
1079
|
-
s ? Array.isArray(t[String(r)]) ? t[String(r)].push(e.getValue()) : t[String(r)] = [e.getValue()] : t[String(r)] = e.getValue(), i &&
|
|
1079
|
+
s ? Array.isArray(t[String(r)]) ? t[String(r)].push(e.getValue()) : t[String(r)] = [e.getValue()] : t[String(r)] = e.getValue(), i && g.warn(
|
|
1080
1080
|
"Haori",
|
|
1081
1081
|
`Element cannot have both ${l.prefix}form-object and name attributes.`
|
|
1082
1082
|
);
|
|
@@ -1086,7 +1086,7 @@ class E {
|
|
|
1086
1086
|
const n = {};
|
|
1087
1087
|
for (const a of e.getChildElementFragments())
|
|
1088
1088
|
E.getPartValues(a, n);
|
|
1089
|
-
Object.keys(n).length > 0 && (t[String(i)] = n), s &&
|
|
1089
|
+
Object.keys(n).length > 0 && (t[String(i)] = n), s && g.warn(
|
|
1090
1090
|
"Haori",
|
|
1091
1091
|
`Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
|
|
1092
1092
|
);
|
|
@@ -1160,10 +1160,10 @@ class E {
|
|
|
1160
1160
|
} else if (o) {
|
|
1161
1161
|
const f = t[String(o)];
|
|
1162
1162
|
if (f && typeof f == "object")
|
|
1163
|
-
for (const
|
|
1163
|
+
for (const m of e.getChildElementFragments())
|
|
1164
1164
|
n.push(
|
|
1165
1165
|
E.setPartValues(
|
|
1166
|
-
|
|
1166
|
+
m,
|
|
1167
1167
|
f,
|
|
1168
1168
|
null,
|
|
1169
1169
|
i,
|
|
@@ -1173,9 +1173,9 @@ class E {
|
|
|
1173
1173
|
} else if (c) {
|
|
1174
1174
|
const f = t[String(c)];
|
|
1175
1175
|
if (Array.isArray(f)) {
|
|
1176
|
-
const
|
|
1177
|
-
for (let v = 0; v <
|
|
1178
|
-
const p =
|
|
1176
|
+
const m = e.getChildElementFragments();
|
|
1177
|
+
for (let v = 0; v < m.length; v++) {
|
|
1178
|
+
const p = m[v];
|
|
1179
1179
|
f.length > v ? n.push(
|
|
1180
1180
|
E.setPartValues(
|
|
1181
1181
|
p,
|
|
@@ -1206,7 +1206,7 @@ class E {
|
|
|
1206
1206
|
E.clearValues(e), await Promise.all([
|
|
1207
1207
|
E.clearMessages(e),
|
|
1208
1208
|
E.clearEachClones(e)
|
|
1209
|
-
]), await
|
|
1209
|
+
]), await x.enqueue(() => {
|
|
1210
1210
|
const t = e.getTarget();
|
|
1211
1211
|
if (t instanceof HTMLFormElement)
|
|
1212
1212
|
t.reset();
|
|
@@ -1217,7 +1217,7 @@ class E {
|
|
|
1217
1217
|
s.appendChild(t), s.reset(), r.insertBefore(t, i);
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
|
-
}), await
|
|
1220
|
+
}), await M.evaluateAll(e);
|
|
1221
1221
|
}
|
|
1222
1222
|
/**
|
|
1223
1223
|
* data-each によって生成された複製(テンプレート以外)を削除します。
|
|
@@ -1325,9 +1325,9 @@ class E {
|
|
|
1325
1325
|
if (s === o) {
|
|
1326
1326
|
const c = i.substring(n + 1, a), d = Number(c);
|
|
1327
1327
|
if (isNaN(d))
|
|
1328
|
-
|
|
1328
|
+
g.error("Haori", `Invalid index: ${i}`);
|
|
1329
1329
|
else {
|
|
1330
|
-
const f = e.getChildElementFragments().filter((
|
|
1330
|
+
const f = e.getChildElementFragments().filter((m) => m.hasAttribute(`${l.prefix}row`));
|
|
1331
1331
|
d < f.length && r.push(
|
|
1332
1332
|
...E.findFragmentByKeyParts(f[d], t.slice(1))
|
|
1333
1333
|
);
|
|
@@ -1354,12 +1354,12 @@ class E {
|
|
|
1354
1354
|
return r ? this.getFormFragment(r) : null;
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
const
|
|
1357
|
+
const N = class N {
|
|
1358
1358
|
/**
|
|
1359
1359
|
* 集計状態を初期化します。
|
|
1360
1360
|
*/
|
|
1361
1361
|
static reset() {
|
|
1362
|
-
|
|
1362
|
+
N.ELEMENT_STORES.clear(), N.ensureGlobalAccess();
|
|
1363
1363
|
}
|
|
1364
1364
|
/**
|
|
1365
1365
|
* 現在の集計結果スナップショットを返します。
|
|
@@ -1367,7 +1367,7 @@ const F = class F {
|
|
|
1367
1367
|
* @returns エレメントごとの集計結果
|
|
1368
1368
|
*/
|
|
1369
1369
|
static snapshot() {
|
|
1370
|
-
return
|
|
1370
|
+
return N.ensureGlobalAccess(), [...N.ELEMENT_STORES.entries()].map(([e, t]) => ({
|
|
1371
1371
|
elementId: e,
|
|
1372
1372
|
tagName: t.tagName,
|
|
1373
1373
|
attributes: [...t.attributes.entries()].map(([r, i]) => ({
|
|
@@ -1376,7 +1376,7 @@ const F = class F {
|
|
|
1376
1376
|
calls: i.calls,
|
|
1377
1377
|
totalDurationMs: i.totalDurationMs,
|
|
1378
1378
|
maxDurationMs: i.maxDurationMs,
|
|
1379
|
-
placeholders:
|
|
1379
|
+
placeholders: N.sortPlaceholders(
|
|
1380
1380
|
i.placeholders
|
|
1381
1381
|
)
|
|
1382
1382
|
})).sort((r, i) => i.calls - r.calls),
|
|
@@ -1386,7 +1386,7 @@ const F = class F {
|
|
|
1386
1386
|
calls: i.calls,
|
|
1387
1387
|
totalDurationMs: i.totalDurationMs,
|
|
1388
1388
|
maxDurationMs: i.maxDurationMs,
|
|
1389
|
-
placeholders:
|
|
1389
|
+
placeholders: N.sortPlaceholders(
|
|
1390
1390
|
i.placeholders
|
|
1391
1391
|
)
|
|
1392
1392
|
})).sort((r, i) => i.calls - r.calls)
|
|
@@ -1402,31 +1402,31 @@ const F = class F {
|
|
|
1402
1402
|
* @param expressions 今回評価した式一覧
|
|
1403
1403
|
*/
|
|
1404
1404
|
static record(e, t, r) {
|
|
1405
|
-
if (!
|
|
1405
|
+
if (!U.isEnabled() || !e || t.length === 0)
|
|
1406
1406
|
return;
|
|
1407
|
-
|
|
1408
|
-
const i =
|
|
1407
|
+
N.ensureGlobalAccess();
|
|
1408
|
+
const i = N.getOrCreateElementStore(
|
|
1409
1409
|
e.element
|
|
1410
1410
|
);
|
|
1411
1411
|
if (e.kind === "attribute") {
|
|
1412
|
-
const n =
|
|
1412
|
+
const n = N.getOrCreateCounter(
|
|
1413
1413
|
i.attributes,
|
|
1414
1414
|
e.rawName,
|
|
1415
1415
|
e.template
|
|
1416
1416
|
);
|
|
1417
|
-
|
|
1417
|
+
N.updateCounter(
|
|
1418
1418
|
n,
|
|
1419
1419
|
t,
|
|
1420
1420
|
r
|
|
1421
1421
|
);
|
|
1422
1422
|
return;
|
|
1423
1423
|
}
|
|
1424
|
-
const s =
|
|
1424
|
+
const s = N.getOrCreateCounter(
|
|
1425
1425
|
i.texts,
|
|
1426
1426
|
String(e.childIndex),
|
|
1427
1427
|
e.template
|
|
1428
1428
|
);
|
|
1429
|
-
|
|
1429
|
+
N.updateCounter(
|
|
1430
1430
|
s,
|
|
1431
1431
|
t,
|
|
1432
1432
|
r
|
|
@@ -1436,12 +1436,12 @@ const F = class F {
|
|
|
1436
1436
|
* globalThis から dev-only の取得窓口を参照できるようにします。
|
|
1437
1437
|
*/
|
|
1438
1438
|
static ensureGlobalAccess() {
|
|
1439
|
-
if (!
|
|
1439
|
+
if (!U.isEnabled())
|
|
1440
1440
|
return;
|
|
1441
1441
|
const e = globalThis;
|
|
1442
|
-
e[
|
|
1443
|
-
reset: () =>
|
|
1444
|
-
snapshot: () =>
|
|
1442
|
+
e[N.GLOBAL_KEY] === void 0 && (e[N.GLOBAL_KEY] = {
|
|
1443
|
+
reset: () => N.reset(),
|
|
1444
|
+
snapshot: () => N.snapshot()
|
|
1445
1445
|
});
|
|
1446
1446
|
}
|
|
1447
1447
|
/**
|
|
@@ -1451,7 +1451,7 @@ const F = class F {
|
|
|
1451
1451
|
* @returns 集計ストア
|
|
1452
1452
|
*/
|
|
1453
1453
|
static getOrCreateElementStore(e) {
|
|
1454
|
-
const t =
|
|
1454
|
+
const t = N.createElementId(e), r = N.ELEMENT_STORES.get(t);
|
|
1455
1455
|
if (r)
|
|
1456
1456
|
return r;
|
|
1457
1457
|
const i = {
|
|
@@ -1459,7 +1459,7 @@ const F = class F {
|
|
|
1459
1459
|
attributes: /* @__PURE__ */ new Map(),
|
|
1460
1460
|
texts: /* @__PURE__ */ new Map()
|
|
1461
1461
|
};
|
|
1462
|
-
return
|
|
1462
|
+
return N.ELEMENT_STORES.set(t, i), i;
|
|
1463
1463
|
}
|
|
1464
1464
|
/**
|
|
1465
1465
|
* カウンタを取得または初期化します。
|
|
@@ -1509,7 +1509,7 @@ const F = class F {
|
|
|
1509
1509
|
*/
|
|
1510
1510
|
static updateCounter(e, t, r) {
|
|
1511
1511
|
e.calls += 1, e.totalDurationMs += r, e.maxDurationMs = Math.max(e.maxDurationMs, r), t.forEach((i) => {
|
|
1512
|
-
const s =
|
|
1512
|
+
const s = N.getOrCreatePlaceholder(
|
|
1513
1513
|
e.placeholders,
|
|
1514
1514
|
i.expression
|
|
1515
1515
|
);
|
|
@@ -1548,10 +1548,10 @@ const F = class F {
|
|
|
1548
1548
|
* @returns 結果と所要時間
|
|
1549
1549
|
*/
|
|
1550
1550
|
static measure(e) {
|
|
1551
|
-
const t =
|
|
1551
|
+
const t = N.now();
|
|
1552
1552
|
return {
|
|
1553
1553
|
value: e(),
|
|
1554
|
-
durationMs:
|
|
1554
|
+
durationMs: N.now() - t
|
|
1555
1555
|
};
|
|
1556
1556
|
}
|
|
1557
1557
|
/**
|
|
@@ -1578,8 +1578,8 @@ const F = class F {
|
|
|
1578
1578
|
return t.join(" > ");
|
|
1579
1579
|
}
|
|
1580
1580
|
};
|
|
1581
|
-
|
|
1582
|
-
let J =
|
|
1581
|
+
N.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", N.ELEMENT_STORES = /* @__PURE__ */ new Map();
|
|
1582
|
+
let J = N;
|
|
1583
1583
|
const K = class K {
|
|
1584
1584
|
/**
|
|
1585
1585
|
* フラグメントのコンストラクタ。
|
|
@@ -1597,16 +1597,16 @@ const K = class K {
|
|
|
1597
1597
|
let t;
|
|
1598
1598
|
switch (e.nodeType) {
|
|
1599
1599
|
case Node.ELEMENT_NODE:
|
|
1600
|
-
t = new
|
|
1600
|
+
t = new P(e);
|
|
1601
1601
|
break;
|
|
1602
1602
|
case Node.TEXT_NODE:
|
|
1603
|
-
t = new
|
|
1603
|
+
t = new H(e);
|
|
1604
1604
|
break;
|
|
1605
1605
|
case Node.COMMENT_NODE:
|
|
1606
1606
|
t = new ae(e);
|
|
1607
1607
|
break;
|
|
1608
1608
|
default:
|
|
1609
|
-
return
|
|
1609
|
+
return g.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
|
|
1610
1610
|
}
|
|
1611
1611
|
return t;
|
|
1612
1612
|
}
|
|
@@ -1628,7 +1628,7 @@ const K = class K {
|
|
|
1628
1628
|
return Promise.resolve();
|
|
1629
1629
|
if (this.parent) {
|
|
1630
1630
|
const e = this.parent, t = e.skipMutationNodes;
|
|
1631
|
-
return
|
|
1631
|
+
return x.enqueue(() => {
|
|
1632
1632
|
e.skipMutationNodes = !0, this.target.parentNode === e.getTarget() && e.getTarget().removeChild(this.target), this.mounted = !1;
|
|
1633
1633
|
}).finally(() => {
|
|
1634
1634
|
e.skipMutationNodes = t;
|
|
@@ -1636,7 +1636,7 @@ const K = class K {
|
|
|
1636
1636
|
} else {
|
|
1637
1637
|
const e = this.target.parentNode;
|
|
1638
1638
|
if (e)
|
|
1639
|
-
return
|
|
1639
|
+
return x.enqueue(() => {
|
|
1640
1640
|
this.target.parentNode === e && e.removeChild(this.target), this.mounted = !1;
|
|
1641
1641
|
});
|
|
1642
1642
|
this.mounted = !1;
|
|
@@ -1653,7 +1653,7 @@ const K = class K {
|
|
|
1653
1653
|
return Promise.resolve();
|
|
1654
1654
|
if (this.parent) {
|
|
1655
1655
|
const e = this.parent, t = e.skipMutationNodes;
|
|
1656
|
-
return
|
|
1656
|
+
return x.enqueue(() => {
|
|
1657
1657
|
e.skipMutationNodes = !0, this.target.parentNode !== e.getTarget() && e.getTarget().appendChild(this.target), this.mounted = !0;
|
|
1658
1658
|
}).finally(() => {
|
|
1659
1659
|
e.skipMutationNodes = t;
|
|
@@ -1783,7 +1783,7 @@ const V = class V extends w {
|
|
|
1783
1783
|
removeChild(e) {
|
|
1784
1784
|
const t = this.children.indexOf(e);
|
|
1785
1785
|
if (t < 0) {
|
|
1786
|
-
|
|
1786
|
+
g.warn("[Haori]", "Child fragment not found.", e);
|
|
1787
1787
|
return;
|
|
1788
1788
|
}
|
|
1789
1789
|
this.children.splice(t, 1), e.setParent(null);
|
|
@@ -2047,16 +2047,16 @@ const V = class V extends w {
|
|
|
2047
2047
|
if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
|
|
2048
2048
|
const i = this.getAttribute("value"), s = r.type === "checkbox" && i === "true";
|
|
2049
2049
|
let n;
|
|
2050
|
-
return s ? n = e === !0 || e === "true" : i === "false" ? n = e === !1 : n = i === String(e), this.value = s ? n : n ? e : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0,
|
|
2050
|
+
return s ? n = e === !0 || e === "true" : i === "false" ? n = e === !1 : n = i === String(e), this.value = s ? n : n ? e : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, x.enqueue(() => {
|
|
2051
2051
|
r.checked = n, t && r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2052
2052
|
}).finally(() => {
|
|
2053
2053
|
this.skipChangeValue = !1;
|
|
2054
2054
|
}));
|
|
2055
|
-
} else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = e, this.skipChangeValue = !0,
|
|
2055
|
+
} else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = e, this.skipChangeValue = !0, x.enqueue(() => {
|
|
2056
2056
|
r.value = e === null ? "" : String(e), t && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
2057
2057
|
}).finally(() => {
|
|
2058
2058
|
this.skipChangeValue = !1;
|
|
2059
|
-
})) : (
|
|
2059
|
+
})) : (g.warn(
|
|
2060
2060
|
"[Haori]",
|
|
2061
2061
|
"setValue is not supported for this element type.",
|
|
2062
2062
|
r
|
|
@@ -2138,7 +2138,7 @@ const V = class V extends w {
|
|
|
2138
2138
|
return Promise.resolve();
|
|
2139
2139
|
this.attributeMap.delete(e), this.skipMutationAttributes = !0;
|
|
2140
2140
|
const r = this.getTarget();
|
|
2141
|
-
return
|
|
2141
|
+
return x.enqueue(() => {
|
|
2142
2142
|
r.removeAttribute(e), t !== e && r.removeAttribute(t);
|
|
2143
2143
|
}).finally(() => {
|
|
2144
2144
|
this.skipMutationAttributes = !1;
|
|
@@ -2160,9 +2160,9 @@ const V = class V extends w {
|
|
|
2160
2160
|
return e === t ? this.removeAttribute(e) : this.removeAliasedAttribute(e, t);
|
|
2161
2161
|
const n = new X(e, r);
|
|
2162
2162
|
if (s) {
|
|
2163
|
-
const
|
|
2164
|
-
if (
|
|
2165
|
-
return this.skipMutationAttributes = !0,
|
|
2163
|
+
const L = this.attributeMap.get(e);
|
|
2164
|
+
if (L && (L.isEvaluate || L.isForceEvaluation()) && !n.isEvaluate && !n.isForceEvaluation())
|
|
2165
|
+
return this.skipMutationAttributes = !0, x.enqueue(() => {
|
|
2166
2166
|
}).finally(() => {
|
|
2167
2167
|
this.skipMutationAttributes = !1;
|
|
2168
2168
|
});
|
|
@@ -2173,9 +2173,9 @@ const V = class V extends w {
|
|
|
2173
2173
|
element: a,
|
|
2174
2174
|
rawName: e,
|
|
2175
2175
|
template: r
|
|
2176
|
-
}), c = n.isEvaluate || n.isRawEvaluate, d = e === t && V.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), f = n.isSingleExpression(),
|
|
2177
|
-
return !y && !
|
|
2178
|
-
y && a.setAttribute(e, r), A === null ? a.removeAttribute(t) : (
|
|
2176
|
+
}), c = n.isEvaluate || n.isRawEvaluate, d = e === t && V.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), f = n.isSingleExpression(), m = j.joinEvaluateResults(o.results), v = o.results.length === 1 ? o.results[0] : m, p = !n.isForceEvaluation() && (t !== e || d || f ? o.hasUnresolvedReference || v === null || v === void 0 || v === !1 : c && m === ""), b = n.isForceEvaluation() ? r : f ? v : m, S = i && n.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), A = p || b === null || b === !1 ? null : String(b), y = e !== t && a.getAttribute(e) !== r, R = A === null ? a.hasAttribute(t) : a.getAttribute(t) !== A, B = S && A !== null && a.value !== A;
|
|
2177
|
+
return !y && !R && !B ? (S && A !== null && (this.value = A), Promise.resolve()) : (this.skipMutationAttributes = !0, x.enqueue(() => {
|
|
2178
|
+
y && a.setAttribute(e, r), A === null ? a.removeAttribute(t) : (R && a.setAttribute(t, A), S && (this.value = A, B && (a.value = A)));
|
|
2179
2179
|
}).finally(() => {
|
|
2180
2180
|
this.skipMutationAttributes = !1;
|
|
2181
2181
|
}));
|
|
@@ -2191,7 +2191,7 @@ const V = class V extends w {
|
|
|
2191
2191
|
return Promise.resolve();
|
|
2192
2192
|
this.attributeMap.delete(e), this.skipMutationAttributes = !0;
|
|
2193
2193
|
const t = this.getTarget();
|
|
2194
|
-
return
|
|
2194
|
+
return x.enqueue(() => {
|
|
2195
2195
|
t.removeAttribute(e);
|
|
2196
2196
|
}).finally(() => {
|
|
2197
2197
|
this.skipMutationAttributes = !1;
|
|
@@ -2294,13 +2294,13 @@ const V = class V extends w {
|
|
|
2294
2294
|
if (this.skipMutationNodes)
|
|
2295
2295
|
return Promise.resolve();
|
|
2296
2296
|
if (e === this)
|
|
2297
|
-
return
|
|
2297
|
+
return g.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
|
|
2298
2298
|
const i = /* @__PURE__ */ new Set();
|
|
2299
2299
|
let s = this.parent;
|
|
2300
2300
|
for (; s; )
|
|
2301
2301
|
i.add(s), s = s.getParent();
|
|
2302
2302
|
if (i.has(e))
|
|
2303
|
-
return
|
|
2303
|
+
return g.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
|
|
2304
2304
|
const n = e.getParent() === this;
|
|
2305
2305
|
let a = -1, o = -1;
|
|
2306
2306
|
n && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
|
|
@@ -2310,23 +2310,23 @@ const V = class V extends w {
|
|
|
2310
2310
|
if (t === null)
|
|
2311
2311
|
this.children.push(e);
|
|
2312
2312
|
else {
|
|
2313
|
-
let
|
|
2314
|
-
if (n ? a !== -1 && a < o ?
|
|
2313
|
+
let m;
|
|
2314
|
+
if (n ? a !== -1 && a < o ? m = o - 1 : m = o : m = this.children.indexOf(t), m === -1) {
|
|
2315
2315
|
const v = this.resolveInsertionPointFromDom(
|
|
2316
2316
|
t,
|
|
2317
2317
|
!1
|
|
2318
2318
|
);
|
|
2319
|
-
v === null ? (
|
|
2319
|
+
v === null ? (g.warn(
|
|
2320
2320
|
"[Haori]",
|
|
2321
2321
|
"Reference child not found in children.",
|
|
2322
2322
|
t
|
|
2323
2323
|
), this.children.push(e)) : (this.children.splice(v.index, 0, e), d = v.referenceNode);
|
|
2324
2324
|
} else
|
|
2325
|
-
this.children.splice(
|
|
2325
|
+
this.children.splice(m, 0, e);
|
|
2326
2326
|
}
|
|
2327
2327
|
e.setParent(this), e.setMounted(this.mounted);
|
|
2328
2328
|
const f = this.skipMutationNodes;
|
|
2329
|
-
return this.skipMutationNodes = !0,
|
|
2329
|
+
return this.skipMutationNodes = !0, x.enqueue(() => {
|
|
2330
2330
|
this.target.insertBefore(e.getTarget(), d);
|
|
2331
2331
|
}).finally(() => {
|
|
2332
2332
|
this.skipMutationNodes = f;
|
|
@@ -2348,7 +2348,7 @@ const V = class V extends w {
|
|
|
2348
2348
|
t,
|
|
2349
2349
|
!0
|
|
2350
2350
|
);
|
|
2351
|
-
return i === null ? (
|
|
2351
|
+
return i === null ? (g.warn(
|
|
2352
2352
|
"[Haori]",
|
|
2353
2353
|
"Reference child not found in children.",
|
|
2354
2354
|
t
|
|
@@ -2460,8 +2460,8 @@ V.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
2460
2460
|
"reversed",
|
|
2461
2461
|
"selected"
|
|
2462
2462
|
]);
|
|
2463
|
-
let
|
|
2464
|
-
class
|
|
2463
|
+
let P = V;
|
|
2464
|
+
class H extends w {
|
|
2465
2465
|
/**
|
|
2466
2466
|
* テキストフラグメントのコンストラクタ。
|
|
2467
2467
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -2477,7 +2477,7 @@ class L extends w {
|
|
|
2477
2477
|
* @returns クローンされたフラグメント
|
|
2478
2478
|
*/
|
|
2479
2479
|
clone() {
|
|
2480
|
-
const e = new
|
|
2480
|
+
const e = new H(this.target.cloneNode(!0));
|
|
2481
2481
|
return e.mounted = !1, e.text = this.text, e.contents = this.contents, e.renderedText = this.renderedText, e;
|
|
2482
2482
|
}
|
|
2483
2483
|
/**
|
|
@@ -2513,7 +2513,7 @@ class L extends w {
|
|
|
2513
2513
|
evaluate() {
|
|
2514
2514
|
return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
|
|
2515
2515
|
new Error("Parent fragment is required for raw evaluation")
|
|
2516
|
-
) :
|
|
2516
|
+
) : x.enqueue(() => {
|
|
2517
2517
|
this.skipMutation = !0;
|
|
2518
2518
|
let e = this.text;
|
|
2519
2519
|
this.contents.isRawEvaluate ? e = this.contents.evaluate(
|
|
@@ -2573,7 +2573,7 @@ class ae extends w {
|
|
|
2573
2573
|
* @return 更新のPromise
|
|
2574
2574
|
*/
|
|
2575
2575
|
setContent(e) {
|
|
2576
|
-
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e,
|
|
2576
|
+
return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, x.enqueue(() => {
|
|
2577
2577
|
this.skipMutation = !0, this.target.textContent = this.text;
|
|
2578
2578
|
}).finally(() => {
|
|
2579
2579
|
this.skipMutation = !1;
|
|
@@ -2639,7 +2639,7 @@ const Z = class Z {
|
|
|
2639
2639
|
*/
|
|
2640
2640
|
checkRawExpressions() {
|
|
2641
2641
|
for (let e = 0; e < this.contents.length; e++)
|
|
2642
|
-
this.contents[e].type === 2 && this.contents.length > 1 && (
|
|
2642
|
+
this.contents[e].type === 2 && this.contents.length > 1 && (g.error(
|
|
2643
2643
|
"[Haori]",
|
|
2644
2644
|
"Raw expressions are not allowed in multi-content expressions."
|
|
2645
2645
|
), this.contents[e].type = 1);
|
|
@@ -2695,7 +2695,7 @@ const Z = class Z {
|
|
|
2695
2695
|
} else
|
|
2696
2696
|
s.push(c.text);
|
|
2697
2697
|
} catch (d) {
|
|
2698
|
-
|
|
2698
|
+
g.error(
|
|
2699
2699
|
"[Haori]",
|
|
2700
2700
|
`Error evaluating ${i} expression: ${c.text}`,
|
|
2701
2701
|
d
|
|
@@ -2758,7 +2758,7 @@ const _ = class _ extends j {
|
|
|
2758
2758
|
(i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
|
|
2759
2759
|
"attribute"
|
|
2760
2760
|
);
|
|
2761
|
-
return this.forceEvaluation && r.results.length > 1 ? (
|
|
2761
|
+
return this.forceEvaluation && r.results.length > 1 ? (g.error(
|
|
2762
2762
|
"[Haori]",
|
|
2763
2763
|
"each or if expressions must have a single content.",
|
|
2764
2764
|
r.results
|
|
@@ -2777,7 +2777,7 @@ _.FORCE_EVALUATION_ATTRIBUTES = [
|
|
|
2777
2777
|
"hor-derive"
|
|
2778
2778
|
];
|
|
2779
2779
|
let X = _;
|
|
2780
|
-
class
|
|
2780
|
+
class F {
|
|
2781
2781
|
/**
|
|
2782
2782
|
* カスタムイベントを発火します。
|
|
2783
2783
|
*
|
|
@@ -2801,7 +2801,7 @@ class R {
|
|
|
2801
2801
|
* @param version ライブラリバージョン
|
|
2802
2802
|
*/
|
|
2803
2803
|
static ready(e) {
|
|
2804
|
-
|
|
2804
|
+
F.dispatch(document, "ready", { version: e });
|
|
2805
2805
|
}
|
|
2806
2806
|
/**
|
|
2807
2807
|
* renderイベントを発火します。
|
|
@@ -2809,7 +2809,7 @@ class R {
|
|
|
2809
2809
|
* @param target 評価対象要素
|
|
2810
2810
|
*/
|
|
2811
2811
|
static render(e) {
|
|
2812
|
-
|
|
2812
|
+
F.dispatch(e, "render", { target: e });
|
|
2813
2813
|
}
|
|
2814
2814
|
/**
|
|
2815
2815
|
* importstartイベントを発火します。
|
|
@@ -2818,7 +2818,7 @@ class R {
|
|
|
2818
2818
|
* @param url インポート対象URL
|
|
2819
2819
|
*/
|
|
2820
2820
|
static importStart(e, t) {
|
|
2821
|
-
|
|
2821
|
+
F.dispatch(e, "importstart", {
|
|
2822
2822
|
url: t,
|
|
2823
2823
|
startedAt: performance.now()
|
|
2824
2824
|
});
|
|
@@ -2832,7 +2832,7 @@ class R {
|
|
|
2832
2832
|
* @param startedAt 開始時刻
|
|
2833
2833
|
*/
|
|
2834
2834
|
static importEnd(e, t, r, i) {
|
|
2835
|
-
|
|
2835
|
+
F.dispatch(e, "importend", {
|
|
2836
2836
|
url: t,
|
|
2837
2837
|
bytes: r,
|
|
2838
2838
|
durationMs: performance.now() - i
|
|
@@ -2846,7 +2846,7 @@ class R {
|
|
|
2846
2846
|
* @param error エラー内容
|
|
2847
2847
|
*/
|
|
2848
2848
|
static importError(e, t, r) {
|
|
2849
|
-
|
|
2849
|
+
F.dispatch(e, "importerror", { url: t, error: r });
|
|
2850
2850
|
}
|
|
2851
2851
|
/**
|
|
2852
2852
|
* bindchangeイベントを発火します。
|
|
@@ -2862,7 +2862,7 @@ class R {
|
|
|
2862
2862
|
const d = t?.[c], f = r[c];
|
|
2863
2863
|
d !== f && s.push(c);
|
|
2864
2864
|
}
|
|
2865
|
-
|
|
2865
|
+
F.dispatch(e, "bindchange", {
|
|
2866
2866
|
previous: t || {},
|
|
2867
2867
|
next: r,
|
|
2868
2868
|
changedKeys: s,
|
|
@@ -2878,7 +2878,7 @@ class R {
|
|
|
2878
2878
|
* @param order 現在の順序
|
|
2879
2879
|
*/
|
|
2880
2880
|
static eachUpdate(e, t, r, i) {
|
|
2881
|
-
|
|
2881
|
+
F.dispatch(e, "eachupdate", {
|
|
2882
2882
|
added: t,
|
|
2883
2883
|
removed: r,
|
|
2884
2884
|
order: i,
|
|
@@ -2894,7 +2894,7 @@ class R {
|
|
|
2894
2894
|
* @param item 行データ
|
|
2895
2895
|
*/
|
|
2896
2896
|
static rowAdd(e, t, r, i) {
|
|
2897
|
-
|
|
2897
|
+
F.dispatch(e, "rowadd", { key: t, index: r, item: i });
|
|
2898
2898
|
}
|
|
2899
2899
|
/**
|
|
2900
2900
|
* rowremoveイベントを発火します。
|
|
@@ -2904,7 +2904,7 @@ class R {
|
|
|
2904
2904
|
* @param index インデックス
|
|
2905
2905
|
*/
|
|
2906
2906
|
static rowRemove(e, t, r) {
|
|
2907
|
-
|
|
2907
|
+
F.dispatch(e, "rowremove", { key: t, index: r });
|
|
2908
2908
|
}
|
|
2909
2909
|
/**
|
|
2910
2910
|
* rowmoveイベントを発火します。
|
|
@@ -2915,7 +2915,7 @@ class R {
|
|
|
2915
2915
|
* @param to 移動後インデックス
|
|
2916
2916
|
*/
|
|
2917
2917
|
static rowMove(e, t, r, i) {
|
|
2918
|
-
|
|
2918
|
+
F.dispatch(e, "rowmove", { key: t, from: r, to: i });
|
|
2919
2919
|
}
|
|
2920
2920
|
/**
|
|
2921
2921
|
* showイベントを発火します。
|
|
@@ -2923,7 +2923,7 @@ class R {
|
|
|
2923
2923
|
* @param target data-if要素
|
|
2924
2924
|
*/
|
|
2925
2925
|
static show(e) {
|
|
2926
|
-
|
|
2926
|
+
F.dispatch(e, "show", { visible: !0 });
|
|
2927
2927
|
}
|
|
2928
2928
|
/**
|
|
2929
2929
|
* hideイベントを発火します。
|
|
@@ -2931,7 +2931,7 @@ class R {
|
|
|
2931
2931
|
* @param target data-if要素
|
|
2932
2932
|
*/
|
|
2933
2933
|
static hide(e) {
|
|
2934
|
-
|
|
2934
|
+
F.dispatch(e, "hide", { visible: !1 });
|
|
2935
2935
|
}
|
|
2936
2936
|
/**
|
|
2937
2937
|
* fetchstartイベントを発火します。
|
|
@@ -2944,7 +2944,7 @@ class R {
|
|
|
2944
2944
|
* @return 戻り値はありません。
|
|
2945
2945
|
*/
|
|
2946
2946
|
static fetchStart(e, t, r, i, s) {
|
|
2947
|
-
|
|
2947
|
+
F.dispatch(e, "fetchstart", {
|
|
2948
2948
|
url: t,
|
|
2949
2949
|
options: r || {},
|
|
2950
2950
|
payload: i,
|
|
@@ -2961,7 +2961,7 @@ class R {
|
|
|
2961
2961
|
* @param startedAt 開始時刻
|
|
2962
2962
|
*/
|
|
2963
2963
|
static fetchEnd(e, t, r, i) {
|
|
2964
|
-
|
|
2964
|
+
F.dispatch(e, "fetchend", {
|
|
2965
2965
|
url: t,
|
|
2966
2966
|
status: r,
|
|
2967
2967
|
durationMs: performance.now() - i
|
|
@@ -2977,7 +2977,7 @@ class R {
|
|
|
2977
2977
|
* @param startedAt 開始時刻(存在する場合)
|
|
2978
2978
|
*/
|
|
2979
2979
|
static fetchError(e, t, r, i, s) {
|
|
2980
|
-
|
|
2980
|
+
F.dispatch(e, "fetcherror", {
|
|
2981
2981
|
url: t,
|
|
2982
2982
|
status: i,
|
|
2983
2983
|
error: r,
|
|
@@ -3000,21 +3000,21 @@ function ie() {
|
|
|
3000
3000
|
) ? e : te;
|
|
3001
3001
|
}
|
|
3002
3002
|
const me = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
3003
|
-
function be(
|
|
3004
|
-
return me.has(
|
|
3003
|
+
function be(D) {
|
|
3004
|
+
return me.has(D.toUpperCase());
|
|
3005
3005
|
}
|
|
3006
|
-
function ve(
|
|
3006
|
+
function ve(D, e) {
|
|
3007
3007
|
for (const [t, r] of Object.entries(e))
|
|
3008
|
-
r !== void 0 && (r === null ?
|
|
3009
|
-
|
|
3010
|
-
}) : typeof r == "object" || typeof r == "function" ?
|
|
3008
|
+
r !== void 0 && (r === null ? D.append(t, "") : Array.isArray(r) ? r.forEach((i) => {
|
|
3009
|
+
D.append(t, String(i));
|
|
3010
|
+
}) : typeof r == "object" || typeof r == "function" ? D.append(t, JSON.stringify(r)) : D.append(t, String(r)));
|
|
3011
3011
|
}
|
|
3012
|
-
function ye(
|
|
3013
|
-
const t = new URL(
|
|
3012
|
+
function ye(D, e) {
|
|
3013
|
+
const t = new URL(D, window.location.href), r = new URLSearchParams(t.search);
|
|
3014
3014
|
return ve(r, e), t.search = r.toString(), t.toString();
|
|
3015
3015
|
}
|
|
3016
|
-
function Ee(
|
|
3017
|
-
return
|
|
3016
|
+
function Ee(D) {
|
|
3017
|
+
return D == null ? null : typeof D == "string" ? D : D instanceof URLSearchParams ? D.toString() : D instanceof FormData ? Array.from(D.entries()).map(([e, t]) => t instanceof File ? [
|
|
3018
3018
|
e,
|
|
3019
3019
|
{
|
|
3020
3020
|
type: "file",
|
|
@@ -3022,16 +3022,16 @@ function Ee(S) {
|
|
|
3022
3022
|
size: t.size,
|
|
3023
3023
|
mimeType: t.type
|
|
3024
3024
|
}
|
|
3025
|
-
] : [e, String(t)]) : String(
|
|
3025
|
+
] : [e, String(t)]) : String(D);
|
|
3026
3026
|
}
|
|
3027
|
-
function Ae(
|
|
3027
|
+
function Ae(D, e) {
|
|
3028
3028
|
const t = new Headers(
|
|
3029
3029
|
e.headers || void 0
|
|
3030
3030
|
), r = Array.from(t.entries()).sort(
|
|
3031
3031
|
([i], [s]) => i.localeCompare(s)
|
|
3032
3032
|
);
|
|
3033
3033
|
return JSON.stringify({
|
|
3034
|
-
url:
|
|
3034
|
+
url: D,
|
|
3035
3035
|
method: String(e.method || "GET").toUpperCase(),
|
|
3036
3036
|
headers: r,
|
|
3037
3037
|
body: Ee(e.body || null)
|
|
@@ -3187,7 +3187,7 @@ const h = class h {
|
|
|
3187
3187
|
const a = r.trim();
|
|
3188
3188
|
if (h.SINGLE_PLACEHOLDER_REGEX.test(a))
|
|
3189
3189
|
return {
|
|
3190
|
-
value:
|
|
3190
|
+
value: M.parseDataBind(s),
|
|
3191
3191
|
hasUnresolvedReference: n
|
|
3192
3192
|
};
|
|
3193
3193
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
@@ -3196,7 +3196,7 @@ const h = class h {
|
|
|
3196
3196
|
e.getBindingData()
|
|
3197
3197
|
);
|
|
3198
3198
|
return {
|
|
3199
|
-
value:
|
|
3199
|
+
value: M.parseDataBind(c.value),
|
|
3200
3200
|
hasUnresolvedReference: n || c.hasUnresolvedReference
|
|
3201
3201
|
};
|
|
3202
3202
|
}
|
|
@@ -3205,7 +3205,7 @@ const h = class h {
|
|
|
3205
3205
|
e.getBindingData()
|
|
3206
3206
|
);
|
|
3207
3207
|
return {
|
|
3208
|
-
value:
|
|
3208
|
+
value: M.parseDataBind(o.value),
|
|
3209
3209
|
hasUnresolvedReference: n || o.hasUnresolvedReference
|
|
3210
3210
|
};
|
|
3211
3211
|
}
|
|
@@ -3227,10 +3227,10 @@ const h = class h {
|
|
|
3227
3227
|
h.attrName(t, "form")
|
|
3228
3228
|
);
|
|
3229
3229
|
if (p) {
|
|
3230
|
-
const
|
|
3231
|
-
|
|
3232
|
-
w.get(
|
|
3233
|
-
) :
|
|
3230
|
+
const b = document.body.querySelector(p);
|
|
3231
|
+
b !== null ? r.formFragment = E.getFormFragment(
|
|
3232
|
+
w.get(b)
|
|
3233
|
+
) : g.error(
|
|
3234
3234
|
"Haori",
|
|
3235
3235
|
`Form element not found: ${p} (${h.attrName(t, "form")})`
|
|
3236
3236
|
);
|
|
@@ -3250,8 +3250,8 @@ const h = class h {
|
|
|
3250
3250
|
${p}
|
|
3251
3251
|
`
|
|
3252
3252
|
);
|
|
3253
|
-
} catch (
|
|
3254
|
-
|
|
3253
|
+
} catch (b) {
|
|
3254
|
+
g.error("Haori", `Invalid before script: ${b}`);
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
3257
|
}
|
|
@@ -3264,28 +3264,28 @@ ${p}
|
|
|
3264
3264
|
if (t) {
|
|
3265
3265
|
const p = h.attrName(t, "fetch-method");
|
|
3266
3266
|
if (e.hasAttribute(p)) {
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3267
|
+
const b = e.getAttributeEvaluation(p);
|
|
3268
|
+
b?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = b?.value;
|
|
3269
3269
|
}
|
|
3270
3270
|
} else {
|
|
3271
3271
|
const p = h.attrName(null, "method", !0);
|
|
3272
3272
|
if (e.hasAttribute(p)) {
|
|
3273
|
-
const
|
|
3273
|
+
const b = e.getAttributeEvaluation(
|
|
3274
3274
|
p
|
|
3275
3275
|
);
|
|
3276
|
-
|
|
3276
|
+
b?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = b?.value;
|
|
3277
3277
|
}
|
|
3278
3278
|
}
|
|
3279
3279
|
if (t) {
|
|
3280
3280
|
const p = h.attrName(t, "fetch-headers");
|
|
3281
3281
|
if (e.hasAttribute(p)) {
|
|
3282
|
-
const
|
|
3282
|
+
const b = e.getRawAttribute(
|
|
3283
3283
|
p
|
|
3284
3284
|
);
|
|
3285
3285
|
try {
|
|
3286
|
-
n.headers =
|
|
3287
|
-
} catch (
|
|
3288
|
-
|
|
3286
|
+
n.headers = M.parseDataBind(b);
|
|
3287
|
+
} catch (S) {
|
|
3288
|
+
g.error("Haori", `Invalid fetch headers: ${S}`);
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
3291
3291
|
} else {
|
|
@@ -3295,27 +3295,27 @@ ${p}
|
|
|
3295
3295
|
!0
|
|
3296
3296
|
);
|
|
3297
3297
|
if (e.hasAttribute(p)) {
|
|
3298
|
-
const
|
|
3298
|
+
const b = e.getRawAttribute(
|
|
3299
3299
|
p
|
|
3300
3300
|
);
|
|
3301
3301
|
try {
|
|
3302
|
-
n.headers =
|
|
3303
|
-
} catch (
|
|
3304
|
-
|
|
3302
|
+
n.headers = M.parseDataBind(b);
|
|
3303
|
+
} catch (S) {
|
|
3304
|
+
g.error("Haori", `Invalid fetch headers: ${S}`);
|
|
3305
3305
|
}
|
|
3306
3306
|
}
|
|
3307
3307
|
}
|
|
3308
3308
|
if (t) {
|
|
3309
3309
|
const p = h.attrName(t, "fetch-content-type");
|
|
3310
3310
|
if (e.hasAttribute(p)) {
|
|
3311
|
-
const
|
|
3312
|
-
|
|
3311
|
+
const b = e.getAttributeEvaluation(p);
|
|
3312
|
+
b?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
|
|
3313
3313
|
...n.headers,
|
|
3314
|
-
"Content-Type":
|
|
3314
|
+
"Content-Type": b?.value
|
|
3315
3315
|
};
|
|
3316
3316
|
} else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
|
|
3317
|
-
let
|
|
3318
|
-
n.headers && typeof n.headers == "object" && (
|
|
3317
|
+
let b = !1;
|
|
3318
|
+
n.headers && typeof n.headers == "object" && (b = "Content-Type" in n.headers), b || (n.headers = {
|
|
3319
3319
|
...n.headers,
|
|
3320
3320
|
"Content-Type": "application/json"
|
|
3321
3321
|
});
|
|
@@ -3330,14 +3330,14 @@ ${p}
|
|
|
3330
3330
|
!0
|
|
3331
3331
|
);
|
|
3332
3332
|
if (e.hasAttribute(p)) {
|
|
3333
|
-
const
|
|
3334
|
-
|
|
3333
|
+
const b = e.getAttributeEvaluation(p);
|
|
3334
|
+
b?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
|
|
3335
3335
|
...n.headers,
|
|
3336
|
-
"Content-Type":
|
|
3336
|
+
"Content-Type": b?.value
|
|
3337
3337
|
};
|
|
3338
3338
|
} else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
|
|
3339
|
-
let
|
|
3340
|
-
n.headers && typeof n.headers == "object" && (
|
|
3339
|
+
let b = !1;
|
|
3340
|
+
n.headers && typeof n.headers == "object" && (b = "Content-Type" in n.headers), b || (n.headers = {
|
|
3341
3341
|
...n.headers,
|
|
3342
3342
|
"Content-Type": "application/json"
|
|
3343
3343
|
});
|
|
@@ -3351,11 +3351,11 @@ ${p}
|
|
|
3351
3351
|
if (e.hasAttribute(a)) {
|
|
3352
3352
|
const p = e.getRawAttribute(a);
|
|
3353
3353
|
if (p) {
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3356
|
-
const A = w.get(
|
|
3354
|
+
const b = document.body.querySelectorAll(p);
|
|
3355
|
+
b.length > 0 ? (r.bindFragments = [], b.forEach((S) => {
|
|
3356
|
+
const A = w.get(S);
|
|
3357
3357
|
A && r.bindFragments.push(A);
|
|
3358
|
-
})) :
|
|
3358
|
+
})) : g.error(
|
|
3359
3359
|
"Haori",
|
|
3360
3360
|
`Bind element not found: ${p} (${a})`
|
|
3361
3361
|
);
|
|
@@ -3376,42 +3376,42 @@ ${p}
|
|
|
3376
3376
|
const f = t ? h.attrName(t, "bind-params") : h.attrName(null, "bind-params", !0);
|
|
3377
3377
|
if (e.hasAttribute(f)) {
|
|
3378
3378
|
const p = e.getRawAttribute(f);
|
|
3379
|
-
r.bindParams = p.split("&").map((
|
|
3379
|
+
r.bindParams = p.split("&").map((b) => b.trim());
|
|
3380
3380
|
}
|
|
3381
|
-
const
|
|
3382
|
-
if (e.hasAttribute(
|
|
3383
|
-
const p = e.getRawAttribute(
|
|
3384
|
-
r.bindAppendParams = p.split("&").map((
|
|
3381
|
+
const m = t ? h.attrName(t, "bind-append") : h.attrName(null, "bind-append", !0);
|
|
3382
|
+
if (e.hasAttribute(m)) {
|
|
3383
|
+
const p = e.getRawAttribute(m);
|
|
3384
|
+
r.bindAppendParams = p.split("&").map((b) => b.trim()).filter(Boolean);
|
|
3385
3385
|
}
|
|
3386
3386
|
const v = t ? h.attrName(t, "copy-params") : null;
|
|
3387
3387
|
if (v && e.hasAttribute(v)) {
|
|
3388
3388
|
const p = e.getRawAttribute(v);
|
|
3389
|
-
r.copyParams = p.split("&").map((
|
|
3389
|
+
r.copyParams = p.split("&").map((b) => b.trim()).filter(Boolean);
|
|
3390
3390
|
}
|
|
3391
3391
|
if (t) {
|
|
3392
3392
|
if (e.hasAttribute(h.attrName(t, "adjust"))) {
|
|
3393
|
-
const
|
|
3393
|
+
const S = e.getRawAttribute(
|
|
3394
3394
|
h.attrName(t, "adjust")
|
|
3395
3395
|
);
|
|
3396
|
-
if (
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3399
|
-
const
|
|
3400
|
-
|
|
3401
|
-
})) :
|
|
3396
|
+
if (S) {
|
|
3397
|
+
const A = document.body.querySelectorAll(S);
|
|
3398
|
+
A.length > 0 ? (r.adjustFragments = [], A.forEach((y) => {
|
|
3399
|
+
const R = w.get(y);
|
|
3400
|
+
R && r.adjustFragments.push(R);
|
|
3401
|
+
})) : g.error(
|
|
3402
3402
|
"Haori",
|
|
3403
|
-
`Adjust element not found: ${
|
|
3403
|
+
`Adjust element not found: ${S} (${h.attrName(t, "adjust")})`
|
|
3404
3404
|
);
|
|
3405
3405
|
}
|
|
3406
3406
|
if (e.hasAttribute(h.attrName(t, "adjust-value"))) {
|
|
3407
|
-
const
|
|
3407
|
+
const A = e.getRawAttribute(
|
|
3408
3408
|
h.attrName(t, "adjust-value")
|
|
3409
|
-
),
|
|
3410
|
-
isNaN(
|
|
3409
|
+
), y = Number(A);
|
|
3410
|
+
isNaN(y) || (r.adjustValue = y);
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
3413
|
if (e.hasAttribute(h.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(h.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(h.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(h.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
|
|
3414
|
-
const
|
|
3414
|
+
const S = e.getRawAttribute(
|
|
3415
3415
|
`${l.prefix}${t}-after-run`
|
|
3416
3416
|
);
|
|
3417
3417
|
try {
|
|
@@ -3419,11 +3419,11 @@ ${p}
|
|
|
3419
3419
|
"response",
|
|
3420
3420
|
`
|
|
3421
3421
|
"use strict";
|
|
3422
|
-
${
|
|
3422
|
+
${S}
|
|
3423
3423
|
`
|
|
3424
3424
|
);
|
|
3425
|
-
} catch (
|
|
3426
|
-
|
|
3425
|
+
} catch (A) {
|
|
3426
|
+
g.error("Haori", `Invalid after script: ${A}`);
|
|
3427
3427
|
}
|
|
3428
3428
|
}
|
|
3429
3429
|
if (e.hasAttribute(h.attrName(t, "dialog")) && (r.dialogMessage = e.getAttribute(h.attrName(t, "dialog")).replace(/\\n/g, `
|
|
@@ -3431,10 +3431,10 @@ ${g}
|
|
|
3431
3431
|
r.toastMessage = e.getAttribute(
|
|
3432
3432
|
h.attrName(t, "toast")
|
|
3433
3433
|
);
|
|
3434
|
-
const
|
|
3434
|
+
const S = e.getRawAttribute(
|
|
3435
3435
|
h.attrName(t, "toast-level")
|
|
3436
|
-
),
|
|
3437
|
-
r.toastLevel =
|
|
3436
|
+
), y = ["info", "warning", "error", "success"].includes(S);
|
|
3437
|
+
r.toastLevel = y ? S : null;
|
|
3438
3438
|
}
|
|
3439
3439
|
if (e.hasAttribute(h.attrName(t, "redirect")) && (r.redirectUrl = e.getAttribute(
|
|
3440
3440
|
h.attrName(t, "redirect")
|
|
@@ -3443,16 +3443,16 @@ ${g}
|
|
|
3443
3443
|
)), e.hasAttribute(h.attrName(t, "history")) && (r.historyUrl = e.getAttribute(
|
|
3444
3444
|
h.attrName(t, "history")
|
|
3445
3445
|
)), e.hasAttribute(h.attrName(t, "history-data")) && (r.historyDataAttrName = h.attrName(t, "history-data")), e.hasAttribute(h.attrName(t, "history-form"))) {
|
|
3446
|
-
const
|
|
3446
|
+
const S = e.getRawAttribute(
|
|
3447
3447
|
h.attrName(t, "history-form")
|
|
3448
3448
|
);
|
|
3449
|
-
if (
|
|
3450
|
-
const
|
|
3451
|
-
|
|
3452
|
-
w.get(
|
|
3453
|
-
) :
|
|
3449
|
+
if (S) {
|
|
3450
|
+
const A = document.body.querySelector(S);
|
|
3451
|
+
A !== null ? r.historyFormFragment = E.getFormFragment(
|
|
3452
|
+
w.get(A)
|
|
3453
|
+
) : g.error(
|
|
3454
3454
|
"Haori",
|
|
3455
|
-
`Form element not found: ${
|
|
3455
|
+
`Form element not found: ${S} (${h.attrName(t, "history-form")})`
|
|
3456
3456
|
);
|
|
3457
3457
|
} else
|
|
3458
3458
|
r.historyFormFragment = E.getFormFragment(e);
|
|
@@ -3465,49 +3465,70 @@ ${g}
|
|
|
3465
3465
|
"copy",
|
|
3466
3466
|
"open",
|
|
3467
3467
|
"close"
|
|
3468
|
-
].forEach((
|
|
3469
|
-
const
|
|
3470
|
-
if (!e.hasAttribute(
|
|
3468
|
+
].forEach((S) => {
|
|
3469
|
+
const A = h.attrName(t, S);
|
|
3470
|
+
if (!e.hasAttribute(A))
|
|
3471
3471
|
return;
|
|
3472
|
-
const
|
|
3473
|
-
if (
|
|
3474
|
-
const
|
|
3475
|
-
|
|
3476
|
-
}),
|
|
3477
|
-
switch (
|
|
3472
|
+
const y = e.getRawAttribute(A), R = [];
|
|
3473
|
+
if (y ? (document.body.querySelectorAll(y).forEach((L) => {
|
|
3474
|
+
const k = w.get(L);
|
|
3475
|
+
k && R.push(k);
|
|
3476
|
+
}), R.length === 0 && g.error("Haori", `Element not found: ${y} (${A})`)) : R.push(e), R.length > 0)
|
|
3477
|
+
switch (S) {
|
|
3478
3478
|
case "reset-before":
|
|
3479
|
-
r.resetBeforeFragments =
|
|
3479
|
+
r.resetBeforeFragments = R;
|
|
3480
3480
|
break;
|
|
3481
3481
|
case "reset":
|
|
3482
|
-
r.resetFragments =
|
|
3482
|
+
r.resetFragments = R;
|
|
3483
3483
|
break;
|
|
3484
3484
|
case "refetch":
|
|
3485
|
-
r.refetchFragments =
|
|
3485
|
+
r.refetchFragments = R;
|
|
3486
3486
|
break;
|
|
3487
3487
|
case "click":
|
|
3488
|
-
r.clickFragments =
|
|
3488
|
+
r.clickFragments = R;
|
|
3489
3489
|
break;
|
|
3490
3490
|
case "copy":
|
|
3491
|
-
r.copyFragments =
|
|
3491
|
+
r.copyFragments = R;
|
|
3492
3492
|
break;
|
|
3493
3493
|
case "open":
|
|
3494
|
-
r.openFragments =
|
|
3494
|
+
r.openFragments = R;
|
|
3495
3495
|
break;
|
|
3496
3496
|
case "close":
|
|
3497
|
-
r.closeFragments =
|
|
3497
|
+
r.closeFragments = R;
|
|
3498
3498
|
break;
|
|
3499
3499
|
}
|
|
3500
3500
|
});
|
|
3501
|
+
const b = h.attrName(t, "copy-source");
|
|
3502
|
+
if (e.hasAttribute(b)) {
|
|
3503
|
+
const S = e.getRawAttribute(
|
|
3504
|
+
b
|
|
3505
|
+
);
|
|
3506
|
+
if (S) {
|
|
3507
|
+
const A = document.body.querySelector(S);
|
|
3508
|
+
if (A !== null) {
|
|
3509
|
+
const y = w.get(A);
|
|
3510
|
+
y ? r.copySourceFragment = y : g.error(
|
|
3511
|
+
"Haori",
|
|
3512
|
+
`Element is not managed by Haori: ${S} (${b})`
|
|
3513
|
+
);
|
|
3514
|
+
} else
|
|
3515
|
+
g.error(
|
|
3516
|
+
"Haori",
|
|
3517
|
+
`Element not found: ${S} (${b})`
|
|
3518
|
+
);
|
|
3519
|
+
} else
|
|
3520
|
+
r.copySourceFragment = e;
|
|
3521
|
+
}
|
|
3501
3522
|
}
|
|
3502
3523
|
if (!t && (e.hasAttribute(h.attrName(null, "data", !0)) && (r.dataAttrName = h.attrName(null, "data", !0)), e.hasAttribute(h.attrName(null, "form", !0)))) {
|
|
3503
3524
|
const p = e.getRawAttribute(
|
|
3504
3525
|
h.attrName(null, "form", !0)
|
|
3505
3526
|
);
|
|
3506
3527
|
if (p) {
|
|
3507
|
-
const
|
|
3508
|
-
|
|
3509
|
-
w.get(
|
|
3510
|
-
) :
|
|
3528
|
+
const b = document.body.querySelector(p);
|
|
3529
|
+
b !== null ? r.formFragment = E.getFormFragment(
|
|
3530
|
+
w.get(b)
|
|
3531
|
+
) : g.error(
|
|
3511
3532
|
"Haori",
|
|
3512
3533
|
`Form element not found: ${p} (${h.attrName(null, "fetch-form", !0)})`
|
|
3513
3534
|
);
|
|
@@ -3595,48 +3616,48 @@ ${g}
|
|
|
3595
3616
|
}
|
|
3596
3617
|
const a = Object.keys(i).length > 0;
|
|
3597
3618
|
if (s) {
|
|
3598
|
-
const d = { ...n || {} }, f = r.requestedMethod,
|
|
3599
|
-
if (v &&
|
|
3619
|
+
const d = { ...n || {} }, f = r.requestedMethod, m = r.effectiveMethod, v = r.transportMode === "query-get", p = r.queryString;
|
|
3620
|
+
if (v && g.info("Haori demo fetch normalization", {
|
|
3600
3621
|
runtime: l.runtime,
|
|
3601
3622
|
requestedMethod: f,
|
|
3602
|
-
effectiveMethod:
|
|
3623
|
+
effectiveMethod: m,
|
|
3603
3624
|
transportMode: "query-get",
|
|
3604
3625
|
url: s,
|
|
3605
3626
|
payload: a ? i : void 0,
|
|
3606
3627
|
queryString: p
|
|
3607
3628
|
}), this.options.targetFragment && s) {
|
|
3608
|
-
const
|
|
3629
|
+
const b = performance.now(), S = {
|
|
3609
3630
|
runtime: l.runtime,
|
|
3610
3631
|
requestedMethod: f,
|
|
3611
|
-
effectiveMethod:
|
|
3632
|
+
effectiveMethod: m,
|
|
3612
3633
|
transportMode: v ? "query-get" : "http",
|
|
3613
3634
|
...v ? { queryString: p } : {}
|
|
3614
3635
|
};
|
|
3615
|
-
return
|
|
3636
|
+
return F.fetchStart(
|
|
3616
3637
|
this.options.targetFragment.getTarget(),
|
|
3617
3638
|
s,
|
|
3618
3639
|
d,
|
|
3619
3640
|
a ? i : void 0,
|
|
3620
|
-
|
|
3641
|
+
S
|
|
3621
3642
|
), fetch(s, d).then((A) => this.handleFetchResult(
|
|
3622
3643
|
A,
|
|
3623
3644
|
s || void 0,
|
|
3624
|
-
|
|
3645
|
+
b
|
|
3625
3646
|
)).catch((A) => {
|
|
3626
|
-
throw s &&
|
|
3647
|
+
throw s && F.fetchError(
|
|
3627
3648
|
this.options.targetFragment.getTarget(),
|
|
3628
3649
|
s,
|
|
3629
3650
|
A
|
|
3630
3651
|
), A;
|
|
3631
3652
|
});
|
|
3632
3653
|
}
|
|
3633
|
-
return fetch(s, d).then((
|
|
3654
|
+
return fetch(s, d).then((b) => this.handleFetchResult(b, s || void 0));
|
|
3634
3655
|
}
|
|
3635
3656
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
|
|
3636
|
-
const d = this.options.formFragment, f = d.getTarget(),
|
|
3637
|
-
e && e.appliedDisabledAttribute && this.options.targetFragment &&
|
|
3657
|
+
const d = this.options.formFragment, f = d.getTarget(), m = /* @__PURE__ */ new Set();
|
|
3658
|
+
e && e.appliedDisabledAttribute && this.options.targetFragment && m.add(this.options.targetFragment), f.setAttribute(`${l.prefix}bind`, JSON.stringify(i));
|
|
3638
3659
|
const v = d.getBindingData();
|
|
3639
|
-
Object.assign(v, i), await
|
|
3660
|
+
Object.assign(v, i), await M.setBindingData(f, v, m);
|
|
3640
3661
|
}
|
|
3641
3662
|
const o = a ? i : {}, c = new Response(JSON.stringify(o), {
|
|
3642
3663
|
headers: { "Content-Type": "application/json" }
|
|
@@ -3675,14 +3696,14 @@ ${g}
|
|
|
3675
3696
|
async handleFetchResult(e, t, r) {
|
|
3676
3697
|
const i = ie();
|
|
3677
3698
|
if (!e.ok)
|
|
3678
|
-
return this.options.targetFragment && t &&
|
|
3699
|
+
return this.options.targetFragment && t && F.fetchError(
|
|
3679
3700
|
this.options.targetFragment.getTarget(),
|
|
3680
3701
|
t,
|
|
3681
3702
|
new Error(`${e.status} ${e.statusText}`),
|
|
3682
3703
|
e.status,
|
|
3683
3704
|
r
|
|
3684
3705
|
), await this.handleFetchError(e), !1;
|
|
3685
|
-
if (this.options.targetFragment && t && r &&
|
|
3706
|
+
if (this.options.targetFragment && t && r && F.fetchEnd(
|
|
3686
3707
|
this.options.targetFragment.getTarget(),
|
|
3687
3708
|
t,
|
|
3688
3709
|
e.status,
|
|
@@ -3700,19 +3721,22 @@ ${g}
|
|
|
3700
3721
|
this.options.resetFragments.map((a) => E.reset(a))
|
|
3701
3722
|
), await this.copy();
|
|
3702
3723
|
const n = [];
|
|
3703
|
-
|
|
3724
|
+
if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
|
|
3704
3725
|
n.push(new h(a, null).run());
|
|
3705
|
-
}), this.options.clickFragments && this.options.clickFragments.length > 0
|
|
3706
|
-
const
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3726
|
+
}), this.options.clickFragments && this.options.clickFragments.length > 0)
|
|
3727
|
+
for (const a of this.options.clickFragments) {
|
|
3728
|
+
await M.evaluateAll(a);
|
|
3729
|
+
const o = a.getTarget();
|
|
3730
|
+
typeof o.click == "function" ? o.click() : o.dispatchEvent(
|
|
3731
|
+
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
return this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
|
|
3711
3735
|
const o = a.getTarget();
|
|
3712
|
-
o instanceof HTMLElement ? n.push(i.openDialog(o)) :
|
|
3736
|
+
o instanceof HTMLElement ? n.push(i.openDialog(o)) : g.error("Haori", "Element is not an HTML element: ", o);
|
|
3713
3737
|
}), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
|
|
3714
3738
|
const o = a.getTarget();
|
|
3715
|
-
o instanceof HTMLElement ? n.push(i.closeDialog(o)) :
|
|
3739
|
+
o instanceof HTMLElement ? n.push(i.closeDialog(o)) : g.error("Haori", "Element is not an HTML element: ", o);
|
|
3716
3740
|
}), await Promise.all(n), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
|
|
3717
3741
|
this.options.toastMessage,
|
|
3718
3742
|
this.options.toastLevel ?? "info"
|
|
@@ -3732,12 +3756,12 @@ ${g}
|
|
|
3732
3756
|
const n = e ? this.options.historyUrl : window.location.pathname, a = new URL(n, window.location.href);
|
|
3733
3757
|
if (a.origin !== window.location.origin) {
|
|
3734
3758
|
const c = "history.pushState: cross-origin URL is not allowed: " + a.toString();
|
|
3735
|
-
|
|
3759
|
+
g.error("Haori", c);
|
|
3736
3760
|
return;
|
|
3737
3761
|
}
|
|
3738
3762
|
const o = (c) => {
|
|
3739
3763
|
for (const [d, f] of Object.entries(c))
|
|
3740
|
-
f != null && (Array.isArray(f) ? f.forEach((
|
|
3764
|
+
f != null && (Array.isArray(f) ? f.forEach((m) => a.searchParams.append(d, String(m))) : typeof f == "object" ? a.searchParams.set(d, JSON.stringify(f)) : a.searchParams.set(d, String(f)));
|
|
3741
3765
|
};
|
|
3742
3766
|
i && o(t), s && o(r), history.pushState(
|
|
3743
3767
|
{ [ge]: !0 },
|
|
@@ -3745,7 +3769,7 @@ ${g}
|
|
|
3745
3769
|
a.toString()
|
|
3746
3770
|
);
|
|
3747
3771
|
} catch (n) {
|
|
3748
|
-
|
|
3772
|
+
g.error("Haori", `history.pushState failed: ${n}`);
|
|
3749
3773
|
}
|
|
3750
3774
|
}
|
|
3751
3775
|
/**
|
|
@@ -3869,11 +3893,11 @@ ${g}
|
|
|
3869
3893
|
);
|
|
3870
3894
|
} else
|
|
3871
3895
|
n[a] = r;
|
|
3872
|
-
i.push(
|
|
3896
|
+
i.push(M.setBindingData(s.getTarget(), n));
|
|
3873
3897
|
});
|
|
3874
3898
|
else {
|
|
3875
3899
|
if (typeof r == "string")
|
|
3876
|
-
return
|
|
3900
|
+
return g.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
|
|
3877
3901
|
new Error("string data cannot be bound without a bindArg.")
|
|
3878
3902
|
);
|
|
3879
3903
|
this.options.bindFragments.forEach((s) => {
|
|
@@ -3882,7 +3906,7 @@ ${g}
|
|
|
3882
3906
|
r
|
|
3883
3907
|
);
|
|
3884
3908
|
i.push(
|
|
3885
|
-
|
|
3909
|
+
M.setBindingData(s.getTarget(), n)
|
|
3886
3910
|
);
|
|
3887
3911
|
});
|
|
3888
3912
|
}
|
|
@@ -3914,7 +3938,7 @@ ${g}
|
|
|
3914
3938
|
...i.getBindingData(),
|
|
3915
3939
|
...t
|
|
3916
3940
|
};
|
|
3917
|
-
return
|
|
3941
|
+
return M.setBindingData(i.getTarget(), s);
|
|
3918
3942
|
});
|
|
3919
3943
|
return Promise.all(r).then(() => {
|
|
3920
3944
|
});
|
|
@@ -3923,7 +3947,7 @@ ${g}
|
|
|
3923
3947
|
* copy のコピー元データを取得します。
|
|
3924
3948
|
*/
|
|
3925
3949
|
resolveCopySourceData() {
|
|
3926
|
-
return this.options.formFragment ? E.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
|
|
3950
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? E.getValues(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? E.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
|
|
3927
3951
|
}
|
|
3928
3952
|
/**
|
|
3929
3953
|
* data 属性とフォーム値を統合した送信データを作成します。
|
|
@@ -3990,15 +4014,15 @@ ${g}
|
|
|
3990
4014
|
const f = n.get("Content-Type") || "";
|
|
3991
4015
|
if (/multipart\/form-data/i.test(f)) {
|
|
3992
4016
|
n.delete("Content-Type");
|
|
3993
|
-
const
|
|
4017
|
+
const m = new FormData();
|
|
3994
4018
|
for (const [v, p] of Object.entries(t))
|
|
3995
|
-
p == null ?
|
|
3996
|
-
s.body =
|
|
4019
|
+
p == null ? m.append(v, "") : p instanceof Blob ? m.append(v, p) : Array.isArray(p) ? p.forEach((b) => m.append(v, String(b))) : typeof p == "object" ? m.append(v, JSON.stringify(p)) : m.append(v, String(p));
|
|
4020
|
+
s.body = m;
|
|
3997
4021
|
} else if (/application\/x-www-form-urlencoded/i.test(f)) {
|
|
3998
|
-
const
|
|
4022
|
+
const m = new URLSearchParams();
|
|
3999
4023
|
for (const [v, p] of Object.entries(t))
|
|
4000
|
-
p !== void 0 && (p === null ?
|
|
4001
|
-
s.body =
|
|
4024
|
+
p !== void 0 && (p === null ? m.append(v, "") : Array.isArray(p) ? p.forEach((b) => m.append(v, String(b))) : typeof p == "object" ? m.append(v, JSON.stringify(p)) : m.append(v, String(p)));
|
|
4025
|
+
s.body = m;
|
|
4002
4026
|
} else
|
|
4003
4027
|
n.set("Content-Type", "application/json"), s.body = JSON.stringify(t);
|
|
4004
4028
|
}
|
|
@@ -4093,11 +4117,11 @@ ${g}
|
|
|
4093
4117
|
*/
|
|
4094
4118
|
getRowFragment() {
|
|
4095
4119
|
if (!this.options.targetFragment)
|
|
4096
|
-
return
|
|
4120
|
+
return g.error("Haori", "Target fragment is not specified for row operation."), null;
|
|
4097
4121
|
const e = this.options.targetFragment.closestByAttribute(
|
|
4098
4122
|
`${l.prefix}row`
|
|
4099
4123
|
);
|
|
4100
|
-
return e || (
|
|
4124
|
+
return e || (g.error("Haori", "Row fragment not found."), null);
|
|
4101
4125
|
}
|
|
4102
4126
|
/**
|
|
4103
4127
|
* 行を追加します。
|
|
@@ -4113,7 +4137,7 @@ ${g}
|
|
|
4113
4137
|
const t = [], r = e.clone();
|
|
4114
4138
|
return t.push(
|
|
4115
4139
|
e.getParent().insertAfter(r, e)
|
|
4116
|
-
), t.push(
|
|
4140
|
+
), t.push(M.evaluateAll(r)), t.push(E.reset(r)), Promise.all(t).then(() => {
|
|
4117
4141
|
});
|
|
4118
4142
|
}
|
|
4119
4143
|
/**
|
|
@@ -4198,23 +4222,23 @@ class De {
|
|
|
4198
4222
|
try {
|
|
4199
4223
|
r = await fetch(e, t);
|
|
4200
4224
|
} catch (s) {
|
|
4201
|
-
throw
|
|
4225
|
+
throw g.error("[Haori]", "Failed to fetch import source:", e, s), new Error(`Failed to fetch: ${e}`);
|
|
4202
4226
|
}
|
|
4203
4227
|
if (!r.ok) {
|
|
4204
4228
|
const s = `${r.status} ${r.statusText}`;
|
|
4205
|
-
throw
|
|
4229
|
+
throw g.error("[Haori]", "Import HTTP error:", e, s), new Error(`Failed to load ${e}: ${s}`);
|
|
4206
4230
|
}
|
|
4207
4231
|
let i;
|
|
4208
4232
|
try {
|
|
4209
4233
|
i = await r.text();
|
|
4210
4234
|
} catch (s) {
|
|
4211
|
-
throw
|
|
4235
|
+
throw g.error("[Haori]", "Failed to read response text:", e, s), new Error(`Failed to read response from: ${e}`);
|
|
4212
4236
|
}
|
|
4213
4237
|
try {
|
|
4214
4238
|
const n = new DOMParser().parseFromString(i, "text/html");
|
|
4215
|
-
return n && n.body ? n.body.innerHTML : (
|
|
4239
|
+
return n && n.body ? n.body.innerHTML : (g.warn("[Haori]", "No body found in imported document:", e), i);
|
|
4216
4240
|
} catch (s) {
|
|
4217
|
-
return
|
|
4241
|
+
return g.error("[Haori]", "Failed to parse imported HTML:", e, s), i;
|
|
4218
4242
|
}
|
|
4219
4243
|
}
|
|
4220
4244
|
}
|
|
@@ -4270,7 +4294,7 @@ const u = class u {
|
|
|
4270
4294
|
*/
|
|
4271
4295
|
static isAliasedAttributeReflection(e, t) {
|
|
4272
4296
|
const r = w.get(e);
|
|
4273
|
-
return r instanceof
|
|
4297
|
+
return r instanceof P ? r.hasAttribute(
|
|
4274
4298
|
`${l.prefix}${u.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
4275
4299
|
) : !1;
|
|
4276
4300
|
}
|
|
@@ -4301,7 +4325,7 @@ const u = class u {
|
|
|
4301
4325
|
static reevaluateChildren(e) {
|
|
4302
4326
|
const t = [];
|
|
4303
4327
|
return e.getChildren().forEach((r) => {
|
|
4304
|
-
r instanceof
|
|
4328
|
+
r instanceof P ? t.push(u.evaluateAll(r)) : r instanceof H && t.push(u.evaluateText(r));
|
|
4305
4329
|
}), Promise.all(t).then(() => {
|
|
4306
4330
|
});
|
|
4307
4331
|
}
|
|
@@ -4351,7 +4375,7 @@ const u = class u {
|
|
|
4351
4375
|
return Promise.resolve();
|
|
4352
4376
|
const r = [];
|
|
4353
4377
|
return e.hasAttribute(`${l.prefix}fetch`) && r.push(u.executeManagedFetch(e)), e.hasAttribute(`${l.prefix}import`) && r.push(u.executeManagedImport(e)), e.getChildren().forEach((i) => {
|
|
4354
|
-
i instanceof
|
|
4378
|
+
i instanceof P && r.push(
|
|
4355
4379
|
u.reevaluateReactiveSpecialAttributes(i, t)
|
|
4356
4380
|
);
|
|
4357
4381
|
}), Promise.all(r).then(() => {
|
|
@@ -4389,22 +4413,22 @@ const u = class u {
|
|
|
4389
4413
|
return Promise.resolve();
|
|
4390
4414
|
r.lastUrl = s, r.running = !0;
|
|
4391
4415
|
const n = performance.now();
|
|
4392
|
-
return t.setAttribute(`${l.prefix}importing`, ""),
|
|
4416
|
+
return t.setAttribute(`${l.prefix}importing`, ""), F.importStart(t, s), De.load(s).then((a) => {
|
|
4393
4417
|
const o = new TextEncoder().encode(a).length;
|
|
4394
|
-
return
|
|
4418
|
+
return x.enqueue(() => {
|
|
4395
4419
|
t.innerHTML = a;
|
|
4396
4420
|
}).then(() => {
|
|
4397
|
-
if (t.removeAttribute(`${l.prefix}importing`),
|
|
4421
|
+
if (t.removeAttribute(`${l.prefix}importing`), F.importEnd(t, s, o, n), !document.body.hasAttribute("data-haori-ready")) {
|
|
4398
4422
|
const c = [];
|
|
4399
4423
|
return t.childNodes.forEach((d) => {
|
|
4400
4424
|
const f = w.get(d);
|
|
4401
|
-
f instanceof
|
|
4425
|
+
f instanceof P ? c.push(u.scan(f.getTarget())) : f instanceof H && c.push(u.evaluateText(f));
|
|
4402
4426
|
}), Promise.all(c).then(() => {
|
|
4403
4427
|
});
|
|
4404
4428
|
}
|
|
4405
4429
|
});
|
|
4406
4430
|
}).catch((a) => {
|
|
4407
|
-
t.removeAttribute(`${l.prefix}importing`),
|
|
4431
|
+
t.removeAttribute(`${l.prefix}importing`), F.importError(t, s, a), g.error("[Haori]", "Failed to import HTML:", s, a);
|
|
4408
4432
|
}).finally(() => {
|
|
4409
4433
|
if (r.running = !1, r.rerunRequested)
|
|
4410
4434
|
return r.rerunRequested = !1, u.executeManagedImport(e);
|
|
@@ -4447,7 +4471,7 @@ const u = class u {
|
|
|
4447
4471
|
}
|
|
4448
4472
|
const r = [];
|
|
4449
4473
|
return e.getChildren().forEach((i) => {
|
|
4450
|
-
i instanceof
|
|
4474
|
+
i instanceof P ? r.push(u.initializeElementFragment(i, t)) : i instanceof H && r.push(u.evaluateText(i));
|
|
4451
4475
|
}), Promise.all(r).then(() => {
|
|
4452
4476
|
u.refreshDerivedSubtreeSignature(e);
|
|
4453
4477
|
});
|
|
@@ -4587,8 +4611,8 @@ const u = class u {
|
|
|
4587
4611
|
if (d === null)
|
|
4588
4612
|
a.push(u.setBindingData(e, f));
|
|
4589
4613
|
else {
|
|
4590
|
-
const
|
|
4591
|
-
|
|
4614
|
+
const m = s.getRawBindingData() || {};
|
|
4615
|
+
m[String(d)] = f, a.push(u.setBindingData(e, m));
|
|
4592
4616
|
}
|
|
4593
4617
|
break;
|
|
4594
4618
|
}
|
|
@@ -4623,7 +4647,7 @@ const u = class u {
|
|
|
4623
4647
|
}
|
|
4624
4648
|
return n = n.then(() => u.evaluateAll(i, r)), n = n.then(
|
|
4625
4649
|
() => u.reevaluateReactiveSpecialAttributes(i, r)
|
|
4626
|
-
),
|
|
4650
|
+
), F.bindChange(e, s, t, "manual"), n.then(() => {
|
|
4627
4651
|
});
|
|
4628
4652
|
}
|
|
4629
4653
|
/**
|
|
@@ -4637,7 +4661,7 @@ const u = class u {
|
|
|
4637
4661
|
try {
|
|
4638
4662
|
return JSON.parse(e);
|
|
4639
4663
|
} catch (t) {
|
|
4640
|
-
return
|
|
4664
|
+
return g.error("[Haori]", "Invalid JSON in data-bind:", t), {};
|
|
4641
4665
|
}
|
|
4642
4666
|
else {
|
|
4643
4667
|
const t = new URLSearchParams(e), r = {};
|
|
@@ -4657,7 +4681,7 @@ const u = class u {
|
|
|
4657
4681
|
if (r.isSkipMutationNodes())
|
|
4658
4682
|
return;
|
|
4659
4683
|
const i = w.get(t.nextSibling), s = w.get(t);
|
|
4660
|
-
s && (r.insertBefore(s, i), s instanceof
|
|
4684
|
+
s && (r.insertBefore(s, i), s instanceof P ? u.scan(s.getTarget()) : s instanceof H && u.evaluateText(s));
|
|
4661
4685
|
}
|
|
4662
4686
|
/**
|
|
4663
4687
|
* ノードを親要素から削除します。
|
|
@@ -4731,22 +4755,22 @@ const u = class u {
|
|
|
4731
4755
|
const i = e.hasAttribute(`${l.prefix}derive`), s = e.hasAttribute(`${l.prefix}if`), n = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
|
|
4732
4756
|
let c = !1, d = !1, f = null;
|
|
4733
4757
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
4734
|
-
const
|
|
4758
|
+
const m = u.createDeriveInputSignature(
|
|
4735
4759
|
e,
|
|
4736
4760
|
a,
|
|
4737
4761
|
o
|
|
4738
4762
|
);
|
|
4739
|
-
|
|
4763
|
+
m === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
|
|
4740
4764
|
() => u.evaluateDerive(e, a, o).then(
|
|
4741
4765
|
() => {
|
|
4742
4766
|
}
|
|
4743
4767
|
)
|
|
4744
|
-
)) : e.getDeriveInputSignature() !==
|
|
4768
|
+
)) : e.getDeriveInputSignature() !== m && (r = r.then(() => u.evaluateDerive(
|
|
4745
4769
|
e,
|
|
4746
4770
|
a,
|
|
4747
4771
|
o
|
|
4748
4772
|
).then(() => {
|
|
4749
|
-
e.setDeriveInputSignature(
|
|
4773
|
+
e.setDeriveInputSignature(m);
|
|
4750
4774
|
})));
|
|
4751
4775
|
}
|
|
4752
4776
|
return s && (r = r.then(() => u.evaluateIf(e))), n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => u.evaluateEach(e))) : s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
|
|
@@ -4765,14 +4789,14 @@ const u = class u {
|
|
|
4765
4789
|
})), r.then(() => {
|
|
4766
4790
|
if (c)
|
|
4767
4791
|
return;
|
|
4768
|
-
const
|
|
4792
|
+
const m = [];
|
|
4769
4793
|
return e.getChildren().forEach((v) => {
|
|
4770
|
-
if (v instanceof
|
|
4794
|
+
if (v instanceof P) {
|
|
4771
4795
|
if (u.canSkipUnchangedNestedEach(v))
|
|
4772
4796
|
return;
|
|
4773
|
-
|
|
4774
|
-
} else v instanceof
|
|
4775
|
-
}), Promise.all(
|
|
4797
|
+
m.push(u.evaluateAll(v, t));
|
|
4798
|
+
} else v instanceof H && m.push(u.evaluateText(v));
|
|
4799
|
+
}), Promise.all(m).then(() => {
|
|
4776
4800
|
});
|
|
4777
4801
|
}).then(() => {
|
|
4778
4802
|
d && f !== null && e.setDeriveSubtreeSignature(f);
|
|
@@ -4826,18 +4850,18 @@ const u = class u {
|
|
|
4826
4850
|
if (r === !1 || r === void 0 || r === null || Number.isNaN(r))
|
|
4827
4851
|
t.push(
|
|
4828
4852
|
e.hide().then(() => {
|
|
4829
|
-
|
|
4853
|
+
F.hide(e.getTarget());
|
|
4830
4854
|
})
|
|
4831
4855
|
);
|
|
4832
4856
|
else {
|
|
4833
4857
|
const i = [];
|
|
4834
4858
|
e.getChildren().forEach((s) => {
|
|
4835
|
-
s instanceof
|
|
4859
|
+
s instanceof P ? i.push(
|
|
4836
4860
|
s.isMounted() ? u.evaluateAll(s) : u.scan(s.getTarget())
|
|
4837
|
-
) : s instanceof
|
|
4861
|
+
) : s instanceof H && i.push(u.evaluateText(s));
|
|
4838
4862
|
}), t.push(
|
|
4839
4863
|
e.show().then(() => {
|
|
4840
|
-
|
|
4864
|
+
F.show(e.getTarget());
|
|
4841
4865
|
})
|
|
4842
4866
|
), t.push(Promise.all(i).then(() => {
|
|
4843
4867
|
}));
|
|
@@ -4865,7 +4889,7 @@ const u = class u {
|
|
|
4865
4889
|
if (r === null) {
|
|
4866
4890
|
let n = !1;
|
|
4867
4891
|
return e.getChildren().forEach((a) => {
|
|
4868
|
-
if (!n && a instanceof
|
|
4892
|
+
if (!n && a instanceof P) {
|
|
4869
4893
|
if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
|
|
4870
4894
|
return;
|
|
4871
4895
|
r = a.clone(), u.markFreshInitializationSkippable(r), e.setTemplate(r), n = !0, e.removeChild(a);
|
|
@@ -4888,7 +4912,7 @@ const u = class u {
|
|
|
4888
4912
|
*/
|
|
4889
4913
|
static resolveEachItems(e) {
|
|
4890
4914
|
const t = e.getAttributeEvaluation(`${l.prefix}each`), r = t?.value;
|
|
4891
|
-
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (
|
|
4915
|
+
return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (g.error("[Haori]", "Invalid each attribute:", r), null);
|
|
4892
4916
|
}
|
|
4893
4917
|
/**
|
|
4894
4918
|
* nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
|
|
@@ -4929,7 +4953,7 @@ const u = class u {
|
|
|
4929
4953
|
* @returns 含むなら true
|
|
4930
4954
|
*/
|
|
4931
4955
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
4932
|
-
return e.getChildren().some((t) => t instanceof
|
|
4956
|
+
return e.getChildren().some((t) => t instanceof P ? t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}derive-name`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !0 : u.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
4933
4957
|
}
|
|
4934
4958
|
/**
|
|
4935
4959
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -4977,7 +5001,7 @@ const u = class u {
|
|
|
4977
5001
|
* @returns プロファイル
|
|
4978
5002
|
*/
|
|
4979
5003
|
static getOrCreateDerivedSubtreeProfile(e) {
|
|
4980
|
-
if (!
|
|
5004
|
+
if (!U.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
|
|
4981
5005
|
return null;
|
|
4982
5006
|
const t = u.DERIVE_SUBTREE_PROFILES.get(e);
|
|
4983
5007
|
if (t)
|
|
@@ -5015,7 +5039,7 @@ const u = class u {
|
|
|
5015
5039
|
typeof n == "string" && n.trim() !== "" && (s += `[${l.prefix}derive-name="${n.trim()}"]`);
|
|
5016
5040
|
const a = r.getParent();
|
|
5017
5041
|
if (a) {
|
|
5018
|
-
const o = a.getChildren().filter((c) => c instanceof
|
|
5042
|
+
const o = a.getChildren().filter((c) => c instanceof P).findIndex((c) => c === r);
|
|
5019
5043
|
s += `:nth-child(${o + 1})`;
|
|
5020
5044
|
}
|
|
5021
5045
|
t.unshift(s), r = a;
|
|
@@ -5046,7 +5070,7 @@ const u = class u {
|
|
|
5046
5070
|
*/
|
|
5047
5071
|
static logDerivedSubtreeProfileSnapshot(e, t) {
|
|
5048
5072
|
const r = u.getOrCreateDerivedSubtreeProfile(e);
|
|
5049
|
-
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1),
|
|
5073
|
+
r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), g.info("[Haori][derive-profile]", {
|
|
5050
5074
|
reason: t,
|
|
5051
5075
|
hostId: r.hostId,
|
|
5052
5076
|
signatureComputeTotal: r.signatureComputeTotal,
|
|
@@ -5078,7 +5102,7 @@ const u = class u {
|
|
|
5078
5102
|
const s = e.getRawAttribute(i);
|
|
5079
5103
|
return typeof s == "string" && s.includes("{{");
|
|
5080
5104
|
}) ? !0 : e.getChildren().some(
|
|
5081
|
-
(i) => i instanceof
|
|
5105
|
+
(i) => i instanceof H && i.hasDynamicContent()
|
|
5082
5106
|
);
|
|
5083
5107
|
}
|
|
5084
5108
|
/**
|
|
@@ -5088,7 +5112,7 @@ const u = class u {
|
|
|
5088
5112
|
* @returns subtree 全体を省略可能なら true
|
|
5089
5113
|
*/
|
|
5090
5114
|
static markFreshInitializationSkippable(e) {
|
|
5091
|
-
const t = e.getAttributeNames().some((s) => u.isFreshInitializationDynamicAttribute(e, s)), r = e.getChildren().some((s) => s instanceof
|
|
5115
|
+
const t = e.getAttributeNames().some((s) => u.isFreshInitializationDynamicAttribute(e, s)), r = e.getChildren().some((s) => s instanceof P ? !u.markFreshInitializationSkippable(s) : s instanceof H ? s.hasDynamicContent() : !1), i = !t && !r;
|
|
5092
5116
|
return e.setFreshInitializationSkippable(i), i;
|
|
5093
5117
|
}
|
|
5094
5118
|
/**
|
|
@@ -5113,83 +5137,83 @@ const u = class u {
|
|
|
5113
5137
|
static updateDiff(e, t) {
|
|
5114
5138
|
const r = e.getTemplate();
|
|
5115
5139
|
if (r === null)
|
|
5116
|
-
return
|
|
5140
|
+
return g.error("[Haori]", "Template is not set for each element."), Promise.resolve();
|
|
5117
5141
|
let i = e.getAttribute(`${l.prefix}each-index`);
|
|
5118
5142
|
i && (i = String(i));
|
|
5119
5143
|
const s = e.getAttribute(`${l.prefix}each-key`), n = e.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
5120
|
-
t.forEach((y,
|
|
5121
|
-
const
|
|
5144
|
+
t.forEach((y, R) => {
|
|
5145
|
+
const B = u.createListKey(
|
|
5122
5146
|
y,
|
|
5123
5147
|
s ? String(s) : null,
|
|
5124
|
-
|
|
5148
|
+
R
|
|
5125
5149
|
);
|
|
5126
|
-
o.push(
|
|
5150
|
+
o.push(B), a.set(B, { item: y, itemIndex: R });
|
|
5127
5151
|
});
|
|
5128
5152
|
const c = new Set(o), d = [];
|
|
5129
|
-
let f = e.getChildren().filter((y) => y instanceof
|
|
5153
|
+
let f = e.getChildren().filter((y) => y instanceof P).filter(
|
|
5130
5154
|
(y) => !y.hasAttribute(`${l.prefix}each-before`) && !y.hasAttribute(`${l.prefix}each-after`)
|
|
5131
5155
|
);
|
|
5132
|
-
const
|
|
5156
|
+
const m = f.map((y) => y.getListKey());
|
|
5133
5157
|
f = f.filter((y) => c.has(String(y.getListKey())) ? !0 : (d.push(y.remove()), !1));
|
|
5134
5158
|
const v = f.map((y) => y.getListKey()), p = /* @__PURE__ */ new Map();
|
|
5135
5159
|
f.forEach((y) => {
|
|
5136
|
-
const
|
|
5137
|
-
|
|
5160
|
+
const R = y.getListKey();
|
|
5161
|
+
R !== null && !p.has(R) && p.set(R, y);
|
|
5138
5162
|
});
|
|
5139
|
-
const
|
|
5163
|
+
const b = e.getChildElementFragments().slice(), S = b.filter(
|
|
5140
5164
|
(y) => y.hasAttribute(`${l.prefix}each-before`)
|
|
5141
5165
|
).length;
|
|
5142
5166
|
let A = Promise.resolve();
|
|
5143
|
-
return o.forEach((y,
|
|
5144
|
-
const { item:
|
|
5145
|
-
let
|
|
5167
|
+
return o.forEach((y, R) => {
|
|
5168
|
+
const { item: B, itemIndex: L } = a.get(y);
|
|
5169
|
+
let k;
|
|
5146
5170
|
const Y = p.get(y);
|
|
5147
5171
|
if (Y)
|
|
5148
|
-
|
|
5172
|
+
k = Y, A = A.then(
|
|
5149
5173
|
() => u.updateRowFragment(
|
|
5150
|
-
U,
|
|
5151
5174
|
k,
|
|
5152
|
-
i,
|
|
5153
5175
|
B,
|
|
5176
|
+
i,
|
|
5177
|
+
L,
|
|
5154
5178
|
n ? String(n) : null,
|
|
5155
5179
|
y
|
|
5156
5180
|
).then((I) => {
|
|
5157
5181
|
if (I)
|
|
5158
|
-
return u.evaluateAll(
|
|
5182
|
+
return u.evaluateAll(k);
|
|
5159
5183
|
})
|
|
5160
5184
|
);
|
|
5161
5185
|
else {
|
|
5162
|
-
|
|
5163
|
-
const I =
|
|
5186
|
+
k = r.clone();
|
|
5187
|
+
const I = S + R;
|
|
5164
5188
|
A = A.then(
|
|
5165
5189
|
() => u.updateRowFragment(
|
|
5166
|
-
U,
|
|
5167
5190
|
k,
|
|
5168
|
-
i,
|
|
5169
5191
|
B,
|
|
5192
|
+
i,
|
|
5193
|
+
L,
|
|
5170
5194
|
n ? String(n) : null,
|
|
5171
5195
|
y
|
|
5172
5196
|
).then(() => {
|
|
5173
|
-
const ce =
|
|
5174
|
-
return e.insertBefore(
|
|
5175
|
-
|
|
5176
|
-
}).then(() => u.initializeFreshEachRow(
|
|
5197
|
+
const ce = b[I] ?? null;
|
|
5198
|
+
return e.insertBefore(k, ce).then(() => {
|
|
5199
|
+
b.splice(I, 0, k);
|
|
5200
|
+
}).then(() => u.initializeFreshEachRow(k));
|
|
5177
5201
|
})
|
|
5178
5202
|
);
|
|
5179
5203
|
}
|
|
5180
5204
|
}), Promise.all(d).then(() => A).then(() => {
|
|
5181
5205
|
const y = o.filter(
|
|
5182
5206
|
(I) => I !== null
|
|
5183
|
-
),
|
|
5207
|
+
), R = v.filter(
|
|
5184
5208
|
(I) => I !== null
|
|
5185
|
-
),
|
|
5209
|
+
), B = new Set(R), L = y.filter((I) => !B.has(I)), Y = m.filter(
|
|
5186
5210
|
(I) => I !== null
|
|
5187
5211
|
).filter(
|
|
5188
5212
|
(I) => !c.has(I)
|
|
5189
5213
|
);
|
|
5190
|
-
|
|
5214
|
+
F.eachUpdate(
|
|
5191
5215
|
e.getTarget(),
|
|
5192
|
-
|
|
5216
|
+
L,
|
|
5193
5217
|
Y,
|
|
5194
5218
|
y
|
|
5195
5219
|
);
|
|
@@ -5237,7 +5261,7 @@ const u = class u {
|
|
|
5237
5261
|
[s]: t
|
|
5238
5262
|
}, r && (a[r] = i);
|
|
5239
5263
|
else
|
|
5240
|
-
return
|
|
5264
|
+
return g.error(
|
|
5241
5265
|
"[Haori]",
|
|
5242
5266
|
`Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
|
|
5243
5267
|
), Promise.resolve(!1);
|
|
@@ -5348,7 +5372,7 @@ u.ATTRIBUTE_ALIAS_SUFFIX = "attr-", u.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
5348
5372
|
"import",
|
|
5349
5373
|
"url-param"
|
|
5350
5374
|
], u.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, u.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), u.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), u.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap();
|
|
5351
|
-
let
|
|
5375
|
+
let M = u;
|
|
5352
5376
|
const ee = class ee {
|
|
5353
5377
|
/**
|
|
5354
5378
|
* コンストラクタ。
|
|
@@ -5388,8 +5412,8 @@ const ee = class ee {
|
|
|
5388
5412
|
if (!r)
|
|
5389
5413
|
return;
|
|
5390
5414
|
const i = w.get(r);
|
|
5391
|
-
i && (t === "change" && i instanceof
|
|
5392
|
-
|
|
5415
|
+
i && (t === "change" && i instanceof P && i.syncValue(), new z(i, t).run().catch((s) => {
|
|
5416
|
+
g.error("[Haori]", "Procedure execution error:", s);
|
|
5393
5417
|
}));
|
|
5394
5418
|
}
|
|
5395
5419
|
/**
|
|
@@ -5467,17 +5491,17 @@ const T = class T {
|
|
|
5467
5491
|
(c) => {
|
|
5468
5492
|
const d = T.registrations.get(e);
|
|
5469
5493
|
d && c.forEach((f) => {
|
|
5470
|
-
!f.isIntersecting || d.running || T.isDisabled(d.fragment) || (d.running = !0, new z(d.fragment, "intersect").runWithResult().then((
|
|
5471
|
-
|
|
5472
|
-
}).catch((
|
|
5473
|
-
|
|
5494
|
+
!f.isIntersecting || d.running || T.isDisabled(d.fragment) || (d.running = !0, new z(d.fragment, "intersect").runWithResult().then((m) => {
|
|
5495
|
+
m && d.once && (d.observer.disconnect(), T.registrations.delete(e));
|
|
5496
|
+
}).catch((m) => {
|
|
5497
|
+
g.error(
|
|
5474
5498
|
"[Haori]",
|
|
5475
5499
|
"Intersect procedure execution error:",
|
|
5476
|
-
|
|
5500
|
+
m
|
|
5477
5501
|
);
|
|
5478
5502
|
}).finally(() => {
|
|
5479
|
-
const
|
|
5480
|
-
|
|
5503
|
+
const m = T.registrations.get(e);
|
|
5504
|
+
m && (m.running = !1);
|
|
5481
5505
|
}));
|
|
5482
5506
|
});
|
|
5483
5507
|
},
|
|
@@ -5525,7 +5549,7 @@ const T = class T {
|
|
|
5525
5549
|
if (typeof r != "string" || r.trim() === "")
|
|
5526
5550
|
return null;
|
|
5527
5551
|
const i = document.querySelector(r);
|
|
5528
|
-
return T.isHtmlElement(i) ? i : (
|
|
5552
|
+
return T.isHtmlElement(i) ? i : (g.error("[Haori]", `Intersect root element not found: ${r}`), null);
|
|
5529
5553
|
}
|
|
5530
5554
|
static resolveRootMargin(e) {
|
|
5531
5555
|
const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
|
|
@@ -5574,10 +5598,10 @@ const O = class O {
|
|
|
5574
5598
|
return;
|
|
5575
5599
|
O._initialized = !0, O.disconnectMutationObservers();
|
|
5576
5600
|
const e = await Promise.allSettled([
|
|
5577
|
-
|
|
5578
|
-
|
|
5601
|
+
M.scan(document.head),
|
|
5602
|
+
M.scan(document.body)
|
|
5579
5603
|
]), [t, r] = e;
|
|
5580
|
-
t.status !== "fulfilled" &&
|
|
5604
|
+
t.status !== "fulfilled" && g.error("[Haori]", "Failed to build head fragment:", t.reason), r.status !== "fulfilled" && g.error("[Haori]", "Failed to build body fragment:", r.reason), await x.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ne().start(), G.syncTree(document.body);
|
|
5581
5605
|
}
|
|
5582
5606
|
/**
|
|
5583
5607
|
* 指定された要素を監視します。
|
|
@@ -5591,12 +5615,12 @@ const O = class O {
|
|
|
5591
5615
|
switch (i.type) {
|
|
5592
5616
|
case "attributes": {
|
|
5593
5617
|
const s = i.target;
|
|
5594
|
-
if (i.attributeName && s.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName &&
|
|
5618
|
+
if (i.attributeName && s.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName && M.isAliasedAttributeReflection(
|
|
5595
5619
|
s,
|
|
5596
5620
|
i.attributeName
|
|
5597
5621
|
))
|
|
5598
5622
|
break;
|
|
5599
|
-
|
|
5623
|
+
M.setAttribute(
|
|
5600
5624
|
s,
|
|
5601
5625
|
i.attributeName,
|
|
5602
5626
|
s.getAttribute(i.attributeName),
|
|
@@ -5606,14 +5630,14 @@ const O = class O {
|
|
|
5606
5630
|
}
|
|
5607
5631
|
case "childList": {
|
|
5608
5632
|
Array.from(i.removedNodes).forEach((s) => {
|
|
5609
|
-
G.cleanupTree(s),
|
|
5633
|
+
G.cleanupTree(s), M.removeNode(s);
|
|
5610
5634
|
}), Array.from(i.addedNodes).forEach((s) => {
|
|
5611
|
-
s.parentElement instanceof Element && (
|
|
5635
|
+
s.parentElement instanceof Element && (M.addNode(s.parentElement, s), G.syncTree(s));
|
|
5612
5636
|
});
|
|
5613
5637
|
break;
|
|
5614
5638
|
}
|
|
5615
5639
|
case "characterData": {
|
|
5616
|
-
i.target instanceof Text || i.target instanceof Comment ?
|
|
5640
|
+
i.target instanceof Text || i.target instanceof Comment ? M.changeText(i.target, i.target.textContent) : g.warn(
|
|
5617
5641
|
"[Haori]",
|
|
5618
5642
|
"Unsupported character data type:",
|
|
5619
5643
|
i.target
|
|
@@ -5621,11 +5645,11 @@ const O = class O {
|
|
|
5621
5645
|
break;
|
|
5622
5646
|
}
|
|
5623
5647
|
default:
|
|
5624
|
-
|
|
5648
|
+
g.warn("[Haori]", "Unknown mutation type:", i.type);
|
|
5625
5649
|
continue;
|
|
5626
5650
|
}
|
|
5627
5651
|
} catch (s) {
|
|
5628
|
-
|
|
5652
|
+
g.error("[Haori]", "Error processing mutation:", s);
|
|
5629
5653
|
}
|
|
5630
5654
|
});
|
|
5631
5655
|
t.observe(e, {
|
|
@@ -5641,13 +5665,13 @@ let Q = O;
|
|
|
5641
5665
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Q.init) : Q.init();
|
|
5642
5666
|
const Te = "0.4.13";
|
|
5643
5667
|
export {
|
|
5644
|
-
|
|
5668
|
+
M as Core,
|
|
5645
5669
|
l as Env,
|
|
5646
5670
|
E as Form,
|
|
5647
5671
|
w as Fragment,
|
|
5648
5672
|
te as Haori,
|
|
5649
|
-
|
|
5650
|
-
|
|
5673
|
+
g as Log,
|
|
5674
|
+
x as Queue,
|
|
5651
5675
|
te as default,
|
|
5652
5676
|
Te as version
|
|
5653
5677
|
};
|