@digi-frontend/dgate-api-documentation 4.0.0-beta.1 → 4.0.0-beta.4
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/dist/index.cjs +2167 -1117
- package/dist/index.cjs.map +1 -1
- package/dist/{index-Bu-W04Zg.d.cts → index.d.cts} +24 -12
- package/dist/index.d.cts.map +1 -0
- package/dist/{index-ZiBNQn4i.d.ts → index.d.mts} +24 -12
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +2148 -1096
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-Bu-W04Zg.d.cts.map +0 -1
- package/dist/index-ZiBNQn4i.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -3,17 +3,16 @@ import { devtools } from "zustand/middleware";
|
|
|
3
3
|
import { immer } from "zustand/middleware/immer";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Alert, Breadcrumb, Button, Card, Divider, Drawer, Empty, Flex, Form, Grid, Input, Modal, Pagination, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
|
|
6
|
-
import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
6
|
import { useStyleRegister } from "@ant-design/cssinjs";
|
|
9
|
-
import
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import Text from "antd/es/typography/Text.js";
|
|
9
|
+
import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
|
|
10
10
|
import { Resizable } from "re-resizable";
|
|
11
|
-
import Title from "antd/es/typography/Title";
|
|
12
|
-
import { nanoid } from "nanoid";
|
|
11
|
+
import Title from "antd/es/typography/Title.js";
|
|
13
12
|
import { Light } from "react-syntax-highlighter";
|
|
14
|
-
import json from "react-syntax-highlighter/dist/esm/languages/hljs/json";
|
|
15
|
-
import * as hljs from "react-syntax-highlighter/dist/esm/styles/hljs";
|
|
16
|
-
|
|
13
|
+
import json from "react-syntax-highlighter/dist/esm/languages/hljs/json.js";
|
|
14
|
+
import * as hljs from "react-syntax-highlighter/dist/esm/styles/hljs/index.js";
|
|
15
|
+
import { nanoid } from "nanoid";
|
|
17
16
|
//#region src/store/slices/view.ts
|
|
18
17
|
const createViewSlice = (set) => ({ view: {
|
|
19
18
|
selectedNodeKey: null,
|
|
@@ -69,32 +68,28 @@ const createViewSlice = (set) => ({ view: {
|
|
|
69
68
|
state.view.selectedStatusCode = code;
|
|
70
69
|
})
|
|
71
70
|
} });
|
|
72
|
-
|
|
73
71
|
//#endregion
|
|
74
72
|
//#region src/store/index.ts
|
|
75
73
|
const createStore = (set) => ({ ...createViewSlice(set) });
|
|
76
74
|
const useStore = create()(devtools(immer(createStore), { name: "dgate-docs-store" }));
|
|
77
|
-
var store_default = useStore;
|
|
78
|
-
|
|
79
75
|
//#endregion
|
|
80
76
|
//#region src/hooks/useStyle.ts
|
|
81
77
|
function useStyle(componentName, stylesFn) {
|
|
82
|
-
const { token
|
|
78
|
+
const { token, theme: theme$1, hashId } = theme.useToken();
|
|
83
79
|
const scope = (className) => `.${hashId}.${componentName}-${className}`;
|
|
84
80
|
const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId}`).join(" ");
|
|
85
81
|
return {
|
|
86
82
|
wrapSSR: useStyleRegister({
|
|
87
83
|
theme: theme$1,
|
|
88
|
-
token
|
|
84
|
+
token,
|
|
89
85
|
path: [componentName]
|
|
90
|
-
}, () => stylesFn(token
|
|
86
|
+
}, () => stylesFn(token, scope)),
|
|
91
87
|
cx,
|
|
92
88
|
scope,
|
|
93
|
-
token
|
|
89
|
+
token,
|
|
94
90
|
hashId
|
|
95
91
|
};
|
|
96
92
|
}
|
|
97
|
-
|
|
98
93
|
//#endregion
|
|
99
94
|
//#region src/theme/light.json
|
|
100
95
|
var token = {
|
|
@@ -425,44 +420,43 @@ var token = {
|
|
|
425
420
|
"marginXXXL": 60,
|
|
426
421
|
"marginXXXXL": 72
|
|
427
422
|
};
|
|
428
|
-
|
|
429
423
|
//#endregion
|
|
430
424
|
//#region src/view/helper/sidebar.utils.ts
|
|
431
|
-
const methodColors = {
|
|
425
|
+
const methodColors$1 = {
|
|
432
426
|
GET: {
|
|
433
|
-
bg:
|
|
427
|
+
bg: token.colorPrimaryBgHover,
|
|
434
428
|
color: token.colorPrimary
|
|
435
429
|
},
|
|
436
430
|
POST: {
|
|
437
|
-
bg: "
|
|
431
|
+
bg: token["green.1"],
|
|
438
432
|
color: token.colorSuccess
|
|
439
433
|
},
|
|
440
434
|
DELETE: {
|
|
441
|
-
bg:
|
|
435
|
+
bg: token.colorErrorBg,
|
|
442
436
|
color: token.colorError
|
|
443
437
|
},
|
|
444
438
|
PUT: {
|
|
445
|
-
bg:
|
|
439
|
+
bg: token.colorWarningBg,
|
|
446
440
|
color: token.colorWarning
|
|
447
441
|
},
|
|
448
442
|
PATCH: {
|
|
449
|
-
bg: "
|
|
443
|
+
bg: token["volcano.1"],
|
|
450
444
|
color: token["volcano.5"]
|
|
451
445
|
},
|
|
452
446
|
OPTIONS: {
|
|
453
|
-
bg: "
|
|
447
|
+
bg: token["geekblue.2"],
|
|
454
448
|
color: token["geekblue.6"]
|
|
455
449
|
},
|
|
456
450
|
HEAD: {
|
|
457
|
-
bg: "
|
|
451
|
+
bg: token["purple.1"],
|
|
458
452
|
color: token["purple.5"]
|
|
459
453
|
},
|
|
460
454
|
TRACE: {
|
|
461
|
-
bg: "
|
|
462
|
-
color: token["
|
|
455
|
+
bg: token["cyan.1"],
|
|
456
|
+
color: token["cyan.5"]
|
|
463
457
|
}
|
|
464
458
|
};
|
|
465
|
-
const darkerMethodColors = {
|
|
459
|
+
const darkerMethodColors$1 = {
|
|
466
460
|
GET: {
|
|
467
461
|
bg: token.colorPrimary,
|
|
468
462
|
color: "#FFFFFF"
|
|
@@ -496,70 +490,18 @@ const darkerMethodColors = {
|
|
|
496
490
|
color: "#FFFFFF"
|
|
497
491
|
}
|
|
498
492
|
};
|
|
499
|
-
const
|
|
500
|
-
GET: {
|
|
501
|
-
bg: token.colorPrimaryBgHover,
|
|
502
|
-
color: token.colorPrimary
|
|
503
|
-
},
|
|
504
|
-
POST: {
|
|
505
|
-
bg: token.colorSuccessBg,
|
|
506
|
-
color: token.colorSuccess
|
|
507
|
-
},
|
|
508
|
-
DELETE: {
|
|
509
|
-
bg: token.colorErrorBg,
|
|
510
|
-
color: token.colorError
|
|
511
|
-
},
|
|
512
|
-
PUT: {
|
|
513
|
-
bg: token.colorWarningBg,
|
|
514
|
-
color: token.colorWarning
|
|
515
|
-
},
|
|
516
|
-
PATCH: {
|
|
517
|
-
bg: token["volcano.1"],
|
|
518
|
-
color: token["volcano.5"]
|
|
519
|
-
},
|
|
520
|
-
OPTIONS: {
|
|
521
|
-
bg: token["geekblue.2"],
|
|
522
|
-
color: token["geekblue.6"]
|
|
523
|
-
},
|
|
524
|
-
HEAD: {
|
|
525
|
-
bg: token["purple.1"],
|
|
526
|
-
color: token["purple.5"]
|
|
527
|
-
},
|
|
528
|
-
TRACE: {
|
|
529
|
-
bg: token["volcano.1"],
|
|
530
|
-
color: token["volcano.4"]
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
const buildTreeDataStructure = (data) => {
|
|
493
|
+
const buildTreeDataStructure$1 = (data) => {
|
|
534
494
|
if (!data) return [];
|
|
535
495
|
return data.map((api) => {
|
|
536
496
|
const tagEntries = Object.entries(api.tags);
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
key: endpoint.id,
|
|
542
|
-
isLeaf: true,
|
|
497
|
+
const hasOnlyDefaultTag = tagEntries.length === 1 && tagEntries[0][0] === "default";
|
|
498
|
+
return {
|
|
499
|
+
title: api.title,
|
|
500
|
+
key: api.id,
|
|
543
501
|
selectable: true,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
api,
|
|
548
|
-
tagName: "default",
|
|
549
|
-
parentApiId: api.id
|
|
550
|
-
}
|
|
551
|
-
})) : [];
|
|
552
|
-
const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
|
|
553
|
-
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
554
|
-
return {
|
|
555
|
-
title: tag,
|
|
556
|
-
key: tagId,
|
|
557
|
-
selectable: true,
|
|
558
|
-
data: {
|
|
559
|
-
tagName: tag,
|
|
560
|
-
apiData: api
|
|
561
|
-
},
|
|
562
|
-
children: endpoints.map((endpoint) => ({
|
|
502
|
+
data: api,
|
|
503
|
+
children: hasOnlyDefaultTag ? tagEntries[0][1].map((endpoint) => {
|
|
504
|
+
return {
|
|
563
505
|
title: endpoint.summary,
|
|
564
506
|
key: endpoint.id,
|
|
565
507
|
isLeaf: true,
|
|
@@ -568,19 +510,38 @@ const buildTreeDataStructure = (data) => {
|
|
|
568
510
|
data: {
|
|
569
511
|
endpoint,
|
|
570
512
|
api,
|
|
571
|
-
tagName:
|
|
572
|
-
parentApiId: api.id
|
|
573
|
-
tagId
|
|
513
|
+
tagName: "default",
|
|
514
|
+
parentApiId: api.id
|
|
574
515
|
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
516
|
+
};
|
|
517
|
+
}) : tagEntries.map(([tag, endpoints]) => {
|
|
518
|
+
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
519
|
+
return {
|
|
520
|
+
title: tag,
|
|
521
|
+
key: tagId,
|
|
522
|
+
selectable: true,
|
|
523
|
+
data: {
|
|
524
|
+
tagName: tag,
|
|
525
|
+
apiData: api
|
|
526
|
+
},
|
|
527
|
+
children: endpoints.map((endpoint) => {
|
|
528
|
+
return {
|
|
529
|
+
title: endpoint.summary,
|
|
530
|
+
key: endpoint.id,
|
|
531
|
+
isLeaf: true,
|
|
532
|
+
selectable: true,
|
|
533
|
+
method: endpoint.method,
|
|
534
|
+
data: {
|
|
535
|
+
endpoint,
|
|
536
|
+
api,
|
|
537
|
+
tagName: tag,
|
|
538
|
+
parentApiId: api.id,
|
|
539
|
+
tagId
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
})
|
|
543
|
+
};
|
|
544
|
+
})
|
|
584
545
|
};
|
|
585
546
|
});
|
|
586
547
|
};
|
|
@@ -594,7 +555,11 @@ const findNodeByKey = (nodes, targetKey) => {
|
|
|
594
555
|
}
|
|
595
556
|
return null;
|
|
596
557
|
};
|
|
597
|
-
const
|
|
558
|
+
const isApiSectionHighlighted = (apiKey, selectedEndpoint) => {
|
|
559
|
+
if (!selectedEndpoint) return false;
|
|
560
|
+
return selectedEndpoint.parentApiId === apiKey;
|
|
561
|
+
};
|
|
562
|
+
const getAllTreeKeys$1 = (data) => {
|
|
598
563
|
const keys = [];
|
|
599
564
|
const traverse = (nodes) => {
|
|
600
565
|
nodes.forEach((node) => {
|
|
@@ -605,7 +570,7 @@ const getAllTreeKeys = (data) => {
|
|
|
605
570
|
traverse(data);
|
|
606
571
|
return keys;
|
|
607
572
|
};
|
|
608
|
-
const filterTreeData = (data, searchText) => {
|
|
573
|
+
const filterTreeData$1 = (data, searchText) => {
|
|
609
574
|
if (!searchText) return data;
|
|
610
575
|
const findOriginalNode = (nodes, key) => {
|
|
611
576
|
for (const node of nodes) {
|
|
@@ -638,31 +603,27 @@ const filterTreeData = (data, searchText) => {
|
|
|
638
603
|
};
|
|
639
604
|
return data.map((node) => filterNode(node)).filter((node) => node !== null);
|
|
640
605
|
};
|
|
641
|
-
const getSidebarStyles = (token
|
|
606
|
+
const getSidebarStyles$1 = (token, scope) => ({
|
|
642
607
|
[scope("sider")]: {
|
|
643
|
-
backgroundColor: token
|
|
608
|
+
backgroundColor: token.colorBgContainer,
|
|
609
|
+
overflowY: "auto",
|
|
644
610
|
overflowX: "clip",
|
|
645
|
-
borderRadius: token
|
|
646
|
-
height: "auto"
|
|
611
|
+
borderRadius: token.borderRadius
|
|
647
612
|
},
|
|
648
|
-
[scope("content")]: { padding: token
|
|
613
|
+
[scope("content")]: { padding: token.padding },
|
|
649
614
|
[scope("controls")]: {
|
|
650
615
|
display: "flex",
|
|
651
|
-
gap: token
|
|
652
|
-
marginBottom: token
|
|
616
|
+
gap: token.marginXS,
|
|
617
|
+
marginBottom: token.marginSM
|
|
653
618
|
},
|
|
654
619
|
[scope("search-input")]: { flex: 1 },
|
|
655
620
|
[scope("tree")]: {
|
|
656
621
|
backgroundColor: "transparent",
|
|
657
|
-
width: "100%",
|
|
658
|
-
"& .ant-tree-list": { width: "100%" },
|
|
659
|
-
"& .ant-tree-list-holder-inner": { width: "100%" },
|
|
660
622
|
"& .ant-tree-node-content-wrapper": {
|
|
661
623
|
overflow: "hidden",
|
|
662
|
-
|
|
624
|
+
width: "100%",
|
|
663
625
|
display: "flex",
|
|
664
|
-
alignItems: "center"
|
|
665
|
-
padding: "0 !important"
|
|
626
|
+
alignItems: "center"
|
|
666
627
|
},
|
|
667
628
|
"& .ant-tree-title": {
|
|
668
629
|
width: "100%",
|
|
@@ -675,73 +636,58 @@ const getSidebarStyles = (token$1, scope) => ({
|
|
|
675
636
|
width: "100%",
|
|
676
637
|
padding: 0
|
|
677
638
|
},
|
|
678
|
-
"& .ant-tree-
|
|
639
|
+
"& .ant-tree-node-content-wrapper:hover": { backgroundColor: token.colorFillTertiary }
|
|
679
640
|
},
|
|
680
641
|
[scope("endpoint-item")]: {
|
|
681
642
|
display: "flex",
|
|
682
643
|
alignItems: "center",
|
|
683
|
-
gap: token
|
|
644
|
+
gap: token.marginXS,
|
|
684
645
|
width: "100%",
|
|
685
646
|
maxWidth: "100%",
|
|
686
|
-
minWidth: "100%"
|
|
687
|
-
paddingLeft: token$1.marginXS,
|
|
688
|
-
paddingRight: token$1.marginXS
|
|
647
|
+
minWidth: "100%"
|
|
689
648
|
},
|
|
690
649
|
[scope("method-tag")]: {
|
|
691
|
-
|
|
692
|
-
height: 16,
|
|
693
|
-
lineHeight: "16px",
|
|
694
|
-
fontSize: 12,
|
|
650
|
+
minWidth: "3.75rem",
|
|
695
651
|
textAlign: "center",
|
|
696
|
-
border: "none"
|
|
697
|
-
borderRadius: 6,
|
|
698
|
-
padding: "0 8px",
|
|
699
|
-
display: "inline-flex",
|
|
700
|
-
alignItems: "center",
|
|
701
|
-
justifyContent: "center"
|
|
652
|
+
border: "none"
|
|
702
653
|
},
|
|
703
654
|
[scope("endpoint-text")]: {
|
|
704
655
|
flex: 1,
|
|
705
656
|
maxWidth: "100%",
|
|
706
|
-
minWidth: 0,
|
|
707
|
-
overflow: "hidden",
|
|
708
657
|
display: "block"
|
|
709
658
|
},
|
|
710
659
|
[scope("tag-title")]: {
|
|
711
|
-
color: token
|
|
660
|
+
color: token.colorText,
|
|
712
661
|
maxWidth: "100%",
|
|
713
662
|
display: "block",
|
|
714
663
|
flex: 1
|
|
715
664
|
},
|
|
716
665
|
[scope("api-title")]: {
|
|
717
666
|
flex: 1,
|
|
718
|
-
color: token
|
|
667
|
+
color: token.colorText,
|
|
719
668
|
maxWidth: "100%",
|
|
720
669
|
display: "block",
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
670
|
+
padding: 0,
|
|
671
|
+
margin: 0,
|
|
672
|
+
"&.highlighted": { color: token.colorPrimary }
|
|
724
673
|
}
|
|
725
674
|
});
|
|
726
|
-
|
|
727
675
|
//#endregion
|
|
728
676
|
//#region src/view/helper/sidebar.components.tsx
|
|
729
|
-
const { Text: Text$
|
|
730
|
-
const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
731
|
-
const methodStyle = (isSelected ? darkerMethodColors :
|
|
732
|
-
const isPost = method?.toUpperCase() === "POST";
|
|
677
|
+
const { Text: Text$2 } = Typography;
|
|
678
|
+
const EndpointItem$1 = ({ method, title, cx, isSelected = false }) => {
|
|
679
|
+
const methodStyle = (isSelected ? darkerMethodColors$1 : methodColors$1)[method];
|
|
733
680
|
return /* @__PURE__ */ jsxs("div", {
|
|
734
|
-
className:
|
|
681
|
+
className: cx("endpoint-item"),
|
|
735
682
|
children: [/* @__PURE__ */ jsx(Tag, {
|
|
736
683
|
className: cx("method-tag"),
|
|
737
684
|
style: {
|
|
738
685
|
backgroundColor: methodStyle?.bg,
|
|
739
686
|
color: methodStyle?.color,
|
|
740
|
-
border: "none"
|
|
741
|
-
...isPost ? { borderRadius: 4 } : {}
|
|
687
|
+
border: "none"
|
|
742
688
|
},
|
|
743
689
|
children: method
|
|
744
|
-
}), /* @__PURE__ */ jsx(Text$
|
|
690
|
+
}), /* @__PURE__ */ jsx(Text$2, {
|
|
745
691
|
className: cx("endpoint-text"),
|
|
746
692
|
ellipsis: { tooltip: title },
|
|
747
693
|
style: { flex: 1 },
|
|
@@ -749,23 +695,25 @@ const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
|
749
695
|
})]
|
|
750
696
|
});
|
|
751
697
|
};
|
|
752
|
-
const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
|
|
698
|
+
const convertToRenderableTreeData$1 = (treeDataStructure, selectedEndpoint, cx) => {
|
|
753
699
|
const renderNode = (node) => {
|
|
754
700
|
let title;
|
|
755
701
|
if (node.isLeaf && node.method) {
|
|
756
702
|
const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
|
|
757
|
-
title = /* @__PURE__ */ jsx(EndpointItem, {
|
|
703
|
+
title = /* @__PURE__ */ jsx(EndpointItem$1, {
|
|
758
704
|
method: node.method,
|
|
759
705
|
title: typeof node.title === "string" ? node.title : "Endpoint Name",
|
|
760
706
|
cx,
|
|
761
707
|
isSelected
|
|
762
708
|
});
|
|
763
|
-
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data))
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
709
|
+
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
|
|
710
|
+
const isHighlighted = isApiSectionHighlighted(node.key, selectedEndpoint);
|
|
711
|
+
title = /* @__PURE__ */ jsx(Text$2, {
|
|
712
|
+
className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
|
|
713
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
|
|
714
|
+
children: node.title
|
|
715
|
+
});
|
|
716
|
+
} else title = /* @__PURE__ */ jsx(Text$2, {
|
|
769
717
|
className: cx("tag-title"),
|
|
770
718
|
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
771
719
|
children: node.title
|
|
@@ -778,7 +726,6 @@ const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) =>
|
|
|
778
726
|
};
|
|
779
727
|
return treeDataStructure.map(renderNode);
|
|
780
728
|
};
|
|
781
|
-
|
|
782
729
|
//#endregion
|
|
783
730
|
//#region src/hooks/useNodeSelection.ts
|
|
784
731
|
const useNodeSelection = () => {
|
|
@@ -884,7 +831,6 @@ const useNodeSelection = () => {
|
|
|
884
831
|
selectPreSelectedApi
|
|
885
832
|
};
|
|
886
833
|
};
|
|
887
|
-
|
|
888
834
|
//#endregion
|
|
889
835
|
//#region src/assets/Minify.tsx
|
|
890
836
|
const Minify = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
@@ -902,8 +848,6 @@ const Minify = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
902
848
|
stroke: "currentcolor"
|
|
903
849
|
})]
|
|
904
850
|
});
|
|
905
|
-
var Minify_default = Minify;
|
|
906
|
-
|
|
907
851
|
//#endregion
|
|
908
852
|
//#region src/view/components/NoDataIcon.tsx
|
|
909
853
|
const NoDataIcon = ({ width = 298, height = 237, fill = "#F1F5FD", stroke = "#E0E9F9", ...props }) => {
|
|
@@ -1071,21 +1015,17 @@ const NoDataIcon = ({ width = 298, height = 237, fill = "#F1F5FD", stroke = "#E0
|
|
|
1071
1015
|
]
|
|
1072
1016
|
});
|
|
1073
1017
|
};
|
|
1074
|
-
var NoDataIcon_default = NoDataIcon;
|
|
1075
|
-
|
|
1076
1018
|
//#endregion
|
|
1077
1019
|
//#region src/view/components/Sidebar.tsx
|
|
1078
|
-
const {
|
|
1079
|
-
const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
1020
|
+
const Sidebar$1 = ({ searchValue, setSearchValue }) => {
|
|
1080
1021
|
const expandedKeys = useStore((state) => state.view.expandedKeys);
|
|
1081
1022
|
const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
|
|
1082
1023
|
const { selectNodeByKey, clearSelection } = useNodeSelection();
|
|
1083
1024
|
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
1084
|
-
const
|
|
1085
|
-
const { wrapSSR, cx, token: token$1 } = useStyle("Sidebar", getSidebarStyles);
|
|
1025
|
+
const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles$1);
|
|
1086
1026
|
const handleSearch = (value) => {
|
|
1087
1027
|
if (value && builtTreeData) {
|
|
1088
|
-
setExpandedKeys(getAllTreeKeys(builtTreeData));
|
|
1028
|
+
setExpandedKeys(getAllTreeKeys$1(builtTreeData));
|
|
1089
1029
|
setSearchValue(value);
|
|
1090
1030
|
setAutoExpandParent(true);
|
|
1091
1031
|
} else {
|
|
@@ -1096,7 +1036,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1096
1036
|
};
|
|
1097
1037
|
const renderTreeData = useMemo(() => {
|
|
1098
1038
|
if (!builtTreeData) return [];
|
|
1099
|
-
return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
|
|
1039
|
+
return convertToRenderableTreeData$1(builtTreeData, selectedEndpoint, cx);
|
|
1100
1040
|
}, [
|
|
1101
1041
|
builtTreeData,
|
|
1102
1042
|
selectedEndpoint,
|
|
@@ -1105,7 +1045,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1105
1045
|
const filteredTreeData = useMemo(() => {
|
|
1106
1046
|
if (!searchValue) return renderTreeData;
|
|
1107
1047
|
if (!builtTreeData) return [];
|
|
1108
|
-
return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
1048
|
+
return convertToRenderableTreeData$1(filterTreeData$1(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
1109
1049
|
}, [
|
|
1110
1050
|
builtTreeData,
|
|
1111
1051
|
searchValue,
|
|
@@ -1126,96 +1066,9 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1126
1066
|
selectNodeByKey(selectedKey);
|
|
1127
1067
|
setSelectedNodeKey(selectedKey);
|
|
1128
1068
|
};
|
|
1129
|
-
const inner = /* @__PURE__ */ jsxs("div", {
|
|
1130
|
-
className: cx("content"),
|
|
1131
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1132
|
-
className: cx("controls"),
|
|
1133
|
-
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1134
|
-
title: "Search by APIs or Endpoints",
|
|
1135
|
-
placement: "bottom",
|
|
1136
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
1137
|
-
placeholder: "Search by APIs or Endpoints",
|
|
1138
|
-
value: searchValue,
|
|
1139
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
1140
|
-
allowClear: true,
|
|
1141
|
-
className: cx("search-input"),
|
|
1142
|
-
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
1143
|
-
})
|
|
1144
|
-
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1145
|
-
title: "Collapse All",
|
|
1146
|
-
placement: "bottom",
|
|
1147
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1148
|
-
onClick: collapseAll,
|
|
1149
|
-
title: "Collapse All",
|
|
1150
|
-
icon: /* @__PURE__ */ jsx(Minify_default, {})
|
|
1151
|
-
})
|
|
1152
|
-
})]
|
|
1153
|
-
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
1154
|
-
showLine: { showLeafIcon: false },
|
|
1155
|
-
showIcon: false,
|
|
1156
|
-
switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ jsx(MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ jsx(PlusSquareOutlined, { style: { fontSize: 12 } }),
|
|
1157
|
-
expandedKeys,
|
|
1158
|
-
autoExpandParent,
|
|
1159
|
-
selectedKeys: [selectedNodeKey || ""],
|
|
1160
|
-
onSelect: (selectedKeys) => {
|
|
1161
|
-
if (!selectedKeys?.length) return;
|
|
1162
|
-
onTreeNodeSelect(selectedKeys);
|
|
1163
|
-
setSelectedNodeKey(selectedKeys[0]);
|
|
1164
|
-
onNodeSelect?.();
|
|
1165
|
-
},
|
|
1166
|
-
onExpand: (expandedKeysValue) => {
|
|
1167
|
-
setExpandedKeys(expandedKeysValue);
|
|
1168
|
-
setAutoExpandParent(false);
|
|
1169
|
-
},
|
|
1170
|
-
treeData: filteredTreeData,
|
|
1171
|
-
className: cx("tree")
|
|
1172
|
-
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
1173
|
-
justify: "center",
|
|
1174
|
-
align: "center",
|
|
1175
|
-
gap: token$1.marginSM,
|
|
1176
|
-
vertical: true,
|
|
1177
|
-
style: { marginTop: token$1.paddingXL },
|
|
1178
|
-
children: [/* @__PURE__ */ jsx(NoDataIcon_default, {
|
|
1179
|
-
stroke: token$1.colorPrimaryHover,
|
|
1180
|
-
fill: token$1.colorPrimaryBg,
|
|
1181
|
-
width: "10.375rem",
|
|
1182
|
-
height: "8.1875rem"
|
|
1183
|
-
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
1184
|
-
style: {
|
|
1185
|
-
textAlign: "center",
|
|
1186
|
-
fontFamily: token$1.fontFamily,
|
|
1187
|
-
fontWeight: 400,
|
|
1188
|
-
fontSize: token$1.fontSizeLG,
|
|
1189
|
-
color: token$1.colorTextTertiary
|
|
1190
|
-
},
|
|
1191
|
-
children: "No results found"
|
|
1192
|
-
}) : /* @__PURE__ */ jsxs(Text, {
|
|
1193
|
-
style: {
|
|
1194
|
-
textAlign: "center",
|
|
1195
|
-
fontFamily: token$1.fontFamily,
|
|
1196
|
-
fontWeight: 400,
|
|
1197
|
-
fontSize: token$1.fontSizeLG,
|
|
1198
|
-
color: token$1.colorTextTertiary
|
|
1199
|
-
},
|
|
1200
|
-
children: [
|
|
1201
|
-
"No API",
|
|
1202
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
1203
|
-
"Documentation Found"
|
|
1204
|
-
]
|
|
1205
|
-
})]
|
|
1206
|
-
})]
|
|
1207
|
-
});
|
|
1208
|
-
if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
|
|
1209
|
-
className: cx("sider"),
|
|
1210
|
-
style: {
|
|
1211
|
-
width: "100%",
|
|
1212
|
-
height: "100%"
|
|
1213
|
-
},
|
|
1214
|
-
children: inner
|
|
1215
|
-
}));
|
|
1216
1069
|
return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
|
|
1217
1070
|
as: "aside",
|
|
1218
|
-
minWidth:
|
|
1071
|
+
minWidth: 300,
|
|
1219
1072
|
maxWidth: 386,
|
|
1220
1073
|
enable: {
|
|
1221
1074
|
top: false,
|
|
@@ -1228,24 +1081,99 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1228
1081
|
topLeft: false
|
|
1229
1082
|
},
|
|
1230
1083
|
defaultSize: {
|
|
1231
|
-
width:
|
|
1232
|
-
height: "
|
|
1084
|
+
width: 333,
|
|
1085
|
+
height: "100%"
|
|
1233
1086
|
},
|
|
1234
1087
|
className: cx("sider"),
|
|
1235
|
-
children:
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1088
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1089
|
+
className: cx("content"),
|
|
1090
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1091
|
+
className: cx("controls"),
|
|
1092
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1093
|
+
title: "Search by APIs or Endpoints",
|
|
1094
|
+
placement: "bottom",
|
|
1095
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
1096
|
+
placeholder: "Search by APIs or Endpoints",
|
|
1097
|
+
value: searchValue,
|
|
1098
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
1099
|
+
allowClear: true,
|
|
1100
|
+
className: cx("search-input"),
|
|
1101
|
+
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
1102
|
+
})
|
|
1103
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1104
|
+
title: "Collapse All",
|
|
1105
|
+
placement: "bottom",
|
|
1106
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1107
|
+
onClick: collapseAll,
|
|
1108
|
+
title: "Collapse All",
|
|
1109
|
+
icon: /* @__PURE__ */ jsx(Minify, {})
|
|
1110
|
+
})
|
|
1111
|
+
})]
|
|
1112
|
+
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
1113
|
+
showLine: { showLeafIcon: false },
|
|
1114
|
+
showIcon: false,
|
|
1115
|
+
expandedKeys,
|
|
1116
|
+
autoExpandParent,
|
|
1117
|
+
selectedKeys: [selectedNodeKey || ""],
|
|
1118
|
+
onSelect: (selectedKeys) => {
|
|
1119
|
+
if (!selectedKeys?.length) return;
|
|
1120
|
+
onTreeNodeSelect(selectedKeys);
|
|
1121
|
+
setSelectedNodeKey(selectedKeys[0]);
|
|
1122
|
+
},
|
|
1123
|
+
onExpand: (expandedKeysValue) => {
|
|
1124
|
+
setExpandedKeys(expandedKeysValue);
|
|
1125
|
+
setAutoExpandParent(false);
|
|
1126
|
+
},
|
|
1127
|
+
treeData: filteredTreeData,
|
|
1128
|
+
className: cx("tree")
|
|
1129
|
+
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
1130
|
+
justify: "center",
|
|
1131
|
+
align: "center",
|
|
1132
|
+
gap: token.marginSM,
|
|
1133
|
+
vertical: true,
|
|
1134
|
+
style: { marginTop: token.paddingXL },
|
|
1135
|
+
children: [/* @__PURE__ */ jsx(NoDataIcon, {
|
|
1136
|
+
stroke: token.colorPrimaryHover,
|
|
1137
|
+
fill: token.colorPrimaryBg,
|
|
1138
|
+
width: "10.375rem",
|
|
1139
|
+
height: "8.1875rem"
|
|
1140
|
+
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
1141
|
+
style: {
|
|
1142
|
+
textAlign: "center",
|
|
1143
|
+
fontFamily: token.fontFamily,
|
|
1144
|
+
fontWeight: 400,
|
|
1145
|
+
fontSize: token.fontSizeLG,
|
|
1146
|
+
color: "rgba(0,0,0,0.45)"
|
|
1147
|
+
},
|
|
1148
|
+
children: "No results found"
|
|
1149
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
1150
|
+
style: {
|
|
1151
|
+
textAlign: "center",
|
|
1152
|
+
fontFamily: token.fontFamily,
|
|
1153
|
+
fontWeight: 400,
|
|
1154
|
+
fontSize: token.fontSizeLG,
|
|
1155
|
+
color: "rgba(0,0,0,0.45)"
|
|
1156
|
+
},
|
|
1157
|
+
children: [
|
|
1158
|
+
"No API",
|
|
1159
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1160
|
+
"Documentation Found"
|
|
1161
|
+
]
|
|
1162
|
+
})]
|
|
1163
|
+
})]
|
|
1164
|
+
})
|
|
1165
|
+
}));
|
|
1166
|
+
};
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/assets/link.tsx
|
|
1169
|
+
const Link = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
1170
|
+
width: "12",
|
|
1171
|
+
height: "12",
|
|
1172
|
+
viewBox: "0 0 12 12",
|
|
1173
|
+
fill: "none",
|
|
1174
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1175
|
+
...props,
|
|
1176
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1249
1177
|
d: "M3.875 9.25C2.085 9.25 0.625 7.79 0.625 6C0.625 4.21 2.085 2.75 3.875 2.75C4.08 2.75 4.25 2.92 4.25 3.125C4.25 3.33 4.08 3.5 3.875 3.5C2.495 3.5 1.375 4.62 1.375 6C1.375 7.38 2.495 8.5 3.875 8.5C5.255 8.5 6.375 7.38 6.375 6C6.375 5.795 6.545 5.625 6.75 5.625C6.955 5.625 7.125 5.795 7.125 6C7.125 7.79 5.665 9.25 3.875 9.25Z",
|
|
1250
1178
|
fill: "#4D75D9"
|
|
1251
1179
|
}), /* @__PURE__ */ jsx("path", {
|
|
@@ -1253,25 +1181,23 @@ const Link = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
1253
1181
|
fill: "#4D75D9"
|
|
1254
1182
|
})]
|
|
1255
1183
|
});
|
|
1256
|
-
var link_default = Link;
|
|
1257
|
-
|
|
1258
1184
|
//#endregion
|
|
1259
1185
|
//#region src/view/components/ApiPage/components/ApiCard.tsx
|
|
1260
1186
|
const ApiCard = ({ api, viewStyle }) => {
|
|
1261
|
-
const { wrapSSR, cx, token
|
|
1187
|
+
const { wrapSSR, cx, token } = useStyle("DocumentationApiCard", (token, scope) => ({
|
|
1262
1188
|
[scope("method-chip")]: {
|
|
1263
1189
|
minWidth: "5.375rem",
|
|
1264
1190
|
width: "fit-content",
|
|
1265
|
-
paddingLeft: token
|
|
1266
|
-
paddingRight: token
|
|
1191
|
+
paddingLeft: token.marginXS,
|
|
1192
|
+
paddingRight: token.marginXS,
|
|
1267
1193
|
display: "flex",
|
|
1268
1194
|
justifyContent: "center",
|
|
1269
1195
|
alignItems: "center",
|
|
1270
|
-
borderRadius: token
|
|
1196
|
+
borderRadius: token.borderRadius
|
|
1271
1197
|
},
|
|
1272
1198
|
[scope("list-container")]: {
|
|
1273
|
-
paddingTop: token
|
|
1274
|
-
paddingBottom: token
|
|
1199
|
+
paddingTop: token.marginXS,
|
|
1200
|
+
paddingBottom: token.marginXS
|
|
1275
1201
|
},
|
|
1276
1202
|
[scope("chip-title")]: {
|
|
1277
1203
|
alignSelf: "center",
|
|
@@ -1279,97 +1205,97 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1279
1205
|
padding: 0,
|
|
1280
1206
|
margin: 0,
|
|
1281
1207
|
lineHeight: "1.375rem",
|
|
1282
|
-
fontSize: token
|
|
1208
|
+
fontSize: token.fontSize
|
|
1283
1209
|
},
|
|
1284
1210
|
[scope("list-see-details")]: {
|
|
1285
1211
|
width: "6.5625rem",
|
|
1286
1212
|
height: "2rem",
|
|
1287
|
-
borderRadius: token
|
|
1288
|
-
border: `${token
|
|
1289
|
-
paddingRight: token
|
|
1290
|
-
paddingLeft: token
|
|
1291
|
-
background: token
|
|
1292
|
-
"&:hover": { background: token
|
|
1213
|
+
borderRadius: token.borderRadius,
|
|
1214
|
+
border: `${token.lineWidth}px solid ${token.Button?.defaultBorderColor}`,
|
|
1215
|
+
paddingRight: token.Button?.paddingInline,
|
|
1216
|
+
paddingLeft: token.Button?.paddingInline,
|
|
1217
|
+
background: token.Button?.defaultBg,
|
|
1218
|
+
"&:hover": { background: token.Button?.defaultBg }
|
|
1293
1219
|
},
|
|
1294
1220
|
[scope("list-content")]: {
|
|
1295
1221
|
display: "flex",
|
|
1296
|
-
paddingTop: token
|
|
1297
|
-
paddingBottom: token
|
|
1298
|
-
paddingRight: token
|
|
1299
|
-
paddingLeft: token
|
|
1222
|
+
paddingTop: token.paddingXXS,
|
|
1223
|
+
paddingBottom: token.paddingXXS,
|
|
1224
|
+
paddingRight: token.paddingXS,
|
|
1225
|
+
paddingLeft: token.paddingXS,
|
|
1300
1226
|
alignItems: "center",
|
|
1301
|
-
gap: token
|
|
1227
|
+
gap: token.marginXS,
|
|
1302
1228
|
alignSelf: "stretch",
|
|
1303
1229
|
flexDirection: "row",
|
|
1304
|
-
borderRadius: token
|
|
1305
|
-
border: `1px solid ${token
|
|
1230
|
+
borderRadius: token.borderRadiusSM,
|
|
1231
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1306
1232
|
minWidth: "6.25rem",
|
|
1307
1233
|
maxWidth: "fit-content",
|
|
1308
|
-
svg: { path: { fill: token
|
|
1234
|
+
svg: { path: { fill: token.colorPrimary } }
|
|
1309
1235
|
},
|
|
1310
1236
|
[scope("list-title")]: {
|
|
1311
|
-
color: token
|
|
1312
|
-
fontSize: token
|
|
1313
|
-
fontWeight: token
|
|
1314
|
-
lineHeight: token
|
|
1237
|
+
color: token.colorTextHeading,
|
|
1238
|
+
fontSize: token.fontSizeHeading3,
|
|
1239
|
+
fontWeight: token.fontWeightStrong,
|
|
1240
|
+
lineHeight: token.lineHeightHeading3,
|
|
1315
1241
|
paddingBottom: 0,
|
|
1316
1242
|
marginBottom: 0,
|
|
1317
|
-
fontFamily: token
|
|
1243
|
+
fontFamily: token.fontFamily,
|
|
1318
1244
|
cursor: "pointer",
|
|
1319
1245
|
transition: "color 0.2s ease-in",
|
|
1320
1246
|
"&:hover": {
|
|
1321
|
-
color: `${token
|
|
1247
|
+
color: `${token.colorPrimary} !important`,
|
|
1322
1248
|
textDecoration: "underline"
|
|
1323
1249
|
}
|
|
1324
1250
|
},
|
|
1325
1251
|
[scope("path-name")]: {
|
|
1326
|
-
color: token
|
|
1327
|
-
fontSize: token
|
|
1252
|
+
color: token.colorText,
|
|
1253
|
+
fontSize: token.fontSizeSM,
|
|
1328
1254
|
fontWeight: 400,
|
|
1329
|
-
fontFamily: token
|
|
1255
|
+
fontFamily: token.fontFamily
|
|
1330
1256
|
},
|
|
1331
1257
|
[scope("grid-card")]: {
|
|
1332
1258
|
width: "17.5rem",
|
|
1333
1259
|
height: "100%",
|
|
1334
|
-
borderRadius: token
|
|
1260
|
+
borderRadius: token.borderRadiusLG
|
|
1335
1261
|
},
|
|
1336
1262
|
[scope("grid-title")]: {
|
|
1337
|
-
color: token
|
|
1338
|
-
fontSize: token
|
|
1339
|
-
fontWeight: token
|
|
1340
|
-
lineHeight: token
|
|
1263
|
+
color: token.colorTextHeading,
|
|
1264
|
+
fontSize: token.fontSizeHeading3,
|
|
1265
|
+
fontWeight: token.fontWeightStrong,
|
|
1266
|
+
lineHeight: token.lineHeightHeading3,
|
|
1341
1267
|
paddingBottom: 0,
|
|
1342
1268
|
marginBottom: 0,
|
|
1343
|
-
fontFamily: token
|
|
1269
|
+
fontFamily: token.fontFamily
|
|
1344
1270
|
},
|
|
1345
1271
|
[scope("grid-content")]: {
|
|
1346
1272
|
display: "flex",
|
|
1347
|
-
paddingTop: token
|
|
1348
|
-
paddingBottom: token
|
|
1349
|
-
paddingRight: token
|
|
1350
|
-
paddingLeft: token
|
|
1273
|
+
paddingTop: token.paddingXXS,
|
|
1274
|
+
paddingBottom: token.paddingXXS,
|
|
1275
|
+
paddingRight: token.paddingXS,
|
|
1276
|
+
paddingLeft: token.paddingXS,
|
|
1351
1277
|
alignItems: "center",
|
|
1352
|
-
gap: token
|
|
1278
|
+
gap: token.marginXS,
|
|
1353
1279
|
alignSelf: "stretch",
|
|
1354
1280
|
flexDirection: "row",
|
|
1355
|
-
borderRadius: token
|
|
1356
|
-
border: `1px solid ${token
|
|
1357
|
-
svg: { path: { fill: token
|
|
1281
|
+
borderRadius: token.borderRadiusSM,
|
|
1282
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1283
|
+
svg: { path: { fill: token.colorPrimary } }
|
|
1358
1284
|
},
|
|
1359
1285
|
[scope("grid-path-name")]: {
|
|
1360
|
-
color: token
|
|
1361
|
-
fontSize: token
|
|
1286
|
+
color: token.colorText,
|
|
1287
|
+
fontSize: token.fontSizeSM,
|
|
1362
1288
|
fontWeight: 400,
|
|
1363
|
-
fontFamily: token
|
|
1289
|
+
fontFamily: token.fontFamily
|
|
1364
1290
|
},
|
|
1365
1291
|
[scope("grid-see-details")]: {
|
|
1366
1292
|
paddingTop: 0,
|
|
1367
1293
|
paddingBottom: 0,
|
|
1368
1294
|
paddingLeft: "0.4375rem",
|
|
1369
1295
|
paddingRight: "0.4375rem",
|
|
1370
|
-
borderRadius: token
|
|
1371
|
-
border: `1px solid ${token
|
|
1372
|
-
background: token
|
|
1296
|
+
borderRadius: token.borderRadiusSM,
|
|
1297
|
+
border: `1px solid ${token.Button?.defaultBorderColor}`,
|
|
1298
|
+
background: token.Button?.defaultBg,
|
|
1373
1299
|
boxShadow: `0 2px 0 0 rgba(0, 0, 0, 0.02)`,
|
|
1374
1300
|
width: "100%",
|
|
1375
1301
|
height: "1.5rem"
|
|
@@ -1389,7 +1315,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1389
1315
|
});
|
|
1390
1316
|
};
|
|
1391
1317
|
const MethodChip = ({ method }) => {
|
|
1392
|
-
const methodStyle = methodColors[method];
|
|
1318
|
+
const methodStyle = methodColors$1[method];
|
|
1393
1319
|
return /* @__PURE__ */ jsx("div", {
|
|
1394
1320
|
className: cx("method-chip"),
|
|
1395
1321
|
style: {
|
|
@@ -1413,7 +1339,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1413
1339
|
align: "center",
|
|
1414
1340
|
className: cx("list-container"),
|
|
1415
1341
|
children: [/* @__PURE__ */ jsxs(Flex, {
|
|
1416
|
-
gap: token
|
|
1342
|
+
gap: token.marginSM,
|
|
1417
1343
|
children: [/* @__PURE__ */ jsx(MethodChip, { method: api.method }), /* @__PURE__ */ jsx(Title, {
|
|
1418
1344
|
className: cx("list-title"),
|
|
1419
1345
|
level: 4,
|
|
@@ -1428,7 +1354,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1428
1354
|
}),
|
|
1429
1355
|
/* @__PURE__ */ jsxs("div", {
|
|
1430
1356
|
className: cx("list-content"),
|
|
1431
|
-
children: [/* @__PURE__ */ jsx(
|
|
1357
|
+
children: [/* @__PURE__ */ jsx(Link, {}), /* @__PURE__ */ jsx(Text, {
|
|
1432
1358
|
className: cx("path-name"),
|
|
1433
1359
|
children: api?.path
|
|
1434
1360
|
})]
|
|
@@ -1443,7 +1369,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1443
1369
|
className: cx("grid-card"),
|
|
1444
1370
|
children: /* @__PURE__ */ jsxs(Flex, {
|
|
1445
1371
|
vertical: true,
|
|
1446
|
-
gap: token
|
|
1372
|
+
gap: token.marginSM,
|
|
1447
1373
|
children: [
|
|
1448
1374
|
/* @__PURE__ */ jsx(MethodChip, { method: api?.method }),
|
|
1449
1375
|
/* @__PURE__ */ jsx(Title, {
|
|
@@ -1453,7 +1379,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1453
1379
|
}),
|
|
1454
1380
|
/* @__PURE__ */ jsxs("div", {
|
|
1455
1381
|
className: cx("grid-content"),
|
|
1456
|
-
children: [/* @__PURE__ */ jsx(
|
|
1382
|
+
children: [/* @__PURE__ */ jsx(Link, {}), /* @__PURE__ */ jsx(Text, {
|
|
1457
1383
|
className: cx("grid-path-name"),
|
|
1458
1384
|
children: api?.path
|
|
1459
1385
|
})]
|
|
@@ -1467,8 +1393,6 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1467
1393
|
})
|
|
1468
1394
|
}));
|
|
1469
1395
|
};
|
|
1470
|
-
var ApiCard_default = ApiCard;
|
|
1471
|
-
|
|
1472
1396
|
//#endregion
|
|
1473
1397
|
//#region src/view/components/ApiPage/components/ViewModeApiHeader.tsx
|
|
1474
1398
|
function formatAuthType(authType) {
|
|
@@ -1482,11 +1406,11 @@ function formatAuthType(authType) {
|
|
|
1482
1406
|
}
|
|
1483
1407
|
}
|
|
1484
1408
|
const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
1485
|
-
const { wrapSSR, cx } = useStyle("ViewModeApiHeader", (token
|
|
1409
|
+
const { wrapSSR, cx } = useStyle("ViewModeApiHeader", (token, scope) => ({
|
|
1486
1410
|
[scope("root")]: {
|
|
1487
1411
|
display: "flex",
|
|
1488
1412
|
flexDirection: "column",
|
|
1489
|
-
gap: token
|
|
1413
|
+
gap: token.marginMD
|
|
1490
1414
|
},
|
|
1491
1415
|
[scope("meta-bar")]: {
|
|
1492
1416
|
display: "flex",
|
|
@@ -1502,20 +1426,20 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1502
1426
|
display: "flex",
|
|
1503
1427
|
alignItems: "center",
|
|
1504
1428
|
paddingRight: 12,
|
|
1505
|
-
borderRight: `1px solid ${token
|
|
1429
|
+
borderRight: `1px solid ${token.colorBorderSecondary}`,
|
|
1506
1430
|
marginRight: 12
|
|
1507
1431
|
},
|
|
1508
1432
|
[scope("jws-tag")]: {
|
|
1509
1433
|
display: "flex",
|
|
1510
1434
|
alignItems: "center",
|
|
1511
1435
|
height: 32,
|
|
1512
|
-
background: token
|
|
1513
|
-
border: `1px solid ${token
|
|
1436
|
+
background: token.colorPrimaryBg,
|
|
1437
|
+
border: `1px solid ${token.colorPrimaryBorder}`,
|
|
1514
1438
|
borderRadius: 6,
|
|
1515
1439
|
padding: "0 8px",
|
|
1516
1440
|
fontSize: 12,
|
|
1517
1441
|
lineHeight: "20px",
|
|
1518
|
-
color: token
|
|
1442
|
+
color: token.colorPrimary,
|
|
1519
1443
|
fontWeight: 400,
|
|
1520
1444
|
margin: 0
|
|
1521
1445
|
},
|
|
@@ -1523,14 +1447,14 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1523
1447
|
display: "inline-flex",
|
|
1524
1448
|
alignItems: "center",
|
|
1525
1449
|
gap: 4,
|
|
1526
|
-
background: token
|
|
1527
|
-
border: `1px solid ${token
|
|
1450
|
+
background: token.colorBgContainer,
|
|
1451
|
+
border: `1px solid ${token.colorBorder}`,
|
|
1528
1452
|
borderRadius: 4,
|
|
1529
1453
|
padding: "0 8px",
|
|
1530
1454
|
height: 32,
|
|
1531
1455
|
fontSize: 12,
|
|
1532
1456
|
lineHeight: "20px",
|
|
1533
|
-
color: token
|
|
1457
|
+
color: token.colorText,
|
|
1534
1458
|
margin: 0,
|
|
1535
1459
|
boxSizing: "border-box"
|
|
1536
1460
|
},
|
|
@@ -1543,8 +1467,8 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1543
1467
|
display: "inline-flex",
|
|
1544
1468
|
alignItems: "center",
|
|
1545
1469
|
gap: 8,
|
|
1546
|
-
background: token
|
|
1547
|
-
border: `1px solid ${token
|
|
1470
|
+
background: token.colorFillTertiary,
|
|
1471
|
+
border: `1px solid ${token.colorBorder}`,
|
|
1548
1472
|
borderRadius: 6,
|
|
1549
1473
|
padding: "0 15px",
|
|
1550
1474
|
height: 32,
|
|
@@ -1553,13 +1477,13 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1553
1477
|
},
|
|
1554
1478
|
[scope("version-icon")]: {
|
|
1555
1479
|
fontSize: 16,
|
|
1556
|
-
color: token
|
|
1480
|
+
color: token.colorTextDisabled,
|
|
1557
1481
|
display: "flex",
|
|
1558
1482
|
alignItems: "center"
|
|
1559
1483
|
},
|
|
1560
1484
|
[scope("version-text")]: {
|
|
1561
1485
|
fontSize: 14,
|
|
1562
|
-
color: token
|
|
1486
|
+
color: token.colorTextDisabled,
|
|
1563
1487
|
fontWeight: 400,
|
|
1564
1488
|
lineHeight: 1
|
|
1565
1489
|
},
|
|
@@ -1573,16 +1497,16 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1573
1497
|
justifyContent: "center"
|
|
1574
1498
|
},
|
|
1575
1499
|
[scope("toggle-btn-active")]: {
|
|
1576
|
-
border: `1px solid ${token
|
|
1577
|
-
color: `${token
|
|
1578
|
-
backgroundColor: `${token
|
|
1500
|
+
border: `1px solid ${token.colorPrimary} !important`,
|
|
1501
|
+
color: `${token.colorPrimary} !important`,
|
|
1502
|
+
backgroundColor: `${token.colorBgContainer} !important`,
|
|
1579
1503
|
zIndex: 1
|
|
1580
1504
|
},
|
|
1581
1505
|
[scope("description")]: {
|
|
1582
|
-
fontSize: token
|
|
1583
|
-
color: token
|
|
1506
|
+
fontSize: token.fontSizeLG,
|
|
1507
|
+
color: token.colorTextTertiary
|
|
1584
1508
|
},
|
|
1585
|
-
[scope("title")]: { fontFamily: token
|
|
1509
|
+
[scope("title")]: { fontFamily: token.fontFamily }
|
|
1586
1510
|
}));
|
|
1587
1511
|
const version = api.relatedVersions?.find((v) => v.apiId === api.currentVersion)?.version || api.version;
|
|
1588
1512
|
return wrapSSR(/* @__PURE__ */ jsxs("div", {
|
|
@@ -1667,14 +1591,13 @@ const ViewModeApiHeader = ({ api, viewLayout, onViewLayoutChange }) => {
|
|
|
1667
1591
|
]
|
|
1668
1592
|
}));
|
|
1669
1593
|
};
|
|
1670
|
-
|
|
1671
1594
|
//#endregion
|
|
1672
1595
|
//#region src/view/components/ApiPage/index.tsx
|
|
1673
1596
|
const APIPage = () => {
|
|
1674
1597
|
const [selectedUrl, setSelectedUrl] = useState("");
|
|
1675
|
-
const { view: { selectedApi, focusedTag, setFocusedTag } } =
|
|
1598
|
+
const { view: { selectedApi, focusedTag, setFocusedTag } } = useStore();
|
|
1676
1599
|
const [viewStyle, setViewStyle] = useState("grid");
|
|
1677
|
-
const { wrapSSR, token
|
|
1600
|
+
const { wrapSSR, token } = useStyle("DocumentationApiPage", () => ({}));
|
|
1678
1601
|
const urlsOptions = useMemo(() => selectedApi?.servers?.map((server) => ({
|
|
1679
1602
|
label: server?.url,
|
|
1680
1603
|
value: server?.url
|
|
@@ -1714,7 +1637,7 @@ const APIPage = () => {
|
|
|
1714
1637
|
};
|
|
1715
1638
|
return wrapSSR(/* @__PURE__ */ jsxs(Flex, {
|
|
1716
1639
|
vertical: true,
|
|
1717
|
-
gap: token
|
|
1640
|
+
gap: token.margin,
|
|
1718
1641
|
children: [selectedApi && /* @__PURE__ */ jsx(ViewModeApiHeader, {
|
|
1719
1642
|
api: selectedApi,
|
|
1720
1643
|
viewLayout: viewStyle,
|
|
@@ -1731,14 +1654,14 @@ const APIPage = () => {
|
|
|
1731
1654
|
haveUnderLine: index < arr.length - 1,
|
|
1732
1655
|
contextPath: selectedApi?.contextPath,
|
|
1733
1656
|
viewStyle,
|
|
1734
|
-
token
|
|
1657
|
+
token
|
|
1735
1658
|
}, `${selectedApi?.id}_${key}`);
|
|
1736
1659
|
})]
|
|
1737
1660
|
}));
|
|
1738
1661
|
};
|
|
1739
|
-
const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine, contextPath, viewStyle, token
|
|
1662
|
+
const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine, contextPath, viewStyle, token }) => {
|
|
1740
1663
|
return /* @__PURE__ */ jsxs(Flex, {
|
|
1741
|
-
gap: viewStyle === "grid" ? token
|
|
1664
|
+
gap: viewStyle === "grid" ? token.marginXS : 0,
|
|
1742
1665
|
style: {
|
|
1743
1666
|
marginBottom: 0,
|
|
1744
1667
|
paddingBottom: 0
|
|
@@ -1755,19 +1678,18 @@ const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine, contextPath, vi
|
|
|
1755
1678
|
wrap: "wrap",
|
|
1756
1679
|
gap: viewStyle === "grid" ? "1.5rem" : 0,
|
|
1757
1680
|
vertical: viewStyle === "list",
|
|
1758
|
-
children: apis.map((item) => /* @__PURE__ */ jsx(
|
|
1681
|
+
children: apis.map((item) => /* @__PURE__ */ jsx(ApiCard, {
|
|
1759
1682
|
api: item,
|
|
1760
1683
|
viewStyle
|
|
1761
1684
|
}, `${tagName}_renderer_${item.id}_${item.method}_${item.path}`))
|
|
1762
1685
|
}),
|
|
1763
1686
|
haveUnderLine && /* @__PURE__ */ jsx(Divider, { style: {
|
|
1764
|
-
marginTop: token
|
|
1765
|
-
marginBottom: token
|
|
1687
|
+
marginTop: token.marginSM,
|
|
1688
|
+
marginBottom: token.marginSM
|
|
1766
1689
|
} })
|
|
1767
1690
|
]
|
|
1768
1691
|
}, `${tagName}_renderer_${contextPath}`);
|
|
1769
1692
|
};
|
|
1770
|
-
|
|
1771
1693
|
//#endregion
|
|
1772
1694
|
//#region src/utils/index.ts
|
|
1773
1695
|
const handleStatusColor = (code) => {
|
|
@@ -1778,11 +1700,10 @@ const handleStatusColor = (code) => {
|
|
|
1778
1700
|
else if (code >= 300 && code < 400) return "orange";
|
|
1779
1701
|
else return "gray";
|
|
1780
1702
|
};
|
|
1781
|
-
|
|
1782
1703
|
//#endregion
|
|
1783
1704
|
//#region src/view/components/EndpointPage/EndpointPage.tsx
|
|
1784
|
-
const { Title: Title$
|
|
1785
|
-
const requestColumns = [
|
|
1705
|
+
const { Title: Title$3, Paragraph: Paragraph$1 } = Typography;
|
|
1706
|
+
const requestColumns$1 = [
|
|
1786
1707
|
{
|
|
1787
1708
|
title: "Parameter",
|
|
1788
1709
|
dataIndex: "param",
|
|
@@ -1799,8 +1720,8 @@ const requestColumns = [
|
|
|
1799
1720
|
key: "enum"
|
|
1800
1721
|
}
|
|
1801
1722
|
];
|
|
1802
|
-
const responseColumns = [...requestColumns];
|
|
1803
|
-
const buildRequestData = (params
|
|
1723
|
+
const responseColumns$1 = [...requestColumns$1];
|
|
1724
|
+
const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
|
|
1804
1725
|
let typeLabel = p.schema?.type;
|
|
1805
1726
|
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
1806
1727
|
return {
|
|
@@ -1809,17 +1730,17 @@ const buildRequestData = (params, token$1) => [...params].sort((a, b) => a.requi
|
|
|
1809
1730
|
p.name,
|
|
1810
1731
|
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
1811
1732
|
style: {
|
|
1812
|
-
color:
|
|
1733
|
+
color: "rgba(0,0,0,0.45)",
|
|
1813
1734
|
marginLeft: "0.25rem",
|
|
1814
1735
|
marginRight: "0.25rem"
|
|
1815
1736
|
},
|
|
1816
1737
|
children: typeLabel
|
|
1817
1738
|
}),
|
|
1818
1739
|
p.required ? /* @__PURE__ */ jsx("span", {
|
|
1819
|
-
style: { color:
|
|
1740
|
+
style: { color: "red" },
|
|
1820
1741
|
children: "*"
|
|
1821
1742
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1822
|
-
style: { color:
|
|
1743
|
+
style: { color: "#52C41A" },
|
|
1823
1744
|
children: "Optional"
|
|
1824
1745
|
})
|
|
1825
1746
|
] }),
|
|
@@ -1827,7 +1748,7 @@ const buildRequestData = (params, token$1) => [...params].sort((a, b) => a.requi
|
|
|
1827
1748
|
enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
1828
1749
|
};
|
|
1829
1750
|
});
|
|
1830
|
-
const buildHeaderData = (headers
|
|
1751
|
+
const buildHeaderData$1 = (headers) => {
|
|
1831
1752
|
if (!headers) return [];
|
|
1832
1753
|
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
1833
1754
|
let typeLabel = header.schema?.type;
|
|
@@ -1838,17 +1759,17 @@ const buildHeaderData = (headers, token$1) => {
|
|
|
1838
1759
|
name,
|
|
1839
1760
|
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
1840
1761
|
style: {
|
|
1841
|
-
color:
|
|
1762
|
+
color: "rgba(0,0,0,0.45)",
|
|
1842
1763
|
marginLeft: "0.25rem",
|
|
1843
1764
|
marginRight: "0.25rem"
|
|
1844
1765
|
},
|
|
1845
1766
|
children: typeLabel
|
|
1846
1767
|
}),
|
|
1847
1768
|
header.required ? /* @__PURE__ */ jsx("span", {
|
|
1848
|
-
style: { color:
|
|
1769
|
+
style: { color: "red" },
|
|
1849
1770
|
children: "*"
|
|
1850
1771
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1851
|
-
style: { color:
|
|
1772
|
+
style: { color: "#52C41A" },
|
|
1852
1773
|
children: "Optional"
|
|
1853
1774
|
})
|
|
1854
1775
|
] }, idx),
|
|
@@ -1857,46 +1778,15 @@ const buildHeaderData = (headers, token$1) => {
|
|
|
1857
1778
|
};
|
|
1858
1779
|
});
|
|
1859
1780
|
};
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
const properties = schema.properties ?? {};
|
|
1866
|
-
const required = schema.required ?? [];
|
|
1867
|
-
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
1868
|
-
key: idx,
|
|
1869
|
-
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
1870
|
-
name,
|
|
1871
|
-
prop.type && /* @__PURE__ */ jsx("span", {
|
|
1872
|
-
style: {
|
|
1873
|
-
color: token$1.colorTextTertiary,
|
|
1874
|
-
marginLeft: "0.25rem",
|
|
1875
|
-
marginRight: "0.25rem"
|
|
1876
|
-
},
|
|
1877
|
-
children: prop.type
|
|
1878
|
-
}),
|
|
1879
|
-
required.includes(name) ? /* @__PURE__ */ jsx("span", {
|
|
1880
|
-
style: { color: token$1.colorError },
|
|
1881
|
-
children: "*"
|
|
1882
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
1883
|
-
style: { color: token$1.colorSuccess },
|
|
1884
|
-
children: "Optional"
|
|
1885
|
-
})
|
|
1886
|
-
] }),
|
|
1887
|
-
desc: prop.description || "--",
|
|
1888
|
-
enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
1889
|
-
}));
|
|
1890
|
-
};
|
|
1891
|
-
const EndpointPage = () => {
|
|
1892
|
-
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = store_default(({ view }) => view);
|
|
1893
|
-
const [activeTabKey, setActiveTabKey] = useState("header");
|
|
1894
|
-
const { token: token$1 } = theme.useToken();
|
|
1895
|
-
const { cx } = useStyle("EndpointPage", (token$2, scope) => ({
|
|
1781
|
+
const EndpointPage$1 = () => {
|
|
1782
|
+
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
|
|
1783
|
+
const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
|
|
1784
|
+
const [selectedServer, setSelectedServer] = useState(0);
|
|
1785
|
+
const { cx } = useStyle("EndpointPage", (token, scope) => ({
|
|
1896
1786
|
[scope("docs-endpoint-container")]: {
|
|
1897
1787
|
display: "flex",
|
|
1898
1788
|
flexDirection: "column",
|
|
1899
|
-
gap: token
|
|
1789
|
+
gap: token.marginLG,
|
|
1900
1790
|
height: "100%"
|
|
1901
1791
|
},
|
|
1902
1792
|
[scope("content")]: {
|
|
@@ -1905,100 +1795,74 @@ const EndpointPage = () => {
|
|
|
1905
1795
|
},
|
|
1906
1796
|
[scope("code")]: {
|
|
1907
1797
|
background: "unset",
|
|
1908
|
-
borderRadius: token
|
|
1909
|
-
padding: token
|
|
1798
|
+
borderRadius: token.borderRadius,
|
|
1799
|
+
padding: token.paddingSM,
|
|
1910
1800
|
fontFamily: "monospace",
|
|
1911
1801
|
whiteSpace: "pre-wrap"
|
|
1912
1802
|
},
|
|
1913
1803
|
[scope("breadcrumb")]: {
|
|
1914
1804
|
display: "flex",
|
|
1915
|
-
gap: token
|
|
1805
|
+
gap: token.marginLG,
|
|
1916
1806
|
alignItems: "center",
|
|
1917
|
-
marginBottom: token
|
|
1807
|
+
marginBottom: token.marginLG
|
|
1918
1808
|
},
|
|
1919
1809
|
[scope("request-card")]: {
|
|
1920
|
-
borderRadius: token$2.borderRadius,
|
|
1921
|
-
backgroundColor: token$2.colorBgBase,
|
|
1922
1810
|
".ant-card-head": {
|
|
1923
1811
|
minHeight: "unset",
|
|
1924
1812
|
borderBottom: "unset",
|
|
1925
|
-
padding: "0.75rem"
|
|
1926
|
-
backgroundColor: token$2.colorBgBase
|
|
1813
|
+
padding: "0.75rem"
|
|
1927
1814
|
},
|
|
1928
1815
|
".ant-card-body": {
|
|
1929
1816
|
padding: "0px 0.75rem 0.75rem 0.75rem",
|
|
1930
|
-
backgroundColor: token$2.colorBgBase,
|
|
1931
1817
|
".ant-tabs-tab": { paddingTop: "0" }
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
"& .ant-table-thead > tr > th": { backgroundColor: `${token$2.colorBgBase} !important` },
|
|
1935
|
-
"& .ant-table-tbody > tr > td": { backgroundColor: `${token$2.colorBgBase} !important` }
|
|
1936
|
-
},
|
|
1937
|
-
[scope("row-odd")]: { "& > td": { background: `${token$2.colorBgElevated} !important` } },
|
|
1938
|
-
[scope("row-even")]: { "& > td": { background: `${token$2.colorBgLayout} !important` } }
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1939
1820
|
}));
|
|
1940
|
-
const methodStyle =
|
|
1941
|
-
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []
|
|
1942
|
-
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []
|
|
1943
|
-
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []
|
|
1944
|
-
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token$1);
|
|
1821
|
+
const methodStyle = methodColors$1[selectedEndpoint?.method];
|
|
1822
|
+
const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
|
|
1823
|
+
const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
|
|
1824
|
+
const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
|
|
1945
1825
|
const requestTabs = [
|
|
1946
1826
|
{
|
|
1947
1827
|
key: "header",
|
|
1948
1828
|
label: "Header",
|
|
1949
1829
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1950
|
-
columns: requestColumns,
|
|
1830
|
+
columns: requestColumns$1,
|
|
1951
1831
|
dataSource: headerParams,
|
|
1952
1832
|
pagination: false,
|
|
1953
1833
|
bordered: true,
|
|
1954
|
-
size: "small"
|
|
1955
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1834
|
+
size: "small"
|
|
1956
1835
|
})
|
|
1957
1836
|
},
|
|
1958
1837
|
{
|
|
1959
1838
|
key: "path",
|
|
1960
1839
|
label: "Path",
|
|
1961
1840
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1962
|
-
columns: requestColumns,
|
|
1841
|
+
columns: requestColumns$1,
|
|
1963
1842
|
dataSource: pathParams,
|
|
1964
1843
|
pagination: false,
|
|
1965
1844
|
bordered: true,
|
|
1966
|
-
size: "small"
|
|
1967
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1845
|
+
size: "small"
|
|
1968
1846
|
})
|
|
1969
1847
|
},
|
|
1970
1848
|
{
|
|
1971
1849
|
key: "query",
|
|
1972
1850
|
label: "Query",
|
|
1973
1851
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1974
|
-
columns: requestColumns,
|
|
1852
|
+
columns: requestColumns$1,
|
|
1975
1853
|
dataSource: queryParams,
|
|
1976
1854
|
pagination: false,
|
|
1977
1855
|
bordered: true,
|
|
1978
|
-
size: "small"
|
|
1979
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1980
|
-
})
|
|
1981
|
-
},
|
|
1982
|
-
...requestBodyData.length > 0 ? [{
|
|
1983
|
-
key: "requestBody",
|
|
1984
|
-
label: "Request Body",
|
|
1985
|
-
children: /* @__PURE__ */ jsx(Table, {
|
|
1986
|
-
columns: requestColumns,
|
|
1987
|
-
dataSource: requestBodyData,
|
|
1988
|
-
pagination: false,
|
|
1989
|
-
bordered: true,
|
|
1990
|
-
size: "small",
|
|
1991
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1856
|
+
size: "small"
|
|
1992
1857
|
})
|
|
1993
|
-
}
|
|
1858
|
+
}
|
|
1994
1859
|
].filter((t) => t !== null);
|
|
1995
|
-
useEffect(() => {
|
|
1996
|
-
const firstKey = requestTabs[0]?.key ?? "header";
|
|
1997
|
-
setActiveTabKey(firstKey);
|
|
1998
|
-
setActiveRequestTab(firstKey);
|
|
1999
|
-
}, [selectedEndpoint?.id]);
|
|
2000
1860
|
const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
|
|
2001
|
-
const responseHeaderData = buildHeaderData(responseHeaders
|
|
1861
|
+
const responseHeaderData = buildHeaderData$1(responseHeaders);
|
|
1862
|
+
selectedApi?.servers?.map((server, index) => ({
|
|
1863
|
+
value: index,
|
|
1864
|
+
label: `${server.url}${selectedEndpoint?.path || ""}`
|
|
1865
|
+
}));
|
|
2002
1866
|
return /* @__PURE__ */ jsx("div", {
|
|
2003
1867
|
className: cx("docs-endpoint-container"),
|
|
2004
1868
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -2038,61 +1902,42 @@ const EndpointPage = () => {
|
|
|
2038
1902
|
display: "flex",
|
|
2039
1903
|
flexDirection: "row",
|
|
2040
1904
|
alignItems: "center",
|
|
2041
|
-
color:
|
|
1905
|
+
color: "rgba(0,0,0,0.45)",
|
|
2042
1906
|
gap: "0.25rem"
|
|
2043
1907
|
},
|
|
2044
1908
|
children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
|
|
2045
1909
|
})
|
|
2046
1910
|
},
|
|
2047
|
-
{ title: /* @__PURE__ */ jsx(
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
whiteSpace: "nowrap",
|
|
2054
|
-
display: "block",
|
|
2055
|
-
maxWidth: "300px"
|
|
2056
|
-
},
|
|
2057
|
-
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
2058
|
-
})
|
|
1911
|
+
{ title: /* @__PURE__ */ jsx("span", {
|
|
1912
|
+
style: {
|
|
1913
|
+
display: "flex",
|
|
1914
|
+
gap: "1rem"
|
|
1915
|
+
},
|
|
1916
|
+
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
2059
1917
|
}) }
|
|
2060
1918
|
] })]
|
|
2061
1919
|
}),
|
|
2062
|
-
/* @__PURE__ */ jsxs(Title$
|
|
1920
|
+
/* @__PURE__ */ jsxs(Title$3, {
|
|
2063
1921
|
level: 3,
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
alignItems: "center",
|
|
2067
|
-
gap: 12,
|
|
2068
|
-
margin: 0
|
|
2069
|
-
},
|
|
2070
|
-
children: [/* @__PURE__ */ jsx(Tag, {
|
|
2071
|
-
style: {
|
|
2072
|
-
backgroundColor: methodStyle?.bg,
|
|
2073
|
-
color: methodStyle?.color,
|
|
2074
|
-
border: "none",
|
|
2075
|
-
width: "4.375rem",
|
|
2076
|
-
height: "1.375rem",
|
|
2077
|
-
textAlign: "center",
|
|
2078
|
-
flexShrink: 0
|
|
2079
|
-
},
|
|
2080
|
-
children: selectedEndpoint?.method
|
|
2081
|
-
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
2082
|
-
title: selectedEndpoint?.summary ?? "--",
|
|
2083
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1922
|
+
children: [
|
|
1923
|
+
/* @__PURE__ */ jsx(Tag, {
|
|
2084
1924
|
style: {
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
1925
|
+
backgroundColor: methodStyle?.bg,
|
|
1926
|
+
color: methodStyle?.color,
|
|
1927
|
+
border: "none",
|
|
1928
|
+
width: "4.375rem",
|
|
1929
|
+
height: "1.375rem",
|
|
1930
|
+
textAlign: "center"
|
|
2088
1931
|
},
|
|
2089
|
-
children: selectedEndpoint?.
|
|
2090
|
-
})
|
|
2091
|
-
|
|
1932
|
+
children: selectedEndpoint?.method
|
|
1933
|
+
}),
|
|
1934
|
+
" ",
|
|
1935
|
+
selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
|
|
1936
|
+
]
|
|
2092
1937
|
}),
|
|
2093
|
-
/* @__PURE__ */ jsx(Paragraph, {
|
|
1938
|
+
/* @__PURE__ */ jsx(Paragraph$1, {
|
|
2094
1939
|
style: {
|
|
2095
|
-
color:
|
|
1940
|
+
color: "rgba(0,0,0,0.45)",
|
|
2096
1941
|
marginBottom: "1.5rem"
|
|
2097
1942
|
},
|
|
2098
1943
|
children: selectedEndpoint?.description ?? "--"
|
|
@@ -2100,17 +1945,9 @@ const EndpointPage = () => {
|
|
|
2100
1945
|
requestTabs.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
2101
1946
|
title: "Request",
|
|
2102
1947
|
className: cx("request-card"),
|
|
2103
|
-
style: {
|
|
2104
|
-
marginBottom: "1.5rem",
|
|
2105
|
-
backgroundColor: token$1.colorBgBase
|
|
2106
|
-
},
|
|
2107
|
-
styles: { body: { backgroundColor: token$1.colorBgBase } },
|
|
1948
|
+
style: { marginBottom: "1.5rem" },
|
|
2108
1949
|
children: /* @__PURE__ */ jsx(Tabs, {
|
|
2109
|
-
|
|
2110
|
-
onChange: (key) => {
|
|
2111
|
-
setActiveTabKey(key);
|
|
2112
|
-
setActiveRequestTab(key);
|
|
2113
|
-
},
|
|
1950
|
+
defaultActiveKey: requestTabs[0].key,
|
|
2114
1951
|
items: requestTabs
|
|
2115
1952
|
})
|
|
2116
1953
|
}),
|
|
@@ -2126,19 +1963,17 @@ const EndpointPage = () => {
|
|
|
2126
1963
|
marginRight: "0.5rem"
|
|
2127
1964
|
} }), /* @__PURE__ */ jsx("span", { children: selectedStatusCode })] }),
|
|
2128
1965
|
children: /* @__PURE__ */ jsx(Table, {
|
|
2129
|
-
columns: responseColumns,
|
|
1966
|
+
columns: responseColumns$1,
|
|
2130
1967
|
dataSource: responseHeaderData,
|
|
2131
1968
|
pagination: false,
|
|
2132
1969
|
bordered: true,
|
|
2133
|
-
size: "small"
|
|
2134
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1970
|
+
size: "small"
|
|
2135
1971
|
})
|
|
2136
1972
|
})
|
|
2137
1973
|
]
|
|
2138
1974
|
})
|
|
2139
1975
|
});
|
|
2140
1976
|
};
|
|
2141
|
-
|
|
2142
1977
|
//#endregion
|
|
2143
1978
|
//#region src/assets/mouseSquare.tsx
|
|
2144
1979
|
const MouseSquare = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
@@ -2162,20 +1997,19 @@ const MouseSquare = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
2162
1997
|
strokeLinejoin: "round"
|
|
2163
1998
|
})]
|
|
2164
1999
|
});
|
|
2165
|
-
var mouseSquare_default = MouseSquare;
|
|
2166
|
-
|
|
2167
2000
|
//#endregion
|
|
2168
2001
|
//#region src/view/components/MainContent.tsx
|
|
2169
|
-
const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
2170
|
-
const { focusedContent, transformedData } =
|
|
2171
|
-
const { wrapSSR, cx, token
|
|
2002
|
+
const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
2003
|
+
const { focusedContent, transformedData } = useStore(({ view }) => view);
|
|
2004
|
+
const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
|
|
2172
2005
|
[scope("inner-doc-container")]: {
|
|
2006
|
+
backgroundColor: token.colorBgContainer,
|
|
2007
|
+
height: "100%",
|
|
2173
2008
|
width: "100%",
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
minWidth: 0
|
|
2009
|
+
maxHeight: "100%",
|
|
2010
|
+
overflow: "auto",
|
|
2011
|
+
borderRadius: token.borderRadius,
|
|
2012
|
+
padding: token.paddingXL
|
|
2179
2013
|
},
|
|
2180
2014
|
[scope("centered")]: {
|
|
2181
2015
|
display: "flex",
|
|
@@ -2186,31 +2020,30 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2186
2020
|
padding: 0
|
|
2187
2021
|
},
|
|
2188
2022
|
[scope("title")]: {
|
|
2189
|
-
fontFamily: token
|
|
2023
|
+
fontFamily: token.fontFamily,
|
|
2190
2024
|
fontWeight: 600,
|
|
2191
|
-
fontSize: token
|
|
2192
|
-
color:
|
|
2025
|
+
fontSize: token.fontSizeHeading4,
|
|
2026
|
+
color: "rgba(0, 0, 0, 0.88)"
|
|
2193
2027
|
},
|
|
2194
2028
|
[scope("text")]: {
|
|
2195
|
-
color:
|
|
2196
|
-
fontFamily: token
|
|
2029
|
+
color: "rgba(0, 0, 0, 0.88)",
|
|
2030
|
+
fontFamily: token.fontFamily
|
|
2197
2031
|
},
|
|
2198
2032
|
[scope("visit-landing-button")]: {
|
|
2199
2033
|
width: "12.25rem",
|
|
2200
2034
|
height: "2.5rem",
|
|
2201
|
-
borderRadius: token
|
|
2035
|
+
borderRadius: token.borderRadiusLG
|
|
2202
2036
|
},
|
|
2203
2037
|
[scope("reset-button")]: {
|
|
2204
2038
|
width: "8.125rem",
|
|
2205
2039
|
height: "2.5rem",
|
|
2206
|
-
borderRadius: token
|
|
2207
|
-
backgroundColor: token
|
|
2208
|
-
fontSize: token
|
|
2040
|
+
borderRadius: token.borderRadiusLG,
|
|
2041
|
+
backgroundColor: token?.Button?.primaryColor,
|
|
2042
|
+
fontSize: token.Button?.contentFontSizeLG
|
|
2209
2043
|
}
|
|
2210
2044
|
}));
|
|
2211
2045
|
return wrapSSR(/* @__PURE__ */ jsx("div", {
|
|
2212
2046
|
className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
|
|
2213
|
-
style: { backgroundColor: focusedContent === "ENDPOINT" ? token$1.colorBgBase : token$1.colorBgElevated },
|
|
2214
2047
|
children: !transformedData?.length ? /* @__PURE__ */ jsxs(Flex, {
|
|
2215
2048
|
justify: "center",
|
|
2216
2049
|
align: "center",
|
|
@@ -2218,9 +2051,9 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2218
2051
|
vertical: true,
|
|
2219
2052
|
flex: 1,
|
|
2220
2053
|
children: [
|
|
2221
|
-
/* @__PURE__ */ jsx(
|
|
2222
|
-
stroke: token
|
|
2223
|
-
fill: token
|
|
2054
|
+
/* @__PURE__ */ jsx(NoDataIcon, {
|
|
2055
|
+
stroke: token.colorPrimaryHover,
|
|
2056
|
+
fill: token.colorPrimaryBg,
|
|
2224
2057
|
width: "18.625rem",
|
|
2225
2058
|
height: "14.75rem"
|
|
2226
2059
|
}),
|
|
@@ -2241,7 +2074,7 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2241
2074
|
!searchEnabled ? /* @__PURE__ */ jsx(Button, {
|
|
2242
2075
|
type: "primary",
|
|
2243
2076
|
onClick: handleVisitLandingPage,
|
|
2244
|
-
icon: /* @__PURE__ */ jsx(
|
|
2077
|
+
icon: /* @__PURE__ */ jsx(MouseSquare, {}),
|
|
2245
2078
|
iconPosition: "start",
|
|
2246
2079
|
className: cx("visit-landing-button"),
|
|
2247
2080
|
children: "Visit Landing Page"
|
|
@@ -2252,30 +2085,29 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2252
2085
|
children: "Reset Search"
|
|
2253
2086
|
})
|
|
2254
2087
|
]
|
|
2255
|
-
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
2088
|
+
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage$1, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
2256
2089
|
}));
|
|
2257
2090
|
};
|
|
2258
|
-
|
|
2259
2091
|
//#endregion
|
|
2260
2092
|
//#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
|
|
2261
|
-
const { useBreakpoint: useBreakpoint$
|
|
2262
|
-
const { Title: Title$
|
|
2093
|
+
const { useBreakpoint: useBreakpoint$4 } = Grid;
|
|
2094
|
+
const { Title: Title$2 } = Typography;
|
|
2263
2095
|
const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
|
|
2264
|
-
const isMobile = !useBreakpoint$
|
|
2265
|
-
const { wrapSSR, cx, token
|
|
2096
|
+
const isMobile = !useBreakpoint$4().md;
|
|
2097
|
+
const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
|
|
2266
2098
|
[scope("root")]: {
|
|
2267
2099
|
display: "flex",
|
|
2268
2100
|
alignItems: "center",
|
|
2269
2101
|
justifyContent: "space-between",
|
|
2270
|
-
padding: `${token
|
|
2271
|
-
background: token
|
|
2272
|
-
borderRadius: token
|
|
2102
|
+
padding: `${token.marginSM + 4}px ${token.paddingLG}px`,
|
|
2103
|
+
background: token.colorBgContainer,
|
|
2104
|
+
borderRadius: token.borderRadius,
|
|
2273
2105
|
width: "100%",
|
|
2274
|
-
["@media (max-width: 640px)"]: { padding: `${token
|
|
2106
|
+
["@media (max-width: 640px)"]: { padding: `${token.marginSM}px ${token.marginMD}px` }
|
|
2275
2107
|
},
|
|
2276
2108
|
[scope("mobileWrapper")]: {
|
|
2277
2109
|
flexDirection: "column",
|
|
2278
|
-
gap: token
|
|
2110
|
+
gap: token.marginMD
|
|
2279
2111
|
},
|
|
2280
2112
|
[scope("mobileTopRow")]: {
|
|
2281
2113
|
width: "100%",
|
|
@@ -2298,7 +2130,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2298
2130
|
flex: 1,
|
|
2299
2131
|
display: "flex",
|
|
2300
2132
|
alignItems: "center",
|
|
2301
|
-
gap: token
|
|
2133
|
+
gap: token.marginSM,
|
|
2302
2134
|
minWidth: 0,
|
|
2303
2135
|
overflow: "hidden"
|
|
2304
2136
|
},
|
|
@@ -2308,14 +2140,14 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2308
2140
|
display: "flex",
|
|
2309
2141
|
alignItems: "center",
|
|
2310
2142
|
justifyContent: "center",
|
|
2311
|
-
color: token
|
|
2143
|
+
color: token.colorText
|
|
2312
2144
|
},
|
|
2313
2145
|
[scope("switcher")]: {
|
|
2314
2146
|
display: "flex",
|
|
2315
2147
|
alignItems: "center",
|
|
2316
|
-
background: token
|
|
2148
|
+
background: token.colorBgLayout,
|
|
2317
2149
|
padding: "4px 4px",
|
|
2318
|
-
borderRadius: token
|
|
2150
|
+
borderRadius: token.borderRadius,
|
|
2319
2151
|
gap: 8
|
|
2320
2152
|
},
|
|
2321
2153
|
[scope("switcher-item")]: {
|
|
@@ -2326,17 +2158,17 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2326
2158
|
background: "transparent",
|
|
2327
2159
|
border: "none",
|
|
2328
2160
|
cursor: "pointer",
|
|
2329
|
-
fontSize: token
|
|
2161
|
+
fontSize: token.fontSizeLG,
|
|
2330
2162
|
fontWeight: 400,
|
|
2331
|
-
color: token
|
|
2332
|
-
fontFamily: token
|
|
2163
|
+
color: token.colorText,
|
|
2164
|
+
fontFamily: token.fontFamily,
|
|
2333
2165
|
transition: "all 0.2s ease"
|
|
2334
2166
|
},
|
|
2335
2167
|
[scope("switcher-item-active")]: {
|
|
2336
|
-
background: token
|
|
2337
|
-
borderRadius: token
|
|
2168
|
+
background: token.colorBgContainer,
|
|
2169
|
+
borderRadius: token.borderRadius,
|
|
2338
2170
|
boxShadow: "0px 2px 4px -2px rgba(17,12,34,0.12)",
|
|
2339
|
-
fontSize: token
|
|
2171
|
+
fontSize: token.fontSize,
|
|
2340
2172
|
fontWeight: 700
|
|
2341
2173
|
},
|
|
2342
2174
|
[scope("switcher-icon")]: {
|
|
@@ -2350,14 +2182,14 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2350
2182
|
[scope("actions")]: {
|
|
2351
2183
|
display: "flex",
|
|
2352
2184
|
alignItems: "center",
|
|
2353
|
-
gap: token
|
|
2185
|
+
gap: token.marginMD,
|
|
2354
2186
|
flex: 1,
|
|
2355
2187
|
justifyContent: "flex-end"
|
|
2356
2188
|
},
|
|
2357
2189
|
[scope("mobileActions")]: {
|
|
2358
2190
|
display: "flex",
|
|
2359
2191
|
alignItems: "center",
|
|
2360
|
-
gap: token
|
|
2192
|
+
gap: token.marginSM,
|
|
2361
2193
|
justifyContent: "flex-end"
|
|
2362
2194
|
}
|
|
2363
2195
|
}));
|
|
@@ -2372,13 +2204,13 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2372
2204
|
className: cx("title-section"),
|
|
2373
2205
|
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
2374
2206
|
title: apiName,
|
|
2375
|
-
children: /* @__PURE__ */ jsx(Title$
|
|
2207
|
+
children: /* @__PURE__ */ jsx(Title$2, {
|
|
2376
2208
|
level: 3,
|
|
2377
2209
|
ellipsis: true,
|
|
2378
2210
|
style: {
|
|
2379
2211
|
margin: 0,
|
|
2380
2212
|
fontWeight: 600,
|
|
2381
|
-
color: token
|
|
2213
|
+
color: token.colorTextHeading
|
|
2382
2214
|
},
|
|
2383
2215
|
children: apiName
|
|
2384
2216
|
})
|
|
@@ -2410,7 +2242,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2410
2242
|
className: cx("title-section"),
|
|
2411
2243
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
2412
2244
|
title: `${apiName} API Documentation`,
|
|
2413
|
-
children: /* @__PURE__ */ jsxs(Title$
|
|
2245
|
+
children: /* @__PURE__ */ jsxs(Title$2, {
|
|
2414
2246
|
level: 3,
|
|
2415
2247
|
style: {
|
|
2416
2248
|
margin: 0,
|
|
@@ -2418,7 +2250,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2418
2250
|
whiteSpace: "nowrap",
|
|
2419
2251
|
overflow: "hidden",
|
|
2420
2252
|
textOverflow: "ellipsis",
|
|
2421
|
-
color: token
|
|
2253
|
+
color: token.colorTextHeading,
|
|
2422
2254
|
minWidth: 0,
|
|
2423
2255
|
flex: 1
|
|
2424
2256
|
},
|
|
@@ -2462,17 +2294,16 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2462
2294
|
]
|
|
2463
2295
|
}));
|
|
2464
2296
|
};
|
|
2465
|
-
|
|
2466
2297
|
//#endregion
|
|
2467
2298
|
//#region src/view/components/ApiPage/components/GeneralSection.tsx
|
|
2468
|
-
const { useBreakpoint: useBreakpoint$
|
|
2299
|
+
const { useBreakpoint: useBreakpoint$3 } = Grid;
|
|
2469
2300
|
const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
|
|
2470
|
-
const isMobile = !useBreakpoint$
|
|
2471
|
-
const { wrapSSR, cx, token
|
|
2301
|
+
const isMobile = !useBreakpoint$3().md;
|
|
2302
|
+
const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
|
|
2472
2303
|
[scope("root")]: {
|
|
2473
2304
|
display: "flex",
|
|
2474
2305
|
flexDirection: "column",
|
|
2475
|
-
borderRadius: token
|
|
2306
|
+
borderRadius: token.borderRadius,
|
|
2476
2307
|
overflow: "hidden",
|
|
2477
2308
|
width: "100%"
|
|
2478
2309
|
},
|
|
@@ -2480,22 +2311,22 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
|
|
|
2480
2311
|
display: "flex",
|
|
2481
2312
|
alignItems: "center",
|
|
2482
2313
|
justifyContent: "space-between",
|
|
2483
|
-
padding: `${token
|
|
2484
|
-
background: token
|
|
2485
|
-
borderRadius: `${token
|
|
2314
|
+
padding: `${token.paddingXS}px ${token.paddingLG}px`,
|
|
2315
|
+
background: token.colorPrimaryBg,
|
|
2316
|
+
borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
|
|
2486
2317
|
},
|
|
2487
2318
|
[scope("body")]: {
|
|
2488
2319
|
display: "flex",
|
|
2489
2320
|
flexDirection: "column",
|
|
2490
|
-
gap: token
|
|
2491
|
-
padding: token
|
|
2492
|
-
paddingBottom: token
|
|
2493
|
-
background: token
|
|
2494
|
-
borderRadius: `0 0 ${token
|
|
2321
|
+
gap: token.paddingLG,
|
|
2322
|
+
padding: token.paddingLG,
|
|
2323
|
+
paddingBottom: token.paddingXXL ?? 48,
|
|
2324
|
+
background: token.colorBgElevated,
|
|
2325
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
|
|
2495
2326
|
},
|
|
2496
2327
|
[scope("row")]: {
|
|
2497
2328
|
display: "flex",
|
|
2498
|
-
gap: token
|
|
2329
|
+
gap: token.paddingLG,
|
|
2499
2330
|
width: "100%"
|
|
2500
2331
|
},
|
|
2501
2332
|
[scope("field")]: {
|
|
@@ -2507,22 +2338,22 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
|
|
|
2507
2338
|
[scope("label")]: {
|
|
2508
2339
|
display: "flex",
|
|
2509
2340
|
alignItems: "center",
|
|
2510
|
-
gap: token
|
|
2511
|
-
fontSize: token
|
|
2341
|
+
gap: token.marginXXS,
|
|
2342
|
+
fontSize: token.fontSize,
|
|
2512
2343
|
fontWeight: 400,
|
|
2513
|
-
color: token
|
|
2514
|
-
paddingBottom: token
|
|
2344
|
+
color: token.colorText,
|
|
2345
|
+
paddingBottom: token.paddingXS,
|
|
2515
2346
|
lineHeight: "22px"
|
|
2516
2347
|
},
|
|
2517
2348
|
[scope("label-required")]: {
|
|
2518
|
-
color: token
|
|
2519
|
-
fontSize: token
|
|
2349
|
+
color: token.colorError,
|
|
2350
|
+
fontSize: token.fontSize
|
|
2520
2351
|
},
|
|
2521
2352
|
[scope("count")]: {
|
|
2522
2353
|
alignSelf: "flex-end",
|
|
2523
|
-
fontSize: token
|
|
2524
|
-
color: token
|
|
2525
|
-
marginTop: token
|
|
2354
|
+
fontSize: token.fontSize,
|
|
2355
|
+
color: token.colorTextDescription,
|
|
2356
|
+
marginTop: token.marginXXS
|
|
2526
2357
|
}
|
|
2527
2358
|
}));
|
|
2528
2359
|
return wrapSSR(/* @__PURE__ */ jsxs("div", {
|
|
@@ -2533,7 +2364,7 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
|
|
|
2533
2364
|
level: 4,
|
|
2534
2365
|
style: {
|
|
2535
2366
|
margin: 0,
|
|
2536
|
-
color: token
|
|
2367
|
+
color: token.colorTextHeading
|
|
2537
2368
|
},
|
|
2538
2369
|
children: "General"
|
|
2539
2370
|
}), /* @__PURE__ */ jsx(Button, {
|
|
@@ -2549,8 +2380,8 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
|
|
|
2549
2380
|
}), !collapsed && /* @__PURE__ */ jsxs("div", {
|
|
2550
2381
|
className: cx("body"),
|
|
2551
2382
|
style: isMobile ? {
|
|
2552
|
-
padding: token
|
|
2553
|
-
paddingBottom: token
|
|
2383
|
+
padding: token.paddingMD,
|
|
2384
|
+
paddingBottom: token.paddingXXL ?? 48
|
|
2554
2385
|
} : void 0,
|
|
2555
2386
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2556
2387
|
className: cx("row"),
|
|
@@ -2631,7 +2462,6 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
|
|
|
2631
2462
|
})]
|
|
2632
2463
|
}));
|
|
2633
2464
|
};
|
|
2634
|
-
|
|
2635
2465
|
//#endregion
|
|
2636
2466
|
//#region src/assets/trash.tsx
|
|
2637
2467
|
const Trash = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
@@ -2691,8 +2521,6 @@ const Trash = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
2691
2521
|
})
|
|
2692
2522
|
]
|
|
2693
2523
|
});
|
|
2694
|
-
var trash_default = Trash;
|
|
2695
|
-
|
|
2696
2524
|
//#endregion
|
|
2697
2525
|
//#region src/assets/info-circle.tsx
|
|
2698
2526
|
const InfoCircle = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
@@ -2729,8 +2557,6 @@ const InfoCircle = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
2729
2557
|
})
|
|
2730
2558
|
]
|
|
2731
2559
|
});
|
|
2732
|
-
var info_circle_default = InfoCircle;
|
|
2733
|
-
|
|
2734
2560
|
//#endregion
|
|
2735
2561
|
//#region src/hooks/useDebounce.ts
|
|
2736
2562
|
function useDebounce(value, delay = 500) {
|
|
@@ -2745,7 +2571,6 @@ function useDebounce(value, delay = 500) {
|
|
|
2745
2571
|
}, [value, delay]);
|
|
2746
2572
|
return debouncedValue;
|
|
2747
2573
|
}
|
|
2748
|
-
|
|
2749
2574
|
//#endregion
|
|
2750
2575
|
//#region src/view/components/ApiPage/components/AddParameterDrawer.tsx
|
|
2751
2576
|
const PARAM_IN_OPTIONS = [
|
|
@@ -2819,11 +2644,11 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2819
2644
|
setHasChanges(false);
|
|
2820
2645
|
}
|
|
2821
2646
|
}, [open]);
|
|
2822
|
-
const { wrapSSR, cx, token
|
|
2647
|
+
const { wrapSSR, cx, token } = useStyle("AddParameterDrawer", (token, scope) => ({
|
|
2823
2648
|
[scope("title")]: {
|
|
2824
2649
|
fontSize: 16,
|
|
2825
2650
|
fontWeight: 600,
|
|
2826
|
-
color: token
|
|
2651
|
+
color: token.colorTextBase,
|
|
2827
2652
|
lineHeight: "24px",
|
|
2828
2653
|
fontFamily: "Cairo SemiBold, Cairo, sans-serif"
|
|
2829
2654
|
},
|
|
@@ -2834,21 +2659,21 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2834
2659
|
"& .ant-form-item": { marginBottom: 0 }
|
|
2835
2660
|
},
|
|
2836
2661
|
[scope("label")]: {
|
|
2837
|
-
fontSize: token
|
|
2838
|
-
color: token
|
|
2662
|
+
fontSize: token.fontSize,
|
|
2663
|
+
color: token.colorText
|
|
2839
2664
|
},
|
|
2840
2665
|
[scope("asterisk")]: {
|
|
2841
|
-
color: token
|
|
2666
|
+
color: token.colorError,
|
|
2842
2667
|
marginLeft: 2
|
|
2843
2668
|
},
|
|
2844
2669
|
[scope("label-optional")]: {
|
|
2845
|
-
color: token
|
|
2670
|
+
color: token.colorTextTertiary,
|
|
2846
2671
|
marginLeft: 4,
|
|
2847
|
-
fontSize: token
|
|
2672
|
+
fontSize: token.fontSize
|
|
2848
2673
|
},
|
|
2849
2674
|
[scope("label-secondary")]: {
|
|
2850
|
-
fontSize: token
|
|
2851
|
-
color: token
|
|
2675
|
+
fontSize: token.fontSize,
|
|
2676
|
+
color: token.colorTextSecondary
|
|
2852
2677
|
},
|
|
2853
2678
|
[scope("switch-row")]: {
|
|
2854
2679
|
display: "flex",
|
|
@@ -2856,8 +2681,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2856
2681
|
gap: 8
|
|
2857
2682
|
},
|
|
2858
2683
|
[scope("switch-label")]: {
|
|
2859
|
-
fontSize: token
|
|
2860
|
-
color: token
|
|
2684
|
+
fontSize: token.fontSize,
|
|
2685
|
+
color: token.colorText
|
|
2861
2686
|
},
|
|
2862
2687
|
[scope("enum-input-row")]: {
|
|
2863
2688
|
display: "flex",
|
|
@@ -2872,27 +2697,27 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2872
2697
|
width: 32,
|
|
2873
2698
|
height: 32,
|
|
2874
2699
|
flexShrink: 0,
|
|
2875
|
-
borderColor: token
|
|
2876
|
-
color: token
|
|
2700
|
+
borderColor: token.colorPrimary,
|
|
2701
|
+
color: token.colorPrimary,
|
|
2877
2702
|
padding: 0,
|
|
2878
2703
|
display: "flex",
|
|
2879
2704
|
alignItems: "center",
|
|
2880
2705
|
justifyContent: "center",
|
|
2881
2706
|
"&:hover": {
|
|
2882
|
-
borderColor: `${token
|
|
2883
|
-
color: `${token
|
|
2707
|
+
borderColor: `${token.colorPrimary} !important`,
|
|
2708
|
+
color: `${token.colorPrimary} !important`
|
|
2884
2709
|
}
|
|
2885
2710
|
},
|
|
2886
2711
|
[scope("enum-list")]: {
|
|
2887
2712
|
display: "flex",
|
|
2888
2713
|
flexDirection: "column",
|
|
2889
|
-
gap: token
|
|
2890
|
-
marginTop: token
|
|
2714
|
+
gap: token.marginXS,
|
|
2715
|
+
marginTop: token.marginXS
|
|
2891
2716
|
},
|
|
2892
2717
|
[scope("enum-value-row")]: {
|
|
2893
2718
|
display: "flex",
|
|
2894
2719
|
alignItems: "center",
|
|
2895
|
-
gap: token
|
|
2720
|
+
gap: token.marginXS
|
|
2896
2721
|
},
|
|
2897
2722
|
[scope("enum-value-input-wrap")]: {
|
|
2898
2723
|
flex: 1,
|
|
@@ -2901,10 +2726,10 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2901
2726
|
[scope("enum-value-input")]: {
|
|
2902
2727
|
height: 32,
|
|
2903
2728
|
fontSize: 14,
|
|
2904
|
-
color: token
|
|
2905
|
-
background: token
|
|
2906
|
-
border: `1px solid ${token
|
|
2907
|
-
borderRadius: token
|
|
2729
|
+
color: token.colorText,
|
|
2730
|
+
background: token.colorBgBase,
|
|
2731
|
+
border: `1px solid ${token.colorBorder}`,
|
|
2732
|
+
borderRadius: token.borderRadius,
|
|
2908
2733
|
cursor: "default",
|
|
2909
2734
|
width: "100%"
|
|
2910
2735
|
},
|
|
@@ -2916,7 +2741,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2916
2741
|
display: "flex",
|
|
2917
2742
|
alignItems: "center",
|
|
2918
2743
|
justifyContent: "center",
|
|
2919
|
-
borderRadius: token
|
|
2744
|
+
borderRadius: token.borderRadius
|
|
2920
2745
|
},
|
|
2921
2746
|
[scope("footer")]: {
|
|
2922
2747
|
display: "flex",
|
|
@@ -2953,7 +2778,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2953
2778
|
fontSize: 16,
|
|
2954
2779
|
fontWeight: 400,
|
|
2955
2780
|
lineHeight: "24px",
|
|
2956
|
-
color: token
|
|
2781
|
+
color: token.colorText
|
|
2957
2782
|
},
|
|
2958
2783
|
[scope("modalCloseBtn")]: {
|
|
2959
2784
|
position: "absolute",
|
|
@@ -2969,12 +2794,12 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2969
2794
|
border: "none",
|
|
2970
2795
|
background: "transparent",
|
|
2971
2796
|
padding: 0,
|
|
2972
|
-
color: token
|
|
2797
|
+
color: token.colorTextTertiary,
|
|
2973
2798
|
fontSize: 16,
|
|
2974
2799
|
lineHeight: 1,
|
|
2975
2800
|
"&:hover": {
|
|
2976
|
-
color: token
|
|
2977
|
-
backgroundColor: token
|
|
2801
|
+
color: token.colorText,
|
|
2802
|
+
backgroundColor: token.colorFillSecondary
|
|
2978
2803
|
}
|
|
2979
2804
|
},
|
|
2980
2805
|
[scope("modalContent")]: {
|
|
@@ -2991,7 +2816,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2991
2816
|
fontSize: 14,
|
|
2992
2817
|
fontWeight: 400,
|
|
2993
2818
|
lineHeight: "22px",
|
|
2994
|
-
color: token
|
|
2819
|
+
color: token.colorText
|
|
2995
2820
|
},
|
|
2996
2821
|
[scope("modalFooter")]: {
|
|
2997
2822
|
display: "flex",
|
|
@@ -3076,14 +2901,14 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3076
2901
|
styles: {
|
|
3077
2902
|
header: {
|
|
3078
2903
|
padding: "16px 24px",
|
|
3079
|
-
borderBottom: `1px solid ${token
|
|
3080
|
-
background: token
|
|
2904
|
+
borderBottom: `1px solid ${token.colorFillSecondary}`,
|
|
2905
|
+
background: token.colorBgBase
|
|
3081
2906
|
},
|
|
3082
2907
|
body: { padding: "24px" },
|
|
3083
2908
|
footer: {
|
|
3084
2909
|
padding: "24px",
|
|
3085
|
-
background: token
|
|
3086
|
-
borderTop: `1px solid ${token
|
|
2910
|
+
background: token.colorPrimaryBg,
|
|
2911
|
+
borderTop: `1px solid ${token.colorFillSecondary}`
|
|
3087
2912
|
}
|
|
3088
2913
|
},
|
|
3089
2914
|
footer: /* @__PURE__ */ jsxs("div", {
|
|
@@ -3187,7 +3012,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3187
3012
|
children: [/* @__PURE__ */ jsx(Switch, {
|
|
3188
3013
|
checked: requiredValue ?? true,
|
|
3189
3014
|
onChange: (checked) => form.setFieldValue("required", checked),
|
|
3190
|
-
style: { backgroundColor: requiredValue ?? true ? token
|
|
3015
|
+
style: { backgroundColor: requiredValue ?? true ? token.colorPrimary : void 0 }
|
|
3191
3016
|
}), /* @__PURE__ */ jsx("span", {
|
|
3192
3017
|
className: cx("switch-label"),
|
|
3193
3018
|
children: "Required?"
|
|
@@ -3255,7 +3080,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3255
3080
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3256
3081
|
danger: true,
|
|
3257
3082
|
type: "text",
|
|
3258
|
-
icon: /* @__PURE__ */ jsx(
|
|
3083
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
3259
3084
|
width: 32,
|
|
3260
3085
|
height: 32
|
|
3261
3086
|
}),
|
|
@@ -3328,9 +3153,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3328
3153
|
borderRadius: 8,
|
|
3329
3154
|
height: 32,
|
|
3330
3155
|
paddingInline: 16,
|
|
3331
|
-
backgroundColor: token
|
|
3332
|
-
borderColor: token
|
|
3333
|
-
boxShadow: `0px 2px 0px ${token
|
|
3156
|
+
backgroundColor: token.colorPrimary,
|
|
3157
|
+
borderColor: token.colorPrimary,
|
|
3158
|
+
boxShadow: `0px 2px 0px ${token.colorPrimaryBg}`
|
|
3334
3159
|
},
|
|
3335
3160
|
children: mode === "edit" ? "Yes, Edit" : "Yes, Add"
|
|
3336
3161
|
})]
|
|
@@ -3339,20 +3164,19 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3339
3164
|
})
|
|
3340
3165
|
] }));
|
|
3341
3166
|
};
|
|
3342
|
-
|
|
3343
3167
|
//#endregion
|
|
3344
3168
|
//#region src/view/components/ApiPage/components/EndpointsSection.tsx
|
|
3345
|
-
const { useBreakpoint: useBreakpoint$
|
|
3169
|
+
const { useBreakpoint: useBreakpoint$2 } = Grid;
|
|
3346
3170
|
const PAGE_SIZE = 5;
|
|
3347
|
-
const getStatusCodeColor = (code, token
|
|
3171
|
+
const getStatusCodeColor = (code, token) => {
|
|
3348
3172
|
const n = parseInt(code, 10);
|
|
3349
3173
|
if (n >= 400 && n < 500) return {
|
|
3350
|
-
dot: token
|
|
3351
|
-
text: token
|
|
3174
|
+
dot: token.colorError,
|
|
3175
|
+
text: token.colorError
|
|
3352
3176
|
};
|
|
3353
3177
|
return {
|
|
3354
|
-
dot: token
|
|
3355
|
-
text: token
|
|
3178
|
+
dot: token.colorSuccess,
|
|
3179
|
+
text: token.colorText
|
|
3356
3180
|
};
|
|
3357
3181
|
};
|
|
3358
3182
|
const buildViewParamRows = (params) => params.map((p, idx) => ({
|
|
@@ -3390,7 +3214,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3390
3214
|
const debouncedResponseSearches = useDebounce(responseSearches);
|
|
3391
3215
|
const { selectNodeByKey } = useNodeSelection();
|
|
3392
3216
|
const { token: antdToken } = theme.useToken();
|
|
3393
|
-
const isMobile = !useBreakpoint$
|
|
3217
|
+
const isMobile = !useBreakpoint$2().md;
|
|
3394
3218
|
const toggleRequestPanel = (epId) => {
|
|
3395
3219
|
setOpenRequestPanels((prev) => {
|
|
3396
3220
|
const next = new Set(prev);
|
|
@@ -3407,11 +3231,11 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3407
3231
|
return next;
|
|
3408
3232
|
});
|
|
3409
3233
|
};
|
|
3410
|
-
const { wrapSSR, cx, token
|
|
3234
|
+
const { wrapSSR, cx, token } = useStyle("EndpointsSection", (token, scope) => ({
|
|
3411
3235
|
[scope("root")]: {
|
|
3412
3236
|
display: "flex",
|
|
3413
3237
|
flexDirection: "column",
|
|
3414
|
-
borderRadius: token
|
|
3238
|
+
borderRadius: token.borderRadius,
|
|
3415
3239
|
overflow: "hidden",
|
|
3416
3240
|
width: "100%",
|
|
3417
3241
|
flexShrink: 0
|
|
@@ -3420,28 +3244,28 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3420
3244
|
display: "flex",
|
|
3421
3245
|
alignItems: "center",
|
|
3422
3246
|
justifyContent: "space-between",
|
|
3423
|
-
padding: `${token
|
|
3424
|
-
background: token
|
|
3425
|
-
borderRadius: `${token
|
|
3247
|
+
padding: `${token.paddingXS}px ${token.paddingLG}px`,
|
|
3248
|
+
background: token.colorPrimaryBg,
|
|
3249
|
+
borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
|
|
3426
3250
|
},
|
|
3427
3251
|
[scope("body")]: {
|
|
3428
3252
|
display: "flex",
|
|
3429
3253
|
flexDirection: "column",
|
|
3430
|
-
gap: token
|
|
3431
|
-
padding: token
|
|
3432
|
-
background: token
|
|
3433
|
-
borderRadius: `0 0 ${token
|
|
3254
|
+
gap: token.margin,
|
|
3255
|
+
padding: token.paddingLG,
|
|
3256
|
+
background: token.colorBgElevated,
|
|
3257
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
|
|
3434
3258
|
},
|
|
3435
3259
|
[scope("tag-title")]: {
|
|
3436
|
-
fontSize: token
|
|
3260
|
+
fontSize: token.fontSize,
|
|
3437
3261
|
fontWeight: 600,
|
|
3438
|
-
color: token
|
|
3439
|
-
marginBottom: token
|
|
3262
|
+
color: token.colorTextSecondary,
|
|
3263
|
+
marginBottom: token.marginXS
|
|
3440
3264
|
},
|
|
3441
3265
|
[scope("endpoint-row")]: {
|
|
3442
3266
|
display: "flex",
|
|
3443
3267
|
alignItems: "center",
|
|
3444
|
-
gap: token
|
|
3268
|
+
gap: token.marginSM,
|
|
3445
3269
|
width: "100%"
|
|
3446
3270
|
},
|
|
3447
3271
|
[scope("endpoint-card")]: {
|
|
@@ -3449,34 +3273,34 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3449
3273
|
flex: "1 0 0",
|
|
3450
3274
|
alignItems: "center",
|
|
3451
3275
|
gap: 14,
|
|
3452
|
-
padding: `${token
|
|
3453
|
-
background: token
|
|
3454
|
-
borderRadius: token
|
|
3276
|
+
padding: `${token.paddingXS}px ${token.padding}px`,
|
|
3277
|
+
background: token.colorFillSecondary,
|
|
3278
|
+
borderRadius: token.borderRadius,
|
|
3455
3279
|
cursor: "pointer",
|
|
3456
3280
|
overflow: "hidden"
|
|
3457
3281
|
},
|
|
3458
3282
|
[scope("endpoint-card-active")]: {
|
|
3459
3283
|
background: "transparent",
|
|
3460
|
-
border: `1px solid ${token
|
|
3284
|
+
border: `1px solid ${token.colorPrimaryBorder}`
|
|
3461
3285
|
},
|
|
3462
3286
|
[scope("method-badge")]: {
|
|
3463
3287
|
display: "flex",
|
|
3464
3288
|
alignItems: "center",
|
|
3465
3289
|
justifyContent: "center",
|
|
3466
3290
|
width: 64,
|
|
3467
|
-
padding: `0 ${token
|
|
3468
|
-
borderRadius: token
|
|
3291
|
+
padding: `0 ${token.paddingXS}px`,
|
|
3292
|
+
borderRadius: token.borderRadius,
|
|
3469
3293
|
border: "1px solid",
|
|
3470
|
-
fontSize: token
|
|
3294
|
+
fontSize: token.fontSize,
|
|
3471
3295
|
fontWeight: 400,
|
|
3472
3296
|
lineHeight: "22px",
|
|
3473
3297
|
whiteSpace: "nowrap",
|
|
3474
3298
|
alignSelf: "stretch"
|
|
3475
3299
|
},
|
|
3476
3300
|
[scope("endpoint-path")]: {
|
|
3477
|
-
fontSize: token
|
|
3301
|
+
fontSize: token.fontSizeLG,
|
|
3478
3302
|
fontWeight: 600,
|
|
3479
|
-
color: token
|
|
3303
|
+
color: token.colorTextHeading,
|
|
3480
3304
|
lineHeight: "24px",
|
|
3481
3305
|
overflow: "hidden",
|
|
3482
3306
|
textOverflow: "ellipsis",
|
|
@@ -3485,12 +3309,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3485
3309
|
[scope("endpoint-form")]: {
|
|
3486
3310
|
display: "flex",
|
|
3487
3311
|
flexDirection: "column",
|
|
3488
|
-
gap: token
|
|
3489
|
-
padding: token
|
|
3490
|
-
borderLeft: `3px solid ${token
|
|
3491
|
-
borderRight: `3px solid ${token
|
|
3492
|
-
borderBottom: `3px solid ${token
|
|
3493
|
-
borderRadius: `0 0 ${token
|
|
3312
|
+
gap: token.paddingLG,
|
|
3313
|
+
padding: token.paddingLG,
|
|
3314
|
+
borderLeft: `3px solid ${token.colorPrimaryBorder}`,
|
|
3315
|
+
borderRight: `3px solid ${token.colorPrimaryBorder}`,
|
|
3316
|
+
borderBottom: `3px solid ${token.colorPrimaryBorder}`,
|
|
3317
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
|
|
3494
3318
|
},
|
|
3495
3319
|
[scope("form-row")]: {
|
|
3496
3320
|
display: "flex",
|
|
@@ -3506,41 +3330,41 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3506
3330
|
[scope("field-label")]: {
|
|
3507
3331
|
display: "flex",
|
|
3508
3332
|
alignItems: "center",
|
|
3509
|
-
gap: token
|
|
3510
|
-
fontSize: token
|
|
3333
|
+
gap: token.marginXXS,
|
|
3334
|
+
fontSize: token.fontSize,
|
|
3511
3335
|
fontWeight: 400,
|
|
3512
|
-
color: token
|
|
3513
|
-
paddingBottom: token
|
|
3336
|
+
color: token.colorText,
|
|
3337
|
+
paddingBottom: token.paddingXS,
|
|
3514
3338
|
lineHeight: "22px"
|
|
3515
3339
|
},
|
|
3516
|
-
[scope("label-required")]: { color: token
|
|
3517
|
-
[scope("label-optional")]: { color: token
|
|
3340
|
+
[scope("label-required")]: { color: token.colorError },
|
|
3341
|
+
[scope("label-optional")]: { color: token.colorTextDescription },
|
|
3518
3342
|
[scope("section-header")]: {
|
|
3519
3343
|
display: "flex",
|
|
3520
3344
|
alignItems: "center",
|
|
3521
3345
|
justifyContent: "space-between",
|
|
3522
|
-
paddingBottom: token
|
|
3523
|
-
borderBottom: `1px solid ${token
|
|
3346
|
+
paddingBottom: token.marginXXS,
|
|
3347
|
+
borderBottom: `1px solid ${token.colorBorder}`,
|
|
3524
3348
|
width: "100%"
|
|
3525
3349
|
},
|
|
3526
3350
|
[scope("section-title")]: {
|
|
3527
|
-
fontSize: token
|
|
3351
|
+
fontSize: token.fontSizeLG,
|
|
3528
3352
|
fontWeight: 600,
|
|
3529
|
-
color: token
|
|
3353
|
+
color: token.colorPrimary,
|
|
3530
3354
|
lineHeight: "24px"
|
|
3531
3355
|
},
|
|
3532
3356
|
[scope("param-row")]: {
|
|
3533
3357
|
display: "flex",
|
|
3534
3358
|
alignItems: "center",
|
|
3535
|
-
gap: token
|
|
3536
|
-
padding: `${token
|
|
3537
|
-
border: `1px solid ${token
|
|
3538
|
-
borderRadius: token
|
|
3539
|
-
background: token
|
|
3359
|
+
gap: token.marginXS,
|
|
3360
|
+
padding: `${token.marginXXS}px ${token.marginSM}px`,
|
|
3361
|
+
border: `1px solid ${token.colorBorder}`,
|
|
3362
|
+
borderRadius: token.borderRadius,
|
|
3363
|
+
background: token.colorBgContainer,
|
|
3540
3364
|
width: "100%",
|
|
3541
3365
|
cursor: "pointer",
|
|
3542
3366
|
userSelect: "none",
|
|
3543
|
-
"&:hover": { background: token
|
|
3367
|
+
"&:hover": { background: token.colorFillTertiary }
|
|
3544
3368
|
},
|
|
3545
3369
|
[scope("param-row-icon")]: {
|
|
3546
3370
|
fontSize: 12,
|
|
@@ -3557,7 +3381,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3557
3381
|
fontFamily: "Cairo, sans-serif",
|
|
3558
3382
|
fontSize: 14,
|
|
3559
3383
|
lineHeight: "20px",
|
|
3560
|
-
color: token
|
|
3384
|
+
color: token.colorTextLightSolid,
|
|
3561
3385
|
width: "100%",
|
|
3562
3386
|
whiteSpace: "pre",
|
|
3563
3387
|
overflowX: "auto",
|
|
@@ -3573,7 +3397,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3573
3397
|
},
|
|
3574
3398
|
[scope("code-btn")]: {
|
|
3575
3399
|
borderColor: "#fff",
|
|
3576
|
-
color: token
|
|
3400
|
+
color: token.colorTextLightSolid,
|
|
3577
3401
|
"&:hover": {
|
|
3578
3402
|
borderColor: "#fff !important",
|
|
3579
3403
|
color: "#fff !important",
|
|
@@ -3591,8 +3415,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3591
3415
|
justifyContent: "space-between",
|
|
3592
3416
|
width: "100%",
|
|
3593
3417
|
padding: `12px 24px`,
|
|
3594
|
-
borderBottom: `1px solid ${token
|
|
3595
|
-
background: token
|
|
3418
|
+
borderBottom: `1px solid ${token.colorBorderSecondary}`,
|
|
3419
|
+
background: token.colorBgContainer,
|
|
3596
3420
|
"&:last-child": { borderBottom: "none" }
|
|
3597
3421
|
},
|
|
3598
3422
|
[scope("param-details")]: {
|
|
@@ -3610,12 +3434,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3610
3434
|
[scope("param-detail-label")]: {
|
|
3611
3435
|
fontFamily: "Cairo SemiBold, Cairo, sans-serif",
|
|
3612
3436
|
fontSize: 16,
|
|
3613
|
-
color: token
|
|
3437
|
+
color: token.colorTextSecondary
|
|
3614
3438
|
},
|
|
3615
3439
|
[scope("param-detail-value")]: {
|
|
3616
3440
|
fontFamily: "Cairo, sans-serif",
|
|
3617
3441
|
fontSize: 16,
|
|
3618
|
-
color: token
|
|
3442
|
+
color: token.colorText
|
|
3619
3443
|
},
|
|
3620
3444
|
[scope("param-detail-value--ellipsis")]: {
|
|
3621
3445
|
overflow: "hidden",
|
|
@@ -3634,13 +3458,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3634
3458
|
display: "inline-flex",
|
|
3635
3459
|
alignItems: "center",
|
|
3636
3460
|
verticalAlign: "middle",
|
|
3637
|
-
background: token
|
|
3638
|
-
border: `1px solid ${token
|
|
3461
|
+
background: token.colorBgContainer,
|
|
3462
|
+
border: `1px solid ${token.colorBorder}`,
|
|
3639
3463
|
borderRadius: 6,
|
|
3640
3464
|
padding: "1px 8px",
|
|
3641
3465
|
fontSize: 12,
|
|
3642
3466
|
lineHeight: "20px",
|
|
3643
|
-
color: token
|
|
3467
|
+
color: token.colorText,
|
|
3644
3468
|
fontFamily: "Cairo, sans-serif",
|
|
3645
3469
|
margin: 0
|
|
3646
3470
|
},
|
|
@@ -3652,10 +3476,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3652
3476
|
width: 20,
|
|
3653
3477
|
height: 20,
|
|
3654
3478
|
borderRadius: "50%",
|
|
3655
|
-
border: `1px solid ${token
|
|
3479
|
+
border: `1px solid ${token.colorBorder}`,
|
|
3656
3480
|
background: "white",
|
|
3657
3481
|
fontSize: 12,
|
|
3658
|
-
color: token
|
|
3482
|
+
color: token.colorText,
|
|
3659
3483
|
cursor: "default"
|
|
3660
3484
|
},
|
|
3661
3485
|
[scope("enum-tooltip-list")]: {
|
|
@@ -3663,7 +3487,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3663
3487
|
padding: "0 0 0 16px",
|
|
3664
3488
|
fontSize: 14,
|
|
3665
3489
|
lineHeight: "22px",
|
|
3666
|
-
color: token
|
|
3490
|
+
color: token.colorTextLightSolid,
|
|
3667
3491
|
fontFamily: "Cairo, sans-serif"
|
|
3668
3492
|
},
|
|
3669
3493
|
[scope("status-label")]: {
|
|
@@ -3714,7 +3538,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3714
3538
|
alignItems: "center",
|
|
3715
3539
|
gap: 8
|
|
3716
3540
|
},
|
|
3717
|
-
"& .ant-select-item-option-selected": { background: `${token
|
|
3541
|
+
"& .ant-select-item-option-selected": { background: `${token.colorPrimaryBg} !important` }
|
|
3718
3542
|
},
|
|
3719
3543
|
[scope("param-actions")]: {
|
|
3720
3544
|
display: "flex",
|
|
@@ -3727,11 +3551,11 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3727
3551
|
display: "flex",
|
|
3728
3552
|
alignItems: "center",
|
|
3729
3553
|
justifyContent: "center",
|
|
3730
|
-
borderColor: token
|
|
3731
|
-
color: token
|
|
3554
|
+
borderColor: token.colorPrimary,
|
|
3555
|
+
color: token.colorPrimary,
|
|
3732
3556
|
"&:hover": {
|
|
3733
|
-
borderColor: `${token
|
|
3734
|
-
color: `${token
|
|
3557
|
+
borderColor: `${token.colorPrimary} !important`,
|
|
3558
|
+
color: `${token.colorPrimary} !important`
|
|
3735
3559
|
}
|
|
3736
3560
|
},
|
|
3737
3561
|
[scope("param-delete-btn")]: {
|
|
@@ -3761,7 +3585,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3761
3585
|
fontSize: 16,
|
|
3762
3586
|
fontWeight: 400,
|
|
3763
3587
|
lineHeight: "24px",
|
|
3764
|
-
color: token
|
|
3588
|
+
color: token.colorText
|
|
3765
3589
|
},
|
|
3766
3590
|
[scope("deleteModalCloseBtn")]: {
|
|
3767
3591
|
position: "absolute",
|
|
@@ -3777,12 +3601,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3777
3601
|
border: "none",
|
|
3778
3602
|
background: "transparent",
|
|
3779
3603
|
padding: 0,
|
|
3780
|
-
color: token
|
|
3604
|
+
color: token.colorTextSecondary,
|
|
3781
3605
|
fontSize: 16,
|
|
3782
3606
|
lineHeight: 1,
|
|
3783
3607
|
"&:hover": {
|
|
3784
|
-
color: token
|
|
3785
|
-
backgroundColor: token
|
|
3608
|
+
color: token.colorText,
|
|
3609
|
+
backgroundColor: token.colorFillSecondary
|
|
3786
3610
|
}
|
|
3787
3611
|
},
|
|
3788
3612
|
[scope("deleteModalContent")]: {
|
|
@@ -3799,7 +3623,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3799
3623
|
fontSize: 14,
|
|
3800
3624
|
fontWeight: 400,
|
|
3801
3625
|
lineHeight: "22px",
|
|
3802
|
-
color: token
|
|
3626
|
+
color: token.colorText
|
|
3803
3627
|
},
|
|
3804
3628
|
[scope("deleteModalFooter")]: {
|
|
3805
3629
|
display: "flex",
|
|
@@ -3817,33 +3641,33 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3817
3641
|
flexDirection: "column",
|
|
3818
3642
|
gap: 16,
|
|
3819
3643
|
width: "100%",
|
|
3820
|
-
borderLeft: `3px solid ${token
|
|
3821
|
-
borderRight: `3px solid ${token
|
|
3822
|
-
borderBottom: `3px solid ${token
|
|
3823
|
-
borderRadius: `0 0 ${token
|
|
3824
|
-
padding: token
|
|
3644
|
+
borderLeft: `3px solid ${token.colorPrimaryBorder}`,
|
|
3645
|
+
borderRight: `3px solid ${token.colorPrimaryBorder}`,
|
|
3646
|
+
borderBottom: `3px solid ${token.colorPrimaryBorder}`,
|
|
3647
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
|
|
3648
|
+
padding: token.paddingLG
|
|
3825
3649
|
},
|
|
3826
3650
|
[scope("view-params-card")]: {
|
|
3827
|
-
border: `1px solid ${token
|
|
3828
|
-
borderRadius: token
|
|
3651
|
+
border: `1px solid ${token.colorBorder}`,
|
|
3652
|
+
borderRadius: token.borderRadius,
|
|
3829
3653
|
display: "flex",
|
|
3830
3654
|
flexDirection: "column",
|
|
3831
|
-
gap: token
|
|
3655
|
+
gap: token.marginSM,
|
|
3832
3656
|
paddingTop: 12,
|
|
3833
3657
|
width: "100%",
|
|
3834
3658
|
overflow: "hidden",
|
|
3835
3659
|
"& .ant-table-thead > tr > th": {
|
|
3836
|
-
background: token
|
|
3660
|
+
background: token.colorFillSecondary,
|
|
3837
3661
|
fontWeight: 700,
|
|
3838
3662
|
fontSize: 14,
|
|
3839
|
-
padding: `${token
|
|
3840
|
-
paddingInline: `${token
|
|
3841
|
-
borderColor: `${token
|
|
3663
|
+
padding: `${token.paddingXS}px`,
|
|
3664
|
+
paddingInline: `${token.paddingXS}px`,
|
|
3665
|
+
borderColor: `${token.colorSplit} !important`
|
|
3842
3666
|
},
|
|
3843
3667
|
"& .ant-table-tbody > tr > td": {
|
|
3844
|
-
padding: `${token
|
|
3845
|
-
paddingInline: `${token
|
|
3846
|
-
borderColor: `${token
|
|
3668
|
+
padding: `${token.paddingXS}px`,
|
|
3669
|
+
paddingInline: `${token.paddingXS}px`,
|
|
3670
|
+
borderColor: `${token.colorBorder} !important`,
|
|
3847
3671
|
height: 38
|
|
3848
3672
|
},
|
|
3849
3673
|
"& .ant-table-container": {
|
|
@@ -3862,30 +3686,30 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3862
3686
|
[scope("view-params-title")]: {
|
|
3863
3687
|
fontSize: 16,
|
|
3864
3688
|
fontWeight: 600,
|
|
3865
|
-
color: token
|
|
3689
|
+
color: token.colorText
|
|
3866
3690
|
},
|
|
3867
3691
|
[scope("view-status-select-sm")]: { width: 65 },
|
|
3868
3692
|
[scope("view-param-name")]: {
|
|
3869
3693
|
fontSize: 14,
|
|
3870
3694
|
fontWeight: 400,
|
|
3871
|
-
color: token
|
|
3695
|
+
color: token.colorText
|
|
3872
3696
|
},
|
|
3873
3697
|
[scope("view-param-type")]: {
|
|
3874
3698
|
fontFamily: "'Cascadia Code', sans-serif",
|
|
3875
3699
|
fontSize: 12,
|
|
3876
|
-
color: token
|
|
3700
|
+
color: token.colorTextSecondary,
|
|
3877
3701
|
marginLeft: 4,
|
|
3878
3702
|
marginRight: 4
|
|
3879
3703
|
},
|
|
3880
|
-
[scope("view-param-required")]: { color: token
|
|
3704
|
+
[scope("view-param-required")]: { color: token.colorError },
|
|
3881
3705
|
[scope("view-param-optional")]: {
|
|
3882
|
-
color: token
|
|
3706
|
+
color: token.colorSuccess,
|
|
3883
3707
|
fontSize: 12,
|
|
3884
3708
|
marginLeft: 4
|
|
3885
3709
|
},
|
|
3886
3710
|
[scope("view-param-desc")]: {
|
|
3887
3711
|
fontSize: 12,
|
|
3888
|
-
color: token
|
|
3712
|
+
color: token.colorText
|
|
3889
3713
|
},
|
|
3890
3714
|
[scope("view-enum-container")]: {
|
|
3891
3715
|
display: "inline-flex",
|
|
@@ -3894,21 +3718,21 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3894
3718
|
alignItems: "center"
|
|
3895
3719
|
},
|
|
3896
3720
|
[scope("view-enum-tag")]: {
|
|
3897
|
-
background: token
|
|
3898
|
-
border: `1px solid ${token
|
|
3721
|
+
background: token.colorFillSecondary,
|
|
3722
|
+
border: `1px solid ${token.colorBorder}`,
|
|
3899
3723
|
borderRadius: 4,
|
|
3900
3724
|
padding: "1px 8px",
|
|
3901
3725
|
fontSize: 12,
|
|
3902
3726
|
lineHeight: "20px",
|
|
3903
|
-
color: token
|
|
3727
|
+
color: token.colorText,
|
|
3904
3728
|
margin: 0,
|
|
3905
3729
|
cursor: "default"
|
|
3906
3730
|
},
|
|
3907
|
-
[scope("view-row-odd")]: { "& > td": { background: `${token
|
|
3908
|
-
[scope("view-row-even")]: { "& > td": { background: `${token
|
|
3731
|
+
[scope("view-row-odd")]: { "& > td": { background: `${token.colorBgLayout} !important` } },
|
|
3732
|
+
[scope("view-row-even")]: { "& > td": { background: `${token.colorBgContainer} !important` } },
|
|
3909
3733
|
[scope("empty-wrapper")]: {
|
|
3910
|
-
background: token
|
|
3911
|
-
borderRadius: token
|
|
3734
|
+
background: token.colorBgElevated,
|
|
3735
|
+
borderRadius: token.borderRadius,
|
|
3912
3736
|
paddingTop: 16,
|
|
3913
3737
|
paddingBottom: 16,
|
|
3914
3738
|
gap: 8,
|
|
@@ -3941,25 +3765,25 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3941
3765
|
[scope("empty-description")]: {
|
|
3942
3766
|
fontSize: 14,
|
|
3943
3767
|
lineHeight: "22px",
|
|
3944
|
-
color: token
|
|
3768
|
+
color: token.colorTextDescription,
|
|
3945
3769
|
textAlign: "center",
|
|
3946
3770
|
fontWeight: 400
|
|
3947
3771
|
},
|
|
3948
3772
|
[scope("pagination")]: {
|
|
3949
3773
|
display: "flex",
|
|
3950
3774
|
justifyContent: "center",
|
|
3951
|
-
marginTop: token
|
|
3775
|
+
marginTop: token.marginMD,
|
|
3952
3776
|
".ant-pagination-item-active": {
|
|
3953
|
-
backgroundColor: token
|
|
3954
|
-
borderColor: token
|
|
3955
|
-
borderRadius: token
|
|
3777
|
+
backgroundColor: token.colorBgContainer,
|
|
3778
|
+
borderColor: token.colorPrimary,
|
|
3779
|
+
borderRadius: token.borderRadius,
|
|
3956
3780
|
display: "flex",
|
|
3957
3781
|
alignItems: "center",
|
|
3958
3782
|
justifyContent: "center",
|
|
3959
3783
|
a: {
|
|
3960
|
-
color: token
|
|
3961
|
-
fontWeight: token
|
|
3962
|
-
fontSize: token
|
|
3784
|
+
color: token.colorPrimary,
|
|
3785
|
+
fontWeight: token.fontWeightStrong,
|
|
3786
|
+
fontSize: token.fontSize,
|
|
3963
3787
|
lineHeight: "22px",
|
|
3964
3788
|
display: "flex",
|
|
3965
3789
|
alignItems: "center",
|
|
@@ -3968,18 +3792,18 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3968
3792
|
}
|
|
3969
3793
|
},
|
|
3970
3794
|
".ant-pagination-item": {
|
|
3971
|
-
borderRadius: token
|
|
3795
|
+
borderRadius: token.borderRadius,
|
|
3972
3796
|
minWidth: 32,
|
|
3973
3797
|
height: 32,
|
|
3974
3798
|
lineHeight: "32px",
|
|
3975
3799
|
a: {
|
|
3976
|
-
color: token
|
|
3800
|
+
color: token.colorText,
|
|
3977
3801
|
fontWeight: 400,
|
|
3978
|
-
fontSize: token
|
|
3802
|
+
fontSize: token.fontSize
|
|
3979
3803
|
}
|
|
3980
3804
|
},
|
|
3981
3805
|
".ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .ant-pagination-item-link": {
|
|
3982
|
-
borderRadius: token
|
|
3806
|
+
borderRadius: token.borderRadius,
|
|
3983
3807
|
width: 32,
|
|
3984
3808
|
height: 32,
|
|
3985
3809
|
display: "flex",
|
|
@@ -4073,7 +3897,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4073
3897
|
level: 4,
|
|
4074
3898
|
style: {
|
|
4075
3899
|
margin: 0,
|
|
4076
|
-
color: token
|
|
3900
|
+
color: token.colorTextHeading
|
|
4077
3901
|
},
|
|
4078
3902
|
children: "Endpoints"
|
|
4079
3903
|
}), /* @__PURE__ */ jsx(Button, {
|
|
@@ -4091,7 +3915,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4091
3915
|
className: cx("body"),
|
|
4092
3916
|
children: Object.values(endpointsByTag).flat().map((ep) => {
|
|
4093
3917
|
const isExpanded = expandedId === ep.id;
|
|
4094
|
-
const methodColor = methodColors[ep.method];
|
|
3918
|
+
const methodColor = methodColors$1[ep.method];
|
|
4095
3919
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4096
3920
|
/* @__PURE__ */ jsxs("div", {
|
|
4097
3921
|
className: cx("endpoint-row"),
|
|
@@ -4121,7 +3945,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4121
3945
|
transform: isExpanded ? "rotate(0deg)" : "rotate(180deg)",
|
|
4122
3946
|
transition: "transform 0.2s",
|
|
4123
3947
|
flexShrink: 0,
|
|
4124
|
-
color: isExpanded ? token
|
|
3948
|
+
color: isExpanded ? token.colorPrimary : token.colorText
|
|
4125
3949
|
}
|
|
4126
3950
|
})]
|
|
4127
3951
|
}),
|
|
@@ -4248,7 +4072,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4248
4072
|
style: {
|
|
4249
4073
|
display: "flex",
|
|
4250
4074
|
alignItems: "center",
|
|
4251
|
-
gap: token
|
|
4075
|
+
gap: token.marginMD
|
|
4252
4076
|
},
|
|
4253
4077
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4254
4078
|
className: cx("section-title"),
|
|
@@ -4374,7 +4198,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4374
4198
|
const pagedReqParams = allReqParams.slice((reqPage - 1) * PAGE_SIZE, reqPage * PAGE_SIZE);
|
|
4375
4199
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4376
4200
|
className: cx("param-list"),
|
|
4377
|
-
style: { marginTop: token
|
|
4201
|
+
style: { marginTop: token.margin },
|
|
4378
4202
|
children: pagedReqParams.map((param, i) => {
|
|
4379
4203
|
const idx = (reqPage - 1) * PAGE_SIZE + i;
|
|
4380
4204
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -4414,16 +4238,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4414
4238
|
style: {
|
|
4415
4239
|
display: "flex",
|
|
4416
4240
|
alignItems: "center",
|
|
4417
|
-
gap: token
|
|
4418
|
-
background: token
|
|
4419
|
-
borderRadius: token
|
|
4420
|
-
padding: `0 ${token
|
|
4241
|
+
gap: token.margin,
|
|
4242
|
+
background: token.colorFillTertiary,
|
|
4243
|
+
borderRadius: token.borderRadius,
|
|
4244
|
+
padding: `0 ${token.marginSM}px`,
|
|
4421
4245
|
height: 50,
|
|
4422
4246
|
flexShrink: 0
|
|
4423
4247
|
},
|
|
4424
4248
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
4425
4249
|
danger: true,
|
|
4426
|
-
icon: /* @__PURE__ */ jsx(
|
|
4250
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
4427
4251
|
width: 32,
|
|
4428
4252
|
height: 32
|
|
4429
4253
|
}),
|
|
@@ -4542,7 +4366,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4542
4366
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
4543
4367
|
danger: true,
|
|
4544
4368
|
type: "text",
|
|
4545
|
-
icon: /* @__PURE__ */ jsx(
|
|
4369
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
4546
4370
|
height: 32,
|
|
4547
4371
|
width: 32
|
|
4548
4372
|
}),
|
|
@@ -4584,12 +4408,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4584
4408
|
})(),
|
|
4585
4409
|
/* @__PURE__ */ jsxs("div", {
|
|
4586
4410
|
className: cx("param-row"),
|
|
4587
|
-
style: { marginTop: token
|
|
4411
|
+
style: { marginTop: token.margin },
|
|
4588
4412
|
onClick: () => toggleRequestPanel(ep.id),
|
|
4589
4413
|
children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openRequestPanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
|
|
4590
|
-
style: { fontSize: token
|
|
4414
|
+
style: { fontSize: token.fontSize },
|
|
4591
4415
|
children: ["Request ", /* @__PURE__ */ jsx("span", {
|
|
4592
|
-
style: { color: token
|
|
4416
|
+
style: { color: token.colorError },
|
|
4593
4417
|
children: "*"
|
|
4594
4418
|
})]
|
|
4595
4419
|
})]
|
|
@@ -4633,7 +4457,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4633
4457
|
style: {
|
|
4634
4458
|
display: "flex",
|
|
4635
4459
|
alignItems: "center",
|
|
4636
|
-
gap: token
|
|
4460
|
+
gap: token.marginMD
|
|
4637
4461
|
},
|
|
4638
4462
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4639
4463
|
className: cx("section-title"),
|
|
@@ -4813,7 +4637,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4813
4637
|
const pagedResParams = allResParams.slice((resPage - 1) * PAGE_SIZE, resPage * PAGE_SIZE);
|
|
4814
4638
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4815
4639
|
className: cx("param-list"),
|
|
4816
|
-
style: { marginTop: token
|
|
4640
|
+
style: { marginTop: token.margin },
|
|
4817
4641
|
children: pagedResParams.map((param, i) => {
|
|
4818
4642
|
const idx = (resPage - 1) * PAGE_SIZE + i;
|
|
4819
4643
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -4853,16 +4677,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4853
4677
|
style: {
|
|
4854
4678
|
display: "flex",
|
|
4855
4679
|
alignItems: "center",
|
|
4856
|
-
gap: token
|
|
4857
|
-
background: token
|
|
4858
|
-
borderRadius: token
|
|
4859
|
-
padding: `0 ${token
|
|
4680
|
+
gap: token.margin,
|
|
4681
|
+
background: token.colorFillTertiary,
|
|
4682
|
+
borderRadius: token.borderRadius,
|
|
4683
|
+
padding: `0 ${token.marginSM}px`,
|
|
4860
4684
|
height: 50,
|
|
4861
4685
|
flexShrink: 0
|
|
4862
4686
|
},
|
|
4863
4687
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
4864
4688
|
danger: true,
|
|
4865
|
-
icon: /* @__PURE__ */ jsx(
|
|
4689
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
4866
4690
|
width: 32,
|
|
4867
4691
|
height: 32
|
|
4868
4692
|
}),
|
|
@@ -4992,7 +4816,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4992
4816
|
}), /* @__PURE__ */ jsx(Button, {
|
|
4993
4817
|
danger: true,
|
|
4994
4818
|
type: "text",
|
|
4995
|
-
icon: /* @__PURE__ */ jsx(
|
|
4819
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
4996
4820
|
height: 18,
|
|
4997
4821
|
width: 18
|
|
4998
4822
|
}),
|
|
@@ -5023,18 +4847,18 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5023
4847
|
})(),
|
|
5024
4848
|
/* @__PURE__ */ jsxs("div", {
|
|
5025
4849
|
className: cx("param-row"),
|
|
5026
|
-
style: { marginTop: token
|
|
4850
|
+
style: { marginTop: token.margin },
|
|
5027
4851
|
onClick: () => toggleResponsePanel(ep.id),
|
|
5028
4852
|
children: [
|
|
5029
4853
|
/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }),
|
|
5030
4854
|
/* @__PURE__ */ jsxs("span", {
|
|
5031
|
-
style: { fontSize: token
|
|
4855
|
+
style: { fontSize: token.fontSize },
|
|
5032
4856
|
children: ["Response ", /* @__PURE__ */ jsx("span", {
|
|
5033
|
-
style: { color: token
|
|
4857
|
+
style: { color: token.colorError },
|
|
5034
4858
|
children: "*"
|
|
5035
4859
|
})]
|
|
5036
4860
|
}),
|
|
5037
|
-
/* @__PURE__ */ jsx(
|
|
4861
|
+
/* @__PURE__ */ jsx(InfoCircle, { style: {
|
|
5038
4862
|
width: 24,
|
|
5039
4863
|
height: 24
|
|
5040
4864
|
} })
|
|
@@ -5216,11 +5040,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5216
5040
|
]
|
|
5217
5041
|
}));
|
|
5218
5042
|
};
|
|
5219
|
-
|
|
5220
5043
|
//#endregion
|
|
5221
5044
|
//#region src/view/components/ApiPage/components/UnsavedChangesBanner.tsx
|
|
5222
5045
|
const UnsavedChangesBanner = ({ onClose }) => {
|
|
5223
|
-
const { wrapSSR, cx } = useStyle("UnsavedChangesBanner", (token
|
|
5046
|
+
const { wrapSSR, cx } = useStyle("UnsavedChangesBanner", (token, scope) => ({
|
|
5224
5047
|
[scope("root")]: {
|
|
5225
5048
|
position: "sticky",
|
|
5226
5049
|
top: 0,
|
|
@@ -5230,7 +5053,7 @@ const UnsavedChangesBanner = ({ onClose }) => {
|
|
|
5230
5053
|
},
|
|
5231
5054
|
[scope("alert")]: {
|
|
5232
5055
|
padding: "8px 12px",
|
|
5233
|
-
fontSize: token
|
|
5056
|
+
fontSize: token.fontSize,
|
|
5234
5057
|
fontWeight: 400,
|
|
5235
5058
|
borderRadius: 0
|
|
5236
5059
|
}
|
|
@@ -5248,17 +5071,16 @@ const UnsavedChangesBanner = ({ onClose }) => {
|
|
|
5248
5071
|
})
|
|
5249
5072
|
}));
|
|
5250
5073
|
};
|
|
5251
|
-
|
|
5252
5074
|
//#endregion
|
|
5253
5075
|
//#region src/view/components/ApiPage/components/TagsSection.tsx
|
|
5254
|
-
const { useBreakpoint } = Grid;
|
|
5076
|
+
const { useBreakpoint: useBreakpoint$1 } = Grid;
|
|
5255
5077
|
const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
|
|
5256
|
-
const isMobile = !useBreakpoint().md;
|
|
5257
|
-
const { wrapSSR, cx, token
|
|
5078
|
+
const isMobile = !useBreakpoint$1().md;
|
|
5079
|
+
const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
|
|
5258
5080
|
[scope("root")]: {
|
|
5259
5081
|
display: "flex",
|
|
5260
5082
|
flexDirection: "column",
|
|
5261
|
-
borderRadius: token
|
|
5083
|
+
borderRadius: token.borderRadius,
|
|
5262
5084
|
overflow: "hidden",
|
|
5263
5085
|
width: "100%",
|
|
5264
5086
|
flexShrink: 0
|
|
@@ -5267,37 +5089,37 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5267
5089
|
display: "flex",
|
|
5268
5090
|
alignItems: "center",
|
|
5269
5091
|
justifyContent: "space-between",
|
|
5270
|
-
padding: `${token
|
|
5271
|
-
background: token
|
|
5272
|
-
borderRadius: `${token
|
|
5092
|
+
padding: `${token.paddingXS}px ${token.paddingLG}px`,
|
|
5093
|
+
background: token.colorPrimaryBg,
|
|
5094
|
+
borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
|
|
5273
5095
|
},
|
|
5274
5096
|
[scope("head-actions")]: {
|
|
5275
5097
|
display: "flex",
|
|
5276
5098
|
alignItems: "center",
|
|
5277
|
-
gap: token
|
|
5099
|
+
gap: token.margin
|
|
5278
5100
|
},
|
|
5279
5101
|
[scope("body")]: {
|
|
5280
5102
|
display: "flex",
|
|
5281
5103
|
flexDirection: "column",
|
|
5282
5104
|
gap: 0,
|
|
5283
|
-
padding: token
|
|
5284
|
-
background: token
|
|
5285
|
-
borderRadius: `0 0 ${token
|
|
5105
|
+
padding: token.paddingLG,
|
|
5106
|
+
background: token.colorBgElevated,
|
|
5107
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
|
|
5286
5108
|
},
|
|
5287
5109
|
[scope("tag-row")]: {
|
|
5288
5110
|
display: "flex",
|
|
5289
5111
|
alignItems: "center",
|
|
5290
5112
|
justifyContent: "space-between",
|
|
5291
5113
|
height: 50,
|
|
5292
|
-
paddingTop: token
|
|
5293
|
-
paddingBottom: token
|
|
5294
|
-
paddingRight: token
|
|
5295
|
-
borderBottom: `1px solid ${token
|
|
5114
|
+
paddingTop: token.controlHeightLG,
|
|
5115
|
+
paddingBottom: token.controlHeightLG,
|
|
5116
|
+
paddingRight: token.paddingLG,
|
|
5117
|
+
borderBottom: `1px solid ${token.colorBorder}`,
|
|
5296
5118
|
width: "100%"
|
|
5297
5119
|
},
|
|
5298
5120
|
[scope("tag-row-last")]: {
|
|
5299
5121
|
borderBottom: "none",
|
|
5300
|
-
paddingBottom: token
|
|
5122
|
+
paddingBottom: token.marginLG
|
|
5301
5123
|
},
|
|
5302
5124
|
[scope("tag-info")]: {
|
|
5303
5125
|
display: "flex",
|
|
@@ -5309,26 +5131,26 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5309
5131
|
[scope("tag-col")]: {
|
|
5310
5132
|
display: "flex",
|
|
5311
5133
|
flexDirection: "column",
|
|
5312
|
-
gap: token
|
|
5134
|
+
gap: token.marginXXS
|
|
5313
5135
|
},
|
|
5314
5136
|
[scope("col-label")]: {
|
|
5315
|
-
fontSize: token
|
|
5137
|
+
fontSize: token.fontSizeLG,
|
|
5316
5138
|
fontWeight: 600,
|
|
5317
|
-
color: token
|
|
5139
|
+
color: token.colorTextTertiary,
|
|
5318
5140
|
lineHeight: "24px",
|
|
5319
5141
|
whiteSpace: "nowrap"
|
|
5320
5142
|
},
|
|
5321
5143
|
[scope("col-value")]: {
|
|
5322
|
-
fontSize: token
|
|
5144
|
+
fontSize: token.fontSizeLG,
|
|
5323
5145
|
fontWeight: 400,
|
|
5324
|
-
color: token
|
|
5146
|
+
color: token.colorText,
|
|
5325
5147
|
lineHeight: "24px",
|
|
5326
5148
|
whiteSpace: "nowrap"
|
|
5327
5149
|
},
|
|
5328
5150
|
[scope("col-value-link")]: {
|
|
5329
|
-
fontSize: token
|
|
5151
|
+
fontSize: token.fontSize,
|
|
5330
5152
|
fontWeight: 400,
|
|
5331
|
-
color: token
|
|
5153
|
+
color: token.colorPrimary,
|
|
5332
5154
|
lineHeight: "22px",
|
|
5333
5155
|
textDecoration: "underline",
|
|
5334
5156
|
whiteSpace: "nowrap"
|
|
@@ -5336,13 +5158,13 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5336
5158
|
[scope("tag-actions")]: {
|
|
5337
5159
|
display: "flex",
|
|
5338
5160
|
alignItems: "center",
|
|
5339
|
-
gap: token
|
|
5161
|
+
gap: token.margin
|
|
5340
5162
|
},
|
|
5341
5163
|
[scope("btn-delete")]: {
|
|
5342
5164
|
width: 40,
|
|
5343
5165
|
height: 40,
|
|
5344
|
-
border: `1px solid ${token
|
|
5345
|
-
borderRadius: token
|
|
5166
|
+
border: `1px solid ${token.colorError}`,
|
|
5167
|
+
borderRadius: token.borderRadius,
|
|
5346
5168
|
display: "flex",
|
|
5347
5169
|
alignItems: "center",
|
|
5348
5170
|
justifyContent: "center"
|
|
@@ -5350,9 +5172,9 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5350
5172
|
[scope("btn-edit")]: {
|
|
5351
5173
|
width: 40,
|
|
5352
5174
|
height: 40,
|
|
5353
|
-
border: `1px solid ${token
|
|
5354
|
-
borderRadius: token
|
|
5355
|
-
background: token
|
|
5175
|
+
border: `1px solid ${token.colorBorder}`,
|
|
5176
|
+
borderRadius: token.borderRadius,
|
|
5177
|
+
background: token.colorBgContainer,
|
|
5356
5178
|
boxShadow: "0px 2px 0px 0px rgba(0,0,0,0.02)",
|
|
5357
5179
|
display: "flex",
|
|
5358
5180
|
alignItems: "center",
|
|
@@ -5364,8 +5186,8 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5364
5186
|
alignItems: "flex-start",
|
|
5365
5187
|
justifyContent: "space-between",
|
|
5366
5188
|
gap: 8,
|
|
5367
|
-
paddingBottom: token
|
|
5368
|
-
borderBottom: `1px solid ${token
|
|
5189
|
+
paddingBottom: token.margin,
|
|
5190
|
+
borderBottom: `1px solid ${token.colorBorder}`,
|
|
5369
5191
|
width: "100%",
|
|
5370
5192
|
minHeight: 50
|
|
5371
5193
|
},
|
|
@@ -5393,9 +5215,9 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5393
5215
|
display: "flex",
|
|
5394
5216
|
flexDirection: "column",
|
|
5395
5217
|
gap: 0,
|
|
5396
|
-
padding: token
|
|
5397
|
-
background: token
|
|
5398
|
-
borderRadius: `0 0 ${token
|
|
5218
|
+
padding: token.paddingMD,
|
|
5219
|
+
background: token.colorBgElevated,
|
|
5220
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
|
|
5399
5221
|
overflowX: "auto"
|
|
5400
5222
|
}
|
|
5401
5223
|
}));
|
|
@@ -5407,7 +5229,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5407
5229
|
level: 4,
|
|
5408
5230
|
style: {
|
|
5409
5231
|
margin: 0,
|
|
5410
|
-
color: token
|
|
5232
|
+
color: token.colorTextHeading
|
|
5411
5233
|
},
|
|
5412
5234
|
children: "Tags"
|
|
5413
5235
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -5417,7 +5239,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5417
5239
|
type: "primary",
|
|
5418
5240
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
5419
5241
|
onClick: onAddTag,
|
|
5420
|
-
style: { borderRadius: token
|
|
5242
|
+
style: { borderRadius: token.borderRadius },
|
|
5421
5243
|
children: "Add Tag"
|
|
5422
5244
|
}), /* @__PURE__ */ jsx(Button, {
|
|
5423
5245
|
type: "text",
|
|
@@ -5442,14 +5264,14 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5442
5264
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5443
5265
|
className: cx("col-label"),
|
|
5444
5266
|
style: {
|
|
5445
|
-
fontSize: token
|
|
5267
|
+
fontSize: token.fontSize,
|
|
5446
5268
|
lineHeight: "20px"
|
|
5447
5269
|
},
|
|
5448
5270
|
children: "Tag Name:"
|
|
5449
5271
|
}), /* @__PURE__ */ jsx("span", {
|
|
5450
5272
|
className: cx("col-value"),
|
|
5451
5273
|
style: {
|
|
5452
|
-
fontSize: token
|
|
5274
|
+
fontSize: token.fontSize,
|
|
5453
5275
|
lineHeight: "20px",
|
|
5454
5276
|
overflow: "hidden",
|
|
5455
5277
|
textOverflow: "ellipsis",
|
|
@@ -5462,7 +5284,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5462
5284
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5463
5285
|
className: cx("col-label"),
|
|
5464
5286
|
style: {
|
|
5465
|
-
fontSize: token
|
|
5287
|
+
fontSize: token.fontSize,
|
|
5466
5288
|
lineHeight: "20px"
|
|
5467
5289
|
},
|
|
5468
5290
|
children: "Description:"
|
|
@@ -5471,7 +5293,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5471
5293
|
children: /* @__PURE__ */ jsx("span", {
|
|
5472
5294
|
className: cx("col-value"),
|
|
5473
5295
|
style: {
|
|
5474
|
-
fontSize: token
|
|
5296
|
+
fontSize: token.fontSize,
|
|
5475
5297
|
lineHeight: "20px",
|
|
5476
5298
|
overflow: "hidden",
|
|
5477
5299
|
textOverflow: "ellipsis",
|
|
@@ -5494,7 +5316,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5494
5316
|
children: /* @__PURE__ */ jsx(Button, {
|
|
5495
5317
|
danger: true,
|
|
5496
5318
|
type: "text",
|
|
5497
|
-
icon: /* @__PURE__ */ jsx(
|
|
5319
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
5498
5320
|
width: 32,
|
|
5499
5321
|
height: 32
|
|
5500
5322
|
}),
|
|
@@ -5601,7 +5423,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5601
5423
|
children: /* @__PURE__ */ jsx(Button, {
|
|
5602
5424
|
danger: true,
|
|
5603
5425
|
type: "text",
|
|
5604
|
-
icon: /* @__PURE__ */ jsx(
|
|
5426
|
+
icon: /* @__PURE__ */ jsx(Trash, {
|
|
5605
5427
|
width: 32,
|
|
5606
5428
|
height: 32
|
|
5607
5429
|
}),
|
|
@@ -5634,7 +5456,6 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
|
|
|
5634
5456
|
}))]
|
|
5635
5457
|
}));
|
|
5636
5458
|
};
|
|
5637
|
-
|
|
5638
5459
|
//#endregion
|
|
5639
5460
|
//#region src/view/components/ApiPage/components/AddTagDrawer.tsx
|
|
5640
5461
|
const TAG_NAME_REGEX = /^[A-Za-z0-9_-]+$/;
|
|
@@ -5648,11 +5469,11 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5648
5469
|
const tagNameValue = Form.useWatch("name", form);
|
|
5649
5470
|
const extDocsDesc = Form.useWatch("externalDocsDescription", form);
|
|
5650
5471
|
const extDocsLink = Form.useWatch("externalDocsLink", form);
|
|
5651
|
-
const { wrapSSR, cx, token
|
|
5472
|
+
const { wrapSSR, cx, token } = useStyle("AddTagDrawer", (token, scope) => ({
|
|
5652
5473
|
[scope("title")]: {
|
|
5653
5474
|
fontSize: 16,
|
|
5654
5475
|
fontWeight: 600,
|
|
5655
|
-
color: token
|
|
5476
|
+
color: token.colorTextBase,
|
|
5656
5477
|
lineHeight: "24px",
|
|
5657
5478
|
fontFamily: "Cairo SemiBold, Cairo, sans-serif"
|
|
5658
5479
|
},
|
|
@@ -5663,25 +5484,25 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5663
5484
|
"& .ant-form-item": { marginBottom: 0 }
|
|
5664
5485
|
},
|
|
5665
5486
|
[scope("label")]: {
|
|
5666
|
-
fontSize: token
|
|
5667
|
-
color: token
|
|
5487
|
+
fontSize: token.fontSize,
|
|
5488
|
+
color: token.colorText
|
|
5668
5489
|
},
|
|
5669
5490
|
[scope("asterisk")]: {
|
|
5670
|
-
color: token
|
|
5491
|
+
color: token.colorError,
|
|
5671
5492
|
marginLeft: 2
|
|
5672
5493
|
},
|
|
5673
5494
|
[scope("label-optional")]: {
|
|
5674
|
-
color: token
|
|
5495
|
+
color: token.colorTextTertiary,
|
|
5675
5496
|
marginLeft: 4,
|
|
5676
|
-
fontSize: token
|
|
5497
|
+
fontSize: token.fontSize
|
|
5677
5498
|
},
|
|
5678
5499
|
[scope("label-secondary")]: {
|
|
5679
|
-
fontSize: token
|
|
5680
|
-
color: token
|
|
5500
|
+
fontSize: token.fontSize,
|
|
5501
|
+
color: token.colorTextSecondary
|
|
5681
5502
|
},
|
|
5682
5503
|
[scope("label-disabled")]: {
|
|
5683
|
-
fontSize: token
|
|
5684
|
-
color: token
|
|
5504
|
+
fontSize: token.fontSize,
|
|
5505
|
+
color: token.colorTextDisabled
|
|
5685
5506
|
},
|
|
5686
5507
|
[scope("footer")]: {
|
|
5687
5508
|
display: "flex",
|
|
@@ -5718,7 +5539,7 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5718
5539
|
fontSize: 16,
|
|
5719
5540
|
fontWeight: 400,
|
|
5720
5541
|
lineHeight: "24px",
|
|
5721
|
-
color: token
|
|
5542
|
+
color: token.colorText
|
|
5722
5543
|
},
|
|
5723
5544
|
[scope("modalCloseBtn")]: {
|
|
5724
5545
|
position: "absolute",
|
|
@@ -5734,12 +5555,12 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5734
5555
|
border: "none",
|
|
5735
5556
|
background: "transparent",
|
|
5736
5557
|
padding: 0,
|
|
5737
|
-
color: token
|
|
5558
|
+
color: token.colorTextTertiary,
|
|
5738
5559
|
fontSize: 16,
|
|
5739
5560
|
lineHeight: 1,
|
|
5740
5561
|
"&:hover": {
|
|
5741
|
-
color: token
|
|
5742
|
-
backgroundColor: token
|
|
5562
|
+
color: token.colorText,
|
|
5563
|
+
backgroundColor: token.colorFillSecondary
|
|
5743
5564
|
}
|
|
5744
5565
|
},
|
|
5745
5566
|
[scope("modalContent")]: {
|
|
@@ -5756,7 +5577,7 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5756
5577
|
fontSize: 14,
|
|
5757
5578
|
fontWeight: 400,
|
|
5758
5579
|
lineHeight: "22px",
|
|
5759
|
-
color: token
|
|
5580
|
+
color: token.colorText
|
|
5760
5581
|
},
|
|
5761
5582
|
[scope("modalFooter")]: {
|
|
5762
5583
|
display: "flex",
|
|
@@ -5833,14 +5654,14 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
5833
5654
|
styles: {
|
|
5834
5655
|
header: {
|
|
5835
5656
|
padding: "16px 24px",
|
|
5836
|
-
borderBottom: `1px solid ${token
|
|
5837
|
-
background: token
|
|
5657
|
+
borderBottom: `1px solid ${token.colorFillSecondary}`,
|
|
5658
|
+
background: token.colorBgBase
|
|
5838
5659
|
},
|
|
5839
5660
|
body: { padding: "24px" },
|
|
5840
5661
|
footer: {
|
|
5841
5662
|
padding: "24px",
|
|
5842
|
-
background: token
|
|
5843
|
-
borderTop: `1px solid ${token
|
|
5663
|
+
background: token.colorPrimaryBg,
|
|
5664
|
+
borderTop: `1px solid ${token.colorFillSecondary}`
|
|
5844
5665
|
}
|
|
5845
5666
|
},
|
|
5846
5667
|
footer: /* @__PURE__ */ jsxs("div", {
|
|
@@ -6041,9 +5862,9 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
6041
5862
|
borderRadius: 8,
|
|
6042
5863
|
height: 32,
|
|
6043
5864
|
paddingInline: 16,
|
|
6044
|
-
backgroundColor: token
|
|
6045
|
-
borderColor: token
|
|
6046
|
-
boxShadow: `0px 2px 0px ${token
|
|
5865
|
+
backgroundColor: token.colorPrimary,
|
|
5866
|
+
borderColor: token.colorPrimary,
|
|
5867
|
+
boxShadow: `0px 2px 0px ${token.colorPrimaryBg}`
|
|
6047
5868
|
},
|
|
6048
5869
|
children: confirmBtnLabel
|
|
6049
5870
|
})]
|
|
@@ -6052,92 +5873,924 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
6052
5873
|
})
|
|
6053
5874
|
] }));
|
|
6054
5875
|
};
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
5876
|
+
token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
|
|
5877
|
+
const darkerMethodColors = {
|
|
5878
|
+
GET: {
|
|
5879
|
+
bg: token.colorPrimary,
|
|
5880
|
+
color: "#FFFFFF"
|
|
5881
|
+
},
|
|
5882
|
+
POST: {
|
|
5883
|
+
bg: token.colorSuccess,
|
|
5884
|
+
color: "#FFFFFF"
|
|
5885
|
+
},
|
|
5886
|
+
DELETE: {
|
|
5887
|
+
bg: token.colorError,
|
|
5888
|
+
color: "#FFFFFF"
|
|
5889
|
+
},
|
|
5890
|
+
PUT: {
|
|
5891
|
+
bg: token.colorWarning,
|
|
5892
|
+
color: "#FFFFFF"
|
|
5893
|
+
},
|
|
5894
|
+
PATCH: {
|
|
5895
|
+
bg: token["volcano.5"],
|
|
5896
|
+
color: "#FFFFFF"
|
|
5897
|
+
},
|
|
5898
|
+
OPTIONS: {
|
|
5899
|
+
bg: token["geekblue.6"],
|
|
5900
|
+
color: "#FFFFFF"
|
|
5901
|
+
},
|
|
5902
|
+
HEAD: {
|
|
5903
|
+
bg: token["purple.5"],
|
|
5904
|
+
color: "#FFFFFF"
|
|
5905
|
+
},
|
|
5906
|
+
TRACE: {
|
|
5907
|
+
bg: token["cyan.5"],
|
|
5908
|
+
color: "#FFFFFF"
|
|
5909
|
+
}
|
|
5910
|
+
};
|
|
5911
|
+
const sidebarMethodColors = {
|
|
5912
|
+
GET: {
|
|
5913
|
+
bg: token.colorPrimaryBgHover,
|
|
5914
|
+
color: token.colorPrimary
|
|
5915
|
+
},
|
|
5916
|
+
POST: {
|
|
5917
|
+
bg: token.colorSuccessBg,
|
|
5918
|
+
color: token.colorSuccess
|
|
5919
|
+
},
|
|
5920
|
+
DELETE: {
|
|
5921
|
+
bg: token.colorErrorBg,
|
|
5922
|
+
color: token.colorError
|
|
5923
|
+
},
|
|
5924
|
+
PUT: {
|
|
5925
|
+
bg: token.colorWarningBg,
|
|
5926
|
+
color: token.colorWarning
|
|
5927
|
+
},
|
|
5928
|
+
PATCH: {
|
|
5929
|
+
bg: token["volcano.1"],
|
|
5930
|
+
color: token["volcano.5"]
|
|
5931
|
+
},
|
|
5932
|
+
OPTIONS: {
|
|
5933
|
+
bg: token["geekblue.2"],
|
|
5934
|
+
color: token["geekblue.6"]
|
|
5935
|
+
},
|
|
5936
|
+
HEAD: {
|
|
5937
|
+
bg: token["purple.1"],
|
|
5938
|
+
color: token["purple.5"]
|
|
5939
|
+
},
|
|
5940
|
+
TRACE: {
|
|
5941
|
+
bg: token["volcano.1"],
|
|
5942
|
+
color: token["volcano.4"]
|
|
5943
|
+
}
|
|
5944
|
+
};
|
|
5945
|
+
const buildTreeDataStructure = (data) => {
|
|
5946
|
+
if (!data) return [];
|
|
5947
|
+
return data.map((api) => {
|
|
5948
|
+
const tagEntries = Object.entries(api.tags);
|
|
5949
|
+
const defaultTag = tagEntries.find(([tag]) => tag.toLowerCase() === "default");
|
|
5950
|
+
const nonDefaultTags = tagEntries.filter(([tag]) => tag.toLowerCase() !== "default");
|
|
5951
|
+
const defaultEndpoints = defaultTag ? defaultTag[1].map((endpoint) => ({
|
|
5952
|
+
title: endpoint.summary,
|
|
5953
|
+
key: endpoint.id,
|
|
5954
|
+
isLeaf: true,
|
|
5955
|
+
selectable: true,
|
|
5956
|
+
method: endpoint.method,
|
|
5957
|
+
data: {
|
|
5958
|
+
endpoint,
|
|
5959
|
+
api,
|
|
5960
|
+
tagName: "default",
|
|
5961
|
+
parentApiId: api.id
|
|
5962
|
+
}
|
|
5963
|
+
})) : [];
|
|
5964
|
+
const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
|
|
5965
|
+
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
5966
|
+
return {
|
|
5967
|
+
title: tag,
|
|
5968
|
+
key: tagId,
|
|
5969
|
+
selectable: true,
|
|
5970
|
+
data: {
|
|
5971
|
+
tagName: tag,
|
|
5972
|
+
apiData: api
|
|
5973
|
+
},
|
|
5974
|
+
children: endpoints.map((endpoint) => ({
|
|
5975
|
+
title: endpoint.summary,
|
|
5976
|
+
key: endpoint.id,
|
|
5977
|
+
isLeaf: true,
|
|
5978
|
+
selectable: true,
|
|
5979
|
+
method: endpoint.method,
|
|
5980
|
+
data: {
|
|
5981
|
+
endpoint,
|
|
5982
|
+
api,
|
|
5983
|
+
tagName: tag,
|
|
5984
|
+
parentApiId: api.id,
|
|
5985
|
+
tagId
|
|
5986
|
+
}
|
|
5987
|
+
}))
|
|
6101
5988
|
};
|
|
6102
|
-
}
|
|
6103
|
-
const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
|
|
6104
|
-
if (matchedTags.length > 0) matchedTags.forEach((tag) => {
|
|
6105
|
-
if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
|
|
6106
|
-
groupedPathsByTags[tag].push({
|
|
6107
|
-
...entry,
|
|
6108
|
-
id: `endpoint-${nanoid(8)}`
|
|
6109
|
-
});
|
|
6110
5989
|
});
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
5990
|
+
return {
|
|
5991
|
+
title: api.title,
|
|
5992
|
+
key: api.id,
|
|
5993
|
+
selectable: true,
|
|
5994
|
+
data: api,
|
|
5995
|
+
children: [...tagNodes, ...defaultEndpoints]
|
|
5996
|
+
};
|
|
5997
|
+
});
|
|
5998
|
+
};
|
|
5999
|
+
const getAllTreeKeys = (data) => {
|
|
6000
|
+
const keys = [];
|
|
6001
|
+
const traverse = (nodes) => {
|
|
6002
|
+
nodes.forEach((node) => {
|
|
6003
|
+
keys.push(node.key);
|
|
6004
|
+
if (node.children && node.children.length > 0) traverse(node.children);
|
|
6005
|
+
});
|
|
6006
|
+
};
|
|
6007
|
+
traverse(data);
|
|
6008
|
+
return keys;
|
|
6009
|
+
};
|
|
6010
|
+
const filterTreeData = (data, searchText) => {
|
|
6011
|
+
if (!searchText) return data;
|
|
6012
|
+
const findOriginalNode = (nodes, key) => {
|
|
6013
|
+
for (const node of nodes) {
|
|
6014
|
+
if (node.key === key) return node;
|
|
6015
|
+
if (node.children) {
|
|
6016
|
+
const found = findOriginalNode(node.children, key);
|
|
6017
|
+
if (found) return found;
|
|
6018
|
+
}
|
|
6019
|
+
}
|
|
6020
|
+
return null;
|
|
6021
|
+
};
|
|
6022
|
+
const filterNode = (node) => {
|
|
6023
|
+
let titleText = "";
|
|
6024
|
+
const originalNode = findOriginalNode(data, node.key);
|
|
6025
|
+
if (originalNode && typeof originalNode.title === "string") titleText = originalNode.title;
|
|
6026
|
+
else if (typeof node.title === "string") titleText = node.title;
|
|
6027
|
+
let searchableText = titleText;
|
|
6028
|
+
if (node.isLeaf && node.method) searchableText = `${node.method} ${titleText}`.toLowerCase();
|
|
6029
|
+
else searchableText = titleText.toLowerCase();
|
|
6030
|
+
const searchLower = searchText.toLowerCase();
|
|
6031
|
+
const matchesSearch = searchableText.includes(searchLower);
|
|
6032
|
+
if (node.children) {
|
|
6033
|
+
const filteredChildren = node.children.map((child) => filterNode(child)).filter((child) => child !== null);
|
|
6034
|
+
if (matchesSearch || filteredChildren.length > 0) return {
|
|
6035
|
+
...node,
|
|
6036
|
+
children: filteredChildren
|
|
6037
|
+
};
|
|
6038
|
+
} else if (matchesSearch) return node;
|
|
6039
|
+
return null;
|
|
6040
|
+
};
|
|
6041
|
+
return data.map((node) => filterNode(node)).filter((node) => node !== null);
|
|
6042
|
+
};
|
|
6043
|
+
const getSidebarStyles = (token, scope) => ({
|
|
6044
|
+
[scope("sider")]: {
|
|
6045
|
+
backgroundColor: token.colorBgElevated,
|
|
6046
|
+
overflowX: "clip",
|
|
6047
|
+
borderRadius: token.borderRadius,
|
|
6048
|
+
height: "auto"
|
|
6049
|
+
},
|
|
6050
|
+
[scope("content")]: { padding: token.padding },
|
|
6051
|
+
[scope("controls")]: {
|
|
6052
|
+
display: "flex",
|
|
6053
|
+
gap: token.marginXS,
|
|
6054
|
+
marginBottom: token.marginSM
|
|
6055
|
+
},
|
|
6056
|
+
[scope("search-input")]: { flex: 1 },
|
|
6057
|
+
[scope("tree")]: {
|
|
6058
|
+
backgroundColor: "transparent",
|
|
6059
|
+
width: "100%",
|
|
6060
|
+
"& .ant-tree-list": { width: "100%" },
|
|
6061
|
+
"& .ant-tree-list-holder-inner": { width: "100%" },
|
|
6062
|
+
"& .ant-tree-node-content-wrapper": {
|
|
6063
|
+
overflow: "hidden",
|
|
6064
|
+
flex: 1,
|
|
6065
|
+
display: "flex",
|
|
6066
|
+
alignItems: "center",
|
|
6067
|
+
padding: "0 !important"
|
|
6068
|
+
},
|
|
6069
|
+
"& .ant-tree-title": {
|
|
6070
|
+
width: "100%",
|
|
6071
|
+
overflow: "hidden",
|
|
6072
|
+
display: "flex",
|
|
6073
|
+
alignItems: "center",
|
|
6074
|
+
marginBlock: "auto"
|
|
6075
|
+
},
|
|
6076
|
+
"& .ant-tree-treenode": {
|
|
6077
|
+
width: "100%",
|
|
6078
|
+
padding: 0
|
|
6079
|
+
},
|
|
6080
|
+
"& .ant-tree-switcher": { backgroundColor: token.colorBgElevated }
|
|
6081
|
+
},
|
|
6082
|
+
[scope("endpoint-item")]: {
|
|
6083
|
+
display: "flex",
|
|
6084
|
+
alignItems: "center",
|
|
6085
|
+
gap: token.marginXS,
|
|
6086
|
+
width: "100%",
|
|
6087
|
+
maxWidth: "100%",
|
|
6088
|
+
minWidth: "100%",
|
|
6089
|
+
paddingLeft: token.marginXS,
|
|
6090
|
+
paddingRight: token.marginXS
|
|
6091
|
+
},
|
|
6092
|
+
[scope("method-tag")]: {
|
|
6093
|
+
width: 51,
|
|
6094
|
+
height: 16,
|
|
6095
|
+
lineHeight: "16px",
|
|
6096
|
+
fontSize: 12,
|
|
6097
|
+
textAlign: "center",
|
|
6098
|
+
border: "none",
|
|
6099
|
+
borderRadius: 6,
|
|
6100
|
+
padding: "0 8px",
|
|
6101
|
+
display: "inline-flex",
|
|
6102
|
+
alignItems: "center",
|
|
6103
|
+
justifyContent: "center"
|
|
6104
|
+
},
|
|
6105
|
+
[scope("endpoint-text")]: {
|
|
6106
|
+
flex: 1,
|
|
6107
|
+
maxWidth: "100%",
|
|
6108
|
+
minWidth: 0,
|
|
6109
|
+
overflow: "hidden",
|
|
6110
|
+
display: "block"
|
|
6111
|
+
},
|
|
6112
|
+
[scope("tag-title")]: {
|
|
6113
|
+
color: token.colorText,
|
|
6114
|
+
maxWidth: "100%",
|
|
6115
|
+
display: "block",
|
|
6116
|
+
flex: 1
|
|
6117
|
+
},
|
|
6118
|
+
[scope("api-title")]: {
|
|
6119
|
+
flex: 1,
|
|
6120
|
+
color: token.colorText,
|
|
6121
|
+
maxWidth: "100%",
|
|
6122
|
+
display: "block",
|
|
6123
|
+
paddingLeft: "4px",
|
|
6124
|
+
paddingRight: "4px",
|
|
6125
|
+
margin: 0
|
|
6126
|
+
}
|
|
6127
|
+
});
|
|
6128
|
+
//#endregion
|
|
6129
|
+
//#region src/view/console/helper/sidebar.components.tsx
|
|
6130
|
+
const { Text: Text$1 } = Typography;
|
|
6131
|
+
const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
6132
|
+
const methodStyle = (isSelected ? darkerMethodColors : sidebarMethodColors)[method];
|
|
6133
|
+
const isPost = method?.toUpperCase() === "POST";
|
|
6134
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6135
|
+
className: `${cx("endpoint-item")}${isSelected ? ` ${cx("endpoint-item-selected")}` : ""}`,
|
|
6136
|
+
children: [/* @__PURE__ */ jsx(Tag, {
|
|
6137
|
+
className: cx("method-tag"),
|
|
6138
|
+
style: {
|
|
6139
|
+
backgroundColor: methodStyle?.bg,
|
|
6140
|
+
color: methodStyle?.color,
|
|
6141
|
+
border: "none",
|
|
6142
|
+
...isPost ? { borderRadius: 4 } : {}
|
|
6143
|
+
},
|
|
6144
|
+
children: method
|
|
6145
|
+
}), /* @__PURE__ */ jsx(Text$1, {
|
|
6146
|
+
className: cx("endpoint-text"),
|
|
6147
|
+
ellipsis: { tooltip: title },
|
|
6148
|
+
style: { flex: 1 },
|
|
6149
|
+
children: title
|
|
6150
|
+
})]
|
|
6151
|
+
});
|
|
6152
|
+
};
|
|
6153
|
+
const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
|
|
6154
|
+
const renderNode = (node) => {
|
|
6155
|
+
let title;
|
|
6156
|
+
if (node.isLeaf && node.method) {
|
|
6157
|
+
const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
|
|
6158
|
+
title = /* @__PURE__ */ jsx(EndpointItem, {
|
|
6159
|
+
method: node.method,
|
|
6160
|
+
title: typeof node.title === "string" ? node.title : "Endpoint Name",
|
|
6161
|
+
cx,
|
|
6162
|
+
isSelected
|
|
6163
|
+
});
|
|
6164
|
+
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) title = /* @__PURE__ */ jsx(Text$1, {
|
|
6165
|
+
className: cx("api-title"),
|
|
6166
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
|
|
6167
|
+
children: node.title
|
|
6168
|
+
});
|
|
6169
|
+
else title = /* @__PURE__ */ jsx(Text$1, {
|
|
6170
|
+
className: cx("tag-title"),
|
|
6171
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
6172
|
+
children: node.title
|
|
6173
|
+
});
|
|
6174
|
+
return {
|
|
6175
|
+
...node,
|
|
6176
|
+
title,
|
|
6177
|
+
children: node.children ? node.children.map(renderNode) : void 0
|
|
6178
|
+
};
|
|
6179
|
+
};
|
|
6180
|
+
return treeDataStructure.map(renderNode);
|
|
6181
|
+
};
|
|
6182
|
+
//#endregion
|
|
6183
|
+
//#region src/view/console/Sidebar.tsx
|
|
6184
|
+
const { useBreakpoint } = Grid;
|
|
6185
|
+
const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
6186
|
+
const expandedKeys = useStore((state) => state.view.expandedKeys);
|
|
6187
|
+
const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
|
|
6188
|
+
const { selectNodeByKey, clearSelection } = useNodeSelection();
|
|
6189
|
+
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
6190
|
+
const isMobile = !useBreakpoint().md;
|
|
6191
|
+
const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles);
|
|
6192
|
+
const handleSearch = (value) => {
|
|
6193
|
+
if (value && builtTreeData) {
|
|
6194
|
+
setExpandedKeys(getAllTreeKeys(builtTreeData));
|
|
6195
|
+
setSearchValue(value);
|
|
6196
|
+
setAutoExpandParent(true);
|
|
6197
|
+
} else {
|
|
6198
|
+
setSearchValue(value);
|
|
6199
|
+
setExpandedKeys([]);
|
|
6200
|
+
setAutoExpandParent(false);
|
|
6201
|
+
}
|
|
6202
|
+
};
|
|
6203
|
+
const renderTreeData = useMemo(() => {
|
|
6204
|
+
if (!builtTreeData) return [];
|
|
6205
|
+
return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
|
|
6206
|
+
}, [
|
|
6207
|
+
builtTreeData,
|
|
6208
|
+
selectedEndpoint,
|
|
6209
|
+
cx
|
|
6210
|
+
]);
|
|
6211
|
+
const filteredTreeData = useMemo(() => {
|
|
6212
|
+
if (!searchValue) return renderTreeData;
|
|
6213
|
+
if (!builtTreeData) return [];
|
|
6214
|
+
return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
6215
|
+
}, [
|
|
6216
|
+
builtTreeData,
|
|
6217
|
+
searchValue,
|
|
6218
|
+
selectedEndpoint,
|
|
6219
|
+
cx
|
|
6220
|
+
]);
|
|
6221
|
+
const collapseAll = () => {
|
|
6222
|
+
setExpandedKeys([]);
|
|
6223
|
+
};
|
|
6224
|
+
const onTreeNodeSelect = (selectedKeys) => {
|
|
6225
|
+
const stringKeys = selectedKeys.map((key) => String(key));
|
|
6226
|
+
if (stringKeys.length === 0) {
|
|
6227
|
+
clearSelection();
|
|
6228
|
+
return;
|
|
6229
|
+
}
|
|
6230
|
+
if (!builtTreeData) return;
|
|
6231
|
+
const selectedKey = stringKeys[0];
|
|
6232
|
+
selectNodeByKey(selectedKey);
|
|
6233
|
+
setSelectedNodeKey(selectedKey);
|
|
6234
|
+
};
|
|
6235
|
+
const inner = /* @__PURE__ */ jsxs("div", {
|
|
6236
|
+
className: cx("content"),
|
|
6237
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6238
|
+
className: cx("controls"),
|
|
6239
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
6240
|
+
title: "Search by APIs or Endpoints",
|
|
6241
|
+
placement: "bottom",
|
|
6242
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
6243
|
+
placeholder: "Search by APIs or Endpoints",
|
|
6244
|
+
value: searchValue,
|
|
6245
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
6246
|
+
allowClear: true,
|
|
6247
|
+
className: cx("search-input"),
|
|
6248
|
+
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
6249
|
+
})
|
|
6250
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
6251
|
+
title: "Collapse All",
|
|
6252
|
+
placement: "bottom",
|
|
6253
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
6254
|
+
onClick: collapseAll,
|
|
6255
|
+
title: "Collapse All",
|
|
6256
|
+
icon: /* @__PURE__ */ jsx(Minify, {})
|
|
6257
|
+
})
|
|
6258
|
+
})]
|
|
6259
|
+
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
6260
|
+
showLine: { showLeafIcon: false },
|
|
6261
|
+
showIcon: false,
|
|
6262
|
+
switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ jsx(MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ jsx(PlusSquareOutlined, { style: { fontSize: 12 } }),
|
|
6263
|
+
expandedKeys,
|
|
6264
|
+
autoExpandParent,
|
|
6265
|
+
selectedKeys: [selectedNodeKey || ""],
|
|
6266
|
+
onSelect: (selectedKeys) => {
|
|
6267
|
+
if (!selectedKeys?.length) return;
|
|
6268
|
+
onTreeNodeSelect(selectedKeys);
|
|
6269
|
+
setSelectedNodeKey(selectedKeys[0]);
|
|
6270
|
+
onNodeSelect?.();
|
|
6271
|
+
},
|
|
6272
|
+
onExpand: (expandedKeysValue) => {
|
|
6273
|
+
setExpandedKeys(expandedKeysValue);
|
|
6274
|
+
setAutoExpandParent(false);
|
|
6275
|
+
},
|
|
6276
|
+
treeData: filteredTreeData,
|
|
6277
|
+
className: cx("tree")
|
|
6278
|
+
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
6279
|
+
justify: "center",
|
|
6280
|
+
align: "center",
|
|
6281
|
+
gap: token.marginSM,
|
|
6282
|
+
vertical: true,
|
|
6283
|
+
style: { marginTop: token.paddingXL },
|
|
6284
|
+
children: [/* @__PURE__ */ jsx(NoDataIcon, {
|
|
6285
|
+
stroke: token.colorPrimaryHover,
|
|
6286
|
+
fill: token.colorPrimaryBg,
|
|
6287
|
+
width: "10.375rem",
|
|
6288
|
+
height: "8.1875rem"
|
|
6289
|
+
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
6290
|
+
style: {
|
|
6291
|
+
textAlign: "center",
|
|
6292
|
+
fontFamily: token.fontFamily,
|
|
6293
|
+
fontWeight: 400,
|
|
6294
|
+
fontSize: token.fontSizeLG,
|
|
6295
|
+
color: token.colorTextTertiary
|
|
6296
|
+
},
|
|
6297
|
+
children: "No results found"
|
|
6298
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
6299
|
+
style: {
|
|
6300
|
+
textAlign: "center",
|
|
6301
|
+
fontFamily: token.fontFamily,
|
|
6302
|
+
fontWeight: 400,
|
|
6303
|
+
fontSize: token.fontSizeLG,
|
|
6304
|
+
color: token.colorTextTertiary
|
|
6305
|
+
},
|
|
6306
|
+
children: [
|
|
6307
|
+
"No API",
|
|
6308
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
6309
|
+
"Documentation Found"
|
|
6310
|
+
]
|
|
6311
|
+
})]
|
|
6312
|
+
})]
|
|
6313
|
+
});
|
|
6314
|
+
if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
|
|
6315
|
+
className: cx("sider"),
|
|
6316
|
+
style: {
|
|
6317
|
+
width: "100%",
|
|
6318
|
+
height: "100%"
|
|
6319
|
+
},
|
|
6320
|
+
children: inner
|
|
6321
|
+
}));
|
|
6322
|
+
return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
|
|
6323
|
+
as: "aside",
|
|
6324
|
+
minWidth: isMobile ? 180 : 300,
|
|
6325
|
+
maxWidth: 386,
|
|
6326
|
+
enable: {
|
|
6327
|
+
top: false,
|
|
6328
|
+
right: true,
|
|
6329
|
+
bottom: false,
|
|
6330
|
+
left: false,
|
|
6331
|
+
topRight: false,
|
|
6332
|
+
bottomRight: false,
|
|
6333
|
+
bottomLeft: false,
|
|
6334
|
+
topLeft: false
|
|
6335
|
+
},
|
|
6336
|
+
defaultSize: {
|
|
6337
|
+
width: isMobile ? 225 : 333,
|
|
6338
|
+
height: "auto"
|
|
6339
|
+
},
|
|
6340
|
+
className: cx("sider"),
|
|
6341
|
+
children: inner
|
|
6342
|
+
}));
|
|
6343
|
+
};
|
|
6344
|
+
//#endregion
|
|
6345
|
+
//#region src/view/console/EndpointPage/EndpointPage.tsx
|
|
6346
|
+
const { Title: Title$1, Paragraph } = Typography;
|
|
6347
|
+
const requestColumns = [
|
|
6348
|
+
{
|
|
6349
|
+
title: "Parameter",
|
|
6350
|
+
dataIndex: "param",
|
|
6351
|
+
key: "param"
|
|
6352
|
+
},
|
|
6353
|
+
{
|
|
6354
|
+
title: "Description",
|
|
6355
|
+
dataIndex: "desc",
|
|
6356
|
+
key: "desc"
|
|
6357
|
+
},
|
|
6358
|
+
{
|
|
6359
|
+
title: "Enum",
|
|
6360
|
+
dataIndex: "enum",
|
|
6361
|
+
key: "enum"
|
|
6362
|
+
}
|
|
6363
|
+
];
|
|
6364
|
+
const responseColumns = [...requestColumns];
|
|
6365
|
+
const buildRequestData = (params, token) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
|
|
6366
|
+
let typeLabel = p.schema?.type;
|
|
6367
|
+
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
6368
|
+
return {
|
|
6369
|
+
key: index,
|
|
6370
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6371
|
+
p.name,
|
|
6372
|
+
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
6373
|
+
style: {
|
|
6374
|
+
color: token.colorTextTertiary,
|
|
6375
|
+
marginLeft: "0.25rem",
|
|
6376
|
+
marginRight: "0.25rem"
|
|
6377
|
+
},
|
|
6378
|
+
children: typeLabel
|
|
6379
|
+
}),
|
|
6380
|
+
p.required ? /* @__PURE__ */ jsx("span", {
|
|
6381
|
+
style: { color: token.colorError },
|
|
6382
|
+
children: "*"
|
|
6383
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6384
|
+
style: { color: token.colorSuccess },
|
|
6385
|
+
children: "Optional"
|
|
6386
|
+
})
|
|
6387
|
+
] }),
|
|
6388
|
+
desc: p.description || "--",
|
|
6389
|
+
enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6390
|
+
};
|
|
6391
|
+
});
|
|
6392
|
+
const buildHeaderData = (headers, token) => {
|
|
6393
|
+
if (!headers) return [];
|
|
6394
|
+
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
6395
|
+
let typeLabel = header.schema?.type;
|
|
6396
|
+
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
6397
|
+
return {
|
|
6398
|
+
key: idx,
|
|
6399
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6400
|
+
name,
|
|
6401
|
+
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
6402
|
+
style: {
|
|
6403
|
+
color: token.colorTextTertiary,
|
|
6404
|
+
marginLeft: "0.25rem",
|
|
6405
|
+
marginRight: "0.25rem"
|
|
6406
|
+
},
|
|
6407
|
+
children: typeLabel
|
|
6408
|
+
}),
|
|
6409
|
+
header.required ? /* @__PURE__ */ jsx("span", {
|
|
6410
|
+
style: { color: token.colorError },
|
|
6411
|
+
children: "*"
|
|
6412
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6413
|
+
style: { color: token.colorSuccess },
|
|
6414
|
+
children: "Optional"
|
|
6415
|
+
})
|
|
6416
|
+
] }, idx),
|
|
6417
|
+
desc: header.description || "--",
|
|
6418
|
+
enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6419
|
+
};
|
|
6420
|
+
});
|
|
6421
|
+
};
|
|
6422
|
+
const buildRequestBodyData = (requestBody, token) => {
|
|
6423
|
+
if (!requestBody?.content) return [];
|
|
6424
|
+
const contentType = Object.keys(requestBody.content)[0];
|
|
6425
|
+
const schema = requestBody.content[contentType]?.schema;
|
|
6426
|
+
if (!schema) return [];
|
|
6427
|
+
const properties = schema.properties ?? {};
|
|
6428
|
+
const required = schema.required ?? [];
|
|
6429
|
+
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
6430
|
+
key: idx,
|
|
6431
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6432
|
+
name,
|
|
6433
|
+
prop.type && /* @__PURE__ */ jsx("span", {
|
|
6434
|
+
style: {
|
|
6435
|
+
color: token.colorTextTertiary,
|
|
6436
|
+
marginLeft: "0.25rem",
|
|
6437
|
+
marginRight: "0.25rem"
|
|
6438
|
+
},
|
|
6439
|
+
children: prop.type
|
|
6440
|
+
}),
|
|
6441
|
+
required.includes(name) ? /* @__PURE__ */ jsx("span", {
|
|
6442
|
+
style: { color: token.colorError },
|
|
6443
|
+
children: "*"
|
|
6444
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6445
|
+
style: { color: token.colorSuccess },
|
|
6446
|
+
children: "Optional"
|
|
6447
|
+
})
|
|
6448
|
+
] }),
|
|
6449
|
+
desc: prop.description || "--",
|
|
6450
|
+
enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6451
|
+
}));
|
|
6452
|
+
};
|
|
6453
|
+
const EndpointPage = () => {
|
|
6454
|
+
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
|
|
6455
|
+
const [activeTabKey, setActiveTabKey] = useState("header");
|
|
6456
|
+
const { token } = theme.useToken();
|
|
6457
|
+
const { cx } = useStyle("EndpointPage", (token, scope) => ({
|
|
6458
|
+
[scope("docs-endpoint-container")]: {
|
|
6459
|
+
display: "flex",
|
|
6460
|
+
flexDirection: "column",
|
|
6461
|
+
gap: token.marginLG,
|
|
6462
|
+
height: "100%"
|
|
6463
|
+
},
|
|
6464
|
+
[scope("content")]: {
|
|
6465
|
+
width: "100%",
|
|
6466
|
+
height: "100%"
|
|
6467
|
+
},
|
|
6468
|
+
[scope("code")]: {
|
|
6469
|
+
background: "unset",
|
|
6470
|
+
borderRadius: token.borderRadius,
|
|
6471
|
+
padding: token.paddingSM,
|
|
6472
|
+
fontFamily: "monospace",
|
|
6473
|
+
whiteSpace: "pre-wrap"
|
|
6474
|
+
},
|
|
6475
|
+
[scope("breadcrumb")]: {
|
|
6476
|
+
display: "flex",
|
|
6477
|
+
gap: token.marginLG,
|
|
6478
|
+
alignItems: "center",
|
|
6479
|
+
marginBottom: token.marginLG
|
|
6480
|
+
},
|
|
6481
|
+
[scope("request-card")]: {
|
|
6482
|
+
borderRadius: token.borderRadius,
|
|
6483
|
+
backgroundColor: token.colorBgBase,
|
|
6484
|
+
".ant-card-head": {
|
|
6485
|
+
minHeight: "unset",
|
|
6486
|
+
borderBottom: "unset",
|
|
6487
|
+
padding: "0.75rem",
|
|
6488
|
+
backgroundColor: token.colorBgBase
|
|
6489
|
+
},
|
|
6490
|
+
".ant-card-body": {
|
|
6491
|
+
padding: "0px 0.75rem 0.75rem 0.75rem",
|
|
6492
|
+
backgroundColor: token.colorBgBase,
|
|
6493
|
+
".ant-tabs-tab": { paddingTop: "0" }
|
|
6494
|
+
},
|
|
6495
|
+
"& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
|
|
6496
|
+
"& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
|
|
6497
|
+
"& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
|
|
6498
|
+
},
|
|
6499
|
+
[scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
|
|
6500
|
+
[scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
|
|
6501
|
+
}));
|
|
6502
|
+
const methodStyle = sidebarMethodColors[selectedEndpoint?.method];
|
|
6503
|
+
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
|
|
6504
|
+
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
|
|
6505
|
+
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
|
|
6506
|
+
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
|
|
6507
|
+
const requestTabs = [
|
|
6508
|
+
{
|
|
6509
|
+
key: "header",
|
|
6510
|
+
label: "Header",
|
|
6511
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6512
|
+
columns: requestColumns,
|
|
6513
|
+
dataSource: headerParams,
|
|
6514
|
+
pagination: false,
|
|
6515
|
+
bordered: true,
|
|
6516
|
+
size: "small",
|
|
6517
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6518
|
+
})
|
|
6519
|
+
},
|
|
6520
|
+
{
|
|
6521
|
+
key: "path",
|
|
6522
|
+
label: "Path",
|
|
6523
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6524
|
+
columns: requestColumns,
|
|
6525
|
+
dataSource: pathParams,
|
|
6526
|
+
pagination: false,
|
|
6527
|
+
bordered: true,
|
|
6528
|
+
size: "small",
|
|
6529
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6530
|
+
})
|
|
6531
|
+
},
|
|
6532
|
+
{
|
|
6533
|
+
key: "query",
|
|
6534
|
+
label: "Query",
|
|
6535
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6536
|
+
columns: requestColumns,
|
|
6537
|
+
dataSource: queryParams,
|
|
6538
|
+
pagination: false,
|
|
6539
|
+
bordered: true,
|
|
6540
|
+
size: "small",
|
|
6541
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6542
|
+
})
|
|
6543
|
+
},
|
|
6544
|
+
...requestBodyData.length > 0 ? [{
|
|
6545
|
+
key: "requestBody",
|
|
6546
|
+
label: "Request Body",
|
|
6547
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6548
|
+
columns: requestColumns,
|
|
6549
|
+
dataSource: requestBodyData,
|
|
6550
|
+
pagination: false,
|
|
6551
|
+
bordered: true,
|
|
6552
|
+
size: "small",
|
|
6553
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6554
|
+
})
|
|
6555
|
+
}] : []
|
|
6556
|
+
].filter((t) => t !== null);
|
|
6557
|
+
useEffect(() => {
|
|
6558
|
+
const firstKey = requestTabs[0]?.key ?? "header";
|
|
6559
|
+
setActiveTabKey(firstKey);
|
|
6560
|
+
setActiveRequestTab(firstKey);
|
|
6561
|
+
}, [selectedEndpoint?.id]);
|
|
6562
|
+
const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
|
|
6563
|
+
const responseHeaderData = buildHeaderData(responseHeaders, token);
|
|
6564
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6565
|
+
className: cx("docs-endpoint-container"),
|
|
6566
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
6567
|
+
className: cx("content"),
|
|
6568
|
+
children: [
|
|
6569
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6570
|
+
className: cx("breadcrumb"),
|
|
6571
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
6572
|
+
color: "default",
|
|
6573
|
+
variant: "outlined",
|
|
6574
|
+
icon: /* @__PURE__ */ jsx(LeftOutlined, {}),
|
|
6575
|
+
onClick: (e) => {
|
|
6576
|
+
e.preventDefault();
|
|
6577
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6578
|
+
setFocusedContent("API");
|
|
6579
|
+
}
|
|
6580
|
+
}), /* @__PURE__ */ jsx(Breadcrumb, { items: [
|
|
6581
|
+
{
|
|
6582
|
+
href: "",
|
|
6583
|
+
title: /* @__PURE__ */ jsx("span", { children: selectedApi?.title || "API Name" }),
|
|
6584
|
+
onClick: (e) => {
|
|
6585
|
+
e.preventDefault();
|
|
6586
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6587
|
+
setFocusedContent("API");
|
|
6588
|
+
}
|
|
6589
|
+
},
|
|
6590
|
+
{
|
|
6591
|
+
href: ``,
|
|
6592
|
+
onClick: (e) => {
|
|
6593
|
+
e.preventDefault();
|
|
6594
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6595
|
+
setFocusedContent("API");
|
|
6596
|
+
setFocusedTag(selectedEndpoint?.tagName || "default");
|
|
6597
|
+
},
|
|
6598
|
+
title: /* @__PURE__ */ jsx("p", {
|
|
6599
|
+
style: {
|
|
6600
|
+
display: "flex",
|
|
6601
|
+
flexDirection: "row",
|
|
6602
|
+
alignItems: "center",
|
|
6603
|
+
color: token.colorTextTertiary,
|
|
6604
|
+
gap: "0.25rem"
|
|
6605
|
+
},
|
|
6606
|
+
children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
|
|
6607
|
+
})
|
|
6608
|
+
},
|
|
6609
|
+
{ title: /* @__PURE__ */ jsx(Tooltip, {
|
|
6610
|
+
title: selectedEndpoint?.summary || "Endpoint Name",
|
|
6611
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6612
|
+
style: {
|
|
6613
|
+
overflow: "hidden",
|
|
6614
|
+
textOverflow: "ellipsis",
|
|
6615
|
+
whiteSpace: "nowrap",
|
|
6616
|
+
display: "block",
|
|
6617
|
+
maxWidth: "300px"
|
|
6618
|
+
},
|
|
6619
|
+
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
6620
|
+
})
|
|
6621
|
+
}) }
|
|
6622
|
+
] })]
|
|
6623
|
+
}),
|
|
6624
|
+
/* @__PURE__ */ jsxs(Title$1, {
|
|
6625
|
+
level: 3,
|
|
6626
|
+
style: {
|
|
6627
|
+
display: "flex",
|
|
6628
|
+
alignItems: "center",
|
|
6629
|
+
gap: 12,
|
|
6630
|
+
margin: 0
|
|
6631
|
+
},
|
|
6632
|
+
children: [/* @__PURE__ */ jsx(Tag, {
|
|
6633
|
+
style: {
|
|
6634
|
+
backgroundColor: methodStyle?.bg,
|
|
6635
|
+
color: methodStyle?.color,
|
|
6636
|
+
border: "none",
|
|
6637
|
+
width: "4.375rem",
|
|
6638
|
+
height: "1.375rem",
|
|
6639
|
+
textAlign: "center",
|
|
6640
|
+
flexShrink: 0
|
|
6641
|
+
},
|
|
6642
|
+
children: selectedEndpoint?.method
|
|
6643
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
6644
|
+
title: selectedEndpoint?.summary ?? "--",
|
|
6645
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6646
|
+
style: {
|
|
6647
|
+
overflow: "hidden",
|
|
6648
|
+
textOverflow: "ellipsis",
|
|
6649
|
+
whiteSpace: "nowrap"
|
|
6650
|
+
},
|
|
6651
|
+
children: selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
|
|
6652
|
+
})
|
|
6653
|
+
})]
|
|
6654
|
+
}),
|
|
6655
|
+
/* @__PURE__ */ jsx(Paragraph, {
|
|
6656
|
+
style: {
|
|
6657
|
+
color: token.colorTextTertiary,
|
|
6658
|
+
marginBottom: "1.5rem"
|
|
6659
|
+
},
|
|
6660
|
+
children: selectedEndpoint?.description ?? "--"
|
|
6661
|
+
}),
|
|
6662
|
+
requestTabs.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
6663
|
+
title: "Request",
|
|
6664
|
+
className: cx("request-card"),
|
|
6665
|
+
style: {
|
|
6666
|
+
marginBottom: "1.5rem",
|
|
6667
|
+
backgroundColor: token.colorBgBase
|
|
6668
|
+
},
|
|
6669
|
+
styles: { body: { backgroundColor: token.colorBgBase } },
|
|
6670
|
+
children: /* @__PURE__ */ jsx(Tabs, {
|
|
6671
|
+
activeKey: activeTabKey,
|
|
6672
|
+
onChange: (key) => {
|
|
6673
|
+
setActiveTabKey(key);
|
|
6674
|
+
setActiveRequestTab(key);
|
|
6675
|
+
},
|
|
6676
|
+
items: requestTabs
|
|
6677
|
+
})
|
|
6678
|
+
}),
|
|
6679
|
+
/* @__PURE__ */ jsx(Card, {
|
|
6680
|
+
title: "Response",
|
|
6681
|
+
className: cx("request-card"),
|
|
6682
|
+
extra: responseHeaderData.length > 0 && /* @__PURE__ */ jsxs(Tag, { children: [/* @__PURE__ */ jsx("span", { style: {
|
|
6683
|
+
background: handleStatusColor(selectedStatusCode),
|
|
6684
|
+
borderRadius: "50%",
|
|
6685
|
+
display: "inline-block",
|
|
6686
|
+
width: "0.5rem",
|
|
6687
|
+
height: "0.5rem",
|
|
6688
|
+
marginRight: "0.5rem"
|
|
6689
|
+
} }), /* @__PURE__ */ jsx("span", { children: selectedStatusCode })] }),
|
|
6690
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6691
|
+
columns: responseColumns,
|
|
6692
|
+
dataSource: responseHeaderData,
|
|
6693
|
+
pagination: false,
|
|
6694
|
+
bordered: true,
|
|
6695
|
+
size: "small",
|
|
6696
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6697
|
+
})
|
|
6698
|
+
})
|
|
6699
|
+
]
|
|
6700
|
+
})
|
|
6701
|
+
});
|
|
6702
|
+
};
|
|
6703
|
+
//#endregion
|
|
6704
|
+
//#region src/view/console/MainContent.tsx
|
|
6705
|
+
const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
6706
|
+
const { focusedContent, transformedData } = useStore(({ view }) => view);
|
|
6707
|
+
const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
|
|
6708
|
+
[scope("inner-doc-container")]: {
|
|
6709
|
+
width: "100%",
|
|
6710
|
+
height: "auto",
|
|
6711
|
+
borderRadius: token.borderRadius,
|
|
6712
|
+
padding: token.paddingXL,
|
|
6713
|
+
overflow: "hidden",
|
|
6714
|
+
minWidth: 0
|
|
6715
|
+
},
|
|
6716
|
+
[scope("centered")]: {
|
|
6717
|
+
display: "flex",
|
|
6718
|
+
justifyContent: "center"
|
|
6719
|
+
},
|
|
6720
|
+
[scope("no-space")]: {
|
|
6721
|
+
margin: 0,
|
|
6722
|
+
padding: 0
|
|
6723
|
+
},
|
|
6724
|
+
[scope("title")]: {
|
|
6725
|
+
fontFamily: token.fontFamily,
|
|
6726
|
+
fontWeight: 600,
|
|
6727
|
+
fontSize: token.fontSizeHeading4,
|
|
6728
|
+
color: token.colorText
|
|
6729
|
+
},
|
|
6730
|
+
[scope("text")]: {
|
|
6731
|
+
color: token.colorText,
|
|
6732
|
+
fontFamily: token.fontFamily
|
|
6733
|
+
},
|
|
6734
|
+
[scope("visit-landing-button")]: {
|
|
6735
|
+
width: "12.25rem",
|
|
6736
|
+
height: "2.5rem",
|
|
6737
|
+
borderRadius: token.borderRadiusLG
|
|
6738
|
+
},
|
|
6739
|
+
[scope("reset-button")]: {
|
|
6740
|
+
width: "8.125rem",
|
|
6741
|
+
height: "2.5rem",
|
|
6742
|
+
borderRadius: token.borderRadiusLG,
|
|
6743
|
+
backgroundColor: token?.Button?.primaryColor,
|
|
6744
|
+
fontSize: token.Button?.contentFontSizeLG
|
|
6117
6745
|
}
|
|
6118
|
-
}
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6746
|
+
}));
|
|
6747
|
+
return wrapSSR(/* @__PURE__ */ jsx("div", {
|
|
6748
|
+
className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
|
|
6749
|
+
style: { backgroundColor: focusedContent === "ENDPOINT" ? token.colorBgBase : token.colorBgElevated },
|
|
6750
|
+
children: !transformedData?.length ? /* @__PURE__ */ jsxs(Flex, {
|
|
6751
|
+
justify: "center",
|
|
6752
|
+
align: "center",
|
|
6753
|
+
gap: "1.5rem",
|
|
6754
|
+
vertical: true,
|
|
6755
|
+
flex: 1,
|
|
6756
|
+
children: [
|
|
6757
|
+
/* @__PURE__ */ jsx(NoDataIcon, {
|
|
6758
|
+
stroke: token.colorPrimaryHover,
|
|
6759
|
+
fill: token.colorPrimaryBg,
|
|
6760
|
+
width: "18.625rem",
|
|
6761
|
+
height: "14.75rem"
|
|
6762
|
+
}),
|
|
6763
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
6764
|
+
justify: "center",
|
|
6765
|
+
align: "center",
|
|
6766
|
+
gap: "0.5rem",
|
|
6767
|
+
vertical: true,
|
|
6768
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
6769
|
+
className: cx("no-space", "title"),
|
|
6770
|
+
level: 4,
|
|
6771
|
+
children: !searchEnabled ? "No API Documentation Found" : "No results found"
|
|
6772
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
6773
|
+
className: cx("no-space", "text"),
|
|
6774
|
+
children: !searchEnabled ? "No API Documentation has been added yet. Contact admin for support." : "Adjust your Search and try again"
|
|
6775
|
+
})]
|
|
6776
|
+
}),
|
|
6777
|
+
!searchEnabled ? /* @__PURE__ */ jsx(Button, {
|
|
6778
|
+
type: "primary",
|
|
6779
|
+
onClick: handleVisitLandingPage,
|
|
6780
|
+
icon: /* @__PURE__ */ jsx(MouseSquare, {}),
|
|
6781
|
+
iconPosition: "start",
|
|
6782
|
+
className: cx("visit-landing-button"),
|
|
6783
|
+
children: "Visit Landing Page"
|
|
6784
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
6785
|
+
type: "default",
|
|
6786
|
+
className: cx("reset-button"),
|
|
6787
|
+
onClick: handleResetSearch,
|
|
6788
|
+
children: "Reset Search"
|
|
6789
|
+
})
|
|
6790
|
+
]
|
|
6791
|
+
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
6792
|
+
}));
|
|
6139
6793
|
};
|
|
6140
|
-
|
|
6141
6794
|
//#endregion
|
|
6142
6795
|
//#region src/assets/copy.tsx
|
|
6143
6796
|
const Copy = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
@@ -6155,17 +6808,15 @@ const Copy = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
6155
6808
|
fill: "currentcolor"
|
|
6156
6809
|
})]
|
|
6157
6810
|
});
|
|
6158
|
-
var copy_default = Copy;
|
|
6159
|
-
|
|
6160
6811
|
//#endregion
|
|
6161
|
-
//#region src/view/
|
|
6812
|
+
//#region src/view/console/EndpointPage/Codebox/Codebox.tsx
|
|
6162
6813
|
Light.registerLanguage("json", json);
|
|
6163
|
-
const Codebox = ({ code, language, wrapLongLines }) => {
|
|
6814
|
+
const Codebox$1 = ({ code, language, wrapLongLines }) => {
|
|
6164
6815
|
const [appTheme] = useState("DARK");
|
|
6165
|
-
const { token
|
|
6166
|
-
const bodyBg = themeConfig.id == 1 ? token
|
|
6167
|
-
const { cx } = useStyle("codeBox", (token
|
|
6168
|
-
borderRadius: token
|
|
6816
|
+
const { token, theme: themeConfig } = theme.useToken();
|
|
6817
|
+
const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
|
|
6818
|
+
const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
|
|
6819
|
+
borderRadius: token.borderRadius,
|
|
6169
6820
|
height: "100%",
|
|
6170
6821
|
maxHeight: "100%",
|
|
6171
6822
|
overflow: "auto",
|
|
@@ -6192,12 +6843,10 @@ const Codebox = ({ code, language, wrapLongLines }) => {
|
|
|
6192
6843
|
})
|
|
6193
6844
|
});
|
|
6194
6845
|
};
|
|
6195
|
-
var Codebox_default = Codebox;
|
|
6196
|
-
|
|
6197
6846
|
//#endregion
|
|
6198
|
-
//#region src/view/
|
|
6199
|
-
function CodeboxSidebar() {
|
|
6200
|
-
const { selectedEndpoint, selectedApi, activeRequestTab, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } =
|
|
6847
|
+
//#region src/view/console/CodeboxSidebar.tsx
|
|
6848
|
+
function CodeboxSidebar$1() {
|
|
6849
|
+
const { selectedEndpoint, selectedApi, activeRequestTab, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
|
|
6201
6850
|
const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
|
|
6202
6851
|
value: code,
|
|
6203
6852
|
label: /* @__PURE__ */ jsxs("span", {
|
|
@@ -6236,14 +6885,14 @@ function CodeboxSidebar() {
|
|
|
6236
6885
|
const headerBg = isDark ? antdToken.colorBgElevated : "#1d2856";
|
|
6237
6886
|
const bodyBg = isDark ? antdToken.colorBgContainer : "#1d2856";
|
|
6238
6887
|
const codeTextColor = isDark ? "rgba(255,255,255,0.85)" : "#ffffff";
|
|
6239
|
-
const { cx } = useStyle("CodeboxSidebar", (token$
|
|
6888
|
+
const { cx } = useStyle("CodeboxSidebar", (token$2, scope) => ({
|
|
6240
6889
|
[scope("container")]: {
|
|
6241
6890
|
display: "flex",
|
|
6242
6891
|
flexDirection: "column",
|
|
6243
|
-
gap: token$
|
|
6244
|
-
background: token$
|
|
6245
|
-
borderRadius: token$
|
|
6246
|
-
padding: token$
|
|
6892
|
+
gap: token$2.marginMD,
|
|
6893
|
+
background: token$2.colorBgElevated,
|
|
6894
|
+
borderRadius: token$2.borderRadiusLG,
|
|
6895
|
+
padding: token$2.paddingLG,
|
|
6247
6896
|
height: "auto",
|
|
6248
6897
|
width: "23.625rem",
|
|
6249
6898
|
minWidth: "23.625rem",
|
|
@@ -6255,24 +6904,24 @@ function CodeboxSidebar() {
|
|
|
6255
6904
|
display: "flex",
|
|
6256
6905
|
flexDirection: "column",
|
|
6257
6906
|
backgroundColor: headerBg,
|
|
6258
|
-
border: `1px solid ${token$
|
|
6907
|
+
border: `1px solid ${token$2.colorBorder}`,
|
|
6259
6908
|
".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
|
|
6260
6909
|
".isolated-card-body": {
|
|
6261
6910
|
padding: " .125rem 0 0 0 !important",
|
|
6262
6911
|
borderTop: ".125rem solid #33419A"
|
|
6263
6912
|
},
|
|
6264
6913
|
".ant-card-head": { flex: "0 0 auto" },
|
|
6265
|
-
borderRadius: token$
|
|
6914
|
+
borderRadius: token$2.borderRadius,
|
|
6266
6915
|
overflow: "hidden"
|
|
6267
6916
|
},
|
|
6268
6917
|
[scope("rightCardRequest")]: { minHeight: "8.125rem" },
|
|
6269
|
-
[scope("rightCardHeaderResponse")]: { padding: `0 ${token$
|
|
6918
|
+
[scope("rightCardHeaderResponse")]: { padding: `0 ${token$2.margin}px ${token$2.marginXS}px ${token$2.margin}px` },
|
|
6270
6919
|
[scope("rightCardResponse")]: {
|
|
6271
6920
|
height: "fit-content",
|
|
6272
6921
|
overflow: "hidden",
|
|
6273
6922
|
".isolated-card-body": {
|
|
6274
6923
|
display: "flex",
|
|
6275
|
-
padding: `0 ${token$
|
|
6924
|
+
padding: `0 ${token$2.margin}px`,
|
|
6276
6925
|
flexDirection: "column",
|
|
6277
6926
|
alignItems: "flex-start",
|
|
6278
6927
|
gap: "10px",
|
|
@@ -6283,8 +6932,8 @@ function CodeboxSidebar() {
|
|
|
6283
6932
|
display: "flex",
|
|
6284
6933
|
alignItems: "center",
|
|
6285
6934
|
justifyContent: "space-between",
|
|
6286
|
-
padding: `${token$
|
|
6287
|
-
borderBottom: `1px solid ${token$
|
|
6935
|
+
padding: `${token$2.marginXS}px ${token$2.margin}px`,
|
|
6936
|
+
borderBottom: `1px solid ${token$2.colorBorderSecondary}`,
|
|
6288
6937
|
height: "3.125rem",
|
|
6289
6938
|
backgroundColor: headerBg
|
|
6290
6939
|
},
|
|
@@ -6371,7 +7020,7 @@ function CodeboxSidebar() {
|
|
|
6371
7020
|
setCurlTooltip("Copied!");
|
|
6372
7021
|
setTimeout(() => setCurlTooltip("Copy cURL"), 1500);
|
|
6373
7022
|
},
|
|
6374
|
-
icon: /* @__PURE__ */ jsx(
|
|
7023
|
+
icon: /* @__PURE__ */ jsx(Copy, { style: { color: "white" } })
|
|
6375
7024
|
})
|
|
6376
7025
|
})]
|
|
6377
7026
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -6401,15 +7050,97 @@ function CodeboxSidebar() {
|
|
|
6401
7050
|
open: httpStatusOptions.length === 1 ? false : void 0,
|
|
6402
7051
|
suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
|
|
6403
7052
|
})]
|
|
6404
|
-
}), /* @__PURE__ */ jsx(
|
|
7053
|
+
}), /* @__PURE__ */ jsx(Codebox$1, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
|
|
6405
7054
|
})]
|
|
6406
7055
|
});
|
|
6407
7056
|
}
|
|
6408
|
-
|
|
6409
|
-
|
|
7057
|
+
//#endregion
|
|
7058
|
+
//#region src/view/helper/mutate.ts
|
|
7059
|
+
const resolveSchema = (schema, components) => {
|
|
7060
|
+
if (!schema) return void 0;
|
|
7061
|
+
if (!schema.$ref) return schema;
|
|
7062
|
+
const refName = schema.$ref.split("/").pop();
|
|
7063
|
+
const resolved = components?.schemas?.[refName];
|
|
7064
|
+
if (!resolved) return schema;
|
|
7065
|
+
return resolveSchema(resolved, components);
|
|
7066
|
+
};
|
|
7067
|
+
const transformOpenApiToDocs = (api) => {
|
|
7068
|
+
const groupedPathsByTags = {};
|
|
7069
|
+
const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
|
|
7070
|
+
const contextPath = Object.keys(api.paths)[0];
|
|
7071
|
+
const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
|
|
7072
|
+
apiId,
|
|
7073
|
+
version
|
|
7074
|
+
})) : [];
|
|
7075
|
+
relatedVersions.unshift({
|
|
7076
|
+
apiId: api["x-current-version"],
|
|
7077
|
+
version: `${api.info.version}`
|
|
7078
|
+
});
|
|
7079
|
+
const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
|
|
7080
|
+
const authScheme = api.components?.securitySchemes;
|
|
7081
|
+
let authType;
|
|
7082
|
+
if (authScheme && Object.keys(authScheme)?.[0]) {
|
|
7083
|
+
authType = Object.keys(authScheme)[0];
|
|
7084
|
+
if (authType && authType.toLowerCase() === "public") authType = "KEYLESS";
|
|
7085
|
+
if (authType && (authType.toLowerCase() === "oauth" || authType.toLowerCase() === "oauth2")) authType = "OAUTH2";
|
|
7086
|
+
authType = authType.toUpperCase();
|
|
7087
|
+
} else authType = "x-auth-type" in api ? api["x-auth-type"] : "";
|
|
7088
|
+
const curl = "x-curls" in api ? api["x-curls"] : "";
|
|
7089
|
+
const jwsEnabled = api["x-jws-enabled"] === true;
|
|
7090
|
+
for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
|
|
7091
|
+
const entry = {
|
|
7092
|
+
...methodData,
|
|
7093
|
+
method: method?.toUpperCase(),
|
|
7094
|
+
path
|
|
7095
|
+
};
|
|
7096
|
+
if (entry.requestBody?.content) {
|
|
7097
|
+
const resolvedContent = {};
|
|
7098
|
+
for (const [contentType, contentValue] of Object.entries(entry.requestBody.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
|
|
7099
|
+
entry.requestBody = {
|
|
7100
|
+
...entry.requestBody,
|
|
7101
|
+
content: resolvedContent
|
|
7102
|
+
};
|
|
7103
|
+
}
|
|
7104
|
+
const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
|
|
7105
|
+
if (matchedTags.length > 0) matchedTags.forEach((tag) => {
|
|
7106
|
+
if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
|
|
7107
|
+
groupedPathsByTags[tag].push({
|
|
7108
|
+
...entry,
|
|
7109
|
+
id: `endpoint-${nanoid(8)}`
|
|
7110
|
+
});
|
|
7111
|
+
});
|
|
7112
|
+
else {
|
|
7113
|
+
if (!groupedPathsByTags.default) groupedPathsByTags.default = [];
|
|
7114
|
+
groupedPathsByTags.default.push({
|
|
7115
|
+
...entry,
|
|
7116
|
+
id: `endpoint-${nanoid(8)}`
|
|
7117
|
+
});
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
const sortedGroupedPathsByTags = Object.keys(groupedPathsByTags).sort((a, b) => {
|
|
7121
|
+
if (a === "default") return 1;
|
|
7122
|
+
if (b === "default") return -1;
|
|
7123
|
+
return a.localeCompare(b);
|
|
7124
|
+
}).reduce((acc, key) => {
|
|
7125
|
+
acc[key] = groupedPathsByTags[key];
|
|
7126
|
+
return acc;
|
|
7127
|
+
}, {});
|
|
7128
|
+
return {
|
|
7129
|
+
...api.info,
|
|
7130
|
+
id: `api-${nanoid(8)}`,
|
|
7131
|
+
contextPath,
|
|
7132
|
+
tags: sortedGroupedPathsByTags,
|
|
7133
|
+
servers: api.servers,
|
|
7134
|
+
relatedVersions,
|
|
7135
|
+
currentVersion,
|
|
7136
|
+
authType,
|
|
7137
|
+
jwsEnabled,
|
|
7138
|
+
curl
|
|
7139
|
+
};
|
|
7140
|
+
};
|
|
6410
7141
|
//#endregion
|
|
6411
7142
|
//#region src/view/layout.tsx
|
|
6412
|
-
const
|
|
7143
|
+
const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
|
|
6413
7144
|
const [searchValue, setSearchValue] = useState("");
|
|
6414
7145
|
const [mode, setMode] = useState("edit");
|
|
6415
7146
|
const [hasChanges, setHasChanges] = useState(false);
|
|
@@ -6436,11 +7167,11 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6436
7167
|
});
|
|
6437
7168
|
const [localTags, setLocalTags] = useState([]);
|
|
6438
7169
|
const [messageApi, contextHolder] = message.useMessage();
|
|
6439
|
-
const { focusedContent, selectedNodeKey, selectedApi, originalData, builtTreeData, selectedEndpoint, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys, setSelectedEndpoint } =
|
|
7170
|
+
const { focusedContent, selectedNodeKey, selectedApi, originalData, builtTreeData, selectedEndpoint, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys, setSelectedEndpoint } = useStore(({ view }) => view);
|
|
6440
7171
|
const { selectFirstApi, selectPreSelectedApi, clearSelection } = useNodeSelection();
|
|
6441
7172
|
const hasInitializedRef = useRef(false);
|
|
6442
|
-
const { useBreakpoint
|
|
6443
|
-
const isMobile = !useBreakpoint
|
|
7173
|
+
const { useBreakpoint } = Grid;
|
|
7174
|
+
const isMobile = !useBreakpoint().md;
|
|
6444
7175
|
useEffect(() => {
|
|
6445
7176
|
return () => {
|
|
6446
7177
|
resetStore();
|
|
@@ -6482,11 +7213,11 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6482
7213
|
selectedApi,
|
|
6483
7214
|
selectFirstApi
|
|
6484
7215
|
]);
|
|
6485
|
-
const { cx, token
|
|
7216
|
+
const { cx, token } = useStyle("APIDocumentationLayout", (token, scope) => ({
|
|
6486
7217
|
[scope("documentation-container")]: {
|
|
6487
7218
|
display: "flex",
|
|
6488
7219
|
flexDirection: "column",
|
|
6489
|
-
gap: token
|
|
7220
|
+
gap: token.marginLG,
|
|
6490
7221
|
height: "100%",
|
|
6491
7222
|
overflowY: "auto"
|
|
6492
7223
|
},
|
|
@@ -6498,7 +7229,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6498
7229
|
display: "flex",
|
|
6499
7230
|
flexShrink: 0,
|
|
6500
7231
|
height: "auto",
|
|
6501
|
-
gap: token
|
|
7232
|
+
gap: token.marginLG,
|
|
6502
7233
|
width: "100%"
|
|
6503
7234
|
},
|
|
6504
7235
|
[".delete-tag-confirm-modal .ant-modal-container"]: {
|
|
@@ -6520,7 +7251,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6520
7251
|
fontSize: 16,
|
|
6521
7252
|
fontWeight: 400,
|
|
6522
7253
|
lineHeight: "24px",
|
|
6523
|
-
color: token
|
|
7254
|
+
color: token.colorText
|
|
6524
7255
|
},
|
|
6525
7256
|
[scope("deleteModalCloseBtn")]: {
|
|
6526
7257
|
position: "absolute",
|
|
@@ -6536,12 +7267,12 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6536
7267
|
border: "none",
|
|
6537
7268
|
background: "transparent",
|
|
6538
7269
|
padding: 0,
|
|
6539
|
-
color: token
|
|
7270
|
+
color: token.colorTextTertiary,
|
|
6540
7271
|
fontSize: 16,
|
|
6541
7272
|
lineHeight: 1,
|
|
6542
7273
|
"&:hover": {
|
|
6543
|
-
color: token
|
|
6544
|
-
backgroundColor: token
|
|
7274
|
+
color: token.colorText,
|
|
7275
|
+
backgroundColor: token.colorFillSecondary
|
|
6545
7276
|
}
|
|
6546
7277
|
},
|
|
6547
7278
|
[scope("deleteModalContent")]: {
|
|
@@ -6558,7 +7289,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6558
7289
|
fontSize: 14,
|
|
6559
7290
|
fontWeight: 400,
|
|
6560
7291
|
lineHeight: "22px",
|
|
6561
|
-
color: token
|
|
7292
|
+
color: token.colorText
|
|
6562
7293
|
},
|
|
6563
7294
|
[scope("deleteModalFooter")]: {
|
|
6564
7295
|
display: "flex",
|
|
@@ -6847,7 +7578,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6847
7578
|
style: {
|
|
6848
7579
|
display: "flex",
|
|
6849
7580
|
alignItems: "center",
|
|
6850
|
-
background: token
|
|
7581
|
+
background: token.colorBgLayout,
|
|
6851
7582
|
padding: "4px",
|
|
6852
7583
|
borderRadius: 8,
|
|
6853
7584
|
gap: 8
|
|
@@ -6862,12 +7593,12 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6862
7593
|
border: "none",
|
|
6863
7594
|
cursor: "pointer",
|
|
6864
7595
|
borderRadius: 8,
|
|
6865
|
-
fontFamily: token
|
|
6866
|
-
background: mode === "edit" ? token
|
|
7596
|
+
fontFamily: token.fontFamily,
|
|
7597
|
+
background: mode === "edit" ? token.colorBgContainer : "transparent",
|
|
6867
7598
|
boxShadow: mode === "edit" ? "0px 2px 4px -2px rgba(17,12,34,0.12)" : "none",
|
|
6868
7599
|
fontWeight: mode === "edit" ? 700 : 400,
|
|
6869
|
-
fontSize: mode === "edit" ? token
|
|
6870
|
-
color: token
|
|
7600
|
+
fontSize: mode === "edit" ? token.fontSize : token.fontSizeLG,
|
|
7601
|
+
color: token.colorText
|
|
6871
7602
|
},
|
|
6872
7603
|
children: [/* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }), "Edit"]
|
|
6873
7604
|
}), /* @__PURE__ */ jsxs("button", {
|
|
@@ -6880,12 +7611,12 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
6880
7611
|
border: "none",
|
|
6881
7612
|
cursor: "pointer",
|
|
6882
7613
|
borderRadius: 8,
|
|
6883
|
-
fontFamily: token
|
|
6884
|
-
background: mode === "view" ? token
|
|
7614
|
+
fontFamily: token.fontFamily,
|
|
7615
|
+
background: mode === "view" ? token.colorBgContainer : "transparent",
|
|
6885
7616
|
boxShadow: mode === "view" ? "0px 2px 4px -2px rgba(17,12,34,0.12)" : "none",
|
|
6886
7617
|
fontWeight: mode === "view" ? 700 : 400,
|
|
6887
|
-
fontSize: mode === "view" ? token
|
|
6888
|
-
color: token
|
|
7618
|
+
fontSize: mode === "view" ? token.fontSize : token.fontSizeLG,
|
|
7619
|
+
color: token.colorText
|
|
6889
7620
|
},
|
|
6890
7621
|
children: [/* @__PURE__ */ jsx(EyeOutlined, { style: { fontSize: 18 } }), "View"]
|
|
6891
7622
|
})]
|
|
@@ -7028,129 +7759,450 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
7028
7759
|
setHasChanges(true);
|
|
7029
7760
|
setBannerVisible(true);
|
|
7030
7761
|
},
|
|
7031
|
-
onDeleteResponseParameter: (endpointId, idx) => {
|
|
7032
|
-
setEndpointResponseParams((prev) => ({
|
|
7033
|
-
...prev,
|
|
7034
|
-
[endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
|
|
7035
|
-
}));
|
|
7036
|
-
setHasChanges(true);
|
|
7037
|
-
setBannerVisible(true);
|
|
7038
|
-
}
|
|
7039
|
-
}, resetKey)
|
|
7040
|
-
})
|
|
7041
|
-
] }) : /* @__PURE__ */ jsxs("div", {
|
|
7042
|
-
className: cx("docs-layout"),
|
|
7043
|
-
children: [
|
|
7044
|
-
/* @__PURE__ */ jsx(Sidebar, {
|
|
7045
|
-
searchValue,
|
|
7046
|
-
setSearchValue
|
|
7047
|
-
}),
|
|
7048
|
-
/* @__PURE__ */ jsx(MainContent, {
|
|
7049
|
-
handleVisitLandingPage: _handleVisitLandingPage,
|
|
7050
|
-
handleResetSearch,
|
|
7051
|
-
searchEnabled: !!searchValue
|
|
7052
|
-
}),
|
|
7053
|
-
!isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(
|
|
7054
|
-
]
|
|
7055
|
-
}),
|
|
7056
|
-
/* @__PURE__ */ jsx(AddTagDrawer, {
|
|
7057
|
-
open: tagDrawerState.open,
|
|
7058
|
-
mode: tagDrawerState.mode,
|
|
7059
|
-
initialValues: tagDrawerState.initialValues,
|
|
7060
|
-
onClose: () => setTagDrawerState({
|
|
7061
|
-
open: false,
|
|
7062
|
-
mode: "add"
|
|
7762
|
+
onDeleteResponseParameter: (endpointId, idx) => {
|
|
7763
|
+
setEndpointResponseParams((prev) => ({
|
|
7764
|
+
...prev,
|
|
7765
|
+
[endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
|
|
7766
|
+
}));
|
|
7767
|
+
setHasChanges(true);
|
|
7768
|
+
setBannerVisible(true);
|
|
7769
|
+
}
|
|
7770
|
+
}, resetKey)
|
|
7771
|
+
})
|
|
7772
|
+
] }) : /* @__PURE__ */ jsxs("div", {
|
|
7773
|
+
className: cx("docs-layout"),
|
|
7774
|
+
children: [
|
|
7775
|
+
/* @__PURE__ */ jsx(Sidebar, {
|
|
7776
|
+
searchValue,
|
|
7777
|
+
setSearchValue
|
|
7778
|
+
}),
|
|
7779
|
+
/* @__PURE__ */ jsx(MainContent, {
|
|
7780
|
+
handleVisitLandingPage: _handleVisitLandingPage,
|
|
7781
|
+
handleResetSearch,
|
|
7782
|
+
searchEnabled: !!searchValue
|
|
7783
|
+
}),
|
|
7784
|
+
!isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})
|
|
7785
|
+
]
|
|
7786
|
+
}),
|
|
7787
|
+
/* @__PURE__ */ jsx(AddTagDrawer, {
|
|
7788
|
+
open: tagDrawerState.open,
|
|
7789
|
+
mode: tagDrawerState.mode,
|
|
7790
|
+
initialValues: tagDrawerState.initialValues,
|
|
7791
|
+
onClose: () => setTagDrawerState({
|
|
7792
|
+
open: false,
|
|
7793
|
+
mode: "add"
|
|
7794
|
+
}),
|
|
7795
|
+
onAddTag: handleAddTag,
|
|
7796
|
+
onEditTag: handleUpdateTag
|
|
7797
|
+
}),
|
|
7798
|
+
/* @__PURE__ */ jsxs(Modal, {
|
|
7799
|
+
open: deleteTagModal.open,
|
|
7800
|
+
onCancel: () => setDeleteTagModal({
|
|
7801
|
+
open: false,
|
|
7802
|
+
tagName: ""
|
|
7803
|
+
}),
|
|
7804
|
+
centered: true,
|
|
7805
|
+
title: null,
|
|
7806
|
+
footer: null,
|
|
7807
|
+
closable: false,
|
|
7808
|
+
width: 520,
|
|
7809
|
+
className: "delete-tag-confirm-modal",
|
|
7810
|
+
styles: {
|
|
7811
|
+
content: {
|
|
7812
|
+
padding: 0,
|
|
7813
|
+
borderRadius: 8,
|
|
7814
|
+
overflow: "hidden"
|
|
7815
|
+
},
|
|
7816
|
+
body: {
|
|
7817
|
+
padding: 0,
|
|
7818
|
+
margin: 0
|
|
7819
|
+
}
|
|
7820
|
+
},
|
|
7821
|
+
children: [
|
|
7822
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7823
|
+
className: cx("deleteModalHead"),
|
|
7824
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
7825
|
+
className: cx("deleteModalTitle"),
|
|
7826
|
+
children: [
|
|
7827
|
+
"Delete ",
|
|
7828
|
+
deleteTagModal.tagName,
|
|
7829
|
+
" tag"
|
|
7830
|
+
]
|
|
7831
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
7832
|
+
className: cx("deleteModalCloseBtn"),
|
|
7833
|
+
onClick: () => setDeleteTagModal({
|
|
7834
|
+
open: false,
|
|
7835
|
+
tagName: ""
|
|
7836
|
+
}),
|
|
7837
|
+
"aria-label": "Close",
|
|
7838
|
+
children: "×"
|
|
7839
|
+
})]
|
|
7840
|
+
}),
|
|
7841
|
+
/* @__PURE__ */ jsx("div", {
|
|
7842
|
+
className: cx("deleteModalContent"),
|
|
7843
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
7844
|
+
className: cx("deleteModalContentText"),
|
|
7845
|
+
children: [
|
|
7846
|
+
"Are you sure you want to delete ",
|
|
7847
|
+
deleteTagModal.tagName,
|
|
7848
|
+
" tag?"
|
|
7849
|
+
]
|
|
7850
|
+
})
|
|
7851
|
+
}),
|
|
7852
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7853
|
+
className: cx("deleteModalFooter"),
|
|
7854
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
7855
|
+
size: "middle",
|
|
7856
|
+
onClick: () => setDeleteTagModal({
|
|
7857
|
+
open: false,
|
|
7858
|
+
tagName: ""
|
|
7859
|
+
}),
|
|
7860
|
+
style: {
|
|
7861
|
+
borderRadius: 8,
|
|
7862
|
+
height: 32,
|
|
7863
|
+
paddingInline: 15
|
|
7864
|
+
},
|
|
7865
|
+
children: "Cancel"
|
|
7866
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
7867
|
+
type: "primary",
|
|
7868
|
+
danger: true,
|
|
7869
|
+
size: "middle",
|
|
7870
|
+
onClick: handleDeleteTagConfirm,
|
|
7871
|
+
style: {
|
|
7872
|
+
borderRadius: 8,
|
|
7873
|
+
height: 32,
|
|
7874
|
+
paddingInline: 16
|
|
7875
|
+
},
|
|
7876
|
+
children: "Yes, Delete"
|
|
7877
|
+
})]
|
|
7878
|
+
})
|
|
7879
|
+
]
|
|
7880
|
+
})
|
|
7881
|
+
]
|
|
7882
|
+
});
|
|
7883
|
+
};
|
|
7884
|
+
//#endregion
|
|
7885
|
+
//#region src/view/components/EndpointPage/Codebox/Codebox.tsx
|
|
7886
|
+
Light.registerLanguage("json", json);
|
|
7887
|
+
const Codebox = ({ code, language }) => {
|
|
7888
|
+
const [theme] = useState("DARK");
|
|
7889
|
+
const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
|
|
7890
|
+
borderRadius: token.borderRadius,
|
|
7891
|
+
height: "100%",
|
|
7892
|
+
maxHeight: "100%",
|
|
7893
|
+
overflow: "auto",
|
|
7894
|
+
pre: { height: "100%" }
|
|
7895
|
+
} }));
|
|
7896
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7897
|
+
className: cx("codebox"),
|
|
7898
|
+
children: /* @__PURE__ */ jsx(Light, {
|
|
7899
|
+
language: language || "json",
|
|
7900
|
+
style: theme === "LIGHT" ? hljs.stackoverflowLight : hljs.stackoverflowDark,
|
|
7901
|
+
showLineNumbers: true,
|
|
7902
|
+
wrapLines: true,
|
|
7903
|
+
customStyle: {
|
|
7904
|
+
margin: 0,
|
|
7905
|
+
minHeight: "3rem",
|
|
7906
|
+
overflowY: "auto",
|
|
7907
|
+
padding: "0.75rem 1rem 0.75rem 1.5rem",
|
|
7908
|
+
backgroundColor: theme === "DARK" ? "#20264B" : "#20264B",
|
|
7909
|
+
fontSize: "0.75rem"
|
|
7910
|
+
},
|
|
7911
|
+
lineProps: { style: { fontFamily: "Cascadia Code, sans-serif" } },
|
|
7912
|
+
children: code
|
|
7913
|
+
})
|
|
7914
|
+
});
|
|
7915
|
+
};
|
|
7916
|
+
//#endregion
|
|
7917
|
+
//#region src/view/components/CodeboxSidebar.tsx
|
|
7918
|
+
function CodeboxSidebar() {
|
|
7919
|
+
const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
|
|
7920
|
+
const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
|
|
7921
|
+
value: code,
|
|
7922
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
7923
|
+
style: {
|
|
7924
|
+
display: "flex",
|
|
7925
|
+
alignItems: "center",
|
|
7926
|
+
gap: "0.5rem"
|
|
7927
|
+
},
|
|
7928
|
+
children: [/* @__PURE__ */ jsx("span", { style: {
|
|
7929
|
+
background: handleStatusColor(code),
|
|
7930
|
+
borderRadius: "50%",
|
|
7931
|
+
display: "inline-block",
|
|
7932
|
+
width: "0.5rem",
|
|
7933
|
+
height: "0.5rem",
|
|
7934
|
+
minWidth: "0.5rem",
|
|
7935
|
+
minHeight: "0.5rem"
|
|
7936
|
+
} }), code]
|
|
7937
|
+
})
|
|
7938
|
+
})), [statusCodeOptions]);
|
|
7939
|
+
const { originalData } = useStore(({ view }) => view);
|
|
7940
|
+
const [curlTooltip, setCurlTooltip] = useState("Copy Request");
|
|
7941
|
+
const findCurlForEndpoint = () => {
|
|
7942
|
+
if (!selectedEndpoint || !originalData) return "";
|
|
7943
|
+
const api = originalData.find((apiData) => {
|
|
7944
|
+
const paths = apiData.paths || {};
|
|
7945
|
+
return Object.keys(paths).some((path) => {
|
|
7946
|
+
const methods = paths[path] || {};
|
|
7947
|
+
return Object.keys(methods).some((method) => {
|
|
7948
|
+
const endpointMethod = method.toUpperCase();
|
|
7949
|
+
return path === selectedEndpoint.path && endpointMethod === selectedEndpoint.method;
|
|
7950
|
+
});
|
|
7951
|
+
});
|
|
7952
|
+
});
|
|
7953
|
+
if (!api || !api["x-curls"]) return "";
|
|
7954
|
+
const matchingCurls = api["x-curls"].filter((curlObj) => curlObj.path === selectedEndpoint.path && curlObj.method === selectedEndpoint.method);
|
|
7955
|
+
const sdbCurl = matchingCurls.find((curl) => curl.serverUrl.includes("sdb") || curl.serverUrl.includes("SDB"));
|
|
7956
|
+
return sdbCurl ? sdbCurl.curlCommand : matchingCurls[0]?.curlCommand || "";
|
|
7957
|
+
};
|
|
7958
|
+
const curlCommand = findCurlForEndpoint();
|
|
7959
|
+
const formatCurlCommand = (cmd) => {
|
|
7960
|
+
if (!cmd) return "";
|
|
7961
|
+
return cmd.replace(/ -X /g, " \\\n -X ").replace(/ -H /g, " \\\n -H ").replace(/ -d /g, " \\\n -d ").replace(/ (https?:\/\/[^\s'"]+)/g, " \\\n $1");
|
|
7962
|
+
};
|
|
7963
|
+
const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
|
|
7964
|
+
[scope("container")]: {
|
|
7965
|
+
display: "flex",
|
|
7966
|
+
flexDirection: "column",
|
|
7967
|
+
gap: token$1.marginMD,
|
|
7968
|
+
background: token$1.colorBgContainer,
|
|
7969
|
+
borderRadius: token$1.borderRadiusLG,
|
|
7970
|
+
padding: token$1.paddingLG,
|
|
7971
|
+
overflow: "hidden",
|
|
7972
|
+
height: "100%",
|
|
7973
|
+
maxHeight: "100%",
|
|
7974
|
+
width: "23.625rem",
|
|
7975
|
+
minWidth: "23.625rem",
|
|
7976
|
+
".ant-card-body": { padding: 0 },
|
|
7977
|
+
".ant-card-head-title": { color: "white" },
|
|
7978
|
+
".ant-card-head": { borderBottom: ".125rem solid #33419A" }
|
|
7979
|
+
},
|
|
7980
|
+
[scope("rightCard")]: {
|
|
7981
|
+
display: "flex",
|
|
7982
|
+
flexDirection: "column",
|
|
7983
|
+
backgroundColor: "#20264B",
|
|
7984
|
+
".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
|
|
7985
|
+
".isolated-card-body": {
|
|
7986
|
+
padding: " .125rem 0 0 0 !important",
|
|
7987
|
+
borderTop: ".125rem solid #33419A"
|
|
7988
|
+
},
|
|
7989
|
+
".ant-card-head": { flex: "0 0 auto" },
|
|
7990
|
+
borderRadius: token$1.borderRadius,
|
|
7991
|
+
overflow: "hidden"
|
|
7992
|
+
},
|
|
7993
|
+
[scope("rightCardRequest")]: {
|
|
7994
|
+
maxHeight: "50%",
|
|
7995
|
+
minHeight: "8.125rem"
|
|
7996
|
+
},
|
|
7997
|
+
[scope("rightCardResponse")]: {
|
|
7998
|
+
height: "fit-content",
|
|
7999
|
+
overflow: "hidden"
|
|
8000
|
+
},
|
|
8001
|
+
[scope("rightCardHeader")]: {
|
|
8002
|
+
display: "flex",
|
|
8003
|
+
alignItems: "center",
|
|
8004
|
+
justifyContent: "space-between",
|
|
8005
|
+
padding: `${token$1.marginXS}px ${token$1.margin}px`,
|
|
8006
|
+
borderBottom: ".125rem solid #33419A",
|
|
8007
|
+
height: "3.125rem"
|
|
8008
|
+
},
|
|
8009
|
+
[scope("rightCardFlex")]: {
|
|
8010
|
+
display: "flex",
|
|
8011
|
+
flexDirection: "column",
|
|
8012
|
+
height: "fit-content",
|
|
8013
|
+
overflow: "auto",
|
|
8014
|
+
backgroundColor: "#20264B",
|
|
8015
|
+
".ant-card-head": { flex: "0 0 auto" },
|
|
8016
|
+
".ant-card-body": {
|
|
8017
|
+
flex: "1 1 auto",
|
|
8018
|
+
overflowY: "auto",
|
|
8019
|
+
padding: ".125rem 0 0 0 !important"
|
|
8020
|
+
},
|
|
8021
|
+
".isolated-card-body": {
|
|
8022
|
+
padding: " .125rem 0 0 0 !important",
|
|
8023
|
+
height: "fit-content",
|
|
8024
|
+
overflow: "auto",
|
|
8025
|
+
borderTop: ".125rem solid #33419A",
|
|
8026
|
+
".codebox": {
|
|
8027
|
+
height: "fit-content",
|
|
8028
|
+
overflow: "auto"
|
|
8029
|
+
}
|
|
8030
|
+
}
|
|
8031
|
+
},
|
|
8032
|
+
[scope("customSelect")]: {
|
|
8033
|
+
width: "5.5rem",
|
|
8034
|
+
maxWidth: "5.5rem",
|
|
8035
|
+
".ant-select-selector": {
|
|
8036
|
+
backgroundColor: "#fff",
|
|
8037
|
+
borderColor: "#fff",
|
|
8038
|
+
borderRadius: ".375rem",
|
|
8039
|
+
color: "#101010"
|
|
8040
|
+
},
|
|
8041
|
+
".ant-select-selection-item": {
|
|
8042
|
+
color: "#101010",
|
|
8043
|
+
fontWeight: 400
|
|
8044
|
+
},
|
|
8045
|
+
".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
|
|
8046
|
+
".ant-select-arrow": { color: "#101010" },
|
|
8047
|
+
"&:hover .ant-select-selector": {
|
|
8048
|
+
borderColor: `${token["brnadColor.7"]}`,
|
|
8049
|
+
color: "white"
|
|
8050
|
+
},
|
|
8051
|
+
"&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
|
|
8052
|
+
borderColor: `${token["brnadColor.7"]}`,
|
|
8053
|
+
color: "white"
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
}));
|
|
8057
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8058
|
+
className: cx("container"),
|
|
8059
|
+
children: [curlCommand && /* @__PURE__ */ jsxs("div", {
|
|
8060
|
+
className: cx("rightCard", "rightCardRequest"),
|
|
8061
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8062
|
+
className: cx("rightCardHeader"),
|
|
8063
|
+
children: [/* @__PURE__ */ jsx(Typography.Text, {
|
|
8064
|
+
strong: true,
|
|
8065
|
+
style: { color: "#fff" },
|
|
8066
|
+
children: "Request"
|
|
8067
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
8068
|
+
title: curlTooltip,
|
|
8069
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
8070
|
+
color: "default",
|
|
8071
|
+
variant: "link",
|
|
8072
|
+
className: cx("copyButton"),
|
|
8073
|
+
onClick: () => {
|
|
8074
|
+
const cleaned = curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\");
|
|
8075
|
+
navigator.clipboard.writeText(formatCurlCommand(cleaned));
|
|
8076
|
+
setCurlTooltip("Copied!");
|
|
8077
|
+
setTimeout(() => setCurlTooltip("Copy cURL"), 1500);
|
|
8078
|
+
},
|
|
8079
|
+
icon: /* @__PURE__ */ jsx(Copy, { style: { color: "white" } })
|
|
8080
|
+
})
|
|
8081
|
+
})]
|
|
8082
|
+
}), /* @__PURE__ */ jsx(Codebox, {
|
|
8083
|
+
language: "bash",
|
|
8084
|
+
code: formatCurlCommand(curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\"))
|
|
8085
|
+
})]
|
|
8086
|
+
}), selectedEndpoint?.responses && httpStatusOptions.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
8087
|
+
className: cx("rightCard", "rightCardResponse"),
|
|
8088
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8089
|
+
className: cx("rightCardHeader", "rightCardHeaderResponse"),
|
|
8090
|
+
children: [/* @__PURE__ */ jsx(Typography.Text, {
|
|
8091
|
+
strong: true,
|
|
8092
|
+
style: { color: "#fff" },
|
|
8093
|
+
children: "Response"
|
|
8094
|
+
}), /* @__PURE__ */ jsx(Select, {
|
|
8095
|
+
defaultActiveFirstOption: true,
|
|
8096
|
+
defaultValue: 200,
|
|
8097
|
+
className: cx("customSelect"),
|
|
8098
|
+
prefix: false,
|
|
8099
|
+
style: { width: "100%" },
|
|
8100
|
+
value: selectedStatusCode,
|
|
8101
|
+
onChange: setSelectedStatusCode,
|
|
8102
|
+
options: httpStatusOptions,
|
|
8103
|
+
open: httpStatusOptions.length === 1 ? false : void 0,
|
|
8104
|
+
suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
|
|
8105
|
+
})]
|
|
8106
|
+
}), /* @__PURE__ */ jsx(Codebox, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
|
|
8107
|
+
})]
|
|
8108
|
+
});
|
|
8109
|
+
}
|
|
8110
|
+
//#endregion
|
|
8111
|
+
//#region src/view/devportal-layout.tsx
|
|
8112
|
+
const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage }) => {
|
|
8113
|
+
const [searchValue, setSearchValue] = useState("");
|
|
8114
|
+
const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys } = useStore(({ view }) => view);
|
|
8115
|
+
const { selectFirstApi, selectPreSelectedApi, clearSelection } = useNodeSelection();
|
|
8116
|
+
const hasInitializedRef = useRef(false);
|
|
8117
|
+
useEffect(() => {
|
|
8118
|
+
return () => {
|
|
8119
|
+
resetStore();
|
|
8120
|
+
};
|
|
8121
|
+
}, []);
|
|
8122
|
+
const resetStore = () => {
|
|
8123
|
+
setExpandedKeys([]);
|
|
8124
|
+
setFocusedContent(null);
|
|
8125
|
+
setBuiltTreeData([]);
|
|
8126
|
+
setTransformedData([]);
|
|
8127
|
+
setOriginalData([]);
|
|
8128
|
+
setSearchValue("");
|
|
8129
|
+
clearSelection();
|
|
8130
|
+
hasInitializedRef.current = false;
|
|
8131
|
+
};
|
|
8132
|
+
useEffect(() => {
|
|
8133
|
+
if (!hasInitializedRef.current && data.length > 0) {
|
|
8134
|
+
setOriginalData(data);
|
|
8135
|
+
const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
|
|
8136
|
+
setTransformedData(transformedData);
|
|
8137
|
+
setBuiltTreeData(buildTreeDataStructure$1(transformedData));
|
|
8138
|
+
hasInitializedRef.current = true;
|
|
8139
|
+
}
|
|
8140
|
+
}, [
|
|
8141
|
+
data,
|
|
8142
|
+
setOriginalData,
|
|
8143
|
+
setTransformedData,
|
|
8144
|
+
setBuiltTreeData
|
|
8145
|
+
]);
|
|
8146
|
+
useEffect(() => {
|
|
8147
|
+
if (builtTreeData && builtTreeData.length > 0 && !selectedApi && !selectedNodeKey && hasInitializedRef.current) {
|
|
8148
|
+
if (!preSelectedApi) selectFirstApi(builtTreeData);
|
|
8149
|
+
else selectPreSelectedApi(builtTreeData, preSelectedApi);
|
|
8150
|
+
hasInitializedRef.current = false;
|
|
8151
|
+
}
|
|
8152
|
+
}, [
|
|
8153
|
+
builtTreeData,
|
|
8154
|
+
selectedNodeKey,
|
|
8155
|
+
selectedApi,
|
|
8156
|
+
selectFirstApi
|
|
8157
|
+
]);
|
|
8158
|
+
const { cx } = useStyle("APIDocumentationLayout", (token, scope) => ({
|
|
8159
|
+
[scope("documentation-container")]: {
|
|
8160
|
+
display: "flex",
|
|
8161
|
+
flexDirection: "column",
|
|
8162
|
+
gap: token.marginLG,
|
|
8163
|
+
height: "100%",
|
|
8164
|
+
maxHeight: "100%",
|
|
8165
|
+
overflow: "hidden"
|
|
8166
|
+
},
|
|
8167
|
+
[scope("docs-layout")]: {
|
|
8168
|
+
display: "flex",
|
|
8169
|
+
height: "100%",
|
|
8170
|
+
maxHeight: "100%",
|
|
8171
|
+
overflow: "hidden",
|
|
8172
|
+
gap: token.marginLG,
|
|
8173
|
+
width: "100%"
|
|
8174
|
+
}
|
|
8175
|
+
}));
|
|
8176
|
+
const handleResetSearch = () => {
|
|
8177
|
+
setSearchValue("");
|
|
8178
|
+
};
|
|
8179
|
+
const _handleVisitLandingPage = () => {
|
|
8180
|
+
if (handleVisitLandingPage) {
|
|
8181
|
+
handleVisitLandingPage();
|
|
8182
|
+
return;
|
|
8183
|
+
}
|
|
8184
|
+
window.location.pathname = "/";
|
|
8185
|
+
};
|
|
8186
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8187
|
+
className: cx("documentation-container"),
|
|
8188
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
8189
|
+
className: cx("docs-layout"),
|
|
8190
|
+
children: [
|
|
8191
|
+
/* @__PURE__ */ jsx(Sidebar$1, {
|
|
8192
|
+
searchValue,
|
|
8193
|
+
setSearchValue
|
|
7063
8194
|
}),
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
open: deleteTagModal.open,
|
|
7069
|
-
onCancel: () => setDeleteTagModal({
|
|
7070
|
-
open: false,
|
|
7071
|
-
tagName: ""
|
|
8195
|
+
/* @__PURE__ */ jsx(MainContent$1, {
|
|
8196
|
+
handleVisitLandingPage: _handleVisitLandingPage,
|
|
8197
|
+
handleResetSearch,
|
|
8198
|
+
searchEnabled: !!searchValue
|
|
7072
8199
|
}),
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
closable: false,
|
|
7077
|
-
width: 520,
|
|
7078
|
-
className: "delete-tag-confirm-modal",
|
|
7079
|
-
styles: {
|
|
7080
|
-
content: {
|
|
7081
|
-
padding: 0,
|
|
7082
|
-
borderRadius: 8,
|
|
7083
|
-
overflow: "hidden"
|
|
7084
|
-
},
|
|
7085
|
-
body: {
|
|
7086
|
-
padding: 0,
|
|
7087
|
-
margin: 0
|
|
7088
|
-
}
|
|
7089
|
-
},
|
|
7090
|
-
children: [
|
|
7091
|
-
/* @__PURE__ */ jsxs("div", {
|
|
7092
|
-
className: cx("deleteModalHead"),
|
|
7093
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
7094
|
-
className: cx("deleteModalTitle"),
|
|
7095
|
-
children: [
|
|
7096
|
-
"Delete ",
|
|
7097
|
-
deleteTagModal.tagName,
|
|
7098
|
-
" tag"
|
|
7099
|
-
]
|
|
7100
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
7101
|
-
className: cx("deleteModalCloseBtn"),
|
|
7102
|
-
onClick: () => setDeleteTagModal({
|
|
7103
|
-
open: false,
|
|
7104
|
-
tagName: ""
|
|
7105
|
-
}),
|
|
7106
|
-
"aria-label": "Close",
|
|
7107
|
-
children: "×"
|
|
7108
|
-
})]
|
|
7109
|
-
}),
|
|
7110
|
-
/* @__PURE__ */ jsx("div", {
|
|
7111
|
-
className: cx("deleteModalContent"),
|
|
7112
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
7113
|
-
className: cx("deleteModalContentText"),
|
|
7114
|
-
children: [
|
|
7115
|
-
"Are you sure you want to delete ",
|
|
7116
|
-
deleteTagModal.tagName,
|
|
7117
|
-
" tag?"
|
|
7118
|
-
]
|
|
7119
|
-
})
|
|
7120
|
-
}),
|
|
7121
|
-
/* @__PURE__ */ jsxs("div", {
|
|
7122
|
-
className: cx("deleteModalFooter"),
|
|
7123
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
7124
|
-
size: "middle",
|
|
7125
|
-
onClick: () => setDeleteTagModal({
|
|
7126
|
-
open: false,
|
|
7127
|
-
tagName: ""
|
|
7128
|
-
}),
|
|
7129
|
-
style: {
|
|
7130
|
-
borderRadius: 8,
|
|
7131
|
-
height: 32,
|
|
7132
|
-
paddingInline: 15
|
|
7133
|
-
},
|
|
7134
|
-
children: "Cancel"
|
|
7135
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
7136
|
-
type: "primary",
|
|
7137
|
-
danger: true,
|
|
7138
|
-
size: "middle",
|
|
7139
|
-
onClick: handleDeleteTagConfirm,
|
|
7140
|
-
style: {
|
|
7141
|
-
borderRadius: 8,
|
|
7142
|
-
height: 32,
|
|
7143
|
-
paddingInline: 16
|
|
7144
|
-
},
|
|
7145
|
-
children: "Yes, Delete"
|
|
7146
|
-
})]
|
|
7147
|
-
})
|
|
7148
|
-
]
|
|
7149
|
-
})
|
|
7150
|
-
]
|
|
8200
|
+
focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar, {})
|
|
8201
|
+
]
|
|
8202
|
+
})
|
|
7151
8203
|
});
|
|
7152
8204
|
};
|
|
7153
|
-
|
|
7154
8205
|
//#endregion
|
|
7155
|
-
export { ApiDocumentationBar, DocumentationLayout, useStore };
|
|
7156
|
-
|
|
8206
|
+
export { ApiDocumentationBar, ConsoleDocumentationLayout, DocumentationLayout, useStore };
|
|
8207
|
+
|
|
8208
|
+
//# sourceMappingURL=index.mjs.map
|