@redocly/theme 0.61.0-next.2 → 0.61.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 (71) hide show
  1. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -0
  2. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +9 -0
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +6 -0
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +144 -0
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.d.ts +8 -0
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +161 -0
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +8 -0
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +67 -0
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +9 -0
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +212 -0
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +2 -25
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +12 -1
  13. package/lib/components/Catalog/CatalogEntity/ShowMoreButton.d.ts +8 -0
  14. package/lib/components/Catalog/CatalogEntity/ShowMoreButton.js +35 -0
  15. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -0
  16. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +4 -1
  17. package/lib/components/Catalog/variables.js +112 -0
  18. package/lib/components/Menu/variables.js +1 -0
  19. package/lib/components/Tooltip/Tooltip.js +2 -0
  20. package/lib/core/constants/catalog.d.ts +1 -0
  21. package/lib/core/constants/catalog.js +2 -1
  22. package/lib/core/hooks/catalog/use-catalog-entity-details.d.ts +3 -1
  23. package/lib/core/hooks/catalog/use-catalog-entity-details.js +12 -5
  24. package/lib/core/hooks/use-color-switcher.js +7 -8
  25. package/lib/core/hooks/use-page-actions.js +37 -6
  26. package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
  27. package/lib/core/hooks/use-telemetry-fallback.js +2 -0
  28. package/lib/core/types/catalog.d.ts +33 -4
  29. package/lib/core/types/hooks.d.ts +14 -3
  30. package/lib/core/types/l10n.d.ts +1 -1
  31. package/lib/core/utils/build-revision-url.d.ts +1 -0
  32. package/lib/core/utils/build-revision-url.js +15 -0
  33. package/lib/core/utils/date.d.ts +14 -0
  34. package/lib/core/utils/date.js +39 -0
  35. package/lib/core/utils/index.d.ts +2 -0
  36. package/lib/core/utils/index.js +2 -0
  37. package/lib/core/utils/transform-revisions-to-version-history.d.ts +8 -0
  38. package/lib/core/utils/transform-revisions-to-version-history.js +110 -0
  39. package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.d.ts +9 -0
  40. package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.js +26 -0
  41. package/lib/index.d.ts +2 -0
  42. package/lib/index.js +2 -0
  43. package/package.json +6 -6
  44. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -1
  45. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +12 -0
  46. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +147 -0
  47. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +180 -0
  48. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +93 -0
  49. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +284 -0
  50. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -25
  51. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +15 -2
  52. package/src/components/Catalog/CatalogEntity/ShowMoreButton.tsx +47 -0
  53. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +6 -1
  54. package/src/components/Catalog/variables.ts +112 -0
  55. package/src/components/Menu/variables.ts +1 -0
  56. package/src/components/Tooltip/Tooltip.tsx +2 -0
  57. package/src/core/constants/catalog.ts +2 -0
  58. package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
  59. package/src/core/hooks/catalog/use-catalog-entity-details.ts +22 -6
  60. package/src/core/hooks/use-color-switcher.ts +13 -10
  61. package/src/core/hooks/use-page-actions.ts +63 -6
  62. package/src/core/hooks/use-telemetry-fallback.ts +2 -0
  63. package/src/core/types/catalog.ts +38 -10
  64. package/src/core/types/hooks.ts +23 -4
  65. package/src/core/types/l10n.ts +10 -0
  66. package/src/core/utils/build-revision-url.ts +16 -0
  67. package/src/core/utils/date.ts +33 -0
  68. package/src/core/utils/index.ts +2 -0
  69. package/src/core/utils/transform-revisions-to-version-history.ts +163 -0
  70. package/src/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.tsx +43 -0
  71. package/src/index.ts +2 -0
@@ -50,11 +50,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.CatalogEntityMetadata = CatalogEntityMetadata;
51
51
  const react_1 = __importStar(require("react"));
52
52
  const styled_components_1 = __importDefault(require("styled-components"));
53
- const ChevronDownIcon_1 = require("../../../icons/ChevronDownIcon/ChevronDownIcon");
54
53
  const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
55
54
  const utils_1 = require("../../../core/utils");
56
55
  const hooks_1 = require("../../../core/hooks");
57
56
  const CatalogEntityInfoBar_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityInfoBar");
57
+ const ShowMoreButton_1 = require("../../../components/Catalog/CatalogEntity/ShowMoreButton");
58
58
  const MAX_INITIAL_ITEMS = 4;
59
59
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
60
60
  function renderMetadataValue(value) {
@@ -82,10 +82,7 @@ function CatalogEntityMetadata({ entity }) {
82
82
  visibleMetadata.map(([key, value]) => (react_1.default.createElement(CatalogEntityInfoBar_1.CatalogEntityInfoBar, { key: key, leftContent: react_1.default.createElement(Label, null,
83
83
  (0, utils_1.capitalize)(key),
84
84
  ":"), rightContent: react_1.default.createElement(Value, null, renderMetadataValue(value)), hoverEffect: false, isCodeBlock: (0, utils_1.isPlainObject)(value) || Array.isArray(value) }))),
85
- hasMoreItems && (react_1.default.createElement(ShowMoreButton, { onClick: () => setIsOn(!isOn) },
86
- isOn ? 'Show less' : 'Show more',
87
- " ",
88
- react_1.default.createElement(ChevronIcon, { "$isExpanded": isOn })))));
85
+ hasMoreItems && (react_1.default.createElement(ShowMoreButton_1.ShowMoreButton, { onClick: () => setIsOn(!isOn), isExpanded: isOn }, isOn ? 'Show less' : 'Show more'))));
89
86
  }
90
87
  const JsonViewerWrapper = (0, styled_components_1.default)(JsonViewer_1.JsonViewer) `
91
88
  text-align: left;
@@ -115,24 +112,4 @@ const Heading = styled_components_1.default.h2 `
115
112
  margin-top: 0;
116
113
  font-size: var(--catalog-metadata-heading-size);
117
114
  `;
118
- const ChevronIcon = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
119
- transform: ${({ $isExpanded }) => ($isExpanded ? 'rotate(180deg)' : 'rotate(0)')};
120
- transition: transform 0.2s ease;
121
- `;
122
- const ShowMoreButton = styled_components_1.default.button `
123
- background: none;
124
- border: none;
125
- display: flex;
126
- align-items: center;
127
- gap: var(--catalog-metadata-button-gap, 0.5rem);
128
- cursor: pointer;
129
- color: var(--catalog-metadata-button-color);
130
- padding: 0;
131
- font-weight: var(--font-weight-medium);
132
- margin-top: var(--spacing-unit);
133
-
134
- &:hover {
135
- color: var(--catalog-metadata-button-color-hover);
136
- }
137
- `;
138
115
  //# sourceMappingURL=CatalogEntityMetadata.js.map
@@ -51,11 +51,22 @@ function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelation
51
51
  (0, react_1.useEffect)(() => {
52
52
  setFilter(ENTITY_DEFAULT_FILTERS[entity.key]);
53
53
  }, [entity.key]);
54
+ const combinedFilter = (0, react_1.useMemo)(() => {
55
+ const baseFilter = filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type];
56
+ if (entity.version && entity.revision) {
57
+ const versionFilter = `version:"${entity.version}"`;
58
+ const revisionFilter = `revision:"${entity.revision}"`;
59
+ return baseFilter
60
+ ? `${baseFilter} AND ${versionFilter} AND ${revisionFilter}`
61
+ : `${versionFilter} AND ${revisionFilter}`;
62
+ }
63
+ return baseFilter;
64
+ }, [filter, entity.version, entity.type, entity.revision]);
54
65
  const { items: relations, query } = useFetchCatalogEntitiesRelations({
55
66
  entityKey: entity.key,
56
67
  search: searchQuery,
57
68
  sort: sortOption !== null && sortOption !== void 0 ? sortOption : undefined,
58
- filter: filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type],
69
+ filter: combinedFilter,
59
70
  limit: 10,
60
71
  }, initialRelations);
61
72
  const shouldShowLoadMore = query.hasNextPage ||
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export type ShowMoreButtonProps = {
3
+ onClick: () => void;
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ isExpanded?: boolean;
7
+ };
8
+ export declare function ShowMoreButton({ onClick, children, className, isExpanded, }: ShowMoreButtonProps): React.ReactElement;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ShowMoreButton = ShowMoreButton;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const ChevronDownIcon_1 = require("../../../icons/ChevronDownIcon/ChevronDownIcon");
10
+ function ShowMoreButton({ onClick, children, className, isExpanded = false, }) {
11
+ return (react_1.default.createElement(BaseShowMoreButton, { type: "button", onClick: onClick, className: className },
12
+ children,
13
+ react_1.default.createElement(ChevronIcon, { "$isExpanded": isExpanded })));
14
+ }
15
+ const BaseShowMoreButton = styled_components_1.default.button `
16
+ all: unset;
17
+ display: flex;
18
+ align-items: center;
19
+ cursor: pointer;
20
+ background: none;
21
+ border: none;
22
+ gap: var(--catalog-show-more-button-gap);
23
+ color: var(--catalog-show-more-button-color);
24
+ padding: 0;
25
+ margin-top: var(--spacing-unit);
26
+
27
+ &:hover {
28
+ color: var(--catalog-show-more-button-color-hover);
29
+ }
30
+ `;
31
+ const ChevronIcon = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
32
+ transform: ${({ $isExpanded }) => ($isExpanded ? 'rotate(180deg)' : 'rotate(0)')};
33
+ transition: transform 0.2s ease;
34
+ `;
35
+ //# sourceMappingURL=ShowMoreButton.js.map
@@ -6,6 +6,8 @@ export type BaseEntity = {
6
6
  type: string;
7
7
  title: string;
8
8
  summary?: string | null;
9
+ revision?: string | null;
10
+ version?: string | null;
9
11
  };
10
12
  export type CatalogTableViewRowProps<T extends BaseEntity> = {
11
13
  entity: T;
@@ -64,8 +64,11 @@ const CatalogTableViewRow = ({ entity, entitiesCatalogConfig, catalogConfig, col
64
64
  const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
65
65
  catalogConfig,
66
66
  entitiesCatalogConfig,
67
+ revision: entity.revision,
68
+ version: entity.version,
67
69
  });
68
- return (react_1.default.createElement(TableRow, { key: entity.id, "$columnsWidths": columns.map((column) => column.width || '1fr'), "$columnsMinWidths": columns.map((column) => column.minWidth || 'auto'), to: getEntityDetailsLink(entity) + '?search=', onClick: () => onRowClick(entity), style: { color: 'var(--catalog-page-wrapper-text-color)' }, "data-component-name": "Catalog/CatalogTableView/CatalogTableViewRow" }, columns.map((column) => (react_1.default.createElement(TableCell, { key: column.key, className: column.key === 'entity' ? '' : 'tooltip-cell-container' }, column.render(entity))))));
70
+ const link = getEntityDetailsLink({ key: entity.key, type: entity.type });
71
+ return (react_1.default.createElement(TableRow, { key: entity.id, "$columnsWidths": columns.map((column) => column.width || '1fr'), "$columnsMinWidths": columns.map((column) => column.minWidth || 'auto'), to: link, onClick: () => onRowClick(entity), style: { color: 'var(--catalog-page-wrapper-text-color)' }, "data-component-name": "Catalog/CatalogTableView/CatalogTableViewRow" }, columns.map((column) => (react_1.default.createElement(TableCell, { key: column.key, className: column.key === 'entity' ? '' : 'tooltip-cell-container' }, column.render(entity))))));
69
72
  };
70
73
  exports.CatalogTableViewRow = CatalogTableViewRow;
71
74
  const TableRow = (0, styled_components_1.default)(Link_1.Link) `
@@ -237,6 +237,13 @@ exports.catalog = (0, styled_components_1.css) `
237
237
  --catalog-metadata-column-half-gap: var(--spacing-sm);
238
238
  --catalog-metadata-heading-size: var(--font-size-md);
239
239
 
240
+ /**
241
+ * @tokens Catalog show more button
242
+ */
243
+ --catalog-show-more-button-gap: 0.5rem;
244
+ --catalog-show-more-button-color: var(--text-color-primary);
245
+ --catalog-show-more-button-color-hover: var(--text-color-secondary);
246
+
240
247
  /**
241
248
  * @tokens Catalog arrow circle
242
249
  */
@@ -429,6 +436,111 @@ exports.catalog = (0, styled_components_1.css) `
429
436
  --catalog-entity-relations-edge-label-font-size: 12px;
430
437
  --catalog-entity-relations-edge-label-line-height: 1.2;
431
438
  // @tokens End
439
+
440
+ /**
441
+ * @tokens Catalog history button
442
+ */
443
+ --catalog-history-separator-border-color: var(--border-color-secondary);
444
+ --catalog-history-separator-margin-bottom: var(--spacing-sm);
445
+ --catalog-history-item-padding: var(--spacing-xxs);
446
+ --catalog-history-item-margin-bottom: calc(var(--spacing-xxs) * -1);
447
+ --catalog-history-item-gap: var(--spacing-xxs);
448
+ --catalog-history-item-border-radius: var(--menu-item-label-border-radius);
449
+ --catalog-history-item-bg-color-hover: var(--menu-item-bg-color-hover);
450
+ --catalog-history-icon-size: 16px;
451
+ --catalog-history-text-font-family: var(--font-family-base);
452
+ --catalog-history-text-font-size: var(--font-size-base);
453
+ --catalog-history-text-font-weight: var(--font-weight-regular);
454
+ --catalog-history-text-line-height: var(--line-height-base);
455
+ --catalog-history-text-color: var(--text-color-primary);
456
+ --catalog-history-pill-gap: var(--spacing-xxs);
457
+ --catalog-history-pill-padding-vertical: 1px;
458
+ --catalog-history-pill-padding-horizontal: var(--spacing-xs);
459
+ --catalog-history-pill-border-color: var(--border-color-primary);
460
+ --catalog-history-pill-border-radius: 12px;
461
+ --catalog-history-pill-icon-size: 14px;
462
+ --catalog-history-pill-icon-color: var(--color-green-8);
463
+ --catalog-history-pill-font-family: var(--font-family-base);
464
+ --catalog-history-pill-font-size: var(--font-size-base);
465
+ --catalog-history-pill-line-height: var(--line-height-base);
466
+ --catalog-history-pill-text-color: var(--text-color-primary);
467
+ // @tokens End
468
+
469
+ /**
470
+ * @tokens Catalog history sidebar
471
+ */
472
+ --catalog-history-sidebar-width: 320px;
473
+ --catalog-history-sidebar-bg-color: var(--sidebar-bg-color);
474
+ --catalog-history-sidebar-border-color: var(--border-color-secondary);
475
+
476
+ --catalog-history-sidebar-header-padding: var(--spacing-base) var(--spacing-sm) var(--spacing-base);
477
+ --catalog-history-sidebar-header-font-family: var(--font-family-base);
478
+ --catalog-history-sidebar-header-font-size: var(--font-size-base);
479
+ --catalog-history-sidebar-header-font-weight: var(--font-weight-semibold);
480
+ --catalog-history-sidebar-header-line-height: var(--line-height-base);
481
+ --catalog-history-sidebar-header-letter-spacing: 0;
482
+ --catalog-history-sidebar-header-color: var(--text-color-primary);
483
+
484
+ --catalog-history-sidebar-close-button-size: 32px;
485
+ --catalog-history-sidebar-close-button-border-radius: var(--border-radius-md);
486
+ --catalog-history-sidebar-close-button-bg-color-hover: var(--color-hover-base);
487
+ --catalog-history-sidebar-close-icon-color: var(--text-color-primary);
488
+
489
+ --catalog-history-sidebar-content-padding: 0 var(--spacing-sm);
490
+ --catalog-history-sidebar-content-margin-top: calc(var(--spacing-xxs) * -1);
491
+
492
+ --catalog-history-sidebar-version-header-padding: var(--spacing-xs) var(--spacing-xxs);
493
+ --catalog-history-sidebar-version-header-border-radius: var(--border-radius-md);
494
+ --catalog-history-sidebar-version-header-bg-color-hover: var(--color-hover-base);
495
+
496
+ --catalog-history-sidebar-version-icon-size: 32px;
497
+ --catalog-history-sidebar-version-icon-color: var(--text-color-secondary);
498
+ --catalog-history-sidebar-version-icon-color-current: var(--color-static-white);
499
+ --catalog-history-sidebar-version-icon-margin-right: var(--spacing-xs);
500
+ --catalog-history-sidebar-chevron-icon-color: var(--text-color-secondary);
501
+ --catalog-history-sidebar-version-info-gap: 2px;
502
+
503
+ --catalog-history-sidebar-version-title-font-family: var(--font-family-base);
504
+ --catalog-history-sidebar-version-title-font-size: var(--font-size-base);
505
+ --catalog-history-sidebar-version-title-font-weight: var(--font-weight-medium);
506
+ --catalog-history-sidebar-version-title-line-height: var(--line-height-base);
507
+ --catalog-history-sidebar-version-title-color: var(--color-warm-grey-7);
508
+
509
+ --catalog-history-sidebar-version-date-font-family: var(--font-family-base);
510
+ --catalog-history-sidebar-version-date-font-size: var(--font-size-sm);
511
+ --catalog-history-sidebar-version-date-font-weight: var(--font-weight-regular);
512
+ --catalog-history-sidebar-version-date-line-height: var(--line-height-sm);
513
+ --catalog-history-sidebar-version-date-color: var(--color-warm-grey-7);
514
+
515
+ --catalog-history-sidebar-revisions-padding-left: 40px;
516
+
517
+ --catalog-history-sidebar-revision-item-padding: var(--spacing-xs) var(--spacing-sm);
518
+ --catalog-history-sidebar-revision-item-border-radius: var(--border-radius-md);
519
+ --catalog-history-sidebar-revision-item-bg-color-hover: var(--bg-color-hover);
520
+
521
+ --catalog-history-sidebar-revision-name-font-family: var(--font-family-base);
522
+ --catalog-history-sidebar-revision-name-font-size: var(--font-size-base);
523
+ --catalog-history-sidebar-revision-name-font-weight: var(--font-weight-regular);
524
+ --catalog-history-sidebar-revision-name-line-height: var(--line-height-base);
525
+ --catalog-history-sidebar-revision-name-color: var(--text-color-primary);
526
+
527
+ --catalog-history-sidebar-revision-date-font-family: var(--font-family-base);
528
+ --catalog-history-sidebar-revision-date-font-size: var(--font-size-sm);
529
+ --catalog-history-sidebar-revision-date-font-weight: var(--font-weight-regular);
530
+ --catalog-history-sidebar-revision-date-line-height: var(--line-height-sm);
531
+ --catalog-history-sidebar-revision-date-color: var(--color-warm-grey-7);
532
+
533
+ --catalog-history-sidebar-revision-line-color: var(--border-color-secondary);
534
+ --catalog-history-sidebar-revision-item-bg-color-active: var(--bg-color-active);
535
+
536
+ --catalog-history-sidebar-revisions-limit-message-color: var(--color-warm-grey-6);
537
+
538
+ /**
539
+ * @tokens Catalog history tag border radius
540
+ */
541
+ --catalog-history-sidebar-version-tag-border-radius: var(--border-radius-xl);
542
+ --catalog-history-sidebar-revision-tag-border-radius: var(--border-radius-xl);
543
+ // @tokens End
432
544
  `;
433
545
  /* eslint-enable theme/no-raw-colors-in-styles */
434
546
  //# sourceMappingURL=variables.js.map
@@ -42,6 +42,7 @@ exports.menu = (0, styled_components_1.css) `
42
42
  --menu-item-padding-vertical: var(--spacing-unit); // @presenter Spacing
43
43
  --menu-item-padding-horizontal: var(--spacing-xxs); // @presenter Spacing
44
44
  --menu-item-nested-offset: var(--spacing-sm); // @presenter Spacing
45
+ --menu-header-container-gap: var(--spacing-sm); // @presenter Spacing
45
46
 
46
47
  /**
47
48
  * @tokens Menu item label
@@ -113,6 +113,8 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
113
113
  onMouseEnter: handleOpen,
114
114
  onMouseLeave: handleClose,
115
115
  onClick: handleClose,
116
+ onFocus: handleOpen,
117
+ onBlur: handleClose,
116
118
  };
117
119
  return (react_1.default.createElement(TooltipWrapper, Object.assign({ ref: ref }, controllers, { className: `tooltip-${className}`, "data-component-name": "Tooltip/Tooltip" }),
118
120
  children,
@@ -13,3 +13,4 @@ export declare enum GraphCustomNodeType {
13
13
  export declare enum GraphCustomEdgeType {
14
14
  CatalogEdge = "catalogEdge"
15
15
  }
16
+ export declare const VERSION_NOT_SPECIFIED = "not_specified_version";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.PREDEFINED_ENTITY_TYPES = exports.CATALOG_TAG_MAX_LENGTH = void 0;
3
+ exports.VERSION_NOT_SPECIFIED = exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.PREDEFINED_ENTITY_TYPES = exports.CATALOG_TAG_MAX_LENGTH = void 0;
4
4
  exports.CATALOG_TAG_MAX_LENGTH = 15;
5
5
  exports.PREDEFINED_ENTITY_TYPES = [
6
6
  'service',
@@ -82,4 +82,5 @@ var GraphCustomEdgeType;
82
82
  (function (GraphCustomEdgeType) {
83
83
  GraphCustomEdgeType["CatalogEdge"] = "catalogEdge";
84
84
  })(GraphCustomEdgeType || (exports.GraphCustomEdgeType = GraphCustomEdgeType = {}));
85
+ exports.VERSION_NOT_SPECIFIED = 'not_specified_version';
85
86
  //# sourceMappingURL=catalog.js.map
@@ -3,9 +3,11 @@ import type { BffCatalogEntity } from '../../../core/types';
3
3
  type Props = {
4
4
  catalogConfig: CatalogEntityConfig;
5
5
  entitiesCatalogConfig?: EntitiesCatalogConfig;
6
+ revision?: string | null;
7
+ version?: string | null;
6
8
  };
7
9
  type BaseEntity = Pick<BffCatalogEntity, 'key' | 'type'>;
8
- export declare function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }: Props): {
10
+ export declare function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig, revision, version, }: Props): {
9
11
  getEntityDetailsLink: (entity: BaseEntity) => string;
10
12
  };
11
13
  export {};
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useCatalogEntityDetails = useCatalogEntityDetails;
4
4
  const urls_1 = require("../../utils/urls");
5
- function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }) {
5
+ function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig, revision, version, }) {
6
6
  const getCatalogSpecificConfigByEntityTypeIncluded = (entity) => {
7
7
  var _a;
8
8
  if (!entitiesCatalogConfig) {
@@ -14,12 +14,19 @@ function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }) {
14
14
  });
15
15
  };
16
16
  const getEntityDetailsLink = (entity) => {
17
- const pathPrefix = (0, urls_1.getPathPrefix)();
18
17
  const catalogSpecificConfig = getCatalogSpecificConfigByEntityTypeIncluded(entity);
19
- if (!catalogSpecificConfig || !entitiesCatalogConfig) {
20
- return `${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`;
18
+ const basePath = !catalogSpecificConfig || !entitiesCatalogConfig
19
+ ? (0, urls_1.withPathPrefix)(`/catalogs/${catalogConfig.slug}/entities/${entity.key}`)
20
+ : (0, urls_1.withPathPrefix)(`/catalogs/${catalogSpecificConfig.slug}/entities/${entity.key}`);
21
+ const params = new URLSearchParams();
22
+ if (revision) {
23
+ params.set('revision', revision);
21
24
  }
22
- return `${pathPrefix}/catalogs/${catalogSpecificConfig.slug}/entities/${entity.key}`;
25
+ if (version !== undefined) {
26
+ params.set('version', version !== null && version !== void 0 ? version : '');
27
+ }
28
+ params.set('search', '');
29
+ return `${basePath}?${params.toString()}`;
23
30
  };
24
31
  return { getEntityDetailsLink };
25
32
  }
@@ -2,28 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useColorSwitcher = void 0;
4
4
  const react_1 = require("react");
5
+ const hooks_1 = require("../../core/hooks");
5
6
  const use_theme_config_1 = require("./use-theme-config");
6
7
  const use_theme_hooks_1 = require("./use-theme-hooks");
7
8
  const use_store_1 = require("./use-store");
8
9
  const constants_1 = require("../constants");
9
- const js_utils_1 = require("../utils/js-utils");
10
10
  const COLOR_MODE_KEY = 'colorSchema';
11
11
  const colorModeStore = (0, use_store_1.createStore)({
12
12
  storageKey: COLOR_MODE_KEY,
13
13
  });
14
14
  const useColorSwitcher = () => {
15
- var _a;
16
15
  const themeSettings = (0, use_theme_config_1.useThemeConfig)();
17
16
  const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
18
17
  const telemetry = useTelemetry();
19
18
  const themeColorMode = themeSettings.colorMode;
20
19
  const modes = (0, react_1.useMemo)(() => (themeColorMode === null || themeColorMode === void 0 ? void 0 : themeColorMode.modes) || [constants_1.DEFAULT_COLOR_MODES.LIGHT, constants_1.DEFAULT_COLOR_MODES.DARK], [themeColorMode]);
21
- const documentMode = (0, react_1.useMemo)(() => {
22
- if (!(0, js_utils_1.isBrowser)())
23
- return;
24
- return Array.from(document.documentElement.classList).find((c) => modes.includes(c));
25
- }, [modes]);
26
- const [activeColorMode, setActiveColorMode] = (0, use_store_1.useStore)(colorModeStore, (_a = documentMode !== null && documentMode !== void 0 ? documentMode : modes[0]) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_COLOR_MODES.LIGHT);
20
+ const defaultMode = modes[0] || constants_1.DEFAULT_COLOR_MODES.LIGHT;
21
+ const [activeColorMode, setActiveColorMode] = (0, use_store_1.useStore)(colorModeStore, defaultMode);
22
+ (0, hooks_1.useMount)(() => {
23
+ const activeMode = Array.from(document.documentElement.classList).find((c) => modes.includes(c));
24
+ setActiveColorMode(activeMode || defaultMode);
25
+ });
27
26
  const switchColorMode = (mode) => {
28
27
  if (mode && !modes.includes(mode)) {
29
28
  return;
@@ -23,6 +23,13 @@ const use_mcp_config_1 = require("./use-mcp-config");
23
23
  const clipboard_service_1 = require("../utils/clipboard-service");
24
24
  const dom_1 = require("../utils/dom");
25
25
  const mcp_1 = require("../utils/mcp");
26
+ function createPageActionResource(pageSlug, pageUrl) {
27
+ return {
28
+ id: pageSlug,
29
+ object: 'page',
30
+ uri: pageUrl,
31
+ };
32
+ }
26
33
  const DEFAULT_ENABLED_ACTIONS = [
27
34
  'copy',
28
35
  'view',
@@ -33,10 +40,11 @@ const DEFAULT_ENABLED_ACTIONS = [
33
40
  ];
34
41
  function usePageActions(pageSlug, mcpUrl, actions) {
35
42
  var _a, _b, _c;
36
- const { useTranslate, usePageData, usePageProps, usePageSharedData } = (0, use_theme_hooks_1.useThemeHooks)();
43
+ const { useTranslate, usePageData, usePageProps, usePageSharedData, useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
37
44
  const { translate } = useTranslate();
38
45
  const themeConfig = (0, use_theme_config_1.useThemeConfig)();
39
46
  const pageProps = usePageProps();
47
+ const telemetry = useTelemetry();
40
48
  const openApiSharedData = usePageSharedData('openAPIDocsStore');
41
49
  const mcpConfig = (0, use_mcp_config_1.useMCPConfig)();
42
50
  const shouldHideAllActions = shouldHidePageActions(pageProps, themeConfig, (_a = openApiSharedData === null || openApiSharedData === void 0 ? void 0 : openApiSharedData.options) === null || _a === void 0 ? void 0 : _a.excludeFromSearch);
@@ -49,8 +57,18 @@ function usePageActions(pageSlug, mcpUrl, actions) {
49
57
  const config = requiresMcpUrl
50
58
  ? { serverName: mcpConfig.serverName, url: mcpUrl || '' }
51
59
  : { serverName: mcpConfig.serverName, url: mcpConfig.serverUrl || '' };
52
- return createMCPAction({ clientType, mcpConfig: config, translate });
53
- }, [mcpUrl, mcpConfig, translate]);
60
+ const isDocsMcp = !requiresMcpUrl;
61
+ const origin = dom_1.IS_BROWSER ? window.location.origin : '';
62
+ const pageUrl = `${origin}${pageSlug}`;
63
+ return createMCPAction({
64
+ clientType,
65
+ mcpConfig: config,
66
+ translate,
67
+ onClickCallback: isDocsMcp
68
+ ? () => telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: `docs-mcp-${clientType}` }))
69
+ : undefined,
70
+ });
71
+ }, [mcpUrl, mcpConfig, translate, telemetry, pageSlug]);
54
72
  const result = (0, react_1.useMemo)(() => {
55
73
  var _a, _b, _c;
56
74
  if (shouldHideAllActions) {
@@ -60,10 +78,11 @@ function usePageActions(pageSlug, mcpUrl, actions) {
60
78
  ? window.location.origin
61
79
  : ((_a = globalThis['SSR_HOSTNAME']) !== null && _a !== void 0 ? _a : '');
62
80
  const normalizedSlug = pageSlug.startsWith('/') ? pageSlug : '/' + pageSlug;
81
+ const pageUrl = `${origin}${normalizedSlug}`;
63
82
  const mdPageUrl = new URL(origin + normalizedSlug + (normalizedSlug === '/' ? 'index.html.md' : '.md')).toString();
64
83
  const actionHandlers = {
65
- 'docs-mcp-cursor': createMCPHandler('cursor'),
66
- 'docs-mcp-vscode': createMCPHandler('vscode'),
84
+ 'docs-mcp-cursor': createMCPHandler('cursor', false),
85
+ 'docs-mcp-vscode': createMCPHandler('vscode', false),
67
86
  'mcp-cursor': createMCPHandler('cursor', true),
68
87
  'mcp-vscode': createMCPHandler('vscode', true),
69
88
  copy: () => ({
@@ -79,6 +98,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
79
98
  }
80
99
  const text = yield result.text();
81
100
  clipboard_service_1.ClipboardService.copyCustom(text);
101
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'copy' }));
82
102
  }
83
103
  catch (error) {
84
104
  console.error(error);
@@ -91,6 +111,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
91
111
  description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
92
112
  iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
93
113
  link: mdPageUrl,
114
+ onClick: () => {
115
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'view' }));
116
+ },
94
117
  }),
95
118
  chatgpt: () => {
96
119
  if (!isPublic) {
@@ -102,6 +125,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
102
125
  description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
103
126
  iconComponent: ChatGptIcon_1.ChatGptIcon,
104
127
  link: getExternalAiPromptLink('https://chat.openai.com', mdPageUrl),
128
+ onClick: () => {
129
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'chatgpt' }));
130
+ },
105
131
  };
106
132
  },
107
133
  claude: () => {
@@ -114,6 +140,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
114
140
  description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
115
141
  iconComponent: ClaudeIcon_1.ClaudeIcon,
116
142
  link: getExternalAiPromptLink('https://claude.ai/new', mdPageUrl),
143
+ onClick: () => {
144
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'claude' }));
145
+ },
117
146
  };
118
147
  },
119
148
  };
@@ -128,6 +157,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
128
157
  translate,
129
158
  isPublic,
130
159
  createMCPHandler,
160
+ telemetry,
131
161
  ]);
132
162
  return result;
133
163
  }
@@ -137,10 +167,11 @@ function getExternalAiPromptLink(baseUrl, mdPageUrl) {
137
167
  url.searchParams.set('q', externalAiPrompt);
138
168
  return url.toString();
139
169
  }
140
- function createMCPAction({ clientType, mcpConfig, translate }) {
170
+ function createMCPAction({ clientType, mcpConfig, translate, onClickCallback, }) {
141
171
  const url = (0, mcp_1.generateMCPDeepLink)(clientType, mcpConfig);
142
172
  const sharedProps = {
143
173
  onClick: () => {
174
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
144
175
  window.open(url, '_blank');
145
176
  },
146
177
  };
@@ -1,6 +1,7 @@
1
1
  export declare const useTelemetryFallback: () => {
2
2
  send: () => void;
3
3
  sendPageViewedMessage: () => void;
4
+ sendPageActionsButtonClickedMessage: () => void;
4
5
  sendErrorMessage: () => void;
5
6
  sendClientErrorMessage: () => void;
6
7
  sendBreadcrumbClickedMessage: () => void;
@@ -61,6 +62,7 @@ export declare const useTelemetryFallback: () => {
61
62
  sendAsyncapiDocsMessageClickedMessage: () => void;
62
63
  sendAsyncapiDocsServerModalOpenedMessage: () => void;
63
64
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => void;
65
+ sendAsyncapiDocsReferencedInClickedMessage: () => void;
64
66
  sendGraphqlDocsViewedMessage: () => void;
65
67
  sendGraphqlDocsPerformanceMetricsMessage: () => void;
66
68
  sendGraphqlDocsReferencedInLinkClickedMessage: () => void;
@@ -6,6 +6,7 @@ exports.useTelemetryFallback = void 0;
6
6
  const useTelemetryFallback = () => ({
7
7
  send: () => { },
8
8
  sendPageViewedMessage: () => { },
9
+ sendPageActionsButtonClickedMessage: () => { },
9
10
  sendErrorMessage: () => { },
10
11
  sendClientErrorMessage: () => { },
11
12
  sendBreadcrumbClickedMessage: () => { },
@@ -66,6 +67,7 @@ const useTelemetryFallback = () => ({
66
67
  sendAsyncapiDocsMessageClickedMessage: () => { },
67
68
  sendAsyncapiDocsServerModalOpenedMessage: () => { },
68
69
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => { },
70
+ sendAsyncapiDocsReferencedInClickedMessage: () => { },
69
71
  sendGraphqlDocsViewedMessage: () => { },
70
72
  sendGraphqlDocsPerformanceMetricsMessage: () => { },
71
73
  sendGraphqlDocsReferencedInLinkClickedMessage: () => { },
@@ -33,10 +33,6 @@ export type UseCatalogResponse = {
33
33
  layout: LayoutVariant;
34
34
  collapsedSidebar: boolean;
35
35
  };
36
- export type UseCatalogFetchCatalogEntities = (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity>;
37
- export type UseCatalogFetchCatalogEntitiesRelations = (params: CatalogApiParams & {
38
- entityKey: string;
39
- }, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity>;
40
36
  export type UseCatalogSortResponse = {
41
37
  sortOption: SortOption | null;
42
38
  setSortOption: (option: SortOption | null) => void;
@@ -109,6 +105,7 @@ export type CatalogApiParams = {
109
105
  filter?: string;
110
106
  sort?: string;
111
107
  search?: string;
108
+ entityVersion?: string | null;
112
109
  };
113
110
  export type UseCatalogEntitiesProps = {
114
111
  entitiesTypes: string[];
@@ -136,6 +133,7 @@ export type BffCatalogRelatedEntity = {
136
133
  sourceFile?: string | null;
137
134
  metadata?: Record<string, any>;
138
135
  version?: string | null;
136
+ revision?: string | null;
139
137
  readonly createdAt: string | null;
140
138
  readonly updatedAt: string | null;
141
139
  };
@@ -171,6 +169,7 @@ export type BffCatalogEntity = {
171
169
  readonly revision: string;
172
170
  readonly isCurrent?: boolean | null;
173
171
  readonly isDefaultVersion?: boolean | null;
172
+ readonly isDeleted?: boolean | null;
174
173
  readonly createdAt: string;
175
174
  readonly updatedAt: string;
176
175
  };
@@ -189,5 +188,35 @@ export type Page = {
189
188
  limit: number;
190
189
  total: number;
191
190
  };
191
+ export type BffCatalogEntityRevision = {
192
+ readonly version: string | null;
193
+ readonly revision: string | null;
194
+ readonly isCurrent: boolean | null;
195
+ readonly isDefaultVersion: boolean | null;
196
+ readonly createdAt: string | null;
197
+ readonly updatedAt: string | null;
198
+ };
199
+ export type BffCatalogEntityRevisionList = BffCatalogList<BffCatalogEntityRevision>;
192
200
  export type EntityRelationType = (typeof ENTITY_RELATION_TYPES)[number];
193
201
  export type ListType = 'default' | 'team' | 'api-operation' | 'data-schema';
202
+ export type CatalogEntityRevision = {
203
+ name: string;
204
+ date: string;
205
+ revisionDate: string | null;
206
+ isActive?: boolean;
207
+ isCurrent?: boolean;
208
+ };
209
+ export type CatalogEntityVersionHistoryGroup = {
210
+ version: string;
211
+ date: string;
212
+ isCurrent?: boolean;
213
+ isExpanded?: boolean;
214
+ revisions?: CatalogEntityRevision[];
215
+ singleRevisionDate?: string | null;
216
+ hasCurrentRevisionFromBackend?: boolean;
217
+ isDefaultVersion?: boolean;
218
+ };
219
+ export type SidebarConnectedEntity = {
220
+ key: string;
221
+ version?: string;
222
+ };