@docubook/markdown 2.0.0-beta.3 → 2.0.0-beta.5

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/index.js CHANGED
@@ -41008,21 +41008,42 @@ function SN({ className: e, children: n }) {
41008
41008
  overflowX: "auto",
41009
41009
  borderBottom: "1px solid hsl(var(--border-color, 210 20% 85%))"
41010
41010
  },
41011
- children: i.map((e) => {
41012
- let t = e.value === c?.value, n = `${r}-tab-${e.value}`, i = `${r}-panel-${e.value}`;
41011
+ children: i.map((e, t) => {
41012
+ let n = e.value === c?.value, a = `${r}-tab-${e.value}`, o = `${r}-panel-${e.value}`;
41013
41013
  return /* @__PURE__ */ h("button", {
41014
- id: n,
41014
+ id: a,
41015
41015
  type: "button",
41016
41016
  role: "tab",
41017
- "aria-selected": t,
41018
- "aria-controls": i,
41019
- tabIndex: t ? 0 : -1,
41017
+ "aria-selected": n,
41018
+ "aria-controls": o,
41019
+ tabIndex: n ? 0 : -1,
41020
41020
  onClick: () => s(e.value),
41021
+ onKeyDown: (e) => {
41022
+ let n;
41023
+ switch (e.key) {
41024
+ case "ArrowRight":
41025
+ n = (t + 1) % i.length;
41026
+ break;
41027
+ case "ArrowLeft":
41028
+ n = (t - 1 + i.length) % i.length;
41029
+ break;
41030
+ case "Home":
41031
+ n = 0;
41032
+ break;
41033
+ case "End":
41034
+ n = i.length - 1;
41035
+ break;
41036
+ default: return;
41037
+ }
41038
+ e.preventDefault();
41039
+ let a = i[n].value;
41040
+ s(a), e.currentTarget.ownerDocument.getElementById(`${r}-tab-${a}`)?.focus();
41041
+ },
41021
41042
  style: {
41022
41043
  border: "none",
41023
- borderBottom: t ? "2px solid hsl(var(--primary, 210 81% 56%))" : "2px solid transparent",
41044
+ borderBottom: n ? "2px solid hsl(var(--primary, 210 81% 56%))" : "2px solid transparent",
41024
41045
  background: "transparent",
41025
- color: t ? "hsl(var(--primary, 210 81% 56%))" : "hsl(var(--foreground, 220 30% 15%))",
41046
+ color: n ? "hsl(var(--primary, 210 81% 56%))" : "hsl(var(--foreground, 220 30% 15%))",
41026
41047
  fontSize: "0.875rem",
41027
41048
  fontWeight: 600,
41028
41049
  lineHeight: 1.2,
@@ -41170,6 +41191,7 @@ function zN({ text: e, tip: t }) {
41170
41191
  children: e ?? "?"
41171
41192
  }), b ? /* @__PURE__ */ g("span", {
41172
41193
  ref: o,
41194
+ id: i,
41173
41195
  role: "tooltip",
41174
41196
  style: {
41175
41197
  position: "fixed",
@@ -41305,7 +41327,7 @@ function ZN({ label: e, onClick: t, cell: n, children: r }) {
41305
41327
  });
41306
41328
  }
41307
41329
  function QN({ chart: e, id: t, className: n }) {
41308
- let r = l(), i = t ?? `mermaid-${r.replace(/[:.]/g, "-")}`, a = f(null), o = f(e), s = f(null), [u, d] = p(null), [m, _] = p(!1), [v, y] = p({
41330
+ let r = l(), i = t ?? `mermaid-${r.replace(/[:.]/g, "-")}`, a = f(null), o = f(Promise.resolve()), s = f(null), [u, d] = p(null), [m, _] = p(!1), [v, y] = p({
41309
41331
  x: 0,
41310
41332
  y: 0,
41311
41333
  scale: 1
@@ -41316,18 +41338,21 @@ function QN({ chart: e, id: t, className: n }) {
41316
41338
  }), re = f(null);
41317
41339
  c(() => {
41318
41340
  if (typeof window > "u" || !e) return;
41319
- o.current = e, d(null), _(!1);
41320
- let t = !1, n = null, r = null, i = null, c = UN(), l = Promise.resolve();
41321
- function u(e) {
41322
- let n = l.then(() => {
41323
- if (!(t || !a.current?.isConnected)) return e();
41341
+ d(null), _(!1);
41342
+ let t = !1, n = null, r = null, i = null, c = UN();
41343
+ function l(n) {
41344
+ let r = o.current.then(() => {
41345
+ let r = a.current;
41346
+ if (!(t || !r?.isConnected)) return r.textContent = e, r.removeAttribute("data-processed"), n();
41324
41347
  });
41325
- return l = n.catch(() => {}), n;
41348
+ return o.current = r.catch(() => {}), r;
41326
41349
  }
41327
- async function f() {
41350
+ async function u() {
41328
41351
  try {
41329
41352
  VN ||= import("mermaid");
41330
- let r = await VN, i = s.current = r.default;
41353
+ let r = await VN;
41354
+ if (t) return;
41355
+ let i = s.current = r.default;
41331
41356
  i.initialize({
41332
41357
  startOnLoad: !1,
41333
41358
  theme: UN()
@@ -41340,7 +41365,7 @@ function QN({ chart: e, id: t, className: n }) {
41340
41365
  }
41341
41366
  if (t || !a.current) return;
41342
41367
  n = new IntersectionObserver(([e]) => {
41343
- !e.isIntersecting || t || !a.current || (u(() => {
41368
+ !e.isIntersecting || t || !a.current || (l(() => {
41344
41369
  let e = a.current;
41345
41370
  return e ? i.run({ nodes: [e] }) : Promise.resolve();
41346
41371
  }).then(() => {
@@ -41353,16 +41378,16 @@ function QN({ chart: e, id: t, className: n }) {
41353
41378
  t || d("Failed to load Mermaid renderer");
41354
41379
  }
41355
41380
  }
41356
- return f(), r = new MutationObserver(() => {
41381
+ return u(), r = new MutationObserver(() => {
41357
41382
  i && clearTimeout(i), i = setTimeout(() => {
41358
- t || !s.current || !a.current || UN() !== c && u(() => {
41383
+ t || !s.current || !a.current || UN() !== c && l(() => {
41359
41384
  let e = s.current, t = a.current;
41360
- return !e || !t ? Promise.resolve() : (c = UN(), t.textContent = o.current, t.removeAttribute("data-processed"), e.initialize({
41385
+ return !e || !t ? Promise.resolve() : (c = UN(), e.initialize({
41361
41386
  startOnLoad: !1,
41362
41387
  theme: c
41363
41388
  }), e.run({ nodes: [t] }));
41364
41389
  }).catch((e) => {
41365
- console.warn("[mermaid] diagram render error:", e);
41390
+ t || console.warn("[mermaid] diagram render error:", e);
41366
41391
  });
41367
41392
  }, 200);
41368
41393
  }), r.observe(document.documentElement, {