@redocly/theme 0.58.0-next.2 → 0.58.0-next.4

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.
@@ -43,7 +43,9 @@ function Catalog(props) {
43
43
  react_1.default.createElement(CatalogPageDescription, null,
44
44
  react_1.default.createElement(CatalogTitleWrapper, null,
45
45
  react_1.default.createElement(CatalogTitle, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey },
46
- translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey),
46
+ (catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
47
+ ? translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
48
+ : catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.slug,
47
49
  ' '),
48
50
  react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, entitiesCounter)),
49
51
  react_1.default.createElement(CatalogDescription, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey }, translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey))),
@@ -13,7 +13,7 @@ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon")
13
13
  const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
14
14
  function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
15
15
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
16
- react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
16
+ react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
17
17
  react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
18
18
  react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "operations-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false, listType: "api-operation" })),
19
19
  react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
@@ -190,8 +190,9 @@ function SearchDialog({ onClose, className }) {
190
190
  }
191
191
  }
192
192
  }, ref: aiQueryRef, tabIndex: 0, role: "option", "aria-selected": "true" },
193
- react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
194
- react_1.default.createElement(Typography_1.Typography, { fontWeight: "var(--font-weight-semibold)" }, query),
193
+ react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { style: { flexShrink: 0 }, color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
194
+ react_1.default.createElement(QueryWrapper, null,
195
+ react_1.default.createElement(Typography_1.Typography, { fontWeight: "var(--font-weight-semibold)" }, query)),
195
196
  react_1.default.createElement(Typography_1.Typography, null,
196
197
  "- ",
197
198
  translate('search.ai.label', 'Ask AI assistant')),
@@ -268,10 +269,10 @@ const SearchDialogWrapper = styled_components_1.default.div `
268
269
  border-radius: 0;
269
270
 
270
271
  @media screen and (max-width: ${utils_1.breakpoints.small}) {
271
- min-height: -webkit-fill-available !important;
272
- min-height: 100dvh !important;
273
- height: auto !important;
274
- width: 100vw !important;
272
+ min-height: -webkit-fill-available;
273
+ min-height: 100dvh;
274
+ height: 100dvh;
275
+ width: 100vw;
275
276
  }
276
277
 
277
278
  @media screen and (min-width: ${utils_1.breakpoints.small}) {
@@ -318,6 +319,8 @@ const SearchDialogBodyMainView = styled_components_1.default.div `
318
319
  `;
319
320
  const SearchDialogBodyFilterView = styled_components_1.default.div `
320
321
  overflow: scroll;
322
+ max-width: var(--search-filter-width);
323
+ width: 100%;
321
324
  `;
322
325
  const SearchDialogFooter = styled_components_1.default.footer `
323
326
  display: flex;
@@ -439,4 +442,7 @@ const SearchWithAI = styled_components_1.default.div `
439
442
  margin-right: var(--spacing-xs);
440
443
  }
441
444
  `;
445
+ const QueryWrapper = styled_components_1.default.div `
446
+ word-break: break-word;
447
+ `;
442
448
  //# sourceMappingURL=SearchDialog.js.map
@@ -43,7 +43,8 @@ function SearchFilter({ className, facets, filter, query, quickFilterFields, onF
43
43
  React.createElement(SearchFilterFields, null, facets.map((facet, index) => (React.createElement(SearchFilterField_1.SearchFilterField, { key: `${facet.field}-${index}`, facet: facet, filter: filter, query: query, quickFilterFields: quickFilterFields, onFilterChange: onFilterChange, onFacetReset: onFacetReset }))))));
44
44
  }
45
45
  const SearchFilterWrapper = styled_components_1.default.div `
46
- width: var(--search-filter-width);
46
+ width: 100%;
47
+ max-width: var(--search-filter-width);
47
48
  display: flex;
48
49
  flex-direction: column;
49
50
  padding: var(--search-filter-padding);
@@ -10,7 +10,7 @@ function useCatalogTableViewRow({ entityKey, entityType, catalogConfig, entities
10
10
  }
11
11
  return Object.values((_a = entitiesCatalogConfig.catalogs) !== null && _a !== void 0 ? _a : {}).find((catalog) => {
12
12
  var _a;
13
- return (_a = catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type === entityType);
13
+ return (_a = catalog === null || catalog === void 0 ? void 0 : catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type === entityType);
14
14
  });
15
15
  };
16
16
  const getEntityDetailsLink = () => {
@@ -17,6 +17,10 @@ function useActiveSectionId(location, hasOverviewPage = false, withNavbar = true
17
17
  setItemId('');
18
18
  return;
19
19
  }
20
+ if (window.scrollY <= 0) {
21
+ setItemId(sections[0].getAttribute('data-section-id') || '');
22
+ return;
23
+ }
20
24
  for (let i = 0; i < sections.length; i++) {
21
25
  const section = sections[i];
22
26
  const rect = section.getBoundingClientRect();
@@ -57,4 +57,9 @@ export declare const useTelemetryFallback: () => {
57
57
  sendAsyncapiDocsMessageClickedMessage: () => void;
58
58
  sendAsyncapiDocsServerModalOpenedMessage: () => void;
59
59
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => void;
60
+ sendGraphqlDocsViewedMessage: () => void;
61
+ sendGraphqlDocsPerformanceMetricsMessage: () => void;
62
+ sendGraphqlDocsReferencedInLinkClickedMessage: () => void;
63
+ sendGraphqlDocsRequiredScopesModalOpenedMessage: () => void;
64
+ sendGraphqlDocsDownloadDefinitionClickedMessage: () => void;
60
65
  };
@@ -61,6 +61,11 @@ const useTelemetryFallback = () => ({
61
61
  sendAsyncapiDocsMessageClickedMessage: () => { },
62
62
  sendAsyncapiDocsServerModalOpenedMessage: () => { },
63
63
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => { },
64
+ sendGraphqlDocsViewedMessage: () => { },
65
+ sendGraphqlDocsPerformanceMetricsMessage: () => { },
66
+ sendGraphqlDocsReferencedInLinkClickedMessage: () => { },
67
+ sendGraphqlDocsRequiredScopesModalOpenedMessage: () => { },
68
+ sendGraphqlDocsDownloadDefinitionClickedMessage: () => { },
64
69
  });
65
70
  exports.useTelemetryFallback = useTelemetryFallback;
66
71
  //# sourceMappingURL=use-telemetry-fallback.js.map
@@ -1,3 +1,7 @@
1
+ export type { UserClaims } from '../types/user-claims';
2
+ export type { SearchDocument, SearchItemData, OperationParameter } from '../types/search';
3
+ export type { TFunction, TOptions } from '../types/l10n';
4
+ export type { SelectOption, SelectProps } from '../types/select';
1
5
  export { IS_BROWSER } from '../utils/dom';
2
6
  export { addLeadingSlash, removeLeadingSlash, getPathPrefix, combineUrls, addTrailingSlash, withPathPrefix, } from '../utils/urls';
3
7
  export { typedMemo } from '../hoc/typedMemo';
@@ -5,14 +9,14 @@ export { useMount } from '../hooks/use-mount';
5
9
  export { GlobalStyle } from '../styles/global';
6
10
  export { breakpoints } from '../utils/media-css';
7
11
  export { isPrimitive } from '../utils/args-typecheck';
8
- export type { UserClaims } from '../types/user-claims';
12
+ export { getUserAgent } from '../utils/get-user-agent';
9
13
  export { useFocusTrap } from '../hooks/use-focus-trap';
10
- export type { TFunction, TOptions } from '../types/l10n';
11
14
  export { useThemeHooks } from '../hooks/use-theme-hooks';
12
15
  export { useOutsideClick } from '../hooks/use-outside-click';
13
- export type { SelectOption, SelectProps } from '../types/select';
14
16
  export { useActiveSectionId } from '../hooks/use-active-section-id';
15
17
  export { useModalScrollLock } from '../hooks/use-modal-scroll-lock';
18
+ export { useSearchDialog } from '../hooks/search/use-search-dialog';
19
+ export { useDialogHotKeys } from '../hooks/use-dialog-hotkeys';
16
20
  export { SecurityVariablesEnvSuffix } from '../constants/environments';
17
21
  export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
18
22
  export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
@@ -1,12 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENTITY_RELATION_TYPES = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
4
- // This file is intended to provide selective imports from @redocly/theme/core
5
- // to reduce bundle size by exporting only functionality used in the @redocly/openapi-docs package.
6
- //
7
- // This selective import approach will help with tree shaking and reduce
8
- // the overall bundle size by avoiding importing the entire theme package
9
- // when only specific functionality is needed.
3
+ exports.ENTITY_RELATION_TYPES = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
10
4
  var dom_1 = require("../utils/dom");
11
5
  Object.defineProperty(exports, "IS_BROWSER", { enumerable: true, get: function () { return dom_1.IS_BROWSER; } });
12
6
  var urls_1 = require("../utils/urls");
@@ -26,6 +20,8 @@ var media_css_1 = require("../utils/media-css");
26
20
  Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return media_css_1.breakpoints; } });
27
21
  var args_typecheck_1 = require("../utils/args-typecheck");
28
22
  Object.defineProperty(exports, "isPrimitive", { enumerable: true, get: function () { return args_typecheck_1.isPrimitive; } });
23
+ var get_user_agent_1 = require("../utils/get-user-agent");
24
+ Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return get_user_agent_1.getUserAgent; } });
29
25
  var use_focus_trap_1 = require("../hooks/use-focus-trap");
30
26
  Object.defineProperty(exports, "useFocusTrap", { enumerable: true, get: function () { return use_focus_trap_1.useFocusTrap; } });
31
27
  var use_theme_hooks_1 = require("../hooks/use-theme-hooks");
@@ -36,6 +32,10 @@ var use_active_section_id_1 = require("../hooks/use-active-section-id");
36
32
  Object.defineProperty(exports, "useActiveSectionId", { enumerable: true, get: function () { return use_active_section_id_1.useActiveSectionId; } });
37
33
  var use_modal_scroll_lock_1 = require("../hooks/use-modal-scroll-lock");
38
34
  Object.defineProperty(exports, "useModalScrollLock", { enumerable: true, get: function () { return use_modal_scroll_lock_1.useModalScrollLock; } });
35
+ var use_search_dialog_1 = require("../hooks/search/use-search-dialog");
36
+ Object.defineProperty(exports, "useSearchDialog", { enumerable: true, get: function () { return use_search_dialog_1.useSearchDialog; } });
37
+ var use_dialog_hotkeys_1 = require("../hooks/use-dialog-hotkeys");
38
+ Object.defineProperty(exports, "useDialogHotKeys", { enumerable: true, get: function () { return use_dialog_hotkeys_1.useDialogHotKeys; } });
39
39
  var environments_1 = require("../constants/environments");
40
40
  Object.defineProperty(exports, "SecurityVariablesEnvSuffix", { enumerable: true, get: function () { return environments_1.SecurityVariablesEnvSuffix; } });
41
41
  var type_guards_1 = require("../utils/type-guards");
@@ -56,7 +56,7 @@ function addLeadingSlash(url) {
56
56
  return url.startsWith('/') ? url : `/${url}`;
57
57
  }
58
58
  function removeTrailingSlash(url) {
59
- return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
59
+ return url.endsWith('/') && url !== '/' ? url.substring(0, url.length - 1) : url;
60
60
  }
61
61
  function removeLeadingSlash(url) {
62
62
  return url.startsWith('/') ? url.substring(1) : url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.58.0-next.2",
3
+ "version": "0.58.0-next.4",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -88,7 +88,7 @@
88
88
  "react-calendar": "5.1.0",
89
89
  "react-date-picker": "11.0.0",
90
90
  "@redocly/realm-asyncapi-sdk": "0.4.0-next.1",
91
- "@redocly/config": "0.29.1"
91
+ "@redocly/config": "0.31.0"
92
92
  },
93
93
  "scripts": {
94
94
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -102,7 +102,9 @@ export function Catalog(props: CatalogProps): JSX.Element {
102
102
  <CatalogPageDescription>
103
103
  <CatalogTitleWrapper>
104
104
  <CatalogTitle data-translation-key={catalogConfig?.titleTranslationKey}>
105
- {translate(catalogConfig?.titleTranslationKey)}{' '}
105
+ {catalogConfig?.titleTranslationKey
106
+ ? translate(catalogConfig?.titleTranslationKey)
107
+ : catalogConfig?.slug}{' '}
106
108
  </CatalogTitle>
107
109
  <CounterTag borderless>{entitiesCounter}</CounterTag>
108
110
  </CatalogTitleWrapper>
@@ -46,7 +46,7 @@ export function CatalogEntityApiDescriptionRelations({
46
46
  }: CatalogEntityApiDescriptionRelationsProps): JSX.Element {
47
47
  return (
48
48
  <div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations">
49
- <Tabs forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
49
+ <Tabs key={entity.id} forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
50
50
  <TabItem
51
51
  label="Operations"
52
52
  icon={<MoleculesIcon />}
@@ -306,13 +306,16 @@ export function SearchDialog({ onClose, className }: SearchDialogProps): JSX.Ele
306
306
  aria-selected="true"
307
307
  >
308
308
  <AiStarsIcon
309
+ style={{ flexShrink: 0 }}
309
310
  color="var(--search-ai-icon-color)"
310
311
  size="36px"
311
312
  background="var(--search-ai-icon-bg-color)"
312
313
  margin="0 var(--spacing-md) 0 0"
313
314
  borderRadius="var(--border-radius-lg)"
314
315
  />
315
- <Typography fontWeight="var(--font-weight-semibold)">{query}</Typography>
316
+ <QueryWrapper>
317
+ <Typography fontWeight="var(--font-weight-semibold)">{query}</Typography>
318
+ </QueryWrapper>
316
319
  <Typography>- {translate('search.ai.label', 'Ask AI assistant')}</Typography>
317
320
  <ReturnKeyIcon color="var(--search-item-text-color)" />
318
321
  </SearchWithAI>
@@ -484,10 +487,10 @@ const SearchDialogWrapper = styled.div`
484
487
  border-radius: 0;
485
488
 
486
489
  @media screen and (max-width: ${breakpoints.small}) {
487
- min-height: -webkit-fill-available !important;
488
- min-height: 100dvh !important;
489
- height: auto !important;
490
- width: 100vw !important;
490
+ min-height: -webkit-fill-available;
491
+ min-height: 100dvh;
492
+ height: 100dvh;
493
+ width: 100vw;
491
494
  }
492
495
 
493
496
  @media screen and (min-width: ${breakpoints.small}) {
@@ -539,6 +542,8 @@ const SearchDialogBodyMainView = styled.div`
539
542
 
540
543
  const SearchDialogBodyFilterView = styled.div`
541
544
  overflow: scroll;
545
+ max-width: var(--search-filter-width);
546
+ width: 100%;
542
547
  `;
543
548
 
544
549
  const SearchDialogFooter = styled.footer`
@@ -673,3 +678,7 @@ const SearchWithAI = styled.div`
673
678
  margin-right: var(--spacing-xs);
674
679
  }
675
680
  `;
681
+
682
+ const QueryWrapper = styled.div`
683
+ word-break: break-word;
684
+ `;
@@ -66,7 +66,8 @@ export function SearchFilter({
66
66
  }
67
67
 
68
68
  const SearchFilterWrapper = styled.div`
69
- width: var(--search-filter-width);
69
+ width: 100%;
70
+ max-width: var(--search-filter-width);
70
71
  display: flex;
71
72
  flex-direction: column;
72
73
  padding: var(--search-filter-padding);
@@ -21,7 +21,7 @@ export function useCatalogTableViewRow({
21
21
  }
22
22
 
23
23
  return Object.values(entitiesCatalogConfig.catalogs ?? {}).find((catalog) => {
24
- return catalog.includes?.some((include) => include.type === entityType);
24
+ return catalog?.includes?.some((include) => include.type === entityType);
25
25
  });
26
26
  };
27
27
 
@@ -25,6 +25,12 @@ export function useActiveSectionId(
25
25
  setItemId('');
26
26
  return;
27
27
  }
28
+
29
+ if (window.scrollY <= 0) {
30
+ setItemId(sections[0].getAttribute('data-section-id') || '');
31
+ return;
32
+ }
33
+
28
34
  for (let i = 0; i < sections.length; i++) {
29
35
  const section = sections[i];
30
36
  const rect = section.getBoundingClientRect();
@@ -58,4 +58,9 @@ export const useTelemetryFallback = () => ({
58
58
  sendAsyncapiDocsMessageClickedMessage: () => {},
59
59
  sendAsyncapiDocsServerModalOpenedMessage: () => {},
60
60
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => {},
61
+ sendGraphqlDocsViewedMessage: () => {},
62
+ sendGraphqlDocsPerformanceMetricsMessage: () => {},
63
+ sendGraphqlDocsReferencedInLinkClickedMessage: () => {},
64
+ sendGraphqlDocsRequiredScopesModalOpenedMessage: () => {},
65
+ sendGraphqlDocsDownloadDefinitionClickedMessage: () => {},
61
66
  });
@@ -4,6 +4,10 @@
4
4
  // This selective import approach will help with tree shaking and reduce
5
5
  // the overall bundle size by avoiding importing the entire theme package
6
6
  // when only specific functionality is needed.
7
+ export type { UserClaims } from '../types/user-claims';
8
+ export type { SearchDocument, SearchItemData, OperationParameter } from '../types/search';
9
+ export type { TFunction, TOptions } from '../types/l10n';
10
+ export type { SelectOption, SelectProps } from '../types/select';
7
11
  export { IS_BROWSER } from '../utils/dom';
8
12
  export {
9
13
  addLeadingSlash,
@@ -18,14 +22,14 @@ export { useMount } from '../hooks/use-mount';
18
22
  export { GlobalStyle } from '../styles/global';
19
23
  export { breakpoints } from '../utils/media-css';
20
24
  export { isPrimitive } from '../utils/args-typecheck';
21
- export type { UserClaims } from '../types/user-claims';
25
+ export { getUserAgent } from '../utils/get-user-agent';
22
26
  export { useFocusTrap } from '../hooks/use-focus-trap';
23
- export type { TFunction, TOptions } from '../types/l10n';
24
27
  export { useThemeHooks } from '../hooks/use-theme-hooks';
25
28
  export { useOutsideClick } from '../hooks/use-outside-click';
26
- export type { SelectOption, SelectProps } from '../types/select';
27
29
  export { useActiveSectionId } from '../hooks/use-active-section-id';
28
30
  export { useModalScrollLock } from '../hooks/use-modal-scroll-lock';
31
+ export { useSearchDialog } from '../hooks/search/use-search-dialog';
32
+ export { useDialogHotKeys } from '../hooks/use-dialog-hotkeys';
29
33
  export { SecurityVariablesEnvSuffix } from '../constants/environments';
30
34
  export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
31
35
  export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
@@ -54,8 +54,9 @@ export function addLeadingSlash(url: string): string {
54
54
  }
55
55
 
56
56
  export function removeTrailingSlash(url: string): string {
57
- return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
57
+ return url.endsWith('/') && url !== '/' ? url.substring(0, url.length - 1) : url;
58
58
  }
59
+
59
60
  export function removeLeadingSlash(url: string): string {
60
61
  return url.startsWith('/') ? url.substring(1) : url;
61
62
  }