@stainless-api/docs-ui 0.1.0-beta.76 → 0.1.0-beta.78

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.
@@ -54,7 +54,7 @@ function GroupEntry({ entry, entryToIndex }) {
54
54
  children: labelWithIcon
55
55
  }), /* @__PURE__ */ jsxs(GroupElement, {
56
56
  className: style_default.SidebarExpander,
57
- ...collapsible ? { open: flattenStlSidebar(entry.entries).some((i) => i.isCurrent) || !entry.collapsed } : {},
57
+ ...collapsible ? { open: !entry.collapsed || isAnyItemCurrent(entry.entries) } : {},
58
58
  children: [
59
59
  /* @__PURE__ */ jsxs(GroupLabelElement, {
60
60
  className: style_default.ExpanderSummary,
@@ -99,8 +99,15 @@ function computeEntryToIndex(allEntries) {
99
99
  addEntries(allEntries);
100
100
  return entryToIndex;
101
101
  }
102
- function flattenStlSidebar(sidebar) {
103
- return sidebar.flatMap((entry) => entry.type === "group" ? flattenStlSidebar(entry.entries) : entry);
102
+ function* walkSidebar(entries) {
103
+ for (const entry of entries) {
104
+ yield entry;
105
+ if (entry.type === "group") yield* walkSidebar(entry.entries);
106
+ }
107
+ }
108
+ function isAnyItemCurrent(entries) {
109
+ for (const e of walkSidebar(entries)) if (e.isCurrent) return true;
110
+ return false;
104
111
  }
105
112
 
106
113
  //#endregion
@@ -47,7 +47,7 @@ declare function useDeclaration<Required extends boolean>(stainlessPath: string,
47
47
  declare function useAvailableLanguages(stainlessPath: string): SpecLanguage[];
48
48
  declare function useIgnoredResources(): string[];
49
49
  declare function useResource(name: string): Resource | undefined;
50
- declare function useLanguage(): "http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli";
50
+ declare function useLanguage(): "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
51
51
  declare function useContentPanelLayout(): ContentPanelLayout;
52
52
  type DocsProviderProps = DocsContextType & {
53
53
  children: React$1.ReactNode;
@@ -44,7 +44,7 @@ function useSnippet(stainlessPath, language, snippetId) {
44
44
  return snippets?.[snippetId]?.content;
45
45
  }
46
46
  function useSnippetResponse(stainlessPath, snippetId) {
47
- const responses = useSpec()?.snippetResponses.http[stainlessPath];
47
+ const responses = useSpec()?.snippetResponses?.http?.[stainlessPath];
48
48
  if (!responses) return void 0;
49
49
  if (!snippetId) return getDefaultSnippet(responses);
50
50
  return responses[snippetId];
@@ -57,7 +57,7 @@ function useDeclaration(stainlessPath, required, language) {
57
57
  }
58
58
  function useAvailableLanguages(stainlessPath) {
59
59
  const spec = useSpec();
60
- return Object.keys(spec?.decls ?? {}).filter((lang) => spec?.decls?.[lang]?.[stainlessPath] !== void 0);
60
+ return Object.keys(spec?.decls ?? {}).filter((lang) => spec?.decls?.[lang]?.[stainlessPath] !== void 0).filter((e) => spec?.docs?.languages?.includes(e));
61
61
  }
62
62
  function useIgnoredResources() {
63
63
  return ["(resource) webhooks > (model) unwrap_webhook_event > (schema)"];
package/dist/routing.d.ts CHANGED
@@ -8,7 +8,7 @@ declare const Languages: readonly ["http", "node", "python", "go", "typescript",
8
8
  declare const SupportedLanguageSyntaxes: string[];
9
9
  type DocsLanguage = (typeof Languages)[number];
10
10
  declare const LanguageNames: Record<DocsLanguage, string>;
11
- declare function getLanguageSnippet(language: DocsLanguage): "http.curl" | "node.default" | "python.default" | "go.default" | "typescript.default" | "terraform.default" | "ruby.default" | "java.default" | "kotlin.default" | "csharp.default" | "php.default" | "cli.default";
11
+ declare function getLanguageSnippet(language: DocsLanguage): "http.curl" | "cli.default" | "csharp.default" | "go.default" | "java.default" | "kotlin.default" | "node.default" | "php.default" | "python.default" | "ruby.default" | "terraform.default" | "typescript.default";
12
12
  declare function isSupportedLanguage(language: string): language is DocsLanguage;
13
13
  type ParsedStainlessPath = ReturnType<typeof parseStainlessPath>;
14
14
  declare function parseStainlessPath(stainlessPath: string): {
package/dist/spec.d.ts CHANGED
@@ -36,13 +36,13 @@ declare function generateNavigation(resource: Partial<Resource>): {
36
36
  declare function generateSpecForResource(spec: Spec, name: string, lang: DocsLanguage, transforms: SpecTransforms): Partial<Spec>;
37
37
  declare function transform(spec: Spec, transforms: SpecTransforms): {
38
38
  name: string;
39
- lang: "http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli";
39
+ lang: "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
40
40
  spec: Partial<Spec>;
41
41
  }[];
42
42
  declare function split(spec: Spec, transforms?: SpecTransforms): {
43
43
  resources: ReturnType<typeof transform>;
44
44
  navigation: {
45
- languages: ("http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli" | "sql" | "openapi")[] | undefined;
45
+ languages: ("cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript" | "sql" | "openapi")[] | undefined;
46
46
  resources: {
47
47
  [k: string]: {
48
48
  title: string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stainless-api/docs-ui",
3
3
  "private": false,
4
- "version": "0.1.0-beta.76",
4
+ "version": "0.1.0-beta.78",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -17,14 +17,14 @@
17
17
  "@markdoc/markdoc": "^0.5.4",
18
18
  "clsx": "^2.1.1",
19
19
  "htmlparser2": "^10.1.0",
20
- "lucide-react": "^0.562.0",
20
+ "lucide-react": "^0.574.0",
21
21
  "@stainless-api/ui-primitives": "0.1.0-beta.48"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/node": "24.10.9",
25
- "@types/react": "19.2.10",
24
+ "@types/node": "24.10.13",
25
+ "@types/react": "19.2.14",
26
26
  "@types/react-dom": "^19.2.3",
27
- "dotenv": "17.2.3",
27
+ "dotenv": "17.3.1",
28
28
  "react": "^19.2.4",
29
29
  "react-dom": "^19.2.4",
30
30
  "tsdown": "^0.20.3",