boltdocs 3.3.4 → 3.3.6

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 (79) hide show
  1. package/dist/{build-COgv-rkY.mjs → build-BJnL-FHG.mjs} +1 -1
  2. package/dist/{build-1CsvBIsN.cjs → build-CxT38vPv.cjs} +1 -1
  3. package/dist/client/index.cjs +80 -32
  4. package/dist/client/index.d.cts +1 -1
  5. package/dist/client/index.d.ts +1 -1
  6. package/dist/client/index.js +78 -31
  7. package/dist/client/mdx.cjs +1 -1
  8. package/dist/client/mdx.js +1 -1
  9. package/dist/client/primitives.cjs +4 -4
  10. package/dist/client/primitives.d.cts +40 -9
  11. package/dist/client/primitives.d.ts +40 -9
  12. package/dist/client/primitives.js +4 -4
  13. package/dist/config-B3_iVsbi.mjs +7 -0
  14. package/dist/{config-PLvresCv.cjs → config-BC_qhXws.cjs} +1 -1
  15. package/dist/config-BJp3lGzE.cjs +7 -0
  16. package/dist/{dev-C_9iBwmu.cjs → dev-46NiL0MC.cjs} +1 -1
  17. package/dist/{dev-UWVM3ah-.mjs → dev-C4kjO5xs.mjs} +1 -1
  18. package/dist/{docs-layout-CbZ7LDRe.js → docs-layout-D3Fmb0Wd.js} +16 -117
  19. package/dist/{docs-layout-vzfXed1Q.cjs → docs-layout-SgphExoE.cjs} +16 -123
  20. package/dist/{doctor-DMECtdK6.cjs → doctor-BqxOFRt3.cjs} +1 -1
  21. package/dist/{doctor-i8Qmd8DJ.mjs → doctor-Cv5lXnay.mjs} +1 -1
  22. package/dist/{doctor-FuFY1jBz.cjs → doctor-TS3JGNEU.cjs} +1 -1
  23. package/dist/{image-B-NDSDuY.js → image-BAiDReNd.js} +1 -1
  24. package/dist/{image-Hnaa2bJd.cjs → image-Bkx85rsq.cjs} +1 -1
  25. package/dist/{index-Cg3TmXIZ.d.ts → index-B1Mx0dHl.d.ts} +30 -6
  26. package/dist/{index-CSiMUBhC.d.cts → index-DLaHgD-i.d.cts} +30 -6
  27. package/dist/{link-vZjmD-es.cjs → link-hLWOsx0x.cjs} +59 -28
  28. package/dist/{link-CgdI6O2o.js → link-q1qHNGK_.js} +54 -29
  29. package/dist/{mdx-BRT71V5Q.js → mdx-CJGWzBGy.js} +2 -2
  30. package/dist/{mdx-D0Absdq5.cjs → mdx-Qi0DmaY8.cjs} +2 -2
  31. package/dist/node/cli-entry.cjs +1 -1
  32. package/dist/node/cli-entry.mjs +1 -1
  33. package/dist/node/highlight.d.cts +2 -2
  34. package/dist/node/highlight.d.mts +2 -2
  35. package/dist/node/index.cjs +1 -1
  36. package/dist/node/index.d.cts +7 -4
  37. package/dist/node/index.d.mts +7 -4
  38. package/dist/node/index.mjs +1 -1
  39. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  40. package/dist/node/mdx/shiki-adapter.d.cts +7 -2
  41. package/dist/node/mdx/shiki-adapter.d.mts +7 -2
  42. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  43. package/dist/node-7Cfw6nMr.cjs +23 -0
  44. package/dist/node-CT2E84nY.mjs +23 -0
  45. package/dist/{package-Cwma8oO7.cjs → package-Bah2tHjK.cjs} +1 -1
  46. package/dist/{package-CKC-4LtU.mjs → package-D6bf68FR.mjs} +1 -1
  47. package/dist/plugin-AgNI3ktz.cjs +69 -0
  48. package/dist/plugin-BAv_pYLt.mjs +69 -0
  49. package/dist/{plugin-context-BxF88sW4.cjs → plugin-context-BZs5lvDu.cjs} +3 -3
  50. package/dist/{plugin-context-BKK-nfOd.mjs → plugin-context-b5qVVQSU.mjs} +2 -2
  51. package/dist/{plugin-lifecycle-BjMclfc3.cjs → plugin-lifecycle-s89gzTlh.cjs} +1 -1
  52. package/dist/{registry-BbB6NqSv.d.cts → registry-B8pt41zj.d.cts} +1 -1
  53. package/dist/{registry-sJqDv0kE.d.mts → registry-BrrH2X9c.d.mts} +1 -1
  54. package/dist/routes-CzhKOw67.cjs +6 -0
  55. package/dist/{routes-C3_w9fLX.cjs → routes-Dq_2EUIB.cjs} +1 -1
  56. package/dist/routes-Dw6g0bfF.mjs +6 -0
  57. package/dist/search-dialog-BYZS9aeO.cjs +747 -0
  58. package/dist/{search-dialog-x_qHU8ty.cjs → search-dialog-CguKVtUu.cjs} +145 -5
  59. package/dist/{search-dialog-MmwxFMmE.js → search-dialog-DQwod5Xc.js} +1 -1
  60. package/dist/search-dialog-DzObE-Ar.js +717 -0
  61. package/dist/{search-dialog-DmirOMPg.cjs → search-dialog-QgKRRbsI.cjs} +1 -1
  62. package/dist/{search-dialog-BqkzDTq2.js → search-dialog-mYnqU4v7.js} +134 -6
  63. package/dist/{types-Db6zToZH.d.mts → types-74i_xUe2.d.mts} +1 -1
  64. package/dist/{types-o7iZ2BAR.d.cts → types-X_Pwk8Cg.d.cts} +1 -1
  65. package/dist/virtual-modules-C3S3Nz8r.cjs +40 -0
  66. package/dist/virtual-modules-CaxqrFd6.mjs +40 -0
  67. package/package.json +4 -3
  68. package/dist/config-CrsQJHQz.cjs +0 -7
  69. package/dist/config-DC0nMMk7.mjs +0 -7
  70. package/dist/node-C3HctGaH.cjs +0 -23
  71. package/dist/node-CUiheODn.mjs +0 -23
  72. package/dist/plugin-BX6TXR8x.cjs +0 -69
  73. package/dist/plugin-C8UMIA-4.mjs +0 -69
  74. package/dist/routes-C0kb4ue6.cjs +0 -6
  75. package/dist/routes-C4wrLWwu.mjs +0 -6
  76. package/dist/search-dialog-D3jtaw6w.cjs +0 -525
  77. package/dist/search-dialog-DRiXejws.js +0 -501
  78. package/dist/virtual-modules-XBiJoTsp.mjs +0 -39
  79. package/dist/virtual-modules-hndVivLR.cjs +0 -39
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  const require_router = require('./router-C3kygdRK.cjs');
7
- const require_link = require('./link-vZjmD-es.cjs');
7
+ const require_link = require('./link-hLWOsx0x.cjs');
8
8
  let react = require("react");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let react_aria_components = require("react-aria-components");
@@ -39,6 +39,15 @@ var ErrorBoundary = class extends react.Component {
39
39
  error: null
40
40
  });
41
41
  };
42
+ prevResetKeys = [];
43
+ componentDidUpdate(prevProps) {
44
+ if (prevProps.resetKeys !== this.props.resetKeys && this.state.hasError && this.props.resetKeys?.length && this.props.resetKeys.some((key, i) => !Object.is(key, this.prevResetKeys[i]))) {
45
+ this.prevResetKeys = this.props.resetKeys;
46
+ this.resetErrorBoundary();
47
+ return;
48
+ }
49
+ this.prevResetKeys = this.props.resetKeys ?? [];
50
+ }
42
51
  render() {
43
52
  const { hasError, error } = this.state;
44
53
  const { children, fallback, FallbackComponent } = this.props;
@@ -165,17 +174,20 @@ function NavbarLogo({ src, alt, width = 24, height = 24, className, logoClassNam
165
174
  });
166
175
  }
167
176
  function NavbarTitle({ children, className, linkClassName, href = "/" }) {
177
+ const titleText = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
168
178
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_link.Link, {
169
179
  href,
170
180
  className: require_link.cn(linkClassName),
181
+ "aria-label": titleText ? `Go to ${titleText} home` : void 0,
171
182
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
172
183
  className: require_link.cn("text-lg font-bold tracking-tight hidden sm:inline-block", className),
173
184
  children
174
185
  })
175
186
  });
176
187
  }
177
- function NavbarLinks({ children, className }) {
188
+ function NavbarLinks({ children, className, label }) {
178
189
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
190
+ "aria-label": label,
179
191
  className: require_link.cn("hidden md:flex items-center gap-6 text-sm font-medium", className),
180
192
  children
181
193
  });
@@ -236,18 +248,20 @@ function NavbarDropdownItem({ href, label, className }) {
236
248
  children: label
237
249
  });
238
250
  }
239
- function NavbarSearchTriggerDesktop({ className, onPress, children }) {
251
+ function NavbarSearchTriggerDesktop({ className, onPress, children, ...props }) {
240
252
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
253
+ ...props,
241
254
  onPress,
242
255
  className: require_link.cn("hidden lg:flex items-center justify-between gap-2 px-3 py-2 text-sm outline-none cursor-pointer w-full max-w-[720px]", className),
243
256
  children
244
257
  });
245
258
  }
246
- function NavbarSearchTriggerMobile({ className, onPress, children }) {
259
+ function NavbarSearchTriggerMobile({ className, onPress, children, ...props }) {
247
260
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
261
+ ...props,
248
262
  onPress,
249
263
  className: require_link.cn("lg:hidden flex h-10 w-10 items-center justify-center outline-none cursor-pointer", className),
250
- "aria-label": "Search",
264
+ "aria-label": props["aria-label"] || "Search",
251
265
  children
252
266
  });
253
267
  }
@@ -330,6 +344,7 @@ function NavbarMobileMenu({ isOpen, onClose, children, className, overlayClassNa
330
344
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_link.X, { size: 24 })
331
345
  })]
332
346
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
347
+ "aria-label": "Mobile navigation",
333
348
  className: require_link.cn("flex-1 overflow-y-auto flex flex-col gap-4", navClassName),
334
349
  children
335
350
  })]
@@ -405,6 +420,119 @@ Navbar.MobileMenu = NavbarMobileMenu;
405
420
  Navbar.MobileLink = NavbarMobileLink;
406
421
  Navbar.MobileLinkItem = NavbarMobileLinkItem;
407
422
 
423
+ //#endregion
424
+ //#region src/client/hooks/use-search-highlight.ts
425
+ /**
426
+ * Hook to highlight search terms based on the 'hl' query parameter.
427
+ */
428
+ function useSearchHighlight(containerSelector = ".boltdocs-page") {
429
+ const { search } = require_router.useLocation();
430
+ const query = new URLSearchParams(search).get("hl");
431
+ (0, react.useEffect)(() => {
432
+ if (!query) {
433
+ clearHighlights(containerSelector);
434
+ return;
435
+ }
436
+ const container = document.querySelector(containerSelector);
437
+ if (!container) return;
438
+ const target = container;
439
+ let rafId;
440
+ const observer = new MutationObserver((mutations) => {
441
+ if (mutations.some((m) => {
442
+ const addedNodes = Array.from(m.addedNodes);
443
+ const removedNodes = Array.from(m.removedNodes);
444
+ return addedNodes.some((n) => !(n instanceof HTMLElement && n.hasAttribute("data-search-highlight"))) || removedNodes.some((n) => !(n instanceof HTMLElement && n.hasAttribute("data-search-highlight")));
445
+ })) run();
446
+ });
447
+ function run() {
448
+ cancelAnimationFrame(rafId);
449
+ rafId = requestAnimationFrame(() => {
450
+ observer.disconnect();
451
+ clearHighlights(containerSelector);
452
+ const terms = (query ?? "").split(/\s+/).map((t) => t.trim()).filter((t) => t.length >= 2);
453
+ if (terms.length > 0) highlightTerms(target, terms);
454
+ observer.observe(target, {
455
+ childList: true,
456
+ subtree: true
457
+ });
458
+ });
459
+ }
460
+ run();
461
+ return () => {
462
+ cancelAnimationFrame(rafId);
463
+ observer.disconnect();
464
+ clearHighlights(containerSelector);
465
+ };
466
+ }, [query, containerSelector]);
467
+ }
468
+ function clearHighlights(selector) {
469
+ document.querySelectorAll(`${selector} mark[data-search-highlight]`).forEach((mark) => {
470
+ try {
471
+ const parent = mark.parentNode;
472
+ if (parent?.contains(mark)) {
473
+ const text = mark.textContent || "";
474
+ parent.replaceChild(document.createTextNode(text), mark);
475
+ }
476
+ } catch {}
477
+ });
478
+ }
479
+ function createSearchHighlightRegex(terms) {
480
+ const accentMap = {
481
+ a: "[aáàäâãåāăą]",
482
+ c: "[cçćč]",
483
+ d: "[dďđ]",
484
+ e: "[eéèëêėęě]",
485
+ g: "[gğģ]",
486
+ i: "[iíìïîīįı]",
487
+ l: "[lĺļł]",
488
+ n: "[nñńň]",
489
+ o: "[oóòöôõøōő]",
490
+ r: "[rřŕ]",
491
+ s: "[sśšş]",
492
+ t: "[tťţ]",
493
+ u: "[uúùüûūůűų]",
494
+ y: "[yýÿ]",
495
+ z: "[zžźż]"
496
+ };
497
+ const escapeTerm = (term) => [...term].map((char) => {
498
+ return accentMap[char.toLocaleLowerCase()] ?? char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
499
+ }).join("");
500
+ const uniqueTerms = [...new Set(terms.map((term) => term.trim()).filter(Boolean))].sort((left, right) => right.length - left.length);
501
+ if (uniqueTerms.length === 0) return null;
502
+ return new RegExp(`(${uniqueTerms.map(escapeTerm).join("|")})`, "gi");
503
+ }
504
+ function highlightTerms(container, terms) {
505
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, { acceptNode: (node) => {
506
+ const parent = node.parentElement;
507
+ if (parent && (parent.tagName === "SCRIPT" || parent.tagName === "STYLE" || parent.tagName === "MARK" || parent.closest("pre") || parent.closest("code"))) return NodeFilter.FILTER_REJECT;
508
+ return NodeFilter.FILTER_ACCEPT;
509
+ } });
510
+ const nodes = [];
511
+ let node = walker.nextNode();
512
+ while (node) {
513
+ nodes.push(node);
514
+ node = walker.nextNode();
515
+ }
516
+ const regex = createSearchHighlightRegex(terms);
517
+ if (!regex) return;
518
+ nodes.forEach((textNode) => {
519
+ const text = textNode.textContent;
520
+ regex.lastIndex = 0;
521
+ if (text && regex.test(text)) {
522
+ const fragment = document.createDocumentFragment();
523
+ text.split(regex).forEach((part, index) => {
524
+ if (index % 2 === 1) {
525
+ const mark = document.createElement("mark");
526
+ mark.textContent = part;
527
+ mark.setAttribute("data-search-highlight", "true");
528
+ fragment.appendChild(mark);
529
+ } else if (part) fragment.appendChild(document.createTextNode(part));
530
+ });
531
+ if (textNode.parentNode) textNode.parentNode.replaceChild(fragment, textNode);
532
+ }
533
+ });
534
+ }
535
+
408
536
  //#endregion
409
537
  //#region src/client/components/primitives/search-dialog.tsx
410
538
  /**
@@ -576,4 +704,16 @@ Object.defineProperty(exports, 'SearchDialog', {
576
704
  get: function () {
577
705
  return SearchDialog;
578
706
  }
707
+ });
708
+ Object.defineProperty(exports, 'createSearchHighlightRegex', {
709
+ enumerable: true,
710
+ get: function () {
711
+ return createSearchHighlightRegex;
712
+ }
713
+ });
714
+ Object.defineProperty(exports, 'useSearchHighlight', {
715
+ enumerable: true,
716
+ get: function () {
717
+ return useSearchHighlight;
718
+ }
579
719
  });
@@ -3,6 +3,6 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import { t as SearchDialog } from "./search-dialog-DRiXejws.js";
6
+ import { n as SearchResultHighlight, t as SearchDialog } from "./search-dialog-DzObE-Ar.js";
7
7
 
8
8
  export { SearchDialog };