@acmekit/docs-app 2.13.43

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.
@@ -0,0 +1,5 @@
1
+ export { routes } from 'virtual:acmekit/docs-routes';
2
+
3
+ declare function render(url: string, basePath: string): string;
4
+
5
+ export { render };
@@ -0,0 +1,5 @@
1
+ export { routes } from 'virtual:acmekit/docs-routes';
2
+
3
+ declare function render(url: string, basePath: string): string;
4
+
5
+ export { render };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/entry-server.tsx
21
+ var entry_server_exports = {};
22
+ __export(entry_server_exports, {
23
+ render: () => render,
24
+ routes: () => import_docs_routes.routes
25
+ });
26
+ module.exports = __toCommonJS(entry_server_exports);
27
+ var import_server = require("react-dom/server");
28
+ var import_server2 = require("react-router-dom/server");
29
+ var import_react_router_dom = require("react-router-dom");
30
+ var import_docs_routes = require("virtual:acmekit/docs-routes");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ function render(url, basePath) {
33
+ return (0, import_server.renderToString)(
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_server2.StaticRouter, { basename: basePath, location: url, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-screen w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Routes, { children: import_docs_routes.routes.map((route) => {
35
+ const Component = import_docs_routes.components[route.path];
36
+ if (!Component) return null;
37
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
38
+ import_react_router_dom.Route,
39
+ {
40
+ path: route.path,
41
+ element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {})
42
+ },
43
+ route.path
44
+ );
45
+ }) }) }) })
46
+ );
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ render,
51
+ routes
52
+ });
@@ -0,0 +1,26 @@
1
+ // src/entry-server.tsx
2
+ import { renderToString } from "react-dom/server";
3
+ import { StaticRouter } from "react-router-dom/server";
4
+ import { Routes, Route } from "react-router-dom";
5
+ import { routes, components } from "virtual:acmekit/docs-routes";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function render(url, basePath) {
8
+ return renderToString(
9
+ /* @__PURE__ */ jsx(StaticRouter, { basename: basePath, location: url, children: /* @__PURE__ */ jsx("div", { className: "h-screen w-full overflow-hidden", children: /* @__PURE__ */ jsx(Routes, { children: routes.map((route) => {
10
+ const Component = components[route.path];
11
+ if (!Component) return null;
12
+ return /* @__PURE__ */ jsx(
13
+ Route,
14
+ {
15
+ path: route.path,
16
+ element: /* @__PURE__ */ jsx(Component, {})
17
+ },
18
+ route.path
19
+ );
20
+ }) }) }) })
21
+ );
22
+ }
23
+ export {
24
+ render,
25
+ routes
26
+ };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { DocsRouteEntry, DocsSidebarItem } from '@acmekit/docs-shared';
3
+
4
+ type DocsPlugin = {
5
+ name: string;
6
+ routes?: DocsRouteEntry[];
7
+ sidebar?: DocsSidebarItem[];
8
+ };
9
+
10
+ type DocsAppProps = {
11
+ plugins?: DocsPlugin[];
12
+ };
13
+ declare function DocsApp({ plugins }: DocsAppProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { DocsApp, type DocsPlugin };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { DocsRouteEntry, DocsSidebarItem } from '@acmekit/docs-shared';
3
+
4
+ type DocsPlugin = {
5
+ name: string;
6
+ routes?: DocsRouteEntry[];
7
+ sidebar?: DocsSidebarItem[];
8
+ };
9
+
10
+ type DocsAppProps = {
11
+ plugins?: DocsPlugin[];
12
+ };
13
+ declare function DocsApp({ plugins }: DocsAppProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { DocsApp, type DocsPlugin };
package/dist/index.js ADDED
@@ -0,0 +1,507 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ DocsApp: () => DocsApp
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/docs-app.tsx
38
+ var import_react8 = require("react");
39
+ var import_react_router_dom5 = require("react-router-dom");
40
+ var import_docs_routes2 = require("virtual:acmekit/docs-routes");
41
+ var import_docs_config2 = require("virtual:acmekit/docs-config");
42
+ var import_docs_ui8 = require("@acmekit/docs-ui");
43
+
44
+ // src/providers/DocsProviders.tsx
45
+ var import_react = require("react");
46
+ var import_docs_ui = require("@acmekit/docs-ui");
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ function DocsProviders({ children, config: config3 }) {
49
+ const navItems = (0, import_react.useMemo)(() => {
50
+ if (!config3.areas?.length) {
51
+ return [];
52
+ }
53
+ return config3.areas.map((area) => ({
54
+ type: "link",
55
+ link: `/${area.id}`,
56
+ title: area.title
57
+ }));
58
+ }, [config3.areas]);
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.RootProviders, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
+ import_docs_ui.SiteConfigProvider,
61
+ {
62
+ config: {
63
+ baseUrl: "",
64
+ basePath: config3.basePath,
65
+ sidebars: config3.sidebars || [],
66
+ project: {
67
+ title: config3.title || "Documentation",
68
+ key: "docs"
69
+ },
70
+ logo: config3.logo || "",
71
+ version: config3.version
72
+ },
73
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.ScrollControllerProvider, { scrollableSelector: "#main", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_docs_ui.SidebarProvider,
75
+ {
76
+ sidebars: config3.sidebars || [],
77
+ isSidebarStatic: true,
78
+ shouldHandlePathChange: true,
79
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.NotificationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.PaginationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.MainNavProvider, { navItems, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.SearchProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_docs_ui.AiAssistantProvider, { children }) }) }) }) })
80
+ }
81
+ ) })
82
+ }
83
+ ) });
84
+ }
85
+
86
+ // src/components/Layout.tsx
87
+ var import_react2 = __toESM(require("react"));
88
+ var import_react_router_dom = require("react-router-dom");
89
+ var import_docs_ui2 = require("@acmekit/docs-ui");
90
+ var import_clsx = __toESM(require("clsx"));
91
+ var import_jsx_runtime2 = require("react/jsx-runtime");
92
+ function Layout() {
93
+ const { isBrowser } = (0, import_docs_ui2.useIsBrowser)();
94
+ const { desktopSidebarOpen, sidebars } = (0, import_docs_ui2.useSidebar)();
95
+ const { mainContentRef, showCollapsedNavbar } = (0, import_docs_ui2.useLayout)();
96
+ const { frontmatter } = (0, import_docs_ui2.useSiteConfig)();
97
+ const { pathname } = (0, import_react_router_dom.useLocation)();
98
+ const isAreasRoot = pathname === "/" && sidebars.length > 1;
99
+ import_react2.default.useEffect(() => {
100
+ if (!isBrowser) return;
101
+ const rootLayout = document.getElementById("root-layout");
102
+ if (desktopSidebarOpen && !isAreasRoot) {
103
+ rootLayout?.classList.add("lg:grid-cols-[221px_1fr]");
104
+ } else {
105
+ rootLayout?.classList.remove("lg:grid-cols-[221px_1fr]");
106
+ }
107
+ }, [desktopSidebarOpen, isBrowser, isAreasRoot]);
108
+ const showContentMenu = !frontmatter.hide_content_menu && !isAreasRoot;
109
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
110
+ "div",
111
+ {
112
+ className: (0, import_clsx.default)(
113
+ "bg-acmekit-bg-subtle font-base text-medium w-full",
114
+ "text-acmekit-fg-base",
115
+ "h-full overflow-hidden",
116
+ "grid grid-cols-1 lg:mx-auto",
117
+ !isAreasRoot && "lg:grid-cols-[221px_1fr]"
118
+ ),
119
+ id: "root-layout",
120
+ children: [
121
+ !isAreasRoot && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_docs_ui2.Sidebar, {}),
122
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "relative h-screen flex", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
123
+ "div",
124
+ {
125
+ className: (0, import_clsx.default)(
126
+ "relative max-w-full",
127
+ "h-full flex-1",
128
+ "flex flex-col",
129
+ "gap-docs_0.5 lg:py-docs_0.25 lg:mr-docs_0.25 scroll-m-docs_0.25",
130
+ !desktopSidebarOpen && "lg:ml-docs_0.25"
131
+ ),
132
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
133
+ "div",
134
+ {
135
+ className: (0, import_clsx.default)(
136
+ "bg-acmekit-bg-base",
137
+ "flex-col items-center",
138
+ "h-full w-full",
139
+ "overflow-y-scroll overflow-x-hidden",
140
+ "md:rounded-docs_DEFAULT",
141
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark"
142
+ ),
143
+ id: "main",
144
+ ref: mainContentRef,
145
+ children: [
146
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_docs_ui2.MainNav, {}),
147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
+ "div",
149
+ {
150
+ className: (0, import_clsx.default)(
151
+ "pt-docs_4 lg:pt-docs_6 pb-docs_8 lg:pb-docs_4",
152
+ showContentMenu && "grid grid-cols-1 lg:mx-auto",
153
+ desktopSidebarOpen && showContentMenu && "lg:grid-cols-[1fr_221px]"
154
+ ),
155
+ id: "content",
156
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
157
+ "div",
158
+ {
159
+ className: (0, import_clsx.default)(
160
+ "w-full h-fit",
161
+ "max-w-inner-content-xs sm:max-w-inner-content-sm",
162
+ "md:max-w-inner-content-md lg:max-w-inner-content-lg",
163
+ "xl:max-w-inner-content-xl xxl:max-w-inner-content-xxl",
164
+ "xxxl:max-w-inner-content-xxxl",
165
+ "px-docs_1 md:px-docs_4 lg:px-0"
166
+ ),
167
+ children: [
168
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_docs_ui2.Breadcrumbs, {}),
169
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_router_dom.Outlet, {}),
170
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_docs_ui2.Footer, { showPagination: true })
171
+ ]
172
+ }
173
+ ) })
174
+ }
175
+ ),
176
+ showContentMenu && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_docs_ui2.ContentMenu, {})
177
+ ]
178
+ }
179
+ )
180
+ }
181
+ ) })
182
+ ]
183
+ }
184
+ );
185
+ }
186
+
187
+ // src/components/DocPage.tsx
188
+ var import_react4 = require("react");
189
+ var import_react_router_dom2 = require("react-router-dom");
190
+ var import_docs_ui4 = require("@acmekit/docs-ui");
191
+
192
+ // src/components/MDXContent.tsx
193
+ var import_react3 = require("@mdx-js/react");
194
+ var import_docs_ui3 = require("@acmekit/docs-ui");
195
+ var import_jsx_runtime3 = require("react/jsx-runtime");
196
+ function MDXContent({ children }) {
197
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.MDXProvider, { components: import_docs_ui3.MDXComponents, children });
198
+ }
199
+
200
+ // src/components/DocPage.tsx
201
+ var import_jsx_runtime4 = require("react/jsx-runtime");
202
+ function DocPage({ children, frontmatter }) {
203
+ const { setFrontmatter, setToc } = (0, import_docs_ui4.useSiteConfig)();
204
+ const location = (0, import_react_router_dom2.useLocation)();
205
+ const articleRef = (0, import_react4.useRef)(null);
206
+ (0, import_react4.useEffect)(() => {
207
+ setFrontmatter({
208
+ ...frontmatter,
209
+ generate_toc: true
210
+ });
211
+ setToc([]);
212
+ }, [location.pathname, frontmatter]);
213
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("article", { ref: articleRef, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MDXContent, { children }) });
214
+ }
215
+
216
+ // src/components/HomePage.tsx
217
+ var import_react5 = require("react");
218
+ var import_react_router_dom3 = require("react-router-dom");
219
+ var import_docs_ui5 = require("@acmekit/docs-ui");
220
+ var import_docs_config = require("virtual:acmekit/docs-config");
221
+ var import_docs_routes = require("virtual:acmekit/docs-routes");
222
+ var import_jsx_runtime5 = require("react/jsx-runtime");
223
+ function HomePage() {
224
+ const rootRoute = import_docs_routes.routes.find((r) => r.path === "/");
225
+ const RootComponent = import_docs_routes.components["/"];
226
+ if (RootComponent) {
227
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DocPage, { frontmatter: rootRoute?.frontmatter, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react5.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_docs_ui5.Loading, { count: 8 }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RootComponent, {}) }) });
228
+ }
229
+ if (import_docs_config.config.areas?.length) {
230
+ const plugins = import_docs_config.config.plugins || [];
231
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "py-docs_2", children: [
232
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { className: "text-docs-h1 font-docs-heading text-acmekit-fg-base mb-docs_0.5", children: import_docs_config.config.title }),
233
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-regular text-acmekit-fg-muted mb-docs_2", children: "Browse the documentation areas below." }),
234
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid gap-docs_1 sm:grid-cols-2 lg:grid-cols-3", children: import_docs_config.config.areas.map((area) => {
235
+ const sidebar = import_docs_config.config.sidebars?.find(
236
+ (s) => s.sidebar_id === area.sidebar_id
237
+ );
238
+ const count = sidebar?.items?.length ?? 0;
239
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
240
+ import_react_router_dom3.Link,
241
+ {
242
+ to: `/${area.id}`,
243
+ className: "group block rounded-docs_DEFAULT border border-acmekit-border-base bg-acmekit-bg-base p-docs_1.5 no-underline transition-all hover:shadow-elevation-card-hover dark:hover:shadow-elevation-card-hover-dark",
244
+ children: [
245
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-compact-medium-plus text-acmekit-fg-base mb-docs_0.25 group-hover:text-acmekit-fg-interactive", children: area.title }),
246
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "text-compact-small text-acmekit-fg-muted", children: [
247
+ count,
248
+ " ",
249
+ count === 1 ? "section" : "sections"
250
+ ] })
251
+ ]
252
+ },
253
+ area.id
254
+ );
255
+ }) }),
256
+ plugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-docs-h2 font-docs-heading text-acmekit-fg-base mt-docs_2 mb-docs_1", children: "Plugins" }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid gap-docs_1 sm:grid-cols-2 lg:grid-cols-3", children: plugins.map((plugin) => {
259
+ const sidebar = import_docs_config.config.sidebars?.find(
260
+ (s) => s.sidebar_id === plugin.sidebar_id
261
+ );
262
+ const count = sidebar?.items?.length ?? 0;
263
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
264
+ import_react_router_dom3.Link,
265
+ {
266
+ to: `/plugins/${plugin.slug}`,
267
+ className: "group block rounded-docs_DEFAULT border border-acmekit-border-base bg-acmekit-bg-base p-docs_1.5 no-underline transition-all hover:shadow-elevation-card-hover dark:hover:shadow-elevation-card-hover-dark",
268
+ children: [
269
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-compact-medium-plus text-acmekit-fg-base mb-docs_0.25 group-hover:text-acmekit-fg-interactive", children: plugin.title }),
270
+ plugin.description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-compact-small text-acmekit-fg-muted mb-docs_0.25", children: plugin.description }),
271
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "text-compact-small text-acmekit-fg-subtle", children: [
272
+ count,
273
+ " ",
274
+ count === 1 ? "page" : "pages"
275
+ ] })
276
+ ]
277
+ },
278
+ plugin.slug
279
+ );
280
+ }) })
281
+ ] })
282
+ ] });
283
+ }
284
+ const categories = (import_docs_config.config.sidebars?.[0]?.items || []).filter(
285
+ (item) => item.type === "category" && item.children?.length
286
+ );
287
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "py-docs_2", children: [
288
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { className: "text-docs-h1 font-docs-heading text-acmekit-fg-base mb-docs_0.5", children: import_docs_config.config.title }),
289
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-regular text-acmekit-fg-muted mb-docs_2", children: "Browse the documentation to get started." }),
290
+ categories.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid gap-docs_1 sm:grid-cols-2 lg:grid-cols-3", children: categories.map((cat) => {
291
+ const firstLink = cat.children?.find(
292
+ (c) => c.type === "link" && c.path
293
+ );
294
+ const targetPath = firstLink?.path || "/";
295
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
296
+ import_react_router_dom3.Link,
297
+ {
298
+ to: targetPath,
299
+ className: "group block rounded-docs_DEFAULT border border-acmekit-border-base bg-acmekit-bg-base p-docs_1.5 no-underline transition-all hover:shadow-elevation-card-hover dark:hover:shadow-elevation-card-hover-dark",
300
+ children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-compact-medium-plus text-acmekit-fg-base mb-docs_0.25 group-hover:text-acmekit-fg-interactive", children: cat.title }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "text-compact-small text-acmekit-fg-muted", children: [
303
+ cat.children?.length,
304
+ " ",
305
+ cat.children?.length === 1 ? "article" : "articles"
306
+ ] })
307
+ ]
308
+ },
309
+ cat.title
310
+ );
311
+ }) })
312
+ ] });
313
+ }
314
+
315
+ // src/components/RouteErrorBoundary.tsx
316
+ var import_react6 = __toESM(require("react"));
317
+ var import_docs_ui6 = require("@acmekit/docs-ui");
318
+ var import_jsx_runtime6 = require("react/jsx-runtime");
319
+ var RouteErrorBoundary = class extends import_react6.default.Component {
320
+ constructor() {
321
+ super(...arguments);
322
+ this.state = { hasError: false };
323
+ }
324
+ static getDerivedStateFromError() {
325
+ return { hasError: true };
326
+ }
327
+ render() {
328
+ if (this.state.hasError) {
329
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_docs_ui6.ErrorPage, {});
330
+ }
331
+ return this.props.children;
332
+ }
333
+ };
334
+
335
+ // src/components/SearchModal.tsx
336
+ var import_react7 = __toESM(require("react"));
337
+ var import_react_router_dom4 = require("react-router-dom");
338
+ var import_docs_ui7 = require("@acmekit/docs-ui");
339
+ var import_docs_search = require("virtual:acmekit/docs-search");
340
+ var import_jsx_runtime7 = require("react/jsx-runtime");
341
+ function scoreEntry(entry, words) {
342
+ let score = 0;
343
+ const title = entry.title.toLowerCase();
344
+ const desc = entry.description.toLowerCase();
345
+ const body = entry.body.toLowerCase();
346
+ for (const word of words) {
347
+ if (title.includes(word)) score += 3;
348
+ if (desc.includes(word)) score += 2;
349
+ if (body.includes(word)) score += 1;
350
+ }
351
+ return score;
352
+ }
353
+ function SearchModal() {
354
+ const { isOpen, setIsOpen, modalRef } = (0, import_docs_ui7.useSearch)();
355
+ const [query, setQuery] = (0, import_react7.useState)("");
356
+ const [activeIndex, setActiveIndex] = (0, import_react7.useState)(0);
357
+ const navigate = (0, import_react_router_dom4.useNavigate)();
358
+ const searchWrapperRef = (0, import_react7.useRef)(null);
359
+ const results = import_react7.default.useMemo(() => {
360
+ if (!query.trim()) return [];
361
+ const words = query.toLowerCase().split(/\s+/).filter((w) => w.length > 0);
362
+ return import_docs_search.searchIndex.map((entry) => ({
363
+ path: entry.path,
364
+ title: entry.title,
365
+ description: entry.description,
366
+ score: scoreEntry(entry, words)
367
+ })).filter((r) => r.score > 0).sort((a, b) => b.score - a.score).slice(0, 20);
368
+ }, [query]);
369
+ (0, import_react7.useEffect)(() => {
370
+ setActiveIndex(0);
371
+ }, [results]);
372
+ (0, import_react7.useEffect)(() => {
373
+ function onKeyDown2(e) {
374
+ if ((e.metaKey || e.ctrlKey) && e.key === "k") {
375
+ e.preventDefault();
376
+ setIsOpen((prev) => !prev);
377
+ }
378
+ }
379
+ document.addEventListener("keydown", onKeyDown2);
380
+ return () => document.removeEventListener("keydown", onKeyDown2);
381
+ }, [setIsOpen]);
382
+ (0, import_react7.useEffect)(() => {
383
+ const dialog = modalRef.current;
384
+ if (!dialog) return;
385
+ if (isOpen) {
386
+ dialog.showModal();
387
+ searchWrapperRef.current?.querySelector("input")?.focus();
388
+ } else {
389
+ dialog.close();
390
+ setQuery("");
391
+ }
392
+ }, [isOpen, modalRef]);
393
+ const navigateTo = (0, import_react7.useCallback)(
394
+ (path) => {
395
+ navigate(path);
396
+ setIsOpen(false);
397
+ },
398
+ [navigate, setIsOpen]
399
+ );
400
+ function onKeyDown(e) {
401
+ if (e.key === "ArrowDown") {
402
+ e.preventDefault();
403
+ setActiveIndex((i) => Math.min(i + 1, results.length - 1));
404
+ } else if (e.key === "ArrowUp") {
405
+ e.preventDefault();
406
+ setActiveIndex((i) => Math.max(i - 1, 0));
407
+ } else if (e.key === "Enter" && results[activeIndex]) {
408
+ e.preventDefault();
409
+ navigateTo(results[activeIndex].path);
410
+ }
411
+ }
412
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
413
+ "dialog",
414
+ {
415
+ ref: modalRef,
416
+ className: "fixed inset-0 z-50 m-0 h-full w-full max-h-full max-w-full bg-transparent p-0 backdrop:bg-acmekit-bg-overlay",
417
+ onClick: (e) => {
418
+ if (e.target === e.currentTarget) setIsOpen(false);
419
+ },
420
+ onClose: () => setIsOpen(false),
421
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mx-auto mt-[15vh] w-full max-w-[540px] rounded-docs_DEFAULT border border-acmekit-border-base bg-acmekit-bg-base shadow-elevation-modal dark:shadow-elevation-modal-dark", children: [
422
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: searchWrapperRef, className: "p-docs_1", onKeyDown, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
423
+ import_docs_ui7.SearchInput,
424
+ {
425
+ value: query,
426
+ onChange: setQuery,
427
+ placeholder: "Search documentation...",
428
+ autoFocus: true
429
+ }
430
+ ) }),
431
+ results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "max-h-[50vh] overflow-y-auto border-t border-acmekit-border-base p-docs_0.5", children: results.map((result, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
432
+ "button",
433
+ {
434
+ type: "button",
435
+ className: `w-full rounded-docs_sm px-docs_1 py-docs_0.5 text-left transition-colors ${i === activeIndex ? "bg-acmekit-bg-base-hover" : "hover:bg-acmekit-bg-base-hover"}`,
436
+ onMouseEnter: () => setActiveIndex(i),
437
+ onClick: () => navigateTo(result.path),
438
+ children: [
439
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-compact-small-plus text-acmekit-fg-base block", children: result.title }),
440
+ result.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-compact-x-small text-acmekit-fg-muted block truncate", children: result.description })
441
+ ]
442
+ }
443
+ ) }, result.path)) }),
444
+ query.trim() && results.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "border-t border-acmekit-border-base p-docs_1 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-compact-small text-acmekit-fg-muted", children: "No results found" }) })
445
+ ] })
446
+ }
447
+ );
448
+ }
449
+
450
+ // src/docs-app.tsx
451
+ var import_jsx_runtime8 = require("react/jsx-runtime");
452
+ function DocsApp({ plugins = [] }) {
453
+ const allRoutes = [...import_docs_routes2.routes];
454
+ const prefetched = (0, import_react8.useRef)(/* @__PURE__ */ new Set());
455
+ for (const plugin of plugins) {
456
+ if (plugin.routes) {
457
+ allRoutes.push(...plugin.routes);
458
+ }
459
+ }
460
+ (0, import_react8.useEffect)(() => {
461
+ function onMouseOver(e) {
462
+ const anchor = e.target.closest?.("a");
463
+ if (!anchor) return;
464
+ const href = anchor.getAttribute("href");
465
+ if (!href || prefetched.current.has(href)) return;
466
+ const importer = import_docs_routes2.importers[href];
467
+ if (importer) {
468
+ prefetched.current.add(href);
469
+ importer();
470
+ }
471
+ }
472
+ document.addEventListener("mouseover", onMouseOver);
473
+ return () => document.removeEventListener("mouseover", onMouseOver);
474
+ }, []);
475
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom5.BrowserRouter, { basename: import_docs_config2.config.basePath, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DocsProviders, { config: import_docs_config2.config, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "h-screen w-full overflow-hidden", children: [
476
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RouteErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react8.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_docs_ui8.Loading, { count: 8 }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom5.Routes, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_router_dom5.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Layout, {}), children: [
477
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom5.Route, { index: true, element: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HomePage, {}) }),
478
+ allRoutes.map((route) => {
479
+ const Component = import_docs_routes2.components[route.path];
480
+ if (!Component) return null;
481
+ if (route.type === "mdx") {
482
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
483
+ import_react_router_dom5.Route,
484
+ {
485
+ path: route.path,
486
+ element: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DocPage, { frontmatter: route.frontmatter, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react8.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_docs_ui8.Loading, { count: 8 }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Component, {}) }) })
487
+ },
488
+ route.path
489
+ );
490
+ }
491
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
492
+ import_react_router_dom5.Route,
493
+ {
494
+ path: route.path,
495
+ element: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react8.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_docs_ui8.Loading, { count: 8 }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Component, {}) })
496
+ },
497
+ route.path
498
+ );
499
+ })
500
+ ] }) }) }) }),
501
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SearchModal, {})
502
+ ] }) }) });
503
+ }
504
+ // Annotate the CommonJS export names for ESM import in node:
505
+ 0 && (module.exports = {
506
+ DocsApp
507
+ });