@open-resource-discovery/metadata-renderer 0.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +94 -1
  3. package/dist/a2a/index.d.ts +9 -0
  4. package/dist/a2a.js +2 -0
  5. package/dist/asyncApi/asyncapi-browser.d.ts +3 -0
  6. package/dist/asyncApi/customAttributes/attributeLink.d.ts +3 -0
  7. package/dist/asyncApi/customAttributes/autoDiscover.d.ts +4 -0
  8. package/dist/asyncApi/customAttributes/buildExtensionsConfig.d.ts +5 -0
  9. package/dist/asyncApi/customAttributes/context.d.ts +7 -0
  10. package/dist/asyncApi/customAttributes/genericRenderer.d.ts +4 -0
  11. package/dist/asyncApi/customAttributes/sapPreset.d.ts +2 -0
  12. package/dist/asyncApi/customAttributes/stateInfo.d.ts +3 -0
  13. package/dist/asyncApi/customAttributes/styles.d.ts +2 -0
  14. package/dist/asyncApi/customAttributes/types.d.ts +32 -0
  15. package/dist/asyncApi/index.d.ts +11 -0
  16. package/dist/asyncapi.js +2 -0
  17. package/dist/chunks/a2a-B5lkgqLU.js +29 -0
  18. package/dist/chunks/asyncApi-DtAXW7IY.js +502 -0
  19. package/dist/chunks/csn-3ek2O4d6.js +385 -0
  20. package/dist/chunks/mcp-qA5sYRAN.js +29 -0
  21. package/dist/chunks/openApi-BTb5yzun.js +783 -0
  22. package/dist/chunks/utils-BC3WF3-9.js +77 -0
  23. package/dist/core/ShadowRoot.d.ts +6 -0
  24. package/dist/core/dispatch.d.ts +3 -0
  25. package/dist/core/dispatch.test.d.ts +1 -0
  26. package/dist/core/index.d.ts +11 -0
  27. package/dist/core/utils.d.ts +7 -0
  28. package/dist/core/utils.test.d.ts +1 -0
  29. package/dist/csn/customAttributes/genericRenderer.d.ts +2 -0
  30. package/dist/csn/customAttributes/postProcess.d.ts +5 -0
  31. package/dist/csn/customAttributes/sapPreset.d.ts +2 -0
  32. package/dist/csn/customAttributes/types.d.ts +28 -0
  33. package/dist/csn/index.d.ts +11 -0
  34. package/dist/csn/styles.d.ts +2 -0
  35. package/dist/csn.js +2 -0
  36. package/dist/entries/a2a.d.ts +2 -0
  37. package/dist/entries/asyncapi.d.ts +2 -0
  38. package/dist/entries/csn.d.ts +2 -0
  39. package/dist/entries/mcp.d.ts +2 -0
  40. package/dist/entries/openapi.d.ts +2 -0
  41. package/dist/favicon.ico +0 -0
  42. package/dist/favicon.svg +29 -0
  43. package/dist/index.css +210782 -0
  44. package/dist/index.d.ts +23 -0
  45. package/dist/index.js +783 -0
  46. package/dist/mcp/index.d.ts +8 -0
  47. package/dist/mcp.js +2 -0
  48. package/dist/openApi/customAttributes/attributeLink.d.ts +3 -0
  49. package/dist/openApi/customAttributes/autoDiscover.d.ts +15 -0
  50. package/dist/openApi/customAttributes/genericRenderer.d.ts +3 -0
  51. package/dist/openApi/customAttributes/sapAttributes/operation/deprecatedOperation.d.ts +10 -0
  52. package/dist/openApi/customAttributes/sapAttributes/root/extOverview.d.ts +2 -0
  53. package/dist/openApi/customAttributes/sapAttributes/root/extensible.d.ts +10 -0
  54. package/dist/openApi/customAttributes/sapAttributes/root/ordId.d.ts +6 -0
  55. package/dist/openApi/customAttributes/sapAttributes/root/stateInfo.d.ts +11 -0
  56. package/dist/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.d.ts +10 -0
  57. package/dist/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.spec.d.ts +1 -0
  58. package/dist/openApi/customAttributes/sapAttributes/sapPreset.d.ts +2 -0
  59. package/dist/openApi/customAttributes/sapAttributes/schema/odmEntityName.d.ts +6 -0
  60. package/dist/openApi/customAttributes/sapAttributes/schema/odmSemanticKey.d.ts +10 -0
  61. package/dist/openApi/customAttributes/types.d.ts +31 -0
  62. package/dist/openApi/index.d.ts +9 -0
  63. package/dist/openApi/styles.d.ts +2 -0
  64. package/dist/openApi/utils/context.d.ts +7 -0
  65. package/dist/openApi/utils/context.test.d.ts +1 -0
  66. package/dist/openApi/utils/plugins.d.ts +3 -0
  67. package/dist/openApi/utils/scalarTheme.d.ts +11 -0
  68. package/dist/openapi.js +2 -0
  69. package/dist/styles.d.ts +0 -0
  70. package/dist/styles.js +4 -0
  71. package/dist/theme-builder.d.ts +28 -0
  72. package/dist/types.d.ts +46 -0
  73. package/dist/vendor.d.ts +2 -0
  74. package/package.json +135 -3
@@ -0,0 +1,502 @@
1
+ import { i as loadObject } from "./utils-BC3WF3-9.js";
2
+ /* empty css */
3
+ import { createElement, useId, useMemo } from "react";
4
+ import Markdown from "react-markdown";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import AsyncApiComponent from "@asyncapi/react-component/browser/index.js";
7
+ import { PluginSlot } from "@asyncapi/react-component";
8
+ //#region src/lib/asyncApi/customAttributes/context.ts
9
+ var asyncApiContext = {
10
+ version: "",
11
+ configs: [],
12
+ rootFields: {},
13
+ getDocumentationUrl(fieldName) {
14
+ return (this.configs.find((c) => c.extensions?.[fieldName]) ?? this.configs.find((c) => c.prefixStartsWith && fieldName.startsWith(c.prefixStartsWith)))?.documentationUrl?.(fieldName, { version: this.version });
15
+ }
16
+ };
17
+ //#endregion
18
+ //#region src/lib/asyncApi/customAttributes/attributeLink.tsx
19
+ function AttributeLink({ attributeName }) {
20
+ const href = asyncApiContext.getDocumentationUrl(attributeName);
21
+ if (!href) return null;
22
+ return /* @__PURE__ */ jsx("a", {
23
+ href,
24
+ style: {
25
+ marginLeft: 4,
26
+ marginTop: 4
27
+ },
28
+ target: "_blank",
29
+ rel: "noreferrer",
30
+ title: "View in AsyncAPI Specification",
31
+ children: /* @__PURE__ */ jsx("svg", {
32
+ width: "16",
33
+ height: "16",
34
+ viewBox: "0 0 16 16",
35
+ fill: "currentColor",
36
+ children: /* @__PURE__ */ jsx("path", { d: "M10.604 1h4.146a.25.25 0 01.25.25v4.146a.25.25 0 01-.427.177L13.03 4.03 9.28 7.78a.75.75 0 01-1.06-1.06l3.75-3.75-1.543-1.543A.25.25 0 0110.604 1zM3.75 2A1.75 1.75 0 002 3.75v8.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 12.25v-3.5a.75.75 0 00-1.5 0v3.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-8.5a.25.25 0 01.25-.25h3.5a.75.75 0 000-1.5h-3.5z" })
37
+ })
38
+ });
39
+ }
40
+ //#endregion
41
+ //#region src/lib/asyncApi/customAttributes/genericRenderer.tsx
42
+ function autoLabel(fieldName, prefix) {
43
+ let name = fieldName;
44
+ if (prefix && name.startsWith(prefix)) name = name.slice(prefix.length);
45
+ return name.replace(/([a-z])([A-Z])/g, "$1-$2").split("-").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
46
+ }
47
+ function Label({ name, label }) {
48
+ return /* @__PURE__ */ jsxs("div", {
49
+ className: "asyncapi-attr-label",
50
+ children: [
51
+ label,
52
+ " ",
53
+ /* @__PURE__ */ jsx(AttributeLink, { attributeName: name })
54
+ ]
55
+ });
56
+ }
57
+ function renderObjectValue(val) {
58
+ if (val === null || val === void 0) return /* @__PURE__ */ jsx("span", {
59
+ className: "asyncapi-attr-placeholder",
60
+ children: "—"
61
+ });
62
+ if (typeof val === "boolean") return /* @__PURE__ */ jsx("span", { children: val ? "Yes" : "No" });
63
+ if (typeof val === "number") return /* @__PURE__ */ jsx("span", { children: val });
64
+ if (Array.isArray(val)) return /* @__PURE__ */ jsx("ul", {
65
+ className: "asyncapi-attr-list",
66
+ children: val.map((item, i) => /* @__PURE__ */ jsx("li", { children: renderObjectValue(item) }, i))
67
+ });
68
+ if (typeof val === "object") return /* @__PURE__ */ jsx("dl", {
69
+ className: "asyncapi-attr-obj",
70
+ children: Object.entries(val).map(([k, v]) => /* @__PURE__ */ jsxs("div", {
71
+ className: "asyncapi-attr-obj-row",
72
+ children: [
73
+ /* @__PURE__ */ jsxs("dt", {
74
+ className: "asyncapi-attr-obj-key",
75
+ children: [k, ":"]
76
+ }),
77
+ " ",
78
+ /* @__PURE__ */ jsx("dd", {
79
+ className: "asyncapi-attr-obj-val",
80
+ children: renderObjectValue(v)
81
+ })
82
+ ]
83
+ }, k))
84
+ });
85
+ const str = String(val);
86
+ return /[*_`[\]#]/.test(str) ? /* @__PURE__ */ jsx(Markdown, { children: str }) : /* @__PURE__ */ jsx("span", { children: str });
87
+ }
88
+ function StringRenderer(props) {
89
+ const link = props.valueLinks?.[props.value];
90
+ return /* @__PURE__ */ jsxs("div", {
91
+ className: "asyncapi-attr-row",
92
+ children: [/* @__PURE__ */ jsx(Label, {
93
+ name: props.name,
94
+ label: props.label
95
+ }), /* @__PURE__ */ jsx("p", {
96
+ className: "asyncapi-attr-value",
97
+ children: link ? /* @__PURE__ */ jsx("a", {
98
+ href: link,
99
+ rel: "noreferrer noopener",
100
+ target: "_blank",
101
+ className: "asyncapi-attr-link",
102
+ children: props.value
103
+ }) : props.value
104
+ })]
105
+ });
106
+ }
107
+ function BooleanRenderer(props) {
108
+ return /* @__PURE__ */ jsxs("div", {
109
+ className: "asyncapi-attr-row",
110
+ children: [/* @__PURE__ */ jsx(Label, {
111
+ name: props.name,
112
+ label: props.label
113
+ }), /* @__PURE__ */ jsx("p", {
114
+ className: "asyncapi-attr-value",
115
+ children: props.value ? "Yes" : "No"
116
+ })]
117
+ });
118
+ }
119
+ function NumberRenderer(props) {
120
+ return /* @__PURE__ */ jsxs("div", {
121
+ className: "asyncapi-attr-row",
122
+ children: [/* @__PURE__ */ jsx(Label, {
123
+ name: props.name,
124
+ label: props.label
125
+ }), /* @__PURE__ */ jsx("p", {
126
+ className: "asyncapi-attr-value",
127
+ children: props.value
128
+ })]
129
+ });
130
+ }
131
+ function ArrayRenderer(props) {
132
+ return /* @__PURE__ */ jsxs("div", {
133
+ className: "asyncapi-attr-row",
134
+ children: [/* @__PURE__ */ jsx(Label, {
135
+ name: props.name,
136
+ label: props.label
137
+ }), /* @__PURE__ */ jsx("div", {
138
+ className: "asyncapi-attr-value",
139
+ children: /* @__PURE__ */ jsx("ul", {
140
+ className: "asyncapi-attr-list",
141
+ children: props.value.map((item, i) => /* @__PURE__ */ jsx("li", { children: renderObjectValue(item) }, i))
142
+ })
143
+ })]
144
+ });
145
+ }
146
+ function ObjectRenderer(props) {
147
+ return /* @__PURE__ */ jsxs("div", {
148
+ className: "asyncapi-attr-row",
149
+ children: [/* @__PURE__ */ jsx(Label, {
150
+ name: props.name,
151
+ label: props.label
152
+ }), /* @__PURE__ */ jsx("div", {
153
+ className: "asyncapi-attr-value",
154
+ children: renderObjectValue(props.value)
155
+ })]
156
+ });
157
+ }
158
+ function LinkRenderer(props) {
159
+ const href = props.callback(props.value);
160
+ return /* @__PURE__ */ jsxs("div", {
161
+ className: "asyncapi-attr-row",
162
+ children: [/* @__PURE__ */ jsx(Label, {
163
+ name: props.name,
164
+ label: props.label
165
+ }), /* @__PURE__ */ jsx("p", {
166
+ className: "asyncapi-attr-value",
167
+ children: href ? /* @__PURE__ */ jsx("a", {
168
+ href,
169
+ rel: "noreferrer noopener",
170
+ target: "_blank",
171
+ className: "asyncapi-attr-link",
172
+ children: String(props.value)
173
+ }) : String(props.value)
174
+ })]
175
+ });
176
+ }
177
+ function buildAsyncApiGenericRenderer(fieldName, def, config) {
178
+ if (def && "component" in def) return def.component;
179
+ return function AsyncApiFieldRenderer({ propertyValue }) {
180
+ const value = propertyValue;
181
+ if (value === void 0 || value === null) return null;
182
+ const label = def && "label" in def && def.label ? def.label : autoLabel(fieldName, config.prefixStartsWith);
183
+ if (def?.type === "link") return /* @__PURE__ */ jsx(LinkRenderer, {
184
+ name: fieldName,
185
+ label,
186
+ value,
187
+ callback: def.callback
188
+ });
189
+ if (def?.type === "boolean" || typeof value === "boolean") return /* @__PURE__ */ jsx(BooleanRenderer, {
190
+ name: fieldName,
191
+ label,
192
+ value: Boolean(value)
193
+ });
194
+ if (def?.type === "number" || typeof value === "number") return /* @__PURE__ */ jsx(NumberRenderer, {
195
+ name: fieldName,
196
+ label,
197
+ value
198
+ });
199
+ if (def?.type === "array" || Array.isArray(value)) {
200
+ if (!Array.isArray(value)) return null;
201
+ return /* @__PURE__ */ jsx(ArrayRenderer, {
202
+ name: fieldName,
203
+ label,
204
+ value
205
+ });
206
+ }
207
+ if (def?.type === "object" || typeof value === "object") return /* @__PURE__ */ jsx(ObjectRenderer, {
208
+ name: fieldName,
209
+ label,
210
+ value
211
+ });
212
+ const valueLinks = def && "valueLinks" in def ? def.valueLinks : void 0;
213
+ return /* @__PURE__ */ jsx(StringRenderer, {
214
+ name: fieldName,
215
+ label,
216
+ value: String(value),
217
+ valueLinks
218
+ });
219
+ };
220
+ }
221
+ //#endregion
222
+ //#region src/lib/asyncApi/customAttributes/autoDiscover.ts
223
+ var ASYNCAPI_ROOT_KEYS = /* @__PURE__ */ new Set([
224
+ "asyncapi",
225
+ "info",
226
+ "channels",
227
+ "operations",
228
+ "components",
229
+ "servers",
230
+ "tags",
231
+ "id",
232
+ "defaultContentType",
233
+ "externalDocs"
234
+ ]);
235
+ function discoverAsyncApiFieldNames(doc, prefix) {
236
+ const names = /* @__PURE__ */ new Set();
237
+ const addKeys = (obj) => {
238
+ if (!obj || typeof obj !== "object") return;
239
+ for (const key of Object.keys(obj)) if (key.startsWith(prefix)) names.add(key);
240
+ };
241
+ addKeys(doc);
242
+ addKeys(doc.info);
243
+ const channels = doc.channels;
244
+ if (channels) for (const channel of Object.values(channels)) {
245
+ if (!channel || typeof channel !== "object") continue;
246
+ const ch = channel;
247
+ addKeys(ch);
248
+ for (const op of [
249
+ "subscribe",
250
+ "publish",
251
+ "send",
252
+ "receive"
253
+ ]) {
254
+ const operation = ch[op];
255
+ if (!operation || typeof operation !== "object") continue;
256
+ addKeys(operation);
257
+ addKeys(operation.message);
258
+ }
259
+ const msgs = ch.messages;
260
+ if (msgs) for (const msg of Object.values(msgs)) addKeys(msg);
261
+ }
262
+ const operations = doc.operations;
263
+ if (operations) for (const op of Object.values(operations)) addKeys(op);
264
+ const components = doc.components;
265
+ if (components) {
266
+ for (const section of ["messages", "messageTraits"]) {
267
+ const msgs = components[section];
268
+ if (msgs) for (const msg of Object.values(msgs)) addKeys(msg);
269
+ }
270
+ const schemas = components.schemas;
271
+ if (schemas) for (const schema of Object.values(schemas)) addKeys(schema);
272
+ const compChannels = components.channels;
273
+ if (compChannels) for (const ch of Object.values(compChannels)) addKeys(ch);
274
+ const compOps = components.operations;
275
+ if (compOps) for (const op of Object.values(compOps)) addKeys(op);
276
+ }
277
+ return [...names];
278
+ }
279
+ function extractRootFields(doc, prefixes) {
280
+ const result = {};
281
+ for (const [key, value] of Object.entries(doc)) {
282
+ if (ASYNCAPI_ROOT_KEYS.has(key)) continue;
283
+ if (!key.startsWith("x-")) continue;
284
+ if (prefixes.some((p) => key.startsWith(p))) result[key] = value;
285
+ }
286
+ return result;
287
+ }
288
+ //#endregion
289
+ //#region src/lib/asyncApi/customAttributes/buildExtensionsConfig.ts
290
+ function buildAsyncApiExtensionsConfig(configs, doc, version) {
291
+ asyncApiContext.version = version;
292
+ asyncApiContext.configs = configs;
293
+ if (doc) {
294
+ const prefixes = configs.map((c) => c.prefixStartsWith).filter(Boolean);
295
+ asyncApiContext.rootFields = prefixes.length ? extractRootFields(doc, prefixes) : {};
296
+ } else asyncApiContext.rootFields = {};
297
+ const result = {};
298
+ for (const config of configs) {
299
+ for (const [key, def] of Object.entries(config.extensions ?? {})) result[key] = buildAsyncApiGenericRenderer(key, def, config);
300
+ if (config.prefixStartsWith && doc) {
301
+ for (const key of discoverAsyncApiFieldNames(doc, config.prefixStartsWith)) if (!result[key]) result[key] = buildAsyncApiGenericRenderer(key, void 0, config);
302
+ }
303
+ }
304
+ return result;
305
+ }
306
+ function buildRootExtensionsPlugin(configs) {
307
+ function rootExtensionsSlot(_props) {
308
+ const entries = Object.entries(asyncApiContext.rootFields);
309
+ if (!entries.length) return null;
310
+ const nodes = entries.flatMap(([key, value]) => {
311
+ const config = asyncApiContext.configs.find((c) => c.extensions?.[key]) ?? asyncApiContext.configs.find((c) => c.prefixStartsWith && key.startsWith(c.prefixStartsWith)) ?? configs[0];
312
+ if (!config) return [];
313
+ const def = config.extensions?.[key];
314
+ return [createElement(buildAsyncApiGenericRenderer(key, def, config), {
315
+ key,
316
+ propertyName: key,
317
+ propertyValue: value,
318
+ document: void 0,
319
+ parent: void 0
320
+ })];
321
+ });
322
+ return nodes.length ? createElement("div", null, ...nodes) : null;
323
+ }
324
+ return {
325
+ name: "sap-root-extensions",
326
+ version: "1.0.0",
327
+ install(api) {
328
+ api.registerComponent(PluginSlot.INFO, rootExtensionsSlot);
329
+ }
330
+ };
331
+ }
332
+ //#endregion
333
+ //#region src/lib/asyncApi/customAttributes/styles.ts
334
+ var styles_default = `
335
+ .asyncapi-attr-row {
336
+ display: flex;
337
+ border: 1px solid var(--ord-border, #e5e7eb);
338
+ border-radius: calc(var(--ord-radius, 4)*1px);
339
+ margin-top: 8px;
340
+ margin-bottom: 4px;
341
+ font-size: 0.875rem;
342
+ line-height: 1.5;
343
+ overflow: hidden;
344
+ }
345
+ .asyncapi-attr-label {
346
+ color: var(--ord-foreground, #111);
347
+ width: 20ch;
348
+ min-width: 20ch;
349
+ flex-shrink: 0;
350
+ background: var(--ord-muted, #f3f4f6);
351
+ padding: 8px 10px 8px 16px;
352
+ border-right: 1px solid var(--ord-border, #e5e7eb);
353
+ display: flex;
354
+ justify-content: space-between;
355
+ align-items: flex-start;
356
+ font-weight: 400;
357
+ }
358
+ .asyncapi-attr-value {
359
+ color: var(--ord-muted-foreground, #555);
360
+ padding: 8px;
361
+ }
362
+ .asyncapi-attr-list {
363
+ margin: 0 2ch;
364
+ list-style: disc;
365
+ }
366
+ .asyncapi-attr-link {
367
+ text-decoration: none;
368
+ color: var(--ord-primary, #0098ff);
369
+ transition: color 0.1s ease-in-out;
370
+ cursor: pointer;
371
+ }
372
+ .asyncapi-attr-placeholder {
373
+ color: #999;
374
+ }
375
+ .asyncapi-attr-obj {
376
+ margin: 0;
377
+ padding-left: 12px;
378
+ }
379
+ .asyncapi-attr-obj-row {
380
+ margin-bottom: 4px;
381
+ }
382
+ .asyncapi-attr-obj-key {
383
+ font-weight: 600;
384
+ display: inline;
385
+ }
386
+ .asyncapi-attr-obj-val {
387
+ display: inline;
388
+ margin: 0;
389
+ }
390
+
391
+ /* Width-adaptive rows: react to the renderer's own available width (container on the
392
+ wrapper above). Below the breakpoint, every row stacks label-above-value simultaneously,
393
+ and the label spans the full width. */
394
+ @container asyncapi-attrs (max-width: 520px) {
395
+ .asyncapi-attr-row {
396
+ flex-direction: column;
397
+ }
398
+ .asyncapi-attr-label {
399
+ width: 100%;
400
+ min-width: 0;
401
+ border-right: none;
402
+ border-bottom: 1px solid var(--ord-border, #e5e7eb);
403
+ }
404
+ .asyncapi-attr-value {
405
+ width: 100%;
406
+ }
407
+ }
408
+ `;
409
+ //#endregion
410
+ //#region src/lib/asyncApi/index.tsx
411
+ var DARK_DEFAULTS = {
412
+ "--ord-background": "#1e1e1e",
413
+ "--ord-foreground": "#d4d4d4",
414
+ "--ord-card": "#252526",
415
+ "--ord-primary": "#0098ff",
416
+ "--ord-primary-foreground": "#1e1e1e",
417
+ "--ord-muted": "#2d2d30",
418
+ "--ord-muted-foreground": "#969696",
419
+ "--ord-border": "#3e3e42"
420
+ };
421
+ function buildAsyncApiThemeStyle(id, theme) {
422
+ const t = theme;
423
+ const bg = t["--ord-background"];
424
+ const fg = t["--ord-foreground"];
425
+ const secondary = t["--ord-secondary"];
426
+ const secondaryFg = t["--ord-secondary-foreground"];
427
+ const muted = t["--ord-muted"];
428
+ const mutedFg = t["--ord-muted-foreground"];
429
+ const border = t["--ord-border"];
430
+ const primary = t["--ord-primary"];
431
+ const primaryFg = t["--ord-primary-foreground"];
432
+ const accent = t["--ord-accent"];
433
+ const accentFg = t["--ord-accent-foreground"];
434
+ const borderRadius = t["--ord-radius"];
435
+ const rules = [];
436
+ const scope = `[data-renderer-id="${id}"]`;
437
+ if (bg) rules.push(`${scope} .bg-white { background-color: ${bg} !important; }`);
438
+ if (fg) rules.push(`${scope} {color: ${fg}; }`);
439
+ if (accent && accentFg) rules.push(`${scope} .bg-blue-100 { color: ${accentFg}; background-color: ${accent}; }`);
440
+ if (secondary) rules.push(`${scope} .bg-gray-100 { background-color: ${secondary} !important; }`);
441
+ if (secondaryFg) rules.push(`${scope} .prose, ${scope} .text-gray-700 { color: ${secondaryFg}; }`);
442
+ if (muted) rules.push(`${scope} .bg-gray-200 { background-color: ${muted} !important; }`);
443
+ if (mutedFg) rules.push(`${scope} .text-gray-500, ${scope} .text-gray-600 { color: ${mutedFg} !important; }`);
444
+ if (primary) rules.push(`${scope} .bg-gray-800 { background-color: ${primary} !important; }`, `${scope} .bg-blue-100 .text-purple-700 { color: ${primary}; }`);
445
+ if (primaryFg) rules.push(`${scope} .text-white { color: ${primaryFg} !important; }`);
446
+ if (secondary) rules.push(`${scope} .bg-gray-400 { background-color: ${secondary} !important; }`);
447
+ if (accentFg) rules.push(`${scope} .text-gray-200, ${scope} .examples .text-gray-600 { color: ${accentFg} !important; } `);
448
+ if (fg) rules.push(`${scope} .text-gray-800, ${scope} .text-gray-900 { color: ${fg} !important; }`);
449
+ if (border) rules.push(`${scope} .border { border-color: ${border}; }`, `${scope} .border-b { border-bottom-color: ${border}; }`, `${scope} .border-gray-400 { border-color: ${border} !important; }`);
450
+ if (borderRadius) rules.push(`${scope} .rounded, ${scope} .prose pre, ${scope} .\\32 xl\\:rounded { border-radius: ${borderRadius}px; }`, `${scope} .rounded:not(.inline-block) { overflow: hidden; }`, `${scope} .rounded-tl-none { border-top-left-radius: 0px; }`, `${scope} .examples { border-radius: 0px !important; }`);
451
+ return rules.join("\n");
452
+ }
453
+ function AsyncApiRenderer({ content, config, customAttributes, className, theme }) {
454
+ const id = useId();
455
+ const isDark = className?.split(/\s+/).includes("dark") ?? false;
456
+ const effectiveTheme = theme ?? (isDark ? DARK_DEFAULTS : null);
457
+ const themeStyle = effectiveTheme ? buildAsyncApiThemeStyle(id, effectiveTheme) : null;
458
+ const activeConfigs = useMemo(() => customAttributes ?? [], [customAttributes]);
459
+ const isEnabled = customAttributes !== void 0;
460
+ const parsedDoc = useMemo(() => isEnabled ? loadObject(content) : null, [content, isEnabled]);
461
+ const version = useMemo(() => {
462
+ const doc = parsedDoc;
463
+ return typeof doc?.asyncapi === "string" ? doc.asyncapi : "";
464
+ }, [parsedDoc]);
465
+ const effectiveConfig = useMemo(() => {
466
+ if (!isEnabled) return config ?? {};
467
+ const extensions = buildAsyncApiExtensionsConfig(activeConfigs, parsedDoc, version);
468
+ return {
469
+ ...config,
470
+ extensions: {
471
+ ...extensions,
472
+ ...config?.extensions ?? {}
473
+ }
474
+ };
475
+ }, [
476
+ config,
477
+ isEnabled,
478
+ activeConfigs,
479
+ parsedDoc,
480
+ version
481
+ ]);
482
+ const rootPlugin = useMemo(() => isEnabled ? buildRootExtensionsPlugin(activeConfigs) : null, [isEnabled, activeConfigs]);
483
+ const scope = `[data-renderer-id="${id}"]`;
484
+ const layoutStyle = `${scope} { container: asyncapi-attrs / inline-size; height: 100%; overflow: auto; scrollbar-gutter: stable; }\n${scope} :where(h1,h2,h3,h4,p,span,strong,a,li,td,div):not(pre *) { overflow-wrap: anywhere; }`;
485
+ return /* @__PURE__ */ jsxs("div", {
486
+ "data-renderer-id": id,
487
+ className,
488
+ children: [
489
+ themeStyle && /* @__PURE__ */ jsx("style", { children: themeStyle }),
490
+ isEnabled && /* @__PURE__ */ jsx("style", { children: styles_default }),
491
+ /* @__PURE__ */ jsx("style", { children: layoutStyle }),
492
+ isEnabled && /* @__PURE__ */ jsx("style", { children: `[data-renderer-id="${id}"] #introduction .hidden { display: block !important; }` }),
493
+ /* @__PURE__ */ jsx(AsyncApiComponent, {
494
+ schema: content,
495
+ config: effectiveConfig,
496
+ plugins: rootPlugin ? [rootPlugin] : []
497
+ })
498
+ ]
499
+ });
500
+ }
501
+ //#endregion
502
+ export { AttributeLink as n, AsyncApiRenderer as t };