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