@openpkg-ts/doc-generator 0.3.3 → 0.3.4
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/README.md +45 -0
- package/dist/react-styled.js +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,51 @@ import { FunctionPage, ClassPage } from '@openpkg-ts/doc-generator/react/styled'
|
|
|
81
81
|
<ClassPage export={cls} />
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### Styled Components Setup (Fumadocs)
|
|
85
|
+
|
|
86
|
+
Pre-styled components require CSS variables and Tailwind configuration for proper theming and syntax highlighting.
|
|
87
|
+
|
|
88
|
+
#### 1. Install adapter
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm install @openpkg-ts/fumadocs-adapter
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### 2. Import CSS
|
|
95
|
+
|
|
96
|
+
Add to your global CSS (e.g., `app/global.css`):
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
@import 'tailwindcss';
|
|
100
|
+
@import 'fumadocs-ui/css/neutral.css';
|
|
101
|
+
@import 'fumadocs-ui/css/preset.css';
|
|
102
|
+
@import '@openpkg-ts/fumadocs-adapter/css';
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This provides:
|
|
106
|
+
- `--dk-*` variables for DocsKit code blocks
|
|
107
|
+
- `--ch-*` variables for CodeHike syntax highlighting (GitHub theme)
|
|
108
|
+
- `--api-*` variables for API reference styling
|
|
109
|
+
- Light/dark mode support
|
|
110
|
+
|
|
111
|
+
#### 3. Tailwind v4 source scanning
|
|
112
|
+
|
|
113
|
+
Tailwind v4 excludes `node_modules` by default. Add this directive to scan styled component classes:
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
@source "../node_modules/@openpkg-ts/doc-generator/dist/**/*.js";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Without this, utility classes like `lg:grid-cols-[1fr,minmax(0,420px)]` won't be included in your build.
|
|
120
|
+
|
|
121
|
+
#### 4. Layout requirements
|
|
122
|
+
|
|
123
|
+
Styled components use a two-column layout at the `lg:` breakpoint (1024px). For best results:
|
|
124
|
+
|
|
125
|
+
- Content area should be >= 1024px wide
|
|
126
|
+
- In Fumadocs, consider using `full` layout for API pages or hiding the TOC to maximize content width
|
|
127
|
+
- On narrower viewports, the layout stacks vertically
|
|
128
|
+
|
|
84
129
|
## API Reference
|
|
85
130
|
|
|
86
131
|
### Core Functions
|
package/dist/react-styled.js
CHANGED
|
@@ -23095,6 +23095,7 @@ function ExportIndexPage({
|
|
|
23095
23095
|
// src/components/styled/FunctionPage.tsx
|
|
23096
23096
|
import { cn as cn5 } from "@doccov/ui/lib/utils";
|
|
23097
23097
|
import { CodeTabs as CodeTabs2, ImportSection as ImportSection2 } from "@doccov/ui/api";
|
|
23098
|
+
import { ClientDocsKitCode } from "@doccov/ui/docskit";
|
|
23098
23099
|
import { useState as useState7 } from "react";
|
|
23099
23100
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
23100
23101
|
|
|
@@ -23118,15 +23119,16 @@ function FunctionPage({
|
|
|
23118
23119
|
const code = typeof example === "string" ? example : example.code;
|
|
23119
23120
|
const title = typeof example === "string" ? `Example ${index + 1}` : example.title || `Example ${index + 1}`;
|
|
23120
23121
|
const filename = `${exp.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}-${index + 1}.ts`;
|
|
23122
|
+
const lang = typeof example === "string" ? "ts" : example.language || "ts";
|
|
23121
23123
|
return {
|
|
23122
23124
|
label: title,
|
|
23123
23125
|
code,
|
|
23124
|
-
content: renderExample ? renderExample(code, filename) : /* @__PURE__ */ jsx13(
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
}
|
|
23126
|
+
content: renderExample ? renderExample(code, filename) : /* @__PURE__ */ jsx13(ClientDocsKitCode, {
|
|
23127
|
+
codeblock: {
|
|
23128
|
+
value: code,
|
|
23129
|
+
lang,
|
|
23130
|
+
meta: "-c"
|
|
23131
|
+
}
|
|
23130
23132
|
})
|
|
23131
23133
|
};
|
|
23132
23134
|
}) : [];
|