raffel 1.1.97 → 1.1.98
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/docs/try-it-proxy.d.ts +15 -0
- package/dist/docs/try-it-proxy.d.ts.map +1 -1
- package/dist/docs/try-it-proxy.js +54 -0
- package/dist/docs/try-it-proxy.js.map +1 -1
- package/dist/docs/ui/assets/protocol-console.js +13 -1
- package/dist/docs/ui/assets/raffel-docs.js +167 -1
- package/dist/docs/ui/client-script/index.d.ts.map +1 -1
- package/dist/docs/ui/client-script/index.js +3 -95
- package/dist/docs/ui/client-script/index.js.map +1 -1
- package/dist/docs/ui/html-builder.d.ts.map +1 -1
- package/dist/docs/ui/html-builder.js +6 -3
- package/dist/docs/ui/html-builder.js.map +1 -1
- package/dist/docs/ui/runtime/index.js +167 -1
- package/dist/docs/ui/runtime/index.js.map +1 -1
- package/dist/docs/ui/runtime/protocol-console.d.ts +2 -0
- package/dist/docs/ui/runtime/protocol-console.d.ts.map +1 -1
- package/dist/docs/ui/runtime/protocol-console.js +13 -1
- package/dist/docs/ui/runtime/protocol-console.js.map +1 -1
- package/dist/docs/usd-middleware.d.ts +2 -0
- package/dist/docs/usd-middleware.d.ts.map +1 -1
- package/dist/docs/usd-middleware.js +37 -1
- package/dist/docs/usd-middleware.js.map +1 -1
- package/dist/server/builder/execution-http-docs.d.ts.map +1 -1
- package/dist/server/builder/execution-http-docs.js +8 -0
- package/dist/server/builder/execution-http-docs.js.map +1 -1
- package/dist/server/rest-middleware.d.ts.map +1 -1
- package/dist/server/rest-middleware.js +26 -0
- package/dist/server/rest-middleware.js.map +1 -1
- package/dist/ui/docs/try-it-proxy.d.ts +15 -0
- package/dist/ui/docs/try-it-proxy.d.ts.map +1 -1
- package/dist/ui/docs/ui/client-script/index.d.ts.map +1 -1
- package/dist/ui/docs/ui/html-builder.d.ts.map +1 -1
- package/dist/ui/docs/ui/runtime/protocol-console.d.ts +2 -0
- package/dist/ui/docs/ui/runtime/protocol-console.d.ts.map +1 -1
- package/dist/ui/docs/usd-middleware.d.ts +2 -0
- package/dist/ui/docs/usd-middleware.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/docs/ui/client-script/cards-and-code.d.ts +0 -5
- package/dist/docs/ui/client-script/cards-and-code.d.ts.map +0 -1
- package/dist/docs/ui/client-script/cards-and-code.js +0 -5
- package/dist/docs/ui/client-script/cards-and-code.js.map +0 -1
- package/dist/docs/ui/client-script/content.d.ts +0 -5
- package/dist/docs/ui/client-script/content.d.ts.map +0 -1
- package/dist/docs/ui/client-script/content.js +0 -412
- package/dist/docs/ui/client-script/content.js.map +0 -1
- package/dist/docs/ui/client-script/docs-pages.d.ts +0 -5
- package/dist/docs/ui/client-script/docs-pages.d.ts.map +0 -1
- package/dist/docs/ui/client-script/docs-pages.js +0 -153
- package/dist/docs/ui/client-script/docs-pages.js.map +0 -1
- package/dist/docs/ui/client-script/endpoint-details.d.ts +0 -5
- package/dist/docs/ui/client-script/endpoint-details.d.ts.map +0 -1
- package/dist/docs/ui/client-script/endpoint-details.js +0 -5
- package/dist/docs/ui/client-script/endpoint-details.js.map +0 -1
- package/dist/docs/ui/client-script/init.d.ts +0 -5
- package/dist/docs/ui/client-script/init.d.ts.map +0 -1
- package/dist/docs/ui/client-script/init.js +0 -227
- package/dist/docs/ui/client-script/init.js.map +0 -1
- package/dist/docs/ui/client-script/markdown.d.ts +0 -5
- package/dist/docs/ui/client-script/markdown.d.ts.map +0 -1
- package/dist/docs/ui/client-script/markdown.js +0 -438
- package/dist/docs/ui/client-script/markdown.js.map +0 -1
- package/dist/docs/ui/client-script/navigation.d.ts +0 -5
- package/dist/docs/ui/client-script/navigation.d.ts.map +0 -1
- package/dist/docs/ui/client-script/navigation.js +0 -548
- package/dist/docs/ui/client-script/navigation.js.map +0 -1
- package/dist/docs/ui/client-script/protocols.d.ts +0 -5
- package/dist/docs/ui/client-script/protocols.d.ts.map +0 -1
- package/dist/docs/ui/client-script/protocols.js +0 -5
- package/dist/docs/ui/client-script/protocols.js.map +0 -1
- package/dist/docs/ui/client-script/schema-rendering.d.ts +0 -5
- package/dist/docs/ui/client-script/schema-rendering.d.ts.map +0 -1
- package/dist/docs/ui/client-script/schema-rendering.js +0 -5
- package/dist/docs/ui/client-script/schema-rendering.js.map +0 -1
- package/dist/docs/ui/client-script/try-it.d.ts +0 -5
- package/dist/docs/ui/client-script/try-it.d.ts.map +0 -1
- package/dist/docs/ui/client-script/try-it.js +0 -5
- package/dist/docs/ui/client-script/try-it.js.map +0 -1
- package/dist/ui/docs/ui/client-script/cards-and-code.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/cards-and-code.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/content.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/content.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/docs-pages.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/docs-pages.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/endpoint-details.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/endpoint-details.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/init.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/init.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/markdown.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/markdown.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/navigation.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/navigation.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/protocols.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/protocols.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/schema-rendering.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/schema-rendering.d.ts.map +0 -1
- package/dist/ui/docs/ui/client-script/try-it.d.ts +0 -5
- package/dist/ui/docs/ui/client-script/try-it.d.ts.map +0 -1
|
@@ -1,548 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export const navigationClientScript = String.raw ` // Search functionality
|
|
5
|
-
const searchInput = document.getElementById('searchInput');
|
|
6
|
-
if (searchInput) {
|
|
7
|
-
searchInput.addEventListener('input', (e) => {
|
|
8
|
-
searchQuery = e.target.value.toLowerCase();
|
|
9
|
-
renderSidebar();
|
|
10
|
-
renderContent();
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const themeToggle = document.getElementById('themeToggle');
|
|
15
|
-
if (themeToggle) {
|
|
16
|
-
themeToggle.addEventListener('click', () => {
|
|
17
|
-
const root = document.documentElement;
|
|
18
|
-
const current = root.getAttribute('data-theme') || 'auto';
|
|
19
|
-
const configured = root.getAttribute('data-theme-configured') === 'true';
|
|
20
|
-
const next = current === 'auto' ? 'dark' : current === 'dark' ? 'light' : configured ? 'auto' : current === 'light' ? 'custom' : 'auto';
|
|
21
|
-
root.setAttribute('data-theme', next);
|
|
22
|
-
localStorage?.setItem?.('raffel-docs-theme', next);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const backToTop = document.getElementById('backToTop');
|
|
27
|
-
if (backToTop) {
|
|
28
|
-
backToTop.addEventListener('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
window.addEventListener('scroll', () => {
|
|
32
|
-
const progress = document.getElementById('readingProgress');
|
|
33
|
-
if (progress) {
|
|
34
|
-
const max = document.documentElement.scrollHeight - window.innerHeight;
|
|
35
|
-
const pct = max > 0 ? (window.scrollY / max) * 100 : 0;
|
|
36
|
-
progress.style.width = pct + '%';
|
|
37
|
-
}
|
|
38
|
-
if (backToTop) {
|
|
39
|
-
backToTop.classList.toggle('visible', window.scrollY > 400);
|
|
40
|
-
}
|
|
41
|
-
}, { passive: true });
|
|
42
|
-
|
|
43
|
-
window.addEventListener('hashchange', () => {
|
|
44
|
-
const route = parseRouteHash();
|
|
45
|
-
activePagePath = route.pagePath;
|
|
46
|
-
activeHeadingId = route.headingId;
|
|
47
|
-
activePagePath = resolveDocsAlias(activePagePath);
|
|
48
|
-
runVoidHook('onRouteChange', getPluginContext({ pagePath: activePagePath }));
|
|
49
|
-
unmountDocsComponents(document.getElementById('mainContent'));
|
|
50
|
-
renderSidebar();
|
|
51
|
-
renderContent();
|
|
52
|
-
highlightCodeBlocks(document.getElementById('mainContent'));
|
|
53
|
-
enhanceCodeBlockToolbars(document.getElementById('mainContent'));
|
|
54
|
-
renderMermaidDiagrams();
|
|
55
|
-
mountDocsComponents(document.getElementById('mainContent'));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function renderProtocolTabs() {
|
|
59
|
-
const container = document.getElementById('protocolTabs');
|
|
60
|
-
if (!container) return;
|
|
61
|
-
container.textContent = '';
|
|
62
|
-
protocols.forEach(p => {
|
|
63
|
-
const btn = document.createElement('button');
|
|
64
|
-
btn.className = 'protocol-tab' + (!activePagePath && p === activeProtocol ? ' active' : '');
|
|
65
|
-
const label = p.charAt(0).toUpperCase() + p.slice(1);
|
|
66
|
-
const count = protocolData[p];
|
|
67
|
-
btn.innerHTML = label + (sidebarConfig.showCounts !== false ? '<span class="count">' + count + '</span>' : '');
|
|
68
|
-
btn.onclick = () => setProtocol(p);
|
|
69
|
-
container.appendChild(btn);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function setProtocol(protocol) {
|
|
74
|
-
activeProtocol = protocol;
|
|
75
|
-
activePagePath = '';
|
|
76
|
-
activeHeadingId = '';
|
|
77
|
-
if (location.hash && location.hash.startsWith('#/')) {
|
|
78
|
-
history.replaceState(null, '', '#docs');
|
|
79
|
-
}
|
|
80
|
-
unmountDocsComponents(document.getElementById('mainContent'));
|
|
81
|
-
renderProtocolTabs();
|
|
82
|
-
renderSidebar();
|
|
83
|
-
renderContent();
|
|
84
|
-
highlightCodeBlocks(document.getElementById('mainContent'));
|
|
85
|
-
enhanceCodeBlockToolbars(document.getElementById('mainContent'));
|
|
86
|
-
renderMermaidDiagrams();
|
|
87
|
-
mountDocsComponents(document.getElementById('mainContent'));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function setDocsPage(path, headingId) {
|
|
91
|
-
activePagePath = resolveDocsAlias(normalizeDocsPath(path));
|
|
92
|
-
activeHeadingId = headingId || '';
|
|
93
|
-
history.replaceState(null, '', '#' + activePagePath + (activeHeadingId ? '?id=' + encodeURIComponent(activeHeadingId) : ''));
|
|
94
|
-
runVoidHook('onRouteChange', getPluginContext({ pagePath: activePagePath, headingId: activeHeadingId }));
|
|
95
|
-
unmountDocsComponents(document.getElementById('mainContent'));
|
|
96
|
-
renderProtocolTabs();
|
|
97
|
-
renderSidebar();
|
|
98
|
-
renderContent();
|
|
99
|
-
highlightCodeBlocks(document.getElementById('mainContent'));
|
|
100
|
-
enhanceCodeBlockToolbars(document.getElementById('mainContent'));
|
|
101
|
-
renderMermaidDiagrams();
|
|
102
|
-
mountDocsComponents(document.getElementById('mainContent'));
|
|
103
|
-
if (activeHeadingId) {
|
|
104
|
-
const target = document.getElementById(activeHeadingId);
|
|
105
|
-
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
106
|
-
} else {
|
|
107
|
-
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function renderSidebar() {
|
|
112
|
-
const nav = document.getElementById('sidebarNav');
|
|
113
|
-
if (!nav) return;
|
|
114
|
-
nav.textContent = '';
|
|
115
|
-
|
|
116
|
-
renderDocsPagesNav(nav);
|
|
117
|
-
|
|
118
|
-
// Add Introduction link if there's a description (and not searching)
|
|
119
|
-
if (!searchQuery && spec.info && spec.info.description && !activePagePath) {
|
|
120
|
-
const introLink = document.createElement('div');
|
|
121
|
-
introLink.className = 'nav-item nav-item-intro';
|
|
122
|
-
introLink.innerHTML = '<span class="nav-item-icon">Docs</span><span class="nav-item-text">Introduction</span>';
|
|
123
|
-
introLink.onclick = () => {
|
|
124
|
-
const el = document.getElementById('introduction');
|
|
125
|
-
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
126
|
-
};
|
|
127
|
-
nav.appendChild(introLink);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (activePagePath) return;
|
|
131
|
-
|
|
132
|
-
// Get endpoints for current protocol
|
|
133
|
-
const endpoints = getEndpointsForProtocol(activeProtocol);
|
|
134
|
-
|
|
135
|
-
// Filter by search
|
|
136
|
-
const filtered = searchQuery
|
|
137
|
-
? endpoints.filter(e =>
|
|
138
|
-
e.path.toLowerCase().includes(searchQuery) ||
|
|
139
|
-
(e.summary || '').toLowerCase().includes(searchQuery) ||
|
|
140
|
-
(e.description || '').toLowerCase().includes(searchQuery)
|
|
141
|
-
)
|
|
142
|
-
: endpoints;
|
|
143
|
-
|
|
144
|
-
// Group by tags
|
|
145
|
-
const tagMap = new Map();
|
|
146
|
-
const untagged = [];
|
|
147
|
-
|
|
148
|
-
filtered.forEach(ep => {
|
|
149
|
-
const tags = ep.tags || ['Other'];
|
|
150
|
-
if (tags.length === 0) {
|
|
151
|
-
untagged.push(ep);
|
|
152
|
-
} else {
|
|
153
|
-
tags.forEach(tag => {
|
|
154
|
-
if (!tagMap.has(tag)) tagMap.set(tag, []);
|
|
155
|
-
tagMap.get(tag).push(ep);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// Use tagGroups if defined, otherwise auto-group by tags (sorted, Other last)
|
|
161
|
-
const sortedTags = Array.from(tagMap.keys()).sort((a, b) => {
|
|
162
|
-
if (a === 'Other') return 1;
|
|
163
|
-
if (b === 'Other') return -1;
|
|
164
|
-
return a.localeCompare(b);
|
|
165
|
-
});
|
|
166
|
-
const groups = tagGroups.length > 0 ? tagGroups : sortedTags.map(name => ({
|
|
167
|
-
name,
|
|
168
|
-
tags: [name],
|
|
169
|
-
expanded: sidebarConfig.expandAll !== false
|
|
170
|
-
}));
|
|
171
|
-
|
|
172
|
-
groups.forEach((group) => {
|
|
173
|
-
const groupEndpoints = [];
|
|
174
|
-
group.tags.forEach(tag => {
|
|
175
|
-
const eps = tagMap.get(tag) || [];
|
|
176
|
-
groupEndpoints.push(...eps);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (groupEndpoints.length === 0) return;
|
|
180
|
-
|
|
181
|
-
const groupEl = document.createElement('div');
|
|
182
|
-
groupEl.className = 'tag-group' + (group.expanded === false ? ' collapsed' : '');
|
|
183
|
-
|
|
184
|
-
const header = document.createElement('div');
|
|
185
|
-
header.className = 'tag-group-header';
|
|
186
|
-
header.innerHTML = '<span class="tag-group-arrow">▼</span>' +
|
|
187
|
-
esc(group.name) +
|
|
188
|
-
'<span class="tag-group-count">' + groupEndpoints.length + '</span>';
|
|
189
|
-
header.onclick = () => groupEl.classList.toggle('collapsed');
|
|
190
|
-
|
|
191
|
-
const items = document.createElement('div');
|
|
192
|
-
items.className = 'tag-group-items';
|
|
193
|
-
items.style.maxHeight = group.expanded === false ? '0' : (groupEndpoints.length * 50) + 'px';
|
|
194
|
-
|
|
195
|
-
groupEndpoints.forEach(ep => {
|
|
196
|
-
const item = document.createElement('div');
|
|
197
|
-
item.className = 'nav-item';
|
|
198
|
-
item.innerHTML = '<span class="nav-item-method ' + getMethodClass(ep.method) + '">' +
|
|
199
|
-
esc(ep.method) + '</span><span class="nav-item-path">' + esc(ep.path) + '</span>';
|
|
200
|
-
item.onclick = (e) => {
|
|
201
|
-
e.stopPropagation();
|
|
202
|
-
scrollToEndpoint(ep.id);
|
|
203
|
-
};
|
|
204
|
-
items.appendChild(item);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
groupEl.appendChild(header);
|
|
208
|
-
groupEl.appendChild(items);
|
|
209
|
-
nav.appendChild(groupEl);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
if (untagged.length > 0) {
|
|
213
|
-
const groupEl = document.createElement('div');
|
|
214
|
-
groupEl.className = 'tag-group';
|
|
215
|
-
|
|
216
|
-
const header = document.createElement('div');
|
|
217
|
-
header.className = 'tag-group-header';
|
|
218
|
-
header.innerHTML = '<span class="tag-group-arrow">▼</span>Other<span class="tag-group-count">' + untagged.length + '</span>';
|
|
219
|
-
header.onclick = () => groupEl.classList.toggle('collapsed');
|
|
220
|
-
|
|
221
|
-
const items = document.createElement('div');
|
|
222
|
-
items.className = 'tag-group-items';
|
|
223
|
-
items.style.maxHeight = (untagged.length * 50) + 'px';
|
|
224
|
-
|
|
225
|
-
untagged.forEach(ep => {
|
|
226
|
-
const item = document.createElement('div');
|
|
227
|
-
item.className = 'nav-item';
|
|
228
|
-
item.innerHTML = '<span class="nav-item-method ' + getMethodClass(ep.method) + '">' +
|
|
229
|
-
esc(ep.method) + '</span><span class="nav-item-path">' + esc(ep.path) + '</span>';
|
|
230
|
-
item.onclick = (e) => {
|
|
231
|
-
e.stopPropagation();
|
|
232
|
-
scrollToEndpoint(ep.id);
|
|
233
|
-
};
|
|
234
|
-
items.appendChild(item);
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
groupEl.appendChild(header);
|
|
238
|
-
groupEl.appendChild(items);
|
|
239
|
-
nav.appendChild(groupEl);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function renderDocsPagesNav(nav) {
|
|
244
|
-
if (sidebarConfig.docsPages === false || !Array.isArray(docsPages) || docsPages.length === 0) return;
|
|
245
|
-
if (Array.isArray(docsSidebar) && docsSidebar.length > 0 && !searchQuery) {
|
|
246
|
-
renderDeclarativeDocsSidebar(nav);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const pages = getDocsPageViews();
|
|
250
|
-
const filteredPages = searchQuery
|
|
251
|
-
? pages.filter(page =>
|
|
252
|
-
(page.title || '').toLowerCase().includes(searchQuery) ||
|
|
253
|
-
(page.description || '').toLowerCase().includes(searchQuery) ||
|
|
254
|
-
(page.markdown || '').toLowerCase().includes(searchQuery)
|
|
255
|
-
)
|
|
256
|
-
: pages;
|
|
257
|
-
if (filteredPages.length === 0) return;
|
|
258
|
-
|
|
259
|
-
const sectionMap = new Map();
|
|
260
|
-
filteredPages.forEach(page => {
|
|
261
|
-
const section = page.section || 'Guides';
|
|
262
|
-
if (!sectionMap.has(section)) sectionMap.set(section, []);
|
|
263
|
-
sectionMap.get(section).push(page);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
sectionMap.forEach((sectionPages, sectionName) => {
|
|
267
|
-
const groupEl = document.createElement('div');
|
|
268
|
-
groupEl.className = 'tag-group docs-pages-group';
|
|
269
|
-
const header = document.createElement('div');
|
|
270
|
-
header.className = 'tag-group-header';
|
|
271
|
-
header.innerHTML = '<span class="tag-group-arrow">▼</span>' +
|
|
272
|
-
esc(sectionName) +
|
|
273
|
-
'<span class="tag-group-count">' + sectionPages.length + '</span>';
|
|
274
|
-
header.onclick = () => groupEl.classList.toggle('collapsed');
|
|
275
|
-
|
|
276
|
-
const items = document.createElement('div');
|
|
277
|
-
items.className = 'tag-group-items';
|
|
278
|
-
const headingCount = sectionPages.reduce((count, page) => (
|
|
279
|
-
count + (normalizeDocsPath(page.path) === activePagePath && !searchQuery ? extractSidebarHeadings(page.markdown).length : 0)
|
|
280
|
-
), 0);
|
|
281
|
-
items.style.maxHeight = ((sectionPages.length * 50) + (headingCount * 34)) + 'px';
|
|
282
|
-
sectionPages.forEach(page => {
|
|
283
|
-
const path = normalizeDocsPath(page.path);
|
|
284
|
-
const item = document.createElement('div');
|
|
285
|
-
item.className = 'nav-item docs-page-nav-item' + (path === activePagePath ? ' active' : '');
|
|
286
|
-
item.innerHTML = '<span class="nav-item-text">' + esc(page.title || page.path) + '</span>';
|
|
287
|
-
item.onclick = (event) => {
|
|
288
|
-
event.stopPropagation();
|
|
289
|
-
setDocsPage(path);
|
|
290
|
-
};
|
|
291
|
-
items.appendChild(item);
|
|
292
|
-
if (path === activePagePath && !searchQuery) {
|
|
293
|
-
const headings = extractSidebarHeadings(page.markdown);
|
|
294
|
-
if (headings.length > 0) {
|
|
295
|
-
const subItems = document.createElement('div');
|
|
296
|
-
subItems.className = 'nav-subitems';
|
|
297
|
-
headings.forEach(heading => {
|
|
298
|
-
const child = document.createElement('button');
|
|
299
|
-
child.type = 'button';
|
|
300
|
-
child.className = 'nav-subitem nav-subitem-level-' + heading.level;
|
|
301
|
-
child.textContent = heading.title;
|
|
302
|
-
child.onclick = (event) => {
|
|
303
|
-
event.stopPropagation();
|
|
304
|
-
if (path !== activePagePath) setDocsPage(path);
|
|
305
|
-
const target = document.getElementById(heading.id);
|
|
306
|
-
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
307
|
-
history.replaceState(null, '', '#' + path + '?id=' + encodeURIComponent(heading.id));
|
|
308
|
-
};
|
|
309
|
-
subItems.appendChild(child);
|
|
310
|
-
});
|
|
311
|
-
items.appendChild(subItems);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
groupEl.appendChild(header);
|
|
317
|
-
groupEl.appendChild(items);
|
|
318
|
-
nav.appendChild(groupEl);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function renderDeclarativeDocsSidebar(nav) {
|
|
323
|
-
docsSidebar.forEach(item => appendDeclarativeSidebarItem(nav, item, 0));
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function appendDeclarativeSidebarItem(parent, item, depth) {
|
|
327
|
-
const children = Array.isArray(item.children) ? item.children : [];
|
|
328
|
-
const title = String(item.title || item.path || item.href || '');
|
|
329
|
-
if (!title) return;
|
|
330
|
-
const itemPath = item.path ? resolveDocsAlias(normalizeDocsPath(item.path)) : '';
|
|
331
|
-
const active = Boolean(itemPath && itemPath === activePagePath);
|
|
332
|
-
const expanded = sidebarConfig.expandAll === true || active || children.some(sidebarItemContainsActivePath);
|
|
333
|
-
|
|
334
|
-
if (children.length > 0) {
|
|
335
|
-
const groupEl = document.createElement('div');
|
|
336
|
-
groupEl.className = 'tag-group docs-sidebar-group docs-sidebar-depth-' + depth + (expanded ? '' : ' collapsed');
|
|
337
|
-
const header = document.createElement('div');
|
|
338
|
-
header.className = 'tag-group-header' + (active ? ' active' : '');
|
|
339
|
-
header.innerHTML = '<span class="tag-group-arrow">▼</span>' + esc(title) +
|
|
340
|
-
'<span class="tag-group-count">' + countSidebarLeaves(children) + '</span>';
|
|
341
|
-
header.onclick = () => groupEl.classList.toggle('collapsed');
|
|
342
|
-
const items = document.createElement('div');
|
|
343
|
-
items.className = 'tag-group-items';
|
|
344
|
-
items.style.maxHeight = expanded ? (Math.max(1, countSidebarRows(children)) * 90) + 'px' : '0';
|
|
345
|
-
if (itemPath || item.href) {
|
|
346
|
-
items.appendChild(createDeclarativeSidebarPage(item, title, active, depth));
|
|
347
|
-
if (active && !searchQuery) appendActivePageHeadings(items, item.path || activePagePath);
|
|
348
|
-
}
|
|
349
|
-
children.forEach(child => appendDeclarativeSidebarItem(items, child, depth + 1));
|
|
350
|
-
groupEl.appendChild(header);
|
|
351
|
-
groupEl.appendChild(items);
|
|
352
|
-
parent.appendChild(groupEl);
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
parent.appendChild(createDeclarativeSidebarPage(item, title, active, depth));
|
|
357
|
-
if (active && !searchQuery) appendActivePageHeadings(parent, item.path || activePagePath);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function createDeclarativeSidebarPage(item, title, active, depth) {
|
|
361
|
-
const el = document.createElement('div');
|
|
362
|
-
el.className = 'nav-item docs-page-nav-item docs-sidebar-page docs-sidebar-depth-' + depth + (active ? ' active' : '');
|
|
363
|
-
el.innerHTML = '<span class="nav-item-text">' + esc(title) + '</span>';
|
|
364
|
-
el.onclick = (event) => {
|
|
365
|
-
event.stopPropagation();
|
|
366
|
-
if (item.href && !item.path) {
|
|
367
|
-
if (/^(?:https?:)?\/\//i.test(item.href)) location.href = item.href;
|
|
368
|
-
else history.replaceState(null, '', item.href);
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
if (item.path) setDocsPage(item.path);
|
|
372
|
-
};
|
|
373
|
-
return el;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function appendActivePageHeadings(parent, path) {
|
|
377
|
-
const page = getDocsPageViews().find(candidate => candidate.path === resolveDocsAlias(normalizeDocsPath(path)));
|
|
378
|
-
if (!page) return;
|
|
379
|
-
const headings = extractSidebarHeadings(page.markdown);
|
|
380
|
-
if (headings.length === 0) return;
|
|
381
|
-
const subItems = document.createElement('div');
|
|
382
|
-
subItems.className = 'nav-subitems';
|
|
383
|
-
headings.forEach(heading => {
|
|
384
|
-
const child = document.createElement('button');
|
|
385
|
-
child.type = 'button';
|
|
386
|
-
child.className = 'nav-subitem nav-subitem-level-' + heading.level + (heading.id === activeHeadingId ? ' active' : '');
|
|
387
|
-
child.textContent = heading.title;
|
|
388
|
-
child.onclick = (event) => {
|
|
389
|
-
event.stopPropagation();
|
|
390
|
-
setDocsPage(activePagePath || path, heading.id);
|
|
391
|
-
};
|
|
392
|
-
subItems.appendChild(child);
|
|
393
|
-
});
|
|
394
|
-
parent.appendChild(subItems);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function sidebarItemContainsActivePath(item) {
|
|
398
|
-
const itemPath = item.path ? resolveDocsAlias(normalizeDocsPath(item.path)) : '';
|
|
399
|
-
return Boolean(itemPath && itemPath === activePagePath) ||
|
|
400
|
-
(Array.isArray(item.children) && item.children.some(sidebarItemContainsActivePath));
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function countSidebarLeaves(items) {
|
|
404
|
-
return items.reduce((count, item) => count + (Array.isArray(item.children) && item.children.length > 0 ? countSidebarLeaves(item.children) : 1), 0);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function countSidebarRows(items) {
|
|
408
|
-
return items.reduce((count, item) => count + 1 + (Array.isArray(item.children) ? countSidebarRows(item.children) : 0), 0);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function getMethodClass(method) {
|
|
412
|
-
const m = method.toLowerCase();
|
|
413
|
-
if (m === 'get') return 'method-get';
|
|
414
|
-
if (m === 'post') return 'method-post';
|
|
415
|
-
if (m === 'put') return 'method-put';
|
|
416
|
-
if (m === 'patch') return 'method-patch';
|
|
417
|
-
if (m === 'delete') return 'method-delete';
|
|
418
|
-
if (m === 'ws' || m === 'websocket') return 'method-ws';
|
|
419
|
-
if (m === 'stream' || m === 'sse') return 'method-stream';
|
|
420
|
-
if (m === 'rpc') return 'method-rpc';
|
|
421
|
-
if (m === 'grpc' || m === 'unary') return 'method-grpc';
|
|
422
|
-
return 'method-post';
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function getEndpointsForProtocol(protocol) {
|
|
426
|
-
const endpoints = [];
|
|
427
|
-
let id = 0;
|
|
428
|
-
|
|
429
|
-
if (protocol === 'http' && spec.paths) {
|
|
430
|
-
Object.entries(spec.paths).forEach(([path, methods]) => {
|
|
431
|
-
Object.entries(methods).forEach(([method, op]) => {
|
|
432
|
-
if (!['get','post','put','patch','delete'].includes(method)) return;
|
|
433
|
-
endpoints.push({
|
|
434
|
-
id: 'ep-' + (id++),
|
|
435
|
-
path,
|
|
436
|
-
method: method.toUpperCase(),
|
|
437
|
-
summary: op.summary,
|
|
438
|
-
description: op.description,
|
|
439
|
-
tags: op.tags || [],
|
|
440
|
-
data: op
|
|
441
|
-
});
|
|
442
|
-
});
|
|
443
|
-
});
|
|
444
|
-
} else if (protocol === 'websocket' && wsSpec?.channels) {
|
|
445
|
-
Object.entries(wsSpec.channels).forEach(([name, channel]) => {
|
|
446
|
-
endpoints.push({
|
|
447
|
-
id: 'ep-' + (id++),
|
|
448
|
-
path: name,
|
|
449
|
-
method: 'WS',
|
|
450
|
-
summary: channel.description,
|
|
451
|
-
tags: channel.tags || [],
|
|
452
|
-
data: channel
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
} else if (protocol === 'streams' && streamsSpec?.endpoints) {
|
|
456
|
-
Object.entries(streamsSpec.endpoints).forEach(([name, endpoint]) => {
|
|
457
|
-
endpoints.push({
|
|
458
|
-
id: 'ep-' + (id++),
|
|
459
|
-
path: name,
|
|
460
|
-
method: endpoint.direction || 'STREAM',
|
|
461
|
-
summary: endpoint.description,
|
|
462
|
-
tags: endpoint.tags || [],
|
|
463
|
-
data: endpoint
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
} else if (protocol === 'jsonrpc' && jsonrpcSpec?.methods) {
|
|
467
|
-
Object.entries(jsonrpcSpec.methods).forEach(([name, method]) => {
|
|
468
|
-
endpoints.push({
|
|
469
|
-
id: 'ep-' + (id++),
|
|
470
|
-
path: name,
|
|
471
|
-
method: 'RPC',
|
|
472
|
-
summary: method.description,
|
|
473
|
-
tags: method.tags || [],
|
|
474
|
-
data: method
|
|
475
|
-
});
|
|
476
|
-
});
|
|
477
|
-
} else if (protocol === 'grpc' && grpcSpec?.services) {
|
|
478
|
-
Object.entries(grpcSpec.services).forEach(([serviceName, service]) => {
|
|
479
|
-
Object.entries(service.methods || {}).forEach(([methodName, method]) => {
|
|
480
|
-
const type = getGrpcMethodType(method);
|
|
481
|
-
endpoints.push({
|
|
482
|
-
id: 'ep-' + (id++),
|
|
483
|
-
path: serviceName + '/' + methodName,
|
|
484
|
-
method: type.toUpperCase(),
|
|
485
|
-
summary: method.description,
|
|
486
|
-
tags: service.tags || [],
|
|
487
|
-
data: { service, method, serviceName, methodName }
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
});
|
|
491
|
-
} else if (protocol === 'tcp' && tcpSpec?.servers) {
|
|
492
|
-
Object.entries(tcpSpec.servers).forEach(([name, server]) => {
|
|
493
|
-
endpoints.push({
|
|
494
|
-
id: 'ep-' + (id++),
|
|
495
|
-
path: name,
|
|
496
|
-
method: 'TCP',
|
|
497
|
-
summary: server.description,
|
|
498
|
-
tags: server.tags || [],
|
|
499
|
-
data: server
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
} else if (protocol === 'udp' && udpSpec?.endpoints) {
|
|
503
|
-
Object.entries(udpSpec.endpoints).forEach(([name, endpoint]) => {
|
|
504
|
-
endpoints.push({
|
|
505
|
-
id: 'ep-' + (id++),
|
|
506
|
-
path: name,
|
|
507
|
-
method: 'UDP',
|
|
508
|
-
summary: endpoint.description,
|
|
509
|
-
tags: endpoint.tags || [],
|
|
510
|
-
data: endpoint
|
|
511
|
-
});
|
|
512
|
-
});
|
|
513
|
-
} else if (protocol === 'graphql' && (spec.components?.schemas?.Query || spec['x-usd']?.graphql?.types)) {
|
|
514
|
-
const graphqlSpec = spec['x-usd']?.graphql;
|
|
515
|
-
if (graphqlSpec?.types) {
|
|
516
|
-
Object.entries(graphqlSpec.types).forEach(([name, type]) => {
|
|
517
|
-
endpoints.push({
|
|
518
|
-
id: 'ep-' + (id++),
|
|
519
|
-
path: name,
|
|
520
|
-
method: 'GQL',
|
|
521
|
-
summary: type.description,
|
|
522
|
-
tags: type.tags || [],
|
|
523
|
-
data: type
|
|
524
|
-
});
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
return endpoints;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
function scrollToEndpoint(id) {
|
|
533
|
-
activePagePath = '';
|
|
534
|
-
const el = document.getElementById(id);
|
|
535
|
-
if (el) {
|
|
536
|
-
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
537
|
-
el.classList.add('expanded');
|
|
538
|
-
// Render "Try it Out" in right panel when endpoint is selected
|
|
539
|
-
const endpoints = getEndpointsForProtocol(activeProtocol);
|
|
540
|
-
const endpoint = endpoints.find(ep => ep.id === id);
|
|
541
|
-
if (endpoint && renderTryItOut) {
|
|
542
|
-
renderTryItOut(endpoint);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
`;
|
|
548
|
-
//# sourceMappingURL=navigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/navigation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+hB/C,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export declare const protocolClientScript = " // Detect protocols with counts\n const protocolData = {};\n const xUsd = spec['x-usd'] || {};\n const wsSpec = xUsd.websocket;\n const streamsSpec = xUsd.streams;\n const jsonrpcSpec = xUsd.jsonrpc;\n const grpcSpec = xUsd.grpc;\n const tcpSpec = xUsd.tcp;\n const udpSpec = xUsd.udp;\n if (spec.paths) {\n let count = 0;\n Object.values(spec.paths).forEach(methods => {\n Object.keys(methods).forEach(m => {\n if (['get','post','put','patch','delete'].includes(m)) count++;\n });\n });\n if (count > 0) protocolData.http = count;\n }\n if (wsSpec?.channels) {\n protocolData.websocket = Object.keys(wsSpec.channels).length;\n }\n if (streamsSpec?.endpoints) {\n protocolData.streams = Object.keys(streamsSpec.endpoints).length;\n }\n if (jsonrpcSpec?.methods) {\n protocolData.jsonrpc = Object.keys(jsonrpcSpec.methods).length;\n }\n if (grpcSpec?.services) {\n let count = 0;\n Object.values(grpcSpec.services).forEach(s => {\n count += Object.keys(s.methods || {}).length;\n });\n if (count > 0) protocolData.grpc = count;\n }\n if (tcpSpec?.servers) {\n protocolData.tcp = Object.keys(tcpSpec.servers).length;\n } else if (tcpSpec) {\n protocolData.tcp = 0;\n }\n if (udpSpec?.endpoints) {\n protocolData.udp = Object.keys(udpSpec.endpoints).length;\n } else if (udpSpec) {\n protocolData.udp = 0;\n }\n if (wsSpec && !protocolData.websocket) {\n protocolData.websocket = 0;\n }\n\n const protocols = Object.keys(protocolData);\n let activeProtocol = protocols.includes('http') ? 'http' : (protocols[0] || 'http');\n let searchQuery = '';\n const initialRoute = parseRouteHash();\n let activePagePath = initialRoute.pagePath;\n let activeHeadingId = initialRoute.headingId;\n\n function parseRouteHash() {\n const hash = String(location.hash || '');\n if (!hash.startsWith('#/')) return { pagePath: '/', headingId: hash.startsWith('#') ? hash.slice(1) : '' };\n const raw = hash.slice(1);\n const parts = raw.split('?');\n const params = typeof URLSearchParams === 'undefined' ? null : new URLSearchParams(parts[1] || '');\n return { pagePath: normalizeDocsPath(parts[0]), headingId: params?.get?.('id') || '' };\n }\n\n function normalizeDocsPath(path) {\n const raw = String(path || '').trim();\n if (!raw) return '';\n const withSlash = raw.startsWith('/') ? raw : '/' + raw;\n return withSlash.replace(/\\/+$/, '') || '/';\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=protocols.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/protocols.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,oBAAoB,wjFAAwjF,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export const protocolClientScript = " // Detect protocols with counts\n const protocolData = {};\n const xUsd = spec['x-usd'] || {};\n const wsSpec = xUsd.websocket;\n const streamsSpec = xUsd.streams;\n const jsonrpcSpec = xUsd.jsonrpc;\n const grpcSpec = xUsd.grpc;\n const tcpSpec = xUsd.tcp;\n const udpSpec = xUsd.udp;\n if (spec.paths) {\n let count = 0;\n Object.values(spec.paths).forEach(methods => {\n Object.keys(methods).forEach(m => {\n if (['get','post','put','patch','delete'].includes(m)) count++;\n });\n });\n if (count > 0) protocolData.http = count;\n }\n if (wsSpec?.channels) {\n protocolData.websocket = Object.keys(wsSpec.channels).length;\n }\n if (streamsSpec?.endpoints) {\n protocolData.streams = Object.keys(streamsSpec.endpoints).length;\n }\n if (jsonrpcSpec?.methods) {\n protocolData.jsonrpc = Object.keys(jsonrpcSpec.methods).length;\n }\n if (grpcSpec?.services) {\n let count = 0;\n Object.values(grpcSpec.services).forEach(s => {\n count += Object.keys(s.methods || {}).length;\n });\n if (count > 0) protocolData.grpc = count;\n }\n if (tcpSpec?.servers) {\n protocolData.tcp = Object.keys(tcpSpec.servers).length;\n } else if (tcpSpec) {\n protocolData.tcp = 0;\n }\n if (udpSpec?.endpoints) {\n protocolData.udp = Object.keys(udpSpec.endpoints).length;\n } else if (udpSpec) {\n protocolData.udp = 0;\n }\n if (wsSpec && !protocolData.websocket) {\n protocolData.websocket = 0;\n }\n\n const protocols = Object.keys(protocolData);\n let activeProtocol = protocols.includes('http') ? 'http' : (protocols[0] || 'http');\n let searchQuery = '';\n const initialRoute = parseRouteHash();\n let activePagePath = initialRoute.pagePath;\n let activeHeadingId = initialRoute.headingId;\n\n function parseRouteHash() {\n const hash = String(location.hash || '');\n if (!hash.startsWith('#/')) return { pagePath: '/', headingId: hash.startsWith('#') ? hash.slice(1) : '' };\n const raw = hash.slice(1);\n const parts = raw.split('?');\n const params = typeof URLSearchParams === 'undefined' ? null : new URLSearchParams(parts[1] || '');\n return { pagePath: normalizeDocsPath(parts[0]), headingId: params?.get?.('id') || '' };\n }\n\n function normalizeDocsPath(path) {\n const raw = String(path || '').trim();\n if (!raw) return '';\n const withSlash = raw.startsWith('/') ? raw : '/' + raw;\n return withSlash.replace(/\\/+$/, '') || '/';\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=protocols.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/protocols.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,qjFAAqjF,CAAA"}
|