@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,46 @@
|
|
|
1
|
+
import { c as LanguageDeclNodes, f as Resource, g as SpecLanguage, h as Spec } from "./index-zNpvNvtN.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime21 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;
|
|
10
|
+
collapseDescription?: boolean;
|
|
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 useSnippet(stainlessPath: string, language?: SpecLanguage, variant?: string): string | undefined;
|
|
31
|
+
type Declaration = LanguageDeclNodes[SpecLanguage];
|
|
32
|
+
declare function useDeclaration<Required extends boolean>(stainlessPath: string, required: Required, language?: SpecLanguage): (Required extends true ? never : undefined) | Declaration;
|
|
33
|
+
declare function useResource(name: string): Resource | undefined;
|
|
34
|
+
declare function useLanguage(): "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
|
|
35
|
+
declare function useContentPanelLayout(): ContentPanelLayout;
|
|
36
|
+
type DocsProviderProps = DocsContextType & {
|
|
37
|
+
children: React$1.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
declare function DocsProvider({
|
|
40
|
+
spec,
|
|
41
|
+
language,
|
|
42
|
+
settings,
|
|
43
|
+
children
|
|
44
|
+
}: DocsProviderProps): react_jsx_runtime21.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { DocsProviderProps as a, useDeclaration as c, useResource as d, useSettings as f, DocsProvider as i, useDocs as l, useSpec as m, Declaration as n, PropertySettingsType as o, useSnippet as p, DocsContextType as r, useContentPanelLayout as s, ContentPanelLayout as t, useLanguage as u };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { c as LanguageDeclNodes, f as Resource, g as SpecLanguage, h as Spec } from "./index-zNpvNvtN.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime38 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;
|
|
10
|
+
collapseDescription?: boolean;
|
|
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 useSnippet(stainlessPath: string, language?: SpecLanguage, variant?: string): string | undefined;
|
|
31
|
+
type Declaration = LanguageDeclNodes[SpecLanguage];
|
|
32
|
+
declare function useDeclaration<Required extends boolean>(stainlessPath: string, required: Required, language?: SpecLanguage): (Required extends true ? never : undefined) | Declaration;
|
|
33
|
+
declare function useResource(name: string): Resource | undefined;
|
|
34
|
+
declare function useLanguage(): "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
|
|
35
|
+
declare function useContentPanelLayout(): ContentPanelLayout;
|
|
36
|
+
type DocsProviderProps = DocsContextType & {
|
|
37
|
+
children: React$1.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
declare function DocsProvider({
|
|
40
|
+
spec,
|
|
41
|
+
language,
|
|
42
|
+
settings,
|
|
43
|
+
children
|
|
44
|
+
}: DocsProviderProps): react_jsx_runtime38.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { DocsProviderProps as a, useDeclaration as c, useResource as d, useSettings as f, DocsProvider as i, useDocs as l, useSpec as m, Declaration as n, PropertySettingsType as o, useSnippet as p, DocsContextType as r, useContentPanelLayout as s, ContentPanelLayout as t, useLanguage as u };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/docs.tsx
|
|
5
|
+
const DocsContextDefaults = {
|
|
6
|
+
settings: {},
|
|
7
|
+
language: "node",
|
|
8
|
+
spec: null
|
|
9
|
+
};
|
|
10
|
+
const DocsContext = React$1.createContext(DocsContextDefaults);
|
|
11
|
+
function useDocs() {
|
|
12
|
+
return React$1.useContext(DocsContext);
|
|
13
|
+
}
|
|
14
|
+
function useSpec() {
|
|
15
|
+
return useDocs().spec;
|
|
16
|
+
}
|
|
17
|
+
function useSettings() {
|
|
18
|
+
return useDocs().settings;
|
|
19
|
+
}
|
|
20
|
+
function useSnippet(stainlessPath, language, variant) {
|
|
21
|
+
const defaultLanguage = useLanguage();
|
|
22
|
+
const snippetLanguage = [language ?? defaultLanguage, variant ?? "default"].join(".");
|
|
23
|
+
return useSpec()?.snippets?.[snippetLanguage]?.[stainlessPath];
|
|
24
|
+
}
|
|
25
|
+
function useDeclaration(stainlessPath, required, language) {
|
|
26
|
+
const defaultLanguage = useLanguage();
|
|
27
|
+
const decl = useSpec()?.decls?.[language ?? defaultLanguage]?.[stainlessPath];
|
|
28
|
+
if (required && !decl) throw new Error(`Declaration not found for '${stainlessPath}'`);
|
|
29
|
+
return decl;
|
|
30
|
+
}
|
|
31
|
+
function useResource(name) {
|
|
32
|
+
return useSpec()?.resources?.[name];
|
|
33
|
+
}
|
|
34
|
+
function useLanguage() {
|
|
35
|
+
return useDocs().language;
|
|
36
|
+
}
|
|
37
|
+
function useContentPanelLayout() {
|
|
38
|
+
return useDocs().settings?.contentPanelLayout ?? "double-pane";
|
|
39
|
+
}
|
|
40
|
+
function DocsProvider({ spec, language, settings, children }) {
|
|
41
|
+
const value = {
|
|
42
|
+
...DocsContextDefaults,
|
|
43
|
+
spec,
|
|
44
|
+
settings: settings ?? DocsContextDefaults.settings,
|
|
45
|
+
language: language ?? DocsContextDefaults.language
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsx(DocsContext.Provider, {
|
|
48
|
+
value,
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { useLanguage as a, useSnippet as c, useDocs as i, useSpec as l, useContentPanelLayout as n, useResource as o, useDeclaration as r, useSettings as s, DocsProvider as t };
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-BN_g-Awi.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 * as React$1 from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/languages/go.tsx
|
|
9
|
+
var go_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
Declaration: () => Declaration,
|
|
11
|
+
MethodSignature: () => MethodSignature,
|
|
12
|
+
Property: () => Property,
|
|
13
|
+
Type: () => Type,
|
|
14
|
+
TypeName: () => TypeName
|
|
15
|
+
});
|
|
16
|
+
const ComplexTypes = {
|
|
17
|
+
GoTypeMap: "map",
|
|
18
|
+
GoTypeArray: "array"
|
|
19
|
+
};
|
|
20
|
+
const Keywords = {
|
|
21
|
+
GoTypeAny: "any",
|
|
22
|
+
GoTypeUnknown: "unknown",
|
|
23
|
+
GoTypeInt: "int64",
|
|
24
|
+
GoTypeFloat: "float64",
|
|
25
|
+
GoTypeBool: "bool",
|
|
26
|
+
GoTypeError: "error"
|
|
27
|
+
};
|
|
28
|
+
function isField(type) {
|
|
29
|
+
return type.kind === "GoTypeReference" && type.typeName === "param.Field";
|
|
30
|
+
}
|
|
31
|
+
function TypeName({ type }) {
|
|
32
|
+
const Lang = useLanguageComponents();
|
|
33
|
+
return isField(type) ? "field" : ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
|
|
34
|
+
}
|
|
35
|
+
function Type({ type }) {
|
|
36
|
+
const Lang = useLanguageComponents();
|
|
37
|
+
const { Join, SDKReference } = useComponents();
|
|
38
|
+
switch (type.kind) {
|
|
39
|
+
case "GoTypeReference": {
|
|
40
|
+
const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
|
|
41
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
42
|
+
className: style_default.Type,
|
|
43
|
+
children: [type.$ref ? /* @__PURE__ */ jsx(SDKReference, {
|
|
44
|
+
stainlessPath: type.$ref,
|
|
45
|
+
children: type.typeName
|
|
46
|
+
}) : type.typeName, params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: style_default.TypeBracket,
|
|
49
|
+
children: "["
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx(Join, {
|
|
52
|
+
items: params,
|
|
53
|
+
limit: 3,
|
|
54
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: style_default.TextOperator,
|
|
56
|
+
children: ", "
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: style_default.TypeBracket,
|
|
61
|
+
children: "]"
|
|
62
|
+
})
|
|
63
|
+
] }) : null]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
case "GoTypeAny":
|
|
67
|
+
case "GoTypeUnknown":
|
|
68
|
+
case "GoTypeInt":
|
|
69
|
+
case "GoTypeFloat":
|
|
70
|
+
case "GoTypeBool":
|
|
71
|
+
case "GoTypeError": return /* @__PURE__ */ jsx("span", {
|
|
72
|
+
className: style_default.Type,
|
|
73
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: style_default.TypeKeyword,
|
|
75
|
+
children: Keywords[type.kind]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
case "GoTypeString": return /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: style_default.Type,
|
|
80
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: style_default.TypeString,
|
|
82
|
+
children: "string"
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
case "GoTypeArray": return /* @__PURE__ */ jsxs("span", {
|
|
86
|
+
className: style_default.Type,
|
|
87
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
88
|
+
className: style_default.TextOperator,
|
|
89
|
+
children: "[]"
|
|
90
|
+
}), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
|
|
91
|
+
});
|
|
92
|
+
case "GoTypeStruct": return /* @__PURE__ */ jsx("span", {
|
|
93
|
+
className: style_default.Type,
|
|
94
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: style_default.TypeKeyword,
|
|
96
|
+
children: "struct{…}"
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
case "GoTypeInterface": return /* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: style_default.Type,
|
|
101
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: style_default.TypeKeyword,
|
|
103
|
+
children: "interface{…}"
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
case "GoTypeMap": return /* @__PURE__ */ jsxs("span", {
|
|
107
|
+
className: style_default.Type,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: style_default.TypeKeyword,
|
|
111
|
+
children: "map"
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("span", {
|
|
114
|
+
className: style_default.TypeBracket,
|
|
115
|
+
children: "["
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
|
|
118
|
+
/* @__PURE__ */ jsx("span", {
|
|
119
|
+
className: style_default.TextPunctuation,
|
|
120
|
+
children: ","
|
|
121
|
+
}),
|
|
122
|
+
" ",
|
|
123
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
|
|
124
|
+
/* @__PURE__ */ jsx("span", {
|
|
125
|
+
className: style_default.TypeBracket,
|
|
126
|
+
children: "]"
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
case "GoTypePointer": return /* @__PURE__ */ jsxs("span", {
|
|
131
|
+
className: style_default.Type,
|
|
132
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
133
|
+
className: style_default.TextOperator,
|
|
134
|
+
children: "*"
|
|
135
|
+
}), /* @__PURE__ */ jsx(Lang.Type, { type: type.inner })]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function MethodSignature({ decl }) {
|
|
140
|
+
const Lang = useLanguageComponents();
|
|
141
|
+
const { Join } = useComponents();
|
|
142
|
+
const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: style_default.TextIdentifier,
|
|
144
|
+
children: param.ident
|
|
145
|
+
}), param.optional && /* @__PURE__ */ jsx("span", {
|
|
146
|
+
className: style_default.TextPunctuation,
|
|
147
|
+
children: "?"
|
|
148
|
+
})] }, i));
|
|
149
|
+
const returns = decl.returnType.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
|
|
150
|
+
return /* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: style_default.MethodSignature,
|
|
152
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
153
|
+
className: style_default.SignatureTitle,
|
|
154
|
+
children: [
|
|
155
|
+
decl.async && /* @__PURE__ */ jsx("span", {
|
|
156
|
+
className: style_default.TextKeyword,
|
|
157
|
+
children: "async "
|
|
158
|
+
}),
|
|
159
|
+
decl.qualified && /* @__PURE__ */ jsx("span", {
|
|
160
|
+
className: style_default.SignatureQualified,
|
|
161
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
162
|
+
className: style_default.TextIdentifier,
|
|
163
|
+
children: decl.qualified?.slice(0, -decl.ident.length)
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
decl.kind === "GoDeclFunction" && /* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: style_default.SignatureName,
|
|
168
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
169
|
+
className: style_default.TextIdentifier,
|
|
170
|
+
children: decl.ident
|
|
171
|
+
})
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsxs("span", {
|
|
174
|
+
className: style_default.MethodSignature,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsx("span", {
|
|
177
|
+
className: style_default.SignatureParen,
|
|
178
|
+
children: "("
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: style_default.SignatureParams,
|
|
182
|
+
children: /* @__PURE__ */ jsx(Join, {
|
|
183
|
+
items: params,
|
|
184
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
185
|
+
className: style_default.TextOperator,
|
|
186
|
+
children: ", "
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ jsxs("span", {
|
|
191
|
+
className: style_default.SignatureParen,
|
|
192
|
+
children: [")", " "]
|
|
193
|
+
}),
|
|
194
|
+
decl.returnType.length === 1 ? returns : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
195
|
+
/* @__PURE__ */ jsx("span", {
|
|
196
|
+
className: style_default.SignatureParen,
|
|
197
|
+
children: "("
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ jsx(Join, {
|
|
200
|
+
items: returns,
|
|
201
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
202
|
+
className: style_default.TextOperator,
|
|
203
|
+
children: ", "
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ jsx("span", {
|
|
207
|
+
className: style_default.SignatureParen,
|
|
208
|
+
children: ")"
|
|
209
|
+
})
|
|
210
|
+
] })
|
|
211
|
+
]
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function Property({ decl, children }) {
|
|
218
|
+
const Docs = useComponents();
|
|
219
|
+
const Lang = useLanguageComponents();
|
|
220
|
+
if (!decl) return null;
|
|
221
|
+
switch (decl.kind) {
|
|
222
|
+
case "GoDeclProperty": return children({
|
|
223
|
+
name: decl.ident,
|
|
224
|
+
typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
|
|
225
|
+
badges: decl.optional && /* @__PURE__ */ jsx(Docs.Badge, { id: "optional" }),
|
|
226
|
+
type: (isField(decl.type) || decl.type.kind in ComplexTypes) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
227
|
+
});
|
|
228
|
+
case "GoDeclConst": return children({
|
|
229
|
+
name: decl.ident,
|
|
230
|
+
typeName: "const",
|
|
231
|
+
type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
232
|
+
});
|
|
233
|
+
case "GoDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
|
|
234
|
+
case "GoDeclType":
|
|
235
|
+
case "GoDeclTypeAlias": {
|
|
236
|
+
const typeName = decl.type.kind === "GoTypeStruct" ? "struct" : decl.type.kind === "GoTypeInterface" ? "interface" : decl.kind === "GoDeclTypeAlias" ? "alias" : "type";
|
|
237
|
+
return children({
|
|
238
|
+
name: decl.ident,
|
|
239
|
+
typeName,
|
|
240
|
+
type: ["GoTypeStruct", "GoTypeInterface"].includes(decl.type.kind) || /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function Declaration({ decl }) {
|
|
246
|
+
const Lang = useLanguageComponents();
|
|
247
|
+
if (!decl) return;
|
|
248
|
+
switch (decl.kind) {
|
|
249
|
+
case "GoDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
250
|
+
/* @__PURE__ */ jsx("span", {
|
|
251
|
+
className: style_default.TextKeyword,
|
|
252
|
+
children: "type "
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ jsxs("span", {
|
|
255
|
+
className: style_default.TextIdentifier,
|
|
256
|
+
children: [decl.ident, " "]
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
259
|
+
] });
|
|
260
|
+
case "GoDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
261
|
+
/* @__PURE__ */ jsx("span", {
|
|
262
|
+
className: style_default.TextKeyword,
|
|
263
|
+
children: "type "
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ jsxs("span", {
|
|
266
|
+
className: style_default.TextIdentifier,
|
|
267
|
+
children: [decl.ident, " "]
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ jsx("span", {
|
|
270
|
+
className: style_default.TextOperator,
|
|
271
|
+
children: "= "
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
274
|
+
] });
|
|
275
|
+
case "GoDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
276
|
+
className: style_default.TypePropertyName,
|
|
277
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
278
|
+
className: style_default.TextIdentifier,
|
|
279
|
+
children: [decl.ident, " "]
|
|
280
|
+
})
|
|
281
|
+
}), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
|
|
282
|
+
case "GoDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
|
|
283
|
+
case "GoDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
284
|
+
/* @__PURE__ */ jsx("span", {
|
|
285
|
+
className: style_default.TextKeyword,
|
|
286
|
+
children: "const "
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ jsxs("span", {
|
|
289
|
+
className: style_default.TextIdentifier,
|
|
290
|
+
children: [decl.ident, " "]
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
|
|
293
|
+
/* @__PURE__ */ jsx("span", {
|
|
294
|
+
className: style_default.TextOperator,
|
|
295
|
+
children: " = "
|
|
296
|
+
}),
|
|
297
|
+
JSON.stringify(decl.value)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
//#endregion
|
|
303
|
+
export { TypeName as a, Type as i, MethodSignature as n, go_exports as o, Property as r, Declaration as t };
|