@stainless-api/docs 0.1.0-beta.12 → 0.1.0-beta.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @stainless-api/docs
2
2
 
3
+ ## 0.1.0-beta.14
4
+
5
+ ### Patch Changes
6
+
7
+ - a529fd4: fix: site title height
8
+ - Updated dependencies [a529fd4]
9
+ - @stainless-api/docs-ui@0.1.0-beta.11
10
+ - @stainless-api/ui-primitives@0.1.0-beta.12
11
+
12
+ ## 0.1.0-beta.13
13
+
14
+ ### Patch Changes
15
+
16
+ - 26a4786: fix: include missing starlight config options
17
+ - Updated dependencies [26a4786]
18
+ - @stainless-api/docs-ui@0.1.0-beta.10
19
+ - @stainless-api/ui-primitives@0.1.0-beta.11
20
+
3
21
  ## 0.1.0-beta.12
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.12",
3
+ "version": "0.1.0-beta.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,6 +22,7 @@
22
22
  "./BaseSidebar": "./stl-docs/components/sidebars/BaseSidebar.astro",
23
23
  "./SDKSelectSidebar": "./stl-docs/components/sidebars/SDKSelectSidebar.astro",
24
24
  "./ContentPanel": "./stl-docs/components/content-panel/ContentPanel.astro",
25
+ "./TableOfContents": "./stl-docs/components/TableOfContents.astro",
25
26
  "./tabsMiddleware": "./stl-docs/tabsMiddleware.ts",
26
27
  "./stainless-docs/mintlify-compat": "./stl-docs/components/mintlify-compat/index.ts",
27
28
  "./theme": "./theme.css",
@@ -35,34 +36,34 @@
35
36
  "node": ">=18.17.1"
36
37
  },
37
38
  "peerDependencies": {
38
- "@astrojs/starlight": ">=0.34.0",
39
- "astro": ">=5.5.0"
39
+ "@astrojs/starlight": ">=0.36.1",
40
+ "astro": ">=5.15.3"
40
41
  },
41
42
  "dependencies": {
42
43
  "@astrojs/markdown-remark": "^6.3.2",
43
- "@astrojs/react": "^4.3.1",
44
+ "@astrojs/react": "^4.4.1",
44
45
  "@stainless-api/sdk": "0.1.0-alpha.12",
45
46
  "cheerio": "^1.1.2",
46
47
  "clsx": "^2.1.1",
47
- "dotenv": "17.2.2",
48
+ "dotenv": "17.2.3",
48
49
  "get-port": "^7.1.0",
49
50
  "highlight.js": "^11.11.1",
50
51
  "lucide-react": "^0.544.0",
51
52
  "marked": "^16.0.0",
52
- "react": "^19.1.1",
53
- "react-dom": "^19.1.1",
53
+ "react": "^19.2.0",
54
+ "react-dom": "^19.2.0",
54
55
  "remark-github-alerts": "^0.1.1",
55
56
  "shiki": "^3.9.2",
56
57
  "web-worker": "^1.5.0",
57
58
  "yaml": "^2.8.0",
58
- "@stainless-api/ui-primitives": "0.1.0-beta.10",
59
- "@stainless-api/docs-ui": "0.1.0-beta.9"
59
+ "@stainless-api/ui-primitives": "0.1.0-beta.12",
60
+ "@stainless-api/docs-ui": "0.1.0-beta.11"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@markdoc/markdoc": "^0.5.2",
63
64
  "@types/node": "^24.4.0",
64
- "@types/react": "^19.1.13",
65
- "@types/react-dom": "^19.1.9",
65
+ "@types/react": "^19.2.2",
66
+ "@types/react-dom": "^19.2.2",
66
67
  "tsx": "^4.20.3",
67
68
  "zod": "^4.0.0",
68
69
  "@stainless/eslint-config": "0.0.0"
@@ -44,9 +44,10 @@ const shouldRenderSearch = !!(
44
44
  overflow: clip;
45
45
  /* Avoid clipping focus ring around link inside title wrapper. */
46
46
  padding: 0.25rem;
47
- padding-left: 0;
48
47
  margin: -0.25rem;
49
48
  min-width: 0;
49
+ /* Max height should match button height */
50
+ max-height: 32px;
50
51
  }
51
52
 
52
53
  .default-tabs-container {
@@ -0,0 +1,34 @@
1
+ ---
2
+ import Default from '@astrojs/starlight/components/TableOfContents.astro';
3
+ ---
4
+
5
+ <Default {...Astro.props} />
6
+
7
+ <script>
8
+ /**
9
+ * Starlight will mark TOC links as active as they are scrolled to. However, it does not mark
10
+ * a link as active if it cannot be scrolled to on the page. This happens for small sections at
11
+ * the bottom of the page which are not large enough to scroll to the top of the viewport.
12
+ *
13
+ * This script will mark a section as active if its corresponding hash is in the URL, even if
14
+ * it cannot be scrolled to.
15
+ */
16
+ document.addEventListener('DOMContentLoaded', () => {
17
+ const tocLinks = document.querySelectorAll('starlight-toc a') as NodeListOf<HTMLAnchorElement>;
18
+
19
+ function updateAriaCurrent() {
20
+ const current = decodeURIComponent(window.location.hash || '');
21
+ tocLinks.forEach((link) => {
22
+ const linkHash = decodeURIComponent(link.hash || link.getAttribute('href') || '');
23
+ if (linkHash === current) {
24
+ link.setAttribute('aria-current', 'true');
25
+ } else {
26
+ link.removeAttribute('aria-current');
27
+ }
28
+ });
29
+ }
30
+
31
+ window.addEventListener('hashchange', updateAriaCurrent);
32
+ updateAriaCurrent();
33
+ });
34
+ </script>
@@ -34,13 +34,8 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
34
34
  align-items: center;
35
35
  padding: 0;
36
36
  list-style: none;
37
- overflow-x: auto;
38
37
  margin-bottom: -1px;
39
- gap: 0.29rem;
40
- }
41
-
42
- .stl-active-secondary-link:hover {
43
- background-color: transparent;
38
+ gap: 4px;
44
39
  }
45
40
 
46
41
  li {
@@ -50,6 +45,20 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
50
45
  &.active {
51
46
  border-color: var(--sl-color-text-accent);
52
47
  }
48
+
49
+ .stl-ui-button {
50
+ /* match sidebar. TODO: hoist sidebar variables to use those instead of hardcoding? */
51
+ border-width: 0;
52
+ padding: 8px 12px;
53
+ margin-inline: -12px;
54
+ }
55
+ /* cover for button’s negative margin */
56
+ &:not(:first-child) {
57
+ margin-inline-start: 12px;
58
+ }
59
+ &:not(:last-child) {
60
+ margin-inline-end: 12px;
61
+ }
53
62
  }
54
63
  }
55
64
 
package/stl-docs/index.ts CHANGED
@@ -47,6 +47,7 @@ function stainlessDocsStarlightIntegration(config: NormalizedStainlessDocsConfig
47
47
  Header: '@stainless-api/docs/Header',
48
48
  ThemeSelect: '@stainless-api/docs/ThemeSelect',
49
49
  ContentPanel: '@stainless-api/docs/ContentPanel',
50
+ TableOfContents: '@stainless-api/docs/TableOfContents',
50
51
  };
51
52
 
52
53
  if (config.apiReference !== null) {
@@ -119,6 +119,12 @@ function normalizeConfig(userConfig: StainlessDocsUserConfig) {
119
119
  description: userConfig.description,
120
120
  tagline: userConfig.tagline,
121
121
  logo: userConfig.logo,
122
+ favicon: userConfig.favicon,
123
+ disable404Route: userConfig.disable404Route,
124
+ editLink: userConfig.editLink,
125
+ locales: userConfig.locales,
126
+ lastUpdated: userConfig.lastUpdated,
127
+ pagination: userConfig.pagination,
122
128
  },
123
129
  starlightCompat: {
124
130
  components: userConfig.experimental?.starlightCompat?.components ?? {},
package/styles/page.css CHANGED
@@ -1,18 +1,21 @@
1
- .page {
2
- position: relative;
1
+ .page,
2
+ .page > header .header,
3
+ .page > header .stl-secondary-nav-tabs {
3
4
  max-width: var(--sl-page-max-width);
4
5
  margin: 0 auto;
5
6
 
6
- .sidebar-pane {
7
- left: auto;
7
+ @media (min-width: 50rem) {
8
+ padding-inline: var(--stl-ui-page-padding-inline);
8
9
  }
10
+ }
9
11
 
10
- > header {
11
- .stl-secondary-nav-tabs,
12
- .header {
13
- max-width: var(--sl-page-max-width);
14
- margin: 0 auto;
15
- }
12
+
13
+ .page {
14
+ position: relative;
15
+ max-width: var(--sl-page-max-width);
16
+
17
+ .sidebar-pane {
18
+ left: unset;
16
19
  }
17
20
 
18
21
  .right-sidebar {
@@ -25,22 +28,10 @@
25
28
  }
26
29
 
27
30
  @media (min-width: 50rem) {
28
- .page {
29
- padding-left: var(--sl-sidebar-pad-x);
30
- padding-right: var(--sl-sidebar-pad-x);
31
-
32
- > header {
33
- .header,
34
- .stl-secondary-nav-tabs {
35
- padding: 0 1.5rem;
36
- }
37
- }
38
-
39
- > header {
40
- .stl-secondary-nav-tabs {
41
- padding-left: 0.55rem;
42
- }
43
- }
31
+ /* on desktop, adjust sidebar so that its _text content_ aligns with the page left edge.
32
+ * padding (visible on hover) bleeds out beyond the page left edge, covered by --stl-ui-page-padding-inline */
33
+ .sidebar-pane {
34
+ margin-inline-start: calc(-1 * (var(--sl-sidebar-pad-x) + var(--stl-sidebar-item-padding-inline)));
44
35
  }
45
36
 
46
37
  .header,
@@ -52,9 +43,6 @@
52
43
  mobile-starlight-toc nav {
53
44
  inset-inline-start: calc(var(--sl-content-inline-start, 0) + var(--sl-sidebar-pad-x));
54
45
  }
55
- .sidebar-content {
56
- padding-left: 0;
57
- }
58
46
  }
59
47
 
60
48
  .stl-content-breadcrumbs {
@@ -63,6 +63,10 @@
63
63
  color: var(--stl-ui-foreground);
64
64
  }
65
65
  }
66
+ .stl-sdk-select .stldocs-dropdown-trigger {
67
+ /* dropdown should match link padding, accounting for 1px border */
68
+ padding: calc(var(--stl-sidebar-item-padding-block) - 1px) calc(var(--stl-sidebar-item-padding-inline) - 1px);
69
+ }
66
70
  li a {
67
71
  color: var(--stl-ui-foreground-secondary);
68
72
  font-weight: 400;