@stainless-api/docs-ui 0.1.0-beta.73 → 0.1.0-beta.75
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/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
- package/dist/components/MaskedInput.d.ts +3 -3
- package/dist/components/MaskedInput.js +1 -1
- package/dist/components/breadcrumbs.d.ts +24 -1
- package/dist/components/breadcrumbs.js +62 -7
- package/dist/components/icons.d.ts +18 -13
- package/dist/components/icons.js +940 -2
- package/dist/components/index.d.ts +16 -14
- package/dist/components/index.js +72 -18
- package/dist/components/method.d.ts +58 -1
- package/dist/components/method.js +95 -8
- package/dist/components/overview.d.ts +38 -1
- package/dist/components/overview.js +137 -9
- package/dist/components/primitives.d.ts +104 -1
- package/dist/components/primitives.js +250 -6
- package/dist/components/properties.d.ts +53 -1
- package/dist/components/properties.js +138 -7
- package/dist/components/sdk-sidebar.d.ts +14 -1
- package/dist/components/sdk-sidebar.js +50 -8
- package/dist/components/sdk.d.ts +121 -1
- package/dist/components/sdk.js +405 -8
- package/dist/components/snippets.d.ts +70 -13
- package/dist/components/snippets.js +182 -7
- package/dist/components/stl-sidebar.d.ts +57 -1
- package/dist/components/stl-sidebar.js +105 -3
- package/dist/contexts/component-generics.d.ts +29 -1
- package/dist/contexts/component-generics.js +31 -1
- package/dist/contexts/component-types.d.ts +4 -15
- package/dist/contexts/component.d.ts +7 -17
- package/dist/contexts/component.js +22 -28
- package/dist/contexts/docs.d.ts +61 -1
- package/dist/contexts/docs.js +89 -1
- package/dist/contexts/index.d.ts +13 -14
- package/dist/contexts/index.js +44 -6
- package/dist/contexts/markdown.d.ts +21 -1
- package/dist/contexts/markdown.js +47 -2
- package/dist/contexts/navigation.d.ts +28 -1
- package/dist/contexts/navigation.js +22 -1
- package/dist/contexts/use-components.d.ts +1 -13
- package/dist/contexts/use-components.js +6 -2
- package/dist/{index-HDt5wRiR.d.ts → index-Cl6Gny0o.d.ts} +37 -2
- package/dist/index.d.ts +4 -14
- package/dist/index.js +7 -30
- package/dist/languages/cli.d.ts +38 -14
- package/dist/languages/cli.js +166 -20
- package/dist/languages/csharp.d.ts +42 -14
- package/dist/languages/csharp.js +283 -8
- package/dist/languages/go.d.ts +40 -14
- package/dist/languages/go.js +303 -8
- package/dist/languages/http.d.ts +46 -14
- package/dist/languages/http.js +390 -19
- package/dist/languages/index.d.ts +51 -14
- package/dist/languages/index.js +32 -28
- package/dist/languages/java.d.ts +43 -14
- package/dist/languages/java.js +403 -8
- package/dist/languages/php.d.ts +40 -0
- package/dist/languages/php.js +313 -0
- package/dist/languages/python.d.ts +40 -14
- package/dist/languages/python.js +269 -8
- package/dist/languages/ruby.d.ts +40 -14
- package/dist/languages/ruby.js +387 -8
- package/dist/languages/terraform.d.ts +48 -14
- package/dist/languages/terraform.js +243 -8
- package/dist/languages/typescript.d.ts +40 -14
- package/dist/languages/typescript.js +449 -8
- package/dist/markdown/index.d.ts +1 -2
- package/dist/markdown/index.js +1 -28
- package/dist/markdown/printer.d.ts +2 -2
- package/dist/markdown/printer.js +6 -30
- package/dist/markdown/utils.d.ts +3 -3
- package/dist/routing.d.ts +61 -2
- package/dist/routing.js +205 -2
- package/dist/spec.d.ts +2 -2
- package/dist/spec.js +2 -2
- package/dist/style.js +176 -1
- package/dist/use-strict-context-L0c8JKg4.js +16 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +53 -2
- package/package.json +3 -3
- package/dist/breadcrumbs-Dei_5sHd.d.ts +0 -25
- package/dist/breadcrumbs-oUp-6oJK.js +0 -63
- package/dist/cli-BX9ofVCR.js +0 -166
- package/dist/component-Dl5ZEHxB.js +0 -23
- package/dist/component-generics-C9ALAcZI.d.ts +0 -30
- package/dist/component-generics-POFirVVb.js +0 -45
- package/dist/components-DQPlXEwE.js +0 -72
- package/dist/contexts-_NNW5yqC.js +0 -44
- package/dist/csharp-sn5CJu9t.js +0 -283
- package/dist/docs-YgoQ3bzY.js +0 -81
- package/dist/docs-x-kfjRMc.d.ts +0 -66
- package/dist/go-BoaAVmP0.js +0 -303
- package/dist/http-Ccj1dOvE.js +0 -389
- package/dist/icons-BYKn5X8E.js +0 -885
- package/dist/index-OCM-LZIo.d.ts +0 -428
- package/dist/java-BiLRuLuD.js +0 -403
- package/dist/languages-COjc0Nwx.js +0 -30
- package/dist/markdown-BszOPZhh.d.ts +0 -22
- package/dist/markdown-Cq3XEhrR.js +0 -49
- package/dist/method-DjzVBzZe.js +0 -96
- package/dist/method-KkWyhvKa.d.ts +0 -59
- package/dist/navigation-BZjwfN2P.d.ts +0 -29
- package/dist/navigation-aoYZ_tl4.js +0 -24
- package/dist/overview-BNmMeDUE.d.ts +0 -39
- package/dist/overview-Clq5psZe.js +0 -138
- package/dist/primitives-B8OnSXRP.d.ts +0 -105
- package/dist/primitives-BBUs_flm.js +0 -250
- package/dist/properties-BhlRtWo4.d.ts +0 -54
- package/dist/properties-DQU0NBzb.js +0 -138
- package/dist/python-nqOBH7GS.js +0 -269
- package/dist/routing-GvhEMw6E.js +0 -205
- package/dist/routing-qJMPICGo.d.ts +0 -61
- package/dist/ruby-BBc8HdIt.js +0 -387
- package/dist/sdk-C8C6IRQp.d.ts +0 -122
- package/dist/sdk-DzCHhEoX.js +0 -405
- package/dist/sdk-sidebar-CkjSLggl.js +0 -50
- package/dist/sdk-sidebar-lgNmf-ns.d.ts +0 -15
- package/dist/snippets-CLpNVNlA.js +0 -181
- package/dist/stl-sidebar-8jF9cdnn.d.ts +0 -58
- package/dist/stl-sidebar-DC5UOJiT.js +0 -106
- package/dist/style-DJIYkFhO.js +0 -178
- package/dist/terraform-DVx2ea2h.js +0 -243
- package/dist/typescript-Cmk-jBBw.js +0 -449
- package/dist/use-components-BUz3GbO4.js +0 -7
- package/dist/utils-D6zJxUZ9.js +0 -54
|
@@ -1,9 +1,184 @@
|
|
|
1
|
-
import "../docs
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../contexts-
|
|
6
|
-
import "../
|
|
7
|
-
import
|
|
1
|
+
import { useDeclaration, useLanguage, useSnippet, useSnippetIds, useSnippetResponse } from "../contexts/docs.js";
|
|
2
|
+
import "../use-strict-context-L0c8JKg4.js";
|
|
3
|
+
import { useHighlight } from "../contexts/markdown.js";
|
|
4
|
+
import "../contexts/index.js";
|
|
5
|
+
import { useComponents } from "../contexts/use-components.js";
|
|
6
|
+
import style_default from "../style.js";
|
|
7
|
+
import * as React$1 from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { CheckIcon, CircleAlertIcon, CopyIcon } from "lucide-react";
|
|
11
|
+
import { Badge, Button, getHttpMethod } from "@stainless-api/ui-primitives";
|
|
8
12
|
|
|
13
|
+
//#region src/components/snippets.tsx
|
|
14
|
+
function SnippetCode({ content, language }) {
|
|
15
|
+
const lang = useLanguage();
|
|
16
|
+
const highlighted = useHighlight(content, language || lang);
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: style_default.SnippetCode,
|
|
19
|
+
"data-stldocs-copy-content": true,
|
|
20
|
+
dangerouslySetInnerHTML: { __html: highlighted }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function SnippetContainer({ children, className, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: clsx(style_default.Snippet, className),
|
|
26
|
+
...props,
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function SnippetRequestContainer({ children }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { children });
|
|
32
|
+
}
|
|
33
|
+
function Snippet({ requestTitle, method, snippet, transformRequestSnippet }) {
|
|
34
|
+
const Docs = useComponents();
|
|
35
|
+
const language = useLanguage();
|
|
36
|
+
const originalSnippetContent = useSnippet(method.stainlessPath, void 0, snippet);
|
|
37
|
+
const snippetResponses = useSnippetResponse(method.stainlessPath, snippet);
|
|
38
|
+
const decl = useDeclaration(method.stainlessPath, false);
|
|
39
|
+
const signature = decl && "qualified" in decl ? decl.qualified : void 0;
|
|
40
|
+
if (!originalSnippetContent) {
|
|
41
|
+
console.warn(`Snippet not found for method '${method.stainlessPath}'`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const snippetContent = transformRequestSnippet ? transformRequestSnippet({
|
|
45
|
+
snippet: originalSnippetContent,
|
|
46
|
+
language
|
|
47
|
+
}) : originalSnippetContent;
|
|
48
|
+
const httpMethod = getHttpMethod(method.httpMethod);
|
|
49
|
+
return /* @__PURE__ */ jsxs(Docs.SnippetContainer, {
|
|
50
|
+
signature,
|
|
51
|
+
method,
|
|
52
|
+
children: [snippetContent && /* @__PURE__ */ jsx(Docs.SnippetRequestContainer, {
|
|
53
|
+
signature,
|
|
54
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: style_default.SnippetRequest,
|
|
56
|
+
"data-stldocs-copy-parent": true,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: style_default.SnippetRequestTitle,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: style_default.SnippetRequestTitleMethod,
|
|
63
|
+
children: [httpMethod && /* @__PURE__ */ jsx(Badge.HTTP, {
|
|
64
|
+
method: httpMethod,
|
|
65
|
+
iconOnly: true
|
|
66
|
+
}), /* @__PURE__ */ jsx("h3", { children: method.summary || method.title })]
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: style_default.SnippetRequestTitleContent,
|
|
70
|
+
children: requestTitle
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(Docs.SnippetButtons, { content: snippetContent })
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ jsx(Docs.SnippetCode, {
|
|
76
|
+
content: snippetContent,
|
|
77
|
+
signature
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx(Docs.SnippetFooter, {})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
}), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: snippetResponses })]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function MultiSnippets({ requestTitle, method }) {
|
|
86
|
+
const snippetIds = useSnippetIds(method.stainlessPath)?.filter((id) => id !== "default");
|
|
87
|
+
const radioId = React$1.useId();
|
|
88
|
+
const Docs = useComponents();
|
|
89
|
+
if (!snippetIds) return null;
|
|
90
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
91
|
+
className: style_default.SnippetMulti,
|
|
92
|
+
"data-stldocs-multi-snippet-container": true,
|
|
93
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: style_default.SnippetMultiTabs,
|
|
95
|
+
"data-stldocs-multi-snippet-tabs": true,
|
|
96
|
+
children: snippetIds.map((snid, idx) => /* @__PURE__ */ jsxs("label", {
|
|
97
|
+
className: style_default.SnippetMultiTab,
|
|
98
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
99
|
+
type: "radio",
|
|
100
|
+
name: `snippet-example-radio-${radioId}`,
|
|
101
|
+
value: idx,
|
|
102
|
+
defaultChecked: idx === 0
|
|
103
|
+
}), /* @__PURE__ */ jsx("span", { children: snid.slice(7) })]
|
|
104
|
+
}, `snippet-example-${idx}`))
|
|
105
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: style_default.SnippetMultiContent,
|
|
107
|
+
children: snippetIds.map((snid, idx) => {
|
|
108
|
+
return /* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: clsx(style_default.SnippetMultiPane, idx === 0 && style_default.SnippetMultiPaneActive),
|
|
110
|
+
"data-stldocs-multi-snippet-id": idx,
|
|
111
|
+
children: /* @__PURE__ */ jsx(Docs.Snippet, {
|
|
112
|
+
method,
|
|
113
|
+
snippet: snid,
|
|
114
|
+
requestTitle
|
|
115
|
+
})
|
|
116
|
+
}, `snippet-example-content-${idx}`);
|
|
117
|
+
})
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function SnippetButtons({ content }) {
|
|
122
|
+
const [CopyButtonIcon, setCopyIcon] = React$1.useState(CopyIcon);
|
|
123
|
+
async function handleCopy() {
|
|
124
|
+
try {
|
|
125
|
+
await navigator.clipboard.writeText(content);
|
|
126
|
+
setCopyIcon(CheckIcon);
|
|
127
|
+
} catch {
|
|
128
|
+
setCopyIcon(CircleAlertIcon);
|
|
129
|
+
}
|
|
130
|
+
setTimeout(() => setCopyIcon(CopyIcon), 1e3);
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
133
|
+
variant: "outline",
|
|
134
|
+
"data-stldocs-snippet-copy": true,
|
|
135
|
+
children: /* @__PURE__ */ jsx(CopyButtonIcon, {
|
|
136
|
+
size: 16,
|
|
137
|
+
className: style_default.Icon,
|
|
138
|
+
onClick: handleCopy
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function SnippetFooter() {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
function SnippetResponse({ responses }) {
|
|
146
|
+
const Docs = useComponents();
|
|
147
|
+
if (!responses || responses.length === 0) return null;
|
|
148
|
+
const tabs = responses.map(({ status }, index) => ({
|
|
149
|
+
status,
|
|
150
|
+
index,
|
|
151
|
+
label: status ? `${status} example` : null
|
|
152
|
+
}));
|
|
153
|
+
const hasTabs = tabs.length > 1 || tabs.some((tab) => tab.label);
|
|
154
|
+
return /* @__PURE__ */ jsx("div", {
|
|
155
|
+
className: style_default.SnippetMultiResponse,
|
|
156
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
157
|
+
className: clsx(style_default.Snippet),
|
|
158
|
+
children: [hasTabs && /* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: clsx(style_default.SnippetResponseTab, tabs.length === 1 && style_default.SnippetResponseTabSingleReturn),
|
|
160
|
+
children: tabs.map(({ status, label }, index) => /* @__PURE__ */ jsx("div", {
|
|
161
|
+
"data-snippet-response-tab-id": `snippet-response-tab-${status}-${index}`,
|
|
162
|
+
className: clsx(style_default.SnippetResponseTabItem, index === 0 && style_default.SnippetResponseTabItemActive),
|
|
163
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
164
|
+
disabled: responses.length === 1,
|
|
165
|
+
variant: "ghost",
|
|
166
|
+
children: label ?? `Example ${index + 1}`
|
|
167
|
+
})
|
|
168
|
+
}, `snippet-response-tab-item-${status}-${index}`))
|
|
169
|
+
}), responses.map(({ status, content, contentType }, index) => {
|
|
170
|
+
return typeof content === "string" ? /* @__PURE__ */ jsx("div", {
|
|
171
|
+
className: clsx(style_default.SnippetResponsePane, index === 0 && style_default.SnippetResponsePaneActive),
|
|
172
|
+
"data-snippet-response-pane-id": `snippet-response-tab-${status}-${index}`,
|
|
173
|
+
children: /* @__PURE__ */ jsx(Docs.SnippetCode, {
|
|
174
|
+
content,
|
|
175
|
+
language: contentType === "application/json" || !contentType ? "json" : "none"
|
|
176
|
+
})
|
|
177
|
+
}, `snippet-response-${status}-${index}`) : null;
|
|
178
|
+
})]
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
//#endregion
|
|
9
184
|
export { MultiSnippets, Snippet, SnippetButtons, SnippetCode, SnippetContainer, SnippetFooter, SnippetRequestContainer, SnippetResponse };
|
|
@@ -1,2 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/stl-sidebar.d.ts
|
|
5
|
+
declare module 'react' {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
/**
|
|
9
|
+
* Custom element defined by Starlight's <SidebarPersister>.
|
|
10
|
+
*/
|
|
11
|
+
'sl-sidebar-restore': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
type StlSidebarTarget = {
|
|
16
|
+
type: 'href';
|
|
17
|
+
href: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'stainlessPath';
|
|
20
|
+
stainlessPath: string;
|
|
21
|
+
};
|
|
22
|
+
interface StlSidebarLink {
|
|
23
|
+
type: 'link';
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
label: string;
|
|
26
|
+
/** Current sidebar item is highlighted. */
|
|
27
|
+
isCurrent?: boolean;
|
|
28
|
+
target: StlSidebarTarget;
|
|
29
|
+
/** Additional HTML attributes that will be attached to the anchor element. */
|
|
30
|
+
attrs?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
interface StlSidebarGroup {
|
|
33
|
+
type: 'group';
|
|
34
|
+
icon?: ReactNode;
|
|
35
|
+
label: string;
|
|
36
|
+
entries: Array<StlSidebarLink | StlSidebarGroup>;
|
|
37
|
+
/** Defaults to true. */
|
|
38
|
+
collapsible?: boolean;
|
|
39
|
+
collapsed?: boolean;
|
|
40
|
+
/** Current sidebar item is highlighted. */
|
|
41
|
+
isCurrent?: boolean;
|
|
42
|
+
target?: StlSidebarTarget;
|
|
43
|
+
}
|
|
44
|
+
type StlSidebarEntry = StlSidebarLink | StlSidebarGroup;
|
|
45
|
+
type StlSidebarProps = {
|
|
46
|
+
entries: StlSidebarEntry[];
|
|
47
|
+
/**
|
|
48
|
+
* If set, add <sl-sidebar-restore> custom elements (as defined by Starlight's SidebarPersister)
|
|
49
|
+
* which are used to save/restore sidebar state.
|
|
50
|
+
*/
|
|
51
|
+
withStarlightRestoration?: boolean;
|
|
52
|
+
};
|
|
53
|
+
declare function StlSidebar({
|
|
54
|
+
entries,
|
|
55
|
+
withStarlightRestoration
|
|
56
|
+
}: StlSidebarProps): react_jsx_runtime0.JSX.Element;
|
|
57
|
+
//#endregion
|
|
2
58
|
export { StlSidebar, StlSidebarEntry, StlSidebarGroup, StlSidebarLink, StlSidebarProps, StlSidebarTarget };
|
|
@@ -1,5 +1,107 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../use-components
|
|
3
|
-
import
|
|
1
|
+
import "../use-strict-context-L0c8JKg4.js";
|
|
2
|
+
import { useComponents } from "../contexts/use-components.js";
|
|
3
|
+
import style_default from "../style.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { ChevronRight } from "lucide-react";
|
|
4
7
|
|
|
8
|
+
//#region src/components/stl-sidebar.tsx
|
|
9
|
+
function targetToAttributes(target) {
|
|
10
|
+
return {
|
|
11
|
+
href: target.type === "href" ? target.href : void 0,
|
|
12
|
+
stainlessPath: target.type === "stainlessPath" ? target.stainlessPath : void 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function StlSidebarSublist({ entries, entryToIndex }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
17
|
+
className: style_default.SidebarList,
|
|
18
|
+
children: entries.map((entry, index) => entry.type === "link" ? /* @__PURE__ */ jsx(LinkEntry, { entry }, index) : /* @__PURE__ */ jsx(GroupEntry, {
|
|
19
|
+
entry,
|
|
20
|
+
entryToIndex
|
|
21
|
+
}, index))
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function EntryItem({ className, children }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("li", {
|
|
26
|
+
className: clsx(style_default.SidebarEntry, className),
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function LinkEntry({ entry }) {
|
|
31
|
+
const Docs = useComponents();
|
|
32
|
+
return /* @__PURE__ */ jsx(EntryItem, {
|
|
33
|
+
className: style_default.SidebarEntryLink,
|
|
34
|
+
children: /* @__PURE__ */ jsxs(Docs.Link, {
|
|
35
|
+
...targetToAttributes(entry.target),
|
|
36
|
+
"aria-current": entry.isCurrent ? "page" : void 0,
|
|
37
|
+
...entry.attrs,
|
|
38
|
+
children: [entry.icon, entry.label]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function GroupEntry({ entry, entryToIndex }) {
|
|
43
|
+
const Docs = useComponents();
|
|
44
|
+
const restorePointIndex = entryToIndex?.get(entry);
|
|
45
|
+
const { collapsible = true } = entry;
|
|
46
|
+
const labelWithIcon = /* @__PURE__ */ jsxs(Fragment, { children: [entry.label, entry.icon] });
|
|
47
|
+
const GroupElement = collapsible ? "details" : "div";
|
|
48
|
+
const GroupLabelElement = collapsible ? "summary" : "div";
|
|
49
|
+
return /* @__PURE__ */ jsxs(EntryItem, {
|
|
50
|
+
className: style_default.SidebarEntryGroup,
|
|
51
|
+
children: [entry.target && /* @__PURE__ */ jsx(Docs.Link, {
|
|
52
|
+
...targetToAttributes(entry.target),
|
|
53
|
+
"aria-current": entry.isCurrent ? "page" : void 0,
|
|
54
|
+
children: labelWithIcon
|
|
55
|
+
}), /* @__PURE__ */ jsxs(GroupElement, {
|
|
56
|
+
className: style_default.SidebarExpander,
|
|
57
|
+
...collapsible ? { open: flattenStlSidebar(entry.entries).some((i) => i.isCurrent) || !entry.collapsed } : {},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsxs(GroupLabelElement, {
|
|
60
|
+
className: style_default.ExpanderSummary,
|
|
61
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
+
"aria-hidden": entry.target ? "true" : void 0,
|
|
63
|
+
children: labelWithIcon
|
|
64
|
+
}), entry.entries.length > 0 && collapsible && /* @__PURE__ */ jsx(ChevronRight, {
|
|
65
|
+
size: 16,
|
|
66
|
+
strokeWidth: 1,
|
|
67
|
+
className: `${style_default.Icon} ${style_default.ExpanderSummaryIcon}`
|
|
68
|
+
})]
|
|
69
|
+
}),
|
|
70
|
+
restorePointIndex !== void 0 && /* @__PURE__ */ jsx("sl-sidebar-restore", { "data-index": restorePointIndex }),
|
|
71
|
+
entry.entries.length > 0 && /* @__PURE__ */ jsx(StlSidebarSublist, {
|
|
72
|
+
entries: entry.entries,
|
|
73
|
+
entryToIndex
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function StlSidebar({ entries, withStarlightRestoration }) {
|
|
80
|
+
const entryToIndex = withStarlightRestoration ? computeEntryToIndex(entries) : void 0;
|
|
81
|
+
return /* @__PURE__ */ jsx("div", {
|
|
82
|
+
className: `${style_default.Root} ${style_default.Sidebar}`,
|
|
83
|
+
children: /* @__PURE__ */ jsx(StlSidebarSublist, {
|
|
84
|
+
entries,
|
|
85
|
+
entryToIndex
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function computeEntryToIndex(allEntries) {
|
|
90
|
+
const entryToIndex = /* @__PURE__ */ new Map();
|
|
91
|
+
let currentIndex = 0;
|
|
92
|
+
function addEntries(entries) {
|
|
93
|
+
for (const entry of entries) if (entry.type === "group") {
|
|
94
|
+
entryToIndex.set(entry, currentIndex);
|
|
95
|
+
currentIndex++;
|
|
96
|
+
addEntries(entry.entries);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
addEntries(allEntries);
|
|
100
|
+
return entryToIndex;
|
|
101
|
+
}
|
|
102
|
+
function flattenStlSidebar(sidebar) {
|
|
103
|
+
return sidebar.flatMap((entry) => entry.type === "group" ? flattenStlSidebar(entry.entries) : entry);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
5
107
|
export { StlSidebar };
|
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/component-generics.d.ts
|
|
5
|
+
type DeepPartialMap<L> = { [K in keyof L]?: Partial<L[K]> };
|
|
6
|
+
type ComponentsContextType<C, L> = {
|
|
7
|
+
components: C;
|
|
8
|
+
language: L;
|
|
9
|
+
};
|
|
10
|
+
declare const useComponentContext: () => ComponentsContextType<any, any>;
|
|
11
|
+
declare function useComponents<C = unknown>(): C;
|
|
12
|
+
declare function customizeComponents<C, L>(defaults: {
|
|
13
|
+
components: C;
|
|
14
|
+
language: L;
|
|
15
|
+
}, overrides?: {
|
|
16
|
+
components?: Partial<C>;
|
|
17
|
+
language?: DeepPartialMap<L>;
|
|
18
|
+
}): {
|
|
19
|
+
components: C;
|
|
20
|
+
language: L;
|
|
21
|
+
};
|
|
22
|
+
declare function ComponentProvider<C, L>({
|
|
23
|
+
value,
|
|
24
|
+
children
|
|
25
|
+
}: {
|
|
26
|
+
value: ComponentsContextType<C, L>;
|
|
27
|
+
children: React$1.ReactNode;
|
|
28
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
29
|
+
//#endregion
|
|
2
30
|
export { ComponentProvider, ComponentsContextType, customizeComponents, useComponentContext, useComponents };
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as createStrictContext } from "../use-strict-context-L0c8JKg4.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
4
|
|
|
5
|
+
//#region src/contexts/component-generics.tsx
|
|
6
|
+
const [Provider, useComponentContext] = createStrictContext("Component");
|
|
7
|
+
function useComponents() {
|
|
8
|
+
return useComponentContext().components;
|
|
9
|
+
}
|
|
10
|
+
function customizeComponents(defaults, overrides = {}) {
|
|
11
|
+
return {
|
|
12
|
+
components: {
|
|
13
|
+
...defaults.components,
|
|
14
|
+
...overrides.components ?? {}
|
|
15
|
+
},
|
|
16
|
+
language: Object.keys(defaults.language).reduce((acc, key) => {
|
|
17
|
+
acc[key] = {
|
|
18
|
+
...defaults.language[key],
|
|
19
|
+
...overrides.language?.[key] ?? {}
|
|
20
|
+
};
|
|
21
|
+
return acc;
|
|
22
|
+
}, {})
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function ComponentProvider({ value, children }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
27
|
+
value,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
3
33
|
export { ComponentProvider, customizeComponents, useComponentContext, useComponents };
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import "../method-KkWyhvKa.js";
|
|
4
|
-
import "../properties-BhlRtWo4.js";
|
|
5
|
-
import "../sdk-C8C6IRQp.js";
|
|
6
|
-
import { t as index_d_exports, y as index_d_exports$1 } from "../index-OCM-LZIo.js";
|
|
7
|
-
import "../navigation-BZjwfN2P.js";
|
|
8
|
-
import "../markdown-BszOPZhh.js";
|
|
9
|
-
import "../component-generics-C9ALAcZI.js";
|
|
10
|
-
import "../docs-x-kfjRMc.js";
|
|
11
|
-
import "../overview-BNmMeDUE.js";
|
|
12
|
-
import "../sdk-sidebar-lgNmf-ns.js";
|
|
13
|
-
import "../stl-sidebar-8jF9cdnn.js";
|
|
1
|
+
import { t as index_d_exports } from "../languages/index.js";
|
|
2
|
+
import { t as index_d_exports$1 } from "../components/index.js";
|
|
14
3
|
|
|
15
4
|
//#region src/contexts/component-types.d.ts
|
|
16
|
-
type AppComponents = typeof index_d_exports;
|
|
17
|
-
type AppLanguage = typeof index_d_exports
|
|
5
|
+
type AppComponents = typeof index_d_exports$1;
|
|
6
|
+
type AppLanguage = typeof index_d_exports;
|
|
18
7
|
//#endregion
|
|
19
8
|
export { AppComponents, AppLanguage };
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "
|
|
3
|
-
import "../
|
|
4
|
-
import "../properties-BhlRtWo4.js";
|
|
5
|
-
import "../sdk-C8C6IRQp.js";
|
|
6
|
-
import { t as index_d_exports, y as index_d_exports$1 } from "../index-OCM-LZIo.js";
|
|
7
|
-
import "../navigation-BZjwfN2P.js";
|
|
8
|
-
import "../markdown-BszOPZhh.js";
|
|
9
|
-
import { n as ComponentsContextType } from "../component-generics-C9ALAcZI.js";
|
|
10
|
-
import "../docs-x-kfjRMc.js";
|
|
11
|
-
import "../overview-BNmMeDUE.js";
|
|
12
|
-
import "../sdk-sidebar-lgNmf-ns.js";
|
|
13
|
-
import "../stl-sidebar-8jF9cdnn.js";
|
|
1
|
+
import { t as index_d_exports } from "../languages/index.js";
|
|
2
|
+
import { ComponentsContextType } from "./component-generics.js";
|
|
3
|
+
import { t as index_d_exports$1 } from "../components/index.js";
|
|
14
4
|
import React from "react";
|
|
15
|
-
import * as
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
16
6
|
|
|
17
7
|
//#region src/contexts/component.d.ts
|
|
18
|
-
type AppComponents = typeof index_d_exports;
|
|
19
|
-
type AppLanguage = typeof index_d_exports
|
|
8
|
+
type AppComponents = typeof index_d_exports$1;
|
|
9
|
+
type AppLanguage = typeof index_d_exports;
|
|
20
10
|
declare const defaultContextValue: ComponentsContextType<AppComponents, AppLanguage>;
|
|
21
11
|
declare function ComponentProvider({
|
|
22
12
|
components,
|
|
@@ -26,6 +16,6 @@ declare function ComponentProvider({
|
|
|
26
16
|
components?: Partial<AppComponents>;
|
|
27
17
|
language?: { [K in keyof AppLanguage]?: Partial<AppLanguage[K]> };
|
|
28
18
|
children: React.ReactNode;
|
|
29
|
-
}):
|
|
19
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
30
20
|
//#endregion
|
|
31
21
|
export { AppComponents, AppLanguage, ComponentProvider, defaultContextValue };
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "../properties-DQU0NBzb.js";
|
|
8
|
-
import "../method-DjzVBzZe.js";
|
|
9
|
-
import "../primitives-BBUs_flm.js";
|
|
10
|
-
import "../icons-BYKn5X8E.js";
|
|
11
|
-
import "../sdk-DzCHhEoX.js";
|
|
12
|
-
import "../snippets-CLpNVNlA.js";
|
|
13
|
-
import "../overview-Clq5psZe.js";
|
|
14
|
-
import "../breadcrumbs-oUp-6oJK.js";
|
|
15
|
-
import "../stl-sidebar-DC5UOJiT.js";
|
|
16
|
-
import "../sdk-sidebar-CkjSLggl.js";
|
|
17
|
-
import "../components-DQPlXEwE.js";
|
|
18
|
-
import "../typescript-Cmk-jBBw.js";
|
|
19
|
-
import "../java-BiLRuLuD.js";
|
|
20
|
-
import "../go-BoaAVmP0.js";
|
|
21
|
-
import "../python-nqOBH7GS.js";
|
|
22
|
-
import "../ruby-BBc8HdIt.js";
|
|
23
|
-
import "../http-Ccj1dOvE.js";
|
|
24
|
-
import "../csharp-sn5CJu9t.js";
|
|
25
|
-
import "../cli-BX9ofVCR.js";
|
|
26
|
-
import "../terraform-DVx2ea2h.js";
|
|
27
|
-
import "../languages-COjc0Nwx.js";
|
|
28
|
-
import { n as defaultContextValue, t as ComponentProvider } from "../component-Dl5ZEHxB.js";
|
|
1
|
+
import "../use-strict-context-L0c8JKg4.js";
|
|
2
|
+
import { ComponentProvider as ComponentProvider$1, customizeComponents } from "./component-generics.js";
|
|
3
|
+
import { t as components_exports } from "../components/index.js";
|
|
4
|
+
import { t as languages_exports } from "../languages/index.js";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
29
7
|
|
|
8
|
+
//#region src/contexts/component.tsx
|
|
9
|
+
const defaultContextValue = {
|
|
10
|
+
components: components_exports,
|
|
11
|
+
language: languages_exports
|
|
12
|
+
};
|
|
13
|
+
function ComponentProvider({ components, language, children }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(ComponentProvider$1, {
|
|
15
|
+
value: React.useMemo(() => customizeComponents(defaultContextValue, {
|
|
16
|
+
components,
|
|
17
|
+
language
|
|
18
|
+
}), [components, language]),
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
30
24
|
export { ComponentProvider, defaultContextValue };
|
package/dist/contexts/docs.d.ts
CHANGED
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as Resource, u as LanguageDeclNodes, v as Spec, y as SpecLanguage } from "../index-Cl6Gny0o.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/contexts/docs.d.ts
|
|
6
|
+
type ContentPanelLayout = 'double-pane' | 'single-pane';
|
|
7
|
+
type PropertySettingsType = {
|
|
8
|
+
types?: 'simple' | 'rich';
|
|
9
|
+
includeModelProperties?: boolean | 'method-page';
|
|
10
|
+
collapseDescription?: boolean | 'show-first-line';
|
|
11
|
+
showTitle?: boolean;
|
|
12
|
+
expandDepth?: number;
|
|
13
|
+
};
|
|
14
|
+
type DocsContextType = {
|
|
15
|
+
language: SpecLanguage;
|
|
16
|
+
spec: Spec | null;
|
|
17
|
+
settings?: {
|
|
18
|
+
properties?: PropertySettingsType;
|
|
19
|
+
contentPanelLayout?: ContentPanelLayout;
|
|
20
|
+
virtualExpanders?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare function useDocs(): DocsContextType;
|
|
24
|
+
declare function useSpec(): Spec | null;
|
|
25
|
+
declare function useSettings(): {
|
|
26
|
+
properties?: PropertySettingsType;
|
|
27
|
+
contentPanelLayout?: ContentPanelLayout;
|
|
28
|
+
virtualExpanders?: boolean;
|
|
29
|
+
} | undefined;
|
|
30
|
+
declare function useSnippets(stainlessPath: string, language?: SpecLanguage): {
|
|
31
|
+
[key: `custom:${string}`]: {
|
|
32
|
+
content: string;
|
|
33
|
+
};
|
|
34
|
+
default: {
|
|
35
|
+
content: string;
|
|
36
|
+
};
|
|
37
|
+
} | undefined;
|
|
38
|
+
declare function useSnippetIds(stainlessPath: string, language?: SpecLanguage): SnippetId[] | undefined;
|
|
39
|
+
type SnippetId = keyof NonNullable<ReturnType<typeof useSnippets>>;
|
|
40
|
+
declare function useSnippet(stainlessPath: string, language?: SpecLanguage, snippetId?: SnippetId): string | undefined;
|
|
41
|
+
declare function useSnippetResponse(stainlessPath: string, snippetId?: SnippetId): {
|
|
42
|
+
status?: string;
|
|
43
|
+
content: string;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
type Declaration = LanguageDeclNodes[SpecLanguage];
|
|
46
|
+
declare function useDeclaration<Required extends boolean>(stainlessPath: string, required: Required, language?: SpecLanguage): (Required extends true ? never : undefined) | Declaration;
|
|
47
|
+
declare function useAvailableLanguages(stainlessPath: string): SpecLanguage[];
|
|
48
|
+
declare function useIgnoredResources(): string[];
|
|
49
|
+
declare function useResource(name: string): Resource | undefined;
|
|
50
|
+
declare function useLanguage(): "http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli";
|
|
51
|
+
declare function useContentPanelLayout(): ContentPanelLayout;
|
|
52
|
+
type DocsProviderProps = DocsContextType & {
|
|
53
|
+
children: React$1.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
declare function DocsProvider({
|
|
56
|
+
spec,
|
|
57
|
+
language,
|
|
58
|
+
settings,
|
|
59
|
+
children
|
|
60
|
+
}: DocsProviderProps): react_jsx_runtime0.JSX.Element;
|
|
61
|
+
//#endregion
|
|
2
62
|
export { ContentPanelLayout, Declaration, DocsContextType, DocsProvider, DocsProviderProps, PropertySettingsType, useAvailableLanguages, useContentPanelLayout, useDeclaration, useDocs, useIgnoredResources, useLanguage, useResource, useSettings, useSnippet, useSnippetIds, useSnippetResponse, useSnippets, useSpec };
|