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

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