@stainless-api/docs 0.1.0-beta.2 → 0.1.0-beta.20

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 (91) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/components/variables.css +1 -27
  3. package/eslint-suppressions.json +47 -0
  4. package/locals.d.ts +14 -0
  5. package/package.json +30 -27
  6. package/plugin/buildAlgoliaIndex.ts +29 -4
  7. package/plugin/cms/server.ts +97 -54
  8. package/plugin/cms/sidebar-builder.ts +6 -25
  9. package/plugin/cms/worker.ts +2 -2
  10. package/plugin/components/SnippetCode.tsx +7 -4
  11. package/plugin/components/search/SearchAlgolia.astro +0 -7
  12. package/plugin/components/search/SearchIsland.tsx +30 -17
  13. package/plugin/generateAPIReferenceLink.ts +1 -1
  14. package/plugin/globalJs/ai-dropdown-options.ts +161 -0
  15. package/plugin/globalJs/navigation.ts +0 -23
  16. package/plugin/helpers/getPageLoadEvent.ts +1 -1
  17. package/plugin/index.ts +49 -17
  18. package/plugin/languages.ts +1 -1
  19. package/plugin/loadPluginConfig.ts +92 -13
  20. package/plugin/react/Routing.tsx +30 -33
  21. package/plugin/referencePlaceholderUtils.ts +1 -1
  22. package/plugin/replaceSidebarPlaceholderMiddleware.ts +4 -0
  23. package/plugin/routes/Docs.astro +59 -85
  24. package/plugin/routes/Overview.astro +9 -15
  25. package/plugin/routes/markdown.ts +1 -1
  26. package/plugin/vendor/preview.worker.docs.js +6357 -6132
  27. package/resolveSrcFile.ts +10 -0
  28. package/shared/getSharedLogger.ts +15 -0
  29. package/shared/terminalUtils.ts +3 -0
  30. package/src/content.config.ts +9 -0
  31. package/stl-docs/components/AIDropdown.tsx +52 -0
  32. package/stl-docs/components/Head.astro +9 -0
  33. package/stl-docs/components/Header.astro +3 -2
  34. package/stl-docs/components/PageTitle.astro +65 -0
  35. package/stl-docs/components/TableOfContents.astro +34 -0
  36. package/stl-docs/components/ThemeSelect.astro +4 -2
  37. package/stl-docs/components/content-panel/ContentPanel.astro +9 -39
  38. package/stl-docs/components/headers/DefaultHeader.astro +1 -1
  39. package/stl-docs/components/headers/HeaderLinks.astro +1 -1
  40. package/stl-docs/components/headers/StackedHeader.astro +30 -25
  41. package/stl-docs/components/icons/chat-gpt.tsx +17 -0
  42. package/stl-docs/components/icons/claude.tsx +10 -0
  43. package/stl-docs/components/icons/markdown.tsx +10 -0
  44. package/stl-docs/components/index.ts +2 -0
  45. package/stl-docs/components/mintlify-compat/Accordion.astro +7 -38
  46. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +9 -23
  47. package/stl-docs/components/mintlify-compat/Columns.astro +40 -42
  48. package/stl-docs/components/mintlify-compat/Frame.astro +16 -18
  49. package/stl-docs/components/mintlify-compat/Step.astro +30 -32
  50. package/stl-docs/components/mintlify-compat/Steps.astro +8 -10
  51. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +10 -3
  52. package/stl-docs/components/mintlify-compat/callouts/Check.astro +7 -3
  53. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +7 -3
  54. package/stl-docs/components/mintlify-compat/callouts/Info.astro +7 -3
  55. package/stl-docs/components/mintlify-compat/callouts/Note.astro +7 -3
  56. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +7 -3
  57. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +7 -3
  58. package/stl-docs/components/mintlify-compat/card.css +33 -35
  59. package/stl-docs/components/nav-tabs/NavDropdown.astro +1 -1
  60. package/stl-docs/components/nav-tabs/SecondaryNavTabs.astro +15 -7
  61. package/stl-docs/components/nav-tabs/buildNavLinks.ts +4 -3
  62. package/stl-docs/components/pagination/HomeLink.astro +10 -0
  63. package/stl-docs/components/pagination/Pagination.astro +173 -0
  64. package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +22 -0
  65. package/stl-docs/components/pagination/PaginationLinkQuiet.astro +13 -0
  66. package/stl-docs/components/pagination/util.ts +71 -0
  67. package/stl-docs/components/{Sidebar.astro → sidebars/BaseSidebar.astro} +2 -3
  68. package/stl-docs/components/sidebars/SDKSelectSidebar.astro +8 -0
  69. package/stl-docs/disableCalloutSyntax.ts +36 -0
  70. package/stl-docs/index.ts +76 -13
  71. package/stl-docs/loadStlDocsConfig.ts +25 -3
  72. package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +64 -0
  73. package/stl-docs/proseMarkdown/proseMarkdownMiddleware.ts +34 -0
  74. package/stl-docs/proseMarkdown/toMarkdown.ts +158 -0
  75. package/stl-docs/tabsMiddleware.ts +12 -4
  76. package/styles/code.css +115 -127
  77. package/styles/fonts.css +24 -9
  78. package/styles/links.css +10 -49
  79. package/styles/overrides.css +55 -57
  80. package/styles/page.css +89 -59
  81. package/styles/sdk_select.css +6 -7
  82. package/styles/search.css +65 -67
  83. package/styles/sidebar.css +199 -128
  84. package/styles/toc.css +37 -33
  85. package/theme.css +9 -1
  86. package/tsconfig.json +2 -5
  87. package/virtual-module.d.ts +4 -1
  88. package/plugin/globalJs/ai-dropdown.ts +0 -57
  89. package/stl-docs/components/APIReferenceAIDropdown.tsx +0 -86
  90. package/stl-docs/components/content-panel/ProseAIDropdown.tsx +0 -64
  91. /package/stl-docs/components/{content-panel/ContentBreadcrumbs.tsx → ContentBreadcrumbs.tsx} +0 -0
@@ -16,51 +16,49 @@ const { cols } = Astro.props;
16
16
  </div>
17
17
 
18
18
  <style>
19
- @layer stl-ui-mintlify-compat {
20
- .stl-ui-mintlify-compat-columns {
21
- display: grid;
22
- gap: 1rem;
23
- grid-template-columns: 1fr;
19
+ .stl-ui-mintlify-compat-columns {
20
+ display: grid;
21
+ gap: 1rem;
22
+ grid-template-columns: 1fr;
24
23
 
25
- > [data-stl-ui-element] {
26
- margin: 0;
27
- }
24
+ > [data-stl-ui-element] {
25
+ margin: 0;
28
26
  }
27
+ }
29
28
 
30
- @media (min-width: 50rem) {
31
- .stl-ui-mintlify-compat-columns--2 {
32
- grid-template-columns: repeat(2, minmax(0, 1fr));
33
- }
34
- .stl-ui-mintlify-compat-columns--3 {
35
- grid-template-columns: repeat(3, minmax(0, 1fr));
36
- }
37
- .stl-ui-mintlify-compat-columns--4 {
38
- grid-template-columns: repeat(4, minmax(0, 1fr));
39
- }
40
- .stl-ui-mintlify-compat-columns--5 {
41
- grid-template-columns: repeat(5, minmax(0, 1fr));
42
- }
43
- .stl-ui-mintlify-compat-columns--6 {
44
- grid-template-columns: repeat(6, minmax(0, 1fr));
45
- }
46
- .stl-ui-mintlify-compat-columns--7 {
47
- grid-template-columns: repeat(7, minmax(0, 1fr));
48
- }
49
- .stl-ui-mintlify-compat-columns--8 {
50
- grid-template-columns: repeat(8, minmax(0, 1fr));
51
- }
52
- .stl-ui-mintlify-compat-columns--9 {
53
- grid-template-columns: repeat(9, minmax(0, 1fr));
54
- }
55
- .stl-ui-mintlify-compat-columns--10 {
56
- grid-template-columns: repeat(10, minmax(0, 1fr));
57
- }
58
- .stl-ui-mintlify-compat-columns--11 {
59
- grid-template-columns: repeat(11, minmax(0, 1fr));
60
- }
61
- .stl-ui-mintlify-compat-columns--12 {
62
- grid-template-columns: repeat(12, minmax(0, 1fr));
63
- }
29
+ @media (min-width: 50rem) {
30
+ .stl-ui-mintlify-compat-columns--2 {
31
+ grid-template-columns: repeat(2, minmax(0, 1fr));
32
+ }
33
+ .stl-ui-mintlify-compat-columns--3 {
34
+ grid-template-columns: repeat(3, minmax(0, 1fr));
35
+ }
36
+ .stl-ui-mintlify-compat-columns--4 {
37
+ grid-template-columns: repeat(4, minmax(0, 1fr));
38
+ }
39
+ .stl-ui-mintlify-compat-columns--5 {
40
+ grid-template-columns: repeat(5, minmax(0, 1fr));
41
+ }
42
+ .stl-ui-mintlify-compat-columns--6 {
43
+ grid-template-columns: repeat(6, minmax(0, 1fr));
44
+ }
45
+ .stl-ui-mintlify-compat-columns--7 {
46
+ grid-template-columns: repeat(7, minmax(0, 1fr));
47
+ }
48
+ .stl-ui-mintlify-compat-columns--8 {
49
+ grid-template-columns: repeat(8, minmax(0, 1fr));
50
+ }
51
+ .stl-ui-mintlify-compat-columns--9 {
52
+ grid-template-columns: repeat(9, minmax(0, 1fr));
53
+ }
54
+ .stl-ui-mintlify-compat-columns--10 {
55
+ grid-template-columns: repeat(10, minmax(0, 1fr));
56
+ }
57
+ .stl-ui-mintlify-compat-columns--11 {
58
+ grid-template-columns: repeat(11, minmax(0, 1fr));
59
+ }
60
+ .stl-ui-mintlify-compat-columns--12 {
61
+ grid-template-columns: repeat(12, minmax(0, 1fr));
64
62
  }
65
63
  }
66
64
  </style>
@@ -12,26 +12,24 @@ const { caption } = Astro.props;
12
12
  </div>
13
13
 
14
14
  <style>
15
- @layer stl-ui-mintlify-compat {
16
- .stl-ui-mintlify-compat-frame {
17
- padding: 6px;
18
- border-radius: 10px;
19
- background-color: var(--sl-color-gray-7);
20
- border: 1px solid var(--sl-color-gray-6);
15
+ .stl-ui-mintlify-compat-frame {
16
+ padding: 6px;
17
+ border-radius: 10px;
18
+ background-color: var(--sl-color-gray-7);
19
+ border: 1px solid var(--sl-color-gray-6);
21
20
 
22
- .stl-ui-mintlify-compat-frame-content {
23
- border-radius: 8px;
24
- overflow: hidden;
25
- }
21
+ .stl-ui-mintlify-compat-frame-content {
22
+ border-radius: 8px;
23
+ overflow: hidden;
24
+ }
26
25
 
27
- .stl-ui-mintlify-compat-frame-caption {
28
- text-align: center;
29
- padding-top: 12px;
30
- padding-bottom: 6px;
31
- font-size: var(--sl-text-body);
32
- color: var(--sl-color-gray-3);
33
- line-height: 100%;
34
- }
26
+ .stl-ui-mintlify-compat-frame-caption {
27
+ text-align: center;
28
+ padding-top: 12px;
29
+ padding-bottom: 6px;
30
+ font-size: var(--sl-text-body);
31
+ color: var(--sl-color-gray-3);
32
+ line-height: 100%;
35
33
  }
36
34
  }
37
35
  </style>
@@ -15,44 +15,42 @@ const { title } = Astro.props;
15
15
  </li>
16
16
 
17
17
  <style>
18
- @layer stl-ui-mintlify-compat {
19
- .stl-ui-mintlify-compat-step {
20
- display: flex;
18
+ .stl-ui-mintlify-compat-step {
19
+ display: flex;
21
20
 
22
- &:not(:first-child) {
23
- margin-top: 1rem;
24
- }
21
+ &:not(:first-child) {
22
+ margin-top: 1rem;
25
23
  }
24
+ }
25
+
26
+ .stl-ui-mintlify-compat-step-step-number {
27
+ margin-right: 1rem;
28
+ display: flex;
29
+ align-items: top;
30
+ justify-content: center;
31
+ margin-top: 4px;
26
32
 
27
- .stl-ui-mintlify-compat-step-step-number {
28
- margin-right: 1rem;
33
+ &::before {
34
+ counter-increment: ui-steps;
35
+ content: counter(ui-steps);
36
+ border-radius: 50%;
37
+ height: 1.5rem;
38
+ width: 1.5rem;
39
+ font-size: 0.8rem;
40
+ color: var(--sl-color-text);
41
+ font-weight: 600;
42
+ background-color: var(--sl-color-gray-5);
29
43
  display: flex;
30
- align-items: top;
44
+ align-items: center;
31
45
  justify-content: center;
32
- margin-top: 4px;
33
-
34
- &::before {
35
- counter-increment: ui-steps;
36
- content: counter(ui-steps);
37
- border-radius: 50%;
38
- height: 1.5rem;
39
- width: 1.5rem;
40
- font-size: 0.8rem;
41
- color: var(--sl-color-text);
42
- font-weight: 600;
43
- background-color: var(--sl-color-gray-5);
44
- display: flex;
45
- align-items: center;
46
- justify-content: center;
47
- }
48
46
  }
47
+ }
49
48
 
50
- .stl-ui-mintlify-compat-step-title {
51
- font-weight: 600;
52
- color: var(--sl-color-text);
53
- }
54
- .stl-ui-mintlify-compat-step-content {
55
- margin-top: 0.5rem;
56
- }
49
+ .stl-ui-mintlify-compat-step-title {
50
+ font-weight: 600;
51
+ color: var(--sl-color-text);
52
+ }
53
+ .stl-ui-mintlify-compat-step-content {
54
+ margin-top: 0.5rem;
57
55
  }
58
56
  </style>
@@ -1,17 +1,15 @@
1
1
  <ol class="stl-ui-mintlify-compat-steps"><slot /></ol>
2
2
 
3
3
  <style>
4
- @layer stl-ui-mintlify-compat {
5
- .stl-ui-mintlify-compat-steps {
6
- counter-reset: ui-steps;
7
- list-style: none;
8
- margin: 0;
9
- padding: 0;
10
- margin-top: 1rem;
4
+ .stl-ui-mintlify-compat-steps {
5
+ counter-reset: ui-steps;
6
+ list-style: none;
7
+ margin: 0;
8
+ padding: 0;
9
+ margin-top: 1rem;
11
10
 
12
- * {
13
- margin: 0;
14
- }
11
+ * {
12
+ margin: 0;
15
13
  }
16
14
  }
17
15
  </style>
@@ -1,7 +1,14 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout as StainlessCallout, type CalloutVariant } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ variant?: CalloutVariant;
6
+ children: astroHTML.JSX.Children;
7
+ }
8
+
9
+ const { variant } = Astro.props;
3
10
  ---
4
11
 
5
- <Aside>
12
+ <StainlessCallout variant={variant}>
6
13
  <slot />
7
- </Aside>
14
+ </StainlessCallout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside>
9
+ <Callout variant="success">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside type="danger">
9
+ <Callout variant="danger">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside>
9
+ <Callout variant="info">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside>
9
+ <Callout variant="note">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside type="tip">
9
+ <Callout variant="tip">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { Aside } from '@astrojs/starlight/components';
2
+ import { Callout } from '@stainless-api/ui-primitives';
3
+
4
+ export interface Props {
5
+ children: astroHTML.JSX.Children;
6
+ }
3
7
  ---
4
8
 
5
- <Aside type="caution">
9
+ <Callout variant="warning">
6
10
  <slot />
7
- </Aside>
11
+ </Callout>
@@ -1,44 +1,42 @@
1
- @layer stl-ui-mintlify-compat {
2
- .stl-ui-mintlify-compat-card {
3
- border-radius: 12px;
4
- padding: 16px;
5
- font-size: var(--sl-text-body);
6
- display: flex;
7
- gap: 8px;
8
- border: 1px solid var(--sl-color-hairline);
9
- flex-direction: column;
10
-
11
- .stl-ui-mintlify-compat-card-icon svg {
12
- color: var(--sl-color-accent);
13
- }
1
+ .stl-ui-mintlify-compat-card {
2
+ border-radius: 12px;
3
+ padding: 16px;
4
+ font-size: var(--sl-text-body);
5
+ display: flex;
6
+ gap: 8px;
7
+ border: 1px solid var(--sl-color-hairline);
8
+ flex-direction: column;
14
9
 
15
- .stl-ui-mintlify-compat-card-title {
16
- font-weight: 600;
17
- font-size: 1.125rem;
18
- display: flex;
19
- align-items: center;
20
- gap: 8px;
21
- margin-top: 8px;
22
- }
10
+ .stl-ui-mintlify-compat-card-icon svg {
11
+ color: var(--sl-color-accent);
12
+ }
23
13
 
24
- .stl-ui-mintlify-compat-card-content {
25
- margin-top: 0;
26
- color: var(--sl-color-text-secondary);
27
- }
14
+ .stl-ui-mintlify-compat-card-title {
15
+ font-weight: 600;
16
+ font-size: 1.125rem;
17
+ display: flex;
18
+ align-items: center;
19
+ gap: 8px;
20
+ margin-top: 8px;
28
21
  }
29
22
 
30
- a.stl-ui-mintlify-compat-card {
31
- text-decoration: none;
23
+ .stl-ui-mintlify-compat-card-content {
24
+ margin-top: 0;
32
25
  color: var(--sl-color-text-secondary);
33
-
34
- &:hover {
35
- border-color: var(--sl-color-accent);
36
- }
37
26
  }
27
+ }
28
+
29
+ a.stl-ui-mintlify-compat-card {
30
+ text-decoration: none;
31
+ color: var(--sl-color-text-secondary);
38
32
 
39
- .stl-ui-mintlify-compat-card-group {
40
- display: grid;
41
- gap: 1rem;
42
- grid-template-columns: repeat(2, minmax(0, 1fr));
33
+ &:hover {
34
+ border-color: var(--sl-color-accent);
43
35
  }
44
36
  }
37
+
38
+ .stl-ui-mintlify-compat-card-group {
39
+ display: grid;
40
+ gap: 1rem;
41
+ grid-template-columns: repeat(2, minmax(0, 1fr));
42
+ }
@@ -17,7 +17,7 @@ const BUTTON_ID = 'nav-dropdown-button';
17
17
 
18
18
  const navLinks = buildNavLinks(Astro.locals.starlightRoute);
19
19
 
20
- const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]).label;
20
+ const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]!).label;
21
21
  ---
22
22
 
23
23
  <div class="stldocs-root nav-dropdown-root">
@@ -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,13 +45,26 @@ 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
 
56
65
  @media (min-width: 50rem) {
57
66
  .stl-secondary-nav-tabs {
58
67
  display: block;
59
- padding-left: 0.55rem;
60
68
  }
61
69
  }
62
70
  </style>
@@ -1,9 +1,10 @@
1
1
  import type { StarlightRouteData } from '@astrojs/starlight/route-data';
2
- import { TABS } from 'virtual:stl-stl-starlight-virtual-module';
2
+ import { TABS } from 'virtual:stl-docs-virtual-module';
3
+ import type { StarlightRouteWithStlDocs } from '../../tabsMiddleware';
3
4
 
4
5
  export function buildNavLinks(starlightRoute: StarlightRouteData) {
5
- // TODO: specify the type of Astro.locals.starlightRoute._stlStarlight
6
- const activeTabIndex = starlightRoute._stlStarlight?.activeTabIndex;
6
+ const routeData: StarlightRouteWithStlDocs = starlightRoute;
7
+ const activeTabIndex = routeData?._stlDocs?.activeTabIndex;
7
8
 
8
9
  const navLinks = TABS.map((item, index) => ({
9
10
  ...item,
@@ -0,0 +1,10 @@
1
+ ---
2
+ import { base } from 'astro:config/client';
3
+ import { HomeIcon } from 'lucide-react';
4
+ import PaginationLinkQuiet from './PaginationLinkQuiet.astro';
5
+ ---
6
+
7
+ <PaginationLinkQuiet href={base}>
8
+ <HomeIcon slot="icon" />
9
+ Home
10
+ </PaginationLinkQuiet>