docusaurus-theme-openapi-docs 0.0.0-1295 → 0.0.0-1310

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.
Files changed (57) hide show
  1. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +4 -2
  2. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +9 -6
  3. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +1 -1
  4. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +1 -1
  5. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +1 -1
  6. package/lib/theme/ApiExplorer/CodeTabs/index.js +6 -5
  7. package/lib/theme/ApiTabs/index.d.ts +1 -1
  8. package/lib/theme/ApiTabs/index.js +6 -5
  9. package/lib/theme/DiscriminatorTabs/index.d.ts +1 -1
  10. package/lib/theme/DiscriminatorTabs/index.js +6 -5
  11. package/lib/theme/MimeTabs/index.d.ts +1 -1
  12. package/lib/theme/MimeTabs/index.js +6 -5
  13. package/lib/theme/OperationTabs/index.d.ts +1 -1
  14. package/lib/theme/OperationTabs/index.js +6 -5
  15. package/lib/theme/SchemaTabs/index.d.ts +1 -1
  16. package/lib/theme/SchemaTabs/index.js +6 -5
  17. package/lib/theme/TabItem/index.d.ts +5 -0
  18. package/lib/theme/TabItem/index.js +51 -0
  19. package/lib/theme/TabItem/styles.module.css +3 -0
  20. package/lib/theme/Tabs/index.d.ts +5 -0
  21. package/lib/theme/Tabs/index.js +148 -0
  22. package/lib/theme/Tabs/styles.module.css +7 -0
  23. package/lib/theme/utils/codeBlockUtils.d.ts +28 -0
  24. package/lib/theme/utils/codeBlockUtils.js +223 -0
  25. package/lib/theme/utils/reactUtils.d.ts +1 -0
  26. package/lib/theme/utils/reactUtils.js +23 -0
  27. package/lib/theme/utils/scrollUtils.d.ts +7 -0
  28. package/lib/theme/utils/scrollUtils.js +175 -0
  29. package/lib/theme/utils/tabsUtils.d.ts +47 -0
  30. package/lib/theme/utils/tabsUtils.js +299 -0
  31. package/lib/theme/utils/useCodeWordWrap.d.ts +8 -0
  32. package/lib/theme/utils/useCodeWordWrap.js +84 -0
  33. package/lib/theme/utils/useMutationObserver.d.ts +3 -0
  34. package/lib/theme/utils/useMutationObserver.js +34 -0
  35. package/package.json +4 -4
  36. package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +2 -1
  37. package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +8 -7
  38. package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +1 -1
  39. package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +1 -1
  40. package/src/theme/ApiExplorer/CodeTabs/index.tsx +5 -5
  41. package/src/theme/ApiTabs/index.tsx +7 -6
  42. package/src/theme/DiscriminatorTabs/index.tsx +6 -5
  43. package/src/theme/MimeTabs/index.tsx +9 -8
  44. package/src/theme/OperationTabs/index.tsx +5 -4
  45. package/src/theme/SchemaTabs/index.tsx +6 -5
  46. package/src/theme/TabItem/index.tsx +61 -0
  47. package/src/theme/TabItem/styles.module.css +3 -0
  48. package/src/theme/Tabs/index.tsx +164 -0
  49. package/src/theme/Tabs/styles.module.css +7 -0
  50. package/src/theme/utils/codeBlockUtils.ts +296 -0
  51. package/src/theme/utils/reactUtils.ts +22 -0
  52. package/src/theme/utils/scrollUtils.tsx +153 -0
  53. package/src/theme/utils/tabsUtils.tsx +329 -0
  54. package/src/theme/utils/useCodeWordWrap.ts +110 -0
  55. package/src/theme/utils/useMutationObserver.ts +43 -0
  56. package/src/theme-classic.d.ts +0 -96
  57. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,299 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Portions Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ * Portions Copyright (c) Palo Alto Networks
5
+ *
6
+ * Vendored from @docusaurus/theme-common/src/utils/tabsUtils.tsx (MIT) to
7
+ * remove the dependency on @docusaurus/theme-common/internal. The
8
+ * useQueryStringValue dependency from theme-common's historyUtils is inlined
9
+ * below to avoid pulling another internal module.
10
+ * See: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/1140
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ * ========================================================================== */
15
+ var __createBinding =
16
+ (this && this.__createBinding) ||
17
+ (Object.create
18
+ ? function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (
22
+ !desc ||
23
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
24
+ ) {
25
+ desc = {
26
+ enumerable: true,
27
+ get: function () {
28
+ return m[k];
29
+ },
30
+ };
31
+ }
32
+ Object.defineProperty(o, k2, desc);
33
+ }
34
+ : function (o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ o[k2] = m[k];
37
+ });
38
+ var __setModuleDefault =
39
+ (this && this.__setModuleDefault) ||
40
+ (Object.create
41
+ ? function (o, v) {
42
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
43
+ }
44
+ : function (o, v) {
45
+ o["default"] = v;
46
+ });
47
+ var __importStar =
48
+ (this && this.__importStar) ||
49
+ (function () {
50
+ var ownKeys = function (o) {
51
+ ownKeys =
52
+ Object.getOwnPropertyNames ||
53
+ function (o) {
54
+ var ar = [];
55
+ for (var k in o)
56
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
57
+ return ar;
58
+ };
59
+ return ownKeys(o);
60
+ };
61
+ return function (mod) {
62
+ if (mod && mod.__esModule) return mod;
63
+ var result = {};
64
+ if (mod != null)
65
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
66
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
67
+ __setModuleDefault(result, mod);
68
+ return result;
69
+ };
70
+ })();
71
+ var __importDefault =
72
+ (this && this.__importDefault) ||
73
+ function (mod) {
74
+ return mod && mod.__esModule ? mod : { default: mod };
75
+ };
76
+ Object.defineProperty(exports, "__esModule", { value: true });
77
+ exports.sanitizeTabsChildren = sanitizeTabsChildren;
78
+ exports.useTabsContextValue = useTabsContextValue;
79
+ exports.useTabs = useTabs;
80
+ exports.TabsProvider = TabsProvider;
81
+ const react_1 = __importStar(require("react"));
82
+ const router_1 = require("@docusaurus/router");
83
+ const theme_common_1 = require("@docusaurus/theme-common");
84
+ const useIsomorphicLayoutEffect_1 = __importDefault(
85
+ require("@docusaurus/useIsomorphicLayoutEffect")
86
+ );
87
+ const scrollUtils_1 = require("./scrollUtils");
88
+ function sanitizeTabsChildren(children) {
89
+ return react_1.default.Children.toArray(children).filter(
90
+ (child) => child !== "\n"
91
+ );
92
+ }
93
+ function extractChildrenTabValues(children) {
94
+ function isTabItemWithValueProp(comp) {
95
+ const { props } = comp;
96
+ return !!props && typeof props === "object" && "value" in props;
97
+ }
98
+ const elements = react_1.default.Children.toArray(children).flatMap(
99
+ (child) => {
100
+ if (!child) {
101
+ return [];
102
+ }
103
+ if ((0, react_1.isValidElement)(child) && isTabItemWithValueProp(child)) {
104
+ return [child];
105
+ }
106
+ const badChildTypeName =
107
+ // @ts-expect-error: guarding against unexpected cases
108
+ typeof child.type === "string" ? child.type : child.type.name;
109
+ throw new Error(`Docusaurus error: Bad <Tabs> child <${badChildTypeName}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.
110
+ If you do not want to pass on a "value" prop to the direct children of <Tabs>, you can also pass an explicit <Tabs values={...}> prop.`);
111
+ }
112
+ );
113
+ return elements.map(
114
+ ({ props: { value, label, attributes, default: isDefault } }) => ({
115
+ value,
116
+ label,
117
+ attributes,
118
+ default: isDefault,
119
+ })
120
+ );
121
+ }
122
+ function ensureNoDuplicateValue(values) {
123
+ const dup = (0, theme_common_1.duplicates)(
124
+ values,
125
+ (a, b) => a.value === b.value
126
+ );
127
+ if (dup.length > 0) {
128
+ throw new Error(
129
+ `Docusaurus error: Duplicate values "${dup
130
+ .map((a) => `'${a.value}'`)
131
+ .join(", ")}" found in <Tabs>. Every value needs to be unique.`
132
+ );
133
+ }
134
+ }
135
+ function useTabValues(props) {
136
+ const { values: valuesProp, children } = props;
137
+ return (0, react_1.useMemo)(() => {
138
+ const values = valuesProp ?? extractChildrenTabValues(children);
139
+ ensureNoDuplicateValue(values);
140
+ return values;
141
+ }, [valuesProp, children]);
142
+ }
143
+ function isValidValue({ value, tabValues }) {
144
+ return tabValues.some((a) => a.value === value);
145
+ }
146
+ function getInitialStateValue({ defaultValue, tabValues }) {
147
+ if (tabValues.length === 0) {
148
+ throw new Error(
149
+ "Docusaurus error: the <Tabs> component requires at least one <TabItem> children component"
150
+ );
151
+ }
152
+ if (defaultValue) {
153
+ if (!isValidValue({ value: defaultValue, tabValues })) {
154
+ throw new Error(
155
+ `Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${tabValues
156
+ .map((a) => a.value)
157
+ .join(
158
+ ", "
159
+ )}. If you intend to show no default tab, use defaultValue={null} instead.`
160
+ );
161
+ }
162
+ return defaultValue;
163
+ }
164
+ const defaultTabValue =
165
+ tabValues.find((tabValue) => tabValue.default) ?? tabValues[0];
166
+ if (!defaultTabValue) {
167
+ throw new Error("Unexpected error: 0 tabValues");
168
+ }
169
+ return defaultTabValue.value;
170
+ }
171
+ function getStorageKey(groupId) {
172
+ if (!groupId) {
173
+ return null;
174
+ }
175
+ return `docusaurus.tab.${groupId}`;
176
+ }
177
+ function getQueryStringKey({ queryString = false, groupId }) {
178
+ if (typeof queryString === "string") {
179
+ return queryString;
180
+ }
181
+ if (queryString === false) {
182
+ return null;
183
+ }
184
+ if (queryString === true && !groupId) {
185
+ throw new Error(
186
+ `Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".`
187
+ );
188
+ }
189
+ return groupId ?? null;
190
+ }
191
+ // Inlined from @docusaurus/theme-common/internal historyUtils.useQueryStringValue
192
+ function useQueryStringValue(key) {
193
+ const history = (0, router_1.useHistory)();
194
+ return (0, react_1.useSyncExternalStore)(
195
+ history.listen,
196
+ () =>
197
+ key === null
198
+ ? null
199
+ : new URLSearchParams(history.location.search).get(key),
200
+ () => null
201
+ );
202
+ }
203
+ function useTabQueryString({ queryString = false, groupId }) {
204
+ const history = (0, router_1.useHistory)();
205
+ const key = getQueryStringKey({ queryString, groupId });
206
+ const value = useQueryStringValue(key);
207
+ const setValue = (0, react_1.useCallback)(
208
+ (newValue) => {
209
+ if (!key) {
210
+ return;
211
+ }
212
+ const searchParams = new URLSearchParams(history.location.search);
213
+ searchParams.set(key, newValue);
214
+ history.replace({ ...history.location, search: searchParams.toString() });
215
+ },
216
+ [key, history]
217
+ );
218
+ return [value, setValue];
219
+ }
220
+ function useTabStorage({ groupId }) {
221
+ const key = getStorageKey(groupId);
222
+ const [value, storageSlot] = (0, theme_common_1.useStorageSlot)(key);
223
+ const setValue = (0, react_1.useCallback)(
224
+ (newValue) => {
225
+ if (!key) {
226
+ return;
227
+ }
228
+ storageSlot.set(newValue);
229
+ },
230
+ [key, storageSlot]
231
+ );
232
+ return [value, setValue];
233
+ }
234
+ function useTabsContextValue(props) {
235
+ const { defaultValue, queryString = false, groupId } = props;
236
+ const tabValues = useTabValues(props);
237
+ const [selectedValue, setSelectedValue] = (0, react_1.useState)(() =>
238
+ getInitialStateValue({ defaultValue, tabValues })
239
+ );
240
+ const [queryStringValue, setQueryString] = useTabQueryString({
241
+ queryString,
242
+ groupId,
243
+ });
244
+ const [storageValue, setStorageValue] = useTabStorage({
245
+ groupId,
246
+ });
247
+ const valueToSync = (() => {
248
+ const value = queryStringValue ?? storageValue;
249
+ if (!isValidValue({ value, tabValues })) {
250
+ return null;
251
+ }
252
+ return value;
253
+ })();
254
+ (0, useIsomorphicLayoutEffect_1.default)(() => {
255
+ if (valueToSync) {
256
+ setSelectedValue(valueToSync);
257
+ }
258
+ }, [valueToSync]);
259
+ const selectValue = (0, react_1.useCallback)(
260
+ (newValue) => {
261
+ if (!isValidValue({ value: newValue, tabValues })) {
262
+ throw new Error(`Can't select invalid tab value=${newValue}`);
263
+ }
264
+ setSelectedValue(newValue);
265
+ setQueryString(newValue);
266
+ setStorageValue(newValue);
267
+ },
268
+ [setQueryString, setStorageValue, tabValues]
269
+ );
270
+ return {
271
+ selectedValue,
272
+ selectValue,
273
+ tabValues,
274
+ lazy: props.lazy ?? false,
275
+ block: props.block ?? false,
276
+ };
277
+ }
278
+ const TabsContext = (0, react_1.createContext)(null);
279
+ function useTabs() {
280
+ const contextValue = react_1.default.useContext(TabsContext);
281
+ if (!contextValue) {
282
+ throw new Error("useTabsContext() must be used within a Tabs component");
283
+ }
284
+ return contextValue;
285
+ }
286
+ function TabsProvider(props) {
287
+ // ScrollControllerProvider is mounted here so every tab consumer
288
+ // (our six OpenAPI tab variants + the swizzled @theme/Tabs) gets a working
289
+ // useScrollPositionBlocker without callers needing a separate provider.
290
+ return react_1.default.createElement(
291
+ scrollUtils_1.ScrollControllerProvider,
292
+ null,
293
+ react_1.default.createElement(
294
+ TabsContext.Provider,
295
+ { value: props.value },
296
+ props.children
297
+ )
298
+ );
299
+ }
@@ -0,0 +1,8 @@
1
+ import type { RefObject } from "react";
2
+ export type WordWrap = {
3
+ readonly codeBlockRef: RefObject<HTMLPreElement | null>;
4
+ readonly isEnabled: boolean;
5
+ readonly isCodeScrollable: boolean;
6
+ readonly toggle: () => void;
7
+ };
8
+ export declare function useCodeWordWrap(): WordWrap;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Portions Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ * Portions Copyright (c) Palo Alto Networks
5
+ *
6
+ * Vendored from @docusaurus/theme-common/src/hooks/useCodeWordWrap.ts (MIT)
7
+ * to remove the dependency on @docusaurus/theme-common/internal.
8
+ * See: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/1140
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ * ========================================================================== */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useCodeWordWrap = useCodeWordWrap;
15
+ const react_1 = require("react");
16
+ const useMutationObserver_1 = require("./useMutationObserver");
17
+ // Callback fires when the "hidden" attribute of a tabpanel changes
18
+ // See https://github.com/facebook/docusaurus/pull/7485
19
+ function useTabBecameVisibleCallback(codeBlockRef, callback) {
20
+ const [hiddenTabElement, setHiddenTabElement] = (0, react_1.useState)();
21
+ const updateHiddenTabElement = (0, react_1.useCallback)(() => {
22
+ setHiddenTabElement(
23
+ codeBlockRef.current?.closest("[role=tabpanel][hidden]")
24
+ );
25
+ }, [codeBlockRef, setHiddenTabElement]);
26
+ (0, react_1.useEffect)(() => {
27
+ updateHiddenTabElement();
28
+ }, [updateHiddenTabElement]);
29
+ (0, useMutationObserver_1.useMutationObserver)(
30
+ hiddenTabElement,
31
+ (mutations) => {
32
+ mutations.forEach((mutation) => {
33
+ if (
34
+ mutation.type === "attributes" &&
35
+ mutation.attributeName === "hidden"
36
+ ) {
37
+ callback();
38
+ updateHiddenTabElement();
39
+ }
40
+ });
41
+ },
42
+ {
43
+ attributes: true,
44
+ characterData: false,
45
+ childList: false,
46
+ subtree: false,
47
+ }
48
+ );
49
+ }
50
+ function useCodeWordWrap() {
51
+ const [isEnabled, setIsEnabled] = (0, react_1.useState)(false);
52
+ const [isCodeScrollable, setIsCodeScrollable] = (0, react_1.useState)(false);
53
+ const codeBlockRef = (0, react_1.useRef)(null);
54
+ const toggle = (0, react_1.useCallback)(() => {
55
+ const codeElement = codeBlockRef.current.querySelector("code");
56
+ if (isEnabled) {
57
+ codeElement.removeAttribute("style");
58
+ } else {
59
+ codeElement.style.whiteSpace = "pre-wrap";
60
+ codeElement.style.overflowWrap = "anywhere";
61
+ }
62
+ setIsEnabled((value) => !value);
63
+ }, [codeBlockRef, isEnabled]);
64
+ const updateCodeIsScrollable = (0, react_1.useCallback)(() => {
65
+ const { scrollWidth, clientWidth } = codeBlockRef.current;
66
+ const isScrollable =
67
+ scrollWidth > clientWidth ||
68
+ codeBlockRef.current.querySelector("code").hasAttribute("style");
69
+ setIsCodeScrollable(isScrollable);
70
+ }, [codeBlockRef]);
71
+ useTabBecameVisibleCallback(codeBlockRef, updateCodeIsScrollable);
72
+ (0, react_1.useEffect)(() => {
73
+ updateCodeIsScrollable();
74
+ }, [isEnabled, updateCodeIsScrollable]);
75
+ (0, react_1.useEffect)(() => {
76
+ window.addEventListener("resize", updateCodeIsScrollable, {
77
+ passive: true,
78
+ });
79
+ return () => {
80
+ window.removeEventListener("resize", updateCodeIsScrollable);
81
+ };
82
+ }, [updateCodeIsScrollable]);
83
+ return { codeBlockRef, isEnabled, isCodeScrollable, toggle };
84
+ }
@@ -0,0 +1,3 @@
1
+ type Options = MutationObserverInit;
2
+ export declare function useMutationObserver(target: Element | undefined | null, callback: MutationCallback, options?: Options): void;
3
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Portions Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ * Portions Copyright (c) Palo Alto Networks
5
+ *
6
+ * Vendored from @docusaurus/theme-common/src/hooks/useMutationObserver.ts (MIT)
7
+ * to remove the dependency on @docusaurus/theme-common/internal.
8
+ * See: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/1140
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ * ========================================================================== */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useMutationObserver = useMutationObserver;
15
+ const react_1 = require("react");
16
+ const theme_common_1 = require("@docusaurus/theme-common");
17
+ const reactUtils_1 = require("./reactUtils");
18
+ const DefaultOptions = {
19
+ attributes: true,
20
+ characterData: true,
21
+ childList: true,
22
+ subtree: true,
23
+ };
24
+ function useMutationObserver(target, callback, options = DefaultOptions) {
25
+ const stableCallback = (0, theme_common_1.useEvent)(callback);
26
+ const stableOptions = (0, reactUtils_1.useShallowMemoObject)(options);
27
+ (0, react_1.useEffect)(() => {
28
+ const observer = new MutationObserver(stableCallback);
29
+ if (target) {
30
+ observer.observe(target, stableOptions);
31
+ }
32
+ return () => observer.disconnect();
33
+ }, [target, stableCallback, stableOptions]);
34
+ }
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-1295",
4
+ "version": "0.0.0-1310",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -37,8 +37,8 @@
37
37
  "@types/pako": "^2.0.3",
38
38
  "@types/postman-collection": "^3.5.11",
39
39
  "@types/react-modal": "^3.16.3",
40
- "concurrently": "^9.2.0",
41
- "docusaurus-plugin-openapi-docs": "0.0.0-1295",
40
+ "concurrently": "^10.0.3",
41
+ "docusaurus-plugin-openapi-docs": "0.0.0-1310",
42
42
  "docusaurus-plugin-sass": "^0.2.6",
43
43
  "eslint-plugin-prettier": "^5.5.1"
44
44
  },
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=14"
84
84
  },
85
- "gitHead": "794540bb4937ec12827e46aa936f8cb29fc7b2ab"
85
+ "gitHead": "349c9aa5c4072ee8a0d36c848b55bd121dbfdb85"
86
86
  }
@@ -8,9 +8,10 @@
8
8
  import React, { ComponentProps } from "react";
9
9
 
10
10
  import { ThemeClassNames, usePrismTheme } from "@docusaurus/theme-common";
11
- import { getPrismCssVariables } from "@docusaurus/theme-common/internal";
12
11
  import clsx from "clsx";
13
12
 
13
+ import { getPrismCssVariables } from "@theme/utils/codeBlockUtils";
14
+
14
15
  export default function CodeBlockContainer<T extends "div" | "pre">({
15
16
  as: As,
16
17
  ...props
@@ -8,13 +8,6 @@
8
8
  import React from "react";
9
9
 
10
10
  import { useThemeConfig, usePrismTheme } from "@docusaurus/theme-common";
11
- import {
12
- parseCodeBlockTitle,
13
- parseLanguage,
14
- parseLines,
15
- containsLineNumbers,
16
- useCodeWordWrap,
17
- } from "@docusaurus/theme-common/internal";
18
11
  import Container from "@theme/ApiExplorer/ApiCodeBlock/Container";
19
12
  import CopyButton from "@theme/ApiExplorer/ApiCodeBlock/CopyButton";
20
13
  import ExpandButton from "@theme/ApiExplorer/ApiCodeBlock/ExpandButton";
@@ -24,6 +17,14 @@ import type { Props } from "@theme/CodeBlock/Content/String";
24
17
  import clsx from "clsx";
25
18
  import { Highlight, Language } from "prism-react-renderer";
26
19
 
20
+ import {
21
+ containsLineNumbers,
22
+ parseCodeBlockTitle,
23
+ parseLanguage,
24
+ parseLines,
25
+ } from "@theme/utils/codeBlockUtils";
26
+ import { useCodeWordWrap } from "@theme/utils/useCodeWordWrap";
27
+
27
28
  export default function CodeBlockString({
28
29
  children,
29
30
  className: blockClassName = "",
@@ -7,7 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { LineProps } from "@docusaurus/theme-common/internal";
10
+ import type { Props as LineProps } from "@theme/CodeBlock/Line";
11
11
  import clsx from "clsx";
12
12
 
13
13
  export default function CodeBlockLine({
@@ -7,8 +7,8 @@
7
7
 
8
8
  import React, { isValidElement, ReactNode } from "react";
9
9
 
10
- import { CodeBlockProps } from "@docusaurus/theme-common/internal";
11
10
  import useIsBrowser from "@docusaurus/useIsBrowser";
11
+ import type { Props as CodeBlockProps } from "@theme/CodeBlock";
12
12
  import ElementContent from "@theme/ApiExplorer/ApiCodeBlock/Content/Element";
13
13
  import StringContent from "@theme/ApiExplorer/ApiCodeBlock/Content/String";
14
14
 
@@ -7,17 +7,17 @@
7
7
 
8
8
  import React, { cloneElement, ReactElement, useEffect, useRef } from "react";
9
9
 
10
+ import useIsBrowser from "@docusaurus/useIsBrowser";
11
+ import clsx from "clsx";
12
+
13
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
10
14
  import {
11
15
  sanitizeTabsChildren,
12
16
  type TabItemProps,
13
17
  type TabProps,
14
18
  TabsProvider,
15
- useScrollPositionBlocker,
16
19
  useTabsContextValue,
17
- } from "@docusaurus/theme-common/internal";
18
- import useIsBrowser from "@docusaurus/useIsBrowser";
19
- import clsx from "clsx";
20
-
20
+ } from "@theme/utils/tabsUtils";
21
21
  import { Language } from "../CodeSnippets/code-snippets-types";
22
22
 
23
23
  export interface Props {
@@ -13,18 +13,19 @@ import React, {
13
13
  ReactElement,
14
14
  } from "react";
15
15
 
16
+ import { translate } from "@docusaurus/Translate";
17
+ import useIsBrowser from "@docusaurus/useIsBrowser";
18
+ import Heading from "@theme/Heading";
19
+ import clsx from "clsx";
20
+
21
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
16
22
  import {
17
23
  sanitizeTabsChildren,
18
24
  type TabItemProps,
19
25
  TabProps,
20
26
  TabsProvider,
21
- useScrollPositionBlocker,
22
27
  useTabsContextValue,
23
- } from "@docusaurus/theme-common/internal";
24
- import { translate } from "@docusaurus/Translate";
25
- import useIsBrowser from "@docusaurus/useIsBrowser";
26
- import Heading from "@theme/Heading";
27
- import clsx from "clsx";
28
+ } from "@theme/utils/tabsUtils";
28
29
 
29
30
  export interface TabListProps extends TabProps {
30
31
  label: string;
@@ -13,17 +13,18 @@ import React, {
13
13
  ReactElement,
14
14
  } from "react";
15
15
 
16
+ import useIsBrowser from "@docusaurus/useIsBrowser";
17
+ import clsx from "clsx";
18
+ import flatten from "lodash/flatten";
19
+
20
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
16
21
  import {
17
22
  sanitizeTabsChildren,
18
23
  type TabItemProps,
19
24
  TabProps,
20
25
  TabsProvider,
21
- useScrollPositionBlocker,
22
26
  useTabsContextValue,
23
- } from "@docusaurus/theme-common/internal";
24
- import useIsBrowser from "@docusaurus/useIsBrowser";
25
- import clsx from "clsx";
26
- import flatten from "lodash/flatten";
27
+ } from "@theme/utils/tabsUtils";
27
28
 
28
29
  function TabList({
29
30
  className,
@@ -13,14 +13,6 @@ import React, {
13
13
  ReactElement,
14
14
  } from "react";
15
15
 
16
- import {
17
- sanitizeTabsChildren,
18
- type TabItemProps,
19
- TabProps,
20
- TabsProvider,
21
- useScrollPositionBlocker,
22
- useTabsContextValue,
23
- } from "@docusaurus/theme-common/internal";
24
16
  import useIsBrowser from "@docusaurus/useIsBrowser";
25
17
  import { setAccept } from "@theme/ApiExplorer/Accept/slice";
26
18
  import { setContentType } from "@theme/ApiExplorer/ContentType/slice";
@@ -28,6 +20,15 @@ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
28
20
  import { RootState } from "@theme/ApiItem/store";
29
21
  import clsx from "clsx";
30
22
 
23
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
24
+ import {
25
+ sanitizeTabsChildren,
26
+ type TabItemProps,
27
+ TabProps,
28
+ TabsProvider,
29
+ useTabsContextValue,
30
+ } from "@theme/utils/tabsUtils";
31
+
31
32
  export interface Props {
32
33
  schemaType: any;
33
34
  }
@@ -13,16 +13,17 @@ import React, {
13
13
  ReactElement,
14
14
  } from "react";
15
15
 
16
+ import useIsBrowser from "@docusaurus/useIsBrowser";
17
+ import clsx from "clsx";
18
+
19
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
16
20
  import {
17
21
  sanitizeTabsChildren,
18
22
  type TabItemProps,
19
23
  TabProps,
20
24
  TabsProvider,
21
- useScrollPositionBlocker,
22
25
  useTabsContextValue,
23
- } from "@docusaurus/theme-common/internal";
24
- import useIsBrowser from "@docusaurus/useIsBrowser";
25
- import clsx from "clsx";
26
+ } from "@theme/utils/tabsUtils";
26
27
 
27
28
  function TabList({
28
29
  className,
@@ -14,17 +14,18 @@ import React, {
14
14
  LegacyRef,
15
15
  } from "react";
16
16
 
17
+ import useIsBrowser from "@docusaurus/useIsBrowser";
18
+ import clsx from "clsx";
19
+ import flatten from "lodash/flatten";
20
+
21
+ import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
17
22
  import {
18
23
  sanitizeTabsChildren,
19
24
  type TabItemProps,
20
25
  TabProps,
21
26
  TabsProvider,
22
- useScrollPositionBlocker,
23
27
  useTabsContextValue,
24
- } from "@docusaurus/theme-common/internal";
25
- import useIsBrowser from "@docusaurus/useIsBrowser";
26
- import clsx from "clsx";
27
- import flatten from "lodash/flatten";
28
+ } from "@theme/utils/tabsUtils";
28
29
 
29
30
  export interface SchemaTabsProps extends TabProps {
30
31
  /**