@openpkg-ts/ui 0.1.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/api/index.d.ts +114 -0
- package/dist/api/index.js +435 -0
- package/dist/badge/index.d.ts +29 -0
- package/dist/badge/index.js +94 -0
- package/dist/docskit/index.d.ts +410 -0
- package/dist/docskit/index.js +6140 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +9 -0
- package/package.json +54 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { AnnotationHandler } from "codehike/code";
|
|
2
|
+
declare const callout: AnnotationHandler;
|
|
3
|
+
import { AnnotationHandler as AnnotationHandler2, RawCode } from "codehike/code";
|
|
4
|
+
type CodeOptions = {
|
|
5
|
+
copyButton?: boolean;
|
|
6
|
+
lineNumbers?: boolean;
|
|
7
|
+
wordWrap?: boolean;
|
|
8
|
+
animate?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type CodeInfo = {
|
|
11
|
+
storage?: string;
|
|
12
|
+
options: CodeOptions;
|
|
13
|
+
tabs: {
|
|
14
|
+
options: CodeOptions;
|
|
15
|
+
title: string;
|
|
16
|
+
code: string;
|
|
17
|
+
pre: React.ReactNode;
|
|
18
|
+
icon: React.ReactNode;
|
|
19
|
+
lang: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
declare const theme = "github-from-css";
|
|
23
|
+
/**
|
|
24
|
+
* Convert flags string to options object.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* flagsToOptions("na") // { lineNumbers: true, animate: true }
|
|
28
|
+
* flagsToOptions("c") // { copyButton: true }
|
|
29
|
+
*/
|
|
30
|
+
declare function flagsToOptions(flags?: string);
|
|
31
|
+
declare function DocsKitCode(props: {
|
|
32
|
+
codeblock: RawCode;
|
|
33
|
+
handlers?: AnnotationHandler2[];
|
|
34
|
+
className?: string;
|
|
35
|
+
});
|
|
36
|
+
declare function SingleCode(props: {
|
|
37
|
+
group: CodeInfo;
|
|
38
|
+
className?: string;
|
|
39
|
+
});
|
|
40
|
+
declare function toCodeGroup(props: {
|
|
41
|
+
codeblocks: RawCode[];
|
|
42
|
+
flags?: string;
|
|
43
|
+
storage?: string;
|
|
44
|
+
handlers?: AnnotationHandler2[];
|
|
45
|
+
}): Promise<CodeInfo>;
|
|
46
|
+
declare function MultiCode({ group, className }: {
|
|
47
|
+
group: CodeInfo;
|
|
48
|
+
className?: string;
|
|
49
|
+
});
|
|
50
|
+
import { AnnotationHandler as AnnotationHandler3, RawCode as RawCode2 } from "codehike/code";
|
|
51
|
+
/**
|
|
52
|
+
* Client-side code block with syntax highlighting.
|
|
53
|
+
* Highlights code in useEffect to avoid SSR memory issues.
|
|
54
|
+
*/
|
|
55
|
+
declare function ClientDocsKitCode(props: {
|
|
56
|
+
codeblock: RawCode2;
|
|
57
|
+
handlers?: AnnotationHandler3[];
|
|
58
|
+
className?: string;
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Client-side terminal-style code block.
|
|
62
|
+
*/
|
|
63
|
+
declare function ClientTerminal(props: {
|
|
64
|
+
codeblock: RawCode2;
|
|
65
|
+
handlers?: AnnotationHandler3[];
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Client-side inline code with syntax highlighting.
|
|
69
|
+
*/
|
|
70
|
+
declare function ClientInlineCode({ codeblock }: {
|
|
71
|
+
codeblock: RawCode2;
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Client-side code tabs with multiple files.
|
|
75
|
+
*/
|
|
76
|
+
declare function ClientCode(props: {
|
|
77
|
+
codeblocks: RawCode2[];
|
|
78
|
+
flags?: string;
|
|
79
|
+
storage?: string;
|
|
80
|
+
});
|
|
81
|
+
declare function CopyButton({ text, className, variant }: {
|
|
82
|
+
text: string;
|
|
83
|
+
className?: string;
|
|
84
|
+
variant?: "floating" | "inline";
|
|
85
|
+
});
|
|
86
|
+
import { AnnotationHandler as AnnotationHandler4, RawCode as RawCode3 } from "codehike/code";
|
|
87
|
+
interface DiffStats {
|
|
88
|
+
additions?: number;
|
|
89
|
+
deletions?: number;
|
|
90
|
+
}
|
|
91
|
+
interface ClientDiffCodeProps {
|
|
92
|
+
codeblock: RawCode3;
|
|
93
|
+
/** Full file path (e.g., "src/components/") */
|
|
94
|
+
path?: string;
|
|
95
|
+
/** Filename (e.g., "index.ts") - if not provided, extracted from codeblock meta */
|
|
96
|
+
filename?: string;
|
|
97
|
+
/** Diff statistics */
|
|
98
|
+
diff?: DiffStats;
|
|
99
|
+
/** Extra annotation handlers */
|
|
100
|
+
handlers?: AnnotationHandler4[];
|
|
101
|
+
/** Wrapper className */
|
|
102
|
+
className?: string;
|
|
103
|
+
/** Start collapsed */
|
|
104
|
+
defaultOpen?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* DocKit code block variant with file change row header.
|
|
108
|
+
* Displays path/filename with diff stats, collapsible with syntax-highlighted code.
|
|
109
|
+
*/
|
|
110
|
+
declare function ClientDiffCode(props: ClientDiffCodeProps);
|
|
111
|
+
declare function CodeIcon({ title, lang, className }: {
|
|
112
|
+
title: string;
|
|
113
|
+
lang: string;
|
|
114
|
+
className?: string;
|
|
115
|
+
});
|
|
116
|
+
import { RawCode as RawCode4 } from "codehike/code";
|
|
117
|
+
declare function DocsKitInlineCode({ codeblock }: {
|
|
118
|
+
codeblock: RawCode4;
|
|
119
|
+
});
|
|
120
|
+
type PackageManager = "npm" | "bun" | "pnpm" | "yarn";
|
|
121
|
+
interface PackageInstallProps {
|
|
122
|
+
/** The package name to install */
|
|
123
|
+
package: string;
|
|
124
|
+
/** Whether this is a dev dependency */
|
|
125
|
+
dev?: boolean;
|
|
126
|
+
/** Whether this is a global install */
|
|
127
|
+
global?: boolean;
|
|
128
|
+
/** Which package managers to show (defaults to all) */
|
|
129
|
+
managers?: PackageManager[];
|
|
130
|
+
/** Whether to show the copy button */
|
|
131
|
+
copyButton?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Package installation command with tabs for different package managers.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```tsx
|
|
138
|
+
* <PackageInstall package="@doccov/ui" />
|
|
139
|
+
* <PackageInstall package="typescript" dev />
|
|
140
|
+
* <PackageInstall package="opencode-ai" global />
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
declare function PackageInstall({ package: pkg, dev, global: isGlobal, managers, copyButton }: PackageInstallProps);
|
|
144
|
+
/**
|
|
145
|
+
* Loading skeleton for code blocks.
|
|
146
|
+
*/
|
|
147
|
+
declare function CodeBlockSkeleton({ hasTitle, lines }: {
|
|
148
|
+
hasTitle?: boolean;
|
|
149
|
+
lines?: number;
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Loading skeleton for terminal-style code blocks.
|
|
153
|
+
*/
|
|
154
|
+
declare function TerminalSkeleton({ lines }: {
|
|
155
|
+
lines?: number;
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* Loading skeleton for inline code.
|
|
159
|
+
*/
|
|
160
|
+
declare function InlineCodeSkeleton();
|
|
161
|
+
/**
|
|
162
|
+
* Loading skeleton for code tabs.
|
|
163
|
+
*/
|
|
164
|
+
declare function CodeTabsSkeleton({ tabs, lines }: {
|
|
165
|
+
tabs?: number;
|
|
166
|
+
lines?: number;
|
|
167
|
+
});
|
|
168
|
+
import { RawCode as RawCode5 } from "codehike/code";
|
|
169
|
+
declare function CodeGroup(props: unknown);
|
|
170
|
+
declare function Code(props: {
|
|
171
|
+
codeblocks: RawCode5[];
|
|
172
|
+
flags?: string;
|
|
173
|
+
storage?: string;
|
|
174
|
+
});
|
|
175
|
+
import { AnnotationHandler as AnnotationHandler5, RawCode as RawCode6 } from "codehike/code";
|
|
176
|
+
/**
|
|
177
|
+
* Terminal-style code block with macOS window controls.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```tsx
|
|
181
|
+
* <Terminal
|
|
182
|
+
* codeblock={{
|
|
183
|
+
* value: "npm install @opencode-ai/sdk",
|
|
184
|
+
* lang: "bash",
|
|
185
|
+
* meta: "-c",
|
|
186
|
+
* }}
|
|
187
|
+
* />
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
declare function Terminal(props: {
|
|
191
|
+
codeblock: RawCode6;
|
|
192
|
+
handlers?: AnnotationHandler5[];
|
|
193
|
+
});
|
|
194
|
+
declare const collapse: unknown;
|
|
195
|
+
import { AnnotationHandler as AnnotationHandler6 } from "codehike/code";
|
|
196
|
+
declare const diff: AnnotationHandler6;
|
|
197
|
+
import React2 from "react";
|
|
198
|
+
declare function addDocsKit<T extends Record<string, React2.ElementType | string>>(components: T): T;
|
|
199
|
+
import { AnnotationHandler as AnnotationHandler7 } from "codehike/code";
|
|
200
|
+
declare const expandable: AnnotationHandler7;
|
|
201
|
+
import { AnnotationHandler as AnnotationHandler8 } from "codehike/code";
|
|
202
|
+
import React3 from "react";
|
|
203
|
+
declare function WithHover(props: {
|
|
204
|
+
children: React3.ReactNode;
|
|
205
|
+
});
|
|
206
|
+
declare function HoverLink(props: {
|
|
207
|
+
href?: string;
|
|
208
|
+
children?: React3.ReactNode;
|
|
209
|
+
});
|
|
210
|
+
declare const hover: AnnotationHandler8;
|
|
211
|
+
import { AnnotationHandler as AnnotationHandler9 } from "codehike/code";
|
|
212
|
+
declare const lineNumbers2: AnnotationHandler9;
|
|
213
|
+
import { AnnotationHandler as AnnotationHandler10 } from "codehike/code";
|
|
214
|
+
declare const link: AnnotationHandler10;
|
|
215
|
+
import { AnnotationHandler as AnnotationHandler11 } from "codehike/code";
|
|
216
|
+
declare const mark: AnnotationHandler11;
|
|
217
|
+
declare function WithNotes({ children,...rest }: {
|
|
218
|
+
children: React.ReactNode;
|
|
219
|
+
});
|
|
220
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
221
|
+
import * as React4 from "react";
|
|
222
|
+
declare function Tabs({ className,...props }: React4.ComponentProps<typeof TabsPrimitive.Root>);
|
|
223
|
+
declare function TabsList({ className,...props }: React4.ComponentProps<typeof TabsPrimitive.List>);
|
|
224
|
+
declare function TabsTrigger({ className,...props }: React4.ComponentProps<typeof TabsPrimitive.Trigger>);
|
|
225
|
+
declare function TabsContent({ className,...props }: React4.ComponentProps<typeof TabsPrimitive.Content>);
|
|
226
|
+
import { AnnotationHandler as AnnotationHandler12 } from "codehike/code";
|
|
227
|
+
declare const tooltip: AnnotationHandler12;
|
|
228
|
+
declare function TooltipLink(props: {
|
|
229
|
+
href?: string;
|
|
230
|
+
children?: React.ReactNode;
|
|
231
|
+
});
|
|
232
|
+
import { AnnotationHandler as AnnotationHandler13 } from "codehike/code";
|
|
233
|
+
declare const wordWrap2: AnnotationHandler13;
|
|
234
|
+
import * as React5 from "react";
|
|
235
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
236
|
+
type EndpointBadgeSize = "sm" | "md";
|
|
237
|
+
declare const endpointBadgeVariants: (props?: {
|
|
238
|
+
method?: HttpMethod | null;
|
|
239
|
+
size?: EndpointBadgeSize | null;
|
|
240
|
+
className?: string;
|
|
241
|
+
}) => string;
|
|
242
|
+
interface EndpointBadgeProps extends React5.HTMLAttributes<HTMLSpanElement> {
|
|
243
|
+
method: HttpMethod;
|
|
244
|
+
size?: EndpointBadgeSize | null;
|
|
245
|
+
}
|
|
246
|
+
declare const EndpointBadge: React5.ForwardRefExoticComponent<EndpointBadgeProps & React5.RefAttributes<HTMLSpanElement>>;
|
|
247
|
+
import * as React6 from "react";
|
|
248
|
+
interface EndpointHeaderProps extends React6.HTMLAttributes<HTMLDivElement> {
|
|
249
|
+
/** HTTP method */
|
|
250
|
+
method: HttpMethod;
|
|
251
|
+
/** API path (e.g., "/v1/customers") */
|
|
252
|
+
path: string;
|
|
253
|
+
/** Show copy button on hover */
|
|
254
|
+
copyable?: boolean;
|
|
255
|
+
}
|
|
256
|
+
declare const EndpointHeader: React6.ForwardRefExoticComponent<EndpointHeaderProps & React6.RefAttributes<HTMLDivElement>>;
|
|
257
|
+
import * as React7 from "react";
|
|
258
|
+
interface APIParameterSchema {
|
|
259
|
+
/** Type name */
|
|
260
|
+
type?: string;
|
|
261
|
+
/** Formatted type string */
|
|
262
|
+
typeString?: string;
|
|
263
|
+
/** Description */
|
|
264
|
+
description?: string;
|
|
265
|
+
/** Nested properties for object types */
|
|
266
|
+
properties?: Record<string, APIParameterSchema>;
|
|
267
|
+
/** Required property names */
|
|
268
|
+
required?: string[];
|
|
269
|
+
}
|
|
270
|
+
interface APIParameterItemProps {
|
|
271
|
+
/** Parameter name */
|
|
272
|
+
name: string;
|
|
273
|
+
/** Type string (e.g., "string", "object") */
|
|
274
|
+
type: string;
|
|
275
|
+
/** Is required */
|
|
276
|
+
required?: boolean;
|
|
277
|
+
/** Description */
|
|
278
|
+
description?: string;
|
|
279
|
+
/** Nested children (for expandable objects) */
|
|
280
|
+
children?: APIParameterSchema;
|
|
281
|
+
/** Nesting depth */
|
|
282
|
+
depth?: number;
|
|
283
|
+
/** Custom className */
|
|
284
|
+
className?: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Single parameter row with name, type, required badge, description, and expandable children.
|
|
288
|
+
* Stripe-style API reference parameter display.
|
|
289
|
+
*/
|
|
290
|
+
declare function APIParameterItem({ name, type, required, description, children, depth, className }: APIParameterItemProps): React7.ReactNode;
|
|
291
|
+
import * as React8 from "react";
|
|
292
|
+
interface ParameterListProps {
|
|
293
|
+
/** Title above the list (e.g., "Body parameters") */
|
|
294
|
+
title?: string;
|
|
295
|
+
/** Number of items to show before collapsing */
|
|
296
|
+
collapseAfter?: number;
|
|
297
|
+
/** Child parameter items */
|
|
298
|
+
children: React8.ReactNode;
|
|
299
|
+
/** Custom className */
|
|
300
|
+
className?: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Container for parameter items with optional "More parameters" collapse.
|
|
304
|
+
*/
|
|
305
|
+
declare function ParameterList({ title, collapseAfter, children, className }: ParameterListProps): React8.ReactNode;
|
|
306
|
+
import * as React9 from "react";
|
|
307
|
+
interface ResponseBlockProps {
|
|
308
|
+
/** Response JSON data */
|
|
309
|
+
data: object;
|
|
310
|
+
/** Optional title (e.g., "Response", "200 OK") */
|
|
311
|
+
title?: string;
|
|
312
|
+
/** Custom className */
|
|
313
|
+
className?: string;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* JSON response preview with syntax highlighting.
|
|
317
|
+
* Displays formatted JSON with copy functionality.
|
|
318
|
+
*/
|
|
319
|
+
declare function ResponseBlock({ data, title, className }: ResponseBlockProps): React9.ReactNode;
|
|
320
|
+
import * as React10 from "react";
|
|
321
|
+
interface Language {
|
|
322
|
+
/** Language identifier (e.g., "curl", "node", "python") */
|
|
323
|
+
id: string;
|
|
324
|
+
/** Display label (e.g., "cURL", "Node.js", "Python") */
|
|
325
|
+
label: string;
|
|
326
|
+
}
|
|
327
|
+
interface LanguageSelectorProps {
|
|
328
|
+
/** Available languages */
|
|
329
|
+
languages: Language[];
|
|
330
|
+
/** Currently selected language id */
|
|
331
|
+
value: string;
|
|
332
|
+
/** Callback when language changes */
|
|
333
|
+
onChange: (languageId: string) => void;
|
|
334
|
+
/** Custom className */
|
|
335
|
+
className?: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Dropdown selector for choosing code example language.
|
|
339
|
+
* Used in APICodePanel to switch between language examples.
|
|
340
|
+
*/
|
|
341
|
+
declare function LanguageSelector({ languages, value, onChange, className }: LanguageSelectorProps): React10.ReactNode;
|
|
342
|
+
import * as React11 from "react";
|
|
343
|
+
interface CodeExample {
|
|
344
|
+
/** Language identifier */
|
|
345
|
+
languageId: string;
|
|
346
|
+
/** Code content */
|
|
347
|
+
code: string;
|
|
348
|
+
/** Optional syntax highlighting language (defaults to languageId) */
|
|
349
|
+
highlightLang?: string;
|
|
350
|
+
}
|
|
351
|
+
interface APICodePanelProps {
|
|
352
|
+
/** Available languages for the selector */
|
|
353
|
+
languages: Language[];
|
|
354
|
+
/** Code examples keyed by language id */
|
|
355
|
+
examples: CodeExample[];
|
|
356
|
+
/** Optional external link (e.g., to API playground) */
|
|
357
|
+
externalLink?: string;
|
|
358
|
+
/** Optional title shown in header */
|
|
359
|
+
title?: string;
|
|
360
|
+
/** Custom className */
|
|
361
|
+
className?: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Right-side sticky code panel for API documentation.
|
|
365
|
+
* Features language dropdown, copy button, and dark bg with syntax highlighting.
|
|
366
|
+
*/
|
|
367
|
+
declare function APICodePanel({ languages, examples, externalLink, title, className }: APICodePanelProps): React11.ReactNode;
|
|
368
|
+
import * as React12 from "react";
|
|
369
|
+
interface APISectionProps {
|
|
370
|
+
/** Section title (e.g., "Create a customer", "The Customer object") */
|
|
371
|
+
title: string;
|
|
372
|
+
/** Optional anchor id for deep linking */
|
|
373
|
+
id?: string;
|
|
374
|
+
/** Optional description */
|
|
375
|
+
description?: React12.ReactNode;
|
|
376
|
+
/** Left column content (parameters, returns, etc.) */
|
|
377
|
+
children: React12.ReactNode;
|
|
378
|
+
/** Languages for code panel */
|
|
379
|
+
languages: Language[];
|
|
380
|
+
/** Code examples for the right panel */
|
|
381
|
+
examples: CodeExample[];
|
|
382
|
+
/** Optional external link for code panel */
|
|
383
|
+
externalLink?: string;
|
|
384
|
+
/** Optional code panel title */
|
|
385
|
+
codePanelTitle?: string;
|
|
386
|
+
/** Custom className */
|
|
387
|
+
className?: string;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Single API section with two-column layout.
|
|
391
|
+
* Docs/params on left, sticky code panel on right.
|
|
392
|
+
*/
|
|
393
|
+
declare function APISection({ title, id, description, children, languages, examples, externalLink, codePanelTitle, className }: APISectionProps): React12.ReactNode;
|
|
394
|
+
import * as React13 from "react";
|
|
395
|
+
interface APIReferencePageProps {
|
|
396
|
+
/** Page title */
|
|
397
|
+
title: string;
|
|
398
|
+
/** Optional page description */
|
|
399
|
+
description?: React13.ReactNode;
|
|
400
|
+
/** API sections as children */
|
|
401
|
+
children: React13.ReactNode;
|
|
402
|
+
/** Custom className */
|
|
403
|
+
className?: string;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Full page wrapper for API reference documentation.
|
|
407
|
+
* Provides max-width container and consistent spacing.
|
|
408
|
+
*/
|
|
409
|
+
declare function APIReferencePage({ title, description, children, className }: APIReferencePageProps): React13.ReactNode;
|
|
410
|
+
export { wordWrap2 as wordWrap, tooltip, toCodeGroup, theme, mark, link, lineNumbers2 as lineNumbers, hover, flagsToOptions, expandable, endpointBadgeVariants, diff, collapse, callout, addDocsKit, WithNotes, WithHover, TooltipLink, TerminalSkeleton, Terminal, TabsTrigger, TabsList, TabsContent, Tabs, SingleCode, ResponseBlockProps, ResponseBlock, ParameterListProps, ParameterList, PackageInstall, MultiCode, LanguageSelectorProps, LanguageSelector, Language, InlineCodeSkeleton, 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 };
|