forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicon-set.js
More file actions
59 lines (49 loc) · 1.53 KB
/
icon-set.js
File metadata and controls
59 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import defineReactivePlugin from './utils/private/define-reactive-plugin.js'
import { injectProp } from './utils/private/inject-obj-prop.js'
// no extension on purpose for next one:
import materialIcons from '../icon-set/material-icons'
const Plugin = defineReactivePlugin({
iconMapFn: null,
__icons: {}
}, {
set (setObject, ssrContext) {
const def = { ...setObject, rtl: setObject.rtl === true }
if (__QUASAR_SSR_SERVER__) {
if (ssrContext === void 0) {
console.error('SSR ERROR: second param required: Quasar.iconSet.set(iconSet, ssrContext)')
return
}
def.set = ssrContext.$q.iconSet.set
Object.assign(ssrContext.$q.iconSet, def)
}
else {
def.set = Plugin.set
Object.assign(Plugin.__icons, def)
}
},
install ({ $q, iconSet, ssrContext }) {
if (__QUASAR_SSR_SERVER__) {
const initialSet = iconSet || materialIcons
$q.iconMapFn = ssrContext.$q.config.iconMapFn || this.iconMapFn || null
$q.iconSet = {}
$q.iconSet.set = setObject => {
this.set(setObject, ssrContext)
}
$q.iconSet.set(initialSet)
}
else {
if ($q.config.iconMapFn !== void 0) {
this.iconMapFn = $q.config.iconMapFn
}
$q.iconSet = this.__icons
injectProp($q, 'iconMapFn', () => this.iconMapFn, val => { this.iconMapFn = val })
if (this.__installed === true) {
iconSet !== void 0 && this.set(iconSet)
}
else {
this.set(iconSet || materialIcons)
}
}
}
})
export default Plugin