@digi-frontend/dgate-api-documentation 2.0.1-test.14 → 2.0.1-test.17

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