@bytechain.cn/colamd-themes 0.3.0 → 0.3.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.
Files changed (39) hide show
  1. package/.openclaw/skills/colamd-themes/SKILL.md +15 -124
  2. package/.trae/rules/colamd-themes.md +15 -124
  3. package/CHANGELOG.md +142 -3
  4. package/README.md +12 -1
  5. package/README_CN.md +12 -1
  6. package/RELEASENOTE.md +212 -0
  7. package/dist/cli.js +278 -2
  8. package/dist/cli.js.map +1 -1
  9. package/dist/export-cli.d.ts +1 -0
  10. package/dist/export-cli.js +208 -176
  11. package/dist/export-cli.js.map +1 -1
  12. package/dist/extractors/url-extractor.d.ts +6 -0
  13. package/dist/extractors/url-extractor.js +51 -2
  14. package/dist/extractors/url-extractor.js.map +1 -1
  15. package/dist/generator.d.ts +4 -0
  16. package/dist/generator.js +74 -7
  17. package/dist/generator.js.map +1 -1
  18. package/dist/renderer.d.ts +1 -1
  19. package/dist/renderer.js +87 -14
  20. package/dist/renderer.js.map +1 -1
  21. package/dist/theme-store.d.ts +7 -6
  22. package/dist/theme-store.js +84 -34
  23. package/dist/theme-store.js.map +1 -1
  24. package/dist/utils/cli-utils.d.ts +55 -0
  25. package/dist/utils/cli-utils.js +80 -0
  26. package/dist/utils/cli-utils.js.map +1 -0
  27. package/package.json +1 -1
  28. package/skills/colamd-themes/SKILL.md +30 -0
  29. package/src/cli.ts +289 -2
  30. package/src/export-cli.ts +248 -193
  31. package/src/extractors/url-extractor.ts +56 -2
  32. package/src/generator.ts +88 -7
  33. package/src/renderer.ts +96 -14
  34. package/src/theme-store.ts +93 -35
  35. package/src/utils/cli-utils.ts +84 -0
  36. package/.claude/skills/colamd-themes-preview.skill.md +0 -333
  37. package/.claude/skills/colamd-themes.skill.md +0 -155
  38. package/.hermes/skills/tools/colamd-themes/SKILL.md +0 -159
  39. package/.opencode/skills/colamd-themes/SKILL.md +0 -162
@@ -1,162 +0,0 @@
1
- ---
2
- name: colamd-themes
3
- version: "1.0.0"
4
- description: >
5
- Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes.
6
- Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
7
- user-invocable: true
8
- allowed-tools:
9
- - Read
10
- - Write
11
- - Edit
12
- - Bash
13
- - Glob
14
- - Grep
15
- ---
16
-
17
- Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes. Extract formatting from URLs, DOCX, or PDF sources; export Markdown to standalone HTML/PDF with themes applied; batch export; manage theme configuration.
18
-
19
- ## Prerequisites
20
-
21
- - Node.js ≥ 18
22
- - Project root: run `npm install && npm run build` before first use
23
- - Or run directly: `npx tsx src/cli.ts <command>`
24
-
25
- ## Commands
26
-
27
- ### Theme extraction
28
-
29
- ```bash
30
- colamd-themes from-url <URL> [options]
31
- colamd-themes from-docx <file> [options]
32
- colamd-themes from-pdf <file> [options]
33
- colamd-themes extract <source> [options]
34
- ```
35
-
36
- ### Export to HTML / PDF
37
-
38
- ```bash
39
- colamd-themes export-html <input.md> -t <theme> -o <output.html>
40
- colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
41
- colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
42
- ```
43
-
44
- ### Theme management
45
-
46
- ```bash
47
- colamd-themes set-theme <name> --default
48
- colamd-themes set-theme <name> --css <file>
49
- colamd-themes set-theme <name> --css <file> --default
50
- colamd-themes set-theme <name> --remove
51
- ```
52
-
53
- ### Inspection
54
-
55
- ```bash
56
- colamd-themes color-systems [-j]
57
- colamd-themes mermaid-presets [-j]
58
- colamd-themes list [-d <dir>]
59
- colamd-themes validate <file.css>
60
- ```
61
-
62
- ## Options
63
-
64
- ### Extract options
65
-
66
- | Flag | Description |
67
- |------|-------------|
68
- | `-n, --name` | Theme name |
69
- | `-o, --output` | Output CSS file path |
70
- | `-d, --themes-dir` | Themes directory (default: `themes/`) |
71
- | `-c, --color-system` | Force a color system |
72
- | `-m, --mermaid-preset` | Force a Mermaid preset (light/dark/elegant) |
73
- | `-A, --auto-match` | Auto-match color system and Mermaid preset |
74
-
75
- ### Export options
76
-
77
- | Flag | Description |
78
- |------|-------------|
79
- | `-t, --theme` | Theme: built-in name, custom name, or `.css` file path |
80
- | `-o, --output` | Output file path |
81
- | `-d, --output-dir` | Output directory for batch export |
82
- | `--format` | Batch: `html` or `pdf`; PDF: `A4`, `Letter`, `A3` |
83
-
84
- ## Theme Resolution
85
-
86
- `-t, --theme` accepts:
87
- 1. **Built-in**: `light`, `dark`, `elegant`, `newsprint`
88
- 2. **Custom registered**: name set via `set-theme --css`
89
- 3. **File path**: any `.css` file on disk
90
-
91
- Config: `~/.colamd-themes/config.json`
92
-
93
- ## Color Systems (15 schemes)
94
-
95
- | Family | Schemes |
96
- |--------|---------|
97
- | 莫兰迪 (Morandi) | misty-rose, sage-green, dusky-blue |
98
- | 马卡龙 (Macaron) | strawberry, mint, lavender |
99
- | 北欧 (Nordic) | fjord-blue, pine-green, cloud-grey |
100
- | 复古 (Vintage) | amber, burgundy, forest |
101
- | 薄荷绿 (Mint) | matcha, spearmint, seafoam |
102
-
103
- ## Mermaid Presets
104
-
105
- `light` — cool accent on light bg | `dark` — dark bg | `elegant` — warm accent on light bg
106
-
107
- ## Workflow Examples
108
-
109
- ### Create theme from source
110
-
111
- ```bash
112
- colamd-themes extract <source> --name "my-theme" --auto-match
113
- ```
114
-
115
- ### Export with theme
116
-
117
- ```bash
118
- colamd-themes export-html doc.md -t elegant -o output.html
119
- colamd-themes export-pdf doc.md -t my-brand -o output.pdf
120
- ```
121
-
122
- ### Batch export
123
-
124
- ```bash
125
- colamd-themes export docs/ --format pdf -t dark -d output/
126
- ```
127
-
128
- ### Validate theme
129
-
130
- ```bash
131
- colamd-themes validate themes/my-theme.css
132
- ```
133
-
134
- ## Rendering Pipeline
135
-
136
- Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
137
-
138
- 1. Local HTTP server serves renderer ESM bundle (avoids CORS)
139
- 2. Puppeteer navigates to server page (same-origin)
140
- 3. `createColaMDEditor({ editable: false })` initializes Milkdown editor
141
- 4. `applyTheme(name, customCSS?)` sets theme
142
- 5. `setMarkdown(content)` loads document
143
- 6. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
144
- 7. `buildExportHTML()` → standalone HTML with embedded CSS
145
- 8. For PDF: `emulateMediaType('screen')` + `page.pdf()`
146
-
147
- ## v3.0 Paradigm Constraints
148
-
149
- - No bare hex colors in selectors — use `var(--seed-*)`
150
- - No bare font sizes — use `var(--font-*)`
151
- - No Mermaid SVG selectors (handled by built-in `variables.css`)
152
- - `!important` only in `@media print`
153
- - Generated CSS ≤ 300 lines
154
- - Font stacks must include CJK fallback and end with generic family
155
-
156
- ## Architecture
157
-
158
- ```
159
- Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
160
-
161
- Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
162
- ```