@redocly/theme 0.61.0-next.2 → 0.61.0-next.3
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.
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +9 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +144 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +161 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +67 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +9 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +212 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +2 -25
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +12 -1
- package/lib/components/Catalog/CatalogEntity/ShowMoreButton.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/ShowMoreButton.js +35 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +4 -1
- package/lib/components/Catalog/variables.js +112 -0
- package/lib/components/Menu/variables.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/core/constants/catalog.d.ts +1 -0
- package/lib/core/constants/catalog.js +2 -1
- package/lib/core/hooks/catalog/use-catalog-entity-details.d.ts +3 -1
- package/lib/core/hooks/catalog/use-catalog-entity-details.js +12 -5
- package/lib/core/hooks/use-color-switcher.js +7 -8
- package/lib/core/hooks/use-page-actions.js +37 -6
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/types/catalog.d.ts +33 -4
- package/lib/core/types/hooks.d.ts +14 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/utils/build-revision-url.d.ts +1 -0
- package/lib/core/utils/build-revision-url.js +15 -0
- package/lib/core/utils/date.d.ts +14 -0
- package/lib/core/utils/date.js +39 -0
- package/lib/core/utils/index.d.ts +2 -0
- package/lib/core/utils/index.js +2 -0
- package/lib/core/utils/transform-revisions-to-version-history.d.ts +8 -0
- package/lib/core/utils/transform-revisions-to-version-history.js +110 -0
- package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.d.ts +9 -0
- package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.js +26 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +4 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +12 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +147 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +180 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +93 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +284 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -25
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +15 -2
- package/src/components/Catalog/CatalogEntity/ShowMoreButton.tsx +47 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +6 -1
- package/src/components/Catalog/variables.ts +112 -0
- package/src/components/Menu/variables.ts +1 -0
- package/src/components/Tooltip/Tooltip.tsx +2 -0
- package/src/core/constants/catalog.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/catalog/use-catalog-entity-details.ts +22 -6
- package/src/core/hooks/use-color-switcher.ts +13 -10
- package/src/core/hooks/use-page-actions.ts +63 -6
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/types/catalog.ts +38 -10
- package/src/core/types/hooks.ts +23 -4
- package/src/core/types/l10n.ts +10 -0
- package/src/core/utils/build-revision-url.ts +16 -0
- package/src/core/utils/date.ts +33 -0
- package/src/core/utils/index.ts +2 -0
- package/src/core/utils/transform-revisions-to-version-history.ts +163 -0
- package/src/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.tsx +43 -0
- package/src/index.ts +2 -0
|
@@ -3,8 +3,9 @@ import type { BannerConfig, PageData, PageProps, ResolvedNavItemWithLink, Versio
|
|
|
3
3
|
import type { ShikiTransformer } from '@shikijs/types';
|
|
4
4
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
5
5
|
import type { To, Location, NavigateFunction } from 'react-router-dom';
|
|
6
|
+
import type { UseQueryResult } from '@tanstack/react-query';
|
|
6
7
|
import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
7
|
-
import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps,
|
|
8
|
+
import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
|
|
8
9
|
import type { UserMenuData } from './user-menu';
|
|
9
10
|
import type { ItemState } from './sidebar';
|
|
10
11
|
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
@@ -12,6 +13,7 @@ import type { SubmitFeedbackParams } from './feedback';
|
|
|
12
13
|
import type { TFunction } from './l10n';
|
|
13
14
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
14
15
|
import type { DrilldownMenuItemDetails } from './sidebar';
|
|
16
|
+
import { BffCatalogEntity, BffCatalogEntityList, BffCatalogRelatedEntity, BffCatalogRelatedEntityList, BffCatalogEntityRevision, BffCatalogEntityRevisionList } from './catalog';
|
|
15
17
|
import { AiSearchError } from '../constants/search';
|
|
16
18
|
export type ThemeHooks = {
|
|
17
19
|
useTranslate: () => {
|
|
@@ -124,8 +126,17 @@ export type ThemeHooks = {
|
|
|
124
126
|
useCatalog: (props?: UseCatalogProps) => UseCatalogResponse;
|
|
125
127
|
useCatalogSort: () => UseCatalogSortResponse;
|
|
126
128
|
useCatalogSearch: () => UseCatalogSearchResponse;
|
|
127
|
-
useFetchCatalogEntities:
|
|
128
|
-
useFetchCatalogEntitiesRelations:
|
|
129
|
+
useFetchCatalogEntities: (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity>;
|
|
130
|
+
useFetchCatalogEntitiesRelations: (params: CatalogApiParams & {
|
|
131
|
+
entityKey: string;
|
|
132
|
+
}, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity>;
|
|
133
|
+
useFetchCatalogEntityRevisions: (params: {
|
|
134
|
+
entityKey: string;
|
|
135
|
+
version?: string | null;
|
|
136
|
+
}) => {
|
|
137
|
+
query: UseQueryResult<BffCatalogEntityRevisionList, Error>;
|
|
138
|
+
items: BffCatalogEntityRevision[];
|
|
139
|
+
};
|
|
129
140
|
useCatalogClassic: (config: CatalogConfig) => FilteredCatalog;
|
|
130
141
|
useTelemetry: () => Omit<AsyncApiRealmUI.Telemetry, 'init' | 'updateCloudEventData' | 'forceFlush' | 'startSpan' | 'constructCloudEvent' | 'sendToOtelService'>;
|
|
131
142
|
useUserTeams: () => string[];
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildRevisionUrl(basePath: string, revisionDate: string | null | undefined, version?: string | null): string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRevisionUrl = buildRevisionUrl;
|
|
4
|
+
function buildRevisionUrl(basePath, revisionDate, version) {
|
|
5
|
+
if (!revisionDate) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const params = new URLSearchParams();
|
|
9
|
+
params.set('revision', revisionDate);
|
|
10
|
+
if (version) {
|
|
11
|
+
params.set('version', version);
|
|
12
|
+
}
|
|
13
|
+
return `${basePath}?${params.toString()}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=build-revision-url.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a date string to localized short date format (e.g., "Dec 12, 2025")
|
|
3
|
+
* @param dateString - ISO date string or null
|
|
4
|
+
* @param locale - Locale string (e.g., "en-US")
|
|
5
|
+
* @returns Formatted date string or empty string if dateString is null
|
|
6
|
+
*/
|
|
7
|
+
export declare function toLocalizedShortDate(dateString: string | null, locale: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a date string to localized short date-time format (e.g., "Dec 12, 3:45 PM")
|
|
10
|
+
* @param dateString - ISO date string or null
|
|
11
|
+
* @param locale - Locale string (e.g., "en-US")
|
|
12
|
+
* @returns Formatted date-time string or empty string if dateString is null
|
|
13
|
+
*/
|
|
14
|
+
export declare function toLocalizedShortDateTime(dateString: string | null, locale: string): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLocalizedShortDate = toLocalizedShortDate;
|
|
4
|
+
exports.toLocalizedShortDateTime = toLocalizedShortDateTime;
|
|
5
|
+
/**
|
|
6
|
+
* Formats a date string to localized short date format (e.g., "Dec 12, 2025")
|
|
7
|
+
* @param dateString - ISO date string or null
|
|
8
|
+
* @param locale - Locale string (e.g., "en-US")
|
|
9
|
+
* @returns Formatted date string or empty string if dateString is null
|
|
10
|
+
*/
|
|
11
|
+
function toLocalizedShortDate(dateString, locale) {
|
|
12
|
+
if (!dateString)
|
|
13
|
+
return '';
|
|
14
|
+
const date = new Date(dateString);
|
|
15
|
+
return date.toLocaleDateString(locale, {
|
|
16
|
+
month: 'short',
|
|
17
|
+
day: 'numeric',
|
|
18
|
+
year: 'numeric',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Formats a date string to localized short date-time format (e.g., "Dec 12, 3:45 PM")
|
|
23
|
+
* @param dateString - ISO date string or null
|
|
24
|
+
* @param locale - Locale string (e.g., "en-US")
|
|
25
|
+
* @returns Formatted date-time string or empty string if dateString is null
|
|
26
|
+
*/
|
|
27
|
+
function toLocalizedShortDateTime(dateString, locale) {
|
|
28
|
+
if (!dateString)
|
|
29
|
+
return '';
|
|
30
|
+
const date = new Date(dateString);
|
|
31
|
+
return date.toLocaleString(locale, {
|
|
32
|
+
month: 'short',
|
|
33
|
+
day: 'numeric',
|
|
34
|
+
hour: 'numeric',
|
|
35
|
+
minute: '2-digit',
|
|
36
|
+
hour12: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=date.js.map
|
package/lib/core/utils/index.js
CHANGED
|
@@ -57,4 +57,6 @@ __exportStar(require("./Dynamic"), exports);
|
|
|
57
57
|
__exportStar(require("./tabs"), exports);
|
|
58
58
|
__exportStar(require("./get-operation-color"), exports);
|
|
59
59
|
__exportStar(require("./frontmatter-translate"), exports);
|
|
60
|
+
__exportStar(require("./transform-revisions-to-version-history"), exports);
|
|
61
|
+
__exportStar(require("./build-revision-url"), exports);
|
|
60
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BffCatalogEntityRevision, CatalogEntityVersionHistoryGroup } from '../../core/types';
|
|
2
|
+
export type TransformRevisionsToVersionHistoryParams = {
|
|
3
|
+
revisions: BffCatalogEntityRevision[];
|
|
4
|
+
currentRevisionDate?: string;
|
|
5
|
+
currentVersion?: string | null;
|
|
6
|
+
locale?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, currentVersion, locale, }: TransformRevisionsToVersionHistoryParams): CatalogEntityVersionHistoryGroup[];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformRevisionsToVersionHistory = transformRevisionsToVersionHistory;
|
|
4
|
+
const constants_1 = require("../../core/constants");
|
|
5
|
+
const date_1 = require("./date");
|
|
6
|
+
function compareVersionsDescending(versionA, versionB) {
|
|
7
|
+
return versionB.localeCompare(versionA, undefined, { numeric: true });
|
|
8
|
+
}
|
|
9
|
+
function extractGroupComparisonData(group) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const version = group.version;
|
|
12
|
+
const isNotSpecified = version === constants_1.VERSION_NOT_SPECIFIED;
|
|
13
|
+
// Get version dates (oldest revision date for each group - the version's creation date)
|
|
14
|
+
// This ensures versions stay in their original order even when new revisions are added
|
|
15
|
+
const date = group.singleRevisionDate ||
|
|
16
|
+
(group.revisions && group.revisions.length > 0
|
|
17
|
+
? (_a = group.revisions[group.revisions.length - 1]) === null || _a === void 0 ? void 0 : _a.revisionDate
|
|
18
|
+
: undefined) ||
|
|
19
|
+
'';
|
|
20
|
+
const time = date ? new Date(date).getTime() : 0;
|
|
21
|
+
const hasCurrent = (_b = group.hasCurrentRevisionFromBackend) !== null && _b !== void 0 ? _b : false;
|
|
22
|
+
return { version, isNotSpecified, time, hasCurrent };
|
|
23
|
+
}
|
|
24
|
+
function compareVersionGroupsDescending(groupA, groupB) {
|
|
25
|
+
const { version: versionA, isNotSpecified: isNotSpecifiedA, time: timeA, hasCurrent: hasCurrentA, } = extractGroupComparisonData(groupA);
|
|
26
|
+
const { version: versionB, isNotSpecified: isNotSpecifiedB, time: timeB, hasCurrent: hasCurrentB, } = extractGroupComparisonData(groupB);
|
|
27
|
+
// First, compare by version date (oldest first, so most recent versions come first)
|
|
28
|
+
const dateComparison = timeB - timeA;
|
|
29
|
+
if (dateComparison !== 0) {
|
|
30
|
+
return dateComparison;
|
|
31
|
+
}
|
|
32
|
+
// If dates are equal, prioritize the one with isCurrent from backend
|
|
33
|
+
if (hasCurrentA !== hasCurrentB) {
|
|
34
|
+
return hasCurrentB ? 1 : -1; // hasCurrentB comes first if true
|
|
35
|
+
}
|
|
36
|
+
// If both have same isCurrent status, compare by version
|
|
37
|
+
// If both are unknown or both are real versions, compare by version
|
|
38
|
+
if (isNotSpecifiedA === isNotSpecifiedB) {
|
|
39
|
+
return compareVersionsDescending(versionA, versionB);
|
|
40
|
+
}
|
|
41
|
+
// If one is unknown and one is a real version, unknown comes last
|
|
42
|
+
return isNotSpecifiedA ? 1 : -1;
|
|
43
|
+
}
|
|
44
|
+
function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, currentVersion, locale = typeof navigator !== 'undefined' ? navigator.language : 'en-US', }) {
|
|
45
|
+
const normalizedCurrentVersion = currentVersion === null ? constants_1.VERSION_NOT_SPECIFIED : currentVersion;
|
|
46
|
+
const versionMap = new Map();
|
|
47
|
+
revisions.forEach((revision) => {
|
|
48
|
+
const version = revision.version || constants_1.VERSION_NOT_SPECIFIED;
|
|
49
|
+
const versionRevisions = versionMap.get(version) || [];
|
|
50
|
+
versionRevisions.push(revision);
|
|
51
|
+
if (!versionMap.has(version)) {
|
|
52
|
+
versionMap.set(version, versionRevisions);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const versionGroups = Array.from(versionMap.entries()).map(([version, versionRevisions]) => {
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
const sortedRevisions = [...versionRevisions].sort((a, b) => {
|
|
58
|
+
const dateA = a.revision ? new Date(a.revision).getTime() : 0;
|
|
59
|
+
const dateB = b.revision ? new Date(b.revision).getTime() : 0;
|
|
60
|
+
return dateB - dateA;
|
|
61
|
+
});
|
|
62
|
+
const latestRevision = sortedRevisions[0];
|
|
63
|
+
const versionMatches = normalizedCurrentVersion === undefined || normalizedCurrentVersion === version;
|
|
64
|
+
let isCurrent;
|
|
65
|
+
if (currentRevisionDate !== undefined) {
|
|
66
|
+
// Check if revision matches AND version matches
|
|
67
|
+
const revisionMatches = sortedRevisions.some((rev) => rev.revision === currentRevisionDate);
|
|
68
|
+
isCurrent = revisionMatches && versionMatches;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// When no revision is specified, use isCurrent flag from the latest revision
|
|
72
|
+
// but only if version also matches (or no version filter is applied)
|
|
73
|
+
isCurrent = ((_a = latestRevision === null || latestRevision === void 0 ? void 0 : latestRevision.isCurrent) !== null && _a !== void 0 ? _a : false) && versionMatches;
|
|
74
|
+
}
|
|
75
|
+
// Check if any revision in this version group is the default version
|
|
76
|
+
const isDefaultVersion = sortedRevisions.some((rev) => rev.isDefaultVersion === true);
|
|
77
|
+
const revisions = sortedRevisions.length > 1
|
|
78
|
+
? sortedRevisions.map((rev, index) => {
|
|
79
|
+
var _a;
|
|
80
|
+
const revisionMatches = currentRevisionDate
|
|
81
|
+
? rev.revision === currentRevisionDate
|
|
82
|
+
: false;
|
|
83
|
+
const isActiveRevision = revisionMatches && versionMatches;
|
|
84
|
+
const isCurrentByDefault = !currentRevisionDate &&
|
|
85
|
+
normalizedCurrentVersion === undefined &&
|
|
86
|
+
index === 0 &&
|
|
87
|
+
isCurrent;
|
|
88
|
+
return {
|
|
89
|
+
name: `r.${sortedRevisions.length - index}`,
|
|
90
|
+
date: (0, date_1.toLocalizedShortDateTime)(rev.revision, locale),
|
|
91
|
+
revisionDate: rev.revision,
|
|
92
|
+
isActive: isActiveRevision || isCurrentByDefault,
|
|
93
|
+
isCurrent: (_a = rev.isCurrent) !== null && _a !== void 0 ? _a : false,
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
: undefined;
|
|
97
|
+
return {
|
|
98
|
+
version,
|
|
99
|
+
date: (0, date_1.toLocalizedShortDate)((latestRevision === null || latestRevision === void 0 ? void 0 : latestRevision.revision) || null, locale),
|
|
100
|
+
isCurrent,
|
|
101
|
+
isExpanded: isCurrent,
|
|
102
|
+
hasCurrentRevisionFromBackend: (_b = latestRevision === null || latestRevision === void 0 ? void 0 : latestRevision.isCurrent) !== null && _b !== void 0 ? _b : false,
|
|
103
|
+
isDefaultVersion,
|
|
104
|
+
revisions,
|
|
105
|
+
singleRevisionDate: sortedRevisions.length === 1 ? (_c = sortedRevisions[0]) === null || _c === void 0 ? void 0 : _c.revision : undefined,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
return versionGroups.sort(compareVersionGroupsDescending);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=transform-revisions-to-version-history.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const NavaidMilitaryIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.NavaidMilitaryIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => {
|
|
11
|
+
return (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, props),
|
|
12
|
+
react_1.default.createElement("path", { d: "M8 15C6.61553 15 5.26216 14.5895 4.11101 13.8203C2.95987 13.0511 2.06266 11.9579 1.53285 10.6788C1.00303 9.3997 0.86441 7.99224 1.13451 6.63437C1.4046 5.2765 2.07129 4.02922 3.05026 3.05026C4.02922 2.07129 5.2765 1.4046 6.63437 1.13451C7.99224 0.86441 9.3997 1.00303 10.6788 1.53285C11.9579 2.06266 13.0511 2.95987 13.8203 4.11101C14.5895 5.26216 15 6.61553 15 8C14.9979 9.85588 14.2597 11.6351 12.9474 12.9474C11.6351 14.2597 9.85588 14.9979 8 15ZM8 2C6.81332 2 5.65328 2.3519 4.66658 3.01119C3.67989 3.67047 2.91085 4.60755 2.45673 5.7039C2.0026 6.80026 1.88378 8.00666 2.11529 9.17054C2.3468 10.3344 2.91825 11.4035 3.75736 12.2426C4.59648 13.0818 5.66558 13.6532 6.82946 13.8847C7.99335 14.1162 9.19975 13.9974 10.2961 13.5433C11.3925 13.0892 12.3295 12.3201 12.9888 11.3334C13.6481 10.3467 14 9.18669 14 8C13.9982 6.40926 13.3655 4.88419 12.2406 3.75936C11.1158 2.63454 9.59075 2.00182 8 2Z", fill: "#1A1C21" }),
|
|
13
|
+
react_1.default.createElement("path", { d: "M8 12C7.20888 12 6.43552 11.7654 5.77772 11.3259C5.11993 10.8864 4.60724 10.2616 4.30449 9.53074C4.00173 8.79983 3.92252 7.99557 4.07686 7.21964C4.2312 6.44372 4.61217 5.73099 5.17158 5.17158C5.73099 4.61217 6.44372 4.2312 7.21964 4.07686C7.99557 3.92252 8.79983 4.00173 9.53074 4.30449C10.2616 4.60724 10.8864 5.11993 11.3259 5.77772C11.7654 6.43552 12 7.20888 12 8C11.9988 9.0605 11.577 10.0772 10.8271 10.8271C10.0772 11.577 9.0605 11.9988 8 12ZM8 5C7.40666 5 6.82664 5.17595 6.33329 5.50559C5.83994 5.83524 5.45543 6.30377 5.22836 6.85195C5.0013 7.40013 4.94189 8.00333 5.05765 8.58527C5.1734 9.16722 5.45913 9.70177 5.87868 10.1213C6.29824 10.5409 6.83279 10.8266 7.41473 10.9424C7.99668 11.0581 8.59988 10.9987 9.14805 10.7716C9.69623 10.5446 10.1648 10.1601 10.4944 9.66671C10.8241 9.17337 11 8.59335 11 8C10.9991 7.20463 10.6828 6.44208 10.1203 5.87966C9.55793 5.31725 8.79538 5.00089 8 5Z", fill: "#1A1C21" }),
|
|
14
|
+
react_1.default.createElement("path", { d: "M8 9C8.55229 9 9 8.55229 9 8C9 7.44772 8.55229 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55229 7.44772 9 8 9Z", fill: "#1A1C21" })));
|
|
15
|
+
};
|
|
16
|
+
exports.NavaidMilitaryIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
17
|
+
'data-component-name': 'icons/NavaidMilitaryIcon/NavaidMilitaryIcon',
|
|
18
|
+
})) `
|
|
19
|
+
path {
|
|
20
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
height: ${({ size }) => size || '16px'};
|
|
24
|
+
width: ${({ size }) => size || '16px'};
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=NavaidMilitaryIcon.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -115,6 +115,8 @@ export * from './components/Catalog/CatalogSelector';
|
|
|
115
115
|
export * from './components/Catalog/CatalogSortButton';
|
|
116
116
|
export * from './components/Catalog/CatalogTagsWithTooltip';
|
|
117
117
|
export * from './components/Catalog/CatalogViewModeToggle';
|
|
118
|
+
export * from './components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton';
|
|
119
|
+
export * from './components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar';
|
|
118
120
|
export * from './components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations';
|
|
119
121
|
export * from './components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations';
|
|
120
122
|
export * from './components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations';
|
package/lib/index.js
CHANGED
|
@@ -173,6 +173,8 @@ __exportStar(require("./components/Catalog/CatalogSelector"), exports);
|
|
|
173
173
|
__exportStar(require("./components/Catalog/CatalogSortButton"), exports);
|
|
174
174
|
__exportStar(require("./components/Catalog/CatalogTagsWithTooltip"), exports);
|
|
175
175
|
__exportStar(require("./components/Catalog/CatalogViewModeToggle"), exports);
|
|
176
|
+
__exportStar(require("./components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton"), exports);
|
|
177
|
+
__exportStar(require("./components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar"), exports);
|
|
176
178
|
__exportStar(require("./components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations"), exports);
|
|
177
179
|
__exportStar(require("./components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations"), exports);
|
|
178
180
|
__exportStar(require("./components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.61.0-next.
|
|
3
|
+
"version": "0.61.0-next.3",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@markdoc/markdoc": "0.5.2",
|
|
30
30
|
"lodash.debounce": "^4.0.8",
|
|
31
31
|
"lodash.throttle": "^4.1.1",
|
|
32
|
-
"react": "
|
|
33
|
-
"react-dom": "
|
|
32
|
+
"react": "19.2.3",
|
|
33
|
+
"react-dom": "19.2.3",
|
|
34
34
|
"react-router-dom": "^6.21.1",
|
|
35
35
|
"styled-components": "^4.1.1 || ^5.3.11 || ^6.0.0"
|
|
36
36
|
},
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/react": "^19.2.7",
|
|
49
49
|
"@types/react-dom": "^19.2.3",
|
|
50
50
|
"@types/styled-components": "5.1.34",
|
|
51
|
-
"@vitest/coverage-v8": "
|
|
51
|
+
"@vitest/coverage-v8": "4.0.10",
|
|
52
52
|
"@vitest/ui": "3.2.4",
|
|
53
53
|
"concurrently": "7.6.0",
|
|
54
54
|
"react-router-dom": "^6.21.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { Route, Routes } from 'react-router-dom';
|
|
3
|
+
import { Route, Routes, useSearchParams } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
6
6
|
import type {
|
|
@@ -20,6 +20,7 @@ import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
|
20
20
|
import { CatalogEntitySchema } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntitySchema';
|
|
21
21
|
import { CatalogEntityMethodAndPath } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath';
|
|
22
22
|
import { CatalogEntityRelationsGraph } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy';
|
|
23
|
+
import { CatalogEntityHistorySidebar } from '@redocly/theme';
|
|
23
24
|
|
|
24
25
|
export type CatalogEntityProps = {
|
|
25
26
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -93,6 +94,10 @@ export function CatalogEntity({
|
|
|
93
94
|
const { entity, relations, catalogConfig, entitiesCatalogConfig, relatedEntity } =
|
|
94
95
|
usePageProps<CatalogEntityPageProps>();
|
|
95
96
|
|
|
97
|
+
const [searchParams] = useSearchParams();
|
|
98
|
+
const revision = searchParams.get('revision') || undefined;
|
|
99
|
+
const version = searchParams.get('version') || undefined;
|
|
100
|
+
|
|
96
101
|
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
97
102
|
const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
|
|
98
103
|
|
|
@@ -100,6 +105,7 @@ export function CatalogEntity({
|
|
|
100
105
|
|
|
101
106
|
return (
|
|
102
107
|
<CatalogPageWrapper data-component-name="Catalog/CatalogEntity/CatalogEntity">
|
|
108
|
+
<CatalogEntityHistorySidebar entityKey={entity.key} revision={revision} version={version} />
|
|
103
109
|
<CatalogPageContent>
|
|
104
110
|
<Breadcrumbs
|
|
105
111
|
additionalBreadcrumbs={[
|
package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx
CHANGED
|
@@ -32,8 +32,20 @@ export function CatalogEntityRelationsGraph({
|
|
|
32
32
|
}: CatalogEntityRelationsGraphProps): JSX.Element {
|
|
33
33
|
const { useFetchCatalogEntitiesRelations } = useThemeHooks();
|
|
34
34
|
const { activeColorMode } = useColorSwitcher();
|
|
35
|
+
|
|
36
|
+
const combinedFilter = useMemo(() => {
|
|
37
|
+
if (entity.version && entity.revision) {
|
|
38
|
+
const versionFilter = `version:"${entity.version}"`;
|
|
39
|
+
const revisionFilter = `revision:"${entity.revision}"`;
|
|
40
|
+
return `${versionFilter} AND ${revisionFilter}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return undefined;
|
|
44
|
+
}, [entity.version, entity.revision]);
|
|
45
|
+
|
|
35
46
|
const { items: allRelations } = useFetchCatalogEntitiesRelations({
|
|
36
47
|
entityKey: entity.key,
|
|
48
|
+
filter: combinedFilter,
|
|
37
49
|
});
|
|
38
50
|
|
|
39
51
|
const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = useGraph({
|
package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { RecentlyViewedIcon } from '@redocly/theme/icons/RecentlyViewedIcon/RecentlyViewedIcon';
|
|
5
|
+
import { CheckmarkOutlineIcon } from '@redocly/theme/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon';
|
|
6
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
7
|
+
import { VERSION_NOT_SPECIFIED } from '@redocly/theme/core/constants';
|
|
8
|
+
|
|
9
|
+
export type CatalogHistoryButtonProps = {
|
|
10
|
+
version: string | null;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function CatalogEntityHistoryButton({
|
|
15
|
+
version,
|
|
16
|
+
className,
|
|
17
|
+
}: CatalogHistoryButtonProps): React.ReactElement {
|
|
18
|
+
const [label, setLabel] = useState(version === VERSION_NOT_SPECIFIED ? null : version);
|
|
19
|
+
const { useTranslate } = useThemeHooks();
|
|
20
|
+
const { translate } = useTranslate();
|
|
21
|
+
|
|
22
|
+
const handleClose = useCallback(
|
|
23
|
+
(e: CustomEvent): void => {
|
|
24
|
+
setLabel(
|
|
25
|
+
e.detail.version === VERSION_NOT_SPECIFIED
|
|
26
|
+
? e.detail.revision || 'r.1'
|
|
27
|
+
: `${e.detail.version || version}, ${e.detail.revision || 'r.1'}`,
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
[version],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
window.addEventListener('portal:sidebar:close-version-history', (e) =>
|
|
35
|
+
handleClose(e as CustomEvent),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
window.removeEventListener('portal:sidebar:close-version-history', (e) =>
|
|
40
|
+
handleClose(e as CustomEvent),
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
}, [handleClose]);
|
|
44
|
+
|
|
45
|
+
const handleClick = (): void => {
|
|
46
|
+
window.dispatchEvent(new CustomEvent('portal:sidebar:open-version-history'));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<CatalogHistoryButtonWrapper
|
|
51
|
+
className={className}
|
|
52
|
+
data-component-name="Catalog/CatalogHistoryButton"
|
|
53
|
+
>
|
|
54
|
+
<Separator />
|
|
55
|
+
<HistoryItem onClick={handleClick}>
|
|
56
|
+
<HistoryIcon />
|
|
57
|
+
<HistoryContent>
|
|
58
|
+
<HistoryText>{translate('catalog.history.button.label', 'Version history')}</HistoryText>
|
|
59
|
+
{label && (
|
|
60
|
+
<VersionPill>
|
|
61
|
+
<CheckmarkIcon />
|
|
62
|
+
<span>{label}</span>
|
|
63
|
+
</VersionPill>
|
|
64
|
+
)}
|
|
65
|
+
</HistoryContent>
|
|
66
|
+
</HistoryItem>
|
|
67
|
+
</CatalogHistoryButtonWrapper>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const CatalogHistoryButtonWrapper = styled.div`
|
|
72
|
+
width: 100%;
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const Separator = styled.div`
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 1px;
|
|
78
|
+
background-color: var(--catalog-history-separator-border-color);
|
|
79
|
+
margin-bottom: var(--catalog-history-separator-margin-bottom);
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
const HistoryItem = styled.button`
|
|
84
|
+
all: unset;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
gap: var(--catalog-history-item-gap);
|
|
89
|
+
padding: var(--catalog-history-item-padding);
|
|
90
|
+
margin-bottom: var(--catalog-history-item-margin-bottom);
|
|
91
|
+
width: 100%;
|
|
92
|
+
border-radius: var(--catalog-history-item-border-radius);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
transition: background-color 0.2s ease;
|
|
95
|
+
|
|
96
|
+
&:hover {
|
|
97
|
+
background-color: var(--catalog-history-item-bg-color-hover);
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const HistoryContent = styled.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
flex: 1;
|
|
106
|
+
gap: var(--catalog-history-item-gap);
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
const HistoryText = styled.span`
|
|
110
|
+
font-family: var(--catalog-history-text-font-family);
|
|
111
|
+
font-size: var(--catalog-history-text-font-size);
|
|
112
|
+
font-weight: var(--catalog-history-text-font-weight);
|
|
113
|
+
line-height: var(--catalog-history-text-line-height);
|
|
114
|
+
color: var(--catalog-history-text-color);
|
|
115
|
+
flex: 1;
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
const HistoryIcon = styled(RecentlyViewedIcon)`
|
|
119
|
+
width: var(--catalog-history-icon-size);
|
|
120
|
+
height: var(--catalog-history-icon-size);
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
const VersionPill = styled.div`
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--catalog-history-pill-gap);
|
|
128
|
+
padding: var(--catalog-history-pill-padding-vertical)
|
|
129
|
+
var(--catalog-history-pill-padding-horizontal);
|
|
130
|
+
border: 1px solid var(--catalog-history-pill-border-color);
|
|
131
|
+
border-radius: var(--catalog-history-pill-border-radius);
|
|
132
|
+
background-color: transparent;
|
|
133
|
+
flex-shrink: 0;
|
|
134
|
+
|
|
135
|
+
span {
|
|
136
|
+
font-family: var(--catalog-history-pill-font-family);
|
|
137
|
+
font-size: var(--catalog-history-pill-font-size);
|
|
138
|
+
line-height: var(--catalog-history-pill-line-height);
|
|
139
|
+
color: var(--catalog-history-pill-text-color);
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
const CheckmarkIcon = styled(CheckmarkOutlineIcon)`
|
|
144
|
+
width: var(--catalog-history-pill-icon-size);
|
|
145
|
+
height: var(--catalog-history-pill-icon-size);
|
|
146
|
+
color: var(--catalog-history-pill-icon-color);
|
|
147
|
+
`;
|