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,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export const docsPagesClientScript = String.raw ` function parsePageFrontmatter(markdown) {
|
|
5
|
-
const source = String(markdown || '').replace(/\r\n?/g, '\n');
|
|
6
|
-
if (!source.startsWith('---\n')) {
|
|
7
|
-
return { data: {}, body: source };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const end = source.indexOf('\n---', 4);
|
|
11
|
-
if (end === -1) {
|
|
12
|
-
return { data: {}, body: source };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const data = {};
|
|
16
|
-
const header = source.slice(4, end).split('\n');
|
|
17
|
-
header.forEach(line => {
|
|
18
|
-
const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
19
|
-
if (!match) return;
|
|
20
|
-
const key = match[1];
|
|
21
|
-
let value = match[2].trim();
|
|
22
|
-
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
23
|
-
value = value.slice(1, -1);
|
|
24
|
-
}
|
|
25
|
-
data[key] = value;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const bodyStart = source.indexOf('\n', end + 4);
|
|
29
|
-
return {
|
|
30
|
-
data,
|
|
31
|
-
body: bodyStart === -1 ? '' : source.slice(bodyStart + 1),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function firstMarkdownHeading(markdown) {
|
|
36
|
-
const match = String(markdown || '').match(/^#\s+(.+)$/m);
|
|
37
|
-
return match ? match[1].replace(/\s+#+$/, '').trim() : '';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function resolveDocsAlias(path) {
|
|
41
|
-
let current = normalizeDocsPath(path);
|
|
42
|
-
const seen = new Set();
|
|
43
|
-
for (let depth = 0; depth < 10; depth += 1) {
|
|
44
|
-
const next = resolveDocsAliasTarget(current);
|
|
45
|
-
if (!next || seen.has(next)) return current;
|
|
46
|
-
seen.add(current);
|
|
47
|
-
current = normalizeDocsPath(next);
|
|
48
|
-
}
|
|
49
|
-
return current;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function resolveDocsAliasTarget(path) {
|
|
53
|
-
if (docsAliases[path]) return docsAliases[path];
|
|
54
|
-
for (const [pattern, target] of Object.entries(docsAliases)) {
|
|
55
|
-
if (!/[()*+?[\\\]^$|]/.test(pattern)) continue;
|
|
56
|
-
try {
|
|
57
|
-
const expression = new RegExp(pattern.startsWith('^') ? pattern : '^' + pattern + '$');
|
|
58
|
-
const match = path.match(expression);
|
|
59
|
-
if (!match) continue;
|
|
60
|
-
return String(target).replace(/\$(\d+)/g, function(_token, index) {
|
|
61
|
-
return match[Number(index)] || '';
|
|
62
|
-
});
|
|
63
|
-
} catch {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function getDocsPageView(page) {
|
|
71
|
-
const parsed = parsePageFrontmatter(page.markdown || '');
|
|
72
|
-
const title = parsed.data.title || page.title || firstMarkdownHeading(parsed.body) || page.path || 'Untitled';
|
|
73
|
-
const description = parsed.data.description || page.description || '';
|
|
74
|
-
const order = Number(parsed.data.order ?? page.order ?? 0);
|
|
75
|
-
const section = parsed.data.section || page.section || 'Guides';
|
|
76
|
-
return {
|
|
77
|
-
...page,
|
|
78
|
-
title,
|
|
79
|
-
description,
|
|
80
|
-
order: Number.isFinite(order) ? order : 0,
|
|
81
|
-
section,
|
|
82
|
-
updatedAt: parsed.data.updatedAt || page.updatedAt,
|
|
83
|
-
markdown: parsed.body,
|
|
84
|
-
frontmatter: parsed.data,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function getDocsPageViews() {
|
|
89
|
-
if (!Array.isArray(docsPages)) return [];
|
|
90
|
-
return docsPages
|
|
91
|
-
.map(getDocsPageView)
|
|
92
|
-
.sort((a, b) =>
|
|
93
|
-
String(a.section || '').localeCompare(String(b.section || '')) ||
|
|
94
|
-
(a.order || 0) - (b.order || 0) ||
|
|
95
|
-
String(a.title || '').localeCompare(String(b.title || ''))
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function getDocsPageMarkdown(page) {
|
|
100
|
-
const markdown = renderUpdatedMarker(page.markdown || '', page.updatedAt);
|
|
101
|
-
if (markdownConfig.autoHeader !== true || /^#\s+.+$/m.test(markdown)) return markdown;
|
|
102
|
-
return '# ' + (page.title || page.path || 'Untitled') + '\n\n' + markdown;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function renderUpdatedMarker(markdown, updatedAt) {
|
|
106
|
-
if (!String(markdown || '').includes('{raffel-updated}')) return markdown;
|
|
107
|
-
return String(markdown || '').replace(/\{raffel-updated\}/g, formatDocsUpdated(updatedAt));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function formatDocsUpdated(updatedAt) {
|
|
111
|
-
if (!updatedAt) return '';
|
|
112
|
-
const date = new Date(updatedAt);
|
|
113
|
-
if (Number.isNaN(date.getTime())) return '';
|
|
114
|
-
const pad = value => String(value).padStart(2, '0');
|
|
115
|
-
const tokens = {
|
|
116
|
-
YYYY: String(date.getUTCFullYear()),
|
|
117
|
-
MM: pad(date.getUTCMonth() + 1),
|
|
118
|
-
DD: pad(date.getUTCDate()),
|
|
119
|
-
HH: pad(date.getUTCHours()),
|
|
120
|
-
mm: pad(date.getUTCMinutes()),
|
|
121
|
-
ss: pad(date.getUTCSeconds()),
|
|
122
|
-
};
|
|
123
|
-
const format = String(markdownConfig.formatUpdated || 'YYYY-MM-DD');
|
|
124
|
-
return format.replace(/YYYY|MM|DD|HH|mm|ss/g, token => tokens[token] || token);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function getSidebarSubMaxLevel() {
|
|
128
|
-
const max = Number(sidebarConfig.subMaxLevel || 0);
|
|
129
|
-
return Number.isFinite(max) && max > 1 ? Math.floor(max) : 0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function extractSidebarHeadings(markdown) {
|
|
133
|
-
const max = getSidebarSubMaxLevel();
|
|
134
|
-
if (!max) return [];
|
|
135
|
-
const headings = [];
|
|
136
|
-
String(markdown || '').split(/\r?\n/).forEach(line => {
|
|
137
|
-
const heading = line.trim().match(/^(#{1,6})\s+(.+)$/);
|
|
138
|
-
if (!heading) return;
|
|
139
|
-
const level = heading[1].length;
|
|
140
|
-
const parsed = parseHeadingTitle(heading[2]);
|
|
141
|
-
if (parsed.ignoreAll) {
|
|
142
|
-
headings.length = 0;
|
|
143
|
-
headings.ignoreAll = true;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (headings.ignoreAll || level < 2 || level > max || parsed.ignore) return;
|
|
147
|
-
headings.push({ id: parsed.id, title: parsed.title, level });
|
|
148
|
-
});
|
|
149
|
-
return headings.ignoreAll ? [] : headings;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
`;
|
|
153
|
-
//# sourceMappingURL=docs-pages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs-pages.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/docs-pages.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoJ9C,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export declare const endpointDetailsClientScript = " function resolveEffectiveContentTypes(operationTypes, protocolTypes) {\n const globalTypes = (xUsd && xUsd.contentTypes) ? xUsd.contentTypes : {};\n const defaultType =\n (operationTypes && operationTypes.default) ||\n (protocolTypes && protocolTypes.default) ||\n globalTypes.default ||\n 'application/json';\n const supportedList =\n (operationTypes && operationTypes.supported) ||\n (protocolTypes && protocolTypes.supported) ||\n globalTypes.supported ||\n [];\n const supported = Array.isArray(supportedList) ? supportedList.slice() : [];\n if (defaultType && supported.indexOf(defaultType) === -1) {\n supported.unshift(defaultType);\n }\n return { default: defaultType, supported };\n }\n\n function appendContentTypes(container, label, contentTypes) {\n if (!contentTypes) return;\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">' + esc(label) + '</div>';\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n const supportedText = (contentTypes.supported && contentTypes.supported.length > 0)\n ? contentTypes.supported.join(', ')\n : contentTypes.default;\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Default</div><div class=\"info-card-value\">' +\n esc(contentTypes.default || 'application/json') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Supported</div><div class=\"info-card-value\">' +\n esc(supportedText || 'application/json') + '</div></div>';\n section.appendChild(grid);\n container.appendChild(section);\n }\n\n function renderEndpointDetails(ep) {\n const container = document.createElement('div');\n const data = ep.data;\n\n // HTTP-specific (Redoc-style layout)\n if (activeProtocol === 'http') {\n // AUTHORIZATIONS section\n if (data.security && data.security.length > 0) {\n const authSection = document.createElement('div');\n authSection.className = 'endpoint-subsection';\n authSection.innerHTML = '<div class=\"subsection-label\">AUTHORIZATIONS:</div>';\n const authValue = document.createElement('span');\n authValue.className = 'auth-value';\n const authNames = data.security.flatMap(s => Object.keys(s));\n authValue.textContent = authNames.join(', ') || 'None';\n authSection.appendChild(authValue);\n container.appendChild(authSection);\n }\n\n // PATH PARAMETERS\n const pathParams = (data.parameters || []).filter(p => p.in === 'path');\n if (pathParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">PATH PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(pathParams));\n container.appendChild(section);\n }\n\n // QUERY PARAMETERS\n const queryParams = (data.parameters || []).filter(p => p.in === 'query');\n if (queryParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">QUERY PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(queryParams));\n container.appendChild(section);\n }\n\n // HEADER PARAMETERS\n const headerParams = (data.parameters || []).filter(p => p.in === 'header');\n if (headerParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">HEADER PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(headerParams));\n container.appendChild(section);\n }\n }\n\n // WebSocket-specific\n if (activeProtocol === 'websocket') {\n if (data.type) {\n const badge = document.createElement('span');\n badge.className = 'badge channel-type-' + data.type;\n badge.textContent = data.type;\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n if (data.subscribe) {\n appendContentTypes(\n container,\n 'Subscribe Content Types',\n resolveEffectiveContentTypes(data.subscribe?.contentTypes, wsSpec?.contentTypes)\n );\n }\n if (data.publish) {\n appendContentTypes(\n container,\n 'Publish Content Types',\n resolveEffectiveContentTypes(data.publish?.contentTypes, wsSpec?.contentTypes)\n );\n }\n if (data.parameters) {\n const paramSchema = { type: 'object', properties: {}, required: [] };\n Object.entries(data.parameters).forEach(([name, param]) => {\n const schema = param.schema || { type: 'string' };\n if (param.description) schema.description = param.description;\n paramSchema.properties[name] = schema;\n if (param.required) paramSchema.required.push(name);\n });\n const h = document.createElement('h4');\n h.textContent = 'Parameters';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(paramSchema, paramSchema.required, 0);\n container.appendChild(schemaEl);\n }\n const subscribePayload = resolveMessagePayload(data.subscribe?.message);\n if (subscribePayload) {\n const h = document.createElement('h4');\n h.textContent = 'Subscribe (receive)';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(subscribePayload, [], 0);\n container.appendChild(schemaEl);\n }\n const publishPayload = resolveMessagePayload(data.publish?.message);\n if (publishPayload) {\n const h = document.createElement('h4');\n h.textContent = 'Publish (send)';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(publishPayload, [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n // Streams-specific\n if (activeProtocol === 'streams') {\n if (data.direction) {\n const badge = document.createElement('span');\n badge.className = 'badge badge-stream';\n badge.textContent = data.direction;\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, streamsSpec?.contentTypes)\n );\n const streamPayload = resolveMessagePayload(data.message);\n if (streamPayload) {\n const h = document.createElement('h4');\n h.textContent = 'Message Schema';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(streamPayload, [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n // JSON-RPC-specific\n if (activeProtocol === 'jsonrpc') {\n if (data['x-usd-notification'] || data['x-usd-streaming']) {\n const flags = [];\n if (data['x-usd-notification']) flags.push('notification');\n if (data['x-usd-streaming']) flags.push('streaming');\n const info = document.createElement('div');\n info.style.marginBottom = '16px';\n info.innerHTML = flags.map(f => '<span class=\"badge badge-rpc\" style=\"margin-right: 6px;\">' + esc(f) + '</span>').join('');\n container.appendChild(info);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, jsonrpcSpec?.contentTypes)\n );\n if (data.params) {\n const h = document.createElement('h4');\n h.textContent = 'Parameters';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.params, data.params.required || [], 0);\n container.appendChild(schemaEl);\n }\n if (data.result) {\n const h = document.createElement('h4');\n h.textContent = 'Result';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.result, [], 0);\n container.appendChild(schemaEl);\n }\n if (Array.isArray(data.errors) && data.errors.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">Errors</div>';\n data.errors.forEach((err) => {\n const card = document.createElement('div');\n card.className = 'info-card';\n card.innerHTML =\n '<div class=\"info-card-title\">' + esc(err.code) + '</div>' +\n '<div class=\"info-card-value\">' + esc(err.message) + '</div>' +\n (err.description ? '<div class=\"info-card-subtitle\">' + esc(err.description) + '</div>' : '');\n section.appendChild(card);\n if (err.data) {\n const schemaEl = renderSchemaProperties(err.data, [], 0);\n section.appendChild(schemaEl);\n }\n });\n container.appendChild(section);\n }\n }\n\n // gRPC-specific\n if (activeProtocol === 'grpc') {\n const method = data.method;\n if (method) {\n const methodType = getGrpcMethodType(method);\n if (methodType && methodType !== 'unary') {\n const badge = document.createElement('span');\n badge.className = 'badge badge-stream';\n badge.textContent = methodType.replace('_', ' ');\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(method.contentTypes, grpcSpec?.contentTypes)\n );\n if (method.input) {\n const h = document.createElement('h4');\n h.textContent = 'Request';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(method.input, [], 0);\n container.appendChild(schemaEl);\n }\n if (method.output) {\n const h = document.createElement('h4');\n h.textContent = 'Response';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(method.output, [], 0);\n container.appendChild(schemaEl);\n }\n }\n }\n\n // TCP-specific\n if (activeProtocol === 'tcp') {\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Host</div><div class=\"info-card-value\">' +\n esc(data.host || 'localhost') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Port</div><div class=\"info-card-value\">' +\n (data.port || 'N/A') + '</div></div>' +\n (data.tls?.enabled ? '<div class=\"info-card\"><div class=\"info-card-title\">TLS</div><div class=\"info-card-value\">Enabled</div></div>' : '');\n container.appendChild(grid);\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, tcpSpec?.contentTypes)\n );\n if (data.framing) {\n const h = document.createElement('h4');\n h.textContent = 'Framing';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.framing, [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.inbound || data.messages?.outbound) {\n if (data.messages?.inbound) {\n const h = document.createElement('h4');\n h.textContent = 'Inbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.inbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.outbound) {\n const h = document.createElement('h4');\n h.textContent = 'Outbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.outbound), [], 0);\n container.appendChild(schemaEl);\n }\n }\n }\n\n // UDP-specific\n if (activeProtocol === 'udp') {\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Host</div><div class=\"info-card-value\">' +\n esc(data.host || '127.0.0.1') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Port</div><div class=\"info-card-value\">' +\n (data.port || 'N/A') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Max Packet</div><div class=\"info-card-value\">' +\n (data.maxPacketSize || 65507) + ' bytes</div></div>';\n container.appendChild(grid);\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, udpSpec?.contentTypes)\n );\n if (data.messages?.inbound) {\n const h = document.createElement('h4');\n h.textContent = 'Inbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.inbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.outbound) {\n const h = document.createElement('h4');\n h.textContent = 'Outbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.outbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (!data.messages?.inbound && !data.messages?.outbound && data.message) {\n const h = document.createElement('h4');\n h.textContent = 'Message Schema';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.message), [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n return container;\n }\n\n function getGrpcMethodType(method) {\n const client = method['x-usd-client-streaming'];\n const server = method['x-usd-server-streaming'];\n if (client && server) return 'bidirectional';\n if (client) return 'client_streaming';\n if (server) return 'server_streaming';\n return 'unary';\n }\n\n function resolveMessagePayload(message) {\n if (!message) return null;\n if (message.$ref) {\n const resolved = resolveRef(message.$ref);\n if (resolved && resolved.payload) return resolved.payload;\n return resolved || message;\n }\n if (message.payload) return message.payload;\n return message;\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=endpoint-details.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-details.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/endpoint-details.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,2BAA2B,w/eAA0/e,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export const endpointDetailsClientScript = " function resolveEffectiveContentTypes(operationTypes, protocolTypes) {\n const globalTypes = (xUsd && xUsd.contentTypes) ? xUsd.contentTypes : {};\n const defaultType =\n (operationTypes && operationTypes.default) ||\n (protocolTypes && protocolTypes.default) ||\n globalTypes.default ||\n 'application/json';\n const supportedList =\n (operationTypes && operationTypes.supported) ||\n (protocolTypes && protocolTypes.supported) ||\n globalTypes.supported ||\n [];\n const supported = Array.isArray(supportedList) ? supportedList.slice() : [];\n if (defaultType && supported.indexOf(defaultType) === -1) {\n supported.unshift(defaultType);\n }\n return { default: defaultType, supported };\n }\n\n function appendContentTypes(container, label, contentTypes) {\n if (!contentTypes) return;\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">' + esc(label) + '</div>';\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n const supportedText = (contentTypes.supported && contentTypes.supported.length > 0)\n ? contentTypes.supported.join(', ')\n : contentTypes.default;\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Default</div><div class=\"info-card-value\">' +\n esc(contentTypes.default || 'application/json') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Supported</div><div class=\"info-card-value\">' +\n esc(supportedText || 'application/json') + '</div></div>';\n section.appendChild(grid);\n container.appendChild(section);\n }\n\n function renderEndpointDetails(ep) {\n const container = document.createElement('div');\n const data = ep.data;\n\n // HTTP-specific (Redoc-style layout)\n if (activeProtocol === 'http') {\n // AUTHORIZATIONS section\n if (data.security && data.security.length > 0) {\n const authSection = document.createElement('div');\n authSection.className = 'endpoint-subsection';\n authSection.innerHTML = '<div class=\"subsection-label\">AUTHORIZATIONS:</div>';\n const authValue = document.createElement('span');\n authValue.className = 'auth-value';\n const authNames = data.security.flatMap(s => Object.keys(s));\n authValue.textContent = authNames.join(', ') || 'None';\n authSection.appendChild(authValue);\n container.appendChild(authSection);\n }\n\n // PATH PARAMETERS\n const pathParams = (data.parameters || []).filter(p => p.in === 'path');\n if (pathParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">PATH PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(pathParams));\n container.appendChild(section);\n }\n\n // QUERY PARAMETERS\n const queryParams = (data.parameters || []).filter(p => p.in === 'query');\n if (queryParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">QUERY PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(queryParams));\n container.appendChild(section);\n }\n\n // HEADER PARAMETERS\n const headerParams = (data.parameters || []).filter(p => p.in === 'header');\n if (headerParams.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">HEADER PARAMETERS</div>';\n section.appendChild(renderParametersRedocStyle(headerParams));\n container.appendChild(section);\n }\n }\n\n // WebSocket-specific\n if (activeProtocol === 'websocket') {\n if (data.type) {\n const badge = document.createElement('span');\n badge.className = 'badge channel-type-' + data.type;\n badge.textContent = data.type;\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n if (data.subscribe) {\n appendContentTypes(\n container,\n 'Subscribe Content Types',\n resolveEffectiveContentTypes(data.subscribe?.contentTypes, wsSpec?.contentTypes)\n );\n }\n if (data.publish) {\n appendContentTypes(\n container,\n 'Publish Content Types',\n resolveEffectiveContentTypes(data.publish?.contentTypes, wsSpec?.contentTypes)\n );\n }\n if (data.parameters) {\n const paramSchema = { type: 'object', properties: {}, required: [] };\n Object.entries(data.parameters).forEach(([name, param]) => {\n const schema = param.schema || { type: 'string' };\n if (param.description) schema.description = param.description;\n paramSchema.properties[name] = schema;\n if (param.required) paramSchema.required.push(name);\n });\n const h = document.createElement('h4');\n h.textContent = 'Parameters';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(paramSchema, paramSchema.required, 0);\n container.appendChild(schemaEl);\n }\n const subscribePayload = resolveMessagePayload(data.subscribe?.message);\n if (subscribePayload) {\n const h = document.createElement('h4');\n h.textContent = 'Subscribe (receive)';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(subscribePayload, [], 0);\n container.appendChild(schemaEl);\n }\n const publishPayload = resolveMessagePayload(data.publish?.message);\n if (publishPayload) {\n const h = document.createElement('h4');\n h.textContent = 'Publish (send)';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(publishPayload, [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n // Streams-specific\n if (activeProtocol === 'streams') {\n if (data.direction) {\n const badge = document.createElement('span');\n badge.className = 'badge badge-stream';\n badge.textContent = data.direction;\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, streamsSpec?.contentTypes)\n );\n const streamPayload = resolveMessagePayload(data.message);\n if (streamPayload) {\n const h = document.createElement('h4');\n h.textContent = 'Message Schema';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(streamPayload, [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n // JSON-RPC-specific\n if (activeProtocol === 'jsonrpc') {\n if (data['x-usd-notification'] || data['x-usd-streaming']) {\n const flags = [];\n if (data['x-usd-notification']) flags.push('notification');\n if (data['x-usd-streaming']) flags.push('streaming');\n const info = document.createElement('div');\n info.style.marginBottom = '16px';\n info.innerHTML = flags.map(f => '<span class=\"badge badge-rpc\" style=\"margin-right: 6px;\">' + esc(f) + '</span>').join('');\n container.appendChild(info);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, jsonrpcSpec?.contentTypes)\n );\n if (data.params) {\n const h = document.createElement('h4');\n h.textContent = 'Parameters';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.params, data.params.required || [], 0);\n container.appendChild(schemaEl);\n }\n if (data.result) {\n const h = document.createElement('h4');\n h.textContent = 'Result';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.result, [], 0);\n container.appendChild(schemaEl);\n }\n if (Array.isArray(data.errors) && data.errors.length > 0) {\n const section = document.createElement('div');\n section.className = 'endpoint-subsection';\n section.innerHTML = '<div class=\"subsection-label\">Errors</div>';\n data.errors.forEach((err) => {\n const card = document.createElement('div');\n card.className = 'info-card';\n card.innerHTML =\n '<div class=\"info-card-title\">' + esc(err.code) + '</div>' +\n '<div class=\"info-card-value\">' + esc(err.message) + '</div>' +\n (err.description ? '<div class=\"info-card-subtitle\">' + esc(err.description) + '</div>' : '');\n section.appendChild(card);\n if (err.data) {\n const schemaEl = renderSchemaProperties(err.data, [], 0);\n section.appendChild(schemaEl);\n }\n });\n container.appendChild(section);\n }\n }\n\n // gRPC-specific\n if (activeProtocol === 'grpc') {\n const method = data.method;\n if (method) {\n const methodType = getGrpcMethodType(method);\n if (methodType && methodType !== 'unary') {\n const badge = document.createElement('span');\n badge.className = 'badge badge-stream';\n badge.textContent = methodType.replace('_', ' ');\n badge.style.marginBottom = '16px';\n badge.style.display = 'inline-block';\n container.appendChild(badge);\n }\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(method.contentTypes, grpcSpec?.contentTypes)\n );\n if (method.input) {\n const h = document.createElement('h4');\n h.textContent = 'Request';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(method.input, [], 0);\n container.appendChild(schemaEl);\n }\n if (method.output) {\n const h = document.createElement('h4');\n h.textContent = 'Response';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(method.output, [], 0);\n container.appendChild(schemaEl);\n }\n }\n }\n\n // TCP-specific\n if (activeProtocol === 'tcp') {\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Host</div><div class=\"info-card-value\">' +\n esc(data.host || 'localhost') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Port</div><div class=\"info-card-value\">' +\n (data.port || 'N/A') + '</div></div>' +\n (data.tls?.enabled ? '<div class=\"info-card\"><div class=\"info-card-title\">TLS</div><div class=\"info-card-value\">Enabled</div></div>' : '');\n container.appendChild(grid);\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, tcpSpec?.contentTypes)\n );\n if (data.framing) {\n const h = document.createElement('h4');\n h.textContent = 'Framing';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(data.framing, [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.inbound || data.messages?.outbound) {\n if (data.messages?.inbound) {\n const h = document.createElement('h4');\n h.textContent = 'Inbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.inbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.outbound) {\n const h = document.createElement('h4');\n h.textContent = 'Outbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.outbound), [], 0);\n container.appendChild(schemaEl);\n }\n }\n }\n\n // UDP-specific\n if (activeProtocol === 'udp') {\n const grid = document.createElement('div');\n grid.className = 'info-grid';\n grid.innerHTML =\n '<div class=\"info-card\"><div class=\"info-card-title\">Host</div><div class=\"info-card-value\">' +\n esc(data.host || '127.0.0.1') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Port</div><div class=\"info-card-value\">' +\n (data.port || 'N/A') + '</div></div>' +\n '<div class=\"info-card\"><div class=\"info-card-title\">Max Packet</div><div class=\"info-card-value\">' +\n (data.maxPacketSize || 65507) + ' bytes</div></div>';\n container.appendChild(grid);\n appendContentTypes(\n container,\n 'Content Types',\n resolveEffectiveContentTypes(data.contentTypes, udpSpec?.contentTypes)\n );\n if (data.messages?.inbound) {\n const h = document.createElement('h4');\n h.textContent = 'Inbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.inbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (data.messages?.outbound) {\n const h = document.createElement('h4');\n h.textContent = 'Outbound Message';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.messages.outbound), [], 0);\n container.appendChild(schemaEl);\n }\n if (!data.messages?.inbound && !data.messages?.outbound && data.message) {\n const h = document.createElement('h4');\n h.textContent = 'Message Schema';\n container.appendChild(h);\n const schemaEl = renderSchemaProperties(resolveMessagePayload(data.message), [], 0);\n container.appendChild(schemaEl);\n }\n }\n\n return container;\n }\n\n function getGrpcMethodType(method) {\n const client = method['x-usd-client-streaming'];\n const server = method['x-usd-server-streaming'];\n if (client && server) return 'bidirectional';\n if (client) return 'client_streaming';\n if (server) return 'server_streaming';\n return 'unary';\n }\n\n function resolveMessagePayload(message) {\n if (!message) return null;\n if (message.\$ref) {\n const resolved = resolveRef(message.\$ref);\n if (resolved && resolved.payload) return resolved.payload;\n return resolved || message;\n }\n if (message.payload) return message.payload;\n return message;\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=endpoint-details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-details.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/endpoint-details.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,u/eAAu/e,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,gBAAgB,QA8N5B,CAAA"}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded docs UI client script chunk.
|
|
3
|
-
*/
|
|
4
|
-
export const initClientScript = String.raw ` // Render introduction markdown if provided
|
|
5
|
-
// Note: introductionMarkdown is server-generated trusted content from USD spec
|
|
6
|
-
// parseMarkdown() escapes text before processing markdown syntax
|
|
7
|
-
function renderIntroduction() {
|
|
8
|
-
const container = document.getElementById('introductionContent');
|
|
9
|
-
if (!container || !introductionMarkdown) return;
|
|
10
|
-
container.innerHTML = parseMarkdown(introductionMarkdown);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function renderMermaidDiagrams(root = document) {
|
|
14
|
-
const diagrams = Array.from(root.querySelectorAll('.mermaid:not([data-mermaid-rendered])'));
|
|
15
|
-
if (diagrams.length === 0) return;
|
|
16
|
-
if (!window.mermaid) {
|
|
17
|
-
diagrams.forEach(diagram => diagram.classList.add('mermaid-fallback'));
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
window.mermaid.initialize?.({ startOnLoad: false, securityLevel: 'strict' });
|
|
21
|
-
diagrams.forEach((diagram, index) => {
|
|
22
|
-
const source = diagram.getAttribute('data-mermaid-source') || diagram.textContent || '';
|
|
23
|
-
const id = 'raffel-mermaid-' + Date.now() + '-' + index;
|
|
24
|
-
Promise.resolve(window.mermaid.render(id, source))
|
|
25
|
-
.then(result => {
|
|
26
|
-
diagram.innerHTML = typeof result === 'string' ? result : result.svg;
|
|
27
|
-
result?.bindFunctions?.(diagram);
|
|
28
|
-
diagram.dataset.mermaidRendered = 'true';
|
|
29
|
-
diagram.classList.remove('mermaid-fallback', 'mermaid-error');
|
|
30
|
-
})
|
|
31
|
-
.catch(error => {
|
|
32
|
-
diagram.dataset.mermaidRendered = 'error';
|
|
33
|
-
diagram.classList.add('mermaid-error');
|
|
34
|
-
diagram.setAttribute('title', error instanceof Error ? error.message : 'Unable to render Mermaid diagram');
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function parseComponentProps(raw) {
|
|
40
|
-
const source = String(raw || '').trim();
|
|
41
|
-
if (!source) return {};
|
|
42
|
-
try {
|
|
43
|
-
const parsed = JSON.parse(source);
|
|
44
|
-
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
45
|
-
} catch {
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function mountDocsComponents(root = document) {
|
|
51
|
-
const targets = Array.from(root.querySelectorAll('[data-raffel-component]:not([data-raffel-component-mounted])'));
|
|
52
|
-
targets.forEach(target => {
|
|
53
|
-
const name = String(target.getAttribute('data-raffel-component') || '').trim();
|
|
54
|
-
if (!name) return;
|
|
55
|
-
const props = parseComponentProps(target.getAttribute('data-props'));
|
|
56
|
-
target.dataset.raffelComponentMounted = 'true';
|
|
57
|
-
target.dataset.pagePath = activePagePath;
|
|
58
|
-
const context = getPluginContext({ pagePath: activePagePath });
|
|
59
|
-
docsPlugins.forEach(plugin => plugin.mountComponent?.(target, name, props, context));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function highlightCodeBlocks(root = document) {
|
|
64
|
-
if (!window.Prism?.highlightElement) return;
|
|
65
|
-
const blocks = Array.from(root.querySelectorAll('pre code[class*="language-"]:not([data-prism-highlighted])'));
|
|
66
|
-
blocks.forEach(block => {
|
|
67
|
-
window.Prism.highlightElement(block);
|
|
68
|
-
block.dataset.prismHighlighted = 'true';
|
|
69
|
-
});
|
|
70
|
-
document.documentElement.setAttribute('data-syntax-highlight', 'prism');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function enhanceCodeBlockToolbars(root) {
|
|
74
|
-
const scope = root || document;
|
|
75
|
-
if (!scope.querySelectorAll) return;
|
|
76
|
-
const codes = scope.querySelectorAll('pre > code[class*="language-"]');
|
|
77
|
-
codes.forEach(code => {
|
|
78
|
-
const pre = code.parentElement;
|
|
79
|
-
if (!pre || pre.getAttribute('data-code-toolbar-enhanced') === 'true') return;
|
|
80
|
-
pre.setAttribute('data-code-toolbar-enhanced', 'true');
|
|
81
|
-
if (pre.style && !pre.style.position) pre.style.position = 'relative';
|
|
82
|
-
const langMatch = String(code.className || '').match(/(?:^|\s)language-([\w+#.-]+)/);
|
|
83
|
-
const lang = langMatch ? langMatch[1].toLowerCase() : '';
|
|
84
|
-
const toolbar = document.createElement('div');
|
|
85
|
-
toolbar.className = 'code-block-toolbar';
|
|
86
|
-
const langEl = document.createElement('span');
|
|
87
|
-
langEl.className = 'code-block-lang';
|
|
88
|
-
langEl.textContent = lang;
|
|
89
|
-
if (!lang) langEl.setAttribute('hidden', 'hidden');
|
|
90
|
-
toolbar.appendChild(langEl);
|
|
91
|
-
const button = document.createElement('button');
|
|
92
|
-
button.setAttribute('type', 'button');
|
|
93
|
-
button.className = 'code-block-copy';
|
|
94
|
-
button.textContent = 'Copy';
|
|
95
|
-
button.addEventListener('click', () => {
|
|
96
|
-
const text = String(code.textContent || '');
|
|
97
|
-
const finish = () => {
|
|
98
|
-
button.textContent = 'Copied';
|
|
99
|
-
setTimeout(() => { if (button.textContent === 'Copied') button.textContent = 'Copy'; }, 1000);
|
|
100
|
-
};
|
|
101
|
-
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
102
|
-
try {
|
|
103
|
-
const result = navigator.clipboard.writeText(text);
|
|
104
|
-
if (result && typeof result.then === 'function') result.then(finish).catch(finish);
|
|
105
|
-
else finish();
|
|
106
|
-
} catch { finish(); }
|
|
107
|
-
} else finish();
|
|
108
|
-
});
|
|
109
|
-
toolbar.appendChild(button);
|
|
110
|
-
pre.insertBefore(toolbar, pre.firstChild);
|
|
111
|
-
const wrap = pre.parentElement;
|
|
112
|
-
if (wrap && wrap.classList && wrap.classList.contains('md-code-wrap')) {
|
|
113
|
-
const legacy = wrap.querySelector(':scope > .copy-code-btn');
|
|
114
|
-
if (legacy) legacy.setAttribute('hidden', 'hidden');
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
document.addEventListener('click', (event) => {
|
|
120
|
-
const zoomClose = event.target.closest('.image-zoom-close');
|
|
121
|
-
if (zoomClose || event.target.classList?.contains('image-zoom-overlay')) {
|
|
122
|
-
document.querySelector('.image-zoom-overlay')?.remove();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const zoomImage = event.target.closest('.markdown-content .md-image');
|
|
127
|
-
if (zoomImage?.src) {
|
|
128
|
-
if (zoomImage.matches('[data-no-zoom="true"], .no-zoom')) return;
|
|
129
|
-
document.querySelector('.image-zoom-overlay')?.remove();
|
|
130
|
-
const overlay = document.createElement('div');
|
|
131
|
-
overlay.className = 'image-zoom-overlay';
|
|
132
|
-
overlay.setAttribute('role', 'dialog');
|
|
133
|
-
overlay.setAttribute('aria-modal', 'true');
|
|
134
|
-
overlay.innerHTML = '<button type="button" class="image-zoom-close" aria-label="Close image preview">×</button>' +
|
|
135
|
-
'<img class="image-zoom-img" src="' + escapeAttr(zoomImage.src) + '" alt="' + escapeAttr(zoomImage.alt || '') + '">';
|
|
136
|
-
document.body.appendChild(overlay);
|
|
137
|
-
docsPlugins.forEach(plugin => plugin.onImageZoom?.(String(zoomImage.src), String(zoomImage.alt || ''), getPluginContext({ pagePath: activePagePath })));
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const tabButton = event.target.closest('.md-tab-button');
|
|
142
|
-
if (tabButton) {
|
|
143
|
-
const tabs = tabButton.closest('.md-tabs');
|
|
144
|
-
const tabIndex = tabButton.getAttribute('data-tab-index');
|
|
145
|
-
tabs?.querySelectorAll('.md-tab-button').forEach(button => button.classList.toggle('active', button === tabButton));
|
|
146
|
-
tabs?.querySelectorAll('.md-tab-panel').forEach(panel => panel.classList.toggle('active', panel.getAttribute('data-tab-index') === tabIndex));
|
|
147
|
-
docsPlugins.forEach(plugin => plugin.onTabChange?.(tabButton.textContent?.trim?.() || '', Number(tabIndex || 0), getPluginContext({ pagePath: activePagePath })));
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const copyButton = event.target.closest('.copy-code-btn');
|
|
152
|
-
if (!copyButton) return;
|
|
153
|
-
const wrap = copyButton.closest('.md-code-wrap');
|
|
154
|
-
const code = wrap ? wrap.querySelector('code') : null;
|
|
155
|
-
if (!code) return;
|
|
156
|
-
const text = code.textContent || '';
|
|
157
|
-
const markCopied = () => {
|
|
158
|
-
const previous = copyButton.textContent;
|
|
159
|
-
copyButton.textContent = 'Copied';
|
|
160
|
-
setTimeout(() => {
|
|
161
|
-
copyButton.textContent = previous || 'Copy';
|
|
162
|
-
}, 1500);
|
|
163
|
-
};
|
|
164
|
-
if (navigator.clipboard?.writeText) {
|
|
165
|
-
navigator.clipboard.writeText(text).then(markCopied).catch(() => {});
|
|
166
|
-
} else {
|
|
167
|
-
const textarea = document.createElement('textarea');
|
|
168
|
-
textarea.value = text;
|
|
169
|
-
textarea.style.position = 'fixed';
|
|
170
|
-
textarea.style.opacity = '0';
|
|
171
|
-
document.body.appendChild(textarea);
|
|
172
|
-
textarea.select();
|
|
173
|
-
document.execCommand('copy');
|
|
174
|
-
textarea.remove();
|
|
175
|
-
markCopied();
|
|
176
|
-
}
|
|
177
|
-
docsPlugins.forEach(plugin => plugin.onCopyCode?.(text, getPluginContext({ pagePath: activePagePath })));
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
document.addEventListener('keydown', (event) => {
|
|
181
|
-
if (event.key === 'Escape') {
|
|
182
|
-
document.querySelector('.image-zoom-overlay')?.remove();
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// cmd+K / ctrl+K opens the docs search modal (legacy fallback delivery).
|
|
187
|
-
// The shared runtime delivery wires this through createDocsSearchModal().
|
|
188
|
-
document.addEventListener('keydown', (event) => {
|
|
189
|
-
if ((sidebarConfig && sidebarConfig.search === false)) return;
|
|
190
|
-
const isShortcut = event.key?.toLowerCase?.() === 'k' && (event.ctrlKey || event.metaKey);
|
|
191
|
-
if (!isShortcut) return;
|
|
192
|
-
const target = event.target;
|
|
193
|
-
const isFormField = target && (
|
|
194
|
-
target.tagName === 'INPUT' ||
|
|
195
|
-
target.tagName === 'TEXTAREA' ||
|
|
196
|
-
target.tagName === 'SELECT' ||
|
|
197
|
-
target.isContentEditable === true ||
|
|
198
|
-
(typeof target.getAttribute === 'function' && target.getAttribute('contenteditable') === 'true')
|
|
199
|
-
);
|
|
200
|
-
const existing = document.querySelector('dialog.search-modal');
|
|
201
|
-
if (isFormField && !(existing && existing.hasAttribute('open'))) return;
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
const search = document.getElementById('searchInput');
|
|
204
|
-
if (search && document.activeElement !== search) {
|
|
205
|
-
search.focus();
|
|
206
|
-
document.documentElement.setAttribute('data-search-focused', 'true');
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
const storedTheme = localStorage?.getItem?.('raffel-docs-theme');
|
|
211
|
-
if (storedTheme === 'auto' || storedTheme === 'dark' || storedTheme === 'light' || storedTheme === 'custom') {
|
|
212
|
-
document.documentElement.setAttribute('data-theme', storedTheme);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Initial render
|
|
216
|
-
installDocsPluginApi();
|
|
217
|
-
renderIntroduction();
|
|
218
|
-
renderFooter();
|
|
219
|
-
renderProtocolTabs();
|
|
220
|
-
renderSidebar();
|
|
221
|
-
renderContent();
|
|
222
|
-
highlightCodeBlocks(document.getElementById('mainContent'));
|
|
223
|
-
enhanceCodeBlockToolbars(document.getElementById('mainContent'));
|
|
224
|
-
renderMermaidDiagrams();
|
|
225
|
-
mountDocsComponents(document.getElementById('mainContent'));
|
|
226
|
-
`;
|
|
227
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NzC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,oBAAoB,QAibhC,CAAA"}
|