@farming-labs/docs 0.0.2-beta.11 → 0.0.2-beta.14

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.
@@ -527,6 +527,7 @@ function svelteDocsServerTemplate(cfg) {
527
527
  import { createDocsServer } from "@farming-labs/svelte/server";
528
528
  import config from "${svelteServerConfigImport(cfg.useAlias)}";
529
529
 
530
+ // preload for production
530
531
  const contentFiles = import.meta.glob("/${cfg.entry ?? "docs"}/**/*.{md,mdx,svx}", {
531
532
  query: "?raw",
532
533
  import: "default",
package/dist/index.d.mts CHANGED
@@ -223,6 +223,8 @@ interface PageFrontmatter {
223
223
  icon?: string;
224
224
  /** Path to custom OG image for this page */
225
225
  ogImage?: string;
226
+ /** Sort order in the sidebar. Lower numbers appear first. Pages without `order` are sorted alphabetically after ordered pages. */
227
+ order?: number;
226
228
  }
227
229
  interface DocsNav {
228
230
  /**
@@ -677,6 +679,30 @@ interface AIConfig {
677
679
  name: string;
678
680
  }) => unknown;
679
681
  }
682
+ /**
683
+ * A single item in the slug-based sidebar ordering.
684
+ *
685
+ * @example
686
+ * ```ts
687
+ * ordering: [
688
+ * { slug: "installation" },
689
+ * { slug: "cli" },
690
+ * { slug: "themes", children: [
691
+ * { slug: "default" },
692
+ * { slug: "darksharp" },
693
+ * { slug: "pixel-border" },
694
+ * { slug: "creating-themes" },
695
+ * ]},
696
+ * { slug: "reference" },
697
+ * ]
698
+ * ```
699
+ */
700
+ interface OrderingItem {
701
+ /** Folder name (not the full path, just the directory name at this level) */
702
+ slug: string;
703
+ /** Ordering for child pages within this folder */
704
+ children?: OrderingItem[];
705
+ }
680
706
  interface DocsConfig {
681
707
  /** Entry folder for docs (e.g. "docs" → /docs) */
682
708
  entry: string;
@@ -849,6 +875,40 @@ interface DocsConfig {
849
875
  * ```
850
876
  */
851
877
  ai?: AIConfig;
878
+ /**
879
+ * Sidebar ordering strategy.
880
+ *
881
+ * - `"alphabetical"` — sort pages alphabetically by folder name (default)
882
+ * - `"numeric"` — sort by frontmatter `order` field (lower first, unset pages last)
883
+ * - `OrderingItem[]` — explicit slug-based ordering with nested children
884
+ *
885
+ * @default "alphabetical"
886
+ *
887
+ * @example
888
+ * ```ts
889
+ * // Alphabetical (default)
890
+ * ordering: "alphabetical",
891
+ *
892
+ * // Use frontmatter `order: 1`, `order: 2`, etc.
893
+ * ordering: "numeric",
894
+ *
895
+ * // Explicit slug-based ordering
896
+ * ordering: [
897
+ * { slug: "installation" },
898
+ * { slug: "cli" },
899
+ * { slug: "configuration" },
900
+ * { slug: "themes", children: [
901
+ * { slug: "default" },
902
+ * { slug: "darksharp" },
903
+ * { slug: "pixel-border" },
904
+ * { slug: "creating-themes" },
905
+ * ]},
906
+ * { slug: "customization" },
907
+ * { slug: "reference" },
908
+ * ]
909
+ * ```
910
+ */
911
+ ordering?: "alphabetical" | "numeric" | OrderingItem[];
852
912
  /** SEO metadata - separate from theme */
853
913
  metadata?: DocsMetadata;
854
914
  /** Open Graph image handling */
@@ -924,4 +984,4 @@ declare function resolveTitle(pageTitle: string, metadata?: DocsMetadata): strin
924
984
  */
925
985
  declare function resolveOGImage(page: PageFrontmatter, ogConfig?: OGConfig, baseUrl?: string): string | undefined;
926
986
  //#endregion
927
- export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type PageActionsConfig, type PageFrontmatter, type SidebarConfig, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
987
+ export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, 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 };
package/dist/index.mjs CHANGED
@@ -16,6 +16,7 @@ function defineDocs(config) {
16
16
  icons: config.icons,
17
17
  pageActions: config.pageActions,
18
18
  ai: config.ai,
19
+ ordering: config.ordering,
19
20
  metadata: config.metadata,
20
21
  og: config.og
21
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.0.2-beta.11",
3
+ "version": "0.0.2-beta.14",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",