@farming-labs/svelte 0.1.53 → 0.1.56

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/server.js +11 -5
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -30,7 +30,7 @@
30
30
  import fs from "node:fs";
31
31
  import path from "node:path";
32
32
  import matter from "gray-matter";
33
- import { buildDocsAgentDiscoverySpec, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsSkillRequest, normalizeDocsRelated, performDocsSearch, renderDocsMarkdownDocument, renderDocsSkillDocument, stripGeneratedAgentProvenance, resolveDocsAgentMdxContent, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSkillFormat, } from "@farming-labs/docs";
33
+ import { applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsSkillRequest, normalizeDocsRelated, performDocsSearch, renderDocsMarkdownDocument, renderDocsSkillDocument, stripGeneratedAgentProvenance, resolveDocsAgentMdxContent, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSkillFormat, } from "@farming-labs/docs";
34
34
  import { createDocsMcpHttpHandler, resolveDocsMcpConfig } from "@farming-labs/docs/server";
35
35
  import { loadDocsNavTree, loadDocsContent, flattenNavTree } from "./content.js";
36
36
  import { renderMarkdown } from "./markdown.js";
@@ -410,9 +410,12 @@ export function createDocsServer(config = {}) {
410
410
  async function load(event) {
411
411
  const locale = resolveDocsLocale(event.url.searchParams, i18n) ?? i18n?.defaultLocale;
412
412
  const ctx = resolveContextFromPath(event.url.pathname, locale);
413
- const tree = preloaded
413
+ const tree = applySidebarFolderIndexBehavior(preloaded
414
414
  ? navTreeFromMap(preloaded, ctx.dirPrefix, entry, ordering)
415
- : loadDocsNavTree(ctx.contentDirAbs, entry, ordering);
415
+ : loadDocsNavTree(ctx.contentDirAbs, entry, ordering), {
416
+ sidebar: config.sidebar,
417
+ defaultBehavior: "toggle",
418
+ });
416
419
  const flatPages = flattenNavTree(tree);
417
420
  const slug = ctx.slug;
418
421
  const isIndex = slug === "";
@@ -810,9 +813,12 @@ export function createDocsServer(config = {}) {
810
813
  },
811
814
  getNavigation(locale) {
812
815
  const ctx = resolveContextFromPath(`/${entry}`, resolveLocaleForMcp(locale));
813
- return preloaded
816
+ return applySidebarFolderIndexBehavior(preloaded
814
817
  ? navTreeFromMap(preloaded, ctx.dirPrefix, entry, ordering)
815
- : loadDocsNavTree(ctx.contentDirAbs, entry, ordering);
818
+ : loadDocsNavTree(ctx.contentDirAbs, entry, ordering), {
819
+ sidebar: config.sidebar,
820
+ defaultBehavior: "toggle",
821
+ });
816
822
  },
817
823
  },
818
824
  mcp: config.mcp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/svelte",
3
- "version": "0.1.53",
3
+ "version": "0.1.56",
4
4
  "description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
5
5
  "keywords": [
6
6
  "docs",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@types/node": "^22.10.0",
58
58
  "typescript": "^5.9.3",
59
- "@farming-labs/docs": "0.1.53"
59
+ "@farming-labs/docs": "0.1.56"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@farming-labs/docs": "*"