@openpkg-ts/doc-generator 0.3.3 → 0.4.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.
@@ -3535,11 +3535,6 @@ function buildSignatureString(exp, sigIndex = 0) {
3535
3535
  // src/components/headless/CollapsibleMethod.tsx
3536
3536
  import { jsx, jsxs } from "react/jsx-runtime";
3537
3537
 
3538
- function formatReturnType2(returns) {
3539
- if (!returns)
3540
- return "void";
3541
- return formatSchema(returns.schema);
3542
- }
3543
3538
  function formatParamPreview(params) {
3544
3539
  if (!params || params.length === 0)
3545
3540
  return "";
@@ -3561,7 +3556,7 @@ function CollapsibleMethod({
3561
3556
  const flags = member.flags;
3562
3557
  const isStatic = flags?.static;
3563
3558
  const isAsync = flags?.async;
3564
- const returnType = formatReturnType2(sig?.returns);
3559
+ const returnType = formatReturnType(sig);
3565
3560
  const paramPreview = formatParamPreview(sig?.parameters);
3566
3561
  const toggle = () => setExpanded(!expanded);
3567
3562
  useEffect(() => {
@@ -4198,11 +4193,353 @@ function TypeTable({
4198
4193
  });
4199
4194
  }
4200
4195
  // src/components/styled/index.ts
4201
- import { CodeTabs as CodeTabs4, ImportSection as ImportSection4 } from "@doccov/ui/api";
4196
+ import { CodeTabs, ImportSection } from "@doccov/ui/api";
4197
+
4198
+ // src/components/styled/ClassPage.tsx
4199
+ import {
4200
+ APIParameterItem,
4201
+ APISection,
4202
+ ParameterList
4203
+ } from "@doccov/ui/docskit";
4204
+
4205
+ // src/adapters/spec-to-docskit.ts
4206
+ function specSchemaToAPISchema(schema) {
4207
+ if (!schema || typeof schema !== "object")
4208
+ return;
4209
+ const s = schema;
4210
+ const result = {};
4211
+ result.type = formatSchema(schema);
4212
+ result.typeString = result.type;
4213
+ if (typeof s.description === "string") {
4214
+ result.description = s.description;
4215
+ }
4216
+ if (s.type === "object" && s.properties && typeof s.properties === "object") {
4217
+ result.properties = {};
4218
+ for (const [key, value] of Object.entries(s.properties)) {
4219
+ const nestedSchema = specSchemaToAPISchema(value);
4220
+ if (nestedSchema) {
4221
+ result.properties[key] = nestedSchema;
4222
+ }
4223
+ }
4224
+ if (Array.isArray(s.required)) {
4225
+ result.required = s.required;
4226
+ }
4227
+ }
4228
+ return result;
4229
+ }
4230
+ function specParamToAPIParam(param) {
4231
+ const type = formatSchema(param.schema);
4232
+ const children = specSchemaToAPISchema(param.schema);
4233
+ const hasNestedProperties = children?.properties && Object.keys(children.properties).length > 0;
4234
+ return {
4235
+ name: param.name ?? "unknown",
4236
+ type,
4237
+ required: param.required !== false,
4238
+ description: param.description,
4239
+ children: hasNestedProperties ? children : undefined
4240
+ };
4241
+ }
4242
+ function specExamplesToCodeExamples(examples, defaultLang = "typescript") {
4243
+ if (!examples?.length)
4244
+ return [];
4245
+ return examples.map((example) => {
4246
+ if (typeof example === "string") {
4247
+ return {
4248
+ languageId: defaultLang,
4249
+ code: example,
4250
+ highlightLang: getLangForHighlight(defaultLang)
4251
+ };
4252
+ }
4253
+ return {
4254
+ languageId: example.language || defaultLang,
4255
+ code: example.code,
4256
+ highlightLang: getLangForHighlight(example.language || defaultLang)
4257
+ };
4258
+ });
4259
+ }
4260
+ function getLangForHighlight(lang) {
4261
+ const langMap = {
4262
+ typescript: "ts",
4263
+ javascript: "js",
4264
+ ts: "ts",
4265
+ js: "js",
4266
+ tsx: "tsx",
4267
+ jsx: "jsx",
4268
+ bash: "bash",
4269
+ shell: "bash",
4270
+ sh: "bash",
4271
+ curl: "bash",
4272
+ json: "json",
4273
+ python: "python",
4274
+ py: "python",
4275
+ go: "go",
4276
+ rust: "rust",
4277
+ ruby: "ruby"
4278
+ };
4279
+ return langMap[lang.toLowerCase()] || lang;
4280
+ }
4281
+ function getLanguagesFromExamples(examples) {
4282
+ if (!examples?.length)
4283
+ return [];
4284
+ const langSet = new Set;
4285
+ const languages = [];
4286
+ for (const example of examples) {
4287
+ const lang = typeof example === "string" ? "typescript" : example.language || "typescript";
4288
+ if (!langSet.has(lang)) {
4289
+ langSet.add(lang);
4290
+ languages.push({
4291
+ id: lang,
4292
+ label: getLanguageLabel(lang)
4293
+ });
4294
+ }
4295
+ }
4296
+ return languages;
4297
+ }
4298
+ function getLanguageLabel(lang) {
4299
+ const labels = {
4300
+ typescript: "TypeScript",
4301
+ javascript: "JavaScript",
4302
+ ts: "TypeScript",
4303
+ js: "JavaScript",
4304
+ tsx: "TSX",
4305
+ jsx: "JSX",
4306
+ bash: "Bash",
4307
+ shell: "Shell",
4308
+ sh: "Shell",
4309
+ curl: "cURL",
4310
+ json: "JSON",
4311
+ python: "Python",
4312
+ py: "Python",
4313
+ go: "Go",
4314
+ rust: "Rust",
4315
+ ruby: "Ruby",
4316
+ node: "Node.js"
4317
+ };
4318
+ return labels[lang.toLowerCase()] || lang;
4319
+ }
4320
+ function buildImportStatement(exp, spec) {
4321
+ const packageName = spec.meta?.name || "package";
4322
+ const presentation = spec.extensions?.presentation?.[exp.id];
4323
+ const importPath = presentation?.importPath || packageName;
4324
+ const alias = presentation?.alias || exp.name;
4325
+ if (exp.kind === "type" || exp.kind === "interface") {
4326
+ return `import type { ${alias} } from '${importPath}'`;
4327
+ }
4328
+ return `import { ${alias} } from '${importPath}'`;
4329
+ }
4202
4330
 
4203
4331
  // src/components/styled/ClassPage.tsx
4332
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
4333
+
4334
+ function formatMethodSignature(member) {
4335
+ const sig = member.signatures?.[0];
4336
+ const params = sig?.parameters ?? [];
4337
+ const returnType = formatSchema(sig?.returns?.schema);
4338
+ const paramStr = params.map((p) => `${p.name}${p.required === false ? "?" : ""}: ${formatSchema(p.schema)}`).join(", ");
4339
+ return `(${paramStr}): ${returnType}`;
4340
+ }
4341
+ function getMemberBadges(member) {
4342
+ const badges = [];
4343
+ const flags = member.flags;
4344
+ if (member.visibility && member.visibility !== "public") {
4345
+ badges.push(member.visibility);
4346
+ }
4347
+ if (flags?.static)
4348
+ badges.push("static");
4349
+ if (flags?.readonly)
4350
+ badges.push("readonly");
4351
+ if (flags?.async)
4352
+ badges.push("async");
4353
+ return badges;
4354
+ }
4355
+ function ClassPage({ export: exp, spec }) {
4356
+ const constructors = exp.members?.filter((m) => m.kind === "constructor") ?? [];
4357
+ const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field") ?? [];
4358
+ const methods = exp.members?.filter((m) => m.kind === "method") ?? [];
4359
+ const staticProperties = properties.filter((m) => m.flags?.static);
4360
+ const instanceProperties = properties.filter((m) => !m.flags?.static);
4361
+ const staticMethods = methods.filter((m) => m.flags?.static);
4362
+ const instanceMethods = methods.filter((m) => !m.flags?.static);
4363
+ const constructorSig = constructors[0]?.signatures?.[0];
4364
+ const constructorParams = constructorSig?.parameters ?? [];
4365
+ const languages = getLanguagesFromExamples(exp.examples);
4366
+ const examples = specExamplesToCodeExamples(exp.examples);
4367
+ const importStatement = buildImportStatement(exp, spec);
4368
+ const displayExamples = examples.length > 0 ? examples : [{
4369
+ languageId: "typescript",
4370
+ code: `${importStatement}
4371
+
4372
+ const instance = new ${exp.name}(${constructorParams.map((p) => p.name).join(", ")});`,
4373
+ highlightLang: "ts"
4374
+ }];
4375
+ const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
4376
+ const inheritance = [
4377
+ exp.extends && `extends ${exp.extends}`,
4378
+ exp.implements?.length && `implements ${exp.implements.join(", ")}`
4379
+ ].filter(Boolean).join(" ");
4380
+ return /* @__PURE__ */ jsx8("div", {
4381
+ className: "doccov-class-page not-prose",
4382
+ children: /* @__PURE__ */ jsxs7(APISection, {
4383
+ id: exp.id || exp.name,
4384
+ title: `class ${exp.name}`,
4385
+ description: /* @__PURE__ */ jsxs7("div", {
4386
+ className: "space-y-3",
4387
+ children: [
4388
+ inheritance && /* @__PURE__ */ jsx8("p", {
4389
+ className: "font-mono text-sm text-muted-foreground",
4390
+ children: inheritance
4391
+ }),
4392
+ exp.description && /* @__PURE__ */ jsx8("p", {
4393
+ children: exp.description
4394
+ }),
4395
+ /* @__PURE__ */ jsx8("code", {
4396
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
4397
+ children: importStatement
4398
+ })
4399
+ ]
4400
+ }),
4401
+ languages: displayLanguages,
4402
+ examples: displayExamples,
4403
+ codePanelTitle: `new ${exp.name}()`,
4404
+ children: [
4405
+ constructorParams.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4406
+ title: "Constructor",
4407
+ children: constructorParams.map((param, index) => {
4408
+ const apiParam = specParamToAPIParam(param);
4409
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4410
+ name: apiParam.name,
4411
+ type: apiParam.type,
4412
+ required: apiParam.required,
4413
+ description: apiParam.description,
4414
+ children: apiParam.children
4415
+ }, param.name ?? index);
4416
+ })
4417
+ }),
4418
+ (staticProperties.length > 0 || staticMethods.length > 0) && /* @__PURE__ */ jsxs7(ParameterList, {
4419
+ title: "Static Members",
4420
+ className: "mt-6",
4421
+ children: [
4422
+ staticProperties.map((member) => {
4423
+ const badges = getMemberBadges(member);
4424
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4425
+ name: member.name,
4426
+ type: formatSchema(member.schema),
4427
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4428
+ }, member.name);
4429
+ }),
4430
+ staticMethods.map((member) => {
4431
+ const badges = getMemberBadges(member);
4432
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4433
+ name: `${member.name}()`,
4434
+ type: formatMethodSignature(member),
4435
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4436
+ }, member.name);
4437
+ })
4438
+ ]
4439
+ }),
4440
+ instanceMethods.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4441
+ title: "Methods",
4442
+ className: "mt-6",
4443
+ children: instanceMethods.map((member) => {
4444
+ const badges = getMemberBadges(member);
4445
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4446
+ name: `${member.name}()`,
4447
+ type: formatMethodSignature(member),
4448
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4449
+ }, member.name);
4450
+ })
4451
+ }),
4452
+ instanceProperties.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4453
+ title: "Properties",
4454
+ className: "mt-6",
4455
+ children: instanceProperties.map((member) => {
4456
+ const badges = getMemberBadges(member);
4457
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4458
+ name: member.name,
4459
+ type: formatSchema(member.schema),
4460
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4461
+ }, member.name);
4462
+ })
4463
+ })
4464
+ ]
4465
+ })
4466
+ });
4467
+ }
4468
+
4469
+ // src/components/styled/EnumPage.tsx
4470
+ import {
4471
+ APIParameterItem as APIParameterItem2,
4472
+ APISection as APISection2,
4473
+ ParameterList as ParameterList2
4474
+ } from "@doccov/ui/docskit";
4475
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
4476
+
4477
+ function EnumPage({ export: exp, spec }) {
4478
+ const members = exp.members ?? [];
4479
+ const languages = getLanguagesFromExamples(exp.examples);
4480
+ const examples = specExamplesToCodeExamples(exp.examples);
4481
+ const importStatement = buildImportStatement(exp, spec);
4482
+ const enumDefinition = members.length > 0 ? `enum ${exp.name} {
4483
+ ${members.map((m) => {
4484
+ const value = m.schema !== undefined ? typeof m.schema === "object" && m.schema !== null ? m.schema.const ?? m.schema.default : m.schema : undefined;
4485
+ return ` ${m.name}${value !== undefined ? ` = ${JSON.stringify(value)}` : ""},`;
4486
+ }).join(`
4487
+ `)}
4488
+ }` : `enum ${exp.name} { }`;
4489
+ const displayExamples = examples.length > 0 ? examples : [{
4490
+ languageId: "typescript",
4491
+ code: `${importStatement}
4492
+
4493
+ ${enumDefinition}`,
4494
+ highlightLang: "ts"
4495
+ }];
4496
+ const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
4497
+ return /* @__PURE__ */ jsx9("div", {
4498
+ className: "doccov-enum-page not-prose",
4499
+ children: /* @__PURE__ */ jsx9(APISection2, {
4500
+ id: exp.id || exp.name,
4501
+ title: `enum ${exp.name}`,
4502
+ description: /* @__PURE__ */ jsxs8("div", {
4503
+ className: "space-y-3",
4504
+ children: [
4505
+ exp.description && /* @__PURE__ */ jsx9("p", {
4506
+ children: exp.description
4507
+ }),
4508
+ exp.deprecated && /* @__PURE__ */ jsxs8("div", {
4509
+ 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",
4510
+ children: [
4511
+ /* @__PURE__ */ jsx9("strong", {
4512
+ children: "Deprecated:"
4513
+ }),
4514
+ " This export is deprecated."
4515
+ ]
4516
+ }),
4517
+ /* @__PURE__ */ jsx9("code", {
4518
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
4519
+ children: importStatement
4520
+ })
4521
+ ]
4522
+ }),
4523
+ languages: displayLanguages,
4524
+ examples: displayExamples,
4525
+ codePanelTitle: exp.name,
4526
+ children: members.length > 0 && /* @__PURE__ */ jsx9(ParameterList2, {
4527
+ title: "Members",
4528
+ children: members.map((member, index) => {
4529
+ const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? undefined : member.schema : undefined;
4530
+ return /* @__PURE__ */ jsx9(APIParameterItem2, {
4531
+ name: member.name,
4532
+ type: value !== undefined ? String(value) : "auto",
4533
+ description: member.description
4534
+ }, member.name ?? index);
4535
+ })
4536
+ })
4537
+ })
4538
+ });
4539
+ }
4540
+
4541
+ // src/components/styled/ExportIndexPage.tsx
4204
4542
  import { cn as cn2 } from "@doccov/ui/lib/utils";
4205
- import { CodeTabs, ImportSection } from "@doccov/ui/api";
4206
4543
 
4207
4544
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
4208
4545
  import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
@@ -22235,713 +22572,72 @@ var __iconNode1651 = [
22235
22572
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
22236
22573
  ];
22237
22574
  var ZoomOut = createLucideIcon("zoom-out", __iconNode1651);
22238
- // src/components/styled/ClassPage.tsx
22239
- import { useState as useState5 } from "react";
22575
+ // src/components/styled/ExportIndexPage.tsx
22576
+ import { useState as useState4, useMemo } from "react";
22240
22577
 
22241
- // src/components/styled/ParameterItem.tsx
22578
+ // src/components/styled/ExportCard.tsx
22579
+ var import_link3 = __toESM(require_link(), 1);
22242
22580
  import { cn } from "@doccov/ui/lib/utils";
22243
- import { useState as useState4 } from "react";
22244
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
22581
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
22245
22582
 
22246
- function getNestedProperties2(schema) {
22247
- if (!schema || typeof schema !== "object")
22248
- return null;
22249
- const s = schema;
22250
- if (s.type === "object" && s.properties && typeof s.properties === "object") {
22251
- return s.properties;
22252
- }
22253
- return null;
22254
- }
22255
- function getRequiredFields2(schema) {
22256
- if (!schema || typeof schema !== "object")
22257
- return [];
22258
- const s = schema;
22259
- if (Array.isArray(s.required)) {
22260
- return s.required;
22261
- }
22262
- return [];
22263
- }
22264
- function countProperties2(schema) {
22265
- const props = getNestedProperties2(schema);
22266
- return props ? Object.keys(props).length : 0;
22267
- }
22268
- function NestedPropertyItem({
22583
+ var KIND_COLORS = {
22584
+ function: "group-hover:text-blue-600 dark:group-hover:text-blue-400",
22585
+ class: "group-hover:text-purple-600 dark:group-hover:text-purple-400",
22586
+ interface: "group-hover:text-green-600 dark:group-hover:text-green-400",
22587
+ type: "group-hover:text-amber-600 dark:group-hover:text-amber-400",
22588
+ enum: "group-hover:text-rose-600 dark:group-hover:text-rose-400",
22589
+ variable: "group-hover:text-cyan-600 dark:group-hover:text-cyan-400"
22590
+ };
22591
+ var KIND_BADGE_COLORS = {
22592
+ function: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
22593
+ class: "bg-purple-500/10 text-purple-600 dark:text-purple-400",
22594
+ interface: "bg-green-500/10 text-green-600 dark:text-green-400",
22595
+ type: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
22596
+ enum: "bg-rose-500/10 text-rose-600 dark:text-rose-400",
22597
+ variable: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"
22598
+ };
22599
+ function ExportCard({
22269
22600
  name,
22270
- schema,
22271
- required = false,
22272
- depth = 0
22601
+ description,
22602
+ href,
22603
+ kind = "function",
22604
+ className
22273
22605
  }) {
22274
- const [expanded, setExpanded] = useState4(false);
22275
- const type = formatSchema(schema);
22276
- const nestedProps = getNestedProperties2(schema);
22277
- const nestedCount = countProperties2(schema);
22278
- const hasNested = nestedCount > 0;
22279
- const schemaObj = schema;
22280
- const description = schemaObj?.description;
22281
- return /* @__PURE__ */ jsxs7("div", {
22282
- className: cn("border-t border-border first:border-t-0", depth > 0 && "ml-4"),
22606
+ const isFunction = kind === "function";
22607
+ const hoverColor = KIND_COLORS[kind];
22608
+ const badgeColor = KIND_BADGE_COLORS[kind];
22609
+ return /* @__PURE__ */ jsxs9(import_link3.default, {
22610
+ href,
22611
+ className: cn("group block rounded-lg border border-border bg-card/50 p-4", "transition-all duration-200 ease-out", "hover:border-primary/30 hover:bg-card hover:shadow-lg hover:shadow-primary/5", "hover:-translate-y-1", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
22283
22612
  children: [
22284
- /* @__PURE__ */ jsx8("div", {
22285
- className: "py-3",
22286
- children: /* @__PURE__ */ jsxs7("div", {
22287
- className: "flex items-start gap-2",
22288
- children: [
22289
- hasNested && /* @__PURE__ */ jsx8("button", {
22290
- type: "button",
22291
- onClick: () => setExpanded(!expanded),
22292
- className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
22293
- "aria-label": expanded ? "Collapse" : "Expand",
22294
- children: /* @__PURE__ */ jsx8(ChevronRight, {
22295
- size: 14,
22296
- className: cn("transition-transform duration-200", expanded && "rotate-90")
22297
- })
22298
- }),
22299
- !hasNested && /* @__PURE__ */ jsx8("div", {
22300
- className: "w-5"
22301
- }),
22302
- /* @__PURE__ */ jsxs7("div", {
22303
- className: "flex-1 min-w-0",
22304
- children: [
22305
- /* @__PURE__ */ jsxs7("div", {
22306
- className: "flex items-baseline gap-2 flex-wrap",
22307
- children: [
22308
- /* @__PURE__ */ jsxs7("span", {
22309
- className: "font-mono text-sm text-foreground",
22310
- children: [
22311
- name,
22312
- !required && /* @__PURE__ */ jsx8("span", {
22313
- className: "text-muted-foreground",
22314
- children: "?"
22315
- })
22316
- ]
22317
- }),
22318
- /* @__PURE__ */ jsx8("span", {
22319
- className: "font-mono text-sm text-muted-foreground",
22320
- children: hasNested ? "object" : type
22321
- }),
22322
- hasNested && /* @__PURE__ */ jsxs7("button", {
22323
- type: "button",
22324
- onClick: () => setExpanded(!expanded),
22325
- className: "text-xs text-primary hover:underline cursor-pointer",
22326
- children: [
22327
- nestedCount,
22328
- " ",
22329
- nestedCount === 1 ? "property" : "properties"
22330
- ]
22331
- })
22332
- ]
22333
- }),
22334
- description && /* @__PURE__ */ jsx8("p", {
22335
- className: "text-sm text-muted-foreground mt-1",
22336
- children: description
22337
- })
22338
- ]
22339
- })
22340
- ]
22341
- })
22613
+ /* @__PURE__ */ jsxs9("div", {
22614
+ className: "flex items-center gap-2 mb-2",
22615
+ children: [
22616
+ /* @__PURE__ */ jsx10("span", {
22617
+ className: cn("font-mono text-base font-medium text-foreground transition-colors duration-200", hoverColor),
22618
+ children: name
22619
+ }),
22620
+ isFunction && /* @__PURE__ */ jsx10("span", {
22621
+ className: "font-mono text-base text-muted-foreground",
22622
+ children: "()"
22623
+ }),
22624
+ /* @__PURE__ */ jsx10("span", {
22625
+ className: cn("ml-auto text-xs px-2 py-0.5 rounded-full font-medium", badgeColor),
22626
+ children: kind
22627
+ })
22628
+ ]
22342
22629
  }),
22343
- hasNested && expanded && nestedProps && /* @__PURE__ */ jsx8("div", {
22344
- className: "border-l border-border ml-2",
22345
- children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx8(NestedPropertyItem, {
22346
- name: propName,
22347
- schema: propSchema,
22348
- required: getRequiredFields2(schema).includes(propName),
22349
- depth: depth + 1
22350
- }, propName))
22351
- })
22352
- ]
22353
- });
22354
- }
22355
- function ParameterItem({
22356
- param,
22357
- depth = 0,
22358
- className
22359
- }) {
22360
- const [expanded, setExpanded] = useState4(false);
22361
- const type = formatSchema(param.schema);
22362
- const isRequired = param.required !== false;
22363
- const nestedProps = getNestedProperties2(param.schema);
22364
- const nestedCount = countProperties2(param.schema);
22365
- const hasNested = nestedCount > 0;
22366
- return /* @__PURE__ */ jsxs7("div", {
22367
- className: cn("border-b border-border last:border-b-0", className),
22368
- children: [
22369
- /* @__PURE__ */ jsx8("div", {
22370
- className: "py-3",
22371
- children: /* @__PURE__ */ jsxs7("div", {
22372
- className: "flex items-start gap-2",
22373
- children: [
22374
- hasNested && /* @__PURE__ */ jsx8("button", {
22375
- type: "button",
22376
- onClick: () => setExpanded(!expanded),
22377
- className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
22378
- "aria-label": expanded ? "Collapse" : "Expand",
22379
- children: /* @__PURE__ */ jsx8(ChevronRight, {
22380
- size: 14,
22381
- className: cn("transition-transform duration-200", expanded && "rotate-90")
22382
- })
22383
- }),
22384
- !hasNested && /* @__PURE__ */ jsx8("div", {
22385
- className: "w-5"
22386
- }),
22387
- /* @__PURE__ */ jsxs7("div", {
22388
- className: "flex-1 min-w-0",
22389
- children: [
22390
- /* @__PURE__ */ jsxs7("div", {
22391
- className: "flex items-baseline gap-2 flex-wrap",
22392
- children: [
22393
- /* @__PURE__ */ jsx8("span", {
22394
- className: "font-mono text-sm font-medium text-foreground",
22395
- children: param.name
22396
- }),
22397
- isRequired && /* @__PURE__ */ jsx8("span", {
22398
- className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-border bg-muted text-muted-foreground uppercase tracking-wide",
22399
- children: "Required"
22400
- }),
22401
- /* @__PURE__ */ jsx8("span", {
22402
- className: "font-mono text-sm text-muted-foreground",
22403
- children: hasNested ? "object" : type
22404
- }),
22405
- hasNested && /* @__PURE__ */ jsxs7("button", {
22406
- type: "button",
22407
- onClick: () => setExpanded(!expanded),
22408
- className: "text-xs text-primary hover:underline cursor-pointer",
22409
- children: [
22410
- nestedCount,
22411
- " ",
22412
- nestedCount === 1 ? "property" : "properties"
22413
- ]
22414
- })
22415
- ]
22416
- }),
22417
- param.description && /* @__PURE__ */ jsx8("p", {
22418
- className: "text-sm text-muted-foreground mt-1",
22419
- children: param.description
22420
- })
22421
- ]
22422
- })
22423
- ]
22424
- })
22425
- }),
22426
- hasNested && expanded && nestedProps && /* @__PURE__ */ jsx8("div", {
22427
- className: "border-l border-border ml-2 mb-3",
22428
- children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx8(NestedPropertyItem, {
22429
- name: propName,
22430
- schema: propSchema,
22431
- required: getRequiredFields2(param.schema).includes(propName),
22432
- depth: depth + 1
22433
- }, propName))
22434
- })
22435
- ]
22436
- });
22437
- }
22438
-
22439
- // src/components/styled/ClassPage.tsx
22440
- import { jsx as jsx9, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
22441
-
22442
- function PropertyItem({ member }) {
22443
- const visibility = member.visibility ?? "public";
22444
- const flags = member.flags;
22445
- const isStatic = flags?.static;
22446
- const isReadonly = flags?.readonly;
22447
- const type = formatSchema(member.schema);
22448
- return /* @__PURE__ */ jsxs8("div", {
22449
- className: "py-4 first:pt-4 last:pb-4",
22450
- children: [
22451
- /* @__PURE__ */ jsxs8("div", {
22452
- className: "flex items-center gap-2 flex-wrap",
22453
- children: [
22454
- /* @__PURE__ */ jsx9("code", {
22455
- className: "font-mono text-sm font-medium text-foreground",
22456
- children: member.name
22457
- }),
22458
- /* @__PURE__ */ jsx9("code", {
22459
- className: "font-mono text-sm text-primary",
22460
- children: type
22461
- }),
22462
- visibility !== "public" && /* @__PURE__ */ jsx9("span", {
22463
- className: "text-xs px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground font-medium",
22464
- children: visibility
22465
- }),
22466
- isStatic && /* @__PURE__ */ jsx9("span", {
22467
- className: "text-xs px-1.5 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",
22468
- children: "static"
22469
- }),
22470
- isReadonly && /* @__PURE__ */ jsx9("span", {
22471
- className: "text-xs px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-600 dark:text-purple-400 font-medium",
22472
- children: "readonly"
22473
- })
22474
- ]
22475
- }),
22476
- member.description && /* @__PURE__ */ jsx9("p", {
22477
- className: "text-sm text-muted-foreground mt-2 leading-relaxed",
22478
- children: member.description
22479
- })
22480
- ]
22481
- });
22482
- }
22483
- function MethodItem({ member }) {
22484
- const sig = member.signatures?.[0];
22485
- const params = sig?.parameters ?? [];
22486
- const returnType = formatSchema(sig?.returns?.schema);
22487
- const visibility = member.visibility ?? "public";
22488
- const flags = member.flags;
22489
- const isStatic = flags?.static;
22490
- const isAsync = flags?.async;
22491
- return /* @__PURE__ */ jsxs8("div", {
22492
- className: "p-4",
22493
- children: [
22494
- /* @__PURE__ */ jsxs8("div", {
22495
- className: "flex items-center gap-2 flex-wrap mb-1",
22496
- children: [
22497
- visibility !== "public" && /* @__PURE__ */ jsx9("span", {
22498
- className: "text-xs px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground font-medium",
22499
- children: visibility
22500
- }),
22501
- isStatic && /* @__PURE__ */ jsx9("span", {
22502
- className: "text-xs px-1.5 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",
22503
- children: "static"
22504
- }),
22505
- isAsync && /* @__PURE__ */ jsx9("span", {
22506
- className: "text-xs px-1.5 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 font-medium",
22507
- children: "async"
22508
- })
22509
- ]
22510
- }),
22511
- /* @__PURE__ */ jsxs8("code", {
22512
- className: "font-mono text-sm text-foreground",
22513
- children: [
22514
- /* @__PURE__ */ jsx9("span", {
22515
- className: "font-medium",
22516
- children: member.name
22517
- }),
22518
- /* @__PURE__ */ jsx9("span", {
22519
- className: "text-muted-foreground",
22520
- children: "("
22521
- }),
22522
- params.map((p, i) => /* @__PURE__ */ jsxs8("span", {
22523
- children: [
22524
- i > 0 && /* @__PURE__ */ jsx9("span", {
22525
- className: "text-muted-foreground",
22526
- children: ", "
22527
- }),
22528
- /* @__PURE__ */ jsx9("span", {
22529
- className: "text-muted-foreground",
22530
- children: p.name
22531
- }),
22532
- p.required === false && /* @__PURE__ */ jsx9("span", {
22533
- className: "text-muted-foreground",
22534
- children: "?"
22535
- }),
22536
- /* @__PURE__ */ jsx9("span", {
22537
- className: "text-muted-foreground",
22538
- children: ": "
22539
- }),
22540
- /* @__PURE__ */ jsx9("span", {
22541
- className: "text-primary",
22542
- children: formatSchema(p.schema)
22543
- })
22544
- ]
22545
- }, p.name)),
22546
- /* @__PURE__ */ jsx9("span", {
22547
- className: "text-muted-foreground",
22548
- children: "): "
22549
- }),
22550
- /* @__PURE__ */ jsx9("span", {
22551
- className: "text-primary",
22552
- children: returnType
22553
- })
22554
- ]
22555
- }),
22556
- member.description && /* @__PURE__ */ jsx9("p", {
22557
- className: "text-sm text-muted-foreground mt-2 leading-relaxed",
22558
- children: member.description
22559
- })
22560
- ]
22561
- });
22562
- }
22563
- function ClassPage({ export: exp, spec, renderExample }) {
22564
- const [copied, setCopied] = useState5(false);
22565
- const hasExamples = exp.examples && exp.examples.length > 0;
22566
- const constructors = exp.members?.filter((m) => m.kind === "constructor") ?? [];
22567
- const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field") ?? [];
22568
- const methods = exp.members?.filter((m) => m.kind === "method") ?? [];
22569
- const staticProperties = properties.filter((m) => m.flags?.static);
22570
- const instanceProperties = properties.filter((m) => !m.flags?.static);
22571
- const staticMethods = methods.filter((m) => m.flags?.static);
22572
- const instanceMethods = methods.filter((m) => !m.flags?.static);
22573
- const constructorSig = constructors[0]?.signatures?.[0];
22574
- const constructorParams = constructorSig?.parameters ?? [];
22575
- const packageName = spec.meta.name || "package";
22576
- const importStatement = `import { ${exp.name} } from '${packageName}'`;
22577
- const handleCopyName = () => {
22578
- navigator.clipboard.writeText(exp.name);
22579
- setCopied(true);
22580
- setTimeout(() => setCopied(false), 1200);
22581
- };
22582
- const codeTabs = hasExamples ? exp.examples.map((example, index) => {
22583
- const code = typeof example === "string" ? example : example.code;
22584
- const title = typeof example === "string" ? `Example ${index + 1}` : example.title || `Example ${index + 1}`;
22585
- const filename = `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}-${index + 1}.ts`;
22586
- return {
22587
- label: title,
22588
- code,
22589
- content: renderExample ? renderExample(code, filename) : /* @__PURE__ */ jsx9("pre", {
22590
- className: "p-4 overflow-x-auto",
22591
- children: /* @__PURE__ */ jsx9("code", {
22592
- className: "font-mono text-sm text-foreground",
22593
- children: code
22594
- })
22595
- })
22596
- };
22597
- }) : [];
22598
- return /* @__PURE__ */ jsxs8("div", {
22599
- className: "doccov-class-page not-prose",
22600
- children: [
22601
- /* @__PURE__ */ jsxs8("header", {
22602
- className: "mb-6",
22603
- children: [
22604
- /* @__PURE__ */ jsxs8("div", {
22605
- className: "flex items-center gap-3",
22606
- children: [
22607
- /* @__PURE__ */ jsx9("span", {
22608
- className: "text-xs px-2 py-0.5 rounded-full font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400",
22609
- children: "class"
22610
- }),
22611
- /* @__PURE__ */ jsx9("h1", {
22612
- className: "font-mono text-3xl font-bold text-foreground tracking-tight",
22613
- children: exp.name
22614
- }),
22615
- /* @__PURE__ */ jsx9("button", {
22616
- type: "button",
22617
- onClick: handleCopyName,
22618
- className: cn2("p-1.5 rounded-md", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "transition-all cursor-pointer"),
22619
- "aria-label": "Copy class name",
22620
- children: copied ? /* @__PURE__ */ jsx9(Check, {
22621
- size: 18
22622
- }) : /* @__PURE__ */ jsx9(Copy, {
22623
- size: 18
22624
- })
22625
- })
22626
- ]
22627
- }),
22628
- (exp.extends || exp.implements?.length) && /* @__PURE__ */ jsxs8("div", {
22629
- className: "mt-2 flex items-center gap-2 flex-wrap text-sm",
22630
- children: [
22631
- exp.extends && /* @__PURE__ */ jsxs8(Fragment, {
22632
- children: [
22633
- /* @__PURE__ */ jsx9("span", {
22634
- className: "text-muted-foreground",
22635
- children: "extends"
22636
- }),
22637
- /* @__PURE__ */ jsx9("code", {
22638
- className: "font-mono text-primary",
22639
- children: exp.extends
22640
- })
22641
- ]
22642
- }),
22643
- exp.implements?.length && /* @__PURE__ */ jsxs8(Fragment, {
22644
- children: [
22645
- /* @__PURE__ */ jsx9("span", {
22646
- className: "text-muted-foreground",
22647
- children: "implements"
22648
- }),
22649
- /* @__PURE__ */ jsx9("code", {
22650
- className: "font-mono text-primary",
22651
- children: exp.implements.join(", ")
22652
- })
22653
- ]
22654
- })
22655
- ]
22656
- }),
22657
- exp.description && /* @__PURE__ */ jsx9("p", {
22658
- className: "mt-4 text-muted-foreground leading-relaxed text-base max-w-2xl",
22659
- children: exp.description
22660
- })
22661
- ]
22662
- }),
22663
- /* @__PURE__ */ jsxs8("div", {
22664
- className: cn2("grid gap-8 xl:gap-12", hasExamples ? "lg:grid-cols-[1fr,minmax(0,420px)]" : "grid-cols-1"),
22665
- children: [
22666
- /* @__PURE__ */ jsxs8("div", {
22667
- className: "min-w-0 space-y-8",
22668
- children: [
22669
- /* @__PURE__ */ jsx9(ImportSection, {
22670
- importStatement
22671
- }),
22672
- constructorParams.length > 0 && /* @__PURE__ */ jsxs8("section", {
22673
- children: [
22674
- /* @__PURE__ */ jsx9("h2", {
22675
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
22676
- children: "Constructor"
22677
- }),
22678
- /* @__PURE__ */ jsx9("div", {
22679
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
22680
- children: constructorParams.map((param, index) => /* @__PURE__ */ jsx9(ParameterItem, {
22681
- param,
22682
- className: "px-4"
22683
- }, param.name ?? index))
22684
- })
22685
- ]
22686
- }),
22687
- (staticProperties.length > 0 || staticMethods.length > 0) && /* @__PURE__ */ jsxs8("section", {
22688
- children: [
22689
- /* @__PURE__ */ jsx9("h2", {
22690
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
22691
- children: "Static Members"
22692
- }),
22693
- /* @__PURE__ */ jsxs8("div", {
22694
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
22695
- children: [
22696
- staticProperties.map((member, index) => /* @__PURE__ */ jsx9(PropertyItem, {
22697
- member
22698
- }, member.name ?? `prop-${index}`)),
22699
- staticMethods.map((member, index) => /* @__PURE__ */ jsx9(MethodItem, {
22700
- member
22701
- }, member.name ?? `method-${index}`))
22702
- ]
22703
- })
22704
- ]
22705
- }),
22706
- instanceMethods.length > 0 && /* @__PURE__ */ jsxs8("section", {
22707
- children: [
22708
- /* @__PURE__ */ jsx9("h2", {
22709
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
22710
- children: "Methods"
22711
- }),
22712
- /* @__PURE__ */ jsx9("div", {
22713
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
22714
- children: instanceMethods.map((member, index) => /* @__PURE__ */ jsx9(MethodItem, {
22715
- member
22716
- }, member.name ?? index))
22717
- })
22718
- ]
22719
- }),
22720
- instanceProperties.length > 0 && /* @__PURE__ */ jsxs8("section", {
22721
- children: [
22722
- /* @__PURE__ */ jsx9("h2", {
22723
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
22724
- children: "Properties"
22725
- }),
22726
- /* @__PURE__ */ jsx9("div", {
22727
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border px-4",
22728
- children: instanceProperties.map((member, index) => /* @__PURE__ */ jsx9(PropertyItem, {
22729
- member
22730
- }, member.name ?? index))
22731
- })
22732
- ]
22733
- })
22734
- ]
22735
- }),
22736
- hasExamples && /* @__PURE__ */ jsx9("aside", {
22737
- className: "lg:sticky lg:top-16 lg:self-start lg:max-h-[calc(100vh-6rem)] lg:overflow-y-auto",
22738
- children: codeTabs.length === 1 ? /* @__PURE__ */ jsx9("div", {
22739
- className: "rounded-lg border border-border overflow-hidden bg-background",
22740
- children: codeTabs[0].content
22741
- }) : /* @__PURE__ */ jsx9(CodeTabs, {
22742
- tabs: codeTabs,
22743
- sticky: true
22744
- })
22745
- })
22746
- ]
22747
- })
22748
- ]
22749
- });
22750
- }
22751
-
22752
- // src/components/styled/EnumPage.tsx
22753
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
22754
-
22755
- function EnumPage({ export: exp, spec, renderExample }) {
22756
- const members = exp.members ?? [];
22757
- const hasExamples = exp.examples && exp.examples.length > 0;
22758
- const signature = buildSignatureString(exp);
22759
- return /* @__PURE__ */ jsxs9("div", {
22760
- className: "space-y-6",
22761
- children: [
22762
- exp.description && /* @__PURE__ */ jsx10("p", {
22763
- className: "text-muted-foreground text-base leading-relaxed",
22764
- children: exp.description
22765
- }),
22766
- /* @__PURE__ */ jsxs9("section", {
22767
- children: [
22768
- /* @__PURE__ */ jsx10("h2", {
22769
- className: "text-xl font-semibold mb-2",
22770
- children: "Declaration"
22771
- }),
22772
- /* @__PURE__ */ jsx10("div", {
22773
- className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
22774
- children: /* @__PURE__ */ jsx10("code", {
22775
- className: "font-mono text-sm text-foreground",
22776
- children: signature
22777
- })
22778
- }),
22779
- exp.deprecated && /* @__PURE__ */ jsxs9("div", {
22780
- 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",
22781
- children: [
22782
- /* @__PURE__ */ jsx10("strong", {
22783
- children: "Deprecated:"
22784
- }),
22785
- " This export is deprecated."
22786
- ]
22787
- })
22788
- ]
22789
- }),
22790
- members.length > 0 && /* @__PURE__ */ jsxs9("section", {
22791
- children: [
22792
- /* @__PURE__ */ jsx10("h2", {
22793
- className: "text-xl font-semibold mb-2",
22794
- children: "Members"
22795
- }),
22796
- /* @__PURE__ */ jsx10("div", {
22797
- className: "overflow-x-auto",
22798
- children: /* @__PURE__ */ jsxs9("table", {
22799
- className: "w-full text-sm border-collapse",
22800
- children: [
22801
- /* @__PURE__ */ jsx10("thead", {
22802
- children: /* @__PURE__ */ jsxs9("tr", {
22803
- className: "border-b border-border",
22804
- children: [
22805
- /* @__PURE__ */ jsx10("th", {
22806
- className: "text-left py-2 px-3 font-medium text-muted-foreground",
22807
- children: "Name"
22808
- }),
22809
- /* @__PURE__ */ jsx10("th", {
22810
- className: "text-left py-2 px-3 font-medium text-muted-foreground",
22811
- children: "Value"
22812
- }),
22813
- /* @__PURE__ */ jsx10("th", {
22814
- className: "text-left py-2 px-3 font-medium text-muted-foreground",
22815
- children: "Description"
22816
- })
22817
- ]
22818
- })
22819
- }),
22820
- /* @__PURE__ */ jsx10("tbody", {
22821
- children: members.map((member, index) => {
22822
- const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? "-" : member.schema : "-";
22823
- return /* @__PURE__ */ jsxs9("tr", {
22824
- className: "border-b border-border last:border-0",
22825
- children: [
22826
- /* @__PURE__ */ jsx10("td", {
22827
- className: "py-2 px-3 align-top",
22828
- children: /* @__PURE__ */ jsx10("code", {
22829
- className: "text-primary font-mono text-xs bg-secondary px-1.5 py-0.5 rounded",
22830
- children: member.name
22831
- })
22832
- }),
22833
- /* @__PURE__ */ jsx10("td", {
22834
- className: "py-2 px-3 align-top",
22835
- children: /* @__PURE__ */ jsx10("code", {
22836
- className: "font-mono text-xs text-muted-foreground",
22837
- children: String(value)
22838
- })
22839
- }),
22840
- /* @__PURE__ */ jsx10("td", {
22841
- className: "py-2 px-3 align-top text-muted-foreground",
22842
- children: member.description ?? ""
22843
- })
22844
- ]
22845
- }, member.name ?? index);
22846
- })
22847
- })
22848
- ]
22849
- })
22850
- })
22851
- ]
22852
- }),
22853
- hasExamples && /* @__PURE__ */ jsxs9("section", {
22854
- children: [
22855
- /* @__PURE__ */ jsx10("h2", {
22856
- className: "text-xl font-semibold mb-2",
22857
- children: "Examples"
22858
- }),
22859
- exp.examples.map((example, index) => {
22860
- const code = typeof example === "string" ? example : example.code;
22861
- return /* @__PURE__ */ jsx10("div", {
22862
- className: "mb-4",
22863
- children: renderExample ? renderExample(code, `${exp.name.toLowerCase()}-${index}.ts`) : /* @__PURE__ */ jsx10("pre", {
22864
- className: "rounded-lg border border-border bg-secondary p-4 overflow-x-auto",
22865
- children: /* @__PURE__ */ jsx10("code", {
22866
- className: "font-mono text-sm text-foreground",
22867
- children: code
22868
- })
22869
- })
22870
- }, index);
22871
- })
22872
- ]
22630
+ description && /* @__PURE__ */ jsx10("p", {
22631
+ className: "text-sm text-muted-foreground line-clamp-2 leading-relaxed group-hover:text-muted-foreground/80 transition-colors",
22632
+ children: description
22873
22633
  })
22874
22634
  ]
22875
22635
  });
22876
22636
  }
22877
22637
 
22878
22638
  // src/components/styled/ExportIndexPage.tsx
22879
- import { cn as cn4 } from "@doccov/ui/lib/utils";
22880
- import { useState as useState6, useMemo } from "react";
22881
-
22882
- // src/components/styled/ExportCard.tsx
22883
- var import_link3 = __toESM(require_link(), 1);
22884
- import { cn as cn3 } from "@doccov/ui/lib/utils";
22885
22639
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
22886
22640
 
22887
- var KIND_COLORS = {
22888
- function: "group-hover:text-blue-600 dark:group-hover:text-blue-400",
22889
- class: "group-hover:text-purple-600 dark:group-hover:text-purple-400",
22890
- interface: "group-hover:text-green-600 dark:group-hover:text-green-400",
22891
- type: "group-hover:text-amber-600 dark:group-hover:text-amber-400",
22892
- enum: "group-hover:text-rose-600 dark:group-hover:text-rose-400",
22893
- variable: "group-hover:text-cyan-600 dark:group-hover:text-cyan-400"
22894
- };
22895
- var KIND_BADGE_COLORS = {
22896
- function: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
22897
- class: "bg-purple-500/10 text-purple-600 dark:text-purple-400",
22898
- interface: "bg-green-500/10 text-green-600 dark:text-green-400",
22899
- type: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
22900
- enum: "bg-rose-500/10 text-rose-600 dark:text-rose-400",
22901
- variable: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"
22902
- };
22903
- function ExportCard({
22904
- name,
22905
- description,
22906
- href,
22907
- kind = "function",
22908
- className
22909
- }) {
22910
- const isFunction = kind === "function";
22911
- const hoverColor = KIND_COLORS[kind];
22912
- const badgeColor = KIND_BADGE_COLORS[kind];
22913
- return /* @__PURE__ */ jsxs10(import_link3.default, {
22914
- href,
22915
- className: cn3("group block rounded-lg border border-border bg-card/50 p-4", "transition-all duration-200 ease-out", "hover:border-primary/30 hover:bg-card hover:shadow-lg hover:shadow-primary/5", "hover:-translate-y-1", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
22916
- children: [
22917
- /* @__PURE__ */ jsxs10("div", {
22918
- className: "flex items-center gap-2 mb-2",
22919
- children: [
22920
- /* @__PURE__ */ jsx11("span", {
22921
- className: cn3("font-mono text-base font-medium text-foreground transition-colors duration-200", hoverColor),
22922
- children: name
22923
- }),
22924
- isFunction && /* @__PURE__ */ jsx11("span", {
22925
- className: "font-mono text-base text-muted-foreground",
22926
- children: "()"
22927
- }),
22928
- /* @__PURE__ */ jsx11("span", {
22929
- className: cn3("ml-auto text-xs px-2 py-0.5 rounded-full font-medium", badgeColor),
22930
- children: kind
22931
- })
22932
- ]
22933
- }),
22934
- description && /* @__PURE__ */ jsx11("p", {
22935
- className: "text-sm text-muted-foreground line-clamp-2 leading-relaxed group-hover:text-muted-foreground/80 transition-colors",
22936
- children: description
22937
- })
22938
- ]
22939
- });
22940
- }
22941
-
22942
- // src/components/styled/ExportIndexPage.tsx
22943
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
22944
-
22945
22641
  var KIND_ORDER = ["function", "class", "interface", "type", "enum", "variable"];
22946
22642
  var KIND_LABELS = {
22947
22643
  function: "Functions",
@@ -22974,8 +22670,8 @@ function ExportIndexPage({
22974
22670
  showSearch = true,
22975
22671
  showFilters = true
22976
22672
  }) {
22977
- const [searchQuery, setSearchQuery] = useState6("");
22978
- const [activeFilter, setActiveFilter] = useState6("all");
22673
+ const [searchQuery, setSearchQuery] = useState4("");
22674
+ const [activeFilter, setActiveFilter] = useState4("all");
22979
22675
  if (false) {}
22980
22676
  const allGroups = useMemo(() => groupByKind(spec.exports), [spec.exports]);
22981
22677
  const filteredGroups = useMemo(() => {
@@ -22991,60 +22687,60 @@ function ExportIndexPage({
22991
22687
  }, [allGroups, searchQuery, activeFilter]);
22992
22688
  const availableKinds = useMemo(() => allGroups.map((g) => g.kind), [allGroups]);
22993
22689
  const totalExports = filteredGroups.reduce((sum, g) => sum + g.exports.length, 0);
22994
- return /* @__PURE__ */ jsxs11("div", {
22995
- className: cn4("space-y-8 not-prose", className),
22690
+ return /* @__PURE__ */ jsxs10("div", {
22691
+ className: cn2("space-y-8 not-prose", className),
22996
22692
  children: [
22997
- /* @__PURE__ */ jsxs11("div", {
22693
+ /* @__PURE__ */ jsxs10("div", {
22998
22694
  children: [
22999
- /* @__PURE__ */ jsx12("h1", {
22695
+ /* @__PURE__ */ jsx11("h1", {
23000
22696
  className: "text-3xl font-bold text-foreground mb-3",
23001
22697
  children: spec.meta.name || "API Reference"
23002
22698
  }),
23003
- (description || spec.meta.description) && /* @__PURE__ */ jsx12("p", {
22699
+ (description || spec.meta.description) && /* @__PURE__ */ jsx11("p", {
23004
22700
  className: "text-muted-foreground text-lg leading-relaxed max-w-3xl",
23005
22701
  children: description || spec.meta.description
23006
22702
  })
23007
22703
  ]
23008
22704
  }),
23009
- (showSearch || showFilters) && /* @__PURE__ */ jsxs11("div", {
22705
+ (showSearch || showFilters) && /* @__PURE__ */ jsxs10("div", {
23010
22706
  className: "space-y-4",
23011
22707
  children: [
23012
- showSearch && /* @__PURE__ */ jsxs11("div", {
22708
+ showSearch && /* @__PURE__ */ jsxs10("div", {
23013
22709
  className: "relative max-w-md",
23014
22710
  children: [
23015
- /* @__PURE__ */ jsx12(Search, {
22711
+ /* @__PURE__ */ jsx11(Search, {
23016
22712
  size: 18,
23017
22713
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
23018
22714
  }),
23019
- /* @__PURE__ */ jsx12("input", {
22715
+ /* @__PURE__ */ jsx11("input", {
23020
22716
  type: "text",
23021
22717
  placeholder: "Search exports...",
23022
22718
  value: searchQuery,
23023
22719
  onChange: (e) => setSearchQuery(e.target.value),
23024
- className: cn4("w-full pl-10 pr-4 py-2 rounded-lg", "border border-border bg-background", "text-sm text-foreground placeholder:text-muted-foreground", "focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent", "transition-shadow")
22720
+ className: cn2("w-full pl-10 pr-4 py-2 rounded-lg", "border border-border bg-background", "text-sm text-foreground placeholder:text-muted-foreground", "focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent", "transition-shadow")
23025
22721
  })
23026
22722
  ]
23027
22723
  }),
23028
- showFilters && availableKinds.length > 1 && /* @__PURE__ */ jsxs11("div", {
22724
+ showFilters && availableKinds.length > 1 && /* @__PURE__ */ jsxs10("div", {
23029
22725
  className: "flex flex-wrap gap-2",
23030
22726
  children: [
23031
- /* @__PURE__ */ jsx12("button", {
22727
+ /* @__PURE__ */ jsx11("button", {
23032
22728
  type: "button",
23033
22729
  onClick: () => setActiveFilter("all"),
23034
- className: cn4("px-3 py-1.5 text-sm rounded-md transition-all cursor-pointer", activeFilter === "all" ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),
22730
+ className: cn2("px-3 py-1.5 text-sm rounded-md transition-all cursor-pointer", activeFilter === "all" ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),
23035
22731
  children: "All"
23036
22732
  }),
23037
- availableKinds.map((kind) => /* @__PURE__ */ jsx12("button", {
22733
+ availableKinds.map((kind) => /* @__PURE__ */ jsx11("button", {
23038
22734
  type: "button",
23039
22735
  onClick: () => setActiveFilter(kind),
23040
- className: cn4("px-3 py-1.5 text-sm rounded-md transition-all cursor-pointer", activeFilter === kind ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),
22736
+ className: cn2("px-3 py-1.5 text-sm rounded-md transition-all cursor-pointer", activeFilter === kind ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),
23041
22737
  children: KIND_LABELS[kind]
23042
22738
  }, kind))
23043
22739
  ]
23044
22740
  })
23045
22741
  ]
23046
22742
  }),
23047
- (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsxs11("p", {
22743
+ (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsxs10("p", {
23048
22744
  className: "text-sm text-muted-foreground",
23049
22745
  children: [
23050
22746
  totalExports,
@@ -23053,15 +22749,15 @@ function ExportIndexPage({
23053
22749
  searchQuery && ` for "${searchQuery}"`
23054
22750
  ]
23055
22751
  }),
23056
- filteredGroups.map((group) => /* @__PURE__ */ jsxs11("section", {
22752
+ filteredGroups.map((group) => /* @__PURE__ */ jsxs10("section", {
23057
22753
  children: [
23058
- /* @__PURE__ */ jsx12("h2", {
22754
+ /* @__PURE__ */ jsx11("h2", {
23059
22755
  className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
23060
22756
  children: group.label
23061
22757
  }),
23062
- /* @__PURE__ */ jsx12("div", {
22758
+ /* @__PURE__ */ jsx11("div", {
23063
22759
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
23064
- children: group.exports.map((exp) => /* @__PURE__ */ jsx12(ExportCard, {
22760
+ children: group.exports.map((exp) => /* @__PURE__ */ jsx11(ExportCard, {
23065
22761
  name: exp.name,
23066
22762
  description: exp.description,
23067
22763
  href: `${baseHref}/${group.kind}s/${exp.id}`,
@@ -23070,14 +22766,14 @@ function ExportIndexPage({
23070
22766
  })
23071
22767
  ]
23072
22768
  }, group.kind)),
23073
- filteredGroups.length === 0 && /* @__PURE__ */ jsxs11("div", {
22769
+ filteredGroups.length === 0 && /* @__PURE__ */ jsxs10("div", {
23074
22770
  className: "rounded-lg border border-border bg-card/50 p-8 text-center",
23075
22771
  children: [
23076
- /* @__PURE__ */ jsx12("p", {
22772
+ /* @__PURE__ */ jsx11("p", {
23077
22773
  className: "text-muted-foreground",
23078
22774
  children: searchQuery || activeFilter !== "all" ? "No exports match your search." : "No exports found in this package."
23079
22775
  }),
23080
- (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsx12("button", {
22776
+ (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsx11("button", {
23081
22777
  type: "button",
23082
22778
  onClick: () => {
23083
22779
  setSearchQuery("");
@@ -23093,457 +22789,276 @@ function ExportIndexPage({
23093
22789
  }
23094
22790
 
23095
22791
  // src/components/styled/FunctionPage.tsx
23096
- import { cn as cn5 } from "@doccov/ui/lib/utils";
23097
- import { CodeTabs as CodeTabs2, ImportSection as ImportSection2 } from "@doccov/ui/api";
23098
- import { useState as useState7 } from "react";
23099
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
22792
+ import {
22793
+ APIParameterItem as APIParameterItem3,
22794
+ APISection as APISection3,
22795
+ ParameterList as ParameterList3,
22796
+ ResponseBlock
22797
+ } from "@doccov/ui/docskit";
22798
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
23100
22799
 
23101
22800
  function FunctionPage({
23102
22801
  export: exp,
23103
- spec,
23104
- renderExample
22802
+ spec
23105
22803
  }) {
23106
- const [copied, setCopied] = useState7(false);
23107
22804
  const sig = exp.signatures?.[0];
23108
- const hasExamples = exp.examples && exp.examples.length > 0;
23109
22805
  const hasParams = sig?.parameters && sig.parameters.length > 0;
23110
- const packageName = spec.meta.name || "package";
23111
- const importStatement = `import { ${exp.name} } from '${packageName}'`;
23112
- const handleCopyName = () => {
23113
- navigator.clipboard.writeText(exp.name);
23114
- setCopied(true);
23115
- setTimeout(() => setCopied(false), 1200);
23116
- };
23117
- const codeTabs = hasExamples ? exp.examples.map((example, index) => {
23118
- const code = typeof example === "string" ? example : example.code;
23119
- const title = typeof example === "string" ? `Example ${index + 1}` : example.title || `Example ${index + 1}`;
23120
- const filename = `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}-${index + 1}.ts`;
23121
- return {
23122
- label: title,
23123
- code,
23124
- content: renderExample ? renderExample(code, filename) : /* @__PURE__ */ jsx13("pre", {
23125
- className: "p-4 overflow-x-auto",
23126
- children: /* @__PURE__ */ jsx13("code", {
23127
- className: "font-mono text-sm text-foreground",
23128
- children: code
23129
- })
23130
- })
23131
- };
23132
- }) : [];
23133
- return /* @__PURE__ */ jsxs12("div", {
22806
+ const hasExamples = exp.examples && exp.examples.length > 0;
22807
+ const languages = getLanguagesFromExamples(exp.examples);
22808
+ const examples = specExamplesToCodeExamples(exp.examples);
22809
+ const importStatement = buildImportStatement(exp, spec);
22810
+ const displayExamples = examples.length > 0 ? examples : [{
22811
+ languageId: "typescript",
22812
+ code: `${importStatement}
22813
+
22814
+ // Usage
22815
+ ${exp.name}(${sig?.parameters?.map((p) => p.name).join(", ") || ""})`,
22816
+ highlightLang: "ts"
22817
+ }];
22818
+ const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
22819
+ return /* @__PURE__ */ jsx12("div", {
23134
22820
  className: "doccov-function-page not-prose",
23135
- children: [
23136
- /* @__PURE__ */ jsxs12("header", {
23137
- className: "mb-6",
22821
+ children: /* @__PURE__ */ jsxs11(APISection3, {
22822
+ id: exp.id || exp.name,
22823
+ title: `${exp.name}()`,
22824
+ description: /* @__PURE__ */ jsxs11("div", {
22825
+ className: "space-y-3",
23138
22826
  children: [
23139
- /* @__PURE__ */ jsxs12("div", {
23140
- className: "flex items-center gap-3",
23141
- children: [
23142
- /* @__PURE__ */ jsxs12("h1", {
23143
- className: "font-mono text-3xl font-bold text-foreground tracking-tight",
23144
- children: [
23145
- exp.name,
23146
- /* @__PURE__ */ jsx13("span", {
23147
- className: "text-muted-foreground font-normal",
23148
- children: "()"
23149
- })
23150
- ]
23151
- }),
23152
- /* @__PURE__ */ jsx13("button", {
23153
- type: "button",
23154
- onClick: handleCopyName,
23155
- className: cn5("p-1.5 rounded-md", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "transition-all cursor-pointer"),
23156
- "aria-label": "Copy function name",
23157
- children: copied ? /* @__PURE__ */ jsx13(Check, {
23158
- size: 18
23159
- }) : /* @__PURE__ */ jsx13(Copy, {
23160
- size: 18
23161
- })
23162
- })
23163
- ]
23164
- }),
23165
- exp.description && /* @__PURE__ */ jsx13("p", {
23166
- className: "mt-4 text-muted-foreground leading-relaxed text-base max-w-2xl",
22827
+ exp.description && /* @__PURE__ */ jsx12("p", {
23167
22828
  children: exp.description
22829
+ }),
22830
+ /* @__PURE__ */ jsx12("code", {
22831
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
22832
+ children: importStatement
23168
22833
  })
23169
22834
  ]
23170
22835
  }),
23171
- /* @__PURE__ */ jsxs12("div", {
23172
- className: cn5("grid gap-8 xl:gap-12", hasExamples ? "lg:grid-cols-[1fr,minmax(0,420px)]" : "grid-cols-1"),
23173
- children: [
23174
- /* @__PURE__ */ jsxs12("div", {
23175
- className: "min-w-0 space-y-8",
22836
+ languages: displayLanguages,
22837
+ examples: displayExamples,
22838
+ codePanelTitle: `${exp.name}()`,
22839
+ children: [
22840
+ hasParams && /* @__PURE__ */ jsx12(ParameterList3, {
22841
+ title: "Parameters",
22842
+ children: sig.parameters.map((param, index) => {
22843
+ const apiParam = specParamToAPIParam(param);
22844
+ return /* @__PURE__ */ jsx12(APIParameterItem3, {
22845
+ name: apiParam.name,
22846
+ type: apiParam.type,
22847
+ required: apiParam.required,
22848
+ description: apiParam.description,
22849
+ children: apiParam.children
22850
+ }, param.name ?? index);
22851
+ })
22852
+ }),
22853
+ sig?.returns && /* @__PURE__ */ jsx12(ResponseBlock, {
22854
+ description: /* @__PURE__ */ jsxs11("span", {
23176
22855
  children: [
23177
- /* @__PURE__ */ jsx13(ImportSection2, {
23178
- importStatement
23179
- }),
23180
- hasParams && /* @__PURE__ */ jsxs12("section", {
23181
- children: [
23182
- /* @__PURE__ */ jsx13("h2", {
23183
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
23184
- children: "Parameters"
23185
- }),
23186
- /* @__PURE__ */ jsx13("div", {
23187
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
23188
- children: sig.parameters.map((param, index) => /* @__PURE__ */ jsx13(ParameterItem, {
23189
- param,
23190
- className: "px-4"
23191
- }, param.name ?? index))
23192
- })
23193
- ]
22856
+ /* @__PURE__ */ jsx12("span", {
22857
+ className: "font-mono text-sm font-medium",
22858
+ children: formatSchema(sig.returns.schema)
23194
22859
  }),
23195
- sig?.returns && /* @__PURE__ */ jsxs12("section", {
23196
- children: [
23197
- /* @__PURE__ */ jsx13("h2", {
23198
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
23199
- children: "Returns"
23200
- }),
23201
- /* @__PURE__ */ jsxs12("div", {
23202
- className: "rounded-lg border border-border bg-card/50 p-4",
23203
- children: [
23204
- /* @__PURE__ */ jsx13("div", {
23205
- className: "flex items-baseline gap-2 mb-2",
23206
- children: /* @__PURE__ */ jsx13("span", {
23207
- className: "font-mono text-sm font-medium text-foreground",
23208
- children: formatSchema(sig.returns.schema)
23209
- })
23210
- }),
23211
- sig.returns.description && /* @__PURE__ */ jsx13("p", {
23212
- className: "text-sm text-muted-foreground leading-relaxed",
23213
- children: sig.returns.description
23214
- })
23215
- ]
23216
- })
23217
- ]
22860
+ sig.returns.description && /* @__PURE__ */ jsx12("span", {
22861
+ className: "ml-2 text-muted-foreground",
22862
+ children: sig.returns.description
23218
22863
  })
23219
22864
  ]
23220
22865
  }),
23221
- hasExamples && /* @__PURE__ */ jsx13("aside", {
23222
- className: "lg:sticky lg:top-16 lg:self-start lg:max-h-[calc(100vh-6rem)] lg:overflow-y-auto",
23223
- children: codeTabs.length === 1 ? /* @__PURE__ */ jsx13("div", {
23224
- className: "rounded-lg border border-border overflow-hidden bg-background",
23225
- children: codeTabs[0].content
23226
- }) : /* @__PURE__ */ jsx13(CodeTabs2, {
23227
- tabs: codeTabs,
23228
- sticky: true
23229
- })
23230
- })
23231
- ]
23232
- })
23233
- ]
22866
+ className: "mt-6"
22867
+ }),
22868
+ exp.typeParameters && exp.typeParameters.length > 0 && /* @__PURE__ */ jsx12(ParameterList3, {
22869
+ title: "Type Parameters",
22870
+ className: "mt-6",
22871
+ children: exp.typeParameters.map((tp) => /* @__PURE__ */ jsx12(APIParameterItem3, {
22872
+ name: tp.name,
22873
+ type: tp.constraint || "unknown",
22874
+ description: tp.default ? `Default: ${tp.default}` : undefined
22875
+ }, tp.name))
22876
+ })
22877
+ ]
22878
+ })
23234
22879
  });
23235
22880
  }
23236
22881
 
23237
22882
  // src/components/styled/InterfacePage.tsx
23238
- import { cn as cn6 } from "@doccov/ui/lib/utils";
23239
- import { CodeTabs as CodeTabs3, ImportSection as ImportSection3 } from "@doccov/ui/api";
23240
- import { useState as useState8 } from "react";
23241
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
22883
+ import {
22884
+ APIParameterItem as APIParameterItem4,
22885
+ APISection as APISection4,
22886
+ ParameterList as ParameterList4
22887
+ } from "@doccov/ui/docskit";
22888
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
23242
22889
 
22890
+ function formatMethodSignature2(member) {
22891
+ const sig = member.signatures?.[0];
22892
+ const params = sig?.parameters ?? [];
22893
+ const returnType = formatSchema(sig?.returns?.schema);
22894
+ const paramStr = params.map((p) => `${p.name}${p.required === false ? "?" : ""}: ${formatSchema(p.schema)}`).join(", ");
22895
+ return `(${paramStr}): ${returnType}`;
22896
+ }
23243
22897
  function InterfacePage({
23244
22898
  export: exp,
23245
- spec,
23246
- renderExample
22899
+ spec
23247
22900
  }) {
23248
- const [copied, setCopied] = useState8(false);
23249
- const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field" || !m.kind);
23250
- const methods = exp.members?.filter((m) => m.kind === "method" || m.kind === "function");
23251
- const hasExamples = exp.examples && exp.examples.length > 0;
23252
- const packageName = spec.meta.name || "package";
23253
- const importStatement = `import type { ${exp.name} } from '${packageName}'`;
23254
- const handleCopyName = () => {
23255
- navigator.clipboard.writeText(exp.name);
23256
- setCopied(true);
23257
- setTimeout(() => setCopied(false), 1200);
23258
- };
23259
- const codeTabs = hasExamples ? exp.examples.map((example, index) => {
23260
- const code = typeof example === "string" ? example : example.code;
23261
- const title = typeof example === "string" ? `Example ${index + 1}` : example.title || `Example ${index + 1}`;
23262
- const filename = `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}-${index + 1}.ts`;
23263
- return {
23264
- label: title,
23265
- code,
23266
- content: renderExample ? renderExample(code, filename) : /* @__PURE__ */ jsx14("pre", {
23267
- className: "p-4 overflow-x-auto",
23268
- children: /* @__PURE__ */ jsx14("code", {
23269
- className: "font-mono text-sm text-foreground",
23270
- children: code
23271
- })
23272
- })
23273
- };
23274
- }) : [];
23275
- return /* @__PURE__ */ jsxs13("div", {
22901
+ const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field" || !m.kind) ?? [];
22902
+ const methods = exp.members?.filter((m) => m.kind === "method" || m.kind === "function") ?? [];
22903
+ const languages = getLanguagesFromExamples(exp.examples);
22904
+ const examples = specExamplesToCodeExamples(exp.examples);
22905
+ const importStatement = buildImportStatement(exp, spec);
22906
+ const typeDefinition = properties.length > 0 ? `${exp.kind === "type" ? "type" : "interface"} ${exp.name} {
22907
+ ${properties.map((p) => ` ${p.name}${p.required === false ? "?" : ""}: ${formatSchema(p.schema)};`).join(`
22908
+ `)}
22909
+ }` : `${exp.kind === "type" ? "type" : "interface"} ${exp.name} { }`;
22910
+ const displayExamples = examples.length > 0 ? examples : [{
22911
+ languageId: "typescript",
22912
+ code: `${importStatement}
22913
+
22914
+ ${typeDefinition}`,
22915
+ highlightLang: "ts"
22916
+ }];
22917
+ const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
22918
+ const kindLabel = exp.kind === "type" ? "type" : "interface";
22919
+ return /* @__PURE__ */ jsx13("div", {
23276
22920
  className: "doccov-interface-page not-prose",
23277
- children: [
23278
- /* @__PURE__ */ jsxs13("header", {
23279
- className: "mb-6",
22921
+ children: /* @__PURE__ */ jsxs12(APISection4, {
22922
+ id: exp.id || exp.name,
22923
+ title: `${kindLabel} ${exp.name}`,
22924
+ description: /* @__PURE__ */ jsxs12("div", {
22925
+ className: "space-y-3",
23280
22926
  children: [
23281
- /* @__PURE__ */ jsxs13("div", {
23282
- className: "flex items-center gap-3",
22927
+ exp.extends && /* @__PURE__ */ jsxs12("p", {
22928
+ className: "font-mono text-sm text-muted-foreground",
23283
22929
  children: [
23284
- /* @__PURE__ */ jsx14("span", {
23285
- className: cn6("text-xs px-2 py-0.5 rounded-full font-medium", exp.kind === "type" ? "bg-amber-500/10 text-amber-600 dark:text-amber-400" : "bg-green-500/10 text-green-600 dark:text-green-400"),
23286
- children: exp.kind === "type" ? "type" : "interface"
23287
- }),
23288
- /* @__PURE__ */ jsx14("h1", {
23289
- className: "font-mono text-3xl font-bold text-foreground tracking-tight",
23290
- children: exp.name
23291
- }),
23292
- /* @__PURE__ */ jsx14("button", {
23293
- type: "button",
23294
- onClick: handleCopyName,
23295
- className: cn6("p-1.5 rounded-md", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "transition-all cursor-pointer"),
23296
- "aria-label": "Copy type name",
23297
- children: copied ? /* @__PURE__ */ jsx14(Check, {
23298
- size: 18
23299
- }) : /* @__PURE__ */ jsx14(Copy, {
23300
- size: 18
23301
- })
23302
- })
22930
+ "extends ",
22931
+ exp.extends
23303
22932
  ]
23304
22933
  }),
23305
- exp.description && /* @__PURE__ */ jsx14("p", {
23306
- className: "mt-4 text-muted-foreground leading-relaxed text-base max-w-2xl",
22934
+ exp.description && /* @__PURE__ */ jsx13("p", {
23307
22935
  children: exp.description
23308
22936
  }),
23309
- exp.deprecated && /* @__PURE__ */ jsxs13("div", {
23310
- className: "mt-4 rounded-md bg-yellow-500/10 border border-yellow-500/20 px-3 py-2 text-sm text-yellow-600 dark:text-yellow-400",
22937
+ exp.deprecated && /* @__PURE__ */ jsxs12("div", {
22938
+ 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",
23311
22939
  children: [
23312
- /* @__PURE__ */ jsx14("strong", {
22940
+ /* @__PURE__ */ jsx13("strong", {
23313
22941
  children: "Deprecated:"
23314
22942
  }),
23315
22943
  " This export is deprecated."
23316
22944
  ]
22945
+ }),
22946
+ /* @__PURE__ */ jsx13("code", {
22947
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
22948
+ children: importStatement
23317
22949
  })
23318
22950
  ]
23319
22951
  }),
23320
- /* @__PURE__ */ jsxs13("div", {
23321
- className: cn6("grid gap-8 xl:gap-12", hasExamples ? "lg:grid-cols-[1fr,minmax(0,420px)]" : "grid-cols-1"),
23322
- children: [
23323
- /* @__PURE__ */ jsxs13("div", {
23324
- className: "min-w-0 space-y-8",
23325
- children: [
23326
- /* @__PURE__ */ jsx14(ImportSection3, {
23327
- importStatement
23328
- }),
23329
- exp.extends && /* @__PURE__ */ jsxs13("section", {
23330
- children: [
23331
- /* @__PURE__ */ jsx14("h2", {
23332
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
23333
- children: "Extends"
23334
- }),
23335
- /* @__PURE__ */ jsx14("div", {
23336
- className: "rounded-lg border border-border bg-card/50 p-4",
23337
- children: /* @__PURE__ */ jsx14("code", {
23338
- className: "font-mono text-sm text-primary",
23339
- children: exp.extends
23340
- })
23341
- })
23342
- ]
23343
- }),
23344
- properties && properties.length > 0 && /* @__PURE__ */ jsxs13("section", {
23345
- children: [
23346
- /* @__PURE__ */ jsx14("h2", {
23347
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
23348
- children: "Properties"
23349
- }),
23350
- /* @__PURE__ */ jsx14("div", {
23351
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
23352
- children: properties.map((prop, index) => /* @__PURE__ */ jsx14(ParameterItem, {
23353
- param: {
23354
- name: prop.name,
23355
- schema: prop.schema,
23356
- description: prop.description,
23357
- required: prop.required
23358
- },
23359
- className: "px-4"
23360
- }, prop.name ?? index))
23361
- })
23362
- ]
23363
- }),
23364
- methods && methods.length > 0 && /* @__PURE__ */ jsxs13("section", {
23365
- children: [
23366
- /* @__PURE__ */ jsx14("h2", {
23367
- className: "text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-4",
23368
- children: "Methods"
23369
- }),
23370
- /* @__PURE__ */ jsx14("div", {
23371
- className: "rounded-lg border border-border bg-card/50 divide-y divide-border",
23372
- children: methods.map((method, index) => {
23373
- const sig = method.signatures?.[0];
23374
- const params = sig?.parameters ?? [];
23375
- const returnType = formatSchema(sig?.returns?.schema);
23376
- return /* @__PURE__ */ jsxs13("div", {
23377
- className: "p-4",
23378
- children: [
23379
- /* @__PURE__ */ jsxs13("code", {
23380
- className: "font-mono text-sm text-foreground",
23381
- children: [
23382
- /* @__PURE__ */ jsx14("span", {
23383
- className: "font-medium",
23384
- children: method.name
23385
- }),
23386
- /* @__PURE__ */ jsx14("span", {
23387
- className: "text-muted-foreground",
23388
- children: "("
23389
- }),
23390
- params.map((p, i) => /* @__PURE__ */ jsxs13("span", {
23391
- children: [
23392
- i > 0 && /* @__PURE__ */ jsx14("span", {
23393
- className: "text-muted-foreground",
23394
- children: ", "
23395
- }),
23396
- /* @__PURE__ */ jsx14("span", {
23397
- className: "text-muted-foreground",
23398
- children: p.name
23399
- }),
23400
- p.required === false && /* @__PURE__ */ jsx14("span", {
23401
- className: "text-muted-foreground",
23402
- children: "?"
23403
- }),
23404
- /* @__PURE__ */ jsx14("span", {
23405
- className: "text-muted-foreground",
23406
- children: ": "
23407
- }),
23408
- /* @__PURE__ */ jsx14("span", {
23409
- className: "text-primary",
23410
- children: formatSchema(p.schema)
23411
- })
23412
- ]
23413
- }, p.name)),
23414
- /* @__PURE__ */ jsx14("span", {
23415
- className: "text-muted-foreground",
23416
- children: "): "
23417
- }),
23418
- /* @__PURE__ */ jsx14("span", {
23419
- className: "text-primary",
23420
- children: returnType
23421
- })
23422
- ]
23423
- }),
23424
- method.description && /* @__PURE__ */ jsx14("p", {
23425
- className: "text-sm text-muted-foreground mt-2 leading-relaxed",
23426
- children: method.description
23427
- })
23428
- ]
23429
- }, method.name ?? index);
23430
- })
23431
- })
23432
- ]
23433
- })
23434
- ]
23435
- }),
23436
- hasExamples && /* @__PURE__ */ jsx14("aside", {
23437
- className: "lg:sticky lg:top-16 lg:self-start lg:max-h-[calc(100vh-6rem)] lg:overflow-y-auto",
23438
- children: codeTabs.length === 1 ? /* @__PURE__ */ jsx14("div", {
23439
- className: "rounded-lg border border-border overflow-hidden bg-background",
23440
- children: codeTabs[0].content
23441
- }) : /* @__PURE__ */ jsx14(CodeTabs3, {
23442
- tabs: codeTabs,
23443
- sticky: true
23444
- })
22952
+ languages: displayLanguages,
22953
+ examples: displayExamples,
22954
+ codePanelTitle: exp.name,
22955
+ children: [
22956
+ properties.length > 0 && /* @__PURE__ */ jsx13(ParameterList4, {
22957
+ title: "Properties",
22958
+ children: properties.map((prop, index) => {
22959
+ const type = formatSchema(prop.schema);
22960
+ const children = specSchemaToAPISchema(prop.schema);
22961
+ const hasNestedProperties = children?.properties && Object.keys(children.properties).length > 0;
22962
+ return /* @__PURE__ */ jsx13(APIParameterItem4, {
22963
+ name: prop.name,
22964
+ type,
22965
+ required: prop.required !== false,
22966
+ description: prop.description,
22967
+ children: hasNestedProperties ? children : undefined
22968
+ }, prop.name ?? index);
23445
22969
  })
23446
- ]
23447
- })
23448
- ]
22970
+ }),
22971
+ methods.length > 0 && /* @__PURE__ */ jsx13(ParameterList4, {
22972
+ title: "Methods",
22973
+ className: "mt-6",
22974
+ children: methods.map((method, index) => /* @__PURE__ */ jsx13(APIParameterItem4, {
22975
+ name: `${method.name}()`,
22976
+ type: formatMethodSignature2(method),
22977
+ description: method.description
22978
+ }, method.name ?? index))
22979
+ })
22980
+ ]
22981
+ })
23449
22982
  });
23450
22983
  }
23451
22984
 
23452
22985
  // src/components/styled/VariablePage.tsx
23453
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
22986
+ import {
22987
+ APIParameterItem as APIParameterItem5,
22988
+ APISection as APISection5,
22989
+ ParameterList as ParameterList5
22990
+ } from "@doccov/ui/docskit";
22991
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
23454
22992
 
23455
22993
  function VariablePage({
23456
22994
  export: exp,
23457
- spec,
23458
- renderExample
22995
+ spec
23459
22996
  }) {
23460
22997
  const typeValue = typeof exp.type === "string" ? exp.type : formatSchema(exp.schema);
23461
- const hasExamples = exp.examples && exp.examples.length > 0;
23462
- const exampleCode = hasExamples ? typeof exp.examples[0] === "string" ? exp.examples[0] : exp.examples[0].code : "";
23463
- return /* @__PURE__ */ jsxs14("div", {
23464
- className: "space-y-8",
23465
- children: [
23466
- exp.description && /* @__PURE__ */ jsx15("p", {
23467
- className: "text-muted-foreground text-lg leading-relaxed",
23468
- children: exp.description
23469
- }),
23470
- /* @__PURE__ */ jsx15("div", {
23471
- className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
23472
- children: /* @__PURE__ */ jsxs14("code", {
23473
- className: "font-mono text-sm text-foreground whitespace-pre",
23474
- children: [
23475
- "const ",
23476
- exp.name,
23477
- ": ",
23478
- typeValue
23479
- ]
23480
- })
23481
- }),
23482
- exp.deprecated && /* @__PURE__ */ jsxs14("div", {
23483
- 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",
23484
- children: [
23485
- /* @__PURE__ */ jsx15("strong", {
23486
- children: "Deprecated:"
23487
- }),
23488
- " This export is deprecated."
23489
- ]
23490
- }),
23491
- /* @__PURE__ */ jsxs14("div", {
23492
- className: `grid gap-8 ${hasExamples ? "lg:grid-cols-2" : "grid-cols-1"}`,
22998
+ const languages = getLanguagesFromExamples(exp.examples);
22999
+ const examples = specExamplesToCodeExamples(exp.examples);
23000
+ const importStatement = buildImportStatement(exp, spec);
23001
+ const constValue = exp.schema && typeof exp.schema === "object" ? exp.schema.const : undefined;
23002
+ const displayExamples = examples.length > 0 ? examples : [{
23003
+ languageId: "typescript",
23004
+ code: `${importStatement}
23005
+
23006
+ console.log(${exp.name}); // ${constValue !== undefined ? JSON.stringify(constValue) : typeValue}`,
23007
+ highlightLang: "ts"
23008
+ }];
23009
+ const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
23010
+ return /* @__PURE__ */ jsx14("div", {
23011
+ className: "doccov-variable-page not-prose",
23012
+ children: /* @__PURE__ */ jsx14(APISection5, {
23013
+ id: exp.id || exp.name,
23014
+ title: `const ${exp.name}`,
23015
+ description: /* @__PURE__ */ jsxs13("div", {
23016
+ className: "space-y-3",
23493
23017
  children: [
23494
- /* @__PURE__ */ jsx15("div", {
23495
- className: "space-y-6",
23496
- children: /* @__PURE__ */ jsxs14("div", {
23497
- children: [
23498
- /* @__PURE__ */ jsx15("h3", {
23499
- className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3",
23500
- children: "Type"
23501
- }),
23502
- /* @__PURE__ */ jsx15("div", {
23503
- className: "rounded-lg border border-border bg-card p-4",
23504
- children: /* @__PURE__ */ jsx15("code", {
23505
- className: "font-mono text-sm text-primary",
23506
- children: typeValue
23507
- })
23508
- })
23509
- ]
23510
- })
23018
+ exp.description && /* @__PURE__ */ jsx14("p", {
23019
+ children: exp.description
23511
23020
  }),
23512
- hasExamples && /* @__PURE__ */ jsxs14("div", {
23021
+ exp.deprecated && /* @__PURE__ */ jsxs13("div", {
23022
+ 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",
23513
23023
  children: [
23514
- /* @__PURE__ */ jsxs14("h3", {
23515
- className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3",
23516
- children: [
23517
- exp.name,
23518
- " usage"
23519
- ]
23024
+ /* @__PURE__ */ jsx14("strong", {
23025
+ children: "Deprecated:"
23520
23026
  }),
23521
- renderExample ? renderExample(exampleCode, `${exp.name.toLowerCase()}.ts`) : /* @__PURE__ */ jsx15("pre", {
23522
- className: "rounded-lg border border-border bg-muted/30 p-4 overflow-x-auto",
23523
- children: /* @__PURE__ */ jsx15("code", {
23524
- className: "font-mono text-sm text-foreground",
23525
- children: exampleCode
23526
- })
23527
- })
23027
+ " This export is deprecated."
23528
23028
  ]
23029
+ }),
23030
+ /* @__PURE__ */ jsx14("code", {
23031
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
23032
+ children: importStatement
23529
23033
  })
23530
23034
  ]
23035
+ }),
23036
+ languages: displayLanguages,
23037
+ examples: displayExamples,
23038
+ codePanelTitle: exp.name,
23039
+ children: /* @__PURE__ */ jsx14(ParameterList5, {
23040
+ title: "Type",
23041
+ children: /* @__PURE__ */ jsx14(APIParameterItem5, {
23042
+ name: exp.name,
23043
+ type: typeValue,
23044
+ description: constValue !== undefined ? `Value: ${JSON.stringify(constValue)}` : undefined
23045
+ })
23531
23046
  })
23532
- ]
23047
+ })
23533
23048
  });
23534
23049
  }
23535
23050
 
23536
23051
  // src/components/styled/APIPage.tsx
23537
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
23052
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
23538
23053
 
23539
23054
  function NotFound({ id }) {
23540
- return /* @__PURE__ */ jsx16("div", {
23055
+ return /* @__PURE__ */ jsx15("div", {
23541
23056
  className: "rounded-lg border border-border bg-card p-6 text-center",
23542
- children: /* @__PURE__ */ jsxs15("p", {
23057
+ children: /* @__PURE__ */ jsxs14("p", {
23543
23058
  className: "text-muted-foreground",
23544
23059
  children: [
23545
23060
  "Export ",
23546
- /* @__PURE__ */ jsx16("code", {
23061
+ /* @__PURE__ */ jsx15("code", {
23547
23062
  className: "font-mono text-primary",
23548
23063
  children: id
23549
23064
  }),
@@ -23553,17 +23068,17 @@ function NotFound({ id }) {
23553
23068
  });
23554
23069
  }
23555
23070
  function NoSpec() {
23556
- return /* @__PURE__ */ jsx16("div", {
23071
+ return /* @__PURE__ */ jsx15("div", {
23557
23072
  className: "rounded-lg border border-red-500/20 bg-red-500/10 p-6 text-center",
23558
- children: /* @__PURE__ */ jsxs15("p", {
23073
+ children: /* @__PURE__ */ jsxs14("p", {
23559
23074
  className: "text-red-600 dark:text-red-400",
23560
23075
  children: [
23561
23076
  "No spec provided. Pass either ",
23562
- /* @__PURE__ */ jsx16("code", {
23077
+ /* @__PURE__ */ jsx15("code", {
23563
23078
  children: "spec"
23564
23079
  }),
23565
23080
  " or ",
23566
- /* @__PURE__ */ jsx16("code", {
23081
+ /* @__PURE__ */ jsx15("code", {
23567
23082
  children: "instance"
23568
23083
  }),
23569
23084
  " prop."
@@ -23581,10 +23096,10 @@ function APIPage({
23581
23096
  }) {
23582
23097
  const resolvedSpec = spec ?? instance?.spec;
23583
23098
  if (!resolvedSpec) {
23584
- return /* @__PURE__ */ jsx16(NoSpec, {});
23099
+ return /* @__PURE__ */ jsx15(NoSpec, {});
23585
23100
  }
23586
23101
  if (!id) {
23587
- return /* @__PURE__ */ jsx16(ExportIndexPage, {
23102
+ return /* @__PURE__ */ jsx15(ExportIndexPage, {
23588
23103
  spec: resolvedSpec,
23589
23104
  baseHref,
23590
23105
  description
@@ -23592,35 +23107,232 @@ function APIPage({
23592
23107
  }
23593
23108
  const exp = resolvedSpec.exports.find((e) => e.id === id);
23594
23109
  if (!exp) {
23595
- return /* @__PURE__ */ jsx16(NotFound, {
23110
+ return /* @__PURE__ */ jsx15(NotFound, {
23596
23111
  id
23597
23112
  });
23598
23113
  }
23599
23114
  const pageProps = { export: exp, spec: resolvedSpec, renderExample };
23600
23115
  switch (exp.kind) {
23601
23116
  case "function":
23602
- return /* @__PURE__ */ jsx16(FunctionPage, {
23117
+ return /* @__PURE__ */ jsx15(FunctionPage, {
23603
23118
  ...pageProps
23604
23119
  });
23605
23120
  case "class":
23606
- return /* @__PURE__ */ jsx16(ClassPage, {
23121
+ return /* @__PURE__ */ jsx15(ClassPage, {
23607
23122
  ...pageProps
23608
23123
  });
23609
23124
  case "interface":
23610
23125
  case "type":
23611
- return /* @__PURE__ */ jsx16(InterfacePage, {
23126
+ return /* @__PURE__ */ jsx15(InterfacePage, {
23612
23127
  ...pageProps
23613
23128
  });
23614
23129
  case "enum":
23615
- return /* @__PURE__ */ jsx16(EnumPage, {
23130
+ return /* @__PURE__ */ jsx15(EnumPage, {
23616
23131
  ...pageProps
23617
23132
  });
23618
23133
  default:
23619
- return /* @__PURE__ */ jsx16(VariablePage, {
23134
+ return /* @__PURE__ */ jsx15(VariablePage, {
23620
23135
  ...pageProps
23621
23136
  });
23622
23137
  }
23623
23138
  }
23139
+ // src/components/styled/ParameterItem.tsx
23140
+ import { cn as cn3 } from "@doccov/ui/lib/utils";
23141
+ import { useState as useState5 } from "react";
23142
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
23143
+
23144
+ function getNestedProperties2(schema) {
23145
+ if (!schema || typeof schema !== "object")
23146
+ return null;
23147
+ const s = schema;
23148
+ if (s.type === "object" && s.properties && typeof s.properties === "object") {
23149
+ return s.properties;
23150
+ }
23151
+ return null;
23152
+ }
23153
+ function getRequiredFields2(schema) {
23154
+ if (!schema || typeof schema !== "object")
23155
+ return [];
23156
+ const s = schema;
23157
+ if (Array.isArray(s.required)) {
23158
+ return s.required;
23159
+ }
23160
+ return [];
23161
+ }
23162
+ function countProperties2(schema) {
23163
+ const props = getNestedProperties2(schema);
23164
+ return props ? Object.keys(props).length : 0;
23165
+ }
23166
+ function NestedPropertyItem({
23167
+ name,
23168
+ schema,
23169
+ required = false,
23170
+ depth = 0
23171
+ }) {
23172
+ const [expanded, setExpanded] = useState5(false);
23173
+ const type = formatSchema(schema);
23174
+ const nestedProps = getNestedProperties2(schema);
23175
+ const nestedCount = countProperties2(schema);
23176
+ const hasNested = nestedCount > 0;
23177
+ const schemaObj = schema;
23178
+ const description = schemaObj?.description;
23179
+ return /* @__PURE__ */ jsxs15("div", {
23180
+ className: cn3("border-t border-border first:border-t-0", depth > 0 && "ml-4"),
23181
+ children: [
23182
+ /* @__PURE__ */ jsx16("div", {
23183
+ className: "py-3",
23184
+ children: /* @__PURE__ */ jsxs15("div", {
23185
+ className: "flex items-start gap-2",
23186
+ children: [
23187
+ hasNested && /* @__PURE__ */ jsx16("button", {
23188
+ type: "button",
23189
+ onClick: () => setExpanded(!expanded),
23190
+ className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
23191
+ "aria-label": expanded ? "Collapse" : "Expand",
23192
+ children: /* @__PURE__ */ jsx16(ChevronRight, {
23193
+ size: 14,
23194
+ className: cn3("transition-transform duration-200", expanded && "rotate-90")
23195
+ })
23196
+ }),
23197
+ !hasNested && /* @__PURE__ */ jsx16("div", {
23198
+ className: "w-5"
23199
+ }),
23200
+ /* @__PURE__ */ jsxs15("div", {
23201
+ className: "flex-1 min-w-0",
23202
+ children: [
23203
+ /* @__PURE__ */ jsxs15("div", {
23204
+ className: "flex items-baseline gap-2 flex-wrap",
23205
+ children: [
23206
+ /* @__PURE__ */ jsxs15("span", {
23207
+ className: "font-mono text-sm text-foreground",
23208
+ children: [
23209
+ name,
23210
+ !required && /* @__PURE__ */ jsx16("span", {
23211
+ className: "text-muted-foreground",
23212
+ children: "?"
23213
+ })
23214
+ ]
23215
+ }),
23216
+ /* @__PURE__ */ jsx16("span", {
23217
+ className: "font-mono text-sm text-muted-foreground",
23218
+ children: hasNested ? "object" : type
23219
+ }),
23220
+ hasNested && /* @__PURE__ */ jsxs15("button", {
23221
+ type: "button",
23222
+ onClick: () => setExpanded(!expanded),
23223
+ className: "text-xs text-primary hover:underline cursor-pointer",
23224
+ children: [
23225
+ nestedCount,
23226
+ " ",
23227
+ nestedCount === 1 ? "property" : "properties"
23228
+ ]
23229
+ })
23230
+ ]
23231
+ }),
23232
+ description && /* @__PURE__ */ jsx16("p", {
23233
+ className: "text-sm text-muted-foreground mt-1",
23234
+ children: description
23235
+ })
23236
+ ]
23237
+ })
23238
+ ]
23239
+ })
23240
+ }),
23241
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsx16("div", {
23242
+ className: "border-l border-border ml-2",
23243
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx16(NestedPropertyItem, {
23244
+ name: propName,
23245
+ schema: propSchema,
23246
+ required: getRequiredFields2(schema).includes(propName),
23247
+ depth: depth + 1
23248
+ }, propName))
23249
+ })
23250
+ ]
23251
+ });
23252
+ }
23253
+ function ParameterItem({
23254
+ param,
23255
+ depth = 0,
23256
+ className
23257
+ }) {
23258
+ const [expanded, setExpanded] = useState5(false);
23259
+ const type = formatSchema(param.schema);
23260
+ const isRequired = param.required !== false;
23261
+ const nestedProps = getNestedProperties2(param.schema);
23262
+ const nestedCount = countProperties2(param.schema);
23263
+ const hasNested = nestedCount > 0;
23264
+ return /* @__PURE__ */ jsxs15("div", {
23265
+ className: cn3("border-b border-border last:border-b-0", className),
23266
+ children: [
23267
+ /* @__PURE__ */ jsx16("div", {
23268
+ className: "py-3",
23269
+ children: /* @__PURE__ */ jsxs15("div", {
23270
+ className: "flex items-start gap-2",
23271
+ children: [
23272
+ hasNested && /* @__PURE__ */ jsx16("button", {
23273
+ type: "button",
23274
+ onClick: () => setExpanded(!expanded),
23275
+ className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
23276
+ "aria-label": expanded ? "Collapse" : "Expand",
23277
+ children: /* @__PURE__ */ jsx16(ChevronRight, {
23278
+ size: 14,
23279
+ className: cn3("transition-transform duration-200", expanded && "rotate-90")
23280
+ })
23281
+ }),
23282
+ !hasNested && /* @__PURE__ */ jsx16("div", {
23283
+ className: "w-5"
23284
+ }),
23285
+ /* @__PURE__ */ jsxs15("div", {
23286
+ className: "flex-1 min-w-0",
23287
+ children: [
23288
+ /* @__PURE__ */ jsxs15("div", {
23289
+ className: "flex items-baseline gap-2 flex-wrap",
23290
+ children: [
23291
+ /* @__PURE__ */ jsx16("span", {
23292
+ className: "font-mono text-sm font-medium text-foreground",
23293
+ children: param.name
23294
+ }),
23295
+ isRequired && /* @__PURE__ */ jsx16("span", {
23296
+ className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-border bg-muted text-muted-foreground uppercase tracking-wide",
23297
+ children: "Required"
23298
+ }),
23299
+ /* @__PURE__ */ jsx16("span", {
23300
+ className: "font-mono text-sm text-muted-foreground",
23301
+ children: hasNested ? "object" : type
23302
+ }),
23303
+ hasNested && /* @__PURE__ */ jsxs15("button", {
23304
+ type: "button",
23305
+ onClick: () => setExpanded(!expanded),
23306
+ className: "text-xs text-primary hover:underline cursor-pointer",
23307
+ children: [
23308
+ nestedCount,
23309
+ " ",
23310
+ nestedCount === 1 ? "property" : "properties"
23311
+ ]
23312
+ })
23313
+ ]
23314
+ }),
23315
+ param.description && /* @__PURE__ */ jsx16("p", {
23316
+ className: "text-sm text-muted-foreground mt-1",
23317
+ children: param.description
23318
+ })
23319
+ ]
23320
+ })
23321
+ ]
23322
+ })
23323
+ }),
23324
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsx16("div", {
23325
+ className: "border-l border-border ml-2 mb-3",
23326
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx16(NestedPropertyItem, {
23327
+ name: propName,
23328
+ schema: propSchema,
23329
+ required: getRequiredFields2(param.schema).includes(propName),
23330
+ depth: depth + 1
23331
+ }, propName))
23332
+ })
23333
+ ]
23334
+ });
23335
+ }
23624
23336
  export {
23625
23337
  groupMembersByKind,
23626
23338
  getExampleTitle,
@@ -23637,7 +23349,7 @@ export {
23637
23349
  MembersTable,
23638
23350
  MemberRow,
23639
23351
  InterfacePage,
23640
- ImportSection4 as ImportSection,
23352
+ ImportSection,
23641
23353
  FunctionPage,
23642
23354
  ExportIndexPage,
23643
23355
  ExportCard,
@@ -23645,7 +23357,7 @@ export {
23645
23357
  ExampleBlock,
23646
23358
  EnumPage,
23647
23359
  CollapsibleMethod,
23648
- CodeTabs4 as CodeTabs,
23360
+ CodeTabs,
23649
23361
  ClassPage,
23650
23362
  APIPage
23651
23363
  };