haori 0.4.0 → 0.4.1

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.es.js CHANGED
@@ -417,10 +417,10 @@ class A {
417
417
  } else if (a) {
418
418
  const f = e[String(a)];
419
419
  if (f && typeof f == "object")
420
- for (const T of t.getChildElementFragments())
420
+ for (const N of t.getChildElementFragments())
421
421
  s.push(
422
422
  A.setPartValues(
423
- T,
423
+ N,
424
424
  f,
425
425
  null,
426
426
  i
@@ -429,9 +429,9 @@ class A {
429
429
  } else if (o) {
430
430
  const f = e[String(o)];
431
431
  if (Array.isArray(f)) {
432
- const T = t.getChildElementFragments();
433
- for (let E = 0; E < T.length; E++) {
434
- const d = T[E];
432
+ const N = t.getChildElementFragments();
433
+ for (let E = 0; E < N.length; E++) {
434
+ const d = N[E];
435
435
  f.length > E ? s.push(
436
436
  A.setPartValues(
437
437
  d,
@@ -571,9 +571,9 @@ class A {
571
571
  if (isNaN(f))
572
572
  h.error("Haori", `Invalid index: ${i}`);
573
573
  else {
574
- const T = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
575
- f < T.length && r.push(
576
- ...A.findFragmentByKeyParts(T[f], e.slice(1))
574
+ const N = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
575
+ f < N.length && r.push(
576
+ ...A.findFragmentByKeyParts(N[f], e.slice(1))
577
577
  );
578
578
  }
579
579
  }
@@ -1303,8 +1303,8 @@ const C = class C {
1303
1303
  }
1304
1304
  };
1305
1305
  C.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1306
- let N = C;
1307
- class D extends N {
1306
+ let T = C;
1307
+ class D extends T {
1308
1308
  /**
1309
1309
  * エレメントフラグメントのコンストラクタ。
1310
1310
  * アトリビュートや子フラグメントの作成も行います。
@@ -1334,7 +1334,7 @@ class D extends N {
1334
1334
  this.attributeMap.set(e, i);
1335
1335
  }
1336
1336
  }), t.childNodes.forEach((e) => {
1337
- const r = N.get(e);
1337
+ const r = T.get(e);
1338
1338
  r.setParent(this), this.children.push(r);
1339
1339
  });
1340
1340
  }
@@ -1573,7 +1573,7 @@ class D extends N {
1573
1573
  i.removeAttribute(t);
1574
1574
  else {
1575
1575
  const n = String(s);
1576
- i.getAttribute(t) !== n && i.setAttribute(t, n);
1576
+ i.getAttribute(t) !== n && i.setAttribute(t, n), t === "value" && (i instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement) && (this.value = n, i.value !== n && (i.value = n));
1577
1577
  }
1578
1578
  }).finally(() => {
1579
1579
  this.skipMutationAttributes = !1;
@@ -1651,7 +1651,7 @@ class D extends N {
1651
1651
  const i = e ? r.nextSibling : r;
1652
1652
  let s = e ? r.nextSibling : r;
1653
1653
  for (; s !== null; ) {
1654
- const n = N.get(s);
1654
+ const n = T.get(s);
1655
1655
  if (n !== null) {
1656
1656
  const a = this.children.indexOf(n);
1657
1657
  if (a !== -1)
@@ -1704,11 +1704,11 @@ class D extends N {
1704
1704
  this.children.splice(E, 0, t);
1705
1705
  }
1706
1706
  t.setParent(this), t.setMounted(this.mounted);
1707
- const T = this.skipMutationNodes;
1707
+ const N = this.skipMutationNodes;
1708
1708
  return this.skipMutationNodes = !0, F.enqueue(() => {
1709
1709
  this.target.insertBefore(t.getTarget(), f);
1710
1710
  }).finally(() => {
1711
- this.skipMutationNodes = T;
1711
+ this.skipMutationNodes = N;
1712
1712
  });
1713
1713
  }
1714
1714
  /**
@@ -1803,7 +1803,7 @@ class D extends N {
1803
1803
  return e === null ? null : e.closestByAttribute(t);
1804
1804
  }
1805
1805
  }
1806
- class L extends N {
1806
+ class L extends T {
1807
1807
  /**
1808
1808
  * テキストフラグメントのコンストラクタ。
1809
1809
  * 対象テキストノードの内容を初期化します。
@@ -1858,7 +1858,7 @@ class L extends N {
1858
1858
  });
1859
1859
  }
1860
1860
  }
1861
- class Y extends N {
1861
+ class Y extends T {
1862
1862
  /**
1863
1863
  * コメントフラグメントのコンストラクタ。
1864
1864
  * 対象コメントノードの内容を初期化します。
@@ -2122,8 +2122,8 @@ class v {
2122
2122
  static bindChange(t, e, r, i = "other") {
2123
2123
  const s = [], n = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...n, ...a]);
2124
2124
  for (const p of o) {
2125
- const f = e?.[p], T = r[p];
2126
- f !== T && s.push(p);
2125
+ const f = e?.[p], N = r[p];
2126
+ f !== N && s.push(p);
2127
2127
  }
2128
2128
  v.dispatch(t, "bindchange", {
2129
2129
  previous: e || {},
@@ -2422,7 +2422,7 @@ const c = class c {
2422
2422
  if (d) {
2423
2423
  const u = document.body.querySelector(d);
2424
2424
  u !== null ? r.formFragment = A.getFormFragment(
2425
- N.get(u)
2425
+ T.get(u)
2426
2426
  ) : h.error(
2427
2427
  "Haori",
2428
2428
  `Form element not found: ${d} (${c.attrName(e, "form")})`
@@ -2540,7 +2540,7 @@ ${d}
2540
2540
  if (d) {
2541
2541
  const u = document.body.querySelectorAll(d);
2542
2542
  u.length > 0 ? (r.bindFragments = [], u.forEach((g) => {
2543
- const b = N.get(g);
2543
+ const b = T.get(g);
2544
2544
  b && r.bindFragments.push(b);
2545
2545
  })) : h.error(
2546
2546
  "Haori",
@@ -2560,9 +2560,9 @@ ${d}
2560
2560
  e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(p) ? r.bindArg = t.getRawAttribute(
2561
2561
  p
2562
2562
  ) : t.hasAttribute(f) && (r.bindArg = t.getRawAttribute(f));
2563
- const T = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2564
- if (t.hasAttribute(T)) {
2565
- const d = t.getRawAttribute(T);
2563
+ const N = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2564
+ if (t.hasAttribute(N)) {
2565
+ const d = t.getRawAttribute(N);
2566
2566
  r.bindParams = d.split("&").map((u) => u.trim());
2567
2567
  }
2568
2568
  const E = e ? c.attrName(e, "bind-append") : c.attrName(null, "bind-append", !0);
@@ -2578,7 +2578,7 @@ ${d}
2578
2578
  if (u) {
2579
2579
  const g = document.body.querySelectorAll(u);
2580
2580
  g.length > 0 ? (r.adjustFragments = [], g.forEach((b) => {
2581
- const y = N.get(b);
2581
+ const y = T.get(b);
2582
2582
  y && r.adjustFragments.push(y);
2583
2583
  })) : h.error(
2584
2584
  "Haori",
@@ -2626,7 +2626,7 @@ ${u}
2626
2626
  if (u) {
2627
2627
  const g = document.body.querySelector(u);
2628
2628
  g !== null ? r.historyFormFragment = A.getFormFragment(
2629
- N.get(g)
2629
+ T.get(g)
2630
2630
  ) : h.error(
2631
2631
  "Haori",
2632
2632
  `Form element not found: ${u} (${c.attrName(e, "history-form")})`
@@ -2646,7 +2646,7 @@ ${u}
2646
2646
  return;
2647
2647
  const b = t.getRawAttribute(g), y = [];
2648
2648
  if (b ? (document.body.querySelectorAll(b).forEach((k) => {
2649
- const U = N.get(k);
2649
+ const U = T.get(k);
2650
2650
  U && y.push(U);
2651
2651
  }), y.length === 0 && h.error("Haori", `Element not found: ${b} (${g})`)) : y.push(t), y.length > 0)
2652
2652
  switch (u) {
@@ -2678,7 +2678,7 @@ ${u}
2678
2678
  if (d) {
2679
2679
  const u = document.body.querySelector(d);
2680
2680
  u !== null ? r.formFragment = A.getFormFragment(
2681
- N.get(u)
2681
+ T.get(u)
2682
2682
  ) : h.error(
2683
2683
  "Haori",
2684
2684
  `Form element not found: ${d} (${c.attrName(null, "fetch-form", !0)})`
@@ -2756,7 +2756,7 @@ ${u}
2756
2756
  if (e) {
2757
2757
  const o = { ...r || {} }, p = new Headers(
2758
2758
  o.headers || void 0
2759
- ), f = (o.method || "GET").toUpperCase(), T = l.runtime === "demo" && !nt(f), E = T ? "GET" : f;
2759
+ ), f = (o.method || "GET").toUpperCase(), N = l.runtime === "demo" && !nt(f), E = N ? "GET" : f;
2760
2760
  if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
2761
2761
  s && (e = ot(e, i));
2762
2762
  else if (s) {
@@ -2777,7 +2777,7 @@ ${u}
2777
2777
  }
2778
2778
  o.headers = p;
2779
2779
  let d;
2780
- if (T && (d = e && new URL(e, window.location.href).search || void 0, p.delete("Content-Type"), h.info("Haori demo fetch normalization", {
2780
+ if (N && (d = e && new URL(e, window.location.href).search || void 0, p.delete("Content-Type"), h.info("Haori demo fetch normalization", {
2781
2781
  runtime: l.runtime,
2782
2782
  requestedMethod: f,
2783
2783
  effectiveMethod: E,
@@ -2790,8 +2790,8 @@ ${u}
2790
2790
  runtime: l.runtime,
2791
2791
  requestedMethod: f,
2792
2792
  effectiveMethod: E,
2793
- transportMode: T ? "query-get" : "http",
2794
- ...T ? { queryString: d } : {}
2793
+ transportMode: N ? "query-get" : "http",
2794
+ ...N ? { queryString: d } : {}
2795
2795
  };
2796
2796
  return v.fetchStart(
2797
2797
  this.options.targetFragment.getTarget(),
@@ -3248,10 +3248,10 @@ const m = class m {
3248
3248
  * @returns Promise (スキャンが完了したときに解決される)
3249
3249
  */
3250
3250
  static scan(t) {
3251
- const e = N.get(t);
3251
+ const e = T.get(t);
3252
3252
  if (!e)
3253
3253
  return Promise.resolve();
3254
- t.parentNode && (N.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
3254
+ t.parentNode && (T.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
3255
3255
  const r = [], i = /* @__PURE__ */ new Set();
3256
3256
  for (const s of m.PRIORITY_ATTRIBUTE_SUFFIXES) {
3257
3257
  const n = l.prefix + s;
@@ -3294,7 +3294,7 @@ const m = class m {
3294
3294
  * @returns Promise (DOM操作が完了したときに解決される)
3295
3295
  */
3296
3296
  static setAttribute(t, e, r) {
3297
- const i = N.get(t), s = [];
3297
+ const i = T.get(t), s = [];
3298
3298
  switch (e) {
3299
3299
  case `${l.prefix}bind`: {
3300
3300
  r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(m.parseDataBind(r));
@@ -3353,7 +3353,7 @@ const m = class m {
3353
3353
  * @returns Promise (DOM操作が完了したときに解決される)
3354
3354
  */
3355
3355
  static setBindingData(t, e) {
3356
- const r = N.get(t), i = r.getRawBindingData();
3356
+ const r = T.get(t), i = r.getRawBindingData();
3357
3357
  r.setBindingData(e);
3358
3358
  const s = [];
3359
3359
  return s.push(
@@ -3388,10 +3388,10 @@ const m = class m {
3388
3388
  * @param node 追加するノード
3389
3389
  */
3390
3390
  static addNode(t, e) {
3391
- const r = N.get(t);
3391
+ const r = T.get(t);
3392
3392
  if (r.isSkipMutationNodes())
3393
3393
  return;
3394
- const i = N.get(e.nextSibling), s = N.get(e);
3394
+ const i = T.get(e.nextSibling), s = T.get(e);
3395
3395
  s && (r.insertBefore(s, i), s instanceof D ? m.scan(s.getTarget()) : s instanceof L && m.evaluateText(s));
3396
3396
  }
3397
3397
  /**
@@ -3400,7 +3400,7 @@ const m = class m {
3400
3400
  * @param node 削除するノード
3401
3401
  */
3402
3402
  static removeNode(t) {
3403
- const e = N.get(t);
3403
+ const e = T.get(t);
3404
3404
  if (e) {
3405
3405
  const r = e.getParent();
3406
3406
  if (r && r.isSkipMutationNodes())
@@ -3415,7 +3415,7 @@ const m = class m {
3415
3415
  * @param text 新しいテキスト
3416
3416
  */
3417
3417
  static changeText(t, e) {
3418
- const r = N.get(t);
3418
+ const r = T.get(t);
3419
3419
  r && r.setContent(e);
3420
3420
  }
3421
3421
  /**
@@ -3427,7 +3427,7 @@ const m = class m {
3427
3427
  * @returns Promise (DOM操作が完了したときに解決される)
3428
3428
  */
3429
3429
  static changeValue(t, e) {
3430
- const r = N.get(t);
3430
+ const r = T.get(t);
3431
3431
  if (r.getValue() === e)
3432
3432
  return Promise.resolve();
3433
3433
  const i = [];
@@ -3548,10 +3548,10 @@ const m = class m {
3548
3548
  (u) => !u.hasAttribute(`${l.prefix}each-before`) && !u.hasAttribute(`${l.prefix}each-after`)
3549
3549
  );
3550
3550
  f = f.filter((u) => o.indexOf(String(u.getListKey())) === -1 ? (p.push(u.remove()), !1) : !0);
3551
- const T = f.map((u) => u.getListKey()), E = t.getChildren().filter((u) => u instanceof D).filter((u) => u.hasAttribute(`${l.prefix}each-before`)).length;
3551
+ const N = f.map((u) => u.getListKey()), E = t.getChildren().filter((u) => u instanceof D).filter((u) => u.hasAttribute(`${l.prefix}each-before`)).length;
3552
3552
  let d = Promise.resolve();
3553
3553
  return o.forEach((u, g) => {
3554
- const b = T.indexOf(u), { item: y, itemIndex: x } = a.get(u);
3554
+ const b = N.indexOf(u), { item: y, itemIndex: x } = a.get(u);
3555
3555
  let k;
3556
3556
  if (b !== -1)
3557
3557
  k = f[b], d = d.then(
@@ -3586,7 +3586,7 @@ const m = class m {
3586
3586
  }), Promise.all(p).then(() => d).then(() => {
3587
3587
  const u = o.filter(
3588
3588
  (x) => x !== null
3589
- ), g = T.filter(
3589
+ ), g = N.filter(
3590
3590
  (x) => x !== null
3591
3591
  ), b = u.filter(
3592
3592
  (x) => !g.includes(x)
@@ -3667,7 +3667,7 @@ class ut {
3667
3667
  */
3668
3668
  constructor(t = document) {
3669
3669
  this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
3670
- const e = document.documentElement, r = N.get(e);
3670
+ const e = document.documentElement, r = T.get(e);
3671
3671
  r && new V(r, "load").run();
3672
3672
  }, this.root = t;
3673
3673
  }
@@ -3694,7 +3694,7 @@ class ut {
3694
3694
  const r = this.getElementFromTarget(t.target);
3695
3695
  if (!r)
3696
3696
  return;
3697
- const i = N.get(r);
3697
+ const i = T.get(r);
3698
3698
  i && (e === "change" && i instanceof D && i.syncValue(), new V(i, e).run().catch((s) => {
3699
3699
  h.error("[Haori]", "Procedure execution error:", s);
3700
3700
  }));
@@ -3716,7 +3716,7 @@ const w = class w {
3716
3716
  }));
3717
3717
  }
3718
3718
  static syncElement(t) {
3719
- const e = w.registrations.get(t), r = N.get(t);
3719
+ const e = w.registrations.get(t), r = T.get(t);
3720
3720
  if (!r || !w.shouldObserve(r)) {
3721
3721
  e && (e.observer.disconnect(), w.registrations.delete(t));
3722
3722
  return;
@@ -3735,8 +3735,8 @@ const w = class w {
3735
3735
  const o = new IntersectionObserver(
3736
3736
  (p) => {
3737
3737
  const f = w.registrations.get(t);
3738
- f && p.forEach((T) => {
3739
- !T.isIntersecting || f.running || w.isDisabled(f.fragment) || (f.running = !0, new V(f.fragment, "intersect").runWithResult().then((E) => {
3738
+ f && p.forEach((N) => {
3739
+ !N.isIntersecting || f.running || w.isDisabled(f.fragment) || (f.running = !0, new V(f.fragment, "intersect").runWithResult().then((E) => {
3740
3740
  E && f.once && (f.observer.disconnect(), w.registrations.delete(t));
3741
3741
  }).catch((E) => {
3742
3742
  h.error(
@@ -3909,12 +3909,12 @@ const H = class H {
3909
3909
  H._initialized = !1;
3910
3910
  let G = H;
3911
3911
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", G.init) : G.init();
3912
- const ht = "0.4.0";
3912
+ const ht = "0.4.1";
3913
3913
  export {
3914
3914
  R as Core,
3915
3915
  l as Env,
3916
3916
  A as Form,
3917
- N as Fragment,
3917
+ T as Fragment,
3918
3918
  _ as Haori,
3919
3919
  h as Log,
3920
3920
  F as Queue,