@openpkg-ts/ui 0.4.0 → 0.5.1

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.
@@ -43,9 +43,27 @@ interface APICodePanelProps {
43
43
  }
44
44
  /**
45
45
  * Right-side sticky code panel for API documentation.
46
- * Features language dropdown, copy button, and dark bg with syntax highlighting.
46
+ * Features language dropdown and syntax highlighting via docskit.
47
47
  */
48
48
  declare function APICodePanel({ languages, examples, externalLink, title, className }: APICodePanelProps): React3.ReactNode;
49
+ import { ReactNode as ReactNode2 } from "react";
50
+ interface APIReferenceLayoutProps {
51
+ /** Left column content (documentation) */
52
+ children: ReactNode2;
53
+ /** Right column content (code examples) */
54
+ examples: ReactNode2;
55
+ /** Custom className */
56
+ className?: string;
57
+ /** Left column width on desktop (default: 58%) */
58
+ leftWidth?: string;
59
+ /** Right column width on desktop (default: 42%) */
60
+ rightWidth?: string;
61
+ }
62
+ /**
63
+ * Two-column layout for API reference with sticky right panel.
64
+ * Responsive: stacks vertically on mobile, two-column on desktop.
65
+ */
66
+ declare function APIReferenceLayout({ children, examples, className, leftWidth, rightWidth }: APIReferenceLayoutProps): ReactNode2;
49
67
  import * as React4 from "react";
50
68
  interface APIReferencePageProps {
51
69
  /** Page title */
@@ -88,6 +106,42 @@ interface APISectionProps {
88
106
  * Docs/params on left, sticky code panel on right.
89
107
  */
90
108
  declare function APISection({ title, id, description, children, languages, examples, externalLink, codePanelTitle, className }: APISectionProps): React5.ReactNode;
109
+ import { ReactNode as ReactNode3 } from "react";
110
+ interface CodeBlockProps {
111
+ /** Code content */
112
+ code: string;
113
+ /** Language for syntax highlighting */
114
+ language?: string;
115
+ /** Show line numbers */
116
+ showLineNumbers?: boolean;
117
+ /** Custom className */
118
+ className?: string;
119
+ }
120
+ /**
121
+ * Syntax-highlighted code block powered by CodeHike.
122
+ * Thin wrapper around docskit's ClientDocsKitCode with a simple interface.
123
+ */
124
+ declare function CodeBlock({ code, language, showLineNumbers, className }: CodeBlockProps): ReactNode3;
125
+ import { ReactNode as ReactNode4 } from "react";
126
+ interface CollapsiblePanelProps {
127
+ /** Panel title (e.g., "Response", "Data source") */
128
+ title: string;
129
+ /** Panel content */
130
+ children: ReactNode4;
131
+ /** Default expanded state */
132
+ defaultExpanded?: boolean;
133
+ /** Controlled expanded state */
134
+ expanded?: boolean;
135
+ /** Controlled onChange */
136
+ onExpandedChange?: (expanded: boolean) => void;
137
+ /** Custom className */
138
+ className?: string;
139
+ }
140
+ /**
141
+ * Accordion-style collapsible panel for code examples.
142
+ * Uses CSS grid-rows transition for smooth open/close.
143
+ */
144
+ declare function CollapsiblePanel({ title, children, defaultExpanded, expanded: controlledExpanded, onExpandedChange, className }: CollapsiblePanelProps): ReactNode4;
91
145
  import * as React6 from "react";
92
146
  type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
93
147
  type EndpointBadgeSize = "sm" | "md";
@@ -107,7 +161,154 @@ interface EndpointHeaderProps extends React7.HTMLAttributes<HTMLDivElement> {
107
161
  copyable?: boolean;
108
162
  }
109
163
  declare const EndpointHeader: React7.ForwardRefExoticComponent<EndpointHeaderProps & React7.RefAttributes<HTMLDivElement>>;
110
- import * as React8 from "react";
164
+ import { ReactNode as ReactNode5 } from "react";
165
+ interface EnumValue {
166
+ /** Enum value */
167
+ value: string;
168
+ /** Optional description */
169
+ description?: string;
170
+ }
171
+ interface EnumValuesSectionProps {
172
+ /** Enum values to display */
173
+ values: EnumValue[];
174
+ /** Section header (default: "Possible values") */
175
+ header?: string;
176
+ /** Custom className */
177
+ className?: string;
178
+ }
179
+ /**
180
+ * Enum values section showing possible values with optional descriptions.
181
+ * Used inside parameter items to show enum options.
182
+ */
183
+ declare function EnumValuesSection({ values, header, className }: EnumValuesSectionProps): ReactNode5;
184
+ import { ReactNode as ReactNode6 } from "react";
185
+ interface ExampleChip {
186
+ /** Unique identifier */
187
+ id: string;
188
+ /** Display label */
189
+ label: string;
190
+ }
191
+ interface ExampleChipsProps {
192
+ /** Available examples */
193
+ examples: ExampleChip[];
194
+ /** Currently active example ID */
195
+ activeId: string;
196
+ /** Selection callback */
197
+ onSelect: (id: string) => void;
198
+ /** Custom className */
199
+ className?: string;
200
+ }
201
+ /**
202
+ * Tab-like chips for switching between code examples.
203
+ * Used in the right column to select different example variations.
204
+ */
205
+ declare function ExampleChips({ examples, activeId, onSelect, className }: ExampleChipsProps): ReactNode6;
206
+ import { ReactNode as ReactNode7 } from "react";
207
+ interface CodeExample2 {
208
+ /** Unique identifier */
209
+ id: string;
210
+ /** Display label for chip */
211
+ label: string;
212
+ /** Code content */
213
+ code: string;
214
+ /** Language for highlighting */
215
+ language?: string;
216
+ }
217
+ interface ExampleSectionProps {
218
+ /** Section ID for sync scroll */
219
+ id: string;
220
+ /** Code examples to display */
221
+ examples: CodeExample2[];
222
+ /** Data source code (SQL/schema) */
223
+ dataSource?: string;
224
+ /** Response JSON */
225
+ response?: string;
226
+ /** Notes text */
227
+ notes?: ReactNode7;
228
+ /** Custom className */
229
+ className?: string;
230
+ }
231
+ /**
232
+ * Complete right-column section combining chips, code, and collapsible panels.
233
+ * Integrates with SyncScrollProvider for synchronized scrolling.
234
+ */
235
+ declare function ExampleSection({ id, examples, dataSource, response, notes, className }: ExampleSectionProps): ReactNode7;
236
+ import { SpecSignatureParameter } from "@openpkg-ts/spec";
237
+ import { ReactNode as ReactNode8 } from "react";
238
+ interface ExpandableParameterProps {
239
+ /** Parameter from spec */
240
+ parameter: SpecSignatureParameter;
241
+ /** Parent path prefix */
242
+ parentPath?: string;
243
+ /** Default expanded state */
244
+ defaultExpanded?: boolean;
245
+ /** Controlled expanded state */
246
+ expanded?: boolean;
247
+ /** Controlled onChange */
248
+ onExpandedChange?: (expanded: boolean) => void;
249
+ /** Nesting depth */
250
+ level?: number;
251
+ /** Custom className */
252
+ className?: string;
253
+ }
254
+ /**
255
+ * Compound component combining APIParameterItem + NestedParameterToggle + NestedParameterContainer.
256
+ * Automatically extracts nested object properties and enum values from spec schema.
257
+ */
258
+ declare function ExpandableParameter({ parameter, parentPath, defaultExpanded, expanded: controlledExpanded, onExpandedChange, level, className }: ExpandableParameterProps): ReactNode8;
259
+ import { ReactNode as ReactNode9 } from "react";
260
+ interface MethodSectionProps {
261
+ /** Section ID for scroll sync */
262
+ id: string;
263
+ /** Method title (e.g., "Fetch data") */
264
+ title: string;
265
+ /** Method signature (e.g., "select(columns?, options?)") */
266
+ signature?: string;
267
+ /** Method description */
268
+ description?: ReactNode9;
269
+ /** Bullet list notes */
270
+ notes?: string[];
271
+ /** Parameter content */
272
+ children?: ReactNode9;
273
+ /** Custom className */
274
+ className?: string;
275
+ }
276
+ /**
277
+ * Container for a single API method in the documentation.
278
+ * Renders title, signature, description, notes list, and parameters.
279
+ */
280
+ declare function MethodSection({ id, title, signature, description, notes, children, className }: MethodSectionProps): ReactNode9;
281
+ import { ReactNode as ReactNode10 } from "react";
282
+ interface NestedParameterContainerProps {
283
+ /** Nested parameter content */
284
+ children: ReactNode10;
285
+ /** Nesting depth level (0 = first level) */
286
+ level?: number;
287
+ /** Custom className */
288
+ className?: string;
289
+ }
290
+ /**
291
+ * Bordered container for nested child parameters (Scalar/Clerk-style).
292
+ * Connects to NestedParameterToggle above — shares the same border,
293
+ * so this has no top border and only bottom-rounded corners.
294
+ */
295
+ declare function NestedParameterContainer({ children, level, className }: NestedParameterContainerProps): ReactNode10;
296
+ import { ReactNode as ReactNode11 } from "react";
297
+ interface NestedParameterToggleProps {
298
+ /** Toggle state */
299
+ expanded: boolean;
300
+ /** Toggle callback */
301
+ onToggle: () => void;
302
+ /** Custom className */
303
+ className?: string;
304
+ }
305
+ /**
306
+ * "Show/Hide Child Attributes" toggle button (Scalar/Clerk-style).
307
+ * When collapsed: standalone rounded pill.
308
+ * When expanded: top of a unified bordered container (rounded-t, no bottom border).
309
+ */
310
+ declare function NestedParameterToggle({ expanded, onToggle, className }: NestedParameterToggleProps): ReactNode11;
311
+ import { ReactNode as ReactNode12 } from "react";
111
312
  interface APIParameterSchema {
112
313
  /** Type name */
113
314
  type?: string;
@@ -123,40 +324,48 @@ interface APIParameterSchema {
123
324
  interface APIParameterItemProps {
124
325
  /** Parameter name */
125
326
  name: string;
126
- /** Type string (e.g., "string", "object") */
327
+ /** Parent path prefix (e.g., "options." for nested) */
328
+ parentPath?: string;
329
+ /** Parameter type */
127
330
  type: string;
128
- /** Is required */
331
+ /** Required parameter */
129
332
  required?: boolean;
333
+ /** Optional parameter (explicit) */
334
+ optional?: boolean;
335
+ /** Has expandable children */
336
+ expandable?: boolean;
130
337
  /** Description */
131
- description?: string;
132
- /** Nested children (for expandable objects) */
133
- children?: APIParameterSchema;
134
- /** Nesting depth */
135
- depth?: number;
338
+ description?: ReactNode12;
339
+ /** Nested content (params or enum) */
340
+ children?: ReactNode12;
341
+ /** Anchor ID for deep linking */
342
+ anchorId?: string;
343
+ /** Show anchor link on hover */
344
+ showAnchor?: boolean;
136
345
  /** Custom className */
137
346
  className?: string;
138
347
  }
139
348
  /**
140
- * Single parameter row with name, type, required badge, description, and expandable children.
141
- * Stripe-style API reference parameter display.
349
+ * Single parameter row (Scalar/Clerk-style).
350
+ * Displays name, type, required badge (orange text), description, and optional nested content.
142
351
  */
143
- declare function APIParameterItem({ name, type, required, description, children, depth, className }: APIParameterItemProps): React8.ReactNode;
144
- import * as React9 from "react";
352
+ declare function APIParameterItem({ name, parentPath, type, required, optional, description, children, anchorId, className }: APIParameterItemProps): ReactNode12;
353
+ import * as React8 from "react";
145
354
  interface ParameterListProps {
146
355
  /** Title above the list (e.g., "Body parameters") */
147
356
  title?: string;
148
357
  /** Number of items to show before collapsing */
149
358
  collapseAfter?: number;
150
359
  /** Child parameter items */
151
- children: React9.ReactNode;
360
+ children: React8.ReactNode;
152
361
  /** Custom className */
153
362
  className?: string;
154
363
  }
155
364
  /**
156
365
  * Container for parameter items with optional "More parameters" collapse.
157
366
  */
158
- declare function ParameterList({ title, collapseAfter, children, className }: ParameterListProps): React9.ReactNode;
159
- import * as React10 from "react";
367
+ declare function ParameterList({ title, collapseAfter, children, className }: ParameterListProps): React8.ReactNode;
368
+ import * as React9 from "react";
160
369
  interface ResponseBlockProps {
161
370
  /** Response JSON data */
162
371
  data: object;
@@ -169,7 +378,41 @@ interface ResponseBlockProps {
169
378
  * JSON response preview with syntax highlighting.
170
379
  * Displays formatted JSON with copy functionality.
171
380
  */
172
- declare function ResponseBlock({ data, title, className }: ResponseBlockProps): React10.ReactNode;
381
+ declare function ResponseBlock({ data, title, className }: ResponseBlockProps): React9.ReactNode;
382
+ import { ReactNode as ReactNode13, RefObject } from "react";
383
+ interface SyncScrollContextValue {
384
+ /** Currently visible section ID */
385
+ activeSection: string | null;
386
+ /** Register a section to track */
387
+ registerSection: (id: string, ref: RefObject<HTMLElement | null>) => void;
388
+ /** Unregister a section */
389
+ unregisterSection: (id: string) => void;
390
+ /** Scroll right column to section */
391
+ scrollToSection: (id: string) => void;
392
+ /** Register the right column container */
393
+ registerRightColumn: (ref: RefObject<HTMLElement | null>) => void;
394
+ }
395
+ interface SyncScrollProviderProps {
396
+ children: ReactNode13;
397
+ /** Root margin for intersection observer (default: '-20% 0px -60% 0px') */
398
+ rootMargin?: string;
399
+ /** Scroll behavior (default: 'smooth') */
400
+ scrollBehavior?: ScrollBehavior;
401
+ }
402
+ /**
403
+ * Provider for synchronized scrolling between left and right columns.
404
+ * Uses IntersectionObserver to track visible sections on the left,
405
+ * and auto-scrolls the right column to matching examples.
406
+ */
407
+ declare function SyncScrollProvider({ children, rootMargin, scrollBehavior }: SyncScrollProviderProps): ReactNode13;
408
+ /**
409
+ * Hook to access sync scroll context.
410
+ */
411
+ declare function useSyncScroll(): SyncScrollContextValue;
412
+ /**
413
+ * Hook to register a section for scroll tracking.
414
+ */
415
+ declare function useSyncSection(id: string): RefObject<HTMLElement | null>;
173
416
  import { AnnotationHandler } from "codehike/code";
174
417
  declare const callout: AnnotationHandler;
175
418
  import { AnnotationHandler as AnnotationHandler2, RawCode } from "codehike/code";
@@ -367,19 +610,19 @@ import { AnnotationHandler as AnnotationHandler6 } from "codehike/code";
367
610
  declare const collapse: readonly AnnotationHandler6[];
368
611
  import { AnnotationHandler as AnnotationHandler7 } from "codehike/code";
369
612
  declare const diff: AnnotationHandler7;
370
- import React11 from "react";
371
- declare function addDocsKit<T extends Record<string, React11.ElementType | string>>(components: T): T;
613
+ import React10 from "react";
614
+ declare function addDocsKit<T extends Record<string, React10.ElementType | string>>(components: T): T;
372
615
  import { AnnotationHandler as AnnotationHandler8 } from "codehike/code";
373
616
  declare const expandable: AnnotationHandler8;
374
617
  import { AnnotationHandler as AnnotationHandler9 } from "codehike/code";
375
- import React12 from "react";
618
+ import React11 from "react";
376
619
  declare function WithHover(props: {
377
- children: React12.ReactNode;
378
- }): React12.ReactNode;
620
+ children: React11.ReactNode;
621
+ }): React11.ReactNode;
379
622
  declare function HoverLink(props: {
380
623
  href?: string;
381
- children?: React12.ReactNode;
382
- }): React12.ReactNode;
624
+ children?: React11.ReactNode;
625
+ }): React11.ReactNode;
383
626
  declare const hover: AnnotationHandler9;
384
627
  import { AnnotationHandler as AnnotationHandler10 } from "codehike/code";
385
628
  declare const lineNumbers2: AnnotationHandler10;
@@ -391,11 +634,11 @@ declare function WithNotes({ children,...rest }: {
391
634
  children: React.ReactNode;
392
635
  }): React.ReactNode;
393
636
  import * as TabsPrimitive from "@radix-ui/react-tabs";
394
- import * as React13 from "react";
395
- declare function Tabs({ className,...props }: React13.ComponentProps<typeof TabsPrimitive.Root>): React13.ReactNode;
396
- declare function TabsList({ className,...props }: React13.ComponentProps<typeof TabsPrimitive.List>): React13.ReactNode;
397
- declare function TabsTrigger({ className,...props }: React13.ComponentProps<typeof TabsPrimitive.Trigger>): React13.ReactNode;
398
- declare function TabsContent({ className,...props }: React13.ComponentProps<typeof TabsPrimitive.Content>): React13.ReactNode;
637
+ import * as React12 from "react";
638
+ declare function Tabs({ className,...props }: React12.ComponentProps<typeof TabsPrimitive.Root>): React12.ReactNode;
639
+ declare function TabsList({ className,...props }: React12.ComponentProps<typeof TabsPrimitive.List>): React12.ReactNode;
640
+ declare function TabsTrigger({ className,...props }: React12.ComponentProps<typeof TabsPrimitive.Trigger>): React12.ReactNode;
641
+ declare function TabsContent({ className,...props }: React12.ComponentProps<typeof TabsPrimitive.Content>): React12.ReactNode;
399
642
  import { AnnotationHandler as AnnotationHandler13 } from "codehike/code";
400
643
  declare const tooltip: AnnotationHandler13;
401
644
  declare function TooltipLink(props: {
@@ -415,14 +658,14 @@ interface ImportSectionProps {
415
658
  * Monospace styling with copy button.
416
659
  */
417
660
  declare function ImportSection({ importStatement, className }: ImportSectionProps): React.ReactNode;
418
- import * as React14 from "react";
661
+ import * as React13 from "react";
419
662
  type TypeColor = "string" | "number" | "boolean" | "null" | "undefined" | "object" | "array" | "function" | "union" | "generic" | "default";
420
663
  /**
421
664
  * Type coloring for syntax display.
422
665
  * Follows Stripe-style: consistent colors for primitives vs complex types.
423
666
  */
424
667
  declare const typeBadgeVariants: unknown;
425
- interface TypeBadgeProps extends React14.HTMLAttributes<HTMLSpanElement> {
668
+ interface TypeBadgeProps extends React13.HTMLAttributes<HTMLSpanElement> {
426
669
  /** Type string to display */
427
670
  type: string;
428
671
  /** Override color detection */
@@ -432,5 +675,5 @@ interface TypeBadgeProps extends React14.HTMLAttributes<HTMLSpanElement> {
432
675
  * Inline type display with syntax coloring.
433
676
  * Automatically detects type category and applies appropriate color.
434
677
  */
435
- declare const TypeBadge: React14.ForwardRefExoticComponent<TypeBadgeProps & React14.RefAttributes<HTMLSpanElement>>;
436
- export { wordWrap2 as wordWrap, typeBadgeVariants, tooltip, toCodeGroup, theme, mark, link, lineNumbers2 as lineNumbers, hover, flagsToOptions, expandable, endpointBadgeVariants, diff, collapse, callout, addDocsKit, WithNotes, WithHover, TypeColor, TypeBadgeProps, TypeBadge, TooltipLink, TerminalSkeleton, Terminal, TabsTrigger, TabsList, TabsContent, Tabs, SingleCode, ResponseBlockProps, ResponseBlock, ParameterListProps, ParameterList, PackageInstall, MultiCode, LanguageSelectorProps, LanguageSelector, Language, InlineCodeSkeleton, ImportSectionProps, ImportSection, HttpMethod, HoverLink, EndpointHeaderProps, EndpointHeader, EndpointBadgeProps, EndpointBadge, DocsKitInlineCode, DocsKitCode, DiffStats, CopyButton, CodeTabsSkeleton, CodeInfo, CodeIcon, CodeGroup, CodeExample, CodeBlockSkeleton, Code, ClientTerminal, ClientInlineCode, ClientDocsKitCode, ClientDiffCodeProps, ClientDiffCode, ClientCode, APISectionProps, APISection, APIReferencePageProps, APIReferencePage, APIParameterSchema, APIParameterItemProps, APIParameterItem, APICodePanelProps, APICodePanel };
678
+ declare const TypeBadge: React13.ForwardRefExoticComponent<TypeBadgeProps & React13.RefAttributes<HTMLSpanElement>>;
679
+ export { wordWrap2 as wordWrap, useSyncSection, useSyncScroll, typeBadgeVariants, tooltip, toCodeGroup, theme, mark, link, lineNumbers2 as lineNumbers, hover, flagsToOptions, expandable, endpointBadgeVariants, diff, collapse, callout, addDocsKit, WithNotes, WithHover, TypeColor, TypeBadgeProps, TypeBadge, TooltipLink, TerminalSkeleton, Terminal, TabsTrigger, TabsList, TabsContent, Tabs, SyncScrollProviderProps, SyncScrollProvider, SyncScrollContextValue, SingleCode, ResponseBlockProps, ResponseBlock, ParameterListProps, ParameterList, PackageInstall, NestedParameterToggleProps, NestedParameterToggle, NestedParameterContainerProps, NestedParameterContainer, MultiCode, MethodSectionProps, MethodSection, LanguageSelectorProps, LanguageSelector, Language, InlineCodeSkeleton, ImportSectionProps, ImportSection, HttpMethod, HoverLink, ExpandableParameterProps, ExpandableParameter, ExampleSectionProps, CodeExample2 as ExampleSectionCodeExample, ExampleSection, ExampleChipsProps, ExampleChips, ExampleChip, EnumValuesSectionProps, EnumValuesSection, EnumValue, EndpointHeaderProps, EndpointHeader, EndpointBadgeProps, EndpointBadge, DocsKitInlineCode, DocsKitCode, DiffStats, CopyButton, CollapsiblePanelProps, CollapsiblePanel, CodeTabsSkeleton, CodeInfo, CodeIcon, CodeGroup, CodeExample, CodeBlockSkeleton, CodeBlockProps, CodeBlock, Code, ClientTerminal, ClientInlineCode, ClientDocsKitCode, ClientDiffCodeProps, ClientDiffCode, ClientCode, APISectionProps, APISection, APIReferencePageProps, APIReferencePage, APIReferenceLayoutProps, APIReferenceLayout, APIParameterSchema, APIParameterItemProps, APIParameterItem, APICodePanelProps, APICodePanel };