Skip to content

Commit 4d122e0

Browse files
committed
feat(ui): new mdi-v6 icon set
1 parent b2d3c86 commit 4d122e0

File tree

8 files changed

+6308
-4
lines changed

8 files changed

+6308
-4
lines changed

ui/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,12 @@ Choices are:
145145
7. material-icons.umd.js
146146
8. mdi-v4.umd.js
147147
9. mdi-v5.umd.js
148-
10. themify.umd.js
149-
11. line-awesome.umd.js
150-
12. bootstrap-icons.umd.js
148+
10. mdi-v5.umd.js
149+
11. themify.umd.js
150+
12. line-awesome.umd.js
151+
13. bootstrap-icons.umd.js
152+
153+
> You can only use one of `mdi-v4`, `mdi-v5` or `mdi-v6`
151154
152155
### UMD Example
153156
```html

ui/build/icons/build.all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require('./build.google.material-icons.js')
22
require('./build.mdi-v4.js')
33
require('./build.mdi-v5.js')
4+
require('./build.mdi-v6.js')
45
require('./build.ion.js')
56
require('./build.eva.js')
67
require('./build.themify.js')

ui/build/icons/build.mdi-v6.js

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
const path = require('path')
2+
const { green, blue, red } = require('chalk')
3+
const { readFile, writeFile } = require('../utils')
4+
5+
const name = 'mdi-v6'
6+
const inputLocation = `../../src/components/icon-set/${name}.js`
7+
const outputLocation = `../../src/components/icon-set/${name}.js`
8+
const oldIcons = {}
9+
const icons = []
10+
const blacklisted = [
11+
'md',
12+
'mdi-blank',
13+
'mdi-18px.mdi-set, .mdi-18px.md',
14+
'mdi-24px.mdi-set, .mdi-24px.md',
15+
'mdi-36px.mdi-set, .mdi-36px.md',
16+
'mdi-48px.mdi-set, .mdi-48px.md',
17+
'mdi-dar',
18+
'mdi-dark.mdi-inactiv',
19+
'mdi-ligh',
20+
'mdi-light.mdi-inactiv',
21+
'mdi-rotate-4',
22+
'mdi-rotate-9',
23+
'mdi-rotate-13',
24+
'mdi-rotate-18',
25+
'mdi-rotate-22',
26+
'mdi-rotate-27',
27+
'mdi-rotate-31',
28+
'mdi-flip-',
29+
'mdi-spi'
30+
]
31+
32+
let fa = readFile(path.resolve(__dirname, inputLocation))
33+
fa = fa.split('\n')
34+
fa.shift()
35+
fa.shift()
36+
fa.shift()
37+
fa.pop()
38+
fa.pop()
39+
fa.pop()
40+
fa = '[\n' + fa.join(',\n') + '\n]\n'
41+
// eslint-disable-next-line no-eval
42+
fa = eval(fa)
43+
fa.forEach(f => {
44+
const name = f.name
45+
const tags = f.tags
46+
oldIcons[name] = { tags: Array(tags).join(',') }
47+
})
48+
49+
const location = require.resolve('@quasar/extras/mdi-v6/mdi-v6.css')
50+
const fileContents = readFile(location)
51+
52+
fileContents
53+
.split('\n')
54+
.forEach(line => {
55+
line = line.trim()
56+
if (line.startsWith('.')) {
57+
const pos = line.indexOf(':before')
58+
if (pos > 0) {
59+
line = line.slice(1, pos - 1)
60+
if (blacklisted.includes(line) === false) {
61+
if (oldIcons[line]) {
62+
const tags = oldIcons[line].tags.split(',').map(tag => {
63+
if (tag === '') return tag
64+
return "'" + tag + "'"
65+
}).join(', ')
66+
icons.push(`{ name: '${line}', tags: [${tags}] }`)
67+
}
68+
else {
69+
icons.push(`{ name: '${line}', tags: [] }`)
70+
}
71+
}
72+
}
73+
}
74+
})
75+
76+
if (icons.length === 0) {
77+
console.log(`${red('[error]')} ${name} icons parsed 0 icons...exiting`)
78+
process.exit(1)
79+
}
80+
81+
let output = 'export default {\n'
82+
output += ` name: '${name}',\n`
83+
output += ' icons: [\n'
84+
85+
icons.forEach((icon, index) => {
86+
if (index !== 0) {
87+
output += ',\n'
88+
}
89+
90+
output += ` ${icon}`
91+
})
92+
93+
output += '\n ]\n'
94+
output += '}\n'
95+
96+
writeFile(path.resolve(__dirname, outputLocation), output)
97+
console.log(`${blue('[icon]')} ${green(name + ':')} ${icons.length} generated`)

ui/dev/quasar.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function (/* ctx */) {
3333
// https://github.com/quasarframework/quasar/tree/dev/extras
3434
extras: [
3535
'ionicons-v4',
36-
'mdi-v5',
36+
'mdi-v6',
3737
'fontawesome-v5',
3838
'eva-icons',
3939
'themify',

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"build:api": "node build/build.api.js",
2323
"icons:mdi-v4": "node build/icons/build.mdi-v4.js",
2424
"icons:mdi-v5": "node build/icons/build.mdi-v5.js",
25+
"icons:mdi-v6": "node build/icons/build.mdi-v6.js",
2526
"icons:ion": "node build/icons/build.ion.js",
2627
"icons:eva": "node build/icons/build.eva.js",
2728
"icons:themify": "node build/icons/build.themify.js",

ui/src/components/QIconPicker.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"ionicons-v4",
2727
"mdi-v4",
2828
"mdi-v5",
29+
"mdi-v6",
2930
"fontawesome-v5",
3031
"eva-icons",
3132
"themify",

0 commit comments

Comments
 (0)