@redocly/theme 0.56.0-next.2 → 0.56.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.
Files changed (175) hide show
  1. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +1 -0
  2. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +9 -0
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -6
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +0 -1
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +2 -1
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +11 -5
  7. package/lib/components/Catalog/CatalogEntityIcon.js +6 -0
  8. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -4
  9. package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.d.ts +3 -0
  10. package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.js +11 -0
  11. package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +4 -0
  12. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +4 -0
  13. package/lib/components/Catalog/CatalogTagsWithTooltip.js +2 -3
  14. package/lib/components/Catalog/variables.js +2 -2
  15. package/lib/components/Tags/CounterTag.d.ts +1 -1
  16. package/lib/components/Tags/HttpTag.d.ts +1 -1
  17. package/lib/core/constants/catalog.d.ts +3 -0
  18. package/lib/core/constants/catalog.js +55 -1
  19. package/lib/core/constants/index.d.ts +5 -5
  20. package/lib/core/constants/index.js +5 -5
  21. package/lib/core/constants/search.d.ts +1 -1
  22. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.d.ts +1 -1
  23. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +1 -1
  24. package/lib/core/contexts/ThemeDataContext.d.ts +1 -1
  25. package/lib/core/contexts/index.d.ts +3 -3
  26. package/lib/core/contexts/index.js +3 -3
  27. package/lib/core/hoc/index.d.ts +1 -1
  28. package/lib/core/hoc/index.js +1 -1
  29. package/lib/core/hooks/__mocks__/index.d.ts +28 -28
  30. package/lib/core/hooks/__mocks__/index.js +28 -28
  31. package/lib/core/hooks/catalog/useCatalogEntities.d.ts +1 -1
  32. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +2 -2
  33. package/lib/core/hooks/code-walkthrough/use-code-panel.js +6 -5
  34. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +8 -5
  35. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -1
  36. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +9 -9
  37. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +2 -2
  38. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +4 -3
  39. package/lib/core/hooks/code-walkthrough/use-renderable-files.js +6 -4
  40. package/lib/core/hooks/feedback/use-report-dialog.js +4 -3
  41. package/lib/core/hooks/index.d.ts +42 -42
  42. package/lib/core/hooks/index.js +42 -42
  43. package/lib/core/hooks/menu/use-menu-item-expanded.d.ts +1 -1
  44. package/lib/core/hooks/menu/use-mobile-menu-items.d.ts +1 -1
  45. package/lib/core/hooks/menu/use-mobile-menu-items.js +13 -12
  46. package/lib/core/hooks/menu/use-mobile-menu-levels.d.ts +1 -1
  47. package/lib/core/hooks/menu/use-mobile-menu-levels.js +8 -7
  48. package/lib/core/hooks/menu/use-nested-menu.d.ts +1 -1
  49. package/lib/core/hooks/menu/use-nested-menu.js +8 -6
  50. package/lib/core/hooks/search/use-recent-searches.js +3 -3
  51. package/lib/core/hooks/search/use-search-dialog.js +4 -3
  52. package/lib/core/hooks/search/use-search-filter.d.ts +1 -1
  53. package/lib/core/hooks/search/use-suggested-pages.js +2 -2
  54. package/lib/core/hooks/use-active-page-version.js +2 -2
  55. package/lib/core/hooks/use-active-section-id.js +2 -2
  56. package/lib/core/hooks/use-color-switcher.js +4 -3
  57. package/lib/core/hooks/use-input-key-commands.js +2 -2
  58. package/lib/core/hooks/use-language-picker.d.ts +1 -1
  59. package/lib/core/hooks/use-language-picker.js +4 -4
  60. package/lib/core/hooks/use-mobile-menu.js +2 -2
  61. package/lib/core/hooks/use-navbar-height.js +3 -3
  62. package/lib/core/hooks/use-page-versions.js +2 -2
  63. package/lib/core/hooks/use-product-picker.js +2 -2
  64. package/lib/core/hooks/use-theme-config.js +2 -2
  65. package/lib/core/hooks/use-theme-hooks.d.ts +1 -1
  66. package/lib/core/hooks/use-theme-hooks.js +2 -2
  67. package/lib/core/hooks/use-time-ago.js +2 -2
  68. package/lib/core/hooks/use-user-teams.js +2 -2
  69. package/lib/core/index.d.ts +7 -7
  70. package/lib/core/index.js +7 -7
  71. package/lib/core/openapi/index.d.ts +18 -0
  72. package/lib/core/openapi/index.js +48 -0
  73. package/lib/core/styles/global.js +1 -1
  74. package/lib/core/styles/index.d.ts +2 -2
  75. package/lib/core/styles/index.js +2 -2
  76. package/lib/core/templates/Markdown.d.ts +1 -1
  77. package/lib/core/templates/Markdown.js +8 -6
  78. package/lib/core/types/catalog.d.ts +6 -2
  79. package/lib/core/types/code-walkthrough.d.ts +1 -1
  80. package/lib/core/types/feedback.d.ts +1 -1
  81. package/lib/core/types/filter.d.ts +1 -1
  82. package/lib/core/types/hooks.d.ts +11 -3
  83. package/lib/core/types/index.d.ts +18 -18
  84. package/lib/core/types/index.js +18 -18
  85. package/lib/core/types/search.d.ts +1 -1
  86. package/lib/core/types/sidebar.d.ts +1 -1
  87. package/lib/core/utils/download-code-walkthrough.js +6 -4
  88. package/lib/core/utils/get-code-walkthrough-file-text.js +4 -3
  89. package/lib/core/utils/index.d.ts +35 -35
  90. package/lib/core/utils/index.js +35 -35
  91. package/lib/core/utils/load-and-navigate.js +2 -2
  92. package/lib/core/utils/match-code-walkthrough-conditions.js +3 -3
  93. package/lib/core/utils/menu.d.ts +3 -2
  94. package/lib/core/utils/menu.js +12 -12
  95. package/lib/core/utils/toc.d.ts +1 -1
  96. package/lib/core/utils/type-guards.d.ts +1 -1
  97. package/lib/core/utils/type-guards.js +5 -5
  98. package/lib/core/utils/urls.d.ts +1 -1
  99. package/lib/core/utils/urls.js +2 -2
  100. package/lib/markdoc/components/Tabs/TabList.js +2 -0
  101. package/package.json +1 -1
  102. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +15 -0
  103. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +8 -2
  104. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +0 -1
  105. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +16 -3
  106. package/src/components/Catalog/CatalogEntityIcon.tsx +6 -0
  107. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +5 -4
  108. package/src/components/Catalog/CatalogTableView/CatalogEntityRelationCell.tsx +19 -0
  109. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +4 -0
  110. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +4 -0
  111. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +7 -15
  112. package/src/components/Catalog/variables.ts +2 -2
  113. package/src/core/constants/catalog.ts +58 -0
  114. package/src/core/constants/index.ts +5 -5
  115. package/src/core/constants/search.ts +1 -1
  116. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.tsx +1 -1
  117. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +1 -1
  118. package/src/core/contexts/ThemeDataContext.tsx +3 -3
  119. package/src/core/contexts/index.ts +3 -3
  120. package/src/core/hoc/index.ts +1 -1
  121. package/src/core/hooks/__mocks__/index.ts +28 -28
  122. package/src/core/hooks/catalog/useCatalogEntities.ts +1 -1
  123. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
  124. package/src/core/hooks/code-walkthrough/use-code-panel.ts +3 -5
  125. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +4 -6
  126. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +4 -3
  127. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +3 -3
  128. package/src/core/hooks/code-walkthrough/use-renderable-files.ts +4 -6
  129. package/src/core/hooks/feedback/use-report-dialog.ts +3 -2
  130. package/src/core/hooks/index.ts +42 -42
  131. package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -1
  132. package/src/core/hooks/menu/use-mobile-menu-items.ts +4 -7
  133. package/src/core/hooks/menu/use-mobile-menu-levels.ts +3 -2
  134. package/src/core/hooks/menu/use-nested-menu.ts +5 -3
  135. package/src/core/hooks/search/use-recent-searches.ts +1 -1
  136. package/src/core/hooks/search/use-search-dialog.ts +2 -1
  137. package/src/core/hooks/search/use-search-filter.ts +1 -1
  138. package/src/core/hooks/search/use-suggested-pages.ts +1 -1
  139. package/src/core/hooks/use-active-page-version.ts +1 -1
  140. package/src/core/hooks/use-active-section-id.ts +1 -1
  141. package/src/core/hooks/use-codeblock-tabs-controls.ts +1 -1
  142. package/src/core/hooks/use-color-switcher.ts +2 -1
  143. package/src/core/hooks/use-input-key-commands.ts +1 -1
  144. package/src/core/hooks/use-language-picker.ts +3 -3
  145. package/src/core/hooks/use-mobile-menu.ts +1 -1
  146. package/src/core/hooks/use-navbar-height.ts +1 -1
  147. package/src/core/hooks/use-page-versions.ts +1 -1
  148. package/src/core/hooks/use-product-picker.ts +1 -1
  149. package/src/core/hooks/use-theme-config.ts +2 -2
  150. package/src/core/hooks/use-theme-hooks.ts +2 -2
  151. package/src/core/hooks/use-time-ago.ts +3 -2
  152. package/src/core/hooks/use-user-teams.ts +1 -1
  153. package/src/core/index.ts +7 -7
  154. package/src/core/openapi/index.ts +31 -0
  155. package/src/core/styles/global.ts +2 -1
  156. package/src/core/styles/index.ts +2 -2
  157. package/src/core/templates/Markdown.tsx +8 -4
  158. package/src/core/types/catalog.ts +15 -2
  159. package/src/core/types/code-walkthrough.ts +1 -1
  160. package/src/core/types/feedback.ts +6 -6
  161. package/src/core/types/filter.ts +1 -1
  162. package/src/core/types/hooks.ts +17 -16
  163. package/src/core/types/index.ts +18 -18
  164. package/src/core/types/search.ts +1 -1
  165. package/src/core/types/sidebar.ts +1 -1
  166. package/src/core/utils/download-code-walkthrough.ts +3 -5
  167. package/src/core/utils/get-code-walkthrough-file-text.ts +2 -1
  168. package/src/core/utils/index.ts +35 -35
  169. package/src/core/utils/load-and-navigate.ts +1 -1
  170. package/src/core/utils/match-code-walkthrough-conditions.ts +1 -1
  171. package/src/core/utils/menu.ts +4 -3
  172. package/src/core/utils/toc.ts +1 -1
  173. package/src/core/utils/type-guards.ts +2 -2
  174. package/src/core/utils/urls.ts +2 -2
  175. package/src/markdoc/components/Tabs/TabList.tsx +1 -0
@@ -3,13 +3,14 @@ import styled from 'styled-components';
3
3
 
4
4
  import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
5
5
  import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
6
- import { BffCatalogRelatedEntity } from '@redocly/theme/core/types';
6
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
7
7
 
8
- export type CatalogEntityCellProps = {
9
- entity: BffCatalogRelatedEntity;
8
+ type Entity = Pick<BffCatalogEntity, 'type' | 'title' | 'summary'>;
9
+ export type CatalogEntityCellProps<T extends Entity> = {
10
+ entity: T;
10
11
  };
11
12
 
12
- export function CatalogEntityCell({ entity }: CatalogEntityCellProps) {
13
+ export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
13
14
  return (
14
15
  <EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
15
16
  <IconContainer>
@@ -0,0 +1,19 @@
1
+ import type { BffCatalogRelatedEntity } from '@redocly/theme/core/types';
2
+
3
+ import { reverseRelationMap } from '@redocly/theme/core/constants';
4
+
5
+ export type CatalogEntityRelationCellProps = Pick<
6
+ BffCatalogRelatedEntity,
7
+ 'relationType' | 'relationRole'
8
+ >;
9
+
10
+ export function CatalogEntityRelationCell({
11
+ relationType,
12
+ relationRole,
13
+ }: CatalogEntityRelationCellProps) {
14
+ if (relationRole === 'source') {
15
+ return reverseRelationMap[relationType];
16
+ }
17
+
18
+ return relationType;
19
+ }
@@ -52,6 +52,10 @@ export const getEntityTagColor = (type: EntityType): string => {
52
52
  return 'yellow';
53
53
  case 'api-description':
54
54
  return 'sky';
55
+ case 'data-schema':
56
+ return 'sky';
57
+ case 'api-operation':
58
+ return 'sky';
55
59
  default:
56
60
  const exhaustiveCheck: never = type;
57
61
  throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
@@ -47,6 +47,10 @@ export const getEntityTagColor = (type: EntityType): string => {
47
47
  return 'yellow';
48
48
  case 'api-description':
49
49
  return 'sky';
50
+ case 'data-schema':
51
+ return 'sky';
52
+ case 'api-operation':
53
+ return 'sky';
50
54
  default:
51
55
  const exhaustiveCheck: never = type;
52
56
  throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
@@ -35,21 +35,13 @@ export function CatalogTagsWithTooltip({
35
35
 
36
36
  if (items.length <= itemsToShow) {
37
37
  return (
38
- <TooltipComponent
39
- tip={items.join(', ')}
40
- placement="bottom"
41
- className="catalog"
42
- width="400px"
43
- disabled={items.join(', ').length <= CATALOG_TAG_MAX_LENGTH}
44
- >
45
- <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
46
- {items.map((item, index) => (
47
- <Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
48
- <CatalogHighlight>{item}</CatalogHighlight>
49
- </Tag>
50
- ))}
51
- </CatalogTagsWrapper>
52
- </TooltipComponent>
38
+ <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
39
+ {items.map((item, index) => (
40
+ <Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
41
+ <CatalogHighlight>{item}</CatalogHighlight>
42
+ </Tag>
43
+ ))}
44
+ </CatalogTagsWrapper>
53
45
  );
54
46
  }
55
47
 
@@ -254,7 +254,7 @@ export const catalog = css`
254
254
  */
255
255
  --catalog-table-border-color: var(--border-color-primary);
256
256
  --catalog-table-header-bg-color: var(--bg-color-secondary);
257
- --catalog-table-header-font-weight: var(--font-weight-semibold);
257
+ --catalog-table-header-font-weight: var(--font-weight-medium);
258
258
  --catalog-table-header-cell-padding: 5px 8px;
259
259
  --catalog-table-cell-padding: 5px 8px;
260
260
  --catalog-table-row-hover-bg-color: var(--bg-color-hover, rgba(0, 0, 0, 0.04));
@@ -286,7 +286,7 @@ export const catalog = css`
286
286
  */
287
287
  --catalog-table-entity-title-font-size: var(--catalog-card-title-font-size);
288
288
  --catalog-table-entity-title-line-height: var(--line-height-lg);
289
- --catalog-table-entity-title-font-weight: var(--font-weight-semibold);
289
+ --catalog-table-entity-title-font-weight: var(--font-weight-medium);
290
290
 
291
291
  /**
292
292
  * @tokens Catalog table description
@@ -1 +1,59 @@
1
+ import type { EntityRelationType } from '../types/catalog';
2
+
1
3
  export const CATALOG_TAG_MAX_LENGTH = 15;
4
+
5
+ export const ENTITY_RELATION_TYPES = [
6
+ 'partOf',
7
+ 'hasParts',
8
+ 'creates',
9
+ 'createdBy',
10
+ 'owns',
11
+ 'ownedBy',
12
+ 'implements',
13
+ 'implementedBy',
14
+ 'dependsOn',
15
+ 'dependencyOf',
16
+ 'uses',
17
+ 'usedBy',
18
+ 'produces',
19
+ 'consumes',
20
+ 'linksTo',
21
+ 'supersedes',
22
+ 'supersededBy',
23
+ 'compatibleWith',
24
+ 'extends',
25
+ 'extendedBy',
26
+ 'relatesTo',
27
+ 'hasMember',
28
+ 'memberOf',
29
+ 'triggers',
30
+ 'triggeredBy',
31
+ ] as const;
32
+
33
+ export const reverseRelationMap: Record<EntityRelationType, EntityRelationType> = {
34
+ partOf: 'hasParts',
35
+ hasParts: 'partOf',
36
+ creates: 'createdBy',
37
+ createdBy: 'creates',
38
+ owns: 'ownedBy',
39
+ ownedBy: 'owns',
40
+ implements: 'implementedBy',
41
+ implementedBy: 'implements',
42
+ dependsOn: 'dependencyOf',
43
+ dependencyOf: 'dependsOn',
44
+ uses: 'usedBy',
45
+ usedBy: 'uses',
46
+ produces: 'consumes',
47
+ consumes: 'produces',
48
+ linksTo: 'linksTo',
49
+ supersedes: 'supersededBy',
50
+ supersededBy: 'supersedes',
51
+ compatibleWith: 'compatibleWith',
52
+ extends: 'extendedBy',
53
+ extendedBy: 'extends',
54
+ relatesTo: 'relatesTo',
55
+ hasMember: 'memberOf',
56
+ memberOf: 'hasMember',
57
+ triggers: 'triggeredBy',
58
+ triggeredBy: 'triggers',
59
+ } as const;
@@ -1,5 +1,5 @@
1
- export * from '@redocly/theme/core/constants/common';
2
- export * from '@redocly/theme/core/constants/environments';
3
- export * from '@redocly/theme/core/constants/code-walkthrough';
4
- export * from '@redocly/theme/core/constants/search';
5
- export * from '@redocly/theme/core/constants/catalog';
1
+ export * from './common';
2
+ export * from './environments';
3
+ export * from './code-walkthrough';
4
+ export * from './search';
5
+ export * from './catalog';
@@ -1,4 +1,4 @@
1
- import type { AiSearchErrorConfig } from '@redocly/theme/core/types';
1
+ import type { AiSearchErrorConfig } from '../types/search';
2
2
 
3
3
  export enum AiSearchError {
4
4
  Unauthorized = 'ai_search_unauthorized',
@@ -1,6 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
 
3
- import type { WalkthroughControlsState } from '@redocly/theme/core/hooks';
3
+ import type { WalkthroughControlsState } from '../../hooks/code-walkthrough/use-code-walkthrough-controls';
4
4
 
5
5
  export const CodeWalkthroughControlsStateContext = createContext<WalkthroughControlsState>({
6
6
  activeFilters: [],
@@ -1,6 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
 
3
- import type { WalkthroughStepsState } from '@redocly/theme/core/types';
3
+ import type { WalkthroughStepsState } from '../../types/code-walkthrough';
4
4
 
5
5
  export const CodeWalkthroughStepsContext = createContext<WalkthroughStepsState>({
6
6
  markers: {},
@@ -1,9 +1,9 @@
1
1
  import { createContext } from 'react';
2
2
 
3
3
  import type { JSX } from 'react';
4
- import type { ThemeHooks } from '@redocly/theme/core/types';
5
- import type { LinkProps } from '@redocly/theme/components/Link/Link';
6
- import type { UiAccessibleConfig } from '@redocly/theme/config';
4
+ import type { ThemeHooks } from '../types/hooks';
5
+ import type { LinkProps } from '../../components/Link/Link';
6
+ import type { UiAccessibleConfig } from '../../config';
7
7
 
8
8
  export interface ThemeDataTransferObject {
9
9
  hooks: ThemeHooks;
@@ -1,3 +1,3 @@
1
- export * from '@redocly/theme/core/contexts/ThemeDataContext';
2
- export * from '@redocly/theme/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext';
3
- export * from '@redocly/theme/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext';
1
+ export * from './ThemeDataContext';
2
+ export * from './CodeWalkthrough/CodeWalkthroughControlsContext';
3
+ export * from './CodeWalkthrough/CodeWalkthroughStepsContext';
@@ -1 +1 @@
1
- export * from '@redocly/theme/core/hoc/typedMemo';
1
+ export * from './typedMemo';
@@ -1,28 +1,28 @@
1
- export * from '@redocly/theme/core/hooks/__mocks__/use-theme-config';
2
- export * from '@redocly/theme/core/hooks/__mocks__/use-theme-hooks';
3
- export * from '@redocly/theme/core/hooks/__mocks__/use-mobile-menu';
4
- export * from '@redocly/theme/core/hooks/__mocks__/use-controlled-state';
5
- export * from '@redocly/theme/core/hooks/__mocks__/search/use-recent-searches';
6
- export * from '@redocly/theme/core/hooks/__mocks__/search/use-suggested-pages';
7
- export * from '@redocly/theme/core/hooks/__mocks__/search/use-search-filter';
8
- export * from '@redocly/theme/core/hooks/menu/__mocks__/use-mobile-menu-items';
9
- export * from '@redocly/theme/core/hooks/menu/use-collapse';
10
- export * from '@redocly/theme/core/hooks/use-active-heading';
11
- export * from '@redocly/theme/core/hooks/use-control';
12
- export * from '@redocly/theme/core/hooks/use-dialog-hotkeys';
13
- export * from '@redocly/theme/core/hooks/use-full-height';
14
- export * from '@redocly/theme/core/hooks/use-modal-scroll-lock';
15
- export * from '@redocly/theme/core/hooks/use-mount';
16
- export * from '@redocly/theme/core/hooks/use-outside-click';
17
- export * from '@redocly/theme/core/hooks/use-unmount';
18
- export * from '@redocly/theme/core/hooks/use-color-switcher';
19
- export * from '@redocly/theme/core/hooks/menu/use-nested-menu';
20
- export * from '@redocly/theme/core/hooks/menu/use-menu-item-expanded';
21
- export * from '@redocly/theme/core/hooks/menu/use-mobile-menu-levels';
22
- export * from '@redocly/theme/core/hooks/feedback/use-report-dialog';
23
- export * from '@redocly/theme/core/hooks/use-product-picker';
24
- export * from '@redocly/theme/core/hooks/search/use-search-dialog';
25
- export * from '@redocly/theme/core/hooks/use-language-picker';
26
- export * from '@redocly/theme/core/hooks/__mocks__/use-element-size';
27
- export * from '@redocly/theme/core/hooks/__mocks__/use-time-ago';
28
- export * from '@redocly/theme/core/hooks/__mocks__/use-input-key-commands';
1
+ export * from './use-theme-config';
2
+ export * from './use-theme-hooks';
3
+ export * from './use-mobile-menu';
4
+ export * from './use-controlled-state';
5
+ export * from './search/use-recent-searches';
6
+ export * from './search/use-suggested-pages';
7
+ export * from './search/use-search-filter';
8
+ export * from '../menu/__mocks__/use-mobile-menu-items';
9
+ export * from '../menu/use-collapse';
10
+ export * from '../use-active-heading';
11
+ export * from '../use-control';
12
+ export * from '../use-dialog-hotkeys';
13
+ export * from '../use-full-height';
14
+ export * from '../use-modal-scroll-lock';
15
+ export * from '../use-mount';
16
+ export * from '../use-outside-click';
17
+ export * from '../use-unmount';
18
+ export * from '../use-color-switcher';
19
+ export * from '../menu/use-nested-menu';
20
+ export * from '../menu/use-menu-item-expanded';
21
+ export * from '../menu/use-mobile-menu-levels';
22
+ export * from '../feedback/use-report-dialog';
23
+ export * from '../use-product-picker';
24
+ export * from '../search/use-search-dialog';
25
+ export * from '../use-language-picker';
26
+ export * from './use-element-size';
27
+ export * from './use-time-ago';
28
+ export * from './use-input-key-commands';
@@ -1,4 +1,4 @@
1
- import type { UseCatalogEntitiesProps } from '@redocly/theme';
1
+ import type { UseCatalogEntitiesProps } from '../../types/catalog';
2
2
 
3
3
  export function useCatalogEntities({ entitiesTypes, excludedEntities }: UseCatalogEntitiesProps) {
4
4
  const initialTypesWithoutAll = entitiesTypes.filter((type) => type !== 'all');
@@ -1,6 +1,6 @@
1
1
  import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
2
2
 
3
- import { getPathPrefix } from '../../utils';
3
+ import { getPathPrefix } from '../../utils/urls';
4
4
 
5
5
  type CatalogTableViewRowProps = {
6
6
  entityKey: string;
@@ -6,11 +6,9 @@ import type {
6
6
  CodeWalkthroughConditionsObject,
7
7
  } from '@redocly/config';
8
8
 
9
- import {
10
- CodeWalkthroughControlsStateContext,
11
- CodeWalkthroughStepsContext,
12
- } from '@redocly/theme/core/contexts';
13
- import { useThemeHooks } from '@redocly/theme/core/hooks';
9
+ import { CodeWalkthroughControlsStateContext } from '../../contexts/CodeWalkthrough/CodeWalkthroughControlsContext';
10
+ import { CodeWalkthroughStepsContext } from '../../contexts/CodeWalkthrough/CodeWalkthroughStepsContext';
11
+ import { useThemeHooks } from '../use-theme-hooks';
14
12
 
15
13
  const ACTIVE_FILE_MOCK = {
16
14
  content: [],
@@ -12,12 +12,10 @@ import type {
12
12
  CodeWalkthroughControlsState,
13
13
  } from '@redocly/config';
14
14
 
15
- import {
16
- downloadCodeWalkthrough,
17
- matchCodeWalkthroughConditions,
18
- getCodeWalkthroughFileText,
19
- replaceInputsWithValue,
20
- } from '@redocly/theme/core/utils';
15
+ import { downloadCodeWalkthrough } from '../../utils/download-code-walkthrough';
16
+ import { matchCodeWalkthroughConditions } from '../../utils/match-code-walkthrough-conditions';
17
+ import { getCodeWalkthroughFileText } from '../../utils/get-code-walkthrough-file-text';
18
+ import { replaceInputsWithValue } from '../../utils/replace-inputs-with-value';
21
19
 
22
20
  export type ActiveFilter = {
23
21
  id: string;
@@ -2,10 +2,11 @@ import { useCallback, useEffect, useRef, useState, useMemo } from 'react';
2
2
  import { useLocation, useNavigate } from 'react-router-dom';
3
3
 
4
4
  import type { CodeWalkthroughStepAttr } from '@redocly/config';
5
- import type { ActiveStep, MarkerArea, WalkthroughStepsState } from '@redocly/theme/core/types';
5
+ import type { ActiveStep, WalkthroughStepsState } from '../../types/code-walkthrough';
6
+ import type { MarkerArea } from '../../types/marker';
6
7
 
7
- import { getAdjacentValues, insertAt, isBrowser, removeElement } from '@redocly/theme/core/utils';
8
- import { ACTIVE_STEP_QUERY_PARAM } from '@redocly/theme/core/constants';
8
+ import { getAdjacentValues, insertAt, isBrowser, removeElement } from '../../utils/js-utils';
9
+ import { ACTIVE_STEP_QUERY_PARAM } from '../../constants/code-walkthrough';
9
10
 
10
11
  type CodeWalkthroughStep = CodeWalkthroughStepAttr & {
11
12
  compRef?: HTMLElement;
@@ -3,13 +3,13 @@ import type {
3
3
  CodeWalkthroughStepAttr,
4
4
  CodeWalkthroughAttr,
5
5
  } from '@redocly/config';
6
- import type { WalkthroughStepsState } from '@redocly/theme/core/types';
6
+ import type { WalkthroughStepsState } from '../../types/code-walkthrough';
7
7
 
8
8
  import {
9
- useCodeWalkthroughSteps,
10
9
  useCodeWalkthroughControls,
11
10
  type WalkthroughControlsState,
12
- } from '@redocly/theme/core/hooks';
11
+ } from './use-code-walkthrough-controls';
12
+ import { useCodeWalkthroughSteps } from './use-code-walkthrough-steps';
13
13
 
14
14
  export type WalkthroughState = {
15
15
  stepsState: WalkthroughStepsState;
@@ -1,13 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
 
3
3
  import type { CodeWalkthroughFile } from '@redocly/config';
4
- import type { IconProps } from '@redocly/theme/icons/types';
4
+ import type { IconProps } from '../../../icons/types';
5
5
 
6
- import {
7
- getFileIconByExt,
8
- removeLeadingSlash,
9
- findClosestCommonDirectory,
10
- } from '@redocly/theme/core/utils';
6
+ import { findClosestCommonDirectory } from '../../utils/find-closest-common-directory';
7
+ import { getFileIconByExt } from '../../utils/get-file-icon';
8
+ import { removeLeadingSlash } from '../../utils/urls';
11
9
 
12
10
  export type RenderableFile = CodeWalkthroughFile & {
13
11
  FileIcon: React.FunctionComponent<IconProps>;
@@ -1,8 +1,9 @@
1
1
  import { useState } from 'react';
2
2
 
3
- import type { ReportDialogProps } from '@redocly/theme/components/Feedback/ReportDialog';
3
+ import type { ReportDialogProps } from '../../../components/Feedback/ReportDialog';
4
4
 
5
- import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
5
+ import { useThemeHooks } from '../use-theme-hooks';
6
+ import { useThemeConfig } from '../use-theme-config';
6
7
 
7
8
  export type ReportButtonProps = {
8
9
  onClick: () => void;
@@ -1,42 +1,42 @@
1
- export * from '@redocly/theme/core/hooks/use-theme-config';
2
- export * from '@redocly/theme/core/hooks/use-control';
3
- export * from '@redocly/theme/core/hooks/use-mount';
4
- export * from '@redocly/theme/core/hooks/use-unmount';
5
- export * from '@redocly/theme/core/hooks/use-active-heading';
6
- export * from '@redocly/theme/core/hooks/use-active-section-id';
7
- export * from '@redocly/theme/core/hooks/use-dialog-hotkeys';
8
- export * from '@redocly/theme/core/hooks/use-full-height';
9
- export * from '@redocly/theme/core/hooks/use-navbar-height';
10
- export * from '@redocly/theme/core/hooks/use-outside-click';
11
- export * from '@redocly/theme/core/hooks/use-theme-hooks';
12
- export * from '@redocly/theme/core/hooks/use-mobile-menu';
13
- export * from '@redocly/theme/core/hooks/use-modal-scroll-lock';
14
- export * from '@redocly/theme/core/hooks/use-color-switcher';
15
- export * from '@redocly/theme/core/hooks/search/use-recent-searches';
16
- export * from '@redocly/theme/core/hooks/search/use-suggested-pages';
17
- export * from '@redocly/theme/core/hooks/menu/use-nested-menu';
18
- export * from '@redocly/theme/core/hooks/menu/use-menu-item-expanded';
19
- export * from '@redocly/theme/core/hooks/menu/use-mobile-menu-items';
20
- export * from '@redocly/theme/core/hooks/menu/use-mobile-menu-levels';
21
- export * from '@redocly/theme/core/hooks/menu/use-collapse';
22
- export * from '@redocly/theme/core/hooks/feedback/use-report-dialog';
23
- export * from '@redocly/theme/core/hooks/use-tabs';
24
- export * from '@redocly/theme/core/hooks/use-focus-trap';
25
- export * from '@redocly/theme/core/hooks/use-language-picker';
26
- export * from '@redocly/theme/core/hooks/use-product-picker';
27
- export * from '@redocly/theme/core/hooks/search/use-search-dialog';
28
- export * from '@redocly/theme/core/hooks/search/use-search-filter';
29
- export * from '@redocly/theme/core/hooks/use-controlled-state';
30
- export * from '@redocly/theme/core/hooks/use-codeblock-tabs-controls';
31
- export * from '@redocly/theme/core/hooks/code-walkthrough/use-code-walkthrough';
32
- export * from '@redocly/theme/core/hooks/code-walkthrough/use-code-walkthrough-steps';
33
- export * from '@redocly/theme/core/hooks/code-walkthrough/use-code-walkthrough-controls';
34
- export * from '@redocly/theme/core/hooks/code-walkthrough/use-code-panel';
35
- export * from '@redocly/theme/core/hooks/code-walkthrough/use-renderable-files';
36
- export * from '@redocly/theme/core/hooks/use-element-size';
37
- export * from '@redocly/theme/core/hooks/use-time-ago';
38
- export * from '@redocly/theme/core/hooks/use-input-key-commands';
39
- export * from '@redocly/theme/core/hooks/catalog/useCatalogEntities';
40
- export * from '@redocly/theme/core/hooks/use-active-page-version';
41
- export * from '@redocly/theme/core/hooks/use-page-versions';
42
- export * from '@redocly/theme/core/hooks/use-user-teams';
1
+ export * from './use-theme-config';
2
+ export * from './use-control';
3
+ export * from './use-mount';
4
+ export * from './use-unmount';
5
+ export * from './use-active-heading';
6
+ export * from './use-active-section-id';
7
+ export * from './use-dialog-hotkeys';
8
+ export * from './use-full-height';
9
+ export * from './use-navbar-height';
10
+ export * from './use-outside-click';
11
+ export * from './use-theme-hooks';
12
+ export * from './use-mobile-menu';
13
+ export * from './use-modal-scroll-lock';
14
+ export * from './use-color-switcher';
15
+ export * from './search/use-recent-searches';
16
+ export * from './search/use-suggested-pages';
17
+ export * from './menu/use-nested-menu';
18
+ export * from './menu/use-menu-item-expanded';
19
+ export * from './menu/use-mobile-menu-items';
20
+ export * from './menu/use-mobile-menu-levels';
21
+ export * from './menu/use-collapse';
22
+ export * from './feedback/use-report-dialog';
23
+ export * from './use-tabs';
24
+ export * from './use-focus-trap';
25
+ export * from './use-language-picker';
26
+ export * from './use-product-picker';
27
+ export * from './search/use-search-dialog';
28
+ export * from './search/use-search-filter';
29
+ export * from './use-controlled-state';
30
+ export * from './use-codeblock-tabs-controls';
31
+ export * from './code-walkthrough/use-code-walkthrough';
32
+ export * from './code-walkthrough/use-code-walkthrough-steps';
33
+ export * from './code-walkthrough/use-code-walkthrough-controls';
34
+ export * from './code-walkthrough/use-code-panel';
35
+ export * from './code-walkthrough/use-renderable-files';
36
+ export * from './use-element-size';
37
+ export * from './use-time-ago';
38
+ export * from './use-input-key-commands';
39
+ export * from './catalog/useCatalogEntities';
40
+ export * from './use-active-page-version';
41
+ export * from './use-page-versions';
42
+ export * from './use-user-teams';
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from 'react';
2
2
 
3
3
  import type { Dispatch, SetStateAction } from 'react';
4
- import type { ItemState } from '@redocly/theme/core/types';
4
+ import type { ItemState } from '../../types/sidebar';
5
5
 
6
6
  function isItemExpanded(item: ItemState) {
7
7
  return (
@@ -2,13 +2,10 @@ import { useLocation } from 'react-router-dom';
2
2
 
3
3
  import type { ResolvedNavItem } from '@redocly/config';
4
4
 
5
- import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
6
- import { MobileMenuType } from '@redocly/theme/core/constants';
7
- import {
8
- buildLanguagesGroup,
9
- buildVersionSection,
10
- mapNavbarItems,
11
- } from '@redocly/theme/core/utils';
5
+ import { useThemeHooks } from '../use-theme-hooks';
6
+ import { useThemeConfig } from '../use-theme-config';
7
+ import { MobileMenuType } from '../../constants/common';
8
+ import { buildLanguagesGroup, buildVersionSection, mapNavbarItems } from '../../utils/menu';
12
9
 
13
10
  const MENU_SEPARATOR: ResolvedNavItem = {
14
11
  type: 'separator',
@@ -3,8 +3,9 @@ import { useLocation } from 'react-router-dom';
3
3
 
4
4
  import type { ResolvedNavItem } from '@redocly/config';
5
5
 
6
- import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
7
- import { MobileMenuType } from '@redocly/theme/core/constants';
6
+ import { useThemeHooks } from '../use-theme-hooks';
7
+ import { useThemeConfig } from '../use-theme-config';
8
+ import { MobileMenuType } from '../../constants/common';
8
9
 
9
10
  export const useMobileMenuLevels = () => {
10
11
  const { useTranslate, useCurrentProduct, usePageVersions, useSidebarItems } = useThemeHooks();
@@ -1,10 +1,12 @@
1
1
  import { useNavigate, useLocation } from 'react-router-dom';
2
2
  import { useCallback, useEffect, useState } from 'react';
3
3
 
4
- import type { MenuItemProps } from '@redocly/theme/core/types';
4
+ import type { MenuItemProps } from '../../types/sidebar';
5
5
 
6
- import { useMenuItemExpanded, useCollapse } from '@redocly/theme/core/hooks';
7
- import { loadAndNavigate, withoutPathPrefix } from '@redocly/theme/core/utils';
6
+ import { useMenuItemExpanded } from './use-menu-item-expanded';
7
+ import { useCollapse } from './use-collapse';
8
+ import { loadAndNavigate } from '../../utils/load-and-navigate';
9
+ import { withoutPathPrefix } from '../../utils/urls';
8
10
 
9
11
  type NestedMenuProps = MenuItemProps & {
10
12
  labelRef?: React.RefObject<HTMLElement | null>;
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useSyncExternalStore } from 'react';
2
2
 
3
- import { isBrowser } from '@redocly/theme/core/utils';
3
+ import { isBrowser } from '../../utils/js-utils';
4
4
 
5
5
  const RECENT_SEARCHES_KEY = 'recentSearches';
6
6
  const RECENT_SEARCHES_LIMIT = 5;
@@ -2,7 +2,8 @@ import { useEffect, useCallback, useState } from 'react';
2
2
  import { useLocation } from 'react-router-dom';
3
3
  import hotkeys from 'hotkeys-js';
4
4
 
5
- import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
5
+ import { useThemeHooks } from '../use-theme-hooks';
6
+ import { useThemeConfig } from '../use-theme-config';
6
7
 
7
8
  export function useSearchDialog() {
8
9
  const [isOpen, setIsOpen] = useState(false);
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useState } from 'react';
2
2
 
3
- import type { SearchFilterItem } from '@redocly/theme/core/types';
3
+ import type { SearchFilterItem } from '../../types/search';
4
4
 
5
5
  export function useSearchFilter(
6
6
  filter: SearchFilterItem[],
@@ -1,4 +1,4 @@
1
- import { useThemeConfig } from '@redocly/theme/core/hooks';
1
+ import { useThemeConfig } from '../use-theme-config';
2
2
 
3
3
  export const useSuggestedPages = () => {
4
4
  const themeSettings = useThemeConfig();
@@ -1,4 +1,4 @@
1
- import { useThemeHooks } from '@redocly/theme/core/hooks';
1
+ import { useThemeHooks } from './use-theme-hooks';
2
2
 
3
3
  export function useActivePageVersion(): string | undefined {
4
4
  const { usePageVersions } = useThemeHooks();
@@ -3,7 +3,7 @@ import throttle from 'lodash.throttle';
3
3
 
4
4
  import type { Location } from 'react-router-dom';
5
5
 
6
- import { useNavbarHeight } from '@redocly/theme/core/hooks';
6
+ import { useNavbarHeight } from './use-navbar-height';
7
7
 
8
8
  export type UseActiveSectionIdReturnType = string;
9
9
 
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState, useCallback, useMemo } from 'react';
2
2
 
3
- import type { FileTabs } from '@redocly/theme/components/CodeBlock/CodeBlock';
3
+ import type { FileTabs } from '../../components/CodeBlock/CodeBlock';
4
4
 
5
5
  type CodeBlockTabsProps = {
6
6
  tabs: FileTabs;