@x-wave/blog 1.0.19 → 1.0.21

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.
Files changed (2) hide show
  1. package/index.js +134 -134
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs as d, jsx as e, Fragment as G } from "react/jsx-runtime";
2
2
  import { useTranslation as O } from "react-i18next";
3
3
  import { useLocation as Q, useNavigate as K, useParams as ce, Link as he, Navigate as be, Routes as ye, Route as ge } from "react-router-dom";
4
- import { useState as T, useEffect as S, createContext as Te, useContext as Pe, useRef as F } from "react";
4
+ import { useState as P, useEffect as S, createContext as Pe, useContext as Te, useRef as F } from "react";
5
5
  import Le from "react-markdown";
6
6
  import Se from "remark-gfm";
7
7
  import ne from "i18next";
@@ -52,7 +52,7 @@ function He({ hasAdvanced: t }) {
52
52
  function qe({ children: t }) {
53
53
  return /* @__PURE__ */ e("div", { className: "xw-blog-root", children: t });
54
54
  }
55
- function $e(t) {
55
+ function Ne(t) {
56
56
  function n(s) {
57
57
  const a = s.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
58
58
  if (!a) return { frontmatter: {}, content: s };
@@ -133,15 +133,15 @@ function $e(t) {
133
133
  };
134
134
  }
135
135
  function Ga(t) {
136
- const n = $e(t);
136
+ const n = Ne(t);
137
137
  return {
138
138
  mdxFiles: t,
139
139
  loadContent: n.loadMDXContent,
140
140
  loadEnglishContent: n.loadEnglishContent
141
141
  };
142
142
  }
143
- const Ne = "app-theme", xe = () => typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ve = (t) => t === "system" ? xe() : t, Fe = () => typeof window > "u" ? "system" : localStorage.getItem(Ne) || "system", Ie = () => {
144
- const [t, n] = T(Fe);
143
+ const $e = "app-theme", xe = () => typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ve = (t) => t === "system" ? xe() : t, Fe = () => typeof window > "u" ? "system" : localStorage.getItem($e) || "system", Ie = () => {
144
+ const [t, n] = P(Fe);
145
145
  return S(() => {
146
146
  const a = ve(t), r = document.querySelector(".xw-blog-root");
147
147
  if (r && (r.classList.remove("light", "dark"), r.classList.add(a)), t === "system") {
@@ -154,7 +154,7 @@ const Ne = "app-theme", xe = () => typeof window > "u" ? "light" : window.matchM
154
154
  }, [t]), {
155
155
  theme: t,
156
156
  setTheme: (a) => {
157
- localStorage.setItem(Ne, a), n(a);
157
+ localStorage.setItem($e, a), n(a);
158
158
  },
159
159
  effectiveTheme: ve(t)
160
160
  };
@@ -175,7 +175,7 @@ const Ne = "app-theme", xe = () => typeof window > "u" ? "light" : window.matchM
175
175
  ...s.showTableOfContents !== void 0 && {
176
176
  showTableOfContents: s.showTableOfContents
177
177
  }
178
- }), Z = (t) => t.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, ""), Ce = Te(null);
178
+ }), Z = (t) => t.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, ""), Ce = Pe(null);
179
179
  function Qa({
180
180
  children: t,
181
181
  config: n,
@@ -183,9 +183,9 @@ function Qa({
183
183
  navigationData: a = []
184
184
  }) {
185
185
  Ie();
186
- const [r, o] = T({});
186
+ const [r, o] = P({});
187
187
  S(() => {
188
- const { buildTagIndex: m } = $e(s.mdxFiles), h = n.supportedLanguages.map(async (v) => {
188
+ const { buildTagIndex: m } = Ne(s.mdxFiles), h = n.supportedLanguages.map(async (v) => {
189
189
  try {
190
190
  const _ = await m(v);
191
191
  return { language: v, index: _ };
@@ -216,7 +216,7 @@ function Qa({
216
216
  );
217
217
  }
218
218
  function R() {
219
- const t = Pe(Ce);
219
+ const t = Te(Ce);
220
220
  if (!t)
221
221
  throw new Error("useBlogConfig must be used within a BlogProvider");
222
222
  return t;
@@ -260,26 +260,26 @@ function rt({
260
260
  content: t,
261
261
  englishContent: n
262
262
  }) {
263
- const { t: s } = O(), a = Q(), r = K(), [o, u] = T([]), [m, h] = T(""), v = F(null);
263
+ const { t: s } = O(), a = Q(), r = K(), [o, u] = P([]), [m, h] = P(""), v = F(null);
264
264
  S(() => {
265
265
  h(""), (() => {
266
266
  const p = /^(#{1,6})\s+(.+)$/gm, i = [];
267
267
  let l = p.exec(t);
268
268
  const c = [];
269
269
  for (; l !== null; ) {
270
- const f = l[1].length, $ = l[2].trim();
271
- c.push({ level: f, text: $ }), l = p.exec(t);
270
+ const f = l[1].length, N = l[2].trim();
271
+ c.push({ level: f, text: N }), l = p.exec(t);
272
272
  }
273
273
  const w = /^(#{1,6})\s+(.+)$/gm;
274
- let I = w.exec(n), y = 0;
275
- for (; I !== null && y < c.length; ) {
276
- const f = I[2].trim(), $ = Z(f);
274
+ let I = w.exec(n), k = 0;
275
+ for (; I !== null && k < c.length; ) {
276
+ const f = I[2].trim(), N = Z(f);
277
277
  i.push({
278
- id: $,
279
- text: c[y].text,
278
+ id: N,
279
+ text: c[k].text,
280
280
  // Use localized text for display
281
- level: c[y].level
282
- }), y++, I = w.exec(n);
281
+ level: c[k].level
282
+ }), k++, I = w.exec(n);
283
283
  }
284
284
  u(i);
285
285
  })();
@@ -410,10 +410,10 @@ function bt({
410
410
  document.body
411
411
  );
412
412
  }
413
- const wt = "_tags_11t8a_1", $t = "_compact_11t8a_9", Nt = "_tagLabel_11t8a_15", xt = "_tagIcon_11t8a_25", It = "_tagList_11t8a_30", Ct = "_tag_11t8a_1", z = {
413
+ const wt = "_tags_11t8a_1", Nt = "_compact_11t8a_9", $t = "_tagLabel_11t8a_15", xt = "_tagIcon_11t8a_25", It = "_tagList_11t8a_30", Ct = "_tag_11t8a_1", z = {
414
414
  tags: wt,
415
- compact: $t,
416
- tagLabel: Nt,
415
+ compact: Nt,
416
+ tagLabel: $t,
417
417
  tagIcon: xt,
418
418
  tagList: It,
419
419
  tag: Ct
@@ -451,10 +451,10 @@ function kt({ tags: t, variant: n = "default", onTagClick: s }) {
451
451
  }
452
452
  );
453
453
  }
454
- const yt = "_contentPage_1nxj5_1", Tt = "_loadingContainer_1nxj5_48", Pt = "_errorContainer_1nxj5_49", Lt = "_skeletonTitle_1nxj5_71", St = "_skeletonParagraph_1nxj5_80", Dt = "_skeletonParagraphShort_1nxj5_93", Bt = "_errorText_1nxj5_107", Mt = "_mdxContent_1nxj5_112", Et = "_withMetadata_1nxj5_125", Ot = "_codeBlock_1nxj5_300", Rt = "_codeLanguage_1nxj5_304", B = {
454
+ const yt = "_contentPage_1nxj5_1", Pt = "_loadingContainer_1nxj5_48", Tt = "_errorContainer_1nxj5_49", Lt = "_skeletonTitle_1nxj5_71", St = "_skeletonParagraph_1nxj5_80", Dt = "_skeletonParagraphShort_1nxj5_93", Bt = "_errorText_1nxj5_107", Mt = "_mdxContent_1nxj5_112", Et = "_withMetadata_1nxj5_125", Ot = "_codeBlock_1nxj5_300", Rt = "_codeLanguage_1nxj5_304", B = {
455
455
  contentPage: yt,
456
- loadingContainer: Tt,
457
- errorContainer: Pt,
456
+ loadingContainer: Pt,
457
+ errorContainer: Tt,
458
458
  skeletonTitle: Lt,
459
459
  skeletonParagraph: St,
460
460
  skeletonParagraphShort: Dt,
@@ -466,60 +466,60 @@ const yt = "_contentPage_1nxj5_1", Tt = "_loadingContainer_1nxj5_48", Pt = "_err
466
466
  };
467
467
  function jt({ language: t }) {
468
468
  var ue;
469
- const { slug: n } = ce(), s = Q(), { config: a, loadContent: r, loadEnglishContent: o } = R(), [u, m] = T(""), [h, v] = T(""), [_, b] = T({}), [p, i] = T(!0), [l, c] = T(null), [w, I] = T(!0), [y, f] = T(null), $ = F(0), D = F([]), ee = ((g) => {
469
+ const { slug: n } = ce(), s = Q(), { config: a, loadContent: r, loadEnglishContent: o } = R(), [u, m] = P(""), [h, v] = P(""), [_, b] = P({}), [p, i] = P(!0), [l, c] = P(null), [w, I] = P(!0), [k, f] = P(null), N = F(0), D = F([]), ee = ((g) => {
470
470
  const C = {
471
471
  advanced: !1,
472
472
  anchor: ""
473
473
  };
474
474
  if (!g) return C;
475
- const N = (g.startsWith("?") ? g.substring(1) : g).split("&");
476
- for (const k of N)
477
- k === "advanced" ? C.advanced = !0 : k.startsWith("a=") && (C.anchor = k.substring(2));
475
+ const $ = (g.startsWith("?") ? g.substring(1) : g).split("&");
476
+ for (const y of $)
477
+ y === "advanced" ? C.advanced = !0 : y.startsWith("a=") && (C.anchor = y.substring(2));
478
478
  return C;
479
479
  })(s.search), A = ee.advanced;
480
480
  if (S(() => {
481
481
  (async () => {
482
482
  if (!n) return;
483
- i(!0), c(null), $.current = 0;
483
+ i(!0), c(null), N.current = 0;
484
484
  const C = (a == null ? void 0 : a.navigationData) || [];
485
485
  let L = !0;
486
- for (const N of C)
487
- if ("items" in N) {
488
- const k = N.items.find((E) => E.slug === n);
489
- if (k) {
490
- L = k.showTableOfContents !== !1;
486
+ for (const $ of C)
487
+ if ("items" in $) {
488
+ const y = $.items.find((E) => E.slug === n);
489
+ if (y) {
490
+ L = y.showTableOfContents !== !1;
491
491
  break;
492
492
  }
493
- } else if (N.slug === n) {
494
- L = N.showTableOfContents !== !1;
493
+ } else if ($.slug === n) {
494
+ L = $.showTableOfContents !== !1;
495
495
  break;
496
496
  }
497
497
  I(L);
498
498
  try {
499
- let N;
499
+ let $;
500
500
  try {
501
- N = await r(t, n, A);
501
+ $ = await r(t, n, A);
502
502
  } catch {
503
503
  if (A)
504
- N = await r(t, n, !1);
504
+ $ = await r(t, n, !1);
505
505
  else
506
506
  throw new Error("Content not found");
507
507
  }
508
- let k = "";
508
+ let y = "";
509
509
  try {
510
- k = await o(n, A);
510
+ y = await o(n, A);
511
511
  } catch {
512
- A && (k = await o(n, !1));
512
+ A && (y = await o(n, !1));
513
513
  }
514
514
  const E = /^(#{1,6})\s+(.+)$/gm, X = [];
515
- let U = E.exec(k);
515
+ let U = E.exec(y);
516
516
  for (; U !== null; ) {
517
517
  const ke = U[2].trim();
518
- X.push(ke), U = E.exec(k);
518
+ X.push(ke), U = E.exec(y);
519
519
  }
520
- D.current = X, v(k), m(N.content), b(N.frontmatter);
521
- } catch (N) {
522
- c(N instanceof Error ? N.message : "Failed to load content");
520
+ D.current = X, v(y), m($.content), b($.frontmatter);
521
+ } catch ($) {
522
+ c($ instanceof Error ? $.message : "Failed to load content");
523
523
  } finally {
524
524
  i(!1);
525
525
  }
@@ -536,9 +536,9 @@ function jt({ language: t }) {
536
536
  const g = setTimeout(() => {
537
537
  const C = document.getElementById(ee.anchor);
538
538
  if (C) {
539
- const k = C.getBoundingClientRect().top + window.pageYOffset - 80;
539
+ const y = C.getBoundingClientRect().top + window.pageYOffset - 80;
540
540
  window.scrollTo({
541
- top: k,
541
+ top: y,
542
542
  behavior: "smooth"
543
543
  });
544
544
  }
@@ -557,7 +557,7 @@ function jt({ language: t }) {
557
557
  "Error: ",
558
558
  l
559
559
  ] }) }) });
560
- $.current = 0;
560
+ N.current = 0;
561
561
  let de = !1;
562
562
  return /* @__PURE__ */ d(G, { children: [
563
563
  /* @__PURE__ */ d("div", { className: B.contentPage, children: [
@@ -568,14 +568,14 @@ function jt({ language: t }) {
568
568
  remarkPlugins: [Se],
569
569
  components: {
570
570
  h1: ({ children: g }) => {
571
- const C = $.current++, L = D.current[C] || "", N = Z(L), k = A ? `?advanced&a=${N}` : `?a=${N}`, E = `#/${t}/${n}${k}`, X = !de;
571
+ const C = N.current++, L = D.current[C] || "", $ = Z(L), E = A ? `?advanced&a=${$}` : `?a=${$}`, X = !de;
572
572
  de = !0;
573
573
  const U = _.date || _.author;
574
574
  return /* @__PURE__ */ d(G, { children: [
575
575
  /* @__PURE__ */ e(
576
576
  "h1",
577
577
  {
578
- id: N,
578
+ id: $,
579
579
  className: X && U ? B.withMetadata : void 0,
580
580
  children: /* @__PURE__ */ e(
581
581
  "a",
@@ -597,8 +597,8 @@ function jt({ language: t }) {
597
597
  ] });
598
598
  },
599
599
  h2: ({ children: g }) => {
600
- const C = $.current++, L = D.current[C] || "", N = Z(L), k = A ? `?advanced&a=${N}` : `?a=${N}`, E = `#/${t}/${n}${k}`;
601
- return /* @__PURE__ */ e("h2", { id: N, children: /* @__PURE__ */ e(
600
+ const C = N.current++, L = D.current[C] || "", $ = Z(L), E = A ? `?advanced&a=${$}` : `?a=${$}`;
601
+ return /* @__PURE__ */ e("h2", { id: $, children: /* @__PURE__ */ e(
602
602
  "a",
603
603
  {
604
604
  href: E,
@@ -608,8 +608,8 @@ function jt({ language: t }) {
608
608
  ) });
609
609
  },
610
610
  h3: ({ children: g }) => {
611
- const C = $.current++, L = D.current[C] || "", N = Z(L), k = A ? `?advanced&a=${N}` : `?a=${N}`, E = `#/${t}/${n}${k}`;
612
- return /* @__PURE__ */ e("h3", { id: N, children: /* @__PURE__ */ e(
611
+ const C = N.current++, L = D.current[C] || "", $ = Z(L), E = A ? `?advanced&a=${$}` : `?a=${$}`;
612
+ return /* @__PURE__ */ e("h3", { id: $, children: /* @__PURE__ */ e(
613
613
  "a",
614
614
  {
615
615
  href: E,
@@ -619,8 +619,8 @@ function jt({ language: t }) {
619
619
  ) });
620
620
  },
621
621
  h4: ({ children: g }) => {
622
- const C = $.current++, L = D.current[C] || "", N = Z(L), k = A ? `?advanced&a=${N}` : `?a=${N}`, E = `#/${t}/${n}${k}`;
623
- return /* @__PURE__ */ e("h4", { id: N, children: /* @__PURE__ */ e(
622
+ const C = N.current++, L = D.current[C] || "", $ = Z(L), E = A ? `?advanced&a=${$}` : `?a=${$}`;
623
+ return /* @__PURE__ */ e("h4", { id: $, children: /* @__PURE__ */ e(
624
624
  "a",
625
625
  {
626
626
  href: E,
@@ -630,11 +630,11 @@ function jt({ language: t }) {
630
630
  ) });
631
631
  },
632
632
  h5: ({ children: g }) => {
633
- const C = `h5-${$.current++}`;
633
+ const C = `h5-${N.current++}`;
634
634
  return /* @__PURE__ */ e("h5", { id: C, children: g });
635
635
  },
636
636
  h6: ({ children: g }) => {
637
- const C = `h6-${$.current++}`;
637
+ const C = `h6-${N.current++}`;
638
638
  return /* @__PURE__ */ e("h6", { id: C, children: g });
639
639
  },
640
640
  p: ({ children: g }) => /* @__PURE__ */ e("p", { children: g }),
@@ -644,9 +644,9 @@ function jt({ language: t }) {
644
644
  code: ({ className: g, children: C, ...L }) => {
645
645
  if (!g)
646
646
  return /* @__PURE__ */ e("code", { ...L, children: C });
647
- const k = (g == null ? void 0 : g.replace("language-", "")) || "";
647
+ const y = (g == null ? void 0 : g.replace("language-", "")) || "";
648
648
  return /* @__PURE__ */ d("div", { className: B.codeBlock, children: [
649
- k && /* @__PURE__ */ e("div", { className: B.codeLanguage, children: k }),
649
+ y && /* @__PURE__ */ e("div", { className: B.codeLanguage, children: y }),
650
650
  /* @__PURE__ */ e("pre", { children: /* @__PURE__ */ e("code", { className: g, ...L, children: C }) })
651
651
  ] });
652
652
  },
@@ -655,8 +655,8 @@ function jt({ language: t }) {
655
655
  blockquote: ({ children: g }) => /* @__PURE__ */ e("blockquote", { children: g }),
656
656
  a: ({ href: g, children: C, ...L }) => {
657
657
  if (g != null && g.startsWith("./")) {
658
- const N = g.slice(2), k = `#/${t}/${N}`;
659
- return /* @__PURE__ */ e("a", { href: k, ...L, children: C });
658
+ const $ = g.slice(2), y = `#/${t}/${$}`;
659
+ return /* @__PURE__ */ e("a", { href: y, ...L, children: C });
660
660
  }
661
661
  return g != null && g.startsWith("http://") || g != null && g.startsWith("https://") ? /* @__PURE__ */ e(
662
662
  "a",
@@ -685,18 +685,18 @@ function jt({ language: t }) {
685
685
  )
686
686
  ] }),
687
687
  w && /* @__PURE__ */ e(rt, { content: u, englishContent: h }),
688
- y && ((ue = a.tagIndex) == null ? void 0 : ue[t]) && /* @__PURE__ */ e(
688
+ k && ((ue = a.tagIndex) == null ? void 0 : ue[t]) && /* @__PURE__ */ e(
689
689
  bt,
690
690
  {
691
- tag: y,
692
- results: a.tagIndex[t][y] || [],
691
+ tag: k,
692
+ results: a.tagIndex[t][k] || [],
693
693
  language: t,
694
694
  onClose: () => f(null)
695
695
  }
696
696
  )
697
697
  ] });
698
698
  }
699
- const At = "_searchButton_1k9sl_1", Wt = "_searchIcon_1k9sl_17", Ht = "_searchHint_1k9sl_23", qt = "_kbd_1k9sl_27", Ft = "_searchOverlay_1k9sl_42", Kt = "_searchModal_1k9sl_67", Ut = "_searchHeader_1k9sl_91", zt = "_searchInput_1k9sl_105", Gt = "_closeButton_1k9sl_123", Qt = "_searchResults_1k9sl_144", Xt = "_resultsList_1k9sl_152", Yt = "_resultItem_1k9sl_158", Vt = "_selected_1k9sl_173", Jt = "_resultTitle_1k9sl_176", Zt = "_resultSlug_1k9sl_180", en = "_noResults_1k9sl_186", tn = "_searchHints_1k9sl_193", nn = "_hint_1k9sl_210", P = {
699
+ const At = "_searchButton_1k9sl_1", Wt = "_searchIcon_1k9sl_17", Ht = "_searchHint_1k9sl_23", qt = "_kbd_1k9sl_27", Ft = "_searchOverlay_1k9sl_42", Kt = "_searchModal_1k9sl_67", Ut = "_searchHeader_1k9sl_91", zt = "_searchInput_1k9sl_105", Gt = "_closeButton_1k9sl_123", Qt = "_searchResults_1k9sl_144", Xt = "_resultsList_1k9sl_152", Yt = "_resultItem_1k9sl_158", Vt = "_selected_1k9sl_173", Jt = "_resultTitle_1k9sl_176", Zt = "_resultSlug_1k9sl_180", en = "_noResults_1k9sl_186", tn = "_searchHints_1k9sl_193", nn = "_hint_1k9sl_210", T = {
700
700
  searchButton: At,
701
701
  searchIcon: Wt,
702
702
  searchHint: Ht,
@@ -717,25 +717,25 @@ const At = "_searchButton_1k9sl_1", Wt = "_searchIcon_1k9sl_17", Ht = "_searchHi
717
717
  hint: nn
718
718
  };
719
719
  function an({ language: t }) {
720
- const { t: n } = O(), s = K(), { config: a } = R(), [r, o] = T(!1), [u, m] = T(""), [h, v] = T([]), [_, b] = T(0), p = F(null), i = F(null), c = typeof navigator < "u" && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘K" : "Ctrl+K", w = (a.navigationData ? te(a.navigationData, t) : []).flatMap((f) => "items" in f ? f.items.map(($) => ({
721
- title: $.title,
722
- slug: $.slug
720
+ const { t: n } = O(), s = K(), { config: a } = R(), [r, o] = P(!1), [u, m] = P(""), [h, v] = P([]), [_, b] = P(0), p = F(null), i = F(null), c = typeof navigator < "u" && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘K" : "Ctrl+K", w = (a.navigationData ? te(a.navigationData, t) : []).flatMap((f) => "items" in f ? f.items.map((N) => ({
721
+ title: N.title,
722
+ slug: N.slug
723
723
  })) : [{ title: f.title, slug: f.slug }]);
724
724
  S(() => {
725
725
  if (!u.trim()) {
726
726
  v([]), b(0);
727
727
  return;
728
728
  }
729
- const f = u.toLowerCase(), $ = w.filter(
729
+ const f = u.toLowerCase(), N = w.filter(
730
730
  (D) => D.title.toLowerCase().includes(f) || D.slug.toLowerCase().includes(f)
731
731
  );
732
- v($), b(0);
732
+ v(N), b(0);
733
733
  }, [u]), S(() => {
734
- const f = ($) => {
735
- ($.metaKey || $.ctrlKey) && $.key === "k" && ($.preventDefault(), o(!0), setTimeout(() => {
734
+ const f = (N) => {
735
+ (N.metaKey || N.ctrlKey) && N.key === "k" && (N.preventDefault(), o(!0), setTimeout(() => {
736
736
  var D;
737
737
  return (D = p.current) == null ? void 0 : D.focus();
738
- }, 100)), $.key === "Escape" && r && (o(!1), m(""));
738
+ }, 100)), N.key === "Escape" && r && (o(!1), m(""));
739
739
  };
740
740
  return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
741
741
  }, [r]), S(() => {
@@ -744,32 +744,32 @@ function an({ language: t }) {
744
744
  var D;
745
745
  return (D = p.current) == null ? void 0 : D.focus();
746
746
  }, 100);
747
- }, $ = () => {
747
+ }, N = () => {
748
748
  o(!1), m("");
749
749
  };
750
- return window.addEventListener("blog:open-search", f), window.addEventListener("blog:close-search", $), () => {
751
- window.removeEventListener("blog:open-search", f), window.removeEventListener("blog:close-search", $);
750
+ return window.addEventListener("blog:open-search", f), window.addEventListener("blog:close-search", N), () => {
751
+ window.removeEventListener("blog:open-search", f), window.removeEventListener("blog:close-search", N);
752
752
  };
753
753
  }, []);
754
754
  const I = (f) => {
755
- f.key === "ArrowDown" ? (f.preventDefault(), b(($) => Math.min($ + 1, h.length - 1))) : f.key === "ArrowUp" ? (f.preventDefault(), b(($) => Math.max($ - 1, 0))) : f.key === "Enter" && h[_] && (f.preventDefault(), y(h[_].slug));
755
+ f.key === "ArrowDown" ? (f.preventDefault(), b((N) => Math.min(N + 1, h.length - 1))) : f.key === "ArrowUp" ? (f.preventDefault(), b((N) => Math.max(N - 1, 0))) : f.key === "Enter" && h[_] && (f.preventDefault(), k(h[_].slug));
756
756
  };
757
757
  S(() => {
758
- const f = ($) => {
759
- i.current && !i.current.contains($.target) && (o(!1), m(""));
758
+ const f = (N) => {
759
+ i.current && !i.current.contains(N.target) && (o(!1), m(""));
760
760
  };
761
761
  return r && document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
762
762
  }, [r]);
763
- const y = (f) => {
764
- const $ = a.basePath || "";
765
- s(`${$}/${t}/${f}`), o(!1), m("");
763
+ const k = (f) => {
764
+ const N = a.basePath || "";
765
+ s(`${N}/${t}/${f}`), o(!1), m("");
766
766
  };
767
767
  return /* @__PURE__ */ d(G, { children: [
768
768
  /* @__PURE__ */ d(
769
769
  "button",
770
770
  {
771
771
  type: "button",
772
- className: P.searchButton,
772
+ className: T.searchButton,
773
773
  onClick: () => {
774
774
  o(!0), setTimeout(() => {
775
775
  var f;
@@ -778,9 +778,9 @@ function an({ language: t }) {
778
778
  },
779
779
  "aria-label": n("ui.search"),
780
780
  children: [
781
- /* @__PURE__ */ e(me, { className: P.searchIcon }),
782
- /* @__PURE__ */ e("span", { className: P.searchHint, children: n("ui.search") }),
783
- /* @__PURE__ */ e("kbd", { className: P.kbd, children: c })
781
+ /* @__PURE__ */ e(me, { className: T.searchIcon }),
782
+ /* @__PURE__ */ e("span", { className: T.searchHint, children: n("ui.search") }),
783
+ /* @__PURE__ */ e("kbd", { className: T.kbd, children: c })
784
784
  ]
785
785
  }
786
786
  ),
@@ -788,25 +788,25 @@ function an({ language: t }) {
788
788
  /* @__PURE__ */ e(
789
789
  "div",
790
790
  {
791
- className: P.searchOverlay,
791
+ className: T.searchOverlay,
792
792
  onClick: () => {
793
793
  o(!1), m("");
794
794
  },
795
795
  children: /* @__PURE__ */ d(
796
796
  "div",
797
797
  {
798
- className: P.searchModal,
798
+ className: T.searchModal,
799
799
  ref: i,
800
800
  onClick: (f) => f.stopPropagation(),
801
801
  children: [
802
- /* @__PURE__ */ d("div", { className: P.searchHeader, children: [
803
- /* @__PURE__ */ e(me, { className: P.searchIcon }),
802
+ /* @__PURE__ */ d("div", { className: T.searchHeader, children: [
803
+ /* @__PURE__ */ e(me, { className: T.searchIcon }),
804
804
  /* @__PURE__ */ e(
805
805
  "input",
806
806
  {
807
807
  ref: p,
808
808
  type: "text",
809
- className: P.searchInput,
809
+ className: T.searchInput,
810
810
  placeholder: n("ui.searchPlaceholder"),
811
811
  value: u,
812
812
  onChange: (f) => m(f.target.value),
@@ -817,7 +817,7 @@ function an({ language: t }) {
817
817
  "button",
818
818
  {
819
819
  type: "button",
820
- className: P.closeButton,
820
+ className: T.closeButton,
821
821
  onClick: () => {
822
822
  o(!1), m("");
823
823
  },
@@ -826,33 +826,33 @@ function an({ language: t }) {
826
826
  }
827
827
  )
828
828
  ] }),
829
- u && /* @__PURE__ */ e("div", { className: P.searchResults, children: h.length === 0 ? /* @__PURE__ */ e("div", { className: P.noResults, children: n("ui.noSearchResults") }) : /* @__PURE__ */ e("ul", { className: P.resultsList, children: h.map((f, $) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
829
+ u && /* @__PURE__ */ e("div", { className: T.searchResults, children: h.length === 0 ? /* @__PURE__ */ e("div", { className: T.noResults, children: n("ui.noSearchResults") }) : /* @__PURE__ */ e("ul", { className: T.resultsList, children: h.map((f, N) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
830
830
  "button",
831
831
  {
832
832
  type: "button",
833
- className: `${P.resultItem} ${$ === _ ? P.selected : ""}`,
834
- onClick: () => y(f.slug),
835
- onMouseEnter: () => b($),
833
+ className: `${T.resultItem} ${N === _ ? T.selected : ""}`,
834
+ onClick: () => k(f.slug),
835
+ onMouseEnter: () => b(N),
836
836
  children: [
837
- /* @__PURE__ */ e("div", { className: P.resultTitle, children: f.title }),
838
- /* @__PURE__ */ d("div", { className: P.resultSlug, children: [
837
+ /* @__PURE__ */ e("div", { className: T.resultTitle, children: f.title }),
838
+ /* @__PURE__ */ d("div", { className: T.resultSlug, children: [
839
839
  "/",
840
840
  f.slug
841
841
  ] })
842
842
  ]
843
843
  }
844
844
  ) }, f.slug)) }) }),
845
- !u && /* @__PURE__ */ d("div", { className: P.searchHints, children: [
846
- /* @__PURE__ */ d("div", { className: P.hint, children: [
845
+ !u && /* @__PURE__ */ d("div", { className: T.searchHints, children: [
846
+ /* @__PURE__ */ d("div", { className: T.hint, children: [
847
847
  /* @__PURE__ */ e("kbd", { children: "↑" }),
848
848
  /* @__PURE__ */ e("kbd", { children: "↓" }),
849
849
  /* @__PURE__ */ e("span", { children: n("ui.searchNavigate") })
850
850
  ] }),
851
- /* @__PURE__ */ d("div", { className: P.hint, children: [
851
+ /* @__PURE__ */ d("div", { className: T.hint, children: [
852
852
  /* @__PURE__ */ e("kbd", { children: "↵" }),
853
853
  /* @__PURE__ */ e("span", { children: n("ui.searchSelect") })
854
854
  ] }),
855
- /* @__PURE__ */ d("div", { className: P.hint, children: [
855
+ /* @__PURE__ */ d("div", { className: T.hint, children: [
856
856
  /* @__PURE__ */ e("kbd", { children: "esc" }),
857
857
  /* @__PURE__ */ e("span", { children: n("ui.searchClose") })
858
858
  ] })
@@ -866,7 +866,7 @@ function an({ language: t }) {
866
866
  )
867
867
  ] });
868
868
  }
869
- const on = "_header_jrobc_1", sn = "_container_jrobc_24", cn = "_content_jrobc_36", rn = "_leftSection_jrobc_43", ln = "_mobileMenuButton_jrobc_49", dn = "_burgerIcon_jrobc_87", un = "_logo_jrobc_92", hn = "_nav_jrobc_98", gn = "_navLink_jrobc_109", mn = "_externalIcon_jrobc_135", _n = "_supportDropdown_jrobc_141", pn = "_themeDropdown_jrobc_145", fn = "_themeButton_jrobc_149", vn = "_themeIcon_jrobc_171", bn = "_supportButton_jrobc_177", wn = "_caretIcon_jrobc_198", $n = "_dropdownMenu_jrobc_208", Nn = "_dropdownItem_jrobc_221", xn = "_dropdownIcon_jrobc_244", x = {
869
+ const on = "_header_jrobc_1", sn = "_container_jrobc_24", cn = "_content_jrobc_36", rn = "_leftSection_jrobc_43", ln = "_mobileMenuButton_jrobc_49", dn = "_burgerIcon_jrobc_87", un = "_logo_jrobc_92", hn = "_nav_jrobc_98", gn = "_navLink_jrobc_109", mn = "_externalIcon_jrobc_135", _n = "_supportDropdown_jrobc_141", pn = "_themeDropdown_jrobc_145", fn = "_themeButton_jrobc_149", vn = "_themeIcon_jrobc_171", bn = "_supportButton_jrobc_177", wn = "_caretIcon_jrobc_198", Nn = "_dropdownMenu_jrobc_208", $n = "_dropdownItem_jrobc_221", xn = "_dropdownIcon_jrobc_244", x = {
870
870
  header: on,
871
871
  container: sn,
872
872
  content: cn,
@@ -883,12 +883,12 @@ const on = "_header_jrobc_1", sn = "_container_jrobc_24", cn = "_content_jrobc_3
883
883
  themeIcon: vn,
884
884
  supportButton: bn,
885
885
  caretIcon: wn,
886
- dropdownMenu: $n,
887
- dropdownItem: Nn,
886
+ dropdownMenu: Nn,
887
+ dropdownItem: $n,
888
888
  dropdownIcon: xn
889
889
  };
890
890
  function In({ onMobileMenuToggle: t }) {
891
- const { t: n, i18n: s } = O(), { config: a } = R(), r = a.header ?? {}, o = r.navLinks ?? [], u = r.dropdownItems ?? [], [m, h] = T(!1), [v, _] = T(!1), { theme: b, setTheme: p } = Ie(), i = F(null), l = F(null);
891
+ const { t: n, i18n: s } = O(), { config: a } = R(), r = a.header ?? {}, o = r.navLinks ?? [], u = r.dropdownItems ?? [], [m, h] = P(!1), [v, _] = P(!1), { theme: b, setTheme: p } = Ie(), i = F(null), l = F(null);
892
892
  return S(() => {
893
893
  const c = (w) => {
894
894
  i.current && !i.current.contains(w.target) && h(!1), l.current && !l.current.contains(w.target) && _(!1);
@@ -989,13 +989,13 @@ function In({ onMobileMenuToggle: t }) {
989
989
  }
990
990
  ),
991
991
  m && /* @__PURE__ */ e("div", { className: x.dropdownMenu, children: u.map((c, w) => {
992
- const I = c.target ?? (c.url.startsWith("http") ? "_blank" : "_self"), y = c.rel ?? (I === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
992
+ const I = c.target ?? (c.url.startsWith("http") ? "_blank" : "_self"), k = c.rel ?? (I === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
993
993
  return /* @__PURE__ */ d(
994
994
  "a",
995
995
  {
996
996
  href: c.url,
997
997
  target: I,
998
- rel: y,
998
+ rel: k,
999
999
  className: x.dropdownItem,
1000
1000
  children: [
1001
1001
  f && /* @__PURE__ */ e(f, { className: x.dropdownIcon }),
@@ -1007,13 +1007,13 @@ function In({ onMobileMenuToggle: t }) {
1007
1007
  }) })
1008
1008
  ] }),
1009
1009
  o.map((c, w) => {
1010
- const I = c.target ?? (typeof c.url == "string" && c.url.startsWith("http") ? "_blank" : "_self"), y = c.rel ?? (I === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
1010
+ const I = c.target ?? (typeof c.url == "string" && c.url.startsWith("http") ? "_blank" : "_self"), k = c.rel ?? (I === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
1011
1011
  return /* @__PURE__ */ d(
1012
1012
  "a",
1013
1013
  {
1014
1014
  href: c.url,
1015
1015
  target: I,
1016
- rel: y,
1016
+ rel: k,
1017
1017
  className: c.className ?? x.navLink,
1018
1018
  children: [
1019
1019
  c.label,
@@ -1031,15 +1031,15 @@ function le({
1031
1031
  styles: t,
1032
1032
  onLanguageChange: n
1033
1033
  }) {
1034
- const { i18n: s } = O(), a = Q(), r = K(), { config: o } = R(), [u, m] = T(!1), h = F(null), v = s.language, _ = (p) => {
1034
+ const { i18n: s } = O(), a = Q(), r = K(), { config: o } = R(), [u, m] = P(!1), h = F(null), v = s.language, _ = (p) => {
1035
1035
  const i = o.basePath || "";
1036
1036
  let l = a.pathname;
1037
1037
  i && l.startsWith(i) && (l = l.slice(i.length));
1038
1038
  const c = l.split("/").filter(Boolean), w = c[0];
1039
1039
  let I = "";
1040
1040
  o.supportedLanguages.includes(w) ? (c[0] = p, I = `${i}/${c.join("/")}`) : I = `${i}/${p}${l}`;
1041
- const y = I + a.search + a.hash;
1042
- s.changeLanguage(p), r(y), m(!1), n == null || n();
1041
+ const k = I + a.search + a.hash;
1042
+ s.changeLanguage(p), r(k), m(!1), n == null || n();
1043
1043
  };
1044
1044
  S(() => {
1045
1045
  const p = (i) => {
@@ -1079,13 +1079,13 @@ function le({
1079
1079
  ] });
1080
1080
  }
1081
1081
  function ie({ styles: t, onLinkClick: n }) {
1082
- const { i18n: s } = O(), a = Q(), { config: r } = R(), [o, u] = T(() => {
1082
+ const { i18n: s } = O(), a = Q(), { config: r } = R(), [o, u] = P(() => {
1083
1083
  if (!r.navigationData) return {};
1084
1084
  const i = s.language;
1085
1085
  return te(r.navigationData, i).reduce(
1086
1086
  (c, w, I) => {
1087
1087
  if (V(w)) {
1088
- const y = r.navigationData[I], f = V(y) && y.defaultOpen === !0;
1088
+ const k = r.navigationData[I], f = V(k) && k.defaultOpen === !0;
1089
1089
  c[w.title] = f;
1090
1090
  }
1091
1091
  return c;
@@ -1101,7 +1101,7 @@ function ie({ styles: t, onLinkClick: n }) {
1101
1101
  ).reduce(
1102
1102
  (c, w, I) => {
1103
1103
  if (V(w)) {
1104
- const y = r.navigationData[I], f = V(y) && y.defaultOpen === !0;
1104
+ const k = r.navigationData[I], f = V(k) && k.defaultOpen === !0;
1105
1105
  c[w.title] = f;
1106
1106
  }
1107
1107
  return c;
@@ -1174,12 +1174,12 @@ function Xa({
1174
1174
  /* @__PURE__ */ e(ie, { styles: t, onLinkClick: n })
1175
1175
  ] });
1176
1176
  }
1177
- const Cn = "_backdrop_1a7pu_1", kn = "_open_1a7pu_13", yn = "_mobileMenu_1a7pu_18", Tn = "_header_1a7pu_37", Pn = "_brand_1a7pu_46", Ln = "_cloudIcon_1a7pu_53", Sn = "_title_1a7pu_62", Dn = "_closeButton_1a7pu_69", Bn = "_closeIcon_1a7pu_101", Mn = "_languageSection_1a7pu_106", En = "_languageSelect_1a7pu_112", On = "_languageButton_1a7pu_117", Rn = "_icon_1a7pu_156", jn = "_chevron_1a7pu_162", An = "_languageDropdown_1a7pu_172", Wn = "_languageOption_1a7pu_185", Hn = "_selected_1a7pu_226", qn = "_scrollArea_1a7pu_231", Fn = "_navigation_1a7pu_237", Kn = "_section_1a7pu_241", Un = "_sectionButton_1a7pu_245", zn = "_expanded_1a7pu_285", Gn = "_sectionItems_1a7pu_289", Qn = "_navItem_1a7pu_297", Xn = "_active_1a7pu_310", Yn = "_navItemContent_1a7pu_316", Vn = "_navItemTitle_1a7pu_322", M = {
1177
+ const Cn = "_backdrop_1a7pu_1", kn = "_open_1a7pu_13", yn = "_mobileMenu_1a7pu_18", Pn = "_header_1a7pu_37", Tn = "_brand_1a7pu_46", Ln = "_cloudIcon_1a7pu_53", Sn = "_title_1a7pu_62", Dn = "_closeButton_1a7pu_69", Bn = "_closeIcon_1a7pu_101", Mn = "_languageSection_1a7pu_106", En = "_languageSelect_1a7pu_112", On = "_languageButton_1a7pu_117", Rn = "_icon_1a7pu_156", jn = "_chevron_1a7pu_162", An = "_languageDropdown_1a7pu_172", Wn = "_languageOption_1a7pu_185", Hn = "_selected_1a7pu_226", qn = "_scrollArea_1a7pu_231", Fn = "_navigation_1a7pu_237", Kn = "_section_1a7pu_241", Un = "_sectionButton_1a7pu_245", zn = "_expanded_1a7pu_285", Gn = "_sectionItems_1a7pu_289", Qn = "_navItem_1a7pu_297", Xn = "_active_1a7pu_310", Yn = "_navItemContent_1a7pu_316", Vn = "_navItemTitle_1a7pu_322", M = {
1178
1178
  backdrop: Cn,
1179
1179
  open: kn,
1180
1180
  mobileMenu: yn,
1181
- header: Tn,
1182
- brand: Pn,
1181
+ header: Pn,
1182
+ brand: Tn,
1183
1183
  cloudIcon: Ln,
1184
1184
  title: Sn,
1185
1185
  closeButton: Dn,
@@ -1278,15 +1278,15 @@ function wa() {
1278
1278
  /* @__PURE__ */ e("div", { className: q.scrollArea, children: /* @__PURE__ */ e(ie, { styles: q }) })
1279
1279
  ] });
1280
1280
  }
1281
- const $a = "_app_wf6ni_1", Na = "_layout_wf6ni_9", xa = "_main_wf6ni_15", Ia = "_fullWidth_wf6ni_21", Ca = "_contentWrapper_wf6ni_30", J = {
1282
- app: $a,
1283
- layout: Na,
1281
+ const Na = "_app_wf6ni_1", $a = "_layout_wf6ni_9", xa = "_main_wf6ni_15", Ia = "_fullWidth_wf6ni_21", Ca = "_contentWrapper_wf6ni_30", J = {
1282
+ app: Na,
1283
+ layout: $a,
1284
1284
  main: xa,
1285
1285
  fullWidth: Ia,
1286
1286
  contentWrapper: Ca
1287
1287
  };
1288
1288
  function ka({ children: t }) {
1289
- const { language: n } = ce(), { i18n: s } = O(), { config: a } = R(), [r, o] = T(!1);
1289
+ const { language: n } = ce(), { i18n: s } = O(), { config: a } = R(), [r, o] = P(!1);
1290
1290
  S(() => {
1291
1291
  n && a.supportedLanguages.includes(n) && s.changeLanguage(n);
1292
1292
  }, [n, s, a.supportedLanguages]);
@@ -1297,7 +1297,7 @@ function ka({ children: t }) {
1297
1297
  };
1298
1298
  if (!n || !a.supportedLanguages.includes(n))
1299
1299
  return /* @__PURE__ */ e(be, { to: "/en/welcome", replace: !0 });
1300
- const h = !!a.header, v = !!a.navigationData && a.navigationData.length > 0, _ = a.contentMaxWidth ? { width: "100%", maxWidth: a.contentMaxWidth } : void 0;
1300
+ const h = !!a.header, v = a.showSideMenu !== !1, _ = a.contentMaxWidth ? { width: "100%", maxWidth: a.contentMaxWidth } : void 0;
1301
1301
  return /* @__PURE__ */ d("div", { className: J.app, children: [
1302
1302
  h && /* @__PURE__ */ e(In, { onMobileMenuToggle: u }),
1303
1303
  /* @__PURE__ */ e(Jn, { isOpen: r, onClose: m }),
@@ -1313,10 +1313,10 @@ function ka({ children: t }) {
1313
1313
  ] })
1314
1314
  ] });
1315
1315
  }
1316
- const ya = "_homePage_1lc5u_1", Ta = "_header_1lc5u_20", Pa = "_title_1lc5u_24", La = "_articlesList_1lc5u_31", Sa = "_articleCard_1lc5u_37", Da = "_articleTitle_1lc5u_56", Ba = "_articleDescription_1lc5u_63", Ma = "_loading_1lc5u_70", Ea = "_empty_1lc5u_71", H = {
1316
+ const ya = "_homePage_1lc5u_1", Pa = "_header_1lc5u_20", Ta = "_title_1lc5u_24", La = "_articlesList_1lc5u_31", Sa = "_articleCard_1lc5u_37", Da = "_articleTitle_1lc5u_56", Ba = "_articleDescription_1lc5u_63", Ma = "_loading_1lc5u_70", Ea = "_empty_1lc5u_71", H = {
1317
1317
  homePage: ya,
1318
- header: Ta,
1319
- title: Pa,
1318
+ header: Pa,
1319
+ title: Ta,
1320
1320
  articlesList: La,
1321
1321
  articleCard: Sa,
1322
1322
  articleTitle: Da,
@@ -1325,7 +1325,7 @@ const ya = "_homePage_1lc5u_1", Ta = "_header_1lc5u_20", Pa = "_title_1lc5u_24",
1325
1325
  empty: Ea
1326
1326
  };
1327
1327
  function Oa() {
1328
- const { i18n: t, t: n } = O(), { config: s, loadContent: a } = R(), r = K(), [o, u] = T([]), [m, h] = T(!0);
1328
+ const { i18n: t, t: n } = O(), { config: s, loadContent: a } = R(), r = K(), [o, u] = P([]), [m, h] = P(!0);
1329
1329
  S(() => {
1330
1330
  (async () => {
1331
1331
  try {
@@ -1447,7 +1447,7 @@ export {
1447
1447
  bt as TagResultsModal,
1448
1448
  kt as Tags,
1449
1449
  Ga as createBlogUtils,
1450
- $e as createContentLoaders,
1450
+ Ne as createContentLoaders,
1451
1451
  Z as generateHeadingId,
1452
1452
  te as getNavigationData,
1453
1453
  R as useBlogConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-wave/blog",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {