@stainless-api/docs-ui 0.1.0-beta.72 → 0.1.0-beta.74

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 (135) hide show
  1. package/dist/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
  2. package/dist/components/MaskedInput.d.ts +1 -1
  3. package/dist/components/MaskedInput.js +1 -1
  4. package/dist/components/breadcrumbs.d.ts +24 -1
  5. package/dist/components/breadcrumbs.js +62 -7
  6. package/dist/components/icons.d.ts +12 -12
  7. package/dist/components/icons.js +883 -1
  8. package/dist/components/index.d.ts +16 -14
  9. package/dist/components/index.js +72 -18
  10. package/dist/components/method.d.ts +58 -1
  11. package/dist/components/method.js +95 -8
  12. package/dist/components/overview.d.ts +38 -1
  13. package/dist/components/overview.js +137 -9
  14. package/dist/components/primitives.d.ts +104 -1
  15. package/dist/components/primitives.js +250 -6
  16. package/dist/components/properties.d.ts +53 -1
  17. package/dist/components/properties.js +138 -7
  18. package/dist/components/sdk-sidebar.d.ts +14 -1
  19. package/dist/components/sdk-sidebar.js +50 -8
  20. package/dist/components/sdk.d.ts +121 -1
  21. package/dist/components/sdk.js +404 -8
  22. package/dist/components/snippets.d.ts +70 -13
  23. package/dist/components/snippets.js +182 -7
  24. package/dist/components/stl-sidebar.d.ts +57 -1
  25. package/dist/components/stl-sidebar.js +105 -3
  26. package/dist/contexts/component-generics.d.ts +29 -1
  27. package/dist/contexts/component-generics.js +31 -1
  28. package/dist/contexts/component-types.d.ts +4 -15
  29. package/dist/contexts/component.d.ts +7 -17
  30. package/dist/contexts/component.js +22 -28
  31. package/dist/contexts/docs.d.ts +61 -1
  32. package/dist/contexts/docs.js +89 -1
  33. package/dist/contexts/index.d.ts +13 -14
  34. package/dist/contexts/index.js +44 -6
  35. package/dist/contexts/markdown.d.ts +21 -1
  36. package/dist/contexts/markdown.js +47 -2
  37. package/dist/contexts/navigation.d.ts +28 -1
  38. package/dist/contexts/navigation.js +22 -1
  39. package/dist/contexts/use-components.d.ts +1 -13
  40. package/dist/contexts/use-components.js +6 -2
  41. package/dist/{index-W4Td2Hl7.d.ts → index-PdnFhQF9.d.ts} +1 -1
  42. package/dist/index.d.ts +4 -14
  43. package/dist/index.js +7 -30
  44. package/dist/languages/cli.d.ts +38 -14
  45. package/dist/languages/cli.js +166 -20
  46. package/dist/languages/csharp.d.ts +42 -14
  47. package/dist/languages/csharp.js +283 -8
  48. package/dist/languages/go.d.ts +40 -14
  49. package/dist/languages/go.js +303 -8
  50. package/dist/languages/http.d.ts +46 -14
  51. package/dist/languages/http.js +390 -19
  52. package/dist/languages/index.d.ts +50 -14
  53. package/dist/languages/index.js +30 -28
  54. package/dist/languages/java.d.ts +43 -14
  55. package/dist/languages/java.js +403 -8
  56. package/dist/languages/python.d.ts +40 -14
  57. package/dist/languages/python.js +269 -8
  58. package/dist/languages/ruby.d.ts +40 -14
  59. package/dist/languages/ruby.js +387 -8
  60. package/dist/languages/terraform.d.ts +48 -14
  61. package/dist/languages/terraform.js +243 -8
  62. package/dist/languages/typescript.d.ts +40 -14
  63. package/dist/languages/typescript.js +449 -8
  64. package/dist/markdown/index.d.ts +1 -2
  65. package/dist/markdown/index.js +1 -28
  66. package/dist/markdown/printer.d.ts +2 -2
  67. package/dist/markdown/printer.js +6 -30
  68. package/dist/markdown/utils.d.ts +3 -3
  69. package/dist/routing.d.ts +61 -2
  70. package/dist/routing.js +204 -2
  71. package/dist/spec.d.ts +4 -4
  72. package/dist/spec.js +2 -2
  73. package/dist/style.js +176 -1
  74. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  75. package/dist/utils.d.ts +1 -1
  76. package/dist/utils.js +53 -2
  77. package/package.json +3 -3
  78. package/dist/breadcrumbs-46Qjx1Pd.d.ts +0 -25
  79. package/dist/breadcrumbs-BZ4wBC9-.d.ts +0 -25
  80. package/dist/breadcrumbs-BiBfNqBI.js +0 -63
  81. package/dist/cli-hduQ5XS1.js +0 -166
  82. package/dist/component-BU8BTbqz.js +0 -23
  83. package/dist/component-generics-Bw4ZOyEG.d.ts +0 -30
  84. package/dist/component-generics-D-WarFUb.d.ts +0 -30
  85. package/dist/component-generics-POFirVVb.js +0 -45
  86. package/dist/components-9NMl1791.js +0 -72
  87. package/dist/contexts-_NNW5yqC.js +0 -44
  88. package/dist/csharp-sn5CJu9t.js +0 -283
  89. package/dist/docs-Cu9Yl6-y.d.ts +0 -66
  90. package/dist/docs-YgoQ3bzY.js +0 -81
  91. package/dist/docs-xb5wYGjM.d.ts +0 -66
  92. package/dist/go-BoaAVmP0.js +0 -303
  93. package/dist/http-B3qTyMc3.js +0 -389
  94. package/dist/icons-BYKn5X8E.js +0 -885
  95. package/dist/index-BOmn7DHa.d.ts +0 -428
  96. package/dist/index-BvcPmB0r.d.ts +0 -428
  97. package/dist/java-BiLRuLuD.js +0 -403
  98. package/dist/languages-vUhD5Hu_.js +0 -30
  99. package/dist/markdown-BszOPZhh.d.ts +0 -22
  100. package/dist/markdown-Cq3XEhrR.js +0 -49
  101. package/dist/markdown-plMAoN22.d.ts +0 -22
  102. package/dist/method-C4PgTWAu.d.ts +0 -59
  103. package/dist/method-D6R_farj.d.ts +0 -59
  104. package/dist/method-DjzVBzZe.js +0 -96
  105. package/dist/navigation-HiZWRl34.d.ts +0 -29
  106. package/dist/navigation-MrP4Ubbg.d.ts +0 -29
  107. package/dist/navigation-aoYZ_tl4.js +0 -24
  108. package/dist/overview-CTeKhpQq.d.ts +0 -39
  109. package/dist/overview-Yf1PTJNi.d.ts +0 -39
  110. package/dist/overview-ocTARt-j.js +0 -138
  111. package/dist/primitives-CNG-fEhQ.js +0 -250
  112. package/dist/primitives-K7NijV36.d.ts +0 -105
  113. package/dist/primitives-WGxdBJDS.d.ts +0 -105
  114. package/dist/properties-Bu4nW9JD.d.ts +0 -54
  115. package/dist/properties-Bynmj9_H.d.ts +0 -54
  116. package/dist/properties-DQU0NBzb.js +0 -138
  117. package/dist/python-nqOBH7GS.js +0 -269
  118. package/dist/routing-C64k4fmX.js +0 -205
  119. package/dist/routing-pAL4V4hv.d.ts +0 -61
  120. package/dist/ruby-BBc8HdIt.js +0 -387
  121. package/dist/sdk-BSdgEEJw.js +0 -405
  122. package/dist/sdk-BVCk1ox2.d.ts +0 -122
  123. package/dist/sdk-Dm0S-XQE.d.ts +0 -122
  124. package/dist/sdk-sidebar-B1ehT_xI.d.ts +0 -15
  125. package/dist/sdk-sidebar-BDn8S1xS.js +0 -50
  126. package/dist/sdk-sidebar-Dqeu7C1-.d.ts +0 -15
  127. package/dist/snippets-CLpNVNlA.js +0 -181
  128. package/dist/stl-sidebar-BTTErIJs.d.ts +0 -58
  129. package/dist/stl-sidebar-C7GNALtk.d.ts +0 -58
  130. package/dist/stl-sidebar-DC5UOJiT.js +0 -106
  131. package/dist/style-DJIYkFhO.js +0 -178
  132. package/dist/terraform-DVx2ea2h.js +0 -243
  133. package/dist/typescript-Cmk-jBBw.js +0 -449
  134. package/dist/use-components-BUz3GbO4.js +0 -7
  135. package/dist/utils-DPbkW1Tz.js +0 -54
package/dist/routing.js CHANGED
@@ -1,3 +1,205 @@
1
- import { _ as updateHistory, a as findNavigationPath, c as generateRouteList, d as isSupportedLanguage, f as parseRoute, g as trimStainlessPath, h as scrollToPath, i as expandToElement, l as getLanguageSnippet, n as Languages, o as generateMissingRouteList, p as parseStainlessPath, r as SupportedLanguageSyntaxes, s as generateRoute, t as LanguageNames, u as getResource, v as walkTree } from "./routing-C64k4fmX.js";
1
+ import { t as __exportAll } from "./chunk-BYypO7fO.js";
2
2
 
3
- export { LanguageNames, Languages, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
3
+ //#region src/routing.ts
4
+ var routing_exports = /* @__PURE__ */ __exportAll({
5
+ LanguageNames: () => LanguageNames,
6
+ Languages: () => Languages,
7
+ SupportedLanguageSyntaxes: () => SupportedLanguageSyntaxes,
8
+ expandToElement: () => expandToElement,
9
+ findNavigationPath: () => findNavigationPath,
10
+ generateMissingRouteList: () => generateMissingRouteList,
11
+ generateRoute: () => generateRoute,
12
+ generateRouteList: () => generateRouteList,
13
+ getLanguageSnippet: () => getLanguageSnippet,
14
+ getResource: () => getResource,
15
+ isSupportedLanguage: () => isSupportedLanguage,
16
+ parseRoute: () => parseRoute,
17
+ parseStainlessPath: () => parseStainlessPath,
18
+ scrollToPath: () => scrollToPath,
19
+ trimStainlessPath: () => trimStainlessPath,
20
+ updateHistory: () => updateHistory,
21
+ walkTree: () => walkTree
22
+ });
23
+ const Languages = [
24
+ "http",
25
+ "node",
26
+ "python",
27
+ "go",
28
+ "typescript",
29
+ "terraform",
30
+ "ruby",
31
+ "java",
32
+ "kotlin",
33
+ "csharp",
34
+ "php",
35
+ "cli"
36
+ ];
37
+ const SupportedLanguageSyntaxes = [
38
+ "http",
39
+ "javascript",
40
+ "python",
41
+ "go",
42
+ "typescript",
43
+ "terraform",
44
+ "ruby",
45
+ "java",
46
+ "kotlin",
47
+ "csharp",
48
+ "bash"
49
+ ];
50
+ const LanguageNames = {
51
+ http: "HTTP",
52
+ node: "TypeScript",
53
+ typescript: "TypeScript",
54
+ python: "Python",
55
+ go: "Go",
56
+ ruby: "Ruby",
57
+ java: "Java",
58
+ kotlin: "Kotlin",
59
+ terraform: "Terraform",
60
+ csharp: "C#",
61
+ php: "PHP",
62
+ cli: "CLI Tool"
63
+ };
64
+ function getLanguageSnippet(language) {
65
+ return language === "http" ? "http.curl" : `${language}.default`;
66
+ }
67
+ function isSupportedLanguage(language) {
68
+ return Languages.includes(language);
69
+ }
70
+ const DefaultLanguage = "http";
71
+ const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
72
+ function parseStainlessPath(stainlessPath) {
73
+ const match = stainlessPath.match(StainlessPathPattern);
74
+ if (!match?.groups) return null;
75
+ return {
76
+ resource: match.groups.resource?.split(".") ?? null,
77
+ method: match.groups.method ?? null,
78
+ model: match.groups.model ?? null,
79
+ routable: match.groups.model ? match[1] : match[0]
80
+ };
81
+ }
82
+ function trimStainlessPath(stainlessPath) {
83
+ return stainlessPath.replace(/ > \([^\s]+\)$/, "");
84
+ }
85
+ function getResource(stainlessPath) {
86
+ return parseStainlessPath(stainlessPath)?.resource?.[0];
87
+ }
88
+ function parseRoute(basePath, route) {
89
+ if (!route.startsWith(basePath)) return {
90
+ stainlessPath: "",
91
+ language: DefaultLanguage
92
+ };
93
+ if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
94
+ let stainlessPath = "";
95
+ let elements = route.slice(1).split("/");
96
+ let language = DefaultLanguage;
97
+ if (elements[0] && Languages.includes(elements[0])) {
98
+ language = elements[0];
99
+ elements = elements.slice(1);
100
+ }
101
+ while (elements.length > 0) switch (elements.shift()) {
102
+ case "resources":
103
+ stainlessPath += `(resource) ${elements.shift()}`;
104
+ break;
105
+ case "subresources":
106
+ stainlessPath += `.${elements.shift()}`;
107
+ break;
108
+ case "methods":
109
+ stainlessPath += ` > (method) ${elements.shift()}`;
110
+ break;
111
+ }
112
+ return {
113
+ stainlessPath,
114
+ language
115
+ };
116
+ }
117
+ function generateRoute(basePath, language, stainlessPath) {
118
+ const parsedPath = parseStainlessPath(stainlessPath);
119
+ if (!parsedPath) return null;
120
+ const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
121
+ if (language && language !== DefaultLanguage) path.push(language);
122
+ const resources = parsedPath.resource.flatMap((name, index) => [index > 0 ? "subresources" : "resources", name]);
123
+ const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
124
+ path.push(...resourcePath);
125
+ if (parsedPath.method) path.push("methods", parsedPath.method);
126
+ return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
127
+ }
128
+ function* walkResource(resource, path, includeModels) {
129
+ yield {
130
+ data: resource,
131
+ path
132
+ };
133
+ for (const data of Object.values(resource.methods)) yield {
134
+ data,
135
+ path: [
136
+ ...path,
137
+ "methods",
138
+ data.name
139
+ ]
140
+ };
141
+ if (includeModels) for (const data of Object.values(resource.models)) yield {
142
+ data,
143
+ path: [
144
+ ...path,
145
+ "models",
146
+ data.name
147
+ ]
148
+ };
149
+ for (const data of Object.values(resource.subresources ?? {})) yield* walkResource(data, [
150
+ ...path,
151
+ "subresources",
152
+ data.name
153
+ ]);
154
+ }
155
+ function* walkTree(spec, includeModels) {
156
+ for (const data of Object.values(spec.resources)) yield* walkResource(data, ["resources", data.name], includeModels);
157
+ }
158
+ function generateRouteList({ spec, languages, excludeLanguages = [] }) {
159
+ const entries = Array.from(walkTree(spec));
160
+ return (languages ?? spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang)).filter((lang) => !excludeLanguages?.includes(lang)).flatMap((language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
161
+ title,
162
+ kind,
163
+ language,
164
+ stainlessPath,
165
+ slug: (language === "http" ? path : [language, ...path]).join("/")
166
+ })));
167
+ }
168
+ function generateMissingRouteList({ spec, basePath }) {
169
+ const entries = Array.from(walkTree(spec));
170
+ return (spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang)).flatMap((language) => entries.filter(({ data: { stainlessPath, ...rest } }) => {
171
+ if (spec.decls?.[language]?.[stainlessPath] === void 0) return rest.kind === "http_method";
172
+ return false;
173
+ }).map(({ path }) => `${basePath.endsWith("/") ? basePath.slice(0, -1) : basePath}/${language === "http" ? path.join("/") : [language, ...path].join("/")}`));
174
+ }
175
+ function findNavigationPath(items, target) {
176
+ for (const item of Object.values(items)) {
177
+ if (item.stainlessPath === target) return [item.stainlessPath];
178
+ if (item.kind === "http_method") continue;
179
+ const path = findNavigationPath([...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})], target);
180
+ if (path) return [item.stainlessPath, ...path];
181
+ }
182
+ }
183
+ function expandToElement(el) {
184
+ while (el) {
185
+ if (el instanceof HTMLDetailsElement) el.open = true;
186
+ el = el.parentElement;
187
+ }
188
+ }
189
+ function scrollToPath(stainlessPath) {
190
+ const el = document.getElementById(stainlessPath);
191
+ if (el) {
192
+ expandToElement(el);
193
+ el.scrollIntoView({ behavior: "smooth" });
194
+ }
195
+ }
196
+ function updateHistory(basePath, language, stainlessPath) {
197
+ const path = generateRoute(basePath, language, stainlessPath);
198
+ window.history.pushState({
199
+ stainlessPath,
200
+ language
201
+ }, "", path);
202
+ }
203
+
204
+ //#endregion
205
+ export { LanguageNames, Languages, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, routing_exports as t, trimStainlessPath, updateHistory, walkTree };
package/dist/spec.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as Spec, d as Method, f as Model, i as DeclarationNode, m as Resource, v as SpecLanguage } from "./index-W4Td2Hl7.js";
2
- import { t as DocsLanguage } from "./routing-pAL4V4hv.js";
1
+ import { _ as Spec, d as Method, f as Model, i as DeclarationNode, m as Resource, v as SpecLanguage } from "./index-PdnFhQF9.js";
2
+ import { DocsLanguage } from "./routing.js";
3
3
 
4
4
  //#region src/spec.d.ts
5
5
  type SecurityScheme = Spec['security_schemes'][number];
@@ -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")[] | 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/dist/spec.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Languages } from "./routing-C64k4fmX.js";
2
- import { i as isResourceEmpty } from "./utils-DPbkW1Tz.js";
1
+ import { Languages } from "./routing.js";
2
+ import { isResourceEmpty } from "./utils.js";
3
3
 
4
4
  //#region src/spec.ts
5
5
  const defaultTransforms = {
package/dist/style.js CHANGED
@@ -1,3 +1,178 @@
1
- import { t as style_default } from "./style-DJIYkFhO.js";
1
+ //#region src/style.ts
2
+ var style_default = {
3
+ TextIdentifier: "stldocs-text-identifier",
4
+ TextOperator: "stldocs-text-operator",
5
+ TextPunctuation: "stldocs-text-punctuation",
6
+ TextKeyword: "stldocs-text-keyword",
7
+ ContentArea: "stldocs-content-area",
8
+ Markdown: "stldocs-markdown",
9
+ Content: "stldocs-content",
10
+ Truncation: "stldocs-truncation",
11
+ Expander: "stldocs-expander",
12
+ ExpanderContent: "stldocs-expander-content",
13
+ ExpanderSummary: "stldocs-expander-summary",
14
+ ExpanderSummaryIcon: "stldocs-expander-summary-icon",
15
+ ExpanderSummaryContent: "stldocs-expander-summary-content",
16
+ ExpanderIndent: "stldocs-expander-indent",
17
+ Badge: "stldocs-badge",
18
+ Icon: "stldocs-icon",
19
+ Tooltip: "stldocs-tooltip",
20
+ TooltipHost: "stldocs-tooltip-host",
21
+ TooltipContent: "stldocs-tooltip-content",
22
+ Input: "stldocs-input",
23
+ InputDisabled: "stldocs-input-disabled",
24
+ InputTextField: "stldocs-input-textfield",
25
+ MaskedInputWrapper: "stldocs-masked-input-wrapper",
26
+ MaskedInputDisplay: "stldocs-masked-input-display",
27
+ MaskedInputObscured: "stldocs-masked-input-obscured",
28
+ ToggleButton: "stldocs-togglebutton",
29
+ ListView: "stldocs-listview",
30
+ ListViewItem: "stldocs-listview-item",
31
+ ExpandToggle: "stldocs-expand-toggle",
32
+ ExpandToggleContent: "stldocs-expand-toggle-content",
33
+ LoadingSpinner: "stldocs-loading-spinner",
34
+ Type: "stldocs-type",
35
+ TypeName: "stldocs-typename",
36
+ TypeKeyword: "stldocs-type-keyword",
37
+ TypeString: "stldocs-type-string",
38
+ TypeArray: "stldocs-type-array",
39
+ TypeReference: "stldocs-type-reference",
40
+ TypeBracket: "stldocs-type-bracket",
41
+ TypeBrace: "stldocs-type-brace",
42
+ TypePropertyName: "stldocs-type-propertyname",
43
+ TypePlain: "stldocs-type-plain",
44
+ TypePreview: "stldocs-type-preview",
45
+ TypePreviewContent: "stldocs-type-preview-content",
46
+ LiteralString: "stldocs-literal-string",
47
+ LiteralNumeric: "stldocs-literal-numeric",
48
+ LiteralBoolean: "stldocs-literal-boolean",
49
+ Snippet: "stldocs-snippet",
50
+ SnippetCode: "stldocs-snippet-code",
51
+ SnippetFooter: "stldocs-snippet-footer",
52
+ SnippetRequest: "stldocs-snippet-request",
53
+ SnippetRequestTitle: "stldocs-snippet-request-title",
54
+ SnippetRequestTitleContent: "stldocs-snippet-request-title-content",
55
+ SnippetRequestTitleLabel: "stldocs-snippet-request-title-label",
56
+ SnippetRequestTitleLanguage: "stldocs-snippet-request-title-language",
57
+ SnippetRequestTitleMethod: "stldocs-snippet-request-title-method",
58
+ SnippetResponse: "stldocs-snippet-response",
59
+ SnippetMultiResponse: "stldocs-snippet-multi-response",
60
+ SnippetResponseOpen: "stldocs-snippet-response-opened",
61
+ SnippetResponseTab: "stldocs-snippet-response-tab",
62
+ SnippetResponseTabItem: "stldocs-snippet-response-tab-item",
63
+ SnippetResponseTabItemActive: "stldocs-snippet-response-tab-item-active",
64
+ SnippetResponseTabSingleReturn: "stldocs-snippet-response-tab-single-return",
65
+ SnippetResponsePane: "stldocs-snippet-response-pane",
66
+ SnippetResponsePaneActive: "stldocs-snippet-response-pane-active",
67
+ SnippetMulti: "stldocs-snippet-multi",
68
+ SnippetMultiTabs: "stldocs-snippet-multi-tabs",
69
+ SnippetMultiTab: "stldocs-snippet-multi-tab",
70
+ SnippetMultiContent: "stldocs-snippet-multi-content",
71
+ SnippetMultiPane: "stldocs-snippet-multi-pane",
72
+ SnippetMultiPaneActive: "stldocs-snippet-multi-pane-active",
73
+ Method: "stldocs-method",
74
+ MethodHeader: "stldocs-method-header",
75
+ MethodBody: "stldocs-method-body",
76
+ MethodInfo: "stldocs-method-info",
77
+ MethodInfoSection: "stldocs-method-info-section",
78
+ MethodExample: "stldocs-method-example",
79
+ MethodResponseColumn: "stldocs-method-response-column",
80
+ MethodTitle: "stldocs-method-title",
81
+ MethodBadges: "stldocs-method-badges",
82
+ MethodSignature: "stldocs-method-signature",
83
+ MethodDescription: "stldocs-method-description",
84
+ MethodParameters: "stldocs-method-parameters",
85
+ MethodReturns: "stldocs-method-returns",
86
+ MethodContent: "stldocs-method-content",
87
+ MethodContentColumn: "stldocs-method-content-column",
88
+ MethodRouteEndpoint: "stldocs-method-route-endpoint",
89
+ MethodRoute: "stldocs-method-route",
90
+ MethodSummary: "stldocs-method-summary",
91
+ MethodSinglePane: "stldocs-method-single-pane",
92
+ MethodDoublePane: "stldocs-method-double-pane",
93
+ MethodAvailableLanguages: "stldocs-method-available-languages",
94
+ SignatureTitle: "stldocs-signature-title",
95
+ SignatureName: "stldocs-signature-name",
96
+ SignatureQualified: "stldocs-signature-qualified",
97
+ SignatureParams: "stldoc-signature-params",
98
+ SignatureParen: "stldocs-signature-paren",
99
+ SignatureReturns: "stldocs-signature-returns",
100
+ TerraformResourceTitle: "stldocs-terraform-resource-title",
101
+ Property: "stldocs-property",
102
+ Properties: "stldocs-properties",
103
+ PropertyHeader: "stldocs-property-header",
104
+ PropertyInfo: "stldocs-property-info",
105
+ PropertyDeclaration: "stldocs-property-declaration",
106
+ PropertyDeprecated: "stldocs-property-deprecated",
107
+ PropertyDeprecatedMessage: "stldocs-property-deprecated-message",
108
+ PropertyContent: "stldocs-property-content",
109
+ PropertyChildren: "stldocs-property-children",
110
+ PropertyConstraints: "stldocs-property-constraints",
111
+ PropertyConstraint: "stldocs-property-constraint",
112
+ PropertyConstraintName: "stldocs-property-constraint-name",
113
+ PropertyConstraintValue: "stldocs-property-constraint-value",
114
+ PropertyDefault: "stldocs-property-default",
115
+ PropertyDescription: "stldocs-property-description",
116
+ PropertyTitle: "stldocs-property-title",
117
+ PropertyAnnotation: "stldocs-property-annotation",
118
+ PropertyName: "stldocs-property-name",
119
+ PropertyBadges: "stldocs-property-badges",
120
+ PropertyTypeName: "stldocs-property-typename",
121
+ PropertyType: "stldocs-property-type",
122
+ Overview: "stldocs-overview",
123
+ OverviewHeader: "stldocs-overview-header",
124
+ OverviewHeaderInfo: "stldocs-overview-header-info",
125
+ OverviewHeaderInfoTimestamp: "stldocs-overview-header-info-timestamp",
126
+ Resource: "stldocs-resource",
127
+ ResourceContent: "stldocs-resource-content",
128
+ ResourceContentProperties: "stldocs-resource-content-properties",
129
+ ResourceContentGroup: "stldocs-resource-content-group",
130
+ ResourceContentGroupName: "stldocs-resource-content-group-name",
131
+ ResourceContentGroupModelTitle: "stldocs-resource-content-group-model-title",
132
+ ResourceHeader: "stldocs-resource-header",
133
+ ResourceTitle: "stldocs-resource-title",
134
+ ResourceTitleSegment: "stldocs-resource-title-segment",
135
+ ResourceDescription: "stldocs-resource-description",
136
+ ResourceName: "stldocs-resource-name",
137
+ Model: "stldocs-model",
138
+ Root: "stldocs-root",
139
+ Sidebar: "stldocs-sidebar",
140
+ SidebarList: "stldocs-sidebar-list",
141
+ SidebarExpander: "stldocs-sidebar-expander",
142
+ SidebarExpanderSummary: "stldocs-sidebar-expander-summary",
143
+ SidebarExpanderContent: "stldocs-sidebar-expander-content",
144
+ SidebarEntry: "stldocs-sidebar-entry",
145
+ SidebarEntryLink: "stldocs-sidebar-entry-link",
146
+ SidebarEntryGroup: "stldocs-sidebar-entry-group",
147
+ SearchForm: "stldocs-search-form",
148
+ SearchModal: "stldocs-search-modal",
149
+ SearchFilter: "stldocs-search-filter",
150
+ SearchFilterLabel: "stldocs-search-filter-label",
151
+ SearchFilterCount: "stldocs-search-filter-count",
152
+ SearchBreadcrumb: "stldocs-search-breadcrumb",
153
+ SearchBreadcrumbItem: "stldocs-search-breadcrumb-item",
154
+ SearchBreadcrumbDivider: "stldocs-search-breadcrumb-divider",
155
+ SearchResult: "stldocs-search-result",
156
+ SearchResultResourceInfo: "stldocs-search-result-resource-info",
157
+ SearchResultResourceTitle: "stldocs-search-result-resource-title",
158
+ SearchResultResourcePath: "stldocs-search-result-resource-path",
159
+ SearchResultGuideTitle: "stldocs-search-result-guide-title",
160
+ SearchResultGuideExcerpt: "stldocs-search-result-guide-excerpt",
161
+ SearchDisabledStateContainer: "stldocs-search-disabled-state-container",
162
+ SearchModalCloseButton: "stldocs-search-modal-close-button",
163
+ LanguageBlock: "stldocs-language-block",
164
+ LanguageBlockContent: "stldocs-language-block-content",
165
+ LanguageBlockContentIcon: "stldocs-language-block-content-icon",
166
+ LanguageBlockContentInfo: "stldocs-language-block-content-info",
167
+ LanguageBlockContentInfoLanguage: "stldocs-language-block-content-info-language",
168
+ LanguageBlockContentInfoVersion: "stldocs-language-block-content-info-version",
169
+ LanguageBlockLinks: "stldocs-language-block-links",
170
+ LanguageBlockInstall: "stldocs-language-block-install",
171
+ Breadcrumbs: "stldocs-breadcrumbs",
172
+ BreadcrumbsItem: "stldocs-breadcrumbs-item",
173
+ BreadcrumbsLink: "stldocs-breadcrumbs-link",
174
+ BreadcrumbsNonLink: "stldocs-breadcrumbs-non-link"
175
+ };
2
176
 
177
+ //#endregion
3
178
  export { style_default as default };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+
3
+ //#region src/hooks/use-strict-context.tsx
4
+ function createStrictContext(displayName) {
5
+ const Context = React.createContext(null);
6
+ Context.displayName = displayName;
7
+ function useStrictContext() {
8
+ const context = React.useContext(Context);
9
+ if (context === null) throw new Error(`use${displayName} must be used within a ${displayName}Provider`);
10
+ return context;
11
+ }
12
+ return [Context.Provider, useStrictContext];
13
+ }
14
+
15
+ //#endregion
16
+ export { createStrictContext as t };
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as Spec, c as ID, m as Resource, s as HttpAST } from "./index-W4Td2Hl7.js";
1
+ import { _ as Spec, c as ID, m as Resource, s as HttpAST } from "./index-PdnFhQF9.js";
2
2
 
3
3
  //#region src/utils.d.ts
4
4
  declare namespace utils_d_exports {
package/dist/utils.js CHANGED
@@ -1,3 +1,54 @@
1
- import { i as isResourceEmpty, n as getBodyParams, r as getResourceFromSpec, t as flatResources } from "./utils-DPbkW1Tz.js";
1
+ import { t as __exportAll } from "./chunk-BYypO7fO.js";
2
+ import { parseStainlessPath } from "./routing.js";
2
3
 
3
- export { flatResources, getBodyParams, getResourceFromSpec, isResourceEmpty };
4
+ //#region src/utils.ts
5
+ var utils_exports = /* @__PURE__ */ __exportAll({
6
+ flatResources: () => flatResources,
7
+ getBodyParams: () => getBodyParams,
8
+ getResourceFromSpec: () => getResourceFromSpec,
9
+ isResourceEmpty: () => isResourceEmpty
10
+ });
11
+ function flatResources(resources, parents) {
12
+ return Object.keys(resources ?? {}).flatMap((key) => {
13
+ const resource = resources[key];
14
+ return [{
15
+ resource,
16
+ parents
17
+ }, ...resource.subresources ? flatResources(resource.subresources, [...parents, resource]) : []];
18
+ });
19
+ }
20
+ function getResourceFromSpec(stainlessPath, spec) {
21
+ if (typeof stainlessPath === "string") {
22
+ const parsed = parseStainlessPath(stainlessPath);
23
+ if (!parsed?.resource) return null;
24
+ stainlessPath = parsed.resource;
25
+ }
26
+ return stainlessPath.slice(1).reduce((acc, cur) => acc?.subresources?.[cur], spec.resources[stainlessPath[0]]) ?? null;
27
+ }
28
+ function isResourceEmpty(resource) {
29
+ return !(Object.values(resource.methods).length > 0 || Object.values(resource.models).length > 0 || Object.values(resource.subresources).length > 0);
30
+ }
31
+ function getBodyParams(decl) {
32
+ if (!decl.bodyParamsChildren) return null;
33
+ const keys = Object.keys(decl.bodyParamsChildren);
34
+ if (keys.length > 1) console.warn("multiple bodyParams content types in " + decl.stainlessPath + ":", keys);
35
+ const jsonKey = keys.find((e) => /[/+]json(;|$)/.test(e));
36
+ if (jsonKey) return {
37
+ params: decl.bodyParamsChildren[jsonKey],
38
+ encoding: "json"
39
+ };
40
+ const formDataKey = keys.find((e) => /^multipart\/form-data(;|$)/.test(e));
41
+ if (formDataKey) return {
42
+ params: decl.bodyParamsChildren[formDataKey],
43
+ encoding: "form-data"
44
+ };
45
+ const firstKey = keys[0];
46
+ if (firstKey) return {
47
+ params: decl.bodyParamsChildren[firstKey],
48
+ encoding: "unknown"
49
+ };
50
+ return null;
51
+ }
52
+
53
+ //#endregion
54
+ export { flatResources, getBodyParams, getResourceFromSpec, isResourceEmpty, utils_exports as t };
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.72",
4
+ "version": "0.1.0-beta.74",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,10 +27,10 @@
27
27
  "dotenv": "17.2.3",
28
28
  "react": "^19.2.4",
29
29
  "react-dom": "^19.2.4",
30
- "tsdown": "^0.20.0",
30
+ "tsdown": "^0.20.3",
31
31
  "typescript": "5.9.3",
32
32
  "@stainless/eslint-config": "0.1.0-beta.1",
33
- "@stainless/sdk-json": "^0.1.0-beta.5"
33
+ "@stainless/sdk-json": "^0.1.0-beta.6"
34
34
  },
35
35
  "exports": {
36
36
  ".": {
@@ -1,25 +0,0 @@
1
- import { _ as Spec } from "./index-W4Td2Hl7.js";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
3
-
4
- //#region src/components/breadcrumbs.d.ts
5
- type Breadcrumb = {
6
- title: string;
7
- href: string;
8
- };
9
- type BreadcrumbConfig = {
10
- includeCurrentPage?: boolean;
11
- };
12
- declare function generateApiBreadcrumbs(fullPath: string, spec: any, basePath: string): Breadcrumb[] | null;
13
- declare function SDKBreadcrumbs({
14
- spec,
15
- currentPath,
16
- basePath,
17
- config
18
- }: {
19
- spec: Spec;
20
- currentPath: string;
21
- basePath?: string;
22
- config?: BreadcrumbConfig | null;
23
- }): react_jsx_runtime1.JSX.Element | null;
24
- //#endregion
25
- export { generateApiBreadcrumbs as n, SDKBreadcrumbs as t };
@@ -1,25 +0,0 @@
1
- import { _ as Spec } from "./index-W4Td2Hl7.js";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
3
-
4
- //#region src/components/breadcrumbs.d.ts
5
- type Breadcrumb = {
6
- title: string;
7
- href: string;
8
- };
9
- type BreadcrumbConfig = {
10
- includeCurrentPage?: boolean;
11
- };
12
- declare function generateApiBreadcrumbs(fullPath: string, spec: any, basePath: string): Breadcrumb[] | null;
13
- declare function SDKBreadcrumbs({
14
- spec,
15
- currentPath,
16
- basePath,
17
- config
18
- }: {
19
- spec: Spec;
20
- currentPath: string;
21
- basePath?: string;
22
- config?: BreadcrumbConfig | null;
23
- }): react_jsx_runtime13.JSX.Element | null;
24
- //#endregion
25
- export { generateApiBreadcrumbs as n, SDKBreadcrumbs as t };
@@ -1,63 +0,0 @@
1
- import { t as style_default } from "./style-DJIYkFhO.js";
2
- import { n as Languages } from "./routing-C64k4fmX.js";
3
- import { i as Join } from "./primitives-CNG-fEhQ.js";
4
- import { jsx } from "react/jsx-runtime";
5
- import { ChevronRight } from "lucide-react";
6
-
7
- //#region src/components/breadcrumbs.tsx
8
- function generateApiBreadcrumbs(fullPath, spec, basePath) {
9
- const cleanBasePath = basePath.replace(/\/+$/, "");
10
- const cleanPath = fullPath.replace(/\/+$/, "");
11
- if (!cleanPath.startsWith(cleanBasePath)) return null;
12
- const rest = cleanPath.slice(cleanBasePath.length).split("/").filter(Boolean);
13
- const breadcrumbs = [];
14
- let href = cleanBasePath;
15
- let i = 0;
16
- if (Languages.includes(rest[0])) {
17
- href += `/${rest[0]}`;
18
- i++;
19
- }
20
- breadcrumbs.push({
21
- title: "API Reference",
22
- href
23
- });
24
- let currentSpec = spec;
25
- while (i < rest.length) {
26
- const idType = rest[i];
27
- const idValue = rest[i + 1];
28
- if (!idType || !idValue || !currentSpec?.[idType]?.[idValue]) break;
29
- currentSpec = currentSpec[idType][idValue];
30
- href += `/${idType}/${idValue}`;
31
- const title = (idType === "methods" ? currentSpec.summary : currentSpec.title) ?? idValue;
32
- breadcrumbs.push({
33
- title,
34
- href
35
- });
36
- i += 2;
37
- }
38
- return breadcrumbs;
39
- }
40
- function SDKBreadcrumbs({ spec, currentPath, basePath = "/api", config = { includeCurrentPage: false } }) {
41
- const breadcrumbs = generateApiBreadcrumbs(currentPath, spec, basePath);
42
- if (!breadcrumbs || breadcrumbs.length === 0) return null;
43
- if (!config?.includeCurrentPage && breadcrumbs.length > 1) breadcrumbs.pop();
44
- const items = breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx("div", {
45
- className: style_default.BreadcrumbsItem,
46
- children: /* @__PURE__ */ jsx("a", {
47
- href: crumb.href,
48
- className: style_default.BreadcrumbsLink,
49
- children: crumb.title
50
- })
51
- }, index));
52
- return /* @__PURE__ */ jsx("div", {
53
- className: style_default.Breadcrumbs,
54
- children: /* @__PURE__ */ jsx(Join, {
55
- limit: breadcrumbs.length,
56
- items,
57
- children: /* @__PURE__ */ jsx(ChevronRight, {})
58
- })
59
- });
60
- }
61
-
62
- //#endregion
63
- export { generateApiBreadcrumbs as n, SDKBreadcrumbs as t };