@farming-labs/docs 0.0.2-beta.24 → 0.0.2-beta.27

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 (2) hide show
  1. package/dist/index.d.mts +83 -6
  2. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -297,6 +297,54 @@ interface BreadcrumbConfig {
297
297
  */
298
298
  component?: unknown;
299
299
  }
300
+ /**
301
+ * A leaf page in the sidebar tree.
302
+ */
303
+ interface SidebarPageNode {
304
+ type: "page";
305
+ name: string;
306
+ url: string;
307
+ icon?: unknown;
308
+ }
309
+ /**
310
+ * A folder (group) in the sidebar tree. May contain child pages
311
+ * and nested folders, forming a recursive hierarchy.
312
+ */
313
+ interface SidebarFolderNode {
314
+ type: "folder";
315
+ name: string;
316
+ icon?: unknown;
317
+ /** Index page for this folder (the folder's own landing page). */
318
+ index?: SidebarPageNode;
319
+ /** Child pages and sub-folders. */
320
+ children: SidebarNode[];
321
+ /** Whether this folder section is collapsible. */
322
+ collapsible?: boolean;
323
+ /** Whether this folder starts open. */
324
+ defaultOpen?: boolean;
325
+ }
326
+ /** A node in the sidebar tree — either a page or a folder. */
327
+ type SidebarNode = SidebarPageNode | SidebarFolderNode;
328
+ /** The full sidebar tree passed to custom sidebar components. */
329
+ interface SidebarTree {
330
+ name: string;
331
+ children: SidebarNode[];
332
+ }
333
+ /**
334
+ * Props passed to a custom sidebar component.
335
+ *
336
+ * Contains all the information needed to build a fully custom sidebar:
337
+ * the complete page tree with parent-child relationships, and the
338
+ * current sidebar configuration.
339
+ */
340
+ interface SidebarComponentProps {
341
+ /** Full page tree with all parent-child-folder relationships. */
342
+ tree: SidebarTree;
343
+ /** Whether folders are collapsible. */
344
+ collapsible: boolean;
345
+ /** Whether folders are rendered flat (Mintlify-style). */
346
+ flat: boolean;
347
+ }
300
348
  interface SidebarConfig {
301
349
  /**
302
350
  * Whether to show the sidebar.
@@ -304,17 +352,46 @@ interface SidebarConfig {
304
352
  */
305
353
  enabled?: boolean;
306
354
  /**
307
- * Custom sidebar component to completely replace the default sidebar.
308
- * Receives the page tree and config as context.
355
+ * Custom sidebar component to replace the default navigation.
309
356
  *
310
- * @example
357
+ * **Next.js** — Pass a render function that receives `SidebarComponentProps`:
311
358
  * ```tsx
312
359
  * sidebar: {
313
- * component: MySidebar,
360
+ * component: ({ tree, collapsible, flat }) => (
361
+ * <MySidebar tree={tree} />
362
+ * ),
314
363
  * }
315
364
  * ```
365
+ *
366
+ * **Astro** — Use the `sidebar` named slot on `<DocsLayout>`:
367
+ * ```astro
368
+ * <DocsLayout tree={tree} config={config}>
369
+ * <MySidebar slot="sidebar" tree={tree} />
370
+ * <slot />
371
+ * </DocsLayout>
372
+ * ```
373
+ *
374
+ * **SvelteKit** — Use the `sidebar` snippet on `<DocsLayout>`:
375
+ * ```svelte
376
+ * <DocsLayout {tree} {config}>
377
+ * {#snippet sidebar({ tree, isActive })}
378
+ * <MySidebarNav {tree} {isActive} />
379
+ * {/snippet}
380
+ * {@render children()}
381
+ * </DocsLayout>
382
+ * ```
383
+ *
384
+ * **Nuxt / Vue** — Use the `#sidebar` scoped slot on `<DocsLayout>`:
385
+ * ```vue
386
+ * <DocsLayout :tree="tree" :config="config">
387
+ * <template #sidebar="{ tree, isActive }">
388
+ * <MySidebarNav :tree="tree" :is-active="isActive" />
389
+ * </template>
390
+ * <DocsContent />
391
+ * </DocsLayout>
392
+ * ```
316
393
  */
317
- component?: unknown;
394
+ component?: (props: SidebarComponentProps) => unknown;
318
395
  /**
319
396
  * Sidebar footer content (rendered below navigation items).
320
397
  */
@@ -1145,4 +1222,4 @@ declare function resolveTitle(pageTitle: string, metadata?: DocsMetadata): strin
1145
1222
  */
1146
1223
  declare function resolveOGImage(page: PageFrontmatter, ogConfig?: OGConfig, baseUrl?: string): string | undefined;
1147
1224
  //#endregion
1148
- export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type SidebarConfig, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
1225
+ export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.0.2-beta.24",
3
+ "version": "0.0.2-beta.27",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",