@stainless-api/docs-ui 0.1.0-beta.24 → 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.
Files changed (133) hide show
  1. package/dist/breadcrumbs-D5viAm7a.d.ts +20 -0
  2. package/dist/chunk-Bp6m_JJh.js +13 -0
  3. package/dist/component-generics-BnrVqdQj.d.ts +29 -0
  4. package/dist/component-generics-Df4EDvxk.js +41 -0
  5. package/dist/components/breadcrumbs.d.ts +2 -0
  6. package/dist/components/breadcrumbs.js +16 -0
  7. package/dist/components/chat.d.ts +14 -0
  8. package/dist/components/chat.js +128 -0
  9. package/dist/components/dropdown.d.ts +2 -0
  10. package/dist/components/dropdown.js +4 -0
  11. package/dist/components/icons.d.ts +50 -0
  12. package/dist/components/icons.js +3 -0
  13. package/dist/components/index.d.ts +12 -0
  14. package/dist/components/index.js +16 -0
  15. package/dist/components/method.d.ts +2 -0
  16. package/dist/components/method.js +16 -0
  17. package/dist/components/overview.d.ts +2 -0
  18. package/dist/components/overview.js +16 -0
  19. package/dist/components/primitives.d.ts +2 -0
  20. package/dist/components/primitives.js +16 -0
  21. package/dist/components/properties.d.ts +2 -0
  22. package/dist/components/properties.js +16 -0
  23. package/dist/components/scripts/dropdown.d.ts +12 -0
  24. package/dist/components/scripts/dropdown.js +50 -0
  25. package/dist/components/sdk.d.ts +3 -0
  26. package/dist/components/sdk.js +16 -0
  27. package/dist/components/sidebar.d.ts +2 -0
  28. package/dist/components/sidebar.js +16 -0
  29. package/dist/components/snippets.d.ts +4 -0
  30. package/dist/components/snippets.js +16 -0
  31. package/dist/contexts/component-generics.d.ts +2 -0
  32. package/dist/contexts/component-generics.js +3 -0
  33. package/dist/contexts/component-types.d.ts +18 -0
  34. package/dist/contexts/component-types.js +1 -0
  35. package/dist/contexts/component.d.ts +30 -0
  36. package/dist/contexts/component.js +16 -0
  37. package/dist/contexts/docs.d.ts +2 -0
  38. package/dist/contexts/docs.js +3 -0
  39. package/dist/contexts/index.d.ts +20 -0
  40. package/dist/contexts/index.js +16 -0
  41. package/dist/contexts/markdown.d.ts +2 -0
  42. package/dist/contexts/markdown.js +4 -0
  43. package/dist/contexts/navigation.d.ts +3 -0
  44. package/dist/contexts/navigation.js +3 -0
  45. package/dist/contexts/search.d.ts +4 -0
  46. package/dist/contexts/search.js +16 -0
  47. package/dist/contexts/use-components.d.ts +16 -0
  48. package/dist/contexts/use-components.js +4 -0
  49. package/dist/contexts-DO0sMzym.js +2581 -0
  50. package/dist/docs-Cj25B-Sh.js +50 -0
  51. package/dist/docs-DhNaW0DE.d.ts +45 -0
  52. package/dist/dropdown-Dv9VAYCW.d.ts +42 -0
  53. package/dist/dropdown-kUhwBigR.js +38 -0
  54. package/dist/icons--8QR-PrL.js +222 -0
  55. package/dist/index-BW6OPqAo.d.ts +16 -0
  56. package/dist/index-BXO3gZup.d.ts +239 -0
  57. package/dist/index-d8_VR8Z5.d.ts +14 -0
  58. package/dist/index.d.ts +22 -0
  59. package/dist/index.js +5030 -4830
  60. package/dist/languages/go.d.ts +13 -0
  61. package/dist/languages/go.js +16 -0
  62. package/dist/languages/http.d.ts +13 -0
  63. package/dist/languages/http.js +16 -0
  64. package/dist/languages/index.d.ts +13 -0
  65. package/dist/languages/index.js +16 -0
  66. package/dist/languages/java.d.ts +13 -0
  67. package/dist/languages/java.js +16 -0
  68. package/dist/languages/python.d.ts +13 -0
  69. package/dist/languages/python.js +16 -0
  70. package/dist/languages/ruby.d.ts +13 -0
  71. package/dist/languages/ruby.js +16 -0
  72. package/dist/languages/typescript.d.ts +13 -0
  73. package/dist/languages/typescript.js +16 -0
  74. package/dist/markdown/index.d.ts +12 -0
  75. package/dist/markdown/index.js +16 -0
  76. package/dist/markdown/md.d.ts +15 -0
  77. package/dist/markdown/md.js +3 -0
  78. package/dist/markdown/utils.d.ts +4 -0
  79. package/dist/markdown/utils.js +3 -0
  80. package/dist/markdown-DN8KaRR2.d.ts +21 -0
  81. package/dist/markdown-DunIdqFE.js +39 -0
  82. package/dist/mcp.cjs +983443 -0
  83. package/dist/md-Dg8aOyMA.js +41 -0
  84. package/dist/method-c3XDArUn.d.ts +70 -0
  85. package/dist/navigation-BSn6PX-7.d.ts +28 -0
  86. package/dist/navigation-CuCg3le8.js +20 -0
  87. package/dist/overview-D21weqVJ.d.ts +39 -0
  88. package/dist/pagefind-ChrPfuVv.js +15 -0
  89. package/dist/primitives-iB9fIrMF.d.ts +98 -0
  90. package/dist/properties-Ba6F_GGj.d.ts +46 -0
  91. package/dist/routing-BE6Vrs-z.d.ts +54 -0
  92. package/dist/routing-C8oZYLsf.js +189 -0
  93. package/dist/routing.d.ts +2 -0
  94. package/dist/routing.js +4 -4
  95. package/dist/sdk-D2x2l6JH.d.ts +118 -0
  96. package/dist/search/index.d.ts +26 -0
  97. package/dist/search/index.js +211 -0
  98. package/dist/search/providers/algolia.d.ts +24 -0
  99. package/dist/search/providers/algolia.js +16 -0
  100. package/dist/search/providers/fuse.d.ts +18 -0
  101. package/dist/search/providers/fuse.js +31 -0
  102. package/dist/search/providers/pagefind.d.ts +7 -0
  103. package/dist/search/providers/pagefind.js +3 -0
  104. package/dist/search/providers/walker.d.ts +9 -0
  105. package/dist/search/providers/walker.js +35 -0
  106. package/dist/search/types.d.ts +3 -0
  107. package/dist/search/types.js +3 -0
  108. package/dist/search-KMqOU2tz.d.ts +20 -0
  109. package/dist/sidebar-B1X4gmY2.d.ts +35 -0
  110. package/dist/snippets-BApdMOXp.d.ts +45 -0
  111. package/dist/style-BWu-Pqcm.d.ts +182 -0
  112. package/dist/style-CkbsakoF.js +183 -0
  113. package/dist/style.d.ts +2 -0
  114. package/dist/style.js +3 -0
  115. package/dist/styles/main.css +743 -748
  116. package/dist/styles/primitives.css +444 -427
  117. package/dist/styles/resets.css +33 -41
  118. package/dist/styles/search.css +265 -248
  119. package/dist/styles/sidebar.css +58 -60
  120. package/dist/styles/snippets.css +86 -88
  121. package/dist/styles/variables.css +86 -90
  122. package/dist/types-BLgvxY4i.d.ts +83 -0
  123. package/dist/types-DFN4M1Sp.js +34 -0
  124. package/dist/use-components-DI-AbT-D.js +7 -0
  125. package/dist/utils-B9JL_XWH.d.ts +21 -0
  126. package/dist/utils-BhYTrLot.js +32 -0
  127. package/dist/utils-ByZH9QWT.js +30 -0
  128. package/dist/utils-DlayebL1.d.ts +14 -0
  129. package/dist/utils.d.ts +2 -0
  130. package/dist/utils.js +4 -0
  131. package/package.json +4 -4
  132. package/src/search/mcp.ts +8 -8
  133. package/dist/mcp.js +0 -15967
@@ -0,0 +1,32 @@
1
+ import { t as __export } from "./chunk-Bp6m_JJh.js";
2
+ import { f as parseStainlessPath } from "./routing-C8oZYLsf.js";
3
+
4
+ //#region src/utils.ts
5
+ var utils_exports = /* @__PURE__ */ __export({
6
+ flatResources: () => flatResources,
7
+ getResourceFromSpec: () => getResourceFromSpec,
8
+ isResourceEmpty: () => isResourceEmpty
9
+ });
10
+ function flatResources(resources, parents) {
11
+ return Object.keys(resources ?? {}).flatMap((key) => {
12
+ const resource = resources[key];
13
+ return [{
14
+ resource,
15
+ parents
16
+ }, ...resource.subresources ? flatResources(resource.subresources, [...parents, resource]) : []];
17
+ });
18
+ }
19
+ function getResourceFromSpec(stainlessPath, spec) {
20
+ if (typeof stainlessPath === "string") {
21
+ const parsed = parseStainlessPath(stainlessPath);
22
+ if (!parsed?.resource) return null;
23
+ stainlessPath = parsed.resource;
24
+ }
25
+ return stainlessPath.slice(1).reduce((acc, cur) => acc?.subresources?.[cur], spec.resources[stainlessPath[0]]) ?? null;
26
+ }
27
+ function isResourceEmpty(resource) {
28
+ return !(Object.values(resource.methods).length > 0 || Object.values(resource.models).length > 0 || Object.values(resource.subresources).length > 0);
29
+ }
30
+
31
+ //#endregion
32
+ export { utils_exports as i, getResourceFromSpec as n, isResourceEmpty as r, flatResources as t };
@@ -0,0 +1,30 @@
1
+ import { Parser } from "htmlparser2";
2
+
3
+ //#region src/markdown/utils.ts
4
+ function getDecl(env, path) {
5
+ const decl = env.spec?.decls?.[env.language]?.[path];
6
+ if (decl?.kind?.endsWith("Reference")) {
7
+ const refId = "type" in decl && typeof decl["type"] === "object" && "$ref" in decl["type"] ? decl["type"]["$ref"] : null;
8
+ if (refId === path) return decl;
9
+ if (refId) return getDecl(env, refId);
10
+ }
11
+ return decl;
12
+ }
13
+ function getSnippet(env, path) {
14
+ let snippet = env.spec?.snippets?.[`${env.language}.default`]?.[path];
15
+ if (typeof snippet === "string" && env.transforms?.transformRequestSnippet) snippet = env.transforms.transformRequestSnippet({
16
+ snippet,
17
+ language: env.language
18
+ });
19
+ return snippet;
20
+ }
21
+ function stripMarkup(content) {
22
+ let output = "";
23
+ new Parser({ ontext(content$1) {
24
+ output += content$1;
25
+ } }).parseComplete(content);
26
+ return output;
27
+ }
28
+
29
+ //#endregion
30
+ export { getSnippet as n, stripMarkup as r, getDecl as t };
@@ -0,0 +1,14 @@
1
+ import * as SDKJSON from "@stainless/sdk-json";
2
+
3
+ //#region src/utils.d.ts
4
+ declare namespace utils_d_exports {
5
+ export { flatResources, getResourceFromSpec, isResourceEmpty };
6
+ }
7
+ declare function flatResources(resources: Record<string, SDKJSON.Resource> | undefined, parents: SDKJSON.Resource[]): {
8
+ resource: SDKJSON.Resource;
9
+ parents: SDKJSON.Resource[];
10
+ }[];
11
+ declare function getResourceFromSpec(stainlessPath: string | string[], spec: SDKJSON.Spec): SDKJSON.Resource | null;
12
+ declare function isResourceEmpty(resource: SDKJSON.Resource): boolean;
13
+ //#endregion
14
+ export { utils_d_exports as i, getResourceFromSpec as n, isResourceEmpty as r, flatResources as t };
@@ -0,0 +1,2 @@
1
+ import { n as getResourceFromSpec, r as isResourceEmpty, t as flatResources } from "./utils-DlayebL1.js";
2
+ export { flatResources, getResourceFromSpec, isResourceEmpty };
package/dist/utils.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./routing-C8oZYLsf.js";
2
+ import { n as getResourceFromSpec, r as isResourceEmpty, t as flatResources } from "./utils-BhYTrLot.js";
3
+
4
+ export { flatResources, getResourceFromSpec, isResourceEmpty };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stainless-api/docs-ui",
3
3
  "private": false,
4
- "version": "0.1.0-beta.24",
4
+ "version": "0.1.0-beta.26",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -24,7 +24,7 @@
24
24
  "htmlparser2": "^10.0.0",
25
25
  "lucide-react": "^0.544.0",
26
26
  "natural": "^8.0.1",
27
- "@stainless-api/ui-primitives": "0.1.0-beta.18"
27
+ "@stainless-api/ui-primitives": "0.1.0-beta.19"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^24.4.0",
@@ -36,8 +36,8 @@
36
36
  "react-dom": "^19.2.0",
37
37
  "tsx": "^4.20.3",
38
38
  "typescript": "5.9.3",
39
- "@stainless/sdk-json": "^0.1.0-beta.0",
40
- "@stainless/eslint-config": "0.1.0-beta.0"
39
+ "@stainless/eslint-config": "0.1.0-beta.0",
40
+ "@stainless/sdk-json": "^0.1.0-beta.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "node build.js",
package/src/search/mcp.ts CHANGED
@@ -6,7 +6,7 @@ import { buildIndex, search as fuseSearch } from './providers/fuse';
6
6
  import { generateIndex } from './indexer';
7
7
  import type { IndexEntry, IndexMethod } from './types';
8
8
  import natural from 'natural';
9
- import type * as SDKJSON from '~/lib/json-spec-v2/types';
9
+ import type * as SDKJSON from '@stainless/sdk-json';
10
10
 
11
11
  type Item = IndexEntry & IndexMethod;
12
12
 
@@ -21,12 +21,12 @@ export function consolidate(results: IndexEntry[]) {
21
21
  const methods = new Set<string>();
22
22
 
23
23
  for (const entry of results) {
24
- const parsed = parseStainlessPath(entry.stainlessPath);
25
- if (parsed.method) methods.add(parsed.routable);
26
- else resources.add(parsed.routable);
24
+ const parsed = parseStainlessPath(entry.stainlessPath)!;
25
+ if (parsed.method) methods.add(parsed.routable!);
26
+ else resources.add(parsed.routable!);
27
27
  }
28
28
 
29
- const filtered = Array.from(methods).filter((path) => !resources.has(path.split(' >').at(0)));
29
+ const filtered = Array.from(methods).filter((path) => !resources.has(path.split(' >').at(0)!));
30
30
  return [...resources, ...filtered];
31
31
  }
32
32
 
@@ -47,9 +47,9 @@ export function render(
47
47
 
48
48
  const paths = consolidate(items);
49
49
  const output = paths.map((entry) => {
50
- const parsed = parseStainlessPath(entry);
51
- const resource = getResourceFromSpec(parsed.resource, spec);
52
- const target = parsed.method ? resource.methods[parsed.method] : resource;
50
+ const parsed = parseStainlessPath(entry)!;
51
+ const resource = getResourceFromSpec(parsed.resource!, spec)!;
52
+ const target = parsed.method ? resource.methods[parsed.method]! : resource;
53
53
  const content = renderMarkdown(env, target);
54
54
  return [entry, content];
55
55
  });