@solar-icons/vue 2.0.0-beta.2 → 2.0.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/README.md +22 -1
- package/dist/lib/IconBase.mjs +1 -1
- package/dist/lib/index.d.mts +2 -2
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/useSolar.d.mts +2 -1
- package/dist/lib/useSolar.mjs +1 -1
- package/package.json +30 -8
package/README.md
CHANGED
|
@@ -49,9 +49,30 @@ import { HomeIcon } from '@solar-icons/vue/linear'
|
|
|
49
49
|
</template>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
### Global Configuration (Plugin)
|
|
53
|
+
|
|
54
|
+
The plugin sets the same defaults app-wide without a provider wrapper. It writes the five CSS variables on `document.body` and makes `useSolar()` available in every component. The variables are applied client-side.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { createApp } from 'vue'
|
|
58
|
+
import { SolarIconsPlugin } from '@solar-icons/vue/lib'
|
|
59
|
+
|
|
60
|
+
const app = createApp(App)
|
|
61
|
+
app.use(SolarIconsPlugin, {
|
|
62
|
+
color: '#ef4444',
|
|
63
|
+
size: 24,
|
|
64
|
+
strokeWidth: 1.5,
|
|
65
|
+
secondaryColor: '#f59e0b',
|
|
66
|
+
secondaryOpacity: 0.5,
|
|
67
|
+
})
|
|
68
|
+
app.mount('#app')
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For server-rendered apps, prefer `<SolarProvider>` for an exact first paint.
|
|
72
|
+
|
|
52
73
|
## Documentation
|
|
53
74
|
|
|
54
|
-
For installation guides, API reference, and a searchable icon catalog, visit the [Vue Documentation](https://solar-icons.vercel.app/docs/v2/
|
|
75
|
+
For installation guides, API reference, and a searchable icon catalog, visit the [Vue Documentation](https://solar-icons.vercel.app/docs/v2/packages/vue).
|
|
55
76
|
|
|
56
77
|
## License
|
|
57
78
|
|
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/dist/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconProps, IconStyle } from "./types.mjs";
|
|
2
2
|
import _default from "./IconBase.vue.mjs";
|
|
3
3
|
import _default$1 from "./SolarProvider.vue.mjs";
|
|
4
|
-
import { SolarIconsConfig, SolarIconsPlugin, SolarState, createSolarIcons, provideSolarIconsContextInApp, useSolar } from "./useSolar.mjs";
|
|
5
|
-
export { _default as IconBase, type IconProps, IconStyle, type SolarIconsConfig, SolarIconsPlugin, type SolarIconsPlugin as SolarIconsPluginType, _default$1 as SolarProvider, type SolarState, createSolarIcons, provideSolarIconsContextInApp, useSolar };
|
|
4
|
+
import { SolarIconsConfig, SolarIconsPlugin, SolarState, applySolarCssVariables, createSolarIcons, provideSolarIconsContextInApp, useSolar } from "./useSolar.mjs";
|
|
5
|
+
export { _default as IconBase, type IconProps, IconStyle, type SolarIconsConfig, SolarIconsPlugin, type SolarIconsPlugin as SolarIconsPluginType, _default$1 as SolarProvider, type SolarState, applySolarCssVariables, createSolarIcons, provideSolarIconsContextInApp, useSolar };
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./IconBase.mjs";import t from"./SolarProvider.mjs";import{IconStyle as n}from"./types.mjs";import{SolarIconsPlugin as r,
|
|
1
|
+
import e from"./IconBase.mjs";import t from"./SolarProvider.mjs";import{IconStyle as n}from"./types.mjs";import{SolarIconsPlugin as r,applySolarCssVariables as i,createSolarIcons as a,provideSolarIconsContextInApp as o,useSolar as s}from"./useSolar.mjs";export{e as IconBase,n as IconStyle,r as SolarIconsPlugin,t as SolarProvider,i as applySolarCssVariables,a as createSolarIcons,o as provideSolarIconsContextInApp,s as useSolar};
|
package/dist/lib/useSolar.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ declare function useSolar(): SolarState;
|
|
|
25
25
|
interface SolarIconsPlugin {
|
|
26
26
|
install(app: App, options?: SolarIconsConfig): void;
|
|
27
27
|
}
|
|
28
|
+
declare function applySolarCssVariables(state: SolarState): void;
|
|
28
29
|
declare const SolarIconsPlugin: SolarIconsPlugin;
|
|
29
30
|
//#endregion
|
|
30
|
-
export { SolarIconsConfig, SolarIconsPlugin, SolarState, createSolarIcons, provideSolarIconsContextInApp, useSolar };
|
|
31
|
+
export { SolarIconsConfig, SolarIconsPlugin, SolarState, applySolarCssVariables, createSolarIcons, provideSolarIconsContextInApp, useSolar };
|
package/dist/lib/useSolar.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SOLAR_CONTEXT_KEY as e}from"./context-key.mjs";import{inject as t,ref as n}from"vue";function
|
|
1
|
+
import{SOLAR_CONTEXT_KEY as e}from"./context-key.mjs";import{inject as t,ref as n,watch as r}from"vue";function i(e={}){let t=n(e.color),r=n(e.size),i=n(e.strokeWidth),a=n(e.secondaryColor),o=n(e.secondaryOpacity);return{color:t,setColor:e=>{t.value=e},size:r,setSize:e=>{r.value=e},strokeWidth:i,setStrokeWidth:e=>{i.value=e},secondaryColor:a,setSecondaryColor:e=>{a.value=e},secondaryOpacity:o,setSecondaryOpacity:e=>{o.value=e}}}function a(t,n){t.provide(e,n)}function o(){let n=t(e);if(!n)throw Error(`useSolar() must be used inside a <SolarProvider> or after installing SolarIconsPlugin`);return n}const s=[{key:`--solar-color`,get:e=>e.color.value},{key:`--solar-size`,get:e=>e.size.value},{key:`--solar-stroke-width`,get:e=>e.strokeWidth.value},{key:`--solar-secondary-color`,get:e=>e.secondaryColor.value},{key:`--solar-secondary-opacity`,get:e=>e.secondaryOpacity.value}];function c(e){typeof document>`u`||r([e.color,e.size,e.strokeWidth,e.secondaryColor,e.secondaryOpacity],()=>{let t=document.body;for(let{key:n,get:r}of s){let i=r(e);if(n===`--solar-secondary-color`?i:i!=null){let e=n===`--solar-size`&&typeof i==`number`?`${i}px`:String(i);t.style.setProperty(n,e)}else t.style.removeProperty(n)}},{immediate:!0})}const l={install(e,t={}){let n=i(t);a(e,n),c(n)}};export{l as SolarIconsPlugin,c as applySolarCssVariables,i as createSolarIcons,a as provideSolarIconsContextInApp,o as useSolar};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solar-icons/vue",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -77,19 +77,41 @@
|
|
|
77
77
|
"vue": ">=3.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
81
|
-
"@vue/compiler-sfc": "3.5.
|
|
80
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
81
|
+
"@vue/compiler-sfc": "3.5.41",
|
|
82
82
|
"@vue/test-utils": "^2.4.11",
|
|
83
|
-
"jsdom": "^
|
|
83
|
+
"jsdom": "^30.0.1",
|
|
84
84
|
"picocolors": "^1.1.1",
|
|
85
85
|
"unplugin-vue": "^7.2.0",
|
|
86
|
-
"vite": "^8.
|
|
86
|
+
"vite": "^8.2.0",
|
|
87
87
|
"vitest": "^4.1.10",
|
|
88
|
-
"vue": "^3.5.
|
|
89
|
-
"vue-tsc": "3.3.
|
|
90
|
-
"@solar-icons/core": "2.0.0
|
|
88
|
+
"vue": "^3.5.41",
|
|
89
|
+
"vue-tsc": "3.3.9",
|
|
90
|
+
"@solar-icons/core": "2.0.0"
|
|
91
91
|
},
|
|
92
92
|
"license": "MIT",
|
|
93
|
+
"keywords": [
|
|
94
|
+
"vue",
|
|
95
|
+
"icons",
|
|
96
|
+
"svg",
|
|
97
|
+
"solar",
|
|
98
|
+
"design",
|
|
99
|
+
"interface",
|
|
100
|
+
"phosphor",
|
|
101
|
+
"UI",
|
|
102
|
+
"UX"
|
|
103
|
+
],
|
|
104
|
+
"author": {
|
|
105
|
+
"name": "Saoudi Hakim",
|
|
106
|
+
"url": "https://hakimsaoudi.dev",
|
|
107
|
+
"email": "saoudihakim@gmail.com"
|
|
108
|
+
},
|
|
109
|
+
"engines": {
|
|
110
|
+
"node": ">=16"
|
|
111
|
+
},
|
|
112
|
+
"bugs": {
|
|
113
|
+
"url": "https://github.com/saoudi-h/solar-icons/issues"
|
|
114
|
+
},
|
|
93
115
|
"scripts": {
|
|
94
116
|
"copy:licenses": "cp ../../LICENSE ./LICENSE && cp ../../LICENSE-THIRD-PARTY ./LICENSE-THIRD-PARTY",
|
|
95
117
|
"generate:assets": "tsx scripts/generate-assets.ts",
|