@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.81

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 (155) hide show
  1. package/dist/chunk-BYypO7fO.js +18 -0
  2. package/dist/components/MaskedInput.d.ts +14 -0
  3. package/dist/components/MaskedInput.js +76 -0
  4. package/dist/components/breadcrumbs.d.ts +25 -0
  5. package/dist/components/breadcrumbs.js +64 -0
  6. package/dist/components/icons.d.ts +65 -0
  7. package/dist/components/icons.js +941 -0
  8. package/dist/components/index.d.ts +16 -0
  9. package/dist/components/index.js +75 -0
  10. package/dist/components/method.d.ts +59 -0
  11. package/dist/components/method.js +97 -0
  12. package/dist/components/overview.d.ts +39 -0
  13. package/dist/components/overview.js +139 -0
  14. package/dist/components/primitives.d.ts +107 -0
  15. package/dist/components/primitives.js +253 -0
  16. package/dist/components/properties.d.ts +54 -0
  17. package/dist/components/properties.js +146 -0
  18. package/dist/components/sdk-sidebar.d.ts +15 -0
  19. package/dist/components/sdk-sidebar.js +52 -0
  20. package/dist/components/sdk.d.ts +128 -0
  21. package/dist/components/sdk.js +490 -0
  22. package/dist/components/snippets.d.ts +71 -0
  23. package/dist/components/snippets.js +184 -0
  24. package/dist/components/stl-sidebar.d.ts +58 -0
  25. package/dist/components/stl-sidebar.js +114 -0
  26. package/dist/contexts/component-generics.d.ts +30 -0
  27. package/dist/contexts/component-generics.js +33 -0
  28. package/dist/contexts/component-types.d.ts +8 -0
  29. package/dist/contexts/component-types.js +0 -0
  30. package/dist/contexts/component.d.ts +21 -0
  31. package/dist/contexts/component.js +24 -0
  32. package/dist/contexts/docs.d.ts +62 -0
  33. package/dist/contexts/docs.js +91 -0
  34. package/dist/contexts/index.d.ts +13 -0
  35. package/dist/contexts/index.js +45 -0
  36. package/dist/contexts/markdown.d.ts +22 -0
  37. package/dist/contexts/markdown.js +49 -0
  38. package/dist/contexts/navigation.d.ts +29 -0
  39. package/dist/contexts/navigation.js +24 -0
  40. package/dist/contexts/use-components.d.ts +6 -0
  41. package/dist/contexts/use-components.js +8 -0
  42. package/dist/index-pvh-w1xa.d.ts +1776 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +9 -7542
  45. package/dist/languages/cli.d.ts +38 -0
  46. package/dist/languages/cli.js +167 -0
  47. package/dist/languages/csharp.d.ts +42 -0
  48. package/dist/languages/csharp.js +284 -0
  49. package/dist/languages/go.d.ts +40 -0
  50. package/dist/languages/go.js +304 -0
  51. package/dist/languages/http.d.ts +46 -0
  52. package/dist/languages/http.js +387 -0
  53. package/dist/languages/index.d.ts +51 -0
  54. package/dist/languages/index.js +33 -0
  55. package/dist/languages/java.d.ts +43 -0
  56. package/dist/languages/java.js +404 -0
  57. package/dist/languages/php.d.ts +40 -0
  58. package/dist/languages/php.js +313 -0
  59. package/dist/languages/python.d.ts +40 -0
  60. package/dist/languages/python.js +270 -0
  61. package/dist/languages/ruby.d.ts +40 -0
  62. package/dist/languages/ruby.js +388 -0
  63. package/dist/languages/terraform.d.ts +48 -0
  64. package/dist/languages/terraform.js +244 -0
  65. package/dist/languages/typescript.d.ts +40 -0
  66. package/dist/languages/typescript.js +450 -0
  67. package/dist/markdown/index.d.ts +11 -0
  68. package/dist/markdown/index.js +80 -0
  69. package/dist/markdown/md.d.ts +15 -0
  70. package/dist/markdown/md.js +41 -0
  71. package/dist/markdown/printer.d.ts +13 -0
  72. package/dist/markdown/printer.js +76 -0
  73. package/dist/markdown/utils.d.ts +21 -0
  74. package/dist/markdown/utils.js +31 -0
  75. package/dist/routing.d.ts +61 -0
  76. package/dist/routing.js +176 -150
  77. package/dist/spec.d.ts +65 -0
  78. package/dist/spec.js +167 -0
  79. package/dist/style.d.ts +178 -0
  80. package/dist/style.js +179 -0
  81. package/dist/styles/main.css +784 -752
  82. package/dist/styles/main.js +0 -0
  83. package/dist/styles/primitives.css +408 -446
  84. package/dist/styles/primitives.js +0 -0
  85. package/dist/styles/resets.css +32 -41
  86. package/dist/styles/resets.js +0 -0
  87. package/dist/styles/search.css +192 -270
  88. package/dist/styles/search.js +0 -0
  89. package/dist/styles/sidebar.css +182 -69
  90. package/dist/styles/sidebar.js +0 -0
  91. package/dist/styles/variables.css +28 -89
  92. package/dist/styles/variables.js +0 -0
  93. package/dist/styles.css +3423 -0
  94. package/dist/styles.mjs +1 -0
  95. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  96. package/dist/utils.d.ts +20 -0
  97. package/dist/utils.js +54 -0
  98. package/package.json +74 -22
  99. package/dist/mcp.js +0 -16003
  100. package/dist/styles/snippets.css +0 -132
  101. package/src/components/breadcrumbs.tsx +0 -94
  102. package/src/components/chat.tsx +0 -154
  103. package/src/components/dropdown.tsx +0 -91
  104. package/src/components/icons.tsx +0 -584
  105. package/src/components/index.ts +0 -9
  106. package/src/components/method.tsx +0 -146
  107. package/src/components/overview.tsx +0 -160
  108. package/src/components/primitives.tsx +0 -284
  109. package/src/components/properties.tsx +0 -130
  110. package/src/components/scripts/dropdown.ts +0 -78
  111. package/src/components/sdk.tsx +0 -403
  112. package/src/components/sidebar.tsx +0 -99
  113. package/src/components/snippets.tsx +0 -180
  114. package/src/contexts/component-generics.tsx +0 -48
  115. package/src/contexts/component-types.tsx +0 -5
  116. package/src/contexts/component.tsx +0 -32
  117. package/src/contexts/docs.tsx +0 -75
  118. package/src/contexts/index.tsx +0 -17
  119. package/src/contexts/markdown.tsx +0 -43
  120. package/src/contexts/navigation.tsx +0 -44
  121. package/src/contexts/search.tsx +0 -28
  122. package/src/contexts/use-components.tsx +0 -4
  123. package/src/index.ts +0 -6
  124. package/src/languages/go.tsx +0 -281
  125. package/src/languages/http.tsx +0 -321
  126. package/src/languages/index.ts +0 -26
  127. package/src/languages/java.tsx +0 -358
  128. package/src/languages/python.tsx +0 -255
  129. package/src/languages/ruby.tsx +0 -320
  130. package/src/languages/typescript.tsx +0 -393
  131. package/src/markdown/index.ts +0 -107
  132. package/src/markdown/md.ts +0 -45
  133. package/src/markdown/utils.ts +0 -49
  134. package/src/routing.ts +0 -238
  135. package/src/search/form.tsx +0 -127
  136. package/src/search/index.tsx +0 -1
  137. package/src/search/indexer.ts +0 -246
  138. package/src/search/mcp.ts +0 -61
  139. package/src/search/printer.tsx +0 -86
  140. package/src/search/providers/algolia.ts +0 -88
  141. package/src/search/providers/fuse.ts +0 -19
  142. package/src/search/providers/pagefind.ts +0 -17
  143. package/src/search/providers/walker.ts +0 -30
  144. package/src/search/results.tsx +0 -182
  145. package/src/search/state.ts +0 -64
  146. package/src/search/types.ts +0 -116
  147. package/src/style.ts +0 -196
  148. package/src/styles/main.css +0 -986
  149. package/src/styles/primitives.css +0 -580
  150. package/src/styles/resets.css +0 -39
  151. package/src/styles/search.css +0 -341
  152. package/src/styles/sidebar.css +0 -85
  153. package/src/styles/snippets.css +0 -130
  154. package/src/styles/variables.css +0 -86
  155. package/src/utils.ts +0 -41
@@ -0,0 +1,253 @@
1
+ import { useLanguage, useSettings } from "../contexts/docs.js";
2
+ import "../use-strict-context-L0c8JKg4.js";
3
+ import { useNavigation } from "../contexts/navigation.js";
4
+ import { useRenderMarkdown } from "../contexts/markdown.js";
5
+ import "../contexts/index.js";
6
+ import style_default from "../style.js";
7
+ import { generateRoute } from "../routing.js";
8
+ import { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import clsx from "clsx";
11
+ import { MinusIcon, PlusIcon } from "lucide-react";
12
+
13
+ //#region src/components/primitives.tsx
14
+ function Join({ items, limit, children }) {
15
+ return (limit && items.length > limit + 1 ? [...items.slice(0, limit), /* @__PURE__ */ jsxs("span", {
16
+ className: style_default.Truncation,
17
+ children: [items.length - limit, " more"]
18
+ }, "truncation")] : items).map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [!!index && children, item] }, `iterator:${index}`));
19
+ }
20
+ function Expander({ id, open, summary, virtual, muted, children }) {
21
+ const virtualExpanders = useSettings()?.virtualExpanders;
22
+ if (virtual || virtualExpanders) return /* @__PURE__ */ jsx(VirtualExpander, {
23
+ summary,
24
+ open,
25
+ muted,
26
+ id,
27
+ children
28
+ }, open ? "open" : "closed");
29
+ return /* @__PURE__ */ jsxs("details", {
30
+ className: style_default.Expander,
31
+ open,
32
+ "data-stldocs-expander-muted": muted,
33
+ "data-stldocs-expander-initial-state": open,
34
+ children: [/* @__PURE__ */ jsxs("summary", {
35
+ className: style_default.ExpanderSummary,
36
+ children: [/* @__PURE__ */ jsxs("div", {
37
+ className: style_default.ExpanderSummaryIcon,
38
+ children: [/* @__PURE__ */ jsx(PlusIcon, {
39
+ size: 16,
40
+ strokeWidth: 1,
41
+ className: style_default.Icon
42
+ }), /* @__PURE__ */ jsx(MinusIcon, {
43
+ size: 16,
44
+ strokeWidth: 1,
45
+ className: style_default.Icon
46
+ })]
47
+ }), /* @__PURE__ */ jsx("div", {
48
+ className: style_default.ExpanderSummaryContent,
49
+ children: summary
50
+ })]
51
+ }), /* @__PURE__ */ jsx("div", {
52
+ className: style_default.ExpanderContent,
53
+ id,
54
+ children
55
+ })]
56
+ });
57
+ }
58
+ function VirtualExpander({ id, open: isOpen, muted, summary, children }) {
59
+ const [open, setOpen] = useState(isOpen ?? false);
60
+ return /* @__PURE__ */ jsxs("div", {
61
+ className: style_default.Expander,
62
+ "data-open": open,
63
+ "data-stldocs-expander-muted": muted,
64
+ "data-stldocs-expander-initial-state": open,
65
+ children: [/* @__PURE__ */ jsxs("div", {
66
+ className: style_default.ExpanderSummary,
67
+ onClick: () => setOpen(!open),
68
+ children: [/* @__PURE__ */ jsxs("div", {
69
+ className: style_default.ExpanderSummaryIcon,
70
+ children: [/* @__PURE__ */ jsx(PlusIcon, {
71
+ size: 16,
72
+ className: style_default.Icon
73
+ }), /* @__PURE__ */ jsx(MinusIcon, {
74
+ size: 16,
75
+ className: style_default.Icon
76
+ })]
77
+ }), /* @__PURE__ */ jsx("div", {
78
+ className: style_default.ExpanderSummaryContent,
79
+ children: summary
80
+ })]
81
+ }), open && /* @__PURE__ */ jsx("div", {
82
+ className: style_default.ExpanderContent,
83
+ id,
84
+ children
85
+ })]
86
+ });
87
+ }
88
+ function Markdown({ content, style: cssStyle }) {
89
+ const rendered = useRenderMarkdown(content);
90
+ return rendered && /* @__PURE__ */ jsx("div", {
91
+ style: cssStyle,
92
+ className: clsx(style_default.Markdown, style_default.Content, "stl-ui-prose"),
93
+ dangerouslySetInnerHTML: { __html: rendered }
94
+ });
95
+ }
96
+ function Badge({ id, children }) {
97
+ return /* @__PURE__ */ jsx("span", {
98
+ className: style_default.Badge,
99
+ "data-badge-id": id,
100
+ children: children ?? id
101
+ });
102
+ }
103
+ const TooltipNestingContext = createContext(false);
104
+ function Tooltip({ content, children }) {
105
+ if (useContext(TooltipNestingContext)) return children;
106
+ return /* @__PURE__ */ jsxs("span", {
107
+ className: style_default.Tooltip,
108
+ children: [/* @__PURE__ */ jsx("span", {
109
+ className: style_default.TooltipContent,
110
+ children: /* @__PURE__ */ jsx(TooltipNestingContext.Provider, {
111
+ value: true,
112
+ children: content
113
+ })
114
+ }), /* @__PURE__ */ jsx("span", {
115
+ className: style_default.TooltipHost,
116
+ children
117
+ })]
118
+ });
119
+ }
120
+ function Link({ stainlessPath, scroll = true, children, ...props }) {
121
+ const { basePath, onNavigate } = useNavigation();
122
+ const language = useLanguage();
123
+ const href = useMemo(() => {
124
+ if (props.href) return props.href;
125
+ if (stainlessPath && basePath) return generateRoute(basePath, language, stainlessPath);
126
+ }, [
127
+ basePath,
128
+ language,
129
+ stainlessPath,
130
+ props.href
131
+ ]);
132
+ const handleClick = useCallback((e) => {
133
+ if (props.onClick) props.onClick(e);
134
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
135
+ if (href && stainlessPath) onNavigate?.(e, {
136
+ href,
137
+ language,
138
+ stainlessPath,
139
+ scroll
140
+ });
141
+ }, [
142
+ href,
143
+ scroll,
144
+ onNavigate,
145
+ language,
146
+ props,
147
+ stainlessPath
148
+ ]);
149
+ if (!href) return children;
150
+ return /* @__PURE__ */ jsx("a", {
151
+ href,
152
+ onClick: handleClick,
153
+ ...props,
154
+ children
155
+ });
156
+ }
157
+ function Input({ left, right, ref, className, ...props }) {
158
+ return /* @__PURE__ */ jsxs("div", {
159
+ className: clsx(style_default.Input, props.disabled && style_default.InputDisabled, className),
160
+ children: [
161
+ left,
162
+ /* @__PURE__ */ jsx("input", {
163
+ ...props,
164
+ ref,
165
+ className: style_default.InputTextField
166
+ }),
167
+ right
168
+ ]
169
+ });
170
+ }
171
+ function ToggleButton({ children, selected, ref, ...props }) {
172
+ return /* @__PURE__ */ jsx("button", {
173
+ ...props,
174
+ ref,
175
+ className: style_default.ToggleButton,
176
+ "data-stldocs-toggle-selected": selected,
177
+ children
178
+ });
179
+ }
180
+ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
181
+ const [selectedIndex, setSelectedIndex] = useState(0);
182
+ const [keyboardIndex, setKeyboardIndex] = useState(0);
183
+ const listRef = useRef(null);
184
+ const itemRef = useRef(null);
185
+ const handleSelect = useCallback(() => {
186
+ const item = items[selectedIndex];
187
+ if (item) onSelectListItem?.(item);
188
+ }, [
189
+ items,
190
+ selectedIndex,
191
+ onSelectListItem
192
+ ]);
193
+ useEffect(() => {
194
+ const ac = new AbortController();
195
+ document.addEventListener("keydown", (ev) => {
196
+ switch (ev.key) {
197
+ case "ArrowUp": {
198
+ ev.preventDefault();
199
+ const value = Math.max(0, selectedIndex - 1);
200
+ setSelectedIndex(value);
201
+ setKeyboardIndex(value);
202
+ break;
203
+ }
204
+ case "ArrowDown": {
205
+ ev.preventDefault();
206
+ const value = Math.min(items.length, selectedIndex + 1);
207
+ setSelectedIndex(value);
208
+ setKeyboardIndex(value);
209
+ break;
210
+ }
211
+ case "Enter":
212
+ ev.preventDefault();
213
+ handleSelect();
214
+ break;
215
+ }
216
+ }, { signal: ac.signal });
217
+ return () => ac.abort();
218
+ }, [
219
+ items,
220
+ selectedIndex,
221
+ handleSelect
222
+ ]);
223
+ useEffect(() => {
224
+ if (!keyboardIndex || !itemRef.current || !listRef.current) {
225
+ listRef?.current?.scroll(0, 0);
226
+ return;
227
+ }
228
+ const selectedBounds = itemRef.current.getBoundingClientRect();
229
+ const listBounds = listRef.current.getBoundingClientRect();
230
+ if (selectedBounds.top < listBounds.top || selectedBounds.bottom > listBounds.bottom) itemRef.current.scrollIntoView({ block: "nearest" });
231
+ }, [
232
+ keyboardIndex,
233
+ items,
234
+ listRef
235
+ ]);
236
+ return /* @__PURE__ */ jsx("div", {
237
+ ref: listRef,
238
+ className: style_default.ListView,
239
+ tabIndex: 0,
240
+ ...rest,
241
+ children: items.map((item, index) => /* @__PURE__ */ jsx("div", {
242
+ ref: index === selectedIndex ? itemRef : null,
243
+ className: style_default.ListViewItem,
244
+ "data-stldocs-listview-selected": index === selectedIndex,
245
+ onClick: handleSelect,
246
+ onMouseEnter: () => setSelectedIndex(index),
247
+ children: itemDelegate(item, index === selectedIndex)
248
+ }, index))
249
+ });
250
+ }
251
+
252
+ //#endregion
253
+ export { Badge, Expander, Input, Join, Link, ListView, Markdown, ToggleButton, Tooltip, VirtualExpander };
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/components/properties.d.ts
5
+ type PropertyToggleProps = {
6
+ target: string;
7
+ };
8
+ declare function PropertyToggle({
9
+ target
10
+ }: PropertyToggleProps): react_jsx_runtime0.JSX.Element;
11
+ type PropertyDescriptionProps = {
12
+ description?: string;
13
+ };
14
+ declare function PropertyDescription({
15
+ description
16
+ }: PropertyDescriptionProps): react_jsx_runtime0.JSX.Element | undefined;
17
+ type PropertyTitleProps = {
18
+ title?: string;
19
+ };
20
+ declare function PropertyTitle({
21
+ title
22
+ }: PropertyTitleProps): react_jsx_runtime0.JSX.Element | undefined;
23
+ type PropertyProps = {
24
+ id?: string;
25
+ name?: ReactNode;
26
+ typeName?: ReactNode;
27
+ badges?: ReactNode;
28
+ type?: ReactNode;
29
+ description?: string;
30
+ title?: string;
31
+ expand?: boolean;
32
+ deprecated?: boolean | string;
33
+ additional?: ReactNode;
34
+ declaration?: ReactNode;
35
+ constraints?: ReactNode;
36
+ children?: ReactNode;
37
+ };
38
+ declare function Property({
39
+ id,
40
+ name,
41
+ typeName,
42
+ badges,
43
+ type,
44
+ declaration,
45
+ description,
46
+ title,
47
+ deprecated,
48
+ expand,
49
+ additional,
50
+ constraints,
51
+ children
52
+ }: PropertyProps): react_jsx_runtime0.JSX.Element | null;
53
+ //#endregion
54
+ export { Property, PropertyDescription, PropertyDescriptionProps, PropertyProps, PropertyTitle, PropertyTitleProps, PropertyToggle, PropertyToggleProps };
@@ -0,0 +1,146 @@
1
+ import { useIgnoredResources, useLanguage, useSettings } from "../contexts/docs.js";
2
+ import "../use-strict-context-L0c8JKg4.js";
3
+ import "../contexts/index.js";
4
+ import { useComponents } from "../contexts/use-components.js";
5
+ import style_default from "../style.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { ArrowDownWideNarrowIcon, ArrowUpNarrowWideIcon, LinkIcon } from "lucide-react";
8
+ import { Button } from "@stainless-api/ui-primitives";
9
+
10
+ //#region src/components/properties.tsx
11
+ function PropertyToggle({ target }) {
12
+ return /* @__PURE__ */ jsxs("span", {
13
+ className: style_default.ExpandToggle,
14
+ "data-stldocs-property-toggle-expanded": "false",
15
+ "data-stldocs-property-toggle-target": target,
16
+ children: [/* @__PURE__ */ jsxs("span", {
17
+ className: style_default.ExpandToggleContent,
18
+ children: ["Expand ", /* @__PURE__ */ jsx(ArrowDownWideNarrowIcon, {
19
+ className: style_default.Icon,
20
+ size: 16
21
+ })]
22
+ }), /* @__PURE__ */ jsxs("span", {
23
+ className: style_default.ExpandToggleContent,
24
+ children: ["Collapse ", /* @__PURE__ */ jsx(ArrowUpNarrowWideIcon, {
25
+ className: style_default.Icon,
26
+ size: 16
27
+ })]
28
+ })]
29
+ });
30
+ }
31
+ function PropertyDescription({ description }) {
32
+ const { Markdown } = useComponents();
33
+ if (description) return /* @__PURE__ */ jsx("div", {
34
+ className: style_default.PropertyDescription,
35
+ children: /* @__PURE__ */ jsx(Markdown, { content: description })
36
+ });
37
+ }
38
+ function PropertyTitle({ title }) {
39
+ const { Markdown } = useComponents();
40
+ if (title) return /* @__PURE__ */ jsx("div", {
41
+ className: style_default.PropertyTitle,
42
+ children: /* @__PURE__ */ jsx(Markdown, { content: title })
43
+ });
44
+ }
45
+ function splitDescription(description) {
46
+ const pos = description?.indexOf("\n\n");
47
+ if (!description || !pos || pos < 0) return [description, null];
48
+ return [description.slice(0, pos), description.slice(pos)];
49
+ }
50
+ function Property({ id, name, typeName, badges, type, declaration, description, title, deprecated, expand, additional, constraints, children }) {
51
+ const Docs = useComponents();
52
+ const language = useLanguage();
53
+ const { collapseDescription, showTitle, types } = useSettings()?.properties ?? {};
54
+ if (useIgnoredResources().includes(id || "")) return null;
55
+ const [descFirstLine, descRest] = collapseDescription === "show-first-line" ? splitDescription(description) : [null, description];
56
+ const textContent = /* @__PURE__ */ jsxs(Fragment, { children: [
57
+ typeof deprecated === "string" && /* @__PURE__ */ jsx("div", {
58
+ className: style_default.PropertyDeprecatedMessage,
59
+ children: deprecated
60
+ }),
61
+ descRest && /* @__PURE__ */ jsx(Docs.PropertyDescription, { description: descRest }),
62
+ constraints && /* @__PURE__ */ jsx("div", {
63
+ className: style_default.PropertyContent,
64
+ children: constraints
65
+ })
66
+ ] });
67
+ const rich = /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsxs("div", {
69
+ className: style_default.PropertyDeclaration,
70
+ children: [
71
+ deprecated && /* @__PURE__ */ jsx("span", {
72
+ className: style_default.PropertyDeprecated,
73
+ children: "Deprecated"
74
+ }),
75
+ declaration,
76
+ badges && /* @__PURE__ */ jsx("span", {
77
+ className: style_default.PropertyBadges,
78
+ children: badges
79
+ })
80
+ ]
81
+ }),
82
+ title && showTitle && /* @__PURE__ */ jsx(Docs.PropertyTitle, { title }),
83
+ collapseDescription === false ? textContent : descFirstLine && /* @__PURE__ */ jsx(Docs.PropertyDescription, { description: descFirstLine })
84
+ ] });
85
+ const simple = /* @__PURE__ */ jsxs(Fragment, { children: [
86
+ name && /* @__PURE__ */ jsxs("div", {
87
+ className: style_default.PropertyHeader,
88
+ children: [
89
+ deprecated && /* @__PURE__ */ jsx("span", {
90
+ className: style_default.PropertyDeprecated,
91
+ children: "Deprecated"
92
+ }),
93
+ name && /* @__PURE__ */ jsx("span", {
94
+ className: style_default.PropertyName,
95
+ children: name
96
+ }),
97
+ typeName && /* @__PURE__ */ jsx("span", {
98
+ className: style_default.PropertyTypeName,
99
+ children: typeName
100
+ }),
101
+ badges && /* @__PURE__ */ jsx("span", {
102
+ className: style_default.PropertyBadges,
103
+ children: badges
104
+ })
105
+ ]
106
+ }),
107
+ type && /* @__PURE__ */ jsx("div", {
108
+ className: style_default.PropertyType,
109
+ children: type
110
+ }),
111
+ title && showTitle && /* @__PURE__ */ jsx(Docs.PropertyTitle, { title }),
112
+ collapseDescription === false ? textContent : null
113
+ ] });
114
+ const content = /* @__PURE__ */ jsx("div", {
115
+ id,
116
+ className: style_default.PropertyInfo,
117
+ children: types === "simple" ? simple : rich
118
+ });
119
+ return /* @__PURE__ */ jsxs("div", {
120
+ className: style_default.Property,
121
+ "data-stldocs-language": language,
122
+ children: [children || collapseDescription !== false && descRest ? /* @__PURE__ */ jsxs(Docs.Expander, {
123
+ summary: content,
124
+ muted: !children,
125
+ open: expand,
126
+ children: [
127
+ collapseDescription !== false ? textContent : null,
128
+ additional,
129
+ children && /* @__PURE__ */ jsx("div", {
130
+ className: style_default.PropertyChildren,
131
+ children
132
+ })
133
+ ]
134
+ }) : content, id && /* @__PURE__ */ jsx(Button, {
135
+ className: style_default.DeepLinkButton,
136
+ variant: "outline",
137
+ size: "sm",
138
+ href: `#${encodeURIComponent(id)}`,
139
+ "aria-label": "Link to this property",
140
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: LinkIcon })
141
+ })]
142
+ });
143
+ }
144
+
145
+ //#endregion
146
+ export { Property, PropertyDescription, PropertyTitle, PropertyToggle };
@@ -0,0 +1,15 @@
1
+ import { h as Resource } from "../index-pvh-w1xa.js";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/components/sdk-sidebar.d.ts
5
+ type SDKSidebarProps = {
6
+ resources: Resource[];
7
+ };
8
+ /**
9
+ * Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
10
+ */
11
+ declare function SDKSidebar({
12
+ resources
13
+ }: SDKSidebarProps): react_jsx_runtime0.JSX.Element;
14
+ //#endregion
15
+ export { SDKSidebar, SDKSidebarProps };
@@ -0,0 +1,52 @@
1
+ import "../use-strict-context-L0c8JKg4.js";
2
+ import { useNavigation } from "../contexts/navigation.js";
3
+ import "../contexts/index.js";
4
+ import { isResourceEmpty } from "../utils.js";
5
+ import { StlSidebar } from "./stl-sidebar.js";
6
+ import * as React$1 from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { Badge, getHttpMethod } from "@stainless-api/ui-primitives";
9
+
10
+ //#region src/components/sdk-sidebar.tsx
11
+ function resourceToEntry(resource, selectedPath) {
12
+ const result = {
13
+ type: "group",
14
+ collapsed: false,
15
+ label: resource.title,
16
+ entries: [],
17
+ target: {
18
+ type: "stainlessPath",
19
+ stainlessPath: resource.stainlessPath
20
+ },
21
+ isCurrent: selectedPath === resource.stainlessPath
22
+ };
23
+ for (const method of Object.values(resource.methods)) {
24
+ const httpMethod = getHttpMethod(method.httpMethod);
25
+ result.entries.push({
26
+ type: "link",
27
+ target: {
28
+ type: "stainlessPath",
29
+ stainlessPath: method.stainlessPath
30
+ },
31
+ label: method.title,
32
+ isCurrent: selectedPath === method.stainlessPath,
33
+ icon: httpMethod ? /* @__PURE__ */ jsx(Badge.HTTP, {
34
+ method: httpMethod,
35
+ iconOnly: true,
36
+ size: "sm"
37
+ }) : void 0
38
+ });
39
+ }
40
+ for (const subresource of Object.values(resource.subresources ?? {})) result.entries.push(resourceToEntry(subresource, selectedPath));
41
+ return result;
42
+ }
43
+ /**
44
+ * Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
45
+ */
46
+ function SDKSidebar({ resources }) {
47
+ const { selectedPath } = useNavigation();
48
+ return /* @__PURE__ */ jsx(StlSidebar, { entries: React$1.useMemo(() => resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => resourceToEntry(resource, selectedPath)), [resources, selectedPath]) });
49
+ }
50
+
51
+ //#endregion
52
+ export { SDKSidebar };
@@ -0,0 +1,128 @@
1
+ import { _ as SnippetLanguage, c as ID, d as Method, f as Model, o as HasStainlessPath, t as BaseDeclaration } from "../index-pvh-w1xa.js";
2
+ import { DocsLanguage } from "../routing.js";
3
+ import * as React$1 from "react";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+
6
+ //#region src/components/sdk.d.ts
7
+ type PropertyModelContextType = {
8
+ modelPath?: string;
9
+ propertyPath?: string;
10
+ };
11
+ declare const PropertyModelContext: React$1.Context<PropertyModelContextType>;
12
+ declare function usePropertyModel(): PropertyModelContextType;
13
+ type ReferenceNestingContextType = string[];
14
+ declare const ReferenceNestingContext: React$1.Context<ReferenceNestingContextType>;
15
+ declare function useReferenceNesting(): ReferenceNestingContextType;
16
+ type DeclarationParentsContextType = ReadonlySet<string>;
17
+ declare function useDeclarationParents(): DeclarationParentsContextType;
18
+ type SDKSnippetLanguagesType = Record<SnippetLanguage, {
19
+ name: string;
20
+ }>;
21
+ declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
22
+ type TransformRequestSnippetFn = ({
23
+ snippet,
24
+ language
25
+ }: {
26
+ snippet: string;
27
+ language: DocsLanguage;
28
+ }) => string;
29
+ type SDKChildrenProps = {
30
+ paths: ID[];
31
+ expand?: boolean;
32
+ depth?: number;
33
+ };
34
+ declare function SDKChildren({
35
+ paths,
36
+ expand,
37
+ depth
38
+ }: SDKChildrenProps): react_jsx_runtime0.JSX.Element;
39
+ type SDKDeclarationProps = {
40
+ path: string;
41
+ expand?: boolean;
42
+ depth?: number;
43
+ };
44
+ declare function SDKDeclaration({
45
+ path,
46
+ expand,
47
+ depth
48
+ }: SDKDeclarationProps): react_jsx_runtime0.JSX.Element;
49
+ type SDKConstraintsProps = {
50
+ constraints?: Record<string, unknown>;
51
+ };
52
+ declare function SDKConstraints({
53
+ constraints
54
+ }: SDKConstraintsProps): react_jsx_runtime0.JSX.Element | undefined;
55
+ type SDKIconProps = {
56
+ language: SnippetLanguage;
57
+ size?: number;
58
+ };
59
+ declare function SDKIcon({
60
+ language
61
+ }: SDKIconProps): react_jsx_runtime0.JSX.Element | null;
62
+ type SDKRequestTitleProps = {
63
+ snippetLanguage: SnippetLanguage;
64
+ };
65
+ declare function SDKRequestTitle({
66
+ snippetLanguage
67
+ }: SDKRequestTitleProps): react_jsx_runtime0.JSX.Element;
68
+ type SDKExampleProps = {
69
+ method: Partial<Method> & HasStainlessPath;
70
+ transformRequestSnippet?: TransformRequestSnippetFn;
71
+ };
72
+ declare function SDKExample({
73
+ method,
74
+ transformRequestSnippet
75
+ }: SDKExampleProps): react_jsx_runtime0.JSX.Element;
76
+ type SDKMethodProps = {
77
+ method: Method;
78
+ transformRequestSnippet?: TransformRequestSnippetFn;
79
+ };
80
+ declare function SDKMethodHeader({
81
+ method
82
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
83
+ declare function useStreamingResponse(method: BaseDeclaration): ID | undefined;
84
+ declare function SDKMethodInfo({
85
+ method,
86
+ children
87
+ }: SDKMethodProps & {
88
+ children?: React$1.ReactNode;
89
+ }): react_jsx_runtime0.JSX.Element;
90
+ declare function SDKMethodNotImplemented({
91
+ method
92
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
93
+ declare function SDKMethodInfoContent(_props: SDKMethodProps): React$1.ReactNode;
94
+ declare function SDKMethod({
95
+ method,
96
+ transformRequestSnippet
97
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
98
+ type SDKModelProps = {
99
+ model: Model;
100
+ };
101
+ declare function SDKModel({
102
+ model
103
+ }: SDKModelProps): react_jsx_runtime0.JSX.Element | null;
104
+ type SDKReferenceProps = {
105
+ stainlessPath: string;
106
+ children?: React$1.ReactNode;
107
+ };
108
+ declare function SDKReference({
109
+ stainlessPath,
110
+ children
111
+ }: SDKReferenceProps): string | number | bigint | boolean | react_jsx_runtime0.JSX.Element | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | null | undefined;
112
+ type SDKLanguageBlockProps = {
113
+ language: DocsLanguage;
114
+ version: string;
115
+ install: string;
116
+ links: {
117
+ repo: string;
118
+ docs: string;
119
+ };
120
+ };
121
+ declare function SDKLanguageBlock({
122
+ language,
123
+ version,
124
+ install,
125
+ links
126
+ }: SDKLanguageBlockProps): react_jsx_runtime0.JSX.Element;
127
+ //#endregion
128
+ export { DeclarationParentsContextType, PropertyModelContext, PropertyModelContextType, ReferenceNestingContext, ReferenceNestingContextType, SDKChildren, SDKConstraints, SDKConstraintsProps, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKMethodInfoContent, SDKMethodNotImplemented, SDKMethodProps, SDKModel, SDKModelProps, SDKReference, SDKRequestTitle, SDKRequestTitleProps, SDKSnippetLanguages, SDKSnippetLanguagesType, TransformRequestSnippetFn, useDeclarationParents, usePropertyModel, useReferenceNesting, useStreamingResponse };