@bytechain.cn/colamd-themes 0.3.0
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/.claude/skills/colamd-themes-preview.skill.md +333 -0
- package/.claude/skills/colamd-themes.skill.md +155 -0
- package/.hermes/skills/tools/colamd-themes/SKILL.md +159 -0
- package/.openclaw/skills/colamd-themes/SKILL.md +166 -0
- package/.opencode/skills/colamd-themes/SKILL.md +162 -0
- package/.trae/rules/colamd-themes.md +150 -0
- package/CHANGELOG.md +102 -0
- package/README.md +373 -0
- package/README_CN.md +373 -0
- package/RELEASENOTE.md +177 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +208 -0
- package/dist/cli.js.map +1 -0
- package/dist/color-systems.d.ts +17 -0
- package/dist/color-systems.js +251 -0
- package/dist/color-systems.js.map +1 -0
- package/dist/color-utils.d.ts +9 -0
- package/dist/color-utils.js +112 -0
- package/dist/color-utils.js.map +1 -0
- package/dist/contrast.d.ts +15 -0
- package/dist/contrast.js +63 -0
- package/dist/contrast.js.map +1 -0
- package/dist/docx-style-paradigm.d.ts +153 -0
- package/dist/docx-style-paradigm.js +640 -0
- package/dist/docx-style-paradigm.js.map +1 -0
- package/dist/export-cli.d.ts +10 -0
- package/dist/export-cli.js +266 -0
- package/dist/export-cli.js.map +1 -0
- package/dist/extractors/base.d.ts +6 -0
- package/dist/extractors/base.js +3 -0
- package/dist/extractors/base.js.map +1 -0
- package/dist/extractors/docx-extractor.d.ts +52 -0
- package/dist/extractors/docx-extractor.js +370 -0
- package/dist/extractors/docx-extractor.js.map +1 -0
- package/dist/extractors/pdf-extractor.d.ts +66 -0
- package/dist/extractors/pdf-extractor.js +430 -0
- package/dist/extractors/pdf-extractor.js.map +1 -0
- package/dist/extractors/url-extractor.d.ts +104 -0
- package/dist/extractors/url-extractor.js +761 -0
- package/dist/extractors/url-extractor.js.map +1 -0
- package/dist/generator.d.ts +4 -0
- package/dist/generator.js +71 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/mermaid-presets.d.ts +14 -0
- package/dist/mermaid-presets.js +122 -0
- package/dist/mermaid-presets.js.map +1 -0
- package/dist/models.d.ts +106 -0
- package/dist/models.js +92 -0
- package/dist/models.js.map +1 -0
- package/dist/renderer.d.ts +70 -0
- package/dist/renderer.js +204 -0
- package/dist/renderer.js.map +1 -0
- package/dist/templates/template.css +498 -0
- package/dist/templates/theme-paradigm.md +658 -0
- package/dist/templates/theme-template.hbs +370 -0
- package/dist/theme-store.d.ts +37 -0
- package/dist/theme-store.js +90 -0
- package/dist/theme-store.js.map +1 -0
- package/dist/validators.d.ts +26 -0
- package/dist/validators.js +144 -0
- package/dist/validators.js.map +1 -0
- package/package.json +36 -0
- package/skills/build-skills.sh +166 -0
- package/skills/colamd-themes/SKILL.md +148 -0
- package/src/cli.ts +200 -0
- package/src/color-systems.ts +289 -0
- package/src/color-utils.ts +120 -0
- package/src/contrast.ts +66 -0
- package/src/docx-style-paradigm.ts +811 -0
- package/src/export-cli.ts +301 -0
- package/src/extractors/base.ts +8 -0
- package/src/extractors/docx-extractor.ts +417 -0
- package/src/extractors/pdf-extractor.ts +527 -0
- package/src/extractors/url-extractor.ts +927 -0
- package/src/generator.ts +88 -0
- package/src/index.ts +29 -0
- package/src/mermaid-presets.ts +142 -0
- package/src/models.ts +212 -0
- package/src/renderer.ts +277 -0
- package/src/templates/template.css +498 -0
- package/src/templates/theme-paradigm.md +658 -0
- package/src/templates/theme-template.hbs +370 -0
- package/src/theme-store.ts +112 -0
- package/src/types/pdf-parse.d.ts +12 -0
- package/src/validators.ts +176 -0
- package/themes/.gitkeep +0 -0
- package/themes/academic-paper-pt.css +1805 -0
- package/themes/academic-paper.css +1099 -0
- package/themes/academic-style.css +2430 -0
- package/themes/colly.css +370 -0
- package/themes/elegant.css +671 -0
- package/themes/forest-ink.css +664 -0
- package/themes/guizang.css +732 -0
- package/themes/meeting-minutes.css +370 -0
- package/themes/pixso-design.css +1261 -0
- package/themes/salvator-blog.css +370 -0
- package/themes/swiss-design copy.css +746 -0
- package/themes/swiss-design.css +746 -0
- package/themes/template.css +498 -0
- package/themes/trae-blue.css +737 -0
- package/themes-preview/colly-preview.html +623 -0
- package/themes-preview/demo-content.md +187 -0
- package/themes-preview/meeting-minutes-preview.html +625 -0
- package/themes-preview/salvator-blog-preview.html +623 -0
- package/tsconfig.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# ColaMD Themes
|
|
2
|
+
|
|
3
|
+
A theme development & export toolkit for [ColaMD](https://github.com/cola-md/cola-md) — the Agent-native Markdown editor. Extract visual formatting from web pages, Word documents, and PDFs, convert them into validated CSS theme files, and export Markdown to standalone HTML or PDF with any theme applied.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Theme Extraction
|
|
8
|
+
|
|
9
|
+
- **URL** — fetch a web page, parse its CSS rules (via `css-tree`), resolve inline styles with specificity calculation, and derive a coherent theme palette
|
|
10
|
+
- **DOCX** — read Word document styles (H1–H6, tables, code blocks) via mammoth, map to theme variables
|
|
11
|
+
- **PDF** — extract typography metadata from PDF text using multi-layer heuristic analysis
|
|
12
|
+
- **Auto‑detect** — `extract` command automatically routes to the right extractor
|
|
13
|
+
|
|
14
|
+
### HTML / PDF Export
|
|
15
|
+
|
|
16
|
+
- **`export-html`** — render Markdown to a standalone HTML document with theme CSS embedded, Mermaid diagrams and KaTeX math fully rendered
|
|
17
|
+
- **`export-pdf`** — render Markdown to PDF via Puppeteer (Chromium), preserving theme colors with `@media print` fidelity
|
|
18
|
+
- **`export`** — batch export multiple files or entire directories to HTML or PDF
|
|
19
|
+
- Powered by `@bytechain.cn/colamd/renderer` — the same Milkdown editor engine used by ColaMD itself
|
|
20
|
+
|
|
21
|
+
### Theme Management
|
|
22
|
+
|
|
23
|
+
- **`set-theme`** — configure default export theme, register custom CSS themes, switch between built-in themes
|
|
24
|
+
- Built-in themes: `light`, `dark`, `elegant`, `newsprint`
|
|
25
|
+
- Custom themes: any `.css` file registered by name, referenced in exports
|
|
26
|
+
|
|
27
|
+
### Validation & Color Systems
|
|
28
|
+
|
|
29
|
+
- **Contrast Engine** — WCAG 2.1 relative luminance & contrast ratio calculations
|
|
30
|
+
- **Paradigm Validator** — 15+ design constraint rules (CR, HR, SL, NT, BD, MP, FP, FS, SH) with auto-fix suggestions
|
|
31
|
+
- **Color System Library** — 15 predefined seed palettes across 5 families (Morandi, Macaron, Nordic, Vintage, Mint)
|
|
32
|
+
- **Mermaid Presets** — 3 presets (light/dark/elegant) with 20 core variables, auto-selected by luminance and accent warmth
|
|
33
|
+
|
|
34
|
+
### CSS Template Engine
|
|
35
|
+
|
|
36
|
+
Handlebars-powered template produces v3.0 paradigm CSS (≤300 lines):
|
|
37
|
+
|
|
38
|
+
| Section | Content |
|
|
39
|
+
|---------|---------|
|
|
40
|
+
| 1 | Design Tokens — seed palette (11 vars), typography (4 font stacks), font sizing, radii & spacing |
|
|
41
|
+
| 2 | Semantic Mapping — auto-derived from seed tokens via `var(--seed-*)` |
|
|
42
|
+
| 3 | Mermaid 20 Core Variables — container, font, nodes, edges, clusters, labels, titles, person, offset |
|
|
43
|
+
| 4 | Fine Tuning |
|
|
44
|
+
| 5 | Selector-Level Micro Adjustments — headings, code, pre, blockquote, table, hr, responsive |
|
|
45
|
+
| 6 | `@media print` — screen-mirror with `!important` + `print-color-adjust: exact` |
|
|
46
|
+
|
|
47
|
+
### Multi-Agent Skill
|
|
48
|
+
|
|
49
|
+
Universal skill definitions for 5 AI coding agents, auto-generated from a single source:
|
|
50
|
+
|
|
51
|
+
| Agent | Skill Path | Frontmatter |
|
|
52
|
+
|-------|-----------|-------------|
|
|
53
|
+
| **Claude Code** | `.claude/skills/colamd-themes.skill.md` | `name`, `description` |
|
|
54
|
+
| **OpenCode** | `.opencode/skills/colamd-themes/SKILL.md` | `name`, `version`, `user-invocable`, `allowed-tools`, `hooks` |
|
|
55
|
+
| **OpenClaw** | `.openclaw/skills/colamd-themes/SKILL.md` | `id`, `name`, `version`, `icon`, `author`, `homepage`, `metadata.openclaw.os` |
|
|
56
|
+
| **Hermes** | `.hermes/skills/tools/colamd-themes/SKILL.md` | `name`, `version`, `author`, `license`, `metadata.hermes.tags`, `prerequisites` |
|
|
57
|
+
| **Trae** | `.trae/rules/colamd-themes.md` | Plain Markdown (no frontmatter) |
|
|
58
|
+
|
|
59
|
+
**Architecture:**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
skills/colamd-themes/SKILL.md ← Canonical source (single source of truth)
|
|
63
|
+
│
|
|
64
|
+
▼
|
|
65
|
+
skills/build-skills.sh ← Build script (bash)
|
|
66
|
+
│
|
|
67
|
+
├──→ .claude/skills/colamd-themes.skill.md
|
|
68
|
+
├──→ .opencode/skills/colamd-themes/SKILL.md
|
|
69
|
+
├──→ .openclaw/skills/colamd-themes/SKILL.md
|
|
70
|
+
├──→ .hermes/skills/tools/colamd-themes/SKILL.md
|
|
71
|
+
└──→ .trae/rules/colamd-themes.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Regenerate all agent skills:**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run build:skills # generate all
|
|
78
|
+
bash skills/build-skills.sh # same thing
|
|
79
|
+
|
|
80
|
+
# Or generate for a single agent:
|
|
81
|
+
bash skills/build-skills.sh claude
|
|
82
|
+
bash skills/build-skills.sh opencode
|
|
83
|
+
bash skills/build-skills.sh openclaw
|
|
84
|
+
bash skills/build-skills.sh hermes
|
|
85
|
+
bash skills/build-skills.sh trae
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To customize: edit `skills/colamd-themes/SKILL.md`, then run `npm run build:skills`.
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git clone git@github.com:byteuser1977/ColaMD-themes.git
|
|
94
|
+
cd ColaMD-themes
|
|
95
|
+
npm install
|
|
96
|
+
npm run build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For development with hot‑reload:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx tsx src/cli.ts <command>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
The package provides two equivalent CLI commands:
|
|
108
|
+
|
|
109
|
+
- **`colamd-themes`** — full command name
|
|
110
|
+
- **`cthemes`** — short alias (recommended for frequent use)
|
|
111
|
+
|
|
112
|
+
Examples below use the short alias `cthemes`, but you can substitute `colamd-themes` interchangeably.
|
|
113
|
+
|
|
114
|
+
### Extract a theme from a URL
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cthemes from-url "https://example.com" --name my-theme
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Extract from a Word document
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cthemes from-docx report.docx --name corporate-theme
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Extract from a PDF
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cthemes from-pdf paper.pdf --name academic-theme
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Auto‑detect source type
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
cthemes extract source.docx --name auto-theme
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Validate a theme
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
cthemes validate themes/my-theme.css
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### List themes and color systems
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cthemes list
|
|
148
|
+
cthemes color-systems
|
|
149
|
+
cthemes mermaid-presets
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Export to HTML
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Single file with a built-in theme
|
|
156
|
+
cthemes export-html document.md -t elegant -o output.html
|
|
157
|
+
|
|
158
|
+
# With a custom theme
|
|
159
|
+
cthemes export-html document.md -t my-brand -o output.html
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Export to PDF
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Single file
|
|
166
|
+
cthemes export-pdf document.md -t dark -o output.pdf
|
|
167
|
+
|
|
168
|
+
# With page format
|
|
169
|
+
cthemes export-pdf document.md -t elegant --format Letter -o output.pdf
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Batch export
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Multiple files to HTML
|
|
176
|
+
cthemes export docs/*.md --format html -t light -d output/
|
|
177
|
+
|
|
178
|
+
# Directory of Markdown files to PDF
|
|
179
|
+
cthemes export docs/ --format pdf -t elegant -d output/
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Theme management
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Set a built-in theme as default
|
|
186
|
+
cthemes set-theme elegant --default
|
|
187
|
+
|
|
188
|
+
# Register a custom theme from a CSS file
|
|
189
|
+
cthemes set-theme my-brand --css themes/swiss-design.css
|
|
190
|
+
|
|
191
|
+
# Register and set as default
|
|
192
|
+
cthemes set-theme my-brand --css themes/swiss-design.css --default
|
|
193
|
+
|
|
194
|
+
# Unregister a custom theme
|
|
195
|
+
cthemes set-theme my-brand --remove
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### All commands
|
|
199
|
+
|
|
200
|
+
| Command | Description |
|
|
201
|
+
|---------|-------------|
|
|
202
|
+
| `from-url <url>` | Extract theme from a web page URL |
|
|
203
|
+
| `from-docx <file>` | Extract theme from a .docx document |
|
|
204
|
+
| `from-pdf <file>` | Extract theme from a PDF document |
|
|
205
|
+
| `extract <source>` | Auto-detect source type and extract theme |
|
|
206
|
+
| `color-systems` | List 15 built-in color systems |
|
|
207
|
+
| `mermaid-presets` | List Mermaid presets (light/dark/elegant) |
|
|
208
|
+
| `list` | List all generated themes |
|
|
209
|
+
| `validate <file>` | Validate a theme against v3.0 paradigm rules |
|
|
210
|
+
| `set-theme <name>` | Set, register, or remove export themes |
|
|
211
|
+
| `export-html <input>` | Export Markdown → standalone HTML |
|
|
212
|
+
| `export-pdf <input>` | Export Markdown → PDF |
|
|
213
|
+
| `export <inputs...>` | Batch export multiple files or directories |
|
|
214
|
+
|
|
215
|
+
### Extract options
|
|
216
|
+
|
|
217
|
+
| Flag | Description |
|
|
218
|
+
|------|-------------|
|
|
219
|
+
| `-n, --name` | Theme name (derived from source by default) |
|
|
220
|
+
| `-o, --output` | Output CSS file path |
|
|
221
|
+
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
222
|
+
| `-c, --color-system` | Force a color system |
|
|
223
|
+
| `-m, --mermaid-preset` | Force a Mermaid preset |
|
|
224
|
+
| `-A, --auto-match` | Auto-match color system and Mermaid preset |
|
|
225
|
+
|
|
226
|
+
### Export options
|
|
227
|
+
|
|
228
|
+
| Flag | Description |
|
|
229
|
+
|------|-------------|
|
|
230
|
+
| `-t, --theme` | Theme name (built-in, custom, or CSS file path) |
|
|
231
|
+
| `-o, --output` | Output file path |
|
|
232
|
+
| `-d, --output-dir` | Output directory for batch export |
|
|
233
|
+
| `--format` | Output format for batch: `html` or `pdf` (default: `html`) |
|
|
234
|
+
| `--format` | PDF page size: `A4`, `Letter`, `A3` (default: `A4`) |
|
|
235
|
+
|
|
236
|
+
## How It Works
|
|
237
|
+
|
|
238
|
+
### Theme Extraction Pipeline
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
Source (URL / .docx / .pdf)
|
|
242
|
+
│
|
|
243
|
+
▼
|
|
244
|
+
┌─────────────────────┐
|
|
245
|
+
│ Extractor │ Parse → raw ThemeStyle
|
|
246
|
+
└──────────┬──────────┘
|
|
247
|
+
│
|
|
248
|
+
▼
|
|
249
|
+
┌─────────────────────┐
|
|
250
|
+
│ Color System │ Match → 15 built-in palettes
|
|
251
|
+
│ Mermaid Preset │ Select light/dark/elegant
|
|
252
|
+
│ Validators │ WCAG contrast + paradigm rules
|
|
253
|
+
└──────────┬──────────┘
|
|
254
|
+
│
|
|
255
|
+
▼
|
|
256
|
+
┌─────────────────────┐
|
|
257
|
+
│ Template Engine │ Handlebars → v3.0 CSS (≤300 lines)
|
|
258
|
+
└──────────┬──────────┘
|
|
259
|
+
│
|
|
260
|
+
▼
|
|
261
|
+
themes/<name>.css
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Export Pipeline
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Markdown file
|
|
268
|
+
│
|
|
269
|
+
▼
|
|
270
|
+
┌─────────────────────────────────────────────┐
|
|
271
|
+
│ Puppeteer (headless Chromium) │
|
|
272
|
+
│ ┌───────────────────────────────────────┐ │
|
|
273
|
+
│ │ Local HTTP Server │ │
|
|
274
|
+
│ │ serves @bytechain.cn/colamd/renderer │ │
|
|
275
|
+
│ │ (same-origin, no CORS) │ │
|
|
276
|
+
│ └──────────────┬────────────────────────┘ │
|
|
277
|
+
│ │ │
|
|
278
|
+
│ createColaMDEditor({ editable: false }) │
|
|
279
|
+
│ applyTheme(name, customCSS?) │
|
|
280
|
+
│ setMarkdown(content) │
|
|
281
|
+
│ ensureAllPluginsRendered() ← mermaid/KaTeX │
|
|
282
|
+
│ │ │
|
|
283
|
+
│ ┌──────────────┴──────────────┐ │
|
|
284
|
+
│ │ buildExportHTML() → .html │ │
|
|
285
|
+
│ │ page.pdf() → .pdf │ │
|
|
286
|
+
│ └─────────────────────────────┘ │
|
|
287
|
+
└─────────────────────────────────────────────┘
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Design Paradigm (v3.0)
|
|
291
|
+
|
|
292
|
+
Full specification: [`templates/theme-paradigm.md`](src/templates/theme-paradigm.md).
|
|
293
|
+
|
|
294
|
+
### Core Principles
|
|
295
|
+
|
|
296
|
+
| Principle | Description |
|
|
297
|
+
|-----------|-------------|
|
|
298
|
+
| **Variable-first** | All colors, fonts, sizes, spacing as CSS custom properties. No raw values in selectors |
|
|
299
|
+
| **Modular** | Theme = variables + minimal selector tweaks. Built-in systems inherit automatically |
|
|
300
|
+
| **Semantic** | `--color-link` not `--color-blue`; `--font-heading` not `--font-sans` |
|
|
301
|
+
| **Derivable** | Full theme from 5 seed colors + 3 font stacks. AI agents modify only Section 1 |
|
|
302
|
+
| **Print-faithful** | `@media print` mirrors screen styles with `!important` + `print-color-adjust` |
|
|
303
|
+
|
|
304
|
+
### Contrast Requirements (WCAG 2.1)
|
|
305
|
+
|
|
306
|
+
| Rule ID | Level | Requirement | Threshold |
|
|
307
|
+
|---------|-------|-------------|-----------|
|
|
308
|
+
| CR-01 | MUST | Body text vs background | ≥ 7:1 (AAA) |
|
|
309
|
+
| CR-02 | MUST | Secondary text vs background | ≥ 4.5:1 (AA) |
|
|
310
|
+
| CR-03 | MUST | Dimmed text vs background | ≥ 3:1 (AA large) |
|
|
311
|
+
| CR-04 | MUST | Accent color vs background | ≥ 4.5:1 (AA) |
|
|
312
|
+
| CR-05 | SHOULD | Inline code bg vs background | ≥ 1.5:1 |
|
|
313
|
+
|
|
314
|
+
## Project Structure
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
ColaMD-themes/
|
|
318
|
+
├── skills/
|
|
319
|
+
│ ├── colamd-themes/SKILL.md # Canonical skill source
|
|
320
|
+
│ └── build-skills.sh # Generate agent-specific files
|
|
321
|
+
├── .claude/skills/colamd-themes.skill.md # Claude Code skill
|
|
322
|
+
├── .opencode/skills/colamd-themes/SKILL.md # OpenCode skill
|
|
323
|
+
├── .openclaw/skills/colamd-themes/SKILL.md # OpenClaw skill
|
|
324
|
+
├── .hermes/skills/tools/colamd-themes/ # Hermes skill
|
|
325
|
+
├── .trae/rules/colamd-themes.md # Trae rules
|
|
326
|
+
├── package.json
|
|
327
|
+
├── tsconfig.json
|
|
328
|
+
├── themes/ # Generated CSS themes
|
|
329
|
+
├── src/
|
|
330
|
+
│ ├── cli.ts # CLI entry point
|
|
331
|
+
│ ├── index.ts # Public API exports
|
|
332
|
+
│ ├── models.ts # ThemeStyle / SeedPalette types
|
|
333
|
+
│ ├── generator.ts # Handlebars → CSS pipeline
|
|
334
|
+
│ ├── renderer.ts # Puppeteer HTML/PDF export engine
|
|
335
|
+
│ ├── export-cli.ts # Export CLI commands
|
|
336
|
+
│ ├── theme-store.ts # Theme config persistence
|
|
337
|
+
│ ├── color-utils.ts # Color manipulation utilities
|
|
338
|
+
│ ├── contrast.ts # WCAG 2.1 luminance & contrast
|
|
339
|
+
│ ├── validators.ts # Paradigm validation engine
|
|
340
|
+
│ ├── color-systems.ts # 15 predefined seed palettes
|
|
341
|
+
│ ├── mermaid-presets.ts # Mermaid 20-variable presets
|
|
342
|
+
│ ├── docx-style-paradigm.ts # Document style specification
|
|
343
|
+
│ ├── extractors/
|
|
344
|
+
│ │ ├── base.ts # Extractor interface
|
|
345
|
+
│ │ ├── url-extractor.ts # URL → ThemeStyle
|
|
346
|
+
│ │ ├── docx-extractor.ts # DOCX → ThemeStyle
|
|
347
|
+
│ │ └── pdf-extractor.ts # PDF → ThemeStyle
|
|
348
|
+
│ └── templates/
|
|
349
|
+
│ ├── template.css # Paradigm companion CSS
|
|
350
|
+
│ ├── theme-paradigm.md # v3.0 design specification
|
|
351
|
+
│ └── theme-template.hbs # Handlebars CSS template
|
|
352
|
+
└── tests/
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Tech Stack
|
|
356
|
+
|
|
357
|
+
| Component | Library | Purpose |
|
|
358
|
+
|-----------|---------|---------|
|
|
359
|
+
| Runtime | Node.js + TypeScript | ESM modules, strict typing |
|
|
360
|
+
| CLI framework | Commander.js | Argument parsing, subcommands |
|
|
361
|
+
| CSS templating | Handlebars | v3.0 paradigm CSS generation |
|
|
362
|
+
| HTML parsing | Cheerio | DOM traversal for URL extraction |
|
|
363
|
+
| CSS parsing | css-tree | CSS rule AST parsing |
|
|
364
|
+
| DOCX parsing | Mammoth | Word → HTML conversion |
|
|
365
|
+
| PDF parsing | pdf-parse | PDF text extraction |
|
|
366
|
+
| HTTP client | Axios | Web page fetching |
|
|
367
|
+
| Browser engine | Puppeteer | Headless Chromium for HTML/PDF export |
|
|
368
|
+
| Editor engine | @bytechain.cn/colamd | Milkdown-based Markdown renderer |
|
|
369
|
+
| Terminal output | Chalk + Ora | Colored text + spinners |
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
MIT
|