docusaurus-theme-openapi-docs 0.0.0-beta.722 → 0.0.0-beta.727

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.
@@ -44,9 +44,11 @@ function ApiItem(props) {
44
44
  const { schema } = frontMatter;
45
45
  // decompress and parse
46
46
  if (api) {
47
- api = JSON.parse(
48
- zlib_1.default.inflateSync(Buffer.from(api, "base64")).toString()
49
- );
47
+ try {
48
+ api = JSON.parse(
49
+ zlib_1.default.inflateSync(Buffer.from(api, "base64")).toString()
50
+ );
51
+ } catch {}
50
52
  }
51
53
  const { siteConfig } = (0, useDocusaurusContext_1.default)();
52
54
  const themeConfig = siteConfig.themeConfig;
@@ -114,11 +114,17 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) {
114
114
  resizeObserver.disconnect();
115
115
  };
116
116
  }, []);
117
- const handleRightClick = () => {
118
- tabItemListContainerRef.current.scrollLeft += 90;
117
+ const handleRightClick = (e) => {
118
+ e.preventDefault();
119
+ if (tabItemListContainerRef.current) {
120
+ tabItemListContainerRef.current.scrollLeft += 90;
121
+ }
119
122
  };
120
- const handleLeftClick = () => {
121
- tabItemListContainerRef.current.scrollLeft -= 90;
123
+ const handleLeftClick = (e) => {
124
+ e.preventDefault();
125
+ if (tabItemListContainerRef.current) {
126
+ tabItemListContainerRef.current.scrollLeft -= 90;
127
+ }
122
128
  };
123
129
  return react_1.default.createElement(
124
130
  "div",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-beta.722",
4
+ "version": "0.0.0-beta.727",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -44,7 +44,7 @@
44
44
  "clsx": "^1.1.1",
45
45
  "copy-text-to-clipboard": "^3.1.0",
46
46
  "crypto-js": "^4.1.1",
47
- "docusaurus-plugin-openapi-docs": "0.0.0-beta.722",
47
+ "docusaurus-plugin-openapi-docs": "0.0.0-beta.727",
48
48
  "docusaurus-plugin-sass": "^0.2.3",
49
49
  "file-saver": "^2.0.5",
50
50
  "lodash": "^4.17.20",
@@ -69,5 +69,5 @@
69
69
  "engines": {
70
70
  "node": ">=14"
71
71
  },
72
- "gitHead": "cae8c487b81918ef2cab2c7338deaae407b4dc2b"
72
+ "gitHead": "3269c28557138d879701d00fe96c054c708155cc"
73
73
  }
@@ -56,11 +56,12 @@ export default function ApiItem(props: Props): JSX.Element {
56
56
  const { schema } = frontMatter as SchemaFrontMatter;
57
57
  // decompress and parse
58
58
  if (api) {
59
- api = JSON.parse(
60
- zlib.inflateSync(Buffer.from(api as any, "base64")).toString()
61
- );
59
+ try {
60
+ api = JSON.parse(
61
+ zlib.inflateSync(Buffer.from(api as any, "base64")).toString()
62
+ );
63
+ } catch {}
62
64
  }
63
-
64
65
  const { siteConfig } = useDocusaurusContext();
65
66
  const themeConfig = siteConfig.themeConfig as ThemeConfig;
66
67
  const options = themeConfig.api;
@@ -11,6 +11,7 @@ import React, {
11
11
  useEffect,
12
12
  useState,
13
13
  ReactElement,
14
+ LegacyRef,
14
15
  } from "react";
15
16
 
16
17
  import {
@@ -99,12 +100,18 @@ function TabList({
99
100
  };
100
101
  }, []);
101
102
 
102
- const handleRightClick = () => {
103
- tabItemListContainerRef.current!.scrollLeft += 90;
103
+ const handleRightClick = (e: any) => {
104
+ e.preventDefault();
105
+ if (tabItemListContainerRef.current) {
106
+ tabItemListContainerRef.current.scrollLeft += 90;
107
+ }
104
108
  };
105
109
 
106
- const handleLeftClick = () => {
107
- tabItemListContainerRef.current!.scrollLeft -= 90;
110
+ const handleLeftClick = (e: any) => {
111
+ e.preventDefault();
112
+ if (tabItemListContainerRef.current) {
113
+ tabItemListContainerRef.current.scrollLeft -= 90;
114
+ }
108
115
  };
109
116
 
110
117
  return (
@@ -116,7 +123,7 @@ function TabList({
116
123
  />
117
124
  )}
118
125
  <ul
119
- ref={tabItemListContainerRef}
126
+ ref={tabItemListContainerRef as LegacyRef<HTMLUListElement>}
120
127
  role="tablist"
121
128
  aria-orientation="horizontal"
122
129
  className={clsx(