@redocly/theme 0.63.0 → 0.64.0-next.1
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/Catalog.js +3 -32
- package/lib/components/Catalog/CatalogActionsRow.d.ts +6 -4
- package/lib/components/Catalog/CatalogActionsRow.js +49 -5
- package/lib/components/Catalog/CatalogEntities.d.ts +0 -1
- package/lib/components/Catalog/CatalogEntities.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +31 -25
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +1 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +2 -2
- package/lib/components/SvgViewer/variables.dark.js +1 -1
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +1 -3
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.js +1 -4
- package/lib/core/styles/dark.js +34 -30
- package/lib/core/styles/global.js +36 -29
- package/lib/core/types/hooks.d.ts +2 -2
- package/lib/icons/ColorPaletteIcon/ColorPaletteIcon.d.ts +9 -0
- package/lib/icons/ColorPaletteIcon/ColorPaletteIcon.js +27 -0
- package/lib/icons/StopIcon/StopIcon.d.ts +9 -0
- package/lib/icons/StopIcon/StopIcon.js +22 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.d.ts +7 -0
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.js +95 -0
- package/lib/markdoc/components/ExcalidrawDiagram/variables.d.ts +1 -0
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.d.ts +1 -0
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.js +8 -0
- package/lib/markdoc/components/ExcalidrawDiagram/variables.js +15 -0
- package/lib/markdoc/components/Mermaid/Mermaid.js +2 -0
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/package.json +2 -2
- package/src/components/Catalog/Catalog.tsx +9 -43
- package/src/components/Catalog/CatalogActionsRow.tsx +25 -7
- package/src/components/Catalog/CatalogEntities.tsx +0 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +39 -31
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +0 -3
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +0 -3
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +0 -3
- package/src/components/SvgViewer/variables.dark.ts +1 -1
- package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +0 -6
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +8 -1
- package/src/core/types/hooks.ts +2 -1
- package/src/icons/ColorPaletteIcon/ColorPaletteIcon.tsx +28 -0
- package/src/icons/StopIcon/StopIcon.tsx +23 -0
- package/src/index.ts +2 -0
- package/src/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.tsx +85 -0
- package/src/markdoc/components/ExcalidrawDiagram/variables.dark.ts +5 -0
- package/src/markdoc/components/ExcalidrawDiagram/variables.ts +12 -0
- package/src/markdoc/components/Mermaid/Mermaid.tsx +2 -0
- package/src/markdoc/components/default.ts +1 -0
|
@@ -14,36 +14,6 @@ import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/C
|
|
|
14
14
|
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
15
15
|
import { CatalogEntityRelationCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityRelationCell';
|
|
16
16
|
|
|
17
|
-
const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
18
|
-
{
|
|
19
|
-
key: 'entity',
|
|
20
|
-
title: 'Entity',
|
|
21
|
-
render: (entity) => <CatalogEntityCell entity={entity} />,
|
|
22
|
-
sortable: true,
|
|
23
|
-
sortKey: 'title',
|
|
24
|
-
width: '2.5fr',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
key: 'type',
|
|
28
|
-
title: 'Type',
|
|
29
|
-
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
30
|
-
sortable: true,
|
|
31
|
-
sortKey: 'type',
|
|
32
|
-
width: '1fr',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
key: 'relationType',
|
|
36
|
-
title: 'Relations',
|
|
37
|
-
render: (entity) => (
|
|
38
|
-
<CatalogEntityRelationCell
|
|
39
|
-
relationType={entity.relationType}
|
|
40
|
-
relationRole={entity.relationRole}
|
|
41
|
-
/>
|
|
42
|
-
),
|
|
43
|
-
width: '1fr',
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
|
|
47
17
|
export type CatalogEntityDefaultRelationsProps = {
|
|
48
18
|
entity: BffCatalogEntity;
|
|
49
19
|
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
@@ -91,7 +61,7 @@ export function CatalogEntityDefaultRelations({
|
|
|
91
61
|
searchQuery={searchQuery}
|
|
92
62
|
setSearchQuery={setSearchQuery}
|
|
93
63
|
heading={shouldShowHeading ? 'Related entities' : undefined}
|
|
94
|
-
columns={
|
|
64
|
+
columns={getRelationsTableColumns(listType)}
|
|
95
65
|
sortOption={sortOption}
|
|
96
66
|
setSortOption={setSortOption}
|
|
97
67
|
handleSortClick={handleSortClick}
|
|
@@ -102,3 +72,41 @@ export function CatalogEntityDefaultRelations({
|
|
|
102
72
|
</div>
|
|
103
73
|
);
|
|
104
74
|
}
|
|
75
|
+
|
|
76
|
+
function getRelationsTableColumns(listType?: ListType): CatalogColumn<BffCatalogRelatedEntity>[] {
|
|
77
|
+
const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
78
|
+
{
|
|
79
|
+
key: 'entity',
|
|
80
|
+
title: 'Entity',
|
|
81
|
+
render: (entity) => <CatalogEntityCell entity={entity} />,
|
|
82
|
+
sortable: true,
|
|
83
|
+
sortKey: 'title',
|
|
84
|
+
width: '2.5fr',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'type',
|
|
88
|
+
title: 'Type',
|
|
89
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
90
|
+
sortable: true,
|
|
91
|
+
sortKey: 'type',
|
|
92
|
+
width: '1fr',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'relationType',
|
|
96
|
+
title: 'Relations',
|
|
97
|
+
render: (entity) => (
|
|
98
|
+
<CatalogEntityRelationCell
|
|
99
|
+
relationType={entity.relationType}
|
|
100
|
+
relationRole={entity.relationRole}
|
|
101
|
+
/>
|
|
102
|
+
),
|
|
103
|
+
width: '1fr',
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
if (listType === 'api-operation' || listType === 'data-schema') {
|
|
108
|
+
return columns.filter((column) => column.key !== 'type');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return columns;
|
|
112
|
+
}
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export function CatalogEntityRelations({
|
|
|
32
32
|
setSearchQuery,
|
|
33
33
|
}: CatalogEntityRelationsProps): JSX.Element | null {
|
|
34
34
|
const { useCatalogSort, useFetchCatalogEntitiesRelations } = useThemeHooks();
|
|
35
|
-
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
|
|
35
|
+
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort('title');
|
|
36
36
|
|
|
37
37
|
const [filter, setFilter] = useState<string | undefined>(ENTITY_DEFAULT_FILTERS[entity.type]);
|
|
38
38
|
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx
CHANGED
|
@@ -86,7 +86,8 @@ export function CatalogEntityRelationsTable({
|
|
|
86
86
|
setSearchQuery={setSearchQuery}
|
|
87
87
|
sortOption={sortOption}
|
|
88
88
|
setSortOption={setSortOption}
|
|
89
|
-
|
|
89
|
+
viewMode="table"
|
|
90
|
+
isDetailsPage={true}
|
|
90
91
|
/>
|
|
91
92
|
<CatalogEntityRelationsTableContent
|
|
92
93
|
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
@@ -95,7 +96,6 @@ export function CatalogEntityRelationsTable({
|
|
|
95
96
|
query={query}
|
|
96
97
|
searchQuery={searchQuery}
|
|
97
98
|
columns={columns}
|
|
98
|
-
setSortOption={setSortOption}
|
|
99
99
|
sortOption={sortOption}
|
|
100
100
|
handleSortClick={handleSortClick}
|
|
101
101
|
isColumnSorted={isColumnSorted}
|
|
@@ -25,7 +25,6 @@ export type CatalogEntityRelationsTableContentProps = {
|
|
|
25
25
|
searchQuery: string;
|
|
26
26
|
columns: CatalogColumn<BffCatalogRelatedEntity>[];
|
|
27
27
|
sortOption: SortOption | null;
|
|
28
|
-
setSortOption: (sortOption: SortOption | null) => void;
|
|
29
28
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
30
29
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
31
30
|
shouldShowLoadMore: boolean;
|
|
@@ -40,7 +39,6 @@ export function CatalogEntityRelationsTableContent({
|
|
|
40
39
|
query,
|
|
41
40
|
searchQuery,
|
|
42
41
|
columns,
|
|
43
|
-
setSortOption,
|
|
44
42
|
sortOption,
|
|
45
43
|
handleSortClick,
|
|
46
44
|
isColumnSorted,
|
|
@@ -57,7 +55,6 @@ export function CatalogEntityRelationsTableContent({
|
|
|
57
55
|
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
58
56
|
catalogConfig={catalogConfig}
|
|
59
57
|
columns={columns}
|
|
60
|
-
setSortOption={setSortOption}
|
|
61
58
|
currentSortOption={sortOption}
|
|
62
59
|
handleSortClick={handleSortClick}
|
|
63
60
|
isColumnSorted={isColumnSorted}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
14
14
|
column: CatalogColumn<T>;
|
|
15
|
-
setSortOption: (sortOption: SortOption | null) => void;
|
|
16
15
|
currentSortOption?: SortOption | null;
|
|
17
16
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
18
17
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
@@ -22,13 +21,11 @@ export const CatalogTableHeaderCell = <T extends BaseEntity>({
|
|
|
22
21
|
column,
|
|
23
22
|
handleSortClick,
|
|
24
23
|
isColumnSorted,
|
|
25
|
-
setSortOption,
|
|
26
24
|
}: CatalogTableHeaderCellProps<T>) => {
|
|
27
25
|
const { handleCellClick, sortKey, isUpActive, isDownActive } = useCatalogTableHeaderCellActions({
|
|
28
26
|
column,
|
|
29
27
|
handleSortClick,
|
|
30
28
|
isColumnSorted,
|
|
31
|
-
setSortOption,
|
|
32
29
|
});
|
|
33
30
|
|
|
34
31
|
return (
|
|
@@ -26,7 +26,6 @@ export type CatalogTableViewProps<T extends BaseEntity> = {
|
|
|
26
26
|
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
27
27
|
catalogConfig: CatalogEntityConfig;
|
|
28
28
|
columns?: CatalogColumn<T>[];
|
|
29
|
-
setSortOption: (sortOption: SortOption | null) => void;
|
|
30
29
|
currentSortOption?: SortOption | null;
|
|
31
30
|
onRowClick?: (entity: T) => void;
|
|
32
31
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
@@ -96,7 +95,6 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
96
95
|
entitiesCatalogConfig,
|
|
97
96
|
catalogConfig,
|
|
98
97
|
columns = baseColumns as CatalogColumn<BaseEntity>[],
|
|
99
|
-
setSortOption,
|
|
100
98
|
currentSortOption,
|
|
101
99
|
onRowClick,
|
|
102
100
|
handleSortClick,
|
|
@@ -114,7 +112,6 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
114
112
|
<CatalogTableHeaderCell<T>
|
|
115
113
|
key={column.key}
|
|
116
114
|
column={column}
|
|
117
|
-
setSortOption={setSortOption}
|
|
118
115
|
currentSortOption={currentSortOption}
|
|
119
116
|
handleSortClick={handleSortClick}
|
|
120
117
|
isColumnSorted={isColumnSorted}
|
|
@@ -3,19 +3,15 @@ import {
|
|
|
3
3
|
CatalogColumn,
|
|
4
4
|
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
5
5
|
|
|
6
|
-
import { SortOption } from '../../types';
|
|
7
|
-
|
|
8
6
|
type CatalogTableHeaderCellActionsProps<T extends BaseEntity> = {
|
|
9
7
|
column: CatalogColumn<T>;
|
|
10
8
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
11
|
-
setSortOption: (sortOption: SortOption | null) => void;
|
|
12
9
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
13
10
|
};
|
|
14
11
|
|
|
15
12
|
export function useCatalogTableHeaderCellActions<T extends BaseEntity>({
|
|
16
13
|
column,
|
|
17
14
|
handleSortClick,
|
|
18
|
-
setSortOption,
|
|
19
15
|
isColumnSorted,
|
|
20
16
|
}: CatalogTableHeaderCellActionsProps<T>) {
|
|
21
17
|
const sortKey = column.sortKey;
|
|
@@ -27,8 +23,6 @@ export function useCatalogTableHeaderCellActions<T extends BaseEntity>({
|
|
|
27
23
|
|
|
28
24
|
if (isDownActive) {
|
|
29
25
|
handleSortClick(sortKey, 'desc');
|
|
30
|
-
} else if (isUpActive) {
|
|
31
|
-
setSortOption(null);
|
|
32
26
|
} else {
|
|
33
27
|
handleSortClick(sortKey, 'asc');
|
|
34
28
|
}
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { css } from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { scorecardDarkMode } from '@redocly/theme/components/Scorecard/variables.dark';
|
|
4
4
|
import { mermaidDarkMode } from '@redocly/theme/markdoc/components/Mermaid/variables.dark'
|
|
5
|
+
import { excalidrawDarkMode } from '@redocly/theme/markdoc/components/ExcalidrawDiagram/variables.dark'
|
|
5
6
|
import { menuDarkMode } from '@redocly/theme/components/Menu/variables.dark';
|
|
6
7
|
import { buttonDarkMode } from '@redocly/theme/components/Button/variables.dark';
|
|
7
8
|
import { aiAssistantButtonDarkMode } from '@redocly/theme/components/Buttons/variables.dark';
|
|
@@ -43,6 +44,8 @@ const replayDarkMode = css`
|
|
|
43
44
|
--replay-runtime-expression-bg-color: rgba(147, 166, 249, 0.16); // @presenter Color
|
|
44
45
|
--replay-operators-color: rgba(168, 143, 88, 1); // @presenter Color
|
|
45
46
|
|
|
47
|
+
--replay-ai-user-message-gradient: linear-gradient(73.52deg, rgba(113, 94, 254, 0.16) 10.13%, rgba(255, 92, 220, 0.16) 87.29%);
|
|
48
|
+
|
|
46
49
|
// @tokens End
|
|
47
50
|
`;
|
|
48
51
|
|
|
@@ -335,6 +338,7 @@ export const darkMode = css`
|
|
|
335
338
|
${statusCodeDarkMode}
|
|
336
339
|
${menuDarkMode}
|
|
337
340
|
${mermaidDarkMode}
|
|
341
|
+
${excalidrawDarkMode}
|
|
338
342
|
${scorecardDarkMode}
|
|
339
343
|
${replayDarkMode}
|
|
340
344
|
${switcherDarkMode}
|
|
@@ -29,6 +29,7 @@ import { markdown } from '@redocly/theme/components/Markdown/variables';
|
|
|
29
29
|
import { banner } from '@redocly/theme/components/Banner/variables';
|
|
30
30
|
import { markdownTabs } from '@redocly/theme/markdoc/components/Tabs/variables';
|
|
31
31
|
import { mermaid } from '@redocly/theme/markdoc/components/Mermaid/variables';
|
|
32
|
+
import { excalidraw } from '@redocly/theme/markdoc/components/ExcalidrawDiagram/variables';
|
|
32
33
|
import { lastUpdated } from '@redocly/theme/components/LastUpdated/variables';
|
|
33
34
|
import { logo } from '@redocly/theme/components/Logo/variables';
|
|
34
35
|
import { statusCode } from '@redocly/theme/components/StatusCode/variables';
|
|
@@ -1167,7 +1168,7 @@ const icon = css`
|
|
|
1167
1168
|
|
|
1168
1169
|
--icon-color-primary: var(--color-warm-grey-11); // @presenter Color
|
|
1169
1170
|
--icon-color-secondary: var(--color-warm-grey-8); // @presenter Color
|
|
1170
|
-
--icon-color-on-color: var(--color-
|
|
1171
|
+
--icon-color-on-color: var(--color-static-white); // @presenter Color
|
|
1171
1172
|
--icon-color-interactive: var(--color-blueberry-6); // @presenter Color
|
|
1172
1173
|
--icon-color-inverse: var(--color-white); // @presenter Color
|
|
1173
1174
|
--icon-color-disabled: var(--color-warm-grey-5); // @presenter Color
|
|
@@ -1251,6 +1252,11 @@ const replay = css`
|
|
|
1251
1252
|
--replay-runtime-expression-bg-color: rgba(54, 90, 249, 0.08); // @presenter Color
|
|
1252
1253
|
--replay-operators-color: rgba(193, 142, 31, 1); // @presenter Color
|
|
1253
1254
|
|
|
1255
|
+
--replay-ai-gradient-soft: linear-gradient(62.6deg, rgba(113, 94, 254, 0.16) 0%, rgba(255, 92, 220, 0.16) 100%);
|
|
1256
|
+
--replay-ai-gradient-disabled: linear-gradient(62.6deg, rgba(113, 94, 254, 0.6) 0%, rgba(255, 92, 220, 0.6) 100%);
|
|
1257
|
+
--replay-ai-user-message-gradient: linear-gradient(73.52deg, rgba(113, 94, 254, 0.08) 10.13%, rgba(255, 92, 220, 0.08) 87.29%);
|
|
1258
|
+
|
|
1259
|
+
--replay-ai-send-button-disabled-border: 1px solid #ffffff33;
|
|
1254
1260
|
// @tokens End
|
|
1255
1261
|
`;
|
|
1256
1262
|
|
|
@@ -1289,6 +1295,7 @@ export const styles = css`
|
|
|
1289
1295
|
${markdown}
|
|
1290
1296
|
${markdownTabs}
|
|
1291
1297
|
${mermaid}
|
|
1298
|
+
${excalidraw}
|
|
1292
1299
|
${menu}
|
|
1293
1300
|
${mobileMenu}
|
|
1294
1301
|
${modal}
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
UseCatalogProps,
|
|
20
20
|
CatalogApiParams,
|
|
21
21
|
CatalogApiResults,
|
|
22
|
+
SortOption,
|
|
22
23
|
} from './catalog';
|
|
23
24
|
import type { UserMenuData } from './user-menu';
|
|
24
25
|
import type { ItemState } from './sidebar';
|
|
@@ -164,7 +165,7 @@ export type ThemeHooks = {
|
|
|
164
165
|
}
|
|
165
166
|
| undefined;
|
|
166
167
|
useCatalog: (props?: UseCatalogProps) => UseCatalogResponse;
|
|
167
|
-
useCatalogSort: () => UseCatalogSortResponse;
|
|
168
|
+
useCatalogSort: (defaultSortOption?: SortOption | null) => UseCatalogSortResponse;
|
|
168
169
|
useCatalogSearch: () => UseCatalogSearchResponse;
|
|
169
170
|
useFetchCatalogEntities: (
|
|
170
171
|
params: CatalogApiParams,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M3.5 5.25456C3.98325 5.25456 4.375 4.86281 4.375 4.37956C4.375 3.89631 3.98325 3.50456 3.5 3.50456C3.01675 3.50456 2.625 3.89631 2.625 4.37956C2.625 4.86281 3.01675 5.25456 3.5 5.25456Z" />
|
|
11
|
+
<path d="M6.125 3.94206C6.60825 3.94206 7 3.55031 7 3.06706C7 2.58381 6.60825 2.19206 6.125 2.19206C5.64175 2.19206 5.25 2.58381 5.25 3.06706C5.25 3.55031 5.64175 3.94206 6.125 3.94206Z" />
|
|
12
|
+
<path d="M8.75 5.25456C9.23325 5.25456 9.625 4.86281 9.625 4.37956C9.625 3.89631 9.23325 3.50456 8.75 3.50456C8.26675 3.50456 7.875 3.89631 7.875 4.37956C7.875 4.86281 8.26675 5.25456 8.75 5.25456Z" />
|
|
13
|
+
<path d="M9.1875 7.87956C9.67075 7.87956 10.0625 7.48781 10.0625 7.00456C10.0625 6.52131 9.67075 6.12956 9.1875 6.12956C8.70425 6.12956 8.3125 6.52131 8.3125 7.00456C8.3125 7.48781 8.70425 7.87956 9.1875 7.87956Z" />
|
|
14
|
+
<path d="M7.4375 10.0671C7.92075 10.0671 8.3125 9.67531 8.3125 9.19206C8.3125 8.70881 7.92075 8.31706 7.4375 8.31706C6.95425 8.31706 6.5625 8.70881 6.5625 9.19206C6.5625 9.67531 6.95425 10.0671 7.4375 10.0671Z" />
|
|
15
|
+
<path d="M6.36125 0.00455826C5.53725 -0.0272487 4.7153 0.107661 3.9447 0.401198C3.17409 0.694735 2.4707 1.14086 1.87668 1.71281C1.28266 2.28477 0.810249 2.97079 0.487771 3.72974C0.165293 4.48869 -0.000611956 5.30494 1.69613e-06 6.12956C-2.00107e-05 6.45389 0.074769 6.77385 0.218553 7.06457C0.362337 7.35528 0.57124 7.60891 0.829017 7.80574C1.08679 8.00256 1.3865 8.13728 1.70482 8.1994C2.02315 8.26153 2.35151 8.24939 2.66438 8.16393L3.15438 8.02831C3.3493 7.9751 3.55388 7.96761 3.75217 8.00643C3.95047 8.04526 4.13712 8.12934 4.29759 8.25212C4.45806 8.37491 4.58801 8.53309 4.67733 8.71433C4.76664 8.89558 4.8129 9.095 4.8125 9.29706V10.9421C4.8125 11.2902 4.95078 11.624 5.19692 11.8701C5.44307 12.1163 5.77691 12.2546 6.125 12.2546C6.94962 12.2552 7.76587 12.0893 8.52482 11.7668C9.28377 11.4443 9.96979 10.9719 10.5417 10.3779C11.1137 9.78386 11.5598 9.08046 11.8534 8.30986C12.1469 7.53926 12.2818 6.71731 12.25 5.89331C12.1865 4.35185 11.5457 2.89063 10.4548 1.79973C9.36393 0.708834 7.90271 0.0680368 6.36125 0.00455826ZM9.90938 9.76518C9.42087 10.2766 8.83352 10.6835 8.18297 10.961C7.53243 11.2385 6.83227 11.3809 6.125 11.3796C6.00897 11.3796 5.89769 11.3335 5.81564 11.2514C5.7336 11.1694 5.6875 11.0581 5.6875 10.9421V9.29706C5.6875 8.7169 5.45703 8.1605 5.0468 7.75026C4.63656 7.34003 4.08016 7.10956 3.5 7.10956C3.30341 7.10991 3.10774 7.13639 2.91813 7.18831L2.42813 7.32393C2.24511 7.37298 2.05326 7.37922 1.86744 7.34216C1.68163 7.3051 1.50685 7.22574 1.35665 7.11024C1.20645 6.99474 1.08488 6.84619 1.00135 6.67612C0.917824 6.50605 0.87459 6.31903 0.875002 6.12956C0.874459 5.42247 1.01676 4.72256 1.29336 4.07181C1.56996 3.42107 1.97517 2.83291 2.48466 2.34261C2.99416 1.85232 3.59745 1.47 4.25833 1.21859C4.91922 0.967181 5.62408 0.851864 6.33063 0.879558C7.64627 0.948081 8.8899 1.50154 9.82146 2.4331C10.753 3.36466 11.3065 4.60829 11.375 5.92393C11.4051 6.63092 11.2907 7.33662 11.0387 7.99785C10.7867 8.65908 10.4024 9.26195 9.90938 9.76956V9.76518Z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const ColorPaletteIcon = styled(Icon).attrs(() => ({
|
|
20
|
+
'data-component-name': 'icons/ColorPaletteIcon/ColorPaletteIcon',
|
|
21
|
+
}))<IconProps>`
|
|
22
|
+
path {
|
|
23
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
height: ${({ size }) => size || '16px'};
|
|
27
|
+
width: ${({ size }) => size || '16px'};
|
|
28
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" fill="none" {...props}>
|
|
10
|
+
<path d="M10.5 3.5V10.5H3.5V3.5H10.5ZM10.5 2.625H3.5C3.26794 2.625 3.04538 2.71719 2.88128 2.88128C2.71719 3.04538 2.625 3.26794 2.625 3.5V10.5C2.625 10.7321 2.71719 10.9546 2.88128 11.1187C3.04538 11.2828 3.26794 11.375 3.5 11.375H10.5C10.7321 11.375 10.9546 11.2828 11.1187 11.1187C11.2828 10.9546 11.375 10.7321 11.375 10.5V3.5C11.375 3.26794 11.2828 3.04538 11.1187 2.88128C10.9546 2.71719 10.7321 2.625 10.5 2.625Z" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const StopIcon = styled(Icon).attrs(() => ({
|
|
15
|
+
'data-component-name': 'icons/StopIcon/StopIcon',
|
|
16
|
+
}))<IconProps>`
|
|
17
|
+
path {
|
|
18
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
height: ${({ size }) => size || '16px'};
|
|
22
|
+
width: ${({ size }) => size || '16px'};
|
|
23
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -274,6 +274,7 @@ export * from '@redocly/theme/icons/FileIcon/FileIcon';
|
|
|
274
274
|
export * from '@redocly/theme/icons/ExportIcon/ExportIcon';
|
|
275
275
|
export * from '@redocly/theme/icons/CertificateIcon/CertificateIcon';
|
|
276
276
|
export * from '@redocly/theme/icons/PlayIcon/PlayIcon';
|
|
277
|
+
export * from '@redocly/theme/icons/StopIcon/StopIcon';
|
|
277
278
|
export * from '@redocly/theme/icons/PlaylistIcon/PlaylistIcon';
|
|
278
279
|
export * from '@redocly/theme/icons/WorkflowAutomationIcon/WorkflowAutomationIcon';
|
|
279
280
|
export * from '@redocly/theme/icons/TaskViewIcon/TaskViewIcon';
|
|
@@ -296,6 +297,7 @@ export * from '@redocly/theme/icons/GenericIcon/GenericIcon';
|
|
|
296
297
|
export * from '@redocly/theme/icons/ShareIcon/ShareIcon';
|
|
297
298
|
export * from '@redocly/theme/icons/HashtagIcon/HashtagIcon';
|
|
298
299
|
export * from '@redocly/theme/icons/FitToViewIcon/FitToViewIcon';
|
|
300
|
+
export * from '@redocly/theme/icons/ColorPaletteIcon/ColorPaletteIcon';
|
|
299
301
|
/* Layouts */
|
|
300
302
|
export * from '@redocly/theme/layouts/RootLayout';
|
|
301
303
|
export * from '@redocly/theme/layouts/PageLayout';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
|
|
6
|
+
import { concatClassNames } from '@redocly/theme/core/utils';
|
|
7
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
|
+
import { SvgViewer } from '@redocly/theme/components/SvgViewer/SvgViewer';
|
|
9
|
+
|
|
10
|
+
type ExcalidrawDiagramProps = {
|
|
11
|
+
diagramHtml: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function ExcalidrawDiagram({ diagramHtml, className }: ExcalidrawDiagramProps): JSX.Element {
|
|
16
|
+
const { useTranslate } = useThemeHooks();
|
|
17
|
+
const { translate } = useTranslate();
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
|
|
20
|
+
const open = () => setIsOpen(true);
|
|
21
|
+
const close = () => setIsOpen(false);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Wrapper
|
|
26
|
+
className={concatClassNames('excalidraw-wrapper', className)}
|
|
27
|
+
dangerouslySetInnerHTML={{ __html: diagramHtml }}
|
|
28
|
+
data-component-name="Markdoc/ExcalidrawDiagram/ExcalidrawDiagram"
|
|
29
|
+
onClick={open}
|
|
30
|
+
onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && open()}
|
|
31
|
+
role="button"
|
|
32
|
+
tabIndex={0}
|
|
33
|
+
aria-label={translate('excalidraw.openFullscreen', 'Click to open diagram in fullscreen')}
|
|
34
|
+
/>
|
|
35
|
+
<SvgViewer
|
|
36
|
+
isOpen={isOpen}
|
|
37
|
+
onClose={close}
|
|
38
|
+
labels={{
|
|
39
|
+
zoomIn: translate('excalidraw.zoomIn', 'Zoom in'),
|
|
40
|
+
zoomOut: translate('excalidraw.zoomOut', 'Zoom out'),
|
|
41
|
+
fitToView: translate('excalidraw.reset', 'Fit to view'),
|
|
42
|
+
close: translate('excalidraw.close', 'Close'),
|
|
43
|
+
dialogLabel: translate('excalidraw.viewer', 'Excalidraw diagram viewer'),
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<ViewerContent dangerouslySetInnerHTML={{ __html: diagramHtml }} />
|
|
47
|
+
</SvgViewer>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const Wrapper = styled.div`
|
|
53
|
+
background-color: var(--excalidraw-bg-color);
|
|
54
|
+
border-radius: var(--excalidraw-border-radius);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition: box-shadow 0.2s ease;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
|
|
59
|
+
&:hover,
|
|
60
|
+
&:focus {
|
|
61
|
+
outline: none;
|
|
62
|
+
box-shadow: 0 0 0 2px var(--border-color-input-focus);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
svg {
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
height: auto;
|
|
68
|
+
display: block;
|
|
69
|
+
|
|
70
|
+
> rect {
|
|
71
|
+
fill: var(--excalidraw-bg-color);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
& + & {
|
|
76
|
+
margin-top: var(--spacing-md);
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const ViewerContent = styled.div`
|
|
81
|
+
svg {
|
|
82
|
+
display: block;
|
|
83
|
+
max-width: none !important;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { css } from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const excalidraw = css`
|
|
4
|
+
/**
|
|
5
|
+
* @tokens Excalidraw
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
--excalidraw-bg-color: var(--bg-color); // @presenter Color
|
|
9
|
+
--excalidraw-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
10
|
+
|
|
11
|
+
// @tokens End
|
|
12
|
+
`;
|
|
@@ -3,6 +3,7 @@ export * from '@redocly/theme/markdoc/components/InlineSvg/InlineSvg';
|
|
|
3
3
|
export * from '@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample';
|
|
4
4
|
export * from '@redocly/theme/markdoc/components/Heading/Heading';
|
|
5
5
|
export * from '@redocly/theme/markdoc/components/Mermaid/Mermaid';
|
|
6
|
+
export * from '@redocly/theme/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram';
|
|
6
7
|
export * from '@redocly/theme/markdoc/components/HtmlBlock/HtmlBlock';
|
|
7
8
|
export * from '@redocly/theme/markdoc/components/Tabs/Tab';
|
|
8
9
|
export * from '@redocly/theme/markdoc/components/Tabs/TabList';
|