@doccov/fumadocs-adapter 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/bunup.config.ts +0 -1
- package/dist/components/index.d.ts +70 -70
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-pqaj3kdh.js → chunk-mmca4gp7.js} +653 -654
- package/package.json +1 -2
- package/src/components/api-page.tsx +3 -9
- package/src/components/class-page.tsx +3 -8
- package/src/components/code-example.tsx +6 -2
- package/src/components/collapsible-method.tsx +6 -13
- package/src/components/coverage-badge.tsx +5 -3
- package/src/components/enum-page.tsx +10 -6
- package/src/components/examples.tsx +0 -1
- package/src/components/expandable-property.tsx +5 -7
- package/src/components/function-page.tsx +7 -9
- package/src/components/index.ts +29 -44
- package/src/components/interface-page.tsx +6 -5
- package/src/components/members-section.tsx +6 -7
- package/src/components/parameter-card.tsx +2 -6
- package/src/components/type-table.tsx +6 -9
- package/src/components/variable-page.tsx +2 -7
- package/src/index.ts +3 -4
- package/src/server.ts +0 -1
- package/src/styles/docskit.css +8 -7
- package/tsconfig.json +0 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type { OpenPkg
|
|
3
|
+
import type { OpenPkg } from '@openpkg-ts/spec';
|
|
4
4
|
import type { OpenPkgInstance } from '../server';
|
|
5
|
-
import { FunctionPage } from './function-page';
|
|
6
5
|
import { ClassPage } from './class-page';
|
|
7
|
-
import { InterfacePage } from './interface-page';
|
|
8
6
|
import { EnumPage } from './enum-page';
|
|
7
|
+
import { FunctionPage } from './function-page';
|
|
8
|
+
import { InterfacePage } from './interface-page';
|
|
9
9
|
import { VariablePage } from './variable-page';
|
|
10
10
|
|
|
11
11
|
export interface APIPageProps {
|
|
@@ -78,13 +78,7 @@ export function APIPage({ spec, instance, id }: APIPageProps) {
|
|
|
78
78
|
return <InterfacePage {...pageProps} />;
|
|
79
79
|
case 'enum':
|
|
80
80
|
return <EnumPage {...pageProps} />;
|
|
81
|
-
case 'variable':
|
|
82
|
-
case 'namespace':
|
|
83
|
-
case 'module':
|
|
84
|
-
case 'reference':
|
|
85
|
-
case 'external':
|
|
86
81
|
default:
|
|
87
82
|
return <VariablePage {...pageProps} />;
|
|
88
83
|
}
|
|
89
84
|
}
|
|
90
|
-
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import type { OpenPkg, SpecExport, SpecMember } from '@openpkg-ts/spec';
|
|
4
4
|
import { CodeExample } from './code-example';
|
|
5
|
+
import { CollapsibleMethod } from './collapsible-method';
|
|
5
6
|
import { CoverageBadge } from './coverage-badge';
|
|
6
7
|
import { ExpandableProperty } from './expandable-property';
|
|
7
|
-
import { CollapsibleMethod } from './collapsible-method';
|
|
8
8
|
|
|
9
9
|
export interface ClassPageProps {
|
|
10
10
|
export: SpecExport;
|
|
@@ -79,9 +79,7 @@ export function ClassPage({ export: exp, spec }: ClassPageProps) {
|
|
|
79
79
|
<div className="space-y-8">
|
|
80
80
|
{/* Description */}
|
|
81
81
|
{exp.description && (
|
|
82
|
-
<p className="text-fd-muted-foreground text-lg leading-relaxed">
|
|
83
|
-
{exp.description}
|
|
84
|
-
</p>
|
|
82
|
+
<p className="text-fd-muted-foreground text-lg leading-relaxed">{exp.description}</p>
|
|
85
83
|
)}
|
|
86
84
|
|
|
87
85
|
{/* Declaration */}
|
|
@@ -150,10 +148,7 @@ export function ClassPage({ export: exp, spec }: ClassPageProps) {
|
|
|
150
148
|
<h3 className="text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4">
|
|
151
149
|
Example
|
|
152
150
|
</h3>
|
|
153
|
-
<CodeExample
|
|
154
|
-
code={exp.examples![0]}
|
|
155
|
-
filename={`${exp.name.toLowerCase()}.ts`}
|
|
156
|
-
/>
|
|
151
|
+
<CodeExample code={exp.examples![0]} filename={`${exp.name.toLowerCase()}.ts`} />
|
|
157
152
|
</div>
|
|
158
153
|
)}
|
|
159
154
|
</div>
|
|
@@ -25,9 +25,13 @@ function cleanCode(code: string): string {
|
|
|
25
25
|
return cleaned;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function CodeExample({
|
|
28
|
+
export function CodeExample({
|
|
29
|
+
code,
|
|
30
|
+
filename = 'example.ts',
|
|
31
|
+
language = 'typescript',
|
|
32
|
+
}: CodeExampleProps) {
|
|
29
33
|
const cleaned = cleanCode(code);
|
|
30
|
-
|
|
34
|
+
|
|
31
35
|
// Build RawCode object for ClientDocsKitCode
|
|
32
36
|
// The meta field uses flags: 'c' for copyButton, 'n' for lineNumbers
|
|
33
37
|
const codeblock: RawCode = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
3
|
import type { SpecMember, SpecSchema } from '@openpkg-ts/spec';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { ExpandableProperty } from './expandable-property';
|
|
6
6
|
|
|
7
7
|
export interface CollapsibleMethodProps {
|
|
@@ -40,7 +40,7 @@ function formatSchema(schema: unknown): string {
|
|
|
40
40
|
}
|
|
41
41
|
if (s.tsType) {
|
|
42
42
|
const tsType = String(s.tsType);
|
|
43
|
-
if (tsType.length > 40) return tsType.slice(0, 37)
|
|
43
|
+
if (tsType.length > 40) return `${tsType.slice(0, 37)}...`;
|
|
44
44
|
return tsType;
|
|
45
45
|
}
|
|
46
46
|
if (s.type) return String(s.type);
|
|
@@ -52,7 +52,7 @@ function formatReturnType(returns: { schema?: SpecSchema; tsType?: string } | un
|
|
|
52
52
|
if (!returns) return 'void';
|
|
53
53
|
if (returns.tsType) {
|
|
54
54
|
const t = returns.tsType;
|
|
55
|
-
if (t.length > 40) return t.slice(0, 37)
|
|
55
|
+
if (t.length > 40) return `${t.slice(0, 37)}...`;
|
|
56
56
|
return t;
|
|
57
57
|
}
|
|
58
58
|
return formatSchema(returns.schema);
|
|
@@ -90,10 +90,7 @@ export function CollapsibleMethod({ member, defaultExpanded = false }: Collapsib
|
|
|
90
90
|
}, [member.name]);
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
|
-
<div
|
|
94
|
-
id={member.name}
|
|
95
|
-
className="scroll-mt-20 border-b border-fd-border last:border-0"
|
|
96
|
-
>
|
|
93
|
+
<div id={member.name} className="scroll-mt-20 border-b border-fd-border last:border-0">
|
|
97
94
|
{/* Clickable header */}
|
|
98
95
|
<button
|
|
99
96
|
onClick={() => setExpanded(!expanded)}
|
|
@@ -111,9 +108,7 @@ export function CollapsibleMethod({ member, defaultExpanded = false }: Collapsib
|
|
|
111
108
|
<span className="text-fd-muted-foreground font-normal">({paramPreview})</span>
|
|
112
109
|
</span>
|
|
113
110
|
<span className="text-fd-muted-foreground">→</span>
|
|
114
|
-
<span className="font-mono text-sm text-fd-muted-foreground truncate">
|
|
115
|
-
{returnType}
|
|
116
|
-
</span>
|
|
111
|
+
<span className="font-mono text-sm text-fd-muted-foreground truncate">{returnType}</span>
|
|
117
112
|
</div>
|
|
118
113
|
|
|
119
114
|
{/* Badges */}
|
|
@@ -141,9 +136,7 @@ export function CollapsibleMethod({ member, defaultExpanded = false }: Collapsib
|
|
|
141
136
|
<div className="pb-6 pl-8 pr-4">
|
|
142
137
|
{/* Description */}
|
|
143
138
|
{member.description && (
|
|
144
|
-
<p className="text-fd-muted-foreground mb-4 leading-relaxed">
|
|
145
|
-
{member.description}
|
|
146
|
-
</p>
|
|
139
|
+
<p className="text-fd-muted-foreground mb-4 leading-relaxed">{member.description}</p>
|
|
147
140
|
)}
|
|
148
141
|
|
|
149
142
|
{/* Parameters */}
|
|
@@ -10,7 +10,8 @@ export interface CoverageBadgeProps {
|
|
|
10
10
|
|
|
11
11
|
function getScoreColor(score: number): string {
|
|
12
12
|
if (score >= 80) return 'text-green-600 dark:text-green-400 bg-green-500/10 border-green-500/20';
|
|
13
|
-
if (score >= 60)
|
|
13
|
+
if (score >= 60)
|
|
14
|
+
return 'text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20';
|
|
14
15
|
return 'text-red-600 dark:text-red-400 bg-red-500/10 border-red-500/20';
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -58,7 +59,9 @@ export function CoverageBadge({ docs, showMissing = true, showDrift = true }: Co
|
|
|
58
59
|
|
|
59
60
|
{hasDrift && (
|
|
60
61
|
<div className="rounded-md bg-red-500/10 border border-red-500/20 px-3 py-2">
|
|
61
|
-
<p className="text-sm font-medium text-red-600 dark:text-red-400 mb-1">
|
|
62
|
+
<p className="text-sm font-medium text-red-600 dark:text-red-400 mb-1">
|
|
63
|
+
Documentation Drift
|
|
64
|
+
</p>
|
|
62
65
|
<ul className="text-sm text-red-600/80 dark:text-red-400/80 space-y-1">
|
|
63
66
|
{docs.drift!.map((drift, index) => (
|
|
64
67
|
<li key={index} className="flex flex-col">
|
|
@@ -77,4 +80,3 @@ export function CoverageBadge({ docs, showMissing = true, showDrift = true }: Co
|
|
|
77
80
|
</div>
|
|
78
81
|
);
|
|
79
82
|
}
|
|
80
|
-
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { OpenPkg, SpecExport } from '@openpkg-ts/spec';
|
|
4
|
-
import { Signature } from './signature';
|
|
5
|
-
import { ExamplesSection } from './examples';
|
|
6
4
|
import { CoverageBadge } from './coverage-badge';
|
|
5
|
+
import { ExamplesSection } from './examples';
|
|
6
|
+
import { Signature } from './signature';
|
|
7
7
|
|
|
8
8
|
export interface EnumPageProps {
|
|
9
9
|
export: SpecExport;
|
|
@@ -35,7 +35,9 @@ export function EnumPage({ export: exp, spec }: EnumPageProps) {
|
|
|
35
35
|
<thead>
|
|
36
36
|
<tr className="border-b border-fd-border">
|
|
37
37
|
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">Name</th>
|
|
38
|
-
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">
|
|
38
|
+
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">
|
|
39
|
+
Value
|
|
40
|
+
</th>
|
|
39
41
|
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">
|
|
40
42
|
Description
|
|
41
43
|
</th>
|
|
@@ -47,12 +49,15 @@ export function EnumPage({ export: exp, spec }: EnumPageProps) {
|
|
|
47
49
|
const value =
|
|
48
50
|
member.schema !== undefined
|
|
49
51
|
? typeof member.schema === 'object' && member.schema !== null
|
|
50
|
-
? (member.schema as any).const ?? (member.schema as any).default ?? '-'
|
|
52
|
+
? ((member.schema as any).const ?? (member.schema as any).default ?? '-')
|
|
51
53
|
: member.schema
|
|
52
54
|
: '-';
|
|
53
55
|
|
|
54
56
|
return (
|
|
55
|
-
<tr
|
|
57
|
+
<tr
|
|
58
|
+
key={member.name ?? index}
|
|
59
|
+
className="border-b border-fd-border last:border-0"
|
|
60
|
+
>
|
|
56
61
|
<td className="py-2 px-3 align-top">
|
|
57
62
|
<code className="text-fd-primary font-mono text-xs bg-fd-secondary px-1.5 py-0.5 rounded">
|
|
58
63
|
{member.name}
|
|
@@ -83,4 +88,3 @@ export function EnumPage({ export: exp, spec }: EnumPageProps) {
|
|
|
83
88
|
</div>
|
|
84
89
|
);
|
|
85
90
|
}
|
|
86
|
-
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type { SpecSchema, SpecSignatureParameter } from '@openpkg-ts/spec';
|
|
3
4
|
import { useState } from 'react';
|
|
4
|
-
import type { SpecSignatureParameter, SpecSchema } from '@openpkg-ts/spec';
|
|
5
5
|
|
|
6
6
|
export interface ExpandablePropertyProps {
|
|
7
7
|
param: SpecSignatureParameter;
|
|
@@ -46,7 +46,7 @@ function formatType(schema: SpecSchema): string {
|
|
|
46
46
|
if (s.tsType && typeof s.tsType === 'string') {
|
|
47
47
|
const tsType = s.tsType as string;
|
|
48
48
|
if (tsType.length > 80) {
|
|
49
|
-
return tsType.slice(0, 77)
|
|
49
|
+
return `${tsType.slice(0, 77)}...`;
|
|
50
50
|
}
|
|
51
51
|
return tsType;
|
|
52
52
|
}
|
|
@@ -58,8 +58,8 @@ function formatType(schema: SpecSchema): string {
|
|
|
58
58
|
|
|
59
59
|
// Handle enums
|
|
60
60
|
if (s.enum && Array.isArray(s.enum)) {
|
|
61
|
-
const enumVals = (s.enum as unknown[]).map(v => JSON.stringify(v)).join(' | ');
|
|
62
|
-
if (enumVals.length > 50) return enumVals.slice(0, 47)
|
|
61
|
+
const enumVals = (s.enum as unknown[]).map((v) => JSON.stringify(v)).join(' | ');
|
|
62
|
+
if (enumVals.length > 50) return `${enumVals.slice(0, 47)}...`;
|
|
63
63
|
return enumVals;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -135,9 +135,7 @@ export function NestedProperty({ name, schema, required = false, depth = 0 }: Ne
|
|
|
135
135
|
</span>
|
|
136
136
|
</div>
|
|
137
137
|
{description && (
|
|
138
|
-
<p className="text-sm text-fd-muted-foreground mt-0.5 leading-relaxed">
|
|
139
|
-
{description}
|
|
140
|
-
</p>
|
|
138
|
+
<p className="text-sm text-fd-muted-foreground mt-0.5 leading-relaxed">{description}</p>
|
|
141
139
|
)}
|
|
142
140
|
</div>
|
|
143
141
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { OpenPkg, SpecExport } from '@openpkg-ts/spec';
|
|
4
|
-
import { ParameterCard } from './parameter-card';
|
|
5
4
|
import { CodeExample } from './code-example';
|
|
6
5
|
import { CoverageBadge } from './coverage-badge';
|
|
6
|
+
import { ParameterCard } from './parameter-card';
|
|
7
7
|
|
|
8
8
|
export interface FunctionPageProps {
|
|
9
9
|
export: SpecExport;
|
|
@@ -33,9 +33,7 @@ export function FunctionPage({ export: exp, spec }: FunctionPageProps) {
|
|
|
33
33
|
<div className="space-y-6 not-prose">
|
|
34
34
|
{/* Description */}
|
|
35
35
|
{exp.description && (
|
|
36
|
-
<p className="text-fd-muted-foreground leading-relaxed">
|
|
37
|
-
{exp.description}
|
|
38
|
-
</p>
|
|
36
|
+
<p className="text-fd-muted-foreground leading-relaxed">{exp.description}</p>
|
|
39
37
|
)}
|
|
40
38
|
|
|
41
39
|
{/* Returns */}
|
|
@@ -47,13 +45,13 @@ export function FunctionPage({ export: exp, spec }: FunctionPageProps) {
|
|
|
47
45
|
)}
|
|
48
46
|
|
|
49
47
|
{/* Two-column layout - using inline styles to override prose */}
|
|
50
|
-
<div
|
|
48
|
+
<div
|
|
51
49
|
className="not-prose"
|
|
52
|
-
style={{
|
|
50
|
+
style={{
|
|
53
51
|
display: hasExamples ? 'grid' : 'block',
|
|
54
52
|
gridTemplateColumns: hasExamples ? 'repeat(2, minmax(0, 1fr))' : undefined,
|
|
55
53
|
gap: '2rem',
|
|
56
|
-
alignItems: 'start'
|
|
54
|
+
alignItems: 'start',
|
|
57
55
|
}}
|
|
58
56
|
>
|
|
59
57
|
{/* Left column: Parameters */}
|
|
@@ -78,8 +76,8 @@ export function FunctionPage({ export: exp, spec }: FunctionPageProps) {
|
|
|
78
76
|
<h3 className="text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-4">
|
|
79
77
|
Example
|
|
80
78
|
</h3>
|
|
81
|
-
<CodeExample
|
|
82
|
-
code={exp.examples![0]}
|
|
79
|
+
<CodeExample
|
|
80
|
+
code={exp.examples![0]}
|
|
83
81
|
filename={`${exp.name.toLowerCase().replace(/[^a-z0-9]/g, '-')}.ts`}
|
|
84
82
|
/>
|
|
85
83
|
</div>
|
package/src/components/index.ts
CHANGED
|
@@ -1,51 +1,36 @@
|
|
|
1
1
|
// Main component
|
|
2
|
-
export { APIPage } from './api-page';
|
|
3
|
-
export type { APIPageProps } from './api-page';
|
|
4
|
-
|
|
5
|
-
// Page components
|
|
6
|
-
export { FunctionPage } from './function-page';
|
|
7
|
-
export type { FunctionPageProps } from './function-page';
|
|
8
2
|
|
|
9
|
-
export {
|
|
3
|
+
export type { APIPageProps } from './api-page';
|
|
4
|
+
export { APIPage } from './api-page';
|
|
10
5
|
export type { ClassPageProps } from './class-page';
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
export {
|
|
6
|
+
export { ClassPage } from './class-page';
|
|
7
|
+
export type { CodeExampleProps } from './code-example';
|
|
8
|
+
export { CodeExample } from './code-example';
|
|
9
|
+
export type { CollapsibleMethodProps } from './collapsible-method';
|
|
10
|
+
export { CollapsibleMethod } from './collapsible-method';
|
|
11
|
+
export type { CoverageBadgeProps } from './coverage-badge';
|
|
12
|
+
export { CoverageBadge } from './coverage-badge';
|
|
16
13
|
export type { EnumPageProps } from './enum-page';
|
|
17
|
-
|
|
18
|
-
export { VariablePage } from './variable-page';
|
|
19
|
-
export type { VariablePageProps } from './variable-page';
|
|
20
|
-
|
|
21
|
-
// Shared components
|
|
22
|
-
export { TypeTable } from './type-table';
|
|
23
|
-
export type { TypeTableProps } from './type-table';
|
|
24
|
-
|
|
25
|
-
export { Signature } from './signature';
|
|
26
|
-
export type { SignatureProps } from './signature';
|
|
27
|
-
|
|
28
|
-
export { ExamplesSection } from './examples';
|
|
14
|
+
export { EnumPage } from './enum-page';
|
|
29
15
|
export type { ExamplesSectionProps } from './examples';
|
|
30
|
-
|
|
31
|
-
export { CoverageBadge } from './coverage-badge';
|
|
32
|
-
export type { CoverageBadgeProps } from './coverage-badge';
|
|
33
|
-
|
|
34
|
-
export { MembersSection } from './members-section';
|
|
35
|
-
export type { MembersSectionProps } from './members-section';
|
|
36
|
-
|
|
37
|
-
export { ParameterCard } from './parameter-card';
|
|
38
|
-
export type { ParameterCardProps } from './parameter-card';
|
|
39
|
-
|
|
40
|
-
export { CodeExample } from './code-example';
|
|
41
|
-
export type { CodeExampleProps } from './code-example';
|
|
42
|
-
|
|
43
|
-
export { ExpandableProperty, NestedProperty } from './expandable-property';
|
|
16
|
+
export { ExamplesSection } from './examples';
|
|
44
17
|
export type { ExpandablePropertyProps, NestedPropertyProps } from './expandable-property';
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export {
|
|
18
|
+
export { ExpandableProperty, NestedProperty } from './expandable-property';
|
|
19
|
+
export type { FunctionPageProps } from './function-page';
|
|
20
|
+
// Page components
|
|
21
|
+
export { FunctionPage } from './function-page';
|
|
22
|
+
export type { InterfacePageProps } from './interface-page';
|
|
23
|
+
export { InterfacePage } from './interface-page';
|
|
24
|
+
export type { MembersSectionProps } from './members-section';
|
|
25
|
+
export { MembersSection } from './members-section';
|
|
50
26
|
export type { MethodSectionProps } from './method-section';
|
|
51
|
-
|
|
27
|
+
export { MethodSection } from './method-section';
|
|
28
|
+
export type { ParameterCardProps } from './parameter-card';
|
|
29
|
+
export { ParameterCard } from './parameter-card';
|
|
30
|
+
export type { SignatureProps } from './signature';
|
|
31
|
+
export { Signature } from './signature';
|
|
32
|
+
export type { TypeTableProps } from './type-table';
|
|
33
|
+
// Shared components
|
|
34
|
+
export { TypeTable } from './type-table';
|
|
35
|
+
export type { VariablePageProps } from './variable-page';
|
|
36
|
+
export { VariablePage } from './variable-page';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { OpenPkg, SpecExport } from '@openpkg-ts/spec';
|
|
4
|
+
import { CoverageBadge } from './coverage-badge';
|
|
5
|
+
import { ExamplesSection } from './examples';
|
|
4
6
|
import { Signature } from './signature';
|
|
5
7
|
import { TypeTable } from './type-table';
|
|
6
|
-
import { ExamplesSection } from './examples';
|
|
7
|
-
import { CoverageBadge } from './coverage-badge';
|
|
8
8
|
|
|
9
9
|
export interface InterfacePageProps {
|
|
10
10
|
export: SpecExport;
|
|
@@ -14,7 +14,7 @@ export interface InterfacePageProps {
|
|
|
14
14
|
export function InterfacePage({ export: exp, spec }: InterfacePageProps) {
|
|
15
15
|
// For interfaces/types, members are the properties
|
|
16
16
|
const properties = exp.members?.filter(
|
|
17
|
-
(m) => m.kind === 'property' || m.kind === 'field' || !m.kind
|
|
17
|
+
(m) => m.kind === 'property' || m.kind === 'field' || !m.kind,
|
|
18
18
|
);
|
|
19
19
|
const methods = exp.members?.filter((m) => m.kind === 'method' || m.kind === 'function');
|
|
20
20
|
|
|
@@ -67,7 +67,9 @@ export function InterfacePage({ export: exp, spec }: InterfacePageProps) {
|
|
|
67
67
|
.map((p) => {
|
|
68
68
|
const optional = p.required === false ? '?' : '';
|
|
69
69
|
const type =
|
|
70
|
-
typeof p.schema === 'string'
|
|
70
|
+
typeof p.schema === 'string'
|
|
71
|
+
? p.schema
|
|
72
|
+
: ((p.schema as any)?.tsType ?? 'any');
|
|
71
73
|
return `${p.name}${optional}: ${type}`;
|
|
72
74
|
})
|
|
73
75
|
.join(', ')}
|
|
@@ -91,4 +93,3 @@ export function InterfacePage({ export: exp, spec }: InterfacePageProps) {
|
|
|
91
93
|
</div>
|
|
92
94
|
);
|
|
93
95
|
}
|
|
94
|
-
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import { TypeTable } from './type-table';
|
|
3
|
+
import type { OpenPkg, SpecMember } from '@openpkg-ts/spec';
|
|
5
4
|
|
|
6
5
|
export interface MembersSectionProps {
|
|
7
6
|
members: SpecMember[];
|
|
@@ -76,10 +75,11 @@ function MemberRow({ member }: { member: SpecMember }) {
|
|
|
76
75
|
const sig = member.signatures?.[0];
|
|
77
76
|
let signature = '';
|
|
78
77
|
if (sig) {
|
|
79
|
-
const params =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const params =
|
|
79
|
+
sig.parameters?.map((p) => {
|
|
80
|
+
const optional = p.required === false ? '?' : '';
|
|
81
|
+
return `${p.name}${optional}: ${formatSchema(p.schema)}`;
|
|
82
|
+
}) ?? [];
|
|
83
83
|
const returnType = sig.returns?.tsType ?? formatSchema(sig.returns?.schema) ?? 'void';
|
|
84
84
|
signature = `(${params.join(', ')}): ${returnType}`;
|
|
85
85
|
}
|
|
@@ -190,4 +190,3 @@ export function MembersSection({ members, spec, title = 'Members' }: MembersSect
|
|
|
190
190
|
</div>
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
|
-
|
|
@@ -38,15 +38,11 @@ export function ParameterCard({ param, spec }: ParameterCardProps) {
|
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
{/* Type */}
|
|
41
|
-
<div className="text-sm text-fd-muted-foreground font-mono">
|
|
42
|
-
{type}
|
|
43
|
-
</div>
|
|
41
|
+
<div className="text-sm text-fd-muted-foreground font-mono">{type}</div>
|
|
44
42
|
|
|
45
43
|
{/* Description */}
|
|
46
44
|
{param.description && (
|
|
47
|
-
<p className="text-sm text-fd-muted-foreground mt-2">
|
|
48
|
-
{param.description}
|
|
49
|
-
</p>
|
|
45
|
+
<p className="text-sm text-fd-muted-foreground mt-2">{param.description}</p>
|
|
50
46
|
)}
|
|
51
47
|
</div>
|
|
52
48
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type { OpenPkg,
|
|
3
|
+
import type { OpenPkg, SpecMember, SpecSignatureParameter } from '@openpkg-ts/spec';
|
|
4
4
|
|
|
5
5
|
export interface TypeTableProps {
|
|
6
6
|
items: (SpecSignatureParameter | SpecMember)[];
|
|
@@ -40,7 +40,9 @@ export function TypeTable({ items, showRequired = true }: TypeTableProps) {
|
|
|
40
40
|
<tr className="border-b border-fd-border">
|
|
41
41
|
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">Name</th>
|
|
42
42
|
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">Type</th>
|
|
43
|
-
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">
|
|
43
|
+
<th className="text-left py-2 px-3 font-medium text-fd-muted-foreground">
|
|
44
|
+
Description
|
|
45
|
+
</th>
|
|
44
46
|
</tr>
|
|
45
47
|
</thead>
|
|
46
48
|
<tbody>
|
|
@@ -56,9 +58,7 @@ export function TypeTable({ items, showRequired = true }: TypeTableProps) {
|
|
|
56
58
|
<code className="text-fd-primary font-mono text-xs bg-fd-secondary px-1.5 py-0.5 rounded">
|
|
57
59
|
{name}
|
|
58
60
|
</code>
|
|
59
|
-
{showRequired && required &&
|
|
60
|
-
<span className="ml-1 text-red-500 text-xs">*</span>
|
|
61
|
-
)}
|
|
61
|
+
{showRequired && required && <span className="ml-1 text-red-500 text-xs">*</span>}
|
|
62
62
|
{showRequired && !required && (
|
|
63
63
|
<span className="ml-1 text-fd-muted-foreground text-xs">?</span>
|
|
64
64
|
)}
|
|
@@ -66,9 +66,7 @@ export function TypeTable({ items, showRequired = true }: TypeTableProps) {
|
|
|
66
66
|
<td className="py-2 px-3 align-top">
|
|
67
67
|
<code className="font-mono text-xs text-fd-muted-foreground">{type}</code>
|
|
68
68
|
</td>
|
|
69
|
-
<td className="py-2 px-3 align-top text-fd-muted-foreground">
|
|
70
|
-
{description}
|
|
71
|
-
</td>
|
|
69
|
+
<td className="py-2 px-3 align-top text-fd-muted-foreground">{description}</td>
|
|
72
70
|
</tr>
|
|
73
71
|
);
|
|
74
72
|
})}
|
|
@@ -77,4 +75,3 @@ export function TypeTable({ items, showRequired = true }: TypeTableProps) {
|
|
|
77
75
|
</div>
|
|
78
76
|
);
|
|
79
77
|
}
|
|
80
|
-
|
|
@@ -31,9 +31,7 @@ export function VariablePage({ export: exp, spec }: VariablePageProps) {
|
|
|
31
31
|
<div className="space-y-8">
|
|
32
32
|
{/* Description */}
|
|
33
33
|
{exp.description && (
|
|
34
|
-
<p className="text-fd-muted-foreground text-lg leading-relaxed">
|
|
35
|
-
{exp.description}
|
|
36
|
-
</p>
|
|
34
|
+
<p className="text-fd-muted-foreground text-lg leading-relaxed">{exp.description}</p>
|
|
37
35
|
)}
|
|
38
36
|
|
|
39
37
|
{/* Declaration */}
|
|
@@ -63,10 +61,7 @@ export function VariablePage({ export: exp, spec }: VariablePageProps) {
|
|
|
63
61
|
<h3 className="text-sm font-semibold uppercase tracking-wide text-fd-muted-foreground mb-3">
|
|
64
62
|
{exp.name} usage
|
|
65
63
|
</h3>
|
|
66
|
-
<CodeExample
|
|
67
|
-
code={exp.examples![0]}
|
|
68
|
-
filename={`${exp.name.toLowerCase()}.ts`}
|
|
69
|
-
/>
|
|
64
|
+
<CodeExample code={exp.examples![0]} filename={`${exp.name.toLowerCase()}.ts`} />
|
|
70
65
|
</div>
|
|
71
66
|
)}
|
|
72
67
|
</div>
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Server
|
|
2
|
-
export { createOpenPkg } from './server';
|
|
3
|
-
export type { OpenPkgInstance, OpenPkgOptions } from './server';
|
|
4
2
|
|
|
3
|
+
export type { APIPageProps } from './components/api-page';
|
|
5
4
|
// Components
|
|
6
5
|
export { APIPage } from './components/api-page';
|
|
7
|
-
export type {
|
|
8
|
-
|
|
6
|
+
export type { OpenPkgInstance, OpenPkgOptions } from './server';
|
|
7
|
+
export { createOpenPkg } from './server';
|
package/src/server.ts
CHANGED
package/src/styles/docskit.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Docskit CSS Variables for Fumadocs
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This file defines the CSS variables needed for @doccov/ui docskit components
|
|
5
5
|
* to work within Fumadocs themes.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Import this in your global CSS:
|
|
8
8
|
* @import '@doccov/fumadocs-adapter/css';
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* Or add these variables to your Tailwind CSS:
|
|
11
11
|
* @import 'tailwindcss';
|
|
12
12
|
* @import 'fumadocs-ui/css/neutral.css';
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
--dk-tab-inactive-foreground: var(--color-fd-muted-foreground, hsl(0 0% 60%));
|
|
24
24
|
--dk-tab-active-foreground: var(--color-fd-foreground, hsl(0 0% 98%));
|
|
25
25
|
--dk-selection: var(--color-fd-primary, hsl(220 70% 50%));
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
/* Line highlight colors */
|
|
28
28
|
--dk-line-bg: transparent;
|
|
29
29
|
--dk-line-border: transparent;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/* Light mode overrides if needed */
|
|
33
|
-
.light,
|
|
33
|
+
.light,
|
|
34
|
+
[data-theme="light"] {
|
|
34
35
|
--dk-background: var(--color-fd-card, hsl(0 0% 98%));
|
|
35
36
|
--dk-border: var(--color-fd-border, hsl(0 0% 85%));
|
|
36
37
|
--dk-tabs-background: var(--color-fd-muted, hsl(0 0% 95%));
|
|
@@ -97,7 +98,8 @@
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
/* GitHub Light theme */
|
|
100
|
-
.light,
|
|
101
|
+
.light,
|
|
102
|
+
[data-theme="light"] {
|
|
101
103
|
--ch-0: #24292f; /* default text */
|
|
102
104
|
--ch-1: #cf222e; /* strings, inherited class */
|
|
103
105
|
--ch-2: #116329; /* string literals */
|
|
@@ -127,4 +129,3 @@
|
|
|
127
129
|
--ch-26: #ffffffe6;
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
|
-
|
package/tsconfig.json
CHANGED