vite-plugin-material-symbols 0.7.1 → 0.8.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/CHANGELOG.md +7 -0
- package/README.md +9 -7
- package/dist/index.d.ts +10 -4
- package/dist/index.js +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Version 0
|
|
4
4
|
|
|
5
|
+
### v0.8.0
|
|
6
|
+
|
|
7
|
+
- Replaced `getUrl` option with two new ones:
|
|
8
|
+
- `fontUrl` (string): Material Symbols CSS Provider;
|
|
9
|
+
- `paramName` (string): The name of the query parameter to add to the `fontUrl` (default: "icon_names");
|
|
10
|
+
- The plugin will automatically add the query parameter with the icon names list to the font URL.
|
|
11
|
+
|
|
5
12
|
### v0.7.1
|
|
6
13
|
|
|
7
14
|
- Added the following configuration options for flexibility:
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ the font downloaded by the user.
|
|
|
28
28
|
Install the plugin using your favourite package manager, for example:
|
|
29
29
|
|
|
30
30
|
```shell
|
|
31
|
-
|
|
31
|
+
pnpm add -D vite-plugin-material-symbols
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
Add it to the Vite configuration:
|
|
@@ -110,13 +110,15 @@ component:
|
|
|
110
110
|
type: string | RegExp
|
|
111
111
|
description: The name of JSX component to get the icon names from (or regex to match the component name)
|
|
112
112
|
default: Icon
|
|
113
|
-
|
|
114
|
-
type:
|
|
113
|
+
fontUrl:
|
|
114
|
+
type: string
|
|
115
115
|
description: Material Symbols CSS Provider
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
# Standard settings: Outlined, no infill, 24px, weight 400
|
|
117
|
+
default: https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0
|
|
118
|
+
paramName:
|
|
119
|
+
type: string
|
|
120
|
+
description: The name of the query parameter to add to the fontUrl
|
|
121
|
+
default: icon_names
|
|
120
122
|
preload:
|
|
121
123
|
type: boolean
|
|
122
124
|
description: Enables higher priority for loading symbols
|
package/dist/index.d.ts
CHANGED
|
@@ -15,12 +15,17 @@ type PluginOptions = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Material Symbols CSS Provider. Default: outlined, no infill, 24px, weight 400
|
|
17
17
|
* @see https://fonts.google.com/icons?icon.set=Material+Symbols
|
|
18
|
-
* @default
|
|
18
|
+
* @default "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0"
|
|
19
19
|
* */
|
|
20
|
-
|
|
20
|
+
fontUrl: string;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the query parameter to add to the fontUrl
|
|
23
|
+
* @default "icon_names"
|
|
24
|
+
* */
|
|
25
|
+
paramName: string;
|
|
21
26
|
/**
|
|
22
27
|
* The name of JSX component to get the icon names from (or regex to match the component name)
|
|
23
|
-
* @default Icon
|
|
28
|
+
* @default "Icon"
|
|
24
29
|
* */
|
|
25
30
|
component: string | RegExp;
|
|
26
31
|
/**
|
|
@@ -35,7 +40,8 @@ declare const plugin: ({
|
|
|
35
40
|
moduleIdRegex,
|
|
36
41
|
jsxNodeRegex,
|
|
37
42
|
component,
|
|
38
|
-
|
|
43
|
+
fontUrl,
|
|
44
|
+
paramName,
|
|
39
45
|
preload
|
|
40
46
|
}?: Partial<PluginOptions>) => Plugin;
|
|
41
47
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"esquery";const t=e=>e.type===`Literal`&&`value`in e&&typeof e.value==`string`,n=
|
|
1
|
+
import e from"esquery";const t=e=>e.type===`Literal`&&`value`in e&&typeof e.value==`string`,n=(e,t)=>[`CallExpression[callee.name=${`/${e.source}/${e.flags}`}][arguments.0.name=${typeof t==`string`?`'${t}'`:`/${t.source}/${t.flags}`}]`,`.arguments`,`Property[key.name='children'] Literal`].join(` > `),r=(e,t,n)=>{let r=new URL(e);if(n.size){let e=[];for(let t of n.values())e.push(t);r.searchParams.append(t,e.toSorted().join(`,`))}return decodeURIComponent(r.toString())},i=({moduleIdRegex:i=/.([jt])sx?$/i,jsxNodeRegex:a=/jsx/,component:o=`Icon`,fontUrl:s=`https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0`,paramName:c=`icon_names`,preload:l=!1}={})=>{let u=new Set;return{name:`material-symbols`,enforce:`pre`,moduleParsed:function({id:r,code:s}){if(!s||!i.test(r))return;let c=this.parse(s),l=n(a,o),d=e.query(c,l).filter(t);for(let{value:e}of d)this.debug({id:r,message:e}),u.add(e)},transformIndexHtml:e=>{let t=r(s,c,u).toString(),n=[{injectTo:`head`,tag:`link`,attrs:{rel:`stylesheet`,href:t}}];return l&&n.push({injectTo:`head-prepend`,tag:`link`,attrs:{rel:`preload`,as:`style`,href:t}},{injectTo:`head-prepend`,tag:`link`,attrs:{rel:`preconnect`,href:`https://fonts.gstatic.com`}}),{html:e,tags:n}}}};export{i as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-material-symbols",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Selective loading of Material Symbols for production",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@arethetypeswrong/core": "^0.18.2",
|
|
42
|
-
"@biomejs/biome": "2.4.
|
|
42
|
+
"@biomejs/biome": "2.4.15",
|
|
43
43
|
"@tsconfig/bun": "^1.0.8",
|
|
44
44
|
"@types/bun": "^1.2.17",
|
|
45
45
|
"@types/esquery": "^1.5.4",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-dom": "^19.1.0",
|
|
52
52
|
"semver": "^7.7.2",
|
|
53
53
|
"tsdown": "^0.21.2",
|
|
54
|
-
"typescript": "^
|
|
54
|
+
"typescript": "^6.0.0"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"css",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"icon",
|
|
69
69
|
"font-icons",
|
|
70
70
|
"vite",
|
|
71
|
-
"vitejs"
|
|
71
|
+
"vitejs",
|
|
72
|
+
"vite-plugin"
|
|
72
73
|
]
|
|
73
74
|
}
|