@digi-frontend/dgate-api-documentation 2.0.1-test.0 → 2.0.1-test.10

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,20 +1,19 @@
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
- import { nanoid } from "nanoid";
10
8
  import { AntdRegistry } from "@ant-design/nextjs-registry";
9
+ import { nanoid } from "nanoid";
11
10
 
12
11
  //#region src/store/slices/view.ts
13
12
  const createViewSlice = (set) => ({ view: {
14
13
  selectedNodeKey: null,
15
14
  expandedKeys: ["custom-auth", "api-name-01"],
16
- originalData: null,
17
- transformedData: null,
15
+ originalData: [],
16
+ transformedData: [],
18
17
  selectedApi: null,
19
18
  selectedEndpoint: null,
20
19
  setSelectedNode: (key) => set((state) => {
@@ -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,770 +115,31 @@ 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
126
  //#endregion
750
127
  //#region src/view/components/Sidebar.tsx
751
- const { Sider } = Layout;
752
- const Sidebar = () => {
753
- const expandedKeys = useStore((state) => state.view.expandedKeys);
754
- const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
755
- const setSelectedApi = useStore((state) => state.view.setSelectedApi);
756
- const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
757
- const [selectedNode, setSelectedNodeState] = useState();
758
- const transformedData = useStore((state) => state.view.transformedData);
759
- const builtTreeData = useMemo(() => buildTreeDataStructure(transformedData), [transformedData]);
760
- const [searchValue, setSearchValue] = useState("");
761
- const [autoExpandParent, setAutoExpandParent] = useState(true);
762
- const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
763
- const handleSearch = (value) => {
764
- if (value) {
765
- const allKeys = getAllTreeKeys(builtTreeData);
766
- setExpandedKeys(allKeys);
767
- setSearchValue(value);
768
- setAutoExpandParent(true);
769
- } else {
770
- setSearchValue(value);
771
- setAutoExpandParent(false);
772
- }
773
- };
774
- const renderTreeData = useMemo(() => {
775
- return convertToRenderableTreeData(builtTreeData, selectedNode, cx);
776
- }, [
777
- builtTreeData,
778
- selectedNode,
779
- cx
780
- ]);
781
- const filteredTreeData = useMemo(() => {
782
- if (!searchValue) return renderTreeData;
783
- const filteredOriginal = filterTreeData(builtTreeData, searchValue);
784
- return convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
785
- }, [
786
- builtTreeData,
787
- searchValue,
788
- selectedNode,
789
- cx
790
- ]);
791
- const collapseAll = () => {
792
- setExpandedKeys([]);
793
- };
794
- const handleNodeSelection = (nodeData, nodeKey) => {
795
- if (!nodeData) return null;
796
- if (nodeKey.startsWith("endpoint-")) {
797
- const endpointNodeData = nodeData;
798
- setSelectedEndpoint(endpointNodeData.endpoint);
799
- setSelectedApi(endpointNodeData.api);
800
- return {
801
- type: "endpoint",
802
- endpoint: endpointNodeData.endpoint,
803
- api: endpointNodeData.api,
804
- tag: endpointNodeData.tagName
805
- };
806
- } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
807
- const apiData = nodeData;
808
- setSelectedApi(apiData);
809
- setSelectedEndpoint(null);
810
- return {
811
- type: "api",
812
- api: apiData
813
- };
814
- } else {
815
- const tagData = nodeData;
816
- return {
817
- type: "tag",
818
- tag: tagData.tagName,
819
- api: tagData.apiData
820
- };
821
- }
822
- };
823
- const onTreeNodeSelect = (selectedKeys) => {
824
- const stringKeys = selectedKeys.map((key) => String(key));
825
- if (stringKeys.length === 0) {
826
- setSelectedNodeState([]);
827
- setSelectedApi(null);
828
- setSelectedEndpoint(null);
829
- return;
830
- }
831
- const selectedKey = stringKeys[0];
832
- const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
833
- if (selectedNode$1) handleNodeSelection(selectedNode$1.data, selectedKey);
834
- setSelectedNodeState(stringKeys);
835
- };
836
- return wrapSSR(/* @__PURE__ */ jsx(Sider, {
837
- width: 280,
838
- className: cx("sider"),
839
- children: /* @__PURE__ */ jsxs("div", {
840
- className: cx("content"),
841
- children: [/* @__PURE__ */ jsxs("div", {
842
- className: cx("controls"),
843
- children: [/* @__PURE__ */ jsx(Input, {
844
- placeholder: "Search by APIs or Endpoints",
845
- value: searchValue,
846
- onChange: (e) => handleSearch(e.target.value),
847
- allowClear: true,
848
- className: cx("search-input")
849
- }), /* @__PURE__ */ jsx(Button, {
850
- onClick: collapseAll,
851
- title: "Collapse All",
852
- icon: /* @__PURE__ */ jsx(Minify_default, {})
853
- })]
854
- }), /* @__PURE__ */ jsx(Tree, {
855
- showLine: { showLeafIcon: false },
856
- showIcon: false,
857
- expandedKeys,
858
- autoExpandParent,
859
- selectedKeys: selectedNode,
860
- onSelect: onTreeNodeSelect,
861
- onExpand: (expandedKeysValue) => {
862
- setExpandedKeys(expandedKeysValue);
863
- setAutoExpandParent(false);
864
- },
865
- treeData: filteredTreeData,
866
- className: cx("tree")
867
- })]
868
- })
869
- }));
870
- };
128
+ function Sidebar() {
129
+ return /* @__PURE__ */ jsx("div", { children: "Sidebar" });
130
+ }
871
131
 
872
132
  //#endregion
873
133
  //#region src/view/components/MainContent.tsx
874
134
  const MainContent = () => {
875
- const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
876
- backgroundColor: token$1.colorBgContainer,
135
+ const { wrapSSR, cx } = useStyle("MainContent", (token, scope) => ({ [scope("container")]: {
136
+ backgroundColor: token.colorBgContainer,
877
137
  height: "100%",
878
138
  width: "100%",
879
139
  maxHeight: "100%",
880
140
  overflow: "auto",
881
- borderRadius: token$1.borderRadius,
882
- padding: token$1.paddingXL
141
+ borderRadius: token.borderRadius,
142
+ padding: token.paddingXL
883
143
  } }));
884
144
  return wrapSSR(/* @__PURE__ */ jsx("div", { className: cx("container") }));
885
145
  };
@@ -921,32 +181,6 @@ const transformOpenApiToDocs = (api) => {
921
181
 
922
182
  //#endregion
923
183
  //#region src/view/layout.tsx
924
- function ErrorBoundary({ children }) {
925
- const [error, setError] = useState(null);
926
- if (error) return /* @__PURE__ */ jsxs("div", {
927
- style: {
928
- color: "red",
929
- padding: 24
930
- },
931
- children: [
932
- /* @__PURE__ */ jsx("h2", { children: "Something went wrong in DocumentationLayout." }),
933
- /* @__PURE__ */ jsx("pre", { children: error.message }),
934
- /* @__PURE__ */ jsx("pre", { children: error.stack })
935
- ]
936
- });
937
- return /* @__PURE__ */ jsx(ErrorCatcher, {
938
- onError: setError,
939
- children
940
- });
941
- }
942
- var ErrorCatcher = class extends React.Component {
943
- componentDidCatch(error) {
944
- this.props.onError(error);
945
- }
946
- render() {
947
- return this.props.children;
948
- }
949
- };
950
184
  const DocumentationLayout = ({ data }) => {
951
185
  const { setOriginalData } = store_default(({ view }) => view);
952
186
  const { setTransformedData } = store_default(({ view }) => view);
@@ -955,11 +189,11 @@ const DocumentationLayout = ({ data }) => {
955
189
  const transformedData = data.map(transformOpenApiToDocs);
956
190
  setTransformedData(transformedData);
957
191
  }, [data]);
958
- const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
192
+ const { cx } = useStyle("DocumentationLayout", (token, scope) => ({
959
193
  [scope("container")]: {
960
194
  display: "flex",
961
195
  flexDirection: "column",
962
- gap: token$1.marginLG,
196
+ gap: token.marginLG,
963
197
  height: "100%",
964
198
  maxHeight: "100%",
965
199
  overflow: "hidden"
@@ -969,16 +203,16 @@ const DocumentationLayout = ({ data }) => {
969
203
  height: "100%",
970
204
  maxHeight: "100%",
971
205
  overflow: "hidden",
972
- gap: token$1.marginLG
206
+ gap: token.marginLG
973
207
  }
974
208
  }));
975
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
209
+ return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
976
210
  className: cx("container"),
977
211
  children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsxs("div", {
978
212
  className: cx("layout"),
979
213
  children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx(MainContent, {})]
980
214
  })]
981
- }) }) });
215
+ }) });
982
216
  };
983
217
 
984
218
  //#endregion