@open-resource-discovery/metadata-renderer 1.0.0 → 1.1.0

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 (39) hide show
  1. package/README.md +1 -0
  2. package/dist/a2a/index.d.ts +1 -1
  3. package/dist/a2a.js +1 -1
  4. package/dist/asyncApi/asyncapi-browser.d.ts +10 -0
  5. package/dist/asyncApi/customAttributes/attributeLink.d.ts +1 -1
  6. package/dist/asyncApi/index.d.ts +2 -2
  7. package/dist/asyncapi.js +1 -1
  8. package/dist/chunks/{a2a-B5lkgqLU.js → a2a-BfdUdobQ.js} +1 -1
  9. package/dist/chunks/{asyncApi-K0uQpQwz.js → asyncApi-B7WZqXRI.js} +16 -153
  10. package/dist/chunks/{csn-D4GBs8tC.js → csn-CIBA2ds5.js} +58 -189
  11. package/dist/chunks/{mcp-qA5sYRAN.js → mcp-Yb3SHisP.js} +1 -1
  12. package/dist/chunks/{openApi-Ccp9Pa_k.js → openApi-sDysRKUP.js} +15 -323
  13. package/dist/chunks/overlay-CO0o6FYy.js +41 -0
  14. package/dist/chunks/{utils-BC3WF3-9.js → utils-BLQCpHkJ.js} +2 -0
  15. package/dist/core/ShadowRoot.d.ts +1 -1
  16. package/dist/core/dispatch.d.ts +3 -0
  17. package/dist/core/dispatch.test.d.ts +1 -0
  18. package/dist/core/index.d.ts +1 -1
  19. package/dist/core/utils.d.ts +1 -1
  20. package/dist/csn/customAttributes/postProcess.d.ts +1 -0
  21. package/dist/csn/customAttributes/postProcess.test.d.ts +1 -0
  22. package/dist/csn/index.d.ts +1 -2
  23. package/dist/csn.js +1 -1
  24. package/dist/entries/overlay.d.ts +2 -0
  25. package/dist/index.css +6815 -2141
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +650 -28
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp.js +1 -1
  30. package/dist/openApi/customAttributes/attributeLink.d.ts +1 -1
  31. package/dist/openApi/index.d.ts +1 -2
  32. package/dist/openapi.js +1 -1
  33. package/dist/overlay/index.d.ts +7 -0
  34. package/dist/overlay.js +2 -0
  35. package/dist/styles.d.ts +1 -0
  36. package/dist/styles.js +1 -0
  37. package/dist/types.d.ts +1 -3
  38. package/dist/vendor.d.ts +1 -0
  39. package/package.json +30 -20
package/README.md CHANGED
@@ -17,6 +17,7 @@ React components that render metadata documents of various types consistently.
17
17
  - [AsyncAPI](https://asyncapi.com/) 2.x / 3.x (JSON or YAML) — via [@asyncapi/react-component](https://github.com/asyncapi/asyncapi-react)
18
18
  - [A2A Agent Cards](https://a2a-protocol.org/latest/specification/) — via [@open-resource-discovery/a2a-editor](https://www.npmjs.com/package/@open-resource-discovery/a2a-editor)
19
19
  - [MCP Server Cards](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2127) — via [@open-resource-discovery/mcp-server-card-ui](https://www.npmjs.com/package/@open-resource-discovery/mcp-server-card-ui)
20
+ - [ORD Overlay](https://open-resource-discovery.org/) — via [@open-resource-discovery/overlay-editor](https://www.npmjs.com/package/@open-resource-discovery/overlay-editor)
20
21
 
21
22
  More formats will be added over time. See the [Support](https://open-resource-discovery.github.io/metadata-renderer/docs/Supported) page for the current list.
22
23
 
@@ -6,4 +6,4 @@ export type A2ARendererProps = {
6
6
  className?: string;
7
7
  theme?: RendererTheme;
8
8
  };
9
- export declare function A2ARenderer({ content, showValidation, showConnection, className, theme, }: A2ARendererProps): import("react").JSX.Element;
9
+ export declare function A2ARenderer({ content, showValidation, showConnection, className, theme, }: A2ARendererProps): import('react').JSX.Element;
package/dist/a2a.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as A2ARenderer } from "./chunks/a2a-B5lkgqLU.js";
1
+ import { t as A2ARenderer } from "./chunks/a2a-BfdUdobQ.js";
2
2
  export { A2ARenderer };
@@ -1,3 +1,13 @@
1
1
  declare module '@asyncapi/react-component/browser/index.js' {
2
2
  export { default } from '@asyncapi/react-component';
3
3
  }
4
+
5
+ // The `PluginSlot` enum is defined in this dependency-free leaf module. We import
6
+ // the runtime value from here (not from the package root) because the root entry
7
+ // pulls in @asyncapi/parser -> @asyncapi/avro-schema-parser -> avsc, which needs
8
+ // Node builtins and breaks browser consumers. The browser component's plugin
9
+ // system keys on the same string values (INFO = "info"). Types are re-exported
10
+ // from the package root and are erased at build time.
11
+ declare module '@asyncapi/react-component/lib/esm/types.js' {
12
+ export { PluginSlot } from '@asyncapi/react-component';
13
+ }
@@ -1,3 +1,3 @@
1
1
  export default function AttributeLink({ attributeName }: {
2
2
  attributeName: string;
3
- }): import("react").JSX.Element | null;
3
+ }): import('react').JSX.Element | null;
@@ -4,9 +4,9 @@ import { AsyncApiCustomAttributesConfig } from './customAttributes/types';
4
4
  export type AsyncApiRendererProps = {
5
5
  content: string;
6
6
  config?: Partial<ConfigInterface>;
7
- showCustomAttributes?: boolean;
8
7
  customAttributes?: AsyncApiCustomAttributesConfig[];
9
8
  className?: string;
10
9
  theme?: RendererTheme;
11
10
  };
12
- export declare function AsyncApiRenderer({ content, config, showCustomAttributes, customAttributes, className, theme, }: AsyncApiRendererProps): import("react").JSX.Element;
11
+ export declare function buildAsyncApiThemeStyle(id: string, theme: RendererTheme): string;
12
+ export declare function AsyncApiRenderer({ content, config, customAttributes, className, theme }: AsyncApiRendererProps): import('react').JSX.Element;
package/dist/asyncapi.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as AsyncApiRenderer } from "./chunks/asyncApi-K0uQpQwz.js";
1
+ import { t as AsyncApiRenderer } from "./chunks/asyncApi-B7WZqXRI.js";
2
2
  export { AsyncApiRenderer };
@@ -1,4 +1,4 @@
1
- import { t as buildShadcnThemeStyle } from "./utils-BC3WF3-9.js";
1
+ import { t as buildShadcnThemeStyle } from "./utils-BLQCpHkJ.js";
2
2
  /* empty css */
3
3
  import { useEffect, useId } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,10 +1,10 @@
1
- import { i as loadObject } from "./utils-BC3WF3-9.js";
1
+ import { i as loadObject } from "./utils-BLQCpHkJ.js";
2
2
  /* empty css */
3
3
  import { createElement, useId, useMemo } from "react";
4
4
  import Markdown from "react-markdown";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import AsyncApiComponent from "@asyncapi/react-component/browser/index.js";
7
- import { PluginSlot } from "@asyncapi/react-component";
7
+ import { PluginSlot } from "@asyncapi/react-component/lib/esm/types.js";
8
8
  //#region src/lib/asyncApi/customAttributes/context.ts
9
9
  var asyncApiContext = {
10
10
  version: "",
@@ -311,7 +311,8 @@ function buildRootExtensionsPlugin(configs) {
311
311
  const config = asyncApiContext.configs.find((c) => c.extensions?.[key]) ?? asyncApiContext.configs.find((c) => c.prefixStartsWith && key.startsWith(c.prefixStartsWith)) ?? configs[0];
312
312
  if (!config) return [];
313
313
  const def = config.extensions?.[key];
314
- return [createElement(buildAsyncApiGenericRenderer(key, def, config), {
314
+ const fieldComponent = buildAsyncApiGenericRenderer(key, def, config);
315
+ return [createElement(fieldComponent, {
315
316
  key,
316
317
  propertyName: key,
317
318
  propertyValue: value,
@@ -330,146 +331,6 @@ function buildRootExtensionsPlugin(configs) {
330
331
  };
331
332
  }
332
333
  //#endregion
333
- //#region src/lib/asyncApi/customAttributes/stateInfo.tsx
334
- var background = {
335
- ACTIVE: "color-mix(in srgb, #22c55e 15%, transparent)",
336
- BETA: "color-mix(in srgb, #3b82f6 15%, transparent)",
337
- DEPRECATED: "color-mix(in srgb, #f97316 15%, transparent)",
338
- DECOMMISSIONED: "color-mix(in srgb, #ef4444 15%, transparent)"
339
- };
340
- var color = {
341
- ACTIVE: "#16a34a",
342
- BETA: "#2563eb",
343
- DEPRECATED: "#ea580c",
344
- DECOMMISSIONED: "#dc2626"
345
- };
346
- function AsyncApiStateInfo({ propertyName, propertyValue }) {
347
- if (!propertyValue || typeof propertyValue !== "object") return null;
348
- const info = propertyValue;
349
- const status = info.state?.toUpperCase();
350
- const badge = /* @__PURE__ */ jsx("span", {
351
- style: {
352
- display: "inline-block",
353
- borderRadius: "10px",
354
- padding: "0 6px",
355
- background: background[status] || "",
356
- color: color[status] || ""
357
- },
358
- children: status
359
- });
360
- const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
361
- const formatDate = (d) => {
362
- const parsed = new Date(d);
363
- return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
364
- };
365
- return /* @__PURE__ */ jsxs("div", {
366
- className: "asyncapi-attr-row",
367
- children: [/* @__PURE__ */ jsxs("div", {
368
- className: "asyncapi-attr-label",
369
- children: ["API State ", /* @__PURE__ */ jsx(AttributeLink, { attributeName: propertyName })]
370
- }), /* @__PURE__ */ jsxs("div", {
371
- className: "asyncapi-attr-value",
372
- children: [
373
- badge,
374
- info.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(info.deprecationDate)] }),
375
- info.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(info.decommissionedDate)] }),
376
- info.link && /* @__PURE__ */ jsxs("div", { children: ["More info: ", /* @__PURE__ */ jsx("a", {
377
- href: info.link,
378
- target: "_blank",
379
- rel: "noreferrer",
380
- className: "asyncapi-attr-link",
381
- children: info.link
382
- })] })
383
- ]
384
- })]
385
- });
386
- }
387
- //#endregion
388
- //#region src/lib/asyncApi/customAttributes/sapPreset.ts
389
- var sapAsyncApiAttributesConfig = {
390
- prefixStartsWith: "x-sap-",
391
- documentationUrl: (name) => `https://github.com/SAP/asyncapi-specification#${name}`,
392
- extensions: {
393
- "x-sap-catalog-spec-version": {
394
- type: "string",
395
- label: "SAP Catalog Spec Version"
396
- },
397
- "x-sap-application-namespace": {
398
- type: "string",
399
- label: "SAP Application Namespace"
400
- },
401
- "x-sap-ord-id": {
402
- type: "string",
403
- label: "ORD ID"
404
- },
405
- "x-sap-shortText": {
406
- type: "string",
407
- label: "SAP Short Text"
408
- },
409
- "x-sap-software-min-version": {
410
- type: "string",
411
- label: "SAP Software Version"
412
- },
413
- "x-sap-stateInfo": { component: AsyncApiStateInfo },
414
- "x-sap-event-spec-version": {
415
- type: "string",
416
- label: "SAP Event Spec Version"
417
- },
418
- "x-sap-event-source": {
419
- type: "string",
420
- label: "SAP Event Source"
421
- },
422
- "x-sap-event-source-parameters": {
423
- type: "object",
424
- label: "SAP Event Source Parameters"
425
- },
426
- "x-sap-event-version": {
427
- type: "string",
428
- label: "SAP Event Version"
429
- },
430
- "x-sap-event-characteristics": {
431
- type: "object",
432
- label: "SAP Event Characteristics"
433
- },
434
- "x-sap-object-type": {
435
- type: "string",
436
- label: "SAP Object Type"
437
- },
438
- "x-sap-odm-version": {
439
- type: "string",
440
- label: "SAP ODM Version"
441
- },
442
- "x-sap-logical-odm-event-version": {
443
- type: "string",
444
- label: "SAP Logical ODM Event Version"
445
- },
446
- "x-sap-dpp-entity-semantics": {
447
- type: "string",
448
- label: "SAP DPP: Entity Semantics"
449
- },
450
- "x-sap-dpp-data-subject-role": {
451
- type: "string",
452
- label: "SAP DPP: Data Subject Role"
453
- },
454
- "x-sap-dpp-data-subject-role-description": {
455
- type: "string",
456
- label: "SAP DPP: Data Subject Role Description"
457
- },
458
- "x-sap-dpp-field-semantics": {
459
- type: "string",
460
- label: "SAP DPP: Field Semantics"
461
- },
462
- "x-sap-dpp-is-potentially-personal": {
463
- type: "boolean",
464
- label: "SAP DPP: Potentially Personal"
465
- },
466
- "x-sap-dpp-is-potentially-sensitive": {
467
- type: "boolean",
468
- label: "SAP DPP: Potentially Sensitive"
469
- }
470
- }
471
- };
472
- //#endregion
473
334
  //#region src/lib/asyncApi/customAttributes/styles.ts
474
335
  var styles_default = `
475
336
  .asyncapi-attr-row {
@@ -587,22 +448,23 @@ function buildAsyncApiThemeStyle(id, theme) {
587
448
  if (accentFg) rules.push(`${scope} .text-gray-200, ${scope} .examples .text-gray-600 { color: ${accentFg} !important; } `);
588
449
  if (fg) rules.push(`${scope} .text-gray-800, ${scope} .text-gray-900 { color: ${fg} !important; }`);
589
450
  if (border) rules.push(`${scope} .border { border-color: ${border}; }`, `${scope} .border-b { border-bottom-color: ${border}; }`, `${scope} .border-gray-400 { border-color: ${border} !important; }`);
590
- 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
+ if (borderRadius) rules.push(`${scope} .rounded, ${scope} .prose pre { border-radius: ${borderRadius}px; }`, `@media (min-width: 1536px) {\n${scope} .\\32 xl\\:rounded { border-radius: ${borderRadius}px; }\n}`, `${scope} .rounded:not(.inline-block) { overflow: hidden; }`, `${scope} .rounded-tl-none { border-top-left-radius: 0px; }`);
591
452
  return rules.join("\n");
592
453
  }
593
- function AsyncApiRenderer({ content, config, showCustomAttributes = true, customAttributes, className, theme }) {
454
+ function AsyncApiRenderer({ content, config, customAttributes, className, theme }) {
594
455
  const id = useId();
595
456
  const isDark = className?.split(/\s+/).includes("dark") ?? false;
596
457
  const effectiveTheme = theme ?? (isDark ? DARK_DEFAULTS : null);
597
458
  const themeStyle = effectiveTheme ? buildAsyncApiThemeStyle(id, effectiveTheme) : null;
598
- const activeConfigs = customAttributes ?? [sapAsyncApiAttributesConfig];
599
- const parsedDoc = useMemo(() => showCustomAttributes ? loadObject(content) : null, [content, showCustomAttributes]);
459
+ const activeConfigs = useMemo(() => customAttributes ?? [], [customAttributes]);
460
+ const isEnabled = customAttributes !== void 0;
461
+ const parsedDoc = useMemo(() => isEnabled ? loadObject(content) : null, [content, isEnabled]);
600
462
  const version = useMemo(() => {
601
463
  const doc = parsedDoc;
602
464
  return typeof doc?.asyncapi === "string" ? doc.asyncapi : "";
603
465
  }, [parsedDoc]);
604
466
  const effectiveConfig = useMemo(() => {
605
- if (!showCustomAttributes) return config ?? {};
467
+ if (!isEnabled) return config ?? {};
606
468
  const extensions = buildAsyncApiExtensionsConfig(activeConfigs, parsedDoc, version);
607
469
  return {
608
470
  ...config,
@@ -613,12 +475,12 @@ function AsyncApiRenderer({ content, config, showCustomAttributes = true, custom
613
475
  };
614
476
  }, [
615
477
  config,
616
- showCustomAttributes,
478
+ isEnabled,
617
479
  activeConfigs,
618
480
  parsedDoc,
619
481
  version
620
482
  ]);
621
- const rootPlugin = useMemo(() => showCustomAttributes ? buildRootExtensionsPlugin(activeConfigs) : null, [showCustomAttributes, activeConfigs]);
483
+ const rootPlugin = useMemo(() => isEnabled ? buildRootExtensionsPlugin(activeConfigs) : null, [isEnabled, activeConfigs]);
622
484
  const scope = `[data-renderer-id="${id}"]`;
623
485
  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; }`;
624
486
  return /* @__PURE__ */ jsxs("div", {
@@ -626,9 +488,10 @@ function AsyncApiRenderer({ content, config, showCustomAttributes = true, custom
626
488
  className,
627
489
  children: [
628
490
  themeStyle && /* @__PURE__ */ jsx("style", { children: themeStyle }),
629
- showCustomAttributes && /* @__PURE__ */ jsx("style", { children: styles_default }),
491
+ isEnabled && /* @__PURE__ */ jsx("style", { children: styles_default }),
630
492
  /* @__PURE__ */ jsx("style", { children: layoutStyle }),
631
- showCustomAttributes && /* @__PURE__ */ jsx("style", { children: `[data-renderer-id="${id}"] #introduction .hidden { display: block !important; }` }),
493
+ isEnabled && /* @__PURE__ */ jsx("style", { children: `[data-renderer-id="${id}"] #introduction .hidden { display: block !important; }` }),
494
+ !isEnabled && /* @__PURE__ */ jsx("style", { children: `[data-renderer-id="${id}"] :is(#operations, #messages) div:has(> .flex.py-2 span.Extensions) { display: none; }` }),
632
495
  /* @__PURE__ */ jsx(AsyncApiComponent, {
633
496
  schema: content,
634
497
  config: effectiveConfig,
@@ -638,4 +501,4 @@ function AsyncApiRenderer({ content, config, showCustomAttributes = true, custom
638
501
  });
639
502
  }
640
503
  //#endregion
641
- export { sapAsyncApiAttributesConfig as n, AsyncApiRenderer as t };
504
+ export { AttributeLink as n, AsyncApiRenderer as t };
@@ -1,4 +1,4 @@
1
- import { i as loadObject } from "./utils-BC3WF3-9.js";
1
+ import { i as loadObject } from "./utils-BLQCpHkJ.js";
2
2
  import { useEffect, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { generateHtml } from "@sap/csn-interop-renderer";
@@ -254,35 +254,67 @@ function replaceNodeRun(parentNode, startNode, endNode, replacementHtml) {
254
254
  cur = next;
255
255
  }
256
256
  }
257
+ function matchAnnotationRun(node, next) {
258
+ if (node.nodeType !== Node.TEXT_NODE) return null;
259
+ const text = (node.textContent ?? "").replace(/^\s+/, "");
260
+ const match = /^@([\w.]+):\s*$/.exec(text);
261
+ if (!match) return null;
262
+ if (!next || next.nodeType !== Node.ELEMENT_NODE) return null;
263
+ const el = next;
264
+ let codeEl = null;
265
+ if (el.tagName === "CODE") codeEl = el;
266
+ else if (el.tagName === "A") codeEl = el.querySelector("code");
267
+ if (!codeEl) return null;
268
+ return {
269
+ key: `@${match[1]}`,
270
+ valueNode: next,
271
+ codeEl
272
+ };
273
+ }
257
274
  function collectAnnotationPairs(td, renderers) {
258
275
  const pairs = [];
259
276
  const childNodes = Array.from(td.childNodes);
260
277
  for (let i = 0; i < childNodes.length - 1; i++) {
261
- const node = childNodes[i];
262
- if (node.nodeType !== Node.TEXT_NODE) continue;
263
- const text = (node.textContent ?? "").replace(/^\s+/, "");
264
- const match = /^@([\w.]+):\s*$/.exec(text);
265
- if (!match) continue;
266
- const key = `@${match[1]}`;
267
- const entry = renderers.get(key);
278
+ const run = matchAnnotationRun(childNodes[i], childNodes[i + 1]);
279
+ if (!run) continue;
280
+ const entry = renderers.get(run.key);
268
281
  if (!entry) continue;
269
- const valueNode = childNodes[i + 1];
270
- if (!valueNode || valueNode.nodeType !== Node.ELEMENT_NODE) continue;
271
- const el = valueNode;
272
- let codeEl = null;
273
- if (el.tagName === "CODE") codeEl = el;
274
- else if (el.tagName === "A") codeEl = el.querySelector("code");
275
- if (!codeEl) continue;
276
282
  pairs.push({
277
- textNode: node,
278
- valueNode,
279
- codeEl,
280
- key,
283
+ textNode: childNodes[i],
284
+ valueNode: run.valueNode,
285
+ codeEl: run.codeEl,
286
+ key: run.key,
281
287
  entry
282
288
  });
283
289
  }
284
290
  return pairs;
285
291
  }
292
+ function precedingBr(textNode) {
293
+ let prev = textNode.previousSibling;
294
+ if (prev && prev.nodeType === Node.TEXT_NODE && !(prev.textContent ?? "").trim()) prev = prev.previousSibling;
295
+ return prev && prev.nodeType === Node.ELEMENT_NODE && prev.tagName === "BR" ? prev : null;
296
+ }
297
+ function stripAllAnnotations(html) {
298
+ const domDoc = new DOMParser().parseFromString(html, "text/html");
299
+ for (const container of Array.from(domDoc.querySelectorAll("td, p"))) {
300
+ const childNodes = Array.from(container.childNodes);
301
+ const runs = [];
302
+ for (let i = 0; i < childNodes.length - 1; i++) {
303
+ const run = matchAnnotationRun(childNodes[i], childNodes[i + 1]);
304
+ if (!run) continue;
305
+ runs.push({
306
+ textNode: childNodes[i],
307
+ valueNode: run.valueNode,
308
+ br: precedingBr(childNodes[i])
309
+ });
310
+ }
311
+ for (const { textNode, valueNode, br } of runs) {
312
+ replaceNodeRun(container, textNode, valueNode, "");
313
+ if (br && br.parentNode === container) container.removeChild(br);
314
+ }
315
+ }
316
+ return domDoc.body.innerHTML;
317
+ }
286
318
  function applyAnnotationRenderers(html, configs, doc) {
287
319
  const renderers = /* @__PURE__ */ new Map();
288
320
  for (const config of configs) {
@@ -309,169 +341,6 @@ function applyAnnotationRenderers(html, configs, doc) {
309
341
  return domDoc.body.innerHTML;
310
342
  }
311
343
  //#endregion
312
- //#region src/lib/csn/customAttributes/sapPreset.ts
313
- var sapCsnAttributesConfig = {
314
- prefixStartsWith: "@",
315
- annotations: {
316
- "@EndUserText.label": {
317
- type: "string",
318
- label: "End User Text · Label"
319
- },
320
- "@EndUserText.heading": {
321
- type: "string",
322
- label: "End User Text · Heading"
323
- },
324
- "@EndUserText.quickInfo": {
325
- type: "string",
326
- label: "End User Text · Quick Info"
327
- },
328
- "@ObjectModel.modelingPattern": {
329
- type: "object",
330
- label: "Modeling Pattern"
331
- },
332
- "@ObjectModel.text.element": {
333
- type: "array",
334
- label: "Text Element"
335
- },
336
- "@ObjectModel.text.association": {
337
- type: "object",
338
- label: "Text Association"
339
- },
340
- "@ObjectModel.semanticKey": {
341
- type: "array",
342
- label: "Semantic Key"
343
- },
344
- "@ObjectModel.representativeKey": {
345
- type: "object",
346
- label: "Representative Key"
347
- },
348
- "@ObjectModel.compositionRoot": {
349
- type: "boolean",
350
- label: "Composition Root"
351
- },
352
- "@ObjectModel.supportedCapabilities": {
353
- type: "array",
354
- label: "Supported Capabilities"
355
- },
356
- "@ObjectModel.usageType.sizeCategory": {
357
- type: "string",
358
- label: "Usage Type · Size Category"
359
- },
360
- "@ObjectModel.foreignKey.association": {
361
- type: "object",
362
- label: "Foreign Key Association"
363
- },
364
- "@Consumption.valueHelpDefinition": {
365
- type: "array",
366
- label: "Value Help"
367
- },
368
- "@Consumption.hidden": {
369
- type: "boolean",
370
- label: "Hidden"
371
- },
372
- "@PersonalData.entitySemantics": {
373
- type: "string",
374
- label: "DPP · Entity Semantics"
375
- },
376
- "@PersonalData.dataSubjectRole": {
377
- type: "string",
378
- label: "DPP · Data Subject Role"
379
- },
380
- "@PersonalData.dataSubjectRoleDescription": {
381
- type: "string",
382
- label: "DPP · Data Subject Role Description"
383
- },
384
- "@PersonalData.fieldSemantics": {
385
- type: "string",
386
- label: "DPP · Field Semantics"
387
- },
388
- "@PersonalData.isPotentiallyPersonal": {
389
- type: "boolean",
390
- label: "DPP · Potentially Personal"
391
- },
392
- "@PersonalData.isPotentiallySensitive": {
393
- type: "boolean",
394
- label: "DPP · Potentially Sensitive"
395
- },
396
- "@Semantics.currencyCode": {
397
- type: "boolean",
398
- label: "Semantics · Currency Code"
399
- },
400
- "@Semantics.amount.currencyCode": {
401
- type: "object",
402
- label: "Semantics · Amount Currency"
403
- },
404
- "@Semantics.unitOfMeasure": {
405
- type: "boolean",
406
- label: "Semantics · Unit of Measure"
407
- },
408
- "@Semantics.quantity.unitOfMeasure": {
409
- type: "object",
410
- label: "Semantics · Quantity Unit"
411
- },
412
- "@Semantics.text": {
413
- type: "boolean",
414
- label: "Semantics · Text"
415
- },
416
- "@Semantics.uuid": {
417
- type: "boolean",
418
- label: "Semantics · UUID"
419
- },
420
- "@Semantics.language": {
421
- type: "boolean",
422
- label: "Semantics · Language"
423
- },
424
- "@API.element.releaseState": {
425
- type: "string",
426
- label: "API · Element Release State"
427
- },
428
- "@API.entity.releaseState": {
429
- type: "string",
430
- label: "API · Entity Release State"
431
- },
432
- "@ODM.entityName": {
433
- type: "string",
434
- label: "ODM · Entity Name"
435
- },
436
- "@ODM.oid": {
437
- type: "string",
438
- label: "ODM · OID"
439
- },
440
- "@ODM.oidReference.entityName": {
441
- type: "string",
442
- label: "ODM · OID Reference Entity"
443
- },
444
- "@Aggregation.default": {
445
- type: "object",
446
- label: "Default Aggregation"
447
- },
448
- "@EntityRelationship.entityType": {
449
- type: "string",
450
- label: "Entity Relationship · Type"
451
- },
452
- "@EntityRelationship.entityIds": {
453
- type: "array",
454
- label: "Entity Relationship · IDs"
455
- },
456
- "@EntityRelationship.propertyType": {
457
- type: "string",
458
- label: "Entity Relationship · Property Type"
459
- },
460
- "@EntityRelationship.compositeReferences": {
461
- type: "array",
462
- label: "Entity Relationship · Composite References"
463
- },
464
- "@EntityRelationship.reference": {
465
- type: "array",
466
- label: "Entity Relationship · Reference"
467
- },
468
- "@DataIntegration.dataUnavailable": {
469
- type: "boolean",
470
- label: "Data Integration · Unavailable"
471
- }
472
- }
473
- };
474
- //#endregion
475
344
  //#region src/lib/csn/index.tsx
476
345
  function buildAnnotationLinkCallbacks(configs) {
477
346
  const callbacks = {};
@@ -481,7 +350,7 @@ function buildAnnotationLinkCallbacks(configs) {
481
350
  }
482
351
  return callbacks;
483
352
  }
484
- function CsnRenderer({ content, config, showCustomAttributes = true, customAttributes, className, theme }) {
353
+ function CsnRenderer({ content, config, customAttributes, className, theme }) {
485
354
  const [state, setState] = useState({ kind: "idle" });
486
355
  useEffect(() => {
487
356
  if (!content) {
@@ -500,9 +369,10 @@ function CsnRenderer({ content, config, showCustomAttributes = true, customAttri
500
369
  });
501
370
  return;
502
371
  }
503
- const activeConfigs = customAttributes ?? [sapCsnAttributesConfig];
504
- const parsedDoc = showCustomAttributes ? loadObject(content) : null;
505
- const linkCallbacks = showCustomAttributes ? buildAnnotationLinkCallbacks(activeConfigs) : {};
372
+ const activeConfigs = customAttributes ?? [];
373
+ const isEnabled = customAttributes !== void 0;
374
+ const parsedDoc = isEnabled ? loadObject(content) : null;
375
+ const linkCallbacks = isEnabled ? buildAnnotationLinkCallbacks(activeConfigs) : {};
506
376
  const rendererConfig = {
507
377
  ...config,
508
378
  annotationLinkCallbacks: {
@@ -511,7 +381,7 @@ function CsnRenderer({ content, config, showCustomAttributes = true, customAttri
511
381
  }
512
382
  };
513
383
  generateHtml(parsed, rendererConfig).then((html) => {
514
- const processed = showCustomAttributes ? applyAnnotationRenderers(html, activeConfigs, parsedDoc) : html;
384
+ const processed = isEnabled ? applyAnnotationRenderers(html, activeConfigs, parsedDoc) : stripAllAnnotations(html);
515
385
  if (!cancelled) setState({
516
386
  kind: "ready",
517
387
  html: processed
@@ -528,7 +398,6 @@ function CsnRenderer({ content, config, showCustomAttributes = true, customAttri
528
398
  }, [
529
399
  content,
530
400
  config,
531
- showCustomAttributes,
532
401
  customAttributes
533
402
  ]);
534
403
  return /* @__PURE__ */ jsxs("div", {
@@ -545,4 +414,4 @@ function CsnRenderer({ content, config, showCustomAttributes = true, customAttri
545
414
  });
546
415
  }
547
416
  //#endregion
548
- export { sapCsnAttributesConfig as n, CsnRenderer as t };
417
+ export { CsnRenderer as t };
@@ -1,4 +1,4 @@
1
- import { t as buildShadcnThemeStyle } from "./utils-BC3WF3-9.js";
1
+ import { t as buildShadcnThemeStyle } from "./utils-BLQCpHkJ.js";
2
2
  /* empty css */
3
3
  import { useEffect, useId } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";