@netlify/spark-ui 1.4.5 → 1.5.0-alpha.0
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/dist/assets/AskNetlify.css +1 -0
- package/dist/assets/Orb.css +1 -0
- package/dist/assets/SearchLink.css +1 -1
- package/dist/assets/SearchModal.css +1 -1
- package/dist/chunks/compat.module.BNbXPLVY.js +298 -0
- package/dist/chunks/hooks.module.DGkdD5n9.js +177 -0
- package/dist/chunks/{useTimeout.YR4eKwj7.js → useTimeout.Cq4aqnDe.js} +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/preact/AskNetlify/AskNetlify.d.ts +2 -0
- package/dist/components/preact/AskNetlify/AskNetlify.js +5653 -0
- package/dist/components/preact/Modal/Modal.js +1 -1
- package/dist/components/preact/Orb/Orb.d.ts +2 -0
- package/dist/components/preact/Orb/Orb.js +5 -0
- package/dist/components/preact/SearchModal/components/SearchInput.d.ts +2 -0
- package/dist/components/preact/SearchModal/components/SearchInput.js +2 -2
- package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.d.ts +1 -1
- package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +35 -17
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +81 -51
- package/dist/components/preact/SearchModal/components/SearchToggle/SearchToggle.js +1 -1
- package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
- package/dist/components/preact/SearchModal/components/SearchWindow.js +46 -30
- package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +6 -6
- package/dist/components/preact/SearchModal/hooks/useSearch.js +2 -2
- package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchLogger.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchParams.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +1 -1
- package/dist/components/preact/SearchModal/types/search.types.d.ts +6 -1
- package/dist/components/preact/index.d.ts +1 -0
- package/dist/components/preact/index.js +7 -5
- package/dist/utils/handleThemeChange.d.ts +1 -0
- package/package.json +4 -2
- package/packages/components/CodeBlock.astro +1 -1
- package/packages/components/index.ts +1 -0
- package/packages/components/preact/AskNetlify/AskNetlify.css +168 -0
- package/packages/components/preact/AskNetlify/AskNetlify.tsx +126 -0
- package/packages/components/preact/Orb/Orb.css +94 -0
- package/packages/components/preact/Orb/Orb.tsx +7 -0
- package/packages/components/preact/SearchModal/components/SearchInput.tsx +9 -7
- package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +7 -2
- package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.tsx +27 -7
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +81 -18
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +67 -30
- package/packages/components/preact/SearchModal/components/SearchWindow.tsx +31 -16
- package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +2 -2
- package/packages/components/preact/SearchModal/types/search.types.tsx +5 -2
- package/packages/components/preact/index.ts +1 -0
- package/packages/styles/tokens.css +28 -0
- package/packages/utils/handleThemeChange.ts +11 -0
- package/dist/chunks/compat.module.DJD78v1z.js +0 -175
- package/dist/chunks/hooks.module.D9IrxdEh.js +0 -138
- package/packages/themes/poimandres.json +0 -311
|
@@ -14,21 +14,26 @@ import {
|
|
|
14
14
|
useSearchToggles,
|
|
15
15
|
useSearchLogger,
|
|
16
16
|
} from '../../hooks';
|
|
17
|
+
import { useTimeout } from '@utils/useTimeout';
|
|
18
|
+
|
|
19
|
+
import AskNetlify from '../../../../preact/AskNetlify/AskNetlify';
|
|
17
20
|
|
|
18
21
|
import './SearchModal.css';
|
|
19
22
|
|
|
20
23
|
interface Props {
|
|
21
24
|
children: ComponentChildren;
|
|
22
25
|
className?: string;
|
|
23
|
-
debug?: boolean
|
|
26
|
+
debug?: boolean;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
function SearchModal(props: Props = {className: '', children: null, debug: false }) {
|
|
29
|
+
function SearchModal(props: Props = { className: '', children: null, debug: false }) {
|
|
27
30
|
const [isPagefindLoaded, setIsPagefindLoaded] = useState(false);
|
|
31
|
+
const [modalState, setModalState] = useState({ current: 'search' });
|
|
32
|
+
const [askNetlifyQuery, setAskNetlifyQuery] = useState('');
|
|
28
33
|
|
|
29
34
|
// Poll for the existence of window.pagefind.
|
|
30
35
|
useEffect(() => {
|
|
31
|
-
let intervalId:number;
|
|
36
|
+
let intervalId: number;
|
|
32
37
|
|
|
33
38
|
const checkForPagefind = () => {
|
|
34
39
|
if (window.pagefind) {
|
|
@@ -45,19 +50,18 @@ function SearchModal(props: Props = {className: '', children: null, debug: false
|
|
|
45
50
|
return () => clearInterval(intervalId);
|
|
46
51
|
}, []);
|
|
47
52
|
|
|
48
|
-
|
|
49
53
|
const { children, className, debug, ...rest } = props;
|
|
50
54
|
const { state, actions } = useSearch();
|
|
51
|
-
const [searchOpen, setSearchOpen] = useState(false);
|
|
52
55
|
|
|
56
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
53
57
|
const openSearch = () => setSearchOpen(true);
|
|
54
58
|
const closeSearch = () => setSearchOpen(false);
|
|
55
59
|
|
|
56
60
|
const modalRef = useRef<HTMLDialogElement>(null);
|
|
57
61
|
const containerRef = useClickOutside<HTMLDivElement>(closeSearch);
|
|
58
62
|
|
|
59
|
-
useSearchLogger(state, debug)
|
|
60
|
-
useSearchToggles(isPagefindLoaded,
|
|
63
|
+
useSearchLogger(state, debug);
|
|
64
|
+
useSearchToggles(isPagefindLoaded, openSearch);
|
|
61
65
|
useSearchParams(isPagefindLoaded, actions.setSearchTerm, openSearch);
|
|
62
66
|
useSearchHotkeys(isPagefindLoaded, searchOpen, openSearch, closeSearch);
|
|
63
67
|
useKeyboardNav(isPagefindLoaded, modalRef, searchOpen, closeSearch);
|
|
@@ -67,31 +71,64 @@ function SearchModal(props: Props = {className: '', children: null, debug: false
|
|
|
67
71
|
searchOpen ? modalRef.current.showModal() : modalRef.current.close();
|
|
68
72
|
}, [searchOpen]);
|
|
69
73
|
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const input = modalRef.current?.querySelector('input');
|
|
76
|
+
|
|
77
|
+
if (input) input.focus();
|
|
78
|
+
|
|
79
|
+
if (modalState.current === 'ask') {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
modalRef.current.classList.add('n-search-modal-ask');
|
|
82
|
+
}, 150);
|
|
83
|
+
} else if (modalState.current === 'search') {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
modalRef.current.classList.remove('n-search-modal-ask');
|
|
86
|
+
}, 150);
|
|
87
|
+
}
|
|
88
|
+
}, [modalState.current]);
|
|
89
|
+
|
|
70
90
|
return (
|
|
71
|
-
<Modal
|
|
91
|
+
<Modal
|
|
92
|
+
ref={modalRef}
|
|
93
|
+
className={`n-search-modal ${className ? className : ''}`}
|
|
94
|
+
data-state={modalState.current}
|
|
95
|
+
{...rest}
|
|
96
|
+
>
|
|
72
97
|
<div ref={containerRef} className="n-search-container">
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
{modalState.current === 'ask' && (
|
|
99
|
+
<AskNetlify query={askNetlifyQuery} setModalState={setModalState} />
|
|
100
|
+
)}
|
|
101
|
+
{modalState.current === 'search' && (
|
|
102
|
+
<>
|
|
103
|
+
<SearchInput
|
|
104
|
+
setSearchTerm={actions.setSearchTerm}
|
|
105
|
+
setAskNetlifyQuery={setAskNetlifyQuery}
|
|
106
|
+
initialValue={state.searchTerm}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<SearchWindow
|
|
110
|
+
setModalState={setModalState}
|
|
111
|
+
searchLoading={state.isLoading}
|
|
112
|
+
searchTerm={state.searchTerm}
|
|
113
|
+
results={state.results}
|
|
114
|
+
>
|
|
115
|
+
{children}
|
|
116
|
+
</SearchWindow>
|
|
117
|
+
|
|
118
|
+
<div className="n-search-footer">
|
|
119
|
+
<p className="n-search-footer-tip">
|
|
120
|
+
<KeyboardKey keyNames={['Esc']} />
|
|
121
|
+
to closed
|
|
122
|
+
</p>
|
|
123
|
+
<p className="n-search-footer-tip">
|
|
124
|
+
<KeyboardKey keyNames={['Tab']} />
|
|
125
|
+
<span>or</span>
|
|
126
|
+
<KeyboardKey keyNames={['↑', '↓']} />
|
|
127
|
+
to navigate
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
</>
|
|
131
|
+
)}
|
|
95
132
|
</div>
|
|
96
133
|
</Modal>
|
|
97
134
|
);
|
|
@@ -4,6 +4,10 @@ import { useMemo } from 'preact/hooks';
|
|
|
4
4
|
import SearchHeading from './SearchHeading/SearchHeading';
|
|
5
5
|
import SearchLink from './SearchLink/SearchLink';
|
|
6
6
|
|
|
7
|
+
import { handleThemeChange } from '@utils/handleThemeChange';
|
|
8
|
+
|
|
9
|
+
import Icon from '../../../preact/Icon';
|
|
10
|
+
|
|
7
11
|
/* --- Search Results Window (for active searches) --- */
|
|
8
12
|
const SearchResults: FunctionComponent<SearchResultsProps> = ({
|
|
9
13
|
searchLoading,
|
|
@@ -20,9 +24,9 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({
|
|
|
20
24
|
|
|
21
25
|
if (!results || results.length === 0) {
|
|
22
26
|
return (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
<SearchHeading>
|
|
28
|
+
0 results for <span className="n-search-term">{searchTerm}</span>
|
|
29
|
+
</SearchHeading>
|
|
26
30
|
);
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -43,29 +47,40 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({
|
|
|
43
47
|
|
|
44
48
|
/* --- Main Search Results Component --- */
|
|
45
49
|
export default function SearchWindow({
|
|
50
|
+
setModalState,
|
|
46
51
|
searchLoading,
|
|
47
52
|
searchTerm,
|
|
48
53
|
results,
|
|
49
54
|
children: DefaultWindow,
|
|
50
55
|
}: SearchWindowProps) {
|
|
51
|
-
const askNetlify: SearchLinkProps = {
|
|
52
|
-
icon: 'sparkles',
|
|
53
|
-
label: 'Ask Netlify AI',
|
|
54
|
-
url: 'https://docs.netlify.com/ask-netlify/',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
56
|
return (
|
|
58
57
|
<div className="n-search-window">
|
|
59
58
|
<div className="search-links">
|
|
60
|
-
<SearchLink {...askNetlify} />
|
|
61
59
|
{searchTerm && searchTerm.length > 1 ? (
|
|
62
|
-
<SearchResults
|
|
63
|
-
searchLoading={searchLoading}
|
|
64
|
-
searchTerm={searchTerm}
|
|
65
|
-
results={results}
|
|
66
|
-
/>
|
|
60
|
+
<SearchResults searchLoading={searchLoading} searchTerm={searchTerm} results={results} />
|
|
67
61
|
) : DefaultWindow ? (
|
|
68
|
-
|
|
62
|
+
<>
|
|
63
|
+
<SearchLink
|
|
64
|
+
as="button"
|
|
65
|
+
icon="netlify"
|
|
66
|
+
label="Ask Netlify AI"
|
|
67
|
+
onClick={() => {
|
|
68
|
+
setModalState({ current: 'ask' });
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
{DefaultWindow}
|
|
73
|
+
|
|
74
|
+
<SearchLink
|
|
75
|
+
as="button"
|
|
76
|
+
icon="netlify"
|
|
77
|
+
label="Toggle theme"
|
|
78
|
+
onClick={() => {
|
|
79
|
+
const theme = document.documentElement.getAttribute('data-theme');
|
|
80
|
+
handleThemeChange(theme === 'dark' ? 'light' : 'dark');
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
</>
|
|
69
84
|
) : null}
|
|
70
85
|
</div>
|
|
71
86
|
</div>
|
|
@@ -21,7 +21,7 @@ export function useKeyboardNav(
|
|
|
21
21
|
onClose: () => void
|
|
22
22
|
) {
|
|
23
23
|
useEffect(() => {
|
|
24
|
-
if (!isPagefindLoaded) return
|
|
24
|
+
if (!isPagefindLoaded) return;
|
|
25
25
|
const handleKeydown = (e: KeyboardEvent) => {
|
|
26
26
|
if (!isOpen) return;
|
|
27
27
|
|
|
@@ -35,7 +35,7 @@ export function useKeyboardNav(
|
|
|
35
35
|
const container = containerRef.current;
|
|
36
36
|
if (!container) return;
|
|
37
37
|
|
|
38
|
-
const links = Array.from(container.querySelectorAll('
|
|
38
|
+
const links = Array.from(container.querySelectorAll('.n-search-link'));
|
|
39
39
|
const currentIndex = links.findIndex(link => link === document.activeElement);
|
|
40
40
|
const nextIndex =
|
|
41
41
|
e.key === 'ArrowDown'
|
|
@@ -2,14 +2,17 @@ import type { ComponentChildren } from 'preact';
|
|
|
2
2
|
import type { IconName } from '../../Icon';
|
|
3
3
|
|
|
4
4
|
export interface SearchLinkProps {
|
|
5
|
+
as?: any;
|
|
5
6
|
icon: IconName;
|
|
6
7
|
label: string;
|
|
7
8
|
resource?: 'blog' | 'changelog' | 'docs' | 'guide';
|
|
8
|
-
url
|
|
9
|
+
url?: string;
|
|
9
10
|
excerpt?: string;
|
|
11
|
+
onClick?: () => void;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export interface SearchWindowProps {
|
|
15
|
+
setModalState: (e: { current: string }) => void;
|
|
13
16
|
searchLoading: boolean;
|
|
14
17
|
searchTerm?: string;
|
|
15
18
|
results?: SearchLinkProps[];
|
|
@@ -33,4 +36,4 @@ export interface SearchGTMObjectProps {
|
|
|
33
36
|
resultUrl?: string;
|
|
34
37
|
query?: string;
|
|
35
38
|
debug_mode?: boolean;
|
|
36
|
-
}
|
|
39
|
+
}
|
|
@@ -4,6 +4,7 @@ export { default as Icon } from './Icon';
|
|
|
4
4
|
export { default as SearchLink } from './SearchModal/components/SearchLink/SearchLink';
|
|
5
5
|
export { default as SearchHeading } from './SearchModal/components/SearchHeading/SearchHeading';
|
|
6
6
|
export { default as SearchToggle } from './SearchModal/components/SearchToggle/SearchToggle';
|
|
7
|
+
export { default as AskNetlify } from "./AskNetlify/AskNetlify"
|
|
7
8
|
export { SearchModal } from './SearchModal';
|
|
8
9
|
|
|
9
10
|
export { type IconName } from './Icon';
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
6
|
--active-switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117 / 0.047058823529411764);
|
|
7
|
+
--badge-bg-color: var(--neutral-100);
|
|
8
|
+
--badge-border-color: var(--neutral-300);
|
|
9
|
+
--badge-text-color: var(--neutral-500);
|
|
7
10
|
--blue-000: color(srgb 0.9294117647058824 0.9568627450980393 1);
|
|
8
11
|
--blue-100: color(srgb 0.803921568627451 0.8862745098039215 1);
|
|
9
12
|
--blue-200: color(srgb 0.7098039215686275 0.8235294117647058 0.984313725490196);
|
|
@@ -153,8 +156,12 @@
|
|
|
153
156
|
--red-700: color(srgb 0.6862745098039216 0.1450980392156863 0.21176470588235294);
|
|
154
157
|
--red-800: color(srgb 0.5019607843137255 0.0392156862745098 0.12549019607843137);
|
|
155
158
|
--red-900: color(srgb 0.23921568627450981 0.10980392156862745 0.10588235294117647);
|
|
159
|
+
--search-answer-message-color: var(--neutral-200);
|
|
160
|
+
--search-back-btn-bg-color: var(--neutral-100);
|
|
156
161
|
--search-bg-color: var(--neutral-000);
|
|
157
162
|
--search-highlight-color: var(--teal-000);
|
|
163
|
+
--search-loading-color: var(--blue-700);
|
|
164
|
+
--search-user-message-color: var(--blue-100);
|
|
158
165
|
--shadow-deep: 0 16px 24px 0 color(srgb 0 0 0 / 0.07), 0 6px 30px 0 color(srgb 0 0 0 / 0.06), 0 8px 10px 0 color(srgb 0 0 0 / 0.1);
|
|
159
166
|
--shadow-heavy: -10px 10px 80px 0 color(srgb 0 0 0 / 0.1);
|
|
160
167
|
--shadow-hover: 0 4px 12px 0 color(srgb 0 0 0 / 0.25);
|
|
@@ -186,6 +193,9 @@
|
|
|
186
193
|
@media (prefers-color-scheme: dark) {
|
|
187
194
|
:root {
|
|
188
195
|
--active-switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117);
|
|
196
|
+
--badge-bg-color: var(--neutral-700);
|
|
197
|
+
--badge-border-color: var(--neutral-600);
|
|
198
|
+
--badge-text-color: var(--neutral-100);
|
|
189
199
|
--button-outline-bg-color: color(srgb 0 0 0 / 0);
|
|
190
200
|
--button-outline-bg-color-hover: color(srgb 0.6509803921568628 1 0.9921568627450981 / 0.09803921568627451);
|
|
191
201
|
--button-outline-stroke-color: var(--teal-200);
|
|
@@ -242,8 +252,12 @@
|
|
|
242
252
|
--neutral-700: color(srgb 0.11764705882352941 0.1411764705882353 0.17254901960784313);
|
|
243
253
|
--neutral-800: color(srgb 0.07058823529411765 0.09411764705882353 0.12156862745098039);
|
|
244
254
|
--neutral-900: color(srgb 0.023529411764705882 0.043137254901960784 0.06274509803921569);
|
|
255
|
+
--search-answer-message-color: var(--neutral-600);
|
|
256
|
+
--search-back-btn-bg-color: var(--neutral-500);
|
|
245
257
|
--search-bg-color: var(--neutral-700);
|
|
246
258
|
--search-highlight-color: var(--teal-800);
|
|
259
|
+
--search-loading-color: var(--teal-200);
|
|
260
|
+
--search-user-message-color: var(--teal-800);
|
|
247
261
|
--switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117 / 0.2);
|
|
248
262
|
--title-text-color: color(srgb 0.8352941176470589 1 0.996078431372549 / 0.7490196078431373);
|
|
249
263
|
}
|
|
@@ -251,6 +265,9 @@
|
|
|
251
265
|
|
|
252
266
|
[data-theme="dark"] {
|
|
253
267
|
--active-switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117);
|
|
268
|
+
--badge-bg-color: var(--neutral-700);
|
|
269
|
+
--badge-border-color: var(--neutral-600);
|
|
270
|
+
--badge-text-color: var(--neutral-100);
|
|
254
271
|
--button-outline-bg-color: color(srgb 0 0 0 / 0);
|
|
255
272
|
--button-outline-bg-color-hover: color(srgb 0.6509803921568628 1 0.9921568627450981 / 0.09803921568627451);
|
|
256
273
|
--button-outline-stroke-color: var(--teal-200);
|
|
@@ -307,14 +324,21 @@
|
|
|
307
324
|
--neutral-700: color(srgb 0.11764705882352941 0.1411764705882353 0.17254901960784313);
|
|
308
325
|
--neutral-800: color(srgb 0.07058823529411765 0.09411764705882353 0.12156862745098039);
|
|
309
326
|
--neutral-900: color(srgb 0.023529411764705882 0.043137254901960784 0.06274509803921569);
|
|
327
|
+
--search-answer-message-color: var(--neutral-600);
|
|
328
|
+
--search-back-btn-bg-color: var(--neutral-500);
|
|
310
329
|
--search-bg-color: var(--neutral-700);
|
|
311
330
|
--search-highlight-color: var(--teal-800);
|
|
331
|
+
--search-loading-color: var(--teal-200);
|
|
332
|
+
--search-user-message-color: var(--teal-800);
|
|
312
333
|
--switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117 / 0.2);
|
|
313
334
|
--title-text-color: color(srgb 0.8352941176470589 1 0.996078431372549 / 0.7490196078431373);
|
|
314
335
|
}
|
|
315
336
|
|
|
316
337
|
[data-theme="light"] {
|
|
317
338
|
--active-switcher-tab-bg-color: color(srgb 0.047058823529411764 0.16470588235294117 0.16470588235294117 / 0.047058823529411764);
|
|
339
|
+
--badge-bg-color: var(--neutral-100);
|
|
340
|
+
--badge-border-color: var(--neutral-300);
|
|
341
|
+
--badge-text-color: var(--neutral-500);
|
|
318
342
|
--button-outline-bg-color: color(srgb 0 0 0 / 0);
|
|
319
343
|
--button-outline-bg-color-hover: color(srgb 0.19607843137254902 0.9019607843137255 0.8862745098039215 / 0.2);
|
|
320
344
|
--button-outline-stroke-color: var(--neutral-800);
|
|
@@ -371,8 +395,12 @@
|
|
|
371
395
|
--neutral-600: color(srgb 0.32941176470588235 0.35294117647058826 0.3803921568627451);
|
|
372
396
|
--neutral-700: color(srgb 0.20784313725490197 0.22745098039215686 0.24313725490196078);
|
|
373
397
|
--neutral-800: color(srgb 0.09411764705882353 0.10196078431372549 0.10980392156862745);
|
|
398
|
+
--search-answer-message-color: var(--neutral-200);
|
|
399
|
+
--search-back-btn-bg-color: var(--neutral-100);
|
|
374
400
|
--search-bg-color: var(--neutral-000);
|
|
375
401
|
--search-highlight-color: var(--teal-000);
|
|
402
|
+
--search-loading-color: var(--blue-700);
|
|
403
|
+
--search-user-message-color: var(--blue-100);
|
|
376
404
|
--switcher-tab-bg-color: color(srgb 1 1 1 / 0.047058823529411764);
|
|
377
405
|
--title-text-color: color(srgb 0.32941176470588235 0.35294117647058826 0.3803921568627451 / 0.7490196078431373);
|
|
378
406
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const handleThemeChange = (value: 'dark' | 'light' | '') => {
|
|
2
|
+
const element = document.documentElement;
|
|
3
|
+
|
|
4
|
+
if (value === '') {
|
|
5
|
+
element.removeAttribute('data-theme');
|
|
6
|
+
localStorage.removeItem('theme');
|
|
7
|
+
} else {
|
|
8
|
+
element.setAttribute('data-theme', value);
|
|
9
|
+
localStorage.setItem('theme', value);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Component as f, options as a, createElement as d, Fragment as h, toChildArray as v } from "preact";
|
|
2
|
-
import "./hooks.module.D9IrxdEh.js";
|
|
3
|
-
function C(e, t) {
|
|
4
|
-
for (var r in t) e[r] = t[r];
|
|
5
|
-
return e;
|
|
6
|
-
}
|
|
7
|
-
function m(e, t) {
|
|
8
|
-
for (var r in e) if (r !== "__source" && !(r in t)) return !0;
|
|
9
|
-
for (var o in t) if (o !== "__source" && e[o] !== t[o]) return !0;
|
|
10
|
-
return !1;
|
|
11
|
-
}
|
|
12
|
-
function y(e, t) {
|
|
13
|
-
this.props = e, this.context = t;
|
|
14
|
-
}
|
|
15
|
-
(y.prototype = new f()).isPureReactComponent = !0, y.prototype.shouldComponentUpdate = function(e, t) {
|
|
16
|
-
return m(this.props, e) || m(this.state, t);
|
|
17
|
-
};
|
|
18
|
-
var b = a.__b;
|
|
19
|
-
a.__b = function(e) {
|
|
20
|
-
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), b && b(e);
|
|
21
|
-
};
|
|
22
|
-
var x = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
|
|
23
|
-
function z(e) {
|
|
24
|
-
function t(r) {
|
|
25
|
-
var o = C({}, r);
|
|
26
|
-
return delete o.ref, e(o, r.ref || null);
|
|
27
|
-
}
|
|
28
|
-
return t.$$typeof = x, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
|
|
29
|
-
}
|
|
30
|
-
var U = a.__e;
|
|
31
|
-
a.__e = function(e, t, r, o) {
|
|
32
|
-
if (e.then) {
|
|
33
|
-
for (var n, l = t; l = l.__; ) if ((n = l.__c) && n.__c) return t.__e == null && (t.__e = r.__e, t.__k = r.__k), n.__c(e, t);
|
|
34
|
-
}
|
|
35
|
-
U(e, t, r, o);
|
|
36
|
-
};
|
|
37
|
-
var g = a.unmount;
|
|
38
|
-
function N(e, t, r) {
|
|
39
|
-
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
|
|
40
|
-
typeof o.__c == "function" && o.__c();
|
|
41
|
-
}), e.__c.__H = null), (e = C({}, e)).__c != null && (e.__c.__P === r && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
|
|
42
|
-
return N(o, t, r);
|
|
43
|
-
})), e;
|
|
44
|
-
}
|
|
45
|
-
function E(e, t, r) {
|
|
46
|
-
return e && r && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
|
|
47
|
-
return E(o, t, r);
|
|
48
|
-
}), e.__c && e.__c.__P === t && (e.__e && r.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = r)), e;
|
|
49
|
-
}
|
|
50
|
-
function p() {
|
|
51
|
-
this.__u = 0, this.o = null, this.__b = null;
|
|
52
|
-
}
|
|
53
|
-
function R(e) {
|
|
54
|
-
var t = e.__.__c;
|
|
55
|
-
return t && t.__a && t.__a(e);
|
|
56
|
-
}
|
|
57
|
-
function s() {
|
|
58
|
-
this.i = null, this.l = null;
|
|
59
|
-
}
|
|
60
|
-
a.unmount = function(e) {
|
|
61
|
-
var t = e.__c;
|
|
62
|
-
t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), g && g(e);
|
|
63
|
-
}, (p.prototype = new f()).__c = function(e, t) {
|
|
64
|
-
var r = t.__c, o = this;
|
|
65
|
-
o.o == null && (o.o = []), o.o.push(r);
|
|
66
|
-
var n = R(o.__v), l = !1, _ = function() {
|
|
67
|
-
l || (l = !0, r.__R = null, n ? n(i) : i());
|
|
68
|
-
};
|
|
69
|
-
r.__R = _;
|
|
70
|
-
var i = function() {
|
|
71
|
-
if (!--o.__u) {
|
|
72
|
-
if (o.state.__a) {
|
|
73
|
-
var u = o.state.__a;
|
|
74
|
-
o.__v.__k[0] = E(u, u.__c.__P, u.__c.__O);
|
|
75
|
-
}
|
|
76
|
-
var c;
|
|
77
|
-
for (o.setState({ __a: o.__b = null }); c = o.o.pop(); ) c.forceUpdate();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
o.__u++ || 32 & t.__u || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(_, _);
|
|
81
|
-
}, p.prototype.componentWillUnmount = function() {
|
|
82
|
-
this.o = [];
|
|
83
|
-
}, p.prototype.render = function(e, t) {
|
|
84
|
-
if (this.__b) {
|
|
85
|
-
if (this.__v.__k) {
|
|
86
|
-
var r = document.createElement("div"), o = this.__v.__k[0].__c;
|
|
87
|
-
this.__v.__k[0] = N(this.__b, r, o.__O = o.__P);
|
|
88
|
-
}
|
|
89
|
-
this.__b = null;
|
|
90
|
-
}
|
|
91
|
-
var n = t.__a && d(h, null, e.fallback);
|
|
92
|
-
return n && (n.__u &= -33), [d(h, null, t.__a ? null : e.children), n];
|
|
93
|
-
};
|
|
94
|
-
var k = function(e, t, r) {
|
|
95
|
-
if (++r[1] === r[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (r = e.i; r; ) {
|
|
96
|
-
for (; r.length > 3; ) r.pop()();
|
|
97
|
-
if (r[1] < r[0]) break;
|
|
98
|
-
e.i = r = r[2];
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
(s.prototype = new f()).__a = function(e) {
|
|
102
|
-
var t = this, r = R(t.__v), o = t.l.get(e);
|
|
103
|
-
return o[0]++, function(n) {
|
|
104
|
-
var l = function() {
|
|
105
|
-
t.props.revealOrder ? (o.push(n), k(t, e, o)) : n();
|
|
106
|
-
};
|
|
107
|
-
r ? r(l) : l();
|
|
108
|
-
};
|
|
109
|
-
}, s.prototype.render = function(e) {
|
|
110
|
-
this.i = null, this.l = /* @__PURE__ */ new Map();
|
|
111
|
-
var t = v(e.children);
|
|
112
|
-
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
|
|
113
|
-
for (var r = t.length; r--; ) this.l.set(t[r], this.i = [1, 0, this.i]);
|
|
114
|
-
return e.children;
|
|
115
|
-
}, s.prototype.componentDidUpdate = s.prototype.componentDidMount = function() {
|
|
116
|
-
var e = this;
|
|
117
|
-
this.l.forEach(function(t, r) {
|
|
118
|
-
k(e, r, t);
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
var A = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, V = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, W = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, H = /[A-Z0-9]/g, $ = typeof document < "u", j = function(e) {
|
|
122
|
-
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
|
|
123
|
-
};
|
|
124
|
-
f.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
|
|
125
|
-
Object.defineProperty(f.prototype, e, { configurable: !0, get: function() {
|
|
126
|
-
return this["UNSAFE_" + e];
|
|
127
|
-
}, set: function(t) {
|
|
128
|
-
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
|
|
129
|
-
} });
|
|
130
|
-
});
|
|
131
|
-
var P = a.event;
|
|
132
|
-
function D() {
|
|
133
|
-
}
|
|
134
|
-
function F() {
|
|
135
|
-
return this.cancelBubble;
|
|
136
|
-
}
|
|
137
|
-
function B() {
|
|
138
|
-
return this.defaultPrevented;
|
|
139
|
-
}
|
|
140
|
-
a.event = function(e) {
|
|
141
|
-
return P && (e = P(e)), e.persist = D, e.isPropagationStopped = F, e.isDefaultPrevented = B, e.nativeEvent = e;
|
|
142
|
-
};
|
|
143
|
-
var L = { enumerable: !1, configurable: !0, get: function() {
|
|
144
|
-
return this.class;
|
|
145
|
-
} }, O = a.vnode;
|
|
146
|
-
a.vnode = function(e) {
|
|
147
|
-
typeof e.type == "string" && function(t) {
|
|
148
|
-
var r = t.props, o = t.type, n = {}, l = o.indexOf("-") === -1;
|
|
149
|
-
for (var _ in r) {
|
|
150
|
-
var i = r[_];
|
|
151
|
-
if (!(_ === "value" && "defaultValue" in r && i == null || $ && _ === "children" && o === "noscript" || _ === "class" || _ === "className")) {
|
|
152
|
-
var u = _.toLowerCase();
|
|
153
|
-
_ === "defaultValue" && "value" in r && r.value == null ? _ = "value" : _ === "download" && i === !0 ? i = "" : u === "translate" && i === "no" ? i = !1 : u[0] === "o" && u[1] === "n" ? u === "ondoubleclick" ? _ = "ondblclick" : u !== "onchange" || o !== "input" && o !== "textarea" || j(r.type) ? u === "onfocus" ? _ = "onfocusin" : u === "onblur" ? _ = "onfocusout" : W.test(_) && (_ = u) : u = _ = "oninput" : l && V.test(_) ? _ = _.replace(H, "-$&").toLowerCase() : i === null && (i = void 0), u === "oninput" && n[_ = u] && (_ = "oninputCapture"), n[_] = i;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
o == "select" && n.multiple && Array.isArray(n.value) && (n.value = v(r.children).forEach(function(c) {
|
|
157
|
-
c.props.selected = n.value.indexOf(c.props.value) != -1;
|
|
158
|
-
})), o == "select" && n.defaultValue != null && (n.value = v(r.children).forEach(function(c) {
|
|
159
|
-
c.props.selected = n.multiple ? n.defaultValue.indexOf(c.props.value) != -1 : n.defaultValue == c.props.value;
|
|
160
|
-
})), r.class && !r.className ? (n.class = r.class, Object.defineProperty(n, "className", L)) : (r.className && !r.class || r.class && r.className) && (n.class = n.className = r.className), t.props = n;
|
|
161
|
-
}(e), e.$$typeof = A, O && O(e);
|
|
162
|
-
};
|
|
163
|
-
var S = a.__r;
|
|
164
|
-
a.__r = function(e) {
|
|
165
|
-
S && S(e), e.__c;
|
|
166
|
-
};
|
|
167
|
-
var w = a.diffed;
|
|
168
|
-
a.diffed = function(e) {
|
|
169
|
-
w && w(e);
|
|
170
|
-
var t = e.props, r = e.__e;
|
|
171
|
-
r != null && e.type === "textarea" && "value" in t && t.value !== r.value && (r.value = t.value == null ? "" : t.value);
|
|
172
|
-
};
|
|
173
|
-
export {
|
|
174
|
-
z as D
|
|
175
|
-
};
|