@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { RefObject } from 'react';
|
|
4
|
+
import type { ToastItem } from '../types/toast';
|
|
5
|
+
|
|
6
|
+
import { getAutoDismissDuration } from '../utils';
|
|
7
|
+
|
|
8
|
+
const STACK_SHIFT_ENTER_DURATION_MS = 280;
|
|
9
|
+
const STACK_SHIFT_EXIT_DURATION_MS = 200;
|
|
10
|
+
|
|
11
|
+
interface UseToastLogicOptions {
|
|
12
|
+
toast: ToastItem;
|
|
13
|
+
onDismiss: (id: string) => void;
|
|
14
|
+
stackIndex: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface UseToastLogicReturn {
|
|
18
|
+
wrapperRef: RefObject<HTMLDivElement | null>;
|
|
19
|
+
hasDetails: boolean;
|
|
20
|
+
dismissToast: () => void;
|
|
21
|
+
handleMouseEnter: () => void;
|
|
22
|
+
handleMouseLeave: () => void;
|
|
23
|
+
ariaRole: 'alert' | 'status';
|
|
24
|
+
ariaLive: 'assertive' | 'polite';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useToastLogic({
|
|
28
|
+
toast,
|
|
29
|
+
onDismiss,
|
|
30
|
+
stackIndex,
|
|
31
|
+
}: UseToastLogicOptions): UseToastLogicReturn {
|
|
32
|
+
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
33
|
+
const previousTopRef = useRef<number | null>(null);
|
|
34
|
+
const previousStackIndexRef = useRef<number | null>(null);
|
|
35
|
+
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
36
|
+
const startedAtRef = useRef<number | null>(null);
|
|
37
|
+
const remainingTimeRef = useRef<number>(0);
|
|
38
|
+
const animationFrameRef = useRef<number | null>(null);
|
|
39
|
+
const isHoveredRef = useRef<boolean>(false);
|
|
40
|
+
|
|
41
|
+
const hasDetails = Boolean(toast.description);
|
|
42
|
+
const resolvedDuration = useMemo(
|
|
43
|
+
() => getAutoDismissDuration(hasDetails, toast.type, toast.duration),
|
|
44
|
+
[hasDetails, toast.duration, toast.type],
|
|
45
|
+
);
|
|
46
|
+
const ariaRole = toast.type === 'error' ? 'alert' : 'status';
|
|
47
|
+
const ariaLive = toast.type === 'error' ? 'assertive' : 'polite';
|
|
48
|
+
|
|
49
|
+
const clearTimer = useCallback((): void => {
|
|
50
|
+
if (timerRef.current) {
|
|
51
|
+
clearTimeout(timerRef.current);
|
|
52
|
+
timerRef.current = null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
startedAtRef.current = null;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const dismissToast = useCallback((): void => {
|
|
59
|
+
onDismiss(toast.id);
|
|
60
|
+
}, [onDismiss, toast.id]);
|
|
61
|
+
|
|
62
|
+
const startTimer = useCallback(
|
|
63
|
+
(delay: number): void => {
|
|
64
|
+
clearTimer();
|
|
65
|
+
|
|
66
|
+
if (delay <= 0) {
|
|
67
|
+
dismissToast();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
remainingTimeRef.current = delay;
|
|
72
|
+
startedAtRef.current = Date.now();
|
|
73
|
+
timerRef.current = setTimeout(() => {
|
|
74
|
+
dismissToast();
|
|
75
|
+
}, delay);
|
|
76
|
+
},
|
|
77
|
+
[clearTimer, dismissToast],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (toast.isExiting || resolvedDuration === null) {
|
|
82
|
+
clearTimer();
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!isHoveredRef.current) {
|
|
87
|
+
startTimer(resolvedDuration);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return () => {
|
|
91
|
+
clearTimer();
|
|
92
|
+
};
|
|
93
|
+
}, [
|
|
94
|
+
clearTimer,
|
|
95
|
+
resolvedDuration,
|
|
96
|
+
startTimer,
|
|
97
|
+
toast.description,
|
|
98
|
+
toast.isExiting,
|
|
99
|
+
toast.title,
|
|
100
|
+
toast.type,
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
useLayoutEffect(() => {
|
|
104
|
+
const node = wrapperRef.current;
|
|
105
|
+
|
|
106
|
+
if (!node) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
node.style.transition = 'none';
|
|
111
|
+
node.style.transform = '';
|
|
112
|
+
|
|
113
|
+
const currentTop = node.getBoundingClientRect().top;
|
|
114
|
+
const previousTop = previousTopRef.current;
|
|
115
|
+
const previousStackIndex = previousStackIndexRef.current;
|
|
116
|
+
|
|
117
|
+
if (toast.isExiting) {
|
|
118
|
+
previousTopRef.current = currentTop;
|
|
119
|
+
previousStackIndexRef.current = stackIndex;
|
|
120
|
+
|
|
121
|
+
return () => {
|
|
122
|
+
if (animationFrameRef.current !== null) {
|
|
123
|
+
window.cancelAnimationFrame(animationFrameRef.current);
|
|
124
|
+
animationFrameRef.current = null;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const didStackIndexChange = previousStackIndex !== null && previousStackIndex !== stackIndex;
|
|
130
|
+
|
|
131
|
+
if (didStackIndexChange && previousTop !== null && previousTop !== currentTop) {
|
|
132
|
+
const delta = previousTop - currentTop;
|
|
133
|
+
const shiftDuration =
|
|
134
|
+
delta > 0 ? STACK_SHIFT_ENTER_DURATION_MS : STACK_SHIFT_EXIT_DURATION_MS;
|
|
135
|
+
|
|
136
|
+
node.style.transform = `translateY(${delta}px)`;
|
|
137
|
+
node.getBoundingClientRect();
|
|
138
|
+
|
|
139
|
+
animationFrameRef.current = window.requestAnimationFrame(() => {
|
|
140
|
+
animationFrameRef.current = null;
|
|
141
|
+
|
|
142
|
+
if (!wrapperRef.current) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
wrapperRef.current.style.transition = `transform ${shiftDuration}ms ease-out`;
|
|
147
|
+
wrapperRef.current.style.transform = 'translateY(0)';
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
previousTopRef.current = currentTop;
|
|
152
|
+
previousStackIndexRef.current = stackIndex;
|
|
153
|
+
|
|
154
|
+
return () => {
|
|
155
|
+
if (animationFrameRef.current !== null) {
|
|
156
|
+
window.cancelAnimationFrame(animationFrameRef.current);
|
|
157
|
+
animationFrameRef.current = null;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
return () => {
|
|
164
|
+
clearTimer();
|
|
165
|
+
|
|
166
|
+
if (animationFrameRef.current !== null) {
|
|
167
|
+
window.cancelAnimationFrame(animationFrameRef.current);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}, [clearTimer]);
|
|
171
|
+
|
|
172
|
+
const handleMouseEnter = useCallback((): void => {
|
|
173
|
+
isHoveredRef.current = true;
|
|
174
|
+
|
|
175
|
+
if (resolvedDuration === null || startedAtRef.current === null) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const elapsed = Date.now() - startedAtRef.current;
|
|
180
|
+
remainingTimeRef.current = Math.max(remainingTimeRef.current - elapsed, 0);
|
|
181
|
+
clearTimer();
|
|
182
|
+
}, [clearTimer, resolvedDuration]);
|
|
183
|
+
|
|
184
|
+
const handleMouseLeave = useCallback((): void => {
|
|
185
|
+
isHoveredRef.current = false;
|
|
186
|
+
|
|
187
|
+
if (toast.isExiting || resolvedDuration === null) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
startTimer(remainingTimeRef.current || resolvedDuration);
|
|
192
|
+
}, [resolvedDuration, startTimer, toast.isExiting]);
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
wrapperRef,
|
|
196
|
+
hasDetails,
|
|
197
|
+
dismissToast,
|
|
198
|
+
handleMouseEnter,
|
|
199
|
+
handleMouseLeave,
|
|
200
|
+
ariaRole,
|
|
201
|
+
ariaLive,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ToastContextValue, ToastOptions, ToastType } from '../types/toast';
|
|
4
|
+
|
|
5
|
+
import { ToastContext } from '../contexts/Toast/ToastContext';
|
|
6
|
+
|
|
7
|
+
type TypedToastOptions = Omit<ToastOptions, 'title' | 'type'>;
|
|
8
|
+
|
|
9
|
+
interface UseToastReturn extends ToastContextValue {
|
|
10
|
+
info: (title: string, options?: TypedToastOptions) => string;
|
|
11
|
+
success: (title: string, options?: TypedToastOptions) => string;
|
|
12
|
+
warning: (title: string, options?: TypedToastOptions) => string;
|
|
13
|
+
error: (title: string, options?: TypedToastOptions) => string;
|
|
14
|
+
loading: (title: string, options?: TypedToastOptions) => string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createTypedToast(
|
|
18
|
+
showToast: ToastContextValue['showToast'],
|
|
19
|
+
type: ToastType,
|
|
20
|
+
): (title: string, options?: TypedToastOptions) => string {
|
|
21
|
+
return (title: string, options?: TypedToastOptions): string =>
|
|
22
|
+
showToast({
|
|
23
|
+
...options,
|
|
24
|
+
title,
|
|
25
|
+
type,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useToast(): UseToastReturn {
|
|
30
|
+
const context = useContext(ToastContext);
|
|
31
|
+
|
|
32
|
+
if (!context) {
|
|
33
|
+
throw new Error('useToast must be used within a ToastProvider');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return useMemo(
|
|
37
|
+
() => ({
|
|
38
|
+
...context,
|
|
39
|
+
info: createTypedToast(context.showToast, 'info'),
|
|
40
|
+
success: createTypedToast(context.showToast, 'success'),
|
|
41
|
+
warning: createTypedToast(context.showToast, 'warning'),
|
|
42
|
+
error: createTypedToast(context.showToast, 'error'),
|
|
43
|
+
loading: createTypedToast(context.showToast, 'loading'),
|
|
44
|
+
}),
|
|
45
|
+
[context],
|
|
46
|
+
);
|
|
47
|
+
}
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
3
|
import { scorecardDarkMode } from '@redocly/theme/components/Scorecard/variables.dark';
|
|
4
|
-
import { mermaidDarkMode } from '@redocly/theme/markdoc/components/Mermaid/variables.dark'
|
|
5
|
-
import { excalidrawDarkMode } from '@redocly/theme/markdoc/components/ExcalidrawDiagram/variables.dark'
|
|
6
4
|
import { menuDarkMode } from '@redocly/theme/components/Menu/variables.dark';
|
|
7
5
|
import { buttonDarkMode } from '@redocly/theme/components/Button/variables.dark';
|
|
8
6
|
import { aiAssistantButtonDarkMode } from '@redocly/theme/components/Buttons/variables.dark';
|
|
@@ -17,7 +15,6 @@ import { pageActionsDarkMode } from '@redocly/theme/components/PageActions/varia
|
|
|
17
15
|
import { tooltipDarkMode } from '@redocly/theme/components/Tooltip/variables.dark';
|
|
18
16
|
import { bannerDarkMode } from '@redocly/theme/components/Banner/variables.dark';
|
|
19
17
|
import { admonitionDarkMode } from '@redocly/theme/components/Admonition/variables.dark';
|
|
20
|
-
import { svgViewerDarkMode } from '@redocly/theme/components/SvgViewer/variables.dark';
|
|
21
18
|
|
|
22
19
|
import { activeBrandPaletteDark } from './palette.dark';
|
|
23
20
|
|
|
@@ -246,12 +243,6 @@ export const darkMode = css`
|
|
|
246
243
|
--color-black: #ffffff;
|
|
247
244
|
--color-white: #000000;
|
|
248
245
|
|
|
249
|
-
|
|
250
|
-
--color-brand-pink-subtle-bg: var(--color-brand-subtle-1);
|
|
251
|
-
--color-brand-pink-subtle-bg-hover: var(--color-brand-subtle-2);
|
|
252
|
-
--color-brand-pink-subtle-border: var(--color-brand-subtle-3);
|
|
253
|
-
--color-brand-pink-subtle-border-hover: var(--color-brand-subtle-4);
|
|
254
|
-
|
|
255
246
|
--color-hover-base: #32343E;
|
|
256
247
|
|
|
257
248
|
--bg-color: var(--color-warm-grey-2);
|
|
@@ -275,6 +266,11 @@ export const darkMode = css`
|
|
|
275
266
|
--layer-accent-hover: var(--color-warm-grey-10);
|
|
276
267
|
--layer-color-raised: var(--color-warm-grey-3);
|
|
277
268
|
|
|
269
|
+
--color-brand-subtle-bg: var(--color-brand-subtle-1);
|
|
270
|
+
--color-brand-subtle-bg-hover: var(--color-brand-subtle-2);
|
|
271
|
+
--color-brand-subtle-border: var(--color-brand-subtle-3);
|
|
272
|
+
--color-brand-subtle-border-hover: var(--color-brand-subtle-4);
|
|
273
|
+
|
|
278
274
|
/**
|
|
279
275
|
* @tokens Border Colors
|
|
280
276
|
* @presenter Color
|
|
@@ -345,8 +341,6 @@ export const darkMode = css`
|
|
|
345
341
|
${tagDarkMode}
|
|
346
342
|
${statusCodeDarkMode}
|
|
347
343
|
${menuDarkMode}
|
|
348
|
-
${mermaidDarkMode}
|
|
349
|
-
${excalidrawDarkMode}
|
|
350
344
|
${scorecardDarkMode}
|
|
351
345
|
${replayDarkMode}
|
|
352
346
|
${switcherDarkMode}
|
|
@@ -356,7 +350,6 @@ export const darkMode = css`
|
|
|
356
350
|
${tooltipDarkMode}
|
|
357
351
|
${bannerDarkMode}
|
|
358
352
|
${admonitionDarkMode}
|
|
359
|
-
${svgViewerDarkMode}
|
|
360
353
|
${badgesDarkMode}
|
|
361
354
|
${activeBrandPaletteDark}
|
|
362
355
|
/**
|
|
@@ -28,8 +28,7 @@ import { productPicker } from '@redocly/theme/components/Product/variables';
|
|
|
28
28
|
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
|
-
import {
|
|
32
|
-
import { excalidraw } from '@redocly/theme/markdoc/components/ExcalidrawDiagram/variables';
|
|
31
|
+
import { diagram } from '@redocly/theme/markdoc/components/Diagram/variables';
|
|
33
32
|
import { lastUpdated } from '@redocly/theme/components/LastUpdated/variables';
|
|
34
33
|
import { logo } from '@redocly/theme/components/Logo/variables';
|
|
35
34
|
import { statusCode } from '@redocly/theme/components/StatusCode/variables';
|
|
@@ -44,6 +43,7 @@ import { codeWalkthrough } from '@redocly/theme/markdoc/components/CodeWalkthrou
|
|
|
44
43
|
import { skipContent } from '@redocly/theme/components/SkipContent/variables';
|
|
45
44
|
import { pageActions } from '@redocly/theme/components/PageActions/variables';
|
|
46
45
|
import { svgViewer } from '@redocly/theme/components/SvgViewer/variables';
|
|
46
|
+
import { toast } from '@redocly/theme/components/Toast/variables';
|
|
47
47
|
|
|
48
48
|
import { activeBrandPaletteLight } from './palette';
|
|
49
49
|
import { darkMode } from './dark';
|
|
@@ -227,23 +227,6 @@ const themeColors = css`
|
|
|
227
227
|
--color-white: #ffffff;
|
|
228
228
|
--color-static-white: #ffffff;
|
|
229
229
|
|
|
230
|
-
--color-primary-bg: var(--color-brand-1);
|
|
231
|
-
--color-primary-bg-hover: var(--color-brand-2);
|
|
232
|
-
--color-primary-border: var(--color-brand-3);
|
|
233
|
-
--color-primary-border-hover: var(--color-brand-4);
|
|
234
|
-
--color-primary-hover: var(--color-brand-8);
|
|
235
|
-
--color-primary-base: var(--color-brand-6);
|
|
236
|
-
--color-primary-active: var(--color-brand-7);
|
|
237
|
-
--color-primary-text-hover: var(--color-brand-9);
|
|
238
|
-
--color-primary-text: var(--color-brand-8);
|
|
239
|
-
--color-primary-text-active: var(--color-brand-7);
|
|
240
|
-
--color-primary-text-on-color: var(--text-color-on-color);
|
|
241
|
-
|
|
242
|
-
--color-brand-pink-subtle-bg: var(--color-brand-1);
|
|
243
|
-
--color-brand-pink-subtle-bg-hover: var(--color-brand-2);
|
|
244
|
-
--color-brand-pink-subtle-border: var(--color-brand-3);
|
|
245
|
-
--color-brand-pink-subtle-border-hover: var(--color-brand-4);
|
|
246
|
-
|
|
247
230
|
--color-success-bg: var(--color-green-1);
|
|
248
231
|
--color-success-bg-hover: var(--color-green-2);
|
|
249
232
|
--color-success-border: var(--color-green-3);
|
|
@@ -288,6 +271,18 @@ const themeColors = css`
|
|
|
288
271
|
--color-info-text: var(--color-blue-9);
|
|
289
272
|
--color-info-text-active: var(--color-blue-10);
|
|
290
273
|
|
|
274
|
+
--color-primary-bg: var(--color-brand-1); // @presenter Color
|
|
275
|
+
--color-primary-bg-hover: var(--color-brand-2); // @presenter Color
|
|
276
|
+
--color-primary-border: var(--color-brand-3); // @presenter Color
|
|
277
|
+
--color-primary-border-hover: var(--color-brand-4); // @presenter Color
|
|
278
|
+
--color-primary-hover: var(--color-brand-8); // @presenter Color
|
|
279
|
+
--color-primary-base: var(--color-brand-6); // @presenter Color
|
|
280
|
+
--color-primary-active: var(--color-brand-7); // @presenter Color
|
|
281
|
+
--color-primary-text-hover: var(--color-brand-9); // @presenter Color
|
|
282
|
+
--color-primary-text: var(--color-brand-8); // @presenter Color
|
|
283
|
+
--color-primary-text-active: var(--color-brand-7); // @presenter Color
|
|
284
|
+
--color-primary-text-on-color: var(--text-color-on-color); // @presenter Color
|
|
285
|
+
|
|
291
286
|
/**
|
|
292
287
|
* @tokens Elevation Colors
|
|
293
288
|
* @presenter Color
|
|
@@ -770,24 +765,24 @@ const apiReferenceDocs = css`
|
|
|
770
765
|
--schema-chevron-color: var(--text-color-secondary); // @presenter Color
|
|
771
766
|
--schema-chevron-size: 9px;
|
|
772
767
|
|
|
773
|
-
--schema-property-deep-link-icon-color: var(--color-primary-base); // @presenter Color
|
|
768
|
+
--schema-property-deep-link-icon-color: var(--color-primary-base, var(--color-blueberry-6)); // @presenter Color
|
|
774
769
|
--schema-property-deep-link-icon: none;
|
|
775
770
|
|
|
776
771
|
/**
|
|
777
772
|
* @tokens API Reference Other
|
|
778
773
|
*/
|
|
779
774
|
|
|
780
|
-
--loading-spinner-color: var(--color-primary-base); // @presenter Color
|
|
775
|
+
--loading-spinner-color: var(--color-primary-base, var(--color-blueberry-6)); // @presenter Color
|
|
781
776
|
--linear-progress-color: var(--color-info-base); // @presenter Color
|
|
782
777
|
--linear-progress-bg-color: var(--color-info-bg); // @presenter Color
|
|
783
778
|
|
|
784
|
-
--fab-bg-color: var(--color-primary-base); // @presenter Color
|
|
779
|
+
--fab-bg-color: var(--color-primary-base, var(--color-blueberry-6)); // @presenter Color
|
|
785
780
|
--fab-box-shadow: var(--bg-raised-shadow); // @presenter Shadow
|
|
786
781
|
|
|
787
|
-
--fab-bg-color-hover: var(--color-primary-base); // @presenter Color
|
|
782
|
+
--fab-bg-color-hover: var(--color-primary-base, var(--color-blueberry-6)); // @presenter Color
|
|
788
783
|
--fab-box-shadow-hover: var(--bg-raised-shadow); // @presenter Shadow
|
|
789
784
|
|
|
790
|
-
--fab-bg-color-active: var(--color-primary-base); // @presenter Color
|
|
785
|
+
--fab-bg-color-active: var(--color-primary-base, var(--color-blueberry-6)); // @presenter Color
|
|
791
786
|
--fab-box-shadow-active: var(--bg-raised-shadow); // @presenter Shadow
|
|
792
787
|
|
|
793
788
|
--fab-icon-color: var(--navbar-text-color); // @presenter Color
|
|
@@ -1264,6 +1259,13 @@ const replay = css`
|
|
|
1264
1259
|
--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%);
|
|
1265
1260
|
|
|
1266
1261
|
--replay-ai-send-button-disabled-border: 1px solid #ffffff33;
|
|
1262
|
+
|
|
1263
|
+
--replay-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1264
|
+
--replay-transition-duration: 300ms;
|
|
1265
|
+
|
|
1266
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1267
|
+
--replay-transition-duration: 0s;
|
|
1268
|
+
}
|
|
1267
1269
|
// @tokens End
|
|
1268
1270
|
`;
|
|
1269
1271
|
|
|
@@ -1301,8 +1303,7 @@ export const styles = css<{ palette?: string }>`
|
|
|
1301
1303
|
${logo}
|
|
1302
1304
|
${markdown}
|
|
1303
1305
|
${markdownTabs}
|
|
1304
|
-
${
|
|
1305
|
-
${excalidraw}
|
|
1306
|
+
${diagram}
|
|
1306
1307
|
${menu}
|
|
1307
1308
|
${mobileMenu}
|
|
1308
1309
|
${modal}
|
|
@@ -1339,6 +1340,7 @@ export const styles = css<{ palette?: string }>`
|
|
|
1339
1340
|
${skipContent}
|
|
1340
1341
|
${pageActions}
|
|
1341
1342
|
${svgViewer}
|
|
1343
|
+
${toast}
|
|
1342
1344
|
|
|
1343
1345
|
background-color: var(--bg-color);
|
|
1344
1346
|
color: var(--text-color-primary);
|
|
@@ -2,20 +2,6 @@ import { css, type FlattenSimpleInterpolation } from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolation {
|
|
4
4
|
switch (palette) {
|
|
5
|
-
case 'default':
|
|
6
|
-
return css`
|
|
7
|
-
--color-brand-1: var(--color-blueberry-1);
|
|
8
|
-
--color-brand-2: var(--color-blueberry-2);
|
|
9
|
-
--color-brand-3: var(--color-blueberry-3);
|
|
10
|
-
--color-brand-4: var(--color-blueberry-4);
|
|
11
|
-
--color-brand-5: var(--color-blueberry-5);
|
|
12
|
-
--color-brand-6: var(--color-blueberry-6);
|
|
13
|
-
--color-brand-7: var(--color-blueberry-7);
|
|
14
|
-
--color-brand-8: var(--color-blueberry-8);
|
|
15
|
-
--color-brand-9: var(--color-blueberry-9);
|
|
16
|
-
--color-brand-10: var(--color-blueberry-10);
|
|
17
|
-
--color-brand-11: var(--color-blueberry-11);
|
|
18
|
-
`;
|
|
19
5
|
case 'slate':
|
|
20
6
|
return css`
|
|
21
7
|
--color-brand-1: #2a2b33;
|
|
@@ -189,22 +175,21 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
|
|
|
189
175
|
`;
|
|
190
176
|
default:
|
|
191
177
|
return css`
|
|
192
|
-
--color-
|
|
193
|
-
--color-
|
|
194
|
-
|
|
195
|
-
--color-
|
|
196
|
-
--color-
|
|
197
|
-
|
|
198
|
-
--color-
|
|
199
|
-
|
|
200
|
-
--color-
|
|
201
|
-
--color-
|
|
202
|
-
|
|
203
|
-
--
|
|
204
|
-
|
|
205
|
-
--color-
|
|
206
|
-
--
|
|
207
|
-
--text-color-on-color: #ffffff;
|
|
178
|
+
--button-bg-color-primary-hover-legacy: var(--color-blue-5);
|
|
179
|
+
--button-bg-color-primary-pressed-legacy: var(--color-blue-4);
|
|
180
|
+
|
|
181
|
+
--toc-item-text-color-active-legacy: var(--text-color-primary);
|
|
182
|
+
--toc-item-border-color-active-legacy: var(--border-color-invers);
|
|
183
|
+
|
|
184
|
+
--checkbox-border-color-legacy: var(--border-color-primary);
|
|
185
|
+
|
|
186
|
+
--switch-bg-color-selected-legacy: var(--color-warm-grey-7);
|
|
187
|
+
--switch-border-color-selected-legacy: var(--color-warm-grey-7);
|
|
188
|
+
|
|
189
|
+
--md-tabs-active-tab-bg-color-legacy: var(--bg-color-active);
|
|
190
|
+
|
|
191
|
+
--admonition-default-bg-color-legacy: var(--color-warm-grey-3);
|
|
192
|
+
--admonition-default-border-color-legacy: var(--color-warm-grey-5);
|
|
208
193
|
`;
|
|
209
194
|
}
|
|
210
195
|
}
|