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