@openpkg-ts/doc-generator 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -1,21 +1,772 @@
1
- import {
2
- CollapsibleMethod,
3
- ExampleBlock,
4
- ExpandableProperty,
5
- MemberRow,
6
- MembersTable,
7
- NestedProperty,
8
- ParamRow,
9
- ParamTable,
10
- Signature,
11
- TypeTable,
12
- cleanCode,
13
- getExampleCode,
14
- getExampleLanguage,
15
- getExampleTitle,
16
- groupMembersByKind
17
- } from "./shared/chunk-e5fkh3kh.js";
18
- import"./shared/chunk-taeg9090.js";
1
+ "use client";
2
+ // src/components/headless/CollapsibleMethod.tsx
3
+ import { useEffect, useState } from "react";
4
+
5
+ // src/core/query.ts
6
+ function formatSchema(schema) {
7
+ if (!schema)
8
+ return "unknown";
9
+ if (typeof schema === "string")
10
+ return schema;
11
+ if (typeof schema === "object" && schema !== null) {
12
+ if ("$ref" in schema && typeof schema.$ref === "string") {
13
+ return schema.$ref.replace("#/types/", "");
14
+ }
15
+ if ("anyOf" in schema && Array.isArray(schema.anyOf)) {
16
+ return schema.anyOf.map((s) => formatSchema(s)).join(" | ");
17
+ }
18
+ if ("allOf" in schema && Array.isArray(schema.allOf)) {
19
+ return schema.allOf.map((s) => formatSchema(s)).join(" & ");
20
+ }
21
+ if ("type" in schema && schema.type === "array") {
22
+ const items = "items" in schema ? formatSchema(schema.items) : "unknown";
23
+ return `${items}[]`;
24
+ }
25
+ if ("type" in schema && schema.type === "tuple" && "items" in schema) {
26
+ const items = schema.items.map(formatSchema).join(", ");
27
+ return `[${items}]`;
28
+ }
29
+ if ("type" in schema && schema.type === "object") {
30
+ if ("properties" in schema && schema.properties) {
31
+ const props = Object.entries(schema.properties).map(([k, v]) => `${k}: ${formatSchema(v)}`).join("; ");
32
+ return `{ ${props} }`;
33
+ }
34
+ return "object";
35
+ }
36
+ if ("type" in schema && typeof schema.type === "string") {
37
+ return schema.type;
38
+ }
39
+ }
40
+ return "unknown";
41
+ }
42
+ function formatTypeParameters(typeParams) {
43
+ if (!typeParams?.length)
44
+ return "";
45
+ const params = typeParams.map((tp) => {
46
+ let str = tp.name;
47
+ if (tp.constraint)
48
+ str += ` extends ${tp.constraint}`;
49
+ if (tp.default)
50
+ str += ` = ${tp.default}`;
51
+ return str;
52
+ });
53
+ return `<${params.join(", ")}>`;
54
+ }
55
+ function formatParameters(sig) {
56
+ if (!sig?.parameters?.length)
57
+ return "()";
58
+ const params = sig.parameters.map((p) => {
59
+ const optional = p.required === false ? "?" : "";
60
+ const rest = p.rest ? "..." : "";
61
+ const type = formatSchema(p.schema);
62
+ return `${rest}${p.name}${optional}: ${type}`;
63
+ });
64
+ return `(${params.join(", ")})`;
65
+ }
66
+ function formatReturnType(sig) {
67
+ if (!sig?.returns)
68
+ return "void";
69
+ return formatSchema(sig.returns.schema);
70
+ }
71
+ function buildSignatureString(exp, sigIndex = 0) {
72
+ const sig = exp.signatures?.[sigIndex];
73
+ const typeParams = formatTypeParameters(exp.typeParameters || sig?.typeParameters);
74
+ switch (exp.kind) {
75
+ case "function": {
76
+ const params = formatParameters(sig);
77
+ const returnType = formatReturnType(sig);
78
+ return `function ${exp.name}${typeParams}${params}: ${returnType}`;
79
+ }
80
+ case "class": {
81
+ const ext = exp.extends ? ` extends ${exp.extends}` : "";
82
+ const impl = exp.implements?.length ? ` implements ${exp.implements.join(", ")}` : "";
83
+ return `class ${exp.name}${typeParams}${ext}${impl}`;
84
+ }
85
+ case "interface": {
86
+ const ext = exp.extends ? ` extends ${exp.extends}` : "";
87
+ return `interface ${exp.name}${typeParams}${ext}`;
88
+ }
89
+ case "type": {
90
+ const typeValue = typeof exp.type === "string" ? exp.type : formatSchema(exp.schema);
91
+ return `type ${exp.name}${typeParams} = ${typeValue}`;
92
+ }
93
+ case "enum": {
94
+ return `enum ${exp.name}`;
95
+ }
96
+ case "variable": {
97
+ const typeValue = typeof exp.type === "string" ? exp.type : formatSchema(exp.schema);
98
+ return `const ${exp.name}: ${typeValue}`;
99
+ }
100
+ default:
101
+ return exp.name;
102
+ }
103
+ }
104
+
105
+ // src/components/headless/CollapsibleMethod.tsx
106
+ import { jsxDEV } from "react/jsx-dev-runtime";
107
+
108
+ function formatReturnType2(returns) {
109
+ if (!returns)
110
+ return "void";
111
+ return formatSchema(returns.schema);
112
+ }
113
+ function formatParamPreview(params) {
114
+ if (!params || params.length === 0)
115
+ return "";
116
+ if (params.length === 1)
117
+ return params[0].name || "arg";
118
+ return `${params[0].name || "arg"}, ...`;
119
+ }
120
+ function CollapsibleMethod({
121
+ member,
122
+ defaultExpanded = false,
123
+ className,
124
+ renderHeader,
125
+ renderContent
126
+ }) {
127
+ const [expanded, setExpanded] = useState(defaultExpanded);
128
+ const sig = member.signatures?.[0];
129
+ const hasParams = sig?.parameters && sig.parameters.length > 0;
130
+ const visibility = member.visibility ?? "public";
131
+ const flags = member.flags;
132
+ const isStatic = flags?.static;
133
+ const isAsync = flags?.async;
134
+ const returnType = formatReturnType2(sig?.returns);
135
+ const paramPreview = formatParamPreview(sig?.parameters);
136
+ const toggle = () => setExpanded(!expanded);
137
+ useEffect(() => {
138
+ if (typeof window !== "undefined" && window.location.hash === `#${member.name}`) {
139
+ setExpanded(true);
140
+ }
141
+ }, [member.name]);
142
+ const badges = [];
143
+ if (visibility !== "public")
144
+ badges.push(visibility);
145
+ if (isStatic)
146
+ badges.push("static");
147
+ if (isAsync)
148
+ badges.push("async");
149
+ return /* @__PURE__ */ jsxDEV("div", {
150
+ id: member.name,
151
+ className,
152
+ "data-expanded": expanded,
153
+ children: [
154
+ renderHeader ? renderHeader(member, expanded, toggle) : /* @__PURE__ */ jsxDEV("button", {
155
+ type: "button",
156
+ onClick: toggle,
157
+ "data-header": true,
158
+ children: [
159
+ /* @__PURE__ */ jsxDEV("span", {
160
+ "data-name": true,
161
+ children: [
162
+ member.name,
163
+ /* @__PURE__ */ jsxDEV("span", {
164
+ "data-params": true,
165
+ children: [
166
+ "(",
167
+ paramPreview,
168
+ ")"
169
+ ]
170
+ }, undefined, true, undefined, this)
171
+ ]
172
+ }, undefined, true, undefined, this),
173
+ /* @__PURE__ */ jsxDEV("span", {
174
+ "data-return": true,
175
+ children: returnType
176
+ }, undefined, false, undefined, this),
177
+ badges.length > 0 && /* @__PURE__ */ jsxDEV("span", {
178
+ "data-badges": true,
179
+ children: badges.map((badge) => /* @__PURE__ */ jsxDEV("span", {
180
+ "data-badge": badge,
181
+ children: badge
182
+ }, badge, false, undefined, this))
183
+ }, undefined, false, undefined, this)
184
+ ]
185
+ }, undefined, true, undefined, this),
186
+ expanded && (renderContent ? renderContent(member) : /* @__PURE__ */ jsxDEV("div", {
187
+ "data-content": true,
188
+ children: [
189
+ member.description && /* @__PURE__ */ jsxDEV("p", {
190
+ children: member.description
191
+ }, undefined, false, undefined, this),
192
+ hasParams && /* @__PURE__ */ jsxDEV("div", {
193
+ "data-params-section": true,
194
+ children: [
195
+ /* @__PURE__ */ jsxDEV("h4", {
196
+ children: "Parameters"
197
+ }, undefined, false, undefined, this),
198
+ /* @__PURE__ */ jsxDEV("ul", {
199
+ children: sig.parameters.map((param, index) => /* @__PURE__ */ jsxDEV("li", {
200
+ children: [
201
+ /* @__PURE__ */ jsxDEV("code", {
202
+ children: [
203
+ param.name,
204
+ param.required === false && "?",
205
+ ": ",
206
+ formatSchema(param.schema)
207
+ ]
208
+ }, undefined, true, undefined, this),
209
+ param.description && /* @__PURE__ */ jsxDEV("span", {
210
+ children: param.description
211
+ }, undefined, false, undefined, this)
212
+ ]
213
+ }, param.name ?? index, true, undefined, this))
214
+ }, undefined, false, undefined, this)
215
+ ]
216
+ }, undefined, true, undefined, this),
217
+ sig?.returns && returnType !== "void" && /* @__PURE__ */ jsxDEV("div", {
218
+ "data-returns-section": true,
219
+ children: [
220
+ /* @__PURE__ */ jsxDEV("h4", {
221
+ children: "Returns"
222
+ }, undefined, false, undefined, this),
223
+ /* @__PURE__ */ jsxDEV("code", {
224
+ children: returnType
225
+ }, undefined, false, undefined, this),
226
+ sig.returns.description && /* @__PURE__ */ jsxDEV("p", {
227
+ children: sig.returns.description
228
+ }, undefined, false, undefined, this)
229
+ ]
230
+ }, undefined, true, undefined, this)
231
+ ]
232
+ }, undefined, true, undefined, this))
233
+ ]
234
+ }, undefined, true, undefined, this);
235
+ }
236
+ // src/components/headless/ExampleBlock.tsx
237
+ import { useState as useState2 } from "react";
238
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
239
+
240
+ function getExampleCode(example) {
241
+ if (typeof example === "string")
242
+ return example;
243
+ return example.code;
244
+ }
245
+ function getExampleTitle(example) {
246
+ if (typeof example === "string")
247
+ return;
248
+ return example.title;
249
+ }
250
+ function getExampleLanguage(example) {
251
+ if (typeof example === "string")
252
+ return "typescript";
253
+ return example.language ?? "typescript";
254
+ }
255
+ function cleanCode(code) {
256
+ let cleaned = code.trim();
257
+ if (cleaned.startsWith("```")) {
258
+ const lines = cleaned.split(`
259
+ `);
260
+ lines.shift();
261
+ if (lines[lines.length - 1] === "```") {
262
+ lines.pop();
263
+ }
264
+ cleaned = lines.join(`
265
+ `);
266
+ }
267
+ return cleaned;
268
+ }
269
+ function ExampleBlock({
270
+ examples,
271
+ className,
272
+ renderExample
273
+ }) {
274
+ const [activeIndex, setActiveIndex] = useState2(0);
275
+ if (!examples?.length)
276
+ return null;
277
+ const showTabs = examples.length > 1;
278
+ const currentExample = examples[activeIndex];
279
+ const code = cleanCode(getExampleCode(currentExample));
280
+ if (renderExample) {
281
+ return /* @__PURE__ */ jsxDEV2("div", {
282
+ className,
283
+ children: [
284
+ showTabs && /* @__PURE__ */ jsxDEV2("div", {
285
+ "data-tabs": true,
286
+ children: examples.map((example, index) => /* @__PURE__ */ jsxDEV2("button", {
287
+ type: "button",
288
+ onClick: () => setActiveIndex(index),
289
+ "data-active": activeIndex === index,
290
+ children: getExampleTitle(example) ?? `Example ${index + 1}`
291
+ }, index, false, undefined, this))
292
+ }, undefined, false, undefined, this),
293
+ renderExample(currentExample, activeIndex)
294
+ ]
295
+ }, undefined, true, undefined, this);
296
+ }
297
+ return /* @__PURE__ */ jsxDEV2("div", {
298
+ className,
299
+ children: [
300
+ showTabs && /* @__PURE__ */ jsxDEV2("div", {
301
+ "data-tabs": true,
302
+ children: examples.map((example, index) => /* @__PURE__ */ jsxDEV2("button", {
303
+ type: "button",
304
+ onClick: () => setActiveIndex(index),
305
+ "data-active": activeIndex === index,
306
+ children: getExampleTitle(example) ?? `Example ${index + 1}`
307
+ }, index, false, undefined, this))
308
+ }, undefined, false, undefined, this),
309
+ /* @__PURE__ */ jsxDEV2("pre", {
310
+ children: /* @__PURE__ */ jsxDEV2("code", {
311
+ "data-language": getExampleLanguage(currentExample),
312
+ children: code
313
+ }, undefined, false, undefined, this)
314
+ }, undefined, false, undefined, this)
315
+ ]
316
+ }, undefined, true, undefined, this);
317
+ }
318
+ // src/components/headless/ExpandableProperty.tsx
319
+ import { useState as useState3 } from "react";
320
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
321
+
322
+ function getNestedProperties(schema) {
323
+ if (!schema || typeof schema !== "object")
324
+ return null;
325
+ const s = schema;
326
+ if (s.type === "object" && s.properties && typeof s.properties === "object") {
327
+ return s.properties;
328
+ }
329
+ return null;
330
+ }
331
+ function getRequiredFields(schema) {
332
+ if (!schema || typeof schema !== "object")
333
+ return [];
334
+ const s = schema;
335
+ if (Array.isArray(s.required)) {
336
+ return s.required;
337
+ }
338
+ return [];
339
+ }
340
+ function countProperties(schema) {
341
+ const props = getNestedProperties(schema);
342
+ return props ? Object.keys(props).length : 0;
343
+ }
344
+ function NestedProperty({
345
+ name,
346
+ schema,
347
+ required = false,
348
+ depth = 0
349
+ }) {
350
+ const [expanded, setExpanded] = useState3(false);
351
+ const type = formatSchema(schema);
352
+ const nestedProps = getNestedProperties(schema);
353
+ const nestedCount = countProperties(schema);
354
+ const hasNested = nestedCount > 0;
355
+ const schemaObj = schema;
356
+ const description = schemaObj?.description;
357
+ return /* @__PURE__ */ jsxDEV3("div", {
358
+ "data-property": name,
359
+ "data-depth": depth,
360
+ children: [
361
+ /* @__PURE__ */ jsxDEV3("div", {
362
+ "data-row": true,
363
+ children: [
364
+ /* @__PURE__ */ jsxDEV3("span", {
365
+ "data-name": true,
366
+ children: [
367
+ name,
368
+ !required && "?",
369
+ ":"
370
+ ]
371
+ }, undefined, true, undefined, this),
372
+ /* @__PURE__ */ jsxDEV3("span", {
373
+ "data-type": true,
374
+ children: hasNested ? "object" : type
375
+ }, undefined, false, undefined, this),
376
+ description && /* @__PURE__ */ jsxDEV3("span", {
377
+ "data-description": true,
378
+ children: description
379
+ }, undefined, false, undefined, this),
380
+ hasNested && /* @__PURE__ */ jsxDEV3("button", {
381
+ type: "button",
382
+ onClick: () => setExpanded(!expanded),
383
+ "data-expand": true,
384
+ children: [
385
+ nestedCount,
386
+ " properties"
387
+ ]
388
+ }, undefined, true, undefined, this)
389
+ ]
390
+ }, undefined, true, undefined, this),
391
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsxDEV3("div", {
392
+ "data-nested": true,
393
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsxDEV3(NestedProperty, {
394
+ name: propName,
395
+ schema: propSchema,
396
+ required: getRequiredFields(schema).includes(propName),
397
+ depth: depth + 1
398
+ }, propName, false, undefined, this))
399
+ }, undefined, false, undefined, this)
400
+ ]
401
+ }, undefined, true, undefined, this);
402
+ }
403
+ function ExpandableProperty({
404
+ param,
405
+ depth = 0,
406
+ className
407
+ }) {
408
+ const [expanded, setExpanded] = useState3(false);
409
+ const type = formatSchema(param.schema);
410
+ const isOptional = param.required === false;
411
+ const nestedProps = getNestedProperties(param.schema);
412
+ const nestedCount = countProperties(param.schema);
413
+ const hasNested = nestedCount > 0;
414
+ return /* @__PURE__ */ jsxDEV3("div", {
415
+ className,
416
+ "data-param": param.name,
417
+ "data-depth": depth,
418
+ children: [
419
+ /* @__PURE__ */ jsxDEV3("div", {
420
+ "data-row": true,
421
+ children: [
422
+ /* @__PURE__ */ jsxDEV3("span", {
423
+ "data-name": true,
424
+ children: [
425
+ param.name,
426
+ isOptional && "?",
427
+ ":"
428
+ ]
429
+ }, undefined, true, undefined, this),
430
+ /* @__PURE__ */ jsxDEV3("span", {
431
+ "data-type": true,
432
+ children: hasNested ? "object" : type
433
+ }, undefined, false, undefined, this),
434
+ param.description && /* @__PURE__ */ jsxDEV3("span", {
435
+ "data-description": true,
436
+ children: param.description
437
+ }, undefined, false, undefined, this),
438
+ hasNested && /* @__PURE__ */ jsxDEV3("button", {
439
+ type: "button",
440
+ onClick: () => setExpanded(!expanded),
441
+ "data-expand": true,
442
+ children: [
443
+ nestedCount,
444
+ " properties"
445
+ ]
446
+ }, undefined, true, undefined, this)
447
+ ]
448
+ }, undefined, true, undefined, this),
449
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsxDEV3("div", {
450
+ "data-nested": true,
451
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsxDEV3(NestedProperty, {
452
+ name: propName,
453
+ schema: propSchema,
454
+ required: getRequiredFields(param.schema).includes(propName),
455
+ depth: depth + 1
456
+ }, propName, false, undefined, this))
457
+ }, undefined, false, undefined, this)
458
+ ]
459
+ }, undefined, true, undefined, this);
460
+ }
461
+ // src/components/headless/MembersTable.tsx
462
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
463
+
464
+ function groupMembersByKind(members) {
465
+ const groups = {
466
+ constructors: [],
467
+ properties: [],
468
+ methods: [],
469
+ accessors: [],
470
+ other: []
471
+ };
472
+ for (const member of members) {
473
+ const kind = member.kind?.toLowerCase() ?? "other";
474
+ if (kind === "constructor") {
475
+ groups.constructors.push(member);
476
+ } else if (kind === "property" || kind === "field") {
477
+ groups.properties.push(member);
478
+ } else if (kind === "method" || kind === "function") {
479
+ groups.methods.push(member);
480
+ } else if (kind === "getter" || kind === "setter" || kind === "accessor") {
481
+ groups.accessors.push(member);
482
+ } else {
483
+ groups.other.push(member);
484
+ }
485
+ }
486
+ return groups;
487
+ }
488
+ function MemberRow({ member }) {
489
+ const visibility = member.visibility ?? "public";
490
+ const flags = member.flags;
491
+ const isStatic = flags?.static;
492
+ const isAbstract = flags?.abstract;
493
+ const isReadonly = flags?.readonly;
494
+ const type = formatSchema(member.schema);
495
+ const sig = member.signatures?.[0];
496
+ let signature = "";
497
+ if (sig) {
498
+ const params = sig.parameters?.map((p) => {
499
+ const optional = p.required === false ? "?" : "";
500
+ return `${p.name}${optional}: ${formatSchema(p.schema)}`;
501
+ }) ?? [];
502
+ const returnType = formatSchema(sig.returns?.schema) ?? "void";
503
+ signature = `(${params.join(", ")}): ${returnType}`;
504
+ }
505
+ const badges = [];
506
+ if (visibility !== "public")
507
+ badges.push(visibility);
508
+ if (isStatic)
509
+ badges.push("static");
510
+ if (isAbstract)
511
+ badges.push("abstract");
512
+ if (isReadonly)
513
+ badges.push("readonly");
514
+ return /* @__PURE__ */ jsxDEV4("div", {
515
+ "data-member": member.name,
516
+ children: [
517
+ /* @__PURE__ */ jsxDEV4("div", {
518
+ children: [
519
+ /* @__PURE__ */ jsxDEV4("code", {
520
+ children: [
521
+ member.name,
522
+ signature
523
+ ]
524
+ }, undefined, true, undefined, this),
525
+ badges.length > 0 && /* @__PURE__ */ jsxDEV4("span", {
526
+ children: badges.map((badge) => /* @__PURE__ */ jsxDEV4("span", {
527
+ "data-badge": badge,
528
+ children: badge
529
+ }, badge, false, undefined, this))
530
+ }, undefined, false, undefined, this)
531
+ ]
532
+ }, undefined, true, undefined, this),
533
+ !signature && type !== "unknown" && /* @__PURE__ */ jsxDEV4("code", {
534
+ children: type
535
+ }, undefined, false, undefined, this),
536
+ member.description && /* @__PURE__ */ jsxDEV4("p", {
537
+ children: member.description
538
+ }, undefined, false, undefined, this)
539
+ ]
540
+ }, undefined, true, undefined, this);
541
+ }
542
+ function MembersTable({
543
+ members,
544
+ className,
545
+ groupByKind = false,
546
+ renderMember
547
+ }) {
548
+ if (!members?.length)
549
+ return null;
550
+ if (!groupByKind) {
551
+ return /* @__PURE__ */ jsxDEV4("div", {
552
+ className,
553
+ children: members.map((member, index) => renderMember ? renderMember(member, index) : /* @__PURE__ */ jsxDEV4(MemberRow, {
554
+ member
555
+ }, member.name ?? index, false, undefined, this))
556
+ }, undefined, false, undefined, this);
557
+ }
558
+ const groups = groupMembersByKind(members);
559
+ return /* @__PURE__ */ jsxDEV4("div", {
560
+ className,
561
+ children: [
562
+ groups.constructors.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
563
+ "data-group": "constructors",
564
+ children: [
565
+ /* @__PURE__ */ jsxDEV4("h4", {
566
+ children: "Constructor"
567
+ }, undefined, false, undefined, this),
568
+ groups.constructors.map((member, index) => renderMember ? renderMember(member, index) : /* @__PURE__ */ jsxDEV4(MemberRow, {
569
+ member
570
+ }, member.name ?? index, false, undefined, this))
571
+ ]
572
+ }, undefined, true, undefined, this),
573
+ groups.properties.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
574
+ "data-group": "properties",
575
+ children: [
576
+ /* @__PURE__ */ jsxDEV4("h4", {
577
+ children: "Properties"
578
+ }, undefined, false, undefined, this),
579
+ groups.properties.map((member, index) => renderMember ? renderMember(member, index) : /* @__PURE__ */ jsxDEV4(MemberRow, {
580
+ member
581
+ }, member.name ?? index, false, undefined, this))
582
+ ]
583
+ }, undefined, true, undefined, this),
584
+ groups.methods.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
585
+ "data-group": "methods",
586
+ children: [
587
+ /* @__PURE__ */ jsxDEV4("h4", {
588
+ children: "Methods"
589
+ }, undefined, false, undefined, this),
590
+ groups.methods.map((member, index) => renderMember ? renderMember(member, index) : /* @__PURE__ */ jsxDEV4(MemberRow, {
591
+ member
592
+ }, member.name ?? index, false, undefined, this))
593
+ ]
594
+ }, undefined, true, undefined, this),
595
+ groups.accessors.length > 0 && /* @__PURE__ */ jsxDEV4("section", {
596
+ "data-group": "accessors",
597
+ children: [
598
+ /* @__PURE__ */ jsxDEV4("h4", {
599
+ children: "Accessors"
600
+ }, undefined, false, undefined, this),
601
+ groups.accessors.map((member, index) => renderMember ? renderMember(member, index) : /* @__PURE__ */ jsxDEV4(MemberRow, {
602
+ member
603
+ }, member.name ?? index, false, undefined, this))
604
+ ]
605
+ }, undefined, true, undefined, this)
606
+ ]
607
+ }, undefined, true, undefined, this);
608
+ }
609
+ // src/components/headless/ParamTable.tsx
610
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
611
+
612
+ function isParameter(item) {
613
+ return "required" in item;
614
+ }
615
+ function ParamRow({ item, showRequired = true }) {
616
+ const name = item.name ?? "arg";
617
+ const type = formatSchema(item.schema);
618
+ const description = item.description ?? "";
619
+ const required = isParameter(item) ? item.required : true;
620
+ return /* @__PURE__ */ jsxDEV5("tr", {
621
+ children: [
622
+ /* @__PURE__ */ jsxDEV5("td", {
623
+ children: [
624
+ /* @__PURE__ */ jsxDEV5("code", {
625
+ children: name
626
+ }, undefined, false, undefined, this),
627
+ showRequired && required && /* @__PURE__ */ jsxDEV5("span", {
628
+ children: "*"
629
+ }, undefined, false, undefined, this),
630
+ showRequired && !required && /* @__PURE__ */ jsxDEV5("span", {
631
+ children: "?"
632
+ }, undefined, false, undefined, this)
633
+ ]
634
+ }, undefined, true, undefined, this),
635
+ /* @__PURE__ */ jsxDEV5("td", {
636
+ children: /* @__PURE__ */ jsxDEV5("code", {
637
+ children: type
638
+ }, undefined, false, undefined, this)
639
+ }, undefined, false, undefined, this),
640
+ /* @__PURE__ */ jsxDEV5("td", {
641
+ children: description
642
+ }, undefined, false, undefined, this)
643
+ ]
644
+ }, undefined, true, undefined, this);
645
+ }
646
+ function ParamTable({
647
+ items,
648
+ showRequired = true,
649
+ className,
650
+ renderRow
651
+ }) {
652
+ if (!items?.length)
653
+ return null;
654
+ return /* @__PURE__ */ jsxDEV5("table", {
655
+ className,
656
+ children: [
657
+ /* @__PURE__ */ jsxDEV5("thead", {
658
+ children: /* @__PURE__ */ jsxDEV5("tr", {
659
+ children: [
660
+ /* @__PURE__ */ jsxDEV5("th", {
661
+ children: "Name"
662
+ }, undefined, false, undefined, this),
663
+ /* @__PURE__ */ jsxDEV5("th", {
664
+ children: "Type"
665
+ }, undefined, false, undefined, this),
666
+ /* @__PURE__ */ jsxDEV5("th", {
667
+ children: "Description"
668
+ }, undefined, false, undefined, this)
669
+ ]
670
+ }, undefined, true, undefined, this)
671
+ }, undefined, false, undefined, this),
672
+ /* @__PURE__ */ jsxDEV5("tbody", {
673
+ children: items.map((item, index) => renderRow ? renderRow(item, index) : /* @__PURE__ */ jsxDEV5(ParamRow, {
674
+ item,
675
+ showRequired
676
+ }, item.name ?? index, false, undefined, this))
677
+ }, undefined, false, undefined, this)
678
+ ]
679
+ }, undefined, true, undefined, this);
680
+ }
681
+ // src/components/headless/Signature.tsx
682
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
683
+
684
+ function Signature({
685
+ export: exp,
686
+ signatureIndex = 0,
687
+ className,
688
+ children
689
+ }) {
690
+ const signature = buildSignatureString(exp, signatureIndex);
691
+ if (children) {
692
+ return children(signature);
693
+ }
694
+ return /* @__PURE__ */ jsxDEV6("code", {
695
+ className,
696
+ children: signature
697
+ }, undefined, false, undefined, this);
698
+ }
699
+ // src/components/headless/TypeTable.tsx
700
+ import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
701
+
702
+ function isParameter2(item) {
703
+ return "required" in item;
704
+ }
705
+ function TypeTable({
706
+ items,
707
+ showRequired = true,
708
+ className,
709
+ renderRow
710
+ }) {
711
+ if (!items?.length)
712
+ return null;
713
+ return /* @__PURE__ */ jsxDEV7("table", {
714
+ className,
715
+ children: [
716
+ /* @__PURE__ */ jsxDEV7("thead", {
717
+ children: /* @__PURE__ */ jsxDEV7("tr", {
718
+ children: [
719
+ /* @__PURE__ */ jsxDEV7("th", {
720
+ children: "Name"
721
+ }, undefined, false, undefined, this),
722
+ /* @__PURE__ */ jsxDEV7("th", {
723
+ children: "Type"
724
+ }, undefined, false, undefined, this),
725
+ /* @__PURE__ */ jsxDEV7("th", {
726
+ children: "Description"
727
+ }, undefined, false, undefined, this)
728
+ ]
729
+ }, undefined, true, undefined, this)
730
+ }, undefined, false, undefined, this),
731
+ /* @__PURE__ */ jsxDEV7("tbody", {
732
+ children: items.map((item, index) => {
733
+ if (renderRow) {
734
+ return renderRow(item, index);
735
+ }
736
+ const name = item.name ?? `arg${index}`;
737
+ const type = formatSchema(item.schema);
738
+ const description = item.description ?? "";
739
+ const required = isParameter2(item) ? item.required : true;
740
+ return /* @__PURE__ */ jsxDEV7("tr", {
741
+ children: [
742
+ /* @__PURE__ */ jsxDEV7("td", {
743
+ children: [
744
+ /* @__PURE__ */ jsxDEV7("code", {
745
+ children: name
746
+ }, undefined, false, undefined, this),
747
+ showRequired && required && /* @__PURE__ */ jsxDEV7("span", {
748
+ children: "*"
749
+ }, undefined, false, undefined, this),
750
+ showRequired && !required && /* @__PURE__ */ jsxDEV7("span", {
751
+ children: "?"
752
+ }, undefined, false, undefined, this)
753
+ ]
754
+ }, undefined, true, undefined, this),
755
+ /* @__PURE__ */ jsxDEV7("td", {
756
+ children: /* @__PURE__ */ jsxDEV7("code", {
757
+ children: type
758
+ }, undefined, false, undefined, this)
759
+ }, undefined, false, undefined, this),
760
+ /* @__PURE__ */ jsxDEV7("td", {
761
+ children: description
762
+ }, undefined, false, undefined, this)
763
+ ]
764
+ }, name, true, undefined, this);
765
+ })
766
+ }, undefined, false, undefined, this)
767
+ ]
768
+ }, undefined, true, undefined, this);
769
+ }
19
770
  export {
20
771
  groupMembersByKind,
21
772
  getExampleTitle,