@apify/docs-theme 1.0.243 → 1.0.245
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/LICENSE +201 -0
- package/package.json +48 -48
- package/src/config.js +1 -3
- package/src/markdown.js +8 -6
- package/src/roa-loader/index.js +16 -14
- package/src/theme/ColorModeToggle/index.jsx +14 -27
- package/src/theme/DocBreadcrumbs/Items/Home/index.js +2 -1
- package/src/theme/DocBreadcrumbs/index.js +10 -20
- package/src/theme/DocItemContent/index.js +42 -43
- package/src/theme/DocItemContent/styles.module.css +1 -3
- package/src/theme/DocSidebarItem/Category/index.js +36 -54
- package/src/theme/DocSidebarItem/Link/index.jsx +9 -23
- package/src/theme/DocSidebarItem/Link/styles.module.css +1 -1
- package/src/theme/Footer/LinkItem/index.js +7 -12
- package/src/theme/Footer/index.jsx +2 -3
- package/src/theme/Heading/index.jsx +3 -4
- package/src/theme/Heading/styles.module.css +23 -23
- package/src/theme/Icon/DarkMode/index.jsx +7 -1
- package/src/theme/Icon/LightMode/index.jsx +28 -10
- package/src/theme/LLMButtons/index.jsx +7 -37
- package/src/theme/Layout/index.jsx +10 -9
- package/src/theme/Logo/index.js +3 -16
- package/src/theme/MDXComponents/A.js +11 -6
- package/src/theme/MDXComponents/Code.js +3 -2
- package/src/theme/MDXComponents/Details.js +1 -3
- package/src/theme/MDXComponents/Head.js +2 -1
- package/src/theme/MDXComponents/Img/index.js +1 -7
- package/src/theme/MDXComponents/Img/styles.module.css +1 -1
- package/src/theme/MDXComponents/Ul/index.js +1 -1
- package/src/theme/MDXComponents/Ul/styles.module.css +2 -2
- package/src/theme/Navbar/CTA/index.jsx +3 -1
- package/src/theme/Navbar/CTA/styles.module.css +45 -45
- package/src/theme/Navbar/Content/index.jsx +29 -28
- package/src/theme/Navbar/MobileSidebar/Header/index.jsx +3 -1
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.jsx +15 -29
- package/src/theme/NavbarItem/ComponentTypes.jsx +3 -22
- package/src/theme/NavbarItem/NavbarNavLink.jsx +28 -24
- package/src/theme/NotFound.jsx +2 -6
- package/src/theme/RunnableCodeBlock/RunnableCodeBlock.jsx +43 -9
- package/src/theme/SearchBar/index.js +21 -21
- package/src/theme/SearchBar/styles.css +84 -83
- package/src/theme/SearchMetadata/index.js +8 -8
- package/src/theme/SearchPage/index.js +173 -230
- package/src/theme/SearchPage/styles.module.css +59 -59
- package/src/theme/TOCItems/Tree.jsx +2 -12
- package/src/theme/TOCItems/index.jsx +2 -12
- package/src/theme/custom.css +90 -75
- package/src/theme.js +15 -19
- package/src/utils.js +1 -5
- package/static/js/custom.js +7 -5
|
@@ -4,13 +4,7 @@ import {
|
|
|
4
4
|
isActiveSidebarItem,
|
|
5
5
|
useDocSidebarItemsExpandedState,
|
|
6
6
|
} from '@docusaurus/plugin-content-docs/client';
|
|
7
|
-
import {
|
|
8
|
-
Collapsible,
|
|
9
|
-
ThemeClassNames,
|
|
10
|
-
useCollapsible,
|
|
11
|
-
usePrevious,
|
|
12
|
-
useThemeConfig,
|
|
13
|
-
} from '@docusaurus/theme-common';
|
|
7
|
+
import { Collapsible, ThemeClassNames, useCollapsible, usePrevious, useThemeConfig } from '@docusaurus/theme-common';
|
|
14
8
|
import { isSamePath } from '@docusaurus/theme-common/internal';
|
|
15
9
|
import { translate } from '@docusaurus/Translate';
|
|
16
10
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
@@ -59,21 +53,21 @@ function CollapseButton({ collapsed, categoryLabel, onClick }) {
|
|
|
59
53
|
aria-label={
|
|
60
54
|
collapsed
|
|
61
55
|
? translate(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
{
|
|
57
|
+
id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
|
|
58
|
+
message: "Expand sidebar category '{label}'",
|
|
59
|
+
description: 'The ARIA label to expand the sidebar category',
|
|
60
|
+
},
|
|
61
|
+
{ label: categoryLabel },
|
|
62
|
+
)
|
|
69
63
|
: translate(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
{
|
|
65
|
+
id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
|
|
66
|
+
message: "Collapse sidebar category '{label}'",
|
|
67
|
+
description: 'The ARIA label to collapse the sidebar category',
|
|
68
|
+
},
|
|
69
|
+
{ label: categoryLabel },
|
|
70
|
+
)
|
|
77
71
|
}
|
|
78
72
|
aria-expanded={!collapsed}
|
|
79
73
|
type="button"
|
|
@@ -93,10 +87,7 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
93
87
|
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
94
88
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
95
89
|
const isCurrentPage = isSamePath(href, activePath);
|
|
96
|
-
const {
|
|
97
|
-
collapsed,
|
|
98
|
-
setCollapsed,
|
|
99
|
-
} = useCollapsible({
|
|
90
|
+
const { collapsed, setCollapsed } = useCollapsible({
|
|
100
91
|
// Active categories are always initialized as expanded. The default
|
|
101
92
|
// (`item.collapsed`) is only used for non-active categories.
|
|
102
93
|
initialState: () => {
|
|
@@ -106,10 +97,7 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
106
97
|
return isActive ? false : item.collapsed;
|
|
107
98
|
},
|
|
108
99
|
});
|
|
109
|
-
const {
|
|
110
|
-
expandedItem,
|
|
111
|
-
setExpandedItem,
|
|
112
|
-
} = useDocSidebarItemsExpandedState();
|
|
100
|
+
const { expandedItem, setExpandedItem } = useDocSidebarItemsExpandedState();
|
|
113
101
|
// Use this instead of `setCollapsed`, because it is also reactive
|
|
114
102
|
const updateCollapsed = (toCollapsed = !collapsed) => {
|
|
115
103
|
setExpandedItem(toCollapsed ? null : index);
|
|
@@ -121,12 +109,7 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
121
109
|
updateCollapsed,
|
|
122
110
|
});
|
|
123
111
|
useEffect(() => {
|
|
124
|
-
if (
|
|
125
|
-
collapsible
|
|
126
|
-
&& expandedItem != null
|
|
127
|
-
&& expandedItem !== index
|
|
128
|
-
&& autoCollapseCategories
|
|
129
|
-
) {
|
|
112
|
+
if (collapsible && expandedItem != null && expandedItem !== index && autoCollapseCategories) {
|
|
130
113
|
setCollapsed(true);
|
|
131
114
|
}
|
|
132
115
|
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);
|
|
@@ -149,11 +132,13 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
149
132
|
'menu__list-item--collapsed': collapsed,
|
|
150
133
|
},
|
|
151
134
|
className,
|
|
152
|
-
)}
|
|
135
|
+
)}
|
|
136
|
+
>
|
|
153
137
|
<div
|
|
154
138
|
className={clsx('menu__list-item-collapsible', {
|
|
155
139
|
'menu__list-item-collapsible--active': isCurrentPage,
|
|
156
|
-
})}
|
|
140
|
+
})}
|
|
141
|
+
>
|
|
157
142
|
<Link
|
|
158
143
|
className={clsx('menu__link', {
|
|
159
144
|
'menu__link--sublist': collapsible,
|
|
@@ -163,23 +148,24 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
163
148
|
onClick={
|
|
164
149
|
collapsible
|
|
165
150
|
? (e) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
151
|
+
onItemClick?.(item);
|
|
152
|
+
if (href) {
|
|
153
|
+
updateCollapsed(false);
|
|
154
|
+
} else {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
updateCollapsed();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
174
159
|
: () => {
|
|
175
|
-
|
|
176
|
-
|
|
160
|
+
onItemClick?.(item);
|
|
161
|
+
}
|
|
177
162
|
}
|
|
178
163
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
179
164
|
role={collapsible && !href ? 'button' : undefined}
|
|
180
165
|
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
181
|
-
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
182
|
-
{...props}
|
|
166
|
+
href={collapsible ? (hrefWithSSRFallback ?? '#') : hrefWithSSRFallback}
|
|
167
|
+
{...props}
|
|
168
|
+
>
|
|
183
169
|
{label}
|
|
184
170
|
</Link>
|
|
185
171
|
{href && collapsible && (
|
|
@@ -194,11 +180,7 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
|
|
|
194
180
|
)}
|
|
195
181
|
</div>
|
|
196
182
|
|
|
197
|
-
<Collapsible
|
|
198
|
-
lazy
|
|
199
|
-
as="ul"
|
|
200
|
-
className="menu__list"
|
|
201
|
-
collapsed={collapsed}>
|
|
183
|
+
<Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
|
|
202
184
|
<DocSidebarItems
|
|
203
185
|
items={items}
|
|
204
186
|
tabIndex={collapsed ? -1 : 0}
|
|
@@ -9,20 +9,8 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
11
|
|
|
12
|
-
export default function DocSidebarItemLink({
|
|
13
|
-
item
|
|
14
|
-
onItemClick,
|
|
15
|
-
activePath,
|
|
16
|
-
level,
|
|
17
|
-
index,
|
|
18
|
-
...props
|
|
19
|
-
}) {
|
|
20
|
-
const {
|
|
21
|
-
href,
|
|
22
|
-
label,
|
|
23
|
-
className,
|
|
24
|
-
autoAddBaseUrl,
|
|
25
|
-
} = item;
|
|
12
|
+
export default function DocSidebarItemLink({ item, onItemClick, activePath, level, index, ...props }) {
|
|
13
|
+
const { href, label, className, autoAddBaseUrl } = item;
|
|
26
14
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
27
15
|
const isInternalLink = isInternalUrl(href);
|
|
28
16
|
const baseUrl = useDocusaurusContext().siteConfig.url;
|
|
@@ -45,22 +33,20 @@ export default function DocSidebarItemLink({
|
|
|
45
33
|
'menu__list-item',
|
|
46
34
|
className,
|
|
47
35
|
)}
|
|
48
|
-
key={label}
|
|
36
|
+
key={label}
|
|
37
|
+
>
|
|
49
38
|
<Link
|
|
50
|
-
className={clsx(
|
|
51
|
-
'menu__link',
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
'menu__link--active': isActive,
|
|
55
|
-
},
|
|
56
|
-
)}
|
|
39
|
+
className={clsx('menu__link', !isInternalLink && styles.menuExternalLink, {
|
|
40
|
+
'menu__link--active': isActive,
|
|
41
|
+
})}
|
|
57
42
|
autoAddBaseUrl={autoAddBaseUrl}
|
|
58
43
|
aria-current={isActive ? 'page' : undefined}
|
|
59
44
|
to={href}
|
|
60
45
|
{...(isInternalLink && {
|
|
61
46
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
62
47
|
})}
|
|
63
|
-
{...props}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
64
50
|
{label}
|
|
65
51
|
{!isInternalLink && <IconExternalLink />}
|
|
66
52
|
</Link>
|
|
@@ -6,13 +6,7 @@ import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
export default function FooterLinkItem({ item }) {
|
|
9
|
-
const {
|
|
10
|
-
to,
|
|
11
|
-
href,
|
|
12
|
-
label,
|
|
13
|
-
prependBaseUrlToHref,
|
|
14
|
-
...props
|
|
15
|
-
} = item;
|
|
9
|
+
const { to, href, label, prependBaseUrlToHref, ...props } = item;
|
|
16
10
|
const toUrl = useBaseUrl(to);
|
|
17
11
|
const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });
|
|
18
12
|
const { siteConfig } = useDocusaurusContext();
|
|
@@ -27,12 +21,13 @@ export default function FooterLinkItem({ item }) {
|
|
|
27
21
|
className="footer__link-item"
|
|
28
22
|
{...(href
|
|
29
23
|
? {
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
25
|
+
}
|
|
32
26
|
: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{...props}
|
|
27
|
+
to: toUrl,
|
|
28
|
+
})}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
36
31
|
{label}
|
|
37
32
|
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
38
33
|
</Link>
|
|
@@ -31,12 +31,11 @@ function Footer() {
|
|
|
31
31
|
<footer className={clsx(styles.footer, style)}>
|
|
32
32
|
<div className={styles.container}>
|
|
33
33
|
<div className={clsx('row', styles.top)}>
|
|
34
|
-
{
|
|
34
|
+
{links.map((column, i) => (
|
|
35
35
|
<div key={i} className={`col col--2`}>
|
|
36
36
|
<FooterLinksColumn {...{ column }} />
|
|
37
37
|
</div>
|
|
38
|
-
))
|
|
39
|
-
}
|
|
38
|
+
))}
|
|
40
39
|
</div>
|
|
41
40
|
<div className={clsx('row', styles.bottom)}>
|
|
42
41
|
<div className="col col--6">
|
|
@@ -65,12 +65,11 @@ export default function Heading({ as: As, id, ...props }) {
|
|
|
65
65
|
{...props}
|
|
66
66
|
className={clsx(
|
|
67
67
|
'anchor',
|
|
68
|
-
hideOnScroll
|
|
69
|
-
? styles.anchorWithHideOnScrollNavbar
|
|
70
|
-
: styles.anchorWithStickyNavbar,
|
|
68
|
+
hideOnScroll ? styles.anchorWithHideOnScrollNavbar : styles.anchorWithStickyNavbar,
|
|
71
69
|
props.className,
|
|
72
70
|
)}
|
|
73
|
-
id={id}
|
|
71
|
+
id={id}
|
|
72
|
+
>
|
|
74
73
|
{props.children}
|
|
75
74
|
<a
|
|
76
75
|
onClick={handleCopy}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
.anchorWithStickyNavbar {
|
|
2
|
-
|
|
2
|
+
scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.anchorWithHideOnScrollNavbar {
|
|
6
|
-
|
|
6
|
+
scroll-margin-top: 0.5rem;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.headingCopyIcon {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
display: inline-block;
|
|
11
|
+
opacity: 0;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
position: relative;
|
|
14
|
+
left: 0.4rem;
|
|
15
|
+
color: var(--ifm-color-emphasis-700);
|
|
16
|
+
text-decoration: none;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.headingCopyIcon svg {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
stroke: var(--ifm-color-primary);
|
|
21
|
+
max-height: 1em !important;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
h2:hover .headingCopyIcon,
|
|
@@ -26,25 +26,25 @@ h3:hover .headingCopyIcon,
|
|
|
26
26
|
h4:hover .headingCopyIcon,
|
|
27
27
|
h5:hover .headingCopyIcon,
|
|
28
28
|
h6:hover .headingCopyIcon {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
opacity: 1;
|
|
30
|
+
pointer-events: auto;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.headingCopyIcon.copied {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
opacity: 1;
|
|
35
|
+
pointer-events: auto;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.headingCopyIcon.copied svg {
|
|
39
|
-
|
|
39
|
+
display: none;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.headingCopyIcon.copied::after {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
content: 'Copied!';
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
color: var(--ifm-font-color-secondary);
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
margin-left: 8px;
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
line-height: 1;
|
|
50
50
|
}
|
|
@@ -4,7 +4,13 @@ import React from 'react';
|
|
|
4
4
|
function IconDarkMode(props) {
|
|
5
5
|
return (
|
|
6
6
|
<svg viewBox="0 0 13 12" width={14} height={14} {...props}>
|
|
7
|
-
<path
|
|
7
|
+
<path
|
|
8
|
+
d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
fill="transparent"
|
|
11
|
+
strokeLinecap="round"
|
|
12
|
+
strokeLinejoin="round"
|
|
13
|
+
/>
|
|
8
14
|
</svg>
|
|
9
15
|
);
|
|
10
16
|
}
|
|
@@ -7,19 +7,37 @@ function IconLightMode(props) {
|
|
|
7
7
|
<g clipPath="url(#clip0_833_8168)">
|
|
8
8
|
<path
|
|
9
9
|
d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z"
|
|
10
|
-
stroke="currentColor"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<path d="
|
|
15
|
-
<path d="
|
|
16
|
-
<path d="
|
|
17
|
-
<path
|
|
18
|
-
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
strokeLinecap="round"
|
|
12
|
+
strokeLinejoin="round"
|
|
13
|
+
/>
|
|
14
|
+
<path d="M6.59985 0.5V1.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
15
|
+
<path d="M6.59985 10.5V11.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
16
|
+
<path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
17
|
+
<path
|
|
18
|
+
d="M9.77991 9.17999L10.4899 9.88999"
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
strokeLinecap="round"
|
|
21
|
+
strokeLinejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
<path d="M1.09998 6H2.09998" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
24
|
+
<path d="M11.0999 6H12.0999" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
25
|
+
<path
|
|
26
|
+
d="M2.7099 9.88999L3.4199 9.17999"
|
|
27
|
+
stroke="currentColor"
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d="M9.77991 2.82L10.4899 2.11"
|
|
33
|
+
stroke="currentColor"
|
|
34
|
+
strokeLinecap="round"
|
|
35
|
+
strokeLinejoin="round"
|
|
36
|
+
/>
|
|
19
37
|
</g>
|
|
20
38
|
<defs>
|
|
21
39
|
<clipPath id="clip0_833_8168">
|
|
22
|
-
<rect width="12" height="12" fill="white" transform="translate(0.599976)"/>
|
|
40
|
+
<rect width="12" height="12" fill="white" transform="translate(0.599976)" />
|
|
23
41
|
</clipPath>
|
|
24
42
|
</defs>
|
|
25
43
|
</svg>
|
|
@@ -101,10 +101,7 @@ const onOpenInChatGPTClick = () => {
|
|
|
101
101
|
const prompt = getPrompt(window.location.href);
|
|
102
102
|
|
|
103
103
|
try {
|
|
104
|
-
window.open(
|
|
105
|
-
`https://chatgpt.com/?hints=search&q=${encodeURIComponent(prompt)}`,
|
|
106
|
-
'_blank',
|
|
107
|
-
);
|
|
104
|
+
window.open(`https://chatgpt.com/?hints=search&q=${encodeURIComponent(prompt)}`, '_blank');
|
|
108
105
|
} catch (error) {
|
|
109
106
|
console.error('Error opening ChatGPT:', error);
|
|
110
107
|
}
|
|
@@ -122,10 +119,7 @@ const onOpenInClaudeClick = () => {
|
|
|
122
119
|
const prompt = getPrompt(window.location.href);
|
|
123
120
|
|
|
124
121
|
try {
|
|
125
|
-
window.open(
|
|
126
|
-
`https://claude.ai/new?q=${encodeURIComponent(prompt)}`,
|
|
127
|
-
'_blank',
|
|
128
|
-
);
|
|
122
|
+
window.open(`https://claude.ai/new?q=${encodeURIComponent(prompt)}`, '_blank');
|
|
129
123
|
} catch (error) {
|
|
130
124
|
console.error('Error opening Claude:', error);
|
|
131
125
|
}
|
|
@@ -143,12 +137,7 @@ const onOpenInPerplexityClick = () => {
|
|
|
143
137
|
const prompt = getPrompt(window.location.href);
|
|
144
138
|
|
|
145
139
|
try {
|
|
146
|
-
window.open(
|
|
147
|
-
`https://www.perplexity.ai/search/new?q=${encodeURIComponent(
|
|
148
|
-
prompt,
|
|
149
|
-
)}`,
|
|
150
|
-
'_blank',
|
|
151
|
-
);
|
|
140
|
+
window.open(`https://www.perplexity.ai/search/new?q=${encodeURIComponent(prompt)}`, '_blank');
|
|
152
141
|
} catch (error) {
|
|
153
142
|
console.error('Error opening Perplexity:', error);
|
|
154
143
|
}
|
|
@@ -303,20 +292,10 @@ function getButtonText({ status }) {
|
|
|
303
292
|
}
|
|
304
293
|
}
|
|
305
294
|
|
|
306
|
-
const MenuBase = ({
|
|
307
|
-
children,
|
|
308
|
-
ref,
|
|
309
|
-
copyingStatus,
|
|
310
|
-
setCopyingStatus,
|
|
311
|
-
chevronIconRef,
|
|
312
|
-
...props
|
|
313
|
-
}) => (
|
|
295
|
+
const MenuBase = ({ children, ref, copyingStatus, setCopyingStatus, chevronIconRef, ...props }) => (
|
|
314
296
|
<div ref={ref} className={styles.llmButtonWrapper}>
|
|
315
297
|
<div className={styles.llmButton}>
|
|
316
|
-
<div
|
|
317
|
-
className={styles.copyUpIconWrapper}
|
|
318
|
-
onClick={() => onCopyAsMarkdownClick({ setCopyingStatus })}
|
|
319
|
-
>
|
|
298
|
+
<div className={styles.copyUpIconWrapper} onClick={() => onCopyAsMarkdownClick({ setCopyingStatus })}>
|
|
320
299
|
{copyingStatus === 'loading' && <LoaderIcon size={16} />}
|
|
321
300
|
{copyingStatus === 'copied' && <CheckIcon size={16} />}
|
|
322
301
|
{copyingStatus === 'idle' && <CopyIcon size={16} />}
|
|
@@ -349,12 +328,7 @@ const Option = ({ Icon, label, description, showExternalIcon }) => (
|
|
|
349
328
|
{description}
|
|
350
329
|
</Text>
|
|
351
330
|
</div>
|
|
352
|
-
{showExternalIcon &&
|
|
353
|
-
<ExternalLinkIcon
|
|
354
|
-
size={16}
|
|
355
|
-
className={styles.menuOptionExternalIcon}
|
|
356
|
-
/>
|
|
357
|
-
)}
|
|
331
|
+
{showExternalIcon && <ExternalLinkIcon size={16} className={styles.menuOptionExternalIcon} />}
|
|
358
332
|
</div>
|
|
359
333
|
);
|
|
360
334
|
|
|
@@ -398,11 +372,7 @@ export default function LLMButtons({ isApiReferencePage = false }) {
|
|
|
398
372
|
className={clsx(styles.llmMenu, {
|
|
399
373
|
[styles.llmMenuApiReferencePage]: isApiReferencePage,
|
|
400
374
|
})}
|
|
401
|
-
onMenuOpen={(isOpen) => chevronIconRef.current?.classList.toggle(
|
|
402
|
-
styles.chevronIconOpen,
|
|
403
|
-
isOpen,
|
|
404
|
-
)
|
|
405
|
-
}
|
|
375
|
+
onMenuOpen={(isOpen) => chevronIconRef.current?.classList.toggle(styles.chevronIconOpen, isOpen)}
|
|
406
376
|
components={{
|
|
407
377
|
MenuBase: (props) => (
|
|
408
378
|
<MenuBase
|
|
@@ -8,7 +8,9 @@ import { usePluginData } from '@docusaurus/useGlobalData';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
export default function LayoutWrapper(props) {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
options: { subNavbar },
|
|
13
|
+
} = usePluginData('@apify/docs-theme');
|
|
12
14
|
const baseUrl = useBaseUrl('/');
|
|
13
15
|
const { pathname } = useLocation();
|
|
14
16
|
const currentPath = pathname.replace(new RegExp(`^${baseUrl}`), '').trim();
|
|
@@ -20,8 +22,8 @@ export default function LayoutWrapper(props) {
|
|
|
20
22
|
'typedoc-plugin-default': typedocPluginData,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
const isVersionedPage = Object.values(allPluginData).some(
|
|
24
|
-
|
|
25
|
+
const isVersionedPage = Object.values(allPluginData).some((pluginData) =>
|
|
26
|
+
pluginData.versions?.some((version) => !version.isLast && pathname.startsWith(version.path)),
|
|
25
27
|
);
|
|
26
28
|
|
|
27
29
|
const shouldRenderAlternateLink = currentPath && currentPath !== '404' && !isVersionedPage;
|
|
@@ -31,11 +33,9 @@ export default function LayoutWrapper(props) {
|
|
|
31
33
|
return (
|
|
32
34
|
<>
|
|
33
35
|
<Head>
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
: null
|
|
38
|
-
}
|
|
36
|
+
{shouldRenderAlternateLink ? (
|
|
37
|
+
<link rel="alternate" type="text/markdown" href={alternateMarkdownLink} />
|
|
38
|
+
) : null}
|
|
39
39
|
</Head>
|
|
40
40
|
<div
|
|
41
41
|
style={{
|
|
@@ -43,7 +43,8 @@ export default function LayoutWrapper(props) {
|
|
|
43
43
|
margin: 0,
|
|
44
44
|
padding: 0,
|
|
45
45
|
boxSizing: 'border-box',
|
|
46
|
-
}}
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
47
48
|
<Layout {...props} />
|
|
48
49
|
</div>
|
|
49
50
|
</>
|
package/src/theme/Logo/index.js
CHANGED
|
@@ -22,11 +22,7 @@ function LogoThemedImage({ logo, alt, imageClassName }) {
|
|
|
22
22
|
);
|
|
23
23
|
// Is this extra div really necessary?
|
|
24
24
|
// introduced in https://github.com/facebook/docusaurus/pull/5666
|
|
25
|
-
return imageClassName ?
|
|
26
|
-
<div className={imageClassName}>{themedImage}</div>
|
|
27
|
-
) : (
|
|
28
|
-
themedImage
|
|
29
|
-
);
|
|
25
|
+
return imageClassName ? <div className={imageClassName}>{themedImage}</div> : themedImage;
|
|
30
26
|
}
|
|
31
27
|
export default function Logo(props) {
|
|
32
28
|
const {
|
|
@@ -44,17 +40,8 @@ export default function Logo(props) {
|
|
|
44
40
|
// and provide a sensible fallback otherwise.
|
|
45
41
|
const alt = logo?.alt ?? fallbackAlt;
|
|
46
42
|
return (
|
|
47
|
-
<Link
|
|
48
|
-
|
|
49
|
-
{...propsRest}
|
|
50
|
-
{...(logo?.target && { target: logo.target })}>
|
|
51
|
-
{logo && (
|
|
52
|
-
<LogoThemedImage
|
|
53
|
-
logo={logo}
|
|
54
|
-
alt={alt}
|
|
55
|
-
imageClassName={imageClassName}
|
|
56
|
-
/>
|
|
57
|
-
)}
|
|
43
|
+
<Link to={logoLink} {...propsRest} {...(logo?.target && { target: logo.target })}>
|
|
44
|
+
{logo && <LogoThemedImage logo={logo} alt={alt} imageClassName={imageClassName} />}
|
|
58
45
|
{!logo ? <b className={titleClassName}>{navbarTitle}</b> : null}
|
|
59
46
|
</Link>
|
|
60
47
|
);
|
|
@@ -20,12 +20,17 @@ export default function MDXA(props) {
|
|
|
20
20
|
|
|
21
21
|
// links to a different docusaurus instance cannot go through the client side navigation, we need a hard redirect
|
|
22
22
|
if (props.href && isDifferentInstance(props.href)) {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
return (
|
|
24
|
+
<a
|
|
25
|
+
{...props}
|
|
26
|
+
onClick={(e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
window.location.assign(props.href);
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{props.children}
|
|
32
|
+
</a>
|
|
33
|
+
);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
return <Link {...props} />;
|
|
@@ -35,8 +35,9 @@ export default function MDXCode(props) {
|
|
|
35
35
|
'wbr',
|
|
36
36
|
];
|
|
37
37
|
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
38
|
-
(el) =>
|
|
39
|
-
|
|
38
|
+
(el) =>
|
|
39
|
+
(typeof el === 'string' && !el.includes('\n')) ||
|
|
40
|
+
(isValidElement(el) && inlineElements.includes(el.props?.mdxType)),
|
|
40
41
|
);
|
|
41
42
|
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
|
42
43
|
}
|
|
@@ -5,9 +5,7 @@ export default function MDXDetails(props) {
|
|
|
5
5
|
const items = React.Children.toArray(props.children);
|
|
6
6
|
// Split summary item from the rest to pass it as a separate prop to the
|
|
7
7
|
// Details theme component
|
|
8
|
-
const summary = items.find(
|
|
9
|
-
(item) => React.isValidElement(item) && item.type === 'summary',
|
|
10
|
-
);
|
|
8
|
+
const summary = items.find((item) => React.isValidElement(item) && item.type === 'summary');
|
|
11
9
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
12
10
|
return (
|
|
13
11
|
<Details {...props} summary={summary}>
|
|
@@ -10,7 +10,8 @@ function unwrapMDXElement(element) {
|
|
|
10
10
|
return element;
|
|
11
11
|
}
|
|
12
12
|
export default function MDXHead(props) {
|
|
13
|
-
const unwrappedChildren = React.Children.map(props.children, (child) =>
|
|
13
|
+
const unwrappedChildren = React.Children.map(props.children, (child) =>
|
|
14
|
+
React.isValidElement(child) ? unwrapMDXElement(child) : child,
|
|
14
15
|
);
|
|
15
16
|
return <Head {...props}>{unwrappedChildren}</Head>;
|
|
16
17
|
}
|