@pikacss/plugin-typography 0.0.40 → 0.0.41
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/package.json +5 -5
- package/README.md +0 -314
package/package.json
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.41",
|
|
8
8
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/pikacss/pikacss.
|
|
12
|
+
"url": "https://github.com/pikacss/pikacss.git",
|
|
13
13
|
"directory": "packages/plugin-typography"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/pikacss/pikacss
|
|
16
|
+
"url": "https://github.com/pikacss/pikacss/issues"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"pikacss",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@pikacss/core": "0.0.
|
|
42
|
+
"@pikacss/core": "0.0.41"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@pikacss/core": "0.0.
|
|
45
|
+
"@pikacss/core": "0.0.41"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsdown",
|
package/README.md
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
# @pikacss/plugin-typography
|
|
2
|
-
|
|
3
|
-
Beautiful typographic defaults for HTML you don't control.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @pikacss/plugin-typography
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
|
-
**pika.config.ts**:
|
|
14
|
-
```typescript
|
|
15
|
-
import { defineEngineConfig } from '@pikacss/core'
|
|
16
|
-
import { typography } from '@pikacss/plugin-typography'
|
|
17
|
-
|
|
18
|
-
export default defineEngineConfig({
|
|
19
|
-
plugins: [
|
|
20
|
-
typography() // Note: must call function
|
|
21
|
-
]
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Your HTML**:
|
|
26
|
-
```html
|
|
27
|
-
<article class="prose">
|
|
28
|
-
<h1>Your Article Title</h1>
|
|
29
|
-
<p>Your content goes here...</p>
|
|
30
|
-
</article>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Features
|
|
34
|
-
|
|
35
|
-
- 🎨 Beautiful typographic defaults
|
|
36
|
-
- � Modular shortcuts for granular control
|
|
37
|
-
- 📏 Multiple size modifiers (sm, lg, xl, 2xl)
|
|
38
|
-
- 🎯 Semantic HTML element styling
|
|
39
|
-
- 🔧 Fully customizable via CSS variables
|
|
40
|
-
- 🌙 Dark mode support through CSS variables
|
|
41
|
-
- ⚡ Automatic style deduplication
|
|
42
|
-
- 🔌 Zero dependencies (except @pikacss/core)
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
### Complete Prose Style
|
|
47
|
-
|
|
48
|
-
Use `prose` for all typography styles:
|
|
49
|
-
|
|
50
|
-
```html
|
|
51
|
-
<article class="prose">
|
|
52
|
-
<h1>Your Article Title</h1>
|
|
53
|
-
<p>Your content goes here...</p>
|
|
54
|
-
</article>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Modular Shortcuts
|
|
58
|
-
|
|
59
|
-
PikaCSS typography plugin provides modular shortcuts that you can mix and match according to your needs.
|
|
60
|
-
|
|
61
|
-
**Important:** Each modular shortcut automatically includes `prose-base` styles, so you don't need to add it manually. The engine will automatically deduplicate styles when combining multiple shortcuts.
|
|
62
|
-
|
|
63
|
-
#### Why Modular?
|
|
64
|
-
|
|
65
|
-
- ✅ **Smaller CSS Bundle**: Only include the styles you actually use
|
|
66
|
-
- ✅ **Better Performance**: Less CSS to parse and apply
|
|
67
|
-
- ✅ **More Flexible**: Combine exactly what you need for each section
|
|
68
|
-
- ✅ **Easier Debugging**: Know exactly which styles are applied
|
|
69
|
-
- ✅ **Better Control**: Avoid style conflicts with unused elements
|
|
70
|
-
|
|
71
|
-
#### Available Modular Shortcuts
|
|
72
|
-
|
|
73
|
-
Each shortcut automatically includes `prose-base` for consistent styling:
|
|
74
|
-
|
|
75
|
-
- `prose-base` - Base styles (color, max-width, font-size, line-height)
|
|
76
|
-
- `prose-paragraphs` - Paragraph and lead text styles (includes `prose-base`)
|
|
77
|
-
- `prose-links` - Link styles (includes `prose-base`)
|
|
78
|
-
- `prose-emphasis` - Strong and em styles (includes `prose-base`)
|
|
79
|
-
- `prose-kbd` - Keyboard input styles (includes `prose-base`)
|
|
80
|
-
- `prose-lists` - List styles (ul, ol, li, dl, dt, dd) (includes `prose-base`)
|
|
81
|
-
- `prose-hr` - Horizontal rule styles (includes `prose-base`)
|
|
82
|
-
- `prose-headings` - Heading styles (h1-h4) (includes `prose-base`)
|
|
83
|
-
- `prose-quotes` - Blockquote styles (includes `prose-base`)
|
|
84
|
-
- `prose-media` - Media styles (img, video, figure, figcaption) (includes `prose-base`)
|
|
85
|
-
- `prose-code` - Code and pre styles (includes `prose-base`)
|
|
86
|
-
- `prose-tables` - Table styles (includes `prose-base`)
|
|
87
|
-
- `prose` - Complete prose (combination of all above)
|
|
88
|
-
|
|
89
|
-
#### Usage Examples
|
|
90
|
-
|
|
91
|
-
```html
|
|
92
|
-
<!-- Minimal blog post - just headings and paragraphs -->
|
|
93
|
-
<article class="prose-headings prose-paragraphs">
|
|
94
|
-
<h1>Blog Post Title</h1>
|
|
95
|
-
<p>Just simple text content.</p>
|
|
96
|
-
</article>
|
|
97
|
-
|
|
98
|
-
<!-- Technical documentation - headings, code, and lists -->
|
|
99
|
-
<article class="prose-headings prose-code prose-lists">
|
|
100
|
-
<h1>API Documentation</h1>
|
|
101
|
-
<pre><code>npm install package-name</code></pre>
|
|
102
|
-
<ul>
|
|
103
|
-
<li>Feature 1</li>
|
|
104
|
-
<li>Feature 2</li>
|
|
105
|
-
</ul>
|
|
106
|
-
</article>
|
|
107
|
-
|
|
108
|
-
<!-- Rich blog content - multiple elements -->
|
|
109
|
-
<article class="prose-headings prose-paragraphs prose-links prose-emphasis prose-quotes prose-media">
|
|
110
|
-
<h1>Travel Blog</h1>
|
|
111
|
-
<p>I recently visited <strong>Japan</strong> and it was <em>amazing</em>!</p>
|
|
112
|
-
<blockquote>
|
|
113
|
-
<p>Travel is the only thing you buy that makes you richer.</p>
|
|
114
|
-
</blockquote>
|
|
115
|
-
<figure>
|
|
116
|
-
<img src="photo.jpg" alt="Scenery">
|
|
117
|
-
<figcaption>Mount Fuji at sunrise</figcaption>
|
|
118
|
-
</figure>
|
|
119
|
-
</article>
|
|
120
|
-
|
|
121
|
-
<!-- Data table document -->
|
|
122
|
-
<article class="prose-headings prose-paragraphs prose-tables">
|
|
123
|
-
<h1>Sales Report</h1>
|
|
124
|
-
<p>Q4 2023 results</p>
|
|
125
|
-
<table>
|
|
126
|
-
<!-- table content -->
|
|
127
|
-
</table>
|
|
128
|
-
</article>
|
|
129
|
-
|
|
130
|
-
<!-- Keyboard shortcuts guide -->
|
|
131
|
-
<article class="prose-headings prose-lists prose-kbd">
|
|
132
|
-
<h1>Keyboard Shortcuts</h1>
|
|
133
|
-
<ul>
|
|
134
|
-
<li>Save: <kbd>Cmd</kbd> + <kbd>S</kbd></li>
|
|
135
|
-
<li>Copy: <kbd>Cmd</kbd> + <kbd>C</kbd></li>
|
|
136
|
-
</ul>
|
|
137
|
-
</article>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### Common Combinations
|
|
141
|
-
|
|
142
|
-
**Blog Post**:
|
|
143
|
-
```html
|
|
144
|
-
class="prose-headings prose-paragraphs prose-links prose-emphasis prose-lists"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
**Technical Documentation**:
|
|
148
|
-
```html
|
|
149
|
-
class="prose-headings prose-paragraphs prose-code prose-lists prose-links"
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**News Article**:
|
|
153
|
-
```html
|
|
154
|
-
class="prose-headings prose-paragraphs prose-links prose-quotes prose-media"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**Data Page**:
|
|
158
|
-
```html
|
|
159
|
-
class="prose-headings prose-paragraphs prose-tables"
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Simple Landing Page**:
|
|
163
|
-
```html
|
|
164
|
-
class="prose-headings prose-paragraphs"
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Size Modifiers
|
|
168
|
-
|
|
169
|
-
Size modifiers apply the complete `prose` styles with different font sizes:
|
|
170
|
-
|
|
171
|
-
```html
|
|
172
|
-
<!-- Default size (1rem / 16px) -->
|
|
173
|
-
<article class="prose">...</article>
|
|
174
|
-
|
|
175
|
-
<!-- Small (0.875rem / 14px) -->
|
|
176
|
-
<article class="prose-sm">...</article>
|
|
177
|
-
|
|
178
|
-
<!-- Large (1.125rem / 18px) -->
|
|
179
|
-
<article class="prose-lg">...</article>
|
|
180
|
-
|
|
181
|
-
<!-- Extra Large (1.25rem / 20px) -->
|
|
182
|
-
<article class="prose-xl">...</article>
|
|
183
|
-
|
|
184
|
-
<!-- 2X Large (1.5rem / 24px) -->
|
|
185
|
-
<article class="prose-2xl">...</article>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Customization
|
|
189
|
-
|
|
190
|
-
The plugin provides module augmentation for type-safe configuration. After importing the plugin, the `typography` property becomes available in `EngineConfig` with full TypeScript autocomplete.
|
|
191
|
-
|
|
192
|
-
**pika.config.ts**:
|
|
193
|
-
```typescript
|
|
194
|
-
import { defineEngineConfig } from '@pikacss/core'
|
|
195
|
-
import { typography } from '@pikacss/plugin-typography'
|
|
196
|
-
|
|
197
|
-
// Module augmentation is automatic - just import the plugin
|
|
198
|
-
export default defineEngineConfig({
|
|
199
|
-
plugins: [
|
|
200
|
-
typography() // Note: must call function
|
|
201
|
-
],
|
|
202
|
-
typography: { // ✅ TypeScript autocomplete works here
|
|
203
|
-
variables: {
|
|
204
|
-
'--pk-prose-color-body': '#374151',
|
|
205
|
-
'--pk-prose-color-headings': '#111827',
|
|
206
|
-
'--pk-prose-color-links': '#2563eb',
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
})
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
**How Module Augmentation Works**:
|
|
213
|
-
|
|
214
|
-
The plugin declares module augmentation internally:
|
|
215
|
-
|
|
216
|
-
```typescript
|
|
217
|
-
declare module '@pikacss/core' {
|
|
218
|
-
interface EngineConfig {
|
|
219
|
-
typography?: {
|
|
220
|
-
variables?: Partial<Record<string, string>>
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
This enables:
|
|
227
|
-
- **IntelliSense**: TypeScript shows the `typography` property when you type in `defineEngineConfig`
|
|
228
|
-
- **Type Safety**: Invalid configuration shapes are caught at compile time
|
|
229
|
-
- **Documentation**: Hover over the property to see available options
|
|
230
|
-
|
|
231
|
-
#### Available CSS Variables
|
|
232
|
-
|
|
233
|
-
```css
|
|
234
|
-
--pk-prose-color-body /* Body text color */
|
|
235
|
-
--pk-prose-color-headings /* Heading text color */
|
|
236
|
-
--pk-prose-color-lead /* Lead paragraph color */
|
|
237
|
-
--pk-prose-color-links /* Link color */
|
|
238
|
-
--pk-prose-color-bold /* Bold text color */
|
|
239
|
-
--pk-prose-color-counters /* List counter color */
|
|
240
|
-
--pk-prose-color-bullets /* List bullet color */
|
|
241
|
-
--pk-prose-color-hr /* Horizontal rule color */
|
|
242
|
-
--pk-prose-color-quotes /* Blockquote text color */
|
|
243
|
-
--pk-prose-color-quote-borders /* Blockquote border color */
|
|
244
|
-
--pk-prose-color-captions /* Image caption color */
|
|
245
|
-
--pk-prose-color-code /* Inline code color */
|
|
246
|
-
--pk-prose-color-pre-code /* Code block text color */
|
|
247
|
-
--pk-prose-color-pre-bg /* Code block background */
|
|
248
|
-
--pk-prose-color-th-borders /* Table header border color */
|
|
249
|
-
--pk-prose-color-td-borders /* Table cell border color */
|
|
250
|
-
--pk-prose-color-kbd /* Keyboard input color */
|
|
251
|
-
--pk-prose-kbd-shadows /* Keyboard input shadow color */
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Dark Mode
|
|
255
|
-
|
|
256
|
-
Implement dark mode by overriding CSS variables:
|
|
257
|
-
|
|
258
|
-
```css
|
|
259
|
-
@media (prefers-color-scheme: dark) {
|
|
260
|
-
.prose {
|
|
261
|
-
--pk-prose-color-body: #d1d5db;
|
|
262
|
-
--pk-prose-color-headings: #fff;
|
|
263
|
-
--pk-prose-color-links: #60a5fa;
|
|
264
|
-
--pk-prose-color-quote-borders: #374151;
|
|
265
|
-
--pk-prose-color-pre-bg: #1f2937;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Styled Elements
|
|
271
|
-
|
|
272
|
-
This plugin provides modular styles for:
|
|
273
|
-
|
|
274
|
-
- **Base**: Container styles (max-width, font size, line height)
|
|
275
|
-
- **Paragraphs**: `p`, lead text (`[class~="lead"]`)
|
|
276
|
-
- **Links**: `a`
|
|
277
|
-
- **Emphasis**: `strong`, `em`
|
|
278
|
-
- **Keyboard**: `kbd`
|
|
279
|
-
- **Lists**: `ul`, `ol`, `li`, `dl`, `dt`, `dd`
|
|
280
|
-
- **Horizontal Rule**: `hr`
|
|
281
|
-
- **Headings**: `h1`, `h2`, `h3`, `h4`
|
|
282
|
-
- **Quotes**: `blockquote`
|
|
283
|
-
- **Media**: `img`, `video`, `figure`, `figcaption`, `picture`
|
|
284
|
-
- **Code**: `code`, `pre`
|
|
285
|
-
- **Tables**: `table`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`
|
|
286
|
-
|
|
287
|
-
## Architecture
|
|
288
|
-
|
|
289
|
-
The plugin uses a modular architecture with automatic deduplication:
|
|
290
|
-
|
|
291
|
-
- Each modular shortcut is registered with `prose-base` included
|
|
292
|
-
- When combining multiple shortcuts, the engine automatically deduplicates `prose-base`
|
|
293
|
-
- The `prose` shortcut combines all modular shortcuts using shortcut names
|
|
294
|
-
- This ensures optimal performance and consistent styling
|
|
295
|
-
|
|
296
|
-
## Performance
|
|
297
|
-
|
|
298
|
-
Using modular shortcuts can significantly reduce CSS bundle size:
|
|
299
|
-
|
|
300
|
-
```html
|
|
301
|
-
<!-- Full prose: ~100% of typography CSS -->
|
|
302
|
-
<article class="prose">...</article>
|
|
303
|
-
|
|
304
|
-
<!-- Modular: ~30-40% of typography CSS (depending on combination) -->
|
|
305
|
-
<article class="prose-headings prose-paragraphs prose-links">...</article>
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
## Documentation
|
|
309
|
-
|
|
310
|
-
For complete documentation, visit: [PikaCSS Documentation](https://pikacss.github.io/pikacss/)
|
|
311
|
-
|
|
312
|
-
## License
|
|
313
|
-
|
|
314
|
-
MIT © DevilTea
|