@solar-icons/vue 2.0.0-beta.1 → 2.0.0-beta.3
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/README.md +28 -79
- package/dist/lib/IconBase.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,109 +1,58 @@
|
|
|
1
1
|
# @solar-icons/vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue components for Solar Icons. This package provides 7,476 SVG icons across 6 styles (Bold, Broken, Linear, Outline, Bold Duotone, Line Duotone), optimized for Vue applications.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **7,476 SVGs:** 1,246 unique icons in 6 styles. Designed by 480 Design.
|
|
8
|
+
- **Tree-shakeable:** Import only the icons you use.
|
|
9
|
+
- **Global configuration:** Set defaults for size, color, and stroke width using `<SolarProvider>`.
|
|
10
|
+
- **Customizable:** Override size, color, and stroke width per icon via props or CSS variables.
|
|
11
|
+
- **Duotone support:** Secondary color controls for `bold-duotone` and `line-duotone` styles.
|
|
12
|
+
- **TypeScript:** Typed components and props.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
8
17
|
npm install @solar-icons/vue
|
|
9
18
|
```
|
|
10
19
|
|
|
11
20
|
## Usage
|
|
12
21
|
|
|
13
|
-
Import and render components:
|
|
14
|
-
|
|
15
22
|
```vue
|
|
23
|
+
<script setup>
|
|
24
|
+
import { HomeIcon, LoginIcon } from '@solar-icons/vue/linear'
|
|
25
|
+
</script>
|
|
26
|
+
|
|
16
27
|
<template>
|
|
17
28
|
<div>
|
|
18
|
-
<
|
|
19
|
-
<
|
|
29
|
+
<HomeIcon />
|
|
30
|
+
<LoginIcon color="#3b82f6" :size="32" :strokeWidth="2" />
|
|
20
31
|
</div>
|
|
21
32
|
</template>
|
|
22
|
-
|
|
23
|
-
<script setup>
|
|
24
|
-
import { ArrowUp } from '@solar-icons/vue'
|
|
25
|
-
import { Arrows } from '@solar-icons/vue/category'
|
|
26
|
-
</script>
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
###
|
|
35
|
+
### Global Configuration (Provider)
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- **`size`**: Width and height (e.g., `24`, `"1.5em"`, default: `24`).
|
|
34
|
-
- **`color`**: Icon color (e.g., `"#000"`, `"currentColor"`, default: `"currentColor"`).
|
|
35
|
-
- **`weight`**: Icon style variant (`"Bold"`, `"Linear"`, `"Outline"`, `"BoldDuotone"`, `"LineDuotone"`, or `"Broken"`, default: `"Linear"`).
|
|
36
|
-
- **`mirrored`**: Flips the icon horizontally when `true` (default: `false`).
|
|
37
|
-
- **`alt`**: Accessibility title.
|
|
38
|
-
|
|
39
|
-
## Advanced Usage
|
|
40
|
-
|
|
41
|
-
### Global Configuration
|
|
42
|
-
|
|
43
|
-
Set default styles globally using `SolarProvider`:
|
|
37
|
+
Wrap your application root in `<SolarProvider>` to set default properties:
|
|
44
38
|
|
|
45
39
|
```vue
|
|
46
|
-
<template>
|
|
47
|
-
<SolarProvider :size="32" color="purple" weight="Linear">
|
|
48
|
-
<YourComponents />
|
|
49
|
-
</SolarProvider>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
40
|
<script setup>
|
|
53
41
|
import { SolarProvider } from '@solar-icons/vue'
|
|
42
|
+
import { HomeIcon } from '@solar-icons/vue/linear'
|
|
54
43
|
</script>
|
|
55
|
-
```
|
|
56
44
|
|
|
57
|
-
### Vue Plugin
|
|
58
|
-
|
|
59
|
-
Alternatively, configure defaults globally via the Vue plugin:
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
import { createApp } from 'vue'
|
|
63
|
-
import { SolarIconsPlugin } from '@solar-icons/vue'
|
|
64
|
-
|
|
65
|
-
const app = createApp(App)
|
|
66
|
-
app.use(SolarIconsPlugin, {
|
|
67
|
-
color: 'currentColor',
|
|
68
|
-
size: '24',
|
|
69
|
-
weight: 'Linear',
|
|
70
|
-
mirrored: false,
|
|
71
|
-
})
|
|
72
|
-
app.mount('#app')
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Composition API
|
|
76
|
-
|
|
77
|
-
Access and modify settings dynamically using `useSolar`:
|
|
78
|
-
|
|
79
|
-
```vue
|
|
80
45
|
<template>
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
</div>
|
|
46
|
+
<SolarProvider :size="24" color="currentColor" :strokeWidth="1.5">
|
|
47
|
+
<HomeIcon />
|
|
48
|
+
</SolarProvider>
|
|
85
49
|
</template>
|
|
86
|
-
|
|
87
|
-
<script setup>
|
|
88
|
-
import { ref } from 'vue'
|
|
89
|
-
import { ArrowUp, useSolar } from '@solar-icons/vue'
|
|
90
|
-
|
|
91
|
-
const { config, setSize } = useSolar()
|
|
92
|
-
const iconSize = ref(24)
|
|
93
|
-
|
|
94
|
-
const increaseSize = () => {
|
|
95
|
-
const newSize = parseInt(iconSize.value) + 4
|
|
96
|
-
iconSize.value = newSize
|
|
97
|
-
setSize(newSize)
|
|
98
|
-
}
|
|
99
|
-
</script>
|
|
100
50
|
```
|
|
101
51
|
|
|
102
|
-
##
|
|
52
|
+
## Documentation
|
|
103
53
|
|
|
104
|
-
|
|
105
|
-
- **Icons**: CC BY 4.0 by [480 Design](https://www.figma.com/community/file/1166831539721848736) (requires attribution)
|
|
54
|
+
For installation guides, API reference, and a searchable icon catalog, visit the [Vue Documentation](https://solar-icons.vercel.app/docs/v2/frameworks/vue).
|
|
106
55
|
|
|
107
|
-
|
|
56
|
+
## License
|
|
108
57
|
|
|
109
|
-
|
|
58
|
+
MIT License. Icons by 480 Design (CC BY 4.0).
|
package/dist/lib/IconBase.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{computed as e,createCommentVNode as t,createElementBlock as n,defineComponent as r,mergeProps as i,openBlock as a,renderSlot as o,toDisplayString as s,useAttrs as c}from"vue";const l=[`width`,`height`,`color`,`stroke-width`,`aria-hidden`],u={key:0},d=`solar`,f=r({__name:`IconBase`,props:{alt:{},color:{},size:{},strokeWidth:{},secondaryColor:{},secondaryOpacity:{},iconName:{},isolated:{type:Boolean}},setup(r){let f=r,p=c(),m=e(()=>f.iconName?`${d} solar-${f.iconName}`:d),h=e(()=>!!f.alt||p[`aria-label`]!==void 0||p.title!==void 0),g=e(()=>{let e={};if(f.isolated&&(e[`--solar-secondary-color`]=`initial`,e[`--solar-secondary-opacity`]=`initial`),f.color!==void 0&&(e.color=f.color),f.size!==void 0){let t=typeof f.size==`number`?`${f.size}px`:f.size;e.width=t,e.height=t}return f.strokeWidth!==void 0&&(e[`stroke-width`]=String(f.strokeWidth)),f.secondaryColor&&(e[`--solar-secondary-color`]=f.secondaryColor),f.secondaryOpacity!=null&&(e[`--solar-secondary-opacity`]=String(f.secondaryOpacity)),e}),_=e(()=>{if(f.size===void 0)return f.isolated?`24px`:`
|
|
1
|
+
import{computed as e,createCommentVNode as t,createElementBlock as n,defineComponent as r,mergeProps as i,openBlock as a,renderSlot as o,toDisplayString as s,useAttrs as c}from"vue";const l=[`width`,`height`,`color`,`stroke-width`,`aria-hidden`],u={key:0},d=`solar`,f=r({__name:`IconBase`,props:{alt:{},color:{},size:{},strokeWidth:{},secondaryColor:{},secondaryOpacity:{},iconName:{},isolated:{type:Boolean}},setup(r){let f=r,p=c(),m=e(()=>f.iconName?`${d} solar-${f.iconName}`:d),h=e(()=>!!f.alt||p[`aria-label`]!==void 0||p.title!==void 0),g=e(()=>{let e={};if(f.isolated&&(e[`--solar-secondary-color`]=`initial`,e[`--solar-secondary-opacity`]=`initial`),f.color!==void 0&&(e.color=f.color),f.size!==void 0){let t=typeof f.size==`number`?`${f.size}px`:f.size;e.width=t,e.height=t}return f.strokeWidth!==void 0&&(e[`stroke-width`]=String(f.strokeWidth)),f.secondaryColor&&(e[`--solar-secondary-color`]=f.secondaryColor),f.secondaryOpacity!=null&&(e[`--solar-secondary-opacity`]=String(f.secondaryOpacity)),f.size===void 0&&!f.isolated&&!e.fontSize&&!e[`font-size`]&&(e.fontSize=`var(--solar-size, 24px)`),e}),_=e(()=>{if(f.size===void 0)return f.isolated?`24px`:`1em`}),v=e(()=>{if(f.size===void 0)return f.isolated?`24px`:`1em`}),y=e(()=>{if(f.color===void 0)return f.isolated?`currentColor`:`var(--solar-color, currentColor)`}),b=e(()=>{if(f.strokeWidth===void 0)return f.isolated?`1.5`:`var(--solar-stroke-width, 1.5)`});return(e,c)=>(a(),n(`svg`,i({xmlns:`http://www.w3.org/2000/svg`},e.$attrs,{class:m.value,style:Object.keys(g.value).length>0?g.value:void 0,fill:`none`,viewBox:`0 0 24 24`,width:_.value,height:v.value,color:y.value,"stroke-width":b.value,"aria-hidden":h.value?void 0:`true`}),[r.alt?(a(),n(`title`,u,s(r.alt),1)):t(`v-if`,!0),o(e.$slots,`default`)],16,l))}});export{f as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solar-icons/vue",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"vitest": "^4.1.10",
|
|
88
88
|
"vue": "^3.5.39",
|
|
89
89
|
"vue-tsc": "3.3.7",
|
|
90
|
-
"@solar-icons/core": "2.0.0-beta.
|
|
90
|
+
"@solar-icons/core": "2.0.0-beta.1"
|
|
91
91
|
},
|
|
92
92
|
"license": "MIT",
|
|
93
93
|
"scripts": {
|