@doccov/fumadocs-adapter 0.0.1 → 0.0.3
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/CHANGELOG.md +13 -0
- package/bunup.config.ts +0 -1
- package/dist/components/index.d.ts +76 -76
- package/dist/components/index.js +11 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-pqaj3kdh.js → chunk-edfpjshy.js} +633 -632
- package/package.json +1 -2
- package/src/components/api-page.tsx +4 -10
- package/src/components/class-page.tsx +4 -10
- package/src/components/code-example.tsx +6 -2
- package/src/components/collapsible-method.tsx +12 -24
- package/src/components/coverage-badge.tsx +19 -7
- package/src/components/enum-page.tsx +13 -7
- package/src/components/examples.tsx +17 -6
- package/src/components/expandable-property.tsx +14 -17
- package/src/components/function-page.tsx +9 -12
- package/src/components/index.ts +29 -44
- package/src/components/interface-page.tsx +19 -8
- package/src/components/members-section.tsx +12 -10
- package/src/components/method-section.tsx +4 -1
- package/src/components/parameter-card.tsx +3 -8
- package/src/components/signature.tsx +1 -3
- package/src/components/type-table.tsx +7 -12
- package/src/components/variable-page.tsx +3 -9
- package/src/index.ts +3 -4
- package/src/server.ts +0 -1
- package/src/styles/docskit.css +8 -7
- package/tsconfig.json +0 -1
|
@@ -1,58 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
// src/components/parameter-card.tsx
|
|
3
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
4
|
-
|
|
5
|
-
function formatSchema(schema) {
|
|
6
|
-
if (!schema)
|
|
7
|
-
return "unknown";
|
|
8
|
-
if (typeof schema === "string")
|
|
9
|
-
return schema;
|
|
10
|
-
if (typeof schema === "object" && schema !== null) {
|
|
11
|
-
const s = schema;
|
|
12
|
-
if (s.$ref && typeof s.$ref === "string") {
|
|
13
|
-
return s.$ref.replace("#/types/", "");
|
|
14
|
-
}
|
|
15
|
-
if (s.tsType)
|
|
16
|
-
return String(s.tsType);
|
|
17
|
-
if (s.type)
|
|
18
|
-
return String(s.type);
|
|
19
|
-
}
|
|
20
|
-
return "unknown";
|
|
21
|
-
}
|
|
22
|
-
function ParameterCard({ param, spec }) {
|
|
23
|
-
const type = formatSchema(param.schema);
|
|
24
|
-
const isRequired = param.required !== false;
|
|
25
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
26
|
-
className: "rounded-lg border border-fd-border bg-fd-card/50 p-4",
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
29
|
-
className: "flex items-center gap-2 mb-1",
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
32
|
-
className: "font-mono text-sm text-fd-foreground",
|
|
33
|
-
children: param.name
|
|
34
|
-
}, undefined, false, undefined, this),
|
|
35
|
-
isRequired && /* @__PURE__ */ jsxDEV("span", {
|
|
36
|
-
className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-fd-border bg-fd-muted text-fd-muted-foreground uppercase tracking-wide",
|
|
37
|
-
children: "Required"
|
|
38
|
-
}, undefined, false, undefined, this)
|
|
39
|
-
]
|
|
40
|
-
}, undefined, true, undefined, this),
|
|
41
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
42
|
-
className: "text-sm text-fd-muted-foreground font-mono",
|
|
43
|
-
children: type
|
|
44
|
-
}, undefined, false, undefined, this),
|
|
45
|
-
param.description && /* @__PURE__ */ jsxDEV("p", {
|
|
46
|
-
className: "text-sm text-fd-muted-foreground mt-2",
|
|
47
|
-
children: param.description
|
|
48
|
-
}, undefined, false, undefined, this)
|
|
49
|
-
]
|
|
50
|
-
}, undefined, true, undefined, this);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
2
|
// src/components/code-example.tsx
|
|
54
3
|
import { ClientDocsKitCode } from "@doccov/ui/docskit";
|
|
55
|
-
import { jsxDEV
|
|
4
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
56
5
|
|
|
57
6
|
function cleanCode(code) {
|
|
58
7
|
let cleaned = code.trim();
|
|
@@ -68,215 +17,36 @@ function cleanCode(code) {
|
|
|
68
17
|
}
|
|
69
18
|
return cleaned;
|
|
70
19
|
}
|
|
71
|
-
function CodeExample({
|
|
20
|
+
function CodeExample({
|
|
21
|
+
code,
|
|
22
|
+
filename = "example.ts",
|
|
23
|
+
language = "typescript"
|
|
24
|
+
}) {
|
|
72
25
|
const cleaned = cleanCode(code);
|
|
73
26
|
const codeblock = {
|
|
74
27
|
value: cleaned,
|
|
75
28
|
lang: language,
|
|
76
29
|
meta: `${filename} -cn`
|
|
77
30
|
};
|
|
78
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxDEV(ClientDocsKitCode, {
|
|
79
32
|
codeblock,
|
|
80
33
|
className: "not-fumadocs-codeblock"
|
|
81
34
|
}, undefined, false, undefined, this);
|
|
82
35
|
}
|
|
83
36
|
|
|
84
|
-
// src/components/coverage-badge.tsx
|
|
85
|
-
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
86
|
-
|
|
87
|
-
function getScoreColor(score) {
|
|
88
|
-
if (score >= 80)
|
|
89
|
-
return "text-green-600 dark:text-green-400 bg-green-500/10 border-green-500/20";
|
|
90
|
-
if (score >= 60)
|
|
91
|
-
return "text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20";
|
|
92
|
-
return "text-red-600 dark:text-red-400 bg-red-500/10 border-red-500/20";
|
|
93
|
-
}
|
|
94
|
-
function formatSignal(signal) {
|
|
95
|
-
return signal.charAt(0).toUpperCase() + signal.slice(1);
|
|
96
|
-
}
|
|
97
|
-
function CoverageBadge({ docs, showMissing = true, showDrift = true }) {
|
|
98
|
-
const score = docs.coverageScore;
|
|
99
|
-
const hasMissing = showMissing && docs.missing && docs.missing.length > 0;
|
|
100
|
-
const hasDrift = showDrift && docs.drift && docs.drift.length > 0;
|
|
101
|
-
if (score == null && !hasMissing && !hasDrift)
|
|
102
|
-
return null;
|
|
103
|
-
return /* @__PURE__ */ jsxDEV3("div", {
|
|
104
|
-
className: "my-6 space-y-3",
|
|
105
|
-
children: [
|
|
106
|
-
score != null && /* @__PURE__ */ jsxDEV3("div", {
|
|
107
|
-
className: `inline-flex items-center gap-2 px-3 py-1.5 rounded-md border text-sm font-medium ${getScoreColor(score)}`,
|
|
108
|
-
children: [
|
|
109
|
-
/* @__PURE__ */ jsxDEV3("svg", {
|
|
110
|
-
className: "w-4 h-4",
|
|
111
|
-
fill: "none",
|
|
112
|
-
stroke: "currentColor",
|
|
113
|
-
viewBox: "0 0 24 24",
|
|
114
|
-
children: /* @__PURE__ */ jsxDEV3("path", {
|
|
115
|
-
strokeLinecap: "round",
|
|
116
|
-
strokeLinejoin: "round",
|
|
117
|
-
strokeWidth: 2,
|
|
118
|
-
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
119
|
-
}, undefined, false, undefined, this)
|
|
120
|
-
}, undefined, false, undefined, this),
|
|
121
|
-
"Coverage: ",
|
|
122
|
-
score,
|
|
123
|
-
"%"
|
|
124
|
-
]
|
|
125
|
-
}, undefined, true, undefined, this),
|
|
126
|
-
hasMissing && /* @__PURE__ */ jsxDEV3("div", {
|
|
127
|
-
className: "rounded-md bg-yellow-500/10 border border-yellow-500/20 px-3 py-2",
|
|
128
|
-
children: [
|
|
129
|
-
/* @__PURE__ */ jsxDEV3("p", {
|
|
130
|
-
className: "text-sm font-medium text-yellow-600 dark:text-yellow-400 mb-1",
|
|
131
|
-
children: "Missing Documentation"
|
|
132
|
-
}, undefined, false, undefined, this),
|
|
133
|
-
/* @__PURE__ */ jsxDEV3("ul", {
|
|
134
|
-
className: "text-sm text-yellow-600/80 dark:text-yellow-400/80 list-disc list-inside",
|
|
135
|
-
children: docs.missing.map((signal) => /* @__PURE__ */ jsxDEV3("li", {
|
|
136
|
-
children: formatSignal(signal)
|
|
137
|
-
}, signal, false, undefined, this))
|
|
138
|
-
}, undefined, false, undefined, this)
|
|
139
|
-
]
|
|
140
|
-
}, undefined, true, undefined, this),
|
|
141
|
-
hasDrift && /* @__PURE__ */ jsxDEV3("div", {
|
|
142
|
-
className: "rounded-md bg-red-500/10 border border-red-500/20 px-3 py-2",
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsxDEV3("p", {
|
|
145
|
-
className: "text-sm font-medium text-red-600 dark:text-red-400 mb-1",
|
|
146
|
-
children: "Documentation Drift"
|
|
147
|
-
}, undefined, false, undefined, this),
|
|
148
|
-
/* @__PURE__ */ jsxDEV3("ul", {
|
|
149
|
-
className: "text-sm text-red-600/80 dark:text-red-400/80 space-y-1",
|
|
150
|
-
children: docs.drift.map((drift, index) => /* @__PURE__ */ jsxDEV3("li", {
|
|
151
|
-
className: "flex flex-col",
|
|
152
|
-
children: [
|
|
153
|
-
/* @__PURE__ */ jsxDEV3("span", {
|
|
154
|
-
className: "font-medium",
|
|
155
|
-
children: drift.type
|
|
156
|
-
}, undefined, false, undefined, this),
|
|
157
|
-
/* @__PURE__ */ jsxDEV3("span", {
|
|
158
|
-
className: "text-xs opacity-80",
|
|
159
|
-
children: drift.issue
|
|
160
|
-
}, undefined, false, undefined, this),
|
|
161
|
-
drift.suggestion && /* @__PURE__ */ jsxDEV3("span", {
|
|
162
|
-
className: "text-xs text-fd-muted-foreground mt-0.5",
|
|
163
|
-
children: [
|
|
164
|
-
"Suggestion: ",
|
|
165
|
-
drift.suggestion
|
|
166
|
-
]
|
|
167
|
-
}, undefined, true, undefined, this)
|
|
168
|
-
]
|
|
169
|
-
}, index, true, undefined, this))
|
|
170
|
-
}, undefined, false, undefined, this)
|
|
171
|
-
]
|
|
172
|
-
}, undefined, true, undefined, this)
|
|
173
|
-
]
|
|
174
|
-
}, undefined, true, undefined, this);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/components/function-page.tsx
|
|
178
|
-
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
179
|
-
|
|
180
|
-
function formatSchema2(schema) {
|
|
181
|
-
if (!schema)
|
|
182
|
-
return "unknown";
|
|
183
|
-
if (typeof schema === "string")
|
|
184
|
-
return schema;
|
|
185
|
-
if (typeof schema === "object" && schema !== null) {
|
|
186
|
-
const s = schema;
|
|
187
|
-
if (s.$ref && typeof s.$ref === "string") {
|
|
188
|
-
return s.$ref.replace("#/types/", "");
|
|
189
|
-
}
|
|
190
|
-
if (s.tsType)
|
|
191
|
-
return String(s.tsType);
|
|
192
|
-
if (s.type)
|
|
193
|
-
return String(s.type);
|
|
194
|
-
}
|
|
195
|
-
return "unknown";
|
|
196
|
-
}
|
|
197
|
-
function FunctionPage({ export: exp, spec }) {
|
|
198
|
-
const sig = exp.signatures?.[0];
|
|
199
|
-
const hasExamples = exp.examples && exp.examples.length > 0;
|
|
200
|
-
const hasParams = sig?.parameters && sig.parameters.length > 0;
|
|
201
|
-
return /* @__PURE__ */ jsxDEV4("div", {
|
|
202
|
-
className: "space-y-6 not-prose",
|
|
203
|
-
children: [
|
|
204
|
-
exp.description && /* @__PURE__ */ jsxDEV4("p", {
|
|
205
|
-
className: "text-fd-muted-foreground leading-relaxed",
|
|
206
|
-
children: exp.description
|
|
207
|
-
}, undefined, false, undefined, this),
|
|
208
|
-
sig?.returns && /* @__PURE__ */ jsxDEV4("p", {
|
|
209
|
-
className: "text-fd-muted-foreground text-sm",
|
|
210
|
-
children: [
|
|
211
|
-
/* @__PURE__ */ jsxDEV4("span", {
|
|
212
|
-
className: "font-medium text-fd-foreground",
|
|
213
|
-
children: "Returns:"
|
|
214
|
-
}, undefined, false, undefined, this),
|
|
215
|
-
" ",
|
|
216
|
-
sig.returns.description || `A ${sig.returns.tsType ?? formatSchema2(sig.returns.schema)}`
|
|
217
|
-
]
|
|
218
|
-
}, undefined, true, undefined, this),
|
|
219
|
-
/* @__PURE__ */ jsxDEV4("div", {
|
|
220
|
-
className: "not-prose",
|
|
221
|
-
style: {
|
|
222
|
-
display: hasExamples ? "grid" : "block",
|
|
223
|
-
gridTemplateColumns: hasExamples ? "repeat(2, minmax(0, 1fr))" : undefined,
|
|
224
|
-
gap: "2rem",
|
|
225
|
-
alignItems: "start"
|
|
226
|
-
},
|
|
227
|
-
children: [
|
|
228
|
-
/* @__PURE__ */ jsxDEV4("div", {
|
|
229
|
-
className: "space-y-6",
|
|
230
|
-
children: hasParams && /* @__PURE__ */ jsxDEV4("div", {
|
|
231
|
-
children: [
|
|
232
|
-
/* @__PURE__ */ jsxDEV4("h3", {
|
|
233
|
-
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
234
|
-
children: "Parameters"
|
|
235
|
-
}, undefined, false, undefined, this),
|
|
236
|
-
/* @__PURE__ */ jsxDEV4("div", {
|
|
237
|
-
className: "space-y-3",
|
|
238
|
-
children: sig.parameters.map((param, index) => /* @__PURE__ */ jsxDEV4(ParameterCard, {
|
|
239
|
-
param,
|
|
240
|
-
spec
|
|
241
|
-
}, param.name ?? index, false, undefined, this))
|
|
242
|
-
}, undefined, false, undefined, this)
|
|
243
|
-
]
|
|
244
|
-
}, undefined, true, undefined, this)
|
|
245
|
-
}, undefined, false, undefined, this),
|
|
246
|
-
hasExamples && /* @__PURE__ */ jsxDEV4("div", {
|
|
247
|
-
style: { position: "sticky", top: "5rem" },
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ jsxDEV4("h3", {
|
|
250
|
-
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
251
|
-
children: "Example"
|
|
252
|
-
}, undefined, false, undefined, this),
|
|
253
|
-
/* @__PURE__ */ jsxDEV4(CodeExample, {
|
|
254
|
-
code: exp.examples[0],
|
|
255
|
-
filename: `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}.ts`
|
|
256
|
-
}, undefined, false, undefined, this)
|
|
257
|
-
]
|
|
258
|
-
}, undefined, true, undefined, this)
|
|
259
|
-
]
|
|
260
|
-
}, undefined, true, undefined, this),
|
|
261
|
-
exp.docs && /* @__PURE__ */ jsxDEV4(CoverageBadge, {
|
|
262
|
-
docs: exp.docs
|
|
263
|
-
}, undefined, false, undefined, this)
|
|
264
|
-
]
|
|
265
|
-
}, undefined, true, undefined, this);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
37
|
// src/components/expandable-property.tsx
|
|
269
38
|
import { useState } from "react";
|
|
270
|
-
import { jsxDEV as
|
|
39
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
271
40
|
|
|
272
41
|
function ChevronIcon({ expanded }) {
|
|
273
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsxDEV2("svg", {
|
|
274
43
|
width: "12",
|
|
275
44
|
height: "12",
|
|
276
45
|
viewBox: "0 0 12 12",
|
|
277
46
|
fill: "none",
|
|
278
47
|
className: `transition-transform duration-200 ${expanded ? "rotate-90" : ""}`,
|
|
279
|
-
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
children: /* @__PURE__ */ jsxDEV2("path", {
|
|
280
50
|
d: "M4.5 2.5L8 6L4.5 9.5",
|
|
281
51
|
stroke: "currentColor",
|
|
282
52
|
strokeWidth: "1.5",
|
|
@@ -292,20 +62,13 @@ function formatType(schema) {
|
|
|
292
62
|
return schema;
|
|
293
63
|
if (typeof schema === "object" && schema !== null) {
|
|
294
64
|
const s = schema;
|
|
295
|
-
if (s.tsType && typeof s.tsType === "string") {
|
|
296
|
-
const tsType = s.tsType;
|
|
297
|
-
if (tsType.length > 80) {
|
|
298
|
-
return tsType.slice(0, 77) + "...";
|
|
299
|
-
}
|
|
300
|
-
return tsType;
|
|
301
|
-
}
|
|
302
65
|
if (s.$ref && typeof s.$ref === "string") {
|
|
303
66
|
return s.$ref.replace("#/types/", "");
|
|
304
67
|
}
|
|
305
68
|
if (s.enum && Array.isArray(s.enum)) {
|
|
306
69
|
const enumVals = s.enum.map((v) => JSON.stringify(v)).join(" | ");
|
|
307
70
|
if (enumVals.length > 50)
|
|
308
|
-
return enumVals.slice(0, 47)
|
|
71
|
+
return `${enumVals.slice(0, 47)}...`;
|
|
309
72
|
return enumVals;
|
|
310
73
|
}
|
|
311
74
|
if (s.anyOf && Array.isArray(s.anyOf)) {
|
|
@@ -344,7 +107,12 @@ function countProperties(schema) {
|
|
|
344
107
|
const props = getNestedProperties(schema);
|
|
345
108
|
return props ? Object.keys(props).length : 0;
|
|
346
109
|
}
|
|
347
|
-
function NestedProperty({
|
|
110
|
+
function NestedProperty({
|
|
111
|
+
name,
|
|
112
|
+
schema,
|
|
113
|
+
required = false,
|
|
114
|
+
depth = 0
|
|
115
|
+
}) {
|
|
348
116
|
const [expanded, setExpanded] = useState(false);
|
|
349
117
|
const type = formatType(schema);
|
|
350
118
|
const nestedProps = getNestedProperties(schema);
|
|
@@ -352,19 +120,19 @@ function NestedProperty({ name, schema, required = false, depth = 0 }) {
|
|
|
352
120
|
const hasNested = nestedCount > 0;
|
|
353
121
|
const schemaObj = schema;
|
|
354
122
|
const description = schemaObj?.description;
|
|
355
|
-
return /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
356
124
|
className: "flex flex-col border-b border-fd-border last:border-0",
|
|
357
125
|
children: [
|
|
358
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
359
127
|
className: "flex flex-row items-start gap-2 py-2.5 px-3",
|
|
360
128
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
362
130
|
className: "flex-1 min-w-0",
|
|
363
131
|
children: [
|
|
364
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
365
133
|
className: "flex items-baseline gap-2 flex-wrap",
|
|
366
134
|
children: [
|
|
367
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
368
136
|
className: "font-mono text-sm font-medium text-fd-foreground",
|
|
369
137
|
children: [
|
|
370
138
|
name,
|
|
@@ -372,28 +140,29 @@ function NestedProperty({ name, schema, required = false, depth = 0 }) {
|
|
|
372
140
|
":"
|
|
373
141
|
]
|
|
374
142
|
}, undefined, true, undefined, this),
|
|
375
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
376
144
|
className: "font-mono text-sm text-fd-muted-foreground",
|
|
377
145
|
children: hasNested ? "object" : type
|
|
378
146
|
}, undefined, false, undefined, this)
|
|
379
147
|
]
|
|
380
148
|
}, undefined, true, undefined, this),
|
|
381
|
-
description && /* @__PURE__ */
|
|
149
|
+
description && /* @__PURE__ */ jsxDEV2("p", {
|
|
382
150
|
className: "text-sm text-fd-muted-foreground mt-0.5 leading-relaxed",
|
|
383
151
|
children: description
|
|
384
152
|
}, undefined, false, undefined, this)
|
|
385
153
|
]
|
|
386
154
|
}, undefined, true, undefined, this),
|
|
387
|
-
hasNested && /* @__PURE__ */
|
|
155
|
+
hasNested && /* @__PURE__ */ jsxDEV2("button", {
|
|
156
|
+
type: "button",
|
|
388
157
|
onClick: () => setExpanded(!expanded),
|
|
389
158
|
className: `flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-md
|
|
390
159
|
bg-fd-muted text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground
|
|
391
160
|
transition-colors cursor-pointer shrink-0`,
|
|
392
161
|
children: [
|
|
393
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ jsxDEV2(ChevronIcon, {
|
|
394
163
|
expanded
|
|
395
164
|
}, undefined, false, undefined, this),
|
|
396
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
397
166
|
children: [
|
|
398
167
|
nestedCount,
|
|
399
168
|
" properties"
|
|
@@ -403,9 +172,9 @@ function NestedProperty({ name, schema, required = false, depth = 0 }) {
|
|
|
403
172
|
}, undefined, true, undefined, this)
|
|
404
173
|
]
|
|
405
174
|
}, undefined, true, undefined, this),
|
|
406
|
-
hasNested && expanded && nestedProps && /* @__PURE__ */
|
|
175
|
+
hasNested && expanded && nestedProps && /* @__PURE__ */ jsxDEV2("div", {
|
|
407
176
|
className: "mx-3 mb-3 rounded-lg border border-fd-border bg-fd-card/50 overflow-hidden",
|
|
408
|
-
children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */
|
|
177
|
+
children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsxDEV2(NestedProperty, {
|
|
409
178
|
name: propName,
|
|
410
179
|
schema: propSchema,
|
|
411
180
|
required: getRequiredFields(schema).includes(propName),
|
|
@@ -422,19 +191,19 @@ function ExpandableProperty({ param, depth = 0 }) {
|
|
|
422
191
|
const nestedProps = getNestedProperties(param.schema);
|
|
423
192
|
const nestedCount = countProperties(param.schema);
|
|
424
193
|
const hasNested = nestedCount > 0;
|
|
425
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
426
195
|
className: "flex flex-col border-b border-fd-border last:border-0",
|
|
427
196
|
children: [
|
|
428
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
429
198
|
className: "flex flex-row items-start gap-2 py-3",
|
|
430
199
|
children: [
|
|
431
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
432
201
|
className: "flex-1 min-w-0",
|
|
433
202
|
children: [
|
|
434
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
435
204
|
className: "flex items-baseline gap-2 flex-wrap",
|
|
436
205
|
children: [
|
|
437
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
438
207
|
className: "font-mono text-sm font-medium text-fd-foreground",
|
|
439
208
|
children: [
|
|
440
209
|
param.name,
|
|
@@ -442,28 +211,29 @@ function ExpandableProperty({ param, depth = 0 }) {
|
|
|
442
211
|
":"
|
|
443
212
|
]
|
|
444
213
|
}, undefined, true, undefined, this),
|
|
445
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
446
215
|
className: "font-mono text-sm text-fd-muted-foreground",
|
|
447
216
|
children: hasNested ? "object" : type
|
|
448
217
|
}, undefined, false, undefined, this)
|
|
449
218
|
]
|
|
450
219
|
}, undefined, true, undefined, this),
|
|
451
|
-
param.description && /* @__PURE__ */
|
|
220
|
+
param.description && /* @__PURE__ */ jsxDEV2("p", {
|
|
452
221
|
className: "text-sm text-fd-muted-foreground mt-1 leading-relaxed",
|
|
453
222
|
children: param.description
|
|
454
223
|
}, undefined, false, undefined, this)
|
|
455
224
|
]
|
|
456
225
|
}, undefined, true, undefined, this),
|
|
457
|
-
hasNested && /* @__PURE__ */
|
|
226
|
+
hasNested && /* @__PURE__ */ jsxDEV2("button", {
|
|
227
|
+
type: "button",
|
|
458
228
|
onClick: () => setExpanded(!expanded),
|
|
459
229
|
className: `flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-md
|
|
460
230
|
bg-fd-muted text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground
|
|
461
231
|
transition-colors cursor-pointer shrink-0`,
|
|
462
232
|
children: [
|
|
463
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ jsxDEV2(ChevronIcon, {
|
|
464
234
|
expanded
|
|
465
235
|
}, undefined, false, undefined, this),
|
|
466
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
467
237
|
children: [
|
|
468
238
|
nestedCount,
|
|
469
239
|
" properties"
|
|
@@ -473,9 +243,9 @@ function ExpandableProperty({ param, depth = 0 }) {
|
|
|
473
243
|
}, undefined, true, undefined, this)
|
|
474
244
|
]
|
|
475
245
|
}, undefined, true, undefined, this),
|
|
476
|
-
hasNested && expanded && nestedProps && /* @__PURE__ */
|
|
246
|
+
hasNested && expanded && nestedProps && /* @__PURE__ */ jsxDEV2("div", {
|
|
477
247
|
className: "ml-4 mb-3 rounded-lg border border-fd-border bg-fd-card/50 overflow-hidden",
|
|
478
|
-
children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */
|
|
248
|
+
children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsxDEV2(NestedProperty, {
|
|
479
249
|
name: propName,
|
|
480
250
|
schema: propSchema,
|
|
481
251
|
required: getRequiredFields(param.schema).includes(propName),
|
|
@@ -487,17 +257,18 @@ function ExpandableProperty({ param, depth = 0 }) {
|
|
|
487
257
|
}
|
|
488
258
|
|
|
489
259
|
// src/components/collapsible-method.tsx
|
|
490
|
-
import { useState as useState2
|
|
491
|
-
import { jsxDEV as
|
|
260
|
+
import { useEffect, useState as useState2 } from "react";
|
|
261
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
492
262
|
|
|
493
263
|
function ChevronIcon2({ expanded }) {
|
|
494
|
-
return /* @__PURE__ */
|
|
264
|
+
return /* @__PURE__ */ jsxDEV3("svg", {
|
|
495
265
|
width: "16",
|
|
496
266
|
height: "16",
|
|
497
267
|
viewBox: "0 0 16 16",
|
|
498
268
|
fill: "none",
|
|
499
269
|
className: `transition-transform duration-200 ${expanded ? "rotate-90" : ""}`,
|
|
500
|
-
|
|
270
|
+
"aria-hidden": "true",
|
|
271
|
+
children: /* @__PURE__ */ jsxDEV3("path", {
|
|
501
272
|
d: "M6 4L10 8L6 12",
|
|
502
273
|
stroke: "currentColor",
|
|
503
274
|
strokeWidth: "1.5",
|
|
@@ -506,7 +277,7 @@ function ChevronIcon2({ expanded }) {
|
|
|
506
277
|
}, undefined, false, undefined, this)
|
|
507
278
|
}, undefined, false, undefined, this);
|
|
508
279
|
}
|
|
509
|
-
function
|
|
280
|
+
function formatSchema(schema) {
|
|
510
281
|
if (!schema)
|
|
511
282
|
return "unknown";
|
|
512
283
|
if (typeof schema === "string")
|
|
@@ -516,12 +287,6 @@ function formatSchema3(schema) {
|
|
|
516
287
|
if (s.$ref && typeof s.$ref === "string") {
|
|
517
288
|
return s.$ref.replace("#/types/", "");
|
|
518
289
|
}
|
|
519
|
-
if (s.tsType) {
|
|
520
|
-
const tsType = String(s.tsType);
|
|
521
|
-
if (tsType.length > 40)
|
|
522
|
-
return tsType.slice(0, 37) + "...";
|
|
523
|
-
return tsType;
|
|
524
|
-
}
|
|
525
290
|
if (s.type)
|
|
526
291
|
return String(s.type);
|
|
527
292
|
}
|
|
@@ -530,13 +295,7 @@ function formatSchema3(schema) {
|
|
|
530
295
|
function formatReturnType(returns) {
|
|
531
296
|
if (!returns)
|
|
532
297
|
return "void";
|
|
533
|
-
|
|
534
|
-
const t = returns.tsType;
|
|
535
|
-
if (t.length > 40)
|
|
536
|
-
return t.slice(0, 37) + "...";
|
|
537
|
-
return t;
|
|
538
|
-
}
|
|
539
|
-
return formatSchema3(returns.schema);
|
|
298
|
+
return formatSchema(returns.schema);
|
|
540
299
|
}
|
|
541
300
|
function formatParamPreview(params) {
|
|
542
301
|
if (!params || params.length === 0)
|
|
@@ -545,7 +304,10 @@ function formatParamPreview(params) {
|
|
|
545
304
|
return params[0].name || "arg";
|
|
546
305
|
return `${params[0].name || "arg"}, ...`;
|
|
547
306
|
}
|
|
548
|
-
function CollapsibleMethod({
|
|
307
|
+
function CollapsibleMethod({
|
|
308
|
+
member,
|
|
309
|
+
defaultExpanded = false
|
|
310
|
+
}) {
|
|
549
311
|
const [expanded, setExpanded] = useState2(defaultExpanded);
|
|
550
312
|
const sig = member.signatures?.[0];
|
|
551
313
|
const hasParams = sig?.parameters && sig.parameters.length > 0;
|
|
@@ -561,28 +323,29 @@ function CollapsibleMethod({ member, defaultExpanded = false }) {
|
|
|
561
323
|
setExpanded(true);
|
|
562
324
|
}
|
|
563
325
|
}, [member.name]);
|
|
564
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
565
327
|
id: member.name,
|
|
566
328
|
className: "scroll-mt-20 border-b border-fd-border last:border-0",
|
|
567
329
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ jsxDEV3("button", {
|
|
331
|
+
type: "button",
|
|
569
332
|
onClick: () => setExpanded(!expanded),
|
|
570
333
|
className: "w-full flex items-center gap-3 py-4 px-1 text-left hover:bg-fd-muted/30 transition-colors cursor-pointer group",
|
|
571
334
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
573
336
|
className: "text-fd-muted-foreground group-hover:text-fd-foreground transition-colors",
|
|
574
|
-
children: /* @__PURE__ */
|
|
337
|
+
children: /* @__PURE__ */ jsxDEV3(ChevronIcon2, {
|
|
575
338
|
expanded
|
|
576
339
|
}, undefined, false, undefined, this)
|
|
577
340
|
}, undefined, false, undefined, this),
|
|
578
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
579
342
|
className: "flex-1 min-w-0 flex items-baseline gap-2 flex-wrap",
|
|
580
343
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
582
345
|
className: "font-mono text-sm font-semibold text-fd-foreground",
|
|
583
346
|
children: [
|
|
584
347
|
member.name,
|
|
585
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
586
349
|
className: "text-fd-muted-foreground font-normal",
|
|
587
350
|
children: [
|
|
588
351
|
"(",
|
|
@@ -592,28 +355,28 @@ function CollapsibleMethod({ member, defaultExpanded = false }) {
|
|
|
592
355
|
}, undefined, true, undefined, this)
|
|
593
356
|
]
|
|
594
357
|
}, undefined, true, undefined, this),
|
|
595
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
596
359
|
className: "text-fd-muted-foreground",
|
|
597
360
|
children: "→"
|
|
598
361
|
}, undefined, false, undefined, this),
|
|
599
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
600
363
|
className: "font-mono text-sm text-fd-muted-foreground truncate",
|
|
601
364
|
children: returnType
|
|
602
365
|
}, undefined, false, undefined, this)
|
|
603
366
|
]
|
|
604
367
|
}, undefined, true, undefined, this),
|
|
605
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
606
369
|
className: "flex gap-1.5 shrink-0",
|
|
607
370
|
children: [
|
|
608
|
-
visibility !== "public" && /* @__PURE__ */
|
|
371
|
+
visibility !== "public" && /* @__PURE__ */ jsxDEV3("span", {
|
|
609
372
|
className: "text-xs px-1.5 py-0.5 rounded bg-fd-muted text-fd-muted-foreground",
|
|
610
373
|
children: visibility
|
|
611
374
|
}, undefined, false, undefined, this),
|
|
612
|
-
isStatic && /* @__PURE__ */
|
|
375
|
+
isStatic && /* @__PURE__ */ jsxDEV3("span", {
|
|
613
376
|
className: "text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
614
377
|
children: "static"
|
|
615
378
|
}, undefined, false, undefined, this),
|
|
616
|
-
isAsync && /* @__PURE__ */
|
|
379
|
+
isAsync && /* @__PURE__ */ jsxDEV3("span", {
|
|
617
380
|
className: "text-xs px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-600 dark:text-purple-400",
|
|
618
381
|
children: "async"
|
|
619
382
|
}, undefined, false, undefined, this)
|
|
@@ -621,42 +384,42 @@ function CollapsibleMethod({ member, defaultExpanded = false }) {
|
|
|
621
384
|
}, undefined, true, undefined, this)
|
|
622
385
|
]
|
|
623
386
|
}, undefined, true, undefined, this),
|
|
624
|
-
expanded && /* @__PURE__ */
|
|
387
|
+
expanded && /* @__PURE__ */ jsxDEV3("div", {
|
|
625
388
|
className: "pb-6 pl-8 pr-4",
|
|
626
389
|
children: [
|
|
627
|
-
member.description && /* @__PURE__ */
|
|
390
|
+
member.description && /* @__PURE__ */ jsxDEV3("p", {
|
|
628
391
|
className: "text-fd-muted-foreground mb-4 leading-relaxed",
|
|
629
392
|
children: member.description
|
|
630
393
|
}, undefined, false, undefined, this),
|
|
631
|
-
hasParams && /* @__PURE__ */
|
|
394
|
+
hasParams && /* @__PURE__ */ jsxDEV3("div", {
|
|
632
395
|
className: "mb-4",
|
|
633
396
|
children: [
|
|
634
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
635
398
|
className: "text-xs uppercase tracking-wide text-fd-muted-foreground font-medium block mb-2",
|
|
636
399
|
children: "Parameters"
|
|
637
400
|
}, undefined, false, undefined, this),
|
|
638
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
639
402
|
className: "border-l-2 border-fd-border pl-4",
|
|
640
|
-
children: sig.parameters.map((param, index) => /* @__PURE__ */
|
|
403
|
+
children: sig.parameters.map((param, index) => /* @__PURE__ */ jsxDEV3(ExpandableProperty, {
|
|
641
404
|
param
|
|
642
405
|
}, param.name ?? index, false, undefined, this))
|
|
643
406
|
}, undefined, false, undefined, this)
|
|
644
407
|
]
|
|
645
408
|
}, undefined, true, undefined, this),
|
|
646
|
-
sig?.returns && returnType !== "void" && /* @__PURE__ */
|
|
409
|
+
sig?.returns && returnType !== "void" && /* @__PURE__ */ jsxDEV3("div", {
|
|
647
410
|
children: [
|
|
648
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
649
412
|
className: "text-xs uppercase tracking-wide text-fd-muted-foreground font-medium block mb-2",
|
|
650
413
|
children: "Returns"
|
|
651
414
|
}, undefined, false, undefined, this),
|
|
652
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
653
416
|
className: "border-l-2 border-fd-border pl-4 py-2",
|
|
654
417
|
children: [
|
|
655
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
656
419
|
className: "font-mono text-sm text-fd-muted-foreground",
|
|
657
|
-
children:
|
|
420
|
+
children: formatSchema(sig.returns.schema)
|
|
658
421
|
}, undefined, false, undefined, this),
|
|
659
|
-
returnDescription && /* @__PURE__ */
|
|
422
|
+
returnDescription && /* @__PURE__ */ jsxDEV3("p", {
|
|
660
423
|
className: "text-sm text-fd-muted-foreground mt-1 leading-relaxed",
|
|
661
424
|
children: returnDescription
|
|
662
425
|
}, undefined, false, undefined, this)
|
|
@@ -670,87 +433,183 @@ function CollapsibleMethod({ member, defaultExpanded = false }) {
|
|
|
670
433
|
}, undefined, true, undefined, this);
|
|
671
434
|
}
|
|
672
435
|
|
|
673
|
-
// src/components/
|
|
674
|
-
import { jsxDEV as
|
|
436
|
+
// src/components/coverage-badge.tsx
|
|
437
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
675
438
|
|
|
676
|
-
function
|
|
677
|
-
if (
|
|
678
|
-
return "
|
|
679
|
-
if (
|
|
680
|
-
return
|
|
681
|
-
|
|
682
|
-
const s = schema;
|
|
683
|
-
if (s.$ref && typeof s.$ref === "string") {
|
|
684
|
-
return s.$ref.replace("#/types/", "");
|
|
685
|
-
}
|
|
686
|
-
if (s.tsType)
|
|
687
|
-
return String(s.tsType);
|
|
688
|
-
if (s.type)
|
|
689
|
-
return String(s.type);
|
|
690
|
-
}
|
|
691
|
-
return "unknown";
|
|
439
|
+
function getScoreColor(score) {
|
|
440
|
+
if (score >= 80)
|
|
441
|
+
return "text-green-600 dark:text-green-400 bg-green-500/10 border-green-500/20";
|
|
442
|
+
if (score >= 60)
|
|
443
|
+
return "text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20";
|
|
444
|
+
return "text-red-600 dark:text-red-400 bg-red-500/10 border-red-500/20";
|
|
692
445
|
}
|
|
693
|
-
function
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
446
|
+
function formatSignal(signal) {
|
|
447
|
+
return signal.charAt(0).toUpperCase() + signal.slice(1);
|
|
448
|
+
}
|
|
449
|
+
function CoverageBadge({
|
|
450
|
+
docs,
|
|
451
|
+
showMissing = true,
|
|
452
|
+
showDrift = true
|
|
453
|
+
}) {
|
|
454
|
+
const score = docs.coverageScore;
|
|
455
|
+
const hasMissing = showMissing && docs.missing && docs.missing.length > 0;
|
|
456
|
+
const hasDrift = showDrift && docs.drift && docs.drift.length > 0;
|
|
457
|
+
if (score == null && !hasMissing && !hasDrift)
|
|
458
|
+
return null;
|
|
459
|
+
return /* @__PURE__ */ jsxDEV4("div", {
|
|
460
|
+
className: "my-6 space-y-3",
|
|
701
461
|
children: [
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
className:
|
|
462
|
+
score != null && /* @__PURE__ */ jsxDEV4("div", {
|
|
463
|
+
className: `inline-flex items-center gap-2 px-3 py-1.5 rounded-md border text-sm font-medium ${getScoreColor(score)}`,
|
|
704
464
|
children: [
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
className: "
|
|
465
|
+
/* @__PURE__ */ jsxDEV4("svg", {
|
|
466
|
+
className: "w-4 h-4",
|
|
467
|
+
fill: "none",
|
|
468
|
+
stroke: "currentColor",
|
|
469
|
+
viewBox: "0 0 24 24",
|
|
470
|
+
"aria-hidden": "true",
|
|
471
|
+
children: /* @__PURE__ */ jsxDEV4("path", {
|
|
472
|
+
strokeLinecap: "round",
|
|
473
|
+
strokeLinejoin: "round",
|
|
474
|
+
strokeWidth: 2,
|
|
475
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
476
|
+
}, undefined, false, undefined, this)
|
|
477
|
+
}, undefined, false, undefined, this),
|
|
478
|
+
"Coverage: ",
|
|
479
|
+
score,
|
|
480
|
+
"%"
|
|
481
|
+
]
|
|
482
|
+
}, undefined, true, undefined, this),
|
|
483
|
+
hasMissing && /* @__PURE__ */ jsxDEV4("div", {
|
|
484
|
+
className: "rounded-md bg-yellow-500/10 border border-yellow-500/20 px-3 py-2",
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
487
|
+
className: "text-sm font-medium text-yellow-600 dark:text-yellow-400 mb-1",
|
|
488
|
+
children: "Missing Documentation"
|
|
489
|
+
}, undefined, false, undefined, this),
|
|
490
|
+
/* @__PURE__ */ jsxDEV4("ul", {
|
|
491
|
+
className: "text-sm text-yellow-600/80 dark:text-yellow-400/80 list-disc list-inside",
|
|
492
|
+
children: docs.missing.map((signal) => /* @__PURE__ */ jsxDEV4("li", {
|
|
493
|
+
children: formatSignal(signal)
|
|
494
|
+
}, signal, false, undefined, this))
|
|
495
|
+
}, undefined, false, undefined, this)
|
|
496
|
+
]
|
|
497
|
+
}, undefined, true, undefined, this),
|
|
498
|
+
hasDrift && /* @__PURE__ */ jsxDEV4("div", {
|
|
499
|
+
className: "rounded-md bg-red-500/10 border border-red-500/20 px-3 py-2",
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
502
|
+
className: "text-sm font-medium text-red-600 dark:text-red-400 mb-1",
|
|
503
|
+
children: "Documentation Drift"
|
|
504
|
+
}, undefined, false, undefined, this),
|
|
505
|
+
/* @__PURE__ */ jsxDEV4("ul", {
|
|
506
|
+
className: "text-sm text-red-600/80 dark:text-red-400/80 space-y-1",
|
|
507
|
+
children: docs.drift.map((drift) => /* @__PURE__ */ jsxDEV4("li", {
|
|
508
|
+
className: "flex flex-col",
|
|
509
|
+
children: [
|
|
510
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
511
|
+
className: "font-medium",
|
|
512
|
+
children: drift.type
|
|
513
|
+
}, undefined, false, undefined, this),
|
|
514
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
515
|
+
className: "text-xs opacity-80",
|
|
516
|
+
children: drift.issue
|
|
517
|
+
}, undefined, false, undefined, this),
|
|
518
|
+
drift.suggestion && /* @__PURE__ */ jsxDEV4("span", {
|
|
519
|
+
className: "text-xs text-fd-muted-foreground mt-0.5",
|
|
520
|
+
children: [
|
|
521
|
+
"Suggestion: ",
|
|
522
|
+
drift.suggestion
|
|
523
|
+
]
|
|
524
|
+
}, undefined, true, undefined, this)
|
|
525
|
+
]
|
|
526
|
+
}, `${drift.type}-${drift.issue}`, true, undefined, this))
|
|
527
|
+
}, undefined, false, undefined, this)
|
|
528
|
+
]
|
|
529
|
+
}, undefined, true, undefined, this)
|
|
530
|
+
]
|
|
531
|
+
}, undefined, true, undefined, this);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// src/components/class-page.tsx
|
|
535
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
536
|
+
|
|
537
|
+
function formatSchema2(schema) {
|
|
538
|
+
if (!schema)
|
|
539
|
+
return "unknown";
|
|
540
|
+
if (typeof schema === "string")
|
|
541
|
+
return schema;
|
|
542
|
+
if (typeof schema === "object" && schema !== null) {
|
|
543
|
+
const s = schema;
|
|
544
|
+
if (s.$ref && typeof s.$ref === "string") {
|
|
545
|
+
return s.$ref.replace("#/types/", "");
|
|
546
|
+
}
|
|
547
|
+
if (s.type)
|
|
548
|
+
return String(s.type);
|
|
549
|
+
}
|
|
550
|
+
return "unknown";
|
|
551
|
+
}
|
|
552
|
+
function PropertyItem({ member }) {
|
|
553
|
+
const visibility = member.visibility ?? "public";
|
|
554
|
+
const flags = member.flags;
|
|
555
|
+
const isStatic = flags?.static;
|
|
556
|
+
const isReadonly = flags?.readonly;
|
|
557
|
+
const type = formatSchema2(member.schema);
|
|
558
|
+
return /* @__PURE__ */ jsxDEV5("div", {
|
|
559
|
+
className: "py-3 border-b border-fd-border last:border-0",
|
|
560
|
+
children: [
|
|
561
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
562
|
+
className: "flex items-baseline gap-2 flex-wrap",
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
565
|
+
className: "font-semibold text-fd-foreground",
|
|
707
566
|
children: [
|
|
708
567
|
member.name,
|
|
709
568
|
":"
|
|
710
569
|
]
|
|
711
570
|
}, undefined, true, undefined, this),
|
|
712
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
713
572
|
className: "text-fd-muted-foreground font-mono text-sm",
|
|
714
573
|
children: type
|
|
715
574
|
}, undefined, false, undefined, this),
|
|
716
|
-
visibility !== "public" && /* @__PURE__ */
|
|
575
|
+
visibility !== "public" && /* @__PURE__ */ jsxDEV5("span", {
|
|
717
576
|
className: "text-xs px-1.5 py-0.5 rounded bg-fd-muted text-fd-muted-foreground",
|
|
718
577
|
children: visibility
|
|
719
578
|
}, undefined, false, undefined, this),
|
|
720
|
-
isStatic && /* @__PURE__ */
|
|
579
|
+
isStatic && /* @__PURE__ */ jsxDEV5("span", {
|
|
721
580
|
className: "text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
722
581
|
children: "static"
|
|
723
582
|
}, undefined, false, undefined, this),
|
|
724
|
-
isReadonly && /* @__PURE__ */
|
|
583
|
+
isReadonly && /* @__PURE__ */ jsxDEV5("span", {
|
|
725
584
|
className: "text-xs px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-600 dark:text-purple-400",
|
|
726
585
|
children: "readonly"
|
|
727
586
|
}, undefined, false, undefined, this)
|
|
728
587
|
]
|
|
729
588
|
}, undefined, true, undefined, this),
|
|
730
|
-
member.description && /* @__PURE__ */
|
|
589
|
+
member.description && /* @__PURE__ */ jsxDEV5("p", {
|
|
731
590
|
className: "text-sm text-fd-muted-foreground mt-1",
|
|
732
591
|
children: member.description
|
|
733
592
|
}, undefined, false, undefined, this)
|
|
734
593
|
]
|
|
735
594
|
}, undefined, true, undefined, this);
|
|
736
595
|
}
|
|
737
|
-
function ClassPage({ export: exp, spec }) {
|
|
596
|
+
function ClassPage({ export: exp, spec: _spec }) {
|
|
738
597
|
const hasExamples = exp.examples && exp.examples.length > 0;
|
|
739
598
|
const constructors = exp.members?.filter((m) => m.kind === "constructor") ?? [];
|
|
740
599
|
const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field") ?? [];
|
|
741
600
|
const methods = exp.members?.filter((m) => m.kind === "method") ?? [];
|
|
742
601
|
const constructorSig = constructors[0]?.signatures?.[0];
|
|
743
602
|
const constructorParams = constructorSig?.parameters ?? [];
|
|
744
|
-
return /* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ jsxDEV5("div", {
|
|
745
604
|
className: "space-y-8",
|
|
746
605
|
children: [
|
|
747
|
-
exp.description && /* @__PURE__ */
|
|
606
|
+
exp.description && /* @__PURE__ */ jsxDEV5("p", {
|
|
748
607
|
className: "text-fd-muted-foreground text-lg leading-relaxed",
|
|
749
608
|
children: exp.description
|
|
750
609
|
}, undefined, false, undefined, this),
|
|
751
|
-
/* @__PURE__ */
|
|
610
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
752
611
|
className: "rounded-lg border border-fd-border bg-fd-muted/30 p-4 overflow-x-auto",
|
|
753
|
-
children: /* @__PURE__ */
|
|
612
|
+
children: /* @__PURE__ */ jsxDEV5("code", {
|
|
754
613
|
className: "font-mono text-sm text-fd-foreground whitespace-pre",
|
|
755
614
|
children: [
|
|
756
615
|
"class ",
|
|
@@ -760,50 +619,50 @@ function ClassPage({ export: exp, spec }) {
|
|
|
760
619
|
]
|
|
761
620
|
}, undefined, true, undefined, this)
|
|
762
621
|
}, undefined, false, undefined, this),
|
|
763
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
764
623
|
className: `grid gap-8 ${hasExamples ? "lg:grid-cols-2" : "grid-cols-1"}`,
|
|
765
624
|
children: [
|
|
766
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
767
626
|
className: "space-y-8",
|
|
768
627
|
children: [
|
|
769
|
-
constructorParams.length > 0 && /* @__PURE__ */
|
|
628
|
+
constructorParams.length > 0 && /* @__PURE__ */ jsxDEV5("section", {
|
|
770
629
|
children: [
|
|
771
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ jsxDEV5("h3", {
|
|
772
631
|
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
773
632
|
children: "Constructor"
|
|
774
633
|
}, undefined, false, undefined, this),
|
|
775
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
776
635
|
className: "ml-2 border-l-2 border-fd-border pl-4",
|
|
777
|
-
children: constructorParams.map((param, index) => /* @__PURE__ */
|
|
636
|
+
children: constructorParams.map((param, index) => /* @__PURE__ */ jsxDEV5(ExpandableProperty, {
|
|
778
637
|
param
|
|
779
638
|
}, param.name ?? index, false, undefined, this))
|
|
780
639
|
}, undefined, false, undefined, this)
|
|
781
640
|
]
|
|
782
641
|
}, undefined, true, undefined, this),
|
|
783
|
-
methods.length > 0 && /* @__PURE__ */
|
|
642
|
+
methods.length > 0 && /* @__PURE__ */ jsxDEV5("section", {
|
|
784
643
|
children: [
|
|
785
|
-
/* @__PURE__ */
|
|
644
|
+
/* @__PURE__ */ jsxDEV5("h3", {
|
|
786
645
|
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
787
646
|
children: "Methods"
|
|
788
647
|
}, undefined, false, undefined, this),
|
|
789
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
790
649
|
className: "rounded-lg border border-fd-border overflow-hidden",
|
|
791
|
-
children: methods.map((member, index) => /* @__PURE__ */
|
|
650
|
+
children: methods.map((member, index) => /* @__PURE__ */ jsxDEV5(CollapsibleMethod, {
|
|
792
651
|
member,
|
|
793
652
|
defaultExpanded: index === 0
|
|
794
653
|
}, member.name ?? index, false, undefined, this))
|
|
795
654
|
}, undefined, false, undefined, this)
|
|
796
655
|
]
|
|
797
656
|
}, undefined, true, undefined, this),
|
|
798
|
-
properties.length > 0 && /* @__PURE__ */
|
|
657
|
+
properties.length > 0 && /* @__PURE__ */ jsxDEV5("section", {
|
|
799
658
|
children: [
|
|
800
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ jsxDEV5("h3", {
|
|
801
660
|
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
802
661
|
children: "Properties"
|
|
803
662
|
}, undefined, false, undefined, this),
|
|
804
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ jsxDEV5("div", {
|
|
805
664
|
className: "rounded-lg border border-fd-border bg-fd-card px-4",
|
|
806
|
-
children: properties.map((member, index) => /* @__PURE__ */
|
|
665
|
+
children: properties.map((member, index) => /* @__PURE__ */ jsxDEV5(PropertyItem, {
|
|
807
666
|
member
|
|
808
667
|
}, member.name ?? index, false, undefined, this))
|
|
809
668
|
}, undefined, false, undefined, this)
|
|
@@ -811,14 +670,14 @@ function ClassPage({ export: exp, spec }) {
|
|
|
811
670
|
}, undefined, true, undefined, this)
|
|
812
671
|
]
|
|
813
672
|
}, undefined, true, undefined, this),
|
|
814
|
-
hasExamples && /* @__PURE__ */
|
|
673
|
+
hasExamples && /* @__PURE__ */ jsxDEV5("div", {
|
|
815
674
|
className: "lg:sticky lg:top-20 lg:self-start",
|
|
816
675
|
children: [
|
|
817
|
-
/* @__PURE__ */
|
|
676
|
+
/* @__PURE__ */ jsxDEV5("h3", {
|
|
818
677
|
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
819
678
|
children: "Example"
|
|
820
679
|
}, undefined, false, undefined, this),
|
|
821
|
-
/* @__PURE__ */
|
|
680
|
+
/* @__PURE__ */ jsxDEV5(CodeExample, {
|
|
822
681
|
code: exp.examples[0],
|
|
823
682
|
filename: `${exp.name.toLowerCase()}.ts`
|
|
824
683
|
}, undefined, false, undefined, this)
|
|
@@ -826,16 +685,102 @@ function ClassPage({ export: exp, spec }) {
|
|
|
826
685
|
}, undefined, true, undefined, this)
|
|
827
686
|
]
|
|
828
687
|
}, undefined, true, undefined, this),
|
|
829
|
-
exp.docs && /* @__PURE__ */
|
|
688
|
+
exp.docs && /* @__PURE__ */ jsxDEV5(CoverageBadge, {
|
|
830
689
|
docs: exp.docs
|
|
831
690
|
}, undefined, false, undefined, this)
|
|
832
691
|
]
|
|
833
692
|
}, undefined, true, undefined, this);
|
|
834
693
|
}
|
|
835
694
|
|
|
695
|
+
// src/components/examples.tsx
|
|
696
|
+
import { useState as useState3 } from "react";
|
|
697
|
+
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
698
|
+
|
|
699
|
+
function CopyButton({ text }) {
|
|
700
|
+
const [copied, setCopied] = useState3(false);
|
|
701
|
+
const handleCopy = async () => {
|
|
702
|
+
await navigator.clipboard.writeText(text);
|
|
703
|
+
setCopied(true);
|
|
704
|
+
setTimeout(() => setCopied(false), 2000);
|
|
705
|
+
};
|
|
706
|
+
return /* @__PURE__ */ jsxDEV6("button", {
|
|
707
|
+
type: "button",
|
|
708
|
+
onClick: handleCopy,
|
|
709
|
+
className: "absolute top-2 right-2 p-1.5 rounded-md bg-fd-secondary hover:bg-fd-accent text-fd-muted-foreground hover:text-fd-foreground transition-colors opacity-0 group-hover:opacity-100",
|
|
710
|
+
"aria-label": "Copy code",
|
|
711
|
+
children: copied ? /* @__PURE__ */ jsxDEV6("svg", {
|
|
712
|
+
className: "w-4 h-4",
|
|
713
|
+
fill: "none",
|
|
714
|
+
stroke: "currentColor",
|
|
715
|
+
viewBox: "0 0 24 24",
|
|
716
|
+
"aria-hidden": "true",
|
|
717
|
+
children: /* @__PURE__ */ jsxDEV6("path", {
|
|
718
|
+
strokeLinecap: "round",
|
|
719
|
+
strokeLinejoin: "round",
|
|
720
|
+
strokeWidth: 2,
|
|
721
|
+
d: "M5 13l4 4L19 7"
|
|
722
|
+
}, undefined, false, undefined, this)
|
|
723
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("svg", {
|
|
724
|
+
className: "w-4 h-4",
|
|
725
|
+
fill: "none",
|
|
726
|
+
stroke: "currentColor",
|
|
727
|
+
viewBox: "0 0 24 24",
|
|
728
|
+
"aria-hidden": "true",
|
|
729
|
+
children: /* @__PURE__ */ jsxDEV6("path", {
|
|
730
|
+
strokeLinecap: "round",
|
|
731
|
+
strokeLinejoin: "round",
|
|
732
|
+
strokeWidth: 2,
|
|
733
|
+
d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
734
|
+
}, undefined, false, undefined, this)
|
|
735
|
+
}, undefined, false, undefined, this)
|
|
736
|
+
}, undefined, false, undefined, this);
|
|
737
|
+
}
|
|
738
|
+
function ExamplesSection({ examples }) {
|
|
739
|
+
const [activeIndex, setActiveIndex] = useState3(0);
|
|
740
|
+
if (!examples?.length)
|
|
741
|
+
return null;
|
|
742
|
+
const showTabs = examples.length > 1;
|
|
743
|
+
return /* @__PURE__ */ jsxDEV6("div", {
|
|
744
|
+
className: "my-6",
|
|
745
|
+
children: [
|
|
746
|
+
/* @__PURE__ */ jsxDEV6("h3", {
|
|
747
|
+
className: "text-lg font-semibold mb-3",
|
|
748
|
+
children: "Examples"
|
|
749
|
+
}, undefined, false, undefined, this),
|
|
750
|
+
showTabs && /* @__PURE__ */ jsxDEV6("div", {
|
|
751
|
+
className: "flex gap-1 mb-2 border-b border-fd-border",
|
|
752
|
+
children: examples.map((example, index) => /* @__PURE__ */ jsxDEV6("button", {
|
|
753
|
+
type: "button",
|
|
754
|
+
onClick: () => setActiveIndex(index),
|
|
755
|
+
className: `px-3 py-1.5 text-sm font-medium transition-colors ${activeIndex === index ? "text-fd-primary border-b-2 border-fd-primary -mb-px" : "text-fd-muted-foreground hover:text-fd-foreground"}`,
|
|
756
|
+
children: [
|
|
757
|
+
"Example ",
|
|
758
|
+
index + 1
|
|
759
|
+
]
|
|
760
|
+
}, `example-${typeof example === "string" ? example.slice(0, 20) : index}`, true, undefined, this))
|
|
761
|
+
}, undefined, false, undefined, this),
|
|
762
|
+
/* @__PURE__ */ jsxDEV6("div", {
|
|
763
|
+
className: "group relative",
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ jsxDEV6("pre", {
|
|
766
|
+
className: "overflow-x-auto rounded-lg border border-fd-border bg-fd-secondary p-4",
|
|
767
|
+
children: /* @__PURE__ */ jsxDEV6("code", {
|
|
768
|
+
className: "font-mono text-sm text-fd-foreground whitespace-pre",
|
|
769
|
+
children: examples[activeIndex]
|
|
770
|
+
}, undefined, false, undefined, this)
|
|
771
|
+
}, undefined, false, undefined, this),
|
|
772
|
+
/* @__PURE__ */ jsxDEV6(CopyButton, {
|
|
773
|
+
text: examples[activeIndex]
|
|
774
|
+
}, undefined, false, undefined, this)
|
|
775
|
+
]
|
|
776
|
+
}, undefined, true, undefined, this)
|
|
777
|
+
]
|
|
778
|
+
}, undefined, true, undefined, this);
|
|
779
|
+
}
|
|
780
|
+
|
|
836
781
|
// src/components/signature.tsx
|
|
837
782
|
import { ClientDocsKitCode as ClientDocsKitCode2 } from "@doccov/ui/docskit";
|
|
838
|
-
import { jsxDEV as
|
|
783
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
839
784
|
|
|
840
785
|
function formatTypeParameters(typeParams) {
|
|
841
786
|
if (!typeParams?.length)
|
|
@@ -855,12 +800,12 @@ function formatParameters(sig) {
|
|
|
855
800
|
return "()";
|
|
856
801
|
const params = sig.parameters.map((p) => {
|
|
857
802
|
const optional = p.required === false ? "?" : "";
|
|
858
|
-
const type =
|
|
803
|
+
const type = formatSchema3(p.schema);
|
|
859
804
|
return `${p.name}${optional}: ${type}`;
|
|
860
805
|
});
|
|
861
806
|
return `(${params.join(", ")})`;
|
|
862
807
|
}
|
|
863
|
-
function
|
|
808
|
+
function formatSchema3(schema) {
|
|
864
809
|
if (!schema)
|
|
865
810
|
return "unknown";
|
|
866
811
|
if (typeof schema === "string")
|
|
@@ -870,8 +815,6 @@ function formatSchema5(schema) {
|
|
|
870
815
|
if (s.$ref && typeof s.$ref === "string") {
|
|
871
816
|
return s.$ref.replace("#/types/", "");
|
|
872
817
|
}
|
|
873
|
-
if (s.tsType)
|
|
874
|
-
return String(s.tsType);
|
|
875
818
|
if (s.type)
|
|
876
819
|
return String(s.type);
|
|
877
820
|
}
|
|
@@ -880,9 +823,7 @@ function formatSchema5(schema) {
|
|
|
880
823
|
function formatReturnType2(sig) {
|
|
881
824
|
if (!sig?.returns)
|
|
882
825
|
return "void";
|
|
883
|
-
|
|
884
|
-
return sig.returns.tsType;
|
|
885
|
-
return formatSchema5(sig.returns.schema);
|
|
826
|
+
return formatSchema3(sig.returns.schema);
|
|
886
827
|
}
|
|
887
828
|
function buildSignatureString(exp, sigIndex = 0) {
|
|
888
829
|
const sig = exp.signatures?.[sigIndex];
|
|
@@ -903,14 +844,14 @@ function buildSignatureString(exp, sigIndex = 0) {
|
|
|
903
844
|
return `interface ${exp.name}${typeParams}${ext}`;
|
|
904
845
|
}
|
|
905
846
|
case "type": {
|
|
906
|
-
const typeValue = typeof exp.type === "string" ? exp.type :
|
|
847
|
+
const typeValue = typeof exp.type === "string" ? exp.type : formatSchema3(exp.schema);
|
|
907
848
|
return `type ${exp.name}${typeParams} = ${typeValue}`;
|
|
908
849
|
}
|
|
909
850
|
case "enum": {
|
|
910
851
|
return `enum ${exp.name}`;
|
|
911
852
|
}
|
|
912
853
|
case "variable": {
|
|
913
|
-
const typeValue = typeof exp.type === "string" ? exp.type :
|
|
854
|
+
const typeValue = typeof exp.type === "string" ? exp.type : formatSchema3(exp.schema);
|
|
914
855
|
return `const ${exp.name}: ${typeValue}`;
|
|
915
856
|
}
|
|
916
857
|
default:
|
|
@@ -924,16 +865,16 @@ function Signature({ export: exp, signatureIndex = 0 }) {
|
|
|
924
865
|
lang: "typescript",
|
|
925
866
|
meta: "c"
|
|
926
867
|
};
|
|
927
|
-
return /* @__PURE__ */
|
|
868
|
+
return /* @__PURE__ */ jsxDEV7("div", {
|
|
928
869
|
className: "not-prose",
|
|
929
870
|
children: [
|
|
930
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsxDEV7(ClientDocsKitCode2, {
|
|
931
872
|
codeblock
|
|
932
873
|
}, undefined, false, undefined, this),
|
|
933
|
-
exp.deprecated && /* @__PURE__ */
|
|
874
|
+
exp.deprecated && /* @__PURE__ */ jsxDEV7("div", {
|
|
934
875
|
className: "mt-2 rounded-md bg-yellow-500/10 border border-yellow-500/20 px-3 py-2 text-sm text-yellow-600 dark:text-yellow-400",
|
|
935
876
|
children: [
|
|
936
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsxDEV7("strong", {
|
|
937
878
|
children: "Deprecated:"
|
|
938
879
|
}, undefined, false, undefined, this),
|
|
939
880
|
" This export is deprecated."
|
|
@@ -943,10 +884,106 @@ function Signature({ export: exp, signatureIndex = 0 }) {
|
|
|
943
884
|
}, undefined, true, undefined, this);
|
|
944
885
|
}
|
|
945
886
|
|
|
946
|
-
// src/components/
|
|
887
|
+
// src/components/enum-page.tsx
|
|
888
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
889
|
+
|
|
890
|
+
function EnumPage({ export: exp, spec: _spec }) {
|
|
891
|
+
const members = exp.members ?? [];
|
|
892
|
+
return /* @__PURE__ */ jsxDEV8("div", {
|
|
893
|
+
className: "space-y-6",
|
|
894
|
+
children: [
|
|
895
|
+
exp.description && /* @__PURE__ */ jsxDEV8("p", {
|
|
896
|
+
className: "text-fd-muted-foreground text-base leading-relaxed",
|
|
897
|
+
children: exp.description
|
|
898
|
+
}, undefined, false, undefined, this),
|
|
899
|
+
/* @__PURE__ */ jsxDEV8("section", {
|
|
900
|
+
children: [
|
|
901
|
+
/* @__PURE__ */ jsxDEV8("h2", {
|
|
902
|
+
className: "text-xl font-semibold mb-2",
|
|
903
|
+
children: "Declaration"
|
|
904
|
+
}, undefined, false, undefined, this),
|
|
905
|
+
/* @__PURE__ */ jsxDEV8(Signature, {
|
|
906
|
+
export: exp
|
|
907
|
+
}, undefined, false, undefined, this)
|
|
908
|
+
]
|
|
909
|
+
}, undefined, true, undefined, this),
|
|
910
|
+
members.length > 0 && /* @__PURE__ */ jsxDEV8("section", {
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ jsxDEV8("h2", {
|
|
913
|
+
className: "text-xl font-semibold mb-2",
|
|
914
|
+
children: "Members"
|
|
915
|
+
}, undefined, false, undefined, this),
|
|
916
|
+
/* @__PURE__ */ jsxDEV8("div", {
|
|
917
|
+
className: "overflow-x-auto",
|
|
918
|
+
children: /* @__PURE__ */ jsxDEV8("table", {
|
|
919
|
+
className: "w-full text-sm border-collapse",
|
|
920
|
+
children: [
|
|
921
|
+
/* @__PURE__ */ jsxDEV8("thead", {
|
|
922
|
+
children: /* @__PURE__ */ jsxDEV8("tr", {
|
|
923
|
+
className: "border-b border-fd-border",
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsxDEV8("th", {
|
|
926
|
+
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
927
|
+
children: "Name"
|
|
928
|
+
}, undefined, false, undefined, this),
|
|
929
|
+
/* @__PURE__ */ jsxDEV8("th", {
|
|
930
|
+
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
931
|
+
children: "Value"
|
|
932
|
+
}, undefined, false, undefined, this),
|
|
933
|
+
/* @__PURE__ */ jsxDEV8("th", {
|
|
934
|
+
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
935
|
+
children: "Description"
|
|
936
|
+
}, undefined, false, undefined, this)
|
|
937
|
+
]
|
|
938
|
+
}, undefined, true, undefined, this)
|
|
939
|
+
}, undefined, false, undefined, this),
|
|
940
|
+
/* @__PURE__ */ jsxDEV8("tbody", {
|
|
941
|
+
children: members.map((member, index) => {
|
|
942
|
+
const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? "-" : member.schema : "-";
|
|
943
|
+
return /* @__PURE__ */ jsxDEV8("tr", {
|
|
944
|
+
className: "border-b border-fd-border last:border-0",
|
|
945
|
+
children: [
|
|
946
|
+
/* @__PURE__ */ jsxDEV8("td", {
|
|
947
|
+
className: "py-2 px-3 align-top",
|
|
948
|
+
children: /* @__PURE__ */ jsxDEV8("code", {
|
|
949
|
+
className: "text-fd-primary font-mono text-xs bg-fd-secondary px-1.5 py-0.5 rounded",
|
|
950
|
+
children: member.name
|
|
951
|
+
}, undefined, false, undefined, this)
|
|
952
|
+
}, undefined, false, undefined, this),
|
|
953
|
+
/* @__PURE__ */ jsxDEV8("td", {
|
|
954
|
+
className: "py-2 px-3 align-top",
|
|
955
|
+
children: /* @__PURE__ */ jsxDEV8("code", {
|
|
956
|
+
className: "font-mono text-xs text-fd-muted-foreground",
|
|
957
|
+
children: String(value)
|
|
958
|
+
}, undefined, false, undefined, this)
|
|
959
|
+
}, undefined, false, undefined, this),
|
|
960
|
+
/* @__PURE__ */ jsxDEV8("td", {
|
|
961
|
+
className: "py-2 px-3 align-top text-fd-muted-foreground",
|
|
962
|
+
children: member.description ?? ""
|
|
963
|
+
}, undefined, false, undefined, this)
|
|
964
|
+
]
|
|
965
|
+
}, member.name ?? index, true, undefined, this);
|
|
966
|
+
})
|
|
967
|
+
}, undefined, false, undefined, this)
|
|
968
|
+
]
|
|
969
|
+
}, undefined, true, undefined, this)
|
|
970
|
+
}, undefined, false, undefined, this)
|
|
971
|
+
]
|
|
972
|
+
}, undefined, true, undefined, this),
|
|
973
|
+
exp.examples && exp.examples.length > 0 && /* @__PURE__ */ jsxDEV8(ExamplesSection, {
|
|
974
|
+
examples: exp.examples
|
|
975
|
+
}, undefined, false, undefined, this),
|
|
976
|
+
exp.docs && /* @__PURE__ */ jsxDEV8(CoverageBadge, {
|
|
977
|
+
docs: exp.docs
|
|
978
|
+
}, undefined, false, undefined, this)
|
|
979
|
+
]
|
|
980
|
+
}, undefined, true, undefined, this);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// src/components/parameter-card.tsx
|
|
947
984
|
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
948
985
|
|
|
949
|
-
function
|
|
986
|
+
function formatSchema4(schema) {
|
|
950
987
|
if (!schema)
|
|
951
988
|
return "unknown";
|
|
952
989
|
if (typeof schema === "string")
|
|
@@ -954,80 +991,216 @@ function formatSchema6(schema) {
|
|
|
954
991
|
if (typeof schema === "object" && schema !== null) {
|
|
955
992
|
const s = schema;
|
|
956
993
|
if (s.$ref && typeof s.$ref === "string") {
|
|
957
|
-
|
|
958
|
-
return refName;
|
|
994
|
+
return s.$ref.replace("#/types/", "");
|
|
959
995
|
}
|
|
960
996
|
if (s.type)
|
|
961
997
|
return String(s.type);
|
|
962
|
-
if (s.tsType)
|
|
963
|
-
return String(s.tsType);
|
|
964
998
|
}
|
|
965
999
|
return "unknown";
|
|
966
1000
|
}
|
|
967
|
-
function
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
function TypeTable({ items, showRequired = true }) {
|
|
971
|
-
if (!items?.length)
|
|
972
|
-
return null;
|
|
1001
|
+
function ParameterCard({ param, spec: _spec }) {
|
|
1002
|
+
const type = formatSchema4(param.schema);
|
|
1003
|
+
const isRequired = param.required !== false;
|
|
973
1004
|
return /* @__PURE__ */ jsxDEV9("div", {
|
|
974
|
-
className: "
|
|
975
|
-
children:
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1005
|
+
className: "rounded-lg border border-fd-border bg-fd-card/50 p-4",
|
|
1006
|
+
children: [
|
|
1007
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
1008
|
+
className: "flex items-center gap-2 mb-1",
|
|
1009
|
+
children: [
|
|
1010
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
1011
|
+
className: "font-mono text-sm text-fd-foreground",
|
|
1012
|
+
children: param.name
|
|
1013
|
+
}, undefined, false, undefined, this),
|
|
1014
|
+
isRequired && /* @__PURE__ */ jsxDEV9("span", {
|
|
1015
|
+
className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-fd-border bg-fd-muted text-fd-muted-foreground uppercase tracking-wide",
|
|
1016
|
+
children: "Required"
|
|
1017
|
+
}, undefined, false, undefined, this)
|
|
1018
|
+
]
|
|
1019
|
+
}, undefined, true, undefined, this),
|
|
1020
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
1021
|
+
className: "text-sm text-fd-muted-foreground font-mono",
|
|
1022
|
+
children: type
|
|
1023
|
+
}, undefined, false, undefined, this),
|
|
1024
|
+
param.description && /* @__PURE__ */ jsxDEV9("p", {
|
|
1025
|
+
className: "text-sm text-fd-muted-foreground mt-2",
|
|
1026
|
+
children: param.description
|
|
1027
|
+
}, undefined, false, undefined, this)
|
|
1028
|
+
]
|
|
1029
|
+
}, undefined, true, undefined, this);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// src/components/function-page.tsx
|
|
1033
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
1034
|
+
|
|
1035
|
+
function formatSchema5(schema) {
|
|
1036
|
+
if (!schema)
|
|
1037
|
+
return "unknown";
|
|
1038
|
+
if (typeof schema === "string")
|
|
1039
|
+
return schema;
|
|
1040
|
+
if (typeof schema === "object" && schema !== null) {
|
|
1041
|
+
const s = schema;
|
|
1042
|
+
if (s.$ref && typeof s.$ref === "string") {
|
|
1043
|
+
return s.$ref.replace("#/types/", "");
|
|
1044
|
+
}
|
|
1045
|
+
if (s.type)
|
|
1046
|
+
return String(s.type);
|
|
1047
|
+
}
|
|
1048
|
+
return "unknown";
|
|
1049
|
+
}
|
|
1050
|
+
function FunctionPage({ export: exp, spec }) {
|
|
1051
|
+
const sig = exp.signatures?.[0];
|
|
1052
|
+
const hasExamples = exp.examples && exp.examples.length > 0;
|
|
1053
|
+
const hasParams = sig?.parameters && sig.parameters.length > 0;
|
|
1054
|
+
return /* @__PURE__ */ jsxDEV10("div", {
|
|
1055
|
+
className: "space-y-6 not-prose",
|
|
1056
|
+
children: [
|
|
1057
|
+
exp.description && /* @__PURE__ */ jsxDEV10("p", {
|
|
1058
|
+
className: "text-fd-muted-foreground leading-relaxed",
|
|
1059
|
+
children: exp.description
|
|
1060
|
+
}, undefined, false, undefined, this),
|
|
1061
|
+
sig?.returns && /* @__PURE__ */ jsxDEV10("p", {
|
|
1062
|
+
className: "text-fd-muted-foreground text-sm",
|
|
1063
|
+
children: [
|
|
1064
|
+
/* @__PURE__ */ jsxDEV10("span", {
|
|
1065
|
+
className: "font-medium text-fd-foreground",
|
|
1066
|
+
children: "Returns:"
|
|
1067
|
+
}, undefined, false, undefined, this),
|
|
1068
|
+
" ",
|
|
1069
|
+
sig.returns.description || `A ${formatSchema5(sig.returns.schema)}`
|
|
1070
|
+
]
|
|
1071
|
+
}, undefined, true, undefined, this),
|
|
1072
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
1073
|
+
className: "not-prose",
|
|
1074
|
+
style: {
|
|
1075
|
+
display: hasExamples ? "grid" : "block",
|
|
1076
|
+
gridTemplateColumns: hasExamples ? "repeat(2, minmax(0, 1fr))" : undefined,
|
|
1077
|
+
gap: "2rem",
|
|
1078
|
+
alignItems: "start"
|
|
1079
|
+
},
|
|
1080
|
+
children: [
|
|
1081
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
1082
|
+
className: "space-y-6",
|
|
1083
|
+
children: hasParams && /* @__PURE__ */ jsxDEV10("div", {
|
|
1084
|
+
children: [
|
|
1085
|
+
/* @__PURE__ */ jsxDEV10("h3", {
|
|
1086
|
+
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
1087
|
+
children: "Parameters"
|
|
1088
|
+
}, undefined, false, undefined, this),
|
|
1089
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
1090
|
+
className: "space-y-3",
|
|
1091
|
+
children: sig.parameters.map((param, index) => /* @__PURE__ */ jsxDEV10(ParameterCard, {
|
|
1092
|
+
param,
|
|
1093
|
+
spec
|
|
1094
|
+
}, param.name ?? index, false, undefined, this))
|
|
1095
|
+
}, undefined, false, undefined, this)
|
|
1096
|
+
]
|
|
1097
|
+
}, undefined, true, undefined, this)
|
|
1098
|
+
}, undefined, false, undefined, this),
|
|
1099
|
+
hasExamples && /* @__PURE__ */ jsxDEV10("div", {
|
|
1100
|
+
style: { position: "sticky", top: "5rem" },
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ jsxDEV10("h3", {
|
|
1103
|
+
className: "text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4",
|
|
1104
|
+
children: "Example"
|
|
1105
|
+
}, undefined, false, undefined, this),
|
|
1106
|
+
/* @__PURE__ */ jsxDEV10(CodeExample, {
|
|
1107
|
+
code: exp.examples[0],
|
|
1108
|
+
filename: `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}.ts`
|
|
1109
|
+
}, undefined, false, undefined, this)
|
|
1110
|
+
]
|
|
1111
|
+
}, undefined, true, undefined, this)
|
|
1112
|
+
]
|
|
1113
|
+
}, undefined, true, undefined, this),
|
|
1114
|
+
exp.docs && /* @__PURE__ */ jsxDEV10(CoverageBadge, {
|
|
1115
|
+
docs: exp.docs
|
|
1116
|
+
}, undefined, false, undefined, this)
|
|
1117
|
+
]
|
|
1118
|
+
}, undefined, true, undefined, this);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// src/components/type-table.tsx
|
|
1122
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
1123
|
+
|
|
1124
|
+
function formatSchema6(schema) {
|
|
1125
|
+
if (!schema)
|
|
1126
|
+
return "unknown";
|
|
1127
|
+
if (typeof schema === "string")
|
|
1128
|
+
return schema;
|
|
1129
|
+
if (typeof schema === "object" && schema !== null) {
|
|
1130
|
+
const s = schema;
|
|
1131
|
+
if (s.$ref && typeof s.$ref === "string") {
|
|
1132
|
+
const refName = s.$ref.replace("#/types/", "");
|
|
1133
|
+
return refName;
|
|
1134
|
+
}
|
|
1135
|
+
if (s.type)
|
|
1136
|
+
return String(s.type);
|
|
1137
|
+
}
|
|
1138
|
+
return "unknown";
|
|
1139
|
+
}
|
|
1140
|
+
function isParameter(item) {
|
|
1141
|
+
return "required" in item;
|
|
1142
|
+
}
|
|
1143
|
+
function TypeTable({ items, showRequired = true }) {
|
|
1144
|
+
if (!items?.length)
|
|
1145
|
+
return null;
|
|
1146
|
+
return /* @__PURE__ */ jsxDEV11("div", {
|
|
1147
|
+
className: "my-4 overflow-x-auto",
|
|
1148
|
+
children: /* @__PURE__ */ jsxDEV11("table", {
|
|
1149
|
+
className: "w-full text-sm border-collapse",
|
|
1150
|
+
children: [
|
|
1151
|
+
/* @__PURE__ */ jsxDEV11("thead", {
|
|
1152
|
+
children: /* @__PURE__ */ jsxDEV11("tr", {
|
|
980
1153
|
className: "border-b border-fd-border",
|
|
981
1154
|
children: [
|
|
982
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
983
1156
|
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
984
1157
|
children: "Name"
|
|
985
1158
|
}, undefined, false, undefined, this),
|
|
986
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
987
1160
|
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
988
1161
|
children: "Type"
|
|
989
1162
|
}, undefined, false, undefined, this),
|
|
990
|
-
/* @__PURE__ */
|
|
1163
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
991
1164
|
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
992
1165
|
children: "Description"
|
|
993
1166
|
}, undefined, false, undefined, this)
|
|
994
1167
|
]
|
|
995
1168
|
}, undefined, true, undefined, this)
|
|
996
1169
|
}, undefined, false, undefined, this),
|
|
997
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsxDEV11("tbody", {
|
|
998
1171
|
children: items.map((item, index) => {
|
|
999
1172
|
const name = item.name ?? `arg${index}`;
|
|
1000
1173
|
const type = formatSchema6(item.schema);
|
|
1001
1174
|
const description = item.description ?? "";
|
|
1002
1175
|
const required = isParameter(item) ? item.required : true;
|
|
1003
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsxDEV11("tr", {
|
|
1004
1177
|
className: "border-b border-fd-border last:border-0",
|
|
1005
1178
|
children: [
|
|
1006
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1007
1180
|
className: "py-2 px-3 align-top",
|
|
1008
1181
|
children: [
|
|
1009
|
-
/* @__PURE__ */
|
|
1182
|
+
/* @__PURE__ */ jsxDEV11("code", {
|
|
1010
1183
|
className: "text-fd-primary font-mono text-xs bg-fd-secondary px-1.5 py-0.5 rounded",
|
|
1011
1184
|
children: name
|
|
1012
1185
|
}, undefined, false, undefined, this),
|
|
1013
|
-
showRequired && required && /* @__PURE__ */
|
|
1186
|
+
showRequired && required && /* @__PURE__ */ jsxDEV11("span", {
|
|
1014
1187
|
className: "ml-1 text-red-500 text-xs",
|
|
1015
1188
|
children: "*"
|
|
1016
1189
|
}, undefined, false, undefined, this),
|
|
1017
|
-
showRequired && !required && /* @__PURE__ */
|
|
1190
|
+
showRequired && !required && /* @__PURE__ */ jsxDEV11("span", {
|
|
1018
1191
|
className: "ml-1 text-fd-muted-foreground text-xs",
|
|
1019
1192
|
children: "?"
|
|
1020
1193
|
}, undefined, false, undefined, this)
|
|
1021
1194
|
]
|
|
1022
1195
|
}, undefined, true, undefined, this),
|
|
1023
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1024
1197
|
className: "py-2 px-3 align-top",
|
|
1025
|
-
children: /* @__PURE__ */
|
|
1198
|
+
children: /* @__PURE__ */ jsxDEV11("code", {
|
|
1026
1199
|
className: "font-mono text-xs text-fd-muted-foreground",
|
|
1027
1200
|
children: type
|
|
1028
1201
|
}, undefined, false, undefined, this)
|
|
1029
1202
|
}, undefined, false, undefined, this),
|
|
1030
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1031
1204
|
className: "py-2 px-3 align-top text-fd-muted-foreground",
|
|
1032
1205
|
children: description
|
|
1033
1206
|
}, undefined, false, undefined, this)
|
|
@@ -1040,172 +1213,103 @@ function TypeTable({ items, showRequired = true }) {
|
|
|
1040
1213
|
}, undefined, false, undefined, this);
|
|
1041
1214
|
}
|
|
1042
1215
|
|
|
1043
|
-
// src/components/examples.tsx
|
|
1044
|
-
import { useState as useState3 } from "react";
|
|
1045
|
-
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
1046
|
-
|
|
1047
|
-
function CopyButton({ text }) {
|
|
1048
|
-
const [copied, setCopied] = useState3(false);
|
|
1049
|
-
const handleCopy = async () => {
|
|
1050
|
-
await navigator.clipboard.writeText(text);
|
|
1051
|
-
setCopied(true);
|
|
1052
|
-
setTimeout(() => setCopied(false), 2000);
|
|
1053
|
-
};
|
|
1054
|
-
return /* @__PURE__ */ jsxDEV10("button", {
|
|
1055
|
-
type: "button",
|
|
1056
|
-
onClick: handleCopy,
|
|
1057
|
-
className: "absolute top-2 right-2 p-1.5 rounded-md bg-fd-secondary hover:bg-fd-accent text-fd-muted-foreground hover:text-fd-foreground transition-colors opacity-0 group-hover:opacity-100",
|
|
1058
|
-
"aria-label": "Copy code",
|
|
1059
|
-
children: copied ? /* @__PURE__ */ jsxDEV10("svg", {
|
|
1060
|
-
className: "w-4 h-4",
|
|
1061
|
-
fill: "none",
|
|
1062
|
-
stroke: "currentColor",
|
|
1063
|
-
viewBox: "0 0 24 24",
|
|
1064
|
-
children: /* @__PURE__ */ jsxDEV10("path", {
|
|
1065
|
-
strokeLinecap: "round",
|
|
1066
|
-
strokeLinejoin: "round",
|
|
1067
|
-
strokeWidth: 2,
|
|
1068
|
-
d: "M5 13l4 4L19 7"
|
|
1069
|
-
}, undefined, false, undefined, this)
|
|
1070
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV10("svg", {
|
|
1071
|
-
className: "w-4 h-4",
|
|
1072
|
-
fill: "none",
|
|
1073
|
-
stroke: "currentColor",
|
|
1074
|
-
viewBox: "0 0 24 24",
|
|
1075
|
-
children: /* @__PURE__ */ jsxDEV10("path", {
|
|
1076
|
-
strokeLinecap: "round",
|
|
1077
|
-
strokeLinejoin: "round",
|
|
1078
|
-
strokeWidth: 2,
|
|
1079
|
-
d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
1080
|
-
}, undefined, false, undefined, this)
|
|
1081
|
-
}, undefined, false, undefined, this)
|
|
1082
|
-
}, undefined, false, undefined, this);
|
|
1083
|
-
}
|
|
1084
|
-
function ExamplesSection({ examples }) {
|
|
1085
|
-
const [activeIndex, setActiveIndex] = useState3(0);
|
|
1086
|
-
if (!examples?.length)
|
|
1087
|
-
return null;
|
|
1088
|
-
const showTabs = examples.length > 1;
|
|
1089
|
-
return /* @__PURE__ */ jsxDEV10("div", {
|
|
1090
|
-
className: "my-6",
|
|
1091
|
-
children: [
|
|
1092
|
-
/* @__PURE__ */ jsxDEV10("h3", {
|
|
1093
|
-
className: "text-lg font-semibold mb-3",
|
|
1094
|
-
children: "Examples"
|
|
1095
|
-
}, undefined, false, undefined, this),
|
|
1096
|
-
showTabs && /* @__PURE__ */ jsxDEV10("div", {
|
|
1097
|
-
className: "flex gap-1 mb-2 border-b border-fd-border",
|
|
1098
|
-
children: examples.map((_, index) => /* @__PURE__ */ jsxDEV10("button", {
|
|
1099
|
-
type: "button",
|
|
1100
|
-
onClick: () => setActiveIndex(index),
|
|
1101
|
-
className: `px-3 py-1.5 text-sm font-medium transition-colors ${activeIndex === index ? "text-fd-primary border-b-2 border-fd-primary -mb-px" : "text-fd-muted-foreground hover:text-fd-foreground"}`,
|
|
1102
|
-
children: [
|
|
1103
|
-
"Example ",
|
|
1104
|
-
index + 1
|
|
1105
|
-
]
|
|
1106
|
-
}, index, true, undefined, this))
|
|
1107
|
-
}, undefined, false, undefined, this),
|
|
1108
|
-
/* @__PURE__ */ jsxDEV10("div", {
|
|
1109
|
-
className: "group relative",
|
|
1110
|
-
children: [
|
|
1111
|
-
/* @__PURE__ */ jsxDEV10("pre", {
|
|
1112
|
-
className: "overflow-x-auto rounded-lg border border-fd-border bg-fd-secondary p-4",
|
|
1113
|
-
children: /* @__PURE__ */ jsxDEV10("code", {
|
|
1114
|
-
className: "font-mono text-sm text-fd-foreground whitespace-pre",
|
|
1115
|
-
children: examples[activeIndex]
|
|
1116
|
-
}, undefined, false, undefined, this)
|
|
1117
|
-
}, undefined, false, undefined, this),
|
|
1118
|
-
/* @__PURE__ */ jsxDEV10(CopyButton, {
|
|
1119
|
-
text: examples[activeIndex]
|
|
1120
|
-
}, undefined, false, undefined, this)
|
|
1121
|
-
]
|
|
1122
|
-
}, undefined, true, undefined, this)
|
|
1123
|
-
]
|
|
1124
|
-
}, undefined, true, undefined, this);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1216
|
// src/components/interface-page.tsx
|
|
1128
|
-
import { jsxDEV as
|
|
1217
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
1129
1218
|
|
|
1219
|
+
function formatSchema7(schema) {
|
|
1220
|
+
if (!schema)
|
|
1221
|
+
return "unknown";
|
|
1222
|
+
if (typeof schema === "string")
|
|
1223
|
+
return schema;
|
|
1224
|
+
if (typeof schema === "object" && schema !== null) {
|
|
1225
|
+
const s = schema;
|
|
1226
|
+
if (s.$ref && typeof s.$ref === "string") {
|
|
1227
|
+
return s.$ref.replace("#/types/", "");
|
|
1228
|
+
}
|
|
1229
|
+
if (s.type)
|
|
1230
|
+
return String(s.type);
|
|
1231
|
+
}
|
|
1232
|
+
return "unknown";
|
|
1233
|
+
}
|
|
1130
1234
|
function InterfacePage({ export: exp, spec }) {
|
|
1131
1235
|
const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field" || !m.kind);
|
|
1132
1236
|
const methods = exp.members?.filter((m) => m.kind === "method" || m.kind === "function");
|
|
1133
|
-
return /* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1134
1238
|
className: "space-y-6",
|
|
1135
1239
|
children: [
|
|
1136
|
-
exp.description && /* @__PURE__ */
|
|
1240
|
+
exp.description && /* @__PURE__ */ jsxDEV12("p", {
|
|
1137
1241
|
className: "text-fd-muted-foreground text-base leading-relaxed",
|
|
1138
1242
|
children: exp.description
|
|
1139
1243
|
}, undefined, false, undefined, this),
|
|
1140
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsxDEV12("section", {
|
|
1141
1245
|
children: [
|
|
1142
|
-
/* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1143
1247
|
className: "text-xl font-semibold mb-2",
|
|
1144
1248
|
children: "Declaration"
|
|
1145
1249
|
}, undefined, false, undefined, this),
|
|
1146
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ jsxDEV12(Signature, {
|
|
1147
1251
|
export: exp
|
|
1148
1252
|
}, undefined, false, undefined, this)
|
|
1149
1253
|
]
|
|
1150
1254
|
}, undefined, true, undefined, this),
|
|
1151
|
-
exp.extends && /* @__PURE__ */
|
|
1255
|
+
exp.extends && /* @__PURE__ */ jsxDEV12("section", {
|
|
1152
1256
|
children: [
|
|
1153
|
-
/* @__PURE__ */
|
|
1257
|
+
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1154
1258
|
className: "text-xl font-semibold mb-2",
|
|
1155
1259
|
children: "Extends"
|
|
1156
1260
|
}, undefined, false, undefined, this),
|
|
1157
|
-
/* @__PURE__ */
|
|
1261
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1158
1262
|
className: "rounded-lg border border-fd-border bg-fd-card p-4",
|
|
1159
|
-
children: /* @__PURE__ */
|
|
1263
|
+
children: /* @__PURE__ */ jsxDEV12("code", {
|
|
1160
1264
|
className: "font-mono text-sm text-fd-primary",
|
|
1161
1265
|
children: exp.extends
|
|
1162
1266
|
}, undefined, false, undefined, this)
|
|
1163
1267
|
}, undefined, false, undefined, this)
|
|
1164
1268
|
]
|
|
1165
1269
|
}, undefined, true, undefined, this),
|
|
1166
|
-
properties && properties.length > 0 && /* @__PURE__ */
|
|
1270
|
+
properties && properties.length > 0 && /* @__PURE__ */ jsxDEV12("section", {
|
|
1167
1271
|
children: [
|
|
1168
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1169
1273
|
className: "text-xl font-semibold mb-2",
|
|
1170
1274
|
children: "Properties"
|
|
1171
1275
|
}, undefined, false, undefined, this),
|
|
1172
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ jsxDEV12(TypeTable, {
|
|
1173
1277
|
items: properties,
|
|
1174
1278
|
spec,
|
|
1175
1279
|
showRequired: true
|
|
1176
1280
|
}, undefined, false, undefined, this)
|
|
1177
1281
|
]
|
|
1178
1282
|
}, undefined, true, undefined, this),
|
|
1179
|
-
methods && methods.length > 0 && /* @__PURE__ */
|
|
1283
|
+
methods && methods.length > 0 && /* @__PURE__ */ jsxDEV12("section", {
|
|
1180
1284
|
children: [
|
|
1181
|
-
/* @__PURE__ */
|
|
1285
|
+
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1182
1286
|
className: "text-xl font-semibold mb-2",
|
|
1183
1287
|
children: "Methods"
|
|
1184
1288
|
}, undefined, false, undefined, this),
|
|
1185
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1186
1290
|
className: "space-y-4",
|
|
1187
1291
|
children: methods.map((method, index) => {
|
|
1188
1292
|
const sig = method.signatures?.[0];
|
|
1189
1293
|
const params = sig?.parameters ?? [];
|
|
1190
|
-
const returnType = sig?.returns?.
|
|
1191
|
-
return /* @__PURE__ */
|
|
1294
|
+
const returnType = formatSchema7(sig?.returns?.schema);
|
|
1295
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1192
1296
|
className: "rounded-lg border border-fd-border p-4",
|
|
1193
1297
|
children: [
|
|
1194
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ jsxDEV12("code", {
|
|
1195
1299
|
className: "font-mono text-sm text-fd-primary",
|
|
1196
1300
|
children: [
|
|
1197
1301
|
method.name,
|
|
1198
1302
|
"(",
|
|
1199
1303
|
params.map((p) => {
|
|
1200
1304
|
const optional = p.required === false ? "?" : "";
|
|
1201
|
-
const type =
|
|
1305
|
+
const type = formatSchema7(p.schema);
|
|
1202
1306
|
return `${p.name}${optional}: ${type}`;
|
|
1203
1307
|
}).join(", "),
|
|
1204
1308
|
"): ",
|
|
1205
1309
|
returnType
|
|
1206
1310
|
]
|
|
1207
1311
|
}, undefined, true, undefined, this),
|
|
1208
|
-
method.description && /* @__PURE__ */
|
|
1312
|
+
method.description && /* @__PURE__ */ jsxDEV12("p", {
|
|
1209
1313
|
className: "text-sm text-fd-muted-foreground mt-2",
|
|
1210
1314
|
children: method.description
|
|
1211
1315
|
}, undefined, false, undefined, this)
|
|
@@ -1215,102 +1319,6 @@ function InterfacePage({ export: exp, spec }) {
|
|
|
1215
1319
|
}, undefined, false, undefined, this)
|
|
1216
1320
|
]
|
|
1217
1321
|
}, undefined, true, undefined, this),
|
|
1218
|
-
exp.examples && exp.examples.length > 0 && /* @__PURE__ */ jsxDEV11(ExamplesSection, {
|
|
1219
|
-
examples: exp.examples
|
|
1220
|
-
}, undefined, false, undefined, this),
|
|
1221
|
-
exp.docs && /* @__PURE__ */ jsxDEV11(CoverageBadge, {
|
|
1222
|
-
docs: exp.docs
|
|
1223
|
-
}, undefined, false, undefined, this)
|
|
1224
|
-
]
|
|
1225
|
-
}, undefined, true, undefined, this);
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
// src/components/enum-page.tsx
|
|
1229
|
-
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
1230
|
-
|
|
1231
|
-
function EnumPage({ export: exp, spec }) {
|
|
1232
|
-
const members = exp.members ?? [];
|
|
1233
|
-
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1234
|
-
className: "space-y-6",
|
|
1235
|
-
children: [
|
|
1236
|
-
exp.description && /* @__PURE__ */ jsxDEV12("p", {
|
|
1237
|
-
className: "text-fd-muted-foreground text-base leading-relaxed",
|
|
1238
|
-
children: exp.description
|
|
1239
|
-
}, undefined, false, undefined, this),
|
|
1240
|
-
/* @__PURE__ */ jsxDEV12("section", {
|
|
1241
|
-
children: [
|
|
1242
|
-
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1243
|
-
className: "text-xl font-semibold mb-2",
|
|
1244
|
-
children: "Declaration"
|
|
1245
|
-
}, undefined, false, undefined, this),
|
|
1246
|
-
/* @__PURE__ */ jsxDEV12(Signature, {
|
|
1247
|
-
export: exp
|
|
1248
|
-
}, undefined, false, undefined, this)
|
|
1249
|
-
]
|
|
1250
|
-
}, undefined, true, undefined, this),
|
|
1251
|
-
members.length > 0 && /* @__PURE__ */ jsxDEV12("section", {
|
|
1252
|
-
children: [
|
|
1253
|
-
/* @__PURE__ */ jsxDEV12("h2", {
|
|
1254
|
-
className: "text-xl font-semibold mb-2",
|
|
1255
|
-
children: "Members"
|
|
1256
|
-
}, undefined, false, undefined, this),
|
|
1257
|
-
/* @__PURE__ */ jsxDEV12("div", {
|
|
1258
|
-
className: "overflow-x-auto",
|
|
1259
|
-
children: /* @__PURE__ */ jsxDEV12("table", {
|
|
1260
|
-
className: "w-full text-sm border-collapse",
|
|
1261
|
-
children: [
|
|
1262
|
-
/* @__PURE__ */ jsxDEV12("thead", {
|
|
1263
|
-
children: /* @__PURE__ */ jsxDEV12("tr", {
|
|
1264
|
-
className: "border-b border-fd-border",
|
|
1265
|
-
children: [
|
|
1266
|
-
/* @__PURE__ */ jsxDEV12("th", {
|
|
1267
|
-
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
1268
|
-
children: "Name"
|
|
1269
|
-
}, undefined, false, undefined, this),
|
|
1270
|
-
/* @__PURE__ */ jsxDEV12("th", {
|
|
1271
|
-
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
1272
|
-
children: "Value"
|
|
1273
|
-
}, undefined, false, undefined, this),
|
|
1274
|
-
/* @__PURE__ */ jsxDEV12("th", {
|
|
1275
|
-
className: "text-left py-2 px-3 font-medium text-fd-muted-foreground",
|
|
1276
|
-
children: "Description"
|
|
1277
|
-
}, undefined, false, undefined, this)
|
|
1278
|
-
]
|
|
1279
|
-
}, undefined, true, undefined, this)
|
|
1280
|
-
}, undefined, false, undefined, this),
|
|
1281
|
-
/* @__PURE__ */ jsxDEV12("tbody", {
|
|
1282
|
-
children: members.map((member, index) => {
|
|
1283
|
-
const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? "-" : member.schema : "-";
|
|
1284
|
-
return /* @__PURE__ */ jsxDEV12("tr", {
|
|
1285
|
-
className: "border-b border-fd-border last:border-0",
|
|
1286
|
-
children: [
|
|
1287
|
-
/* @__PURE__ */ jsxDEV12("td", {
|
|
1288
|
-
className: "py-2 px-3 align-top",
|
|
1289
|
-
children: /* @__PURE__ */ jsxDEV12("code", {
|
|
1290
|
-
className: "text-fd-primary font-mono text-xs bg-fd-secondary px-1.5 py-0.5 rounded",
|
|
1291
|
-
children: member.name
|
|
1292
|
-
}, undefined, false, undefined, this)
|
|
1293
|
-
}, undefined, false, undefined, this),
|
|
1294
|
-
/* @__PURE__ */ jsxDEV12("td", {
|
|
1295
|
-
className: "py-2 px-3 align-top",
|
|
1296
|
-
children: /* @__PURE__ */ jsxDEV12("code", {
|
|
1297
|
-
className: "font-mono text-xs text-fd-muted-foreground",
|
|
1298
|
-
children: String(value)
|
|
1299
|
-
}, undefined, false, undefined, this)
|
|
1300
|
-
}, undefined, false, undefined, this),
|
|
1301
|
-
/* @__PURE__ */ jsxDEV12("td", {
|
|
1302
|
-
className: "py-2 px-3 align-top text-fd-muted-foreground",
|
|
1303
|
-
children: member.description ?? ""
|
|
1304
|
-
}, undefined, false, undefined, this)
|
|
1305
|
-
]
|
|
1306
|
-
}, member.name ?? index, true, undefined, this);
|
|
1307
|
-
})
|
|
1308
|
-
}, undefined, false, undefined, this)
|
|
1309
|
-
]
|
|
1310
|
-
}, undefined, true, undefined, this)
|
|
1311
|
-
}, undefined, false, undefined, this)
|
|
1312
|
-
]
|
|
1313
|
-
}, undefined, true, undefined, this),
|
|
1314
1322
|
exp.examples && exp.examples.length > 0 && /* @__PURE__ */ jsxDEV12(ExamplesSection, {
|
|
1315
1323
|
examples: exp.examples
|
|
1316
1324
|
}, undefined, false, undefined, this),
|
|
@@ -1324,7 +1332,7 @@ function EnumPage({ export: exp, spec }) {
|
|
|
1324
1332
|
// src/components/variable-page.tsx
|
|
1325
1333
|
import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
|
|
1326
1334
|
|
|
1327
|
-
function
|
|
1335
|
+
function formatSchema8(schema) {
|
|
1328
1336
|
if (!schema)
|
|
1329
1337
|
return "unknown";
|
|
1330
1338
|
if (typeof schema === "string")
|
|
@@ -1334,15 +1342,13 @@ function formatSchema7(schema) {
|
|
|
1334
1342
|
if (s.$ref && typeof s.$ref === "string") {
|
|
1335
1343
|
return s.$ref.replace("#/types/", "");
|
|
1336
1344
|
}
|
|
1337
|
-
if (s.tsType)
|
|
1338
|
-
return String(s.tsType);
|
|
1339
1345
|
if (s.type)
|
|
1340
1346
|
return String(s.type);
|
|
1341
1347
|
}
|
|
1342
1348
|
return "unknown";
|
|
1343
1349
|
}
|
|
1344
|
-
function VariablePage({ export: exp, spec }) {
|
|
1345
|
-
const typeValue = typeof exp.type === "string" ? exp.type :
|
|
1350
|
+
function VariablePage({ export: exp, spec: _spec }) {
|
|
1351
|
+
const typeValue = typeof exp.type === "string" ? exp.type : formatSchema8(exp.schema);
|
|
1346
1352
|
const hasExamples = exp.examples && exp.examples.length > 0;
|
|
1347
1353
|
return /* @__PURE__ */ jsxDEV13("div", {
|
|
1348
1354
|
className: "space-y-8",
|
|
@@ -1473,11 +1479,6 @@ function APIPage({ spec, instance, id }) {
|
|
|
1473
1479
|
return /* @__PURE__ */ jsxDEV14(EnumPage, {
|
|
1474
1480
|
...pageProps
|
|
1475
1481
|
}, undefined, false, undefined, this);
|
|
1476
|
-
case "variable":
|
|
1477
|
-
case "namespace":
|
|
1478
|
-
case "module":
|
|
1479
|
-
case "reference":
|
|
1480
|
-
case "external":
|
|
1481
1482
|
default:
|
|
1482
1483
|
return /* @__PURE__ */ jsxDEV14(VariablePage, {
|
|
1483
1484
|
...pageProps
|
|
@@ -1485,4 +1486,4 @@ function APIPage({ spec, instance, id }) {
|
|
|
1485
1486
|
}
|
|
1486
1487
|
}
|
|
1487
1488
|
|
|
1488
|
-
export {
|
|
1489
|
+
export { CodeExample, NestedProperty, ExpandableProperty, CollapsibleMethod, CoverageBadge, ClassPage, ExamplesSection, Signature, EnumPage, ParameterCard, FunctionPage, TypeTable, InterfacePage, VariablePage, APIPage };
|