@genarou/blazir-icons 1.3.5 → 1.4.1
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/LICENSE +34 -33
- package/NOTICE +14 -0
- package/README.md +153 -213
- package/dist/effects.js +16 -29
- package/dist/icons/Ai.svelte +2 -2
- package/dist/icons/Alternate.svelte +2 -2
- package/dist/icons/AnimatedArrowLeft.svelte +1 -1
- package/dist/icons/ArrowDown.svelte +1 -1
- package/dist/icons/ArrowLeft.svelte +1 -1
- package/dist/icons/Attachment.svelte +1 -1
- package/dist/icons/Bag.svelte +1 -1
- package/dist/icons/Bank.svelte +1 -1
- package/dist/icons/Bell.svelte +1 -1
- package/dist/icons/Blaze.svelte +1 -1
- package/dist/icons/Box.svelte +1 -1
- package/dist/icons/BoxAdd.svelte +1 -1
- package/dist/icons/Buy.svelte +1 -1
- package/dist/icons/Calendar.svelte +1 -1
- package/dist/icons/CalendarEdit.svelte +1 -1
- package/dist/icons/CalendarPlus.svelte +1 -1
- package/dist/icons/Camera.svelte +1 -1
- package/dist/icons/Cart.svelte +1 -1
- package/dist/icons/CategoryAdd.svelte +1 -1
- package/dist/icons/CategorySearch.svelte +1 -1
- package/dist/icons/Chart.svelte +1 -1
- package/dist/icons/ChartDoc.svelte +1 -1
- package/dist/icons/Check.svelte +1 -1
- package/dist/icons/CheckList.svelte +2 -2
- package/dist/icons/CheckO.svelte +1 -1
- package/dist/icons/CircleCheck.svelte +2 -2
- package/dist/icons/CircleExclamation.svelte +2 -2
- package/dist/icons/CircleExclamationOutlined.svelte +2 -2
- package/dist/icons/CircleInfo.svelte +2 -2
- package/dist/icons/CircleInfoOutlined.svelte +2 -2
- package/dist/icons/CircleQuestion.svelte +1 -1
- package/dist/icons/CircleQuestionOutlined.svelte +2 -2
- package/dist/icons/Close.svelte +2 -2
- package/dist/icons/CloudCheck.svelte +1 -1
- package/dist/icons/CloudUpload.svelte +1 -1
- package/dist/icons/Code.svelte +1 -1
- package/dist/icons/Colors.svelte +1 -1
- package/dist/icons/Contact.svelte +1 -1
- package/dist/icons/Csv.svelte +1 -1
- package/dist/icons/Dashboard.svelte +1 -1
- package/dist/icons/Db.svelte +1 -1
- package/dist/icons/DoughnutChart.svelte +1 -1
- package/dist/icons/DownloadAnimated.svelte +1 -1
- package/dist/icons/Earth.svelte +1 -1
- package/dist/icons/Edit.svelte +2 -2
- package/dist/icons/EditOutline.svelte +2 -2
- package/dist/icons/EmailAnimated.svelte +3 -3
- package/dist/icons/Error.svelte +1 -1
- package/dist/icons/ErrorO.svelte +2 -2
- package/dist/icons/Excel.svelte +1 -1
- package/dist/icons/ExcelAnimated.svelte +3 -3
- package/dist/icons/Exchange.svelte +1 -1
- package/dist/icons/ExternalLink.svelte +1 -1
- package/dist/icons/Eye.svelte +1 -1
- package/dist/icons/EyeOff.svelte +2 -2
- package/dist/icons/Favorites.svelte +1 -1
- package/dist/icons/FileUploadAnimated.svelte +2 -2
- package/dist/icons/Filter.svelte +1 -1
- package/dist/icons/Fingerprint.svelte +1 -1
- package/dist/icons/FormatListGroup.svelte +1 -1
- package/dist/icons/Globe.svelte +1 -1
- package/dist/icons/Grid.svelte +1 -1
- package/dist/icons/GripVertical.svelte +1 -1
- package/dist/icons/Group.svelte +3 -3
- package/dist/icons/HardDrive.svelte +1 -1
- package/dist/icons/Heart.svelte +1 -1
- package/dist/icons/Height.svelte +1 -1
- package/dist/icons/Historic.svelte +1 -1
- package/dist/icons/Home.svelte +1 -1
- package/dist/icons/Image.svelte +1 -1
- package/dist/icons/ImageAnimated.svelte +2 -2
- package/dist/icons/Layers.svelte +1 -1
- package/dist/icons/Link.svelte +1 -1
- package/dist/icons/ListDots.svelte +1 -1
- package/dist/icons/Location.svelte +1 -1
- package/dist/icons/LocationAnimated.svelte +1 -1
- package/dist/icons/Lock.svelte +1 -1
- package/dist/icons/LockOpen.svelte +1 -1
- package/dist/icons/Logout.svelte +1 -1
- package/dist/icons/Lose.svelte +1 -1
- package/dist/icons/MagnifiyingGlass.svelte +1 -1
- package/dist/icons/Maximize.svelte +1 -1
- package/dist/icons/MicOff.svelte +1 -1
- package/dist/icons/Microphone.svelte +1 -1
- package/dist/icons/Minimize.svelte +1 -1
- package/dist/icons/Money.svelte +1 -1
- package/dist/icons/Moon.svelte +1 -1
- package/dist/icons/More.svelte +1 -1
- package/dist/icons/Notes.svelte +1 -1
- package/dist/icons/ObjectGroup.svelte +1 -12
- package/dist/icons/Pay.svelte +1 -1
- package/dist/icons/Pdf.svelte +1 -1
- package/dist/icons/Percentage.svelte +1 -1
- package/dist/icons/Play.svelte +1 -1
- package/dist/icons/Plus.svelte +1 -1
- package/dist/icons/PointSale.svelte +2 -42
- package/dist/icons/Power.svelte +1 -1
- package/dist/icons/Product.svelte +1 -1
- package/dist/icons/Profit.svelte +2 -2
- package/dist/icons/Project.svelte +1 -1
- package/dist/icons/Redo.svelte +1 -1
- package/dist/icons/RegularSpinner.svelte +2 -2
- package/dist/icons/RightArrow.svelte +1 -1
- package/dist/icons/Rocket.svelte +1 -1
- package/dist/icons/SafeSolid.svelte +2 -2
- package/dist/icons/Security.svelte +2 -2
- package/dist/icons/Send.svelte +1 -1
- package/dist/icons/Server.svelte +1 -1
- package/dist/icons/Settings.svelte +1 -1
- package/dist/icons/Share.svelte +1 -1
- package/dist/icons/Shield.svelte +2 -2
- package/dist/icons/Sliders.svelte +1 -1
- package/dist/icons/Sun.svelte +1 -1
- package/dist/icons/Supervisor.svelte +1 -1
- package/dist/icons/Swap.svelte +1 -1
- package/dist/icons/SyncPhoto.svelte +1 -1
- package/dist/icons/Table.svelte +1 -3
- package/dist/icons/Tags.svelte +1 -1
- package/dist/icons/Team.svelte +2 -2
- package/dist/icons/Terminal.svelte +1 -1
- package/dist/icons/Timer.svelte +1 -1
- package/dist/icons/Tools.svelte +2 -2
- package/dist/icons/Truck.svelte +1 -1
- package/dist/icons/TruckReturn.svelte +2 -2
- package/dist/icons/Undo.svelte +1 -1
- package/dist/icons/UpDownArrow.svelte +1 -1
- package/dist/icons/Upload.svelte +1 -1
- package/dist/icons/UploadAnimated.svelte +1 -1
- package/dist/icons/UploadLoader.svelte +4 -4
- package/dist/icons/User.svelte +1 -1
- package/dist/icons/UserMinus.svelte +1 -1
- package/dist/icons/UserPlus.svelte +1 -1
- package/dist/icons/UserShield.svelte +1 -1
- package/dist/icons/UserTie.svelte +1 -1
- package/dist/icons/Video.svelte +1 -1
- package/dist/icons/Volume.svelte +1 -1
- package/dist/icons/VolumeOff.svelte +1 -1
- package/dist/icons/Wallet.svelte +2 -2
- package/dist/icons/Word.svelte +1 -1
- package/dist/icons/World.svelte +1 -1
- package/dist/icons/Xml.svelte +1 -1
- package/dist/icons/Zip.svelte +1 -1
- package/dist/icons/components.js +1 -4
- package/dist/icons/lazy-registry.js +31 -61
- package/dist/icons/registry.js +26 -27
- package/dist/icons-api.js +25 -28
- package/dist/index.js +7 -24
- package/dist/plugin/index.d.ts +5 -2
- package/dist/plugin/index.js +26 -1
- package/dist/presets.js +4 -5
- package/dist/smart-cache.js +17 -82
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A high-performance Svelte 5 icon library with smart caching, lazy loading, presets, variants, and a declarative effects system.
|
|
4
4
|
|
|
5
|
-
- **
|
|
5
|
+
- **199 icons** — original SVG artwork
|
|
6
6
|
- **Svelte 5 runes** — `$props`, `$derived`, `$effect`
|
|
7
|
+
- **Three usage patterns** — dynamic `<Icon>`, lazy `<IconLazy>`, or direct named imports
|
|
7
8
|
- **Smart LRU cache** — referential stability, zero re-renders on stable props
|
|
8
9
|
- **Lazy loading** — per-icon code splitting via `import()`
|
|
9
10
|
- **Vite plugin** — automatic tree shaking, only used icons in the bundle
|
|
@@ -79,6 +80,9 @@ pnpm add @genarou/blazir-icons
|
|
|
79
80
|
├─ lazy=false (default) → iconRegistry[name] (static import, zero latency)
|
|
80
81
|
└─ lazy=true → getLoadedIcon() || loadIcon() (dynamic import + skeleton)
|
|
81
82
|
|
|
83
|
+
<IconLazy> ← Zero-registry lazy wrapper
|
|
84
|
+
└─ loadIcon(name) → dynamic import(), no static registry dependency
|
|
85
|
+
|
|
82
86
|
<IconBase> ← SVG renderer
|
|
83
87
|
├─ receives merged IconProps
|
|
84
88
|
├─ applies mode (solid / outline / duotone)
|
|
@@ -109,6 +113,21 @@ When `lazy={true}`:
|
|
|
109
113
|
3. If not found, sets `isLoading = true` (shows a skeleton placeholder), calls `loadIcon(name)` (dynamic `import()`), and updates the component when the module resolves.
|
|
110
114
|
4. If the `name` prop changes before the load completes, the stale result is discarded — no race conditions.
|
|
111
115
|
|
|
116
|
+
### `<IconLazy>` — zero-registry alternative
|
|
117
|
+
|
|
118
|
+
`<IconLazy>` is a standalone component that never imports the static registry. It only depends on `lazy-registry.ts` (pure dynamic imports), so bundlers can fully eliminate it from the initial chunk if you only use lazy icons.
|
|
119
|
+
|
|
120
|
+
```svelte
|
|
121
|
+
<script>
|
|
122
|
+
import { IconLazy } from '@genarou/blazir-icons'
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<!-- No static registry in the bundle at all -->
|
|
126
|
+
<IconLazy name="settings" size={24} color="var(--primary)" />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use `<IconLazy>` instead of `<Icon lazy>` when you want to guarantee zero static registry dependency at the module level.
|
|
130
|
+
|
|
112
131
|
### Actions diff bridge
|
|
113
132
|
|
|
114
133
|
The `actions` prop accepts an array of `[actionFn, params]` tuples. On update, the bridge diffs the new array against the previous one:
|
|
@@ -138,7 +157,7 @@ Every icon has a direct string name and a typed alias via `bzIcons`.
|
|
|
138
157
|
|
|
139
158
|
### Available `bzIcons` aliases
|
|
140
159
|
|
|
141
|
-
All
|
|
160
|
+
All 199 icons organized by category.
|
|
142
161
|
|
|
143
162
|
#### Navigation & Layout
|
|
144
163
|
|
|
@@ -149,7 +168,6 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
149
168
|
| `bzIcons.DashboardOutline` | `dashboardOutline` |
|
|
150
169
|
| `bzIcons.Settings` | `settings` |
|
|
151
170
|
| `bzIcons.Search` | `search` |
|
|
152
|
-
| `bzIcons.Filter` | `filter` |
|
|
153
171
|
| `bzIcons.Menu` | `menu` |
|
|
154
172
|
| `bzIcons.Close` | `close` |
|
|
155
173
|
| `bzIcons.Plus` | `plus` |
|
|
@@ -163,7 +181,10 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
163
181
|
| Alias | `name` |
|
|
164
182
|
|---|---|
|
|
165
183
|
| `bzIcons.User` | `user` |
|
|
184
|
+
| `bzIcons.UserShield` | `userShield` |
|
|
166
185
|
| `bzIcons.UserTie` | `userTie` |
|
|
186
|
+
| `bzIcons.UserPlus` | `userPlus` |
|
|
187
|
+
| `bzIcons.UserMinus` | `userMinus` |
|
|
167
188
|
| `bzIcons.Team` | `team` |
|
|
168
189
|
| `bzIcons.Group` | `group` |
|
|
169
190
|
| `bzIcons.Supervisor` | `supervisor` |
|
|
@@ -252,6 +273,7 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
252
273
|
| `bzIcons.Save` | `save` |
|
|
253
274
|
| `bzIcons.Form` | `form` |
|
|
254
275
|
| `bzIcons.Print` | `print` |
|
|
276
|
+
| `bzIcons.Work` | `work` |
|
|
255
277
|
|
|
256
278
|
#### Calendar & Time
|
|
257
279
|
|
|
@@ -267,10 +289,15 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
267
289
|
| Alias | `name` |
|
|
268
290
|
|---|---|
|
|
269
291
|
| `bzIcons.ArrowRight` | `arrowRight` |
|
|
292
|
+
| `bzIcons.ArrowLeft` | `arrowLeft` |
|
|
270
293
|
| `bzIcons.ArrowUp` | `arrowUp` |
|
|
294
|
+
| `bzIcons.ArrowDown` | `arrowDown` |
|
|
271
295
|
| `bzIcons.ArrowUpDown` | `arrowUpDown` |
|
|
272
296
|
| `bzIcons.ArrowLeftAnimated` | `arrowLeftAnimated` |
|
|
273
297
|
| `bzIcons.ChevronDown` | `chevronDown` |
|
|
298
|
+
| `bzIcons.ChevronUp` | `chevronUp` |
|
|
299
|
+
| `bzIcons.ChevronLeft` | `chevronLeft` |
|
|
300
|
+
| `bzIcons.ChevronRight` | `chevronRight` |
|
|
274
301
|
| `bzIcons.ChevronUpDown` | `chevronUpDown` |
|
|
275
302
|
|
|
276
303
|
#### File Actions
|
|
@@ -284,6 +311,14 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
284
311
|
| `bzIcons.UploadProgress` | `uploadProgress` |
|
|
285
312
|
| `bzIcons.FileUploadAnimated` | `fileUploadAnimated` |
|
|
286
313
|
| `bzIcons.Refresh` | `refresh` |
|
|
314
|
+
| `bzIcons.SyncPhoto` | `syncPhoto` |
|
|
315
|
+
| `bzIcons.Process` | `process` |
|
|
316
|
+
| `bzIcons.Play` | `play` |
|
|
317
|
+
| `bzIcons.Pause` | `pause` |
|
|
318
|
+
| `bzIcons.Historic` | `historic` |
|
|
319
|
+
| `bzIcons.HardDrive` | `hardDrive` |
|
|
320
|
+
| `bzIcons.Connect` | `connect` |
|
|
321
|
+
| `bzIcons.Archive` | `archive` |
|
|
287
322
|
|
|
288
323
|
#### States & Feedback
|
|
289
324
|
|
|
@@ -335,6 +370,8 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
335
370
|
| `bzIcons.Scan` | `scan` |
|
|
336
371
|
| `bzIcons.Cart` | `cart` |
|
|
337
372
|
| `bzIcons.Cards` | `cards` |
|
|
373
|
+
| `bzIcons.Percentage` | `percentage` |
|
|
374
|
+
| `bzIcons.Gift` | `gift` |
|
|
338
375
|
|
|
339
376
|
#### Logistics & Transport
|
|
340
377
|
|
|
@@ -355,20 +392,53 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
355
392
|
| `bzIcons.EditOutline` | `editOutline` |
|
|
356
393
|
| `bzIcons.Trash` | `trash` |
|
|
357
394
|
| `bzIcons.TrashOutline` | `trashOutline` |
|
|
395
|
+
| `bzIcons.Filter` | `filter` |
|
|
396
|
+
| `bzIcons.FilterOutline` | `filterOutline` |
|
|
358
397
|
| `bzIcons.Tags` | `tags` |
|
|
359
398
|
| `bzIcons.Tools` | `tools` |
|
|
360
399
|
| `bzIcons.ObjectGroup` | `objectGroup` |
|
|
361
400
|
| `bzIcons.Project` | `project` |
|
|
362
401
|
|
|
402
|
+
#### Common Actions
|
|
403
|
+
|
|
404
|
+
| Alias | `name` |
|
|
405
|
+
|---|---|
|
|
406
|
+
| `bzIcons.ExternalLink` | `externalLink` |
|
|
407
|
+
| `bzIcons.Maximize` | `maximize` |
|
|
408
|
+
| `bzIcons.Minimize` | `minimize` |
|
|
409
|
+
| `bzIcons.Undo` | `undo` |
|
|
410
|
+
| `bzIcons.Redo` | `redo` |
|
|
411
|
+
| `bzIcons.Grip` | `grip` |
|
|
412
|
+
|
|
413
|
+
#### Layout
|
|
414
|
+
|
|
415
|
+
| Alias | `name` |
|
|
416
|
+
|---|---|
|
|
417
|
+
| `bzIcons.Grid` | `grid` |
|
|
418
|
+
| `bzIcons.Layers` | `layers` |
|
|
419
|
+
| `bzIcons.Sliders` | `sliders` |
|
|
420
|
+
|
|
363
421
|
#### Media & Devices
|
|
364
422
|
|
|
365
423
|
| Alias | `name` |
|
|
366
424
|
|---|---|
|
|
367
425
|
| `bzIcons.Camera` | `camera` |
|
|
368
426
|
| `bzIcons.Desktop` | `desktop` |
|
|
427
|
+
| `bzIcons.Video` | `video` |
|
|
428
|
+
| `bzIcons.Microphone` | `microphone` |
|
|
429
|
+
| `bzIcons.MicOff` | `micOff` |
|
|
430
|
+
| `bzIcons.Volume` | `volume` |
|
|
431
|
+
| `bzIcons.VolumeOff` | `volumeOff` |
|
|
369
432
|
| `bzIcons.Wifi` | `wifi` |
|
|
370
433
|
| `bzIcons.Power` | `power` |
|
|
371
434
|
|
|
435
|
+
#### Dev
|
|
436
|
+
|
|
437
|
+
| Alias | `name` |
|
|
438
|
+
|---|---|
|
|
439
|
+
| `bzIcons.Code` | `code` |
|
|
440
|
+
| `bzIcons.Terminal` | `terminal` |
|
|
441
|
+
|
|
372
442
|
#### Cloud
|
|
373
443
|
|
|
374
444
|
| Alias | `name` |
|
|
@@ -376,6 +446,7 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
376
446
|
| `bzIcons.CloudAlert` | `cloudAlert` |
|
|
377
447
|
| `bzIcons.CloudCheck` | `cloudCheck` |
|
|
378
448
|
| `bzIcons.CloudDownload` | `cloudDownload` |
|
|
449
|
+
| `bzIcons.CloudUpload` | `cloudUpload` |
|
|
379
450
|
|
|
380
451
|
#### Other
|
|
381
452
|
|
|
@@ -385,13 +456,14 @@ All 163 icons organized by category. Use the alias for TypeScript autocomplete o
|
|
|
385
456
|
| `bzIcons.Earth` | `earth` |
|
|
386
457
|
| `bzIcons.Globe` | `globe` |
|
|
387
458
|
| `bzIcons.LightHub` | `lightHub` |
|
|
459
|
+
| `bzIcons.Qr` | `qr` |
|
|
388
460
|
| `bzIcons.Sync` | `sync` |
|
|
389
461
|
|
|
390
462
|
---
|
|
391
463
|
|
|
392
464
|
## Props Reference
|
|
393
465
|
|
|
394
|
-
All props are optional. Every prop can be passed to `<Icon
|
|
466
|
+
All props are optional. Every prop can be passed to `<Icon>`, `<IconLazy>`, or `<IconBase>`.
|
|
395
467
|
|
|
396
468
|
### Visual
|
|
397
469
|
|
|
@@ -411,7 +483,7 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
411
483
|
| `class` | `string` | — | CSS class on the wrapper element |
|
|
412
484
|
| `className` | `string` | — | Alias for `class` |
|
|
413
485
|
| `style` | `string` | — | Inline style on the wrapper element |
|
|
414
|
-
| `attrs` | `Record<string, any>` | — | Arbitrary extra attributes forwarded to the `<svg>` element
|
|
486
|
+
| `attrs` | `Record<string, any>` | — | Arbitrary extra attributes forwarded to the `<svg>` element |
|
|
415
487
|
|
|
416
488
|
### Size Tokens
|
|
417
489
|
|
|
@@ -438,12 +510,12 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
438
510
|
| `rotate` | `number \| string` | — | Rotation in degrees or CSS string |
|
|
439
511
|
| `flipH` | `boolean` | `false` | Flip horizontally |
|
|
440
512
|
| `flipV` | `boolean` | `false` | Flip vertically |
|
|
441
|
-
| `nonScalingStroke` | `boolean` | `false` | Keep stroke width fixed regardless of transform
|
|
513
|
+
| `nonScalingStroke` | `boolean` | `false` | Keep stroke width fixed regardless of transform |
|
|
442
514
|
|
|
443
515
|
```svelte
|
|
444
|
-
<Icon name="
|
|
445
|
-
<Icon name="
|
|
446
|
-
<Icon name="
|
|
516
|
+
<Icon name="arrowRight" rotate={45} />
|
|
517
|
+
<Icon name="arrowRight" flipH />
|
|
518
|
+
<Icon name="arrowRight" rotate={90} flipV />
|
|
447
519
|
```
|
|
448
520
|
|
|
449
521
|
### Animations
|
|
@@ -461,14 +533,11 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
461
533
|
| `animationEasing` | `string` | — | CSS easing function |
|
|
462
534
|
|
|
463
535
|
```svelte
|
|
464
|
-
<Icon name="
|
|
465
|
-
<Icon name="
|
|
536
|
+
<Icon name="spinnerDots" spin />
|
|
537
|
+
<Icon name="spinnerDots" spin={800} />
|
|
466
538
|
<Icon name="bell" bounce animationDuration={600} />
|
|
467
539
|
<Icon name="heart" heartbeat animationDelay="200ms" />
|
|
468
540
|
<Icon name="star" pulse animationEasing="ease-in-out" />
|
|
469
|
-
|
|
470
|
-
<!-- Combine multiple animations -->
|
|
471
|
-
<Icon name="loadingRegular" spin pulse />
|
|
472
541
|
```
|
|
473
542
|
|
|
474
543
|
### Entry Transitions
|
|
@@ -485,7 +554,7 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
485
554
|
|
|
486
555
|
```svelte
|
|
487
556
|
<!-- Animated menu toggle -->
|
|
488
|
-
<Icon name="
|
|
557
|
+
<Icon name="menu" morphTo={isOpen ? 'close' : 'menu'} />
|
|
489
558
|
|
|
490
559
|
<!-- Animated accordion chevron -->
|
|
491
560
|
<Icon name="chevronDown" chevronOpen={isExpanded} />
|
|
@@ -501,10 +570,10 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
501
570
|
| Prop | Type | Default | Description |
|
|
502
571
|
|---|---|---|---|
|
|
503
572
|
| `hoverColor` | `string` | — | Color applied on hover |
|
|
504
|
-
| `activeColor` | `string` | — | Color applied on press/active
|
|
505
|
-
| `disabled` | `boolean` | `false` | Reduces opacity to 0.4 and disables all pointer events
|
|
506
|
-
| `loading` | `boolean` | `false` | Replaces the icon with a spinning circle until `false
|
|
507
|
-
| `tooltip` | `string` | — | Native browser tooltip
|
|
573
|
+
| `activeColor` | `string` | — | Color applied on press/active |
|
|
574
|
+
| `disabled` | `boolean` | `false` | Reduces opacity to 0.4 and disables all pointer events |
|
|
575
|
+
| `loading` | `boolean` | `false` | Replaces the icon with a spinning circle until `false` |
|
|
576
|
+
| `tooltip` | `string` | — | Native browser tooltip |
|
|
508
577
|
| `hoverSpeed` | `"instant" \| "fast" \| "normal" \| "slow" \| "sluggish"` | `"normal"` | Semantic preset for hover transition speed |
|
|
509
578
|
| `transitionMs` | `number \| string` | `250` | Exact hover transition duration. Overrides `hoverSpeed` |
|
|
510
579
|
| `transitionEasing` | `string` | `"ease"` | CSS easing for hover transition |
|
|
@@ -521,24 +590,11 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
521
590
|
| `"sluggish"` | 600ms |
|
|
522
591
|
|
|
523
592
|
```svelte
|
|
524
|
-
<!-- Hover color with speed preset -->
|
|
525
593
|
<Icon name="edit" hoverColor="var(--primary)" hoverSpeed="fast" />
|
|
526
|
-
|
|
527
|
-
<!-- Active/press color -->
|
|
528
594
|
<Icon name="heart" hoverColor="#f97316" activeColor="#dc2626" />
|
|
529
|
-
|
|
530
|
-
<!-- Disabled state -->
|
|
531
595
|
<Icon name="send" disabled />
|
|
532
|
-
<Icon name="save" disabled={!isFormValid} />
|
|
533
|
-
|
|
534
|
-
<!-- Loading state — auto spinner, no wrapper needed -->
|
|
535
596
|
<Icon name="save" loading={isSaving} />
|
|
536
|
-
|
|
537
|
-
<!-- Tooltip -->
|
|
538
|
-
<Icon name="info" tooltip="More information" />
|
|
539
|
-
|
|
540
|
-
<!-- Custom easing -->
|
|
541
|
-
<Icon name="bell" hoverColor="var(--primary)" transitionMs={350} transitionEasing="ease-in-out" />
|
|
597
|
+
<Icon name="circleInfo" tooltip="More information" />
|
|
542
598
|
|
|
543
599
|
<!-- Trigger icon hover when parent row is hovered -->
|
|
544
600
|
<script>
|
|
@@ -552,8 +608,6 @@ All props are optional. Every prop can be passed to `<Icon>` or `<IconBase>`.
|
|
|
552
608
|
|
|
553
609
|
### Compact Mode
|
|
554
610
|
|
|
555
|
-
Reduces visual weight of solid icons at small sizes by adjusting opacity.
|
|
556
|
-
|
|
557
611
|
| Prop | Type | Default | Description |
|
|
558
612
|
|---|---|---|---|
|
|
559
613
|
| `compact` | `"off" \| "auto" \| "outline" \| "duotone"` | `"off"` | Compact rendering mode |
|
|
@@ -562,10 +616,7 @@ Reduces visual weight of solid icons at small sizes by adjusting opacity.
|
|
|
562
616
|
| `compactStrokeWidth` | `number \| string` | — | Stroke width in compact mode |
|
|
563
617
|
|
|
564
618
|
```svelte
|
|
565
|
-
<!-- Auto: switches to outline style below 20px -->
|
|
566
619
|
<Icon name="user" compact="auto" size={16} />
|
|
567
|
-
|
|
568
|
-
<!-- Always compact duotone -->
|
|
569
620
|
<Icon name="folder" compact="duotone" compactFillOpacity={0.2} />
|
|
570
621
|
```
|
|
571
622
|
|
|
@@ -574,33 +625,28 @@ Reduces visual weight of solid icons at small sizes by adjusting opacity.
|
|
|
574
625
|
| Prop | Type | Default | Description |
|
|
575
626
|
|---|---|---|---|
|
|
576
627
|
| `ariaLabel` | `string` | Icon name | `aria-label` on the SVG |
|
|
577
|
-
| `title` | `string` | — | SVG `<title>` element
|
|
578
|
-
| `titleId` | `string` | — | `id` for the `<title>` element
|
|
579
|
-
| `decorative` | `boolean` | `false` | Sets `aria-hidden="true"`
|
|
628
|
+
| `title` | `string` | — | SVG `<title>` element |
|
|
629
|
+
| `titleId` | `string` | — | `id` for the `<title>` element |
|
|
630
|
+
| `decorative` | `boolean` | `false` | Sets `aria-hidden="true"` |
|
|
580
631
|
| `testId` | `string` | — | `data-testid` attribute |
|
|
581
632
|
|
|
582
633
|
```svelte
|
|
583
|
-
<!-- Decorative icon next to a labeled button -->
|
|
584
634
|
<button>
|
|
585
635
|
<Icon name="download" decorative />
|
|
586
636
|
Download
|
|
587
637
|
</button>
|
|
588
638
|
|
|
589
|
-
<!-- Standalone meaningful icon -->
|
|
590
639
|
<Icon name="check" ariaLabel="Task completed" />
|
|
591
|
-
|
|
592
|
-
<!-- With visible tooltip -->
|
|
593
|
-
<Icon name="info" title="More information" ariaLabel="More information" />
|
|
594
640
|
```
|
|
595
641
|
|
|
596
642
|
### Lazy Loading Prop
|
|
597
643
|
|
|
598
644
|
| Prop | Type | Default | Description |
|
|
599
645
|
|---|---|---|---|
|
|
600
|
-
| `lazy` | `boolean` | `false` | Load the icon
|
|
646
|
+
| `lazy` | `boolean` | `false` | Load the icon via dynamic import, enabling per-icon code splitting |
|
|
601
647
|
|
|
602
648
|
```svelte
|
|
603
|
-
<!-- Eager (default)
|
|
649
|
+
<!-- Eager (default) -->
|
|
604
650
|
<Icon name="check" />
|
|
605
651
|
|
|
606
652
|
<!-- Lazy — separate chunk, skeleton while loading -->
|
|
@@ -611,7 +657,7 @@ Reduces visual weight of solid icons at small sizes by adjusting opacity.
|
|
|
611
657
|
|
|
612
658
|
## Presets
|
|
613
659
|
|
|
614
|
-
Presets apply a predefined set of props in one shot.
|
|
660
|
+
Presets apply a predefined set of props in one shot.
|
|
615
661
|
|
|
616
662
|
```svelte
|
|
617
663
|
<Icon name="check" preset="success" />
|
|
@@ -638,10 +684,7 @@ Presets apply a predefined set of props in one shot. Define colors, sizes, and b
|
|
|
638
684
|
Props passed directly always override preset values.
|
|
639
685
|
|
|
640
686
|
```svelte
|
|
641
|
-
<!-- preset sets size=24, but size={32} wins -->
|
|
642
687
|
<Icon name="check" preset="nav" size={32} />
|
|
643
|
-
|
|
644
|
-
<!-- preset + variant combination -->
|
|
645
688
|
<Icon name="trash" preset="button" variant="danger" />
|
|
646
689
|
```
|
|
647
690
|
|
|
@@ -649,11 +692,7 @@ Props passed directly always override preset values.
|
|
|
649
692
|
|
|
650
693
|
## Variants
|
|
651
694
|
|
|
652
|
-
Variants apply a color scheme without touching size or behavior.
|
|
653
|
-
|
|
654
|
-
```svelte
|
|
655
|
-
<Icon name="check" preset="button" variant="success" />
|
|
656
|
-
```
|
|
695
|
+
Variants apply a color scheme without touching size or behavior.
|
|
657
696
|
|
|
658
697
|
| Variant | Color token |
|
|
659
698
|
|---|---|
|
|
@@ -673,17 +712,18 @@ Variants apply a color scheme without touching size or behavior. Combine with pr
|
|
|
673
712
|
By default icons load eagerly (zero latency, no skeletons). Add `lazy` to defer loading and enable per-icon code splitting.
|
|
674
713
|
|
|
675
714
|
```svelte
|
|
676
|
-
<!-- Eager (default)
|
|
715
|
+
<!-- Eager (default) -->
|
|
677
716
|
<Icon name="check" />
|
|
678
717
|
|
|
679
718
|
<!-- Lazy — loaded on first render, skeleton shown while loading -->
|
|
680
719
|
<Icon name="check" lazy />
|
|
720
|
+
|
|
721
|
+
<!-- Zero-registry component — no static imports whatsoever -->
|
|
722
|
+
<IconLazy name="check" />
|
|
681
723
|
```
|
|
682
724
|
|
|
683
725
|
### Manual preload
|
|
684
726
|
|
|
685
|
-
Preload a set of icons before they are needed (e.g. on route anticipation):
|
|
686
|
-
|
|
687
727
|
```ts
|
|
688
728
|
import { preloadIcons } from '@genarou/blazir-icons'
|
|
689
729
|
|
|
@@ -696,11 +736,8 @@ preloadIcons(['check', 'home', 'settings', 'user'])
|
|
|
696
736
|
```ts
|
|
697
737
|
import { loadIcon, getLoadedIcon } from '@genarou/blazir-icons'
|
|
698
738
|
|
|
699
|
-
//
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
// Synchronous lookup (returns null if not yet loaded)
|
|
703
|
-
const Cached = getLoadedIcon('check')
|
|
739
|
+
const Check = await loadIcon('check') // async load + cache
|
|
740
|
+
const Cached = getLoadedIcon('check') // sync lookup (null if not yet loaded)
|
|
704
741
|
```
|
|
705
742
|
|
|
706
743
|
---
|
|
@@ -710,20 +747,9 @@ const Cached = getLoadedIcon('check')
|
|
|
710
747
|
Declarative interactive effects applied via the `effects` prop. All effects respect `prefers-reduced-motion`.
|
|
711
748
|
|
|
712
749
|
```svelte
|
|
713
|
-
<Icon
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
/>
|
|
717
|
-
|
|
718
|
-
<Icon
|
|
719
|
-
name="trash"
|
|
720
|
-
effects={{ wiggleOnHover: true, elasticOnClick: true }}
|
|
721
|
-
/>
|
|
722
|
-
|
|
723
|
-
<Icon
|
|
724
|
-
name="heart"
|
|
725
|
-
effects={{ heartbeatOnHover: true, hoverScale: 1.15 }}
|
|
726
|
-
/>
|
|
750
|
+
<Icon name="settings" effects={{ spinOnHover: true, cursor: 'pointer' }} />
|
|
751
|
+
<Icon name="trash" effects={{ wiggleOnHover: true, elasticOnClick: true }} />
|
|
752
|
+
<Icon name="heart" effects={{ heartbeatOnHover: true, hoverScale: 1.15 }} />
|
|
727
753
|
```
|
|
728
754
|
|
|
729
755
|
### `IconEffectOptions`
|
|
@@ -733,12 +759,10 @@ Declarative interactive effects applied via the `effects` prop. All effects resp
|
|
|
733
759
|
| `spinOnHover` | `boolean` | Spin on mouse enter |
|
|
734
760
|
| `bounceOnHover` | `boolean` | Bounce on mouse enter |
|
|
735
761
|
| `wiggleOnHover` | `boolean` | Wiggle on mouse enter |
|
|
762
|
+
| `heartbeatOnHover` | `boolean` | Heartbeat on hover |
|
|
763
|
+
| `heartbeatOnActive` | `boolean` | Heartbeat on mousedown |
|
|
736
764
|
| `slideOnHover` | `"up" \| "down" \| "left" \| "right"` | Slide translate on hover |
|
|
737
|
-
| `morphOnHover` | `"play" \| "pause" \| "menu" \| "close" \| "arrow" \| "check"` | Morph shape on hover |
|
|
738
765
|
| `elasticOnClick` | `boolean` | Elastic scale pop on click |
|
|
739
|
-
| `heartbeatOnActive` | `boolean` | Heartbeat on mousedown |
|
|
740
|
-
| `heartbeatOnHover` | `boolean` | Heartbeat on hover |
|
|
741
|
-
| `pulse` | `boolean` | Continuous pulse |
|
|
742
766
|
| `hoverScale` | `number` | Scale factor on hover (`1.1` = 110%) |
|
|
743
767
|
| `pressScale` | `number` | Scale factor on press |
|
|
744
768
|
| `rotateOnHover` | `number` | Degrees to rotate on hover |
|
|
@@ -747,12 +771,9 @@ Declarative interactive effects applied via the `effects` prop. All effects resp
|
|
|
747
771
|
| `cursor` | `string` | CSS cursor on hover |
|
|
748
772
|
| `tooltip` | `string` | Native title tooltip |
|
|
749
773
|
| `focusRing` | `boolean` | Show visible focus ring |
|
|
750
|
-
| `kbFocusAttr` | `string` | Data attribute set on keyboard focus |
|
|
751
774
|
|
|
752
775
|
### Using `iconEffects` as a Svelte action
|
|
753
776
|
|
|
754
|
-
For advanced cases where you need to apply effects to a custom element:
|
|
755
|
-
|
|
756
777
|
```svelte
|
|
757
778
|
<script>
|
|
758
779
|
import { iconEffects } from '@genarou/blazir-icons'
|
|
@@ -778,38 +799,24 @@ Pass Svelte actions to the icon wrapper via the `actions` prop. Actions are diff
|
|
|
778
799
|
let opts = $state({ text: 'Save file' })
|
|
779
800
|
</script>
|
|
780
801
|
|
|
781
|
-
<Icon
|
|
782
|
-
name="save"
|
|
783
|
-
actions={[[tooltip, opts], [lazyLoad]]}
|
|
784
|
-
/>
|
|
802
|
+
<Icon name="save" actions={[[tooltip, opts], [lazyLoad]]} />
|
|
785
803
|
```
|
|
786
804
|
|
|
787
|
-
Each entry
|
|
805
|
+
Each entry is a tuple `[actionFn, params?]`. When `params` change, `update()` is called. When the action function itself changes, the action is destroyed and recreated.
|
|
788
806
|
|
|
789
807
|
---
|
|
790
808
|
|
|
791
809
|
## IconBadge
|
|
792
810
|
|
|
793
|
-
`IconBadge` wraps any icon with an absolute-positioned notification badge. Zero weight unless imported.
|
|
794
|
-
|
|
795
811
|
```svelte
|
|
796
812
|
<script>
|
|
797
813
|
import { IconBadge } from '@genarou/blazir-icons'
|
|
798
814
|
</script>
|
|
799
815
|
|
|
800
|
-
<!--
|
|
801
|
-
<IconBadge name="bell" badge />
|
|
802
|
-
|
|
803
|
-
<!-- Count -->
|
|
804
|
-
<IconBadge name="bell" badge={5} />
|
|
805
|
-
|
|
806
|
-
<!-- Text -->
|
|
807
|
-
<IconBadge name="chat" badge="!" />
|
|
808
|
-
|
|
809
|
-
<!-- Custom color and size -->
|
|
816
|
+
<IconBadge name="bell" badge /> <!-- dot -->
|
|
817
|
+
<IconBadge name="bell" badge={5} /> <!-- count -->
|
|
818
|
+
<IconBadge name="chat" badge="!" /> <!-- text -->
|
|
810
819
|
<IconBadge name="bell" badge={12} badgeColor="#f59e0b" badgeSize={18} />
|
|
811
|
-
|
|
812
|
-
<!-- Position (default: top-right) -->
|
|
813
820
|
<IconBadge name="bell" badge={3} badgePosition="top-left" />
|
|
814
821
|
```
|
|
815
822
|
|
|
@@ -821,16 +828,17 @@ Accepts all `Icon` props plus:
|
|
|
821
828
|
|---|---|---|---|
|
|
822
829
|
| `badge` | `boolean \| number \| string` | — | `true` = dot · number/string = label |
|
|
823
830
|
| `badgeColor` | `string` | `#ef4444` | Badge background color |
|
|
831
|
+
| `badgeTextColor` | `string` | `#ffffff` | Badge text color |
|
|
824
832
|
| `badgeSize` | `number` | `8` (dot) / `16` (label) | Badge diameter in px |
|
|
825
833
|
| `badgePosition` | `"top-right" \| "top-left" \| "bottom-right" \| "bottom-left"` | `"top-right"` | Corner placement |
|
|
826
834
|
|
|
827
|
-
> `badge={false}` or omitting `badge` renders the icon directly without any wrapper
|
|
835
|
+
> `badge={false}` or omitting `badge` renders the icon directly without any wrapper — no DOM overhead.
|
|
828
836
|
|
|
829
837
|
---
|
|
830
838
|
|
|
831
839
|
## CustomIcon
|
|
832
840
|
|
|
833
|
-
Render any custom SVG string using the same `IconBase` engine
|
|
841
|
+
Render any custom SVG string using the same `IconBase` engine.
|
|
834
842
|
|
|
835
843
|
```svelte
|
|
836
844
|
<script>
|
|
@@ -839,39 +847,22 @@ Render any custom SVG string using the same `IconBase` engine — all effects, t
|
|
|
839
847
|
const logoSvg = `<path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/>`
|
|
840
848
|
</script>
|
|
841
849
|
|
|
842
|
-
<!-- Same API as Icon — all props supported -->
|
|
843
850
|
<CustomIcon svgContent={logoSvg} size={32} color="var(--primary)" />
|
|
844
|
-
|
|
845
|
-
<!-- With hover and effects -->
|
|
846
|
-
<CustomIcon
|
|
847
|
-
svgContent={logoSvg}
|
|
848
|
-
hoverColor="#6366f1"
|
|
849
|
-
hoverSpeed="fast"
|
|
850
|
-
effects={{ hoverScale: 1.1 }}
|
|
851
|
-
/>
|
|
852
|
-
|
|
853
|
-
<!-- With animations -->
|
|
854
|
-
<CustomIcon svgContent={logoSvg} spin pulse />
|
|
855
|
-
|
|
856
|
-
<!-- Custom viewBox for non-24x24 SVGs -->
|
|
851
|
+
<CustomIcon svgContent={logoSvg} hoverColor="#6366f1" effects={{ hoverScale: 1.1 }} />
|
|
857
852
|
<CustomIcon svgContent={logoSvg} viewBox="0 0 48 48" size={48} />
|
|
858
853
|
```
|
|
859
854
|
|
|
860
|
-
### `CustomIcon` props
|
|
861
|
-
|
|
862
855
|
| Prop | Type | Default | Description |
|
|
863
856
|
|---|---|---|---|
|
|
864
|
-
| `svgContent` | `string` | **required** | Raw SVG inner markup (
|
|
857
|
+
| `svgContent` | `string` | **required** | Raw SVG inner markup (not the `<svg>` tag itself) |
|
|
865
858
|
| `viewBox` | `string` | `"0 0 24 24"` | ViewBox for the SVG container |
|
|
866
|
-
| + all `IconProps` | | | Every prop from
|
|
867
|
-
|
|
868
|
-
> The content is rendered via `{@html}`. For static `svgContent` (most common case) the cost is a single `innerHTML` assignment at mount — identical to any other icon. All `IconBase` effects run on the containing `<g>` layer.
|
|
859
|
+
| + all `IconProps` | | | Every prop from `Icon` is supported |
|
|
869
860
|
|
|
870
861
|
---
|
|
871
862
|
|
|
872
863
|
## Vite Plugin (Tree Shaking)
|
|
873
864
|
|
|
874
|
-
|
|
865
|
+
The plugin scans your source files at build time, detects static `name="..."` values, and generates a minimal registry containing only the icons you use.
|
|
875
866
|
|
|
876
867
|
```ts
|
|
877
868
|
// vite.config.ts
|
|
@@ -886,17 +877,12 @@ export default {
|
|
|
886
877
|
}
|
|
887
878
|
```
|
|
888
879
|
|
|
889
|
-
The plugin scans your source files at build time, detects static `name="..."` values, and generates a minimal registry.
|
|
890
|
-
|
|
891
880
|
```svelte
|
|
892
|
-
<!-- Detected
|
|
881
|
+
<!-- Detected → only Check.svelte bundled -->
|
|
893
882
|
<Icon name="check" />
|
|
894
|
-
|
|
895
|
-
<!-- Also detected statically -->
|
|
896
883
|
<Icon name={"home"} />
|
|
897
884
|
|
|
898
|
-
<!-- Dynamic →
|
|
899
|
-
<Icon name={bzIcons.User} />
|
|
885
|
+
<!-- Dynamic → falls back to full registry (safe) -->
|
|
900
886
|
<Icon name={someVariable} />
|
|
901
887
|
```
|
|
902
888
|
|
|
@@ -904,10 +890,7 @@ The plugin scans your source files at build time, detects static `name="..."` va
|
|
|
904
890
|
|
|
905
891
|
```ts
|
|
906
892
|
blazirIconsPlugin({
|
|
907
|
-
// Root directory to scan. Default: Vite's config.root
|
|
908
893
|
root: './src',
|
|
909
|
-
|
|
910
|
-
// File extensions to include in scan
|
|
911
894
|
extensions: ['.svelte', '.ts', '.tsx', '.js', '.jsx'],
|
|
912
895
|
})
|
|
913
896
|
```
|
|
@@ -916,50 +899,51 @@ blazirIconsPlugin({
|
|
|
916
899
|
|
|
917
900
|
| Scenario | Bundle (gzip) |
|
|
918
901
|
|---|---|
|
|
919
|
-
| No plugin — all
|
|
902
|
+
| No plugin — all 199 icons | ~12 KB |
|
|
920
903
|
| With plugin — 10 static icons | ~1–2 KB |
|
|
921
|
-
|
|
|
904
|
+
| Direct named imports — zero plugin needed | only imported icons |
|
|
922
905
|
|
|
923
906
|
---
|
|
924
907
|
|
|
925
908
|
## Direct Icon Imports
|
|
926
909
|
|
|
927
|
-
|
|
910
|
+
Three ways to import icons with full tree shaking, no plugin required:
|
|
928
911
|
|
|
929
912
|
```ts
|
|
930
|
-
|
|
931
|
-
import Home
|
|
932
|
-
|
|
913
|
+
// 1. Named exports from the main package
|
|
914
|
+
import { CircleCheck, Home, Settings } from '@genarou/blazir-icons'
|
|
915
|
+
|
|
916
|
+
// 2. Named exports from the /components barrel (identical result, explicit path)
|
|
917
|
+
import { CircleCheck, Home } from '@genarou/blazir-icons/components'
|
|
918
|
+
|
|
919
|
+
// 3. Individual file (maximum isolation)
|
|
920
|
+
import CircleCheck from '@genarou/blazir-icons/icons/CircleCheck'
|
|
921
|
+
import Home from '@genarou/blazir-icons/icons/Home'
|
|
933
922
|
```
|
|
934
923
|
|
|
935
|
-
Use them as regular Svelte components. All `IconProps` are supported
|
|
924
|
+
Use them as regular Svelte components. All `IconProps` are supported.
|
|
936
925
|
|
|
937
926
|
```svelte
|
|
938
|
-
<
|
|
939
|
-
<Home
|
|
927
|
+
<CircleCheck size={20} color="var(--success-color)" />
|
|
928
|
+
<Home size={24} hoverColor="var(--primary)" />
|
|
940
929
|
```
|
|
941
930
|
|
|
942
931
|
---
|
|
943
932
|
|
|
944
933
|
## TypeScript
|
|
945
934
|
|
|
946
|
-
Full type coverage on all props and icon names.
|
|
947
|
-
|
|
948
935
|
```ts
|
|
949
936
|
import type { IconProps, IconName, IconMode } from '@genarou/blazir-icons'
|
|
950
937
|
import type { IconEffectOptions } from '@genarou/blazir-icons'
|
|
951
938
|
import type { BzIconKey } from '@genarou/blazir-icons'
|
|
952
939
|
|
|
953
|
-
// Typed icon name
|
|
954
940
|
const icon: IconName = 'check'
|
|
955
941
|
|
|
956
|
-
// Typed effect options
|
|
957
942
|
const effects: IconEffectOptions = {
|
|
958
943
|
spinOnHover: true,
|
|
959
944
|
hoverScale: 1.1,
|
|
960
945
|
}
|
|
961
946
|
|
|
962
|
-
// Typed bzIcons alias
|
|
963
947
|
const key: BzIconKey = 'Check'
|
|
964
948
|
```
|
|
965
949
|
|
|
@@ -968,7 +952,6 @@ const key: BzIconKey = 'Check'
|
|
|
968
952
|
```ts
|
|
969
953
|
import { iconRegistry } from '@genarou/blazir-icons'
|
|
970
954
|
|
|
971
|
-
// Autocomplete on all registry keys
|
|
972
955
|
type MyIconName = keyof typeof iconRegistry
|
|
973
956
|
```
|
|
974
957
|
|
|
@@ -976,8 +959,6 @@ type MyIconName = keyof typeof iconRegistry
|
|
|
976
959
|
|
|
977
960
|
## CSS Custom Properties
|
|
978
961
|
|
|
979
|
-
Customize animations globally via CSS variables.
|
|
980
|
-
|
|
981
962
|
| Variable | Default | Description |
|
|
982
963
|
|---|---|---|
|
|
983
964
|
| `--bz-icon-bounce-amt` | `18%` | Bounce height |
|
|
@@ -985,10 +966,8 @@ Customize animations globally via CSS variables.
|
|
|
985
966
|
| `--bz-icon-ring` | primary | Focus ring color |
|
|
986
967
|
| `--bz-icon-wiggle-angle` | `3deg` | Wiggle rotation amount |
|
|
987
968
|
| `--bz-icon-slide-distance` | `8px` | Slide effect distance |
|
|
988
|
-
| `--bz-icon-size` | set by component | Icon size (set automatically) |
|
|
989
969
|
|
|
990
970
|
```css
|
|
991
|
-
/* globals.css */
|
|
992
971
|
:root {
|
|
993
972
|
--bz-icon-bounce-amt: 24%;
|
|
994
973
|
--bz-icon-wiggle-angle: 5deg;
|
|
@@ -1000,17 +979,17 @@ Customize animations globally via CSS variables.
|
|
|
1000
979
|
## Accessibility Guide
|
|
1001
980
|
|
|
1002
981
|
```svelte
|
|
1003
|
-
<!-- Decorative icon
|
|
982
|
+
<!-- Decorative icon next to a labeled button -->
|
|
1004
983
|
<button>
|
|
1005
984
|
<Icon name="trash" decorative />
|
|
1006
985
|
Delete item
|
|
1007
986
|
</button>
|
|
1008
987
|
|
|
1009
|
-
<!--
|
|
988
|
+
<!-- Standalone meaningful icon -->
|
|
1010
989
|
<Icon name="warning" ariaLabel="Warning: unsaved changes" />
|
|
1011
990
|
|
|
1012
991
|
<!-- With visible tooltip -->
|
|
1013
|
-
<Icon name="
|
|
992
|
+
<Icon name="circleInfo" title="More information" ariaLabel="More information" />
|
|
1014
993
|
|
|
1015
994
|
<!-- In a labeled group -->
|
|
1016
995
|
<div aria-label="Status">
|
|
@@ -1028,19 +1007,11 @@ Customize animations globally via CSS variables.
|
|
|
1028
1007
|
```svelte
|
|
1029
1008
|
<script>
|
|
1030
1009
|
import { Icon } from '@genarou/blazir-icons'
|
|
1031
|
-
|
|
1032
|
-
export let label = ''
|
|
1033
|
-
export let icon = 'home'
|
|
1010
|
+
let { active = false, label = '', icon = 'home' } = $props()
|
|
1034
1011
|
</script>
|
|
1035
1012
|
|
|
1036
1013
|
<a class="nav-item" class:active>
|
|
1037
|
-
<Icon
|
|
1038
|
-
name={icon}
|
|
1039
|
-
preset="sidebar"
|
|
1040
|
-
color={active ? 'var(--primary)' : undefined}
|
|
1041
|
-
effects={{ hoverScale: 1.08 }}
|
|
1042
|
-
decorative
|
|
1043
|
-
/>
|
|
1014
|
+
<Icon name={icon} preset="sidebar" color={active ? 'var(--primary)' : undefined} effects={{ hoverScale: 1.08 }} decorative />
|
|
1044
1015
|
<span>{label}</span>
|
|
1045
1016
|
</a>
|
|
1046
1017
|
```
|
|
@@ -1059,7 +1030,6 @@ Customize animations globally via CSS variables.
|
|
|
1059
1030
|
}
|
|
1060
1031
|
</script>
|
|
1061
1032
|
|
|
1062
|
-
<!-- The icon swaps to a spinner automatically while saving -->
|
|
1063
1033
|
<button onclick={submit} disabled={saving}>
|
|
1064
1034
|
<Icon name="save" loading={saving} decorative />
|
|
1065
1035
|
{saving ? 'Saving...' : 'Save'}
|
|
@@ -1090,16 +1060,8 @@ Customize animations globally via CSS variables.
|
|
|
1090
1060
|
|
|
1091
1061
|
<div class="input-wrapper">
|
|
1092
1062
|
<input type={visible ? 'text' : 'password'} />
|
|
1093
|
-
<button
|
|
1094
|
-
|
|
1095
|
-
aria-label={visible ? 'Hide password' : 'Show password'}
|
|
1096
|
-
>
|
|
1097
|
-
<Icon
|
|
1098
|
-
name={visible ? 'eyeOff' : 'eye'}
|
|
1099
|
-
preset="muted"
|
|
1100
|
-
effects={{ hoverScale: 1.1, cursor: 'pointer' }}
|
|
1101
|
-
decorative
|
|
1102
|
-
/>
|
|
1063
|
+
<button onclick={() => visible = !visible} aria-label={visible ? 'Hide password' : 'Show password'}>
|
|
1064
|
+
<Icon name={visible ? 'eyeOff' : 'eye'} preset="muted" effects={{ hoverScale: 1.1, cursor: 'pointer' }} decorative />
|
|
1103
1065
|
</button>
|
|
1104
1066
|
</div>
|
|
1105
1067
|
```
|
|
@@ -1113,13 +1075,7 @@ Customize animations globally via CSS variables.
|
|
|
1113
1075
|
</script>
|
|
1114
1076
|
|
|
1115
1077
|
<button aria-label="Notifications ({count} unread)">
|
|
1116
|
-
<IconBadge
|
|
1117
|
-
name="bell"
|
|
1118
|
-
size={22}
|
|
1119
|
-
badge={count > 0 ? count : false}
|
|
1120
|
-
effects={{ wiggleOnHover: true, cursor: 'pointer' }}
|
|
1121
|
-
decorative
|
|
1122
|
-
/>
|
|
1078
|
+
<IconBadge name="bell" size={22} badge={count > 0 ? count : false} effects={{ wiggleOnHover: true, cursor: 'pointer' }} decorative />
|
|
1123
1079
|
</button>
|
|
1124
1080
|
```
|
|
1125
1081
|
|
|
@@ -1132,14 +1088,11 @@ Customize animations globally via CSS variables.
|
|
|
1132
1088
|
const ctx = $derived({ hovered })
|
|
1133
1089
|
</script>
|
|
1134
1090
|
|
|
1135
|
-
<tr
|
|
1136
|
-
onmouseenter={() => hovered = true}
|
|
1137
|
-
onmouseleave={() => hovered = false}
|
|
1138
|
-
>
|
|
1091
|
+
<tr onmouseenter={() => hovered = true} onmouseleave={() => hovered = false}>
|
|
1139
1092
|
<td>{row.name}</td>
|
|
1140
1093
|
<td class="actions">
|
|
1141
|
-
<Icon name="edit" parentHoverContext={ctx} hoverColor="var(--primary)"
|
|
1142
|
-
<Icon name="trash" parentHoverContext={ctx} hoverColor="var(--danger-color)"
|
|
1094
|
+
<Icon name="edit" parentHoverContext={ctx} hoverColor="var(--primary)" preset="button" ariaLabel="Edit row" />
|
|
1095
|
+
<Icon name="trash" parentHoverContext={ctx} hoverColor="var(--danger-color)" preset="button" ariaLabel="Delete row" />
|
|
1143
1096
|
</td>
|
|
1144
1097
|
</tr>
|
|
1145
1098
|
```
|
|
@@ -1157,19 +1110,13 @@ Customize animations globally via CSS variables.
|
|
|
1157
1110
|
success: 'circleCheck',
|
|
1158
1111
|
warning: 'warning',
|
|
1159
1112
|
error: 'error',
|
|
1160
|
-
loading: '
|
|
1113
|
+
loading: 'spinnerDots',
|
|
1161
1114
|
}
|
|
1162
1115
|
|
|
1163
|
-
|
|
1116
|
+
let { status }: { status: Status } = $props()
|
|
1164
1117
|
</script>
|
|
1165
1118
|
|
|
1166
|
-
<Icon
|
|
1167
|
-
name={iconMap[status]}
|
|
1168
|
-
variant={status === 'loading' ? 'muted' : status}
|
|
1169
|
-
spin={status === 'loading'}
|
|
1170
|
-
size={18}
|
|
1171
|
-
ariaLabel="Status: {status}"
|
|
1172
|
-
/>
|
|
1119
|
+
<Icon name={iconMap[status]} variant={status === 'loading' ? 'muted' : status} spin={status === 'loading'} size={18} ariaLabel="Status: {status}" />
|
|
1173
1120
|
```
|
|
1174
1121
|
|
|
1175
1122
|
### Preloading icons on route change (SvelteKit)
|
|
@@ -1179,7 +1126,6 @@ Customize animations globally via CSS variables.
|
|
|
1179
1126
|
import { preloadIcons } from '@genarou/blazir-icons'
|
|
1180
1127
|
|
|
1181
1128
|
export const load = async () => {
|
|
1182
|
-
// Icons are prefetched in background while page data loads
|
|
1183
1129
|
preloadIcons(['chart', 'table', 'user', 'settings', 'logout', 'bell'])
|
|
1184
1130
|
return {}
|
|
1185
1131
|
}
|
|
@@ -1190,17 +1136,11 @@ export const load = async () => {
|
|
|
1190
1136
|
```svelte
|
|
1191
1137
|
<script>
|
|
1192
1138
|
import { iconEffects } from '@genarou/blazir-icons'
|
|
1193
|
-
import
|
|
1139
|
+
import { CircleCheck } from '@genarou/blazir-icons'
|
|
1194
1140
|
</script>
|
|
1195
1141
|
|
|
1196
|
-
<div
|
|
1197
|
-
|
|
1198
|
-
use:iconEffects={{ pulse: true, hoverScale: 1.05, cursor: 'pointer' }}
|
|
1199
|
-
>
|
|
1200
|
-
<Check size={14} color="var(--success-color)" decorative />
|
|
1142
|
+
<div class="status-chip" use:iconEffects={{ pulse: true, hoverScale: 1.05, cursor: 'pointer' }}>
|
|
1143
|
+
<CircleCheck size={14} color="var(--success-color)" decorative />
|
|
1201
1144
|
Active
|
|
1202
1145
|
</div>
|
|
1203
1146
|
```
|
|
1204
|
-
|
|
1205
|
-
---
|
|
1206
|
-
|