@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.80
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-BYypO7fO.js +18 -0
- package/dist/components/MaskedInput.d.ts +14 -0
- package/dist/components/MaskedInput.js +76 -0
- package/dist/components/breadcrumbs.d.ts +25 -0
- package/dist/components/breadcrumbs.js +64 -0
- package/dist/components/icons.d.ts +65 -0
- package/dist/components/icons.js +941 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.js +75 -0
- package/dist/components/method.d.ts +59 -0
- package/dist/components/method.js +97 -0
- package/dist/components/overview.d.ts +39 -0
- package/dist/components/overview.js +139 -0
- package/dist/components/primitives.d.ts +107 -0
- package/dist/components/primitives.js +253 -0
- package/dist/components/properties.d.ts +54 -0
- package/dist/components/properties.js +140 -0
- package/dist/components/sdk-sidebar.d.ts +15 -0
- package/dist/components/sdk-sidebar.js +52 -0
- package/dist/components/sdk.d.ts +128 -0
- package/dist/components/sdk.js +490 -0
- package/dist/components/snippets.d.ts +71 -0
- package/dist/components/snippets.js +184 -0
- package/dist/components/stl-sidebar.d.ts +58 -0
- package/dist/components/stl-sidebar.js +114 -0
- package/dist/contexts/component-generics.d.ts +30 -0
- package/dist/contexts/component-generics.js +33 -0
- package/dist/contexts/component-types.d.ts +8 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +21 -0
- package/dist/contexts/component.js +24 -0
- package/dist/contexts/docs.d.ts +62 -0
- package/dist/contexts/docs.js +91 -0
- package/dist/contexts/index.d.ts +13 -0
- package/dist/contexts/index.js +45 -0
- package/dist/contexts/markdown.d.ts +22 -0
- package/dist/contexts/markdown.js +49 -0
- package/dist/contexts/navigation.d.ts +29 -0
- package/dist/contexts/navigation.js +24 -0
- package/dist/contexts/use-components.d.ts +6 -0
- package/dist/contexts/use-components.js +8 -0
- package/dist/index-pvh-w1xa.d.ts +1776 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -7542
- package/dist/languages/cli.d.ts +38 -0
- package/dist/languages/cli.js +167 -0
- package/dist/languages/csharp.d.ts +42 -0
- package/dist/languages/csharp.js +284 -0
- package/dist/languages/go.d.ts +40 -0
- package/dist/languages/go.js +304 -0
- package/dist/languages/http.d.ts +46 -0
- package/dist/languages/http.js +391 -0
- package/dist/languages/index.d.ts +51 -0
- package/dist/languages/index.js +33 -0
- package/dist/languages/java.d.ts +43 -0
- package/dist/languages/java.js +404 -0
- package/dist/languages/php.d.ts +40 -0
- package/dist/languages/php.js +313 -0
- package/dist/languages/python.d.ts +40 -0
- package/dist/languages/python.js +270 -0
- package/dist/languages/ruby.d.ts +40 -0
- package/dist/languages/ruby.js +388 -0
- package/dist/languages/terraform.d.ts +48 -0
- package/dist/languages/terraform.js +244 -0
- package/dist/languages/typescript.d.ts +40 -0
- package/dist/languages/typescript.js +450 -0
- package/dist/markdown/index.d.ts +11 -0
- package/dist/markdown/index.js +80 -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 +76 -0
- package/dist/markdown/utils.d.ts +21 -0
- package/dist/markdown/utils.js +31 -0
- package/dist/routing.d.ts +61 -0
- package/dist/routing.js +176 -150
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/style.d.ts +177 -0
- package/dist/style.js +178 -0
- package/dist/styles/main.css +788 -752
- package/dist/styles/main.js +0 -0
- package/dist/styles/primitives.css +326 -458
- 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 +182 -69
- package/dist/styles/sidebar.js +0 -0
- package/dist/styles/variables.css +28 -89
- package/dist/styles/variables.js +0 -0
- package/dist/styles.css +3333 -0
- package/dist/styles.mjs +1 -0
- package/dist/use-strict-context-L0c8JKg4.js +16 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +54 -0
- package/package.json +74 -22
- 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 -146
- package/src/components/overview.tsx +0 -160
- 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 -403
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -180
- 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 -182
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -196
- package/src/styles/main.css +0 -986
- package/src/styles/primitives.css +0 -580
- package/src/styles/resets.css +0 -39
- package/src/styles/search.css +0 -341
- package/src/styles/sidebar.css +0 -85
- package/src/styles/snippets.css +0 -130
- package/src/styles/variables.css +0 -86
- package/src/utils.ts +0 -41
package/dist/styles.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-strict-context.tsx
|
|
4
|
+
function createStrictContext(displayName) {
|
|
5
|
+
const Context = React.createContext(null);
|
|
6
|
+
Context.displayName = displayName;
|
|
7
|
+
function useStrictContext() {
|
|
8
|
+
const context = React.useContext(Context);
|
|
9
|
+
if (context === null) throw new Error(`use${displayName} must be used within a ${displayName}Provider`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
return [Context.Provider, useStrictContext];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { createStrictContext as t };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { c as ID, h as Resource, s as HttpAST, v as Spec } from "./index-pvh-w1xa.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
declare namespace utils_d_exports {
|
|
5
|
+
export { AssertExhaustive, HttpBodyEncoding, flatResources, getBodyParams, getResourceFromSpec, isResourceEmpty };
|
|
6
|
+
}
|
|
7
|
+
declare function flatResources(resources: Record<string, Resource> | undefined, parents: Resource[]): {
|
|
8
|
+
resource: Resource;
|
|
9
|
+
parents: Resource[];
|
|
10
|
+
}[];
|
|
11
|
+
declare function getResourceFromSpec(stainlessPath: string | string[], spec: Spec): Resource | null;
|
|
12
|
+
declare function isResourceEmpty(resource: Resource): boolean;
|
|
13
|
+
type HttpBodyEncoding = 'json' | 'form-data' | 'unknown';
|
|
14
|
+
declare function getBodyParams(decl: HttpAST.HttpDeclFunction): {
|
|
15
|
+
params: ID[];
|
|
16
|
+
encoding: HttpBodyEncoding;
|
|
17
|
+
} | null;
|
|
18
|
+
type AssertExhaustive<T extends never> = T;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AssertExhaustive, HttpBodyEncoding, flatResources, getBodyParams, getResourceFromSpec, isResourceEmpty, utils_d_exports as t };
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
+
import { parseStainlessPath } from "./routing.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils.ts
|
|
5
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
flatResources: () => flatResources,
|
|
7
|
+
getBodyParams: () => getBodyParams,
|
|
8
|
+
getResourceFromSpec: () => getResourceFromSpec,
|
|
9
|
+
isResourceEmpty: () => isResourceEmpty
|
|
10
|
+
});
|
|
11
|
+
function flatResources(resources, parents) {
|
|
12
|
+
return Object.keys(resources ?? {}).flatMap((key) => {
|
|
13
|
+
const resource = resources[key];
|
|
14
|
+
return [{
|
|
15
|
+
resource,
|
|
16
|
+
parents
|
|
17
|
+
}, ...resource.subresources ? flatResources(resource.subresources, [...parents, resource]) : []];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function getResourceFromSpec(stainlessPath, spec) {
|
|
21
|
+
if (typeof stainlessPath === "string") {
|
|
22
|
+
const parsed = parseStainlessPath(stainlessPath);
|
|
23
|
+
if (!parsed?.resource) return null;
|
|
24
|
+
stainlessPath = parsed.resource;
|
|
25
|
+
}
|
|
26
|
+
return stainlessPath.slice(1).reduce((acc, cur) => acc?.subresources?.[cur], spec.resources[stainlessPath[0]]) ?? null;
|
|
27
|
+
}
|
|
28
|
+
function isResourceEmpty(resource) {
|
|
29
|
+
return !(Object.values(resource.methods).length > 0 || Object.values(resource.models).length > 0 || Object.values(resource.subresources).length > 0);
|
|
30
|
+
}
|
|
31
|
+
function getBodyParams(decl) {
|
|
32
|
+
if (!decl.bodyParamsChildren) return null;
|
|
33
|
+
const keys = Object.keys(decl.bodyParamsChildren);
|
|
34
|
+
if (keys.length > 1) console.warn("multiple bodyParams content types in " + decl.stainlessPath + ":", keys);
|
|
35
|
+
const jsonKey = keys.find((e) => /[/+]json(;|$)/.test(e));
|
|
36
|
+
if (jsonKey) return {
|
|
37
|
+
params: decl.bodyParamsChildren[jsonKey],
|
|
38
|
+
encoding: "json"
|
|
39
|
+
};
|
|
40
|
+
const formDataKey = keys.find((e) => /^multipart\/form-data(;|$)/.test(e));
|
|
41
|
+
if (formDataKey) return {
|
|
42
|
+
params: decl.bodyParamsChildren[formDataKey],
|
|
43
|
+
encoding: "form-data"
|
|
44
|
+
};
|
|
45
|
+
const firstKey = keys[0];
|
|
46
|
+
if (firstKey) return {
|
|
47
|
+
params: decl.bodyParamsChildren[firstKey],
|
|
48
|
+
encoding: "unknown"
|
|
49
|
+
};
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { flatResources, getBodyParams, getResourceFromSpec, isResourceEmpty, utils_exports as t };
|
package/package.json
CHANGED
|
@@ -1,39 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.80",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
"src"
|
|
10
|
+
"dist"
|
|
12
11
|
],
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": ">=19.0.0",
|
|
14
|
+
"react-dom": ">=19.0.0"
|
|
15
|
+
},
|
|
13
16
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@markdoc/markdoc": "^0.5.2",
|
|
16
|
-
"ai": "4.3.19",
|
|
17
|
+
"@markdoc/markdoc": "^0.5.4",
|
|
17
18
|
"clsx": "^2.1.1",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"react": "^19.1.1",
|
|
22
|
-
"react-dom": "^19.1.1",
|
|
23
|
-
"@stainless-api/ui-primitives": "0.1.0-beta.9"
|
|
19
|
+
"htmlparser2": "^10.1.0",
|
|
20
|
+
"lucide-react": "^0.574.0",
|
|
21
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.49"
|
|
24
22
|
},
|
|
25
23
|
"devDependencies": {
|
|
26
|
-
"@types/node": "
|
|
27
|
-
"@types/react": "
|
|
28
|
-
"@types/react-dom": "^19.
|
|
29
|
-
"dotenv": "17.
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
24
|
+
"@types/node": "24.10.13",
|
|
25
|
+
"@types/react": "19.2.14",
|
|
26
|
+
"@types/react-dom": "^19.2.3",
|
|
27
|
+
"dotenv": "17.3.1",
|
|
28
|
+
"react": "^19.2.4",
|
|
29
|
+
"react-dom": "^19.2.4",
|
|
30
|
+
"tsdown": "^0.20.3",
|
|
31
|
+
"typescript": "5.9.3",
|
|
32
|
+
"@stainless/eslint-config": "0.1.0-beta.1",
|
|
33
|
+
"@stainless/sdk-json": "^0.1.0-beta.9"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./routing": {
|
|
40
|
+
"default": "./dist/routing.js"
|
|
41
|
+
},
|
|
42
|
+
"./utils": {
|
|
43
|
+
"default": "./dist/utils.js"
|
|
44
|
+
},
|
|
45
|
+
"./components": {
|
|
46
|
+
"default": "./dist/components/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./components/scripts/*": {
|
|
49
|
+
"default": "./dist/components/scripts/*.js"
|
|
50
|
+
},
|
|
51
|
+
"./components/*": {
|
|
52
|
+
"default": "./dist/components/*.js"
|
|
53
|
+
},
|
|
54
|
+
"./languages": {
|
|
55
|
+
"default": "./dist/languages/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./languages/*": {
|
|
58
|
+
"default": "./dist/languages/*.js"
|
|
59
|
+
},
|
|
60
|
+
"./contexts": {
|
|
61
|
+
"default": "./dist/contexts/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./contexts/*": {
|
|
64
|
+
"default": "./dist/contexts/*.js"
|
|
65
|
+
},
|
|
66
|
+
"./style": {
|
|
67
|
+
"default": "./dist/style.js"
|
|
68
|
+
},
|
|
69
|
+
"./styles/*": {
|
|
70
|
+
"default": "./dist/styles/*"
|
|
71
|
+
},
|
|
72
|
+
"./styles.css": {
|
|
73
|
+
"default": "./dist/styles.css"
|
|
74
|
+
},
|
|
75
|
+
"./markdown": {
|
|
76
|
+
"default": "./dist/markdown/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./markdown/*": {
|
|
79
|
+
"default": "./dist/markdown/*.js"
|
|
80
|
+
},
|
|
81
|
+
"./spec": {
|
|
82
|
+
"default": "./dist/spec.js"
|
|
83
|
+
}
|
|
33
84
|
},
|
|
34
85
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"lint": "eslint ."
|
|
86
|
+
"build": "tsdown",
|
|
87
|
+
"clean": "rm -rf dist",
|
|
88
|
+
"lint": "eslint .",
|
|
89
|
+
"check:types": "tsc --noEmit"
|
|
38
90
|
}
|
|
39
91
|
}
|