@openpkg-ts/doc-generator 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -542,6 +542,28 @@ interface ClassPageProps {
542
542
  * Styled class page component with Tailwind.
543
543
  */
544
544
  declare function ClassPage({ export: exp, spec, renderExample }: ClassPageProps): React.ReactNode;
545
+ import { ReactNode as ReactNode2 } from "react";
546
+ interface CodeTab {
547
+ /** Tab label */
548
+ label: string;
549
+ /** Tab content (code block) */
550
+ content: ReactNode2;
551
+ /** Raw code for copy button */
552
+ code: string;
553
+ }
554
+ interface CodeTabsProps {
555
+ /** Array of tabs */
556
+ tabs: CodeTab[];
557
+ /** Default selected tab index */
558
+ defaultIndex?: number;
559
+ /** Custom className */
560
+ className?: string;
561
+ }
562
+ /**
563
+ * Tabbed code block wrapper with copy button per tab.
564
+ * Integrates with any code rendering component.
565
+ */
566
+ declare function CodeTabs({ tabs, defaultIndex, className }: CodeTabsProps): React.ReactNode2;
545
567
  import { OpenPkg as OpenPkg9, SpecExport as SpecExport5 } from "@openpkg-ts/spec";
546
568
  interface EnumPageProps {
547
569
  export: SpecExport5;
@@ -553,6 +575,40 @@ interface EnumPageProps {
553
575
  * Styled enum page component with Tailwind.
554
576
  */
555
577
  declare function EnumPage({ export: exp, spec, renderExample }: EnumPageProps): React.ReactNode;
578
+ interface ExportCardProps {
579
+ /** Function/name */
580
+ name: string;
581
+ /** Description snippet */
582
+ description?: string;
583
+ /** Link to detail page */
584
+ href: string;
585
+ /** Export kind: function, type, variable, class, interface, enum */
586
+ kind?: "function" | "type" | "variable" | "class" | "interface" | "enum";
587
+ /** Custom className */
588
+ className?: string;
589
+ }
590
+ /**
591
+ * Card component for displaying exports in an index grid.
592
+ * Features function name styling, description, and hover effects.
593
+ */
594
+ declare function ExportCard({ name, description, href, kind, className }: ExportCardProps): React.ReactNode;
595
+ import { OpenPkg as OpenPkg10 } from "@openpkg-ts/spec";
596
+ import { ReactNode as ReactNode3 } from "react";
597
+ interface ExportIndexPageProps {
598
+ /** OpenPkg spec */
599
+ spec: OpenPkg10;
600
+ /** Base href for links (e.g., '/docs/api') */
601
+ baseHref: string;
602
+ /** Optional intro description */
603
+ description?: string;
604
+ /** Custom className */
605
+ className?: string;
606
+ }
607
+ /**
608
+ * Index page showing all exports in a grid, grouped by category.
609
+ * AI SDK-style clean layout with responsive 2-column grid.
610
+ */
611
+ declare function ExportIndexPage({ spec, baseHref, description, className }: ExportIndexPageProps): ReactNode3;
556
612
  import { OpenPkg as OpenPkg11, SpecExport as SpecExport6 } from "@openpkg-ts/spec";
557
613
  import { ReactNode as ReactNode4 } from "react";
558
614
  interface FunctionPageProps {
@@ -566,6 +622,17 @@ interface FunctionPageProps {
566
622
  * Left: parameters, returns. Right: sticky code examples.
567
623
  */
568
624
  declare function FunctionPage({ export: exp, spec, renderExample }: FunctionPageProps): ReactNode4;
625
+ interface ImportSectionProps {
626
+ /** Import statement text */
627
+ importStatement: string;
628
+ /** Custom className */
629
+ className?: string;
630
+ }
631
+ /**
632
+ * Displays a copyable import statement with one-click copy.
633
+ * Monospace styling with copy button.
634
+ */
635
+ declare function ImportSection({ importStatement, className }: ImportSectionProps): React.ReactNode;
569
636
  import { OpenPkg as OpenPkg12, SpecExport as SpecExport7 } from "@openpkg-ts/spec";
570
637
  interface InterfacePageProps {
571
638
  export: SpecExport7;
@@ -577,6 +644,30 @@ interface InterfacePageProps {
577
644
  * Styled interface/type page component with Tailwind.
578
645
  */
579
646
  declare function InterfacePage({ export: exp, spec, renderExample }: InterfacePageProps): React.ReactNode;
647
+ import { SpecSchema as SpecSchema2, SpecSignatureParameter as SpecSignatureParameter4 } from "@openpkg-ts/spec";
648
+ interface ParameterItemProps {
649
+ /** Parameter to display */
650
+ param: SpecSignatureParameter4;
651
+ /** Nesting depth for indentation */
652
+ depth?: number;
653
+ /** Custom className */
654
+ className?: string;
655
+ }
656
+ interface NestedPropertyItemProps {
657
+ /** Property name */
658
+ name: string;
659
+ /** Property schema */
660
+ schema: SpecSchema2;
661
+ /** Is this property required */
662
+ required?: boolean;
663
+ /** Nesting depth */
664
+ depth?: number;
665
+ }
666
+ /**
667
+ * Single parameter with expand capability for nested objects.
668
+ * Features expandable nested params, type annotations, and required/optional badges.
669
+ */
670
+ declare function ParameterItem({ param, depth, className }: ParameterItemProps): React.ReactNode;
580
671
  import { OpenPkg as OpenPkg13, SpecExport as SpecExport8 } from "@openpkg-ts/spec";
581
672
  interface VariablePageProps {
582
673
  export: SpecExport8;
@@ -588,4 +679,4 @@ interface VariablePageProps {
588
679
  * Styled variable/constant page component with Tailwind.
589
680
  */
590
681
  declare function VariablePage({ export: exp, spec, renderExample }: VariablePageProps): React.ReactNode;
591
- export { groupMembersByKind, getExampleTitle, getExampleLanguage, getExampleCode, cleanCode, VariablePageProps, VariablePage, TypeTableProps, TypeTable, SignatureProps, Signature, ParamTableProps, ParamTable, ParamRowProps, ParamRow, NestedPropertyProps, NestedProperty, MembersTableProps, MembersTable, MemberRowProps, MemberRow, MemberGroups, InterfacePageProps, InterfacePage, FunctionPageProps, FunctionPage, ExpandablePropertyProps, ExpandableProperty, ExampleBlockProps, ExampleBlock, EnumPageProps, EnumPage, CollapsibleMethodProps, CollapsibleMethod, ClassPageProps, ClassPage, APIPageProps, APIPage };
682
+ export { groupMembersByKind, getExampleTitle, getExampleLanguage, getExampleCode, cleanCode, VariablePageProps, VariablePage, TypeTableProps, TypeTable, SignatureProps, Signature, ParameterItemProps, ParameterItem, ParamTableProps, ParamTable, ParamRowProps, ParamRow, NestedPropertyProps, NestedPropertyItemProps, NestedProperty, MembersTableProps, MembersTable, MemberRowProps, MemberRow, MemberGroups, InterfacePageProps, InterfacePage, ImportSectionProps, ImportSection, FunctionPageProps, FunctionPage, ExportIndexPageProps, ExportIndexPage, ExportCardProps, ExportCard, ExpandablePropertyProps, ExpandableProperty, ExampleBlockProps, ExampleBlock, EnumPageProps, EnumPage, CollapsibleMethodProps, CollapsibleMethod, CodeTabsProps, CodeTabs, CodeTab, ClassPageProps, ClassPage, APIPageProps, APIPage };
@@ -6048,6 +6048,9 @@ function ExportIndexPage({
6048
6048
  description,
6049
6049
  className
6050
6050
  }) {
6051
+ if (!baseHref) {
6052
+ console.warn("[ExportIndexPage] baseHref is undefined - links will be broken");
6053
+ }
6051
6054
  const groups = groupByKind(spec.exports);
6052
6055
  return /* @__PURE__ */ jsxDEV11("div", {
6053
6056
  className: cn("space-y-10 not-prose", className),
@@ -24924,17 +24927,22 @@ export {
24924
24927
  VariablePage,
24925
24928
  TypeTable,
24926
24929
  Signature,
24930
+ ParameterItem,
24927
24931
  ParamTable,
24928
24932
  ParamRow,
24929
24933
  NestedProperty,
24930
24934
  MembersTable,
24931
24935
  MemberRow,
24932
24936
  InterfacePage,
24937
+ ImportSection,
24933
24938
  FunctionPage,
24939
+ ExportIndexPage,
24940
+ ExportCard,
24934
24941
  ExpandableProperty,
24935
24942
  ExampleBlock,
24936
24943
  EnumPage,
24937
24944
  CollapsibleMethod,
24945
+ CodeTabs,
24938
24946
  ClassPage,
24939
24947
  APIPage
24940
24948
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/doc-generator",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "API doc generator consuming OpenPkg specs. TypeDoc alternative for modern doc frameworks.",
5
5
  "keywords": [
6
6
  "openpkg",