haori 0.22.0 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/haori.cjs.js +10 -9
- package/dist/haori.es.js +162 -145
- package/dist/haori.iife.js +10 -9
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -533,8 +533,8 @@ const We = Object.freeze({
|
|
|
533
533
|
return { value: null, unresolvedReference: !1 };
|
|
534
534
|
try {
|
|
535
535
|
const u = [], p = this.wrapBoundValues(a);
|
|
536
|
-
return h.bindKeys.forEach((
|
|
537
|
-
u.push(p[
|
|
536
|
+
return h.bindKeys.forEach((v) => {
|
|
537
|
+
u.push(p[v]);
|
|
538
538
|
}), {
|
|
539
539
|
value: this.withBlockedPropertyAccess(
|
|
540
540
|
() => h.evaluator(...u)
|
|
@@ -543,9 +543,9 @@ const We = Object.freeze({
|
|
|
543
543
|
};
|
|
544
544
|
} catch (u) {
|
|
545
545
|
if (o && u instanceof ReferenceError) {
|
|
546
|
-
const
|
|
547
|
-
if (
|
|
548
|
-
a[
|
|
546
|
+
const v = this.extractMissingIdentifier(u);
|
|
547
|
+
if (v !== null && this.canRecoverMissingIdentifier(v, a)) {
|
|
548
|
+
a[v] = void 0;
|
|
549
549
|
continue;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
@@ -1679,8 +1679,8 @@ const X = class X {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
};
|
|
1681
1681
|
X.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
1682
|
-
let
|
|
1683
|
-
const K = class K extends
|
|
1682
|
+
let T = X;
|
|
1683
|
+
const K = class K extends T {
|
|
1684
1684
|
/**
|
|
1685
1685
|
* エレメントフラグメントのコンストラクタ。
|
|
1686
1686
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -1710,7 +1710,7 @@ const K = class K extends R {
|
|
|
1710
1710
|
this.attributeMap.set(t, i);
|
|
1711
1711
|
}
|
|
1712
1712
|
}), e.childNodes.forEach((t) => {
|
|
1713
|
-
const r =
|
|
1713
|
+
const r = T.get(t);
|
|
1714
1714
|
r.setParent(this), this.children.push(r);
|
|
1715
1715
|
});
|
|
1716
1716
|
}
|
|
@@ -2242,9 +2242,9 @@ const K = class K extends R {
|
|
|
2242
2242
|
element: a,
|
|
2243
2243
|
rawName: e,
|
|
2244
2244
|
template: r
|
|
2245
|
-
}), l = s.isEvaluate || s.isRawEvaluate, h = e === t && K.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), u = s.isSingleExpression(), p = G.joinEvaluateResults(o.results),
|
|
2246
|
-
return !k && !C && !O && !ve && !ye ? (A && !
|
|
2247
|
-
k && a.setAttribute(e, r), S === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, S), t === `${c.prefix}bind` && this.recordSelfWrittenBind(S)), A && !
|
|
2245
|
+
}), l = s.isEvaluate || s.isRawEvaluate, h = e === t && K.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), u = s.isSingleExpression(), p = G.joinEvaluateResults(o.results), v = o.results.length === 1 ? o.results[0] : p, R = !s.isForceEvaluation() && (t !== e || h || u ? o.hasUnresolvedReference || v === null || v === void 0 || v === !1 : l && p === ""), I = s.isForceEvaluation() ? r : u ? v : p, A = i && s.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), y = a.getRootNode(), b = A && a === y.activeElement, S = R || I === null || I === !1 ? null : String(I), k = e !== t && a.getAttribute(e) !== r, C = S === null ? a.hasAttribute(t) : a.getAttribute(t) !== S, O = A && !b && S !== null && a.value !== S, j = t === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), $ = t === "selected" && a instanceof HTMLOptionElement, _ = y.activeElement, be = _ !== null && (j && a === _ || $ && a.closest("select") === _), te = S !== null, ve = j && !be && a.checked !== te, ye = $ && !be && a.selected !== te;
|
|
2246
|
+
return !k && !C && !O && !ve && !ye ? (A && !b && S !== null && (this.value = this.normalizeValueForElement(a, S)), Promise.resolve()) : (this.skipMutationAttributes = !0, P.enqueue(() => {
|
|
2247
|
+
k && a.setAttribute(e, r), S === null ? a.removeAttribute(t) : (C && (a.setAttribute(t, S), t === `${c.prefix}bind` && this.recordSelfWrittenBind(S)), A && !b && (this.value = this.normalizeValueForElement(a, S), O && (a.value = S))), ve && (a.checked = te), ye && (a.selected = te);
|
|
2248
2248
|
}).finally(() => {
|
|
2249
2249
|
this.skipMutationAttributes = !1;
|
|
2250
2250
|
}));
|
|
@@ -2341,7 +2341,7 @@ const K = class K extends R {
|
|
|
2341
2341
|
const i = t ? r.nextSibling : r;
|
|
2342
2342
|
let n = t ? r.nextSibling : r;
|
|
2343
2343
|
for (; n !== null; ) {
|
|
2344
|
-
const s =
|
|
2344
|
+
const s = T.get(n);
|
|
2345
2345
|
if (s !== null) {
|
|
2346
2346
|
const a = this.children.indexOf(s);
|
|
2347
2347
|
if (a !== -1)
|
|
@@ -2381,15 +2381,15 @@ const K = class K extends R {
|
|
|
2381
2381
|
else {
|
|
2382
2382
|
let p;
|
|
2383
2383
|
if (s ? a !== -1 && a < o ? p = o - 1 : p = o : p = this.children.indexOf(t), p === -1) {
|
|
2384
|
-
const
|
|
2384
|
+
const v = this.resolveInsertionPointFromDom(
|
|
2385
2385
|
t,
|
|
2386
2386
|
!1
|
|
2387
2387
|
);
|
|
2388
|
-
|
|
2388
|
+
v === null ? (m.warn(
|
|
2389
2389
|
"[Haori]",
|
|
2390
2390
|
"Reference child not found in children.",
|
|
2391
2391
|
t
|
|
2392
|
-
), this.children.push(e)) : (this.children.splice(
|
|
2392
|
+
), this.children.push(e)) : (this.children.splice(v.index, 0, e), h = v.referenceNode);
|
|
2393
2393
|
} else
|
|
2394
2394
|
this.children.splice(p, 0, e);
|
|
2395
2395
|
}
|
|
@@ -2530,7 +2530,7 @@ K.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
2530
2530
|
"selected"
|
|
2531
2531
|
]);
|
|
2532
2532
|
let M = K;
|
|
2533
|
-
class V extends
|
|
2533
|
+
class V extends T {
|
|
2534
2534
|
/**
|
|
2535
2535
|
* テキストフラグメントのコンストラクタ。
|
|
2536
2536
|
* 対象テキストノードの内容を初期化します。
|
|
@@ -2608,7 +2608,7 @@ class V extends R {
|
|
|
2608
2608
|
});
|
|
2609
2609
|
}
|
|
2610
2610
|
}
|
|
2611
|
-
class pe extends
|
|
2611
|
+
class pe extends T {
|
|
2612
2612
|
/**
|
|
2613
2613
|
* コメントフラグメントのコンストラクタ。
|
|
2614
2614
|
* 対象コメントノードの内容を初期化します。
|
|
@@ -3263,17 +3263,17 @@ class E {
|
|
|
3263
3263
|
const u = t[String(l)];
|
|
3264
3264
|
if (Array.isArray(u)) {
|
|
3265
3265
|
const p = e.getChildElementFragments();
|
|
3266
|
-
for (let
|
|
3267
|
-
const
|
|
3268
|
-
u.length >
|
|
3266
|
+
for (let v = 0; v < p.length; v++) {
|
|
3267
|
+
const R = p[v];
|
|
3268
|
+
u.length > v ? s.push(
|
|
3269
3269
|
E.setPartValues(
|
|
3270
|
-
|
|
3271
|
-
u[
|
|
3272
|
-
|
|
3270
|
+
R,
|
|
3271
|
+
u[v],
|
|
3272
|
+
v,
|
|
3273
3273
|
i,
|
|
3274
3274
|
n
|
|
3275
3275
|
)
|
|
3276
|
-
) : s.push(E.setPartValues(
|
|
3276
|
+
) : s.push(E.setPartValues(R, {}, v, i, n));
|
|
3277
3277
|
}
|
|
3278
3278
|
}
|
|
3279
3279
|
} else
|
|
@@ -3358,7 +3358,7 @@ class E {
|
|
|
3358
3358
|
t instanceof HTMLFormElement ? r.push(t) : r.push(...Array.from(t.querySelectorAll("form")));
|
|
3359
3359
|
const i = [];
|
|
3360
3360
|
for (const n of r) {
|
|
3361
|
-
const s =
|
|
3361
|
+
const s = T.get(n);
|
|
3362
3362
|
s instanceof M && i.push(s);
|
|
3363
3363
|
}
|
|
3364
3364
|
return i;
|
|
@@ -3746,7 +3746,7 @@ function Ye(f, e) {
|
|
|
3746
3746
|
return null;
|
|
3747
3747
|
if (!t.includes("{{"))
|
|
3748
3748
|
return t;
|
|
3749
|
-
const r =
|
|
3749
|
+
const r = T.get(f), i = r instanceof M ? r.getBindingData() : {}, n = Ge(t, i);
|
|
3750
3750
|
return n === "" ? null : n;
|
|
3751
3751
|
}
|
|
3752
3752
|
function Je(f, e, t) {
|
|
@@ -4073,9 +4073,9 @@ const g = class g {
|
|
|
4073
4073
|
g.attrName(t, "form")
|
|
4074
4074
|
);
|
|
4075
4075
|
if (y) {
|
|
4076
|
-
const
|
|
4077
|
-
|
|
4078
|
-
|
|
4076
|
+
const b = document.body.querySelector(y);
|
|
4077
|
+
b !== null ? r.formFragment = E.getFormFragment(
|
|
4078
|
+
T.get(b)
|
|
4079
4079
|
) : m.error(
|
|
4080
4080
|
"Haori",
|
|
4081
4081
|
`Form element not found: ${y} (${g.attrName(t, "form")})`
|
|
@@ -4096,24 +4096,34 @@ const g = class g {
|
|
|
4096
4096
|
${y}
|
|
4097
4097
|
`
|
|
4098
4098
|
);
|
|
4099
|
-
} catch (
|
|
4100
|
-
m.error("Haori", `Invalid before script: ${
|
|
4099
|
+
} catch (b) {
|
|
4100
|
+
m.error("Haori", `Invalid before script: ${b}`);
|
|
4101
4101
|
}
|
|
4102
4102
|
}
|
|
4103
4103
|
const A = g.attrName(t, "run");
|
|
4104
4104
|
if (e.hasAttribute(A)) {
|
|
4105
4105
|
const y = String(e.getAttribute(A) ?? "");
|
|
4106
|
+
let b = null;
|
|
4106
4107
|
try {
|
|
4107
|
-
|
|
4108
|
+
b = new Function(
|
|
4108
4109
|
"event",
|
|
4109
|
-
`
|
|
4110
|
-
"use strict";
|
|
4110
|
+
`"use strict"; return (
|
|
4111
4111
|
${y}
|
|
4112
|
-
|
|
4112
|
+
);`
|
|
4113
4113
|
);
|
|
4114
|
-
} catch
|
|
4115
|
-
|
|
4114
|
+
} catch {
|
|
4115
|
+
try {
|
|
4116
|
+
b = new Function(
|
|
4117
|
+
"event",
|
|
4118
|
+
`"use strict";
|
|
4119
|
+
${y}
|
|
4120
|
+
`
|
|
4121
|
+
);
|
|
4122
|
+
} catch (S) {
|
|
4123
|
+
m.error("Haori", `Invalid run script: ${S}`);
|
|
4124
|
+
}
|
|
4116
4125
|
}
|
|
4126
|
+
b && (r.runScript = b);
|
|
4117
4127
|
}
|
|
4118
4128
|
}
|
|
4119
4129
|
const i = g.attrName(t, "fetch"), n = e.hasAttribute(i);
|
|
@@ -4145,8 +4155,8 @@ ${y}
|
|
|
4145
4155
|
);
|
|
4146
4156
|
try {
|
|
4147
4157
|
s.headers = x.parseDataBind(y);
|
|
4148
|
-
} catch (
|
|
4149
|
-
m.error("Haori", `Invalid fetch headers: ${
|
|
4158
|
+
} catch (b) {
|
|
4159
|
+
m.error("Haori", `Invalid fetch headers: ${b}`);
|
|
4150
4160
|
}
|
|
4151
4161
|
}
|
|
4152
4162
|
} else {
|
|
@@ -4161,8 +4171,8 @@ ${y}
|
|
|
4161
4171
|
);
|
|
4162
4172
|
try {
|
|
4163
4173
|
s.headers = x.parseDataBind(y);
|
|
4164
|
-
} catch (
|
|
4165
|
-
m.error("Haori", `Invalid fetch headers: ${
|
|
4174
|
+
} catch (b) {
|
|
4175
|
+
m.error("Haori", `Invalid fetch headers: ${b}`);
|
|
4166
4176
|
}
|
|
4167
4177
|
}
|
|
4168
4178
|
}
|
|
@@ -4213,8 +4223,8 @@ ${y}
|
|
|
4213
4223
|
const A = e.getRawAttribute(a);
|
|
4214
4224
|
if (A) {
|
|
4215
4225
|
const y = document.body.querySelectorAll(A);
|
|
4216
|
-
y.length > 0 ? (r.bindFragments = [], y.forEach((
|
|
4217
|
-
const S =
|
|
4226
|
+
y.length > 0 ? (r.bindFragments = [], y.forEach((b) => {
|
|
4227
|
+
const S = T.get(b);
|
|
4218
4228
|
S && r.bindFragments.push(S);
|
|
4219
4229
|
})) : m.error(
|
|
4220
4230
|
"Haori",
|
|
@@ -4244,10 +4254,10 @@ ${y}
|
|
|
4244
4254
|
const A = e.getRawAttribute(p);
|
|
4245
4255
|
r.bindAppendParams = A.split("&").map((y) => y.trim()).filter(Boolean);
|
|
4246
4256
|
}
|
|
4247
|
-
const
|
|
4248
|
-
e.hasAttribute(
|
|
4249
|
-
const
|
|
4250
|
-
e.hasAttribute(
|
|
4257
|
+
const v = t ? g.attrName(t, "bind-merge") : g.attrName(null, "bind-merge", !0);
|
|
4258
|
+
e.hasAttribute(v) && (r.bindMerge = !0);
|
|
4259
|
+
const R = t ? g.attrName(t, "bind-transform") : g.attrName(null, "bind-transform", !0);
|
|
4260
|
+
e.hasAttribute(R) && (r.bindTransform = e.getRawAttribute(R));
|
|
4251
4261
|
const I = t ? g.attrName(t, "copy-params") : null;
|
|
4252
4262
|
if (I && e.hasAttribute(I)) {
|
|
4253
4263
|
const A = e.getRawAttribute(I);
|
|
@@ -4255,17 +4265,17 @@ ${y}
|
|
|
4255
4265
|
}
|
|
4256
4266
|
if (t) {
|
|
4257
4267
|
if (e.hasAttribute(g.attrName(t, "adjust"))) {
|
|
4258
|
-
const
|
|
4268
|
+
const b = e.getRawAttribute(
|
|
4259
4269
|
g.attrName(t, "adjust")
|
|
4260
4270
|
);
|
|
4261
|
-
if (
|
|
4262
|
-
const S = document.body.querySelectorAll(
|
|
4271
|
+
if (b) {
|
|
4272
|
+
const S = document.body.querySelectorAll(b);
|
|
4263
4273
|
S.length > 0 ? (r.adjustFragments = [], S.forEach((k) => {
|
|
4264
|
-
const C =
|
|
4274
|
+
const C = T.get(k);
|
|
4265
4275
|
C && r.adjustFragments.push(C);
|
|
4266
4276
|
})) : m.error(
|
|
4267
4277
|
"Haori",
|
|
4268
|
-
`Adjust element not found: ${
|
|
4278
|
+
`Adjust element not found: ${b} (${g.attrName(t, "adjust")})`
|
|
4269
4279
|
);
|
|
4270
4280
|
}
|
|
4271
4281
|
if (e.hasAttribute(g.attrName(t, "adjust-value"))) {
|
|
@@ -4276,7 +4286,7 @@ ${y}
|
|
|
4276
4286
|
}
|
|
4277
4287
|
}
|
|
4278
4288
|
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(`${c.prefix}${t}-after-run`)) {
|
|
4279
|
-
const
|
|
4289
|
+
const b = e.getRawAttribute(
|
|
4280
4290
|
`${c.prefix}${t}-after-run`
|
|
4281
4291
|
);
|
|
4282
4292
|
try {
|
|
@@ -4284,7 +4294,7 @@ ${y}
|
|
|
4284
4294
|
"response",
|
|
4285
4295
|
`
|
|
4286
4296
|
"use strict";
|
|
4287
|
-
${
|
|
4297
|
+
${b}
|
|
4288
4298
|
`
|
|
4289
4299
|
);
|
|
4290
4300
|
} catch (S) {
|
|
@@ -4296,21 +4306,21 @@ ${v}
|
|
|
4296
4306
|
r.toastMessage = e.getAttribute(
|
|
4297
4307
|
g.attrName(t, "toast")
|
|
4298
4308
|
);
|
|
4299
|
-
const
|
|
4309
|
+
const b = e.getRawAttribute(
|
|
4300
4310
|
g.attrName(t, "toast-level")
|
|
4301
|
-
), k = ["info", "warning", "error", "success"].includes(
|
|
4302
|
-
r.toastLevel = k ?
|
|
4311
|
+
), k = ["info", "warning", "error", "success"].includes(b);
|
|
4312
|
+
r.toastLevel = k ? b : null;
|
|
4303
4313
|
}
|
|
4304
4314
|
if (e.hasAttribute(g.attrName(t, "redirect"))) {
|
|
4305
4315
|
r.redirectUrl = e.getAttribute(
|
|
4306
4316
|
g.attrName(t, "redirect")
|
|
4307
4317
|
);
|
|
4308
|
-
const
|
|
4318
|
+
const b = g.attrName(
|
|
4309
4319
|
t,
|
|
4310
4320
|
"redirect-return-param"
|
|
4311
4321
|
);
|
|
4312
|
-
e.hasAttribute(
|
|
4313
|
-
|
|
4322
|
+
e.hasAttribute(b) && (r.redirectReturnParam = e.getAttribute(
|
|
4323
|
+
b
|
|
4314
4324
|
));
|
|
4315
4325
|
}
|
|
4316
4326
|
if (e.hasAttribute(g.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(g.attrName(t, "scroll")) && (r.scrollTarget = e.getAttribute(
|
|
@@ -4318,16 +4328,16 @@ ${v}
|
|
|
4318
4328
|
)), e.hasAttribute(g.attrName(t, "history")) && (r.historyUrl = e.getAttribute(
|
|
4319
4329
|
g.attrName(t, "history")
|
|
4320
4330
|
)), e.hasAttribute(g.attrName(t, "history-data")) && (r.historyDataAttrName = g.attrName(t, "history-data")), e.hasAttribute(g.attrName(t, "history-form"))) {
|
|
4321
|
-
const
|
|
4331
|
+
const b = e.getRawAttribute(
|
|
4322
4332
|
g.attrName(t, "history-form")
|
|
4323
4333
|
);
|
|
4324
|
-
if (
|
|
4325
|
-
const S = document.body.querySelector(
|
|
4334
|
+
if (b) {
|
|
4335
|
+
const S = document.body.querySelector(b);
|
|
4326
4336
|
S !== null ? r.historyFormFragment = E.getFormFragment(
|
|
4327
|
-
|
|
4337
|
+
T.get(S)
|
|
4328
4338
|
) : m.error(
|
|
4329
4339
|
"Haori",
|
|
4330
|
-
`Form element not found: ${
|
|
4340
|
+
`Form element not found: ${b} (${g.attrName(t, "history-form")})`
|
|
4331
4341
|
);
|
|
4332
4342
|
} else
|
|
4333
4343
|
r.historyFormFragment = E.getFormFragment(e);
|
|
@@ -4340,16 +4350,23 @@ ${v}
|
|
|
4340
4350
|
"copy",
|
|
4341
4351
|
"open",
|
|
4342
4352
|
"close"
|
|
4343
|
-
].forEach((
|
|
4344
|
-
const S = g.attrName(t,
|
|
4353
|
+
].forEach((b) => {
|
|
4354
|
+
const S = g.attrName(t, b);
|
|
4345
4355
|
if (!e.hasAttribute(S))
|
|
4346
4356
|
return;
|
|
4347
4357
|
const k = e.getRawAttribute(S), C = [];
|
|
4348
|
-
if (k
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4358
|
+
if (k)
|
|
4359
|
+
document.body.querySelectorAll(k).forEach((j) => {
|
|
4360
|
+
const $ = T.get(j);
|
|
4361
|
+
$ && C.push($);
|
|
4362
|
+
}), C.length === 0 && m.error("Haori", `Element not found: ${k} (${S})`);
|
|
4363
|
+
else if (b === "open" || b === "close") {
|
|
4364
|
+
const O = e.getTarget().closest("dialog");
|
|
4365
|
+
O ? C.push(T.get(O)) : m.error("Haori", `Ancestor <dialog> not found (${S})`);
|
|
4366
|
+
} else
|
|
4367
|
+
C.push(e);
|
|
4368
|
+
if (C.length > 0)
|
|
4369
|
+
switch (b) {
|
|
4353
4370
|
case "reset-before":
|
|
4354
4371
|
r.resetBeforeFragments = C;
|
|
4355
4372
|
break;
|
|
@@ -4375,21 +4392,21 @@ ${v}
|
|
|
4375
4392
|
});
|
|
4376
4393
|
const y = g.attrName(t, "copy-source");
|
|
4377
4394
|
if (e.hasAttribute(y)) {
|
|
4378
|
-
const
|
|
4395
|
+
const b = e.getRawAttribute(
|
|
4379
4396
|
y
|
|
4380
4397
|
);
|
|
4381
|
-
if (
|
|
4382
|
-
const S = document.body.querySelector(
|
|
4398
|
+
if (b) {
|
|
4399
|
+
const S = document.body.querySelector(b);
|
|
4383
4400
|
if (S !== null) {
|
|
4384
|
-
const k =
|
|
4401
|
+
const k = T.get(S);
|
|
4385
4402
|
k ? r.copySourceFragment = k : m.error(
|
|
4386
4403
|
"Haori",
|
|
4387
|
-
`Element is not managed by Haori: ${
|
|
4404
|
+
`Element is not managed by Haori: ${b} (${y})`
|
|
4388
4405
|
);
|
|
4389
4406
|
} else
|
|
4390
4407
|
m.error(
|
|
4391
4408
|
"Haori",
|
|
4392
|
-
`Element not found: ${
|
|
4409
|
+
`Element not found: ${b} (${y})`
|
|
4393
4410
|
);
|
|
4394
4411
|
} else
|
|
4395
4412
|
r.copySourceFragment = e;
|
|
@@ -4402,7 +4419,7 @@ ${v}
|
|
|
4402
4419
|
if (A) {
|
|
4403
4420
|
const y = document.body.querySelector(A);
|
|
4404
4421
|
y !== null ? r.formFragment = E.getFormFragment(
|
|
4405
|
-
|
|
4422
|
+
T.get(y)
|
|
4406
4423
|
) : m.error(
|
|
4407
4424
|
"Haori",
|
|
4408
4425
|
`Form element not found: ${A} (${g.attrName(null, "fetch-form", !0)})`
|
|
@@ -4503,22 +4520,22 @@ ${v}
|
|
|
4503
4520
|
}
|
|
4504
4521
|
const a = Object.keys(i).length > 0;
|
|
4505
4522
|
if (n) {
|
|
4506
|
-
const h = { ...s || {} }, u = r.requestedMethod, p = r.effectiveMethod,
|
|
4507
|
-
if (
|
|
4523
|
+
const h = { ...s || {} }, u = r.requestedMethod, p = r.effectiveMethod, v = r.transportMode === "query-get", R = r.queryString;
|
|
4524
|
+
if (v && m.info("Haori demo fetch normalization", {
|
|
4508
4525
|
runtime: c.runtime,
|
|
4509
4526
|
requestedMethod: u,
|
|
4510
4527
|
effectiveMethod: p,
|
|
4511
4528
|
transportMode: "query-get",
|
|
4512
4529
|
url: n,
|
|
4513
4530
|
payload: a ? i : void 0,
|
|
4514
|
-
queryString:
|
|
4531
|
+
queryString: R
|
|
4515
4532
|
}), this.options.targetFragment && n) {
|
|
4516
4533
|
const I = performance.now(), A = {
|
|
4517
4534
|
runtime: c.runtime,
|
|
4518
4535
|
requestedMethod: u,
|
|
4519
4536
|
effectiveMethod: p,
|
|
4520
|
-
transportMode:
|
|
4521
|
-
...
|
|
4537
|
+
transportMode: v ? "query-get" : "http",
|
|
4538
|
+
...v ? { queryString: R } : {}
|
|
4522
4539
|
};
|
|
4523
4540
|
return N.fetchStart(
|
|
4524
4541
|
this.options.targetFragment.getTarget(),
|
|
@@ -4543,8 +4560,8 @@ ${v}
|
|
|
4543
4560
|
if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
|
|
4544
4561
|
const h = this.options.formFragment, u = h.getTarget(), p = /* @__PURE__ */ new Set();
|
|
4545
4562
|
e && e.appliedDisabledAttribute && this.options.targetFragment && p.add(this.options.targetFragment);
|
|
4546
|
-
const
|
|
4547
|
-
Object.assign(
|
|
4563
|
+
const v = h.getBindingData();
|
|
4564
|
+
Object.assign(v, i), await x.setBindingData(u, v, p);
|
|
4548
4565
|
}
|
|
4549
4566
|
const o = a ? i : {}, l = new Response(JSON.stringify(o), {
|
|
4550
4567
|
headers: { "Content-Type": "application/json" }
|
|
@@ -4703,12 +4720,12 @@ ${v}
|
|
|
4703
4720
|
const l = /* @__PURE__ */ new Map(), h = [];
|
|
4704
4721
|
for (const u of a)
|
|
4705
4722
|
if (u && typeof u == "object" && !Array.isArray(u)) {
|
|
4706
|
-
const p = u.key,
|
|
4723
|
+
const p = u.key, v = u.message, R = typeof p == "string" && p.length > 0 ? p : null, I = typeof v == "string" ? v : v != null ? String(v) : "";
|
|
4707
4724
|
if (I.length === 0)
|
|
4708
4725
|
continue;
|
|
4709
|
-
if (
|
|
4710
|
-
const A = l.get(
|
|
4711
|
-
A.push(I), l.set(
|
|
4726
|
+
if (R !== null) {
|
|
4727
|
+
const A = l.get(R) ?? [];
|
|
4728
|
+
A.push(I), l.set(R, A);
|
|
4712
4729
|
} else
|
|
4713
4730
|
h.push(I);
|
|
4714
4731
|
} else typeof u == "string" && u.length > 0 && h.push(u);
|
|
@@ -4983,13 +5000,13 @@ ${v}
|
|
|
4983
5000
|
if (/multipart\/form-data/i.test(u)) {
|
|
4984
5001
|
s.delete("Content-Type");
|
|
4985
5002
|
const p = new FormData();
|
|
4986
|
-
for (const [
|
|
4987
|
-
|
|
5003
|
+
for (const [v, R] of Object.entries(t))
|
|
5004
|
+
R == null ? p.append(v, "") : R instanceof Blob ? p.append(v, R) : Array.isArray(R) ? R.forEach((I) => p.append(v, String(I))) : typeof R == "object" ? p.append(v, JSON.stringify(R)) : p.append(v, String(R));
|
|
4988
5005
|
n.body = p;
|
|
4989
5006
|
} else if (/application\/x-www-form-urlencoded/i.test(u)) {
|
|
4990
5007
|
const p = new URLSearchParams();
|
|
4991
|
-
for (const [
|
|
4992
|
-
|
|
5008
|
+
for (const [v, R] of Object.entries(t))
|
|
5009
|
+
R !== void 0 && (R === null ? p.append(v, "") : Array.isArray(R) ? R.forEach((I) => p.append(v, String(I))) : typeof R == "object" ? p.append(v, JSON.stringify(R)) : p.append(v, String(R)));
|
|
4993
5010
|
n.body = p;
|
|
4994
5011
|
} else
|
|
4995
5012
|
s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
|
|
@@ -5249,7 +5266,7 @@ const d = class d {
|
|
|
5249
5266
|
* @returns data-attr-* の内部反映なら true
|
|
5250
5267
|
*/
|
|
5251
5268
|
static isAliasedAttributeReflection(e, t) {
|
|
5252
|
-
const r =
|
|
5269
|
+
const r = T.get(e);
|
|
5253
5270
|
return r instanceof M ? r.hasAttribute(
|
|
5254
5271
|
`${c.prefix}${d.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
5255
5272
|
) : !1;
|
|
@@ -5385,7 +5402,7 @@ const d = class d {
|
|
|
5385
5402
|
if (t.removeAttribute(`${c.prefix}importing`), N.importEnd(t, n, o, s), !document.body.hasAttribute("data-haori-ready")) {
|
|
5386
5403
|
const l = [];
|
|
5387
5404
|
return t.childNodes.forEach((h) => {
|
|
5388
|
-
const u =
|
|
5405
|
+
const u = T.get(h);
|
|
5389
5406
|
u instanceof M ? l.push(d.scan(u.getTarget())) : u instanceof V && l.push(d.evaluateText(u));
|
|
5390
5407
|
}), Promise.all(l).then(() => {
|
|
5391
5408
|
});
|
|
@@ -5405,7 +5422,7 @@ const d = class d {
|
|
|
5405
5422
|
* @returns Promise (スキャンが完了したときに解決される)
|
|
5406
5423
|
*/
|
|
5407
5424
|
static scan(e) {
|
|
5408
|
-
const t =
|
|
5425
|
+
const t = T.get(e);
|
|
5409
5426
|
return t ? d.initializeElementFragment(t, !1) : Promise.resolve();
|
|
5410
5427
|
}
|
|
5411
5428
|
/**
|
|
@@ -5519,7 +5536,7 @@ const d = class d {
|
|
|
5519
5536
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5520
5537
|
*/
|
|
5521
5538
|
static setAttribute(e, t, r, i = !1) {
|
|
5522
|
-
const n =
|
|
5539
|
+
const n = T.get(e), s = d.getAliasedAttributeName(t);
|
|
5523
5540
|
if (s !== null)
|
|
5524
5541
|
return r === null ? n.removeAliasedAttribute(t, s) : n.setAliasedAttribute(
|
|
5525
5542
|
t,
|
|
@@ -5615,7 +5632,7 @@ const d = class d {
|
|
|
5615
5632
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5616
5633
|
*/
|
|
5617
5634
|
static setBindingData(e, t, r = /* @__PURE__ */ new Set(), i = !1, n = !0) {
|
|
5618
|
-
const s =
|
|
5635
|
+
const s = T.get(e), a = s.getRawBindingData();
|
|
5619
5636
|
s.setBindingData(t), n && N.bindChange(e, a, t, "manual");
|
|
5620
5637
|
const o = () => {
|
|
5621
5638
|
s.markBindingWorkStart();
|
|
@@ -5654,7 +5671,7 @@ const d = class d {
|
|
|
5654
5671
|
* `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
|
|
5655
5672
|
*/
|
|
5656
5673
|
static getBindingData(e, t = {}) {
|
|
5657
|
-
const r =
|
|
5674
|
+
const r = T.get(e);
|
|
5658
5675
|
return r instanceof M ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
5659
5676
|
}
|
|
5660
5677
|
/**
|
|
@@ -5673,7 +5690,7 @@ const d = class d {
|
|
|
5673
5690
|
* @return 解決済みスコープと各キーの由来情報
|
|
5674
5691
|
*/
|
|
5675
5692
|
static dumpScope(e) {
|
|
5676
|
-
const t =
|
|
5693
|
+
const t = T.get(e);
|
|
5677
5694
|
if (!t)
|
|
5678
5695
|
return { resolved: {}, sources: {} };
|
|
5679
5696
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
@@ -5681,9 +5698,9 @@ const d = class d {
|
|
|
5681
5698
|
return h.id ? `#${h.id}` : h.tagName.toLowerCase();
|
|
5682
5699
|
}, s = (l, h, u, p) => {
|
|
5683
5700
|
if (l)
|
|
5684
|
-
for (const
|
|
5685
|
-
|
|
5686
|
-
value: l[
|
|
5701
|
+
for (const v of Object.keys(l))
|
|
5702
|
+
v in i || (i[v] = {
|
|
5703
|
+
value: l[v],
|
|
5687
5704
|
source: n(h),
|
|
5688
5705
|
kind: u,
|
|
5689
5706
|
depth: p
|
|
@@ -5721,10 +5738,10 @@ const d = class d {
|
|
|
5721
5738
|
* @param node 追加するノード
|
|
5722
5739
|
*/
|
|
5723
5740
|
static addNode(e, t) {
|
|
5724
|
-
const r =
|
|
5741
|
+
const r = T.get(e);
|
|
5725
5742
|
if (r.isSkipMutationNodes())
|
|
5726
5743
|
return;
|
|
5727
|
-
const i =
|
|
5744
|
+
const i = T.get(t.nextSibling), n = T.get(t);
|
|
5728
5745
|
n && (r.insertBefore(n, i), n instanceof M ? d.scan(n.getTarget()) : n instanceof V && d.evaluateText(n));
|
|
5729
5746
|
}
|
|
5730
5747
|
/**
|
|
@@ -5733,7 +5750,7 @@ const d = class d {
|
|
|
5733
5750
|
* @param node 削除するノード
|
|
5734
5751
|
*/
|
|
5735
5752
|
static removeNode(e) {
|
|
5736
|
-
const t =
|
|
5753
|
+
const t = T.get(e);
|
|
5737
5754
|
if (t) {
|
|
5738
5755
|
const r = t.getParent();
|
|
5739
5756
|
if (r && r.isSkipMutationNodes())
|
|
@@ -5748,7 +5765,7 @@ const d = class d {
|
|
|
5748
5765
|
* @param text 新しいテキスト
|
|
5749
5766
|
*/
|
|
5750
5767
|
static changeText(e, t) {
|
|
5751
|
-
const r =
|
|
5768
|
+
const r = T.get(e);
|
|
5752
5769
|
r && r.setContent(t);
|
|
5753
5770
|
}
|
|
5754
5771
|
/**
|
|
@@ -5760,7 +5777,7 @@ const d = class d {
|
|
|
5760
5777
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
5761
5778
|
*/
|
|
5762
5779
|
static changeValue(e, t) {
|
|
5763
|
-
const r =
|
|
5780
|
+
const r = T.get(e);
|
|
5764
5781
|
if (r.getValue() === t)
|
|
5765
5782
|
return Promise.resolve();
|
|
5766
5783
|
const i = [];
|
|
@@ -5834,12 +5851,12 @@ const d = class d {
|
|
|
5834
5851
|
if (l)
|
|
5835
5852
|
return;
|
|
5836
5853
|
const p = [];
|
|
5837
|
-
return e.getChildren().forEach((
|
|
5838
|
-
if (
|
|
5839
|
-
if (d.canSkipUnchangedNestedEach(
|
|
5854
|
+
return e.getChildren().forEach((v) => {
|
|
5855
|
+
if (v instanceof M) {
|
|
5856
|
+
if (d.canSkipUnchangedNestedEach(v))
|
|
5840
5857
|
return;
|
|
5841
|
-
p.push(d.evaluateAll(
|
|
5842
|
-
} else
|
|
5858
|
+
p.push(d.evaluateAll(v, t));
|
|
5859
|
+
} else v instanceof V && p.push(d.evaluateText(v));
|
|
5843
5860
|
}), Promise.all(p).then(() => {
|
|
5844
5861
|
});
|
|
5845
5862
|
}).then(() => {
|
|
@@ -6056,10 +6073,10 @@ const d = class d {
|
|
|
6056
6073
|
(l) => !l.hasAttribute(`${c.prefix}each-before`) && !l.hasAttribute(`${c.prefix}each-after`)
|
|
6057
6074
|
).forEach((l) => {
|
|
6058
6075
|
if (!s) {
|
|
6059
|
-
const u =
|
|
6076
|
+
const u = T.get(l);
|
|
6060
6077
|
u instanceof M && (r = u.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
6061
6078
|
}
|
|
6062
|
-
const h =
|
|
6079
|
+
const h = T.get(l);
|
|
6063
6080
|
h instanceof M && e.getChildren().includes(h) && (e.removeChild(h), h.setMounted(!1)), l.parentNode && l.parentNode.removeChild(l);
|
|
6064
6081
|
});
|
|
6065
6082
|
}
|
|
@@ -6308,33 +6325,33 @@ const d = class d {
|
|
|
6308
6325
|
let i = e.getAttribute(`${c.prefix}each-index`);
|
|
6309
6326
|
i && (i = String(i));
|
|
6310
6327
|
const n = e.getAttribute(`${c.prefix}each-key`), s = e.getAttribute(`${c.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
|
|
6311
|
-
t.forEach((
|
|
6328
|
+
t.forEach((b, S) => {
|
|
6312
6329
|
const k = d.createListKey(
|
|
6313
|
-
|
|
6330
|
+
b,
|
|
6314
6331
|
n ? String(n) : null,
|
|
6315
6332
|
S
|
|
6316
6333
|
);
|
|
6317
|
-
o.push(k), a.set(k, { item:
|
|
6334
|
+
o.push(k), a.set(k, { item: b, itemIndex: S });
|
|
6318
6335
|
});
|
|
6319
6336
|
const l = new Set(o), h = [];
|
|
6320
|
-
let u = e.getChildren().filter((
|
|
6321
|
-
(
|
|
6337
|
+
let u = e.getChildren().filter((b) => b instanceof M).filter(
|
|
6338
|
+
(b) => !b.hasAttribute(`${c.prefix}each-before`) && !b.hasAttribute(`${c.prefix}each-after`)
|
|
6322
6339
|
);
|
|
6323
|
-
const p = u.map((
|
|
6324
|
-
u = u.filter((
|
|
6325
|
-
const
|
|
6326
|
-
u.forEach((
|
|
6327
|
-
const S =
|
|
6328
|
-
S !== null && !
|
|
6340
|
+
const p = u.map((b) => b.getListKey());
|
|
6341
|
+
u = u.filter((b) => l.has(String(b.getListKey())) ? !0 : (h.push(b.remove()), !1));
|
|
6342
|
+
const v = u.map((b) => b.getListKey()), R = /* @__PURE__ */ new Map();
|
|
6343
|
+
u.forEach((b) => {
|
|
6344
|
+
const S = b.getListKey();
|
|
6345
|
+
S !== null && !R.has(S) && R.set(S, b);
|
|
6329
6346
|
});
|
|
6330
6347
|
const I = e.getChildElementFragments().slice(), A = I.filter(
|
|
6331
|
-
(
|
|
6348
|
+
(b) => b.hasAttribute(`${c.prefix}each-before`)
|
|
6332
6349
|
).length;
|
|
6333
6350
|
let y = Promise.resolve();
|
|
6334
|
-
return o.forEach((
|
|
6335
|
-
const { item: k, itemIndex: C } = a.get(
|
|
6351
|
+
return o.forEach((b, S) => {
|
|
6352
|
+
const { item: k, itemIndex: C } = a.get(b);
|
|
6336
6353
|
let O;
|
|
6337
|
-
const j =
|
|
6354
|
+
const j = R.get(b);
|
|
6338
6355
|
if (j)
|
|
6339
6356
|
O = j, y = y.then(
|
|
6340
6357
|
() => d.updateRowFragment(
|
|
@@ -6343,7 +6360,7 @@ const d = class d {
|
|
|
6343
6360
|
i,
|
|
6344
6361
|
C,
|
|
6345
6362
|
s ? String(s) : null,
|
|
6346
|
-
|
|
6363
|
+
b
|
|
6347
6364
|
).then(($) => {
|
|
6348
6365
|
if ($)
|
|
6349
6366
|
return d.evaluateAll(O);
|
|
@@ -6359,7 +6376,7 @@ const d = class d {
|
|
|
6359
6376
|
i,
|
|
6360
6377
|
C,
|
|
6361
6378
|
s ? String(s) : null,
|
|
6362
|
-
|
|
6379
|
+
b
|
|
6363
6380
|
).then(() => {
|
|
6364
6381
|
const _ = I[$] ?? null;
|
|
6365
6382
|
return e.insertBefore(O, _).then(() => {
|
|
@@ -6369,11 +6386,11 @@ const d = class d {
|
|
|
6369
6386
|
);
|
|
6370
6387
|
}
|
|
6371
6388
|
}), Promise.all(h).then(() => y).then(() => {
|
|
6372
|
-
const
|
|
6389
|
+
const b = o.filter(
|
|
6373
6390
|
($) => $ !== null
|
|
6374
|
-
), S =
|
|
6391
|
+
), S = v.filter(
|
|
6375
6392
|
($) => $ !== null
|
|
6376
|
-
), k = new Set(S), C =
|
|
6393
|
+
), k = new Set(S), C = b.filter(($) => !k.has($)), j = p.filter(
|
|
6377
6394
|
($) => $ !== null
|
|
6378
6395
|
).filter(
|
|
6379
6396
|
($) => !l.has($)
|
|
@@ -6382,7 +6399,7 @@ const d = class d {
|
|
|
6382
6399
|
e.getTarget(),
|
|
6383
6400
|
C,
|
|
6384
6401
|
j,
|
|
6385
|
-
|
|
6402
|
+
b
|
|
6386
6403
|
);
|
|
6387
6404
|
});
|
|
6388
6405
|
}
|
|
@@ -6548,7 +6565,7 @@ const Z = class Z {
|
|
|
6548
6565
|
*/
|
|
6549
6566
|
constructor(e = document) {
|
|
6550
6567
|
this.customEventHandlers = /* @__PURE__ */ new Map(), this.onClick = (t) => this.delegate(t, "click"), this.onChange = (t) => this.delegate(t, "change"), this.onInput = (t) => this.delegate(t, "input"), this.onLoadCapture = (t) => this.delegate(t, "load"), this.onWindowLoad = () => {
|
|
6551
|
-
const t = document.documentElement, r =
|
|
6568
|
+
const t = document.documentElement, r = T.get(t);
|
|
6552
6569
|
r && new q(r, "load").run();
|
|
6553
6570
|
}, this.onPopstate = (t) => {
|
|
6554
6571
|
const r = t.state;
|
|
@@ -6627,7 +6644,7 @@ const Z = class Z {
|
|
|
6627
6644
|
this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
|
|
6628
6645
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
6629
6646
|
return;
|
|
6630
|
-
const n =
|
|
6647
|
+
const n = T.get(i);
|
|
6631
6648
|
n instanceof M && new q(n, "on", t).run().catch((s) => {
|
|
6632
6649
|
m.error("[Haori]", "Procedure execution error:", s);
|
|
6633
6650
|
});
|
|
@@ -6673,7 +6690,7 @@ const Z = class Z {
|
|
|
6673
6690
|
return;
|
|
6674
6691
|
}
|
|
6675
6692
|
r.hasAttribute(`${c.prefix}${t}-prevent`) && e.preventDefault();
|
|
6676
|
-
const i =
|
|
6693
|
+
const i = T.get(r);
|
|
6677
6694
|
if (!i)
|
|
6678
6695
|
return;
|
|
6679
6696
|
(t === "change" || t === "input") && i instanceof M && i.syncValue();
|
|
@@ -6757,7 +6774,7 @@ const D = class D {
|
|
|
6757
6774
|
}));
|
|
6758
6775
|
}
|
|
6759
6776
|
static syncElement(e) {
|
|
6760
|
-
const t = D.registrations.get(e), r =
|
|
6777
|
+
const t = D.registrations.get(e), r = T.get(e);
|
|
6761
6778
|
if (!r || !D.shouldObserve(r)) {
|
|
6762
6779
|
t && (t.observer.disconnect(), D.registrations.delete(e));
|
|
6763
6780
|
return;
|
|
@@ -6899,7 +6916,7 @@ const w = class w {
|
|
|
6899
6916
|
* @param element 対象要素
|
|
6900
6917
|
*/
|
|
6901
6918
|
static syncElement(e) {
|
|
6902
|
-
const t = w.registrations.get(e), r =
|
|
6919
|
+
const t = w.registrations.get(e), r = T.get(e);
|
|
6903
6920
|
if (!(r instanceof M) || !w.shouldObserve(r)) {
|
|
6904
6921
|
t && (t.observer.disconnect(), w.registrations.delete(e));
|
|
6905
6922
|
return;
|
|
@@ -6927,8 +6944,8 @@ const w = class w {
|
|
|
6927
6944
|
return;
|
|
6928
6945
|
let u = !1;
|
|
6929
6946
|
l.forEach((p) => {
|
|
6930
|
-
const
|
|
6931
|
-
h.observedRows.has(
|
|
6947
|
+
const v = p.target;
|
|
6948
|
+
h.observedRows.has(v) && (p.isIntersecting ? h.visibleRows.has(v) || (h.visibleRows.add(v), u = !0) : h.visibleRows.delete(v) && (u = !0));
|
|
6932
6949
|
}), u && w.scheduleCompute(h);
|
|
6933
6950
|
},
|
|
6934
6951
|
{
|
|
@@ -7235,7 +7252,7 @@ export {
|
|
|
7235
7252
|
x as Core,
|
|
7236
7253
|
c as Env,
|
|
7237
7254
|
E as Form,
|
|
7238
|
-
|
|
7255
|
+
T as Fragment,
|
|
7239
7256
|
ee as Haori,
|
|
7240
7257
|
m as Log,
|
|
7241
7258
|
P as Queue,
|