@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
package/dist/index.js ADDED
@@ -0,0 +1,783 @@
1
+ import { i as loadObject, n as detectMetaType, r as extractVersion } from "./chunks/utils-BC3WF3-9.js";
2
+ import { n as attributeLink, t as OpenApiRenderer } from "./chunks/openApi-BTb5yzun.js";
3
+ import { t as CsnRenderer } from "./chunks/csn-3ek2O4d6.js";
4
+ import { n as AttributeLink, t as AsyncApiRenderer } from "./chunks/asyncApi-DtAXW7IY.js";
5
+ import { t as A2ARenderer } from "./chunks/a2a-B5lkgqLU.js";
6
+ import { t as McpRenderer } from "./chunks/mcp-qA5sYRAN.js";
7
+ import { useMemo, useState } from "react";
8
+ import Markdown from "react-markdown";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ //#region src/lib/core/dispatch.ts
11
+ function buildRendererExtraProps(metaType, options) {
12
+ const extraProps = {};
13
+ const customAttributes = options?.customAttributes;
14
+ const ca = customAttributes !== false ? customAttributes : void 0;
15
+ if (metaType === "openapi") {
16
+ if (ca?.openapi) extraProps.customAttributes = ca.openapi;
17
+ }
18
+ if (metaType === "asyncapi") {
19
+ if (options?.asyncapi) Object.assign(extraProps, { config: options.asyncapi });
20
+ if (ca?.asyncapi) extraProps.customAttributes = ca.asyncapi;
21
+ }
22
+ if (metaType === "csn") {
23
+ if (options?.csn) Object.assign(extraProps, { config: options.csn });
24
+ if (ca?.csn) extraProps.customAttributes = ca.csn;
25
+ }
26
+ if (metaType === "a2a" && options?.a2a) Object.assign(extraProps, options.a2a);
27
+ if (metaType === "mcp" && options?.mcp) Object.assign(extraProps, options.mcp);
28
+ return extraProps;
29
+ }
30
+ //#endregion
31
+ //#region src/lib/core/index.tsx
32
+ var DEFAULT_RENDERERS = {
33
+ openapi: OpenApiRenderer,
34
+ csn: CsnRenderer,
35
+ asyncapi: AsyncApiRenderer,
36
+ a2a: A2ARenderer,
37
+ mcp: McpRenderer
38
+ };
39
+ var PROTOCOL_LABELS = {
40
+ openapi: "OpenAPI",
41
+ csn: "CSN",
42
+ asyncapi: "AsyncAPI",
43
+ a2a: "A2A",
44
+ mcp: "MCP"
45
+ };
46
+ function MetadataRenderer({ content, renderers, options, type, className, theme }) {
47
+ const activeRenderers = renderers ?? DEFAULT_RENDERERS;
48
+ const autoDetect = options?.autoDetect !== false;
49
+ const strictTypeCheck = options?.strictTypeCheck !== false;
50
+ const metaType = useMemo(() => {
51
+ if (type) return type;
52
+ if (!autoDetect) return "unknown";
53
+ return detectMetaType(content);
54
+ }, [
55
+ type,
56
+ autoDetect,
57
+ content
58
+ ]);
59
+ const detectedType = useMemo(() => {
60
+ if (!type || !content) return null;
61
+ return detectMetaType(content);
62
+ }, [type, content]);
63
+ const isMismatch = detectedType !== null && detectedType !== type && (detectedType !== "unknown" || strictTypeCheck);
64
+ const version = useMemo(() => extractVersion(metaType, content), [metaType, content]);
65
+ const label = PROTOCOL_LABELS[metaType];
66
+ const RendererComponent = activeRenderers[metaType];
67
+ let renderer;
68
+ if (isMismatch) {
69
+ const detectedLabel = detectedType === "unknown" ? "an unrecognised format" : `‘${PROTOCOL_LABELS[detectedType] ?? detectedType}’`;
70
+ renderer = /* @__PURE__ */ jsxs("div", {
71
+ style: {
72
+ padding: 16,
73
+ fontFamily: "system-ui, sans-serif"
74
+ },
75
+ children: [
76
+ /* @__PURE__ */ jsx("strong", { children: "Type mismatch:" }),
77
+ " content was detected as ",
78
+ detectedLabel,
79
+ " but ‘",
80
+ PROTOCOL_LABELS[type] ?? type,
81
+ "’ was specified."
82
+ ]
83
+ });
84
+ } else if (RendererComponent) renderer = /* @__PURE__ */ jsx(RendererComponent, {
85
+ content,
86
+ className,
87
+ theme,
88
+ ...buildRendererExtraProps(metaType, options)
89
+ });
90
+ else if (options?.fallback === "raw") renderer = /* @__PURE__ */ jsx("pre", {
91
+ style: {
92
+ margin: 0,
93
+ padding: 16,
94
+ overflow: "auto",
95
+ height: "100%"
96
+ },
97
+ children: content
98
+ });
99
+ else renderer = /* @__PURE__ */ jsxs("div", {
100
+ style: {
101
+ padding: 16,
102
+ fontFamily: "system-ui, sans-serif"
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ jsx("strong", { children: "Unsupported format:" }),
106
+ " No renderer registered for type ‘",
107
+ metaType,
108
+ "’."
109
+ ]
110
+ });
111
+ return /* @__PURE__ */ jsxs("div", {
112
+ style: {
113
+ position: "relative",
114
+ height: "100%",
115
+ ...theme
116
+ },
117
+ children: [label && /* @__PURE__ */ jsxs("div", {
118
+ style: {
119
+ position: "absolute",
120
+ top: 8,
121
+ right: 8,
122
+ zIndex: 10,
123
+ padding: "2px 8px",
124
+ borderRadius: 4,
125
+ fontSize: 11,
126
+ fontFamily: "system-ui, sans-serif",
127
+ lineHeight: "16px",
128
+ pointerEvents: "none",
129
+ background: "var(--ord-muted, #e5e7eb)",
130
+ color: "var(--ord-muted-foreground, #6b7280)"
131
+ },
132
+ children: [label, version ? ` · ${version}` : ""]
133
+ }), renderer]
134
+ });
135
+ }
136
+ //#endregion
137
+ //#region src/lib/theme-builder.ts
138
+ var TOKEN_MAP = {
139
+ background: "--ord-background",
140
+ foreground: "--ord-foreground",
141
+ primary: "--ord-primary",
142
+ primaryForeground: "--ord-primary-foreground",
143
+ secondary: "--ord-secondary",
144
+ secondaryForeground: "--ord-secondary-foreground",
145
+ muted: "--ord-muted",
146
+ mutedForeground: "--ord-muted-foreground",
147
+ accent: "--ord-accent",
148
+ accentForeground: "--ord-accent-foreground",
149
+ destructive: "--ord-destructive",
150
+ destructiveForeground: "--ord-destructive-foreground",
151
+ success: "--ord-success",
152
+ successForeground: "--ord-success-foreground",
153
+ warning: "--ord-warning",
154
+ warningForeground: "--ord-warning-foreground",
155
+ border: "--ord-border",
156
+ input: "--ord-input",
157
+ ring: "--ord-ring",
158
+ card: "--ord-card",
159
+ cardForeground: "--ord-card-foreground",
160
+ popover: "--ord-popover",
161
+ popoverForeground: "--ord-popover-foreground",
162
+ radius: "--ord-radius"
163
+ };
164
+ function createTheme(tokens) {
165
+ const result = {};
166
+ for (const [key, value] of Object.entries(tokens)) if (value !== void 0) result[TOKEN_MAP[key]] = value;
167
+ return result;
168
+ }
169
+ //#endregion
170
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.ts
171
+ function typeCheckExSapExtOverviewExSapExtOverview(obj) {
172
+ if (typeof obj !== "object" || obj === null) return false;
173
+ if (!("xSapExtOverview" in obj) || !Array.isArray(obj.xSapExtOverview)) return false;
174
+ return obj.xSapExtOverview.every((xSapExtOverview) => {
175
+ if (typeof xSapExtOverview !== "object" || xSapExtOverview === null) return false;
176
+ if (!("name" in xSapExtOverview) || !("values" in xSapExtOverview)) return false;
177
+ if (typeof xSapExtOverview.name !== "string") return false;
178
+ if (typeof xSapExtOverview.values === "string") return true;
179
+ if (!Array.isArray(xSapExtOverview.values)) return false;
180
+ if (xSapExtOverview.values.every((value) => typeof value === "string")) return true;
181
+ return xSapExtOverview.values.every((value) => {
182
+ if (typeof value !== "object" || value === null) return false;
183
+ if (!("text" in value) || typeof value.text !== "string") return false;
184
+ return "format" in value && (value.format === "plain" || value.format === "markdown");
185
+ });
186
+ });
187
+ }
188
+ //#endregion
189
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/extOverview.tsx
190
+ function extOverview(props) {
191
+ if (!typeCheckExSapExtOverviewExSapExtOverview(props)) return null;
192
+ const { xSapExtOverview } = props;
193
+ return /* @__PURE__ */ jsxs("div", {
194
+ className: "sap-api-container",
195
+ children: [/* @__PURE__ */ jsxs("div", {
196
+ className: "sap-api-label sap-api-label--root",
197
+ children: ["SAP Extensibility Overview ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ext-overview" })]
198
+ }), /* @__PURE__ */ jsx("div", {
199
+ className: "sap-api-value sap-api-value--root",
200
+ children: xSapExtOverview.map((extension) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: extension.name }), /* @__PURE__ */ jsx("ul", {
201
+ className: "sap-api-list",
202
+ children: typeof extension.values === "string" ? /* @__PURE__ */ jsx("li", { children: extension.values }) : extension.values.map((value) => typeof value === "string" ? /* @__PURE__ */ jsx("li", { children: value }, value) : /* @__PURE__ */ jsx("li", { children: value.format === "plain" ? value.text : /* @__PURE__ */ jsx(Markdown, { children: value.text }) }, value.text))
203
+ })] }, extension.name))
204
+ })]
205
+ });
206
+ }
207
+ //#endregion
208
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/stateInfo.tsx
209
+ var background$1 = {
210
+ ACTIVE: "color-mix(in srgb, var(--scalar-color-green) 15%, transparent)",
211
+ BETA: "color-mix(in srgb, var(--scalar-color-blue) 15%, transparent)",
212
+ DEPRECATED: "color-mix(in srgb, var(--scalar-color-orange) 15%, transparent)",
213
+ DECOMMISSIONED: "color-mix(in srgb, var(--scalar-color-red) 15%, transparent)"
214
+ };
215
+ var color$1 = {
216
+ ACTIVE: "var(--scalar-color-green)",
217
+ BETA: "var(--scalar-color-blue)",
218
+ DEPRECATED: "var(--scalar-color-orange)",
219
+ DECOMMISSIONED: "var(--scalar-color-red)"
220
+ };
221
+ function StateInfo({ xSapStateInfo }) {
222
+ if (!xSapStateInfo) return null;
223
+ const status = xSapStateInfo.state?.toUpperCase();
224
+ const badge = /* @__PURE__ */ jsx("span", {
225
+ style: {
226
+ display: "inline-block",
227
+ borderRadius: "10px",
228
+ padding: "0 6px",
229
+ background: background$1[status] || "",
230
+ color: color$1[status] || ""
231
+ },
232
+ children: status
233
+ });
234
+ const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
235
+ const formatDate = (d) => {
236
+ const parsed = new Date(d);
237
+ return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
238
+ };
239
+ return /* @__PURE__ */ jsxs("div", {
240
+ className: "sap-api-container",
241
+ children: [/* @__PURE__ */ jsxs("div", {
242
+ className: "sap-api-label",
243
+ children: ["API State ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-stateInfo" })]
244
+ }), /* @__PURE__ */ jsxs("div", {
245
+ className: "sap-api-value",
246
+ children: [
247
+ badge,
248
+ xSapStateInfo.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(xSapStateInfo.deprecationDate)] }),
249
+ xSapStateInfo.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(xSapStateInfo.decommissionedDate)] }),
250
+ xSapStateInfo.successorApi && /* @__PURE__ */ jsxs("div", { children: ["Successor API: ", /* @__PURE__ */ jsx("a", {
251
+ href: xSapStateInfo.successorApi,
252
+ target: "_blank",
253
+ rel: "noreferrer",
254
+ className: "sap-api-link",
255
+ children: xSapStateInfo.successorApi
256
+ })] })
257
+ ]
258
+ })]
259
+ });
260
+ }
261
+ //#endregion
262
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/ordId.tsx
263
+ function CopyIcon() {
264
+ return /* @__PURE__ */ jsxs("svg", {
265
+ viewBox: "0 0 24 24",
266
+ width: "1em",
267
+ height: "1em",
268
+ fill: "none",
269
+ stroke: "currentColor",
270
+ strokeWidth: "2",
271
+ "aria-hidden": "true",
272
+ children: [/* @__PURE__ */ jsx("rect", {
273
+ x: "9",
274
+ y: "9",
275
+ width: "13",
276
+ height: "13",
277
+ rx: "2"
278
+ }), /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })]
279
+ });
280
+ }
281
+ function CheckIcon() {
282
+ return /* @__PURE__ */ jsx("svg", {
283
+ viewBox: "0 0 24 24",
284
+ width: "1em",
285
+ height: "1em",
286
+ fill: "none",
287
+ stroke: "currentColor",
288
+ strokeWidth: "2",
289
+ "aria-hidden": "true",
290
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
291
+ });
292
+ }
293
+ function ordId({ xSapOrdId }) {
294
+ const [copied, setCopied] = useState(false);
295
+ if (!xSapOrdId) return null;
296
+ const copy = () => {
297
+ navigator.clipboard?.writeText(xSapOrdId).then(() => {
298
+ setCopied(true);
299
+ setTimeout(() => setCopied(false), 1500);
300
+ });
301
+ };
302
+ return /* @__PURE__ */ jsxs("div", {
303
+ className: "sap-api-container",
304
+ children: [/* @__PURE__ */ jsxs("div", {
305
+ className: "sap-api-label",
306
+ children: ["ORD ID ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ord-id" })]
307
+ }), /* @__PURE__ */ jsxs("div", {
308
+ className: "sap-api-value sap-api-ord-id",
309
+ children: [/* @__PURE__ */ jsx("span", {
310
+ className: "sap-api-ord-id-text",
311
+ children: xSapOrdId
312
+ }), /* @__PURE__ */ jsx("button", {
313
+ type: "button",
314
+ className: "sap-api-copy-btn",
315
+ onClick: copy,
316
+ "aria-label": "Copy ORD ID",
317
+ title: copied ? "Copied" : "Copy",
318
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
319
+ })]
320
+ })]
321
+ });
322
+ }
323
+ //#endregion
324
+ //#region src/lib/openApi/customAttributes/sapAttributes/operation/deprecatedOperation.tsx
325
+ function deprecatedOperation({ xSapDeprecatedOperation }) {
326
+ const deprecationDate = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" }).format(new Date(xSapDeprecatedOperation.deprecationDate));
327
+ return /* @__PURE__ */ jsxs("div", {
328
+ className: "sap-api-container",
329
+ children: [/* @__PURE__ */ jsxs("div", {
330
+ className: "sap-api-label",
331
+ children: ["SAP Deprecated Operation ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-deprecated-operation" })]
332
+ }), /* @__PURE__ */ jsxs("div", {
333
+ className: "sap-api-value",
334
+ children: [
335
+ "Deprecated on ",
336
+ deprecationDate,
337
+ " ",
338
+ /* @__PURE__ */ jsx("br", {}),
339
+ !xSapDeprecatedOperation.successorOperationRef && !xSapDeprecatedOperation.successorOperationId ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
340
+ " Successor ",
341
+ xSapDeprecatedOperation.successorOperationRef ? /* @__PURE__ */ jsx("a", {
342
+ href: xSapDeprecatedOperation.successorOperationRef,
343
+ rel: "noreferrer, noopener",
344
+ children: xSapDeprecatedOperation.successorOperationRef
345
+ }) : null,
346
+ xSapDeprecatedOperation.successorOperationId ? /* @__PURE__ */ jsx("span", { children: xSapDeprecatedOperation.successorOperationId }) : null
347
+ ] })
348
+ ]
349
+ })]
350
+ });
351
+ }
352
+ //#endregion
353
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmEntityName.tsx
354
+ function odmEntityName({ xSapOdmEntityName }) {
355
+ return /* @__PURE__ */ jsxs("div", {
356
+ className: "sap-api-container",
357
+ children: [/* @__PURE__ */ jsxs("div", {
358
+ className: "sap-api-label",
359
+ children: ["ODM entity name ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-entity-name" })]
360
+ }), /* @__PURE__ */ jsx("div", {
361
+ className: "sap-api-value",
362
+ children: xSapOdmEntityName
363
+ })]
364
+ });
365
+ }
366
+ //#endregion
367
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmSemanticKey.tsx
368
+ function odmSemanticKey({ xSapOdmSemanticKey }) {
369
+ return /* @__PURE__ */ jsxs("div", {
370
+ className: "sap-api-container",
371
+ children: [/* @__PURE__ */ jsxs("div", {
372
+ className: "sap-api-label",
373
+ children: ["ODM Semantic Key ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-semantic-key" })]
374
+ }), /* @__PURE__ */ jsx("div", {
375
+ className: "sap-api-value",
376
+ children: xSapOdmSemanticKey.map((entry) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: entry.name }), /* @__PURE__ */ jsx("ul", {
377
+ className: "sap-api-list",
378
+ children: entry.values.map((v) => /* @__PURE__ */ jsx("li", { children: v }, v))
379
+ })] }, entry.name))
380
+ })]
381
+ });
382
+ }
383
+ //#endregion
384
+ //#region src/lib/openApi/customAttributes/sapAttributes/sapPreset.ts
385
+ function component(fn) {
386
+ return { component: fn };
387
+ }
388
+ var sapOpenApiAttributesConfig = {
389
+ prefixStartsWith: "x-sap-",
390
+ documentationUrl: (name, { version }) => `https://github.com/SAP/openapi-specification/tree/main/sap-schemas/v${version}#${name}`,
391
+ extensions: {
392
+ "x-sap-compliance-level": {
393
+ type: "link",
394
+ label: "SAP Compliance Level",
395
+ callback: (v) => {
396
+ return {
397
+ "sap:base:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-base-v1.md",
398
+ "sap:core:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md",
399
+ "sap:core:v2": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md"
400
+ }[String(v)];
401
+ }
402
+ },
403
+ "x-sap-shortText": {
404
+ type: "string",
405
+ label: "SAP Short Text"
406
+ },
407
+ "x-sap-software-min-version": {
408
+ type: "string",
409
+ label: "SAP Software Version"
410
+ },
411
+ "x-sap-api-type": {
412
+ type: "string",
413
+ label: "SAP API Type"
414
+ },
415
+ "x-sap-direction": {
416
+ type: "string",
417
+ label: "SAP Direction"
418
+ },
419
+ "x-sap-ord-id": component(ordId),
420
+ "x-sap-operation-intent": {
421
+ type: "string",
422
+ label: "SAP Operation Intent"
423
+ },
424
+ "x-sap-odm-oid": {
425
+ type: "string",
426
+ label: "ODM OID"
427
+ },
428
+ "x-sap-odm-oid-reference-entity-name": {
429
+ type: "string",
430
+ label: "ODM OID Reference Entity Name"
431
+ },
432
+ "x-sap-precision": {
433
+ type: "number",
434
+ label: "SAP Precision"
435
+ },
436
+ "x-sap-scale": {
437
+ type: "number",
438
+ label: "SAP Scale"
439
+ },
440
+ "x-sap-root-entity": {
441
+ type: "boolean",
442
+ label: "SAP Root Entity"
443
+ },
444
+ "x-sap-dpp-entity-semantics": {
445
+ type: "string",
446
+ label: "SAP DPP: Entity Semantics"
447
+ },
448
+ "x-sap-dpp-data-subject-role": {
449
+ type: "string",
450
+ label: "SAP DPP: Data Subject Role"
451
+ },
452
+ "x-sap-dpp-data-subject-role-description": {
453
+ type: "string",
454
+ label: "SAP DPP: Data Subject Role Description"
455
+ },
456
+ "x-sap-dpp-field-semantics": {
457
+ type: "string",
458
+ label: "SAP DPP: Field Semantics"
459
+ },
460
+ "x-sap-dpp-is-potentially-personal": {
461
+ type: "boolean",
462
+ label: "SAP DPP: Potentially Personal"
463
+ },
464
+ "x-sap-dpp-is-potentially-sensitive": {
465
+ type: "boolean",
466
+ label: "SAP DPP: Potentially Sensitive"
467
+ },
468
+ "x-sap-ext-overview": component(extOverview),
469
+ "x-sap-stateInfo": component(StateInfo),
470
+ "x-sap-extensible": {
471
+ type: "object",
472
+ label: "SAP Extensible"
473
+ },
474
+ "x-sap-deprecated-operation": component(deprecatedOperation),
475
+ "x-sap-odm-entity-name": component(odmEntityName),
476
+ "x-sap-odm-semantic-key": component(odmSemanticKey)
477
+ }
478
+ };
479
+ //#endregion
480
+ //#region src/lib/asyncApi/customAttributes/stateInfo.tsx
481
+ var background = {
482
+ ACTIVE: "color-mix(in srgb, #22c55e 15%, transparent)",
483
+ BETA: "color-mix(in srgb, #3b82f6 15%, transparent)",
484
+ DEPRECATED: "color-mix(in srgb, #f97316 15%, transparent)",
485
+ DECOMMISSIONED: "color-mix(in srgb, #ef4444 15%, transparent)"
486
+ };
487
+ var color = {
488
+ ACTIVE: "#16a34a",
489
+ BETA: "#2563eb",
490
+ DEPRECATED: "#ea580c",
491
+ DECOMMISSIONED: "#dc2626"
492
+ };
493
+ function AsyncApiStateInfo({ propertyName, propertyValue }) {
494
+ if (!propertyValue || typeof propertyValue !== "object") return null;
495
+ const info = propertyValue;
496
+ const status = info.state?.toUpperCase();
497
+ const badge = /* @__PURE__ */ jsx("span", {
498
+ style: {
499
+ display: "inline-block",
500
+ borderRadius: "10px",
501
+ padding: "0 6px",
502
+ background: background[status] || "",
503
+ color: color[status] || ""
504
+ },
505
+ children: status
506
+ });
507
+ const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
508
+ const formatDate = (d) => {
509
+ const parsed = new Date(d);
510
+ return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
511
+ };
512
+ return /* @__PURE__ */ jsxs("div", {
513
+ className: "asyncapi-attr-row",
514
+ children: [/* @__PURE__ */ jsxs("div", {
515
+ className: "asyncapi-attr-label",
516
+ children: ["API State ", /* @__PURE__ */ jsx(AttributeLink, { attributeName: propertyName })]
517
+ }), /* @__PURE__ */ jsxs("div", {
518
+ className: "asyncapi-attr-value",
519
+ children: [
520
+ badge,
521
+ info.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(info.deprecationDate)] }),
522
+ info.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(info.decommissionedDate)] }),
523
+ info.link && /* @__PURE__ */ jsxs("div", { children: ["More info: ", /* @__PURE__ */ jsx("a", {
524
+ href: info.link,
525
+ target: "_blank",
526
+ rel: "noreferrer",
527
+ className: "asyncapi-attr-link",
528
+ children: info.link
529
+ })] })
530
+ ]
531
+ })]
532
+ });
533
+ }
534
+ //#endregion
535
+ //#region src/lib/asyncApi/customAttributes/sapPreset.ts
536
+ var sapAsyncApiAttributesConfig = {
537
+ prefixStartsWith: "x-sap-",
538
+ documentationUrl: (name) => `https://github.com/SAP/asyncapi-specification#${name}`,
539
+ extensions: {
540
+ "x-sap-catalog-spec-version": {
541
+ type: "string",
542
+ label: "SAP Catalog Spec Version"
543
+ },
544
+ "x-sap-application-namespace": {
545
+ type: "string",
546
+ label: "SAP Application Namespace"
547
+ },
548
+ "x-sap-ord-id": {
549
+ type: "string",
550
+ label: "ORD ID"
551
+ },
552
+ "x-sap-shortText": {
553
+ type: "string",
554
+ label: "SAP Short Text"
555
+ },
556
+ "x-sap-software-min-version": {
557
+ type: "string",
558
+ label: "SAP Software Version"
559
+ },
560
+ "x-sap-stateInfo": { component: AsyncApiStateInfo },
561
+ "x-sap-event-spec-version": {
562
+ type: "string",
563
+ label: "SAP Event Spec Version"
564
+ },
565
+ "x-sap-event-source": {
566
+ type: "string",
567
+ label: "SAP Event Source"
568
+ },
569
+ "x-sap-event-source-parameters": {
570
+ type: "object",
571
+ label: "SAP Event Source Parameters"
572
+ },
573
+ "x-sap-event-version": {
574
+ type: "string",
575
+ label: "SAP Event Version"
576
+ },
577
+ "x-sap-event-characteristics": {
578
+ type: "object",
579
+ label: "SAP Event Characteristics"
580
+ },
581
+ "x-sap-object-type": {
582
+ type: "string",
583
+ label: "SAP Object Type"
584
+ },
585
+ "x-sap-odm-version": {
586
+ type: "string",
587
+ label: "SAP ODM Version"
588
+ },
589
+ "x-sap-logical-odm-event-version": {
590
+ type: "string",
591
+ label: "SAP Logical ODM Event Version"
592
+ },
593
+ "x-sap-dpp-entity-semantics": {
594
+ type: "string",
595
+ label: "SAP DPP: Entity Semantics"
596
+ },
597
+ "x-sap-dpp-data-subject-role": {
598
+ type: "string",
599
+ label: "SAP DPP: Data Subject Role"
600
+ },
601
+ "x-sap-dpp-data-subject-role-description": {
602
+ type: "string",
603
+ label: "SAP DPP: Data Subject Role Description"
604
+ },
605
+ "x-sap-dpp-field-semantics": {
606
+ type: "string",
607
+ label: "SAP DPP: Field Semantics"
608
+ },
609
+ "x-sap-dpp-is-potentially-personal": {
610
+ type: "boolean",
611
+ label: "SAP DPP: Potentially Personal"
612
+ },
613
+ "x-sap-dpp-is-potentially-sensitive": {
614
+ type: "boolean",
615
+ label: "SAP DPP: Potentially Sensitive"
616
+ }
617
+ }
618
+ };
619
+ //#endregion
620
+ //#region src/lib/csn/customAttributes/sapPreset.ts
621
+ var sapCsnAttributesConfig = {
622
+ prefixStartsWith: "@",
623
+ annotations: {
624
+ "@EndUserText.label": {
625
+ type: "string",
626
+ label: "End User Text · Label"
627
+ },
628
+ "@EndUserText.heading": {
629
+ type: "string",
630
+ label: "End User Text · Heading"
631
+ },
632
+ "@EndUserText.quickInfo": {
633
+ type: "string",
634
+ label: "End User Text · Quick Info"
635
+ },
636
+ "@ObjectModel.modelingPattern": {
637
+ type: "object",
638
+ label: "Modeling Pattern"
639
+ },
640
+ "@ObjectModel.text.element": {
641
+ type: "array",
642
+ label: "Text Element"
643
+ },
644
+ "@ObjectModel.text.association": {
645
+ type: "object",
646
+ label: "Text Association"
647
+ },
648
+ "@ObjectModel.semanticKey": {
649
+ type: "array",
650
+ label: "Semantic Key"
651
+ },
652
+ "@ObjectModel.representativeKey": {
653
+ type: "object",
654
+ label: "Representative Key"
655
+ },
656
+ "@ObjectModel.compositionRoot": {
657
+ type: "boolean",
658
+ label: "Composition Root"
659
+ },
660
+ "@ObjectModel.supportedCapabilities": {
661
+ type: "array",
662
+ label: "Supported Capabilities"
663
+ },
664
+ "@ObjectModel.usageType.sizeCategory": {
665
+ type: "string",
666
+ label: "Usage Type · Size Category"
667
+ },
668
+ "@ObjectModel.foreignKey.association": {
669
+ type: "object",
670
+ label: "Foreign Key Association"
671
+ },
672
+ "@Consumption.valueHelpDefinition": {
673
+ type: "array",
674
+ label: "Value Help"
675
+ },
676
+ "@Consumption.hidden": {
677
+ type: "boolean",
678
+ label: "Hidden"
679
+ },
680
+ "@PersonalData.entitySemantics": {
681
+ type: "string",
682
+ label: "DPP · Entity Semantics"
683
+ },
684
+ "@PersonalData.dataSubjectRole": {
685
+ type: "string",
686
+ label: "DPP · Data Subject Role"
687
+ },
688
+ "@PersonalData.dataSubjectRoleDescription": {
689
+ type: "string",
690
+ label: "DPP · Data Subject Role Description"
691
+ },
692
+ "@PersonalData.fieldSemantics": {
693
+ type: "string",
694
+ label: "DPP · Field Semantics"
695
+ },
696
+ "@PersonalData.isPotentiallyPersonal": {
697
+ type: "boolean",
698
+ label: "DPP · Potentially Personal"
699
+ },
700
+ "@PersonalData.isPotentiallySensitive": {
701
+ type: "boolean",
702
+ label: "DPP · Potentially Sensitive"
703
+ },
704
+ "@Semantics.currencyCode": {
705
+ type: "boolean",
706
+ label: "Semantics · Currency Code"
707
+ },
708
+ "@Semantics.amount.currencyCode": {
709
+ type: "object",
710
+ label: "Semantics · Amount Currency"
711
+ },
712
+ "@Semantics.unitOfMeasure": {
713
+ type: "boolean",
714
+ label: "Semantics · Unit of Measure"
715
+ },
716
+ "@Semantics.quantity.unitOfMeasure": {
717
+ type: "object",
718
+ label: "Semantics · Quantity Unit"
719
+ },
720
+ "@Semantics.text": {
721
+ type: "boolean",
722
+ label: "Semantics · Text"
723
+ },
724
+ "@Semantics.uuid": {
725
+ type: "boolean",
726
+ label: "Semantics · UUID"
727
+ },
728
+ "@Semantics.language": {
729
+ type: "boolean",
730
+ label: "Semantics · Language"
731
+ },
732
+ "@API.element.releaseState": {
733
+ type: "string",
734
+ label: "API · Element Release State"
735
+ },
736
+ "@API.entity.releaseState": {
737
+ type: "string",
738
+ label: "API · Entity Release State"
739
+ },
740
+ "@ODM.entityName": {
741
+ type: "string",
742
+ label: "ODM · Entity Name"
743
+ },
744
+ "@ODM.oid": {
745
+ type: "string",
746
+ label: "ODM · OID"
747
+ },
748
+ "@ODM.oidReference.entityName": {
749
+ type: "string",
750
+ label: "ODM · OID Reference Entity"
751
+ },
752
+ "@Aggregation.default": {
753
+ type: "object",
754
+ label: "Default Aggregation"
755
+ },
756
+ "@EntityRelationship.entityType": {
757
+ type: "string",
758
+ label: "Entity Relationship · Type"
759
+ },
760
+ "@EntityRelationship.entityIds": {
761
+ type: "array",
762
+ label: "Entity Relationship · IDs"
763
+ },
764
+ "@EntityRelationship.propertyType": {
765
+ type: "string",
766
+ label: "Entity Relationship · Property Type"
767
+ },
768
+ "@EntityRelationship.compositeReferences": {
769
+ type: "array",
770
+ label: "Entity Relationship · Composite References"
771
+ },
772
+ "@EntityRelationship.reference": {
773
+ type: "array",
774
+ label: "Entity Relationship · Reference"
775
+ },
776
+ "@DataIntegration.dataUnavailable": {
777
+ type: "boolean",
778
+ label: "Data Integration · Unavailable"
779
+ }
780
+ }
781
+ };
782
+ //#endregion
783
+ export { A2ARenderer, AsyncApiRenderer, CsnRenderer, McpRenderer, MetadataRenderer, OpenApiRenderer, createTheme, detectMetaType, extractVersion, loadObject, sapAsyncApiAttributesConfig, sapCsnAttributesConfig, sapOpenApiAttributesConfig };