sourcey 3.4.1 → 3.4.4
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/dist/client/scroll-tracker.js +168 -156
- package/dist/client/search.js +186 -179
- package/dist/client/sidebar.js +56 -48
- package/dist/client/tabs.js +154 -146
- package/dist/components/layout/Head.d.ts.map +1 -1
- package/dist/components/layout/Head.js +4 -12
- package/dist/components/layout/Header.js +2 -2
- package/dist/components/layout/Page.d.ts.map +1 -1
- package/dist/components/layout/Page.js +9 -9
- package/dist/components/layout/Sidebar.js +6 -6
- package/dist/components/openapi/EndpointBar.js +5 -5
- package/dist/components/openapi/Introduction.js +1 -1
- package/dist/components/openapi/Responses.js +4 -4
- package/dist/components/openapi/Security.d.ts.map +1 -1
- package/dist/components/openapi/Security.js +2 -4
- package/dist/components/ui/SectionLabel.js +1 -1
- package/dist/config.js +3 -3
- package/dist/core/doxygen-loader.d.ts +1 -0
- package/dist/core/doxygen-loader.d.ts.map +1 -1
- package/dist/core/doxygen-loader.js +12 -3
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +111 -12
- package/dist/dev-server.js +2 -1
- package/dist/index.js +1 -1
- package/dist/init.js +1 -1
- package/dist/themes/default/main.css +3 -3
- package/dist/themes/default/sourcey.css +38 -48
- package/dist/utils/markdown.d.ts +10 -0
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +29 -0
- package/package.json +1 -1
package/dist/client/tabs.js
CHANGED
|
@@ -5,187 +5,195 @@
|
|
|
5
5
|
// 2. Response tabs — switches .response-tab active state + .response-panel
|
|
6
6
|
// 3. Copy button — copies code from the active panel to clipboard
|
|
7
7
|
(function () {
|
|
8
|
-
|
|
8
|
+
function init() {
|
|
9
|
+
var selectedLang = null;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
// ── Language Dropdown ──────────────────────────────────────────────
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Toggle dropdown open/close
|
|
14
|
+
document.addEventListener('click', function (e) {
|
|
15
|
+
var trigger = e.target.closest('.code-lang-trigger');
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
// Close all open dropdowns first
|
|
18
|
+
document.querySelectorAll('.code-lang-menu').forEach(function (menu) {
|
|
19
|
+
if (!trigger || !menu.parentElement.contains(trigger)) {
|
|
20
|
+
menu.classList.add('hidden');
|
|
21
|
+
var btn = menu.parentElement.querySelector('.code-lang-trigger');
|
|
22
|
+
if (btn) btn.setAttribute('aria-expanded', 'false');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
if (!trigger) return;
|
|
27
|
+
e.stopPropagation();
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var menu = trigger.nextElementSibling;
|
|
30
|
+
if (!menu) return;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
var isOpen = !menu.classList.contains('hidden');
|
|
33
|
+
menu.classList.toggle('hidden', isOpen);
|
|
34
|
+
trigger.setAttribute('aria-expanded', isOpen ? 'false' : 'true');
|
|
35
|
+
});
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// Select a language from the dropdown
|
|
38
|
+
document.addEventListener('click', function (e) {
|
|
39
|
+
var option = e.target.closest('.code-lang-option');
|
|
40
|
+
if (!option) return;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
var container = option.closest('.code-group');
|
|
43
|
+
var index = option.getAttribute('data-lang-index');
|
|
44
|
+
var lang = option.textContent.trim();
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
// Close the menu
|
|
47
|
+
var menu = option.closest('.code-lang-menu');
|
|
48
|
+
if (menu) {
|
|
49
|
+
menu.classList.add('hidden');
|
|
50
|
+
var trigger = menu.parentElement.querySelector('.code-lang-trigger');
|
|
51
|
+
if (trigger) trigger.setAttribute('aria-expanded', 'false');
|
|
52
|
+
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
var scrollY = window.scrollY;
|
|
55
|
+
activateLang(container, index);
|
|
56
|
+
|
|
57
|
+
// Sync language across all code-sample groups
|
|
58
|
+
if (lang !== selectedLang) {
|
|
59
|
+
selectedLang = lang;
|
|
60
|
+
document.querySelectorAll('.code-group').forEach(function (group) {
|
|
61
|
+
if (group === container || !group.querySelector('.code-lang-dropdown')) return;
|
|
62
|
+
group.querySelectorAll('.code-lang-option').forEach(function (opt) {
|
|
63
|
+
if (opt.textContent.trim() === lang) {
|
|
64
|
+
activateLang(group, opt.getAttribute('data-lang-index'));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
65
67
|
});
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
window.scrollTo(0, scrollY);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
function activateLang(container, index) {
|
|
73
|
-
// Update dropdown label
|
|
74
|
-
var options = container.querySelectorAll('.code-lang-option');
|
|
75
|
-
var label = container.querySelector('.code-lang-label');
|
|
76
|
-
options.forEach(function (opt) {
|
|
77
|
-
var isActive = opt.getAttribute('data-lang-index') === index;
|
|
78
|
-
opt.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
79
|
-
opt.className = opt.className.replace(/(dark:)?text-\[rgb\([^\]]+\)\]/g, '').trim();
|
|
80
|
-
if (isActive) {
|
|
81
|
-
opt.classList.add('text-[rgb(var(--color-primary))]', 'dark:text-[rgb(var(--color-primary-light))]');
|
|
82
|
-
if (label) label.textContent = opt.textContent.trim();
|
|
83
|
-
// Update trigger icon to match selected language
|
|
84
|
-
var triggerIcon = container.querySelector('.code-lang-trigger .code-lang-icon');
|
|
85
|
-
var optIcon = opt.querySelector('.lang-icon');
|
|
86
|
-
if (triggerIcon && optIcon) {
|
|
87
|
-
triggerIcon.innerHTML = optIcon.outerHTML;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
opt.classList.add('text-[rgb(var(--color-stone-600))]', 'dark:text-[rgb(var(--color-stone-400))]');
|
|
91
68
|
}
|
|
92
|
-
});
|
|
93
69
|
|
|
94
|
-
|
|
95
|
-
container.querySelectorAll('.code-lang-panel').forEach(function (p) {
|
|
96
|
-
p.classList.toggle('active', p.getAttribute('data-lang-panel') === index);
|
|
70
|
+
window.scrollTo(0, scrollY);
|
|
97
71
|
});
|
|
98
|
-
}
|
|
99
72
|
|
|
100
|
-
|
|
73
|
+
function activateLang(container, index) {
|
|
74
|
+
// Update dropdown label
|
|
75
|
+
var options = container.querySelectorAll('.code-lang-option');
|
|
76
|
+
var label = container.querySelector('.code-lang-label');
|
|
77
|
+
options.forEach(function (opt) {
|
|
78
|
+
var isActive = opt.getAttribute('data-lang-index') === index;
|
|
79
|
+
opt.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
80
|
+
opt.className = opt.className.replace(/(dark:)?text-\[rgb\([^\]]+\)\]/g, '').trim();
|
|
81
|
+
if (isActive) {
|
|
82
|
+
opt.classList.add('text-[rgb(var(--color-primary))]', 'dark:text-[rgb(var(--color-primary-light))]');
|
|
83
|
+
if (label) label.textContent = opt.textContent.trim();
|
|
84
|
+
// Update trigger icon to match selected language
|
|
85
|
+
var triggerIcon = container.querySelector('.code-lang-trigger .code-lang-icon');
|
|
86
|
+
var optIcon = opt.querySelector('.lang-icon');
|
|
87
|
+
if (triggerIcon && optIcon) {
|
|
88
|
+
triggerIcon.innerHTML = optIcon.outerHTML;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
opt.classList.add('text-[rgb(var(--color-stone-600))]', 'dark:text-[rgb(var(--color-stone-400))]');
|
|
92
|
+
}
|
|
93
|
+
});
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
// Update panels
|
|
96
|
+
container.querySelectorAll('.code-lang-panel').forEach(function (p) {
|
|
97
|
+
p.classList.toggle('active', p.getAttribute('data-lang-panel') === index);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
105
100
|
|
|
106
|
-
|
|
107
|
-
var index = tab.getAttribute('data-response-index');
|
|
108
|
-
var scrollY = window.scrollY;
|
|
101
|
+
// ── Response Tabs ──────────────────────────────────────────────────
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
t.classList.toggle('active', isActive);
|
|
114
|
-
t.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
115
|
-
});
|
|
103
|
+
document.addEventListener('click', function (e) {
|
|
104
|
+
var tab = e.target.closest('.response-tab');
|
|
105
|
+
if (!tab) return;
|
|
116
106
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
var container = tab.closest('.response-tabs');
|
|
108
|
+
var index = tab.getAttribute('data-response-index');
|
|
109
|
+
var scrollY = window.scrollY;
|
|
110
|
+
|
|
111
|
+
// Update tabs
|
|
112
|
+
container.querySelectorAll('.response-tab').forEach(function (t) {
|
|
113
|
+
var isActive = t.getAttribute('data-response-index') === index;
|
|
114
|
+
t.classList.toggle('active', isActive);
|
|
115
|
+
t.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
116
|
+
});
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
// Update panels
|
|
119
|
+
container.querySelectorAll('.response-panel').forEach(function (p) {
|
|
120
|
+
p.classList.toggle('active', p.getAttribute('data-response-panel') === index);
|
|
121
|
+
});
|
|
124
122
|
|
|
125
|
-
|
|
123
|
+
window.scrollTo(0, scrollY);
|
|
124
|
+
});
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
var btn = e.target.closest('.copy-btn');
|
|
129
|
-
if (!btn) return;
|
|
126
|
+
// ── Copy Button ────────────────────────────────────────────────────
|
|
130
127
|
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
document.addEventListener('click', function (e) {
|
|
129
|
+
var btn = e.target.closest('.copy-btn');
|
|
130
|
+
if (!btn) return;
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var codeEl = activePanel
|
|
137
|
-
? activePanel.querySelector('code, .code-block, .font-mono')
|
|
138
|
-
: container.querySelector('code, .code-block, .font-mono');
|
|
132
|
+
var container = btn.closest('.code-group') || btn.closest('.prose-code-block');
|
|
133
|
+
if (!container) return;
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
// Find the active panel's code, or the nearest code element
|
|
136
|
+
var activePanel = container.querySelector('.code-lang-panel.active, .response-panel.active');
|
|
137
|
+
var codeEl = activePanel
|
|
138
|
+
? activePanel.querySelector('code, .code-block, .font-mono')
|
|
139
|
+
: container.querySelector('code, .code-block, .font-mono');
|
|
141
140
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
tooltip
|
|
148
|
-
}
|
|
149
|
-
setTimeout(function () {
|
|
150
|
-
btn.classList.remove('copied');
|
|
141
|
+
if (!codeEl) return;
|
|
142
|
+
|
|
143
|
+
var text = codeEl.textContent || '';
|
|
144
|
+
navigator.clipboard.writeText(text).then(function () {
|
|
145
|
+
btn.classList.add('copied');
|
|
146
|
+
var tooltip = btn.nextElementSibling;
|
|
151
147
|
if (tooltip && tooltip.classList.contains('copy-tooltip')) {
|
|
152
|
-
tooltip.textContent = '
|
|
148
|
+
tooltip.textContent = 'Copied!';
|
|
153
149
|
}
|
|
154
|
-
|
|
150
|
+
setTimeout(function () {
|
|
151
|
+
btn.classList.remove('copied');
|
|
152
|
+
if (tooltip && tooltip.classList.contains('copy-tooltip')) {
|
|
153
|
+
tooltip.textContent = 'Copy';
|
|
154
|
+
}
|
|
155
|
+
}, 2000);
|
|
156
|
+
});
|
|
155
157
|
});
|
|
156
|
-
});
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
// Close dropdowns on Escape
|
|
160
|
+
document.addEventListener('keydown', function (e) {
|
|
161
|
+
if (e.key === 'Escape') {
|
|
162
|
+
document.querySelectorAll('.code-lang-menu').forEach(function (menu) {
|
|
163
|
+
menu.classList.add('hidden');
|
|
164
|
+
var btn = menu.parentElement.querySelector('.code-lang-trigger');
|
|
165
|
+
if (btn) btn.setAttribute('aria-expanded', 'false');
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
// ── Directive Tabs (:::tabs and :::code-group) ────────────────────
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
document.addEventListener('click', function (e) {
|
|
173
|
+
var tab = e.target.closest('.directive-tab');
|
|
174
|
+
if (!tab) return;
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
var group = tab.getAttribute('data-tab-group');
|
|
177
|
+
var index = tab.getAttribute('data-tab-index');
|
|
178
|
+
var scrollY = window.scrollY;
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
// Update tab buttons
|
|
181
|
+
document.querySelectorAll('.directive-tab[data-tab-group="' + group + '"]').forEach(function (t) {
|
|
182
|
+
t.classList.toggle('active', t.getAttribute('data-tab-index') === index);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Update panels
|
|
186
|
+
document.querySelectorAll('.directive-tab-panel[data-tab-group="' + group + '"]').forEach(function (p) {
|
|
187
|
+
p.classList.toggle('active', p.getAttribute('data-tab-index') === index);
|
|
188
|
+
});
|
|
183
189
|
|
|
184
|
-
|
|
185
|
-
document.querySelectorAll('.directive-tab-panel[data-tab-group="' + group + '"]').forEach(function (p) {
|
|
186
|
-
p.classList.toggle('active', p.getAttribute('data-tab-index') === index);
|
|
190
|
+
window.scrollTo(0, scrollY);
|
|
187
191
|
});
|
|
192
|
+
}
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
if ('requestIdleCallback' in window) {
|
|
195
|
+
window.requestIdleCallback(init, { timeout: 250 });
|
|
196
|
+
} else {
|
|
197
|
+
window.addEventListener('load', init, { once: true });
|
|
198
|
+
}
|
|
191
199
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,iCAqEnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
import { useContext } from "preact/hooks";
|
|
3
3
|
import { SpecContext, OptionsContext, PageContext, SiteContext, NavigationContext } from "../../renderer/context.js";
|
|
4
4
|
import { langIconCSS } from "../../utils/lang-icons.js";
|
|
@@ -21,21 +21,13 @@ export function Head() {
|
|
|
21
21
|
// Mobile: h-16 row + h-14 breadcrumb = 7.5rem (always).
|
|
22
22
|
const headerHeight = nav.tabs.length > 1 ? "7rem" : "4rem";
|
|
23
23
|
const headerHeightMobile = "7.5rem";
|
|
24
|
-
|
|
25
|
-
const systemFonts = new Set(["system-ui", "sans-serif", "serif", "monospace", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Consolas", "SF Mono", "Fira Code", "Cascadia Code"]);
|
|
26
|
-
function extractFontName(stack) {
|
|
27
|
-
const m = stack.match(/^'([^']+)'/);
|
|
28
|
-
return m && !systemFonts.has(m[1]) ? m[1] : null;
|
|
29
|
-
}
|
|
30
|
-
const googleFonts = [extractFontName(fonts.sans), extractFontName(fonts.mono)].filter(Boolean);
|
|
31
|
-
const googleFontsUrl = googleFonts.length
|
|
32
|
-
? "https://fonts.googleapis.com/css2?" + googleFonts.map(f => `family=${encodeURIComponent(f)}:wght@300;400;500;600;700`).join("&") + "&display=swap"
|
|
33
|
-
: null;
|
|
24
|
+
const showLangIconCSS = page.kind === "spec" && site.codeSamples.length > 0;
|
|
34
25
|
const themeCSS = `
|
|
35
26
|
:root {
|
|
36
27
|
--color-primary: ${colors.primary};
|
|
37
28
|
--color-primary-light: ${colors.light};
|
|
38
29
|
--color-primary-dark: ${colors.dark};
|
|
30
|
+
--color-primary-ink: ${colors.dark};
|
|
39
31
|
--color-background-light: 255 255 255;
|
|
40
32
|
--color-background-dark: 11 12 16;
|
|
41
33
|
--font-sans: ${fonts.sans};
|
|
@@ -52,5 +44,5 @@ export function Head() {
|
|
|
52
44
|
body { margin: 0; background: rgb(var(--color-background-light)); }
|
|
53
45
|
.dark body { background: rgb(var(--color-background-dark)); }
|
|
54
46
|
`;
|
|
55
|
-
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "generator", content: `Sourcey ${pkg.version}` }), _jsx("meta", { property: "og:title", content: pageTitle }), _jsx("meta", { property: "og:description", content: pageDescription }), _jsx("meta", { property: "og:type", content: "website" }), siteName && _jsx("meta", { property: "og:site_name", content: siteName }), _jsx("meta", { name: "twitter:card", content: "summary" }), _jsx("meta", { name: "twitter:title", content: pageTitle }), _jsx("meta", { name: "twitter:description", content: pageDescription }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }),
|
|
47
|
+
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "generator", content: `Sourcey ${pkg.version}` }), _jsx("meta", { property: "og:title", content: pageTitle }), _jsx("meta", { property: "og:description", content: pageDescription }), _jsx("meta", { property: "og:type", content: "website" }), siteName && _jsx("meta", { property: "og:site_name", content: siteName }), _jsx("meta", { name: "twitter:card", content: "summary" }), _jsx("meta", { name: "twitter:title", content: pageTitle }), _jsx("meta", { name: "twitter:description", content: pageDescription }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), showLangIconCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }), _jsx("link", { rel: "stylesheet", href: `${options.assetBase}sourcey.css` }), site.favicon && _jsx("link", { rel: "icon", href: site.favicon })] }));
|
|
56
48
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
2
|
import { useContext } from "preact/hooks";
|
|
3
3
|
import { NavigationContext, OptionsContext, SiteContext } from "../../renderer/context.js";
|
|
4
|
-
import { SocialIcon } from "../ui/SocialIcon.js";
|
|
4
|
+
import { SocialIcon, socialLabels } from "../ui/SocialIcon.js";
|
|
5
5
|
import { Logo } from "../ui/Logo.js";
|
|
6
6
|
function SearchIcon() {
|
|
7
7
|
return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", class: "min-w-4 flex-none", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("path", { d: "m21 21-4.3-4.3" })] }));
|
|
@@ -37,7 +37,7 @@ export function Header() {
|
|
|
37
37
|
const site = useContext(SiteContext);
|
|
38
38
|
const base = options.assetBase;
|
|
39
39
|
const logoHref = site.logo?.href ?? `${base}${nav.tabs[0]?.href ?? ""}`;
|
|
40
|
-
return (_jsxs("div", { id: "navbar", class: "z-30 fixed lg:sticky top-0 w-full", children: [_jsx("div", { class: "absolute w-full h-full flex-none border-b border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-300)/0.06)] bg-[rgb(var(--color-background-light))] dark:bg-[rgb(var(--color-background-dark))]" }), _jsxs("div", { class: "max-w-[92rem] mx-auto relative", children: [_jsx("div", { class: "relative", children: _jsx("div", { class: "flex items-center lg:px-12 h-16 min-w-0 mx-4 lg:mx-0", children: _jsxs("div", { class: "h-full relative flex-1 flex items-center gap-x-4 min-w-0 border-b border-[rgb(var(--color-gray-500)/0.08)] dark:border-[rgb(var(--color-gray-300)/0.08)]", children: [_jsx("div", { class: "flex-1 flex items-center gap-x-4", children: _jsx(Logo, { href: logoHref, logo: site.logo, name: site.name }) }), _jsx("div", { class: "relative hidden lg:flex items-center flex-1 z-20 gap-2", children: _jsx("button", { id: "search-open", type: "button",
|
|
40
|
+
return (_jsxs("div", { id: "navbar", class: "z-30 fixed lg:sticky top-0 w-full", children: [_jsx("div", { class: "absolute w-full h-full flex-none border-b border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-300)/0.06)] bg-[rgb(var(--color-background-light))] dark:bg-[rgb(var(--color-background-dark))]" }), _jsxs("div", { class: "max-w-[92rem] mx-auto relative", children: [_jsx("div", { class: "relative", children: _jsx("div", { class: "flex items-center lg:px-12 h-16 min-w-0 mx-4 lg:mx-0", children: _jsxs("div", { class: "h-full relative flex-1 flex items-center gap-x-4 min-w-0 border-b border-[rgb(var(--color-gray-500)/0.08)] dark:border-[rgb(var(--color-gray-300)/0.08)]", children: [_jsx("div", { class: "flex-1 flex items-center gap-x-4", children: _jsx(Logo, { href: logoHref, logo: site.logo, name: site.name }) }), _jsx("div", { class: "relative hidden lg:flex items-center flex-1 z-20 gap-2", children: _jsx("button", { id: "search-open", type: "button", class: "group flex pointer-events-auto rounded-lg w-full items-center text-sm leading-6 h-9 pl-3.5 pr-3 text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))] ring-1 ring-[rgb(var(--color-gray-400)/0.3)] hover:ring-[rgb(var(--color-gray-600)/0.3)] dark:ring-[rgb(var(--color-gray-600)/0.3)] dark:hover:ring-[rgb(var(--color-gray-500)/0.3)] justify-between truncate gap-2 min-w-[43px] cursor-pointer bg-[rgb(var(--color-background-light))] dark:bg-[rgb(var(--color-background-dark))] dark:brightness-110 dark:hover:brightness-125", children: _jsxs("div", { class: "flex items-center gap-2 min-w-[42px]", children: [_jsx(SearchIcon, {}), _jsxs("div", { class: "truncate min-w-0", children: ["Type ", _jsx("kbd", { children: "/" }), " to search"] })] }) }) }), _jsxs("div", { class: "flex-1 relative hidden lg:flex items-center ml-auto justify-end space-x-4", children: [_jsx("nav", { class: "text-sm", children: _jsxs("ul", { class: "flex space-x-6 items-center", children: [site.navbar.links.map((link) => (_jsx("li", { children: _jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", "aria-label": link.label ?? socialLabels[link.type] ?? link.href, class: "text-[rgb(var(--color-gray-500))] hover:text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))] dark:hover:text-[rgb(var(--color-gray-300))]", children: link.type === "link"
|
|
41
41
|
? (link.label ?? link.href)
|
|
42
42
|
: (_jsxs(_Fragment, { children: [_jsx(SocialIcon, { type: link.type }), link.label && _jsx("span", { class: "ml-1", children: link.label })] })) }) }, link.href))), site.navbar.primary && (_jsx("li", { children: _jsxs("a", { href: site.navbar.primary.href, target: "_blank", class: "group px-4 py-1.5 relative inline-flex items-center text-sm font-medium", children: [_jsx("span", { class: "absolute inset-0 bg-[rgb(var(--color-primary-dark))] rounded-lg group-hover:opacity-90" }), _jsx("span", { class: "z-10 text-white", children: site.navbar.primary.label })] }) }))] }) }), _jsxs("button", { id: "theme-toggle", type: "button", "aria-label": "Toggle theme", class: "p-2 flex items-center justify-center cursor-pointer text-[rgb(var(--color-gray-400))] hover:text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-500))] dark:hover:text-[rgb(var(--color-gray-300))]", children: [_jsx(SunIcon, {}), _jsx(MoonIcon, {})] })] }), _jsxs("div", { class: "flex lg:hidden items-center gap-3", children: [_jsx("button", { id: "search-open-mobile", type: "button", "aria-label": "Search", class: "text-[rgb(var(--color-gray-500))] w-8 h-8 flex items-center justify-center", children: _jsx(SearchIcon, {}) }), _jsx("button", { type: "button", "data-drawer-slide": "right", "aria-label": "Open menu", class: "text-[rgb(var(--color-gray-500))] w-8 h-8 flex items-center justify-center hover:text-[rgb(var(--color-gray-600))]", children: _jsx("svg", { class: "h-4", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", children: _jsx("path", { d: "M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z" }) }) })] })] }) }) }), _jsx(MobileBreadcrumbs, { nav: nav }), nav.tabs.length > 1 && (_jsx("div", { class: "hidden lg:flex px-12 h-12", children: _jsx("div", { class: "h-full flex text-sm gap-x-6", children: nav.tabs.map((tab) => {
|
|
43
43
|
const isActive = tab.slug === nav.activeTabSlug;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Page.tsx"],"names":[],"mappings":"AAiPA,wBAAgB,IAAI,iCAqCnB"}
|
|
@@ -9,7 +9,7 @@ import { Introduction } from "../openapi/Introduction.js";
|
|
|
9
9
|
import { SecurityDefinitions } from "../openapi/Security.js";
|
|
10
10
|
import { Tags } from "../openapi/Tags.js";
|
|
11
11
|
import { Definition } from "../openapi/Definition.js";
|
|
12
|
-
import { SocialIcon } from "../ui/SocialIcon.js";
|
|
12
|
+
import { SocialIcon, socialLabels } from "../ui/SocialIcon.js";
|
|
13
13
|
import { McpConnection } from "../mcp/McpConnection.js";
|
|
14
14
|
/**
|
|
15
15
|
* Markdown page content with prose typography.
|
|
@@ -20,7 +20,7 @@ function MarkdownPageContent({ page, className = "" }) {
|
|
|
20
20
|
const activeTab = nav.tabs.find((t) => t.slug === nav.activeTabSlug);
|
|
21
21
|
const activeGroup = activeTab?.groups.find((g) => g.items.some((item) => item.id === nav.activePageSlug));
|
|
22
22
|
const eyebrow = activeGroup?.label;
|
|
23
|
-
return (_jsxs("div", { class: `relative grow box-border flex-col w-full mx-auto px-1 min-w-0 ${className}`, id: "content-area", children: [_jsxs("header", { class: "relative leading-none", children: [_jsxs("div", { class: "mt-0.5 space-y-2.5", children: [eyebrow && (_jsx("div", { class: "h-5 text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))] text-sm font-semibold", children: eyebrow })), _jsx("div", { class: "flex flex-col sm:flex-row items-start sm:items-center relative gap-2 min-w-0", children: _jsx("h1", { class: "text-2xl sm:text-3xl text-[rgb(var(--color-gray-900))] tracking-tight dark:text-[rgb(var(--color-gray-200))] font-bold", style: "overflow-wrap: anywhere", children: page.title }) })] }), page.description && (_jsx("div", { class: "page-description mt-2 text-lg prose prose-gray dark:prose-invert", style: "overflow-wrap: anywhere", children: _jsx(Markdown, { content: page.description, inline: true }) }))] }), _jsx("div", { class: "prose prose-gray dark:prose-invert relative mt-8 mb-14 max-w-none", dangerouslySetInnerHTML: { __html: page.html } }), _jsx(PageNavigation, {}), _jsx(ContentFooter, {})] }));
|
|
23
|
+
return (_jsxs("div", { class: `relative grow box-border flex-col w-full mx-auto px-1 min-w-0 ${className}`, id: "content-area", children: [_jsxs("header", { class: "relative leading-none", children: [_jsxs("div", { class: "mt-0.5 space-y-2.5", children: [eyebrow && (_jsx("div", { class: "h-5 text-[rgb(var(--color-primary-ink))] dark:text-[rgb(var(--color-primary-light))] text-sm font-semibold", children: eyebrow })), _jsx("div", { class: "flex flex-col sm:flex-row items-start sm:items-center relative gap-2 min-w-0", children: _jsx("h1", { class: "text-2xl sm:text-3xl text-[rgb(var(--color-gray-900))] tracking-tight dark:text-[rgb(var(--color-gray-200))] font-bold", style: "overflow-wrap: anywhere", children: page.title }) })] }), page.description && (_jsx("div", { class: "page-description mt-2 text-lg prose prose-gray dark:prose-invert", style: "overflow-wrap: anywhere", children: _jsx(Markdown, { content: page.description, inline: true }) }))] }), _jsx("div", { class: "prose prose-gray dark:prose-invert relative mt-8 mb-14 max-w-none", dangerouslySetInnerHTML: { __html: page.html } }), _jsx(PageNavigation, {}), _jsx(ContentFooter, {})] }));
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* OpenAPI spec page content.
|
|
@@ -28,7 +28,7 @@ function MarkdownPageContent({ page, className = "" }) {
|
|
|
28
28
|
function SpecPageContent({ className = "" }) {
|
|
29
29
|
const spec = useContext(SpecContext);
|
|
30
30
|
const serverUrl = spec.servers[0]?.url ?? "/";
|
|
31
|
-
return (_jsxs("div", { class: `relative grow box-border flex-col w-full mx-auto px-1 min-w-0 ${className}`, id: "content-area", children: [_jsxs("article", { children: [_jsx("header", { class: "mb-8", children: _jsxs("div", { class: "flex items-baseline gap-3", children: [_jsx("h1", { class: "text-2xl sm:text-3xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] tracking-tight", children: spec.info.title }), _jsxs("span", { class: "text-sm text-[rgb(var(--color-gray-400))]", children: ["v", spec.info.version] })] }) }), _jsx(Introduction, {}), spec.operations[0]?.mcpExtras?.connection && (_jsx(McpConnection, { connection: spec.operations[0].mcpExtras.connection })), _jsx(SecurityDefinitions, {}), _jsx(Tags, { tags: spec.tags, serverUrl: serverUrl }), Object.keys(spec.schemas).length > 0 && (_jsxs("div", { class: "mt-12", children: [_jsx("div", { class: "mb-6", children: _jsx("h1", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: "Models" }) }), Object.entries(spec.schemas).map(([name, schema]) => (_jsx(Definition, { name: name, schema: schema }, name)))] }))] }), _jsx(ContentFooter, {})] }));
|
|
31
|
+
return (_jsxs("div", { class: `relative grow box-border flex-col w-full mx-auto px-1 min-w-0 ${className}`, id: "content-area", children: [_jsxs("article", { children: [_jsx("header", { class: "mb-8", children: _jsxs("div", { class: "flex items-baseline gap-3", children: [_jsx("h1", { class: "text-2xl sm:text-3xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] tracking-tight", children: spec.info.title }), _jsxs("span", { class: "text-sm text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))]", children: ["v", spec.info.version] })] }) }), _jsx(Introduction, {}), spec.operations[0]?.mcpExtras?.connection && (_jsx(McpConnection, { connection: spec.operations[0].mcpExtras.connection })), _jsx(SecurityDefinitions, {}), _jsx(Tags, { tags: spec.tags, serverUrl: serverUrl }), Object.keys(spec.schemas).length > 0 && (_jsxs("div", { class: "mt-12", children: [_jsx("div", { class: "mb-6", children: _jsx("h1", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: "Models" }) }), Object.entries(spec.schemas).map(([name, schema]) => (_jsx(Definition, { name: name, schema: schema }, name)))] }))] }), _jsx(ContentFooter, {})] }));
|
|
32
32
|
}
|
|
33
33
|
function PageNavigation() {
|
|
34
34
|
const nav = useContext(NavigationContext);
|
|
@@ -45,8 +45,8 @@ function PageNavigation() {
|
|
|
45
45
|
if (!prev && !next)
|
|
46
46
|
return null;
|
|
47
47
|
const linkClass = "group flex flex-col gap-1 px-4 py-3 rounded-lg border border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-800)/0.5)] hover:border-[rgb(var(--color-primary)/0.4)] dark:hover:border-[rgb(var(--color-primary-light)/0.3)] transition-colors no-underline";
|
|
48
|
-
const labelClass = "text-xs text-[rgb(var(--color-gray-400))]";
|
|
49
|
-
const titleClass = "text-sm font-medium text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-300))] group-hover:text-[rgb(var(--color-primary))] dark:group-hover:text-[rgb(var(--color-primary-light))] transition-colors";
|
|
48
|
+
const labelClass = "text-xs text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))]";
|
|
49
|
+
const titleClass = "text-sm font-medium text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-300))] group-hover:text-[rgb(var(--color-primary-ink))] dark:group-hover:text-[rgb(var(--color-primary-light))] transition-colors";
|
|
50
50
|
return (_jsxs("nav", { class: "mt-12 flex items-stretch justify-between gap-4", children: [prev ? (_jsxs("a", { href: prev.href, class: linkClass, children: [_jsx("span", { class: labelClass, children: "\u2190 Previous" }), _jsx("span", { class: titleClass, children: prev.label })] })) : _jsx("span", {}), next ? (_jsxs("a", { href: next.href, class: `${linkClass} text-right ml-auto`, children: [_jsx("span", { class: labelClass, children: "Next \u2192" }), _jsx("span", { class: titleClass, children: next.label })] })) : null] }));
|
|
51
51
|
}
|
|
52
52
|
function ContentFooter() {
|
|
@@ -61,7 +61,7 @@ function ContentFooter() {
|
|
|
61
61
|
editUrl = `${repoBase}/edit/${site.editBranch}/${basePath}${page.markdown.sourcePath}`;
|
|
62
62
|
}
|
|
63
63
|
const linkStyle = "hover:text-[rgb(var(--color-gray-600))] dark:hover:text-[rgb(var(--color-gray-300))] transition-colors";
|
|
64
|
-
return (_jsxs("div", { class: "mt-16 mb-8 flex items-center justify-between border-t border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-800)/0.5)] pt-6 text-xs text-[rgb(var(--color-gray-400))]", children: [_jsxs("a", { href: "https://sourcey.com", target: "_blank", rel: "noopener noreferrer", class: `flex items-center gap-1.5 ${linkStyle}`, children: ["Built with", _jsx("img", { src: "https://sourcey.com/sourcey-logo.png", alt: "Sourcey", class: "h-4 w-4" })] }), _jsxs("div", { class: "flex items-center gap-4", children: [editUrl && (_jsxs("a", { href: editUrl, target: "_blank", rel: "noopener noreferrer", class: `${linkStyle} flex items-center gap-1`, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-3 h-3 mr-0.5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" }) }), "Edit this page"] })), links.map((link) => (_jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", class: linkStyle, children: link.type === "link"
|
|
64
|
+
return (_jsxs("div", { class: "mt-16 mb-8 flex items-center justify-between border-t border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-800)/0.5)] pt-6 text-xs text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))]", children: [_jsxs("a", { href: "https://sourcey.com", target: "_blank", rel: "noopener noreferrer", class: `flex items-center gap-1.5 ${linkStyle}`, children: ["Built with", _jsx("img", { src: "https://sourcey.com/sourcey-logo.png", alt: "Sourcey", class: "h-4 w-4" })] }), _jsxs("div", { class: "flex items-center gap-4", children: [editUrl && (_jsxs("a", { href: editUrl, target: "_blank", rel: "noopener noreferrer", class: `${linkStyle} flex items-center gap-1`, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-3 h-3 mr-0.5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" }) }), "Edit this page"] })), links.map((link) => (_jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", "aria-label": link.label ?? socialLabels[link.type] ?? link.href, class: linkStyle, children: link.type === "link"
|
|
65
65
|
? (link.label ?? link.href)
|
|
66
66
|
: (_jsxs(_Fragment, { children: [_jsx(SocialIcon, { type: link.type }), link.label && _jsx("span", { class: "ml-1", children: link.label })] })) }, link.href)))] })] }));
|
|
67
67
|
}
|
|
@@ -70,15 +70,15 @@ function ContentFooter() {
|
|
|
70
70
|
// ---------------------------------------------------------------------------
|
|
71
71
|
function DefaultLayout() {
|
|
72
72
|
const page = useContext(PageContext);
|
|
73
|
-
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-12", children: [_jsx(Sidebar, {}), _jsx("
|
|
73
|
+
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-12", children: [_jsx(Sidebar, {}), _jsx("main", { id: "docs", class: "pt-[8.5rem] lg:pt-10", children: page.kind === "markdown" ? (_jsxs("div", { class: "flex flex-row-reverse gap-12 box-border w-full", children: [_jsx(TableOfContents, { headings: page.markdown.headings }), _jsx(MarkdownPageContent, { page: page.markdown, className: "lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" })] })) : (_jsx(SpecPageContent, { className: "lg:pl-[23.7rem] lg:-ml-12" })) })] }));
|
|
74
74
|
}
|
|
75
75
|
function MinimalLayout() {
|
|
76
76
|
const page = useContext(PageContext);
|
|
77
|
-
return (_jsx("div", { class: "max-w-3xl mx-auto relative px-4 lg:px-8", children: _jsx("
|
|
77
|
+
return (_jsx("div", { class: "max-w-3xl mx-auto relative px-4 lg:px-8", children: _jsx("main", { id: "docs", class: "pt-[8.5rem] lg:pt-10", children: page.kind === "markdown" ? (_jsx(MarkdownPageContent, { page: page.markdown })) : (_jsx(SpecPageContent, {})) }) }));
|
|
78
78
|
}
|
|
79
79
|
function ApiFirstLayout() {
|
|
80
80
|
const page = useContext(PageContext);
|
|
81
|
-
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-12", children: [_jsx(Sidebar, {}), _jsx("
|
|
81
|
+
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-12", children: [_jsx(Sidebar, {}), _jsx("main", { id: "docs", class: "pt-[8.5rem] lg:pt-10", children: page.kind === "markdown" ? (_jsxs("div", { class: "flex flex-row-reverse gap-12 box-border w-full", children: [_jsx(TableOfContents, { headings: page.markdown.headings }), _jsx(MarkdownPageContent, { page: page.markdown, className: "lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" })] })) : (_jsx(SpecPageContent, { className: "lg:pl-[23.7rem] lg:-ml-12" })) })] }));
|
|
82
82
|
}
|
|
83
83
|
// ---------------------------------------------------------------------------
|
|
84
84
|
// Page shell
|
|
@@ -19,12 +19,12 @@ function MethodPill({ method }) {
|
|
|
19
19
|
}
|
|
20
20
|
const label = m === "DELETE" ? "DEL" : m;
|
|
21
21
|
const colors = {
|
|
22
|
-
GET: "bg-green-
|
|
23
|
-
POST: "bg-blue-
|
|
24
|
-
PUT: "bg-
|
|
25
|
-
DELETE: "bg-red-
|
|
26
|
-
DEL: "bg-red-
|
|
27
|
-
PATCH: "bg-orange-
|
|
22
|
+
GET: "bg-green-100 dark:bg-green-400/20 text-green-800 dark:text-green-300",
|
|
23
|
+
POST: "bg-blue-100 dark:bg-blue-400/20 text-blue-800 dark:text-blue-300",
|
|
24
|
+
PUT: "bg-amber-100 dark:bg-yellow-400/20 text-amber-900 dark:text-yellow-300",
|
|
25
|
+
DELETE: "bg-red-100 dark:bg-red-400/20 text-red-800 dark:text-red-300",
|
|
26
|
+
DEL: "bg-red-100 dark:bg-red-400/20 text-red-800 dark:text-red-300",
|
|
27
|
+
PATCH: "bg-orange-100 dark:bg-orange-400/20 text-orange-900 dark:text-orange-300",
|
|
28
28
|
};
|
|
29
29
|
return (_jsx("span", { class: "flex items-center w-8 h-[1lh] shrink-0", children: _jsx("span", { class: `px-1 py-0.5 rounded-md text-[0.55rem] leading-tight font-bold ${colors[m] ?? "bg-gray-400/20 text-gray-700"}`, children: label }) }));
|
|
30
30
|
}
|
|
@@ -4,11 +4,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
|
4
4
|
* Displayed at the top of each operation.
|
|
5
5
|
*/
|
|
6
6
|
const METHOD_COLORS = {
|
|
7
|
-
get: "bg-green-
|
|
8
|
-
post: "bg-blue-
|
|
9
|
-
put: "bg-
|
|
10
|
-
delete: "bg-red-
|
|
11
|
-
patch: "bg-orange-
|
|
7
|
+
get: "bg-green-100 dark:bg-green-400/20 text-green-800 dark:text-green-300",
|
|
8
|
+
post: "bg-blue-100 dark:bg-blue-400/20 text-blue-800 dark:text-blue-300",
|
|
9
|
+
put: "bg-amber-100 dark:bg-yellow-400/20 text-amber-900 dark:text-yellow-300",
|
|
10
|
+
delete: "bg-red-100 dark:bg-red-400/20 text-red-800 dark:text-red-300",
|
|
11
|
+
patch: "bg-orange-100 dark:bg-orange-400/20 text-orange-900 dark:text-orange-300",
|
|
12
12
|
};
|
|
13
13
|
export function EndpointBar({ method, path, serverUrl }) {
|
|
14
14
|
const m = method.toLowerCase();
|
|
@@ -9,5 +9,5 @@ import { Markdown } from "../ui/Markdown.js";
|
|
|
9
9
|
export function Introduction() {
|
|
10
10
|
const spec = useContext(SpecContext);
|
|
11
11
|
const { info, servers } = spec;
|
|
12
|
-
return (_jsxs("div", { id: "introduction", "data-traverse-target": "introduction", class: "mb-8", children: [info.
|
|
12
|
+
return (_jsxs("div", { id: "introduction", "data-traverse-target": "introduction", class: "mb-8", children: [info.termsOfService && (_jsx("p", { class: "mt-4 text-sm text-[rgb(var(--color-gray-500))]", children: _jsx("a", { href: info.termsOfService, class: "text-[rgb(var(--color-primary-ink))] dark:text-[rgb(var(--color-primary-light))]", children: "Terms of Service" }) })), info.contact?.email && (_jsxs("p", { class: "mt-2 text-sm text-[rgb(var(--color-gray-500))]", children: ["Contact: ", _jsx("a", { href: `mailto:${info.contact.email}`, class: "text-[rgb(var(--color-primary-ink))] dark:text-[rgb(var(--color-primary-light))]", children: info.contact.email })] })), servers.length > 0 && (_jsxs("div", { class: "mt-6 rounded-[var(--radius)] border border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)] overflow-x-auto", children: [_jsxs("div", { class: "px-4 py-2.5 text-xs font-semibold text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-300))] border-b border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)]", children: ["Base URL", servers.length > 1 ? "s" : ""] }), servers.map((s, i) => (_jsxs("div", { class: `flex items-baseline gap-3 px-4 py-2 ${i > 0 ? "border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]" : ""}`, children: [_jsx("code", { class: "font-mono text-sm text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))]", children: s.url }), s.description && (_jsx("span", { class: "text-xs text-[rgb(var(--color-gray-500))]", children: s.description }))] }, i)))] })), info.description && (_jsx(Markdown, { content: info.description, class: "max-w-none mt-8" }))] }));
|
|
13
13
|
}
|
|
@@ -8,13 +8,13 @@ import { generateExample } from "../../utils/example-generator.js";
|
|
|
8
8
|
import { highlightCode } from "../../utils/highlighter.js";
|
|
9
9
|
function statusColorClass(code) {
|
|
10
10
|
if (code.startsWith("2"))
|
|
11
|
-
return "bg-green-
|
|
11
|
+
return "bg-green-100 text-green-800 dark:bg-green-400/20 dark:text-green-300";
|
|
12
12
|
if (code.startsWith("3"))
|
|
13
|
-
return "bg-blue-
|
|
13
|
+
return "bg-blue-100 text-blue-800 dark:bg-blue-400/20 dark:text-blue-300";
|
|
14
14
|
if (code.startsWith("4"))
|
|
15
|
-
return "bg-
|
|
15
|
+
return "bg-amber-100 text-amber-900 dark:bg-yellow-400/20 dark:text-yellow-300";
|
|
16
16
|
if (code.startsWith("5"))
|
|
17
|
-
return "bg-red-
|
|
17
|
+
return "bg-red-100 text-red-800 dark:bg-red-400/20 dark:text-red-300";
|
|
18
18
|
return "bg-gray-400/20 text-gray-700 dark:text-gray-400";
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Security.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,UAAU,aAAa;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,aAAa,uCA8CvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Security.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,UAAU,aAAa;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,aAAa,uCA8CvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,wCA+ElC"}
|