@digi-frontend/dgate-api-documentation 2.0.1-test.6 → 2.0.1-test.7

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,9 +1,8 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
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";
4
+ import { useEffect } from "react";
5
+ import { Layout, theme } from "antd";
7
6
  import { useStyleRegister } from "@ant-design/cssinjs";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
8
  import { nanoid } from "nanoid";
@@ -95,19 +94,19 @@ var store_default = useStore;
95
94
  //#endregion
96
95
  //#region src/hooks/useStyle.ts
97
96
  function useStyle(componentName, stylesFn) {
98
- const { token: token$1, theme: theme$1, hashId } = theme.useToken();
97
+ const { token, theme: theme$1, hashId } = theme.useToken();
99
98
  const scope = (className) => `.${hashId}.${componentName}-${className}`;
100
99
  const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId}`).join(" ");
101
100
  const wrapSSR = useStyleRegister({
102
101
  theme: theme$1,
103
- token: token$1,
102
+ token,
104
103
  path: [componentName]
105
- }, () => stylesFn(token$1, scope));
104
+ }, () => stylesFn(token, scope));
106
105
  return {
107
106
  wrapSSR,
108
107
  cx,
109
108
  scope,
110
- token: token$1,
109
+ token,
111
110
  hashId
112
111
  };
113
112
  }
@@ -116,822 +115,25 @@ function useStyle(componentName, stylesFn) {
116
115
  //#region src/view/components/Header.tsx
117
116
  const { Header: AntHeader } = Layout;
118
117
  const Header = () => {
119
- const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({ [scope("header")]: {
118
+ const { wrapSSR, cx } = useStyle("Header", (token, scope) => ({ [scope("header")]: {
120
119
  width: "100%",
121
120
  height: "4rem",
122
- backgroundColor: token$1.colorBgContainer
121
+ backgroundColor: token.colorBgContainer
123
122
  } }));
124
123
  return wrapSSR(/* @__PURE__ */ jsx(AntHeader, { className: cx("header") }));
125
124
  };
126
125
 
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/components/Sidebar.tsx
751
- const { Sider } = Layout;
752
- var SidebarErrorBoundary = class extends React.Component {
753
- constructor(props) {
754
- super(props);
755
- this.state = { hasError: false };
756
- }
757
- static getDerivedStateFromError(error) {
758
- console.error("[Sidebar] Error caught by ErrorBoundary:", error);
759
- return {
760
- hasError: true,
761
- error
762
- };
763
- }
764
- componentDidCatch(error, errorInfo) {
765
- console.error("[Sidebar] ComponentDidCatch - Error:", error);
766
- console.error("[Sidebar] ComponentDidCatch - ErrorInfo:", errorInfo);
767
- setTimeout(() => {
768
- throw new Error(`Sidebar component error: ${error.message}`);
769
- }, 0);
770
- }
771
- render() {
772
- if (this.state.hasError) return /* @__PURE__ */ jsxs("div", {
773
- style: {
774
- color: "red",
775
- padding: 24,
776
- border: "1px solid red"
777
- },
778
- children: [
779
- /* @__PURE__ */ jsx("h3", { children: "Sidebar Error" }),
780
- /* @__PURE__ */ jsx("p", { children: "The sidebar component crashed. Check console for details." }),
781
- /* @__PURE__ */ jsx("pre", {
782
- style: { fontSize: "12px" },
783
- children: this.state.error?.message
784
- })
785
- ]
786
- });
787
- return this.props.children;
788
- }
789
- };
790
- const Sidebar = () => {
791
- const expandedKeys = useStore((state) => state.view.expandedKeys);
792
- const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
793
- const setSelectedApi = useStore((state) => state.view.setSelectedApi);
794
- const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
795
- const [selectedNode, setSelectedNodeState] = useState();
796
- const transformedData = useStore((state) => state.view.transformedData);
797
- const builtTreeData = useMemo(() => {
798
- console.log("[Sidebar] transformedData:", transformedData);
799
- const tree = buildTreeDataStructure(transformedData);
800
- console.log("[Sidebar] builtTreeData:", tree);
801
- return tree;
802
- }, [transformedData]);
803
- const [searchValue, setSearchValue] = useState("");
804
- const [autoExpandParent, setAutoExpandParent] = useState(true);
805
- const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
806
- const handleSearch = (value) => {
807
- if (value) {
808
- const allKeys = getAllTreeKeys(builtTreeData);
809
- setExpandedKeys(allKeys);
810
- setSearchValue(value);
811
- setAutoExpandParent(true);
812
- } else {
813
- setSearchValue(value);
814
- setAutoExpandParent(false);
815
- }
816
- };
817
- const renderTreeData = useMemo(() => {
818
- const data = convertToRenderableTreeData(builtTreeData, selectedNode, cx);
819
- console.log("[Sidebar] renderTreeData:", data);
820
- return data;
821
- }, [
822
- builtTreeData,
823
- selectedNode,
824
- cx
825
- ]);
826
- const filteredTreeData = useMemo(() => {
827
- if (!searchValue) return renderTreeData;
828
- const filteredOriginal = filterTreeData(builtTreeData, searchValue);
829
- const data = convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
830
- console.log("[Sidebar] filteredTreeData:", data);
831
- return data;
832
- }, [
833
- builtTreeData,
834
- searchValue,
835
- selectedNode,
836
- cx
837
- ]);
838
- const collapseAll = () => {
839
- setExpandedKeys([]);
840
- };
841
- const handleNodeSelection = (nodeData, nodeKey) => {
842
- if (!nodeData) return null;
843
- if (nodeKey.startsWith("endpoint-")) {
844
- const endpointNodeData = nodeData;
845
- setSelectedEndpoint(endpointNodeData.endpoint);
846
- setSelectedApi(endpointNodeData.api);
847
- return {
848
- type: "endpoint",
849
- endpoint: endpointNodeData.endpoint,
850
- api: endpointNodeData.api,
851
- tag: endpointNodeData.tagName
852
- };
853
- } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
854
- const apiData = nodeData;
855
- setSelectedApi(apiData);
856
- setSelectedEndpoint(null);
857
- return {
858
- type: "api",
859
- api: apiData
860
- };
861
- } else {
862
- const tagData = nodeData;
863
- return {
864
- type: "tag",
865
- tag: tagData.tagName,
866
- api: tagData.apiData
867
- };
868
- }
869
- };
870
- const onTreeNodeSelect = (selectedKeys) => {
871
- const stringKeys = selectedKeys.map((key) => String(key));
872
- console.log("[Sidebar] onTreeNodeSelect - selectedKeys:", selectedKeys, "stringKeys:", stringKeys);
873
- if (stringKeys.length === 0) {
874
- setSelectedNodeState([]);
875
- setSelectedApi(null);
876
- setSelectedEndpoint(null);
877
- return;
878
- }
879
- const selectedKey = stringKeys[0];
880
- const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
881
- console.log("[Sidebar] findNodeByKey result:", selectedNode$1);
882
- if (selectedNode$1) {
883
- const result = handleNodeSelection(selectedNode$1.data, selectedKey);
884
- console.log("[Sidebar] handleNodeSelection result:", result);
885
- }
886
- setSelectedNodeState(stringKeys);
887
- };
888
- return wrapSSR(/* @__PURE__ */ jsx(SidebarErrorBoundary, { children: /* @__PURE__ */ jsx(Sider, {
889
- width: 280,
890
- className: cx("sider"),
891
- children: /* @__PURE__ */ jsxs("div", {
892
- className: cx("content"),
893
- children: [/* @__PURE__ */ jsxs("div", {
894
- className: cx("controls"),
895
- children: [/* @__PURE__ */ jsx(Input, {
896
- placeholder: "Search by APIs or Endpoints",
897
- value: searchValue,
898
- onChange: (e) => handleSearch(e.target.value),
899
- allowClear: true,
900
- className: cx("search-input")
901
- }), /* @__PURE__ */ jsx(Button, {
902
- onClick: collapseAll,
903
- title: "Collapse All",
904
- icon: /* @__PURE__ */ jsx(Minify_default, {})
905
- })]
906
- }), /* @__PURE__ */ jsx(Tree, {
907
- showLine: { showLeafIcon: false },
908
- showIcon: false,
909
- expandedKeys,
910
- autoExpandParent,
911
- selectedKeys: selectedNode,
912
- onSelect: onTreeNodeSelect,
913
- onExpand: (expandedKeysValue) => {
914
- setExpandedKeys(expandedKeysValue);
915
- setAutoExpandParent(false);
916
- },
917
- treeData: filteredTreeData,
918
- className: cx("tree")
919
- })]
920
- })
921
- }) }));
922
- };
923
-
924
126
  //#endregion
925
127
  //#region src/view/components/MainContent.tsx
926
128
  const MainContent = () => {
927
- const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
928
- backgroundColor: token$1.colorBgContainer,
129
+ const { wrapSSR, cx } = useStyle("MainContent", (token, scope) => ({ [scope("container")]: {
130
+ backgroundColor: token.colorBgContainer,
929
131
  height: "100%",
930
132
  width: "100%",
931
133
  maxHeight: "100%",
932
134
  overflow: "auto",
933
- borderRadius: token$1.borderRadius,
934
- padding: token$1.paddingXL
135
+ borderRadius: token.borderRadius,
136
+ padding: token.paddingXL
935
137
  } }));
936
138
  return wrapSSR(/* @__PURE__ */ jsx("div", { className: cx("container") }));
937
139
  };
@@ -981,11 +183,11 @@ const DocumentationLayout = ({ data }) => {
981
183
  const transformedData = data.map(transformOpenApiToDocs);
982
184
  setTransformedData(transformedData);
983
185
  }, [data]);
984
- const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
186
+ const { cx } = useStyle("DocumentationLayout", (token, scope) => ({
985
187
  [scope("container")]: {
986
188
  display: "flex",
987
189
  flexDirection: "column",
988
- gap: token$1.marginLG,
190
+ gap: token.marginLG,
989
191
  height: "100%",
990
192
  maxHeight: "100%",
991
193
  overflow: "hidden"
@@ -995,14 +197,14 @@ const DocumentationLayout = ({ data }) => {
995
197
  height: "100%",
996
198
  maxHeight: "100%",
997
199
  overflow: "hidden",
998
- gap: token$1.marginLG
200
+ gap: token.marginLG
999
201
  }
1000
202
  }));
1001
203
  return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
1002
204
  className: cx("container"),
1003
- children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsxs("div", {
205
+ children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsx("div", {
1004
206
  className: cx("layout"),
1005
- children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx(MainContent, {})]
207
+ children: /* @__PURE__ */ jsx(MainContent, {})
1006
208
  })]
1007
209
  }) });
1008
210
  };