@openpkg-ts/react 0.3.0 → 0.3.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.
- package/dist/index.d.ts +23 -23
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-kpvq09pv.js → chunk-2t4e6p1b.js} +13 -12
- package/dist/styled.d.ts +549 -549
- package/dist/styled.js +2326 -2326
- package/package.json +5 -5
package/dist/styled.d.ts
CHANGED
|
@@ -26,18 +26,176 @@ declare function getLanguagesFromExamples(examples: SpecExample[] | undefined):
|
|
|
26
26
|
* Build import statement for an export.
|
|
27
27
|
*/
|
|
28
28
|
declare function buildImportStatement(exp: SpecExport, spec: OpenPkg): string;
|
|
29
|
-
import {
|
|
29
|
+
import { SpecExample as SpecExample2 } from "@openpkg-ts/spec";
|
|
30
|
+
import { ReactNode as ReactNode2 } from "react";
|
|
31
|
+
interface CodeExample2 {
|
|
32
|
+
/** Unique identifier */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Display label for chip */
|
|
35
|
+
label: string;
|
|
36
|
+
/** Code content */
|
|
37
|
+
code: string;
|
|
38
|
+
/** Language for highlighting */
|
|
39
|
+
language?: string;
|
|
40
|
+
}
|
|
41
|
+
interface ExampleSectionProps {
|
|
42
|
+
/** Section ID for sync scroll */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Code examples to display */
|
|
45
|
+
examples: CodeExample2[];
|
|
46
|
+
/** Data source code (SQL/schema) */
|
|
47
|
+
dataSource?: string;
|
|
48
|
+
/** Response JSON */
|
|
49
|
+
response?: string;
|
|
50
|
+
/** Notes text */
|
|
51
|
+
notes?: ReactNode2;
|
|
52
|
+
/** Custom className */
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Complete right-column section combining chips, code, and collapsible panels.
|
|
57
|
+
* Integrates with SyncScrollProvider for synchronized scrolling.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <ExampleSection
|
|
62
|
+
* id="select"
|
|
63
|
+
* examples={[
|
|
64
|
+
* { id: 'basic', label: 'Basic', code: '...', language: 'typescript' },
|
|
65
|
+
* { id: 'filter', label: 'With filter', code: '...', language: 'typescript' },
|
|
66
|
+
* ]}
|
|
67
|
+
* response={`{ "data": [...] }`}
|
|
68
|
+
* notes="Returns all columns by default."
|
|
69
|
+
* />
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function ExampleSection({ id, examples, dataSource, response, notes, className }: ExampleSectionProps): ReactNode2;
|
|
73
|
+
/**
|
|
74
|
+
* Convert a SpecExample to CodeExample props for ExampleSection.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* const examples = spec.examples?.map(specExampleToCodeExample) ?? [];
|
|
79
|
+
* return <ExampleSection examples={examples} />;
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function specExampleToCodeExample(example: SpecExample2 | string, index: number): CodeExample2;
|
|
83
|
+
/**
|
|
84
|
+
* Generate a default code example from function signature.
|
|
85
|
+
*/
|
|
86
|
+
declare function generateDefaultExample(packageName: string, exportName: string, paramNames: string[]): CodeExample2;
|
|
87
|
+
import { SpecSchema as SpecSchema2, SpecSignatureParameter as SpecSignatureParameter2 } from "@openpkg-ts/spec";
|
|
88
|
+
import { ReactNode as ReactNode3 } from "react";
|
|
89
|
+
interface APIParameterItemProps {
|
|
90
|
+
/** Parameter name */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Parent path prefix (e.g., "options." for nested) */
|
|
93
|
+
parentPath?: string;
|
|
94
|
+
/** Parameter type */
|
|
95
|
+
type: string;
|
|
96
|
+
/** Required parameter */
|
|
97
|
+
required?: boolean;
|
|
98
|
+
/** Optional parameter (explicit) */
|
|
99
|
+
optional?: boolean;
|
|
100
|
+
/** Has expandable children */
|
|
101
|
+
expandable?: boolean;
|
|
102
|
+
/** Description */
|
|
103
|
+
description?: ReactNode3;
|
|
104
|
+
/** Nested content (params or enum) */
|
|
105
|
+
children?: ReactNode3;
|
|
106
|
+
/** Anchor ID for deep linking */
|
|
107
|
+
anchorId?: string;
|
|
108
|
+
/** Show anchor link on hover */
|
|
109
|
+
showAnchor?: boolean;
|
|
110
|
+
/** Custom className */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Single parameter row in Stripe-style documentation.
|
|
115
|
+
* Displays name, type, badges, description, and optional nested content.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <APIParameterItem
|
|
120
|
+
* name="email"
|
|
121
|
+
* type="string"
|
|
122
|
+
* required
|
|
123
|
+
* description="User's email address"
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function APIParameterItem({ name, parentPath, type, required, optional, expandable, description, children, anchorId, showAnchor, className }: APIParameterItemProps): ReactNode3;
|
|
128
|
+
import { ReactNode as ReactNode4 } from "react";
|
|
129
|
+
interface EnumValue {
|
|
130
|
+
/** Enum value */
|
|
131
|
+
value: string;
|
|
132
|
+
/** Optional description */
|
|
133
|
+
description?: string;
|
|
134
|
+
}
|
|
135
|
+
interface EnumValuesSectionProps {
|
|
136
|
+
/** Enum values to display */
|
|
137
|
+
values: EnumValue[];
|
|
138
|
+
/** Section header (default: "Possible values") */
|
|
139
|
+
header?: string;
|
|
140
|
+
/** Custom className */
|
|
141
|
+
className?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Enum values section showing possible values with optional descriptions.
|
|
145
|
+
* Used inside parameter items to show enum options.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* <EnumValuesSection
|
|
150
|
+
* values={[
|
|
151
|
+
* { value: 'light', description: 'Light theme' },
|
|
152
|
+
* { value: 'dark', description: 'Dark theme' },
|
|
153
|
+
* { value: 'system', description: 'Follow system preference' },
|
|
154
|
+
* ]}
|
|
155
|
+
* />
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare function EnumValuesSection({ values, header, className }: EnumValuesSectionProps): ReactNode4;
|
|
159
|
+
interface NestedParameterData extends Omit<APIParameterItemProps, "children"> {
|
|
160
|
+
/** Child parameters (for objects) */
|
|
161
|
+
children?: NestedParameterData[];
|
|
162
|
+
/** Enum values (for enums) */
|
|
163
|
+
enumValues?: EnumValue[];
|
|
164
|
+
/** Original schema */
|
|
165
|
+
schema: SpecSchema2;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Convert a SpecSignatureParameter to nested parameter data.
|
|
169
|
+
* Recursively processes object properties and extracts enum values.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```tsx
|
|
173
|
+
* const paramData = specParamToNestedParam(param);
|
|
174
|
+
* return <APIParameterItem {...paramData} />;
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
declare function specParamToNestedParam(param: SpecSignatureParameter2, parentPath?: string): NestedParameterData;
|
|
178
|
+
/**
|
|
179
|
+
* Convert multiple parameters to nested parameter data.
|
|
180
|
+
*/
|
|
181
|
+
declare function specParamsToNestedParams(params: SpecSignatureParameter2[]): NestedParameterData[];
|
|
182
|
+
/**
|
|
183
|
+
* Resolve a $ref in the schema against spec types.
|
|
184
|
+
* Returns the resolved schema or the original if not found.
|
|
185
|
+
*/
|
|
186
|
+
declare function resolveSchemaRef(schema: SpecSchema2, types: Record<string, SpecSchema2>): SpecSchema2;
|
|
187
|
+
import { SpecMember as SpecMember2 } from "@openpkg-ts/spec";
|
|
30
188
|
interface CollapsibleMethodProps {
|
|
31
189
|
/** Method member to display */
|
|
32
|
-
member:
|
|
190
|
+
member: SpecMember2;
|
|
33
191
|
/** Default expanded state */
|
|
34
192
|
defaultExpanded?: boolean;
|
|
35
193
|
/** Custom className */
|
|
36
194
|
className?: string;
|
|
37
195
|
/** Custom header renderer */
|
|
38
|
-
renderHeader?: (member:
|
|
196
|
+
renderHeader?: (member: SpecMember2, expanded: boolean, toggle: () => void) => React.ReactNode;
|
|
39
197
|
/** Custom content renderer */
|
|
40
|
-
renderContent?: (member:
|
|
198
|
+
renderContent?: (member: SpecMember2) => React.ReactNode;
|
|
41
199
|
}
|
|
42
200
|
/**
|
|
43
201
|
* Headless collapsible method component.
|
|
@@ -56,27 +214,27 @@ interface CollapsibleMethodProps {
|
|
|
56
214
|
* ```
|
|
57
215
|
*/
|
|
58
216
|
declare function CollapsibleMethod({ member, defaultExpanded, className, renderHeader, renderContent }: CollapsibleMethodProps): React.ReactNode;
|
|
59
|
-
import { SpecExample as
|
|
217
|
+
import { SpecExample as SpecExample3 } from "@openpkg-ts/spec";
|
|
60
218
|
interface ExampleBlockProps {
|
|
61
219
|
/** Examples to display (string or SpecExample) */
|
|
62
|
-
examples: (string |
|
|
220
|
+
examples: (string | SpecExample3)[];
|
|
63
221
|
/** Custom className */
|
|
64
222
|
className?: string;
|
|
65
223
|
/** Custom example renderer */
|
|
66
|
-
renderExample?: (example: string |
|
|
224
|
+
renderExample?: (example: string | SpecExample3, index: number) => React.ReactNode;
|
|
67
225
|
}
|
|
68
226
|
/**
|
|
69
227
|
* Normalize example to string content.
|
|
70
228
|
*/
|
|
71
|
-
declare function getExampleCode(example: string |
|
|
229
|
+
declare function getExampleCode(example: string | SpecExample3): string;
|
|
72
230
|
/**
|
|
73
231
|
* Get example title if available.
|
|
74
232
|
*/
|
|
75
|
-
declare function getExampleTitle(example: string |
|
|
233
|
+
declare function getExampleTitle(example: string | SpecExample3): string | undefined;
|
|
76
234
|
/**
|
|
77
235
|
* Get example language.
|
|
78
236
|
*/
|
|
79
|
-
declare function getExampleLanguage(example: string |
|
|
237
|
+
declare function getExampleLanguage(example: string | SpecExample3): string;
|
|
80
238
|
/**
|
|
81
239
|
* Clean code by removing markdown fences.
|
|
82
240
|
*/
|
|
@@ -96,10 +254,10 @@ declare function cleanCode(code: string): string;
|
|
|
96
254
|
* ```
|
|
97
255
|
*/
|
|
98
256
|
declare function ExampleBlock({ examples, className, renderExample }: ExampleBlockProps): React.ReactNode;
|
|
99
|
-
import { SpecSchema as
|
|
257
|
+
import { SpecSchema as SpecSchema3, SpecSignatureParameter as SpecSignatureParameter3 } from "@openpkg-ts/spec";
|
|
100
258
|
interface ExpandablePropertyProps {
|
|
101
259
|
/** Parameter to display */
|
|
102
|
-
param:
|
|
260
|
+
param: SpecSignatureParameter3;
|
|
103
261
|
/** Nesting depth */
|
|
104
262
|
depth?: number;
|
|
105
263
|
/** Custom className */
|
|
@@ -109,7 +267,7 @@ interface NestedPropertyProps {
|
|
|
109
267
|
/** Property name */
|
|
110
268
|
name: string;
|
|
111
269
|
/** Property schema */
|
|
112
|
-
schema:
|
|
270
|
+
schema: SpecSchema3;
|
|
113
271
|
/** Is required */
|
|
114
272
|
required?: boolean;
|
|
115
273
|
/** Nesting depth */
|
|
@@ -128,30 +286,31 @@ declare function NestedProperty({ name, schema, required, depth }: NestedPropert
|
|
|
128
286
|
* ```
|
|
129
287
|
*/
|
|
130
288
|
declare function ExpandableProperty({ param, depth, className }: ExpandablePropertyProps): React.ReactNode;
|
|
131
|
-
|
|
289
|
+
type ExportKind = "function" | "type" | "variable" | "class" | "interface" | "enum";
|
|
290
|
+
import { SpecMember as SpecMember5 } from "@openpkg-ts/spec";
|
|
132
291
|
interface MembersTableProps {
|
|
133
292
|
/** Members to display */
|
|
134
|
-
members:
|
|
293
|
+
members: SpecMember5[];
|
|
135
294
|
/** Custom className */
|
|
136
295
|
className?: string;
|
|
137
296
|
/** Group by kind (constructor, property, method) */
|
|
138
297
|
groupByKind?: boolean;
|
|
139
298
|
/** Custom member renderer */
|
|
140
|
-
renderMember?: (member:
|
|
299
|
+
renderMember?: (member: SpecMember5, index: number) => React.ReactNode;
|
|
141
300
|
}
|
|
142
301
|
interface MemberGroups {
|
|
143
|
-
constructors:
|
|
144
|
-
properties:
|
|
145
|
-
methods:
|
|
146
|
-
accessors:
|
|
147
|
-
other:
|
|
302
|
+
constructors: SpecMember5[];
|
|
303
|
+
properties: SpecMember5[];
|
|
304
|
+
methods: SpecMember5[];
|
|
305
|
+
accessors: SpecMember5[];
|
|
306
|
+
other: SpecMember5[];
|
|
148
307
|
}
|
|
149
308
|
/**
|
|
150
309
|
* Group members by their kind.
|
|
151
310
|
*/
|
|
152
|
-
declare function groupMembersByKind(members:
|
|
311
|
+
declare function groupMembersByKind(members: SpecMember5[]): MemberGroups;
|
|
153
312
|
interface MemberRowProps {
|
|
154
|
-
member:
|
|
313
|
+
member: SpecMember5;
|
|
155
314
|
}
|
|
156
315
|
/**
|
|
157
316
|
* Individual member row.
|
|
@@ -166,19 +325,19 @@ declare function MemberRow({ member }: MemberRowProps): React.ReactNode;
|
|
|
166
325
|
* ```
|
|
167
326
|
*/
|
|
168
327
|
declare function MembersTable({ members, className, groupByKind, renderMember }: MembersTableProps): React.ReactNode;
|
|
169
|
-
import { SpecMember as
|
|
328
|
+
import { SpecMember as SpecMember6, SpecSignatureParameter as SpecSignatureParameter5 } from "@openpkg-ts/spec";
|
|
170
329
|
interface ParamTableProps {
|
|
171
330
|
/** Parameters or members to display */
|
|
172
|
-
items: (
|
|
331
|
+
items: (SpecSignatureParameter5 | SpecMember6)[];
|
|
173
332
|
/** Show required indicator */
|
|
174
333
|
showRequired?: boolean;
|
|
175
334
|
/** Custom className */
|
|
176
335
|
className?: string;
|
|
177
336
|
/** Render custom row */
|
|
178
|
-
renderRow?: (item:
|
|
337
|
+
renderRow?: (item: SpecSignatureParameter5 | SpecMember6, index: number) => React.ReactNode;
|
|
179
338
|
}
|
|
180
339
|
interface ParamRowProps {
|
|
181
|
-
item:
|
|
340
|
+
item: SpecSignatureParameter5 | SpecMember6;
|
|
182
341
|
showRequired?: boolean;
|
|
183
342
|
}
|
|
184
343
|
/**
|
|
@@ -200,10 +359,10 @@ declare function ParamRow({ item, showRequired }: ParamRowProps): React.ReactNod
|
|
|
200
359
|
* ```
|
|
201
360
|
*/
|
|
202
361
|
declare function ParamTable({ items, showRequired, className, renderRow }: ParamTableProps): React.ReactNode;
|
|
203
|
-
import { SpecExport as
|
|
362
|
+
import { SpecExport as SpecExport7 } from "@openpkg-ts/spec";
|
|
204
363
|
interface SignatureProps {
|
|
205
364
|
/** The to render signature for */
|
|
206
|
-
export:
|
|
365
|
+
export: SpecExport7;
|
|
207
366
|
/** Index of signature to render (for overloaded functions) */
|
|
208
367
|
signatureIndex?: number;
|
|
209
368
|
/** Custom className */
|
|
@@ -226,16 +385,16 @@ interface SignatureProps {
|
|
|
226
385
|
* ```
|
|
227
386
|
*/
|
|
228
387
|
declare function Signature({ export: exp, signatureIndex, className, children }: SignatureProps): React.ReactNode;
|
|
229
|
-
import { SpecMember as
|
|
388
|
+
import { SpecMember as SpecMember7, SpecSignatureParameter as SpecSignatureParameter6 } from "@openpkg-ts/spec";
|
|
230
389
|
interface TypeTableProps {
|
|
231
390
|
/** Members or parameters to display */
|
|
232
|
-
items: (
|
|
391
|
+
items: (SpecSignatureParameter6 | SpecMember7)[];
|
|
233
392
|
/** Show required indicator */
|
|
234
393
|
showRequired?: boolean;
|
|
235
394
|
/** Custom className */
|
|
236
395
|
className?: string;
|
|
237
396
|
/** Render custom row */
|
|
238
|
-
renderRow?: (item:
|
|
397
|
+
renderRow?: (item: SpecSignatureParameter6 | SpecMember7, index: number) => React.ReactNode;
|
|
239
398
|
}
|
|
240
399
|
/**
|
|
241
400
|
* Headless type table for displaying interface/type members.
|
|
@@ -246,14 +405,99 @@ interface TypeTableProps {
|
|
|
246
405
|
* ```
|
|
247
406
|
*/
|
|
248
407
|
declare function TypeTable({ items, showRequired, className, renderRow }: TypeTableProps): React.ReactNode;
|
|
249
|
-
type ExportKind = "function" | "type" | "variable" | "class" | "interface" | "enum";
|
|
250
408
|
import { CodeTab, CodeTabs, CodeTabsProps, ImportSection, ImportSectionProps } from "@openpkg-ts/ui/api";
|
|
251
|
-
import {
|
|
409
|
+
import { OpenPkg as OpenPkg8, SpecExample as SpecExample4, SpecExport as SpecExport9, SpecSchema as SpecSchema4, SpecSignatureParameter as SpecSignatureParameter7 } from "@openpkg-ts/spec";
|
|
410
|
+
interface MethodData {
|
|
411
|
+
/** Export data */
|
|
412
|
+
export: SpecExport9;
|
|
413
|
+
/** Method title (function name with parens) */
|
|
414
|
+
title: string;
|
|
415
|
+
/** Full signature string */
|
|
416
|
+
signature: string;
|
|
417
|
+
/** Description text */
|
|
418
|
+
description?: string;
|
|
419
|
+
/** Parameters from first signature */
|
|
420
|
+
parameters: SpecSignatureParameter7[];
|
|
421
|
+
/** Examples from or signature */
|
|
422
|
+
examples: SpecExample4[];
|
|
423
|
+
/** Return type schema */
|
|
424
|
+
returnType?: SpecSchema4;
|
|
425
|
+
/** Return type formatted */
|
|
426
|
+
returnTypeString?: string;
|
|
427
|
+
/** Return description */
|
|
428
|
+
returnDescription?: string;
|
|
429
|
+
/** Is async function */
|
|
430
|
+
isAsync?: boolean;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Extract method data from a spec export.
|
|
434
|
+
* Provides all data needed to render a MethodSection.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```tsx
|
|
438
|
+
* const method = useMethodFromSpec(spec, 'createClient');
|
|
439
|
+
* return (
|
|
440
|
+
* <MethodSection
|
|
441
|
+
* id={method.export.id}
|
|
442
|
+
* title={method.title}
|
|
443
|
+
* signature={method.signature}
|
|
444
|
+
* description={method.description}
|
|
445
|
+
* >
|
|
446
|
+
* {method.parameters.map(p => <ExpandableParameter parameter={p} />)}
|
|
447
|
+
* </MethodSection>
|
|
448
|
+
* );
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
declare function useMethodFromSpec(spec: OpenPkg8, exportName: string): MethodData | null;
|
|
452
|
+
/**
|
|
453
|
+
* Extract method data from all function exports.
|
|
454
|
+
*/
|
|
455
|
+
declare function useMethodsFromSpec(spec: OpenPkg8): MethodData[];
|
|
456
|
+
/**
|
|
457
|
+
* Pure function to extract method data from an export.
|
|
458
|
+
*/
|
|
459
|
+
declare function extractMethodData(exp: SpecExport9, _spec: OpenPkg8): MethodData;
|
|
460
|
+
import { DocsInstance } from "@openpkg-ts/sdk/browser";
|
|
461
|
+
import { OpenPkg as OpenPkg9 } from "@openpkg-ts/spec";
|
|
462
|
+
interface APIPageProps {
|
|
463
|
+
/** Direct spec object */
|
|
464
|
+
spec?: OpenPkg9;
|
|
465
|
+
/** Or docs instance from createDocs() */
|
|
466
|
+
instance?: DocsInstance;
|
|
467
|
+
/** Export ID to render, or undefined for index page */
|
|
468
|
+
id?: string;
|
|
469
|
+
/** Base href for index page links (required when id is undefined) */
|
|
470
|
+
baseHref?: string;
|
|
471
|
+
/** Description for index page */
|
|
472
|
+
description?: string;
|
|
473
|
+
/** Custom code example renderer */
|
|
474
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Main styled API page component that renders documentation.
|
|
478
|
+
*
|
|
479
|
+
* Renders either:
|
|
480
|
+
* - Index page (when id is undefined) showing all exports in a grid
|
|
481
|
+
* - Detail page (when id is provided) showing specific docs
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* ```tsx
|
|
485
|
+
* // Index mode - show all exports
|
|
486
|
+
* <APIPage spec={spec} baseHref="/docs/api" />
|
|
487
|
+
* ```
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```tsx
|
|
491
|
+
* // Detail mode - show specific * <APIPage spec={spec} id="createClient" />
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
494
|
+
declare function APIPage({ spec, instance, id, baseHref, description, renderExample }: APIPageProps): React.ReactNode;
|
|
495
|
+
import { ReactNode as ReactNode12 } from "react";
|
|
252
496
|
interface APIReferenceLayoutProps {
|
|
253
497
|
/** Left column content (documentation) */
|
|
254
|
-
children:
|
|
498
|
+
children: ReactNode12;
|
|
255
499
|
/** Right column content (code examples) */
|
|
256
|
-
examples:
|
|
500
|
+
examples: ReactNode12;
|
|
257
501
|
/** Custom className */
|
|
258
502
|
className?: string;
|
|
259
503
|
/** Left column width on desktop (default: 58%) */
|
|
@@ -274,279 +518,19 @@ interface APIReferenceLayoutProps {
|
|
|
274
518
|
* </APIReferenceLayout>
|
|
275
519
|
* ```
|
|
276
520
|
*/
|
|
277
|
-
declare function APIReferenceLayout({ children, examples, className, leftWidth, rightWidth }: APIReferenceLayoutProps):
|
|
278
|
-
import {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
registerSection: (id: string, ref: RefObject<HTMLElement | null>) => void;
|
|
284
|
-
/** Unregister a section */
|
|
285
|
-
unregisterSection: (id: string) => void;
|
|
286
|
-
/** Scroll right column to section */
|
|
287
|
-
scrollToSection: (id: string) => void;
|
|
288
|
-
/** Register the right column container */
|
|
289
|
-
registerRightColumn: (ref: RefObject<HTMLElement | null>) => void;
|
|
290
|
-
}
|
|
291
|
-
interface SyncScrollProviderProps {
|
|
292
|
-
children: ReactNode10;
|
|
293
|
-
/** Root margin for intersection observer (default: '-20% 0px -60% 0px') */
|
|
294
|
-
rootMargin?: string;
|
|
295
|
-
/** Scroll behavior (default: 'smooth') */
|
|
296
|
-
scrollBehavior?: ScrollBehavior;
|
|
521
|
+
declare function APIReferenceLayout({ children, examples, className, leftWidth, rightWidth }: APIReferenceLayoutProps): ReactNode12;
|
|
522
|
+
import { OpenPkg as OpenPkg10, SpecExport as SpecExport10 } from "@openpkg-ts/spec";
|
|
523
|
+
import { ReactNode as ReactNode13 } from "react";
|
|
524
|
+
interface ClassPageProps {
|
|
525
|
+
export: SpecExport10;
|
|
526
|
+
spec: OpenPkg10;
|
|
297
527
|
}
|
|
298
528
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* and auto-scrolls the right column to matching examples.
|
|
302
|
-
*
|
|
303
|
-
* @example
|
|
304
|
-
* ```tsx
|
|
305
|
-
* <SyncScrollProvider>
|
|
306
|
-
* <APIReferenceLayout
|
|
307
|
-
* examples={
|
|
308
|
-
* <>
|
|
309
|
-
* <ExampleSection id="select" ... />
|
|
310
|
-
* <ExampleSection id="insert" ... />
|
|
311
|
-
* </>
|
|
312
|
-
* }
|
|
313
|
-
* >
|
|
314
|
-
* <MethodSection id="select" ... />
|
|
315
|
-
* <MethodSection id="insert" ... />
|
|
316
|
-
* </APIReferenceLayout>
|
|
317
|
-
* </SyncScrollProvider>
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
|
-
declare function SyncScrollProvider({ children, rootMargin, scrollBehavior }: SyncScrollProviderProps): ReactNode10;
|
|
321
|
-
/**
|
|
322
|
-
* Hook to access sync scroll context.
|
|
323
|
-
*/
|
|
324
|
-
declare function useSyncScroll(): SyncScrollContextValue;
|
|
325
|
-
/**
|
|
326
|
-
* Hook to register a section for scroll tracking.
|
|
327
|
-
*/
|
|
328
|
-
declare function useSyncSection(id: string): RefObject<HTMLElement | null>;
|
|
329
|
-
import { ReactNode as ReactNode11 } from "react";
|
|
330
|
-
interface MethodSectionProps {
|
|
331
|
-
/** Section ID for scroll sync */
|
|
332
|
-
id: string;
|
|
333
|
-
/** Method title (e.g., "Fetch data") */
|
|
334
|
-
title: string;
|
|
335
|
-
/** Method signature (e.g., "select(columns?, options?)") */
|
|
336
|
-
signature?: string;
|
|
337
|
-
/** Method description */
|
|
338
|
-
description?: ReactNode11;
|
|
339
|
-
/** Bullet list notes */
|
|
340
|
-
notes?: string[];
|
|
341
|
-
/** Parameter content */
|
|
342
|
-
children?: ReactNode11;
|
|
343
|
-
/** Custom className */
|
|
344
|
-
className?: string;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Container for a single API method in the documentation.
|
|
348
|
-
* Renders title, signature, description, notes list, and parameters.
|
|
349
|
-
*
|
|
350
|
-
* @example
|
|
351
|
-
* ```tsx
|
|
352
|
-
* <MethodSection
|
|
353
|
-
* id="select"
|
|
354
|
-
* title="Fetch data"
|
|
355
|
-
* signature="select(columns?, options?)"
|
|
356
|
-
* description="Performs a SELECT query..."
|
|
357
|
-
* notes={['By default, returns all columns', 'Use .single() for one row']}
|
|
358
|
-
* >
|
|
359
|
-
* <ParameterItem ... />
|
|
360
|
-
* </MethodSection>
|
|
361
|
-
* ```
|
|
362
|
-
*/
|
|
363
|
-
declare function MethodSection({ id, title, signature, description, notes, children, className }: MethodSectionProps): ReactNode11;
|
|
364
|
-
import { ReactNode as ReactNode12 } from "react";
|
|
365
|
-
interface APIParameterItemProps {
|
|
366
|
-
/** Parameter name */
|
|
367
|
-
name: string;
|
|
368
|
-
/** Parent path prefix (e.g., "options." for nested) */
|
|
369
|
-
parentPath?: string;
|
|
370
|
-
/** Parameter type */
|
|
371
|
-
type: string;
|
|
372
|
-
/** Required parameter */
|
|
373
|
-
required?: boolean;
|
|
374
|
-
/** Optional parameter (explicit) */
|
|
375
|
-
optional?: boolean;
|
|
376
|
-
/** Has expandable children */
|
|
377
|
-
expandable?: boolean;
|
|
378
|
-
/** Description */
|
|
379
|
-
description?: ReactNode12;
|
|
380
|
-
/** Nested content (params or enum) */
|
|
381
|
-
children?: ReactNode12;
|
|
382
|
-
/** Anchor ID for deep linking */
|
|
383
|
-
anchorId?: string;
|
|
384
|
-
/** Show anchor link on hover */
|
|
385
|
-
showAnchor?: boolean;
|
|
386
|
-
/** Custom className */
|
|
387
|
-
className?: string;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Single parameter row in Stripe-style documentation.
|
|
391
|
-
* Displays name, type, badges, description, and optional nested content.
|
|
392
|
-
*
|
|
393
|
-
* @example
|
|
394
|
-
* ```tsx
|
|
395
|
-
* <APIParameterItem
|
|
396
|
-
* name="email"
|
|
397
|
-
* type="string"
|
|
398
|
-
* required
|
|
399
|
-
* description="User's email address"
|
|
400
|
-
* />
|
|
401
|
-
* ```
|
|
402
|
-
*/
|
|
403
|
-
declare function APIParameterItem({ name, parentPath, type, required, optional, expandable, description, children, anchorId, showAnchor, className }: APIParameterItemProps): ReactNode12;
|
|
404
|
-
import { ReactNode as ReactNode13 } from "react";
|
|
405
|
-
interface NestedParameterToggleProps {
|
|
406
|
-
/** Toggle state */
|
|
407
|
-
expanded: boolean;
|
|
408
|
-
/** Toggle callback */
|
|
409
|
-
onToggle: () => void;
|
|
410
|
-
/** Optional child count to display */
|
|
411
|
-
count?: number;
|
|
412
|
-
/** Custom className */
|
|
413
|
-
className?: string;
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* "Show/Hide child parameters" toggle button (Stripe-style).
|
|
417
|
-
* Plus icon rotates 45deg when expanded.
|
|
418
|
-
* When expanded, bottom border-radius removed to connect with container.
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* ```tsx
|
|
422
|
-
* <NestedParameterToggle
|
|
423
|
-
* expanded={isOpen}
|
|
424
|
-
* onToggle={() => setIsOpen(!isOpen)}
|
|
425
|
-
* count={3}
|
|
426
|
-
* />
|
|
427
|
-
* ```
|
|
529
|
+
* Stripe-style class page with two-column layout.
|
|
530
|
+
* Left: constructor, methods, properties. Right: sticky code examples.
|
|
428
531
|
*/
|
|
429
|
-
declare function
|
|
532
|
+
declare function ClassPage({ export: exp, spec }: ClassPageProps): ReactNode13;
|
|
430
533
|
import { ReactNode as ReactNode14 } from "react";
|
|
431
|
-
interface NestedParameterContainerProps {
|
|
432
|
-
/** Nested parameter content */
|
|
433
|
-
children: ReactNode14;
|
|
434
|
-
/** Nesting depth level (0 = first level) */
|
|
435
|
-
level?: number;
|
|
436
|
-
/** Custom className */
|
|
437
|
-
className?: string;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Bordered container for nested child parameters (Stripe-style).
|
|
441
|
-
* Connects to NestedParameterToggle above (no top border).
|
|
442
|
-
* Children separated by border-bottom only.
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
* ```tsx
|
|
446
|
-
* <NestedParameterToggle expanded={isOpen} onToggle={toggle} />
|
|
447
|
-
* {isOpen && (
|
|
448
|
-
* <NestedParameterContainer>
|
|
449
|
-
* <APIParameterItem name="city" type="string" />
|
|
450
|
-
* <APIParameterItem name="country" type="string" />
|
|
451
|
-
* </NestedParameterContainer>
|
|
452
|
-
* )}
|
|
453
|
-
* ```
|
|
454
|
-
*/
|
|
455
|
-
declare function NestedParameterContainer({ children, level, className }: NestedParameterContainerProps): ReactNode14;
|
|
456
|
-
import { SpecSignatureParameter as SpecSignatureParameter6 } from "@openpkg-ts/spec";
|
|
457
|
-
import { ReactNode as ReactNode15 } from "react";
|
|
458
|
-
interface ExpandableParameterProps {
|
|
459
|
-
/** Parameter from spec */
|
|
460
|
-
parameter: SpecSignatureParameter6;
|
|
461
|
-
/** Parent path prefix */
|
|
462
|
-
parentPath?: string;
|
|
463
|
-
/** Default expanded state */
|
|
464
|
-
defaultExpanded?: boolean;
|
|
465
|
-
/** Controlled expanded state */
|
|
466
|
-
expanded?: boolean;
|
|
467
|
-
/** Controlled onChange */
|
|
468
|
-
onExpandedChange?: (expanded: boolean) => void;
|
|
469
|
-
/** Nesting depth */
|
|
470
|
-
level?: number;
|
|
471
|
-
/** Custom className */
|
|
472
|
-
className?: string;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Compound component combining APIParameterItem + NestedParameterToggle + NestedParameterContainer.
|
|
476
|
-
* Automatically extracts nested object properties and enum values from spec schema.
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* ```tsx
|
|
480
|
-
* <ExpandableParameter parameter={addressParam} />
|
|
481
|
-
* ```
|
|
482
|
-
*/
|
|
483
|
-
declare function ExpandableParameter({ parameter, parentPath, defaultExpanded, expanded: controlledExpanded, onExpandedChange, level, className }: ExpandableParameterProps): ReactNode15;
|
|
484
|
-
import { ReactNode as ReactNode16 } from "react";
|
|
485
|
-
interface EnumValue {
|
|
486
|
-
/** Enum value */
|
|
487
|
-
value: string;
|
|
488
|
-
/** Optional description */
|
|
489
|
-
description?: string;
|
|
490
|
-
}
|
|
491
|
-
interface EnumValuesSectionProps {
|
|
492
|
-
/** Enum values to display */
|
|
493
|
-
values: EnumValue[];
|
|
494
|
-
/** Section header (default: "Possible values") */
|
|
495
|
-
header?: string;
|
|
496
|
-
/** Custom className */
|
|
497
|
-
className?: string;
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Enum values section showing possible values with optional descriptions.
|
|
501
|
-
* Used inside parameter items to show enum options.
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```tsx
|
|
505
|
-
* <EnumValuesSection
|
|
506
|
-
* values={[
|
|
507
|
-
* { value: 'light', description: 'Light theme' },
|
|
508
|
-
* { value: 'dark', description: 'Dark theme' },
|
|
509
|
-
* { value: 'system', description: 'Follow system preference' },
|
|
510
|
-
* ]}
|
|
511
|
-
* />
|
|
512
|
-
* ```
|
|
513
|
-
*/
|
|
514
|
-
declare function EnumValuesSection({ values, header, className }: EnumValuesSectionProps): ReactNode16;
|
|
515
|
-
import { ReactNode as ReactNode17 } from "react";
|
|
516
|
-
interface ExampleChip {
|
|
517
|
-
/** Unique identifier */
|
|
518
|
-
id: string;
|
|
519
|
-
/** Display label */
|
|
520
|
-
label: string;
|
|
521
|
-
}
|
|
522
|
-
interface ExampleChipsProps {
|
|
523
|
-
/** Available examples */
|
|
524
|
-
examples: ExampleChip[];
|
|
525
|
-
/** Currently active example ID */
|
|
526
|
-
activeId: string;
|
|
527
|
-
/** Selection callback */
|
|
528
|
-
onSelect: (id: string) => void;
|
|
529
|
-
/** Custom className */
|
|
530
|
-
className?: string;
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Tab-like chips for switching between code examples.
|
|
534
|
-
* Used in the right column to select different example variations.
|
|
535
|
-
*
|
|
536
|
-
* @example
|
|
537
|
-
* ```tsx
|
|
538
|
-
* <ExampleChips
|
|
539
|
-
* examples={[
|
|
540
|
-
* { id: 'basic', label: 'Basic' },
|
|
541
|
-
* { id: 'with-filter', label: 'With filter' },
|
|
542
|
-
* ]}
|
|
543
|
-
* activeId="basic"
|
|
544
|
-
* onSelect={setActiveExample}
|
|
545
|
-
* />
|
|
546
|
-
* ```
|
|
547
|
-
*/
|
|
548
|
-
declare function ExampleChips({ examples, activeId, onSelect, className }: ExampleChipsProps): ReactNode17;
|
|
549
|
-
import { ReactNode as ReactNode18 } from "react";
|
|
550
534
|
interface CodePanelProps {
|
|
551
535
|
/** Code content */
|
|
552
536
|
code: string;
|
|
@@ -570,13 +554,13 @@ interface CodePanelProps {
|
|
|
570
554
|
* />
|
|
571
555
|
* ```
|
|
572
556
|
*/
|
|
573
|
-
declare function CodePanel({ code, language, showLineNumbers, className }: CodePanelProps):
|
|
574
|
-
import { ReactNode as
|
|
557
|
+
declare function CodePanel({ code, language, showLineNumbers, className }: CodePanelProps): ReactNode14;
|
|
558
|
+
import { ReactNode as ReactNode15 } from "react";
|
|
575
559
|
interface CollapsiblePanelProps {
|
|
576
560
|
/** Panel title (e.g., "Response", "Data source") */
|
|
577
561
|
title: string;
|
|
578
562
|
/** Panel content */
|
|
579
|
-
children:
|
|
563
|
+
children: ReactNode15;
|
|
580
564
|
/** Default expanded state */
|
|
581
565
|
defaultExpanded?: boolean;
|
|
582
566
|
/** Controlled expanded state */
|
|
@@ -597,243 +581,79 @@ interface CollapsiblePanelProps {
|
|
|
597
581
|
* </CollapsiblePanel>
|
|
598
582
|
* ```
|
|
599
583
|
*/
|
|
600
|
-
declare function CollapsiblePanel({ title, children, defaultExpanded, expanded: controlledExpanded, onExpandedChange, className }: CollapsiblePanelProps):
|
|
601
|
-
import {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
id: string;
|
|
605
|
-
/** Display label for chip */
|
|
606
|
-
label: string;
|
|
607
|
-
/** Code content */
|
|
608
|
-
code: string;
|
|
609
|
-
/** Language for highlighting */
|
|
610
|
-
language?: string;
|
|
611
|
-
}
|
|
612
|
-
interface ExampleSectionProps {
|
|
613
|
-
/** Section ID for sync scroll */
|
|
614
|
-
id: string;
|
|
615
|
-
/** Code examples to display */
|
|
616
|
-
examples: CodeExample2[];
|
|
617
|
-
/** Data source code (SQL/schema) */
|
|
618
|
-
dataSource?: string;
|
|
619
|
-
/** Response JSON */
|
|
620
|
-
response?: string;
|
|
621
|
-
/** Notes text */
|
|
622
|
-
notes?: ReactNode20;
|
|
623
|
-
/** Custom className */
|
|
624
|
-
className?: string;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Complete right-column section combining chips, code, and collapsible panels.
|
|
628
|
-
* Integrates with SyncScrollProvider for synchronized scrolling.
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* ```tsx
|
|
632
|
-
* <ExampleSection
|
|
633
|
-
* id="select"
|
|
634
|
-
* examples={[
|
|
635
|
-
* { id: 'basic', label: 'Basic', code: '...', language: 'typescript' },
|
|
636
|
-
* { id: 'filter', label: 'With filter', code: '...', language: 'typescript' },
|
|
637
|
-
* ]}
|
|
638
|
-
* response={`{ "data": [...] }`}
|
|
639
|
-
* notes="Returns all columns by default."
|
|
640
|
-
* />
|
|
641
|
-
* ```
|
|
642
|
-
*/
|
|
643
|
-
declare function ExampleSection({ id, examples, dataSource, response, notes, className }: ExampleSectionProps): ReactNode20;
|
|
644
|
-
import { OpenPkg as OpenPkg8, SpecExport as SpecExport9 } from "@openpkg-ts/spec";
|
|
645
|
-
import { ReactNode as ReactNode21 } from "react";
|
|
646
|
-
interface MethodSectionFromSpecProps {
|
|
647
|
-
/** OpenPkg spec */
|
|
648
|
-
spec: OpenPkg8;
|
|
649
|
-
/** Export to render (by name or object) */
|
|
650
|
-
export: string | SpecExport9;
|
|
651
|
-
/** Custom className */
|
|
652
|
-
className?: string;
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Auto-generates MethodSection from spec data.
|
|
656
|
-
* Extracts parameters, description, and notes from the export.
|
|
657
|
-
*
|
|
658
|
-
* @example
|
|
659
|
-
* ```tsx
|
|
660
|
-
* <MethodSectionFromSpec spec={spec} export="createClient" />
|
|
661
|
-
* ```
|
|
662
|
-
*/
|
|
663
|
-
declare function MethodSectionFromSpec({ spec, export: exportProp, className }: MethodSectionFromSpecProps): ReactNode21;
|
|
664
|
-
import { OpenPkg as OpenPkg9, SpecExport as SpecExport10 } from "@openpkg-ts/spec";
|
|
665
|
-
import { ReactNode as ReactNode22 } from "react";
|
|
666
|
-
interface StripeAPIReferencePageProps {
|
|
667
|
-
/** OpenPkg spec */
|
|
668
|
-
spec: OpenPkg9;
|
|
669
|
-
/** Filter exports (default: functions only) */
|
|
670
|
-
filter?: (exp: SpecExport10) => boolean;
|
|
671
|
-
/** Show all kinds, not just functions */
|
|
672
|
-
showAllKinds?: boolean;
|
|
673
|
-
/** Custom className */
|
|
674
|
-
className?: string;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Full Stripe/Supabase-style API reference page.
|
|
678
|
-
* Two-column layout with synchronized scrolling.
|
|
679
|
-
*
|
|
680
|
-
* @example
|
|
681
|
-
* ```tsx
|
|
682
|
-
* <StripeAPIReferencePage spec={spec} />
|
|
683
|
-
* ```
|
|
684
|
-
*/
|
|
685
|
-
declare function StripeAPIReferencePage({ spec, filter, showAllKinds, className }: StripeAPIReferencePageProps): ReactNode22;
|
|
686
|
-
import { OpenPkg as OpenPkg10, SpecExample as SpecExample3, SpecExport as SpecExport11, SpecSchema as SpecSchema3, SpecSignatureParameter as SpecSignatureParameter7 } from "@openpkg-ts/spec";
|
|
687
|
-
interface MethodData {
|
|
688
|
-
/** Export data */
|
|
584
|
+
declare function CollapsiblePanel({ title, children, defaultExpanded, expanded: controlledExpanded, onExpandedChange, className }: CollapsiblePanelProps): ReactNode15;
|
|
585
|
+
import { OpenPkg as OpenPkg11, SpecExport as SpecExport11 } from "@openpkg-ts/spec";
|
|
586
|
+
import { ReactNode as ReactNode16 } from "react";
|
|
587
|
+
interface EnumPageProps {
|
|
689
588
|
export: SpecExport11;
|
|
690
|
-
|
|
691
|
-
title: string;
|
|
692
|
-
/** Full signature string */
|
|
693
|
-
signature: string;
|
|
694
|
-
/** Description text */
|
|
695
|
-
description?: string;
|
|
696
|
-
/** Parameters from first signature */
|
|
697
|
-
parameters: SpecSignatureParameter7[];
|
|
698
|
-
/** Examples from or signature */
|
|
699
|
-
examples: SpecExample3[];
|
|
700
|
-
/** Return type schema */
|
|
701
|
-
returnType?: SpecSchema3;
|
|
702
|
-
/** Return type formatted */
|
|
703
|
-
returnTypeString?: string;
|
|
704
|
-
/** Return description */
|
|
705
|
-
returnDescription?: string;
|
|
706
|
-
/** Is async function */
|
|
707
|
-
isAsync?: boolean;
|
|
589
|
+
spec: OpenPkg11;
|
|
708
590
|
}
|
|
709
591
|
/**
|
|
710
|
-
*
|
|
711
|
-
* Provides all data needed to render a MethodSection.
|
|
712
|
-
*
|
|
713
|
-
* @example
|
|
714
|
-
* ```tsx
|
|
715
|
-
* const method = useMethodFromSpec(spec, 'createClient');
|
|
716
|
-
* return (
|
|
717
|
-
* <MethodSection
|
|
718
|
-
* id={method.export.id}
|
|
719
|
-
* title={method.title}
|
|
720
|
-
* signature={method.signature}
|
|
721
|
-
* description={method.description}
|
|
722
|
-
* >
|
|
723
|
-
* {method.parameters.map(p => <ExpandableParameter parameter={p} />)}
|
|
724
|
-
* </MethodSection>
|
|
725
|
-
* );
|
|
726
|
-
* ```
|
|
727
|
-
*/
|
|
728
|
-
declare function useMethodFromSpec(spec: OpenPkg10, exportName: string): MethodData | null;
|
|
729
|
-
/**
|
|
730
|
-
* Extract method data from all function exports.
|
|
731
|
-
*/
|
|
732
|
-
declare function useMethodsFromSpec(spec: OpenPkg10): MethodData[];
|
|
733
|
-
/**
|
|
734
|
-
* Pure function to extract method data from an export.
|
|
735
|
-
*/
|
|
736
|
-
declare function extractMethodData(exp: SpecExport11, _spec: OpenPkg10): MethodData;
|
|
737
|
-
import { SpecSchema as SpecSchema4, SpecSignatureParameter as SpecSignatureParameter8 } from "@openpkg-ts/spec";
|
|
738
|
-
interface NestedParameterData extends Omit<APIParameterItemProps, "children"> {
|
|
739
|
-
/** Child parameters (for objects) */
|
|
740
|
-
children?: NestedParameterData[];
|
|
741
|
-
/** Enum values (for enums) */
|
|
742
|
-
enumValues?: EnumValue[];
|
|
743
|
-
/** Original schema */
|
|
744
|
-
schema: SpecSchema4;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Convert a SpecSignatureParameter to nested parameter data.
|
|
748
|
-
* Recursively processes object properties and extracts enum values.
|
|
749
|
-
*
|
|
750
|
-
* @example
|
|
751
|
-
* ```tsx
|
|
752
|
-
* const paramData = specParamToNestedParam(param);
|
|
753
|
-
* return <APIParameterItem {...paramData} />;
|
|
754
|
-
* ```
|
|
755
|
-
*/
|
|
756
|
-
declare function specParamToNestedParam(param: SpecSignatureParameter8, parentPath?: string): NestedParameterData;
|
|
757
|
-
/**
|
|
758
|
-
* Convert multiple parameters to nested parameter data.
|
|
759
|
-
*/
|
|
760
|
-
declare function specParamsToNestedParams(params: SpecSignatureParameter8[]): NestedParameterData[];
|
|
761
|
-
/**
|
|
762
|
-
* Resolve a $ref in the schema against spec types.
|
|
763
|
-
* Returns the resolved schema or the original if not found.
|
|
764
|
-
*/
|
|
765
|
-
declare function resolveSchemaRef(schema: SpecSchema4, types: Record<string, SpecSchema4>): SpecSchema4;
|
|
766
|
-
import { SpecExample as SpecExample4 } from "@openpkg-ts/spec";
|
|
767
|
-
/**
|
|
768
|
-
* Convert a SpecExample to CodeExample props for ExampleSection.
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```tsx
|
|
772
|
-
* const examples = spec.examples?.map(specExampleToCodeExample) ?? [];
|
|
773
|
-
* return <ExampleSection examples={examples} />;
|
|
774
|
-
* ```
|
|
775
|
-
*/
|
|
776
|
-
declare function specExampleToCodeExample(example: SpecExample4 | string, index: number): CodeExample2;
|
|
777
|
-
/**
|
|
778
|
-
* Generate a default code example from function signature.
|
|
592
|
+
* Stripe-style enum page with two-column layout.
|
|
779
593
|
*/
|
|
780
|
-
declare function
|
|
781
|
-
import {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
594
|
+
declare function EnumPage({ export: exp, spec }: EnumPageProps): ReactNode16;
|
|
595
|
+
import { ReactNode as ReactNode17 } from "react";
|
|
596
|
+
interface ExampleChip {
|
|
597
|
+
/** Unique identifier */
|
|
598
|
+
id: string;
|
|
599
|
+
/** Display label */
|
|
600
|
+
label: string;
|
|
601
|
+
}
|
|
602
|
+
interface ExampleChipsProps {
|
|
603
|
+
/** Available examples */
|
|
604
|
+
examples: ExampleChip[];
|
|
605
|
+
/** Currently active example ID */
|
|
606
|
+
activeId: string;
|
|
607
|
+
/** Selection callback */
|
|
608
|
+
onSelect: (id: string) => void;
|
|
609
|
+
/** Custom className */
|
|
610
|
+
className?: string;
|
|
796
611
|
}
|
|
797
612
|
/**
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
* Renders either:
|
|
801
|
-
* - Index page (when id is undefined) showing all exports in a grid
|
|
802
|
-
* - Detail page (when id is provided) showing specific docs
|
|
613
|
+
* Tab-like chips for switching between code examples.
|
|
614
|
+
* Used in the right column to select different example variations.
|
|
803
615
|
*
|
|
804
616
|
* @example
|
|
805
617
|
* ```tsx
|
|
806
|
-
*
|
|
807
|
-
*
|
|
618
|
+
* <ExampleChips
|
|
619
|
+
* examples={[
|
|
620
|
+
* { id: 'basic', label: 'Basic' },
|
|
621
|
+
* { id: 'with-filter', label: 'With filter' },
|
|
622
|
+
* ]}
|
|
623
|
+
* activeId="basic"
|
|
624
|
+
* onSelect={setActiveExample}
|
|
625
|
+
* />
|
|
808
626
|
* ```
|
|
627
|
+
*/
|
|
628
|
+
declare function ExampleChips({ examples, activeId, onSelect, className }: ExampleChipsProps): ReactNode17;
|
|
629
|
+
import { SpecSignatureParameter as SpecSignatureParameter8 } from "@openpkg-ts/spec";
|
|
630
|
+
import { ReactNode as ReactNode18 } from "react";
|
|
631
|
+
interface ExpandableParameterProps {
|
|
632
|
+
/** Parameter from spec */
|
|
633
|
+
parameter: SpecSignatureParameter8;
|
|
634
|
+
/** Parent path prefix */
|
|
635
|
+
parentPath?: string;
|
|
636
|
+
/** Default expanded state */
|
|
637
|
+
defaultExpanded?: boolean;
|
|
638
|
+
/** Controlled expanded state */
|
|
639
|
+
expanded?: boolean;
|
|
640
|
+
/** Controlled onChange */
|
|
641
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
642
|
+
/** Nesting depth */
|
|
643
|
+
level?: number;
|
|
644
|
+
/** Custom className */
|
|
645
|
+
className?: string;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Compound component combining APIParameterItem + NestedParameterToggle + NestedParameterContainer.
|
|
649
|
+
* Automatically extracts nested object properties and enum values from spec schema.
|
|
809
650
|
*
|
|
810
651
|
* @example
|
|
811
652
|
* ```tsx
|
|
812
|
-
*
|
|
653
|
+
* <ExpandableParameter parameter={addressParam} />
|
|
813
654
|
* ```
|
|
814
655
|
*/
|
|
815
|
-
declare function
|
|
816
|
-
import { OpenPkg as OpenPkg12, SpecExport as SpecExport12 } from "@openpkg-ts/spec";
|
|
817
|
-
import { ReactNode as ReactNode23 } from "react";
|
|
818
|
-
interface ClassPageProps {
|
|
819
|
-
export: SpecExport12;
|
|
820
|
-
spec: OpenPkg12;
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* Stripe-style class page with two-column layout.
|
|
824
|
-
* Left: constructor, methods, properties. Right: sticky code examples.
|
|
825
|
-
*/
|
|
826
|
-
declare function ClassPage({ export: exp, spec }: ClassPageProps): ReactNode23;
|
|
827
|
-
import { OpenPkg as OpenPkg13, SpecExport as SpecExport13 } from "@openpkg-ts/spec";
|
|
828
|
-
import { ReactNode as ReactNode24 } from "react";
|
|
829
|
-
interface EnumPageProps {
|
|
830
|
-
export: SpecExport13;
|
|
831
|
-
spec: OpenPkg13;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Stripe-style enum page with two-column layout.
|
|
835
|
-
*/
|
|
836
|
-
declare function EnumPage({ export: exp, spec }: EnumPageProps): ReactNode24;
|
|
656
|
+
declare function ExpandableParameter({ parameter, parentPath, defaultExpanded, expanded: controlledExpanded, onExpandedChange, level, className }: ExpandableParameterProps): ReactNode18;
|
|
837
657
|
interface ExportCardProps2 {
|
|
838
658
|
/** Function/name */
|
|
839
659
|
name: string;
|
|
@@ -851,11 +671,11 @@ interface ExportCardProps2 {
|
|
|
851
671
|
* Features function name styling, description, and hover effects.
|
|
852
672
|
*/
|
|
853
673
|
declare function ExportCard2({ name, description, href, kind, className }: ExportCardProps2): React.ReactNode;
|
|
854
|
-
import { OpenPkg as
|
|
855
|
-
import { ReactNode as
|
|
674
|
+
import { OpenPkg as OpenPkg12 } from "@openpkg-ts/spec";
|
|
675
|
+
import { ReactNode as ReactNode19 } from "react";
|
|
856
676
|
interface ExportIndexPageProps2 {
|
|
857
677
|
/** OpenPkg spec */
|
|
858
|
-
spec:
|
|
678
|
+
spec: OpenPkg12;
|
|
859
679
|
/** Base href for links (e.g., '/docs/api') */
|
|
860
680
|
baseHref: string;
|
|
861
681
|
/** Optional intro description */
|
|
@@ -871,12 +691,12 @@ interface ExportIndexPageProps2 {
|
|
|
871
691
|
* Index page showing all exports in a grid, grouped by category.
|
|
872
692
|
* AI SDK-style clean layout with responsive 2-column grid.
|
|
873
693
|
*/
|
|
874
|
-
declare function ExportIndexPage2({ spec, baseHref, description, className, showSearch, showFilters }: ExportIndexPageProps2):
|
|
875
|
-
import { OpenPkg as
|
|
876
|
-
import { ReactNode as
|
|
694
|
+
declare function ExportIndexPage2({ spec, baseHref, description, className, showSearch, showFilters }: ExportIndexPageProps2): ReactNode19;
|
|
695
|
+
import { OpenPkg as OpenPkg13, SpecExportKind } from "@openpkg-ts/spec";
|
|
696
|
+
import { ReactNode as ReactNode20 } from "react";
|
|
877
697
|
interface FullAPIReferencePageProps {
|
|
878
698
|
/** OpenPkg spec */
|
|
879
|
-
spec:
|
|
699
|
+
spec: OpenPkg13;
|
|
880
700
|
/** Filter to specific kinds (default: all) */
|
|
881
701
|
kinds?: SpecExportKind[];
|
|
882
702
|
/** Show kind filter buttons (default: true) */
|
|
@@ -886,7 +706,7 @@ interface FullAPIReferencePageProps {
|
|
|
886
706
|
/** Custom title (default: spec.meta.name) */
|
|
887
707
|
title?: string;
|
|
888
708
|
/** Custom description */
|
|
889
|
-
description?:
|
|
709
|
+
description?: ReactNode20;
|
|
890
710
|
/** Custom className */
|
|
891
711
|
className?: string;
|
|
892
712
|
}
|
|
@@ -906,29 +726,136 @@ interface FullAPIReferencePageProps {
|
|
|
906
726
|
* <FullAPIReferencePage spec={spec} kinds={['function']} title="Functions" />
|
|
907
727
|
* ```
|
|
908
728
|
*/
|
|
909
|
-
declare function FullAPIReferencePage({ spec, kinds, showFilters, showTOC, title, description, className }: FullAPIReferencePageProps):
|
|
910
|
-
import { OpenPkg as
|
|
911
|
-
import { ReactNode as
|
|
729
|
+
declare function FullAPIReferencePage({ spec, kinds, showFilters, showTOC, title, description, className }: FullAPIReferencePageProps): ReactNode20;
|
|
730
|
+
import { OpenPkg as OpenPkg14, SpecExport as SpecExport12 } from "@openpkg-ts/spec";
|
|
731
|
+
import { ReactNode as ReactNode21 } from "react";
|
|
912
732
|
interface FunctionPageProps {
|
|
913
|
-
export:
|
|
914
|
-
spec:
|
|
733
|
+
export: SpecExport12;
|
|
734
|
+
spec: OpenPkg14;
|
|
915
735
|
}
|
|
916
736
|
/**
|
|
917
737
|
* Stripe-style function page with two-column layout.
|
|
918
738
|
* Left: parameters, returns. Right: sticky code examples.
|
|
919
739
|
*/
|
|
920
|
-
declare function FunctionPage({ export: exp, spec }: FunctionPageProps):
|
|
921
|
-
import { OpenPkg as
|
|
922
|
-
import { ReactNode as
|
|
740
|
+
declare function FunctionPage({ export: exp, spec }: FunctionPageProps): ReactNode21;
|
|
741
|
+
import { OpenPkg as OpenPkg15, SpecExport as SpecExport13 } from "@openpkg-ts/spec";
|
|
742
|
+
import { ReactNode as ReactNode22 } from "react";
|
|
923
743
|
interface InterfacePageProps {
|
|
924
|
-
export:
|
|
925
|
-
spec:
|
|
744
|
+
export: SpecExport13;
|
|
745
|
+
spec: OpenPkg15;
|
|
926
746
|
}
|
|
927
747
|
/**
|
|
928
748
|
* Stripe-style interface/type page with two-column layout.
|
|
929
749
|
* Left: properties, methods. Right: sticky code examples.
|
|
930
750
|
*/
|
|
931
|
-
declare function InterfacePage({ export: exp, spec }: InterfacePageProps):
|
|
751
|
+
declare function InterfacePage({ export: exp, spec }: InterfacePageProps): ReactNode22;
|
|
752
|
+
import { ReactNode as ReactNode23 } from "react";
|
|
753
|
+
interface MethodSectionProps {
|
|
754
|
+
/** Section ID for scroll sync */
|
|
755
|
+
id: string;
|
|
756
|
+
/** Method title (e.g., "Fetch data") */
|
|
757
|
+
title: string;
|
|
758
|
+
/** Method signature (e.g., "select(columns?, options?)") */
|
|
759
|
+
signature?: string;
|
|
760
|
+
/** Method description */
|
|
761
|
+
description?: ReactNode23;
|
|
762
|
+
/** Bullet list notes */
|
|
763
|
+
notes?: string[];
|
|
764
|
+
/** Parameter content */
|
|
765
|
+
children?: ReactNode23;
|
|
766
|
+
/** Custom className */
|
|
767
|
+
className?: string;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Container for a single API method in the documentation.
|
|
771
|
+
* Renders title, signature, description, notes list, and parameters.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```tsx
|
|
775
|
+
* <MethodSection
|
|
776
|
+
* id="select"
|
|
777
|
+
* title="Fetch data"
|
|
778
|
+
* signature="select(columns?, options?)"
|
|
779
|
+
* description="Performs a SELECT query..."
|
|
780
|
+
* notes={['By default, returns all columns', 'Use .single() for one row']}
|
|
781
|
+
* >
|
|
782
|
+
* <ParameterItem ... />
|
|
783
|
+
* </MethodSection>
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
declare function MethodSection({ id, title, signature, description, notes, children, className }: MethodSectionProps): ReactNode23;
|
|
787
|
+
import { OpenPkg as OpenPkg16, SpecExport as SpecExport14 } from "@openpkg-ts/spec";
|
|
788
|
+
import { ReactNode as ReactNode24 } from "react";
|
|
789
|
+
interface MethodSectionFromSpecProps {
|
|
790
|
+
/** OpenPkg spec */
|
|
791
|
+
spec: OpenPkg16;
|
|
792
|
+
/** Export to render (by name or object) */
|
|
793
|
+
export: string | SpecExport14;
|
|
794
|
+
/** Custom className */
|
|
795
|
+
className?: string;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Auto-generates MethodSection from spec data.
|
|
799
|
+
* Extracts parameters, description, and notes from the export.
|
|
800
|
+
*
|
|
801
|
+
* @example
|
|
802
|
+
* ```tsx
|
|
803
|
+
* <MethodSectionFromSpec spec={spec} export="createClient" />
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
declare function MethodSectionFromSpec({ spec, export: exportProp, className }: MethodSectionFromSpecProps): ReactNode24;
|
|
807
|
+
import { ReactNode as ReactNode25 } from "react";
|
|
808
|
+
interface NestedParameterContainerProps {
|
|
809
|
+
/** Nested parameter content */
|
|
810
|
+
children: ReactNode25;
|
|
811
|
+
/** Nesting depth level (0 = first level) */
|
|
812
|
+
level?: number;
|
|
813
|
+
/** Custom className */
|
|
814
|
+
className?: string;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Bordered container for nested child parameters (Stripe-style).
|
|
818
|
+
* Connects to NestedParameterToggle above (no top border).
|
|
819
|
+
* Children separated by border-bottom only.
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* ```tsx
|
|
823
|
+
* <NestedParameterToggle expanded={isOpen} onToggle={toggle} />
|
|
824
|
+
* {isOpen && (
|
|
825
|
+
* <NestedParameterContainer>
|
|
826
|
+
* <APIParameterItem name="city" type="string" />
|
|
827
|
+
* <APIParameterItem name="country" type="string" />
|
|
828
|
+
* </NestedParameterContainer>
|
|
829
|
+
* )}
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
declare function NestedParameterContainer({ children, level, className }: NestedParameterContainerProps): ReactNode25;
|
|
833
|
+
import { ReactNode as ReactNode26 } from "react";
|
|
834
|
+
interface NestedParameterToggleProps {
|
|
835
|
+
/** Toggle state */
|
|
836
|
+
expanded: boolean;
|
|
837
|
+
/** Toggle callback */
|
|
838
|
+
onToggle: () => void;
|
|
839
|
+
/** Optional child count to display */
|
|
840
|
+
count?: number;
|
|
841
|
+
/** Custom className */
|
|
842
|
+
className?: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* "Show/Hide child parameters" toggle button (Stripe-style).
|
|
846
|
+
* Plus icon rotates 45deg when expanded.
|
|
847
|
+
* When expanded, bottom border-radius removed to connect with container.
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```tsx
|
|
851
|
+
* <NestedParameterToggle
|
|
852
|
+
* expanded={isOpen}
|
|
853
|
+
* onToggle={() => setIsOpen(!isOpen)}
|
|
854
|
+
* count={3}
|
|
855
|
+
* />
|
|
856
|
+
* ```
|
|
857
|
+
*/
|
|
858
|
+
declare function NestedParameterToggle({ expanded, onToggle, count, className }: NestedParameterToggleProps): ReactNode26;
|
|
932
859
|
import { SpecSchema as SpecSchema5, SpecSignatureParameter as SpecSignatureParameter9 } from "@openpkg-ts/spec";
|
|
933
860
|
interface ParameterItemProps {
|
|
934
861
|
/** Parameter to display */
|
|
@@ -956,6 +883,79 @@ interface NestedPropertyItemProps {
|
|
|
956
883
|
* Will be removed in next major version.
|
|
957
884
|
*/
|
|
958
885
|
declare function ParameterItem({ param, depth, className }: ParameterItemProps): React.ReactNode;
|
|
886
|
+
import { OpenPkg as OpenPkg17, SpecExport as SpecExport15 } from "@openpkg-ts/spec";
|
|
887
|
+
import { ReactNode as ReactNode27 } from "react";
|
|
888
|
+
interface StripeAPIReferencePageProps {
|
|
889
|
+
/** OpenPkg spec */
|
|
890
|
+
spec: OpenPkg17;
|
|
891
|
+
/** Filter exports (default: functions only) */
|
|
892
|
+
filter?: (exp: SpecExport15) => boolean;
|
|
893
|
+
/** Show all kinds, not just functions */
|
|
894
|
+
showAllKinds?: boolean;
|
|
895
|
+
/** Custom className */
|
|
896
|
+
className?: string;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Full Stripe/Supabase-style API reference page.
|
|
900
|
+
* Two-column layout with synchronized scrolling.
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```tsx
|
|
904
|
+
* <StripeAPIReferencePage spec={spec} />
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
declare function StripeAPIReferencePage({ spec, filter, showAllKinds, className }: StripeAPIReferencePageProps): ReactNode27;
|
|
908
|
+
import { ReactNode as ReactNode28, RefObject } from "react";
|
|
909
|
+
interface SyncScrollContextValue {
|
|
910
|
+
/** Currently visible section ID */
|
|
911
|
+
activeSection: string | null;
|
|
912
|
+
/** Register a section to track */
|
|
913
|
+
registerSection: (id: string, ref: RefObject<HTMLElement | null>) => void;
|
|
914
|
+
/** Unregister a section */
|
|
915
|
+
unregisterSection: (id: string) => void;
|
|
916
|
+
/** Scroll right column to section */
|
|
917
|
+
scrollToSection: (id: string) => void;
|
|
918
|
+
/** Register the right column container */
|
|
919
|
+
registerRightColumn: (ref: RefObject<HTMLElement | null>) => void;
|
|
920
|
+
}
|
|
921
|
+
interface SyncScrollProviderProps {
|
|
922
|
+
children: ReactNode28;
|
|
923
|
+
/** Root margin for intersection observer (default: '-20% 0px -60% 0px') */
|
|
924
|
+
rootMargin?: string;
|
|
925
|
+
/** Scroll behavior (default: 'smooth') */
|
|
926
|
+
scrollBehavior?: ScrollBehavior;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Provider for synchronized scrolling between left and right columns.
|
|
930
|
+
* Uses IntersectionObserver to track visible sections on the left,
|
|
931
|
+
* and auto-scrolls the right column to matching examples.
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```tsx
|
|
935
|
+
* <SyncScrollProvider>
|
|
936
|
+
* <APIReferenceLayout
|
|
937
|
+
* examples={
|
|
938
|
+
* <>
|
|
939
|
+
* <ExampleSection id="select" ... />
|
|
940
|
+
* <ExampleSection id="insert" ... />
|
|
941
|
+
* </>
|
|
942
|
+
* }
|
|
943
|
+
* >
|
|
944
|
+
* <MethodSection id="select" ... />
|
|
945
|
+
* <MethodSection id="insert" ... />
|
|
946
|
+
* </APIReferenceLayout>
|
|
947
|
+
* </SyncScrollProvider>
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
declare function SyncScrollProvider({ children, rootMargin, scrollBehavior }: SyncScrollProviderProps): ReactNode28;
|
|
951
|
+
/**
|
|
952
|
+
* Hook to access sync scroll context.
|
|
953
|
+
*/
|
|
954
|
+
declare function useSyncScroll(): SyncScrollContextValue;
|
|
955
|
+
/**
|
|
956
|
+
* Hook to register a section for scroll tracking.
|
|
957
|
+
*/
|
|
958
|
+
declare function useSyncSection(id: string): RefObject<HTMLElement | null>;
|
|
959
959
|
import { OpenPkg as OpenPkg18, SpecExport as SpecExport16 } from "@openpkg-ts/spec";
|
|
960
960
|
import { ReactNode as ReactNode29 } from "react";
|
|
961
961
|
interface ClassSectionProps2 {
|