@openpkg-ts/doc-generator 0.1.0

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.
@@ -0,0 +1,766 @@
1
+ "use client";
2
+ import {
3
+ CollapsibleMethod,
4
+ ExampleBlock,
5
+ ExpandableProperty,
6
+ MemberRow,
7
+ MembersTable,
8
+ NestedProperty,
9
+ ParamRow,
10
+ ParamTable,
11
+ Signature,
12
+ TypeTable,
13
+ cleanCode,
14
+ getExampleCode,
15
+ getExampleLanguage,
16
+ getExampleTitle,
17
+ groupMembersByKind
18
+ } from "./shared/chunk-e5fkh3kh.js";
19
+ import {
20
+ buildSignatureString,
21
+ formatSchema
22
+ } from "./shared/chunk-taeg9090.js";
23
+ // src/components/styled/ClassPage.tsx
24
+ import { jsxDEV } from "react/jsx-dev-runtime";
25
+
26
+ function PropertyItem({ member }) {
27
+ const visibility = member.visibility ?? "public";
28
+ const flags = member.flags;
29
+ const isStatic = flags?.static;
30
+ const isReadonly = flags?.readonly;
31
+ const type = formatSchema(member.schema);
32
+ return /* @__PURE__ */ jsxDEV("div", {
33
+ className: "py-3 border-b border-border last:border-0",
34
+ children: [
35
+ /* @__PURE__ */ jsxDEV("div", {
36
+ className: "flex items-baseline gap-2 flex-wrap",
37
+ children: [
38
+ /* @__PURE__ */ jsxDEV("span", {
39
+ className: "font-semibold text-foreground",
40
+ children: [
41
+ member.name,
42
+ ":"
43
+ ]
44
+ }, undefined, true, undefined, this),
45
+ /* @__PURE__ */ jsxDEV("span", {
46
+ className: "text-muted-foreground font-mono text-sm",
47
+ children: type
48
+ }, undefined, false, undefined, this),
49
+ visibility !== "public" && /* @__PURE__ */ jsxDEV("span", {
50
+ className: "text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",
51
+ children: visibility
52
+ }, undefined, false, undefined, this),
53
+ isStatic && /* @__PURE__ */ jsxDEV("span", {
54
+ className: "text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 dark:text-blue-400",
55
+ children: "static"
56
+ }, undefined, false, undefined, this),
57
+ isReadonly && /* @__PURE__ */ jsxDEV("span", {
58
+ className: "text-xs px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-600 dark:text-purple-400",
59
+ children: "readonly"
60
+ }, undefined, false, undefined, this)
61
+ ]
62
+ }, undefined, true, undefined, this),
63
+ member.description && /* @__PURE__ */ jsxDEV("p", {
64
+ className: "text-sm text-muted-foreground mt-1",
65
+ children: member.description
66
+ }, undefined, false, undefined, this)
67
+ ]
68
+ }, undefined, true, undefined, this);
69
+ }
70
+ function ClassPage({ export: exp, spec, renderExample }) {
71
+ const hasExamples = exp.examples && exp.examples.length > 0;
72
+ const constructors = exp.members?.filter((m) => m.kind === "constructor") ?? [];
73
+ const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field") ?? [];
74
+ const methods = exp.members?.filter((m) => m.kind === "method") ?? [];
75
+ const constructorSig = constructors[0]?.signatures?.[0];
76
+ const constructorParams = constructorSig?.parameters ?? [];
77
+ const exampleCode = hasExamples ? typeof exp.examples[0] === "string" ? exp.examples[0] : exp.examples[0].code : "";
78
+ return /* @__PURE__ */ jsxDEV("div", {
79
+ className: "space-y-8",
80
+ children: [
81
+ exp.description && /* @__PURE__ */ jsxDEV("p", {
82
+ className: "text-muted-foreground text-lg leading-relaxed",
83
+ children: exp.description
84
+ }, undefined, false, undefined, this),
85
+ /* @__PURE__ */ jsxDEV("div", {
86
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
87
+ children: /* @__PURE__ */ jsxDEV("code", {
88
+ className: "font-mono text-sm text-foreground whitespace-pre",
89
+ children: [
90
+ "class ",
91
+ exp.name,
92
+ exp.extends ? ` extends ${exp.extends}` : "",
93
+ exp.implements?.length ? ` implements ${exp.implements.join(", ")}` : ""
94
+ ]
95
+ }, undefined, true, undefined, this)
96
+ }, undefined, false, undefined, this),
97
+ /* @__PURE__ */ jsxDEV("div", {
98
+ className: `grid gap-8 ${hasExamples ? "lg:grid-cols-2" : "grid-cols-1"}`,
99
+ children: [
100
+ /* @__PURE__ */ jsxDEV("div", {
101
+ className: "space-y-8",
102
+ children: [
103
+ constructorParams.length > 0 && /* @__PURE__ */ jsxDEV("section", {
104
+ children: [
105
+ /* @__PURE__ */ jsxDEV("h3", {
106
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
107
+ children: "Constructor"
108
+ }, undefined, false, undefined, this),
109
+ /* @__PURE__ */ jsxDEV("div", {
110
+ className: "ml-2 border-l-2 border-border pl-4",
111
+ children: constructorParams.map((param, index) => /* @__PURE__ */ jsxDEV(ExpandableProperty, {
112
+ param
113
+ }, param.name ?? index, false, undefined, this))
114
+ }, undefined, false, undefined, this)
115
+ ]
116
+ }, undefined, true, undefined, this),
117
+ methods.length > 0 && /* @__PURE__ */ jsxDEV("section", {
118
+ children: [
119
+ /* @__PURE__ */ jsxDEV("h3", {
120
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
121
+ children: "Methods"
122
+ }, undefined, false, undefined, this),
123
+ /* @__PURE__ */ jsxDEV("div", {
124
+ className: "rounded-lg border border-border overflow-hidden",
125
+ children: methods.map((member, index) => /* @__PURE__ */ jsxDEV(CollapsibleMethod, {
126
+ member,
127
+ defaultExpanded: index === 0
128
+ }, member.name ?? index, false, undefined, this))
129
+ }, undefined, false, undefined, this)
130
+ ]
131
+ }, undefined, true, undefined, this),
132
+ properties.length > 0 && /* @__PURE__ */ jsxDEV("section", {
133
+ children: [
134
+ /* @__PURE__ */ jsxDEV("h3", {
135
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
136
+ children: "Properties"
137
+ }, undefined, false, undefined, this),
138
+ /* @__PURE__ */ jsxDEV("div", {
139
+ className: "rounded-lg border border-border bg-card px-4",
140
+ children: properties.map((member, index) => /* @__PURE__ */ jsxDEV(PropertyItem, {
141
+ member
142
+ }, member.name ?? index, false, undefined, this))
143
+ }, undefined, false, undefined, this)
144
+ ]
145
+ }, undefined, true, undefined, this)
146
+ ]
147
+ }, undefined, true, undefined, this),
148
+ hasExamples && /* @__PURE__ */ jsxDEV("div", {
149
+ className: "lg:sticky lg:top-20 lg:self-start",
150
+ children: [
151
+ /* @__PURE__ */ jsxDEV("h3", {
152
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
153
+ children: "Example"
154
+ }, undefined, false, undefined, this),
155
+ renderExample ? renderExample(exampleCode, `${exp.name.toLowerCase()}.ts`) : /* @__PURE__ */ jsxDEV("pre", {
156
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
157
+ children: /* @__PURE__ */ jsxDEV("code", {
158
+ className: "font-mono text-sm text-foreground",
159
+ children: exampleCode
160
+ }, undefined, false, undefined, this)
161
+ }, undefined, false, undefined, this)
162
+ ]
163
+ }, undefined, true, undefined, this)
164
+ ]
165
+ }, undefined, true, undefined, this)
166
+ ]
167
+ }, undefined, true, undefined, this);
168
+ }
169
+
170
+ // src/components/styled/EnumPage.tsx
171
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
172
+
173
+ function EnumPage({ export: exp, spec, renderExample }) {
174
+ const members = exp.members ?? [];
175
+ const hasExamples = exp.examples && exp.examples.length > 0;
176
+ const signature = buildSignatureString(exp);
177
+ return /* @__PURE__ */ jsxDEV2("div", {
178
+ className: "space-y-6",
179
+ children: [
180
+ exp.description && /* @__PURE__ */ jsxDEV2("p", {
181
+ className: "text-muted-foreground text-base leading-relaxed",
182
+ children: exp.description
183
+ }, undefined, false, undefined, this),
184
+ /* @__PURE__ */ jsxDEV2("section", {
185
+ children: [
186
+ /* @__PURE__ */ jsxDEV2("h2", {
187
+ className: "text-xl font-semibold mb-2",
188
+ children: "Declaration"
189
+ }, undefined, false, undefined, this),
190
+ /* @__PURE__ */ jsxDEV2("div", {
191
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
192
+ children: /* @__PURE__ */ jsxDEV2("code", {
193
+ className: "font-mono text-sm text-foreground",
194
+ children: signature
195
+ }, undefined, false, undefined, this)
196
+ }, undefined, false, undefined, this),
197
+ exp.deprecated && /* @__PURE__ */ jsxDEV2("div", {
198
+ 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",
199
+ children: [
200
+ /* @__PURE__ */ jsxDEV2("strong", {
201
+ children: "Deprecated:"
202
+ }, undefined, false, undefined, this),
203
+ " This export is deprecated."
204
+ ]
205
+ }, undefined, true, undefined, this)
206
+ ]
207
+ }, undefined, true, undefined, this),
208
+ members.length > 0 && /* @__PURE__ */ jsxDEV2("section", {
209
+ children: [
210
+ /* @__PURE__ */ jsxDEV2("h2", {
211
+ className: "text-xl font-semibold mb-2",
212
+ children: "Members"
213
+ }, undefined, false, undefined, this),
214
+ /* @__PURE__ */ jsxDEV2("div", {
215
+ className: "overflow-x-auto",
216
+ children: /* @__PURE__ */ jsxDEV2("table", {
217
+ className: "w-full text-sm border-collapse",
218
+ children: [
219
+ /* @__PURE__ */ jsxDEV2("thead", {
220
+ children: /* @__PURE__ */ jsxDEV2("tr", {
221
+ className: "border-b border-border",
222
+ children: [
223
+ /* @__PURE__ */ jsxDEV2("th", {
224
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
225
+ children: "Name"
226
+ }, undefined, false, undefined, this),
227
+ /* @__PURE__ */ jsxDEV2("th", {
228
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
229
+ children: "Value"
230
+ }, undefined, false, undefined, this),
231
+ /* @__PURE__ */ jsxDEV2("th", {
232
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
233
+ children: "Description"
234
+ }, undefined, false, undefined, this)
235
+ ]
236
+ }, undefined, true, undefined, this)
237
+ }, undefined, false, undefined, this),
238
+ /* @__PURE__ */ jsxDEV2("tbody", {
239
+ children: members.map((member, index) => {
240
+ const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? "-" : member.schema : "-";
241
+ return /* @__PURE__ */ jsxDEV2("tr", {
242
+ className: "border-b border-border last:border-0",
243
+ children: [
244
+ /* @__PURE__ */ jsxDEV2("td", {
245
+ className: "py-2 px-3 align-top",
246
+ children: /* @__PURE__ */ jsxDEV2("code", {
247
+ className: "text-primary font-mono text-xs bg-secondary px-1.5 py-0.5 rounded",
248
+ children: member.name
249
+ }, undefined, false, undefined, this)
250
+ }, undefined, false, undefined, this),
251
+ /* @__PURE__ */ jsxDEV2("td", {
252
+ className: "py-2 px-3 align-top",
253
+ children: /* @__PURE__ */ jsxDEV2("code", {
254
+ className: "font-mono text-xs text-muted-foreground",
255
+ children: String(value)
256
+ }, undefined, false, undefined, this)
257
+ }, undefined, false, undefined, this),
258
+ /* @__PURE__ */ jsxDEV2("td", {
259
+ className: "py-2 px-3 align-top text-muted-foreground",
260
+ children: member.description ?? ""
261
+ }, undefined, false, undefined, this)
262
+ ]
263
+ }, member.name ?? index, true, undefined, this);
264
+ })
265
+ }, undefined, false, undefined, this)
266
+ ]
267
+ }, undefined, true, undefined, this)
268
+ }, undefined, false, undefined, this)
269
+ ]
270
+ }, undefined, true, undefined, this),
271
+ hasExamples && /* @__PURE__ */ jsxDEV2("section", {
272
+ children: [
273
+ /* @__PURE__ */ jsxDEV2("h2", {
274
+ className: "text-xl font-semibold mb-2",
275
+ children: "Examples"
276
+ }, undefined, false, undefined, this),
277
+ exp.examples.map((example, index) => {
278
+ const code = typeof example === "string" ? example : example.code;
279
+ return /* @__PURE__ */ jsxDEV2("div", {
280
+ className: "mb-4",
281
+ children: renderExample ? renderExample(code, `${exp.name.toLowerCase()}-${index}.ts`) : /* @__PURE__ */ jsxDEV2("pre", {
282
+ className: "rounded-lg border border-border bg-secondary p-4 overflow-x-auto",
283
+ children: /* @__PURE__ */ jsxDEV2("code", {
284
+ className: "font-mono text-sm text-foreground",
285
+ children: code
286
+ }, undefined, false, undefined, this)
287
+ }, undefined, false, undefined, this)
288
+ }, index, false, undefined, this);
289
+ })
290
+ ]
291
+ }, undefined, true, undefined, this)
292
+ ]
293
+ }, undefined, true, undefined, this);
294
+ }
295
+
296
+ // src/components/styled/FunctionPage.tsx
297
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
298
+
299
+ function FunctionPage({
300
+ export: exp,
301
+ spec,
302
+ renderExample
303
+ }) {
304
+ const sig = exp.signatures?.[0];
305
+ const hasExamples = exp.examples && exp.examples.length > 0;
306
+ const hasParams = sig?.parameters && sig.parameters.length > 0;
307
+ const exampleCode = hasExamples ? typeof exp.examples[0] === "string" ? exp.examples[0] : exp.examples[0].code : "";
308
+ return /* @__PURE__ */ jsxDEV3("div", {
309
+ className: "space-y-6 not-prose",
310
+ children: [
311
+ exp.description && /* @__PURE__ */ jsxDEV3("p", {
312
+ className: "text-muted-foreground leading-relaxed",
313
+ children: exp.description
314
+ }, undefined, false, undefined, this),
315
+ sig?.returns && /* @__PURE__ */ jsxDEV3("p", {
316
+ className: "text-muted-foreground text-sm",
317
+ children: [
318
+ /* @__PURE__ */ jsxDEV3("span", {
319
+ className: "font-medium text-foreground",
320
+ children: "Returns:"
321
+ }, undefined, false, undefined, this),
322
+ " ",
323
+ sig.returns.description || `A ${formatSchema(sig.returns.schema)}`
324
+ ]
325
+ }, undefined, true, undefined, this),
326
+ /* @__PURE__ */ jsxDEV3("div", {
327
+ className: "not-prose",
328
+ style: {
329
+ display: hasExamples ? "grid" : "block",
330
+ gridTemplateColumns: hasExamples ? "repeat(2, minmax(0, 1fr))" : undefined,
331
+ gap: "2rem",
332
+ alignItems: "start"
333
+ },
334
+ children: [
335
+ /* @__PURE__ */ jsxDEV3("div", {
336
+ className: "space-y-6",
337
+ children: hasParams && /* @__PURE__ */ jsxDEV3("div", {
338
+ children: [
339
+ /* @__PURE__ */ jsxDEV3("h3", {
340
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
341
+ children: "Parameters"
342
+ }, undefined, false, undefined, this),
343
+ /* @__PURE__ */ jsxDEV3("div", {
344
+ className: "space-y-3 rounded-lg border border-border bg-card/50 p-4",
345
+ children: sig.parameters.map((param, index) => /* @__PURE__ */ jsxDEV3("div", {
346
+ className: "border-b border-border last:border-0 pb-3 last:pb-0",
347
+ children: [
348
+ /* @__PURE__ */ jsxDEV3("div", {
349
+ className: "flex items-baseline gap-2 mb-1",
350
+ children: [
351
+ /* @__PURE__ */ jsxDEV3("span", {
352
+ className: "font-mono text-sm text-foreground",
353
+ children: param.name
354
+ }, undefined, false, undefined, this),
355
+ param.required !== false && /* @__PURE__ */ jsxDEV3("span", {
356
+ className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-border bg-muted text-muted-foreground uppercase tracking-wide",
357
+ children: "Required"
358
+ }, undefined, false, undefined, this)
359
+ ]
360
+ }, undefined, true, undefined, this),
361
+ /* @__PURE__ */ jsxDEV3("div", {
362
+ className: "text-sm text-muted-foreground font-mono",
363
+ children: formatSchema(param.schema)
364
+ }, undefined, false, undefined, this),
365
+ param.description && /* @__PURE__ */ jsxDEV3("p", {
366
+ className: "text-sm text-muted-foreground mt-2",
367
+ children: param.description
368
+ }, undefined, false, undefined, this)
369
+ ]
370
+ }, param.name ?? index, true, undefined, this))
371
+ }, undefined, false, undefined, this)
372
+ ]
373
+ }, undefined, true, undefined, this)
374
+ }, undefined, false, undefined, this),
375
+ hasExamples && /* @__PURE__ */ jsxDEV3("div", {
376
+ style: { position: "sticky", top: "5rem" },
377
+ children: [
378
+ /* @__PURE__ */ jsxDEV3("h3", {
379
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
380
+ children: "Example"
381
+ }, undefined, false, undefined, this),
382
+ renderExample ? renderExample(exampleCode, `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}.ts`) : /* @__PURE__ */ jsxDEV3("pre", {
383
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
384
+ children: /* @__PURE__ */ jsxDEV3("code", {
385
+ className: "font-mono text-sm text-foreground",
386
+ children: exampleCode
387
+ }, undefined, false, undefined, this)
388
+ }, undefined, false, undefined, this)
389
+ ]
390
+ }, undefined, true, undefined, this)
391
+ ]
392
+ }, undefined, true, undefined, this)
393
+ ]
394
+ }, undefined, true, undefined, this);
395
+ }
396
+
397
+ // src/components/styled/InterfacePage.tsx
398
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
399
+
400
+ function InterfacePage({
401
+ export: exp,
402
+ spec,
403
+ renderExample
404
+ }) {
405
+ const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field" || !m.kind);
406
+ const methods = exp.members?.filter((m) => m.kind === "method" || m.kind === "function");
407
+ const hasExamples = exp.examples && exp.examples.length > 0;
408
+ const signature = buildSignatureString(exp);
409
+ return /* @__PURE__ */ jsxDEV4("div", {
410
+ className: "space-y-6",
411
+ children: [
412
+ exp.description && /* @__PURE__ */ jsxDEV4("p", {
413
+ className: "text-muted-foreground text-base leading-relaxed",
414
+ children: exp.description
415
+ }, undefined, false, undefined, this),
416
+ /* @__PURE__ */ jsxDEV4("section", {
417
+ children: [
418
+ /* @__PURE__ */ jsxDEV4("h2", {
419
+ className: "text-xl font-semibold mb-2",
420
+ children: "Declaration"
421
+ }, undefined, false, undefined, this),
422
+ /* @__PURE__ */ jsxDEV4("div", {
423
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
424
+ children: /* @__PURE__ */ jsxDEV4("code", {
425
+ className: "font-mono text-sm text-foreground",
426
+ children: signature
427
+ }, undefined, false, undefined, this)
428
+ }, undefined, false, undefined, this),
429
+ exp.deprecated && /* @__PURE__ */ jsxDEV4("div", {
430
+ 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",
431
+ children: [
432
+ /* @__PURE__ */ jsxDEV4("strong", {
433
+ children: "Deprecated:"
434
+ }, undefined, false, undefined, this),
435
+ " This export is deprecated."
436
+ ]
437
+ }, undefined, true, undefined, this)
438
+ ]
439
+ }, undefined, true, undefined, this),
440
+ exp.extends && /* @__PURE__ */ jsxDEV4("section", {
441
+ children: [
442
+ /* @__PURE__ */ jsxDEV4("h2", {
443
+ className: "text-xl font-semibold mb-2",
444
+ children: "Extends"
445
+ }, undefined, false, undefined, this),
446
+ /* @__PURE__ */ jsxDEV4("div", {
447
+ className: "rounded-lg border border-border bg-card p-4",
448
+ children: /* @__PURE__ */ jsxDEV4("code", {
449
+ className: "font-mono text-sm text-primary",
450
+ children: exp.extends
451
+ }, undefined, false, undefined, this)
452
+ }, undefined, false, undefined, this)
453
+ ]
454
+ }, undefined, true, undefined, this),
455
+ properties && properties.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
456
+ children: [
457
+ /* @__PURE__ */ jsxDEV4("h2", {
458
+ className: "text-xl font-semibold mb-2",
459
+ children: "Properties"
460
+ }, undefined, false, undefined, this),
461
+ /* @__PURE__ */ jsxDEV4("div", {
462
+ className: "overflow-x-auto",
463
+ children: /* @__PURE__ */ jsxDEV4("table", {
464
+ className: "w-full text-sm border-collapse",
465
+ children: [
466
+ /* @__PURE__ */ jsxDEV4("thead", {
467
+ children: /* @__PURE__ */ jsxDEV4("tr", {
468
+ className: "border-b border-border",
469
+ children: [
470
+ /* @__PURE__ */ jsxDEV4("th", {
471
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
472
+ children: "Name"
473
+ }, undefined, false, undefined, this),
474
+ /* @__PURE__ */ jsxDEV4("th", {
475
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
476
+ children: "Type"
477
+ }, undefined, false, undefined, this),
478
+ /* @__PURE__ */ jsxDEV4("th", {
479
+ className: "text-left py-2 px-3 font-medium text-muted-foreground",
480
+ children: "Description"
481
+ }, undefined, false, undefined, this)
482
+ ]
483
+ }, undefined, true, undefined, this)
484
+ }, undefined, false, undefined, this),
485
+ /* @__PURE__ */ jsxDEV4("tbody", {
486
+ children: properties.map((prop, index) => /* @__PURE__ */ jsxDEV4("tr", {
487
+ className: "border-b border-border last:border-0",
488
+ children: [
489
+ /* @__PURE__ */ jsxDEV4("td", {
490
+ className: "py-2 px-3 align-top",
491
+ children: /* @__PURE__ */ jsxDEV4("code", {
492
+ className: "text-primary font-mono text-xs bg-secondary px-1.5 py-0.5 rounded",
493
+ children: prop.name
494
+ }, undefined, false, undefined, this)
495
+ }, undefined, false, undefined, this),
496
+ /* @__PURE__ */ jsxDEV4("td", {
497
+ className: "py-2 px-3 align-top",
498
+ children: /* @__PURE__ */ jsxDEV4("code", {
499
+ className: "font-mono text-xs text-muted-foreground",
500
+ children: formatSchema(prop.schema)
501
+ }, undefined, false, undefined, this)
502
+ }, undefined, false, undefined, this),
503
+ /* @__PURE__ */ jsxDEV4("td", {
504
+ className: "py-2 px-3 align-top text-muted-foreground",
505
+ children: prop.description ?? ""
506
+ }, undefined, false, undefined, this)
507
+ ]
508
+ }, prop.name ?? index, true, undefined, this))
509
+ }, undefined, false, undefined, this)
510
+ ]
511
+ }, undefined, true, undefined, this)
512
+ }, undefined, false, undefined, this)
513
+ ]
514
+ }, undefined, true, undefined, this),
515
+ methods && methods.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
516
+ children: [
517
+ /* @__PURE__ */ jsxDEV4("h2", {
518
+ className: "text-xl font-semibold mb-2",
519
+ children: "Methods"
520
+ }, undefined, false, undefined, this),
521
+ /* @__PURE__ */ jsxDEV4("div", {
522
+ className: "space-y-4",
523
+ children: methods.map((method, index) => {
524
+ const sig = method.signatures?.[0];
525
+ const params = sig?.parameters ?? [];
526
+ const returnType = formatSchema(sig?.returns?.schema);
527
+ return /* @__PURE__ */ jsxDEV4("div", {
528
+ className: "rounded-lg border border-border p-4",
529
+ children: [
530
+ /* @__PURE__ */ jsxDEV4("code", {
531
+ className: "font-mono text-sm text-primary",
532
+ children: [
533
+ method.name,
534
+ "(",
535
+ params.map((p) => {
536
+ const optional = p.required === false ? "?" : "";
537
+ const type = formatSchema(p.schema);
538
+ return `${p.name}${optional}: ${type}`;
539
+ }).join(", "),
540
+ "): ",
541
+ returnType
542
+ ]
543
+ }, undefined, true, undefined, this),
544
+ method.description && /* @__PURE__ */ jsxDEV4("p", {
545
+ className: "text-sm text-muted-foreground mt-2",
546
+ children: method.description
547
+ }, undefined, false, undefined, this)
548
+ ]
549
+ }, method.name ?? index, true, undefined, this);
550
+ })
551
+ }, undefined, false, undefined, this)
552
+ ]
553
+ }, undefined, true, undefined, this),
554
+ hasExamples && /* @__PURE__ */ jsxDEV4("section", {
555
+ children: [
556
+ /* @__PURE__ */ jsxDEV4("h2", {
557
+ className: "text-xl font-semibold mb-2",
558
+ children: "Examples"
559
+ }, undefined, false, undefined, this),
560
+ exp.examples.map((example, index) => {
561
+ const code = typeof example === "string" ? example : example.code;
562
+ const title = typeof example === "string" ? undefined : example.title;
563
+ return /* @__PURE__ */ jsxDEV4("div", {
564
+ className: "mb-4",
565
+ children: [
566
+ title && /* @__PURE__ */ jsxDEV4("h3", {
567
+ className: "text-sm font-medium mb-2",
568
+ children: title
569
+ }, undefined, false, undefined, this),
570
+ renderExample ? renderExample(code, `${exp.name.toLowerCase()}-${index}.ts`) : /* @__PURE__ */ jsxDEV4("pre", {
571
+ className: "rounded-lg border border-border bg-secondary p-4 overflow-x-auto",
572
+ children: /* @__PURE__ */ jsxDEV4("code", {
573
+ className: "font-mono text-sm text-foreground",
574
+ children: code
575
+ }, undefined, false, undefined, this)
576
+ }, undefined, false, undefined, this)
577
+ ]
578
+ }, index, true, undefined, this);
579
+ })
580
+ ]
581
+ }, undefined, true, undefined, this)
582
+ ]
583
+ }, undefined, true, undefined, this);
584
+ }
585
+
586
+ // src/components/styled/VariablePage.tsx
587
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
588
+
589
+ function VariablePage({
590
+ export: exp,
591
+ spec,
592
+ renderExample
593
+ }) {
594
+ const typeValue = typeof exp.type === "string" ? exp.type : formatSchema(exp.schema);
595
+ const hasExamples = exp.examples && exp.examples.length > 0;
596
+ const exampleCode = hasExamples ? typeof exp.examples[0] === "string" ? exp.examples[0] : exp.examples[0].code : "";
597
+ return /* @__PURE__ */ jsxDEV5("div", {
598
+ className: "space-y-8",
599
+ children: [
600
+ exp.description && /* @__PURE__ */ jsxDEV5("p", {
601
+ className: "text-muted-foreground text-lg leading-relaxed",
602
+ children: exp.description
603
+ }, undefined, false, undefined, this),
604
+ /* @__PURE__ */ jsxDEV5("div", {
605
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
606
+ children: /* @__PURE__ */ jsxDEV5("code", {
607
+ className: "font-mono text-sm text-foreground whitespace-pre",
608
+ children: [
609
+ "const ",
610
+ exp.name,
611
+ ": ",
612
+ typeValue
613
+ ]
614
+ }, undefined, true, undefined, this)
615
+ }, undefined, false, undefined, this),
616
+ exp.deprecated && /* @__PURE__ */ jsxDEV5("div", {
617
+ className: "rounded-md bg-yellow-500/10 border border-yellow-500/20 px-3 py-2 text-sm text-yellow-600 dark:text-yellow-400",
618
+ children: [
619
+ /* @__PURE__ */ jsxDEV5("strong", {
620
+ children: "Deprecated:"
621
+ }, undefined, false, undefined, this),
622
+ " This export is deprecated."
623
+ ]
624
+ }, undefined, true, undefined, this),
625
+ /* @__PURE__ */ jsxDEV5("div", {
626
+ className: `grid gap-8 ${hasExamples ? "lg:grid-cols-2" : "grid-cols-1"}`,
627
+ children: [
628
+ /* @__PURE__ */ jsxDEV5("div", {
629
+ className: "space-y-6",
630
+ children: /* @__PURE__ */ jsxDEV5("div", {
631
+ children: [
632
+ /* @__PURE__ */ jsxDEV5("h3", {
633
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3",
634
+ children: "Type"
635
+ }, undefined, false, undefined, this),
636
+ /* @__PURE__ */ jsxDEV5("div", {
637
+ className: "rounded-lg border border-border bg-card p-4",
638
+ children: /* @__PURE__ */ jsxDEV5("code", {
639
+ className: "font-mono text-sm text-primary",
640
+ children: typeValue
641
+ }, undefined, false, undefined, this)
642
+ }, undefined, false, undefined, this)
643
+ ]
644
+ }, undefined, true, undefined, this)
645
+ }, undefined, false, undefined, this),
646
+ hasExamples && /* @__PURE__ */ jsxDEV5("div", {
647
+ children: [
648
+ /* @__PURE__ */ jsxDEV5("h3", {
649
+ className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3",
650
+ children: [
651
+ exp.name,
652
+ " usage"
653
+ ]
654
+ }, undefined, true, undefined, this),
655
+ renderExample ? renderExample(exampleCode, `${exp.name.toLowerCase()}.ts`) : /* @__PURE__ */ jsxDEV5("pre", {
656
+ className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
657
+ children: /* @__PURE__ */ jsxDEV5("code", {
658
+ className: "font-mono text-sm text-foreground",
659
+ children: exampleCode
660
+ }, undefined, false, undefined, this)
661
+ }, undefined, false, undefined, this)
662
+ ]
663
+ }, undefined, true, undefined, this)
664
+ ]
665
+ }, undefined, true, undefined, this)
666
+ ]
667
+ }, undefined, true, undefined, this);
668
+ }
669
+
670
+ // src/components/styled/APIPage.tsx
671
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
672
+
673
+ function NotFound({ id }) {
674
+ return /* @__PURE__ */ jsxDEV6("div", {
675
+ className: "rounded-lg border border-border bg-card p-6 text-center",
676
+ children: /* @__PURE__ */ jsxDEV6("p", {
677
+ className: "text-muted-foreground",
678
+ children: [
679
+ "Export ",
680
+ /* @__PURE__ */ jsxDEV6("code", {
681
+ className: "font-mono text-primary",
682
+ children: id
683
+ }, undefined, false, undefined, this),
684
+ " not found in spec."
685
+ ]
686
+ }, undefined, true, undefined, this)
687
+ }, undefined, false, undefined, this);
688
+ }
689
+ function NoSpec() {
690
+ return /* @__PURE__ */ jsxDEV6("div", {
691
+ className: "rounded-lg border border-red-500/20 bg-red-500/10 p-6 text-center",
692
+ children: /* @__PURE__ */ jsxDEV6("p", {
693
+ className: "text-red-600 dark:text-red-400",
694
+ children: [
695
+ "No spec provided. Pass either ",
696
+ /* @__PURE__ */ jsxDEV6("code", {
697
+ children: "spec"
698
+ }, undefined, false, undefined, this),
699
+ " or ",
700
+ /* @__PURE__ */ jsxDEV6("code", {
701
+ children: "instance"
702
+ }, undefined, false, undefined, this),
703
+ " prop."
704
+ ]
705
+ }, undefined, true, undefined, this)
706
+ }, undefined, false, undefined, this);
707
+ }
708
+ function APIPage({ spec, instance, id, renderExample }) {
709
+ const resolvedSpec = spec ?? instance?.spec;
710
+ if (!resolvedSpec) {
711
+ return /* @__PURE__ */ jsxDEV6(NoSpec, {}, undefined, false, undefined, this);
712
+ }
713
+ const exp = resolvedSpec.exports.find((e) => e.id === id);
714
+ if (!exp) {
715
+ return /* @__PURE__ */ jsxDEV6(NotFound, {
716
+ id
717
+ }, undefined, false, undefined, this);
718
+ }
719
+ const pageProps = { export: exp, spec: resolvedSpec, renderExample };
720
+ switch (exp.kind) {
721
+ case "function":
722
+ return /* @__PURE__ */ jsxDEV6(FunctionPage, {
723
+ ...pageProps
724
+ }, undefined, false, undefined, this);
725
+ case "class":
726
+ return /* @__PURE__ */ jsxDEV6(ClassPage, {
727
+ ...pageProps
728
+ }, undefined, false, undefined, this);
729
+ case "interface":
730
+ case "type":
731
+ return /* @__PURE__ */ jsxDEV6(InterfacePage, {
732
+ ...pageProps
733
+ }, undefined, false, undefined, this);
734
+ case "enum":
735
+ return /* @__PURE__ */ jsxDEV6(EnumPage, {
736
+ ...pageProps
737
+ }, undefined, false, undefined, this);
738
+ default:
739
+ return /* @__PURE__ */ jsxDEV6(VariablePage, {
740
+ ...pageProps
741
+ }, undefined, false, undefined, this);
742
+ }
743
+ }
744
+ export {
745
+ groupMembersByKind,
746
+ getExampleTitle,
747
+ getExampleLanguage,
748
+ getExampleCode,
749
+ cleanCode,
750
+ VariablePage,
751
+ TypeTable,
752
+ Signature,
753
+ ParamTable,
754
+ ParamRow,
755
+ NestedProperty,
756
+ MembersTable,
757
+ MemberRow,
758
+ InterfacePage,
759
+ FunctionPage,
760
+ ExpandableProperty,
761
+ ExampleBlock,
762
+ EnumPage,
763
+ CollapsibleMethod,
764
+ ClassPage,
765
+ APIPage
766
+ };