@solutiondesk/help 1.14.0 → 1.15.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.
package/README.md CHANGED
@@ -29,7 +29,7 @@ const { page } = await help.page("guides/login"); // one page with its text
29
29
 
30
30
  | Method | API | Returns |
31
31
  | --- | --- | --- |
32
- | `site({ lang })` | `GET …/site` | The site (`name`, `languages`, `websiteUrl`) and its navigation tree: pages, folders (with index page, `root` tab, `defaultOpen`, `collapsible`), separators and links. Empty folders are left out. |
32
+ | `site({ lang })` | `GET …/site` | The site (`name`, `languages`, `websiteUrl`) and its navigation tree: pages, folders (with index page, `root` tab, `group`, `defaultOpen`, `collapsible`), separators and links. Empty folders are left out. |
33
33
  | `pages({ lang })` | `GET …/pages` | Every visible page without its text, in reading order (for builds and sitemaps). |
34
34
  | `page(path, { lang, redirect })` | `GET …/page?path=` | One page: `markdown`, `html`, `headings`, `blocks`, `breadcrumbs`, `previous`/`next`. The home page has the path `""`. |
35
35
  | `pageMarkdown(path, { lang })` | `GET …/page.md?path=` | One page as plain Markdown. |
@@ -103,8 +103,9 @@ The navigation becomes the files Fumadocs knows from a content folder:
103
103
  | SolutionDesk | Fumadocs |
104
104
  | --- | --- |
105
105
  | page `guides/login` | `guides/login.mdx` (`slugs: ["guides", "login"]`) |
106
- | home page | `index.mdx` (always at the top) |
106
+ | home page | `index.mdx` at the top, or `(core)/index.mdx` when it is a top-level group's own page |
107
107
  | folder `guides` | `guides/meta.json` with `title`, `icon`, `root`, `defaultOpen`, `collapsible`, `pages` |
108
+ | group folder `core` (adds no address part) | `(core)/` — a Fumadocs folder group, so `(core)/sign-up/index.mdx` is still `sign-up` |
108
109
  | folder's own page | `guides/index.mdx` (`pagesIndex: "index"`, so it also works for `root` tabs) |
109
110
  | any other page with the slug `index` | `guides/index_.mdx` (`slugs: ["guides", "index"]`), so it never collides with the folder's own page |
110
111
  | order of the top level | `meta.json` (`title` = site name) |
@@ -12,7 +12,8 @@ import { TOCItemType } from 'fumadocs-core/toc';
12
12
  * preview token names. Absent values are `null`, never a missing key.
13
13
  *
14
14
  * Paths: a page's path is its folder slugs plus its slug, without leading or
15
- * trailing slash (`guides/login`); the site's home page has the path `""`.
15
+ * trailing slash (`guides/login`) — a `group` folder adds no slug; the site's
16
+ * home page has the path `""`.
16
17
  */
17
18
  /** The doc site itself. */
18
19
  interface HelpPublicSite {
@@ -43,12 +44,17 @@ interface HelpPublicTreeFolder {
43
44
  /** Stable node id. */
44
45
  id: string;
45
46
  slug: string;
46
- /** The folder's path (its index page, if any, lives here). */
47
+ /** The folder's path (its index page, if any, lives here; a group's is its parent's). */
47
48
  path: string;
48
49
  title: string;
49
50
  icon: string | null;
50
51
  /** A tab (top level only; Fumadocs `root`). */
51
52
  root: boolean;
53
+ /**
54
+ * Adds no segment to its pages' paths (Fumadocs `(name)` folder): `path` is
55
+ * the parent's, a top-level group's index page is the home (`""`).
56
+ */
57
+ group: boolean;
52
58
  defaultOpen: boolean;
53
59
  collapsible: boolean;
54
60
  /** The folder's own page, shown at the folder's path; null without one. */
@@ -570,8 +576,10 @@ interface HelpFilesOptions {
570
576
  /**
571
577
  * The Fumadocs virtual files for one language of the site: a `.mdx` page file
572
578
  * per page (a folder's own page as `<folder>/index.mdx`, the home page as
573
- * `index.mdx` at the top, any other page named `index` as `index_.mdx`) and a
574
- * `meta.json` per folder plus one at the top that fixes the order. Every file
579
+ * `index.mdx` at the top or in a top-level group, any other page named `index`
580
+ * as `index_.mdx`) and a `meta.json` per folder plus one at the top that fixes
581
+ * the order. A group folder is a `(slug)/` directory, so Fumadocs gives its
582
+ * pages the same addresses as the tree (no segment for the group). Every file
575
583
  * path is unique. Exported for custom setups; `createHelpSource` uses it.
576
584
  */
577
585
  declare function helpTreeToFiles(payload: HelpPublicSitePayload, options: HelpFilesOptions): HelpVirtualFile[];
package/dist/fumadocs.js CHANGED
@@ -519,12 +519,13 @@ var pageFileName = (page) => {
519
519
  const name = lastSegment(page.path);
520
520
  return name === "index" ? "index_" : name;
521
521
  };
522
+ var folderDirName = (folder) => folder.group ? `(${folder.slug})` : folder.slug;
522
523
  function helpMetaEntry(node) {
523
524
  switch (node.type) {
524
525
  case "page":
525
526
  return pageFileName(node);
526
527
  case "folder":
527
- return node.slug;
528
+ return folderDirName(node);
528
529
  case "separator": {
529
530
  const title = node.title?.replace(/---/g, "\u2013").trim();
530
531
  if (!title) return "---";
@@ -577,9 +578,9 @@ function helpTreeToFiles(payload, options) {
577
578
  const addChildren = (nodes, dir) => {
578
579
  for (const node of nodes) {
579
580
  if (node.type === "page") {
580
- addPage(node, node.path ? join(dir, ext(pageFileName(node), "mdx")) : ext("index", "mdx"));
581
+ addPage(node, join(dir, ext(pageFileName(node), "mdx")));
581
582
  } else if (node.type === "folder") {
582
- addFolder(node, join(dir, node.slug));
583
+ addFolder(node, join(dir, folderDirName(node)));
583
584
  }
584
585
  }
585
586
  };
package/dist/index.d.cts CHANGED
@@ -139,7 +139,8 @@ declare function verifyWebhookSignature(secret: string, rawBody: WebhookBody, he
139
139
  * preview token names. Absent values are `null`, never a missing key.
140
140
  *
141
141
  * Paths: a page's path is its folder slugs plus its slug, without leading or
142
- * trailing slash (`guides/login`); the site's home page has the path `""`.
142
+ * trailing slash (`guides/login`) — a `group` folder adds no slug; the site's
143
+ * home page has the path `""`.
143
144
  */
144
145
  /** The doc site itself. */
145
146
  interface HelpPublicSite {
@@ -170,12 +171,17 @@ interface HelpPublicTreeFolder {
170
171
  /** Stable node id. */
171
172
  id: string;
172
173
  slug: string;
173
- /** The folder's path (its index page, if any, lives here). */
174
+ /** The folder's path (its index page, if any, lives here; a group's is its parent's). */
174
175
  path: string;
175
176
  title: string;
176
177
  icon: string | null;
177
178
  /** A tab (top level only; Fumadocs `root`). */
178
179
  root: boolean;
180
+ /**
181
+ * Adds no segment to its pages' paths (Fumadocs `(name)` folder): `path` is
182
+ * the parent's, a top-level group's index page is the home (`""`).
183
+ */
184
+ group: boolean;
179
185
  defaultOpen: boolean;
180
186
  collapsible: boolean;
181
187
  /** The folder's own page, shown at the folder's path; null without one. */
package/dist/index.d.ts CHANGED
@@ -139,7 +139,8 @@ declare function verifyWebhookSignature(secret: string, rawBody: WebhookBody, he
139
139
  * preview token names. Absent values are `null`, never a missing key.
140
140
  *
141
141
  * Paths: a page's path is its folder slugs plus its slug, without leading or
142
- * trailing slash (`guides/login`); the site's home page has the path `""`.
142
+ * trailing slash (`guides/login`) — a `group` folder adds no slug; the site's
143
+ * home page has the path `""`.
143
144
  */
144
145
  /** The doc site itself. */
145
146
  interface HelpPublicSite {
@@ -170,12 +171,17 @@ interface HelpPublicTreeFolder {
170
171
  /** Stable node id. */
171
172
  id: string;
172
173
  slug: string;
173
- /** The folder's path (its index page, if any, lives here). */
174
+ /** The folder's path (its index page, if any, lives here; a group's is its parent's). */
174
175
  path: string;
175
176
  title: string;
176
177
  icon: string | null;
177
178
  /** A tab (top level only; Fumadocs `root`). */
178
179
  root: boolean;
180
+ /**
181
+ * Adds no segment to its pages' paths (Fumadocs `(name)` folder): `path` is
182
+ * the parent's, a top-level group's index page is the home (`""`).
183
+ */
184
+ group: boolean;
179
185
  defaultOpen: boolean;
180
186
  collapsible: boolean;
181
187
  /** The folder's own page, shown at the folder's path; null without one. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solutiondesk/help",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
4
4
  "description": "Typed, zero-dependency client for the SolutionDesk public help center API, plus a Fumadocs adapter: navigation, pages, search, previews, llms.txt and webhook verification.",
5
5
  "keywords": [
6
6
  "solutiondesk",