@apify/docs-theme 1.0.149 → 1.0.151

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.149",
3
+ "version": "1.0.151",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "axios": "^1.7.4",
26
26
  "babel-loader": "^9.1.3",
27
27
  "docusaurus-gtm-plugin": "^0.0.2",
28
- "postcss-preset-env": "^9.3.0",
28
+ "postcss-preset-env": "^10.0.0",
29
29
  "prism-react-renderer": "^2.0.6",
30
30
  "remark-parse": "^11.0.0",
31
31
  "remark-stringify": "^11.0.0",
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import { PageMetadata } from '@docusaurus/theme-common';
3
2
  import Layout from '@theme/Layout';
3
+ import React from 'react';
4
4
 
5
5
  export default function NotFound() {
6
6
  return (
@@ -17,6 +17,7 @@ import {
17
17
  } from '@docusaurus/theme-common/internal';
18
18
  import Translate, { translate } from '@docusaurus/Translate';
19
19
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
20
+ import { useLocation } from '@docusaurus/router';
20
21
  import {
21
22
  useAlgoliaThemeConfig,
22
23
  useSearchResultUrlProcessor,
@@ -120,6 +121,8 @@ function SearchPageContent() {
120
121
  const documentsFoundPlural = useDocumentsFoundPlural();
121
122
  const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
122
123
  const [searchQuery, setSearchQuery] = useSearchQueryString();
124
+ const location = useLocation();
125
+ const notFound = new URLSearchParams(location.search).get('not-found');
123
126
  const initialSearchResultState = {
124
127
  items: [],
125
128
  query: null,
@@ -302,7 +305,14 @@ function SearchPageContent() {
302
305
  </Head>
303
306
 
304
307
  <div className="container margin-vert--lg">
305
- <h1>{getTitle()}</h1>
308
+ {notFound ? (
309
+ <>
310
+ <h1>Page Not Found</h1>
311
+ <h2>{getTitle()}</h2>
312
+ </>
313
+ ) : (
314
+ <h1>{getTitle()}</h1>
315
+ )}
306
316
 
307
317
  <form className="row" onSubmit={(e) => e.preventDefault()}>
308
318
  <div
@@ -990,7 +990,8 @@ html[data-theme='dark'] .actionLink:hover::after {
990
990
  }
991
991
  }
992
992
 
993
- aside li.section-header > div > .menu__link {
993
+ aside li.section-header > div > .menu__link,
994
+ aside li.section-header > ul > li > div > .menu__link {
994
995
  text-transform: uppercase;
995
996
  opacity: 0.8;
996
997
  font-size: 16px;
@@ -998,6 +999,10 @@ aside li.section-header > div > .menu__link {
998
999
  margin: 0;
999
1000
  }
1000
1001
 
1002
+ aside li.section-header > div > .menu__link {
1003
+ font-size: 20px;
1004
+ }
1005
+
1001
1006
  aside li.section-header.menu__list-item {
1002
1007
  margin-top: 15px;
1003
1008
  margin-bottom: 5px;
@@ -1011,6 +1016,11 @@ aside li.section-header > .menu__list {
1011
1016
  padding-left: 0;
1012
1017
  }
1013
1018
 
1019
+ .theme-doc-sidebar-menu li.section-header > ul > li .menu__list-item-collapsible:hover,
1020
+ .theme-doc-sidebar-menu li.section-header > ul > li .menu__list-item-collapsible--active {
1021
+ background: inherit !important;
1022
+ }
1023
+
1014
1024
  .beta-chip {
1015
1025
  display: inline-block;
1016
1026
  border: 1px solid #ccc;
@@ -63,7 +63,7 @@ function scrollSidebarItemIntoView() {
63
63
 
64
64
  // handles automatic scrolling of the API reference sidebar (openapi-docs)
65
65
  function scrollOpenApiSidebarItemIntoView() {
66
- const $li = document.querySelector(`li > a.menu__link--active[href]`);
66
+ const $li = document.querySelector(`ul.theme-doc-sidebar-menu a.menu__link--active[href]`);
67
67
 
68
68
  if (!$li) {
69
69
  return;
@@ -76,27 +76,31 @@ function scrollOpenApiSidebarItemIntoView() {
76
76
  }
77
77
 
78
78
  function redirectOpenApiDocs() {
79
- const { hash, pathname } = new URL(window.location.href);
79
+ const { hash, pathname, origin } = new URL(window.location.href);
80
80
 
81
81
  // TODO change to '/api/v2'
82
82
  if (pathname.replace(/\/$/, '') !== '/api/v2-new') {
83
83
  return;
84
84
  }
85
85
 
86
- if (hash.startsWith('#/reference/')) {
87
- const sidebarItems = document.querySelectorAll('[data-altids]');
86
+ const sidebarItems = document.querySelectorAll('[data-altids]');
87
+
88
+ if (hash.startsWith('#/reference/') || hash.startsWith('#tag/')) {
89
+ let matched = false;
88
90
 
89
91
  for (const item of sidebarItems) {
90
92
  const ids = item.getAttribute('data-altids').split(',');
93
+
91
94
  if (ids.find((variant) => variant === hash)) {
95
+ matched = true;
92
96
  item.click();
97
+ setTimeout(() => scrollOpenApiSidebarItemIntoView(), 200);
93
98
  }
94
99
  }
95
- }
96
100
 
97
- if (hash.startsWith('#tag/')) {
98
- const id = hash.substring('#tag/'.length);
99
- console.log('redirect', { id, hash });
101
+ if (!matched) {
102
+ window.location.href = `${origin}/search?q=${hash.slice(1)}&not-found=1`;
103
+ }
100
104
  }
101
105
  }
102
106
 
@@ -121,7 +125,7 @@ window.addEventListener('load', () => {
121
125
  setTimeout(() => scrollSidebarItemIntoView(), 1000);
122
126
 
123
127
  // docusaurus-openapi-docs plugin: scroll sidebar into viewport, no need for a large timeout here
124
- setTimeout(() => scrollOpenApiSidebarItemIntoView(), 100);
128
+ setTimeout(() => scrollOpenApiSidebarItemIntoView(), 200);
125
129
  });
126
130
 
127
131
  window.addEventListener('popstate', () => {