@stainless-api/docs 0.1.0-beta.0

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 (119) hide show
  1. package/.env.example +1 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +11 -0
  4. package/components/variables.css +139 -0
  5. package/eslint.config.js +10 -0
  6. package/package.json +74 -0
  7. package/plugin/assets/fonts/geist/OFL.txt +93 -0
  8. package/plugin/assets/fonts/geist/geist-italic-latin-ext.woff2 +0 -0
  9. package/plugin/assets/fonts/geist/geist-italic-latin.woff2 +0 -0
  10. package/plugin/assets/fonts/geist/geist-latin-ext.woff2 +0 -0
  11. package/plugin/assets/fonts/geist/geist-latin.woff2 +0 -0
  12. package/plugin/assets/fonts/geist/geist-mono-italic-latin-ext.woff2 +0 -0
  13. package/plugin/assets/fonts/geist/geist-mono-italic-latin.woff2 +0 -0
  14. package/plugin/assets/fonts/geist/geist-mono-latin-ext.woff2 +0 -0
  15. package/plugin/assets/fonts/geist/geist-mono-latin.woff2 +0 -0
  16. package/plugin/assets/languages/curl.svg +10 -0
  17. package/plugin/assets/languages/go.svg +4 -0
  18. package/plugin/assets/languages/java.svg +7 -0
  19. package/plugin/assets/languages/kotlin.svg +10 -0
  20. package/plugin/assets/languages/powershell.svg +3 -0
  21. package/plugin/assets/languages/python.svg +19 -0
  22. package/plugin/assets/languages/ruby.svg +125 -0
  23. package/plugin/assets/languages/terraform.svg +5 -0
  24. package/plugin/assets/languages/typescript.svg +11 -0
  25. package/plugin/assets/stainless-logo-dark.png +0 -0
  26. package/plugin/assets/stainless-logo.png +0 -0
  27. package/plugin/buildAlgoliaIndex.ts +72 -0
  28. package/plugin/cms/client.ts +62 -0
  29. package/plugin/cms/server.ts +268 -0
  30. package/plugin/cms/sidebar-builder.ts +420 -0
  31. package/plugin/cms/worker.ts +122 -0
  32. package/plugin/components/SDKSelect.astro +154 -0
  33. package/plugin/components/SnippetCode.tsx +212 -0
  34. package/plugin/components/search/Search.astro +6 -0
  35. package/plugin/components/search/SearchAlgolia.astro +87 -0
  36. package/plugin/components/search/SearchIsland.tsx +100 -0
  37. package/plugin/generateAPIReferenceLink.ts +71 -0
  38. package/plugin/globalJs/ai-dropdown.ts +57 -0
  39. package/plugin/globalJs/code-snippets.ts +87 -0
  40. package/plugin/globalJs/copy.ts +37 -0
  41. package/plugin/globalJs/navigation.ts +81 -0
  42. package/plugin/globalJs/tooltip.ts +32 -0
  43. package/plugin/helpers/getPageLoadEvent.ts +8 -0
  44. package/plugin/index.ts +308 -0
  45. package/plugin/languages.ts +67 -0
  46. package/plugin/loadPluginConfig.ts +273 -0
  47. package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +5 -0
  48. package/plugin/middlewareBuilder/stlStarlightMiddleware.ts +5 -0
  49. package/plugin/react/Routing.tsx +435 -0
  50. package/plugin/referencePlaceholderUtils.ts +82 -0
  51. package/plugin/replaceSidebarPlaceholderMiddleware.ts +50 -0
  52. package/plugin/routes/Docs.astro +171 -0
  53. package/plugin/routes/DocsStatic.astro +14 -0
  54. package/plugin/routes/Overview.astro +67 -0
  55. package/plugin/routes/markdown.ts +58 -0
  56. package/plugin/vendor/preview.worker.docs.js +21657 -0
  57. package/plugin/vendor/templates/go.md +314 -0
  58. package/plugin/vendor/templates/java.md +87 -0
  59. package/plugin/vendor/templates/kotlin.md +87 -0
  60. package/plugin/vendor/templates/node.md +233 -0
  61. package/plugin/vendor/templates/python.md +249 -0
  62. package/plugin/vendor/templates/ruby.md +145 -0
  63. package/plugin/vendor/templates/terraform.md +60 -0
  64. package/plugin/vendor/templates/typescript.md +317 -0
  65. package/scripts/vendor_deps.ts +50 -0
  66. package/shared/virtualModule.ts +7 -0
  67. package/stl-docs/components/APIReferenceAIDropdown.tsx +86 -0
  68. package/stl-docs/components/ClientRouterHead.astro +41 -0
  69. package/stl-docs/components/Header.astro +91 -0
  70. package/stl-docs/components/Sidebar.astro +11 -0
  71. package/stl-docs/components/ThemeSelect.astro +225 -0
  72. package/stl-docs/components/content-panel/ContentBreadcrumbs.tsx +84 -0
  73. package/stl-docs/components/content-panel/ContentPanel.astro +72 -0
  74. package/stl-docs/components/content-panel/ProseAIDropdown.tsx +64 -0
  75. package/stl-docs/components/headers/DefaultHeader.astro +36 -0
  76. package/stl-docs/components/headers/HeaderLinks.astro +16 -0
  77. package/stl-docs/components/headers/SplashMobileMenuToggle.astro +49 -0
  78. package/stl-docs/components/headers/StackedHeader.astro +75 -0
  79. package/stl-docs/components/mintlify-compat/Accordion.astro +46 -0
  80. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +25 -0
  81. package/stl-docs/components/mintlify-compat/Card.tsx +32 -0
  82. package/stl-docs/components/mintlify-compat/Columns.astro +66 -0
  83. package/stl-docs/components/mintlify-compat/Frame.astro +37 -0
  84. package/stl-docs/components/mintlify-compat/Step.astro +58 -0
  85. package/stl-docs/components/mintlify-compat/Steps.astro +17 -0
  86. package/stl-docs/components/mintlify-compat/Tab.astro +13 -0
  87. package/stl-docs/components/mintlify-compat/Tabs.astro +7 -0
  88. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +7 -0
  89. package/stl-docs/components/mintlify-compat/callouts/Check.astro +7 -0
  90. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +7 -0
  91. package/stl-docs/components/mintlify-compat/callouts/Info.astro +7 -0
  92. package/stl-docs/components/mintlify-compat/callouts/Note.astro +7 -0
  93. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +7 -0
  94. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +7 -0
  95. package/stl-docs/components/mintlify-compat/callouts/index.ts +9 -0
  96. package/stl-docs/components/mintlify-compat/card.css +44 -0
  97. package/stl-docs/components/mintlify-compat/index.ts +15 -0
  98. package/stl-docs/components/nav-tabs/NavDropdown.astro +106 -0
  99. package/stl-docs/components/nav-tabs/NavTabs.astro +165 -0
  100. package/stl-docs/components/nav-tabs/SecondaryNavTabs.astro +62 -0
  101. package/stl-docs/components/nav-tabs/buildNavLinks.ts +14 -0
  102. package/stl-docs/index.ts +174 -0
  103. package/stl-docs/loadStlDocsConfig.ts +160 -0
  104. package/stl-docs/redirects.ts +33 -0
  105. package/stl-docs/tabsMiddleware.ts +183 -0
  106. package/styles/code.css +189 -0
  107. package/styles/fonts.css +68 -0
  108. package/styles/links.css +51 -0
  109. package/styles/mintlify-compat.css +1 -0
  110. package/styles/overrides.css +79 -0
  111. package/styles/page.css +76 -0
  112. package/styles/sdk_select.css +11 -0
  113. package/styles/search.css +85 -0
  114. package/styles/sidebar.css +168 -0
  115. package/styles/toc.css +42 -0
  116. package/styles/variables.css +18 -0
  117. package/theme.css +15 -0
  118. package/tsconfig.json +18 -0
  119. package/virtual-module.d.ts +43 -0
@@ -0,0 +1,168 @@
1
+ @layer stainless {
2
+ .sidebar-pane {
3
+ border-inline-end: 1px solid var(--sl-color-hairline-light);
4
+ background-color: var(--sl-color-bg);
5
+ }
6
+
7
+ .sidebar-content {
8
+ li a[aria-current='page'] {
9
+ background-color: unset;
10
+ color: var(--sl-color-text-accent);
11
+
12
+ span {
13
+ font-weight: normal;
14
+ }
15
+ }
16
+
17
+ li {
18
+ margin-top: 0;
19
+ }
20
+
21
+ .group-label span,
22
+ li a span {
23
+ font-size: var(--sl-text-sm);
24
+ line-height: 150%;
25
+ }
26
+
27
+ summary {
28
+ padding: 0.435rem var(--sl-sidebar-item-padding-inline);
29
+ padding-right: 4px;
30
+ }
31
+
32
+ .top-level > li:first-child > a,
33
+ .top-level li:first-child details > summary {
34
+ padding-top: 0;
35
+ }
36
+
37
+ li a {
38
+ position: relative;
39
+ padding: 0.435rem var(--sl-sidebar-item-padding-inline);
40
+ }
41
+
42
+ details > summary > svg {
43
+ opacity: 0.5;
44
+ }
45
+
46
+ details[open] > summary > svg {
47
+ opacity: 1;
48
+ }
49
+
50
+ a.large span {
51
+ font-weight: 400;
52
+ color: var(--sl-color-gray-2);
53
+
54
+ &:hover {
55
+ color: var(--sl-color-white);
56
+ }
57
+ }
58
+
59
+ a.large[aria-current='page'] span {
60
+ color: var(--sl-color-text-accent);
61
+ }
62
+
63
+ .stl-mobile-only-sidebar-item-last {
64
+ border-bottom: 1px solid var(--sl-color-hairline-light);
65
+ padding-bottom: 1rem;
66
+ margin-bottom: 0.5rem;
67
+ }
68
+ }
69
+
70
+ .stl-sdk-select {
71
+ .dropdown-toggle {
72
+ width: 100%;
73
+ }
74
+ }
75
+
76
+ [data-stldocs-method] {
77
+ display: flex;
78
+ gap: 0.6rem;
79
+ }
80
+
81
+ [data-stldocs-method]::before {
82
+ content: '';
83
+ min-width: 20px;
84
+ height: 20px;
85
+ border-radius: 4px;
86
+ text-align: center;
87
+ margin-top: 1px;
88
+ }
89
+
90
+ [aria-current='page']::after {
91
+ content: '';
92
+ position: absolute;
93
+ /* Shift left accounting for sidebar item padding - current item width. Sidebar border width is not a variable, it's always set to 1px */
94
+ left: calc(-1 * var(--sl-sidebar-item-padding-inline) - 1px);
95
+ top: 10%;
96
+ height: 80%;
97
+ width: 2px;
98
+ background-color: var(--sl-color-text-accent);
99
+ }
100
+
101
+ .stl-mobile-only-sidebar-item[aria-current='page']::after {
102
+ background-color: transparent;
103
+ }
104
+
105
+ /* CSS is the only way to customize the Starlight sidebar, so the SVGs have to be here. */
106
+
107
+ :root[data-theme='dark'] {
108
+ [data-stldocs-method='get']::before {
109
+ background-color: var(--sl-color-green-low);
110
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(74, 194, 107)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-left-icon lucide-arrow-down-left"><path d="M17 7 7 17"/><path d="M17 17H7V7"/></svg>');
111
+ }
112
+
113
+ [data-stldocs-method='post']::before {
114
+ background-color: var(--sl-color-blue-low);
115
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(84, 174, 255)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right-icon lucide-arrow-up-right"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>');
116
+ }
117
+
118
+ [data-stldocs-method='patch']::before,
119
+ [data-stldocs-method='put']::before {
120
+ background-color: var(--sl-color-orange-low);
121
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(251, 143, 68)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right-icon lucide-arrow-up-right"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>');
122
+ }
123
+
124
+ [data-stldocs-method='delete']::before {
125
+ background-color: var(--sl-color-red-low);
126
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(248, 89, 92)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>');
127
+ }
128
+ }
129
+
130
+ :root[data-theme='light'] {
131
+ [data-stldocs-method='get']::before {
132
+ background-color: var(--sl-color-green-low);
133
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(31, 124, 58)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-left-icon lucide-arrow-down-left"><path d="M17 7 7 17"/><path d="M17 17H7V7"/></svg>');
134
+ }
135
+
136
+ [data-stldocs-method='post']::before {
137
+ background-color: var(--sl-color-blue-low);
138
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(9, 105, 218)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right-icon lucide-arrow-up-right"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>');
139
+ }
140
+
141
+ [data-stldocs-method='patch']::before,
142
+ [data-stldocs-method='put']::before {
143
+ background-color: var(--sl-color-orange-low);
144
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(210, 86, 1)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right-icon lucide-arrow-up-right"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>');
145
+ }
146
+
147
+ [data-stldocs-method='delete']::before {
148
+ background-color: var(--sl-color-red-low);
149
+ content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -2 24 24" fill="none" stroke="rgba(207, 34, 46)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>');
150
+ }
151
+ }
152
+
153
+ .stl-sidebar-header-links {
154
+ display: flex;
155
+ gap: 1rem;
156
+ flex-direction: column-reverse;
157
+ }
158
+
159
+ @media (min-width: 50rem) {
160
+ .stl-mobile-only-sidebar-item {
161
+ display: none;
162
+ }
163
+
164
+ .stl-sidebar-header-links {
165
+ display: none;
166
+ }
167
+ }
168
+ }
package/styles/toc.css ADDED
@@ -0,0 +1,42 @@
1
+ @layer stainless {
2
+ .right-sidebar-panel {
3
+ nav > ul {
4
+ padding-top: 0;
5
+ border-left: 1px solid var(--sl-color-hairline-light);
6
+ }
7
+ ul ul {
8
+ padding-top: 0;
9
+ }
10
+
11
+ ul > li > a {
12
+ --pad-inline: 1rem;
13
+ font-weight: 400;
14
+ color: var(--sl-color-text);
15
+ padding-block: 0.32rem;
16
+ color: var(--sl-color-text-secondary);
17
+ position: relative;
18
+
19
+ &[aria-current='true'] {
20
+ color: var(--sl-color-text-accent);
21
+
22
+ &::after {
23
+ content: '';
24
+ position: absolute;
25
+ height: 100%;
26
+ width: 2px;
27
+ background-color: var(--sl-color-text-accent);
28
+ left: -1px;
29
+ top: 0;
30
+ }
31
+ }
32
+ }
33
+
34
+ h2 {
35
+ color: var(--stldocs-color-text-secondary);
36
+ font-size: var(--stldocs-font-size-small);
37
+ line-height: 150%;
38
+ text-decoration: none;
39
+ font-weight: 400;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,18 @@
1
+ :root {
2
+ --sl-color-bg-table-row: #ffffff0a;
3
+ --sl-button-border-radius: 8px;
4
+ --sl-text-body-sm: 0.86rem;
5
+ --sl-content-width: 52rem;
6
+ --sl-nav-pad-y: 0.5rem;
7
+ --sl-nav-height: 56px;
8
+ --sl-sidebar-width: 19rem;
9
+ --sl-button-size: 32px;
10
+ --sl-button-padding-x: 0.75rem;
11
+ --sl-button-padding-y: 0.5rem;
12
+ --sl-button-icon-offset: 0.2rem;
13
+ --sl-menu-button-size: var(--sl-button-size);
14
+
15
+ --sl-nav-gap: 0.5rem;
16
+ --sl-icon-color: var(--sl-color-text);
17
+ --sl-page-max-width: unset;
18
+ }
package/theme.css ADDED
@@ -0,0 +1,15 @@
1
+ @layer starlight.base, starlight.reset, starlight.core, starlight.content, starlight.components, starlight.utils;
2
+ @layer starlight, docs-ui, stl-ui, stainless;
3
+
4
+ @import './styles/fonts.css';
5
+ @import './styles/variables.css';
6
+ @import './styles/links.css';
7
+ @import './styles/sidebar.css';
8
+ @import './styles/search.css';
9
+ @import './styles/toc.css';
10
+ @import './styles/page.css';
11
+ @import './styles/overrides.css';
12
+ @import './styles/code.css';
13
+ @import './styles/sdk_select.css';
14
+ @import '@stainless-api/ui-primitives/styles.css';
15
+ @import './styles/mintlify-compat.css';
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "include": [
4
+ ".astro/*",
5
+ "node_modules/@astrojs/starlight/**/*.d.ts",
6
+ "**/*",
7
+ ".stl-docs/**/*",
8
+ "./plugin/**/*"
9
+ ],
10
+ "exclude": ["dist"],
11
+ "compilerOptions": {
12
+ "paths": {
13
+ "~/*": ["../../../stainless/legacy-dir-root/*"]
14
+ },
15
+ "jsx": "react-jsx",
16
+ "jsxImportSource": "react"
17
+ }
18
+ }
@@ -0,0 +1,43 @@
1
+ declare module 'virtual:stl-starlight-virtual-module' {
2
+ import type { CreateShikiHighlighterOptions } from '@astrojs/markdown-remark';
3
+ import type { PropertySettingsType } from '@stainless-api/docs-ui/src/contexts';
4
+ import type { StlStarlightMiddleware } from '@stainless-api/docs/plugin/MiddlewareTypes';
5
+ import type { StainlessStarlightUserConfig } from './plugin/loadPluginConfig';
6
+
7
+ export const BASE_PATH: string;
8
+ export const CMS_PORT: number;
9
+ export const EXCLUDE_LANGUAGES: string[];
10
+ export const DEFAULT_LANGUAGE: string;
11
+ export const BREADCRUMB_CONFIG: {
12
+ includeCurrentPage?: boolean;
13
+ } | null;
14
+ export const EXPAND_RESOURCES: boolean;
15
+ export const HIGHLIGHT_THEMES: CreateShikiHighlighterOptions['themes'];
16
+ export const CONTENT_PANEL_LAYOUT: 'double-pane' | 'single-pane';
17
+ export const EXPERIMENTAL_COLLAPSIBLE_SNIPPETS: boolean | undefined;
18
+ export const PROPERTY_SETTINGS: PropertySettingsType;
19
+ export const MIDDLEWARE: StlStarlightMiddleware;
20
+ export const SEARCH: StainlessStarlightUserConfig['search'];
21
+ }
22
+
23
+ declare module 'virtual:stl-stl-starlight-virtual-module' {
24
+ import type { ButtonVariant } from '@stainless-api/ui-primitives';
25
+ import type { AnchorHTMLAttributes } from 'react';
26
+
27
+ type Tab = {
28
+ label: string;
29
+ link: string;
30
+ hidden?: boolean;
31
+ };
32
+
33
+ export const HEADER_LINKS: {
34
+ label: string;
35
+ link: string;
36
+ variant?: ButtonVariant;
37
+ attrs?: AnchorHTMLAttributes<HTMLAnchorElement>;
38
+ }[];
39
+ export const TABS: Tab[];
40
+ export const SPLIT_TABS_ENABLED: boolean;
41
+ export const HEADER_LAYOUT: 'default' | 'stacked';
42
+ export const ENABLE_CLIENT_ROUTER: boolean;
43
+ }