haori 0.22.2 → 0.22.3
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 +3 -3
- package/dist/haori.es.js +35 -24
- package/dist/haori.iife.js +4 -4
- package/dist/index.d.ts +9 -0
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -2242,7 +2242,7 @@ const K = class K extends T {
|
|
|
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), 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,
|
|
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, ee = y.activeElement, be = ee !== null && (j && a === ee || $ && a.closest("select") === ee), te = S !== null, ve = j && !be && a.checked !== te, ye = $ && !be && a.selected !== te;
|
|
2246
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
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(() => {
|
|
@@ -2846,7 +2846,7 @@ le.FORCE_EVALUATION_ATTRIBUTES = [
|
|
|
2846
2846
|
"hor-derive"
|
|
2847
2847
|
];
|
|
2848
2848
|
let se = le;
|
|
2849
|
-
class
|
|
2849
|
+
class Q {
|
|
2850
2850
|
/**
|
|
2851
2851
|
* 実行モードを取得します。
|
|
2852
2852
|
*
|
|
@@ -2922,7 +2922,7 @@ class ee {
|
|
|
2922
2922
|
*/
|
|
2923
2923
|
static openDialog(e) {
|
|
2924
2924
|
return P.enqueue(() => {
|
|
2925
|
-
e instanceof HTMLDialogElement ? e.showModal() : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2925
|
+
e instanceof HTMLDialogElement ? (Q.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
|
|
2926
2926
|
}, !0);
|
|
2927
2927
|
}
|
|
2928
2928
|
/**
|
|
@@ -2942,7 +2942,7 @@ class ee {
|
|
|
2942
2942
|
* @param message エラーメッセージ
|
|
2943
2943
|
*/
|
|
2944
2944
|
static addErrorMessage(e, t) {
|
|
2945
|
-
return
|
|
2945
|
+
return Q.addMessage(e, t, "error");
|
|
2946
2946
|
}
|
|
2947
2947
|
/**
|
|
2948
2948
|
* メッセージをレベル付きで追加します。
|
|
@@ -2964,11 +2964,22 @@ class ee {
|
|
|
2964
2964
|
*/
|
|
2965
2965
|
static clearMessages(e) {
|
|
2966
2966
|
return P.enqueue(() => {
|
|
2967
|
-
|
|
2968
|
-
t.removeAttribute("data-message"), t.removeAttribute("data-message-level");
|
|
2969
|
-
});
|
|
2967
|
+
Q.clearMessagesSync(e);
|
|
2970
2968
|
}, !0);
|
|
2971
2969
|
}
|
|
2970
|
+
/**
|
|
2971
|
+
* 対象のエレメントおよびその子要素のメッセージ属性を同期的に除去します。
|
|
2972
|
+
*
|
|
2973
|
+
* Queue を介さないため、別の enqueue ブロック内から実行順を保ったまま
|
|
2974
|
+
* 呼び出せます。{@link clearMessages} および {@link openDialog} の共通処理です。
|
|
2975
|
+
*
|
|
2976
|
+
* @param parent メッセージをクリアする親要素
|
|
2977
|
+
*/
|
|
2978
|
+
static clearMessagesSync(e) {
|
|
2979
|
+
e.removeAttribute("data-message"), e.removeAttribute("data-message-level"), e.querySelectorAll("[data-message]").forEach((t) => {
|
|
2980
|
+
t.removeAttribute("data-message"), t.removeAttribute("data-message-level");
|
|
2981
|
+
});
|
|
2982
|
+
}
|
|
2972
2983
|
/**
|
|
2973
2984
|
* 日時を指定フォーマットの文字列へ整形します。
|
|
2974
2985
|
*
|
|
@@ -3115,7 +3126,7 @@ function Ae() {
|
|
|
3115
3126
|
const e = globalThis.window?.Haori;
|
|
3116
3127
|
return Ke.every(
|
|
3117
3128
|
(r) => typeof e?.[r] == "function"
|
|
3118
|
-
) ? e :
|
|
3129
|
+
) ? e : Q;
|
|
3119
3130
|
}
|
|
3120
3131
|
class E {
|
|
3121
3132
|
/**
|
|
@@ -3833,7 +3844,7 @@ function ie() {
|
|
|
3833
3844
|
const e = globalThis.window?.Haori;
|
|
3834
3845
|
return Xe.every(
|
|
3835
3846
|
(r) => typeof e?.[r] == "function"
|
|
3836
|
-
) ? e :
|
|
3847
|
+
) ? e : Q;
|
|
3837
3848
|
}
|
|
3838
3849
|
const Ze = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
3839
3850
|
function _e(f) {
|
|
@@ -6378,8 +6389,8 @@ const d = class d {
|
|
|
6378
6389
|
s ? String(s) : null,
|
|
6379
6390
|
b
|
|
6380
6391
|
).then(() => {
|
|
6381
|
-
const
|
|
6382
|
-
return e.insertBefore(O,
|
|
6392
|
+
const ee = I[$] ?? null;
|
|
6393
|
+
return e.insertBefore(O, ee).then(() => {
|
|
6383
6394
|
I.splice($, 0, O);
|
|
6384
6395
|
}).then(() => d.initializeFreshEachRow(O));
|
|
6385
6396
|
})
|
|
@@ -6557,7 +6568,7 @@ d.ATTRIBUTE_ALIAS_SUFFIX = "attr-", d.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
6557
6568
|
"url-param"
|
|
6558
6569
|
], d.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, d.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), d.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), d.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), d.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap();
|
|
6559
6570
|
let x = d;
|
|
6560
|
-
const
|
|
6571
|
+
const _ = class _ {
|
|
6561
6572
|
/**
|
|
6562
6573
|
* コンストラクタ。
|
|
6563
6574
|
*
|
|
@@ -6569,7 +6580,7 @@ const Z = class Z {
|
|
|
6569
6580
|
r && new q(r, "load").run();
|
|
6570
6581
|
}, this.onPopstate = (t) => {
|
|
6571
6582
|
const r = t.state;
|
|
6572
|
-
!r || r[
|
|
6583
|
+
!r || r[_.HISTORY_STATE_KEY] !== !0 || location.reload();
|
|
6573
6584
|
}, this.root = e;
|
|
6574
6585
|
}
|
|
6575
6586
|
/**
|
|
@@ -6621,7 +6632,7 @@ const Z = class Z {
|
|
|
6621
6632
|
subscribeCustomEvent(e) {
|
|
6622
6633
|
if (e === null || e === "")
|
|
6623
6634
|
return;
|
|
6624
|
-
if (
|
|
6635
|
+
if (_.BUILTIN_EVENT_NAMES.has(e)) {
|
|
6625
6636
|
m.warn(
|
|
6626
6637
|
"[Haori]",
|
|
6627
6638
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
@@ -6748,13 +6759,13 @@ const Z = class Z {
|
|
|
6748
6759
|
return null;
|
|
6749
6760
|
}
|
|
6750
6761
|
};
|
|
6751
|
-
|
|
6762
|
+
_.HISTORY_STATE_KEY = "__haoriHistoryState__", _.BUILTIN_EVENT_NAMES = /* @__PURE__ */ new Set([
|
|
6752
6763
|
"click",
|
|
6753
6764
|
"change",
|
|
6754
6765
|
"input",
|
|
6755
6766
|
"load"
|
|
6756
6767
|
]);
|
|
6757
|
-
let fe =
|
|
6768
|
+
let fe = _;
|
|
6758
6769
|
const D = class D {
|
|
6759
6770
|
/**
|
|
6760
6771
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -6882,7 +6893,7 @@ D.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
6882
6893
|
"disabled",
|
|
6883
6894
|
"once"
|
|
6884
6895
|
]), D.registrations = /* @__PURE__ */ new Map();
|
|
6885
|
-
let
|
|
6896
|
+
let Z = D;
|
|
6886
6897
|
function st(f) {
|
|
6887
6898
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => f()) : Promise.resolve().then(f);
|
|
6888
6899
|
}
|
|
@@ -7183,7 +7194,7 @@ const H = class H {
|
|
|
7183
7194
|
x.scan(document.head),
|
|
7184
7195
|
x.scan(document.body)
|
|
7185
7196
|
]), [t, r] = e;
|
|
7186
|
-
t.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", t.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await P.wait(), document.body.setAttribute("data-haori-ready", ""), H.observe(document.head), H.observe(document.body), new fe().start(),
|
|
7197
|
+
t.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", t.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await P.wait(), document.body.setAttribute("data-haori-ready", ""), H.observe(document.head), H.observe(document.body), new fe().start(), Z.syncTree(document.body), Y.syncTree(document.body);
|
|
7187
7198
|
}
|
|
7188
7199
|
/**
|
|
7189
7200
|
* 指定された要素を監視します。
|
|
@@ -7207,14 +7218,14 @@ const H = class H {
|
|
|
7207
7218
|
i.attributeName,
|
|
7208
7219
|
n.getAttribute(i.attributeName),
|
|
7209
7220
|
!0
|
|
7210
|
-
),
|
|
7221
|
+
), Z.syncElement(n), Y.syncElement(n);
|
|
7211
7222
|
break;
|
|
7212
7223
|
}
|
|
7213
7224
|
case "childList": {
|
|
7214
7225
|
Array.from(i.removedNodes).forEach((n) => {
|
|
7215
|
-
|
|
7226
|
+
Z.cleanupTree(n), Y.cleanupTree(n), x.removeNode(n);
|
|
7216
7227
|
}), Array.from(i.addedNodes).forEach((n) => {
|
|
7217
|
-
n.parentElement instanceof Element && (x.addNode(n.parentElement, n),
|
|
7228
|
+
n.parentElement instanceof Element && (x.addNode(n.parentElement, n), Z.syncTree(n), Y.syncTree(n));
|
|
7218
7229
|
}), i.target instanceof Element && Y.syncElement(
|
|
7219
7230
|
i.target
|
|
7220
7231
|
);
|
|
@@ -7247,16 +7258,16 @@ const H = class H {
|
|
|
7247
7258
|
H._initialized = !1, H._mutationObservers = [];
|
|
7248
7259
|
let ae = H;
|
|
7249
7260
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", ae.init) : ae.init();
|
|
7250
|
-
const at = () =>
|
|
7261
|
+
const at = () => Q.waitForRenders(), ot = "0.20.0";
|
|
7251
7262
|
export {
|
|
7252
7263
|
x as Core,
|
|
7253
7264
|
c as Env,
|
|
7254
7265
|
E as Form,
|
|
7255
7266
|
T as Fragment,
|
|
7256
|
-
|
|
7267
|
+
Q as Haori,
|
|
7257
7268
|
m as Log,
|
|
7258
7269
|
P as Queue,
|
|
7259
|
-
|
|
7270
|
+
Q as default,
|
|
7260
7271
|
ot as version,
|
|
7261
7272
|
at as waitForRenders
|
|
7262
7273
|
};
|