boltdocs 1.6.0 → 1.7.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.
Files changed (57) hide show
  1. package/dist/{SearchDialog-J3KNRGNO.mjs → SearchDialog-6Z7CUAYJ.mjs} +8 -1
  2. package/dist/{SearchDialog-3QICRMWF.css → SearchDialog-GOZ6X53X.css} +385 -113
  3. package/dist/{chunk-HSPDIRTW.mjs → chunk-SFVOGJ2W.mjs} +955 -737
  4. package/dist/client/index.css +385 -113
  5. package/dist/client/index.d.mts +19 -7
  6. package/dist/client/index.d.ts +19 -7
  7. package/dist/client/index.js +964 -577
  8. package/dist/client/index.mjs +118 -1
  9. package/dist/client/ssr.css +385 -113
  10. package/dist/client/ssr.d.mts +3 -1
  11. package/dist/client/ssr.d.ts +3 -1
  12. package/dist/client/ssr.js +743 -474
  13. package/dist/client/ssr.mjs +3 -2
  14. package/dist/{config-DkZg5aCf.d.ts → config-D68h41CA.d.mts} +21 -2
  15. package/dist/{config-DkZg5aCf.d.mts → config-D68h41CA.d.ts} +21 -2
  16. package/dist/node/index.d.mts +12 -2
  17. package/dist/node/index.d.ts +12 -2
  18. package/dist/node/index.js +48 -21
  19. package/dist/node/index.mjs +48 -21
  20. package/dist/{types-DGIo1VKD.d.mts → types-BbceAHA0.d.mts} +15 -0
  21. package/dist/{types-DGIo1VKD.d.ts → types-BbceAHA0.d.ts} +15 -0
  22. package/package.json +1 -1
  23. package/src/client/app/index.tsx +16 -11
  24. package/src/client/index.ts +2 -0
  25. package/src/client/ssr.tsx +4 -1
  26. package/src/client/theme/components/mdx/Table.tsx +151 -0
  27. package/src/client/theme/components/mdx/index.ts +3 -0
  28. package/src/client/theme/components/mdx/mdx-components.css +128 -0
  29. package/src/client/theme/styles/markdown.css +8 -3
  30. package/src/client/theme/styles/variables.css +34 -9
  31. package/src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx +46 -0
  32. package/src/client/theme/ui/ErrorBoundary/index.ts +1 -0
  33. package/src/client/theme/ui/Layout/Layout.tsx +10 -11
  34. package/src/client/theme/ui/Layout/base.css +15 -3
  35. package/src/client/theme/ui/Link/Link.tsx +2 -2
  36. package/src/client/theme/ui/Link/LinkPreview.tsx +9 -14
  37. package/src/client/theme/ui/Link/link-preview.css +30 -27
  38. package/src/client/theme/ui/Navbar/Navbar.tsx +65 -17
  39. package/src/client/theme/ui/Navbar/Tabs.tsx +99 -0
  40. package/src/client/theme/ui/Navbar/navbar.css +119 -5
  41. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +66 -57
  42. package/src/client/theme/ui/OnThisPage/toc.css +30 -10
  43. package/src/client/theme/ui/ProgressBar/ProgressBar.css +17 -0
  44. package/src/client/theme/ui/ProgressBar/ProgressBar.tsx +51 -0
  45. package/src/client/theme/ui/ProgressBar/index.ts +1 -0
  46. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +11 -1
  47. package/src/client/theme/ui/Sidebar/Sidebar.tsx +97 -57
  48. package/src/client/theme/ui/Sidebar/sidebar.css +61 -67
  49. package/src/client/types.ts +12 -0
  50. package/src/node/config.ts +19 -1
  51. package/src/node/plugin/entry.ts +5 -1
  52. package/src/node/plugin/index.ts +2 -1
  53. package/src/node/routes/index.ts +13 -1
  54. package/src/node/routes/parser.ts +32 -7
  55. package/src/node/routes/types.ts +11 -1
  56. package/src/node/ssg/index.ts +2 -1
  57. package/src/node/ssg/options.ts +2 -0
@@ -10,7 +10,7 @@ import {
10
10
  Sidebar,
11
11
  ThemeLayout,
12
12
  createBoltdocsApp
13
- } from "../chunk-HSPDIRTW.mjs";
13
+ } from "../chunk-SFVOGJ2W.mjs";
14
14
  import {
15
15
  Video
16
16
  } from "../chunk-Z7JHYNAS.mjs";
@@ -482,6 +482,122 @@ function parseNode(node, depth = 0) {
482
482
  function FileTree({ children }) {
483
483
  return /* @__PURE__ */ jsx8("div", { className: "ld-file-tree", dir: "ltr", children: Children3.map(children, (child) => parseNode(child, 0)) });
484
484
  }
485
+
486
+ // src/client/theme/components/mdx/Table.tsx
487
+ import { useState as useState4, useMemo } from "react";
488
+ import { ChevronUp, ChevronDown, ChevronLeft, ChevronRight as ChevronRight3, ChevronsLeft, ChevronsRight } from "lucide-react";
489
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
490
+ function Table({
491
+ headers,
492
+ data,
493
+ children,
494
+ className = "",
495
+ sortable = false,
496
+ paginated = false,
497
+ pageSize = 10
498
+ }) {
499
+ const [sortConfig, setSortConfig] = useState4(null);
500
+ const [currentPage, setCurrentPage] = useState4(1);
501
+ const processedData = useMemo(() => {
502
+ if (!data) return [];
503
+ let items = [...data];
504
+ if (sortable && sortConfig !== null) {
505
+ items.sort((a, b) => {
506
+ const aVal = a[sortConfig.key];
507
+ const bVal = b[sortConfig.key];
508
+ const aStr = typeof aVal === "string" ? aVal : "";
509
+ const bStr = typeof bVal === "string" ? bVal : "";
510
+ if (aStr < bStr) return sortConfig.direction === "asc" ? -1 : 1;
511
+ if (aStr > bStr) return sortConfig.direction === "asc" ? 1 : -1;
512
+ return 0;
513
+ });
514
+ }
515
+ return items;
516
+ }, [data, sortConfig, sortable]);
517
+ const totalPages = Math.ceil(processedData.length / pageSize);
518
+ const paginatedData = useMemo(() => {
519
+ if (!paginated) return processedData;
520
+ const start = (currentPage - 1) * pageSize;
521
+ return processedData.slice(start, start + pageSize);
522
+ }, [processedData, paginated, currentPage, pageSize]);
523
+ const requestSort = (index) => {
524
+ if (!sortable) return;
525
+ let direction = "asc";
526
+ if (sortConfig && sortConfig.key === index && sortConfig.direction === "asc") {
527
+ direction = "desc";
528
+ }
529
+ setSortConfig({ key: index, direction });
530
+ };
531
+ const renderSortIcon = (index) => {
532
+ if (!sortable) return null;
533
+ if (sortConfig?.key !== index) return /* @__PURE__ */ jsx9(ChevronDown, { size: 14, className: "ld-table-sort-icon ld-table-sort-icon--hidden" });
534
+ return sortConfig.direction === "asc" ? /* @__PURE__ */ jsx9(ChevronUp, { size: 14, className: "ld-table-sort-icon" }) : /* @__PURE__ */ jsx9(ChevronDown, { size: 14, className: "ld-table-sort-icon" });
535
+ };
536
+ const tableContent = children ? children : /* @__PURE__ */ jsxs7(Fragment2, { children: [
537
+ headers && /* @__PURE__ */ jsx9("thead", { children: /* @__PURE__ */ jsx9("tr", { children: headers.map((header, i) => /* @__PURE__ */ jsx9(
538
+ "th",
539
+ {
540
+ onClick: () => requestSort(i),
541
+ className: sortable ? "ld-table-header--sortable" : "",
542
+ children: /* @__PURE__ */ jsxs7("div", { className: "ld-table-header-content", children: [
543
+ header,
544
+ renderSortIcon(i)
545
+ ] })
546
+ },
547
+ i
548
+ )) }) }),
549
+ paginatedData && /* @__PURE__ */ jsx9("tbody", { children: paginatedData.map((row, i) => /* @__PURE__ */ jsx9("tr", { children: row.map((cell, j) => /* @__PURE__ */ jsx9("td", { children: cell }, j)) }, i)) })
550
+ ] });
551
+ return /* @__PURE__ */ jsxs7("div", { className: `ld-table-container ${className}`.trim(), children: [
552
+ /* @__PURE__ */ jsx9("div", { className: "ld-table-wrapper", children: /* @__PURE__ */ jsx9("table", { className: "ld-table", children: tableContent }) }),
553
+ paginated && totalPages > 1 && /* @__PURE__ */ jsxs7("div", { className: "ld-table-pagination", children: [
554
+ /* @__PURE__ */ jsxs7("div", { className: "ld-table-pagination-info", children: [
555
+ "Page ",
556
+ currentPage,
557
+ " of ",
558
+ totalPages
559
+ ] }),
560
+ /* @__PURE__ */ jsxs7("div", { className: "ld-table-pagination-controls", children: [
561
+ /* @__PURE__ */ jsx9(
562
+ "button",
563
+ {
564
+ onClick: () => setCurrentPage(1),
565
+ disabled: currentPage === 1,
566
+ className: "ld-table-pagination-btn",
567
+ children: /* @__PURE__ */ jsx9(ChevronsLeft, { size: 16 })
568
+ }
569
+ ),
570
+ /* @__PURE__ */ jsx9(
571
+ "button",
572
+ {
573
+ onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
574
+ disabled: currentPage === 1,
575
+ className: "ld-table-pagination-btn",
576
+ children: /* @__PURE__ */ jsx9(ChevronLeft, { size: 16 })
577
+ }
578
+ ),
579
+ /* @__PURE__ */ jsx9(
580
+ "button",
581
+ {
582
+ onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
583
+ disabled: currentPage === totalPages,
584
+ className: "ld-table-pagination-btn",
585
+ children: /* @__PURE__ */ jsx9(ChevronRight3, { size: 16 })
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsx9(
589
+ "button",
590
+ {
591
+ onClick: () => setCurrentPage(totalPages),
592
+ disabled: currentPage === totalPages,
593
+ className: "ld-table-pagination-btn",
594
+ children: /* @__PURE__ */ jsx9(ChevronsRight, { size: 16 })
595
+ }
596
+ )
597
+ ] })
598
+ ] })
599
+ ] });
600
+ }
485
601
  export {
486
602
  Admonition,
487
603
  BackgroundGradient,
@@ -504,6 +620,7 @@ export {
504
620
  Playground,
505
621
  Sidebar,
506
622
  Tab,
623
+ Table,
507
624
  Tabs,
508
625
  ThemeLayout,
509
626
  Tip,