@stainless-api/docs-ui 0.1.0-beta.10 → 0.1.0-beta.11

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 (225) hide show
  1. package/dist/breadcrumbs-Z-hEqjcp.d.ts +19 -0
  2. package/dist/chunk-Bp6m_JJh.js +13 -0
  3. package/dist/component-generics-DzI21jRn.js +35 -0
  4. package/dist/component-generics-q5Dqiu2D.d.ts +30 -0
  5. package/dist/components/breadcrumbs.d.ts +2 -11
  6. package/dist/components/breadcrumbs.js +16 -52
  7. package/dist/components/chat.d.ts +13 -5
  8. package/dist/components/chat.js +138 -74
  9. package/dist/components/dropdown.d.ts +2 -17
  10. package/dist/components/dropdown.js +4 -18
  11. package/dist/components/icons.d.ts +50 -27
  12. package/dist/components/icons.js +3 -34
  13. package/dist/components/index.d.ts +12 -9
  14. package/dist/components/index.js +16 -10
  15. package/dist/components/method.d.ts +2 -41
  16. package/dist/components/method.js +16 -44
  17. package/dist/components/overview.d.ts +2 -21
  18. package/dist/components/overview.js +16 -49
  19. package/dist/components/primitives.d.ts +2 -60
  20. package/dist/components/primitives.js +16 -117
  21. package/dist/components/properties.d.ts +2 -24
  22. package/dist/components/properties.js +16 -24
  23. package/dist/components/scripts/dropdown.d.ts +11 -4
  24. package/dist/components/scripts/dropdown.js +49 -63
  25. package/dist/components/sdk.d.ts +3 -78
  26. package/dist/components/sdk.js +16 -153
  27. package/dist/components/sidebar.d.ts +2 -22
  28. package/dist/components/sidebar.js +16 -30
  29. package/dist/components/snippets.d.ts +4 -28
  30. package/dist/components/snippets.js +16 -76
  31. package/dist/contexts/component-generics.d.ts +2 -25
  32. package/dist/contexts/component-generics.js +3 -24
  33. package/dist/contexts/component-types.d.ts +18 -4
  34. package/dist/contexts/component-types.js +1 -2
  35. package/dist/contexts/component.d.ts +31 -14
  36. package/dist/contexts/component.js +16 -14
  37. package/dist/contexts/docs.d.ts +2 -34
  38. package/dist/contexts/docs.js +3 -43
  39. package/dist/contexts/index.d.ts +20 -7
  40. package/dist/contexts/index.js +16 -15
  41. package/dist/contexts/markdown.d.ts +2 -13
  42. package/dist/contexts/markdown.js +4 -29
  43. package/dist/contexts/navigation.d.ts +3 -19
  44. package/dist/contexts/navigation.js +3 -14
  45. package/dist/contexts/search.d.ts +4 -13
  46. package/dist/contexts/search.js +16 -15
  47. package/dist/contexts/use-components.d.ts +16 -1
  48. package/dist/contexts/use-components.js +4 -3
  49. package/dist/contexts-DRxRO-xO.js +3747 -0
  50. package/dist/docs-Dh8kE1va.js +50 -0
  51. package/dist/docs-EUy-wfbA.d.ts +43 -0
  52. package/dist/dropdown-B7VyGMOw.d.ts +43 -0
  53. package/dist/dropdown-DtgAi6lb.js +62 -0
  54. package/dist/icons-DdKM-01E.js +753 -0
  55. package/dist/index-AicgPYKB.d.ts +239 -0
  56. package/dist/index-BhwLhiWk.d.ts +14 -0
  57. package/dist/index-YnpUtXLB.d.ts +16 -0
  58. package/dist/index.d.ts +22 -6
  59. package/dist/index.js +16 -7
  60. package/dist/languages/go.d.ts +13 -21
  61. package/dist/languages/go.js +16 -116
  62. package/dist/languages/http.d.ts +13 -25
  63. package/dist/languages/http.js +16 -130
  64. package/dist/languages/index.d.ts +13 -37
  65. package/dist/languages/index.js +16 -10
  66. package/dist/languages/java.d.ts +13 -23
  67. package/dist/languages/java.js +16 -120
  68. package/dist/languages/python.d.ts +13 -22
  69. package/dist/languages/python.js +16 -104
  70. package/dist/languages/ruby.d.ts +13 -22
  71. package/dist/languages/ruby.js +16 -125
  72. package/dist/languages/typescript.d.ts +13 -22
  73. package/dist/languages/typescript.js +16 -134
  74. package/dist/markdown/index.d.ts +11 -6
  75. package/dist/markdown/index.js +16 -80
  76. package/dist/markdown/md.d.ts +15 -11
  77. package/dist/markdown/md.js +3 -34
  78. package/dist/markdown/utils.d.ts +4 -17
  79. package/dist/markdown/utils.js +3 -30
  80. package/dist/markdown-BXfX1D7C.js +42 -0
  81. package/dist/markdown-nFyAEX_K.d.ts +22 -0
  82. package/dist/md-Dg8aOyMA.js +41 -0
  83. package/dist/method-DpsVuzZW.d.ts +71 -0
  84. package/dist/navigation-aoYZ_tl4.js +24 -0
  85. package/dist/navigation-nyXBY-75.d.ts +29 -0
  86. package/dist/overview-C8e-6jGr.d.ts +38 -0
  87. package/dist/pagefind-ChrPfuVv.js +15 -0
  88. package/dist/primitives-DWz23_Ub.d.ts +99 -0
  89. package/dist/properties-CF71V58d.d.ts +46 -0
  90. package/dist/routing-DQjbRxdJ.js +189 -0
  91. package/dist/routing-qc0V00-j.d.ts +51 -0
  92. package/dist/routing.d.ts +2 -44
  93. package/dist/routing.js +3 -169
  94. package/dist/sdk-Zg3Rggk3.d.ts +118 -0
  95. package/dist/search/index.d.ts +26 -1
  96. package/dist/search/index.js +332 -2
  97. package/dist/search/providers/algolia.d.ts +22 -7
  98. package/dist/search/providers/algolia.js +16 -64
  99. package/dist/search/providers/fuse.d.ts +16 -9
  100. package/dist/search/providers/fuse.js +29 -12
  101. package/dist/search/providers/pagefind.d.ts +7 -2
  102. package/dist/search/providers/pagefind.js +3 -19
  103. package/dist/search/providers/walker.d.ts +8 -5
  104. package/dist/search/providers/walker.js +28 -19
  105. package/dist/search/types.d.ts +3 -79
  106. package/dist/search/types.js +3 -24
  107. package/dist/search-B6loAGmB.d.ts +21 -0
  108. package/dist/sidebar-C8KirYjg.d.ts +35 -0
  109. package/dist/snippets-EUzM4fRO.d.ts +45 -0
  110. package/dist/style-pN9hCoec.d.ts +181 -0
  111. package/dist/style-rYbbxIR_.js +182 -0
  112. package/dist/style.d.ts +2 -179
  113. package/dist/style.js +3 -179
  114. package/dist/styles/main.css +740 -746
  115. package/dist/styles/main.js +1 -0
  116. package/dist/styles/primitives.css +436 -428
  117. package/dist/styles/primitives.js +1 -0
  118. package/dist/styles/resets.css +34 -41
  119. package/dist/styles/resets.js +1 -0
  120. package/dist/styles/search.css +248 -248
  121. package/dist/styles/search.js +1 -0
  122. package/dist/styles/sidebar.css +59 -60
  123. package/dist/styles/sidebar.js +1 -0
  124. package/dist/styles/snippets.css +87 -88
  125. package/dist/styles/snippets.js +1 -0
  126. package/dist/styles/variables.css +86 -89
  127. package/dist/styles/variables.js +1 -0
  128. package/dist/types-CTBDtD34.d.ts +82 -0
  129. package/dist/types-DFN4M1Sp.js +34 -0
  130. package/dist/use-components-D9E85p5x.js +7 -0
  131. package/dist/utils-BHwvUDKn.js +30 -0
  132. package/dist/utils-CJfFBNgT.js +32 -0
  133. package/dist/utils-DQhEbvUC.d.ts +20 -0
  134. package/dist/utils-nDazhti8.d.ts +11 -0
  135. package/dist/utils.d.ts +2 -7
  136. package/dist/utils.js +4 -27
  137. package/package.json +2 -2
  138. package/dist/components/breadcrumbs.js.map +0 -1
  139. package/dist/components/chat.js.map +0 -1
  140. package/dist/components/dropdown.js.map +0 -1
  141. package/dist/components/icons.js.map +0 -1
  142. package/dist/components/index.js.map +0 -1
  143. package/dist/components/method.js.map +0 -1
  144. package/dist/components/overview.js.map +0 -1
  145. package/dist/components/primitives.js.map +0 -1
  146. package/dist/components/properties.js.map +0 -1
  147. package/dist/components/scripts/dropdown.js.map +0 -1
  148. package/dist/components/sdk.js.map +0 -1
  149. package/dist/components/sidebar.js.map +0 -1
  150. package/dist/components/snippets.js.map +0 -1
  151. package/dist/contexts/component-generics.js.map +0 -1
  152. package/dist/contexts/component-types.js.map +0 -1
  153. package/dist/contexts/component.js.map +0 -1
  154. package/dist/contexts/docs.js.map +0 -1
  155. package/dist/contexts/index.js.map +0 -1
  156. package/dist/contexts/markdown.js.map +0 -1
  157. package/dist/contexts/navigation.js.map +0 -1
  158. package/dist/contexts/search.js.map +0 -1
  159. package/dist/contexts/use-components.js.map +0 -1
  160. package/dist/index.js.map +0 -1
  161. package/dist/languages/go.js.map +0 -1
  162. package/dist/languages/http.js.map +0 -1
  163. package/dist/languages/index.js.map +0 -1
  164. package/dist/languages/java.js.map +0 -1
  165. package/dist/languages/python.js.map +0 -1
  166. package/dist/languages/ruby.js.map +0 -1
  167. package/dist/languages/typescript.js.map +0 -1
  168. package/dist/markdown/index.js.map +0 -1
  169. package/dist/markdown/md.js.map +0 -1
  170. package/dist/markdown/utils.js.map +0 -1
  171. package/dist/mcp.js +0 -16105
  172. package/dist/routing.js.map +0 -1
  173. package/dist/search/form.d.ts +0 -13
  174. package/dist/search/form.js +0 -55
  175. package/dist/search/form.js.map +0 -1
  176. package/dist/search/index.js.map +0 -1
  177. package/dist/search/indexer.d.ts +0 -31
  178. package/dist/search/indexer.js +0 -212
  179. package/dist/search/indexer.js.map +0 -1
  180. package/dist/search/mcp.d.ts +0 -8
  181. package/dist/search/mcp.js +0 -43
  182. package/dist/search/mcp.js.map +0 -1
  183. package/dist/search/printer.d.ts +0 -6
  184. package/dist/search/printer.js +0 -43
  185. package/dist/search/printer.js.map +0 -1
  186. package/dist/search/providers/algolia.js.map +0 -1
  187. package/dist/search/providers/fuse.js.map +0 -1
  188. package/dist/search/providers/pagefind.js.map +0 -1
  189. package/dist/search/providers/walker.js.map +0 -1
  190. package/dist/search/results.d.ts +0 -21
  191. package/dist/search/results.js +0 -58
  192. package/dist/search/results.js.map +0 -1
  193. package/dist/search/state.d.ts +0 -29
  194. package/dist/search/state.js +0 -38
  195. package/dist/search/state.js.map +0 -1
  196. package/dist/search/types.js.map +0 -1
  197. package/dist/style.js.map +0 -1
  198. package/dist/types/sdkjson.d.ts +0 -1
  199. package/dist/types/sdkjson.js +0 -2
  200. package/dist/types/sdkjson.js.map +0 -1
  201. package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.d.ts +0 -120
  202. package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js +0 -2
  203. package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js.map +0 -1
  204. package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.d.ts +0 -100
  205. package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js +0 -3
  206. package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js.map +0 -1
  207. package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.d.ts +0 -87
  208. package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js +0 -2
  209. package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js.map +0 -1
  210. package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.d.ts +0 -110
  211. package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js +0 -3
  212. package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js.map +0 -1
  213. package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.d.ts +0 -122
  214. package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js +0 -2
  215. package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js.map +0 -1
  216. package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.d.ts +0 -146
  217. package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js +0 -3
  218. package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js.map +0 -1
  219. package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.d.ts +0 -89
  220. package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js +0 -3
  221. package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js.map +0 -1
  222. package/dist/types/stainless-alias/lib/json-spec-v2/types.d.ts +0 -190
  223. package/dist/types/stainless-alias/lib/json-spec-v2/types.js +0 -105
  224. package/dist/types/stainless-alias/lib/json-spec-v2/types.js.map +0 -1
  225. package/dist/utils.js.map +0 -1
@@ -1,24 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useLanguage, useSettings } from '../contexts';
3
- import { useComponents } from '../contexts/use-components';
4
- import style from '../style';
5
- import { ArrowDownWideNarrowIcon, ArrowUpNarrowWideIcon } from 'lucide-react';
6
- export function PropertyToggle({ target }) {
7
- return (_jsxs("span", { className: style.ExpandToggle, "data-stldocs-property-toggle-expanded": "false", "data-stldocs-property-toggle-target": target, children: [_jsxs("span", { className: style.ExpandToggleContent, children: ["Expand ", _jsx(ArrowDownWideNarrowIcon, { className: style.Icon, size: 16 })] }), _jsxs("span", { className: style.ExpandToggleContent, children: ["Collapse ", _jsx(ArrowUpNarrowWideIcon, { className: style.Icon, size: 16 })] })] }));
8
- }
9
- export function PropertyDescription({ description }) {
10
- const { Markdown } = useComponents();
11
- if (description)
12
- return (_jsx("div", { className: style.PropertyDescription, children: _jsx(Markdown, { content: description }) }));
13
- }
14
- export function Property({ id, name, typeName, badges, type, declaration, description, deprecated, expand, additional, constraints, children, }) {
15
- const Docs = useComponents();
16
- const language = useLanguage();
17
- const { collapseDescription, types } = useSettings().properties ?? {};
18
- const textContent = (_jsxs(_Fragment, { children: [typeof deprecated === 'string' && _jsx("div", { className: style.PropertyDeprecatedMessage, children: deprecated }), description && _jsx(Docs.PropertyDescription, { description: description }), constraints && _jsx("div", { className: style.PropertyContent, children: constraints })] }));
19
- const rich = (_jsxs(_Fragment, { children: [_jsxs("div", { className: style.PropertyDeclaration, children: [deprecated && _jsx("span", { className: style.PropertyDeprecated, children: "Deprecated" }), declaration, badges && _jsx("span", { className: style.PropertyBadges, children: badges })] }), collapseDescription === false ? textContent : null] }));
20
- const simple = (_jsxs(_Fragment, { children: [name && (_jsxs("div", { className: style.PropertyHeader, children: [deprecated && _jsx("span", { className: style.PropertyDeprecated, children: "Deprecated" }), name && _jsx("span", { className: style.PropertyName, children: name }), typeName && _jsx("span", { className: style.PropertyTypeName, children: typeName }), badges && _jsx("span", { className: style.PropertyBadges, children: badges })] })), type && _jsx("div", { className: style.PropertyType, children: type }), collapseDescription === false ? textContent : null] }));
21
- const content = (_jsx("div", { id: id, className: style.PropertyInfo, children: types === 'simple' ? simple : rich }));
22
- return (_jsx("div", { className: style.Property, "data-stldocs-language": language, children: children || (collapseDescription !== false && description) ? (_jsxs(Docs.Expander, { summary: content, muted: !children, open: expand, children: [collapseDescription !== false ? textContent : null, additional, children && _jsx("div", { className: style.PropertyChildren, children: children })] })) : (content) }));
23
- }
24
- //# sourceMappingURL=properties.js.map
1
+ import "../component-generics-DzI21jRn.js";
2
+ import "../docs-Dh8kE1va.js";
3
+ import "../navigation-aoYZ_tl4.js";
4
+ import "../markdown-BXfX1D7C.js";
5
+ import "../routing-DQjbRxdJ.js";
6
+ import "../style-rYbbxIR_.js";
7
+ import "../use-components-D9E85p5x.js";
8
+ import { $t as PropertyDescription, Qt as Property, en as PropertyToggle } from "../contexts-DRxRO-xO.js";
9
+ import "../icons-DdKM-01E.js";
10
+ import "../utils-CJfFBNgT.js";
11
+ import "../dropdown-DtgAi6lb.js";
12
+ import "../md-Dg8aOyMA.js";
13
+ import "../utils-BHwvUDKn.js";
14
+ import "../types-DFN4M1Sp.js";
15
+
16
+ export { Property, PropertyDescription, PropertyToggle };
@@ -1,5 +1,12 @@
1
- export declare function initDropdown({ dropdownId, onSelect, isFixed, }: {
2
- dropdownId: string;
3
- onSelect?: (value: string) => void;
4
- isFixed?: boolean;
1
+ //#region src/components/scripts/dropdown.d.ts
2
+ declare function initDropdown({
3
+ dropdownId,
4
+ onSelect,
5
+ isFixed
6
+ }: {
7
+ dropdownId: string;
8
+ onSelect?: (value: string) => void;
9
+ isFixed?: boolean;
5
10
  }): void;
11
+ //#endregion
12
+ export { initDropdown };
@@ -1,64 +1,50 @@
1
- export function initDropdown({ dropdownId, onSelect, isFixed, }) {
2
- const dropdown = document.getElementById(dropdownId);
3
- if (!dropdown)
4
- return;
5
- const button = dropdown.querySelector('button');
6
- const menu = dropdown.querySelector('.stldocs-dropdown-menu');
7
- if (!button || !menu)
8
- return;
9
- let isOpen = false;
10
- function toggleDropdown() {
11
- if (!button || !menu)
12
- return;
13
- isOpen = !isOpen;
14
- if (isOpen) {
15
- if (isFixed) {
16
- // Calculate position for fixed dropdown
17
- const buttonRect = button.getBoundingClientRect();
18
- menu.style.top = `${buttonRect.bottom}px`;
19
- menu.style.left = `${buttonRect.left}px`;
20
- }
21
- menu.classList.add('open');
22
- button.setAttribute('aria-expanded', 'true');
23
- }
24
- else {
25
- menu.classList.remove('open');
26
- button.setAttribute('aria-expanded', 'false');
27
- }
28
- }
29
- function closeDropdown() {
30
- if (!button || !menu)
31
- return;
32
- isOpen = false;
33
- menu.classList.remove('open');
34
- button.setAttribute('aria-expanded', 'false');
35
- }
36
- // Toggle dropdown on button click
37
- button.addEventListener('click', (e) => {
38
- toggleDropdown();
39
- });
40
- // Close dropdown when clicking outside
41
- document.addEventListener('click', (e) => {
42
- if (!dropdown.contains(e.target)) {
43
- closeDropdown();
44
- }
45
- });
46
- // Close dropdown when pressing Escape
47
- document.addEventListener('keydown', (e) => {
48
- if (e.key === 'Escape' && isOpen) {
49
- closeDropdown();
50
- }
51
- });
52
- // Close dropdown when clicking on dropdown items
53
- const dropdownItems = menu.querySelectorAll('.stldocs-dropdown-item');
54
- dropdownItems.forEach((item) => {
55
- item.addEventListener('click', () => {
56
- closeDropdown();
57
- const selectedValue = item.getAttribute('data-dropdown-value');
58
- if (selectedValue && onSelect) {
59
- onSelect(selectedValue);
60
- }
61
- });
62
- });
1
+ //#region src/components/scripts/dropdown.ts
2
+ function initDropdown({ dropdownId, onSelect, isFixed }) {
3
+ const dropdown = document.getElementById(dropdownId);
4
+ if (!dropdown) return;
5
+ const button = dropdown.querySelector("button");
6
+ const menu = dropdown.querySelector(".stldocs-dropdown-menu");
7
+ if (!button || !menu) return;
8
+ let isOpen = false;
9
+ function toggleDropdown() {
10
+ if (!button || !menu) return;
11
+ isOpen = !isOpen;
12
+ if (isOpen) {
13
+ if (isFixed) {
14
+ const buttonRect = button.getBoundingClientRect();
15
+ menu.style.top = `${buttonRect.bottom}px`;
16
+ menu.style.left = `${buttonRect.left}px`;
17
+ }
18
+ menu.classList.add("open");
19
+ button.setAttribute("aria-expanded", "true");
20
+ } else {
21
+ menu.classList.remove("open");
22
+ button.setAttribute("aria-expanded", "false");
23
+ }
24
+ }
25
+ function closeDropdown() {
26
+ if (!button || !menu) return;
27
+ isOpen = false;
28
+ menu.classList.remove("open");
29
+ button.setAttribute("aria-expanded", "false");
30
+ }
31
+ button.addEventListener("click", (e) => {
32
+ toggleDropdown();
33
+ });
34
+ document.addEventListener("click", (e) => {
35
+ if (!dropdown.contains(e.target)) closeDropdown();
36
+ });
37
+ document.addEventListener("keydown", (e) => {
38
+ if (e.key === "Escape" && isOpen) closeDropdown();
39
+ });
40
+ menu.querySelectorAll(".stldocs-dropdown-item").forEach((item) => {
41
+ item.addEventListener("click", () => {
42
+ closeDropdown();
43
+ const selectedValue = item.getAttribute("data-dropdown-value");
44
+ if (selectedValue && onSelect) onSelect(selectedValue);
45
+ });
46
+ });
63
47
  }
64
- //# sourceMappingURL=dropdown.js.map
48
+
49
+ //#endregion
50
+ export { initDropdown };
@@ -1,78 +1,3 @@
1
- import * as React from 'react';
2
- import type { SDKJSON } from '../types/sdkjson';
3
- import { DocsLanguage } from '../routing';
4
- export type PropertyModelContextType = {
5
- modelPath?: string;
6
- propertyPath?: string;
7
- };
8
- export declare const PropertyModelContext: React.Context<PropertyModelContextType>;
9
- export declare function usePropertyModel(): PropertyModelContextType;
10
- export type ReferenceNestingContextType = string[];
11
- export declare const ReferenceNestingContext: React.Context<ReferenceNestingContextType>;
12
- export declare function useReferenceNesting(): ReferenceNestingContextType;
13
- export type SDKSnippetLanguagesType = Record<SDKJSON.SnippetLanguage, {
14
- name: string;
15
- icon: string;
16
- }>;
17
- export declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
18
- export type TransformRequestSnippetFn = ({ snippet, language, }: {
19
- snippet: string;
20
- language: DocsLanguage;
21
- }) => string;
22
- type SDKChildrenProps = {
23
- paths: SDKJSON.ID[];
24
- expand?: boolean;
25
- depth?: number;
26
- };
27
- export declare function SDKChildren({ paths, expand, depth }: SDKChildrenProps): import("react/jsx-runtime").JSX.Element;
28
- type SDKDeclarationProps = {
29
- path: string;
30
- expand?: boolean;
31
- depth?: number;
32
- };
33
- export declare function SDKDeclaration({ path, expand, depth }: SDKDeclarationProps): import("react/jsx-runtime").JSX.Element | null;
34
- export type SDKConstraintsProps = {
35
- constraints?: Record<string, any>;
36
- };
37
- export declare function SDKConstraints({ constraints }: SDKConstraintsProps): import("react/jsx-runtime").JSX.Element | undefined;
38
- type SDKIconProps = {
39
- language: SDKJSON.SnippetLanguage;
40
- size?: number;
41
- };
42
- export declare function SDKIcon({ language }: SDKIconProps): import("react/jsx-runtime").JSX.Element | null;
43
- export type SDKRequestTitleProps = {
44
- snippetLanguage: SDKJSON.SnippetLanguage;
45
- };
46
- export declare function SDKRequestTitle({ snippetLanguage }: SDKRequestTitleProps): import("react/jsx-runtime").JSX.Element;
47
- type SDKExampleProps = {
48
- method: SDKJSON.Method;
49
- transformRequestSnippet?: TransformRequestSnippetFn;
50
- };
51
- export declare function SDKExample({ method, transformRequestSnippet }: SDKExampleProps): import("react/jsx-runtime").JSX.Element;
52
- export type SDKMethodProps = {
53
- method: SDKJSON.Method;
54
- transformRequestSnippet?: TransformRequestSnippetFn;
55
- };
56
- export declare function SDKMethodHeader({ method }: SDKMethodProps): import("react/jsx-runtime").JSX.Element;
57
- export declare function SDKMethodInfo({ method }: SDKMethodProps): import("react/jsx-runtime").JSX.Element;
58
- export declare function SDKMethod({ method, transformRequestSnippet }: SDKMethodProps): import("react/jsx-runtime").JSX.Element | undefined;
59
- export type SDKModelProps = {
60
- model: SDKJSON.Model;
61
- };
62
- export declare function SDKModel({ model }: SDKModelProps): import("react/jsx-runtime").JSX.Element | null;
63
- type SDKReferenceProps = {
64
- stainlessPath: string;
65
- children?: React.ReactNode;
66
- };
67
- export declare function SDKReference({ stainlessPath, children }: SDKReferenceProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
68
- type SDKLanguageBlockProps = {
69
- language: DocsLanguage;
70
- version: string;
71
- install: string;
72
- links: {
73
- repo: string;
74
- docs: string;
75
- };
76
- };
77
- export declare function SDKLanguageBlock({ language, version, install, links }: SDKLanguageBlockProps): import("react/jsx-runtime").JSX.Element;
78
- export {};
1
+ import "../routing-qc0V00-j.js";
2
+ import { C as TransformRequestSnippetFn, S as SDKSnippetLanguagesType, T as useReferenceNesting, _ as SDKModelProps, a as SDKChildren, b as SDKRequestTitleProps, c as SDKDeclaration, d as SDKLanguageBlock, f as SDKMethod, g as SDKModel, h as SDKMethodProps, i as ReferenceNestingContextType, l as SDKExample, m as SDKMethodInfo, n as PropertyModelContextType, o as SDKConstraints, p as SDKMethodHeader, r as ReferenceNestingContext, s as SDKConstraintsProps, t as PropertyModelContext, u as SDKIcon, v as SDKReference, w as usePropertyModel, x as SDKSnippetLanguages, y as SDKRequestTitle } from "../sdk-Zg3Rggk3.js";
3
+ export { PropertyModelContext, PropertyModelContextType, ReferenceNestingContext, ReferenceNestingContextType, SDKChildren, SDKConstraints, SDKConstraintsProps, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKMethodProps, SDKModel, SDKModelProps, SDKReference, SDKRequestTitle, SDKRequestTitleProps, SDKSnippetLanguages, SDKSnippetLanguagesType, TransformRequestSnippetFn, usePropertyModel, useReferenceNesting };
@@ -1,153 +1,16 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import { useComponents } from '../contexts/use-components';
4
- import { useLanguageComponents, useDeclaration, useLanguage, useSpec, useContentPanelLayout, useSettings, useNavigation, } from '../contexts';
5
- import style from '../style';
6
- import { getLanguageSnippet } from '../routing';
7
- import { BookOpen, Copy, Github } from 'lucide-react';
8
- import clsx from 'clsx';
9
- import { GoIcon, JavaIcon, KotlinIcon, PythonIcon, RubyIcon, TerraformIcon, TypescriptIcon, CurlIcon, PowershellIcon, } from './icons';
10
- import { Button } from '@stainless-api/ui-primitives';
11
- export const PropertyModelContext = React.createContext(null);
12
- export function usePropertyModel() {
13
- return React.useContext(PropertyModelContext);
14
- }
15
- export const ReferenceNestingContext = React.createContext([]);
16
- export function useReferenceNesting() {
17
- return React.useContext(ReferenceNestingContext);
18
- }
19
- export const SDKSnippetLanguages = {
20
- 'node.default': { name: 'TypeScript', icon: 'typescript' },
21
- 'typescript.default': { name: 'TypeScript', icon: 'typescript' },
22
- 'python.default': { name: 'Python', icon: 'python' },
23
- 'go.default': { name: 'Go', icon: 'go' },
24
- 'java.default': { name: 'Java', icon: 'java' },
25
- 'kotlin.default': { name: 'Kotlin', icon: 'kotlin' },
26
- 'http.curl': { name: 'cURL', icon: 'http' },
27
- 'http.powershell': { name: 'Powershell', icon: 'powershell' },
28
- 'terraform.default': { name: 'Terraform', icon: 'terraform' },
29
- 'ruby.default': { name: 'Ruby', icon: 'ruby' },
30
- };
31
- export function SDKChildren({ paths, expand, depth }) {
32
- const Docs = useComponents();
33
- return (_jsx("div", { className: style.Properties, children: paths.map((path, i) => (_jsx(Docs.SDKDeclaration, { path: path, expand: expand, depth: depth }, i))) }));
34
- }
35
- export function SDKDeclaration({ path, expand, depth = 0 }) {
36
- const Lang = useLanguageComponents();
37
- const Docs = useComponents();
38
- const decl = useDeclaration(path);
39
- const settings = useSettings();
40
- const model = usePropertyModel();
41
- const nesting = useReferenceNesting();
42
- const { selectedPath } = useNavigation();
43
- if (!decl)
44
- return null;
45
- if (decl.kind.endsWith('Reference')) {
46
- const refId = decl['type']['$ref'];
47
- if (refId && refId !== path && !nesting.includes(refId)) {
48
- return (_jsx(ReferenceNestingContext.Provider, { value: [...nesting, refId], children: _jsx(SDKDeclaration, { path: refId, expand: expand, depth: depth }) }));
49
- }
50
- }
51
- const isUnion = 'childrenParentSchema' in decl && ['enum', 'union'].includes(decl.childrenParentSchema);
52
- const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
53
- const shouldExpand = (selectedPath.startsWith(path) && nesting.length < 1) ||
54
- (settings.properties?.expandDepth && depth <= settings.properties?.expandDepth && !isUnion) ||
55
- expand;
56
- const content = (_jsx(Lang.Property, { decl: decl, children: ({ ...props }) => (_jsx(Docs.Property, { id: id, expand: shouldExpand, constraints: decl['constraints'] && _jsx(Docs.SDKConstraints, { constraints: decl['constraints'] }), declaration: _jsx(Lang.Declaration, { decl: decl }), description: decl['docstring'], deprecated: decl.deprecated, ...props, children: 'children' in decl &&
57
- decl.children.length > 0 &&
58
- (settings.properties?.includeModelProperties !== false || !('modelPath' in decl)) && (_jsxs(_Fragment, { children: [isUnion && _jsx("div", { className: style.PropertyAnnotation, children: "Accepts one of the following:" }), _jsx(Docs.SDKChildren, { paths: decl.children, depth: depth + 1 })] })) })) }));
59
- if ('modelPath' in decl) {
60
- const value = { modelPath: decl.modelPath, propertyPath: decl.stainlessPath };
61
- return _jsx(PropertyModelContext.Provider, { value: value, children: content });
62
- }
63
- return content;
64
- }
65
- export function SDKConstraints({ constraints }) {
66
- if (constraints)
67
- return (_jsx("div", { className: style.PropertyConstraints, children: Object.entries(constraints).map(([name, value]) => (_jsxs("div", { className: style.PropertyConstraint, children: [_jsx("span", { className: style.PropertyConstraintName, children: name }), _jsx("span", { className: style.PropertyConstraintValue, children: value })] }, name))) }));
68
- }
69
- const snippetIcons = {
70
- 'node.default': TypescriptIcon,
71
- 'typescript.default': TypescriptIcon,
72
- 'go.default': GoIcon,
73
- 'python.default': PythonIcon,
74
- 'terraform.default': TerraformIcon,
75
- 'http.curl': CurlIcon,
76
- 'http.powershell': PowershellIcon,
77
- 'ruby.default': RubyIcon,
78
- 'java.default': JavaIcon,
79
- 'kotlin.default': KotlinIcon,
80
- };
81
- export function SDKIcon({ language }) {
82
- const LangIcon = snippetIcons[language];
83
- if (!LangIcon)
84
- return null;
85
- return _jsx(LangIcon, { className: clsx(style.Icon, language.split('.').shift()) });
86
- }
87
- export function SDKRequestTitle({ snippetLanguage }) {
88
- const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
89
- return (_jsxs("span", { className: style.SnippetRequestTitleLanguage, children: [_jsx(SDKIcon, { language: snippetLanguage }), " ", languageName] }));
90
- }
91
- export function SDKExample({ method, transformRequestSnippet }) {
92
- // TODO: support language variants in snippets
93
- const Docs = useComponents();
94
- const language = useLanguage();
95
- const snippetLanguage = getLanguageSnippet(language);
96
- return (_jsx(Docs.Snippet, { requestTitle: _jsx(Docs.SDKRequestTitle, { snippetLanguage: snippetLanguage }), method: method, transformRequestSnippet: transformRequestSnippet }));
97
- }
98
- export function SDKMethodHeader({ method }) {
99
- const Docs = useComponents();
100
- const Lang = useLanguageComponents();
101
- const decl = useDeclaration(method.stainlessPath);
102
- return (_jsx(Docs.MethodHeader, { level: "h1", title: method.summary ?? method.title, signature: _jsx(Lang.MethodSignature, { decl: decl }), badges: method.deprecated && _jsx(Docs.Badge, { id: "deprecated", children: "Deprecated" }), children: _jsx(Docs.MethodRoute, { httpMethod: method.httpMethod, endpoint: method.endpoint.split(' ', 2).at(-1) }) }));
103
- }
104
- export function SDKMethodInfo({ method }) {
105
- const Docs = useComponents();
106
- const Lang = useLanguageComponents();
107
- const decl = useDeclaration(method.stainlessPath);
108
- const spec = useSpec();
109
- const language = useLanguage();
110
- if (Lang.MethodInfo)
111
- return _jsx(Lang.MethodInfo, { decl: decl });
112
- function shouldExpand(items) {
113
- if (items.length > 1)
114
- return false;
115
- const decl = spec?.decls?.[language]?.[items[0]];
116
- return decl && 'children' in decl && decl.children.length > 0;
117
- }
118
- return (_jsx(Docs.MethodInfo, { parameters: 'paramsChildren' in decl &&
119
- Array.isArray(decl.paramsChildren) &&
120
- decl.paramsChildren.length > 0 && (_jsx(Docs.SDKChildren, { expand: shouldExpand(decl.paramsChildren), paths: decl.paramsChildren })), returns: 'responseChildren' in decl &&
121
- decl.responseChildren.length > 0 && (_jsx(Docs.SDKChildren, { expand: shouldExpand(decl.responseChildren), paths: decl.responseChildren })) }));
122
- }
123
- export function SDKMethod({ method, transformRequestSnippet }) {
124
- const Docs = useComponents();
125
- const decl = useDeclaration(method?.stainlessPath);
126
- const layout = useContentPanelLayout();
127
- if (!decl)
128
- return;
129
- return (_jsxs(Docs.Method, { id: method.stainlessPath, header: _jsx(Docs.SDKMethodHeader, { method: method }), className: clsx({
130
- [style.MethodSinglePane]: layout === 'single-pane',
131
- [style.MethodDoublePane]: layout === 'double-pane',
132
- }), children: [_jsxs("div", { className: style.MethodContentColumn, children: [_jsx(Docs.MethodDescription, { description: method.description }), _jsx(Docs.SDKMethodInfo, { method: method })] }), _jsx("div", { className: style.MethodExample + ' not-content', children: _jsx(Docs.SDKExample, { method: method, transformRequestSnippet: transformRequestSnippet }) }), _jsxs("div", { className: style.MethodResponseColumn, children: [_jsx("h5", { children: "Returns Examples" }), _jsx(Docs.SnippetResponse, { responses: method.exampleResponses })] })] }));
133
- }
134
- export function SDKModel({ model }) {
135
- const Docs = useComponents();
136
- const decl = useDeclaration(`${model.stainlessPath} > (schema)`);
137
- if (!decl)
138
- return null;
139
- return (_jsx("div", { className: style.Model, tabIndex: 0, children: _jsx("div", { className: style.ResourceContentProperties, children: _jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` }) }) }));
140
- }
141
- export function SDKReference({ stainlessPath, children }) {
142
- const Docs = useComponents();
143
- if (!stainlessPath || !stainlessPath.endsWith('(schema)'))
144
- return children;
145
- const link = (_jsx("span", { className: style.TypeReference, children: _jsx(Docs.Link, { stainlessPath: stainlessPath, children: children }) }));
146
- return link;
147
- }
148
- export function SDKLanguageBlock({ language, version, install, links }) {
149
- const Docs = useComponents();
150
- const lang = `${language}.default`;
151
- return (_jsxs("div", { className: style.LanguageBlock, children: [_jsxs("div", { className: style.LanguageBlockContent, children: [_jsx("div", { className: style.LanguageBlockContentIcon, children: _jsx(Docs.SDKIcon, { language: lang, size: 24 }) }), _jsxs("div", { className: style.LanguageBlockContentInfo, children: [_jsx("div", { className: style.LanguageBlockContentInfoLanguage, children: Docs.SDKSnippetLanguages[lang].name }), _jsx("div", { className: style.LanguageBlockContentInfoVersion, children: version })] })] }), _jsxs("div", { className: style.LanguageBlockInstall, "data-stldocs-copy-parent": true, children: [_jsx("pre", { "data-stldocs-copy-content": true, children: install }), ' ', _jsx(Button, { variant: "ghost", size: "sm", "data-stldocs-snippet-copy": true, children: _jsx(Copy, { size: 16, className: style.Icon }) })] }), _jsxs("div", { className: style.LanguageBlockLinks, children: [_jsx(Button, { href: links.repo, variant: "outline", children: _jsx(Button.Icon, { icon: Github }) }), _jsxs(Button, { href: links.docs, variant: "outline", children: [_jsx(Button.Icon, { icon: BookOpen }), _jsx(Button.Label, { children: "Read Docs" })] })] })] }));
152
- }
153
- //# sourceMappingURL=sdk.js.map
1
+ import "../component-generics-DzI21jRn.js";
2
+ import "../docs-Dh8kE1va.js";
3
+ import "../navigation-aoYZ_tl4.js";
4
+ import "../markdown-BXfX1D7C.js";
5
+ import "../routing-DQjbRxdJ.js";
6
+ import "../style-rYbbxIR_.js";
7
+ import "../use-components-D9E85p5x.js";
8
+ import { At as SDKRequestTitle, Ct as SDKIcon, Dt as SDKMethodInfo, Et as SDKMethodHeader, Mt as usePropertyModel, Nt as useReferenceNesting, Ot as SDKModel, St as SDKExample, Tt as SDKMethod, _t as PropertyModelContext, bt as SDKConstraints, jt as SDKSnippetLanguages, kt as SDKReference, vt as ReferenceNestingContext, wt as SDKLanguageBlock, xt as SDKDeclaration, yt as SDKChildren } from "../contexts-DRxRO-xO.js";
9
+ import "../icons-DdKM-01E.js";
10
+ import "../utils-CJfFBNgT.js";
11
+ import "../dropdown-DtgAi6lb.js";
12
+ import "../md-Dg8aOyMA.js";
13
+ import "../utils-BHwvUDKn.js";
14
+ import "../types-DFN4M1Sp.js";
15
+
16
+ export { PropertyModelContext, ReferenceNestingContext, SDKChildren, SDKConstraints, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKModel, SDKReference, SDKRequestTitle, SDKSnippetLanguages, usePropertyModel, useReferenceNesting };
@@ -1,22 +1,2 @@
1
- import * as React from 'react';
2
- import type { SDKJSON } from '../types/sdkjson';
3
- type SidebarExpanderProps = {
4
- open?: boolean;
5
- summary: React.ReactNode;
6
- children?: React.ReactNode;
7
- };
8
- export declare function SidebarExpander({ open, summary, children }: SidebarExpanderProps): import("react/jsx-runtime").JSX.Element;
9
- export type SidebarMethodProps = {
10
- method: SDKJSON.Method;
11
- };
12
- export declare function SidebarMethod({ method }: SidebarMethodProps): import("react/jsx-runtime").JSX.Element;
13
- export type SidebarResourceProps = {
14
- resource: SDKJSON.Resource;
15
- };
16
- export declare function SidebarResource({ resource }: SidebarResourceProps): import("react/jsx-runtime").JSX.Element;
17
- export type SidebarProps = {
18
- resources: SDKJSON.Resource[];
19
- selectedPath?: string;
20
- };
21
- export declare function Sidebar({ resources }: SidebarProps): import("react/jsx-runtime").JSX.Element;
22
- export {};
1
+ import { a as SidebarProps, i as SidebarMethodProps, n as SidebarExpander, o as SidebarResource, r as SidebarMethod, s as SidebarResourceProps, t as Sidebar } from "../sidebar-C8KirYjg.js";
2
+ export { Sidebar, SidebarExpander, SidebarMethod, SidebarMethodProps, SidebarProps, SidebarResource, SidebarResourceProps };
@@ -1,30 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useNavigation } from '../contexts';
3
- import { useComponents } from '../contexts/use-components';
4
- import { ChevronDown, ChevronRight } from 'lucide-react';
5
- import style from '../style';
6
- import { MethodIconBadge } from './method';
7
- import { isResourceEmpty } from '../utils';
8
- export function SidebarExpander({ open, summary, children }) {
9
- return (_jsxs("details", { className: style.SidebarExpander, open: open, children: [_jsxs("summary", { className: style.ExpanderSummary, children: [_jsx("div", { className: style.ExpanderSummaryContent, children: summary }), _jsxs("div", { className: style.ExpanderSummaryIcon, children: [_jsx(ChevronRight, { size: 16, strokeWidth: 1, className: style.Icon }), _jsx(ChevronDown, { size: 16, strokeWidth: 1, className: style.Icon })] })] }), _jsx("div", { className: style.ExpanderContent, children: children })] }));
10
- }
11
- export function SidebarMethod({ method }) {
12
- const Docs = useComponents();
13
- const { selectedPath } = useNavigation();
14
- return (_jsxs("div", { className: style.SidebarMethod, "data-selected": method.stainlessPath === selectedPath, children: [_jsx(MethodIconBadge, { httpMethod: method.httpMethod }), _jsx(Docs.Link, { stainlessPath: method.stainlessPath, children: method.summary })] }));
15
- }
16
- export function SidebarResource({ resource }) {
17
- const Docs = useComponents();
18
- const { selectedPath } = useNavigation();
19
- const subresources = Object.values(resource.subresources ?? {}).map((sub) => (_jsx(SidebarResource, { resource: sub }, sub.stainlessPath)));
20
- const methods = Object.values(resource.methods).map((method) => (_jsx(SidebarMethod, { method: method }, method.stainlessPath)));
21
- const hasChildren = subresources.length > 0 || methods.length > 0;
22
- const title = (_jsx("div", { className: style.SidebarResourceTitle, children: _jsx(Docs.Link, { stainlessPath: resource.stainlessPath, children: resource.title }) }));
23
- return (_jsx("div", { className: style.SidebarResource, "data-selected": resource.stainlessPath === selectedPath, children: hasChildren ? (_jsxs(SidebarExpander, { summary: title, open: true, children: [methods, subresources] })) : (title) }));
24
- }
25
- export function Sidebar({ resources }) {
26
- return (_jsx("div", { className: `${style.Root} ${style.Sidebar}`, children: resources
27
- .filter((resource) => !isResourceEmpty(resource))
28
- .map((resource) => (_jsx(SidebarResource, { resource: resource }, resource.stainlessPath))) }));
29
- }
30
- //# sourceMappingURL=sidebar.js.map
1
+ import "../component-generics-DzI21jRn.js";
2
+ import "../docs-Dh8kE1va.js";
3
+ import "../navigation-aoYZ_tl4.js";
4
+ import "../markdown-BXfX1D7C.js";
5
+ import "../routing-DQjbRxdJ.js";
6
+ import "../style-rYbbxIR_.js";
7
+ import "../use-components-D9E85p5x.js";
8
+ import { at as SidebarResource, it as SidebarMethod, nt as Sidebar, rt as SidebarExpander } from "../contexts-DRxRO-xO.js";
9
+ import "../icons-DdKM-01E.js";
10
+ import "../utils-CJfFBNgT.js";
11
+ import "../dropdown-DtgAi6lb.js";
12
+ import "../md-Dg8aOyMA.js";
13
+ import "../utils-BHwvUDKn.js";
14
+ import "../types-DFN4M1Sp.js";
15
+
16
+ export { Sidebar, SidebarExpander, SidebarMethod, SidebarResource };
@@ -1,28 +1,4 @@
1
- import * as React from 'react';
2
- import type { SDKJSON } from '../types/sdkjson';
3
- import type { TransformRequestSnippetFn } from './sdk';
4
- export type SnippetCodeProps = {
5
- content: string;
6
- signature?: string;
7
- language?: string;
8
- };
9
- export declare function SnippetCode({ content, language }: SnippetCodeProps): import("react/jsx-runtime").JSX.Element;
10
- export type SnippetProps = {
11
- method: SDKJSON.Method;
12
- requestTitle?: React.ReactNode;
13
- transformRequestSnippet?: TransformRequestSnippetFn;
14
- };
15
- export type SnippetContainerProps = {
16
- children: React.ReactNode;
17
- signature?: string;
18
- };
19
- export declare function SnippetContainer({ children }: SnippetContainerProps): import("react/jsx-runtime").JSX.Element;
20
- export type SnippetRequestContainerProps = {
21
- children?: React.ReactNode;
22
- signature?: string;
23
- };
24
- export declare function SnippetRequestContainer({ children }: SnippetRequestContainerProps): import("react/jsx-runtime").JSX.Element;
25
- export declare function Snippet({ requestTitle, method, transformRequestSnippet }: SnippetProps): import("react/jsx-runtime").JSX.Element;
26
- export declare function SnippetResponse({ responses }: {
27
- responses: SDKJSON.Method['exampleResponses'];
28
- }): import("react/jsx-runtime").JSX.Element | null;
1
+ import "../routing-qc0V00-j.js";
2
+ import "../sdk-Zg3Rggk3.js";
3
+ import { a as SnippetContainerProps, c as SnippetRequestContainerProps, i as SnippetContainer, l as SnippetResponse, n as SnippetCode, o as SnippetProps, r as SnippetCodeProps, s as SnippetRequestContainer, t as Snippet } from "../snippets-EUzM4fRO.js";
4
+ export { Snippet, SnippetCode, SnippetCodeProps, SnippetContainer, SnippetContainerProps, SnippetProps, SnippetRequestContainer, SnippetRequestContainerProps, SnippetResponse };