docusaurus-theme-openapi-docs 0.0.0-486 → 0.0.0-488

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.
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _fileSaver = _interopRequireDefault(require("file-saver"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /* ============================================================================
15
+ * Copyright (c) Palo Alto Networks
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ * ========================================================================== */
20
+ const saveFile = url => {
21
+ let fileName;
22
+
23
+ if (url.endsWith("json") || url.endsWith("yaml") || url.endsWith("yml")) {
24
+ fileName = url.substring(url.lastIndexOf("/") + 1);
25
+ }
26
+
27
+ _fileSaver.default.saveAs(url, fileName ? fileName : "openapi.txt");
28
+ };
29
+
30
+ function Export({
31
+ url,
32
+ proxy
33
+ }) {
34
+ return <div style={{
35
+ float: "right"
36
+ }} className="dropdown dropdown--hoverable dropdown--right">
37
+ <button className="export-button button button--sm button--secondary">
38
+ Export
39
+ </button>
40
+ <ul className="export-dropdown dropdown__menu">
41
+ <li>
42
+ <a onClick={e => {
43
+ e.preventDefault();
44
+ saveFile(`${url}`);
45
+ }} className="dropdown__link" href={`${url}`}>
46
+ OpenAPI Spec
47
+ </a>
48
+ </li>
49
+ </ul>
50
+ </div>;
51
+ }
52
+
53
+ var _default = Export;
54
+ exports.default = _default;
@@ -0,0 +1,49 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+ import React from "react";
8
+ import fileSaver from "file-saver";
9
+
10
+ const saveFile = (url) => {
11
+ let fileName;
12
+
13
+ if (url.endsWith("json") || url.endsWith("yaml") || url.endsWith("yml")) {
14
+ fileName = url.substring(url.lastIndexOf("/") + 1);
15
+ }
16
+
17
+ fileSaver.saveAs(url, fileName ? fileName : "openapi.txt");
18
+ };
19
+
20
+ function Export({ url, proxy }) {
21
+ return (
22
+ <div
23
+ style={{
24
+ float: "right",
25
+ }}
26
+ className="dropdown dropdown--hoverable dropdown--right"
27
+ >
28
+ <button className="export-button button button--sm button--secondary">
29
+ Export
30
+ </button>
31
+ <ul className="export-dropdown dropdown__menu">
32
+ <li>
33
+ <a
34
+ onClick={(e) => {
35
+ e.preventDefault();
36
+ saveFile(`${url}`);
37
+ }}
38
+ className="dropdown__link"
39
+ href={`${url}`}
40
+ >
41
+ OpenAPI Spec
42
+ </a>
43
+ </li>
44
+ </ul>
45
+ </div>
46
+ );
47
+ }
48
+
49
+ export default Export;
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-486",
4
+ "version": "0.0.0-488",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -35,6 +35,7 @@
35
35
  "@docusaurus/types": "2.0.1",
36
36
  "@types/concurrently": "^6.3.0",
37
37
  "@types/crypto-js": "^4.1.0",
38
+ "@types/file-saver": "^2.0.5",
38
39
  "@types/fs-extra": "^9.0.13",
39
40
  "@types/lodash": "^4.14.176",
40
41
  "@types/mdx-js__react": "^1.5.4",
@@ -50,7 +51,8 @@
50
51
  "buffer": "^6.0.3",
51
52
  "clsx": "^1.1.1",
52
53
  "crypto-js": "^4.1.1",
53
- "docusaurus-plugin-openapi-docs": "0.0.0-486",
54
+ "docusaurus-plugin-openapi-docs": "0.0.0-488",
55
+ "file-saver": "^2.0.5",
54
56
  "immer": "^9.0.7",
55
57
  "lodash": "^4.17.20",
56
58
  "process": "^0.11.10",
@@ -71,5 +73,5 @@
71
73
  "engines": {
72
74
  "node": ">=14"
73
75
  },
74
- "gitHead": "412d6f0f36d01841630b19cdbee865dda8c7fb0f"
76
+ "gitHead": "05a3a6ee0dcd518bc8de7895e457df9dc86b370f"
75
77
  }
@@ -0,0 +1,47 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ import fileSaver from "file-saver";
11
+
12
+ const saveFile = (url: string) => {
13
+ let fileName;
14
+ if (url.endsWith("json") || url.endsWith("yaml") || url.endsWith("yml")) {
15
+ fileName = url.substring(url.lastIndexOf("/") + 1);
16
+ }
17
+ fileSaver.saveAs(url, fileName ? fileName : "openapi.txt");
18
+ };
19
+
20
+ function Export({ url, proxy }: any) {
21
+ return (
22
+ <div
23
+ style={{ float: "right" }}
24
+ className="dropdown dropdown--hoverable dropdown--right"
25
+ >
26
+ <button className="export-button button button--sm button--secondary">
27
+ Export
28
+ </button>
29
+ <ul className="export-dropdown dropdown__menu">
30
+ <li>
31
+ <a
32
+ onClick={(e) => {
33
+ e.preventDefault();
34
+ saveFile(`${url}`);
35
+ }}
36
+ className="dropdown__link"
37
+ href={`${url}`}
38
+ >
39
+ OpenAPI Spec
40
+ </a>
41
+ </li>
42
+ </ul>
43
+ </div>
44
+ );
45
+ }
46
+
47
+ export default Export;