vectify 2.0.4 → 2.0.5
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.
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
:width="size"
|
|
4
|
-
:height="size"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
:aria-hidden="shouldHide"
|
|
7
|
-
:aria-label="ariaLabel"
|
|
8
|
-
:role="title || ariaLabel ? 'img' : undefined"
|
|
9
|
-
v-bind="$attrs"
|
|
10
|
-
:class="mergedClass"
|
|
11
|
-
>
|
|
12
|
-
<title v-if="title">{{ title }}</title>
|
|
13
|
-
<component
|
|
14
|
-
v-for="(node, index) in cleanedIconNode"
|
|
15
|
-
:key="index"
|
|
16
|
-
:is="renderNode(node)"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
1
|
<script>
|
|
22
2
|
export default {
|
|
23
3
|
name: 'Icon',
|
|
@@ -117,19 +97,43 @@ export default {
|
|
|
117
97
|
return [type, cleanedAttrs, cleanedChildren]
|
|
118
98
|
})
|
|
119
99
|
},
|
|
120
|
-
renderNode(node) {
|
|
100
|
+
renderNode(h, node) {
|
|
121
101
|
const [type, attrs, children] = node
|
|
122
102
|
|
|
123
103
|
if (children && children.length > 0) {
|
|
124
|
-
return
|
|
104
|
+
return h(
|
|
125
105
|
type,
|
|
126
106
|
{ attrs },
|
|
127
|
-
children.map(child => this.renderNode(child))
|
|
107
|
+
children.map(child => this.renderNode(h, child))
|
|
128
108
|
)
|
|
129
109
|
}
|
|
130
110
|
|
|
131
|
-
return
|
|
111
|
+
return h(type, { attrs })
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
render(h) {
|
|
115
|
+
const children = []
|
|
116
|
+
|
|
117
|
+
if (this.title) {
|
|
118
|
+
children.push(h('title', this.title))
|
|
132
119
|
}
|
|
120
|
+
|
|
121
|
+
this.cleanedIconNode.forEach(node => {
|
|
122
|
+
children.push(this.renderNode(h, node))
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return h('svg', {
|
|
126
|
+
attrs: {
|
|
127
|
+
width: this.size,
|
|
128
|
+
height: this.size,
|
|
129
|
+
viewBox: '0 0 24 24',
|
|
130
|
+
'aria-hidden': this.shouldHide,
|
|
131
|
+
'aria-label': this.ariaLabel,
|
|
132
|
+
role: this.title || this.ariaLabel ? 'img' : undefined,
|
|
133
|
+
...this.$attrs
|
|
134
|
+
},
|
|
135
|
+
class: this.mergedClass
|
|
136
|
+
}, children)
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
</script>
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
:width="size"
|
|
4
|
-
:height="size"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
:aria-hidden="shouldHide"
|
|
7
|
-
:aria-label="ariaLabel"
|
|
8
|
-
:role="title || ariaLabel ? 'img' : undefined"
|
|
9
|
-
v-bind="$attrs"
|
|
10
|
-
:class="mergedClass"
|
|
11
|
-
>
|
|
12
|
-
<title v-if="title">{{ title }}</title>
|
|
13
|
-
<component
|
|
14
|
-
v-for="(node, index) in cleanedIconNode"
|
|
15
|
-
:key="index"
|
|
16
|
-
:is="renderNode(node)"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
1
|
<script lang="ts">
|
|
22
|
-
import Vue, { VNode } from 'vue'
|
|
2
|
+
import Vue, { VNode, CreateElement } from 'vue'
|
|
23
3
|
import type { IconNode } from 'vectify'
|
|
24
4
|
|
|
25
5
|
export default Vue.extend({
|
|
@@ -120,19 +100,43 @@ export default Vue.extend({
|
|
|
120
100
|
return [type, cleanedAttrs, cleanedChildren] as IconNode
|
|
121
101
|
})
|
|
122
102
|
},
|
|
123
|
-
renderNode(node: IconNode): VNode {
|
|
103
|
+
renderNode(h: CreateElement, node: IconNode): VNode {
|
|
124
104
|
const [type, attrs, children] = node
|
|
125
105
|
|
|
126
106
|
if (children && children.length > 0) {
|
|
127
|
-
return
|
|
107
|
+
return h(
|
|
128
108
|
type,
|
|
129
109
|
{ attrs },
|
|
130
|
-
children.map(child => this.renderNode(child))
|
|
110
|
+
children.map(child => this.renderNode(h, child))
|
|
131
111
|
)
|
|
132
112
|
}
|
|
133
113
|
|
|
134
|
-
return
|
|
114
|
+
return h(type, { attrs })
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
render(h: CreateElement): VNode {
|
|
118
|
+
const children: VNode[] = []
|
|
119
|
+
|
|
120
|
+
if (this.title) {
|
|
121
|
+
children.push(h('title', this.title))
|
|
135
122
|
}
|
|
123
|
+
|
|
124
|
+
this.cleanedIconNode.forEach(node => {
|
|
125
|
+
children.push(this.renderNode(h, node))
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return h('svg', {
|
|
129
|
+
attrs: {
|
|
130
|
+
width: this.size,
|
|
131
|
+
height: this.size,
|
|
132
|
+
viewBox: '0 0 24 24',
|
|
133
|
+
'aria-hidden': this.shouldHide,
|
|
134
|
+
'aria-label': this.ariaLabel,
|
|
135
|
+
role: this.title || this.ariaLabel ? 'img' : undefined,
|
|
136
|
+
...this.$attrs
|
|
137
|
+
},
|
|
138
|
+
class: this.mergedClass
|
|
139
|
+
}, children)
|
|
136
140
|
}
|
|
137
141
|
})
|
|
138
142
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vectify",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"packageManager": "pnpm@9.15.9",
|
|
5
5
|
"description": "A powerful command-line tool to generate React, Vue, and Svelte icon components from SVG files",
|
|
6
6
|
"author": "Xiaobing Zhu <hellozxb252@gmail.com>",
|