docusaurus-theme-openapi-docs 0.0.0-939 → 0.0.0-940

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.
@@ -53,6 +53,7 @@ function DocItemLayout({ children }) {
53
53
  const { metadata } = (0, client_1.useDoc)();
54
54
  const { frontMatter } = (0, client_1.useDoc)();
55
55
  const api = frontMatter.api;
56
+ const schema = frontMatter.schema;
56
57
  return react_1.default.createElement(
57
58
  "div",
58
59
  { className: "row" },
@@ -86,7 +87,7 @@ function DocItemLayout({ children }) {
86
87
  {
87
88
  className: (0, clsx_1.default)(
88
89
  "col",
89
- api ? "col--7" : "col--12"
90
+ api || schema ? "col--7" : "col--12"
90
91
  ),
91
92
  },
92
93
  react_1.default.createElement(Footer_1.default, null)
@@ -99,7 +100,10 @@ function DocItemLayout({ children }) {
99
100
  react_1.default.createElement(
100
101
  "div",
101
102
  {
102
- className: (0, clsx_1.default)("col", api ? "col--7" : "col--12"),
103
+ className: (0, clsx_1.default)(
104
+ "col",
105
+ api || schema ? "col--7" : "col--12"
106
+ ),
103
107
  },
104
108
  react_1.default.createElement(Paginator_1.default, null)
105
109
  )
@@ -26,6 +26,7 @@ const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
26
26
  const slice_1 = require("@theme/ApiExplorer/Authorization/slice");
27
27
  const persistanceMiddleware_1 = require("@theme/ApiExplorer/persistanceMiddleware");
28
28
  const Layout_1 = __importDefault(require("@theme/ApiItem/Layout"));
29
+ const CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
29
30
  const Metadata_1 = __importDefault(require("@theme/DocItem/Metadata"));
30
31
  const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
31
32
  const clsx_1 = __importDefault(require("clsx"));
@@ -43,6 +44,7 @@ function ApiItem(props) {
43
44
  const { info_path: infoPath } = frontMatter;
44
45
  let { api } = frontMatter;
45
46
  const { schema } = frontMatter;
47
+ const { sample } = frontMatter;
46
48
  // decompress and parse
47
49
  if (api) {
48
50
  try {
@@ -183,8 +185,17 @@ function ApiItem(props) {
183
185
  { className: (0, clsx_1.default)("row", "theme-api-markdown") },
184
186
  react_1.default.createElement(
185
187
  "div",
186
- { className: "col col--12" },
188
+ { className: "col col--7 openapi-left-panel__container schema" },
187
189
  react_1.default.createElement(MDXComponent, null)
190
+ ),
191
+ react_1.default.createElement(
192
+ "div",
193
+ { className: "col col--5 openapi-right-panel__container" },
194
+ react_1.default.createElement(
195
+ CodeBlock_1.default,
196
+ { language: "json", title: `${frontMatter.title}` },
197
+ JSON.stringify(sample, null, 2)
198
+ )
188
199
  )
189
200
  )
190
201
  )
@@ -93,16 +93,16 @@
93
93
  height: 100%;
94
94
  }
95
95
 
96
- @media (min-width: 997px) {
97
- .docItemCol {
98
- max-width: 75% !important;
99
- }
100
-
101
- /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
102
- .tocMobile {
103
- display: none;
104
- }
105
- }
96
+ // @media (min-width: 997px) {
97
+ // .docItemCol {
98
+ // max-width: 75% !important;
99
+ // }
100
+
101
+ // /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
102
+ // .tocMobile {
103
+ // display: none;
104
+ // }
105
+ // }
106
106
 
107
107
  /* Begin OpenAPI theme styles */
108
108
  // [data-theme="dark"] {
@@ -161,6 +161,12 @@
161
161
  border-right: thin solid var(--ifm-toc-border-color);
162
162
  }
163
163
 
164
+ @media (max-width: 997px) {
165
+ .schema {
166
+ margin-bottom: 1rem;
167
+ }
168
+ }
169
+
164
170
  .openapi-tabs__heading {
165
171
  margin-bottom: 1rem;
166
172
  }
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-939",
4
+ "version": "0.0.0-940",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -43,7 +43,7 @@
43
43
  "clsx": "^1.1.1",
44
44
  "copy-text-to-clipboard": "^3.1.0",
45
45
  "crypto-js": "^4.1.1",
46
- "docusaurus-plugin-openapi-docs": "0.0.0-939",
46
+ "docusaurus-plugin-openapi-docs": "0.0.0-940",
47
47
  "docusaurus-plugin-sass": "^0.2.3",
48
48
  "file-saver": "^2.0.5",
49
49
  "lodash": "^4.17.20",
@@ -59,8 +59,8 @@
59
59
  "react-redux": "^7.2.0",
60
60
  "rehype-raw": "^6.1.1",
61
61
  "remark-gfm": "3.0.1",
62
- "sass": "^1.58.1",
63
- "sass-loader": "^13.3.2",
62
+ "sass": "^1.80.4",
63
+ "sass-loader": "^16.0.2",
64
64
  "webpack": "^5.61.0",
65
65
  "xml-formatter": "^2.6.1"
66
66
  },
@@ -71,5 +71,5 @@
71
71
  "engines": {
72
72
  "node": ">=14"
73
73
  },
74
- "gitHead": "a5d3c2f5f5615038a44bb175811196f8be913503"
74
+ "gitHead": "73fe6a842a36f1da27cb0c22d2fa260b268739d6"
75
75
  }
@@ -52,6 +52,7 @@ export default function DocItemLayout({ children }: Props): JSX.Element {
52
52
  const { metadata } = useDoc();
53
53
  const { frontMatter } = useDoc();
54
54
  const api = frontMatter.api;
55
+ const schema = frontMatter.schema;
55
56
  return (
56
57
  <div className="row">
57
58
  <div className={clsx("col", !docTOC.hidden && styles.docItemCol)}>
@@ -64,13 +65,15 @@ export default function DocItemLayout({ children }: Props): JSX.Element {
64
65
  {docTOC.mobile}
65
66
  <DocItemContent>{children}</DocItemContent>
66
67
  <div className="row">
67
- <div className={clsx("col", api ? "col--7" : "col--12")}>
68
+ <div
69
+ className={clsx("col", api || schema ? "col--7" : "col--12")}
70
+ >
68
71
  <DocItemFooter />
69
72
  </div>
70
73
  </div>
71
74
  </article>
72
75
  <div className="row">
73
- <div className={clsx("col", api ? "col--7" : "col--12")}>
76
+ <div className={clsx("col", api || schema ? "col--7" : "col--12")}>
74
77
  <DocItemPaginator />
75
78
  </div>
76
79
  </div>
@@ -18,6 +18,7 @@ import useIsBrowser from "@docusaurus/useIsBrowser";
18
18
  import { createAuth } from "@theme/ApiExplorer/Authorization/slice";
19
19
  import { createPersistanceMiddleware } from "@theme/ApiExplorer/persistanceMiddleware";
20
20
  import DocItemLayout from "@theme/ApiItem/Layout";
21
+ import CodeBlock from "@theme/CodeBlock";
21
22
  import type { Props } from "@theme/DocItem";
22
23
  import DocItemMetadata from "@theme/DocItem/Metadata";
23
24
  import SkeletonLoader from "@theme/SkeletonLoader";
@@ -47,6 +48,10 @@ interface SchemaFrontMatter extends DocFrontMatter {
47
48
  readonly schema?: boolean;
48
49
  }
49
50
 
51
+ interface SampleFrontMatter extends DocFrontMatter {
52
+ readonly sample?: any;
53
+ }
54
+
50
55
  // @ts-ignore
51
56
  export default function ApiItem(props: Props): JSX.Element {
52
57
  const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
@@ -55,6 +60,7 @@ export default function ApiItem(props: Props): JSX.Element {
55
60
  const { info_path: infoPath } = frontMatter as DocFrontMatter;
56
61
  let { api } = frontMatter as ApiFrontMatter;
57
62
  const { schema } = frontMatter as SchemaFrontMatter;
63
+ const { sample } = frontMatter as SampleFrontMatter;
58
64
  // decompress and parse
59
65
  if (api) {
60
66
  try {
@@ -172,9 +178,14 @@ export default function ApiItem(props: Props): JSX.Element {
172
178
  <DocItemMetadata />
173
179
  <DocItemLayout>
174
180
  <div className={clsx("row", "theme-api-markdown")}>
175
- <div className="col col--12">
181
+ <div className="col col--7 openapi-left-panel__container schema">
176
182
  <MDXComponent />
177
183
  </div>
184
+ <div className="col col--5 openapi-right-panel__container">
185
+ <CodeBlock language="json" title={`${frontMatter.title}`}>
186
+ {JSON.stringify(sample, null, 2)}
187
+ </CodeBlock>
188
+ </div>
178
189
  </div>
179
190
  </DocItemLayout>
180
191
  </HtmlClassNameProvider>
@@ -93,16 +93,16 @@
93
93
  height: 100%;
94
94
  }
95
95
 
96
- @media (min-width: 997px) {
97
- .docItemCol {
98
- max-width: 75% !important;
99
- }
100
-
101
- /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
102
- .tocMobile {
103
- display: none;
104
- }
105
- }
96
+ // @media (min-width: 997px) {
97
+ // .docItemCol {
98
+ // max-width: 75% !important;
99
+ // }
100
+
101
+ // /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
102
+ // .tocMobile {
103
+ // display: none;
104
+ // }
105
+ // }
106
106
 
107
107
  /* Begin OpenAPI theme styles */
108
108
  // [data-theme="dark"] {
@@ -161,6 +161,12 @@
161
161
  border-right: thin solid var(--ifm-toc-border-color);
162
162
  }
163
163
 
164
+ @media (max-width: 997px) {
165
+ .schema {
166
+ margin-bottom: 1rem;
167
+ }
168
+ }
169
+
164
170
  .openapi-tabs__heading {
165
171
  margin-bottom: 1rem;
166
172
  }