vectify 2.0.3 → 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.
@@ -912,7 +912,7 @@ async function generateIndexFile(svgFiles, config, dryRun = false) {
912
912
  const typescript = config.typescript ?? true;
913
913
  const strategy = getFrameworkStrategy(config.framework);
914
914
  const ext = strategy.getIndexExtension(typescript);
915
- const usesDefaultExport = ["vue", "svelte", "react", "preact"].includes(config.framework);
915
+ const usesDefaultExport = ["vue", "vue2", "svelte", "react", "preact"].includes(config.framework);
916
916
  const exports = svgFiles.map((svgFile) => {
917
917
  const fileName = path4.basename(svgFile);
918
918
  const componentName = getComponentName(
package/dist/cli.js CHANGED
@@ -1052,7 +1052,7 @@ async function generateIndexFile(svgFiles, config, dryRun = false) {
1052
1052
  const typescript = config.typescript ?? true;
1053
1053
  const strategy = getFrameworkStrategy(config.framework);
1054
1054
  const ext = strategy.getIndexExtension(typescript);
1055
- const usesDefaultExport = ["vue", "svelte", "react", "preact"].includes(config.framework);
1055
+ const usesDefaultExport = ["vue", "vue2", "svelte", "react", "preact"].includes(config.framework);
1056
1056
  const exports2 = svgFiles.map((svgFile) => {
1057
1057
  const fileName = import_node_path4.default.basename(svgFile);
1058
1058
  const componentName = getComponentName(
package/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  generate,
4
4
  init,
5
5
  watch
6
- } from "./chunk-BKDGWTE6.mjs";
6
+ } from "./chunk-GY4VNET5.mjs";
7
7
  import "./chunk-CIKTK6HI.mjs";
8
8
 
9
9
  // src/cli.ts
package/dist/index.js CHANGED
@@ -1060,7 +1060,7 @@ async function generateIndexFile(svgFiles, config, dryRun = false) {
1060
1060
  const typescript = config.typescript ?? true;
1061
1061
  const strategy = getFrameworkStrategy(config.framework);
1062
1062
  const ext = strategy.getIndexExtension(typescript);
1063
- const usesDefaultExport = ["vue", "svelte", "react", "preact"].includes(config.framework);
1063
+ const usesDefaultExport = ["vue", "vue2", "svelte", "react", "preact"].includes(config.framework);
1064
1064
  const exports2 = svgFiles.map((svgFile) => {
1065
1065
  const fileName = import_node_path4.default.basename(svgFile);
1066
1066
  const componentName = getComponentName(
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  init,
8
8
  loadConfig,
9
9
  watch
10
- } from "./chunk-BKDGWTE6.mjs";
10
+ } from "./chunk-GY4VNET5.mjs";
11
11
  import "./chunk-CIKTK6HI.mjs";
12
12
 
13
13
  // src/types.ts
@@ -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 this.$createElement(
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 this.$createElement(type, { attrs })
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 this.$createElement(
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 this.$createElement(type, { attrs })
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",
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>",