@digi-frontend/dgate-api-documentation 1.4.97 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +333 -0
  2. package/dist/index.cjs +983 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +793 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.ts +792 -8
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +951 -43
  9. package/dist/index.js.map +1 -1
  10. package/package.json +53 -70
  11. package/dist/index.css +0 -12
  12. package/dist/index.css.map +0 -1
  13. package/dist/index.d.mts +0 -9
  14. package/dist/index.mjs +0 -25
  15. package/dist/index.mjs.map +0 -1
  16. package/src/components/Chips/style.scss +0 -147
  17. package/src/components/InfoForm/InfoForm.module.scss +0 -165
  18. package/src/components/JsonInput/style.module.scss +0 -133
  19. package/src/components/LivePreview/LivePreview.module.scss +0 -181
  20. package/src/components/MethodAccordion/MethodAccordion.module.scss +0 -399
  21. package/src/components/SectionHead/SectionHead.scss +0 -29
  22. package/src/components/SimpleLabelValue/style.scss +0 -30
  23. package/src/components/Tooltip/Tooltip.scss +0 -133
  24. package/src/components/_global.scss +0 -338
  25. package/src/components/dialog/style.scss +0 -188
  26. package/src/components/table/style.scss +0 -223
  27. package/src/layout/docsComponents/Codebox/style.module.scss +0 -43
  28. package/src/layout/docsComponents/DocsAside/style.module.scss +0 -113
  29. package/src/layout/docsComponents/DocsContent/EndpointPage/style.scss +0 -382
  30. package/src/layout/docsComponents/DocsContent/OverviewPage/style.scss +0 -332
  31. package/src/layout/docsComponents/DocsContent/style.scss +0 -0
  32. package/src/layout/docsComponents/DocsHeader/DocsHeader.module.scss +0 -297
  33. package/src/layout/docsComponents/DocsSideMenuTree/style.scss +0 -202
  34. package/src/layout/docsComponents/index.scss +0 -49
  35. package/src/test.scss +0 -3
  36. package/src/test2.module.scss +0 -5
package/dist/index.js CHANGED
@@ -1,52 +1,960 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/index.ts
20
- var index_exports = {};
21
- __export(index_exports, {
22
- Test: () => test_default,
23
- Test2: () => test2_default
1
+ import { create } from "zustand";
2
+ import { devtools } from "zustand/middleware";
3
+ import { immer } from "zustand/middleware/immer";
4
+ import * as React$1 from "react";
5
+ import { useEffect, useMemo, useState } from "react";
6
+ import { Button, Input, Layout, Tag, Tree, Typography, theme } from "antd";
7
+ import { useStyleRegister } from "@ant-design/cssinjs";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { nanoid } from "nanoid";
10
+ import { AntdRegistry } from "@ant-design/nextjs-registry";
11
+
12
+ //#region src/store/slices/view.ts
13
+ const createViewSlice = (set) => ({ view: {
14
+ selectedNodeKey: null,
15
+ expandedKeys: ["custom-auth", "api-name-01"],
16
+ originalData: null,
17
+ transformedData: null,
18
+ selectedApi: null,
19
+ selectedEndpoint: null,
20
+ setSelectedNode: (key) => set((state) => {
21
+ state.view.selectedNodeKey = key;
22
+ }),
23
+ setExpandedKeys: (keys) => set((state) => {
24
+ state.view.expandedKeys = keys;
25
+ }),
26
+ setOriginalData: (data) => set((state) => {
27
+ state.view.originalData = data;
28
+ }),
29
+ setSelectedApi: (api) => set((state) => {
30
+ state.view.selectedApi = api;
31
+ }),
32
+ setSelectedEndpoint: (endpoint) => set((state) => {
33
+ state.view.selectedEndpoint = endpoint;
34
+ }),
35
+ setTransformedData: (data) => set((state) => {
36
+ state.view.transformedData = data;
37
+ })
38
+ } });
39
+
40
+ //#endregion
41
+ //#region src/store/slices/editor.ts
42
+ const createEditorSlice = (set) => ({ editor: {
43
+ content: "",
44
+ isEditing: false,
45
+ hasUnsavedChanges: false,
46
+ fontSize: 14,
47
+ theme: "vs-light",
48
+ wordWrap: true,
49
+ lineNumbers: true,
50
+ cursorPosition: {
51
+ line: 1,
52
+ column: 1
53
+ },
54
+ setContent: (content) => set((state) => {
55
+ state.content = content;
56
+ state.hasUnsavedChanges = true;
57
+ }),
58
+ setIsEditing: (editing) => set((state) => {
59
+ state.isEditing = editing;
60
+ }),
61
+ setFontSize: (size) => set((state) => {
62
+ state.fontSize = Math.max(10, Math.min(24, size));
63
+ }),
64
+ setEditorTheme: (theme$1) => set((state) => {
65
+ state.theme = theme$1;
66
+ }),
67
+ toggleWordWrap: () => set((state) => {
68
+ state.wordWrap = !state.wordWrap;
69
+ }),
70
+ toggleLineNumbers: () => set((state) => {
71
+ state.lineNumbers = !state.lineNumbers;
72
+ }),
73
+ setCursorPosition: (position) => set((state) => {
74
+ state.cursorPosition = position;
75
+ }),
76
+ saveContent: () => set((state) => {
77
+ state.hasUnsavedChanges = false;
78
+ }),
79
+ resetContent: () => set((state) => {
80
+ state.content = "";
81
+ state.hasUnsavedChanges = false;
82
+ state.isEditing = false;
83
+ })
84
+ } });
85
+
86
+ //#endregion
87
+ //#region src/store/index.ts
88
+ const createStore = (set) => ({
89
+ ...createViewSlice(set),
90
+ ...createEditorSlice(set)
24
91
  });
25
- module.exports = __toCommonJS(index_exports);
92
+ const useStore = create()(devtools(immer(createStore), { name: "dgate-docs-store" }));
93
+ var store_default = useStore;
26
94
 
27
- // src/test.tsx
28
- var import_antd = require("antd");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- function Test({ text = "Hello World" }) {
31
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { children: text }) });
95
+ //#endregion
96
+ //#region src/hooks/useStyle.ts
97
+ function useStyle(componentName, stylesFn) {
98
+ const { token: token$1, theme: theme$1, hashId } = theme.useToken();
99
+ const scope = (className) => `.${hashId}.${componentName}-${className}`;
100
+ const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId}`).join(" ");
101
+ const wrapSSR = useStyleRegister({
102
+ theme: theme$1,
103
+ token: token$1,
104
+ path: [componentName]
105
+ }, () => stylesFn(token$1, scope));
106
+ return {
107
+ wrapSSR,
108
+ cx,
109
+ scope,
110
+ token: token$1,
111
+ hashId
112
+ };
32
113
  }
33
- var test_default = Test;
34
114
 
35
- // src/test2.module.scss
36
- var test2_module_default = {
37
- "test2Alert": "_test2Alert_1m8px_1"
115
+ //#endregion
116
+ //#region src/view/components/Header.tsx
117
+ const { Header: AntHeader } = Layout;
118
+ const Header = () => {
119
+ const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({ [scope("header")]: {
120
+ width: "100%",
121
+ height: "4rem",
122
+ backgroundColor: token$1.colorBgContainer
123
+ } }));
124
+ return wrapSSR(/* @__PURE__ */ jsx(AntHeader, { className: cx("header") }));
38
125
  };
39
126
 
40
- // src/test2.tsx
41
- var import_antd2 = require("antd");
42
- var import_jsx_runtime2 = require("react/jsx-runtime");
43
- function Test2() {
44
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Alert, { message: "Hello World", type: "info", className: test2_module_default.test2Alert });
127
+ //#endregion
128
+ //#region src/assets/Minify.svg
129
+ var _path;
130
+ function _extends() {
131
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
132
+ for (var e = 1; e < arguments.length; e++) {
133
+ var t = arguments[e];
134
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
135
+ }
136
+ return n;
137
+ }, _extends.apply(null, arguments);
45
138
  }
46
- var test2_default = Test2;
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- Test,
50
- Test2
139
+ var SvgMinify = function SvgMinify$1(props) {
140
+ return /* @__PURE__ */ React$1.createElement("svg", _extends({
141
+ xmlns: "http://www.w3.org/2000/svg",
142
+ width: 16,
143
+ height: 16,
144
+ fill: "none"
145
+ }, props), _path || (_path = /* @__PURE__ */ React$1.createElement("path", {
146
+ stroke: "currentcolor",
147
+ d: "m6 11.334 2-2 2 2M6 4.666l2 2 2-2"
148
+ })));
149
+ };
150
+ var Minify_default = SvgMinify;
151
+
152
+ //#endregion
153
+ //#region src/theme/light.json
154
+ var token = {
155
+ "brnadColor.1": "#f1f5fd",
156
+ "brnadColor.2": "#e0e9f9",
157
+ "brnadColor.3": "#c8d8f5",
158
+ "brnadColor.4": "#a2bfee",
159
+ "brnadColor.5": "#769de4",
160
+ "brnadColor.6": "#4d75d9",
161
+ "brnadColor.7": "#4261ce",
162
+ "brnadColor.8": "#384fbd",
163
+ "brnadColor.9": "#33419a",
164
+ "brnadColor.10": "#20264b",
165
+ "cyan.1": "#e6fffb",
166
+ "cyan.2": "#b5f5ec",
167
+ "cyan.3": "#87e8de",
168
+ "cyan.4": "#5cdbd3",
169
+ "cyan.5": "#36cfc9",
170
+ "cyan.6": "#13c2c2",
171
+ "cyan.7": "#08979c",
172
+ "cyan.8": "#006d75",
173
+ "cyan.9": "#00474f",
174
+ "cyan.10": "#002329",
175
+ "geekblue.1": "#f0f5ff",
176
+ "geekblue.2": "#d6e4ff",
177
+ "geekblue.3": "#adc6ff",
178
+ "geekblue.4": "#85a5ff",
179
+ "geekblue.5": "#597ef7",
180
+ "geekblue.6": "#2f54eb",
181
+ "geekblue.7": "#1d39c4",
182
+ "geekblue.8": "#10239e",
183
+ "geekblue.9": "#061178",
184
+ "geekblue.10": "#030852",
185
+ "gold.1": "#fffbe6",
186
+ "gold.2": "#fff1b8",
187
+ "gold.3": "#ffe58f",
188
+ "gold.4": "#ffd666",
189
+ "gold.5": "#ffc53d",
190
+ "gold.6": "#faad14",
191
+ "gold.7": "#d48806",
192
+ "gold.8": "#ad6800",
193
+ "gold.9": "#874d00",
194
+ "gold.10": "#613400",
195
+ "green.1": "#f6ffed",
196
+ "green.2": "#d9f7be",
197
+ "green.3": "#b7eb8f",
198
+ "green.4": "#95de64",
199
+ "green.5": "#73d13d",
200
+ "green.6": "#52c41a",
201
+ "green.7": "#389e0d",
202
+ "green.8": "#237804",
203
+ "green.9": "#135200",
204
+ "green.10": "#092b00",
205
+ "lime.1": "#fcffe6",
206
+ "lime.2": "#f4ffb8",
207
+ "lime.3": "#eaff8f",
208
+ "lime.4": "#d3f261",
209
+ "lime.5": "#bae637",
210
+ "lime.6": "#a0d911",
211
+ "lime.7": "#7cb305",
212
+ "lime.8": "#5b8c00",
213
+ "lime.9": "#3f6600",
214
+ "lime.10": "#254000",
215
+ "magenta.1": "#fff0f6",
216
+ "magenta.2": "#ffd6e7",
217
+ "magenta.3": "#ffadd2",
218
+ "magenta.4": "#ff85c0",
219
+ "magenta.5": "#f759ab",
220
+ "magenta.6": "#eb2f96",
221
+ "magenta.7": "#c41d7f",
222
+ "magenta.8": "#9e1068",
223
+ "magenta.9": "#780650",
224
+ "magenta.10": "#520339",
225
+ "orange.1": "#fff7e6",
226
+ "orange.2": "#ffe7ba",
227
+ "orange.3": "#ffd591",
228
+ "orange.4": "#ffc069",
229
+ "colorText": "rgba(0, 0, 0, 0.88)",
230
+ "colorTextSecondary": "rgba(0, 0, 0, 0.65)",
231
+ "orange.5": "#ffa940",
232
+ "colorTextTertiary": "rgba(0, 0, 0, 0.45)",
233
+ "colorTextQuaternary": "rgba(0, 0, 0, 0.25)",
234
+ "orange.6": "#fa8c16",
235
+ "orange.7": "#d46b08",
236
+ "colorTextLightSolid": "#ffffff",
237
+ "colorTextHeading": "rgba(0, 0, 0, 0.88)",
238
+ "colorTextLabel": "rgba(0, 0, 0, 0.65)",
239
+ "orange.8": "#ad4e00",
240
+ "colorTextDescription": "rgba(0, 0, 0, 0.45)",
241
+ "orange.9": "#873800",
242
+ "colorTextDisabled": "rgba(0, 0, 0, 0.25)",
243
+ "orange.10": "#612500",
244
+ "purple.1": "#f9f0ff",
245
+ "purple.2": "#efdbff",
246
+ "purple.3": "#d3adf7",
247
+ "colorTextPlaceholder": "rgba(0, 0, 0, 0.25)",
248
+ "colorIcon": "rgba(0, 0, 0, 0.45)",
249
+ "purple.4": "#b37feb",
250
+ "colorIconHover": "rgba(0, 0, 0, 0.88)",
251
+ "colorBgContainer": "#ffffff",
252
+ "purple.5": "#9254de",
253
+ "colorBgElevated": "#ffffff",
254
+ "purple.6": "#722ed1",
255
+ "colorBgLayout": "#f5f5f5",
256
+ "purple.7": "#531dab",
257
+ "colorBgMask": "rgba(0, 0, 0, 0.45)",
258
+ "purple.8": "#391085",
259
+ "colorBgSpotlight": "rgba(0, 0, 0, 0.85)",
260
+ "purple.9": "#22075e",
261
+ "colorBorder": "#d9d9d9",
262
+ "purple.10": "#120338",
263
+ "colorBorderSecondary": "#f0f0f0",
264
+ "red.1": "#fff1f0",
265
+ "colorFill": "rgba(0, 0, 0, 0.15)",
266
+ "red.2": "#ffccc7",
267
+ "colorFillSecondary": "rgba(0, 0, 0, 0.06)",
268
+ "colorFillTertiary": "rgba(0, 0, 0, 0.04)",
269
+ "colorFillQuaternary": "rgba(0, 0, 0, 0.02)",
270
+ "red.3": "#ffa39e",
271
+ "red.4": "#ff7875",
272
+ "colorWhite": "#ffffff",
273
+ "red.5": "#ff4d4f",
274
+ "colorBgBase": "#ffffff",
275
+ "red.6": "#f5222d",
276
+ "colorTextBase": "#000000",
277
+ "red.7": "#cf1322",
278
+ "red.8": "#a8071a",
279
+ "colorBgContainerDisabled": "rgba(0, 0, 0, 0.04)",
280
+ "red.9": "#820014",
281
+ "colorBgTextActive": "rgba(0, 0, 0, 0.15)",
282
+ "red.10": "#5c0011",
283
+ "colorBgTextHover": "rgba(0, 0, 0, 0.06)",
284
+ "volcano.1": "#fff2e8",
285
+ "colorBorderBg": "#ffffff",
286
+ "volcano.2": "#ffd8bf",
287
+ "colorFillContent": "rgba(0, 0, 0, 0.06)",
288
+ "volcano.3": "#ffbb96",
289
+ "colorFillContentHover": "rgba(0, 0, 0, 0.15)",
290
+ "volcano.4": "#ff9c6e",
291
+ "colorFillAlter": "rgba(0, 0, 0, 0.02)",
292
+ "volcano.5": "#ff7a45",
293
+ "volcano.6": "#fa541c",
294
+ "volcano.7": "#d4380d",
295
+ "transparent": "rgba(0, 0, 0, 0)",
296
+ "colorSplit": "rgba(0, 0, 0, 0.06)",
297
+ "yellow.1": "#feffe6",
298
+ "volcano.8": "#ad2102",
299
+ "yellow.2": "#ffffb8",
300
+ "yellow.3": "#fffb8f",
301
+ "volcano.9": "#871400",
302
+ "yellow.4": "#fff566",
303
+ "volcano.10": "#610b00",
304
+ "yellow.5": "#ffec3d",
305
+ "yellow.6": "#fadb14",
306
+ "yellow.7": "#d4b106",
307
+ "yellow.8": "#ad8b00",
308
+ "yellow.9": "#876800",
309
+ "yellow.10": "#614700",
310
+ "colorPrimary": "#4d75d9",
311
+ "colorSuccess": "#52c41a",
312
+ "colorWarning": "#faad14",
313
+ "colorInfo": "#4d75d9",
314
+ "colorError": "#ff4d4f",
315
+ "colorLink": "#4d75d9",
316
+ "colorErrorBg": "#fff2f0",
317
+ "colorErrorBgHover": "#fff1f0",
318
+ "colorErrorBorder": "#ffccc7",
319
+ "colorErrorBorderHover": "#ffa39e",
320
+ "colorErrorHover": "#ff7875",
321
+ "colorErrorActive": "#d9363e",
322
+ "colorErrorTextHover": "#ff7875",
323
+ "colorErrorText": "#ff4d4f",
324
+ "colorErrorTextActive": "#d9363e",
325
+ "colorLinkHover": "#769de4",
326
+ "colorInfoBg": "#f1f5fd",
327
+ "colorInfoBgHover": "#e0e9f9",
328
+ "colorInfoBorder": "#c8d8f5",
329
+ "colorInfoBorderHover": "#a2bfee",
330
+ "colorInfoHover": "#769de4",
331
+ "colorInfoActive": "#4261ce",
332
+ "colorInfoTextHover": "#769de4",
333
+ "colorInfoText": "#4d75d9",
334
+ "colorInfoTextActive": "#4261ce",
335
+ "colorLinkActive": "#4261ce",
336
+ "colorPrimaryBg": "#f1f5fd",
337
+ "colorPrimaryBgHover": "#e0e9f9",
338
+ "colorPrimaryBorder": "#c8d8f5",
339
+ "colorPrimaryBorderHover": "#a2bfee",
340
+ "colorPrimaryHover": "#769de4",
341
+ "colorPrimaryActive": "#4261ce",
342
+ "colorPrimaryTextHover": "#769de4",
343
+ "colorPrimaryText": "#4d75d9",
344
+ "colorPrimaryTextActive": "#4261ce",
345
+ "colorSuccessBg": "#f6ffed",
346
+ "colorSuccessBgHover": "#d9f7be",
347
+ "colorSuccessBorder": "#b7eb8f",
348
+ "colorSuccessBorderHover": "#95de64",
349
+ "colorSuccessHover": "#95de64",
350
+ "colorSuccessActive": "#389e0d",
351
+ "colorSuccessTextHover": "#73d13d",
352
+ "colorSuccessText": "#52c41a",
353
+ "colorSuccessTextActive": "#389e0d",
354
+ "colorWarningBg": "#fffbe6",
355
+ "colorWarningBgHover": "#fff1b8",
356
+ "colorWarningBorder": "#ffe58f",
357
+ "colorWarningBorderHover": "#ffd666",
358
+ "colorWarningHover": "#ffd666",
359
+ "colorWarningActive": "#d48806",
360
+ "colorWarningTextHover": "#ffc53d",
361
+ "colorWarningText": "#faad14",
362
+ "colorWarningTextActive": "#d48806",
363
+ "colorErrorOutline": "rgba(255, 38, 6, 0.06)",
364
+ "colorWarningOutline": "rgba(255, 215, 5, 0.1)",
365
+ "controlItemBgActive": "#f1f5fd",
366
+ "controlItemBgActiveDisabled": "rgba(0, 0, 0, 0.15)",
367
+ "controlItemBgActiveHover": "#e0e9f9",
368
+ "controlItemBgHover": "rgba(0, 0, 0, 0.04)",
369
+ "controlOutline": "rgba(5, 145, 255, 0.1)",
370
+ "controlTmpOutline": "rgba(0, 0, 0, 0.02)",
371
+ "borderRadius": 6,
372
+ "borderRadiusLG": 8,
373
+ "borderRadiusSM": 4,
374
+ "borderRadiusXS": 2,
375
+ "sizeStep": 4,
376
+ "sizeUnit": 4,
377
+ "controlInteractiveSize": 16,
378
+ "size": 16,
379
+ "sizeLG": 24,
380
+ "sizeMD": 20,
381
+ "sizeMS": 16,
382
+ "sizeSM": 12,
383
+ "sizeXL": 32,
384
+ "sizeXS": 8,
385
+ "sizeXXL": 48,
386
+ "controlHeight": 32,
387
+ "sizeXXS": 4,
388
+ "controlHeightLG": 40,
389
+ "controlHeightSM": 24,
390
+ "controlHeightXS": 16,
391
+ "lineWidth": 1,
392
+ "lineWidthBold": 2,
393
+ "lineWidthFocus": 4,
394
+ "controlOutlineWidth": 2,
395
+ "screenLG": 992,
396
+ "screenLGMax": 1199,
397
+ "screenLGMin": 992,
398
+ "screenMD": 768,
399
+ "screenMDMax": 991,
400
+ "screenMDMin": 768,
401
+ "screenSM": 576,
402
+ "screenSMMax": 767,
403
+ "screenSMMin": 576,
404
+ "screenXL": 1200,
405
+ "screenXLMax": 1599,
406
+ "screenXLMin": 1200,
407
+ "screenXS": 480,
408
+ "screenXSMax": 575,
409
+ "screenXSMin": 480,
410
+ "screenXXL": 1600,
411
+ "screenXXLMin": 1600,
412
+ "sizePopupArrow": 16,
413
+ "margin": 16,
414
+ "marginLG": 24,
415
+ "marginMD": 20,
416
+ "marginSM": 12,
417
+ "marginXL": 32,
418
+ "marginXS": 8,
419
+ "marginXXL": 48,
420
+ "marginXXS": 4,
421
+ "padding": 16,
422
+ "paddingLG": 24,
423
+ "paddingMD": 20,
424
+ "paddingSM": 12,
425
+ "paddingXL": 32,
426
+ "paddingXS": 8,
427
+ "paddingXXS": 4,
428
+ "paddingContentHorizontal": 16,
429
+ "paddingContentHorizontalLG": 24,
430
+ "paddingContentHorizontalSM": 16,
431
+ "paddingContentVertical": 12,
432
+ "paddingContentVerticalLG": 16,
433
+ "paddingContentVerticalSM": 8,
434
+ "controlPaddingHorizontal": 12,
435
+ "controlPaddingHorizontalSM": 8,
436
+ "fontFamily": "SF Pro",
437
+ "fontFamilyCode": "Courier Prime",
438
+ "fontSize": 14,
439
+ "fontSizeLG": 16,
440
+ "fontSizeSM": 12,
441
+ "fontSizeXL": 20,
442
+ "fontSizeHeading1": 38,
443
+ "fontSizeHeading2": 30,
444
+ "fontSizeHeading3": 24,
445
+ "fontSizeHeading4": 20,
446
+ "fontSizeHeading5": 16,
447
+ "lineHeight": 1.5714285714285714,
448
+ "lineHeightHeading1": 1.2105263157894737,
449
+ "lineHeightHeading2": 1.2666666666666666,
450
+ "lineHeightHeading3": 1.3333333333333333,
451
+ "lineHeightHeading4": 1.4,
452
+ "lineHeightHeading5": 1.5,
453
+ "lineHeightLG": 1.5,
454
+ "lineHeightSM": 1.6666666666666667,
455
+ "fontSizeIcon": 12,
456
+ "fontWeightStrong": 600,
457
+ "colorFillAlterSolid": "#fafafa",
458
+ "fontWeightNormal": 400,
459
+ "colorFilledHandleBg": "#f0f0f0",
460
+ "colorBgSolid": "#000000",
461
+ "colorBgSolidActive": "rgba(0, 0, 0, 0.95)",
462
+ "colorBgSolidHover": "rgba(0, 0, 0, 0.75)",
463
+ "solidTextColor": "#ffffff",
464
+ "pink.1": "#fff0f6",
465
+ "pink.2": "#ffd6e7",
466
+ "pink.3": "#ffadd2",
467
+ "pink.4": "#ff85c0",
468
+ "pink.5": "#f759ab",
469
+ "pink.6": "#eb2f96",
470
+ "pink.7": "#c41d7f",
471
+ "pink.8": "#9e1068",
472
+ "pink.9": "#780650",
473
+ "pink.10": "#520339",
474
+ "sizeXXXL": 60,
475
+ "sizeXXXXL": 72,
476
+ "paddingXXL": 48,
477
+ "paddingXXXL": 60,
478
+ "paddingXXXXL": 72,
479
+ "marginXXXL": 60,
480
+ "marginXXXXL": 72
481
+ };
482
+
483
+ //#endregion
484
+ //#region src/view/helper/sidebar.utils.ts
485
+ const methodColors = {
486
+ GET: {
487
+ bg: token.colorPrimaryBgHover,
488
+ color: token.colorPrimary
489
+ },
490
+ POST: {
491
+ bg: token["green.1"],
492
+ color: token.colorSuccess
493
+ },
494
+ DELETE: {
495
+ bg: token.colorErrorBg,
496
+ color: token.colorError
497
+ },
498
+ PUT: {
499
+ bg: token.colorWarningBg,
500
+ color: token.colorWarning
501
+ },
502
+ PATCH: {
503
+ bg: token["volcano.5"],
504
+ color: token.colorWhite
505
+ },
506
+ OPTIONS: {
507
+ bg: token["geekblue.2"],
508
+ color: token["geekblue.6"]
509
+ },
510
+ HEAD: {
511
+ bg: token["purple.1"],
512
+ color: token["purple.5"]
513
+ },
514
+ TRACE: {
515
+ bg: token["cyan.1"],
516
+ color: token["cyan.5"]
517
+ }
518
+ };
519
+ const buildTreeDataStructure = (data) => {
520
+ if (!data) return [];
521
+ return data.map((api) => {
522
+ return {
523
+ title: api.title,
524
+ key: api.id,
525
+ selectable: true,
526
+ data: api,
527
+ children: Object.entries(api.tags).map(([tag, endpoints]) => {
528
+ const tagId = `tag-${nanoid(8)}`;
529
+ return {
530
+ title: tag,
531
+ key: tagId,
532
+ selectable: false,
533
+ data: {
534
+ tagName: tag,
535
+ apiData: api
536
+ },
537
+ children: endpoints.map((endpoint) => {
538
+ return {
539
+ title: endpoint.summary,
540
+ key: endpoint.id,
541
+ isLeaf: true,
542
+ selectable: true,
543
+ method: endpoint.method,
544
+ data: {
545
+ endpoint,
546
+ api,
547
+ tagName: tag
548
+ }
549
+ };
550
+ })
551
+ };
552
+ })
553
+ };
554
+ });
555
+ };
556
+ const findNodeByKey = (nodes, targetKey) => {
557
+ for (const node of nodes) {
558
+ if (node.key === targetKey) return node;
559
+ if (node.children && node.children.length > 0) {
560
+ const found = findNodeByKey(node.children, targetKey);
561
+ if (found) return found;
562
+ }
563
+ }
564
+ return null;
565
+ };
566
+ const isApiSectionHighlighted = (apiKey, selectedNode, treeDataStructure) => {
567
+ if (!selectedNode || selectedNode.length === 0) return false;
568
+ const selectedKey = selectedNode[0];
569
+ if (selectedKey === apiKey) return false;
570
+ const findNodeParentApi = (nodes, targetKey) => {
571
+ for (const node of nodes) if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
572
+ const apiId = node.key;
573
+ if (node.children) for (const child of node.children) {
574
+ if (child.key === targetKey) return apiId;
575
+ if (child.children) {
576
+ for (const grandChild of child.children) if (grandChild.key === targetKey) return apiId;
577
+ }
578
+ }
579
+ }
580
+ return null;
581
+ };
582
+ const parentApiKey = findNodeParentApi(treeDataStructure, selectedKey);
583
+ return parentApiKey === apiKey;
584
+ };
585
+ const getAllTreeKeys = (data) => {
586
+ const keys = [];
587
+ const traverse = (nodes) => {
588
+ nodes.forEach((node) => {
589
+ keys.push(node.key);
590
+ if (node.children && node.children.length > 0) traverse(node.children);
591
+ });
592
+ };
593
+ traverse(data);
594
+ return keys;
595
+ };
596
+ const filterTreeData = (data, searchText) => {
597
+ if (!searchText) return data;
598
+ const findOriginalNode = (nodes, key) => {
599
+ for (const node of nodes) {
600
+ if (node.key === key) return node;
601
+ if (node.children) {
602
+ const found = findOriginalNode(node.children, key);
603
+ if (found) return found;
604
+ }
605
+ }
606
+ return null;
607
+ };
608
+ const filterNode = (node) => {
609
+ let titleText = "";
610
+ const originalNode = findOriginalNode(data, node.key);
611
+ if (originalNode && typeof originalNode.title === "string") titleText = originalNode.title;
612
+ else if (typeof node.title === "string") titleText = node.title;
613
+ let searchableText = titleText;
614
+ if (node.isLeaf && node.method) searchableText = `${node.method} ${titleText}`.toLowerCase();
615
+ else searchableText = titleText.toLowerCase();
616
+ const searchLower = searchText.toLowerCase();
617
+ const matchesSearch = searchableText.includes(searchLower);
618
+ if (node.children) {
619
+ const filteredChildren = node.children.map((child) => filterNode(child)).filter((child) => child !== null);
620
+ if (matchesSearch || filteredChildren.length > 0) return {
621
+ ...node,
622
+ children: filteredChildren
623
+ };
624
+ } else if (matchesSearch) return node;
625
+ return null;
626
+ };
627
+ return data.map((node) => filterNode(node)).filter((node) => node !== null);
628
+ };
629
+ const getSidebarStyles = (token$1, scope) => ({
630
+ [scope("sider")]: {
631
+ backgroundColor: token$1.colorBgContainer,
632
+ maxWidth: "17.5rem",
633
+ overflowY: "auto",
634
+ overflowX: "clip"
635
+ },
636
+ [scope("content")]: { padding: token$1.padding },
637
+ [scope("controls")]: {
638
+ display: "flex",
639
+ gap: token$1.marginXS,
640
+ marginBottom: token$1.marginSM
641
+ },
642
+ [scope("search-input")]: { flex: 1 },
643
+ [scope("tree")]: {
644
+ backgroundColor: "transparent",
645
+ "& .ant-tree-node-content-wrapper": {
646
+ overflow: "hidden",
647
+ width: "100%",
648
+ display: "flex",
649
+ alignItems: "center"
650
+ },
651
+ "& .ant-tree-title": {
652
+ width: "100%",
653
+ overflow: "hidden",
654
+ display: "flex",
655
+ alignItems: "center",
656
+ marginBlock: "auto"
657
+ },
658
+ "& .ant-tree-treenode": {
659
+ width: "100%",
660
+ padding: 0
661
+ },
662
+ "& .ant-tree-node-content-wrapper:hover": { backgroundColor: token$1.colorFillTertiary }
663
+ },
664
+ [scope("endpoint-item")]: {
665
+ display: "flex",
666
+ alignItems: "center",
667
+ gap: token$1.marginXS,
668
+ width: "100%",
669
+ maxWidth: "100%",
670
+ minWidth: "100%"
671
+ },
672
+ [scope("method-tag")]: {
673
+ minWidth: "3.75rem",
674
+ textAlign: "center",
675
+ border: "none"
676
+ },
677
+ [scope("endpoint-text")]: {
678
+ flex: 1,
679
+ maxWidth: "100%"
680
+ },
681
+ [scope("tag-title")]: {
682
+ color: token$1.colorText,
683
+ maxWidth: "100%",
684
+ display: "block"
685
+ },
686
+ [scope("api-title")]: {
687
+ color: token$1.colorText,
688
+ maxWidth: "100%",
689
+ display: "block",
690
+ padding: 0,
691
+ margin: 0,
692
+ "&.highlighted": { color: token$1.colorPrimary }
693
+ },
694
+ [scope("create-text")]: { color: token$1.colorTextSecondary }
51
695
  });
696
+
697
+ //#endregion
698
+ //#region src/view/helper/sidebar.components.tsx
699
+ const { Text } = Typography;
700
+ const EndpointItem = ({ method, title, cx }) => {
701
+ const methodStyle = methodColors[method];
702
+ return /* @__PURE__ */ jsxs("div", {
703
+ className: cx("endpoint-item"),
704
+ children: [/* @__PURE__ */ jsx(Tag, {
705
+ className: cx("method-tag"),
706
+ style: {
707
+ backgroundColor: methodStyle?.bg,
708
+ color: methodStyle?.color,
709
+ border: "none"
710
+ },
711
+ children: method
712
+ }), /* @__PURE__ */ jsx(Text, {
713
+ className: cx("endpoint-text"),
714
+ ellipsis: { tooltip: title },
715
+ style: { flex: 1 },
716
+ children: title
717
+ })]
718
+ });
719
+ };
720
+ const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
721
+ const renderNode = (node) => {
722
+ let title;
723
+ if (node.isLeaf && node.method) title = /* @__PURE__ */ jsx(EndpointItem, {
724
+ method: node.method,
725
+ title: typeof node.title === "string" ? node.title.replace(`${node.method} `, "") : "",
726
+ cx
727
+ });
728
+ else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
729
+ const isHighlighted = isApiSectionHighlighted(node.key, selectedNode, treeDataStructure);
730
+ title = /* @__PURE__ */ jsx(Text, {
731
+ className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
732
+ ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
733
+ children: node.title
734
+ });
735
+ } else title = /* @__PURE__ */ jsx(Text, {
736
+ className: cx("tag-title"),
737
+ ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
738
+ children: node.title
739
+ });
740
+ return {
741
+ ...node,
742
+ title,
743
+ children: node.children ? node.children.map(renderNode) : void 0
744
+ };
745
+ };
746
+ return treeDataStructure.map(renderNode);
747
+ };
748
+
749
+ //#endregion
750
+ //#region src/view/components/Sidebar.tsx
751
+ const { Sider } = Layout;
752
+ const Sidebar = () => {
753
+ const expandedKeys = useStore((state) => state.view.expandedKeys);
754
+ const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
755
+ const setSelectedApi = useStore((state) => state.view.setSelectedApi);
756
+ const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
757
+ const [selectedNode, setSelectedNodeState] = useState();
758
+ const transformedData = useStore((state) => state.view.transformedData);
759
+ const builtTreeData = useMemo(() => buildTreeDataStructure(transformedData), [transformedData]);
760
+ const [searchValue, setSearchValue] = useState("");
761
+ const [autoExpandParent, setAutoExpandParent] = useState(true);
762
+ const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
763
+ const handleSearch = (value) => {
764
+ if (value) {
765
+ const allKeys = getAllTreeKeys(builtTreeData);
766
+ setExpandedKeys(allKeys);
767
+ setSearchValue(value);
768
+ setAutoExpandParent(true);
769
+ } else {
770
+ setSearchValue(value);
771
+ setAutoExpandParent(false);
772
+ }
773
+ };
774
+ const renderTreeData = useMemo(() => {
775
+ return convertToRenderableTreeData(builtTreeData, selectedNode, cx);
776
+ }, [
777
+ builtTreeData,
778
+ selectedNode,
779
+ cx
780
+ ]);
781
+ const filteredTreeData = useMemo(() => {
782
+ if (!searchValue) return renderTreeData;
783
+ const filteredOriginal = filterTreeData(builtTreeData, searchValue);
784
+ return convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
785
+ }, [
786
+ builtTreeData,
787
+ searchValue,
788
+ selectedNode,
789
+ cx
790
+ ]);
791
+ const collapseAll = () => {
792
+ setExpandedKeys([]);
793
+ };
794
+ const handleNodeSelection = (nodeData, nodeKey) => {
795
+ if (!nodeData) return null;
796
+ if (nodeKey.startsWith("endpoint-")) {
797
+ const endpointNodeData = nodeData;
798
+ setSelectedEndpoint(endpointNodeData.endpoint);
799
+ setSelectedApi(endpointNodeData.api);
800
+ return {
801
+ type: "endpoint",
802
+ endpoint: endpointNodeData.endpoint,
803
+ api: endpointNodeData.api,
804
+ tag: endpointNodeData.tagName
805
+ };
806
+ } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
807
+ const apiData = nodeData;
808
+ setSelectedApi(apiData);
809
+ setSelectedEndpoint(null);
810
+ return {
811
+ type: "api",
812
+ api: apiData
813
+ };
814
+ } else {
815
+ const tagData = nodeData;
816
+ return {
817
+ type: "tag",
818
+ tag: tagData.tagName,
819
+ api: tagData.apiData
820
+ };
821
+ }
822
+ };
823
+ const onTreeNodeSelect = (selectedKeys) => {
824
+ const stringKeys = selectedKeys.map((key) => String(key));
825
+ if (stringKeys.length === 0) {
826
+ setSelectedNodeState([]);
827
+ setSelectedApi(null);
828
+ setSelectedEndpoint(null);
829
+ return;
830
+ }
831
+ const selectedKey = stringKeys[0];
832
+ const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
833
+ if (selectedNode$1) handleNodeSelection(selectedNode$1.data, selectedKey);
834
+ setSelectedNodeState(stringKeys);
835
+ };
836
+ return wrapSSR(/* @__PURE__ */ jsx(Sider, {
837
+ width: 280,
838
+ className: cx("sider"),
839
+ children: /* @__PURE__ */ jsxs("div", {
840
+ className: cx("content"),
841
+ children: [/* @__PURE__ */ jsxs("div", {
842
+ className: cx("controls"),
843
+ children: [/* @__PURE__ */ jsx(Input, {
844
+ placeholder: "Search by APIs or Endpoints",
845
+ value: searchValue,
846
+ onChange: (e) => handleSearch(e.target.value),
847
+ allowClear: true,
848
+ className: cx("search-input")
849
+ }), /* @__PURE__ */ jsx(Button, {
850
+ onClick: collapseAll,
851
+ title: "Collapse All",
852
+ icon: /* @__PURE__ */ jsx(Minify_default, {})
853
+ })]
854
+ }), /* @__PURE__ */ jsx(Tree, {
855
+ showLine: { showLeafIcon: false },
856
+ showIcon: false,
857
+ expandedKeys,
858
+ autoExpandParent,
859
+ selectedKeys: selectedNode,
860
+ onSelect: onTreeNodeSelect,
861
+ onExpand: (expandedKeysValue) => {
862
+ setExpandedKeys(expandedKeysValue);
863
+ setAutoExpandParent(false);
864
+ },
865
+ treeData: filteredTreeData,
866
+ className: cx("tree")
867
+ })]
868
+ })
869
+ }));
870
+ };
871
+
872
+ //#endregion
873
+ //#region src/view/components/MainContent.tsx
874
+ const MainContent = () => {
875
+ const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
876
+ backgroundColor: token$1.colorBgContainer,
877
+ height: "100%",
878
+ width: "100%",
879
+ maxHeight: "100%",
880
+ overflow: "auto",
881
+ borderRadius: token$1.borderRadius,
882
+ padding: token$1.paddingXL
883
+ } }));
884
+ return wrapSSR(/* @__PURE__ */ jsx("div", { className: cx("container") }));
885
+ };
886
+
887
+ //#endregion
888
+ //#region src/view/helper/mutate.ts
889
+ const transformOpenApiToDocs = (api) => {
890
+ const groupedPathsByTags = { default: [] };
891
+ const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
892
+ const contextPath = Object.keys(api.paths)[0];
893
+ for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
894
+ const entry = {
895
+ ...methodData,
896
+ method: method?.toUpperCase(),
897
+ path
898
+ };
899
+ const resourceTags = methodData.tags ?? [];
900
+ const matchedTags = resourceTags.filter((tag) => validTags.has(tag));
901
+ if (matchedTags.length > 0) matchedTags.forEach((tag) => {
902
+ if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
903
+ groupedPathsByTags[tag].push({
904
+ ...entry,
905
+ id: `endpoint-${nanoid(8)}`
906
+ });
907
+ });
908
+ else groupedPathsByTags.default.push({
909
+ ...entry,
910
+ id: `endpoint-${nanoid(8)}`
911
+ });
912
+ }
913
+ return {
914
+ ...api.info,
915
+ id: `api-${nanoid(8)}`,
916
+ contextPath,
917
+ tags: groupedPathsByTags,
918
+ servers: api.servers
919
+ };
920
+ };
921
+
922
+ //#endregion
923
+ //#region src/view/layout.tsx
924
+ const DocumentationLayout = ({ data }) => {
925
+ const { setOriginalData } = store_default(({ view }) => view);
926
+ const { setTransformedData } = store_default(({ view }) => view);
927
+ useEffect(() => {
928
+ setOriginalData(data);
929
+ const transformedData = data.map(transformOpenApiToDocs);
930
+ setTransformedData(transformedData);
931
+ }, [data]);
932
+ const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
933
+ [scope("container")]: {
934
+ display: "flex",
935
+ flexDirection: "column",
936
+ gap: token$1.marginLG,
937
+ height: "100%",
938
+ maxHeight: "100%",
939
+ overflow: "hidden"
940
+ },
941
+ [scope("layout")]: {
942
+ display: "flex",
943
+ height: "100%",
944
+ maxHeight: "100%",
945
+ overflow: "hidden",
946
+ gap: token$1.marginLG
947
+ }
948
+ }));
949
+ return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
950
+ className: cx("container"),
951
+ children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsxs("div", {
952
+ className: cx("layout"),
953
+ children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx(MainContent, {})]
954
+ })]
955
+ }) });
956
+ };
957
+
958
+ //#endregion
959
+ export { DocumentationLayout, useStore };
52
960
  //# sourceMappingURL=index.js.map