@redocly/theme 0.54.0-next.7 → 0.54.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.
@@ -36,6 +36,19 @@ const Link_1 = require("../../components/Link/Link");
36
36
  const Tag_1 = require("../../components/Tag/Tag");
37
37
  const CatalogClassicHighlight_1 = require("../../components/CatalogClassic/CatalogClassicHighlight");
38
38
  const Button_1 = require("../../components/Button/Button");
39
+ /**
40
+ * Strips HTML tags from a plain string.
41
+ */
42
+ function stripHtmlTags(text) {
43
+ if (!text)
44
+ return '';
45
+ // This regex matches:
46
+ // - Opening tags: <tagname> or <tagname attributes>
47
+ // - Closing tags: </tagname>
48
+ // - Self-closing tags: <tagname/> or <tagname attributes/>
49
+ const htmlTagRegex = /<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s[^>]*)?\/?>|<[a-zA-Z][a-zA-Z0-9]*\/>/g;
50
+ return text.replace(htmlTagRegex, '').trim();
51
+ }
39
52
  function CatalogClassicCard({ item }) {
40
53
  var _a, _b;
41
54
  const { useOtelTelemetry } = (0, hooks_1.useThemeHooks)();
@@ -47,7 +60,7 @@ function CatalogClassicCard({ item }) {
47
60
  React.createElement(CardTitle, null,
48
61
  React.createElement(CatalogClassicHighlight_1.CatalogClassicHighlight, null, item.title))),
49
62
  React.createElement(CardDescription, null,
50
- React.createElement(CatalogClassicHighlight_1.CatalogClassicHighlight, null, (_b = (_a = item.summary) !== null && _a !== void 0 ? _a : item.description) !== null && _b !== void 0 ? _b : ''))),
63
+ React.createElement(CatalogClassicHighlight_1.CatalogClassicHighlight, null, stripHtmlTags((_b = (_a = item.summary) !== null && _a !== void 0 ? _a : item.description) !== null && _b !== void 0 ? _b : '')))),
51
64
  React.createElement(CardFooter, null,
52
65
  React.createElement(CardTags, null,
53
66
  (item.tags || []).map((tag, index) => (React.createElement(CardTag, { key: tag + index, color: (0, utils_1.slug)(tag) },
@@ -5,8 +5,13 @@ export type OperationParameter = {
5
5
  name: string | string[];
6
6
  description: string | string[];
7
7
  place: string;
8
+ mediaType: string | undefined;
8
9
  path?: string[];
9
10
  deepLink?: string;
11
+ type: string;
12
+ required: boolean;
13
+ example: string | undefined;
14
+ enum: string[] | undefined;
10
15
  };
11
16
  export type SearchDocument = {
12
17
  id: string;
@@ -17,6 +22,7 @@ export type SearchDocument = {
17
22
  httpMethod?: string;
18
23
  httpPath?: string | string[];
19
24
  deprecated?: boolean;
25
+ security?: string[];
20
26
  parameters?: OperationParameter[];
21
27
  metadata?: Record<string, any>;
22
28
  version?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.54.0-next.7",
3
+ "version": "0.54.0",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -88,8 +88,8 @@
88
88
  "nprogress": "0.2.0",
89
89
  "react-calendar": "5.1.0",
90
90
  "react-date-picker": "11.0.0",
91
- "@redocly/config": "0.25.0",
92
- "@redocly/realm-asyncapi-sdk": "0.0.1"
91
+ "@redocly/realm-asyncapi-sdk": "0.0.1",
92
+ "@redocly/config": "0.26.0"
93
93
  },
94
94
  "scripts": {
95
95
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -16,6 +16,21 @@ export type CatalogClassicCardProps = {
16
16
  item: CatalogItem;
17
17
  };
18
18
 
19
+ /**
20
+ * Strips HTML tags from a plain string.
21
+ */
22
+ function stripHtmlTags(text: string): string {
23
+ if (!text) return '';
24
+
25
+ // This regex matches:
26
+ // - Opening tags: <tagname> or <tagname attributes>
27
+ // - Closing tags: </tagname>
28
+ // - Self-closing tags: <tagname/> or <tagname attributes/>
29
+ const htmlTagRegex = /<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s[^>]*)?\/?>|<[a-zA-Z][a-zA-Z0-9]*\/>/g;
30
+
31
+ return text.replace(htmlTagRegex, '').trim();
32
+ }
33
+
19
34
  export function CatalogClassicCard({ item }: CatalogClassicCardProps): JSX.Element {
20
35
  const { useOtelTelemetry } = useThemeHooks();
21
36
  const otelTelemetry = useOtelTelemetry();
@@ -33,7 +48,7 @@ export function CatalogClassicCard({ item }: CatalogClassicCardProps): JSX.Eleme
33
48
  </CardTitleWrapper>
34
49
  <CardDescription>
35
50
  <CatalogClassicHighlight>
36
- {item.summary ?? item.description ?? ''}
51
+ {stripHtmlTags(item.summary ?? item.description ?? '')}
37
52
  </CatalogClassicHighlight>
38
53
  </CardDescription>
39
54
  </CardContent>
@@ -6,8 +6,13 @@ export type OperationParameter = {
6
6
  name: string | string[];
7
7
  description: string | string[];
8
8
  place: string;
9
+ mediaType: string | undefined;
9
10
  path?: string[];
10
11
  deepLink?: string;
12
+ type: string;
13
+ required: boolean;
14
+ example: string | undefined;
15
+ enum: string[] | undefined;
11
16
  };
12
17
 
13
18
  export type SearchDocument = {
@@ -19,6 +24,7 @@ export type SearchDocument = {
19
24
  httpMethod?: string;
20
25
  httpPath?: string | string[];
21
26
  deprecated?: boolean;
27
+ security?: string[];
22
28
  parameters?: OperationParameter[];
23
29
  metadata?: Record<string, any>;
24
30
  version?: string;