@pikacss/plugin-icons 0.0.40 → 0.0.42
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 -480
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikacss/plugin-icons",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.42",
|
|
5
5
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/pikacss/pikacss.
|
|
9
|
+
"url": "https://github.com/pikacss/pikacss.git",
|
|
10
10
|
"directory": "packages/plugin-icons"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/pikacss/pikacss
|
|
13
|
+
"url": "https://github.com/pikacss/pikacss/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"pikacss",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@pikacss/core": "0.0.
|
|
45
|
+
"@pikacss/core": "0.0.42"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@iconify/utils": "^3.1.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"ofetch": "^1.5.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@pikacss/core": "0.0.
|
|
53
|
+
"@pikacss/core": "0.0.42"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown && pnpm exec publint",
|
package/README.md
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable -->
|
|
2
|
-
# @pikacss/plugin-icons
|
|
3
|
-
|
|
4
|
-
Use thousands of icons from popular icon sets in PikaCSS with full TypeScript autocomplete.
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
pnpm add @pikacss/plugin-icons
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Quick Start
|
|
13
|
-
|
|
14
|
-
**pika.config.ts**:
|
|
15
|
-
```typescript
|
|
16
|
-
/// <reference path="./src/pika.gen.ts" />
|
|
17
|
-
|
|
18
|
-
import { defineEngineConfig } from '@pikacss/core'
|
|
19
|
-
import { icons } from '@pikacss/plugin-icons'
|
|
20
|
-
|
|
21
|
-
export default defineEngineConfig({
|
|
22
|
-
plugins: [
|
|
23
|
-
icons() // ⚠️ Must be a function call!
|
|
24
|
-
],
|
|
25
|
-
icons: {
|
|
26
|
-
prefix: 'i-',
|
|
27
|
-
scale: 1,
|
|
28
|
-
mode: 'auto',
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Module Augmentation** (TypeScript autocomplete support):
|
|
34
|
-
```typescript
|
|
35
|
-
declare module '@pikacss/core' {
|
|
36
|
-
interface EngineConfig {
|
|
37
|
-
icons?: {
|
|
38
|
-
prefix?: string | string[] // Default: 'i-'
|
|
39
|
-
scale?: number // Default: 1
|
|
40
|
-
mode?: 'auto' | 'mask' | 'bg' // Default: 'auto'
|
|
41
|
-
cdn?: string // CDN base URL
|
|
42
|
-
collections?: Record<string, any> // Custom icon collections
|
|
43
|
-
autoInstall?: boolean // Default: false
|
|
44
|
-
unit?: string // Size unit for icons
|
|
45
|
-
extraProperties?: Record<string, string> // Extra CSS props
|
|
46
|
-
processor?: (styleItem: StyleItem, meta: IconMeta) => void
|
|
47
|
-
autocomplete?: string[] // Icons for autocomplete
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default defineEngineConfig({
|
|
53
|
-
plugins: [icons()],
|
|
54
|
-
icons: { // ✅ Full autocomplete for all options
|
|
55
|
-
prefix: 'icon-',
|
|
56
|
-
scale: 1.2,
|
|
57
|
-
mode: 'mask'
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Your code** (3 usage methods):
|
|
63
|
-
```typescript
|
|
64
|
-
// Method 1: Direct shortcut string
|
|
65
|
-
const iconClass = pika('i-mdi:home')
|
|
66
|
-
|
|
67
|
-
// Method 2: Shortcut with additional styles (recommended)
|
|
68
|
-
const styledIcon = pika('i-mdi:home', {
|
|
69
|
-
fontSize: '24px',
|
|
70
|
-
color: 'blue'
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
// Method 3: Using __shortcut property in style object
|
|
74
|
-
const iconWithStyles = pika({
|
|
75
|
-
__shortcut: 'i-mdi:home',
|
|
76
|
-
fontSize: '24px'
|
|
77
|
-
})
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Features
|
|
81
|
-
|
|
82
|
-
- 🎨 **100,000+ icons** from popular icon sets via Iconify
|
|
83
|
-
- 🔍 **Auto-installs** icon collections on demand (optional)
|
|
84
|
-
- 📦 **Tree-shakeable** - only icons you use are included
|
|
85
|
-
- 🎯 **Simple shortcut syntax** with customizable prefix
|
|
86
|
-
- 🔧 **Customizable** icon collections and CDN
|
|
87
|
-
- ⚡ **Built on Iconify** - reliable and fast
|
|
88
|
-
- 🎭 **3 rendering modes**: auto, mask (currentColor), bg (background)
|
|
89
|
-
- 💡 **Full TypeScript autocomplete** via module augmentation
|
|
90
|
-
|
|
91
|
-
## Usage
|
|
92
|
-
|
|
93
|
-
### Three Usage Methods
|
|
94
|
-
|
|
95
|
-
PikaCSS provides three ways to use icons:
|
|
96
|
-
|
|
97
|
-
**Method 1: Direct shortcut string** (simplest)
|
|
98
|
-
```typescript
|
|
99
|
-
const iconClass = pika('i-mdi:home')
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Method 2: Shortcut with additional styles** (recommended)
|
|
103
|
-
```typescript
|
|
104
|
-
const styledIcon = pika('i-mdi:home', {
|
|
105
|
-
fontSize: '24px',
|
|
106
|
-
color: 'blue'
|
|
107
|
-
})
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**Method 3: Using `__shortcut` property** (for complex objects)
|
|
111
|
-
```typescript
|
|
112
|
-
const iconWithStyles = pika({
|
|
113
|
-
__shortcut: 'i-mdi:home',
|
|
114
|
-
fontSize: '24px',
|
|
115
|
-
display: 'inline-block'
|
|
116
|
-
})
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
All three methods produce the same underlying shortcut registration - choose based on your coding style.
|
|
120
|
-
|
|
121
|
-
### Supported Icon Collections
|
|
122
|
-
|
|
123
|
-
All Iconify icon collections are supported (100,000+ icons). Popular collections include:
|
|
124
|
-
|
|
125
|
-
- **Material Design Icons**: `i-mdi:*` (5,000+ icons)
|
|
126
|
-
- **Heroicons**: `i-heroicons:*` (300+ icons)
|
|
127
|
-
- **Bootstrap Icons**: `i-bi:*` (1,800+ icons)
|
|
128
|
-
- **Font Awesome**: `i-fa:*`, `i-fa-solid:*`, `i-fa-brands:*` (2,000+ icons)
|
|
129
|
-
- **Tabler Icons**: `i-tabler:*` (4,000+ icons)
|
|
130
|
-
- **Carbon**: `i-carbon:*` (2,000+ icons)
|
|
131
|
-
- **Phosphor**: `i-ph:*` (6,000+ icons)
|
|
132
|
-
- **Lucide**: `i-lucide:*` (1,000+ icons)
|
|
133
|
-
|
|
134
|
-
Browse all collections at: [Iconify Icon Sets](https://icon-sets.iconify.design/)
|
|
135
|
-
|
|
136
|
-
### Icon Syntax
|
|
137
|
-
|
|
138
|
-
Icons follow the pattern: **`{prefix}{collection}:{icon-name}`**
|
|
139
|
-
|
|
140
|
-
Default prefix is `i-`, so the full syntax is: `i-{collection}:{name}`
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
pika('i-mdi:home') // Material Design home icon
|
|
144
|
-
pika('i-heroicons:user') // Heroicons user icon
|
|
145
|
-
pika('i-carbon:cloud-upload') // Carbon cloud upload icon
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Icon Rendering Modes
|
|
149
|
-
|
|
150
|
-
Append `?mask`, `?bg`, or `?auto` to specify the rendering mode:
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
pika('i-mdi:home?mask') // Mask mode (uses currentColor)
|
|
154
|
-
pika('i-mdi:home?bg') // Background mode
|
|
155
|
-
pika('i-mdi:home?auto') // Auto-detect (default)
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Mode descriptions:**
|
|
159
|
-
- **`auto`** (default): Automatically selects `mask` or `bg` based on whether the icon's SVG contains `currentColor`
|
|
160
|
-
- **`mask`**: Icon uses CSS mask with `currentColor`, inheriting text color (best for monochrome icons)
|
|
161
|
-
- **`bg`**: Icon uses `background-image` (best for multi-colored icons)
|
|
162
|
-
|
|
163
|
-
**Implementation detail:** The mode detection happens at build time by checking if the icon's SVG source includes the string `"currentColor"`. If found, mode defaults to `mask`; otherwise, it defaults to `bg`.
|
|
164
|
-
|
|
165
|
-
### Usage Examples
|
|
166
|
-
|
|
167
|
-
```typescript
|
|
168
|
-
// Simple icon
|
|
169
|
-
const homeIcon = pika('i-mdi:home')
|
|
170
|
-
|
|
171
|
-
// Icon with size and color
|
|
172
|
-
const largeIcon = pika('i-mdi:account', {
|
|
173
|
-
fontSize: '48px',
|
|
174
|
-
color: '#3b82f6'
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
// Icon with hover effect
|
|
178
|
-
const hoverIcon = pika('i-mdi:heart', {
|
|
179
|
-
'fontSize': '24px',
|
|
180
|
-
'color': 'red',
|
|
181
|
-
'cursor': 'pointer',
|
|
182
|
-
'$:hover': {
|
|
183
|
-
transform: 'scale(1.2)'
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
// Combining multiple shortcuts
|
|
188
|
-
const buttonWithIcon = pika('btn', 'i-mdi:send', {
|
|
189
|
-
display: 'inline-flex',
|
|
190
|
-
alignItems: 'center',
|
|
191
|
-
gap: '0.5rem'
|
|
192
|
-
})
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### Customizing Icon Size and Color
|
|
196
|
-
|
|
197
|
-
Icons inherit text properties by default:
|
|
198
|
-
|
|
199
|
-
```typescript
|
|
200
|
-
// Method 2: Shortcut with styles
|
|
201
|
-
pika('i-mdi:home', {
|
|
202
|
-
fontSize: '32px', // Controls icon size
|
|
203
|
-
color: '#3b82f6' // Works with mask mode
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
// Method 3: __shortcut property
|
|
207
|
-
pika({
|
|
208
|
-
__shortcut: 'i-mdi:home',
|
|
209
|
-
fontSize: '32px',
|
|
210
|
-
color: '#3b82f6'
|
|
211
|
-
})
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Note:** Color inheritance only works in `mask` mode. In `bg` mode, the icon retains its original colors.
|
|
215
|
-
|
|
216
|
-
## Configuration
|
|
217
|
-
|
|
218
|
-
The icons plugin is configured using the standard PikaCSS plugin pattern with full TypeScript autocomplete:
|
|
219
|
-
|
|
220
|
-
```typescript
|
|
221
|
-
/// <reference path="./src/pika.gen.ts" />
|
|
222
|
-
|
|
223
|
-
import { defineEngineConfig } from '@pikacss/core'
|
|
224
|
-
import { icons } from '@pikacss/plugin-icons'
|
|
225
|
-
|
|
226
|
-
export default defineEngineConfig({
|
|
227
|
-
// 1. Register plugin in plugins array
|
|
228
|
-
plugins: [
|
|
229
|
-
icons() // ⚠️ Must be a function call: icons() not icons
|
|
230
|
-
],
|
|
231
|
-
|
|
232
|
-
// 2. Configure at root level with full autocomplete
|
|
233
|
-
icons: {
|
|
234
|
-
prefix: 'i-', // Shortcut prefix
|
|
235
|
-
scale: 1, // Icon scale multiplier
|
|
236
|
-
mode: 'auto', // 'auto' | 'mask' | 'bg'
|
|
237
|
-
cdn: 'https://esm.sh/', // CDN for icon collections
|
|
238
|
-
autoInstall: false, // Auto-install icon packages
|
|
239
|
-
// ... other options
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
::: warning Common Mistake
|
|
245
|
-
Always call the plugin function: `plugins: [icons()]` not `plugins: [icons]`
|
|
246
|
-
:::
|
|
247
|
-
|
|
248
|
-
### All Configuration Options
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
interface IconsConfig {
|
|
252
|
-
/**
|
|
253
|
-
* Icon shortcut prefix.
|
|
254
|
-
* Can be a single string or array of prefixes.
|
|
255
|
-
* @default 'i-'
|
|
256
|
-
*/
|
|
257
|
-
prefix?: string | string[]
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Scale factor for icons.
|
|
261
|
-
* Multiplies icon dimensions.
|
|
262
|
-
* @default 1
|
|
263
|
-
*/
|
|
264
|
-
scale?: number
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Icon rendering mode.
|
|
268
|
-
* - 'auto': Auto-detect based on currentColor in SVG
|
|
269
|
-
* - 'mask': Use CSS mask with currentColor (inherits text color)
|
|
270
|
-
* - 'bg': Use background-image (preserves original colors)
|
|
271
|
-
* @default 'auto'
|
|
272
|
-
*/
|
|
273
|
-
mode?: 'auto' | 'mask' | 'bg'
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* CDN base URL for loading icon collections.
|
|
277
|
-
* Icons are fetched from this CDN when not found locally.
|
|
278
|
-
* @example 'https://esm.sh/'
|
|
279
|
-
*/
|
|
280
|
-
cdn?: string
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Custom icon collections.
|
|
284
|
-
* Define your own icons as SVG strings.
|
|
285
|
-
* @example
|
|
286
|
-
* {
|
|
287
|
-
* 'my-icons': {
|
|
288
|
-
* 'logo': '<svg>...</svg>',
|
|
289
|
-
* 'custom': '<svg>...</svg>'
|
|
290
|
-
* }
|
|
291
|
-
* }
|
|
292
|
-
*/
|
|
293
|
-
collections?: Record<string, any>
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Auto-install icon collections from npm.
|
|
297
|
-
* When enabled, missing icon packages are automatically installed.
|
|
298
|
-
* @default false
|
|
299
|
-
*/
|
|
300
|
-
autoInstall?: boolean
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Unit for icon size (when specified).
|
|
304
|
-
* Applied to width and height when using scale with unit.
|
|
305
|
-
* @example 'em', 'rem', 'px'
|
|
306
|
-
*/
|
|
307
|
-
unit?: string
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Extra CSS properties to apply to all icons.
|
|
311
|
-
* Merged into every generated icon style.
|
|
312
|
-
* @example { verticalAlign: 'middle' }
|
|
313
|
-
*/
|
|
314
|
-
extraProperties?: Record<string, string>
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Custom processor for icon styles before rendering.
|
|
318
|
-
* Allows modifying the generated CSS object.
|
|
319
|
-
*/
|
|
320
|
-
processor?: (styleItem: StyleItem, meta: IconMeta) => void
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Icons for auto-completion in your editor.
|
|
324
|
-
* List of icon shortcuts to provide autocomplete suggestions.
|
|
325
|
-
* @example ['mdi:home', 'heroicons:user']
|
|
326
|
-
*/
|
|
327
|
-
autocomplete?: string[]
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Iconify collection names for validation.
|
|
331
|
-
*/
|
|
332
|
-
iconifyCollectionsNames?: string[]
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Path for resolving icon collection node modules.
|
|
336
|
-
*/
|
|
337
|
-
collectionsNodeResolvePath?: string
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Customizations for icon SVG processing.
|
|
341
|
-
*/
|
|
342
|
-
customizations?: IconifyLoaderCustomizations
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### Configuration Examples
|
|
347
|
-
|
|
348
|
-
#### Custom Icon Prefix
|
|
349
|
-
|
|
350
|
-
Change the shortcut prefix to avoid conflicts:
|
|
351
|
-
|
|
352
|
-
```typescript
|
|
353
|
-
export default defineEngineConfig({
|
|
354
|
-
plugins: [icons()],
|
|
355
|
-
icons: {
|
|
356
|
-
prefix: 'icon-' // Now use: icon-mdi:home
|
|
357
|
-
}
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
// Usage with custom prefix
|
|
361
|
-
const iconClass = pika('icon-mdi:home')
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
#### Custom Icon Scale
|
|
365
|
-
|
|
366
|
-
Adjust the default scale of all icons:
|
|
367
|
-
|
|
368
|
-
```typescript
|
|
369
|
-
export default defineEngineConfig({
|
|
370
|
-
plugins: [icons()],
|
|
371
|
-
icons: {
|
|
372
|
-
scale: 1.2 // Make all icons 20% larger
|
|
373
|
-
}
|
|
374
|
-
})
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
#### Force Specific Rendering Mode
|
|
378
|
-
|
|
379
|
-
Override auto-detection to always use mask or bg mode:
|
|
380
|
-
|
|
381
|
-
```typescript
|
|
382
|
-
export default defineEngineConfig({
|
|
383
|
-
plugins: [icons()],
|
|
384
|
-
icons: {
|
|
385
|
-
mode: 'mask' // All icons inherit text color
|
|
386
|
-
}
|
|
387
|
-
})
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
#### Multiple Prefixes
|
|
391
|
-
|
|
392
|
-
Support multiple shortcut prefixes:
|
|
393
|
-
|
|
394
|
-
```typescript
|
|
395
|
-
export default defineEngineConfig({
|
|
396
|
-
plugins: [icons()],
|
|
397
|
-
icons: {
|
|
398
|
-
prefix: ['i-', 'icon-'] // Both work
|
|
399
|
-
}
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
// Both are valid
|
|
403
|
-
const icon1 = pika('i-mdi:home')
|
|
404
|
-
const icon2 = pika('icon-mdi:home')
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
#### Custom Icon Collections
|
|
408
|
-
|
|
409
|
-
Define your own icon collections:
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
export default defineEngineConfig({
|
|
413
|
-
plugins: [icons()],
|
|
414
|
-
icons: {
|
|
415
|
-
collections: {
|
|
416
|
-
'my-icons': {
|
|
417
|
-
logo: '<svg viewBox="0 0 24 24"><path d="..." /></svg>',
|
|
418
|
-
custom: '<svg>...</svg>'
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
// Usage
|
|
425
|
-
const myIcon = pika('i-my-icons:logo')
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
## How It Works
|
|
429
|
-
|
|
430
|
-
The plugin registers icon shortcuts using the PikaCSS shortcut system:
|
|
431
|
-
|
|
432
|
-
1. **Pattern Detection**: Icons matching `{prefix}{collection}:{name}` pattern (e.g., `i-mdi:home`) are detected in your `pika()` calls
|
|
433
|
-
2. **SVG Loading**: Icon SVG is loaded from Iconify (via CDN or local node_modules)
|
|
434
|
-
3. **CSS Variable Generation**: SVG is encoded and stored as a CSS custom property (e.g., `--pika-svg-icon-mdi-home`)
|
|
435
|
-
4. **Mode Selection**: Based on mode setting and SVG content:
|
|
436
|
-
- **auto**: Checks if SVG contains `currentColor` → mask mode if yes, bg mode if no
|
|
437
|
-
- **mask**: Uses CSS mask properties with `background-color: currentColor` (icon inherits text color)
|
|
438
|
-
- **bg**: Uses `background-image` (icon retains original colors)
|
|
439
|
-
5. **Style Application**: CSS properties are applied to create the final icon appearance
|
|
440
|
-
|
|
441
|
-
**Example flow:**
|
|
442
|
-
```typescript
|
|
443
|
-
pika('i-mdi:home', { fontSize: '24px', color: 'blue' })
|
|
444
|
-
```
|
|
445
|
-
1. Plugin detects `i-mdi:home` shortcut
|
|
446
|
-
2. Loads Material Design Icons "home" icon from Iconify
|
|
447
|
-
3. Encodes SVG: `url("data:image/svg+xml;utf8,...")`
|
|
448
|
-
4. Stores in CSS variable: `--pika-svg-icon-mdi-home`
|
|
449
|
-
5. Applies mask mode (if icon uses currentColor):
|
|
450
|
-
```css
|
|
451
|
-
.generated-class {
|
|
452
|
-
--svg-icon: var(--pika-svg-icon-mdi-home);
|
|
453
|
-
-webkit-mask: var(--svg-icon) no-repeat;
|
|
454
|
-
mask: var(--svg-icon) no-repeat;
|
|
455
|
-
mask-size: 100% 100%;
|
|
456
|
-
background-color: currentColor;
|
|
457
|
-
font-size: 24px;
|
|
458
|
-
color: blue;
|
|
459
|
-
}
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
This approach ensures:
|
|
463
|
-
- **Efficient CSS**: Icons are stored once as CSS variables and reused
|
|
464
|
-
- **Color Inheritance**: Mask mode allows icons to inherit text color dynamically
|
|
465
|
-
- **Performance**: Only icons you use are included in the bundle
|
|
466
|
-
|
|
467
|
-
## Performance
|
|
468
|
-
|
|
469
|
-
- **On-demand loading**: Only downloads icon sets you actually use
|
|
470
|
-
- **Tree-shaking**: Only icons you reference are included in the build
|
|
471
|
-
- **Cached**: Downloaded icon collections are cached locally
|
|
472
|
-
- **Optimized SVG**: Icons are optimized for minimal file size
|
|
473
|
-
|
|
474
|
-
## Documentation
|
|
475
|
-
|
|
476
|
-
For complete documentation, visit: [PikaCSS Documentation](https://pikacss.github.io/pikacss/)
|
|
477
|
-
|
|
478
|
-
## License
|
|
479
|
-
|
|
480
|
-
MIT © DevilTea
|