@digi-frontend/dgate-api-documentation 2.0.1-test.3 → 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.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
- import React, { useEffect, useState } from "react";
5
- import { Layout, theme } from "antd";
4
+ import * as React$1 from "react";
5
+ import React, { useEffect, useMemo, useState } from "react";
6
+ import { Button, Input, Layout, Tag, Tree, Typography, theme } from "antd";
6
7
  import { useStyleRegister } from "@ant-design/cssinjs";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { nanoid } from "nanoid";
@@ -94,19 +95,19 @@ var store_default = useStore;
94
95
  //#endregion
95
96
  //#region src/hooks/useStyle.ts
96
97
  function useStyle(componentName, stylesFn) {
97
- const { token, theme: theme$1, hashId } = theme.useToken();
98
+ const { token: token$1, theme: theme$1, hashId } = theme.useToken();
98
99
  const scope = (className) => `.${hashId}.${componentName}-${className}`;
99
100
  const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId}`).join(" ");
100
101
  const wrapSSR = useStyleRegister({
101
102
  theme: theme$1,
102
- token,
103
+ token: token$1,
103
104
  path: [componentName]
104
- }, () => stylesFn(token, scope));
105
+ }, () => stylesFn(token$1, scope));
105
106
  return {
106
107
  wrapSSR,
107
108
  cx,
108
109
  scope,
109
- token,
110
+ token: token$1,
110
111
  hashId
111
112
  };
112
113
  }
@@ -115,25 +116,813 @@ function useStyle(componentName, stylesFn) {
115
116
  //#region src/view/components/Header.tsx
116
117
  const { Header: AntHeader } = Layout;
117
118
  const Header = () => {
118
- const { wrapSSR, cx } = useStyle("Header", (token, scope) => ({ [scope("header")]: {
119
+ const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({ [scope("header")]: {
119
120
  width: "100%",
120
121
  height: "4rem",
121
- backgroundColor: token.colorBgContainer
122
+ backgroundColor: token$1.colorBgContainer
122
123
  } }));
123
124
  return wrapSSR(/* @__PURE__ */ jsx(AntHeader, { className: cx("header") }));
124
125
  };
125
126
 
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);
138
+ }
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 }
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/ErrorBoundary.tsx
751
+ function ErrorBoundary({ children }) {
752
+ const [error, setError] = useState(null);
753
+ if (error) return /* @__PURE__ */ jsxs("div", {
754
+ style: {
755
+ color: "red",
756
+ padding: 24
757
+ },
758
+ children: [
759
+ /* @__PURE__ */ jsx("h2", { children: "Something went wrong in DocumentationLayout." }),
760
+ /* @__PURE__ */ jsx("pre", { children: error.message }),
761
+ /* @__PURE__ */ jsx("pre", { children: error.stack })
762
+ ]
763
+ });
764
+ return /* @__PURE__ */ jsx(ErrorCatcher, {
765
+ onError: setError,
766
+ children
767
+ });
768
+ }
769
+ var ErrorCatcher = class extends React.Component {
770
+ componentDidCatch(error) {
771
+ this.props.onError(error);
772
+ }
773
+ render() {
774
+ return this.props.children;
775
+ }
776
+ };
777
+
778
+ //#endregion
779
+ //#region src/view/components/Sidebar.tsx
780
+ const { Sider } = Layout;
781
+ const Sidebar = () => {
782
+ const expandedKeys = useStore((state) => state.view.expandedKeys);
783
+ const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
784
+ const setSelectedApi = useStore((state) => state.view.setSelectedApi);
785
+ const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
786
+ const [selectedNode, setSelectedNodeState] = useState();
787
+ const transformedData = useStore((state) => state.view.transformedData);
788
+ const builtTreeData = useMemo(() => {
789
+ console.log("[Sidebar] transformedData:", transformedData);
790
+ const tree = buildTreeDataStructure(transformedData);
791
+ console.log("[Sidebar] builtTreeData:", tree);
792
+ return tree;
793
+ }, [transformedData]);
794
+ const [searchValue, setSearchValue] = useState("");
795
+ const [autoExpandParent, setAutoExpandParent] = useState(true);
796
+ const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
797
+ const handleSearch = (value) => {
798
+ if (value) {
799
+ const allKeys = getAllTreeKeys(builtTreeData);
800
+ setExpandedKeys(allKeys);
801
+ setSearchValue(value);
802
+ setAutoExpandParent(true);
803
+ } else {
804
+ setSearchValue(value);
805
+ setAutoExpandParent(false);
806
+ }
807
+ };
808
+ const renderTreeData = useMemo(() => {
809
+ const data = convertToRenderableTreeData(builtTreeData, selectedNode, cx);
810
+ console.log("[Sidebar] renderTreeData:", data);
811
+ return data;
812
+ }, [
813
+ builtTreeData,
814
+ selectedNode,
815
+ cx
816
+ ]);
817
+ const filteredTreeData = useMemo(() => {
818
+ if (!searchValue) return renderTreeData;
819
+ const filteredOriginal = filterTreeData(builtTreeData, searchValue);
820
+ const data = convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
821
+ console.log("[Sidebar] filteredTreeData:", data);
822
+ return data;
823
+ }, [
824
+ builtTreeData,
825
+ searchValue,
826
+ selectedNode,
827
+ cx
828
+ ]);
829
+ const collapseAll = () => {
830
+ setExpandedKeys([]);
831
+ };
832
+ const handleNodeSelection = (nodeData, nodeKey) => {
833
+ if (!nodeData) return null;
834
+ if (nodeKey.startsWith("endpoint-")) {
835
+ const endpointNodeData = nodeData;
836
+ setSelectedEndpoint(endpointNodeData.endpoint);
837
+ setSelectedApi(endpointNodeData.api);
838
+ return {
839
+ type: "endpoint",
840
+ endpoint: endpointNodeData.endpoint,
841
+ api: endpointNodeData.api,
842
+ tag: endpointNodeData.tagName
843
+ };
844
+ } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
845
+ const apiData = nodeData;
846
+ setSelectedApi(apiData);
847
+ setSelectedEndpoint(null);
848
+ return {
849
+ type: "api",
850
+ api: apiData
851
+ };
852
+ } else {
853
+ const tagData = nodeData;
854
+ return {
855
+ type: "tag",
856
+ tag: tagData.tagName,
857
+ api: tagData.apiData
858
+ };
859
+ }
860
+ };
861
+ const onTreeNodeSelect = (selectedKeys) => {
862
+ const stringKeys = selectedKeys.map((key) => String(key));
863
+ console.log("[Sidebar] onTreeNodeSelect - selectedKeys:", selectedKeys, "stringKeys:", stringKeys);
864
+ if (stringKeys.length === 0) {
865
+ setSelectedNodeState([]);
866
+ setSelectedApi(null);
867
+ setSelectedEndpoint(null);
868
+ return;
869
+ }
870
+ const selectedKey = stringKeys[0];
871
+ const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
872
+ console.log("[Sidebar] findNodeByKey result:", selectedNode$1);
873
+ if (selectedNode$1) {
874
+ const result = handleNodeSelection(selectedNode$1.data, selectedKey);
875
+ console.log("[Sidebar] handleNodeSelection result:", result);
876
+ }
877
+ setSelectedNodeState(stringKeys);
878
+ };
879
+ return wrapSSR(/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Sider, {
880
+ width: 280,
881
+ className: cx("sider"),
882
+ children: /* @__PURE__ */ jsxs("div", {
883
+ className: cx("content"),
884
+ children: [/* @__PURE__ */ jsxs("div", {
885
+ className: cx("controls"),
886
+ children: [/* @__PURE__ */ jsx(Input, {
887
+ placeholder: "Search by APIs or Endpoints",
888
+ value: searchValue,
889
+ onChange: (e) => handleSearch(e.target.value),
890
+ allowClear: true,
891
+ className: cx("search-input")
892
+ }), /* @__PURE__ */ jsx(Button, {
893
+ onClick: collapseAll,
894
+ title: "Collapse All",
895
+ icon: /* @__PURE__ */ jsx(Minify_default, {})
896
+ })]
897
+ }), /* @__PURE__ */ jsx(Tree, {
898
+ showLine: { showLeafIcon: false },
899
+ showIcon: false,
900
+ expandedKeys,
901
+ autoExpandParent,
902
+ selectedKeys: selectedNode,
903
+ onSelect: onTreeNodeSelect,
904
+ onExpand: (expandedKeysValue) => {
905
+ setExpandedKeys(expandedKeysValue);
906
+ setAutoExpandParent(false);
907
+ },
908
+ treeData: filteredTreeData,
909
+ className: cx("tree")
910
+ })]
911
+ })
912
+ }) }));
913
+ };
914
+
126
915
  //#endregion
127
916
  //#region src/view/components/MainContent.tsx
128
917
  const MainContent = () => {
129
- const { wrapSSR, cx } = useStyle("MainContent", (token, scope) => ({ [scope("container")]: {
130
- backgroundColor: token.colorBgContainer,
918
+ const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
919
+ backgroundColor: token$1.colorBgContainer,
131
920
  height: "100%",
132
921
  width: "100%",
133
922
  maxHeight: "100%",
134
923
  overflow: "auto",
135
- borderRadius: token.borderRadius,
136
- padding: token.paddingXL
924
+ borderRadius: token$1.borderRadius,
925
+ padding: token$1.paddingXL
137
926
  } }));
138
927
  return wrapSSR(/* @__PURE__ */ jsx("div", { className: cx("container") }));
139
928
  };
@@ -175,32 +964,6 @@ const transformOpenApiToDocs = (api) => {
175
964
 
176
965
  //#endregion
177
966
  //#region src/view/layout.tsx
178
- function ErrorBoundary({ children }) {
179
- const [error, setError] = useState(null);
180
- if (error) return /* @__PURE__ */ jsxs("div", {
181
- style: {
182
- color: "red",
183
- padding: 24
184
- },
185
- children: [
186
- /* @__PURE__ */ jsx("h2", { children: "Something went wrong in DocumentationLayout." }),
187
- /* @__PURE__ */ jsx("pre", { children: error.message }),
188
- /* @__PURE__ */ jsx("pre", { children: error.stack })
189
- ]
190
- });
191
- return /* @__PURE__ */ jsx(ErrorCatcher, {
192
- onError: setError,
193
- children
194
- });
195
- }
196
- var ErrorCatcher = class extends React.Component {
197
- componentDidCatch(error) {
198
- this.props.onError(error);
199
- }
200
- render() {
201
- return this.props.children;
202
- }
203
- };
204
967
  const DocumentationLayout = ({ data }) => {
205
968
  const { setOriginalData } = store_default(({ view }) => view);
206
969
  const { setTransformedData } = store_default(({ view }) => view);
@@ -209,11 +972,11 @@ const DocumentationLayout = ({ data }) => {
209
972
  const transformedData = data.map(transformOpenApiToDocs);
210
973
  setTransformedData(transformedData);
211
974
  }, [data]);
212
- const { cx } = useStyle("DocumentationLayout", (token, scope) => ({
975
+ const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
213
976
  [scope("container")]: {
214
977
  display: "flex",
215
978
  flexDirection: "column",
216
- gap: token.marginLG,
979
+ gap: token$1.marginLG,
217
980
  height: "100%",
218
981
  maxHeight: "100%",
219
982
  overflow: "hidden"
@@ -223,16 +986,16 @@ const DocumentationLayout = ({ data }) => {
223
986
  height: "100%",
224
987
  maxHeight: "100%",
225
988
  overflow: "hidden",
226
- gap: token.marginLG
989
+ gap: token$1.marginLG
227
990
  }
228
991
  }));
229
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
992
+ return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
230
993
  className: cx("container"),
231
- children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsx("div", {
994
+ children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsxs("div", {
232
995
  className: cx("layout"),
233
- children: /* @__PURE__ */ jsx(MainContent, {})
996
+ children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx(MainContent, {})]
234
997
  })]
235
- }) }) });
998
+ }) });
236
999
  };
237
1000
 
238
1001
  //#endregion