@stainless-api/docs-ui 0.1.0-beta.25 → 0.1.0-beta.26
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-D5viAm7a.d.ts +20 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/component-generics-BnrVqdQj.d.ts +29 -0
- package/dist/component-generics-Df4EDvxk.js +41 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +16 -0
- package/dist/components/chat.d.ts +14 -0
- package/dist/components/chat.js +128 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +4 -0
- package/dist/components/icons.d.ts +50 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +16 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +16 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +16 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +16 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +16 -0
- package/dist/components/scripts/dropdown.d.ts +12 -0
- package/dist/components/scripts/dropdown.js +50 -0
- package/dist/components/sdk.d.ts +3 -0
- package/dist/components/sdk.js +16 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +16 -0
- package/dist/components/snippets.d.ts +4 -0
- package/dist/components/snippets.js +16 -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 +18 -0
- package/dist/contexts/component-types.js +1 -0
- package/dist/contexts/component.d.ts +30 -0
- package/dist/contexts/component.js +16 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +20 -0
- package/dist/contexts/index.js +16 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +4 -0
- package/dist/contexts/navigation.d.ts +3 -0
- package/dist/contexts/navigation.js +3 -0
- package/dist/contexts/search.d.ts +4 -0
- package/dist/contexts/search.js +16 -0
- package/dist/contexts/use-components.d.ts +16 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-DO0sMzym.js +2581 -0
- package/dist/docs-Cj25B-Sh.js +50 -0
- package/dist/docs-DhNaW0DE.d.ts +45 -0
- package/dist/dropdown-Dv9VAYCW.d.ts +42 -0
- package/dist/dropdown-kUhwBigR.js +38 -0
- package/dist/icons--8QR-PrL.js +222 -0
- package/dist/index-BW6OPqAo.d.ts +16 -0
- package/dist/index-BXO3gZup.d.ts +239 -0
- package/dist/index-d8_VR8Z5.d.ts +14 -0
- package/dist/index.d.ts +22 -0
- package/dist/languages/go.d.ts +13 -0
- package/dist/languages/go.js +16 -0
- package/dist/languages/http.d.ts +13 -0
- package/dist/languages/http.js +16 -0
- package/dist/languages/index.d.ts +13 -0
- package/dist/languages/index.js +16 -0
- package/dist/languages/java.d.ts +13 -0
- package/dist/languages/java.js +16 -0
- package/dist/languages/python.d.ts +13 -0
- package/dist/languages/python.js +16 -0
- package/dist/languages/ruby.d.ts +13 -0
- package/dist/languages/ruby.js +16 -0
- package/dist/languages/typescript.d.ts +13 -0
- package/dist/languages/typescript.js +16 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +16 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +3 -0
- package/dist/markdown/utils.d.ts +4 -0
- package/dist/markdown/utils.js +3 -0
- package/dist/markdown-DN8KaRR2.d.ts +21 -0
- package/dist/markdown-DunIdqFE.js +39 -0
- package/dist/md-Dg8aOyMA.js +41 -0
- package/dist/method-c3XDArUn.d.ts +70 -0
- package/dist/navigation-BSn6PX-7.d.ts +28 -0
- package/dist/navigation-CuCg3le8.js +20 -0
- package/dist/overview-D21weqVJ.d.ts +39 -0
- package/dist/pagefind-ChrPfuVv.js +15 -0
- package/dist/primitives-iB9fIrMF.d.ts +98 -0
- package/dist/properties-Ba6F_GGj.d.ts +46 -0
- package/dist/routing-BE6Vrs-z.d.ts +54 -0
- package/dist/routing-C8oZYLsf.js +189 -0
- package/dist/routing.d.ts +2 -0
- package/dist/sdk-D2x2l6JH.d.ts +118 -0
- package/dist/search/index.d.ts +26 -0
- package/dist/search/index.js +211 -0
- package/dist/search/providers/algolia.d.ts +24 -0
- package/dist/search/providers/algolia.js +16 -0
- package/dist/search/providers/fuse.d.ts +18 -0
- package/dist/search/providers/fuse.js +31 -0
- package/dist/search/providers/pagefind.d.ts +7 -0
- package/dist/search/providers/pagefind.js +3 -0
- package/dist/search/providers/walker.d.ts +9 -0
- package/dist/search/providers/walker.js +35 -0
- package/dist/search/types.d.ts +3 -0
- package/dist/search/types.js +3 -0
- package/dist/search-KMqOU2tz.d.ts +20 -0
- package/dist/sidebar-B1X4gmY2.d.ts +35 -0
- package/dist/snippets-BApdMOXp.d.ts +45 -0
- package/dist/style-BWu-Pqcm.d.ts +182 -0
- package/dist/style-CkbsakoF.js +183 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.js +3 -0
- package/dist/types-BLgvxY4i.d.ts +83 -0
- package/dist/types-DFN4M1Sp.js +34 -0
- package/dist/use-components-DI-AbT-D.js +7 -0
- package/dist/utils-B9JL_XWH.d.ts +21 -0
- package/dist/utils-BhYTrLot.js +32 -0
- package/dist/utils-ByZH9QWT.js +30 -0
- package/dist/utils-DlayebL1.d.ts +14 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/package.json +2 -2
- package/src/search/mcp.ts +1 -1
- package/dist/mcp.js +0 -15967
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Markdoc from "@markdoc/markdoc";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/md.ts
|
|
4
|
+
function heading(level, children) {
|
|
5
|
+
const content = inline(...typeof children === "string" ? [text(children)] : children);
|
|
6
|
+
return new Markdoc.Ast.Node("heading", { level }, [content]);
|
|
7
|
+
}
|
|
8
|
+
function text(content) {
|
|
9
|
+
return new Markdoc.Ast.Node("text", { content });
|
|
10
|
+
}
|
|
11
|
+
function code(content) {
|
|
12
|
+
return new Markdoc.Ast.Node("code", { content });
|
|
13
|
+
}
|
|
14
|
+
function paragraph(...children) {
|
|
15
|
+
const inline$1 = new Markdoc.Ast.Node("inline", {}, children);
|
|
16
|
+
return new Markdoc.Ast.Node("paragraph", {}, [inline$1]);
|
|
17
|
+
}
|
|
18
|
+
function list(...children) {
|
|
19
|
+
return new Markdoc.Ast.Node("list", { ordered: false }, children);
|
|
20
|
+
}
|
|
21
|
+
function item(...children) {
|
|
22
|
+
return new Markdoc.Ast.Node("item", {}, children);
|
|
23
|
+
}
|
|
24
|
+
function strong(...children) {
|
|
25
|
+
return new Markdoc.Ast.Node("strong", {}, children);
|
|
26
|
+
}
|
|
27
|
+
function inline(...children) {
|
|
28
|
+
return new Markdoc.Ast.Node("inline", {}, children);
|
|
29
|
+
}
|
|
30
|
+
function fence(language, content) {
|
|
31
|
+
return new Markdoc.Ast.Node("fence", {
|
|
32
|
+
language,
|
|
33
|
+
content
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function parse(content) {
|
|
37
|
+
return Markdoc.parse(content).children;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { item as a, parse as c, inline as i, strong as l, fence as n, list as o, heading as r, paragraph as s, code as t, text as u };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { LucideIcon } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/method.d.ts
|
|
6
|
+
declare const HttpMethods: string[];
|
|
7
|
+
type HTTPMethod = (typeof HttpMethods)[number];
|
|
8
|
+
declare const HttpMethodIcons: Record<HTTPMethod, LucideIcon>;
|
|
9
|
+
type MethodIconProps = {
|
|
10
|
+
httpMethod?: string;
|
|
11
|
+
showName?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function MethodIconBadge({
|
|
14
|
+
httpMethod,
|
|
15
|
+
showName
|
|
16
|
+
}: MethodIconProps): React$1.JSX.Element | null;
|
|
17
|
+
type MethodHeaderProps = {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
|
|
20
|
+
signature?: ReactNode;
|
|
21
|
+
badges?: ReactNode;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
declare function MethodHeader({
|
|
25
|
+
title,
|
|
26
|
+
badges,
|
|
27
|
+
signature,
|
|
28
|
+
children,
|
|
29
|
+
level
|
|
30
|
+
}: MethodHeaderProps): React$1.JSX.Element;
|
|
31
|
+
type MethodRouteProps = {
|
|
32
|
+
httpMethod?: string;
|
|
33
|
+
endpoint?: string | ReactNode;
|
|
34
|
+
iconOnly?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare function MethodRoute({
|
|
37
|
+
httpMethod,
|
|
38
|
+
endpoint,
|
|
39
|
+
iconOnly
|
|
40
|
+
}: MethodRouteProps): React$1.JSX.Element;
|
|
41
|
+
type MethodDescriptionProps = {
|
|
42
|
+
description?: string;
|
|
43
|
+
};
|
|
44
|
+
declare function MethodDescription({
|
|
45
|
+
description
|
|
46
|
+
}: MethodDescriptionProps): React$1.JSX.Element | undefined;
|
|
47
|
+
type MethodInfoProps = {
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
parameters?: ReactNode;
|
|
50
|
+
returns?: ReactNode;
|
|
51
|
+
};
|
|
52
|
+
declare function MethodInfo({
|
|
53
|
+
children,
|
|
54
|
+
parameters,
|
|
55
|
+
returns
|
|
56
|
+
}: MethodInfoProps): React$1.JSX.Element;
|
|
57
|
+
type MethodProps = {
|
|
58
|
+
id?: string;
|
|
59
|
+
header?: ReactNode;
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
} & React$1.HTMLProps<HTMLDivElement>;
|
|
62
|
+
declare function Method({
|
|
63
|
+
id,
|
|
64
|
+
header,
|
|
65
|
+
children,
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}: MethodProps): React$1.JSX.Element;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { MethodDescription as a, MethodHeaderProps as c, MethodInfo as d, MethodInfoProps as f, MethodRouteProps as h, Method as i, MethodIconBadge as l, MethodRoute as m, HttpMethodIcons as n, MethodDescriptionProps as o, MethodProps as p, HttpMethods as r, MethodHeader as s, HTTPMethod as t, MethodIconProps as u };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-BE6Vrs-z.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/navigation.d.ts
|
|
5
|
+
type NavigationHandler = (ev: React$1.MouseEvent | null, opts: {
|
|
6
|
+
href: string;
|
|
7
|
+
language: DocsLanguage;
|
|
8
|
+
stainlessPath: string;
|
|
9
|
+
scroll: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
type NavigationContextType = {
|
|
12
|
+
basePath?: string;
|
|
13
|
+
selectedPath?: string;
|
|
14
|
+
navigationPath?: string[];
|
|
15
|
+
onNavigate?: NavigationHandler;
|
|
16
|
+
};
|
|
17
|
+
declare function useNavigation(): NavigationContextType;
|
|
18
|
+
type NavigationProviderProps = NavigationContextType & {
|
|
19
|
+
children: React$1.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
declare function NavigationProvider({
|
|
22
|
+
basePath,
|
|
23
|
+
selectedPath,
|
|
24
|
+
onNavigate,
|
|
25
|
+
children
|
|
26
|
+
}: NavigationProviderProps): React$1.JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useNavigation as a, NavigationProviderProps as i, NavigationHandler as n, NavigationProvider as r, NavigationContextType as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/contexts/navigation.tsx
|
|
4
|
+
const Defaults = { basePath: "/" };
|
|
5
|
+
const NavigationContext = React$1.createContext(Defaults);
|
|
6
|
+
function useNavigation() {
|
|
7
|
+
return React$1.useContext(NavigationContext);
|
|
8
|
+
}
|
|
9
|
+
function NavigationProvider({ basePath, selectedPath, onNavigate, children }) {
|
|
10
|
+
const value = {
|
|
11
|
+
...Defaults,
|
|
12
|
+
onNavigate,
|
|
13
|
+
basePath,
|
|
14
|
+
selectedPath
|
|
15
|
+
};
|
|
16
|
+
return <NavigationContext.Provider value={value}>{children}</NavigationContext.Provider>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useNavigation as n, NavigationProvider as t };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
3
|
+
|
|
4
|
+
//#region src/components/overview.d.ts
|
|
5
|
+
type SDKResourceProps = {
|
|
6
|
+
resource: SDKJSON.Resource;
|
|
7
|
+
parents?: SDKJSON.Resource[];
|
|
8
|
+
};
|
|
9
|
+
declare function SDKResourceHeader({
|
|
10
|
+
resource,
|
|
11
|
+
parents
|
|
12
|
+
}: SDKResourceProps): React$1.JSX.Element | null;
|
|
13
|
+
type SDKMethodSummaryProps = {
|
|
14
|
+
method: SDKJSON.Method;
|
|
15
|
+
};
|
|
16
|
+
declare function SDKMethodSummary({
|
|
17
|
+
method
|
|
18
|
+
}: SDKMethodSummaryProps): React$1.JSX.Element;
|
|
19
|
+
declare function SDKResource({
|
|
20
|
+
resource,
|
|
21
|
+
parents,
|
|
22
|
+
showModels
|
|
23
|
+
}: SDKResourceProps & {
|
|
24
|
+
showModels?: boolean;
|
|
25
|
+
}): React$1.JSX.Element;
|
|
26
|
+
type SDKOverviewProps = {
|
|
27
|
+
resource: SDKJSON.Resource;
|
|
28
|
+
};
|
|
29
|
+
declare function SDKOverview({
|
|
30
|
+
resource
|
|
31
|
+
}: SDKOverviewProps): React$1.JSX.Element;
|
|
32
|
+
type SDKRootProps = {
|
|
33
|
+
stainlessPath: string;
|
|
34
|
+
};
|
|
35
|
+
declare function SDKRoot({
|
|
36
|
+
stainlessPath
|
|
37
|
+
}: SDKRootProps): React$1.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,15 @@
|
|
|
1
|
+
//#region src/search/providers/pagefind.ts
|
|
2
|
+
async function loadPagefind(path) {
|
|
3
|
+
return await import(new URL(path, import.meta.url).href);
|
|
4
|
+
}
|
|
5
|
+
async function guideSearch(loadPath, query, limit) {
|
|
6
|
+
const response = await (await loadPagefind(loadPath)).search(query);
|
|
7
|
+
const items = limit ? response.results.slice(0, limit) : response.results;
|
|
8
|
+
return Promise.all(items.map((result) => result.data().then((data) => ({
|
|
9
|
+
...result,
|
|
10
|
+
data
|
|
11
|
+
}))));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { guideSearch as t };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives.d.ts
|
|
5
|
+
type JoinProps = {
|
|
6
|
+
items: ReactNode[];
|
|
7
|
+
limit?: number;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare function Join({
|
|
11
|
+
items,
|
|
12
|
+
limit,
|
|
13
|
+
children
|
|
14
|
+
}: JoinProps): React$1.JSX.Element[];
|
|
15
|
+
type ExpanderProps = {
|
|
16
|
+
id?: string;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
summary: ReactNode;
|
|
19
|
+
virtual?: boolean;
|
|
20
|
+
muted?: boolean;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
declare function Expander({
|
|
24
|
+
id,
|
|
25
|
+
open,
|
|
26
|
+
summary,
|
|
27
|
+
virtual,
|
|
28
|
+
muted,
|
|
29
|
+
children
|
|
30
|
+
}: ExpanderProps): React$1.JSX.Element;
|
|
31
|
+
declare function VirtualExpander({
|
|
32
|
+
id,
|
|
33
|
+
open: isOpen,
|
|
34
|
+
muted,
|
|
35
|
+
summary,
|
|
36
|
+
children
|
|
37
|
+
}: Omit<ExpanderProps, 'virtual'>): React$1.JSX.Element;
|
|
38
|
+
declare function Markdown({
|
|
39
|
+
content
|
|
40
|
+
}: {
|
|
41
|
+
content: string;
|
|
42
|
+
}): "" | React$1.JSX.Element | undefined;
|
|
43
|
+
type BadgeProps = {
|
|
44
|
+
id: string;
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
declare function Badge({
|
|
48
|
+
id,
|
|
49
|
+
children
|
|
50
|
+
}: BadgeProps): React$1.JSX.Element;
|
|
51
|
+
type TooltipProps = {
|
|
52
|
+
content: ReactNode;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
};
|
|
55
|
+
declare function Tooltip({
|
|
56
|
+
content,
|
|
57
|
+
children
|
|
58
|
+
}: TooltipProps): 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$1.JSX.Element | null | undefined;
|
|
59
|
+
type LinkProps = {
|
|
60
|
+
stainlessPath: string;
|
|
61
|
+
scroll?: boolean;
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
} & React$1.HTMLProps<HTMLAnchorElement>;
|
|
64
|
+
declare function Link({
|
|
65
|
+
stainlessPath,
|
|
66
|
+
scroll,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}: LinkProps): 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$1.JSX.Element | null | undefined;
|
|
70
|
+
type InputProps = {
|
|
71
|
+
left?: ReactNode;
|
|
72
|
+
right?: ReactNode;
|
|
73
|
+
} & React$1.InputHTMLAttributes<HTMLInputElement>;
|
|
74
|
+
declare const Input: React$1.ForwardRefExoticComponent<{
|
|
75
|
+
left?: ReactNode;
|
|
76
|
+
right?: ReactNode;
|
|
77
|
+
} & React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
|
|
78
|
+
type ToggleButtonProps = {
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
selected?: boolean;
|
|
81
|
+
} & React$1.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
82
|
+
declare const ToggleButton: React$1.ForwardRefExoticComponent<{
|
|
83
|
+
children?: ReactNode;
|
|
84
|
+
selected?: boolean;
|
|
85
|
+
} & React$1.ButtonHTMLAttributes<HTMLButtonElement> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
86
|
+
type ListViewProps<TItem> = {
|
|
87
|
+
items: Array<TItem>;
|
|
88
|
+
itemDelegate: (item: TItem, selected: boolean) => React$1.ReactNode;
|
|
89
|
+
onSelectListItem?: (item: TItem) => void;
|
|
90
|
+
} & React$1.HTMLAttributes<HTMLDivElement>;
|
|
91
|
+
declare function ListView<TItem>({
|
|
92
|
+
items,
|
|
93
|
+
itemDelegate,
|
|
94
|
+
onSelectListItem,
|
|
95
|
+
...rest
|
|
96
|
+
}: ListViewProps<TItem>): React$1.JSX.Element;
|
|
97
|
+
//#endregion
|
|
98
|
+
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,46 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/properties.d.ts
|
|
5
|
+
type PropertyToggleProps = {
|
|
6
|
+
target: string;
|
|
7
|
+
};
|
|
8
|
+
declare function PropertyToggle({
|
|
9
|
+
target
|
|
10
|
+
}: PropertyToggleProps): react0.JSX.Element;
|
|
11
|
+
type PropertyDescriptionProps = {
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
declare function PropertyDescription({
|
|
15
|
+
description
|
|
16
|
+
}: PropertyDescriptionProps): react0.JSX.Element | undefined;
|
|
17
|
+
type PropertyProps = {
|
|
18
|
+
id?: string;
|
|
19
|
+
name?: ReactNode;
|
|
20
|
+
typeName?: ReactNode;
|
|
21
|
+
badges?: ReactNode;
|
|
22
|
+
type?: ReactNode;
|
|
23
|
+
description?: string;
|
|
24
|
+
expand?: boolean;
|
|
25
|
+
deprecated?: boolean | string;
|
|
26
|
+
additional?: ReactNode;
|
|
27
|
+
declaration?: ReactNode;
|
|
28
|
+
constraints?: ReactNode;
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
declare function Property({
|
|
32
|
+
id,
|
|
33
|
+
name,
|
|
34
|
+
typeName,
|
|
35
|
+
badges,
|
|
36
|
+
type,
|
|
37
|
+
declaration,
|
|
38
|
+
description,
|
|
39
|
+
deprecated,
|
|
40
|
+
expand,
|
|
41
|
+
additional,
|
|
42
|
+
constraints,
|
|
43
|
+
children
|
|
44
|
+
}: PropertyProps): react0.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { PropertyToggle as a, PropertyProps as i, PropertyDescription as n, PropertyToggleProps as o, PropertyDescriptionProps as r, Property as t };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
2
|
+
|
|
3
|
+
//#region src/routing.d.ts
|
|
4
|
+
declare namespace routing_d_exports {
|
|
5
|
+
export { DocsLanguage, LanguageNames, Languages, ParsedStainlessPath, RouteEntry, SpecTreeEntry, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
|
|
6
|
+
}
|
|
7
|
+
declare const Languages: readonly ["http", "node", "python", "go", "typescript", "terraform", "ruby", "java", "kotlin"];
|
|
8
|
+
declare const SupportedLanguageSyntaxes: string[];
|
|
9
|
+
type DocsLanguage = (typeof Languages)[number];
|
|
10
|
+
declare const LanguageNames: Record<DocsLanguage, string>;
|
|
11
|
+
declare function getLanguageSnippet(language: DocsLanguage): "node.default" | "go.default" | "python.default" | "terraform.default" | "http.curl" | "typescript.default" | "ruby.default" | "java.default" | "kotlin.default";
|
|
12
|
+
declare function isSupportedLanguage(language: string): language is DocsLanguage;
|
|
13
|
+
type ParsedStainlessPath = ReturnType<typeof parseStainlessPath>;
|
|
14
|
+
declare function parseStainlessPath(stainlessPath: string): {
|
|
15
|
+
resource: string[] | null;
|
|
16
|
+
method: string | null;
|
|
17
|
+
model: string | null;
|
|
18
|
+
routable: string | undefined;
|
|
19
|
+
} | null;
|
|
20
|
+
declare function trimStainlessPath(stainlessPath: string): string;
|
|
21
|
+
declare function getResource(stainlessPath: string): string | undefined;
|
|
22
|
+
declare function parseRoute(basePath: string, route: string): {
|
|
23
|
+
stainlessPath: string;
|
|
24
|
+
language: DocsLanguage;
|
|
25
|
+
};
|
|
26
|
+
declare function generateRoute(basePath: string, language: string, stainlessPath: string): string | null;
|
|
27
|
+
type SpecTreeEntry = {
|
|
28
|
+
data: SDKJSON.Method | SDKJSON.Resource | SDKJSON.Model;
|
|
29
|
+
path: string[];
|
|
30
|
+
};
|
|
31
|
+
declare function walkTree(spec: SDKJSON.Spec, includeModels?: boolean): Generator<SpecTreeEntry, void, any>;
|
|
32
|
+
type RouteEntry = {
|
|
33
|
+
title: string;
|
|
34
|
+
kind: SpecTreeEntry['data']['kind'];
|
|
35
|
+
language: DocsLanguage;
|
|
36
|
+
stainlessPath: string;
|
|
37
|
+
slug: string;
|
|
38
|
+
};
|
|
39
|
+
declare function generateRouteList({
|
|
40
|
+
spec,
|
|
41
|
+
languages,
|
|
42
|
+
excludeLanguages
|
|
43
|
+
}: {
|
|
44
|
+
spec: SDKJSON.Spec;
|
|
45
|
+
languages?: DocsLanguage[];
|
|
46
|
+
excludeLanguages?: DocsLanguage[];
|
|
47
|
+
}): RouteEntry[];
|
|
48
|
+
type ResourceOrMethod = SDKJSON.Resource | SDKJSON.Method;
|
|
49
|
+
declare function findNavigationPath(items: ResourceOrMethod[], target: string): string[] | undefined;
|
|
50
|
+
declare function expandToElement(el: HTMLElement | null): void;
|
|
51
|
+
declare function scrollToPath(stainlessPath: string): void;
|
|
52
|
+
declare function updateHistory(basePath: string, language: DocsLanguage, stainlessPath: string): void;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { routing_d_exports as _, RouteEntry as a, updateHistory as b, expandToElement as c, generateRouteList as d, getLanguageSnippet as f, parseStainlessPath as g, parseRoute as h, ParsedStainlessPath as i, findNavigationPath as l, isSupportedLanguage as m, LanguageNames as n, SpecTreeEntry as o, getResource as p, Languages as r, SupportedLanguageSyntaxes as s, DocsLanguage as t, generateRoute as u, scrollToPath as v, walkTree as x, trimStainlessPath as y };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-Bp6m_JJh.js";
|
|
2
|
+
|
|
3
|
+
//#region src/routing.ts
|
|
4
|
+
var routing_exports = /* @__PURE__ */ __export({
|
|
5
|
+
LanguageNames: () => LanguageNames,
|
|
6
|
+
Languages: () => Languages,
|
|
7
|
+
SupportedLanguageSyntaxes: () => SupportedLanguageSyntaxes,
|
|
8
|
+
expandToElement: () => expandToElement,
|
|
9
|
+
findNavigationPath: () => findNavigationPath,
|
|
10
|
+
generateRoute: () => generateRoute,
|
|
11
|
+
generateRouteList: () => generateRouteList,
|
|
12
|
+
getLanguageSnippet: () => getLanguageSnippet,
|
|
13
|
+
getResource: () => getResource,
|
|
14
|
+
isSupportedLanguage: () => isSupportedLanguage,
|
|
15
|
+
parseRoute: () => parseRoute,
|
|
16
|
+
parseStainlessPath: () => parseStainlessPath,
|
|
17
|
+
scrollToPath: () => scrollToPath,
|
|
18
|
+
trimStainlessPath: () => trimStainlessPath,
|
|
19
|
+
updateHistory: () => updateHistory,
|
|
20
|
+
walkTree: () => walkTree
|
|
21
|
+
});
|
|
22
|
+
const Languages = [
|
|
23
|
+
"http",
|
|
24
|
+
"node",
|
|
25
|
+
"python",
|
|
26
|
+
"go",
|
|
27
|
+
"typescript",
|
|
28
|
+
"terraform",
|
|
29
|
+
"ruby",
|
|
30
|
+
"java",
|
|
31
|
+
"kotlin"
|
|
32
|
+
];
|
|
33
|
+
const SupportedLanguageSyntaxes = [
|
|
34
|
+
"http",
|
|
35
|
+
"javascript",
|
|
36
|
+
"python",
|
|
37
|
+
"go",
|
|
38
|
+
"typescript",
|
|
39
|
+
"terraform",
|
|
40
|
+
"ruby",
|
|
41
|
+
"java",
|
|
42
|
+
"kotlin"
|
|
43
|
+
];
|
|
44
|
+
const LanguageNames = {
|
|
45
|
+
http: "HTTP",
|
|
46
|
+
node: "TypeScript",
|
|
47
|
+
typescript: "TypeScript",
|
|
48
|
+
python: "Python",
|
|
49
|
+
go: "Go",
|
|
50
|
+
ruby: "Ruby",
|
|
51
|
+
java: "Java",
|
|
52
|
+
kotlin: "Kotlin",
|
|
53
|
+
terraform: "Terraform"
|
|
54
|
+
};
|
|
55
|
+
function getLanguageSnippet(language) {
|
|
56
|
+
return language === "http" ? "http.curl" : `${language}.default`;
|
|
57
|
+
}
|
|
58
|
+
function isSupportedLanguage(language) {
|
|
59
|
+
return Languages.includes(language);
|
|
60
|
+
}
|
|
61
|
+
const DefaultLanguage = "http";
|
|
62
|
+
const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
|
|
63
|
+
function parseStainlessPath(stainlessPath) {
|
|
64
|
+
const match = stainlessPath.match(StainlessPathPattern);
|
|
65
|
+
if (!match?.groups) return null;
|
|
66
|
+
return {
|
|
67
|
+
resource: match.groups.resource?.split(".") ?? null,
|
|
68
|
+
method: match.groups.method ?? null,
|
|
69
|
+
model: match.groups.model ?? null,
|
|
70
|
+
routable: match.groups.model ? match[1] : match[0]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function trimStainlessPath(stainlessPath) {
|
|
74
|
+
return stainlessPath.replace(/ > \([^\s]+\)$/, "");
|
|
75
|
+
}
|
|
76
|
+
function getResource(stainlessPath) {
|
|
77
|
+
return parseStainlessPath(stainlessPath)?.resource?.[0];
|
|
78
|
+
}
|
|
79
|
+
function parseRoute(basePath, route) {
|
|
80
|
+
if (!route.startsWith(basePath)) return {
|
|
81
|
+
stainlessPath: "",
|
|
82
|
+
language: DefaultLanguage
|
|
83
|
+
};
|
|
84
|
+
if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
|
|
85
|
+
let stainlessPath = "";
|
|
86
|
+
let elements = route.slice(1).split("/");
|
|
87
|
+
let language = DefaultLanguage;
|
|
88
|
+
if (elements[0] && Languages.includes(elements[0])) {
|
|
89
|
+
language = elements[0];
|
|
90
|
+
elements = elements.slice(1);
|
|
91
|
+
}
|
|
92
|
+
while (elements.length > 0) switch (elements.shift()) {
|
|
93
|
+
case "resources":
|
|
94
|
+
stainlessPath += `(resource) ${elements.shift()}`;
|
|
95
|
+
break;
|
|
96
|
+
case "subresources":
|
|
97
|
+
stainlessPath += `.${elements.shift()}`;
|
|
98
|
+
break;
|
|
99
|
+
case "methods":
|
|
100
|
+
stainlessPath += ` > (method) ${elements.shift()}`;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
stainlessPath,
|
|
105
|
+
language
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function generateRoute(basePath, language, stainlessPath) {
|
|
109
|
+
const parsedPath = parseStainlessPath(stainlessPath);
|
|
110
|
+
if (!parsedPath) return null;
|
|
111
|
+
const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
|
|
112
|
+
if (language && language !== DefaultLanguage) path.push(language);
|
|
113
|
+
const resources = parsedPath.resource.flatMap((name, index) => [index > 0 ? "subresources" : "resources", name]);
|
|
114
|
+
const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
|
|
115
|
+
path.push(...resourcePath);
|
|
116
|
+
if (parsedPath.method) path.push("methods", parsedPath.method);
|
|
117
|
+
return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
|
|
118
|
+
}
|
|
119
|
+
function* walkResource(resource, path, includeModels) {
|
|
120
|
+
yield {
|
|
121
|
+
data: resource,
|
|
122
|
+
path
|
|
123
|
+
};
|
|
124
|
+
for (const data of Object.values(resource.methods)) yield {
|
|
125
|
+
data,
|
|
126
|
+
path: [
|
|
127
|
+
...path,
|
|
128
|
+
"methods",
|
|
129
|
+
data.name
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
if (includeModels) for (const data of Object.values(resource.models)) yield {
|
|
133
|
+
data,
|
|
134
|
+
path: [
|
|
135
|
+
...path,
|
|
136
|
+
"models",
|
|
137
|
+
data.name
|
|
138
|
+
]
|
|
139
|
+
};
|
|
140
|
+
for (const data of Object.values(resource.subresources ?? {})) yield* walkResource(data, [
|
|
141
|
+
...path,
|
|
142
|
+
"subresources",
|
|
143
|
+
data.name
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
146
|
+
function* walkTree(spec, includeModels) {
|
|
147
|
+
for (const data of Object.values(spec.resources)) yield* walkResource(data, ["resources", data.name], includeModels);
|
|
148
|
+
}
|
|
149
|
+
function generateRouteList({ spec, languages, excludeLanguages = [] }) {
|
|
150
|
+
const entries = Array.from(walkTree(spec));
|
|
151
|
+
return (languages ?? spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang) && lang !== "terraform").filter((lang) => !excludeLanguages?.includes(lang)).flatMap((language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
|
|
152
|
+
title,
|
|
153
|
+
kind,
|
|
154
|
+
language,
|
|
155
|
+
stainlessPath,
|
|
156
|
+
slug: (language === "http" ? path : [language, ...path]).join("/")
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
function findNavigationPath(items, target) {
|
|
160
|
+
for (const item of Object.values(items)) {
|
|
161
|
+
if (item.stainlessPath === target) return [item.stainlessPath];
|
|
162
|
+
if (item.kind === "http_method") continue;
|
|
163
|
+
const path = findNavigationPath([...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})], target);
|
|
164
|
+
if (path) return [item.stainlessPath, ...path];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function expandToElement(el) {
|
|
168
|
+
while (el) {
|
|
169
|
+
if (el instanceof HTMLDetailsElement) el.open = true;
|
|
170
|
+
el = el.parentElement;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function scrollToPath(stainlessPath) {
|
|
174
|
+
const el = document.getElementById(stainlessPath);
|
|
175
|
+
if (el) {
|
|
176
|
+
expandToElement(el);
|
|
177
|
+
el.scrollIntoView({ behavior: "smooth" });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function updateHistory(basePath, language, stainlessPath) {
|
|
181
|
+
const path = generateRoute(basePath, language, stainlessPath);
|
|
182
|
+
window.history.pushState({
|
|
183
|
+
stainlessPath,
|
|
184
|
+
language
|
|
185
|
+
}, "", path);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
export { walkTree as _, findNavigationPath as a, getLanguageSnippet as c, parseRoute as d, parseStainlessPath as f, updateHistory as g, trimStainlessPath as h, expandToElement as i, getResource as l, scrollToPath as m, Languages as n, generateRoute as o, routing_exports as p, SupportedLanguageSyntaxes as r, generateRouteList as s, LanguageNames as t, isSupportedLanguage as u };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as RouteEntry, b as updateHistory, c as expandToElement, d as generateRouteList, f as getLanguageSnippet, g as parseStainlessPath, h as parseRoute, i as ParsedStainlessPath, l as findNavigationPath, m as isSupportedLanguage, n as LanguageNames, o as SpecTreeEntry, p as getResource, r as Languages, s as SupportedLanguageSyntaxes, t as DocsLanguage, u as generateRoute, v as scrollToPath, x as walkTree, y as trimStainlessPath } from "./routing-BE6Vrs-z.js";
|
|
2
|
+
export { DocsLanguage, LanguageNames, Languages, ParsedStainlessPath, RouteEntry, SpecTreeEntry, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
|