@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
@@ -1,8 +1,252 @@
1
- import "../docs-YgoQ3bzY.js";
2
- import "../component-generics-POFirVVb.js";
3
- import "../navigation-aoYZ_tl4.js";
4
- import "../markdown-Cq3XEhrR.js";
5
- import "../contexts-_NNW5yqC.js";
6
- import { a as Link, c as ToggleButton, i as Join, l as Tooltip, n as Expander, o as ListView, r as Input, s as Markdown, t as Badge, u as VirtualExpander } from "../primitives-CNG-fEhQ.js";
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";
7
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 }) {
89
+ const rendered = useRenderMarkdown(content);
90
+ return rendered && /* @__PURE__ */ jsx("div", {
91
+ className: clsx(style_default.Markdown, style_default.Content, "stl-ui-prose"),
92
+ dangerouslySetInnerHTML: { __html: rendered }
93
+ });
94
+ }
95
+ function Badge({ id, children }) {
96
+ return /* @__PURE__ */ jsx("span", {
97
+ className: style_default.Badge,
98
+ "data-badge-id": id,
99
+ children: children ?? id
100
+ });
101
+ }
102
+ const TooltipNestingContext = createContext(false);
103
+ function Tooltip({ content, children }) {
104
+ if (useContext(TooltipNestingContext)) return children;
105
+ return /* @__PURE__ */ jsxs("span", {
106
+ className: style_default.Tooltip,
107
+ children: [/* @__PURE__ */ jsx("span", {
108
+ className: style_default.TooltipContent,
109
+ children: /* @__PURE__ */ jsx(TooltipNestingContext.Provider, {
110
+ value: true,
111
+ children: content
112
+ })
113
+ }), /* @__PURE__ */ jsx("span", {
114
+ className: style_default.TooltipHost,
115
+ children
116
+ })]
117
+ });
118
+ }
119
+ function Link({ stainlessPath, scroll = true, children, ...props }) {
120
+ const { basePath, onNavigate } = useNavigation();
121
+ const language = useLanguage();
122
+ const href = useMemo(() => {
123
+ if (props.href) return props.href;
124
+ if (stainlessPath && basePath) return generateRoute(basePath, language, stainlessPath);
125
+ }, [
126
+ basePath,
127
+ language,
128
+ stainlessPath,
129
+ props.href
130
+ ]);
131
+ const handleClick = useCallback((e) => {
132
+ if (props.onClick) props.onClick(e);
133
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
134
+ if (href && stainlessPath) onNavigate?.(e, {
135
+ href,
136
+ language,
137
+ stainlessPath,
138
+ scroll
139
+ });
140
+ }, [
141
+ href,
142
+ scroll,
143
+ onNavigate,
144
+ language,
145
+ props,
146
+ stainlessPath
147
+ ]);
148
+ if (!href) return children;
149
+ return /* @__PURE__ */ jsx("a", {
150
+ href,
151
+ onClick: handleClick,
152
+ ...props,
153
+ children
154
+ });
155
+ }
156
+ function Input({ left, right, ref, className, ...props }) {
157
+ return /* @__PURE__ */ jsxs("div", {
158
+ className: clsx(style_default.Input, props.disabled && style_default.InputDisabled, className),
159
+ children: [
160
+ left,
161
+ /* @__PURE__ */ jsx("input", {
162
+ ...props,
163
+ ref,
164
+ className: style_default.InputTextField
165
+ }),
166
+ right
167
+ ]
168
+ });
169
+ }
170
+ function ToggleButton({ children, selected, ref, ...props }) {
171
+ return /* @__PURE__ */ jsx("button", {
172
+ ...props,
173
+ ref,
174
+ className: style_default.ToggleButton,
175
+ "data-stldocs-toggle-selected": selected,
176
+ children
177
+ });
178
+ }
179
+ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
180
+ const [selectedIndex, setSelectedIndex] = useState(0);
181
+ const [keyboardIndex, setKeyboardIndex] = useState(0);
182
+ const listRef = useRef(null);
183
+ const itemRef = useRef(null);
184
+ const handleSelect = useCallback(() => {
185
+ const item = items[selectedIndex];
186
+ if (item) onSelectListItem?.(item);
187
+ }, [
188
+ items,
189
+ selectedIndex,
190
+ onSelectListItem
191
+ ]);
192
+ useEffect(() => {
193
+ const ac = new AbortController();
194
+ document.addEventListener("keydown", (ev) => {
195
+ switch (ev.key) {
196
+ case "ArrowUp": {
197
+ ev.preventDefault();
198
+ const value = Math.max(0, selectedIndex - 1);
199
+ setSelectedIndex(value);
200
+ setKeyboardIndex(value);
201
+ break;
202
+ }
203
+ case "ArrowDown": {
204
+ ev.preventDefault();
205
+ const value = Math.min(items.length, selectedIndex + 1);
206
+ setSelectedIndex(value);
207
+ setKeyboardIndex(value);
208
+ break;
209
+ }
210
+ case "Enter":
211
+ ev.preventDefault();
212
+ handleSelect();
213
+ break;
214
+ }
215
+ }, { signal: ac.signal });
216
+ return () => ac.abort();
217
+ }, [
218
+ items,
219
+ selectedIndex,
220
+ handleSelect
221
+ ]);
222
+ useEffect(() => {
223
+ if (!keyboardIndex || !itemRef.current || !listRef.current) {
224
+ listRef?.current?.scroll(0, 0);
225
+ return;
226
+ }
227
+ const selectedBounds = itemRef.current.getBoundingClientRect();
228
+ const listBounds = listRef.current.getBoundingClientRect();
229
+ if (selectedBounds.top < listBounds.top || selectedBounds.bottom > listBounds.bottom) itemRef.current.scrollIntoView({ block: "nearest" });
230
+ }, [
231
+ keyboardIndex,
232
+ items,
233
+ listRef
234
+ ]);
235
+ return /* @__PURE__ */ jsx("div", {
236
+ ref: listRef,
237
+ className: style_default.ListView,
238
+ tabIndex: 0,
239
+ ...rest,
240
+ children: items.map((item, index) => /* @__PURE__ */ jsx("div", {
241
+ ref: index === selectedIndex ? itemRef : null,
242
+ className: style_default.ListViewItem,
243
+ "data-stldocs-listview-selected": index === selectedIndex,
244
+ onClick: handleSelect,
245
+ onMouseEnter: () => setSelectedIndex(index),
246
+ children: itemDelegate(item, index === selectedIndex)
247
+ }, index))
248
+ });
249
+ }
250
+
251
+ //#endregion
8
252
  export { Badge, Expander, Input, Join, Link, ListView, Markdown, ToggleButton, Tooltip, VirtualExpander };
@@ -1,2 +1,54 @@
1
- import { a as PropertyTitle, c as PropertyToggleProps, i as PropertyProps, n as PropertyDescription, o as PropertyTitleProps, r as PropertyDescriptionProps, s as PropertyToggle, t as Property } from "../properties-Bu4nW9JD.js";
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
2
54
  export { Property, PropertyDescription, PropertyDescriptionProps, PropertyProps, PropertyTitle, PropertyTitleProps, PropertyToggle, PropertyToggleProps };
@@ -1,9 +1,140 @@
1
- import "../docs-YgoQ3bzY.js";
2
- import "../component-generics-POFirVVb.js";
3
- import "../navigation-aoYZ_tl4.js";
4
- import "../markdown-Cq3XEhrR.js";
5
- import "../contexts-_NNW5yqC.js";
6
- import "../use-components-BUz3GbO4.js";
7
- import { i as PropertyToggle, n as PropertyDescription, r as PropertyTitle, t as Property } from "../properties-DQU0NBzb.js";
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 } from "lucide-react";
8
8
 
9
+ //#region src/components/properties.tsx
10
+ function PropertyToggle({ target }) {
11
+ return /* @__PURE__ */ jsxs("span", {
12
+ className: style_default.ExpandToggle,
13
+ "data-stldocs-property-toggle-expanded": "false",
14
+ "data-stldocs-property-toggle-target": target,
15
+ children: [/* @__PURE__ */ jsxs("span", {
16
+ className: style_default.ExpandToggleContent,
17
+ children: ["Expand ", /* @__PURE__ */ jsx(ArrowDownWideNarrowIcon, {
18
+ className: style_default.Icon,
19
+ size: 16
20
+ })]
21
+ }), /* @__PURE__ */ jsxs("span", {
22
+ className: style_default.ExpandToggleContent,
23
+ children: ["Collapse ", /* @__PURE__ */ jsx(ArrowUpNarrowWideIcon, {
24
+ className: style_default.Icon,
25
+ size: 16
26
+ })]
27
+ })]
28
+ });
29
+ }
30
+ function PropertyDescription({ description }) {
31
+ const { Markdown } = useComponents();
32
+ if (description) return /* @__PURE__ */ jsx("div", {
33
+ className: style_default.PropertyDescription,
34
+ children: /* @__PURE__ */ jsx(Markdown, { content: description })
35
+ });
36
+ }
37
+ function PropertyTitle({ title }) {
38
+ const { Markdown } = useComponents();
39
+ if (title) return /* @__PURE__ */ jsx("div", {
40
+ className: style_default.PropertyTitle,
41
+ children: /* @__PURE__ */ jsx(Markdown, { content: title })
42
+ });
43
+ }
44
+ function splitDescription(description) {
45
+ const pos = description?.indexOf("\n\n");
46
+ if (!description || !pos || pos < 0) return [description, null];
47
+ return [description.slice(0, pos), description.slice(pos)];
48
+ }
49
+ function Property({ id, name, typeName, badges, type, declaration, description, title, deprecated, expand, additional, constraints, children }) {
50
+ const Docs = useComponents();
51
+ const language = useLanguage();
52
+ const properties = useSettings()?.properties;
53
+ if (useIgnoredResources().includes(id || "")) return null;
54
+ const { collapseDescription, showTitle } = properties ?? {};
55
+ const types = properties?.types;
56
+ const [descFirstLine, descRest] = collapseDescription === "show-first-line" ? splitDescription(description) : [null, description];
57
+ const textContent = /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ typeof deprecated === "string" && /* @__PURE__ */ jsx("div", {
59
+ className: style_default.PropertyDeprecatedMessage,
60
+ children: deprecated
61
+ }),
62
+ descRest && /* @__PURE__ */ jsx(Docs.PropertyDescription, { description: descRest }),
63
+ constraints && /* @__PURE__ */ jsx("div", {
64
+ className: style_default.PropertyContent,
65
+ children: constraints
66
+ })
67
+ ] });
68
+ const rich = /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsxs("div", {
70
+ className: style_default.PropertyDeclaration,
71
+ children: [
72
+ deprecated && /* @__PURE__ */ jsx("span", {
73
+ className: style_default.PropertyDeprecated,
74
+ children: "Deprecated"
75
+ }),
76
+ declaration,
77
+ badges && /* @__PURE__ */ jsx("span", {
78
+ className: style_default.PropertyBadges,
79
+ children: badges
80
+ })
81
+ ]
82
+ }),
83
+ title && showTitle && /* @__PURE__ */ jsx(Docs.PropertyTitle, { title }),
84
+ collapseDescription === false ? textContent : descFirstLine && /* @__PURE__ */ jsx(Docs.PropertyDescription, { description: descFirstLine })
85
+ ] });
86
+ const simple = /* @__PURE__ */ jsxs(Fragment, { children: [
87
+ name && /* @__PURE__ */ jsxs("div", {
88
+ className: style_default.PropertyHeader,
89
+ children: [
90
+ deprecated && /* @__PURE__ */ jsx("span", {
91
+ className: style_default.PropertyDeprecated,
92
+ children: "Deprecated"
93
+ }),
94
+ name && /* @__PURE__ */ jsx("span", {
95
+ className: style_default.PropertyName,
96
+ children: name
97
+ }),
98
+ typeName && /* @__PURE__ */ jsx("span", {
99
+ className: style_default.PropertyTypeName,
100
+ children: typeName
101
+ }),
102
+ badges && /* @__PURE__ */ jsx("span", {
103
+ className: style_default.PropertyBadges,
104
+ children: badges
105
+ })
106
+ ]
107
+ }),
108
+ type && /* @__PURE__ */ jsx("div", {
109
+ className: style_default.PropertyType,
110
+ children: type
111
+ }),
112
+ title && showTitle && /* @__PURE__ */ jsx(Docs.PropertyTitle, { title }),
113
+ collapseDescription === false ? textContent : null
114
+ ] });
115
+ const content = /* @__PURE__ */ jsx("div", {
116
+ id,
117
+ className: style_default.PropertyInfo,
118
+ children: types === "simple" ? simple : rich
119
+ });
120
+ return /* @__PURE__ */ jsx("div", {
121
+ className: style_default.Property,
122
+ "data-stldocs-language": language,
123
+ children: children || collapseDescription !== false && descRest ? /* @__PURE__ */ jsxs(Docs.Expander, {
124
+ summary: content,
125
+ muted: !children,
126
+ open: expand,
127
+ children: [
128
+ collapseDescription !== false ? textContent : null,
129
+ additional,
130
+ children && /* @__PURE__ */ jsx("div", {
131
+ className: style_default.PropertyChildren,
132
+ children
133
+ })
134
+ ]
135
+ }) : content
136
+ });
137
+ }
138
+
139
+ //#endregion
9
140
  export { Property, PropertyDescription, PropertyTitle, PropertyToggle };
@@ -1,2 +1,15 @@
1
- import { n as SDKSidebarProps, t as SDKSidebar } from "../sdk-sidebar-Dqeu7C1-.js";
1
+ import { m as Resource } from "../index-PdnFhQF9.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
2
15
  export { SDKSidebar, SDKSidebarProps };
@@ -1,10 +1,52 @@
1
- import "../docs-YgoQ3bzY.js";
2
- import "../component-generics-POFirVVb.js";
3
- import "../navigation-aoYZ_tl4.js";
4
- import "../markdown-Cq3XEhrR.js";
5
- import "../contexts-_NNW5yqC.js";
6
- import "../use-components-BUz3GbO4.js";
7
- import "../stl-sidebar-DC5UOJiT.js";
8
- import { t as SDKSidebar } from "../sdk-sidebar-BDn8S1xS.js";
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
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
10
52
  export { SDKSidebar };
@@ -1,2 +1,122 @@
1
- import { C as SDKSnippetLanguagesType, D as useStreamingResponse, E as useReferenceNesting, S as SDKSnippetLanguages, T as usePropertyModel, _ as SDKModel, a as SDKChildren, b as SDKRequestTitle, c as SDKDeclaration, d as SDKLanguageBlock, f as SDKMethod, g as SDKMethodProps, h as SDKMethodNotImplemented, 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 SDKModelProps, w as TransformRequestSnippetFn, x as SDKRequestTitleProps, y as SDKReference } from "../sdk-Dm0S-XQE.js";
1
+ import { c as ID, d as Method, f as Model, g as SnippetLanguage, o as HasStainlessPath, t as BaseDeclaration } from "../index-PdnFhQF9.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 SDKSnippetLanguagesType = Record<SnippetLanguage, {
17
+ name: string;
18
+ }>;
19
+ declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
20
+ type TransformRequestSnippetFn = ({
21
+ snippet,
22
+ language
23
+ }: {
24
+ snippet: string;
25
+ language: DocsLanguage;
26
+ }) => string;
27
+ type SDKChildrenProps = {
28
+ paths: ID[];
29
+ expand?: boolean;
30
+ depth?: number;
31
+ };
32
+ declare function SDKChildren({
33
+ paths,
34
+ expand,
35
+ depth
36
+ }: SDKChildrenProps): react_jsx_runtime0.JSX.Element;
37
+ type SDKDeclarationProps = {
38
+ path: string;
39
+ expand?: boolean;
40
+ depth?: number;
41
+ };
42
+ declare function SDKDeclaration({
43
+ path,
44
+ expand,
45
+ depth
46
+ }: SDKDeclarationProps): react_jsx_runtime0.JSX.Element;
47
+ type SDKConstraintsProps = {
48
+ constraints?: Record<string, unknown>;
49
+ };
50
+ declare function SDKConstraints({
51
+ constraints
52
+ }: SDKConstraintsProps): react_jsx_runtime0.JSX.Element | undefined;
53
+ type SDKIconProps = {
54
+ language: SnippetLanguage;
55
+ size?: number;
56
+ };
57
+ declare function SDKIcon({
58
+ language
59
+ }: SDKIconProps): react_jsx_runtime0.JSX.Element | null;
60
+ type SDKRequestTitleProps = {
61
+ snippetLanguage: SnippetLanguage;
62
+ };
63
+ declare function SDKRequestTitle({
64
+ snippetLanguage
65
+ }: SDKRequestTitleProps): react_jsx_runtime0.JSX.Element;
66
+ type SDKExampleProps = {
67
+ method: Partial<Method> & HasStainlessPath;
68
+ transformRequestSnippet?: TransformRequestSnippetFn;
69
+ };
70
+ declare function SDKExample({
71
+ method,
72
+ transformRequestSnippet
73
+ }: SDKExampleProps): react_jsx_runtime0.JSX.Element;
74
+ type SDKMethodProps = {
75
+ method: Method;
76
+ transformRequestSnippet?: TransformRequestSnippetFn;
77
+ };
78
+ declare function SDKMethodHeader({
79
+ method
80
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
81
+ declare function useStreamingResponse(method: BaseDeclaration): ID | undefined;
82
+ declare function SDKMethodInfo({
83
+ method
84
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
85
+ declare function SDKMethodNotImplemented({
86
+ method
87
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
88
+ declare function SDKMethod({
89
+ method,
90
+ transformRequestSnippet
91
+ }: SDKMethodProps): react_jsx_runtime0.JSX.Element;
92
+ type SDKModelProps = {
93
+ model: Model;
94
+ };
95
+ declare function SDKModel({
96
+ model
97
+ }: SDKModelProps): react_jsx_runtime0.JSX.Element | null;
98
+ type SDKReferenceProps = {
99
+ stainlessPath: string;
100
+ children?: React$1.ReactNode;
101
+ };
102
+ declare function SDKReference({
103
+ stainlessPath,
104
+ children
105
+ }: SDKReferenceProps): string | number | bigint | boolean | 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> | react_jsx_runtime0.JSX.Element | null | undefined;
106
+ type SDKLanguageBlockProps = {
107
+ language: DocsLanguage;
108
+ version: string;
109
+ install: string;
110
+ links: {
111
+ repo: string;
112
+ docs: string;
113
+ };
114
+ };
115
+ declare function SDKLanguageBlock({
116
+ language,
117
+ version,
118
+ install,
119
+ links
120
+ }: SDKLanguageBlockProps): react_jsx_runtime0.JSX.Element;
121
+ //#endregion
2
122
  export { PropertyModelContext, PropertyModelContextType, ReferenceNestingContext, ReferenceNestingContextType, SDKChildren, SDKConstraints, SDKConstraintsProps, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKMethodNotImplemented, SDKMethodProps, SDKModel, SDKModelProps, SDKReference, SDKRequestTitle, SDKRequestTitleProps, SDKSnippetLanguages, SDKSnippetLanguagesType, TransformRequestSnippetFn, usePropertyModel, useReferenceNesting, useStreamingResponse };