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