@apify/docs-theme 1.0.143 → 1.0.144
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/docs-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.144",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apify/docs-search-modal": "^1.1.1",
|
|
23
|
-
"@docusaurus/theme-common": "
|
|
23
|
+
"@docusaurus/theme-common": "3.6.3",
|
|
24
24
|
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
|
|
25
25
|
"axios": "^1.7.4",
|
|
26
26
|
"babel-loader": "^9.1.3",
|
package/src/roa-loader/index.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { createHash } = require('node:crypto');
|
|
2
|
+
const { inspect } = require('node:util');
|
|
2
3
|
|
|
3
4
|
const { urlToRequest } = require('loader-utils');
|
|
4
5
|
|
|
5
6
|
const signingUrl = new URL('https://api.apify.com/v2/tools/encode-and-sign');
|
|
6
7
|
signingUrl.searchParams.set('token', process.env.APIFY_SIGNING_TOKEN);
|
|
7
8
|
const queue = [];
|
|
9
|
+
const cache = {};
|
|
8
10
|
let working = false;
|
|
9
11
|
|
|
12
|
+
function hash(source) {
|
|
13
|
+
return createHash('sha1').update(source).digest('hex');
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
async function getHash(source) {
|
|
17
|
+
const cacheKey = hash(source);
|
|
18
|
+
|
|
19
|
+
if (cache[cacheKey]) {
|
|
20
|
+
return cache[cacheKey];
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
const memory = source.match(/playwright|puppeteer/i) ? 4096 : 1024;
|
|
12
24
|
const res = await (await fetch(signingUrl, {
|
|
13
25
|
method: 'POST',
|
|
@@ -25,14 +37,15 @@ async function getHash(source) {
|
|
|
25
37
|
},
|
|
26
38
|
})).json();
|
|
27
39
|
|
|
28
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
29
|
-
|
|
30
40
|
if (!res.data || !res.data.encoded) {
|
|
31
41
|
// eslint-disable-next-line no-console
|
|
32
42
|
console.error(`Signing failed:' ${inspect(res.error) || 'Unknown error'}`, res);
|
|
33
43
|
return 'invalid-token';
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
cache[cacheKey] = res.data.encoded;
|
|
47
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
48
|
+
|
|
36
49
|
return res.data.encoded;
|
|
37
50
|
}
|
|
38
51
|
|
|
@@ -68,7 +81,7 @@ module.exports = async function (code) {
|
|
|
68
81
|
|
|
69
82
|
// eslint-disable-next-line no-console
|
|
70
83
|
console.log(`Signing ${urlToRequest(this.resourcePath)}...`, { working, queue: queue.length });
|
|
71
|
-
const
|
|
84
|
+
const codeHash = await encodeAndSign(code);
|
|
72
85
|
|
|
73
|
-
return { code, hash };
|
|
86
|
+
return { code, hash: codeHash };
|
|
74
87
|
};
|
|
@@ -31,6 +31,12 @@ export default function DocSidebarItemLink({
|
|
|
31
31
|
props.target = '_self';
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
if (item.customProps) {
|
|
35
|
+
for (const key of Object.keys(item.customProps)) {
|
|
36
|
+
props[`data-${key}`] = item.customProps[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
return (
|
|
35
41
|
<li
|
|
36
42
|
className={clsx(
|
|
@@ -2,12 +2,17 @@ import React from 'react';
|
|
|
2
2
|
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
|
|
3
3
|
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
|
|
4
4
|
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
5
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
6
|
+
import { useLocation } from '@docusaurus/router';
|
|
5
7
|
|
|
6
8
|
export default function LayoutWrapper(props) {
|
|
7
9
|
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
|
|
10
|
+
const baseUrl = useBaseUrl('/');
|
|
11
|
+
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '');
|
|
12
|
+
|
|
8
13
|
return (
|
|
9
14
|
<div style={{
|
|
10
|
-
'--ifm-navbar-height': subNavbar ? '123px' : '68px',
|
|
15
|
+
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
|
|
11
16
|
'margin': 0,
|
|
12
17
|
'padding': 0,
|
|
13
18
|
'boxSizing': 'border-box',
|
package/src/theme/custom.css
CHANGED
|
@@ -1619,3 +1619,153 @@ iframe[src*="youtube"] {
|
|
|
1619
1619
|
margin-top: -130px;
|
|
1620
1620
|
position: absolute;
|
|
1621
1621
|
}
|
|
1622
|
+
|
|
1623
|
+
.redocusaurus .openapi-clients-box {
|
|
1624
|
+
display: block;
|
|
1625
|
+
float: right;
|
|
1626
|
+
padding-left: 6px;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
.redocusaurus .openapi-clients-box-heading {
|
|
1630
|
+
display: inline-block;
|
|
1631
|
+
font-family: 'San Francisco', Helvetica, Arial, sans-serif;
|
|
1632
|
+
color: #6C7590;
|
|
1633
|
+
font-style: normal;
|
|
1634
|
+
font-weight: 700;
|
|
1635
|
+
font-size: 14px;
|
|
1636
|
+
line-height: 20px;
|
|
1637
|
+
text-transform: uppercase;
|
|
1638
|
+
padding-bottom: 6px;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.redocusaurus .openapi-clients-box-icon {
|
|
1642
|
+
display: block;
|
|
1643
|
+
padding-bottom: 6px;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
.theme-api-markdown .openapi-clients-box {
|
|
1647
|
+
display: block;
|
|
1648
|
+
float: right;
|
|
1649
|
+
padding-left: 6px;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
.theme-api-markdown .openapi-clients-box-heading {
|
|
1653
|
+
display: inline-block;
|
|
1654
|
+
font-family: 'San Francisco', Helvetica, Arial, sans-serif;
|
|
1655
|
+
color: #6C7590;
|
|
1656
|
+
font-style: normal;
|
|
1657
|
+
font-weight: 700;
|
|
1658
|
+
font-size: 14px;
|
|
1659
|
+
line-height: 20px;
|
|
1660
|
+
text-transform: uppercase;
|
|
1661
|
+
padding-bottom: 6px;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.theme-api-markdown .openapi-clients-box-icon {
|
|
1665
|
+
display: block;
|
|
1666
|
+
padding-bottom: 6px;
|
|
1667
|
+
margin: 0 !important;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
.theme-api-markdown .openapi__method-endpoint-path,
|
|
1671
|
+
.theme-api-markdown .openapi-security__summary-header {
|
|
1672
|
+
margin-top: 0;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.theme-api-markdown .prism-code .token-line::before {
|
|
1676
|
+
display: none !important;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
.menu__list-item--deprecated > .menu__link,
|
|
1680
|
+
.menu__list-item--deprecated > .menu__link:hover {
|
|
1681
|
+
text-decoration: line-through;
|
|
1682
|
+
text-decoration-thickness: 2px !important;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.api-method > .menu__link,
|
|
1686
|
+
.schema > .menu__link {
|
|
1687
|
+
align-items: center;
|
|
1688
|
+
justify-content: start;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
.api-method > .menu__link::before,
|
|
1692
|
+
.schema > .menu__link::before {
|
|
1693
|
+
width: 55px;
|
|
1694
|
+
height: 20px;
|
|
1695
|
+
font-size: 10px;
|
|
1696
|
+
line-height: 20px;
|
|
1697
|
+
text-transform: uppercase;
|
|
1698
|
+
font-weight: 600;
|
|
1699
|
+
vertical-align: middle;
|
|
1700
|
+
font-family: var(--ifm-font-family-monospace);
|
|
1701
|
+
border-radius: 0.25rem;
|
|
1702
|
+
border: 1px solid;
|
|
1703
|
+
border-inline-start-width: 5px;
|
|
1704
|
+
margin-right: 8px;
|
|
1705
|
+
padding: 3px 5px 3px 4px;
|
|
1706
|
+
text-align: center;
|
|
1707
|
+
flex-shrink: 0;
|
|
1708
|
+
position: relative;
|
|
1709
|
+
top: -1.5px;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
.get > .menu__link::before {
|
|
1713
|
+
content: 'get';
|
|
1714
|
+
background-color: var(--ifm-color-info-contrast-background);
|
|
1715
|
+
color: var(--ifm-color-info-contrast-foreground);
|
|
1716
|
+
border-color: var(--ifm-color-info-dark);
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
.post > .menu__link::before {
|
|
1720
|
+
content: 'post';
|
|
1721
|
+
background-color: var(--ifm-color-success-contrast-background);
|
|
1722
|
+
color: var(--ifm-color-success-contrast-foreground);
|
|
1723
|
+
border-color: var(--ifm-color-success-dark);
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
.delete > .menu__link::before {
|
|
1727
|
+
content: 'del';
|
|
1728
|
+
background-color: var(--ifm-color-danger-contrast-background);
|
|
1729
|
+
color: var(--ifm-color-danger-contrast-foreground);
|
|
1730
|
+
border-color: var(--ifm-color-danger-dark);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
.put > .menu__link::before {
|
|
1734
|
+
content: 'put';
|
|
1735
|
+
background-color: var(--ifm-color-warning-contrast-background);
|
|
1736
|
+
color: var(--ifm-color-warning-contrast-foreground);
|
|
1737
|
+
border-color: var(--ifm-color-warning-dark);
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
.patch > .menu__link::before {
|
|
1741
|
+
content: 'patch';
|
|
1742
|
+
background-color: var(--ifm-color-success-contrast-background);
|
|
1743
|
+
color: var(--ifm-color-success-contrast-foreground);
|
|
1744
|
+
border-color: var(--ifm-color-success-dark);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
.head > .menu__link::before {
|
|
1748
|
+
content: 'head';
|
|
1749
|
+
background-color: var(--ifm-color-secondary-contrast-background);
|
|
1750
|
+
color: var(--ifm-color-secondary-contrast-foreground);
|
|
1751
|
+
border-color: var(--ifm-color-secondary-dark);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
.event > .menu__link::before {
|
|
1755
|
+
content: 'event';
|
|
1756
|
+
background-color: var(--ifm-color-secondary-contrast-background);
|
|
1757
|
+
color: var(--ifm-color-secondary-contrast-foreground);
|
|
1758
|
+
border-color: var(--ifm-color-secondary-dark);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
.schema > .menu__link::before {
|
|
1762
|
+
content: 'schema';
|
|
1763
|
+
background-color: var(--ifm-color-secondary-contrast-background);
|
|
1764
|
+
color: var(--ifm-color-secondary-contrast-foreground);
|
|
1765
|
+
border-color: var(--ifm-color-secondary-dark);
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
.theme-doc-markdown .openapi__heading {
|
|
1769
|
+
font-size: var(--ifm-h1-font-size);
|
|
1770
|
+
margin-bottom: calc(var(--ifm-h1-vertical-rhythm-bottom)* var(--ifm-leading)) !important;
|
|
1771
|
+
}
|
package/static/js/custom.js
CHANGED
|
@@ -61,6 +61,45 @@ function scrollSidebarItemIntoView() {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// handles automatic scrolling of the API reference sidebar (openapi-docs)
|
|
65
|
+
function scrollOpenApiSidebarItemIntoView() {
|
|
66
|
+
const $li = document.querySelector(`li > a.menu__link--active[href]`);
|
|
67
|
+
|
|
68
|
+
if (!$li) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
$li.scrollIntoView({
|
|
73
|
+
block: 'nearest',
|
|
74
|
+
inline: 'center',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function redirectOpenApiDocs() {
|
|
79
|
+
const { hash, pathname } = new URL(window.location.href);
|
|
80
|
+
|
|
81
|
+
// TODO change to '/api/v2'
|
|
82
|
+
if (pathname.replace(/\/$/, '') !== '/api/v2-new') {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (hash.startsWith('#/reference/')) {
|
|
87
|
+
const sidebarItems = document.querySelectorAll('[data-altids]');
|
|
88
|
+
|
|
89
|
+
for (const item of sidebarItems) {
|
|
90
|
+
const ids = item.getAttribute('data-altids').split(',');
|
|
91
|
+
if (ids.find((variant) => variant === hash)) {
|
|
92
|
+
item.click();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (hash.startsWith('#tag/')) {
|
|
98
|
+
const id = hash.substring('#tag/'.length);
|
|
99
|
+
console.log('redirect', { id, hash });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
64
103
|
let ticking = false;
|
|
65
104
|
|
|
66
105
|
document.addEventListener('scroll', () => {
|
|
@@ -75,7 +114,16 @@ document.addEventListener('scroll', () => {
|
|
|
75
114
|
}
|
|
76
115
|
});
|
|
77
116
|
|
|
78
|
-
|
|
117
|
+
window.addEventListener('load', () => {
|
|
118
|
+
setTimeout(() => redirectOpenApiDocs(), 500);
|
|
119
|
+
|
|
79
120
|
// we need to wait a bit more, since the event fires too soon, and a lot of hydration is done after it
|
|
80
|
-
setTimeout(() => scrollSidebarItemIntoView(),
|
|
121
|
+
setTimeout(() => scrollSidebarItemIntoView(), 1000);
|
|
122
|
+
|
|
123
|
+
// docusaurus-openapi-docs plugin: scroll sidebar into viewport, no need for a large timeout here
|
|
124
|
+
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 100);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
window.addEventListener('popstate', () => {
|
|
128
|
+
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 50);
|
|
81
129
|
});
|