@stainless-api/docs 0.1.0-beta.103 → 0.1.0-beta.105

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/styles/page.css CHANGED
@@ -1,109 +1,165 @@
1
- .page,
2
- .page > header .header,
3
- .page > header .stl-secondary-nav-tabs {
4
- max-width: var(--sl-page-max-width);
5
- margin: 0 auto;
1
+ :root {
2
+ --stl-page-max-width: 90rem;
6
3
 
7
- @media (min-width: 50rem) {
8
- padding-inline: var(--stl-ui-page-padding-inline);
4
+ /* 0.75rem at 25rem width (phone); 1.5rem at 72rem width (desktop) */
5
+ --_stl-page-min-padding-mobile-rem: 0.75;
6
+ --_stl-page-min-padding-desktop-rem: 1.5;
7
+ --_stl-page-min-padding-slope: (
8
+ (var(--_stl-page-min-padding-desktop-rem) - var(--_stl-page-min-padding-mobile-rem)) / (72 - 25)
9
+ );
10
+ --stl-page-min-padding: clamp(
11
+ var(--_stl-page-min-padding-mobile-rem) * 1rem,
12
+ var(--_stl-page-min-padding-slope) * (100vw - 25rem) + var(--_stl-page-min-padding-mobile-rem) * 1rem,
13
+ var(--_stl-page-min-padding-desktop-rem) * 1rem
14
+ );
15
+
16
+ --stl-content-max-width: 52rem;
17
+ --stl-content-padding: 2rem;
18
+ --stl-two-column-content-max-width: 80rem;
19
+
20
+ --stl-sidebar-width: 16.5rem;
21
+ --stl-nav-height: 3.5rem; /* has to be statically sized in order to correctly position the viewport-end grid area :( */
22
+ --stl-nav-gap: 0.5rem;
23
+
24
+ --stl-page-width: min(var(--stl-page-max-width), 100vw);
25
+ --vw: calc(var(--stl-page-width) / 100);
26
+ }
27
+ @media (min-width: 50rem) {
28
+ :root:has(.stl-secondary-nav-tabs) {
29
+ --stl-nav-height: 5.5rem;
30
+ header {
31
+ padding-top: 0.25rem;
32
+ }
9
33
  }
10
34
  }
11
35
 
36
+ /* Grid layout */
37
+
12
38
  .page {
13
- position: relative;
14
- max-width: var(--sl-page-max-width);
39
+ display: grid;
15
40
 
16
- .right-sidebar {
17
- border-inline-start: unset;
18
- }
41
+ /* TODO: verify that env-safe-area-inset is behaving as we expect */
42
+ --stl-viewport-width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
43
+ --stl-page-gutter-left: calc(
44
+ env(safe-area-inset-left, 0) +
45
+ max(var(--stl-page-min-padding), (var(--stl-viewport-width) - var(--stl-page-max-width)) / 2)
46
+ );
47
+ --stl-page-gutter-right: calc(
48
+ env(safe-area-inset-right, 0) +
49
+ max(var(--stl-page-min-padding), (var(--stl-viewport-width) - var(--stl-page-max-width)) / 2)
50
+ );
19
51
 
20
- .mobile-preferences {
21
- margin-top: 1rem;
22
- display: flex;
23
- justify-content: flex-end;
24
- }
52
+ /* prettier-ignore */
53
+ grid:
54
+ /* header + content have two identical columns because in mobile layout the menu trigger takes up the latter */
55
+ ' gutter-left header header header header gutter-right chat' var(--stl-nav-height) /* nav */
56
+ ' gutter-left sidebar content content toc gutter-right chat' calc(100dvh - var(--stl-nav-height)) /* viewport (above the fold) */
57
+ [viewport-end]
58
+ ' gutter-left . content content . gutter-right . ' auto /* rest of page height */
59
+ / var(--stl-page-gutter-left) var(--stl-sidebar-width) minmax(0, 1fr) auto auto var(--stl-page-gutter-right) auto;
25
60
  }
26
61
 
27
- :root {
28
- --sl-mobile-toc-height: 4rem;
62
+ .page > main,
63
+ .page > .sidebar > .sidebar-pane,
64
+ .page > .right-sidebar-panel nav {
65
+ padding-block-start: 1rem;
29
66
  }
30
67
 
31
- @media (min-width: 50rem) {
32
- .page .sidebar-pane {
33
- left: unset;
34
- }
35
- /* on desktop, adjust sidebar so that its _text content_ aligns with the page left edge.
36
- * padding (visible on hover) bleeds out beyond the page left edge, covered by --stl-ui-page-padding-inline */
37
- .sidebar-pane {
38
- /* 12px comes from --stl-sidebar-item-padding-inline (which is unfortunately defined deeper than
39
- this component). Please keep in sync. */
40
- margin-inline-start: calc(-1 * (var(--sl-sidebar-pad-x) + 12px));
41
- }
68
+ /* Sticky header and tabs */
42
69
 
43
- .header,
44
- .header {
45
- padding-inline-start: 0;
46
- padding-inline-end: 0;
47
- }
70
+ .page > header {
71
+ grid-area: header;
72
+ margin-left: calc(-1 * var(--stl-page-gutter-left));
73
+ margin-right: calc(-1 * var(--stl-page-gutter-right));
74
+ padding-left: var(--stl-page-gutter-left);
75
+ padding-right: var(--stl-page-gutter-right);
76
+ }
48
77
 
49
- mobile-starlight-toc nav {
50
- inset-inline-start: calc(var(--sl-content-inline-start, 0) + var(--sl-sidebar-pad-x));
51
- }
78
+ header {
79
+ display: flex;
80
+ flex-direction: column;
81
+ border-bottom: 1px solid var(--stl-color-border-faint);
82
+ position: sticky;
83
+ top: 0;
84
+ z-index: 10;
85
+ background: var(--stl-color-background);
52
86
  }
53
87
 
54
- .stl-content-breadcrumbs {
55
- .stldocs-breadcrumbs {
56
- padding-left: 0;
88
+ @layer starlight.core {
89
+ header > .header {
90
+ all: revert-layer;
57
91
  }
58
92
  }
59
93
 
60
- .stl-page-nav-container {
94
+ header > .header {
95
+ flex: 1;
61
96
  display: flex;
97
+ gap: var(--stl-nav-gap);
62
98
  align-items: center;
63
99
  justify-content: space-between;
64
- gap: 1rem;
65
- padding: 1rem 0 0 0;
66
- flex-wrap: wrap;
67
100
  }
68
101
 
69
- .stl-page-nav-container {
102
+ .header site-search > button {
103
+ @media (min-width: 50rem) {
104
+ margin-inline: 2rem;
105
+ flex: 1 1 12rem;
106
+ }
107
+ }
108
+
109
+ .header .right-group {
70
110
  display: flex;
71
- align-items: center;
72
- justify-content: space-between;
73
- gap: 1rem;
74
- padding: 1rem 0 0 0;
75
- flex-wrap: wrap;
111
+ align-items: stretch;
76
112
  }
77
113
 
78
- .stldocs-root .stl-page-nav-container {
79
- padding: 1rem 0 0 var(--stldocs-content-padding);
114
+ /* Sticky sidebar and toc. Outer wrapper “sticks” to top of page, subgrid pushes child down below header */
115
+ .page > .sidebar {
116
+ grid-area: sidebar;
117
+ /* sidebar should bleed to left edge of page in case people want to color it */
118
+ margin-left: calc(-1 * var(--stl-page-gutter-left));
119
+ padding-left: var(--stl-page-gutter-left);
80
120
  }
81
121
 
82
- [data-has-sidebar]:not([data-has-toc]) .sl-container {
83
- max-width: 1428px;
122
+ .page > .right-sidebar-panel {
123
+ grid-area: toc;
84
124
  }
85
125
 
86
- .stl-overview {
87
- max-width: var(--sl-content-width);
126
+ .page > .sidebar,
127
+ .page > .right-sidebar-panel {
128
+ align-self: start;
129
+ grid-row-start: header-start;
130
+ display: grid;
131
+ grid-template-rows: subgrid;
132
+ grid-template-columns: subgrid;
133
+ position: sticky;
134
+ top: 0;
135
+ }
136
+ .page > .sidebar > .sidebar-pane,
137
+ .page > .right-sidebar-panel > starlight-toc {
138
+ grid-area: inherit;
139
+ grid-row-start: header-end;
140
+ overflow-y: auto;
141
+ overflow-x: clip;
88
142
  }
89
143
 
90
- @media (min-width: 50rem) {
91
- :root[data-has-sidebar] {
92
- --sl-content-inline-start: calc(var(--sl-sidebar-width) + 2rem);
93
- }
144
+ /* Page content */
94
145
 
95
- .stldocs-root .stl-page-nav-container {
96
- padding: 1rem 0 0 0;
97
- }
146
+ .page > main {
147
+ grid-area: content;
148
+ width: 100%;
149
+ max-width: min(var(--stl-content-max-width), 100%);
150
+ justify-self: center;
151
+ padding-inline: var(--stl-content-padding);
98
152
  }
99
153
 
100
- @media (min-width: 72rem) {
101
- :root {
102
- --sl-mobile-toc-height: 0rem;
103
- }
154
+ .stl-page-nav-container {
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: space-between;
158
+ gap: 1rem;
159
+ flex-wrap: wrap;
104
160
  }
105
161
 
106
- .content-panel footer {
162
+ .stl-content-panel footer {
107
163
  /* Don’t render empty footer meta, which results in extra margin getting applied on behalf of the flex gap.
108
164
  * Instead, move its margin to its parent. */
109
165
  margin-top: 3rem;
@@ -115,3 +171,94 @@
115
171
  }
116
172
  }
117
173
  }
174
+
175
+ .mobile-preferences {
176
+ margin-top: 1rem;
177
+ display: flex;
178
+ justify-content: flex-end;
179
+ }
180
+
181
+ /* Two-column layouts go wider */
182
+ .page > main:where(:has(.stldocs-method-double-pane)) {
183
+ max-width: min(var(--stl-two-column-content-max-width), 100%);
184
+ padding-inline-start: clamp(
185
+ var(--stl-content-padding),
186
+ var(--stl-page-gutter-right) - env(safe-area-inset-right, 0),
187
+ var(--stl-content-padding) * 2
188
+ );
189
+ padding-inline-end: 0;
190
+ }
191
+
192
+ /* Responsive page layout */
193
+
194
+ /* On smaller screens, the main panel takes up the full width and the TOC is hidden */
195
+ @media not (min-width: 72rem) {
196
+ .page > main {
197
+ /* right edge of content goes up to right gutter to align with header */
198
+ padding-inline-end: 0;
199
+ max-width: 100%;
200
+ }
201
+
202
+ .page > .right-sidebar-panel {
203
+ display: none;
204
+ }
205
+ }
206
+
207
+ /* On mobile screens, the sidebar and nav links collapse */
208
+ @media not (min-width: 50rem) {
209
+ header {
210
+ padding-top: 0;
211
+ display: grid;
212
+ grid-template-columns: subgrid;
213
+ }
214
+
215
+ header > .header {
216
+ grid-column: span 2;
217
+ }
218
+
219
+ /* Sidebar moves to cover content area, hidden by default */
220
+ :root {
221
+ --stl-sidebar-width: 0px;
222
+ }
223
+ .page > .sidebar,
224
+ .page > .sidebar.hidden {
225
+ display: contents;
226
+ }
227
+ .page > .sidebar > .sidebar-pane {
228
+ visibility: hidden;
229
+ grid-area: content;
230
+ grid-row-end: viewport-end;
231
+ z-index: 9;
232
+ /* extend to right edge of page */
233
+ margin-inline-end: calc(-1 * var(--stl-page-gutter-right));
234
+ padding-inline-end: var(--stl-page-gutter-right);
235
+ border-inline-end: 0;
236
+ }
237
+ .page > .sidebar > starlight-menu-button[aria-expanded='true'] ~ .sidebar-pane {
238
+ visibility: visible;
239
+ }
240
+
241
+ /* left padding becomes the left gutter when there’s no sidebar */
242
+ .page > main {
243
+ padding-inline-start: 0;
244
+ }
245
+
246
+ /* Sidebar menu button moves to end of header; takes up space in layout (not absolutely positioned as in starlight) */
247
+ .sidebar starlight-menu-button {
248
+ grid-column: span 1 / content-end;
249
+ grid-row: header;
250
+ display: flex;
251
+ align-items: center;
252
+ position: sticky;
253
+ top: 0;
254
+ padding-left: var(--stl-nav-gap);
255
+ z-index: 11;
256
+ }
257
+ .sidebar starlight-menu-button button {
258
+ position: static;
259
+ }
260
+
261
+ .header .right-group {
262
+ display: none;
263
+ }
264
+ }
@@ -1,23 +1,27 @@
1
- /* reset starlight styles */
2
- @layer starlight.core {
3
- .sidebar .sidebar-pane .sidebar-content {
4
- * {
5
- all: revert-layer;
6
- &::before,
7
- &::after {
8
- all: revert-layer;
9
- }
10
- }
11
- }
12
- }
13
-
14
- .sidebar-pane {
1
+ .page > .sidebar > .sidebar-pane {
2
+ padding-inline-end: 1rem;
15
3
  border-inline-end: 1px solid var(--stl-color-border-faint);
4
+ padding-block-end: calc(2rem + env(safe-area-inset-bottom));
5
+
6
+ /* make sure the sidebar doesn’t get clipped on the left by overflow */
7
+ margin-inline-start: calc(-1 * var(--stl-page-gutter-left));
8
+ padding-inline-start: var(--stl-page-gutter-left);
9
+
10
+ background-color: var(--stl-color-background);
11
+ /* work around chrome bug where the background-color isn’t getting painted in the overscroll? */
12
+ background-image: linear-gradient(to bottom, var(--stl-color-background), var(--stl-color-background));
13
+ background-attachment: fixed;
14
+
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 1rem;
16
18
  }
17
19
 
18
- .sidebar-content .stl-mobile-only-sidebar-item-last {
19
- margin-bottom: 2rem;
20
- position: relative;
20
+ @media (min-width: 50rem) {
21
+ .page > .sidebar :is(.stl-sdk-select, .stldocs-sidebar) {
22
+ /* align left edge of text with container */
23
+ margin-inline-start: calc(-1 * var(--stldocs-sidebar-item-padding-inline));
24
+ }
21
25
  }
22
26
 
23
27
  .stl-sidebar-header-links {
@@ -36,3 +40,9 @@
36
40
  display: none;
37
41
  }
38
42
  }
43
+
44
+ /* No sidebar on splash pages */
45
+ .page > .sidebar.hidden {
46
+ /* Note: on mobile, this will be overridden to display: contents; in order to show the mobile menu */
47
+ display: none;
48
+ }
@@ -1,19 +1,14 @@
1
1
  :root {
2
2
  --sl-color-bg-table-row: #ffffff0a;
3
3
  --sl-button-border-radius: 8px;
4
- --sl-content-width: 52rem;
5
- --sl-nav-pad-y: 0.5rem;
6
- --sl-nav-height: 56px;
7
- --sl-sidebar-width: 19rem;
8
4
  --sl-button-size: 32px;
9
5
  --sl-button-padding-x: 0.75rem;
10
6
  --sl-button-padding-y: 0.5rem;
11
7
  --sl-button-icon-offset: 0.2rem;
12
- --sl-menu-button-size: var(--sl-button-size);
8
+
9
+ /* TODO: remove --sl-nav-height dependencies */
10
+ --sl-nav-height: 56px;
13
11
 
14
12
  --sl-nav-gap: 0.5rem;
15
13
  --sl-icon-color: var(--stl-color-foreground);
16
- --sl-page-max-width: unset;
17
-
18
- --sl-content-pad-x: 1rem;
19
14
  }
@@ -1,6 +1,6 @@
1
1
  @import '@stainless-api/docs-ui/styles/variables.css';
2
2
 
3
3
  :root {
4
- --stldocs-content-width: var(--sl-content-width);
5
- --stldocs-content-padding: var(--sl-content-pad-x);
4
+ --stldocs-content-width: var(--stl-content-max-width);
5
+ --stldocs-content-padding-inline: 0;
6
6
  }
package/styles/toc.css CHANGED
@@ -1,5 +1,11 @@
1
1
  .right-sidebar-panel {
2
2
  font-size: var(--stl-typography-scale-sm);
3
+ overflow-wrap: break-word;
4
+
5
+ nav {
6
+ min-width: 14ch;
7
+ max-width: calc(18 * var(--vw));
8
+ }
3
9
 
4
10
  nav > ul {
5
11
  padding-top: 0;
@@ -17,6 +23,7 @@
17
23
  color: var(--stl-color-foreground-reduced);
18
24
  position: relative;
19
25
  font-size: inherit;
26
+ text-decoration: none;
20
27
 
21
28
  &:hover {
22
29
  text-decoration: underline;
@@ -45,5 +52,6 @@
45
52
  line-height: 150%;
46
53
  text-decoration: none;
47
54
  font-weight: 400;
55
+ margin-bottom: 0.5em;
48
56
  }
49
57
  }
@@ -1,65 +0,0 @@
1
- ---
2
- import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle';
3
- import Sidebar from 'virtual:starlight/components/Sidebar';
4
- ---
5
-
6
- <div class="stl-splash-mobile-menu-toggle">
7
- <MobileMenuToggle />
8
- <div id="starlight__sidebar" class="sidebar sidebar-pane">
9
- <div class="sidebar-content sl-flex">
10
- <Sidebar />
11
- </div>
12
- </div>
13
- </div>
14
-
15
- <style>
16
- @layer starlight.core {
17
- .sidebar-pane {
18
- li,
19
- li a,
20
- li a[aria-current='page'] {
21
- all: revert-layer;
22
- }
23
- }
24
- }
25
-
26
- :global([aria-expanded='true']) ~ .sidebar-pane {
27
- --sl-sidebar-visibility: visible;
28
- }
29
- .sidebar-pane {
30
- visibility: var(--sl-sidebar-visibility, hidden);
31
- position: fixed;
32
- z-index: var(--sl-z-index-menu);
33
- inset-block: var(--sl-nav-height) 0;
34
- inset-inline-start: 0;
35
- width: 100%;
36
- overflow-y: auto;
37
- left: 0;
38
-
39
- a {
40
- font-size: var(--stl-typography-scale-sm);
41
- }
42
- }
43
-
44
- .sidebar-content {
45
- height: 100%;
46
- min-height: max-content;
47
- padding: 1rem var(--sl-sidebar-pad-x) 0;
48
- flex-direction: column;
49
- gap: 1rem;
50
- background-color: var(--stl-color-background);
51
- }
52
-
53
- @media (min-width: 50rem) {
54
- .stl-splash-mobile-menu-toggle {
55
- display: none;
56
- }
57
- }
58
- </style>
59
- <style is:global>
60
- .stl-splash-mobile-menu-toggle button {
61
- position: relative;
62
- top: unset;
63
- inset-inline-end: unset;
64
- }
65
- </style>