@x-wave/blog 1.0.17 → 1.0.19

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 +66 -66
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -124,7 +124,7 @@ function $e(t) {
124
124
  const c = v.tags;
125
125
  if (c && Array.isArray(c))
126
126
  for (const w of c)
127
- a[w] || (a[w] = []), a[w].some((x) => x.slug === p) || a[w].push({ slug: p, title: l });
127
+ a[w] || (a[w] = []), a[w].some((I) => I.slug === p) || a[w].push({ slug: p, title: l });
128
128
  } catch (m) {
129
129
  console.warn(`Failed to process ${u}:`, m);
130
130
  }
@@ -140,13 +140,13 @@ function Ga(t) {
140
140
  loadEnglishContent: n.loadEnglishContent
141
141
  };
142
142
  }
143
- const Ne = "app-theme", Ie = () => typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ve = (t) => t === "system" ? Ie() : t, Fe = () => typeof window > "u" ? "system" : localStorage.getItem(Ne) || "system", xe = () => {
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
144
  const [t, n] = T(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") {
148
148
  const o = window.matchMedia("(prefers-color-scheme: dark)"), u = () => {
149
- const m = Ie(), h = document.querySelector(".xw-blog-root");
149
+ const m = xe(), h = document.querySelector(".xw-blog-root");
150
150
  h && (h.classList.remove("light", "dark"), h.classList.add(m));
151
151
  };
152
152
  return o.addEventListener("change", u), () => o.removeEventListener("change", u);
@@ -182,7 +182,7 @@ function Qa({
182
182
  blog: s,
183
183
  navigationData: a = []
184
184
  }) {
185
- xe();
185
+ Ie();
186
186
  const [r, o] = T({});
187
187
  S(() => {
188
188
  const { buildTagIndex: m } = $e(s.mdxFiles), h = n.supportedLanguages.map(async (v) => {
@@ -271,15 +271,15 @@ function rt({
271
271
  c.push({ level: f, text: $ }), l = p.exec(t);
272
272
  }
273
273
  const w = /^(#{1,6})\s+(.+)$/gm;
274
- let x = w.exec(n), y = 0;
275
- for (; x !== null && y < c.length; ) {
276
- const f = x[2].trim(), $ = Z(f);
274
+ let I = w.exec(n), y = 0;
275
+ for (; I !== null && y < c.length; ) {
276
+ const f = I[2].trim(), $ = Z(f);
277
277
  i.push({
278
278
  id: $,
279
279
  text: c[y].text,
280
280
  // Use localized text for display
281
281
  level: c[y].level
282
- }), y++, x = w.exec(n);
282
+ }), y++, I = w.exec(n);
283
283
  }
284
284
  u(i);
285
285
  })();
@@ -301,7 +301,7 @@ function rt({
301
301
  (i) => {
302
302
  const l = i.filter((c) => c.isIntersecting);
303
303
  if (l.length > 0) {
304
- const c = l.reduce((w, x) => w.boundingClientRect.top < x.boundingClientRect.top ? w : x);
304
+ const c = l.reduce((w, I) => w.boundingClientRect.top < I.boundingClientRect.top ? w : I);
305
305
  h(c.target.id);
306
306
  }
307
307
  },
@@ -410,12 +410,12 @@ function bt({
410
410
  document.body
411
411
  );
412
412
  }
413
- const wt = "_tags_11t8a_1", $t = "_compact_11t8a_9", Nt = "_tagLabel_11t8a_15", It = "_tagIcon_11t8a_25", xt = "_tagList_11t8a_30", Ct = "_tag_11t8a_1", z = {
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 = {
414
414
  tags: wt,
415
415
  compact: $t,
416
416
  tagLabel: Nt,
417
- tagIcon: It,
418
- tagList: xt,
417
+ tagIcon: xt,
418
+ tagList: It,
419
419
  tag: Ct
420
420
  };
421
421
  function kt({ tags: t, variant: n = "default", onTagClick: s }) {
@@ -466,7 +466,7 @@ 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, x] = 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] = 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) => {
470
470
  const C = {
471
471
  advanced: !1,
472
472
  anchor: ""
@@ -494,7 +494,7 @@ function jt({ language: t }) {
494
494
  L = N.showTableOfContents !== !1;
495
495
  break;
496
496
  }
497
- x(L);
497
+ I(L);
498
498
  try {
499
499
  let N;
500
500
  try {
@@ -751,7 +751,7 @@ function an({ language: t }) {
751
751
  window.removeEventListener("blog:open-search", f), window.removeEventListener("blog:close-search", $);
752
752
  };
753
753
  }, []);
754
- const x = (f) => {
754
+ const I = (f) => {
755
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));
756
756
  };
757
757
  S(() => {
@@ -810,7 +810,7 @@ function an({ language: t }) {
810
810
  placeholder: n("ui.searchPlaceholder"),
811
811
  value: u,
812
812
  onChange: (f) => m(f.target.value),
813
- onKeyDown: x
813
+ onKeyDown: I
814
814
  }
815
815
  ),
816
816
  /* @__PURE__ */ e(
@@ -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", In = "_dropdownIcon_jrobc_244", I = {
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 = {
870
870
  header: on,
871
871
  container: sn,
872
872
  content: cn,
@@ -885,50 +885,50 @@ const on = "_header_jrobc_1", sn = "_container_jrobc_24", cn = "_content_jrobc_3
885
885
  caretIcon: wn,
886
886
  dropdownMenu: $n,
887
887
  dropdownItem: Nn,
888
- dropdownIcon: In
888
+ dropdownIcon: xn
889
889
  };
890
- function xn({ 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 } = xe(), i = F(null), l = F(null);
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);
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);
895
895
  };
896
896
  return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
897
- }, []), /* @__PURE__ */ e("header", { className: I.header, children: /* @__PURE__ */ e("div", { className: I.container, children: /* @__PURE__ */ d("div", { className: I.content, children: [
898
- /* @__PURE__ */ d("div", { className: I.leftSection, children: [
897
+ }, []), /* @__PURE__ */ e("header", { className: x.header, children: /* @__PURE__ */ e("div", { className: x.container, children: /* @__PURE__ */ d("div", { className: x.content, children: [
898
+ /* @__PURE__ */ d("div", { className: x.leftSection, children: [
899
899
  /* @__PURE__ */ e(
900
900
  "button",
901
901
  {
902
902
  type: "button",
903
- className: I.mobileMenuButton,
903
+ className: x.mobileMenuButton,
904
904
  onClick: t,
905
905
  "aria-label": "Open menu",
906
- children: /* @__PURE__ */ e(Ee, { className: I.burgerIcon })
906
+ children: /* @__PURE__ */ e(Ee, { className: x.burgerIcon })
907
907
  }
908
908
  ),
909
- /* @__PURE__ */ e("div", { className: I.logo })
909
+ /* @__PURE__ */ e("div", { className: x.logo })
910
910
  ] }),
911
- /* @__PURE__ */ d("nav", { className: I.nav, children: [
911
+ /* @__PURE__ */ d("nav", { className: x.nav, children: [
912
912
  /* @__PURE__ */ e(an, { language: s.language }),
913
- /* @__PURE__ */ d("div", { className: I.themeDropdown, ref: l, children: [
913
+ /* @__PURE__ */ d("div", { className: x.themeDropdown, ref: l, children: [
914
914
  /* @__PURE__ */ d(
915
915
  "button",
916
916
  {
917
917
  type: "button",
918
- className: I.themeButton,
918
+ className: x.themeButton,
919
919
  onClick: () => _(!v),
920
920
  "aria-expanded": v,
921
921
  "aria-haspopup": "true",
922
922
  "aria-label": n("ui.theme"),
923
923
  children: [
924
- b === "light" && /* @__PURE__ */ e(_e, { className: I.themeIcon }),
925
- b === "dark" && /* @__PURE__ */ e(pe, { className: I.themeIcon }),
926
- b === "system" && /* @__PURE__ */ e(fe, { className: I.themeIcon }),
927
- /* @__PURE__ */ e(oe, { className: I.caretIcon })
924
+ b === "light" && /* @__PURE__ */ e(_e, { className: x.themeIcon }),
925
+ b === "dark" && /* @__PURE__ */ e(pe, { className: x.themeIcon }),
926
+ b === "system" && /* @__PURE__ */ e(fe, { className: x.themeIcon }),
927
+ /* @__PURE__ */ e(oe, { className: x.caretIcon })
928
928
  ]
929
929
  }
930
930
  ),
931
- v && /* @__PURE__ */ d("div", { className: I.dropdownMenu, children: [
931
+ v && /* @__PURE__ */ d("div", { className: x.dropdownMenu, children: [
932
932
  /* @__PURE__ */ d(
933
933
  "button",
934
934
  {
@@ -936,9 +936,9 @@ function xn({ onMobileMenuToggle: t }) {
936
936
  onClick: () => {
937
937
  p("light"), _(!1);
938
938
  },
939
- className: I.dropdownItem,
939
+ className: x.dropdownItem,
940
940
  children: [
941
- /* @__PURE__ */ e(_e, { className: I.dropdownIcon }),
941
+ /* @__PURE__ */ e(_e, { className: x.dropdownIcon }),
942
942
  n("ui.light")
943
943
  ]
944
944
  }
@@ -950,9 +950,9 @@ function xn({ onMobileMenuToggle: t }) {
950
950
  onClick: () => {
951
951
  p("dark"), _(!1);
952
952
  },
953
- className: I.dropdownItem,
953
+ className: x.dropdownItem,
954
954
  children: [
955
- /* @__PURE__ */ e(pe, { className: I.dropdownIcon }),
955
+ /* @__PURE__ */ e(pe, { className: x.dropdownIcon }),
956
956
  n("ui.dark")
957
957
  ]
958
958
  }
@@ -964,41 +964,41 @@ function xn({ onMobileMenuToggle: t }) {
964
964
  onClick: () => {
965
965
  p("system"), _(!1);
966
966
  },
967
- className: I.dropdownItem,
967
+ className: x.dropdownItem,
968
968
  children: [
969
- /* @__PURE__ */ e(fe, { className: I.dropdownIcon }),
969
+ /* @__PURE__ */ e(fe, { className: x.dropdownIcon }),
970
970
  n("ui.system")
971
971
  ]
972
972
  }
973
973
  )
974
974
  ] })
975
975
  ] }),
976
- u.length > 0 && /* @__PURE__ */ d("div", { className: I.supportDropdown, ref: i, children: [
976
+ u.length > 0 && /* @__PURE__ */ d("div", { className: x.supportDropdown, ref: i, children: [
977
977
  /* @__PURE__ */ d(
978
978
  "button",
979
979
  {
980
980
  type: "button",
981
- className: I.supportButton,
981
+ className: x.supportButton,
982
982
  onClick: () => h(!m),
983
983
  "aria-expanded": m,
984
984
  "aria-haspopup": "true",
985
985
  children: [
986
986
  n("ui.support"),
987
- /* @__PURE__ */ e(oe, { className: I.caretIcon })
987
+ /* @__PURE__ */ e(oe, { className: x.caretIcon })
988
988
  ]
989
989
  }
990
990
  ),
991
- m && /* @__PURE__ */ e("div", { className: I.dropdownMenu, children: u.map((c, w) => {
992
- const x = c.target ?? (c.url.startsWith("http") ? "_blank" : "_self"), y = c.rel ?? (x === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
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;
993
993
  return /* @__PURE__ */ d(
994
994
  "a",
995
995
  {
996
996
  href: c.url,
997
- target: x,
997
+ target: I,
998
998
  rel: y,
999
- className: I.dropdownItem,
999
+ className: x.dropdownItem,
1000
1000
  children: [
1001
- f && /* @__PURE__ */ e(f, { className: I.dropdownIcon }),
1001
+ f && /* @__PURE__ */ e(f, { className: x.dropdownIcon }),
1002
1002
  c.label
1003
1003
  ]
1004
1004
  },
@@ -1007,17 +1007,17 @@ function xn({ onMobileMenuToggle: t }) {
1007
1007
  }) })
1008
1008
  ] }),
1009
1009
  o.map((c, w) => {
1010
- const x = c.target ?? (typeof c.url == "string" && c.url.startsWith("http") ? "_blank" : "_self"), y = c.rel ?? (x === "_blank" ? "noopener noreferrer" : void 0), f = c.icon;
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;
1011
1011
  return /* @__PURE__ */ d(
1012
1012
  "a",
1013
1013
  {
1014
1014
  href: c.url,
1015
- target: x,
1015
+ target: I,
1016
1016
  rel: y,
1017
- className: c.className ?? I.navLink,
1017
+ className: c.className ?? x.navLink,
1018
1018
  children: [
1019
1019
  c.label,
1020
- f && /* @__PURE__ */ e(f, { className: I.externalIcon })
1020
+ f && /* @__PURE__ */ e(f, { className: x.externalIcon })
1021
1021
  ]
1022
1022
  },
1023
1023
  w
@@ -1036,9 +1036,9 @@ function le({
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
- let x = "";
1040
- o.supportedLanguages.includes(w) ? (c[0] = p, x = `${i}/${c.join("/")}`) : x = `${i}/${p}${l}`;
1041
- const y = x + a.search + a.hash;
1039
+ let I = "";
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
1042
  s.changeLanguage(p), r(y), m(!1), n == null || n();
1043
1043
  };
1044
1044
  S(() => {
@@ -1083,9 +1083,9 @@ function ie({ styles: t, onLinkClick: n }) {
1083
1083
  if (!r.navigationData) return {};
1084
1084
  const i = s.language;
1085
1085
  return te(r.navigationData, i).reduce(
1086
- (c, w, x) => {
1086
+ (c, w, I) => {
1087
1087
  if (V(w)) {
1088
- const y = r.navigationData[x], f = V(y) && y.defaultOpen === !0;
1088
+ const y = r.navigationData[I], f = V(y) && y.defaultOpen === !0;
1089
1089
  c[w.title] = f;
1090
1090
  }
1091
1091
  return c;
@@ -1099,9 +1099,9 @@ function ie({ styles: t, onLinkClick: n }) {
1099
1099
  r.navigationData,
1100
1100
  m
1101
1101
  ).reduce(
1102
- (c, w, x) => {
1102
+ (c, w, I) => {
1103
1103
  if (V(w)) {
1104
- const y = r.navigationData[x], f = V(y) && y.defaultOpen === !0;
1104
+ const y = r.navigationData[I], f = V(y) && y.defaultOpen === !0;
1105
1105
  c[w.title] = f;
1106
1106
  }
1107
1107
  return c;
@@ -1278,11 +1278,11 @@ 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", Ia = "_main_wf6ni_15", xa = "_fullWidth_wf6ni_21", Ca = "_contentWrapper_wf6ni_30", J = {
1281
+ const $a = "_app_wf6ni_1", Na = "_layout_wf6ni_9", xa = "_main_wf6ni_15", Ia = "_fullWidth_wf6ni_21", Ca = "_contentWrapper_wf6ni_30", J = {
1282
1282
  app: $a,
1283
1283
  layout: Na,
1284
- main: Ia,
1285
- fullWidth: xa,
1284
+ main: xa,
1285
+ fullWidth: Ia,
1286
1286
  contentWrapper: Ca
1287
1287
  };
1288
1288
  function ka({ children: t }) {
@@ -1299,7 +1299,7 @@ function ka({ children: t }) {
1299
1299
  return /* @__PURE__ */ e(be, { to: "/en/welcome", replace: !0 });
1300
1300
  const h = !!a.header, v = !!a.navigationData && a.navigationData.length > 0, _ = a.contentMaxWidth ? { width: "100%", maxWidth: a.contentMaxWidth } : void 0;
1301
1301
  return /* @__PURE__ */ d("div", { className: J.app, children: [
1302
- h && /* @__PURE__ */ e(xn, { onMobileMenuToggle: u }),
1302
+ h && /* @__PURE__ */ e(In, { onMobileMenuToggle: u }),
1303
1303
  /* @__PURE__ */ e(Jn, { isOpen: r, onClose: m }),
1304
1304
  /* @__PURE__ */ d("div", { className: J.layout, children: [
1305
1305
  v && /* @__PURE__ */ e(wa, {}),
@@ -1398,8 +1398,8 @@ function Ya() {
1398
1398
  /* @__PURE__ */ e(
1399
1399
  ge,
1400
1400
  {
1401
- path: "/",
1402
- element: (n.defaultRoute || "latest") === "latest" ? /* @__PURE__ */ e(Oa, {}) : /* @__PURE__ */ e(be, { to: `/${n.defaultRoute}`, replace: !0 })
1401
+ index: !0,
1402
+ element: (n.defaultRoute || "latest") === "latest" ? /* @__PURE__ */ e(Oa, {}) : /* @__PURE__ */ e(be, { to: `./${n.defaultRoute}`, replace: !0 })
1403
1403
  }
1404
1404
  )
1405
1405
  ] }) });
@@ -1434,7 +1434,7 @@ export {
1434
1434
  jt as ContentPage,
1435
1435
  ka as DocumentationLayout,
1436
1436
  Ya as DocumentationRoutes,
1437
- xn as Header,
1437
+ In as Header,
1438
1438
  Oa as HomePage,
1439
1439
  le as LanguageSelector,
1440
1440
  se as Metadata,
@@ -1453,5 +1453,5 @@ export {
1453
1453
  R as useBlogConfig,
1454
1454
  Ja as useLanguageChange,
1455
1455
  Va as useSearchModal,
1456
- xe as useTheme
1456
+ Ie as useTheme
1457
1457
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-wave/blog",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {