@stainless-api/docs-ui 0.1.0-beta.25 → 0.1.0-beta.27

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 (131) 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 +653 -683
  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 +326 -351
  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/sdk-D2x2l6JH.d.ts +118 -0
  95. package/dist/search/index.d.ts +26 -0
  96. package/dist/search/index.js +211 -0
  97. package/dist/search/providers/algolia.d.ts +24 -0
  98. package/dist/search/providers/algolia.js +16 -0
  99. package/dist/search/providers/fuse.d.ts +18 -0
  100. package/dist/search/providers/fuse.js +31 -0
  101. package/dist/search/providers/pagefind.d.ts +7 -0
  102. package/dist/search/providers/pagefind.js +3 -0
  103. package/dist/search/providers/walker.d.ts +9 -0
  104. package/dist/search/providers/walker.js +35 -0
  105. package/dist/search/types.d.ts +3 -0
  106. package/dist/search/types.js +3 -0
  107. package/dist/search-KMqOU2tz.d.ts +20 -0
  108. package/dist/sidebar-B1X4gmY2.d.ts +35 -0
  109. package/dist/snippets-BApdMOXp.d.ts +45 -0
  110. package/dist/style-BWu-Pqcm.d.ts +182 -0
  111. package/dist/style-CkbsakoF.js +183 -0
  112. package/dist/style.d.ts +2 -0
  113. package/dist/style.js +3 -0
  114. package/dist/styles/primitives.css +0 -198
  115. package/dist/types-BLgvxY4i.d.ts +83 -0
  116. package/dist/types-DFN4M1Sp.js +34 -0
  117. package/dist/use-components-DI-AbT-D.js +7 -0
  118. package/dist/utils-B9JL_XWH.d.ts +21 -0
  119. package/dist/utils-BhYTrLot.js +32 -0
  120. package/dist/utils-ByZH9QWT.js +30 -0
  121. package/dist/utils-DlayebL1.d.ts +14 -0
  122. package/dist/utils.d.ts +2 -0
  123. package/dist/utils.js +4 -0
  124. package/package.json +2 -2
  125. package/src/components/index.ts +0 -1
  126. package/src/search/mcp.ts +1 -1
  127. package/src/style.ts +0 -12
  128. package/src/styles/primitives.css +0 -198
  129. package/dist/mcp.js +0 -15967
  130. package/src/components/dropdown.tsx +0 -91
  131. package/src/components/scripts/dropdown.ts +0 -78
@@ -0,0 +1,34 @@
1
+ //#region src/search/types.ts
2
+ const QueryKinds = [
3
+ "all",
4
+ "resource",
5
+ "http_method",
6
+ "model",
7
+ "property",
8
+ "guide"
9
+ ];
10
+ const SearchableAttributes = [
11
+ "name",
12
+ "title",
13
+ "ident",
14
+ "Name",
15
+ "qualified",
16
+ "QualifiedName",
17
+ "endpoint",
18
+ "summary",
19
+ "description",
20
+ "docstring"
21
+ ];
22
+ const SearchableAttributesChat = [
23
+ "title",
24
+ "name",
25
+ "endpoint",
26
+ "summary",
27
+ "description",
28
+ "qualified",
29
+ "ident",
30
+ "content"
31
+ ];
32
+
33
+ //#endregion
34
+ export { SearchableAttributes as n, SearchableAttributesChat as r, QueryKinds as t };
@@ -0,0 +1,7 @@
1
+ import { i as useComponents } from "./component-generics-Df4EDvxk.js";
2
+
3
+ //#region src/contexts/use-components.tsx
4
+ const useComponents$1 = () => useComponents();
5
+
6
+ //#endregion
7
+ export { useComponents$1 as t };
@@ -0,0 +1,21 @@
1
+ import { t as DocsLanguage } from "./routing-BE6Vrs-z.js";
2
+ import { C as TransformRequestSnippetFn } from "./sdk-D2x2l6JH.js";
3
+ import * as SDKJSON from "@stainless/sdk-json";
4
+
5
+ //#region src/markdown/utils.d.ts
6
+ type EnvironmentType = {
7
+ spec: SDKJSON.Spec;
8
+ language: DocsLanguage;
9
+ transforms?: {
10
+ transformRequestSnippet?: TransformRequestSnippetFn;
11
+ };
12
+ options: {
13
+ renderNestedResources?: boolean;
14
+ includeModelProperties?: boolean;
15
+ };
16
+ };
17
+ declare function getDecl(env: EnvironmentType, path: string): SDKJSON.LanguageDeclNodes[SDKJSON.SpecLanguage] | undefined;
18
+ declare function getSnippet(env: EnvironmentType, path: string): string | undefined;
19
+ declare function stripMarkup(content: string): string;
20
+ //#endregion
21
+ export { stripMarkup as i, getDecl as n, getSnippet as r, EnvironmentType as t };
@@ -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.25",
4
+ "version": "0.1.0-beta.27",
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.20"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^24.4.0",
@@ -5,5 +5,4 @@ export * from './sdk';
5
5
  export * from './snippets';
6
6
  export * from './overview';
7
7
  export * from './breadcrumbs';
8
- export * from './dropdown';
9
8
  export * from './sidebar';
package/src/search/mcp.ts CHANGED
@@ -153,4 +153,4 @@ function stemText(text: string): string {
153
153
  return stemmedWords.join(' ');
154
154
  }
155
155
 
156
- export { generateIndex }
156
+ export { generateIndex };
package/src/style.ts CHANGED
@@ -182,16 +182,4 @@ export default {
182
182
  BreadcrumbsItem: 'stldocs-breadcrumbs-item',
183
183
  BreadcrumbsLink: 'stldocs-breadcrumbs-link',
184
184
  BreadcrumbsNonLink: 'stldocs-breadcrumbs-non-link',
185
-
186
- Dropdown: 'stldocs-dropdown',
187
- DropdownTrigger: 'stldocs-dropdown-trigger',
188
- DropdownTriggerContent: 'stldocs-dropdown-trigger-content',
189
- DropdownChevron: 'stldocs-dropdown-chevron',
190
- DropdownMenu: 'stldocs-dropdown-menu',
191
- DropdownItem: 'stldocs-dropdown-item',
192
- DropdownItemLink: 'stldocs-dropdown-item-link',
193
-
194
- Button: 'stldocs-button',
195
- ButtonSecondary: 'stldocs-button-secondary',
196
- ButtonIcon: 'stldocs-button-icon',
197
185
  } as const;
@@ -359,206 +359,8 @@
359
359
  align-items: center;
360
360
  gap: 0.5rem;
361
361
  margin: 0;
362
- height: var(--stldocs-button-size);
363
362
  }
364
363
  }
365
-
366
- /* Dropdown component styles */
367
- .stldocs-dropdown {
368
- position: relative;
369
- font-size: 0.85rem;
370
-
371
- span {
372
- display: flex;
373
- align-items: center;
374
- justify-content: center;
375
- }
376
- }
377
-
378
- .stldocs-dropdown-trigger {
379
- display: flex;
380
- align-items: center;
381
- justify-content: space-between;
382
- gap: 6px;
383
- padding: 0.5rem;
384
-
385
- .stldocs-icon {
386
- margin: unset;
387
- width: 16px;
388
- }
389
-
390
- &:hover {
391
- border-color: var(--stldocs-color-hairline-shade);
392
- }
393
- }
394
-
395
- .stldocs-dropdown-trigger-content {
396
- display: flex;
397
- align-items: center;
398
- gap: 8px;
399
- }
400
-
401
- .stldocs-dropdown-chevron {
402
- margin-right: calc(-1 * var(--sl-button-icon-offset));
403
- padding: 0;
404
- opacity: 0.25;
405
- }
406
-
407
- .stldocs-dropdown-chevron svg path {
408
- stroke: var(--stldocs-color-text-secondary);
409
- }
410
-
411
- .stldocs-dropdown-menu {
412
- --stldocs-dropdown-menu-border-radius: 8px;
413
- --stldocs-dropdown-menu-background-color: var(--stldocs-color-bg);
414
- --stldocs-dropdown-menu-border-color: var(--stldocs-color-hairline);
415
-
416
- position: absolute;
417
- right: 0;
418
- bottom: 100%;
419
- z-index: var(--stldocs-z-index-theme-select);
420
- background: var(--stldocs-dropdown-menu-background-color);
421
- border: 1px solid var(--stldocs-dropdown-menu-border-color);
422
- border-radius: var(--stldocs-dropdown-menu-border-radius);
423
- margin-bottom: 4px;
424
- padding: 0;
425
- width: 100%;
426
- min-width: 100px;
427
- overflow: hidden;
428
- display: none;
429
- box-shadow: 0px 4px 4px -2px #00000014;
430
-
431
- &.below {
432
- margin-bottom: unset;
433
- bottom: unset;
434
- top: 100%;
435
- margin-top: 4px;
436
- }
437
- }
438
-
439
- .stldocs-dropdown-menu.open {
440
- display: block;
441
- }
442
-
443
- .stldocs-dropdown-item {
444
- display: flex;
445
- align-items: center;
446
- justify-content: space-between;
447
- gap: 8px;
448
- padding: 6px 10px;
449
- cursor: pointer;
450
- height: 32px;
451
-
452
- div {
453
- display: flex;
454
- align-items: center;
455
- gap: 8px;
456
- }
457
-
458
- .lucide-check {
459
- height: var(--stlodcs-font-size-body);
460
- width: var(--stlodcs-font-size-body);
461
- display: none;
462
- }
463
-
464
- .stldocs-icon {
465
- width: 16px;
466
- }
467
-
468
- &.stldocs-dropdown-item-link {
469
- padding: 0;
470
- height: unset;
471
- gap: 0;
472
-
473
- a {
474
- display: flex;
475
- align-items: center;
476
- justify-content: space-between;
477
- gap: 8px;
478
- padding: 6px 10px;
479
- cursor: pointer;
480
- height: 32px;
481
- width: 100%;
482
- text-decoration: none;
483
- color: inherit;
484
- }
485
- }
486
- }
487
-
488
- .stldocs-dropdown-item:hover {
489
- background-color: var(--stldocs-color-bg-inline-code);
490
- }
491
-
492
- .stldocs-dropdown-item.selected {
493
- .lucide-check {
494
- display: inline;
495
- }
496
- }
497
-
498
- @media (min-width: 50rem) {
499
- .stldocs-dropdown-menu {
500
- margin-bottom: unset;
501
- bottom: unset;
502
- top: 100%;
503
- margin-top: 4px;
504
- }
505
- }
506
- }
507
-
508
- /* Intentionally not using the stldocs-root selector here, as buttons are sometimes outside the stldocs-root. */
509
- .stldocs-button {
510
- border-radius: var(--stldocs-button-border-radius);
511
- display: flex;
512
- padding: var(--stldocs-button-padding-y) var(--stldocs-button-padding-x);
513
- justify-content: center;
514
- align-items: center;
515
- height: var(--stldocs-button-size);
516
- cursor: pointer;
517
- text-decoration: none;
518
- text-wrap: nowrap;
519
- font-weight: 500;
520
- line-height: 150%;
521
- font-size: var(--sl-text-sm);
522
-
523
- span {
524
- padding-left: var(--sl-button-icon-offset);
525
- padding-right: var(--sl-button-icon-offset);
526
- font-size: var(--sl-text-sm);
527
- }
528
-
529
- &.stldocs-button-icon {
530
- > svg {
531
- margin: 0;
532
- }
533
- }
534
- }
535
-
536
- .stldocs-button-icon {
537
- > svg {
538
- margin: 0;
539
- }
540
- }
541
-
542
- .stldocs-button-primary {
543
- background-color: var(--stldocs-color-text);
544
- color: var(--stldocs-color-text-invert);
545
- }
546
-
547
- .stldocs-button-secondary {
548
- background-color: var(--stldocs-color-bg-ui);
549
- border: 1px solid var(--stldocs-color-hairline);
550
- border-radius: var(--stldocs-button-border-radius);
551
- font-weight: 400;
552
-
553
- &:hover {
554
- border-color: var(--stldocs-color-hairline-shade);
555
- }
556
- }
557
-
558
- .stldocs-button-tertiary {
559
- border: none;
560
- color: var(--stldocs-color-text-secondary);
561
- background-color: transparent;
562
364
  }
563
365
 
564
366
  .stldocs-root .stldocs-expand-toggle {