boltdocs 1.3.0 → 1.3.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 (101) hide show
  1. package/dist/node/index.js +21 -6
  2. package/dist/node/index.mjs +21 -6
  3. package/package.json +1 -1
  4. package/src/client/app/index.tsx +344 -344
  5. package/src/client/app/preload.tsx +56 -56
  6. package/src/client/index.ts +40 -40
  7. package/src/client/ssr.tsx +51 -51
  8. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -76
  9. package/src/client/theme/components/CodeBlock/index.ts +1 -1
  10. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -154
  11. package/src/client/theme/components/PackageManagerTabs/index.ts +1 -1
  12. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -64
  13. package/src/client/theme/components/Playground/Playground.tsx +124 -124
  14. package/src/client/theme/components/Playground/index.ts +1 -1
  15. package/src/client/theme/components/Playground/playground.css +168 -168
  16. package/src/client/theme/components/Video/Video.tsx +84 -84
  17. package/src/client/theme/components/Video/index.ts +1 -1
  18. package/src/client/theme/components/Video/video.css +41 -41
  19. package/src/client/theme/components/mdx/Admonition.tsx +80 -80
  20. package/src/client/theme/components/mdx/Badge.tsx +31 -31
  21. package/src/client/theme/components/mdx/Button.tsx +50 -50
  22. package/src/client/theme/components/mdx/Card.tsx +80 -80
  23. package/src/client/theme/components/mdx/List.tsx +57 -57
  24. package/src/client/theme/components/mdx/Tabs.tsx +94 -94
  25. package/src/client/theme/components/mdx/index.ts +18 -18
  26. package/src/client/theme/components/mdx/mdx-components.css +424 -424
  27. package/src/client/theme/icons/bun.tsx +62 -62
  28. package/src/client/theme/icons/deno.tsx +20 -20
  29. package/src/client/theme/icons/discord.tsx +12 -12
  30. package/src/client/theme/icons/github.tsx +15 -15
  31. package/src/client/theme/icons/npm.tsx +13 -13
  32. package/src/client/theme/icons/pnpm.tsx +72 -72
  33. package/src/client/theme/icons/twitter.tsx +12 -12
  34. package/src/client/theme/styles/markdown.css +343 -343
  35. package/src/client/theme/styles/variables.css +162 -162
  36. package/src/client/theme/styles.css +37 -37
  37. package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -10
  38. package/src/client/theme/ui/BackgroundGradient/index.ts +1 -1
  39. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -68
  40. package/src/client/theme/ui/Breadcrumbs/index.ts +1 -1
  41. package/src/client/theme/ui/Footer/footer.css +32 -32
  42. package/src/client/theme/ui/Head/Head.tsx +69 -69
  43. package/src/client/theme/ui/Head/index.ts +1 -1
  44. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -125
  45. package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -1
  46. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -98
  47. package/src/client/theme/ui/Layout/Layout.tsx +202 -202
  48. package/src/client/theme/ui/Layout/base.css +76 -76
  49. package/src/client/theme/ui/Layout/index.ts +2 -2
  50. package/src/client/theme/ui/Layout/pagination.css +72 -72
  51. package/src/client/theme/ui/Layout/responsive.css +36 -36
  52. package/src/client/theme/ui/Link/Link.tsx +254 -254
  53. package/src/client/theme/ui/Link/index.ts +2 -2
  54. package/src/client/theme/ui/Loading/Loading.tsx +10 -10
  55. package/src/client/theme/ui/Loading/index.ts +1 -1
  56. package/src/client/theme/ui/Loading/loading.css +30 -30
  57. package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -27
  58. package/src/client/theme/ui/Navbar/Navbar.tsx +145 -145
  59. package/src/client/theme/ui/Navbar/index.ts +2 -2
  60. package/src/client/theme/ui/Navbar/navbar.css +233 -233
  61. package/src/client/theme/ui/NotFound/NotFound.tsx +19 -19
  62. package/src/client/theme/ui/NotFound/index.ts +1 -1
  63. package/src/client/theme/ui/NotFound/not-found.css +64 -64
  64. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +235 -235
  65. package/src/client/theme/ui/OnThisPage/index.ts +1 -1
  66. package/src/client/theme/ui/OnThisPage/toc.css +132 -132
  67. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -18
  68. package/src/client/theme/ui/PoweredBy/index.ts +1 -1
  69. package/src/client/theme/ui/PoweredBy/powered-by.css +76 -76
  70. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -199
  71. package/src/client/theme/ui/SearchDialog/index.ts +1 -1
  72. package/src/client/theme/ui/SearchDialog/search.css +152 -152
  73. package/src/client/theme/ui/Sidebar/Sidebar.tsx +204 -204
  74. package/src/client/theme/ui/Sidebar/index.ts +1 -1
  75. package/src/client/theme/ui/Sidebar/sidebar.css +236 -236
  76. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -69
  77. package/src/client/theme/ui/ThemeToggle/index.ts +1 -1
  78. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -136
  79. package/src/client/theme/ui/VersionSwitcher/index.ts +1 -1
  80. package/src/client/types.ts +50 -50
  81. package/src/client/utils.ts +26 -26
  82. package/src/node/cache.ts +408 -408
  83. package/src/node/config.ts +192 -192
  84. package/src/node/index.ts +21 -21
  85. package/src/node/mdx.ts +120 -120
  86. package/src/node/plugin/entry.ts +58 -58
  87. package/src/node/plugin/html.ts +55 -55
  88. package/src/node/plugin/index.ts +193 -193
  89. package/src/node/plugin/types.ts +11 -11
  90. package/src/node/routes/cache.ts +28 -28
  91. package/src/node/routes/index.ts +167 -167
  92. package/src/node/routes/parser.ts +153 -127
  93. package/src/node/routes/sorter.ts +42 -42
  94. package/src/node/routes/types.ts +49 -49
  95. package/src/node/ssg/index.ts +114 -114
  96. package/src/node/ssg/meta.ts +34 -34
  97. package/src/node/ssg/options.ts +13 -13
  98. package/src/node/ssg/sitemap.ts +54 -54
  99. package/src/node/utils.ts +134 -134
  100. package/tsconfig.json +20 -20
  101. package/tsup.config.ts +22 -22
@@ -1,154 +1,154 @@
1
- import { useState, useCallback } from "react";
2
- import { Copy, Check } from "lucide-react";
3
- import { NPM } from "../../icons/npm";
4
- import { Pnpm } from "../../icons/pnpm";
5
- import { Bun } from "../../icons/bun";
6
- import { Deno } from "../../icons/deno";
7
-
8
- interface PackageManagerTabsProps {
9
- command: string;
10
- pkg?: string;
11
- className?: string;
12
- }
13
-
14
- type PackageManager = "npm" | "pnpm" | "bun" | "deno";
15
-
16
- const MANAGERS: {
17
- id: PackageManager;
18
- label: string;
19
- icon: any;
20
- }[] = [
21
- { id: "npm", label: "npm", icon: NPM },
22
- { id: "pnpm", label: "pnpm", icon: Pnpm },
23
- { id: "bun", label: "bun", icon: Bun },
24
- { id: "deno", label: "deno", icon: Deno },
25
- ];
26
-
27
- /**
28
- * Returns the exact command for a specific package manager based on the action.
29
- * Maps generic actions like 'install' to their specific permutations (e.g., yarn add, npm install).
30
- */
31
- function getCommandForManager(
32
- manager: PackageManager,
33
- command: string,
34
- pkg: string,
35
- ): string {
36
- const isInstall =
37
- command === "install" || command === "add" || command === "i";
38
- const isCreate = command === "create" || command === "init";
39
- const isRun = command === "run" || command === "exec";
40
-
41
- // Installation commands
42
- if (isInstall) {
43
- const pkgArgs = pkg ? ` ${pkg}` : "";
44
- if (manager === "npm") return `npm install${pkgArgs}`;
45
- if (manager === "pnpm") return pkg ? `pnpm add${pkgArgs}` : `pnpm install`;
46
- if (manager === "bun") return pkg ? `bun add${pkgArgs}` : `bun install`;
47
- if (manager === "deno")
48
- return pkg ? `deno install npm:${pkg}` : `deno install`;
49
- }
50
-
51
- // Create/Init commands
52
- if (isCreate) {
53
- const pkgArgs = pkg ? ` ${pkg}` : "";
54
- if (manager === "npm") return `npm create${pkgArgs}`;
55
- if (manager === "pnpm") return `pnpm create${pkgArgs}`;
56
- if (manager === "bun") return `bun create${pkgArgs}`;
57
- if (manager === "deno") return `deno run -A npm:create-${pkg}`; // Approximation
58
- }
59
-
60
- // Run/Exec commands
61
- if (isRun) {
62
- const pkgArgs = pkg ? ` ${pkg}` : "";
63
- if (manager === "npm") return `npm run${pkgArgs}`;
64
- if (manager === "pnpm") return `pnpm run${pkgArgs}`;
65
- if (manager === "bun") return `bun run${pkgArgs}`;
66
- if (manager === "deno") return `deno task ${pkg}`;
67
- }
68
-
69
- // Fallback: just prefix the manager
70
- const pkgArgs = pkg ? ` ${pkg}` : "";
71
- return `${manager} ${command}${pkgArgs}`;
72
- }
73
-
74
- export function PackageManagerTabs({
75
- command,
76
- pkg = "",
77
- className = "",
78
- }: PackageManagerTabsProps) {
79
- const [activeTab, setActiveTab] = useState<PackageManager>("npm");
80
- const [copied, setCopied] = useState(false);
81
-
82
- const activeCommand = getCommandForManager(activeTab, command, pkg);
83
-
84
- const handleCopy = useCallback(async () => {
85
- try {
86
- await navigator.clipboard.writeText(activeCommand);
87
- setCopied(true);
88
- setTimeout(() => setCopied(false), 2000);
89
- } catch {
90
- const textarea = document.createElement("textarea");
91
- textarea.value = activeCommand;
92
- textarea.style.position = "fixed";
93
- textarea.style.opacity = "0";
94
- document.body.appendChild(textarea);
95
- textarea.select();
96
- document.execCommand("copy");
97
- document.body.removeChild(textarea);
98
- setCopied(true);
99
- setTimeout(() => setCopied(false), 2000);
100
- }
101
- }, [activeCommand]);
102
-
103
- return (
104
- <div className={`pkg-tabs-wrapper ${className}`}>
105
- {/* Tab Headers */}
106
- <div className="pkg-tabs-header">
107
- {MANAGERS.map((mgr) => {
108
- const Icon = mgr.icon;
109
- const isActive = activeTab === mgr.id;
110
- return (
111
- <button
112
- key={mgr.id}
113
- className={`pkg-tab-btn ${isActive ? "active" : ""}`}
114
- onClick={() => setActiveTab(mgr.id)}
115
- aria-selected={isActive}
116
- role="tab"
117
- >
118
- <Icon className="pkg-tab-icon" width="16" height="16" />
119
- <span>{mgr.label}</span>
120
- </button>
121
- );
122
- })}
123
- </div>
124
-
125
- {/* Code Block Content */}
126
- <div className="code-block-wrapper pkg-tabs-content">
127
- <div className="code-block-header">
128
- <span className="code-block-lang">bash</span>
129
- <button
130
- className={`code-block-copy ${copied ? "copied" : ""}`}
131
- onClick={handleCopy}
132
- type="button"
133
- aria-label="Copy code"
134
- >
135
- {copied ? (
136
- <>
137
- <Check size={12} />
138
- </>
139
- ) : (
140
- <>
141
- <Copy size={12} />
142
- </>
143
- )}
144
- </button>
145
- </div>
146
- <pre>
147
- <code>
148
- <span className="line">{activeCommand}</span>
149
- </code>
150
- </pre>
151
- </div>
152
- </div>
153
- );
154
- }
1
+ import { useState, useCallback } from "react";
2
+ import { Copy, Check } from "lucide-react";
3
+ import { NPM } from "../../icons/npm";
4
+ import { Pnpm } from "../../icons/pnpm";
5
+ import { Bun } from "../../icons/bun";
6
+ import { Deno } from "../../icons/deno";
7
+
8
+ interface PackageManagerTabsProps {
9
+ command: string;
10
+ pkg?: string;
11
+ className?: string;
12
+ }
13
+
14
+ type PackageManager = "npm" | "pnpm" | "bun" | "deno";
15
+
16
+ const MANAGERS: {
17
+ id: PackageManager;
18
+ label: string;
19
+ icon: any;
20
+ }[] = [
21
+ { id: "npm", label: "npm", icon: NPM },
22
+ { id: "pnpm", label: "pnpm", icon: Pnpm },
23
+ { id: "bun", label: "bun", icon: Bun },
24
+ { id: "deno", label: "deno", icon: Deno },
25
+ ];
26
+
27
+ /**
28
+ * Returns the exact command for a specific package manager based on the action.
29
+ * Maps generic actions like 'install' to their specific permutations (e.g., yarn add, npm install).
30
+ */
31
+ function getCommandForManager(
32
+ manager: PackageManager,
33
+ command: string,
34
+ pkg: string,
35
+ ): string {
36
+ const isInstall =
37
+ command === "install" || command === "add" || command === "i";
38
+ const isCreate = command === "create" || command === "init";
39
+ const isRun = command === "run" || command === "exec";
40
+
41
+ // Installation commands
42
+ if (isInstall) {
43
+ const pkgArgs = pkg ? ` ${pkg}` : "";
44
+ if (manager === "npm") return `npm install${pkgArgs}`;
45
+ if (manager === "pnpm") return pkg ? `pnpm add${pkgArgs}` : `pnpm install`;
46
+ if (manager === "bun") return pkg ? `bun add${pkgArgs}` : `bun install`;
47
+ if (manager === "deno")
48
+ return pkg ? `deno install npm:${pkg}` : `deno install`;
49
+ }
50
+
51
+ // Create/Init commands
52
+ if (isCreate) {
53
+ const pkgArgs = pkg ? ` ${pkg}` : "";
54
+ if (manager === "npm") return `npm create${pkgArgs}`;
55
+ if (manager === "pnpm") return `pnpm create${pkgArgs}`;
56
+ if (manager === "bun") return `bun create${pkgArgs}`;
57
+ if (manager === "deno") return `deno run -A npm:create-${pkg}`; // Approximation
58
+ }
59
+
60
+ // Run/Exec commands
61
+ if (isRun) {
62
+ const pkgArgs = pkg ? ` ${pkg}` : "";
63
+ if (manager === "npm") return `npm run${pkgArgs}`;
64
+ if (manager === "pnpm") return `pnpm run${pkgArgs}`;
65
+ if (manager === "bun") return `bun run${pkgArgs}`;
66
+ if (manager === "deno") return `deno task ${pkg}`;
67
+ }
68
+
69
+ // Fallback: just prefix the manager
70
+ const pkgArgs = pkg ? ` ${pkg}` : "";
71
+ return `${manager} ${command}${pkgArgs}`;
72
+ }
73
+
74
+ export function PackageManagerTabs({
75
+ command,
76
+ pkg = "",
77
+ className = "",
78
+ }: PackageManagerTabsProps) {
79
+ const [activeTab, setActiveTab] = useState<PackageManager>("npm");
80
+ const [copied, setCopied] = useState(false);
81
+
82
+ const activeCommand = getCommandForManager(activeTab, command, pkg);
83
+
84
+ const handleCopy = useCallback(async () => {
85
+ try {
86
+ await navigator.clipboard.writeText(activeCommand);
87
+ setCopied(true);
88
+ setTimeout(() => setCopied(false), 2000);
89
+ } catch {
90
+ const textarea = document.createElement("textarea");
91
+ textarea.value = activeCommand;
92
+ textarea.style.position = "fixed";
93
+ textarea.style.opacity = "0";
94
+ document.body.appendChild(textarea);
95
+ textarea.select();
96
+ document.execCommand("copy");
97
+ document.body.removeChild(textarea);
98
+ setCopied(true);
99
+ setTimeout(() => setCopied(false), 2000);
100
+ }
101
+ }, [activeCommand]);
102
+
103
+ return (
104
+ <div className={`pkg-tabs-wrapper ${className}`}>
105
+ {/* Tab Headers */}
106
+ <div className="pkg-tabs-header">
107
+ {MANAGERS.map((mgr) => {
108
+ const Icon = mgr.icon;
109
+ const isActive = activeTab === mgr.id;
110
+ return (
111
+ <button
112
+ key={mgr.id}
113
+ className={`pkg-tab-btn ${isActive ? "active" : ""}`}
114
+ onClick={() => setActiveTab(mgr.id)}
115
+ aria-selected={isActive}
116
+ role="tab"
117
+ >
118
+ <Icon className="pkg-tab-icon" width="16" height="16" />
119
+ <span>{mgr.label}</span>
120
+ </button>
121
+ );
122
+ })}
123
+ </div>
124
+
125
+ {/* Code Block Content */}
126
+ <div className="code-block-wrapper pkg-tabs-content">
127
+ <div className="code-block-header">
128
+ <span className="code-block-lang">bash</span>
129
+ <button
130
+ className={`code-block-copy ${copied ? "copied" : ""}`}
131
+ onClick={handleCopy}
132
+ type="button"
133
+ aria-label="Copy code"
134
+ >
135
+ {copied ? (
136
+ <>
137
+ <Check size={12} />
138
+ </>
139
+ ) : (
140
+ <>
141
+ <Copy size={12} />
142
+ </>
143
+ )}
144
+ </button>
145
+ </div>
146
+ <pre>
147
+ <code>
148
+ <span className="line">{activeCommand}</span>
149
+ </code>
150
+ </pre>
151
+ </div>
152
+ </div>
153
+ );
154
+ }
@@ -1 +1 @@
1
- export { PackageManagerTabs } from "./PackageManagerTabs";
1
+ export { PackageManagerTabs } from "./PackageManagerTabs";
@@ -1,64 +1,64 @@
1
-
2
- /* ═══════════════════════════════════════════════════════════
3
- PACKAGE MANAGER TABS
4
- ═══════════════════════════════════════════════════════════ */
5
- .pkg-tabs-wrapper {
6
- margin: 1.5rem 0;
7
- }
8
-
9
- .pkg-tabs-header {
10
- display: flex;
11
- gap: 0.25rem;
12
- overflow-x: auto;
13
- padding-bottom: 0.5rem;
14
- margin-bottom: -0.5rem; /* pull down to meet code block */
15
- scrollbar-width: none;
16
- }
17
-
18
- .pkg-tabs-header::-webkit-scrollbar {
19
- display: none;
20
- }
21
-
22
- .pkg-tab-btn {
23
- display: inline-flex;
24
- align-items: center;
25
- gap: 0.4rem;
26
- padding: 0.5rem 1rem;
27
- background-color: var(--ld-bg-soft);
28
- border: 1px solid var(--ld-border-subtle);
29
- border-bottom: none;
30
- border-radius: var(--ld-radius-md) var(--ld-radius-md) 0 0;
31
- color: var(--ld-text-muted);
32
- font-family: var(--ld-font-sans);
33
- font-size: 0.8125rem;
34
- font-weight: 500;
35
- cursor: pointer;
36
- transition: all 0.2s;
37
- opacity: 0.7;
38
- }
39
-
40
- .pkg-tab-btn:hover {
41
- color: var(--ld-text-main);
42
- background-color: var(--ld-bg-mute);
43
- opacity: 1;
44
- }
45
-
46
- .pkg-tab-btn.active {
47
- background-color: var(--ld-code-bg);
48
- color: var(--ld-text-main);
49
- border-color: var(--ld-border-subtle);
50
- opacity: 1;
51
- position: relative;
52
- z-index: 2;
53
- margin-bottom: -1px; /* Overlap border */
54
- }
55
-
56
- .pkg-tab-icon {
57
- display: inline-block;
58
- }
59
-
60
- /* Ensure tab content sits seamlessly below the tabs */
61
- .pkg-tabs-content {
62
- margin-top: 0 !important;
63
- border-top-left-radius: 0 !important;
64
- }
1
+
2
+ /* ═══════════════════════════════════════════════════════════
3
+ PACKAGE MANAGER TABS
4
+ ═══════════════════════════════════════════════════════════ */
5
+ .pkg-tabs-wrapper {
6
+ margin: 1.5rem 0;
7
+ }
8
+
9
+ .pkg-tabs-header {
10
+ display: flex;
11
+ gap: 0.25rem;
12
+ overflow-x: auto;
13
+ padding-bottom: 0.5rem;
14
+ margin-bottom: -0.5rem; /* pull down to meet code block */
15
+ scrollbar-width: none;
16
+ }
17
+
18
+ .pkg-tabs-header::-webkit-scrollbar {
19
+ display: none;
20
+ }
21
+
22
+ .pkg-tab-btn {
23
+ display: inline-flex;
24
+ align-items: center;
25
+ gap: 0.4rem;
26
+ padding: 0.5rem 1rem;
27
+ background-color: var(--ld-bg-soft);
28
+ border: 1px solid var(--ld-border-subtle);
29
+ border-bottom: none;
30
+ border-radius: var(--ld-radius-md) var(--ld-radius-md) 0 0;
31
+ color: var(--ld-text-muted);
32
+ font-family: var(--ld-font-sans);
33
+ font-size: 0.8125rem;
34
+ font-weight: 500;
35
+ cursor: pointer;
36
+ transition: all 0.2s;
37
+ opacity: 0.7;
38
+ }
39
+
40
+ .pkg-tab-btn:hover {
41
+ color: var(--ld-text-main);
42
+ background-color: var(--ld-bg-mute);
43
+ opacity: 1;
44
+ }
45
+
46
+ .pkg-tab-btn.active {
47
+ background-color: var(--ld-code-bg);
48
+ color: var(--ld-text-main);
49
+ border-color: var(--ld-border-subtle);
50
+ opacity: 1;
51
+ position: relative;
52
+ z-index: 2;
53
+ margin-bottom: -1px; /* Overlap border */
54
+ }
55
+
56
+ .pkg-tab-icon {
57
+ display: inline-block;
58
+ }
59
+
60
+ /* Ensure tab content sits seamlessly below the tabs */
61
+ .pkg-tabs-content {
62
+ margin-top: 0 !important;
63
+ border-top-left-radius: 0 !important;
64
+ }