@stainless-api/docs-ui 0.1.0-beta.6 → 0.1.0-beta.61
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.
- package/dist/breadcrumbs-BVskoBYz.d.ts +25 -0
- package/dist/breadcrumbs-C9LLJyuJ.d.ts +25 -0
- package/dist/breadcrumbs-CqA6kow2.js +63 -0
- package/dist/chunk-BN_g-Awi.js +18 -0
- package/dist/cli-0bJ66S1r.js +157 -0
- package/dist/component-CjJJYIxG.js +23 -0
- package/dist/component-generics-BC_P155r.d.ts +30 -0
- package/dist/component-generics-BkwbbxJF.d.ts +30 -0
- package/dist/component-generics-POFirVVb.js +45 -0
- package/dist/components/MaskedInput.d.ts +14 -0
- package/dist/components/MaskedInput.js +76 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +9 -0
- package/dist/components/icons.d.ts +60 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +18 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +10 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +11 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +8 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +9 -0
- package/dist/components/sdk.d.ts +2 -0
- package/dist/components/sdk.js +10 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +9 -0
- package/dist/components/snippets.d.ts +3 -0
- package/dist/components/snippets.js +9 -0
- package/dist/components-FEHnQBJC.js +70 -0
- package/dist/contexts/component-generics.d.ts +2 -0
- package/dist/contexts/component-generics.js +3 -0
- package/dist/contexts/component-types.d.ts +16 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +29 -0
- package/dist/contexts/component.js +28 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +22 -0
- package/dist/contexts/index.js +7 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +4 -0
- package/dist/contexts/navigation.d.ts +2 -0
- package/dist/contexts/navigation.js +3 -0
- package/dist/contexts/use-components.d.ts +14 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-CeV_L_Iy.js +39 -0
- package/dist/csharp-Dl2RIiYP.js +283 -0
- package/dist/docs--qWFuJCM.d.ts +46 -0
- package/dist/docs-DSFRsmbQ.d.ts +46 -0
- package/dist/docs-Di94viZV.js +54 -0
- package/dist/go-DuKdRGqU.js +303 -0
- package/dist/http-C7bu4oCl.js +331 -0
- package/dist/icons-BYKn5X8E.js +885 -0
- package/dist/index-C0qvL4yP.d.ts +15 -0
- package/dist/index-DE1vA8T2.d.ts +302 -0
- package/dist/index-DsFyACw9.d.ts +15 -0
- package/dist/index-FDM-j9s-.d.ts +302 -0
- package/dist/index-zNpvNvtN.d.ts +1691 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +30 -7542
- package/dist/java-DSyzO-6F.js +403 -0
- package/dist/languages/cli.d.ts +11 -0
- package/dist/languages/cli.js +20 -0
- package/dist/languages/csharp.d.ts +11 -0
- package/dist/languages/csharp.js +9 -0
- package/dist/languages/go.d.ts +11 -0
- package/dist/languages/go.js +9 -0
- package/dist/languages/http.d.ts +11 -0
- package/dist/languages/http.js +19 -0
- package/dist/languages/index.d.ts +11 -0
- package/dist/languages/index.js +27 -0
- package/dist/languages/java.d.ts +11 -0
- package/dist/languages/java.js +9 -0
- package/dist/languages/python.d.ts +11 -0
- package/dist/languages/python.js +9 -0
- package/dist/languages/ruby.d.ts +11 -0
- package/dist/languages/ruby.js +9 -0
- package/dist/languages/typescript.d.ts +11 -0
- package/dist/languages/typescript.js +9 -0
- package/dist/languages-BO5YJ6cy.js +28 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +105 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +41 -0
- package/dist/markdown/printer.d.ts +13 -0
- package/dist/markdown/printer.js +98 -0
- package/dist/markdown/utils.d.ts +21 -0
- package/dist/markdown/utils.js +31 -0
- package/dist/markdown-B517MrZh.d.ts +22 -0
- package/dist/markdown-C7Tb41LZ.d.ts +22 -0
- package/dist/markdown-D2JWyRws.js +49 -0
- package/dist/method-BaQEZVlw.d.ts +59 -0
- package/dist/method-Dln4ZTIB.d.ts +59 -0
- package/dist/method-jTnA0G8m.js +90 -0
- package/dist/navigation-XhIgqXwM.d.ts +29 -0
- package/dist/navigation-aoYZ_tl4.js +24 -0
- package/dist/navigation-rKdts-BR.d.ts +29 -0
- package/dist/overview-B3kgyac2.d.ts +39 -0
- package/dist/overview-BnagZfH1.js +139 -0
- package/dist/overview-Dp-gGl3v.d.ts +39 -0
- package/dist/primitives-B6zu2rrx.d.ts +105 -0
- package/dist/primitives-DQLc9kN7.js +250 -0
- package/dist/primitives-VtUGoYwX.d.ts +105 -0
- package/dist/properties-Bun4nfUE.d.ts +54 -0
- package/dist/properties-DGL2J11L.js +131 -0
- package/dist/properties-ZOIqpkET.d.ts +54 -0
- package/dist/python-D8ABqtn1.js +269 -0
- package/dist/routing-Ce0_tBW6.js +197 -0
- package/dist/routing-CtbZJru_.d.ts +54 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +3 -180
- package/dist/ruby-261jvCjl.js +387 -0
- package/dist/sdk-BebFnWYL.d.ts +118 -0
- package/dist/sdk-CIxaNoAs.d.ts +118 -0
- package/dist/sdk-GGpyGTao.js +338 -0
- package/dist/sidebar-BWno0E4w.js +85 -0
- package/dist/sidebar-CLsIJZZf.d.ts +36 -0
- package/dist/sidebar-D4m_pVpS.d.ts +36 -0
- package/dist/snippets-CwVjwsAo.d.ts +53 -0
- package/dist/snippets-Ym3mnHO3.d.ts +53 -0
- package/dist/snippets-kI8eNs1F.js +164 -0
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/style-LwfvXElj.js +170 -0
- package/dist/style.d.ts +169 -0
- package/dist/style.js +3 -0
- package/dist/styles/main.css +722 -755
- package/dist/styles/main.js +0 -0
- package/dist/styles/primitives.css +322 -459
- package/dist/styles/primitives.js +0 -0
- package/dist/styles/resets.css +32 -41
- package/dist/styles/resets.js +0 -0
- package/dist/styles/search.css +192 -270
- package/dist/styles/search.js +0 -0
- package/dist/styles/sidebar.css +56 -61
- package/dist/styles/sidebar.js +0 -0
- package/dist/styles/variables.css +26 -89
- package/dist/styles/variables.js +0 -0
- package/dist/styles.css +3145 -0
- package/dist/styles.mjs +1 -0
- package/dist/typescript-D924WidI.js +449 -0
- package/dist/use-components-BUz3GbO4.js +7 -0
- package/dist/utils-D01mAUfQ.js +32 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +3 -0
- package/package.json +73 -21
- package/dist/mcp.js +0 -16003
- package/dist/styles/snippets.css +0 -132
- package/src/components/breadcrumbs.tsx +0 -94
- package/src/components/chat.tsx +0 -154
- package/src/components/dropdown.tsx +0 -91
- package/src/components/icons.tsx +0 -584
- package/src/components/index.ts +0 -9
- package/src/components/method.tsx +0 -144
- package/src/components/overview.tsx +0 -159
- package/src/components/primitives.tsx +0 -284
- package/src/components/properties.tsx +0 -130
- package/src/components/scripts/dropdown.ts +0 -78
- package/src/components/sdk.tsx +0 -402
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -179
- package/src/contexts/component-generics.tsx +0 -48
- package/src/contexts/component-types.tsx +0 -5
- package/src/contexts/component.tsx +0 -32
- package/src/contexts/docs.tsx +0 -75
- package/src/contexts/index.tsx +0 -17
- package/src/contexts/markdown.tsx +0 -43
- package/src/contexts/navigation.tsx +0 -44
- package/src/contexts/search.tsx +0 -28
- package/src/contexts/use-components.tsx +0 -4
- package/src/index.ts +0 -6
- package/src/languages/go.tsx +0 -281
- package/src/languages/http.tsx +0 -321
- package/src/languages/index.ts +0 -26
- package/src/languages/java.tsx +0 -358
- package/src/languages/python.tsx +0 -255
- package/src/languages/ruby.tsx +0 -320
- package/src/languages/typescript.tsx +0 -393
- package/src/markdown/index.ts +0 -107
- package/src/markdown/md.ts +0 -45
- package/src/markdown/utils.ts +0 -49
- package/src/routing.ts +0 -238
- package/src/search/form.tsx +0 -127
- package/src/search/index.tsx +0 -1
- package/src/search/indexer.ts +0 -246
- package/src/search/mcp.ts +0 -61
- package/src/search/printer.tsx +0 -86
- package/src/search/providers/algolia.ts +0 -88
- package/src/search/providers/fuse.ts +0 -19
- package/src/search/providers/pagefind.ts +0 -17
- package/src/search/providers/walker.ts +0 -30
- package/src/search/results.tsx +0 -181
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -197
- package/src/styles/main.css +0 -993
- package/src/styles/primitives.css +0 -573
- package/src/styles/resets.css +0 -47
- package/src/styles/search.css +0 -342
- package/src/styles/sidebar.css +0 -87
- package/src/styles/snippets.css +0 -132
- package/src/styles/variables.css +0 -90
- package/src/utils.ts +0 -41
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-CtbZJru_.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime50 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/contexts/navigation.d.ts
|
|
6
|
+
type NavigationHandler = (ev: React$1.MouseEvent | null, opts: {
|
|
7
|
+
href: string;
|
|
8
|
+
language: DocsLanguage;
|
|
9
|
+
stainlessPath: string;
|
|
10
|
+
scroll: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
type NavigationContextType = {
|
|
13
|
+
basePath?: string;
|
|
14
|
+
selectedPath?: string;
|
|
15
|
+
navigationPath?: string[];
|
|
16
|
+
onNavigate?: NavigationHandler;
|
|
17
|
+
};
|
|
18
|
+
declare function useNavigation(): NavigationContextType;
|
|
19
|
+
type NavigationProviderProps = NavigationContextType & {
|
|
20
|
+
children: React$1.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function NavigationProvider({
|
|
23
|
+
basePath,
|
|
24
|
+
selectedPath,
|
|
25
|
+
onNavigate,
|
|
26
|
+
children
|
|
27
|
+
}: NavigationProviderProps): react_jsx_runtime50.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { useNavigation as a, NavigationProviderProps as i, NavigationHandler as n, NavigationProvider as r, NavigationContextType as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/navigation.tsx
|
|
5
|
+
const Defaults = { basePath: "/" };
|
|
6
|
+
const NavigationContext = React$1.createContext(Defaults);
|
|
7
|
+
function useNavigation() {
|
|
8
|
+
return React$1.useContext(NavigationContext);
|
|
9
|
+
}
|
|
10
|
+
function NavigationProvider({ basePath, selectedPath, onNavigate, children }) {
|
|
11
|
+
const value = {
|
|
12
|
+
...Defaults,
|
|
13
|
+
onNavigate,
|
|
14
|
+
basePath,
|
|
15
|
+
selectedPath
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx(NavigationContext.Provider, {
|
|
18
|
+
value,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useNavigation as n, NavigationProvider as t };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-CtbZJru_.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/contexts/navigation.d.ts
|
|
6
|
+
type NavigationHandler = (ev: React$1.MouseEvent | null, opts: {
|
|
7
|
+
href: string;
|
|
8
|
+
language: DocsLanguage;
|
|
9
|
+
stainlessPath: string;
|
|
10
|
+
scroll: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
type NavigationContextType = {
|
|
13
|
+
basePath?: string;
|
|
14
|
+
selectedPath?: string;
|
|
15
|
+
navigationPath?: string[];
|
|
16
|
+
onNavigate?: NavigationHandler;
|
|
17
|
+
};
|
|
18
|
+
declare function useNavigation(): NavigationContextType;
|
|
19
|
+
type NavigationProviderProps = NavigationContextType & {
|
|
20
|
+
children: React$1.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function NavigationProvider({
|
|
23
|
+
basePath,
|
|
24
|
+
selectedPath,
|
|
25
|
+
onNavigate,
|
|
26
|
+
children
|
|
27
|
+
}: NavigationProviderProps): react_jsx_runtime15.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { useNavigation as a, NavigationProviderProps as i, NavigationHandler as n, NavigationProvider as r, NavigationContextType as t };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { f as Resource, l as Method } from "./index-zNpvNvtN.js";
|
|
2
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/overview.d.ts
|
|
5
|
+
type SDKResourceProps = {
|
|
6
|
+
resource: Resource;
|
|
7
|
+
parents?: Resource[];
|
|
8
|
+
};
|
|
9
|
+
declare function SDKResourceHeader({
|
|
10
|
+
resource,
|
|
11
|
+
parents
|
|
12
|
+
}: SDKResourceProps): react_jsx_runtime22.JSX.Element | null;
|
|
13
|
+
type SDKMethodSummaryProps = {
|
|
14
|
+
method: Method;
|
|
15
|
+
};
|
|
16
|
+
declare function SDKMethodSummary({
|
|
17
|
+
method
|
|
18
|
+
}: SDKMethodSummaryProps): react_jsx_runtime22.JSX.Element;
|
|
19
|
+
declare function SDKResource({
|
|
20
|
+
resource,
|
|
21
|
+
parents,
|
|
22
|
+
showModels
|
|
23
|
+
}: SDKResourceProps & {
|
|
24
|
+
showModels?: boolean;
|
|
25
|
+
}): react_jsx_runtime22.JSX.Element;
|
|
26
|
+
type SDKOverviewProps = {
|
|
27
|
+
resource: Resource;
|
|
28
|
+
};
|
|
29
|
+
declare function SDKOverview({
|
|
30
|
+
resource
|
|
31
|
+
}: SDKOverviewProps): react_jsx_runtime22.JSX.Element;
|
|
32
|
+
type SDKRootProps = {
|
|
33
|
+
stainlessPath: string;
|
|
34
|
+
};
|
|
35
|
+
declare function SDKRoot({
|
|
36
|
+
stainlessPath
|
|
37
|
+
}: SDKRootProps): react_jsx_runtime22.JSX.Element | null;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SDKResource as a, SDKRoot as c, SDKOverviewProps as i, SDKRootProps as l, SDKMethodSummaryProps as n, SDKResourceHeader as o, SDKOverview as r, SDKResourceProps as s, SDKMethodSummary as t };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { a as useLanguage, l as useSpec, r as useDeclaration } from "./docs-Di94viZV.js";
|
|
2
|
+
import { n as useLanguageComponents } from "./contexts-CeV_L_Iy.js";
|
|
3
|
+
import { t as useComponents } from "./use-components-BUz3GbO4.js";
|
|
4
|
+
import { t as style_default } from "./style-LwfvXElj.js";
|
|
5
|
+
import { i as PropertyToggle } from "./properties-DGL2J11L.js";
|
|
6
|
+
import { f as parseStainlessPath } from "./routing-Ce0_tBW6.js";
|
|
7
|
+
import { s as Markdown } from "./primitives-DQLc9kN7.js";
|
|
8
|
+
import { n as getResourceFromSpec, t as flatResources } from "./utils-D01mAUfQ.js";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { createElement } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronRight } from "lucide-react";
|
|
13
|
+
|
|
14
|
+
//#region src/components/overview.tsx
|
|
15
|
+
function SDKResourceHeader({ resource, parents }) {
|
|
16
|
+
const segments = parents?.map((parent, index) => /* @__PURE__ */ jsxs("span", {
|
|
17
|
+
className: style_default.ResourceTitleSegment,
|
|
18
|
+
children: [parent.title, index < parents.length && /* @__PURE__ */ jsx(ChevronRight, {
|
|
19
|
+
size: 16,
|
|
20
|
+
className: style_default.Icon
|
|
21
|
+
})]
|
|
22
|
+
}, parent.stainlessPath));
|
|
23
|
+
if (!segments && !resource.description) return null;
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: style_default.ResourceHeader,
|
|
26
|
+
children: [segments && /* @__PURE__ */ jsxs("h4", {
|
|
27
|
+
id: resource.stainlessPath,
|
|
28
|
+
className: style_default.ResourceTitle,
|
|
29
|
+
children: [segments, /* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: style_default.ResourceTitleSegment,
|
|
31
|
+
children: resource.title
|
|
32
|
+
})]
|
|
33
|
+
}), resource.description && /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: style_default.ResourceDescription,
|
|
35
|
+
children: /* @__PURE__ */ jsx(Markdown, { content: resource.description })
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function SDKMethodSummary({ method }) {
|
|
40
|
+
const Docs = useComponents();
|
|
41
|
+
const Lang = useLanguageComponents();
|
|
42
|
+
const decl = useDeclaration(method.stainlessPath, true);
|
|
43
|
+
return /* @__PURE__ */ jsx(Docs.MethodHeader, {
|
|
44
|
+
level: "h5",
|
|
45
|
+
title: /* @__PURE__ */ jsx(Docs.Link, {
|
|
46
|
+
stainlessPath: method.stainlessPath,
|
|
47
|
+
children: method.summary ?? method.title
|
|
48
|
+
}),
|
|
49
|
+
signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
|
|
50
|
+
badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
|
|
51
|
+
id: "deprecated",
|
|
52
|
+
children: "Deprecated"
|
|
53
|
+
}),
|
|
54
|
+
children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
55
|
+
httpMethod: method.httpMethod,
|
|
56
|
+
endpoint: method.endpoint.split(" ", 2).at(-1)
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function SDKResource({ resource, parents, showModels }) {
|
|
61
|
+
const Docs = useComponents();
|
|
62
|
+
const language = useLanguage();
|
|
63
|
+
const spec = useSpec();
|
|
64
|
+
const methods = Object.values(resource.methods).filter((method) => spec?.decls?.[language]?.[method.stainlessPath]);
|
|
65
|
+
const models = Object.values(resource.models).filter((model) => spec?.decls?.[language]?.[`${model.stainlessPath} > (schema)`]);
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: style_default.Resource,
|
|
68
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: style_default.ResourceContent,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Docs.SDKResourceHeader, {
|
|
72
|
+
resource,
|
|
73
|
+
parents
|
|
74
|
+
}),
|
|
75
|
+
methods.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
76
|
+
className: style_default.ResourceContentGroup,
|
|
77
|
+
children: methods.map((method) => /* @__PURE__ */ jsx("div", {
|
|
78
|
+
className: style_default.MethodSummary,
|
|
79
|
+
children: /* @__PURE__ */ jsx(Docs.SDKMethodSummary, { method })
|
|
80
|
+
}, method.stainlessPath))
|
|
81
|
+
}),
|
|
82
|
+
showModels !== false && models.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: style_default.ResourceContentGroup,
|
|
84
|
+
"data-stldocs-property-group": "models",
|
|
85
|
+
children: [/* @__PURE__ */ jsxs("h5", {
|
|
86
|
+
className: style_default.ResourceContentGroupModelTitle,
|
|
87
|
+
children: ["Models", /* @__PURE__ */ jsx(PropertyToggle, { target: "models" })]
|
|
88
|
+
}), models.map((model) => /* @__PURE__ */ jsx(Docs.SDKModel, { model }, model.stainlessPath))]
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function SDKOverview({ resource }) {
|
|
95
|
+
const { SDKResource } = useComponents();
|
|
96
|
+
const nested = React$1.useMemo(() => flatResources(resource.subresources, [resource]), [resource]);
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: style_default.Overview,
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsx("div", {
|
|
101
|
+
className: style_default.OverviewHeader,
|
|
102
|
+
children: /* @__PURE__ */ jsx("h1", { children: resource.title })
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx(SDKResource, { resource }),
|
|
105
|
+
nested.map((props, index) => /* @__PURE__ */ createElement(SDKResource, {
|
|
106
|
+
...props,
|
|
107
|
+
key: index
|
|
108
|
+
}))
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function SDKRoot({ stainlessPath }) {
|
|
113
|
+
const spec = useSpec();
|
|
114
|
+
const Docs = useComponents();
|
|
115
|
+
const parsed = parseStainlessPath(stainlessPath);
|
|
116
|
+
const resource = spec && getResourceFromSpec(stainlessPath, spec);
|
|
117
|
+
if (!resource || !parsed) {
|
|
118
|
+
console.warn(`Could not find resource or parsed path for '${stainlessPath}'`);
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
if (parsed.method) {
|
|
122
|
+
const method = resource.methods[parsed.method];
|
|
123
|
+
if (!method) {
|
|
124
|
+
console.warn(`Method '${parsed.method}' not found in resource '${resource.stainlessPath}'`);
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ jsx("div", {
|
|
128
|
+
className: style_default.Root,
|
|
129
|
+
children: /* @__PURE__ */ jsx(Docs.SDKMethod, { method })
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: style_default.Root,
|
|
134
|
+
children: /* @__PURE__ */ jsx(Docs.SDKOverview, { resource })
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { SDKRoot as a, SDKResourceHeader as i, SDKOverview as n, SDKResource as r, SDKMethodSummary as t };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { f as Resource, l as Method } from "./index-zNpvNvtN.js";
|
|
2
|
+
import * as react_jsx_runtime42 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/overview.d.ts
|
|
5
|
+
type SDKResourceProps = {
|
|
6
|
+
resource: Resource;
|
|
7
|
+
parents?: Resource[];
|
|
8
|
+
};
|
|
9
|
+
declare function SDKResourceHeader({
|
|
10
|
+
resource,
|
|
11
|
+
parents
|
|
12
|
+
}: SDKResourceProps): react_jsx_runtime42.JSX.Element | null;
|
|
13
|
+
type SDKMethodSummaryProps = {
|
|
14
|
+
method: Method;
|
|
15
|
+
};
|
|
16
|
+
declare function SDKMethodSummary({
|
|
17
|
+
method
|
|
18
|
+
}: SDKMethodSummaryProps): react_jsx_runtime42.JSX.Element;
|
|
19
|
+
declare function SDKResource({
|
|
20
|
+
resource,
|
|
21
|
+
parents,
|
|
22
|
+
showModels
|
|
23
|
+
}: SDKResourceProps & {
|
|
24
|
+
showModels?: boolean;
|
|
25
|
+
}): react_jsx_runtime42.JSX.Element;
|
|
26
|
+
type SDKOverviewProps = {
|
|
27
|
+
resource: Resource;
|
|
28
|
+
};
|
|
29
|
+
declare function SDKOverview({
|
|
30
|
+
resource
|
|
31
|
+
}: SDKOverviewProps): react_jsx_runtime42.JSX.Element;
|
|
32
|
+
type SDKRootProps = {
|
|
33
|
+
stainlessPath: string;
|
|
34
|
+
};
|
|
35
|
+
declare function SDKRoot({
|
|
36
|
+
stainlessPath
|
|
37
|
+
}: SDKRootProps): react_jsx_runtime42.JSX.Element | null;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SDKResource as a, SDKRoot as c, SDKOverviewProps as i, SDKRootProps as l, SDKMethodSummaryProps as n, SDKResourceHeader as o, SDKOverview as r, SDKResourceProps as s, SDKMethodSummary as t };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime27 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/primitives.d.ts
|
|
6
|
+
type JoinProps = {
|
|
7
|
+
items: ReactNode[];
|
|
8
|
+
limit?: number;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function Join({
|
|
12
|
+
items,
|
|
13
|
+
limit,
|
|
14
|
+
children
|
|
15
|
+
}: JoinProps): react_jsx_runtime27.JSX.Element[];
|
|
16
|
+
type ExpanderProps = {
|
|
17
|
+
id?: string;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
summary: ReactNode;
|
|
20
|
+
virtual?: boolean;
|
|
21
|
+
muted?: boolean;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
declare function Expander({
|
|
25
|
+
id,
|
|
26
|
+
open,
|
|
27
|
+
summary,
|
|
28
|
+
virtual,
|
|
29
|
+
muted,
|
|
30
|
+
children
|
|
31
|
+
}: ExpanderProps): react_jsx_runtime27.JSX.Element;
|
|
32
|
+
declare function VirtualExpander({
|
|
33
|
+
id,
|
|
34
|
+
open: isOpen,
|
|
35
|
+
muted,
|
|
36
|
+
summary,
|
|
37
|
+
children
|
|
38
|
+
}: Omit<ExpanderProps, 'virtual'>): react_jsx_runtime27.JSX.Element;
|
|
39
|
+
declare function Markdown({
|
|
40
|
+
content
|
|
41
|
+
}: {
|
|
42
|
+
content: string;
|
|
43
|
+
}): "" | react_jsx_runtime27.JSX.Element | undefined;
|
|
44
|
+
type BadgeProps = {
|
|
45
|
+
id: string;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
declare function Badge({
|
|
49
|
+
id,
|
|
50
|
+
children
|
|
51
|
+
}: BadgeProps): react_jsx_runtime27.JSX.Element;
|
|
52
|
+
type TooltipProps = {
|
|
53
|
+
content: ReactNode;
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
};
|
|
56
|
+
declare function Tooltip({
|
|
57
|
+
content,
|
|
58
|
+
children
|
|
59
|
+
}: TooltipProps): string | number | bigint | boolean | react_jsx_runtime27.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
60
|
+
type LinkProps = {
|
|
61
|
+
stainlessPath: string;
|
|
62
|
+
scroll?: boolean;
|
|
63
|
+
children?: ReactNode;
|
|
64
|
+
} & React.HTMLProps<HTMLAnchorElement>;
|
|
65
|
+
declare function Link({
|
|
66
|
+
stainlessPath,
|
|
67
|
+
scroll,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}: LinkProps): string | number | bigint | boolean | react_jsx_runtime27.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
71
|
+
type InputProps = {
|
|
72
|
+
left?: ReactNode;
|
|
73
|
+
right?: ReactNode;
|
|
74
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
75
|
+
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
76
|
+
declare function Input({
|
|
77
|
+
left,
|
|
78
|
+
right,
|
|
79
|
+
ref,
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: InputProps): react_jsx_runtime27.JSX.Element;
|
|
83
|
+
type ToggleButtonProps = {
|
|
84
|
+
children?: ReactNode;
|
|
85
|
+
selected?: boolean;
|
|
86
|
+
} & React.ComponentProps<'button'>;
|
|
87
|
+
declare function ToggleButton({
|
|
88
|
+
children,
|
|
89
|
+
selected,
|
|
90
|
+
ref,
|
|
91
|
+
...props
|
|
92
|
+
}: ToggleButtonProps): react_jsx_runtime27.JSX.Element;
|
|
93
|
+
type ListViewProps<TItem> = {
|
|
94
|
+
items: Array<TItem>;
|
|
95
|
+
itemDelegate: (item: TItem, selected: boolean) => React.ReactNode;
|
|
96
|
+
onSelectListItem?: (item: TItem) => void;
|
|
97
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
98
|
+
declare function ListView<TItem>({
|
|
99
|
+
items,
|
|
100
|
+
itemDelegate,
|
|
101
|
+
onSelectListItem,
|
|
102
|
+
...rest
|
|
103
|
+
}: ListViewProps<TItem>): react_jsx_runtime27.JSX.Element;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { Join as a, ListViewProps as c, ToggleButtonProps as d, Tooltip as f, InputProps as i, Markdown as l, Expander as n, Link as o, VirtualExpander as p, Input as r, ListView as s, Badge as t, ToggleButton as u };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { a as useLanguage, s as useSettings } from "./docs-Di94viZV.js";
|
|
2
|
+
import { n as useNavigation } from "./navigation-aoYZ_tl4.js";
|
|
3
|
+
import { a as useRenderMarkdown } from "./markdown-D2JWyRws.js";
|
|
4
|
+
import { t as style_default } from "./style-LwfvXElj.js";
|
|
5
|
+
import { o as generateRoute } from "./routing-Ce0_tBW6.js";
|
|
6
|
+
import { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { MinusIcon, PlusIcon } from "lucide-react";
|
|
10
|
+
|
|
11
|
+
//#region src/components/primitives.tsx
|
|
12
|
+
function Join({ items, limit, children }) {
|
|
13
|
+
return (limit && items.length > limit + 1 ? [...items.slice(0, limit), /* @__PURE__ */ jsxs("span", {
|
|
14
|
+
className: style_default.Truncation,
|
|
15
|
+
children: [items.length - limit, " more"]
|
|
16
|
+
}, "truncation")] : items).map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [!!index && children, item] }, `iterator:${index}`));
|
|
17
|
+
}
|
|
18
|
+
function Expander({ id, open, summary, virtual, muted, children }) {
|
|
19
|
+
const virtualExpanders = useSettings()?.virtualExpanders;
|
|
20
|
+
if (virtual || virtualExpanders) return /* @__PURE__ */ jsx(VirtualExpander, {
|
|
21
|
+
summary,
|
|
22
|
+
open,
|
|
23
|
+
muted,
|
|
24
|
+
id,
|
|
25
|
+
children
|
|
26
|
+
}, open ? "open" : "closed");
|
|
27
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
28
|
+
className: style_default.Expander,
|
|
29
|
+
open,
|
|
30
|
+
"data-stldocs-expander-muted": muted,
|
|
31
|
+
"data-stldocs-expander-initial-state": open,
|
|
32
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
33
|
+
className: style_default.ExpanderSummary,
|
|
34
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: style_default.ExpanderSummaryIcon,
|
|
36
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, {
|
|
37
|
+
size: 16,
|
|
38
|
+
strokeWidth: 1,
|
|
39
|
+
className: style_default.Icon
|
|
40
|
+
}), /* @__PURE__ */ jsx(MinusIcon, {
|
|
41
|
+
size: 16,
|
|
42
|
+
strokeWidth: 1,
|
|
43
|
+
className: style_default.Icon
|
|
44
|
+
})]
|
|
45
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: style_default.ExpanderSummaryContent,
|
|
47
|
+
children: summary
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: style_default.ExpanderContent,
|
|
51
|
+
id,
|
|
52
|
+
children
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function VirtualExpander({ id, open: isOpen, muted, summary, children }) {
|
|
57
|
+
const [open, setOpen] = useState(isOpen ?? false);
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: style_default.Expander,
|
|
60
|
+
"data-open": open,
|
|
61
|
+
"data-stldocs-expander-muted": muted,
|
|
62
|
+
"data-stldocs-expander-initial-state": open,
|
|
63
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: style_default.ExpanderSummary,
|
|
65
|
+
onClick: () => setOpen(!open),
|
|
66
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
67
|
+
className: style_default.ExpanderSummaryIcon,
|
|
68
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, {
|
|
69
|
+
size: 16,
|
|
70
|
+
className: style_default.Icon
|
|
71
|
+
}), /* @__PURE__ */ jsx(MinusIcon, {
|
|
72
|
+
size: 16,
|
|
73
|
+
className: style_default.Icon
|
|
74
|
+
})]
|
|
75
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
76
|
+
className: style_default.ExpanderSummaryContent,
|
|
77
|
+
children: summary
|
|
78
|
+
})]
|
|
79
|
+
}), open && /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: style_default.ExpanderContent,
|
|
81
|
+
id,
|
|
82
|
+
children
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function Markdown({ content }) {
|
|
87
|
+
const rendered = useRenderMarkdown(content);
|
|
88
|
+
return rendered && /* @__PURE__ */ jsx("div", {
|
|
89
|
+
className: clsx(style_default.Markdown, style_default.Content, "stl-ui-prose"),
|
|
90
|
+
dangerouslySetInnerHTML: { __html: rendered }
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function Badge({ id, children }) {
|
|
94
|
+
return /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: style_default.Badge,
|
|
96
|
+
"data-badge-id": id,
|
|
97
|
+
children: children ?? id
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const TooltipNestingContext = createContext(false);
|
|
101
|
+
function Tooltip({ content, children }) {
|
|
102
|
+
if (useContext(TooltipNestingContext)) return children;
|
|
103
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
104
|
+
className: style_default.Tooltip,
|
|
105
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: style_default.TooltipContent,
|
|
107
|
+
children: /* @__PURE__ */ jsx(TooltipNestingContext.Provider, {
|
|
108
|
+
value: true,
|
|
109
|
+
children: content
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
112
|
+
className: style_default.TooltipHost,
|
|
113
|
+
children
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function Link({ stainlessPath, scroll = true, children, ...props }) {
|
|
118
|
+
const { basePath, onNavigate } = useNavigation();
|
|
119
|
+
const language = useLanguage();
|
|
120
|
+
const href = useMemo(() => {
|
|
121
|
+
if (props.href) return props.href;
|
|
122
|
+
if (stainlessPath && basePath) return generateRoute(basePath, language, stainlessPath);
|
|
123
|
+
}, [
|
|
124
|
+
basePath,
|
|
125
|
+
language,
|
|
126
|
+
stainlessPath,
|
|
127
|
+
props.href
|
|
128
|
+
]);
|
|
129
|
+
const handleClick = useCallback((e) => {
|
|
130
|
+
if (props.onClick) props.onClick(e);
|
|
131
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
132
|
+
if (href) onNavigate?.(e, {
|
|
133
|
+
href,
|
|
134
|
+
language,
|
|
135
|
+
stainlessPath,
|
|
136
|
+
scroll
|
|
137
|
+
});
|
|
138
|
+
}, [
|
|
139
|
+
href,
|
|
140
|
+
scroll,
|
|
141
|
+
onNavigate,
|
|
142
|
+
language,
|
|
143
|
+
props,
|
|
144
|
+
stainlessPath
|
|
145
|
+
]);
|
|
146
|
+
if (!href) return children;
|
|
147
|
+
return /* @__PURE__ */ jsx("a", {
|
|
148
|
+
href,
|
|
149
|
+
onClick: handleClick,
|
|
150
|
+
...props,
|
|
151
|
+
children
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function Input({ left, right, ref, className, ...props }) {
|
|
155
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: clsx(style_default.Input, props.disabled && style_default.InputDisabled, className),
|
|
157
|
+
children: [
|
|
158
|
+
left,
|
|
159
|
+
/* @__PURE__ */ jsx("input", {
|
|
160
|
+
...props,
|
|
161
|
+
ref,
|
|
162
|
+
className: style_default.InputTextField
|
|
163
|
+
}),
|
|
164
|
+
right
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function ToggleButton({ children, selected, ref, ...props }) {
|
|
169
|
+
return /* @__PURE__ */ jsx("button", {
|
|
170
|
+
...props,
|
|
171
|
+
ref,
|
|
172
|
+
className: style_default.ToggleButton,
|
|
173
|
+
"data-stldocs-toggle-selected": selected,
|
|
174
|
+
children
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
|
|
178
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
179
|
+
const [keyboardIndex, setKeyboardIndex] = useState(0);
|
|
180
|
+
const listRef = useRef(null);
|
|
181
|
+
const itemRef = useRef(null);
|
|
182
|
+
const handleSelect = useCallback(() => {
|
|
183
|
+
const item = items[selectedIndex];
|
|
184
|
+
if (item) onSelectListItem?.(item);
|
|
185
|
+
}, [
|
|
186
|
+
items,
|
|
187
|
+
selectedIndex,
|
|
188
|
+
onSelectListItem
|
|
189
|
+
]);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
const ac = new AbortController();
|
|
192
|
+
document.addEventListener("keydown", (ev) => {
|
|
193
|
+
switch (ev.key) {
|
|
194
|
+
case "ArrowUp": {
|
|
195
|
+
ev.preventDefault();
|
|
196
|
+
const value = Math.max(0, selectedIndex - 1);
|
|
197
|
+
setSelectedIndex(value);
|
|
198
|
+
setKeyboardIndex(value);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case "ArrowDown": {
|
|
202
|
+
ev.preventDefault();
|
|
203
|
+
const value = Math.min(items.length, selectedIndex + 1);
|
|
204
|
+
setSelectedIndex(value);
|
|
205
|
+
setKeyboardIndex(value);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case "Enter":
|
|
209
|
+
ev.preventDefault();
|
|
210
|
+
handleSelect();
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}, { signal: ac.signal });
|
|
214
|
+
return () => ac.abort();
|
|
215
|
+
}, [
|
|
216
|
+
items,
|
|
217
|
+
selectedIndex,
|
|
218
|
+
handleSelect
|
|
219
|
+
]);
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
if (!keyboardIndex || !itemRef.current || !listRef.current) {
|
|
222
|
+
listRef?.current?.scroll(0, 0);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const selectedBounds = itemRef.current.getBoundingClientRect();
|
|
226
|
+
const listBounds = listRef.current.getBoundingClientRect();
|
|
227
|
+
if (selectedBounds.top < listBounds.top || selectedBounds.bottom > listBounds.bottom) itemRef.current.scrollIntoView({ block: "nearest" });
|
|
228
|
+
}, [
|
|
229
|
+
keyboardIndex,
|
|
230
|
+
items,
|
|
231
|
+
listRef
|
|
232
|
+
]);
|
|
233
|
+
return /* @__PURE__ */ jsx("div", {
|
|
234
|
+
ref: listRef,
|
|
235
|
+
className: style_default.ListView,
|
|
236
|
+
tabIndex: 0,
|
|
237
|
+
...rest,
|
|
238
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx("div", {
|
|
239
|
+
ref: index === selectedIndex ? itemRef : null,
|
|
240
|
+
className: style_default.ListViewItem,
|
|
241
|
+
"data-stldocs-listview-selected": index === selectedIndex,
|
|
242
|
+
onClick: handleSelect,
|
|
243
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
244
|
+
children: itemDelegate(item, index === selectedIndex)
|
|
245
|
+
}, index))
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
//#endregion
|
|
250
|
+
export { Link as a, ToggleButton as c, Join as i, Tooltip as l, Expander as n, ListView as o, Input as r, Markdown as s, Badge as t, VirtualExpander as u };
|