@openpkg-ts/doc-generator 0.5.0 → 0.6.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.
@@ -4195,7 +4195,7 @@ function TypeTable({
4195
4195
  // src/components/styled/index.ts
4196
4196
  import { CodeTabs, ImportSection } from "@doccov/ui/api";
4197
4197
 
4198
- // src/components/styled/ClassPage.tsx
4198
+ // src/components/styled/sections/ClassSection.tsx
4199
4199
  import {
4200
4200
  APIParameterItem,
4201
4201
  APISection,
@@ -4328,7 +4328,7 @@ function buildImportStatement(exp, spec) {
4328
4328
  return `import { ${alias} } from '${importPath}'`;
4329
4329
  }
4330
4330
 
4331
- // src/components/styled/ClassPage.tsx
4331
+ // src/components/styled/sections/ClassSection.tsx
4332
4332
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
4333
4333
 
4334
4334
  function formatMethodSignature(member) {
@@ -4352,7 +4352,7 @@ function getMemberBadges(member) {
4352
4352
  badges.push("async");
4353
4353
  return badges;
4354
4354
  }
4355
- function ClassPage({ export: exp, spec }) {
4355
+ function ClassSection({ export: exp, spec }) {
4356
4356
  const constructors = exp.members?.filter((m) => m.kind === "constructor") ?? [];
4357
4357
  const properties = exp.members?.filter((m) => m.kind === "property" || m.kind === "field") ?? [];
4358
4358
  const methods = exp.members?.filter((m) => m.kind === "method") ?? [];
@@ -4377,104 +4377,114 @@ const instance = new ${exp.name}(${constructorParams.map((p) => p.name).join(",
4377
4377
  exp.extends && `extends ${exp.extends}`,
4378
4378
  exp.implements?.length && `implements ${exp.implements.join(", ")}`
4379
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}()`,
4380
+ return /* @__PURE__ */ jsxs7(APISection, {
4381
+ id: exp.id || exp.name,
4382
+ title: `class ${exp.name}`,
4383
+ description: /* @__PURE__ */ jsxs7("div", {
4384
+ className: "space-y-3",
4404
4385
  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
- })
4386
+ inheritance && /* @__PURE__ */ jsx8("p", {
4387
+ className: "font-mono text-sm text-muted-foreground",
4388
+ children: inheritance
4417
4389
  }),
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
- ]
4390
+ exp.description && /* @__PURE__ */ jsx8("p", {
4391
+ children: exp.description
4439
4392
  }),
4440
- instanceMethods.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4441
- title: "Methods",
4442
- className: "mt-6",
4443
- children: instanceMethods.map((member) => {
4393
+ /* @__PURE__ */ jsx8("code", {
4394
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
4395
+ children: importStatement
4396
+ })
4397
+ ]
4398
+ }),
4399
+ languages: displayLanguages,
4400
+ examples: displayExamples,
4401
+ codePanelTitle: `new ${exp.name}()`,
4402
+ children: [
4403
+ constructorParams.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4404
+ title: "Constructor",
4405
+ children: constructorParams.map((param, index) => {
4406
+ const apiParam = specParamToAPIParam(param);
4407
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4408
+ name: apiParam.name,
4409
+ type: apiParam.type,
4410
+ required: apiParam.required,
4411
+ description: apiParam.description,
4412
+ children: apiParam.children
4413
+ }, param.name ?? index);
4414
+ })
4415
+ }),
4416
+ (staticProperties.length > 0 || staticMethods.length > 0) && /* @__PURE__ */ jsxs7(ParameterList, {
4417
+ title: "Static Members",
4418
+ className: "mt-6",
4419
+ children: [
4420
+ staticProperties.map((member) => {
4444
4421
  const badges = getMemberBadges(member);
4445
4422
  return /* @__PURE__ */ jsx8(APIParameterItem, {
4446
- name: `${member.name}()`,
4447
- type: formatMethodSignature(member),
4423
+ name: member.name,
4424
+ type: formatSchema(member.schema),
4448
4425
  description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4449
4426
  }, member.name);
4450
- })
4451
- }),
4452
- instanceProperties.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4453
- title: "Properties",
4454
- className: "mt-6",
4455
- children: instanceProperties.map((member) => {
4427
+ }),
4428
+ staticMethods.map((member) => {
4456
4429
  const badges = getMemberBadges(member);
4457
4430
  return /* @__PURE__ */ jsx8(APIParameterItem, {
4458
- name: member.name,
4459
- type: formatSchema(member.schema),
4431
+ name: `${member.name}()`,
4432
+ type: formatMethodSignature(member),
4460
4433
  description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4461
4434
  }, member.name);
4462
4435
  })
4436
+ ]
4437
+ }),
4438
+ instanceMethods.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4439
+ title: "Methods",
4440
+ className: "mt-6",
4441
+ children: instanceMethods.map((member) => {
4442
+ const badges = getMemberBadges(member);
4443
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4444
+ name: `${member.name}()`,
4445
+ type: formatMethodSignature(member),
4446
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4447
+ }, member.name);
4463
4448
  })
4464
- ]
4449
+ }),
4450
+ instanceProperties.length > 0 && /* @__PURE__ */ jsx8(ParameterList, {
4451
+ title: "Properties",
4452
+ className: "mt-6",
4453
+ children: instanceProperties.map((member) => {
4454
+ const badges = getMemberBadges(member);
4455
+ return /* @__PURE__ */ jsx8(APIParameterItem, {
4456
+ name: member.name,
4457
+ type: formatSchema(member.schema),
4458
+ description: badges.length > 0 ? `[${badges.join(", ")}] ${member.description || ""}` : member.description
4459
+ }, member.name);
4460
+ })
4461
+ })
4462
+ ]
4463
+ });
4464
+ }
4465
+
4466
+ // src/components/styled/ClassPage.tsx
4467
+ import { jsx as jsx9 } from "react/jsx-runtime";
4468
+
4469
+ function ClassPage({ export: exp, spec }) {
4470
+ return /* @__PURE__ */ jsx9("div", {
4471
+ className: "doccov-class-page not-prose",
4472
+ children: /* @__PURE__ */ jsx9(ClassSection, {
4473
+ export: exp,
4474
+ spec
4465
4475
  })
4466
4476
  });
4467
4477
  }
4468
4478
 
4469
- // src/components/styled/EnumPage.tsx
4479
+ // src/components/styled/sections/EnumSection.tsx
4470
4480
  import {
4471
4481
  APIParameterItem as APIParameterItem2,
4472
4482
  APISection as APISection2,
4473
4483
  ParameterList as ParameterList2
4474
4484
  } from "@doccov/ui/docskit";
4475
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
4485
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
4476
4486
 
4477
- function EnumPage({ export: exp, spec }) {
4487
+ function EnumSection({ export: exp, spec }) {
4478
4488
  const members = exp.members ?? [];
4479
4489
  const languages = getLanguagesFromExamples(exp.examples);
4480
4490
  const examples = specExamplesToCodeExamples(exp.examples);
@@ -4494,50 +4504,60 @@ ${enumDefinition}`,
4494
4504
  highlightLang: "ts"
4495
4505
  }];
4496
4506
  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);
4507
+ return /* @__PURE__ */ jsx10(APISection2, {
4508
+ id: exp.id || exp.name,
4509
+ title: `enum ${exp.name}`,
4510
+ description: /* @__PURE__ */ jsxs8("div", {
4511
+ className: "space-y-3",
4512
+ children: [
4513
+ exp.description && /* @__PURE__ */ jsx10("p", {
4514
+ children: exp.description
4515
+ }),
4516
+ exp.deprecated && /* @__PURE__ */ jsxs8("div", {
4517
+ 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",
4518
+ children: [
4519
+ /* @__PURE__ */ jsx10("strong", {
4520
+ children: "Deprecated:"
4521
+ }),
4522
+ " This export is deprecated."
4523
+ ]
4524
+ }),
4525
+ /* @__PURE__ */ jsx10("code", {
4526
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
4527
+ children: importStatement
4535
4528
  })
4529
+ ]
4530
+ }),
4531
+ languages: displayLanguages,
4532
+ examples: displayExamples,
4533
+ codePanelTitle: exp.name,
4534
+ children: members.length > 0 && /* @__PURE__ */ jsx10(ParameterList2, {
4535
+ title: "Members",
4536
+ children: members.map((member, index) => {
4537
+ const value = member.schema !== undefined ? typeof member.schema === "object" && member.schema !== null ? member.schema.const ?? member.schema.default ?? undefined : member.schema : undefined;
4538
+ return /* @__PURE__ */ jsx10(APIParameterItem2, {
4539
+ name: member.name,
4540
+ type: value !== undefined ? String(value) : "auto",
4541
+ description: member.description
4542
+ }, member.name ?? index);
4536
4543
  })
4537
4544
  })
4538
4545
  });
4539
4546
  }
4540
4547
 
4548
+ // src/components/styled/EnumPage.tsx
4549
+ import { jsx as jsx11 } from "react/jsx-runtime";
4550
+
4551
+ function EnumPage({ export: exp, spec }) {
4552
+ return /* @__PURE__ */ jsx11("div", {
4553
+ className: "doccov-enum-page not-prose",
4554
+ children: /* @__PURE__ */ jsx11(EnumSection, {
4555
+ export: exp,
4556
+ spec
4557
+ })
4558
+ });
4559
+ }
4560
+
4541
4561
  // src/components/styled/ExportIndexPage.tsx
4542
4562
  import { cn as cn2 } from "@doccov/ui/lib/utils";
4543
4563
 
@@ -22578,7 +22598,7 @@ import { useState as useState4, useMemo } from "react";
22578
22598
  // src/components/styled/ExportCard.tsx
22579
22599
  var import_link3 = __toESM(require_link(), 1);
22580
22600
  import { cn } from "@doccov/ui/lib/utils";
22581
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
22601
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
22582
22602
 
22583
22603
  var KIND_COLORS = {
22584
22604
  function: "group-hover:text-blue-600 dark:group-hover:text-blue-400",
@@ -22613,21 +22633,21 @@ function ExportCard({
22613
22633
  /* @__PURE__ */ jsxs9("div", {
22614
22634
  className: "flex items-center gap-2 mb-2",
22615
22635
  children: [
22616
- /* @__PURE__ */ jsx10("span", {
22636
+ /* @__PURE__ */ jsx12("span", {
22617
22637
  className: cn("font-mono text-base font-medium text-foreground transition-colors duration-200", hoverColor),
22618
22638
  children: name
22619
22639
  }),
22620
- isFunction && /* @__PURE__ */ jsx10("span", {
22640
+ isFunction && /* @__PURE__ */ jsx12("span", {
22621
22641
  className: "font-mono text-base text-muted-foreground",
22622
22642
  children: "()"
22623
22643
  }),
22624
- /* @__PURE__ */ jsx10("span", {
22644
+ /* @__PURE__ */ jsx12("span", {
22625
22645
  className: cn("ml-auto text-xs px-2 py-0.5 rounded-full font-medium", badgeColor),
22626
22646
  children: kind
22627
22647
  })
22628
22648
  ]
22629
22649
  }),
22630
- description && /* @__PURE__ */ jsx10("p", {
22650
+ description && /* @__PURE__ */ jsx12("p", {
22631
22651
  className: "text-sm text-muted-foreground line-clamp-2 leading-relaxed group-hover:text-muted-foreground/80 transition-colors",
22632
22652
  children: description
22633
22653
  })
@@ -22636,7 +22656,7 @@ function ExportCard({
22636
22656
  }
22637
22657
 
22638
22658
  // src/components/styled/ExportIndexPage.tsx
22639
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
22659
+ import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
22640
22660
 
22641
22661
  var KIND_ORDER = ["function", "class", "interface", "type", "enum", "variable"];
22642
22662
  var KIND_LABELS = {
@@ -22692,11 +22712,11 @@ function ExportIndexPage({
22692
22712
  children: [
22693
22713
  /* @__PURE__ */ jsxs10("div", {
22694
22714
  children: [
22695
- /* @__PURE__ */ jsx11("h1", {
22715
+ /* @__PURE__ */ jsx13("h1", {
22696
22716
  className: "text-3xl font-bold text-foreground mb-3",
22697
22717
  children: spec.meta.name || "API Reference"
22698
22718
  }),
22699
- (description || spec.meta.description) && /* @__PURE__ */ jsx11("p", {
22719
+ (description || spec.meta.description) && /* @__PURE__ */ jsx13("p", {
22700
22720
  className: "text-muted-foreground text-lg leading-relaxed max-w-3xl",
22701
22721
  children: description || spec.meta.description
22702
22722
  })
@@ -22708,11 +22728,11 @@ function ExportIndexPage({
22708
22728
  showSearch && /* @__PURE__ */ jsxs10("div", {
22709
22729
  className: "relative max-w-md",
22710
22730
  children: [
22711
- /* @__PURE__ */ jsx11(Search, {
22731
+ /* @__PURE__ */ jsx13(Search, {
22712
22732
  size: 18,
22713
22733
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
22714
22734
  }),
22715
- /* @__PURE__ */ jsx11("input", {
22735
+ /* @__PURE__ */ jsx13("input", {
22716
22736
  type: "text",
22717
22737
  placeholder: "Search exports...",
22718
22738
  value: searchQuery,
@@ -22724,13 +22744,13 @@ function ExportIndexPage({
22724
22744
  showFilters && availableKinds.length > 1 && /* @__PURE__ */ jsxs10("div", {
22725
22745
  className: "flex flex-wrap gap-2",
22726
22746
  children: [
22727
- /* @__PURE__ */ jsx11("button", {
22747
+ /* @__PURE__ */ jsx13("button", {
22728
22748
  type: "button",
22729
22749
  onClick: () => setActiveFilter("all"),
22730
22750
  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"),
22731
22751
  children: "All"
22732
22752
  }),
22733
- availableKinds.map((kind) => /* @__PURE__ */ jsx11("button", {
22753
+ availableKinds.map((kind) => /* @__PURE__ */ jsx13("button", {
22734
22754
  type: "button",
22735
22755
  onClick: () => setActiveFilter(kind),
22736
22756
  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"),
@@ -22751,13 +22771,13 @@ function ExportIndexPage({
22751
22771
  }),
22752
22772
  filteredGroups.map((group) => /* @__PURE__ */ jsxs10("section", {
22753
22773
  children: [
22754
- /* @__PURE__ */ jsx11("h2", {
22774
+ /* @__PURE__ */ jsx13("h2", {
22755
22775
  className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-4",
22756
22776
  children: group.label
22757
22777
  }),
22758
- /* @__PURE__ */ jsx11("div", {
22778
+ /* @__PURE__ */ jsx13("div", {
22759
22779
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
22760
- children: group.exports.map((exp) => /* @__PURE__ */ jsx11(ExportCard, {
22780
+ children: group.exports.map((exp) => /* @__PURE__ */ jsx13(ExportCard, {
22761
22781
  name: exp.name,
22762
22782
  description: exp.description,
22763
22783
  href: `${baseHref}/${group.kind}s/${exp.id}`,
@@ -22769,11 +22789,11 @@ function ExportIndexPage({
22769
22789
  filteredGroups.length === 0 && /* @__PURE__ */ jsxs10("div", {
22770
22790
  className: "rounded-lg border border-border bg-card/50 p-8 text-center",
22771
22791
  children: [
22772
- /* @__PURE__ */ jsx11("p", {
22792
+ /* @__PURE__ */ jsx13("p", {
22773
22793
  className: "text-muted-foreground",
22774
22794
  children: searchQuery || activeFilter !== "all" ? "No exports match your search." : "No exports found in this package."
22775
22795
  }),
22776
- (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsx11("button", {
22796
+ (searchQuery || activeFilter !== "all") && /* @__PURE__ */ jsx13("button", {
22777
22797
  type: "button",
22778
22798
  onClick: () => {
22779
22799
  setSearchQuery("");
@@ -22788,22 +22808,21 @@ function ExportIndexPage({
22788
22808
  });
22789
22809
  }
22790
22810
 
22791
- // src/components/styled/FunctionPage.tsx
22811
+ // src/components/styled/sections/FunctionSection.tsx
22792
22812
  import {
22793
22813
  APIParameterItem as APIParameterItem3,
22794
22814
  APISection as APISection3,
22795
22815
  ParameterList as ParameterList3,
22796
22816
  ResponseBlock
22797
22817
  } from "@doccov/ui/docskit";
22798
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
22818
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
22799
22819
 
22800
- function FunctionPage({
22820
+ function FunctionSection({
22801
22821
  export: exp,
22802
22822
  spec
22803
22823
  }) {
22804
22824
  const sig = exp.signatures?.[0];
22805
22825
  const hasParams = sig?.parameters && sig.parameters.length > 0;
22806
- const hasExamples = exp.examples && exp.examples.length > 0;
22807
22826
  const languages = getLanguagesFromExamples(exp.examples);
22808
22827
  const examples = specExamplesToCodeExamples(exp.examples);
22809
22828
  const importStatement = buildImportStatement(exp, spec);
@@ -22816,76 +22835,89 @@ ${exp.name}(${sig?.parameters?.map((p) => p.name).join(", ") || ""})`,
22816
22835
  highlightLang: "ts"
22817
22836
  }];
22818
22837
  const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
22819
- return /* @__PURE__ */ jsx12("div", {
22820
- className: "doccov-function-page not-prose",
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",
22826
- children: [
22827
- exp.description && /* @__PURE__ */ jsx12("p", {
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
22833
- })
22834
- ]
22835
- }),
22836
- languages: displayLanguages,
22837
- examples: displayExamples,
22838
- codePanelTitle: `${exp.name}()`,
22838
+ return /* @__PURE__ */ jsxs11(APISection3, {
22839
+ id: exp.id || exp.name,
22840
+ title: `${exp.name}()`,
22841
+ description: /* @__PURE__ */ jsxs11("div", {
22842
+ className: "space-y-3",
22839
22843
  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", {
22855
- children: [
22856
- /* @__PURE__ */ jsx12("span", {
22857
- className: "font-mono text-sm font-medium",
22858
- children: formatSchema(sig.returns.schema)
22859
- }),
22860
- sig.returns.description && /* @__PURE__ */ jsx12("span", {
22861
- className: "ml-2 text-muted-foreground",
22862
- children: sig.returns.description
22863
- })
22864
- ]
22865
- }),
22866
- className: "mt-6"
22844
+ exp.description && /* @__PURE__ */ jsx14("p", {
22845
+ children: exp.description
22867
22846
  }),
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))
22847
+ /* @__PURE__ */ jsx14("code", {
22848
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
22849
+ children: importStatement
22876
22850
  })
22877
22851
  ]
22852
+ }),
22853
+ languages: displayLanguages,
22854
+ examples: displayExamples,
22855
+ codePanelTitle: `${exp.name}()`,
22856
+ children: [
22857
+ hasParams && /* @__PURE__ */ jsx14(ParameterList3, {
22858
+ title: "Parameters",
22859
+ children: sig.parameters.map((param, index) => {
22860
+ const apiParam = specParamToAPIParam(param);
22861
+ return /* @__PURE__ */ jsx14(APIParameterItem3, {
22862
+ name: apiParam.name,
22863
+ type: apiParam.type,
22864
+ required: apiParam.required,
22865
+ description: apiParam.description,
22866
+ children: apiParam.children
22867
+ }, param.name ?? index);
22868
+ })
22869
+ }),
22870
+ sig?.returns && /* @__PURE__ */ jsx14(ResponseBlock, {
22871
+ description: /* @__PURE__ */ jsxs11("span", {
22872
+ children: [
22873
+ /* @__PURE__ */ jsx14("span", {
22874
+ className: "font-mono text-sm font-medium",
22875
+ children: formatSchema(sig.returns.schema)
22876
+ }),
22877
+ sig.returns.description && /* @__PURE__ */ jsx14("span", {
22878
+ className: "ml-2 text-muted-foreground",
22879
+ children: sig.returns.description
22880
+ })
22881
+ ]
22882
+ }),
22883
+ className: "mt-6"
22884
+ }),
22885
+ exp.typeParameters && exp.typeParameters.length > 0 && /* @__PURE__ */ jsx14(ParameterList3, {
22886
+ title: "Type Parameters",
22887
+ className: "mt-6",
22888
+ children: exp.typeParameters.map((tp) => /* @__PURE__ */ jsx14(APIParameterItem3, {
22889
+ name: tp.name,
22890
+ type: tp.constraint || "unknown",
22891
+ description: tp.default ? `Default: ${tp.default}` : undefined
22892
+ }, tp.name))
22893
+ })
22894
+ ]
22895
+ });
22896
+ }
22897
+
22898
+ // src/components/styled/FunctionPage.tsx
22899
+ import { jsx as jsx15 } from "react/jsx-runtime";
22900
+
22901
+ function FunctionPage({
22902
+ export: exp,
22903
+ spec
22904
+ }) {
22905
+ return /* @__PURE__ */ jsx15("div", {
22906
+ className: "doccov-function-page not-prose",
22907
+ children: /* @__PURE__ */ jsx15(FunctionSection, {
22908
+ export: exp,
22909
+ spec
22878
22910
  })
22879
22911
  });
22880
22912
  }
22881
22913
 
22882
- // src/components/styled/InterfacePage.tsx
22914
+ // src/components/styled/sections/InterfaceSection.tsx
22883
22915
  import {
22884
22916
  APIParameterItem as APIParameterItem4,
22885
22917
  APISection as APISection4,
22886
22918
  ParameterList as ParameterList4
22887
22919
  } from "@doccov/ui/docskit";
22888
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
22920
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
22889
22921
 
22890
22922
  function formatMethodSignature2(member) {
22891
22923
  const sig = member.signatures?.[0];
@@ -22894,7 +22926,7 @@ function formatMethodSignature2(member) {
22894
22926
  const paramStr = params.map((p) => `${p.name}${p.required === false ? "?" : ""}: ${formatSchema(p.schema)}`).join(", ");
22895
22927
  return `(${paramStr}): ${returnType}`;
22896
22928
  }
22897
- function InterfacePage({
22929
+ function InterfaceSection({
22898
22930
  export: exp,
22899
22931
  spec
22900
22932
  }) {
@@ -22916,81 +22948,94 @@ ${typeDefinition}`,
22916
22948
  }];
22917
22949
  const displayLanguages = languages.length > 0 ? languages : [{ id: "typescript", label: "TypeScript" }];
22918
22950
  const kindLabel = exp.kind === "type" ? "type" : "interface";
22919
- return /* @__PURE__ */ jsx13("div", {
22920
- className: "doccov-interface-page not-prose",
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",
22926
- children: [
22927
- exp.extends && /* @__PURE__ */ jsxs12("p", {
22928
- className: "font-mono text-sm text-muted-foreground",
22929
- children: [
22930
- "extends ",
22931
- exp.extends
22932
- ]
22933
- }),
22934
- exp.description && /* @__PURE__ */ jsx13("p", {
22935
- children: exp.description
22936
- }),
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",
22939
- children: [
22940
- /* @__PURE__ */ jsx13("strong", {
22941
- children: "Deprecated:"
22942
- }),
22943
- " This export is deprecated."
22944
- ]
22945
- }),
22946
- /* @__PURE__ */ jsx13("code", {
22947
- className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
22948
- children: importStatement
22949
- })
22950
- ]
22951
- }),
22952
- languages: displayLanguages,
22953
- examples: displayExamples,
22954
- codePanelTitle: exp.name,
22951
+ return /* @__PURE__ */ jsxs12(APISection4, {
22952
+ id: exp.id || exp.name,
22953
+ title: `${kindLabel} ${exp.name}`,
22954
+ description: /* @__PURE__ */ jsxs12("div", {
22955
+ className: "space-y-3",
22955
22956
  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);
22969
- })
22957
+ exp.extends && /* @__PURE__ */ jsxs12("p", {
22958
+ className: "font-mono text-sm text-muted-foreground",
22959
+ children: [
22960
+ "extends ",
22961
+ exp.extends
22962
+ ]
22963
+ }),
22964
+ exp.description && /* @__PURE__ */ jsx16("p", {
22965
+ children: exp.description
22970
22966
  }),
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))
22967
+ exp.deprecated && /* @__PURE__ */ jsxs12("div", {
22968
+ 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",
22969
+ children: [
22970
+ /* @__PURE__ */ jsx16("strong", {
22971
+ children: "Deprecated:"
22972
+ }),
22973
+ " This export is deprecated."
22974
+ ]
22975
+ }),
22976
+ /* @__PURE__ */ jsx16("code", {
22977
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
22978
+ children: importStatement
22979
22979
  })
22980
22980
  ]
22981
+ }),
22982
+ languages: displayLanguages,
22983
+ examples: displayExamples,
22984
+ codePanelTitle: exp.name,
22985
+ children: [
22986
+ properties.length > 0 && /* @__PURE__ */ jsx16(ParameterList4, {
22987
+ title: "Properties",
22988
+ children: properties.map((prop, index) => {
22989
+ const type = formatSchema(prop.schema);
22990
+ const children = specSchemaToAPISchema(prop.schema);
22991
+ const hasNestedProperties = children?.properties && Object.keys(children.properties).length > 0;
22992
+ return /* @__PURE__ */ jsx16(APIParameterItem4, {
22993
+ name: prop.name,
22994
+ type,
22995
+ required: prop.required !== false,
22996
+ description: prop.description,
22997
+ children: hasNestedProperties ? children : undefined
22998
+ }, prop.name ?? index);
22999
+ })
23000
+ }),
23001
+ methods.length > 0 && /* @__PURE__ */ jsx16(ParameterList4, {
23002
+ title: "Methods",
23003
+ className: "mt-6",
23004
+ children: methods.map((method, index) => /* @__PURE__ */ jsx16(APIParameterItem4, {
23005
+ name: `${method.name}()`,
23006
+ type: formatMethodSignature2(method),
23007
+ description: method.description
23008
+ }, method.name ?? index))
23009
+ })
23010
+ ]
23011
+ });
23012
+ }
23013
+
23014
+ // src/components/styled/InterfacePage.tsx
23015
+ import { jsx as jsx17 } from "react/jsx-runtime";
23016
+
23017
+ function InterfacePage({
23018
+ export: exp,
23019
+ spec
23020
+ }) {
23021
+ return /* @__PURE__ */ jsx17("div", {
23022
+ className: "doccov-interface-page not-prose",
23023
+ children: /* @__PURE__ */ jsx17(InterfaceSection, {
23024
+ export: exp,
23025
+ spec
22981
23026
  })
22982
23027
  });
22983
23028
  }
22984
23029
 
22985
- // src/components/styled/VariablePage.tsx
23030
+ // src/components/styled/sections/VariableSection.tsx
22986
23031
  import {
22987
23032
  APIParameterItem as APIParameterItem5,
22988
23033
  APISection as APISection5,
22989
23034
  ParameterList as ParameterList5
22990
23035
  } from "@doccov/ui/docskit";
22991
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
23036
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
22992
23037
 
22993
- function VariablePage({
23038
+ function VariableSection({
22994
23039
  export: exp,
22995
23040
  spec
22996
23041
  }) {
@@ -23007,58 +23052,71 @@ console.log(${exp.name}); // ${constValue !== undefined ? JSON.stringify(constVa
23007
23052
  highlightLang: "ts"
23008
23053
  }];
23009
23054
  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",
23017
- children: [
23018
- exp.description && /* @__PURE__ */ jsx14("p", {
23019
- children: exp.description
23020
- }),
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",
23023
- children: [
23024
- /* @__PURE__ */ jsx14("strong", {
23025
- children: "Deprecated:"
23026
- }),
23027
- " This export is deprecated."
23028
- ]
23029
- }),
23030
- /* @__PURE__ */ jsx14("code", {
23031
- className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
23032
- children: importStatement
23033
- })
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
23055
+ return /* @__PURE__ */ jsx18(APISection5, {
23056
+ id: exp.id || exp.name,
23057
+ title: `const ${exp.name}`,
23058
+ description: /* @__PURE__ */ jsxs13("div", {
23059
+ className: "space-y-3",
23060
+ children: [
23061
+ exp.description && /* @__PURE__ */ jsx18("p", {
23062
+ children: exp.description
23063
+ }),
23064
+ exp.deprecated && /* @__PURE__ */ jsxs13("div", {
23065
+ 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",
23066
+ children: [
23067
+ /* @__PURE__ */ jsx18("strong", {
23068
+ children: "Deprecated:"
23069
+ }),
23070
+ " This export is deprecated."
23071
+ ]
23072
+ }),
23073
+ /* @__PURE__ */ jsx18("code", {
23074
+ className: "text-sm font-mono bg-muted px-2 py-1 rounded inline-block",
23075
+ children: importStatement
23045
23076
  })
23077
+ ]
23078
+ }),
23079
+ languages: displayLanguages,
23080
+ examples: displayExamples,
23081
+ codePanelTitle: exp.name,
23082
+ children: /* @__PURE__ */ jsx18(ParameterList5, {
23083
+ title: "Type",
23084
+ children: /* @__PURE__ */ jsx18(APIParameterItem5, {
23085
+ name: exp.name,
23086
+ type: typeValue,
23087
+ description: constValue !== undefined ? `Value: ${JSON.stringify(constValue)}` : undefined
23046
23088
  })
23047
23089
  })
23048
23090
  });
23049
23091
  }
23050
23092
 
23093
+ // src/components/styled/VariablePage.tsx
23094
+ import { jsx as jsx19 } from "react/jsx-runtime";
23095
+
23096
+ function VariablePage({
23097
+ export: exp,
23098
+ spec
23099
+ }) {
23100
+ return /* @__PURE__ */ jsx19("div", {
23101
+ className: "doccov-variable-page not-prose",
23102
+ children: /* @__PURE__ */ jsx19(VariableSection, {
23103
+ export: exp,
23104
+ spec
23105
+ })
23106
+ });
23107
+ }
23108
+
23051
23109
  // src/components/styled/APIPage.tsx
23052
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
23110
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
23053
23111
 
23054
23112
  function NotFound({ id }) {
23055
- return /* @__PURE__ */ jsx15("div", {
23113
+ return /* @__PURE__ */ jsx20("div", {
23056
23114
  className: "rounded-lg border border-border bg-card p-6 text-center",
23057
23115
  children: /* @__PURE__ */ jsxs14("p", {
23058
23116
  className: "text-muted-foreground",
23059
23117
  children: [
23060
23118
  "Export ",
23061
- /* @__PURE__ */ jsx15("code", {
23119
+ /* @__PURE__ */ jsx20("code", {
23062
23120
  className: "font-mono text-primary",
23063
23121
  children: id
23064
23122
  }),
@@ -23068,17 +23126,17 @@ function NotFound({ id }) {
23068
23126
  });
23069
23127
  }
23070
23128
  function NoSpec() {
23071
- return /* @__PURE__ */ jsx15("div", {
23129
+ return /* @__PURE__ */ jsx20("div", {
23072
23130
  className: "rounded-lg border border-red-500/20 bg-red-500/10 p-6 text-center",
23073
23131
  children: /* @__PURE__ */ jsxs14("p", {
23074
23132
  className: "text-red-600 dark:text-red-400",
23075
23133
  children: [
23076
23134
  "No spec provided. Pass either ",
23077
- /* @__PURE__ */ jsx15("code", {
23135
+ /* @__PURE__ */ jsx20("code", {
23078
23136
  children: "spec"
23079
23137
  }),
23080
23138
  " or ",
23081
- /* @__PURE__ */ jsx15("code", {
23139
+ /* @__PURE__ */ jsx20("code", {
23082
23140
  children: "instance"
23083
23141
  }),
23084
23142
  " prop."
@@ -23096,10 +23154,10 @@ function APIPage({
23096
23154
  }) {
23097
23155
  const resolvedSpec = spec ?? instance?.spec;
23098
23156
  if (!resolvedSpec) {
23099
- return /* @__PURE__ */ jsx15(NoSpec, {});
23157
+ return /* @__PURE__ */ jsx20(NoSpec, {});
23100
23158
  }
23101
23159
  if (!id) {
23102
- return /* @__PURE__ */ jsx15(ExportIndexPage, {
23160
+ return /* @__PURE__ */ jsx20(ExportIndexPage, {
23103
23161
  spec: resolvedSpec,
23104
23162
  baseHref,
23105
23163
  description
@@ -23107,39 +23165,324 @@ function APIPage({
23107
23165
  }
23108
23166
  const exp = resolvedSpec.exports.find((e) => e.id === id);
23109
23167
  if (!exp) {
23110
- return /* @__PURE__ */ jsx15(NotFound, {
23168
+ return /* @__PURE__ */ jsx20(NotFound, {
23111
23169
  id
23112
23170
  });
23113
23171
  }
23114
23172
  const pageProps = { export: exp, spec: resolvedSpec, renderExample };
23115
23173
  switch (exp.kind) {
23116
23174
  case "function":
23117
- return /* @__PURE__ */ jsx15(FunctionPage, {
23175
+ return /* @__PURE__ */ jsx20(FunctionPage, {
23118
23176
  ...pageProps
23119
23177
  });
23120
23178
  case "class":
23121
- return /* @__PURE__ */ jsx15(ClassPage, {
23179
+ return /* @__PURE__ */ jsx20(ClassPage, {
23122
23180
  ...pageProps
23123
23181
  });
23124
23182
  case "interface":
23125
23183
  case "type":
23126
- return /* @__PURE__ */ jsx15(InterfacePage, {
23184
+ return /* @__PURE__ */ jsx20(InterfacePage, {
23127
23185
  ...pageProps
23128
23186
  });
23129
23187
  case "enum":
23130
- return /* @__PURE__ */ jsx15(EnumPage, {
23188
+ return /* @__PURE__ */ jsx20(EnumPage, {
23131
23189
  ...pageProps
23132
23190
  });
23133
23191
  default:
23134
- return /* @__PURE__ */ jsx15(VariablePage, {
23192
+ return /* @__PURE__ */ jsx20(VariablePage, {
23135
23193
  ...pageProps
23136
23194
  });
23137
23195
  }
23138
23196
  }
23139
- // src/components/styled/ParameterItem.tsx
23197
+ // src/components/styled/FullAPIReferencePage.tsx
23198
+ import { APIReferencePage } from "@doccov/ui/docskit";
23140
23199
  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";
23200
+ import { useState as useState5, useMemo as useMemo2, useEffect as useEffect2, useRef, useCallback } from "react";
23201
+
23202
+ // src/components/styled/sections/ExportSection.tsx
23203
+ import { jsx as jsx21 } from "react/jsx-runtime";
23204
+
23205
+ function ExportSection({ export: exp, spec }) {
23206
+ const props = { export: exp, spec };
23207
+ switch (exp.kind) {
23208
+ case "function":
23209
+ return /* @__PURE__ */ jsx21(FunctionSection, {
23210
+ ...props
23211
+ });
23212
+ case "class":
23213
+ return /* @__PURE__ */ jsx21(ClassSection, {
23214
+ ...props
23215
+ });
23216
+ case "interface":
23217
+ case "type":
23218
+ return /* @__PURE__ */ jsx21(InterfaceSection, {
23219
+ ...props
23220
+ });
23221
+ case "enum":
23222
+ return /* @__PURE__ */ jsx21(EnumSection, {
23223
+ ...props
23224
+ });
23225
+ default:
23226
+ return /* @__PURE__ */ jsx21(VariableSection, {
23227
+ ...props
23228
+ });
23229
+ }
23230
+ }
23231
+
23232
+ // src/components/styled/FullAPIReferencePage.tsx
23233
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
23234
+
23235
+ var KIND_ORDER2 = ["function", "class", "interface", "type", "enum", "variable"];
23236
+ var KIND_LABELS2 = {
23237
+ function: "Functions",
23238
+ class: "Classes",
23239
+ interface: "Interfaces",
23240
+ type: "Types",
23241
+ enum: "Enums",
23242
+ variable: "Variables"
23243
+ };
23244
+ function getExportTitle(exp) {
23245
+ switch (exp.kind) {
23246
+ case "function":
23247
+ return `${exp.name}()`;
23248
+ case "class":
23249
+ return `class ${exp.name}`;
23250
+ case "interface":
23251
+ case "type":
23252
+ return exp.name;
23253
+ case "enum":
23254
+ return `enum ${exp.name}`;
23255
+ default:
23256
+ return exp.name;
23257
+ }
23258
+ }
23259
+ function FullAPIReferencePage({
23260
+ spec,
23261
+ kinds,
23262
+ showFilters = true,
23263
+ showTOC = false,
23264
+ title,
23265
+ description,
23266
+ className
23267
+ }) {
23268
+ const [activeFilter, setActiveFilter] = useState5("all");
23269
+ const [activeSection, setActiveSection] = useState5(null);
23270
+ const isScrollingRef = useRef(false);
23271
+ const availableKinds = useMemo2(() => {
23272
+ const kindSet = new Set;
23273
+ for (const exp of spec.exports) {
23274
+ const kind = exp.kind;
23275
+ if (KIND_ORDER2.includes(kind)) {
23276
+ kindSet.add(kind);
23277
+ }
23278
+ }
23279
+ return KIND_ORDER2.filter((k) => kindSet.has(k));
23280
+ }, [spec.exports]);
23281
+ const filteredExports = useMemo2(() => {
23282
+ let exports = spec.exports;
23283
+ if (kinds?.length) {
23284
+ exports = exports.filter((e) => kinds.includes(e.kind));
23285
+ }
23286
+ if (activeFilter !== "all") {
23287
+ exports = exports.filter((e) => e.kind === activeFilter);
23288
+ }
23289
+ return exports.sort((a, b) => {
23290
+ const kindOrderA = KIND_ORDER2.indexOf(a.kind);
23291
+ const kindOrderB = KIND_ORDER2.indexOf(b.kind);
23292
+ if (kindOrderA !== kindOrderB) {
23293
+ return kindOrderA - kindOrderB;
23294
+ }
23295
+ return a.name.localeCompare(b.name);
23296
+ });
23297
+ }, [spec.exports, kinds, activeFilter]);
23298
+ const groupedExports = useMemo2(() => {
23299
+ const groups = new Map;
23300
+ for (const exp of filteredExports) {
23301
+ const kind = exp.kind;
23302
+ if (!groups.has(kind)) {
23303
+ groups.set(kind, []);
23304
+ }
23305
+ groups.get(kind).push(exp);
23306
+ }
23307
+ return groups;
23308
+ }, [filteredExports]);
23309
+ useEffect2(() => {
23310
+ if (typeof window === "undefined")
23311
+ return;
23312
+ const hash = window.location.hash.slice(1);
23313
+ if (hash) {
23314
+ const timer = setTimeout(() => {
23315
+ const element = document.getElementById(hash);
23316
+ if (element) {
23317
+ isScrollingRef.current = true;
23318
+ element.scrollIntoView({ behavior: "smooth" });
23319
+ setActiveSection(hash);
23320
+ setTimeout(() => {
23321
+ isScrollingRef.current = false;
23322
+ }, 1000);
23323
+ }
23324
+ }, 100);
23325
+ return () => clearTimeout(timer);
23326
+ }
23327
+ }, []);
23328
+ useEffect2(() => {
23329
+ if (!showTOC || typeof window === "undefined")
23330
+ return;
23331
+ const sectionIds = filteredExports.map((exp) => exp.id || exp.name);
23332
+ const observers = [];
23333
+ const handleIntersect = (entries) => {
23334
+ if (isScrollingRef.current)
23335
+ return;
23336
+ for (const entry of entries) {
23337
+ if (entry.isIntersecting && entry.intersectionRatio > 0) {
23338
+ const id = entry.target.id;
23339
+ setActiveSection(id);
23340
+ if (typeof window !== "undefined") {
23341
+ window.history.replaceState(null, "", `#${id}`);
23342
+ }
23343
+ break;
23344
+ }
23345
+ }
23346
+ };
23347
+ const observer = new IntersectionObserver(handleIntersect, {
23348
+ rootMargin: "-20% 0px -70% 0px",
23349
+ threshold: 0
23350
+ });
23351
+ for (const id of sectionIds) {
23352
+ const element = document.getElementById(id);
23353
+ if (element) {
23354
+ observer.observe(element);
23355
+ }
23356
+ }
23357
+ return () => {
23358
+ observer.disconnect();
23359
+ };
23360
+ }, [showTOC, filteredExports]);
23361
+ const handleTOCClick = useCallback((id) => {
23362
+ const element = document.getElementById(id);
23363
+ if (element) {
23364
+ isScrollingRef.current = true;
23365
+ element.scrollIntoView({ behavior: "smooth" });
23366
+ setActiveSection(id);
23367
+ window.history.replaceState(null, "", `#${id}`);
23368
+ setTimeout(() => {
23369
+ isScrollingRef.current = false;
23370
+ }, 1000);
23371
+ }
23372
+ }, []);
23373
+ const defaultDescription = /* @__PURE__ */ jsxs15("div", {
23374
+ children: [
23375
+ spec.meta.description && /* @__PURE__ */ jsx22("p", {
23376
+ children: spec.meta.description
23377
+ }),
23378
+ spec.meta.version && /* @__PURE__ */ jsxs15("p", {
23379
+ className: "text-sm text-muted-foreground mt-2",
23380
+ children: [
23381
+ "Version ",
23382
+ spec.meta.version
23383
+ ]
23384
+ })
23385
+ ]
23386
+ });
23387
+ const shouldShowFilters = showFilters && !kinds?.length && availableKinds.length > 1;
23388
+ return /* @__PURE__ */ jsxs15("div", {
23389
+ className: cn3("not-prose", showTOC && "lg:grid lg:grid-cols-[220px_1fr] lg:gap-8", className),
23390
+ children: [
23391
+ showTOC && /* @__PURE__ */ jsx22("aside", {
23392
+ className: "hidden lg:block",
23393
+ children: /* @__PURE__ */ jsxs15("nav", {
23394
+ className: "sticky top-20 max-h-[calc(100vh-6rem)] overflow-y-auto pr-4",
23395
+ children: [
23396
+ /* @__PURE__ */ jsx22("h4", {
23397
+ className: "text-sm font-semibold text-foreground mb-3",
23398
+ children: "On this page"
23399
+ }),
23400
+ /* @__PURE__ */ jsx22("div", {
23401
+ className: "space-y-4",
23402
+ children: KIND_ORDER2.map((kind) => {
23403
+ const exports = groupedExports.get(kind);
23404
+ if (!exports?.length)
23405
+ return null;
23406
+ return /* @__PURE__ */ jsxs15("div", {
23407
+ children: [
23408
+ /* @__PURE__ */ jsx22("h5", {
23409
+ className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",
23410
+ children: KIND_LABELS2[kind]
23411
+ }),
23412
+ /* @__PURE__ */ jsx22("ul", {
23413
+ className: "space-y-1",
23414
+ children: exports.map((exp) => {
23415
+ const id = exp.id || exp.name;
23416
+ const isActive = activeSection === id;
23417
+ return /* @__PURE__ */ jsx22("li", {
23418
+ children: /* @__PURE__ */ jsx22("button", {
23419
+ type: "button",
23420
+ onClick: () => handleTOCClick(id),
23421
+ className: cn3("block w-full text-left text-sm py-1 px-2 rounded-md transition-colors cursor-pointer truncate", isActive ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"),
23422
+ title: getExportTitle(exp),
23423
+ children: getExportTitle(exp)
23424
+ })
23425
+ }, id);
23426
+ })
23427
+ })
23428
+ ]
23429
+ }, kind);
23430
+ })
23431
+ })
23432
+ ]
23433
+ })
23434
+ }),
23435
+ /* @__PURE__ */ jsx22("div", {
23436
+ children: /* @__PURE__ */ jsxs15(APIReferencePage, {
23437
+ title: title || spec.meta.name || "API Reference",
23438
+ description: description || defaultDescription,
23439
+ children: [
23440
+ shouldShowFilters && /* @__PURE__ */ jsxs15("div", {
23441
+ className: "flex flex-wrap gap-2 mb-8 -mt-4",
23442
+ children: [
23443
+ /* @__PURE__ */ jsx22("button", {
23444
+ type: "button",
23445
+ onClick: () => setActiveFilter("all"),
23446
+ className: cn3("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"),
23447
+ children: "All"
23448
+ }),
23449
+ availableKinds.map((kind) => /* @__PURE__ */ jsx22("button", {
23450
+ type: "button",
23451
+ onClick: () => setActiveFilter(kind),
23452
+ className: cn3("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"),
23453
+ children: KIND_LABELS2[kind]
23454
+ }, kind))
23455
+ ]
23456
+ }),
23457
+ filteredExports.map((exp) => /* @__PURE__ */ jsx22(ExportSection, {
23458
+ export: exp,
23459
+ spec
23460
+ }, exp.id || exp.name)),
23461
+ filteredExports.length === 0 && /* @__PURE__ */ jsxs15("div", {
23462
+ className: "rounded-lg border border-border bg-card/50 p-8 text-center",
23463
+ children: [
23464
+ /* @__PURE__ */ jsx22("p", {
23465
+ className: "text-muted-foreground",
23466
+ children: activeFilter !== "all" ? `No ${KIND_LABELS2[activeFilter].toLowerCase()} found.` : "No exports found in this package."
23467
+ }),
23468
+ activeFilter !== "all" && /* @__PURE__ */ jsx22("button", {
23469
+ type: "button",
23470
+ onClick: () => setActiveFilter("all"),
23471
+ className: "mt-3 text-sm text-primary hover:underline cursor-pointer",
23472
+ children: "Show all exports"
23473
+ })
23474
+ ]
23475
+ })
23476
+ ]
23477
+ })
23478
+ })
23479
+ ]
23480
+ });
23481
+ }
23482
+ // src/components/styled/ParameterItem.tsx
23483
+ import { cn as cn4 } from "@doccov/ui/lib/utils";
23484
+ import { useState as useState6 } from "react";
23485
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
23143
23486
 
23144
23487
  function getNestedProperties2(schema) {
23145
23488
  if (!schema || typeof schema !== "object")
@@ -23169,55 +23512,55 @@ function NestedPropertyItem({
23169
23512
  required = false,
23170
23513
  depth = 0
23171
23514
  }) {
23172
- const [expanded, setExpanded] = useState5(false);
23515
+ const [expanded, setExpanded] = useState6(false);
23173
23516
  const type = formatSchema(schema);
23174
23517
  const nestedProps = getNestedProperties2(schema);
23175
23518
  const nestedCount = countProperties2(schema);
23176
23519
  const hasNested = nestedCount > 0;
23177
23520
  const schemaObj = schema;
23178
23521
  const description = schemaObj?.description;
23179
- return /* @__PURE__ */ jsxs15("div", {
23180
- className: cn3("border-t border-border first:border-t-0", depth > 0 && "ml-4"),
23522
+ return /* @__PURE__ */ jsxs16("div", {
23523
+ className: cn4("border-t border-border first:border-t-0", depth > 0 && "ml-4"),
23181
23524
  children: [
23182
- /* @__PURE__ */ jsx16("div", {
23525
+ /* @__PURE__ */ jsx23("div", {
23183
23526
  className: "py-3",
23184
- children: /* @__PURE__ */ jsxs15("div", {
23527
+ children: /* @__PURE__ */ jsxs16("div", {
23185
23528
  className: "flex items-start gap-2",
23186
23529
  children: [
23187
- hasNested && /* @__PURE__ */ jsx16("button", {
23530
+ hasNested && /* @__PURE__ */ jsx23("button", {
23188
23531
  type: "button",
23189
23532
  onClick: () => setExpanded(!expanded),
23190
23533
  className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
23191
23534
  "aria-label": expanded ? "Collapse" : "Expand",
23192
- children: /* @__PURE__ */ jsx16(ChevronRight, {
23535
+ children: /* @__PURE__ */ jsx23(ChevronRight, {
23193
23536
  size: 14,
23194
- className: cn3("transition-transform duration-200", expanded && "rotate-90")
23537
+ className: cn4("transition-transform duration-200", expanded && "rotate-90")
23195
23538
  })
23196
23539
  }),
23197
- !hasNested && /* @__PURE__ */ jsx16("div", {
23540
+ !hasNested && /* @__PURE__ */ jsx23("div", {
23198
23541
  className: "w-5"
23199
23542
  }),
23200
- /* @__PURE__ */ jsxs15("div", {
23543
+ /* @__PURE__ */ jsxs16("div", {
23201
23544
  className: "flex-1 min-w-0",
23202
23545
  children: [
23203
- /* @__PURE__ */ jsxs15("div", {
23546
+ /* @__PURE__ */ jsxs16("div", {
23204
23547
  className: "flex items-baseline gap-2 flex-wrap",
23205
23548
  children: [
23206
- /* @__PURE__ */ jsxs15("span", {
23549
+ /* @__PURE__ */ jsxs16("span", {
23207
23550
  className: "font-mono text-sm text-foreground",
23208
23551
  children: [
23209
23552
  name,
23210
- !required && /* @__PURE__ */ jsx16("span", {
23553
+ !required && /* @__PURE__ */ jsx23("span", {
23211
23554
  className: "text-muted-foreground",
23212
23555
  children: "?"
23213
23556
  })
23214
23557
  ]
23215
23558
  }),
23216
- /* @__PURE__ */ jsx16("span", {
23559
+ /* @__PURE__ */ jsx23("span", {
23217
23560
  className: "font-mono text-sm text-muted-foreground",
23218
23561
  children: hasNested ? "object" : type
23219
23562
  }),
23220
- hasNested && /* @__PURE__ */ jsxs15("button", {
23563
+ hasNested && /* @__PURE__ */ jsxs16("button", {
23221
23564
  type: "button",
23222
23565
  onClick: () => setExpanded(!expanded),
23223
23566
  className: "text-xs text-primary hover:underline cursor-pointer",
@@ -23229,7 +23572,7 @@ function NestedPropertyItem({
23229
23572
  })
23230
23573
  ]
23231
23574
  }),
23232
- description && /* @__PURE__ */ jsx16("p", {
23575
+ description && /* @__PURE__ */ jsx23("p", {
23233
23576
  className: "text-sm text-muted-foreground mt-1",
23234
23577
  children: description
23235
23578
  })
@@ -23238,9 +23581,9 @@ function NestedPropertyItem({
23238
23581
  ]
23239
23582
  })
23240
23583
  }),
23241
- hasNested && expanded && nestedProps && /* @__PURE__ */ jsx16("div", {
23584
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsx23("div", {
23242
23585
  className: "border-l border-border ml-2",
23243
- children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx16(NestedPropertyItem, {
23586
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx23(NestedPropertyItem, {
23244
23587
  name: propName,
23245
23588
  schema: propSchema,
23246
23589
  required: getRequiredFields2(schema).includes(propName),
@@ -23255,52 +23598,52 @@ function ParameterItem({
23255
23598
  depth = 0,
23256
23599
  className
23257
23600
  }) {
23258
- const [expanded, setExpanded] = useState5(false);
23601
+ const [expanded, setExpanded] = useState6(false);
23259
23602
  const type = formatSchema(param.schema);
23260
23603
  const isRequired = param.required !== false;
23261
23604
  const nestedProps = getNestedProperties2(param.schema);
23262
23605
  const nestedCount = countProperties2(param.schema);
23263
23606
  const hasNested = nestedCount > 0;
23264
- return /* @__PURE__ */ jsxs15("div", {
23265
- className: cn3("border-b border-border last:border-b-0", className),
23607
+ return /* @__PURE__ */ jsxs16("div", {
23608
+ className: cn4("border-b border-border last:border-b-0", className),
23266
23609
  children: [
23267
- /* @__PURE__ */ jsx16("div", {
23610
+ /* @__PURE__ */ jsx23("div", {
23268
23611
  className: "py-3",
23269
- children: /* @__PURE__ */ jsxs15("div", {
23612
+ children: /* @__PURE__ */ jsxs16("div", {
23270
23613
  className: "flex items-start gap-2",
23271
23614
  children: [
23272
- hasNested && /* @__PURE__ */ jsx16("button", {
23615
+ hasNested && /* @__PURE__ */ jsx23("button", {
23273
23616
  type: "button",
23274
23617
  onClick: () => setExpanded(!expanded),
23275
23618
  className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
23276
23619
  "aria-label": expanded ? "Collapse" : "Expand",
23277
- children: /* @__PURE__ */ jsx16(ChevronRight, {
23620
+ children: /* @__PURE__ */ jsx23(ChevronRight, {
23278
23621
  size: 14,
23279
- className: cn3("transition-transform duration-200", expanded && "rotate-90")
23622
+ className: cn4("transition-transform duration-200", expanded && "rotate-90")
23280
23623
  })
23281
23624
  }),
23282
- !hasNested && /* @__PURE__ */ jsx16("div", {
23625
+ !hasNested && /* @__PURE__ */ jsx23("div", {
23283
23626
  className: "w-5"
23284
23627
  }),
23285
- /* @__PURE__ */ jsxs15("div", {
23628
+ /* @__PURE__ */ jsxs16("div", {
23286
23629
  className: "flex-1 min-w-0",
23287
23630
  children: [
23288
- /* @__PURE__ */ jsxs15("div", {
23631
+ /* @__PURE__ */ jsxs16("div", {
23289
23632
  className: "flex items-baseline gap-2 flex-wrap",
23290
23633
  children: [
23291
- /* @__PURE__ */ jsx16("span", {
23634
+ /* @__PURE__ */ jsx23("span", {
23292
23635
  className: "font-mono text-sm font-medium text-foreground",
23293
23636
  children: param.name
23294
23637
  }),
23295
- isRequired && /* @__PURE__ */ jsx16("span", {
23638
+ isRequired && /* @__PURE__ */ jsx23("span", {
23296
23639
  className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-border bg-muted text-muted-foreground uppercase tracking-wide",
23297
23640
  children: "Required"
23298
23641
  }),
23299
- /* @__PURE__ */ jsx16("span", {
23642
+ /* @__PURE__ */ jsx23("span", {
23300
23643
  className: "font-mono text-sm text-muted-foreground",
23301
23644
  children: hasNested ? "object" : type
23302
23645
  }),
23303
- hasNested && /* @__PURE__ */ jsxs15("button", {
23646
+ hasNested && /* @__PURE__ */ jsxs16("button", {
23304
23647
  type: "button",
23305
23648
  onClick: () => setExpanded(!expanded),
23306
23649
  className: "text-xs text-primary hover:underline cursor-pointer",
@@ -23312,7 +23655,7 @@ function ParameterItem({
23312
23655
  })
23313
23656
  ]
23314
23657
  }),
23315
- param.description && /* @__PURE__ */ jsx16("p", {
23658
+ param.description && /* @__PURE__ */ jsx23("p", {
23316
23659
  className: "text-sm text-muted-foreground mt-1",
23317
23660
  children: param.description
23318
23661
  })
@@ -23321,9 +23664,9 @@ function ParameterItem({
23321
23664
  ]
23322
23665
  })
23323
23666
  }),
23324
- hasNested && expanded && nestedProps && /* @__PURE__ */ jsx16("div", {
23667
+ hasNested && expanded && nestedProps && /* @__PURE__ */ jsx23("div", {
23325
23668
  className: "border-l border-border ml-2 mb-3",
23326
- children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx16(NestedPropertyItem, {
23669
+ children: Object.entries(nestedProps).map(([propName, propSchema]) => /* @__PURE__ */ jsx23(NestedPropertyItem, {
23327
23670
  name: propName,
23328
23671
  schema: propSchema,
23329
23672
  required: getRequiredFields2(param.schema).includes(propName),
@@ -23339,6 +23682,7 @@ export {
23339
23682
  getExampleLanguage,
23340
23683
  getExampleCode,
23341
23684
  cleanCode,
23685
+ VariableSection,
23342
23686
  VariablePage,
23343
23687
  TypeTable,
23344
23688
  Signature,
@@ -23348,16 +23692,22 @@ export {
23348
23692
  NestedProperty,
23349
23693
  MembersTable,
23350
23694
  MemberRow,
23695
+ InterfaceSection,
23351
23696
  InterfacePage,
23352
23697
  ImportSection,
23698
+ FunctionSection,
23353
23699
  FunctionPage,
23700
+ FullAPIReferencePage,
23701
+ ExportSection,
23354
23702
  ExportIndexPage,
23355
23703
  ExportCard,
23356
23704
  ExpandableProperty,
23357
23705
  ExampleBlock,
23706
+ EnumSection,
23358
23707
  EnumPage,
23359
23708
  CollapsibleMethod,
23360
23709
  CodeTabs,
23710
+ ClassSection,
23361
23711
  ClassPage,
23362
23712
  APIPage
23363
23713
  };