@redocly/theme 0.64.0-next.2 → 0.64.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.
- package/lib/components/Admonition/Admonition.d.ts +1 -1
- package/lib/components/Admonition/Admonition.js +2 -0
- package/lib/components/Admonition/variables.dark.js +3 -0
- package/lib/components/Admonition/variables.js +13 -0
- package/lib/components/Button/variables.dark.js +2 -2
- package/lib/components/Button/variables.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +3 -1
- package/lib/components/Catalog/CatalogTags.js +5 -2
- package/lib/components/Filter/variables.js +1 -1
- package/lib/components/LanguagePicker/LanguagePicker.js +5 -6
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/Menu/variables.dark.js +2 -0
- package/lib/components/Menu/variables.js +4 -3
- package/lib/components/Search/SearchAiMessage.js +9 -6
- package/lib/components/SvgViewer/SvgViewer.js +0 -3
- package/lib/components/SvgViewer/variables.js +1 -1
- package/lib/components/Switch/variables.dark.js +2 -2
- package/lib/components/Switch/variables.js +1 -1
- package/lib/components/TableOfContent/TableOfContent.js +1 -0
- package/lib/components/TableOfContent/variables.js +3 -2
- package/lib/components/Toast/Toast.d.ts +14 -0
- package/lib/components/Toast/Toast.js +239 -0
- package/lib/components/Toast/variables.d.ts +1 -0
- package/lib/components/Toast/variables.js +64 -0
- package/lib/components/Tooltip/JsTooltip.js +1 -1
- package/lib/core/constants/search.d.ts +3 -3
- package/lib/core/constants/toast.d.ts +1 -0
- package/lib/core/constants/toast.js +5 -0
- package/lib/core/contexts/MarkdownLinkContext.d.ts +5 -0
- package/lib/core/contexts/MarkdownLinkContext.js +6 -0
- package/lib/core/contexts/Toast/ToastContext.d.ts +2 -0
- package/lib/core/contexts/Toast/ToastContext.js +6 -0
- package/lib/core/contexts/Toast/ToastProvider.d.ts +3 -0
- package/lib/core/contexts/Toast/ToastProvider.js +156 -0
- package/lib/core/contexts/index.d.ts +3 -0
- package/lib/core/contexts/index.js +3 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-toast-logic.d.ts +18 -0
- package/lib/core/hooks/use-toast-logic.js +141 -0
- package/lib/core/hooks/use-toast.d.ts +11 -0
- package/lib/core/hooks/use-toast.js +17 -0
- package/lib/core/styles/dark.js +33 -40
- package/lib/core/styles/global.js +56 -54
- package/lib/core/styles/palette.dark.js +15 -30
- package/lib/core/styles/palette.js +130 -134
- package/lib/core/types/hooks.d.ts +2 -9
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +2 -1
- package/lib/core/types/toast.d.ts +23 -0
- package/lib/core/types/toast.js +3 -0
- package/lib/core/utils/get-auto-dismiss-duration.d.ts +2 -0
- package/lib/core/utils/get-auto-dismiss-duration.js +15 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/CheckboxIcon/CheckboxIcon.js +6 -4
- package/lib/icons/CheckboxIcon/variables.dark.js +2 -1
- package/lib/icons/CheckboxIcon/variables.js +3 -3
- package/lib/icons/IdeaIcon/IdeaIcon.d.ts +9 -0
- package/lib/icons/IdeaIcon/IdeaIcon.js +24 -0
- package/lib/icons/NewChatIcon/NewChatIcon.d.ts +11 -0
- package/lib/icons/NewChatIcon/NewChatIcon.js +25 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/markdoc/attributes/diagram-file.d.ts +5 -0
- package/lib/markdoc/attributes/diagram-file.js +16 -0
- package/lib/markdoc/components/Diagram/Diagram.d.ts +15 -0
- package/lib/markdoc/components/Diagram/Diagram.js +135 -0
- package/lib/markdoc/components/Diagram/variables.d.ts +1 -0
- package/lib/markdoc/components/Diagram/variables.js +15 -0
- package/lib/markdoc/components/MarkdownLink/MarkdownLink.d.ts +7 -0
- package/lib/markdoc/components/MarkdownLink/MarkdownLink.js +61 -0
- package/lib/markdoc/components/Tabs/variables.js +3 -3
- package/lib/markdoc/components/default.d.ts +2 -2
- package/lib/markdoc/components/default.js +2 -2
- package/lib/markdoc/default.d.ts +7 -0
- package/lib/markdoc/default.js +3 -0
- package/lib/markdoc/tags/admonition.js +1 -1
- package/lib/markdoc/tags/diagram.d.ts +2 -0
- package/lib/markdoc/tags/diagram.js +63 -0
- package/package.json +3 -3
- package/src/components/Admonition/Admonition.tsx +3 -1
- package/src/components/Admonition/variables.dark.ts +3 -0
- package/src/components/Admonition/variables.ts +13 -0
- package/src/components/Button/variables.dark.ts +2 -2
- package/src/components/Button/variables.ts +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +3 -1
- package/src/components/Catalog/CatalogTags.tsx +6 -1
- package/src/components/Filter/variables.ts +1 -1
- package/src/components/LanguagePicker/LanguagePicker.tsx +5 -5
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/Menu/MenuItem.tsx +5 -1
- package/src/components/Menu/variables.dark.ts +2 -0
- package/src/components/Menu/variables.ts +4 -3
- package/src/components/Search/SearchAiMessage.tsx +15 -10
- package/src/components/SvgViewer/SvgViewer.tsx +0 -4
- package/src/components/SvgViewer/variables.ts +1 -1
- package/src/components/Switch/variables.dark.ts +2 -2
- package/src/components/Switch/variables.ts +1 -1
- package/src/components/TableOfContent/TableOfContent.tsx +1 -0
- package/src/components/TableOfContent/variables.ts +3 -2
- package/src/components/Toast/Toast.tsx +289 -0
- package/src/components/Toast/variables.ts +61 -0
- package/src/components/Tooltip/JsTooltip.tsx +1 -1
- package/src/core/constants/search.ts +2 -3
- package/src/core/constants/toast.ts +1 -0
- package/src/core/contexts/MarkdownLinkContext.tsx +9 -0
- package/src/core/contexts/Toast/ToastContext.tsx +5 -0
- package/src/core/contexts/Toast/ToastProvider.tsx +206 -0
- package/src/core/contexts/index.ts +3 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-toast-logic.ts +203 -0
- package/src/core/hooks/use-toast.ts +47 -0
- package/src/core/styles/dark.ts +5 -12
- package/src/core/styles/global.ts +28 -26
- package/src/core/styles/palette.dark.ts +15 -30
- package/src/core/styles/palette.ts +130 -134
- package/src/core/types/hooks.ts +2 -7
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +9 -9
- package/src/core/types/search.ts +2 -1
- package/src/core/types/toast.ts +28 -0
- package/src/core/utils/get-auto-dismiss-duration.ts +20 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +26 -17
- package/src/icons/CheckboxIcon/variables.dark.ts +2 -1
- package/src/icons/CheckboxIcon/variables.ts +3 -3
- package/src/icons/IdeaIcon/IdeaIcon.tsx +32 -0
- package/src/icons/NewChatIcon/NewChatIcon.tsx +39 -0
- package/src/index.ts +4 -0
- package/src/markdoc/attributes/diagram-file.ts +9 -0
- package/src/markdoc/components/Diagram/Diagram.tsx +173 -0
- package/src/markdoc/components/Diagram/variables.ts +12 -0
- package/src/markdoc/components/MarkdownLink/MarkdownLink.tsx +21 -0
- package/src/markdoc/components/Tabs/variables.ts +3 -3
- package/src/markdoc/components/default.ts +2 -2
- package/src/markdoc/default.ts +3 -0
- package/src/markdoc/tags/admonition.ts +1 -1
- package/src/markdoc/tags/diagram.ts +73 -0
- package/lib/components/SvgViewer/variables.dark.d.ts +0 -1
- package/lib/components/SvgViewer/variables.dark.js +0 -8
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.d.ts +0 -7
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.js +0 -95
- package/lib/markdoc/components/ExcalidrawDiagram/variables.d.ts +0 -1
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.d.ts +0 -1
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.js +0 -8
- package/lib/markdoc/components/ExcalidrawDiagram/variables.js +0 -15
- package/lib/markdoc/components/Mermaid/Mermaid.d.ts +0 -9
- package/lib/markdoc/components/Mermaid/Mermaid.js +0 -96
- package/lib/markdoc/components/Mermaid/variables.d.ts +0 -1
- package/lib/markdoc/components/Mermaid/variables.dark.d.ts +0 -1
- package/lib/markdoc/components/Mermaid/variables.dark.js +0 -8
- package/lib/markdoc/components/Mermaid/variables.js +0 -16
- package/src/components/SvgViewer/variables.dark.ts +0 -5
- package/src/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.tsx +0 -85
- package/src/markdoc/components/ExcalidrawDiagram/variables.dark.ts +0 -5
- package/src/markdoc/components/ExcalidrawDiagram/variables.ts +0 -12
- package/src/markdoc/components/Mermaid/Mermaid.tsx +0 -95
- package/src/markdoc/components/Mermaid/variables.dark.ts +0 -5
- package/src/markdoc/components/Mermaid/variables.ts +0 -13
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,95 +0,0 @@
|
|
|
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 MermaidProps = {
|
|
11
|
-
diagramHtml: string;
|
|
12
|
-
'data-source'?: string;
|
|
13
|
-
'data-hash'?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function Mermaid({
|
|
18
|
-
diagramHtml,
|
|
19
|
-
'data-source': dataSource,
|
|
20
|
-
'data-hash': dataHash,
|
|
21
|
-
className,
|
|
22
|
-
}: MermaidProps): JSX.Element {
|
|
23
|
-
const { useTranslate } = useThemeHooks();
|
|
24
|
-
const { translate } = useTranslate();
|
|
25
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
-
|
|
27
|
-
const open = () => setIsOpen(true);
|
|
28
|
-
const close = () => setIsOpen(false);
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<>
|
|
32
|
-
<Wrapper
|
|
33
|
-
className={concatClassNames('mermaid-wrapper', className)}
|
|
34
|
-
dangerouslySetInnerHTML={{ __html: diagramHtml }}
|
|
35
|
-
data-component-name="Markdoc/Mermaid/Mermaid"
|
|
36
|
-
data-source={dataSource}
|
|
37
|
-
data-hash={dataHash}
|
|
38
|
-
onClick={open}
|
|
39
|
-
onKeyDown={(e) => e.key === 'Enter' || (e.key === ' ' && open())}
|
|
40
|
-
role="button"
|
|
41
|
-
tabIndex={0}
|
|
42
|
-
aria-label={translate('mermaid.openFullscreen', 'Click to open diagram in fullscreen')}
|
|
43
|
-
/>
|
|
44
|
-
<SvgViewer
|
|
45
|
-
isOpen={isOpen}
|
|
46
|
-
onClose={close}
|
|
47
|
-
labels={{
|
|
48
|
-
zoomIn: translate('mermaid.zoomIn', 'Zoom in'),
|
|
49
|
-
zoomOut: translate('mermaid.zoomOut', 'Zoom out'),
|
|
50
|
-
fitToView: translate('mermaid.reset', 'Fit to view'),
|
|
51
|
-
close: translate('mermaid.close', 'Close'),
|
|
52
|
-
dialogLabel: translate('mermaid.viewer', 'Mermaid diagram viewer'),
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<ViewerContent dangerouslySetInnerHTML={{ __html: diagramHtml }} />
|
|
56
|
-
</SvgViewer>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const Wrapper = styled.div`
|
|
62
|
-
background-color: var(--mermaid-bg-color);
|
|
63
|
-
border-radius: var(--mermaid-border-radius);
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
transition: box-shadow 0.2s ease;
|
|
66
|
-
|
|
67
|
-
&:hover,
|
|
68
|
-
&:focus {
|
|
69
|
-
outline: none;
|
|
70
|
-
box-shadow: 0 0 0 2px var(--border-color-input-focus);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
* {
|
|
74
|
-
font-family: var(--mermaid-font-family) !important;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.mermaid > svg {
|
|
78
|
-
font-size: var(--font-size-base) !important;
|
|
79
|
-
max-width: 100%;
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
const ViewerContent = styled.div`
|
|
84
|
-
background-color: var(--mermaid-bg-color);
|
|
85
|
-
|
|
86
|
-
* {
|
|
87
|
-
font-family: var(--mermaid-font-family) !important;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.mermaid > svg {
|
|
91
|
-
font-size: var(--font-size-base) !important;
|
|
92
|
-
display: block;
|
|
93
|
-
max-width: none !important;
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { css } from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const mermaid = css`
|
|
4
|
-
/**
|
|
5
|
-
* @tokens Mermaid
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
--mermaid-bg-color: var(--bg-color-raised); // @presenter Color
|
|
9
|
-
--mermaid-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
10
|
-
--mermaid-font-family: var(--font-family-base); // @presenter FontFamily
|
|
11
|
-
|
|
12
|
-
// @tokens End
|
|
13
|
-
`;
|