@fangzhongya/icons 0.0.11 → 0.0.13

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.
@@ -187,7 +187,13 @@ var icon_default = _vue.defineComponent.call(void 0, {
187
187
  const arr = _vue.computed.call(void 0, () => {
188
188
  var _a, _b, _c;
189
189
  if (slots.default) {
190
- return slots.default();
190
+ return _vue.h.call(void 0,
191
+ _vue.Fragment,
192
+ slots.default({
193
+ class: [props.iconClass],
194
+ style: contStyle
195
+ })
196
+ );
191
197
  } else if (!outputName.value) {
192
198
  return void 0;
193
199
  } else if (outputType.value === "svg") {
@@ -1,5 +1,5 @@
1
1
  // packages/icon/index.ts
2
- import { h, defineComponent, resolveComponent, computed } from "vue";
2
+ import { h, defineComponent, resolveComponent, computed, Fragment } from "vue";
3
3
  var reg = /<svg([^>]*)>((.|\n|\r|\t)*)<\/svg>/g;
4
4
  var reg1 = /<path([^>]*)>((.|\n|\r|\t)*)<\/path>/g;
5
5
  var reg2 = /<g([^>]*)>((.|\n|\r|\t)*)<\/g>/g;
@@ -187,7 +187,13 @@ var icon_default = defineComponent({
187
187
  const arr = computed(() => {
188
188
  var _a, _b, _c;
189
189
  if (slots.default) {
190
- return slots.default();
190
+ return h(
191
+ Fragment,
192
+ slots.default({
193
+ class: [props.iconClass],
194
+ style: contStyle
195
+ })
196
+ );
191
197
  } else if (!outputName.value) {
192
198
  return void 0;
193
199
  } else if (outputType.value === "svg") {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkS2UC3QOVcjs = require('../chunk-S2UC3QOV.cjs');
3
+ var _chunkFCWKSIH4cjs = require('../chunk-FCWKSIH4.cjs');
4
4
  require('../chunk-75ZPJI57.cjs');
5
5
 
6
6
 
7
- exports.default = _chunkS2UC3QOVcjs.icon_default;
7
+ exports.default = _chunkFCWKSIH4cjs.icon_default;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  icon_default
3
- } from "../chunk-HOVIIPWX.js";
3
+ } from "../chunk-PSUUCIWL.js";
4
4
  import "../chunk-MLKGABMK.js";
5
5
  export {
6
6
  icon_default as default
package/dist/iconify.cjs CHANGED
@@ -93,7 +93,31 @@ function iconifySVG(obj, name) {
93
93
  });
94
94
  }
95
95
  }
96
+ function getIconifySVG(obj, name) {
97
+ var _a;
98
+ const icons = obj.icons;
99
+ const aliases = obj.aliases;
100
+ const ap = (_a = aliases[name]) == null ? void 0 : _a.parent;
101
+ const n = _nullishCoalesce(icons[name], () => ( (ap ? icons[ap] : void 0)));
102
+ if (n) {
103
+ const v = {
104
+ prefix: obj.prefix,
105
+ name,
106
+ width: obj.width,
107
+ height: obj.height,
108
+ ...n
109
+ };
110
+ const viewBox = [
111
+ v.left || 0,
112
+ v.top || 0,
113
+ v.width || 1024,
114
+ v.height || 1024
115
+ ].join(" ");
116
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}">${n.body}</svg>`;
117
+ }
118
+ }
119
+
96
120
 
97
121
 
98
122
 
99
- exports.iconify = iconify; exports.iconifySVG = iconifySVG;
123
+ exports.getIconifySVG = getIconifySVG; exports.iconify = iconify; exports.iconifySVG = iconifySVG;
@@ -37,5 +37,6 @@ type Iconify = {
37
37
  * @returns 返回一个Vue组件实例,用于渲染SVG图标
38
38
  */
39
39
  declare function iconifySVG(obj: Iconify, name: string): vue.DefineComponent<{}, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
40
+ declare function getIconifySVG(obj: Iconify, name: string): string;
40
41
 
41
- export { iconify, iconifySVG };
42
+ export { getIconifySVG, iconify, iconifySVG };
package/dist/iconify.d.ts CHANGED
@@ -37,5 +37,6 @@ type Iconify = {
37
37
  * @returns 返回一个Vue组件实例,用于渲染SVG图标
38
38
  */
39
39
  declare function iconifySVG(obj: Iconify, name: string): vue.DefineComponent<{}, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
40
+ declare function getIconifySVG(obj: Iconify, name: string): string;
40
41
 
41
- export { iconify, iconifySVG };
42
+ export { getIconifySVG, iconify, iconifySVG };
package/dist/iconify.js CHANGED
@@ -93,7 +93,31 @@ function iconifySVG(obj, name) {
93
93
  });
94
94
  }
95
95
  }
96
+ function getIconifySVG(obj, name) {
97
+ var _a;
98
+ const icons = obj.icons;
99
+ const aliases = obj.aliases;
100
+ const ap = (_a = aliases[name]) == null ? void 0 : _a.parent;
101
+ const n = icons[name] ?? (ap ? icons[ap] : void 0);
102
+ if (n) {
103
+ const v = {
104
+ prefix: obj.prefix,
105
+ name,
106
+ width: obj.width,
107
+ height: obj.height,
108
+ ...n
109
+ };
110
+ const viewBox = [
111
+ v.left || 0,
112
+ v.top || 0,
113
+ v.width || 1024,
114
+ v.height || 1024
115
+ ].join(" ");
116
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}">${n.body}</svg>`;
117
+ }
118
+ }
96
119
  export {
120
+ getIconifySVG,
97
121
  iconify,
98
122
  iconifySVG
99
123
  };
package/dist/index.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-icons",
3
3
  "info": {},
4
- "lastModified": 1767779740535,
4
+ "lastModified": 1767797055475,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": "<path d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\"></path>"
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkS2UC3QOVcjs = require('../chunk-S2UC3QOV.cjs');
3
+ var _chunkFCWKSIH4cjs = require('../chunk-FCWKSIH4.cjs');
4
4
 
5
5
 
6
6
  var _chunkEEMF44IHcjs = require('../chunk-EEMF44IH.cjs');
@@ -107,7 +107,7 @@ var picker_default = _vue.defineComponent.call(void 0, {
107
107
  }
108
108
  },
109
109
  [
110
- _vue.h.call(void 0, _chunkS2UC3QOVcjs.icon_default, {
110
+ _vue.h.call(void 0, _chunkFCWKSIH4cjs.icon_default, {
111
111
  type: props.type,
112
112
  size: props.size,
113
113
  name: props.modelValue,
@@ -189,7 +189,7 @@ var picker_default = _vue.defineComponent.call(void 0, {
189
189
  },
190
190
  name.value
191
191
  ),
192
- _vue.h.call(void 0, _chunkS2UC3QOVcjs.icon_default, {
192
+ _vue.h.call(void 0, _chunkFCWKSIH4cjs.icon_default, {
193
193
  type: props.type,
194
194
  size: props.size,
195
195
  name: name.value,
@@ -241,7 +241,7 @@ var picker_default = _vue.defineComponent.call(void 0, {
241
241
  }
242
242
  },
243
243
  [
244
- _vue.h.call(void 0, _chunkS2UC3QOVcjs.icon_default, {
244
+ _vue.h.call(void 0, _chunkFCWKSIH4cjs.icon_default, {
245
245
  style: {
246
246
  margin: "5px",
247
247
  marginBottom: 0,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  icon_default
3
- } from "../chunk-HOVIIPWX.js";
3
+ } from "../chunk-PSUUCIWL.js";
4
4
  import {
5
5
  dialog_default
6
6
  } from "../chunk-I5KQLZMG.js";
@@ -910,7 +910,7 @@ function runDev(config, configCallback, callback) {
910
910
 
911
911
  var virtualModuleId = "virtual:fang-icon";
912
912
  function simpleFangIcon(options = {}) {
913
- const { type = "svg", directory = "./svg" } = options;
913
+ const { name = "FangIcon", type = "svg", directory = "./svg" } = options;
914
914
  const resolvedVirtualModuleId = "\0" + virtualModuleId;
915
915
  if (type === "pub" && options.mobile) {
916
916
  const outDir = _path.join.call(void 0, "./public/", directory);
@@ -925,6 +925,93 @@ function simpleFangIcon(options = {}) {
925
925
  isNeader: false
926
926
  });
927
927
  }
928
+ const pub = `
929
+ import { defineComponent, h,} from 'vue'
930
+ import FangIcon from '@fangzhongya/icons/icon/index'
931
+ const component = defineComponent({
932
+ name: '${name}',
933
+ props: {
934
+ name: {
935
+ type: [String, Object],
936
+ },
937
+ default: {
938
+ type: String,
939
+ default: '${type}'
940
+ },
941
+ directory: {
942
+ type: String,
943
+ default: '${directory}'
944
+ }
945
+ },
946
+ setup(props, { attrs }) {
947
+ return () => {
948
+ return h(FangIcon, {
949
+ ...attrs,
950
+ name: props.name,
951
+ default: props.default,
952
+ directory: props.directory
953
+ });
954
+ };
955
+ }
956
+ });
957
+ // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
958
+ export const install = (app) => {
959
+ app.component('${name}', component)
960
+ };
961
+
962
+ export default component;`;
963
+ const svg = `
964
+ import { defineComponent, h, computed} from 'vue'
965
+ import FangIcon from '@fangzhongya/icons/icon/index'
966
+ import { icons } from '@fangzhongya/icons/vue'
967
+ const component = defineComponent({
968
+ name: '${name}',
969
+ props: {
970
+ name: {
971
+ type: [String, Object],
972
+ },
973
+ type: {
974
+ type: String,
975
+ },
976
+ default: {
977
+ type: String,
978
+ default: '${type}'
979
+ },
980
+ directory: {
981
+ type: String,
982
+ default: '${directory}'
983
+ }
984
+ },
985
+ setup(props, { attrs }) {
986
+ const iconName = computed(() => {
987
+ const name = props.name;
988
+ if (typeof name === 'string' && (props.type === 'svg' ||
989
+ (props.type === undefined && props.default === 'svg'))) {
990
+ const icon = icons[name];
991
+ if(icon){
992
+ return icon;
993
+ }
994
+ }
995
+ return name;
996
+ });
997
+ return () => {
998
+ return h(FangIcon, {
999
+ ...attrs,
1000
+ name: iconName.value,
1001
+ type: props.type,
1002
+ default: props.default,
1003
+ directory: props.directory
1004
+ });
1005
+ };
1006
+ }
1007
+ });
1008
+ // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
1009
+ export const install = (app) => {
1010
+ app.component('${name}', component)
1011
+ };
1012
+
1013
+ export default component;`;
1014
+ const text = type === "svg" ? svg : pub;
928
1015
  return {
929
1016
  name: "simple-fang-icon",
930
1017
  resolveId(id) {
@@ -935,35 +1022,7 @@ function simpleFangIcon(options = {}) {
935
1022
  },
936
1023
  load(id) {
937
1024
  if (id === resolvedVirtualModuleId) {
938
- return `
939
- import { defineComponent, h,} from 'vue'
940
- import FangIcon from '@fangzhongya/icons/icon/index'
941
- export default defineComponent({
942
- props: {
943
- name: {
944
- type: [String, Object],
945
- },
946
- default: {
947
- type: String,
948
- default: '${type}'
949
- },
950
- directory: {
951
- type: String,
952
- default: '${directory}'
953
- }
954
- },
955
- setup(props, { attrs }) {
956
- return () => {
957
- return h(FangIcon, {
958
- ...attrs,
959
- name: props.name,
960
- default: props.default,
961
- directory: props.directory
962
- });
963
- };
964
- }
965
- })
966
- `;
1025
+ return text;
967
1026
  }
968
1027
  return null;
969
1028
  }
@@ -1,9 +1,11 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
3
  interface PluginOptions {
4
+ name?: string;
4
5
  type?: string;
5
6
  directory?: string;
6
7
  mobile?: boolean;
8
+ dynamic?: boolean;
7
9
  }
8
10
  declare function simpleFangIcon(options?: PluginOptions): Plugin;
9
11
 
@@ -1,9 +1,11 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
3
  interface PluginOptions {
4
+ name?: string;
4
5
  type?: string;
5
6
  directory?: string;
6
7
  mobile?: boolean;
8
+ dynamic?: boolean;
7
9
  }
8
10
  declare function simpleFangIcon(options?: PluginOptions): Plugin;
9
11
 
@@ -910,7 +910,7 @@ function runDev(config, configCallback, callback) {
910
910
  import { join as join5 } from "path";
911
911
  var virtualModuleId = "virtual:fang-icon";
912
912
  function simpleFangIcon(options = {}) {
913
- const { type = "svg", directory = "./svg" } = options;
913
+ const { name = "FangIcon", type = "svg", directory = "./svg" } = options;
914
914
  const resolvedVirtualModuleId = "\0" + virtualModuleId;
915
915
  if (type === "pub" && options.mobile) {
916
916
  const outDir = join5("./public/", directory);
@@ -925,6 +925,93 @@ function simpleFangIcon(options = {}) {
925
925
  isNeader: false
926
926
  });
927
927
  }
928
+ const pub = `
929
+ import { defineComponent, h,} from 'vue'
930
+ import FangIcon from '@fangzhongya/icons/icon/index'
931
+ const component = defineComponent({
932
+ name: '${name}',
933
+ props: {
934
+ name: {
935
+ type: [String, Object],
936
+ },
937
+ default: {
938
+ type: String,
939
+ default: '${type}'
940
+ },
941
+ directory: {
942
+ type: String,
943
+ default: '${directory}'
944
+ }
945
+ },
946
+ setup(props, { attrs }) {
947
+ return () => {
948
+ return h(FangIcon, {
949
+ ...attrs,
950
+ name: props.name,
951
+ default: props.default,
952
+ directory: props.directory
953
+ });
954
+ };
955
+ }
956
+ });
957
+ // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
958
+ export const install = (app) => {
959
+ app.component('${name}', component)
960
+ };
961
+
962
+ export default component;`;
963
+ const svg = `
964
+ import { defineComponent, h, computed} from 'vue'
965
+ import FangIcon from '@fangzhongya/icons/icon/index'
966
+ import { icons } from '@fangzhongya/icons/vue'
967
+ const component = defineComponent({
968
+ name: '${name}',
969
+ props: {
970
+ name: {
971
+ type: [String, Object],
972
+ },
973
+ type: {
974
+ type: String,
975
+ },
976
+ default: {
977
+ type: String,
978
+ default: '${type}'
979
+ },
980
+ directory: {
981
+ type: String,
982
+ default: '${directory}'
983
+ }
984
+ },
985
+ setup(props, { attrs }) {
986
+ const iconName = computed(() => {
987
+ const name = props.name;
988
+ if (typeof name === 'string' && (props.type === 'svg' ||
989
+ (props.type === undefined && props.default === 'svg'))) {
990
+ const icon = icons[name];
991
+ if(icon){
992
+ return icon;
993
+ }
994
+ }
995
+ return name;
996
+ });
997
+ return () => {
998
+ return h(FangIcon, {
999
+ ...attrs,
1000
+ name: iconName.value,
1001
+ type: props.type,
1002
+ default: props.default,
1003
+ directory: props.directory
1004
+ });
1005
+ };
1006
+ }
1007
+ });
1008
+ // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
1009
+ export const install = (app) => {
1010
+ app.component('${name}', component)
1011
+ };
1012
+
1013
+ export default component;`;
1014
+ const text = type === "svg" ? svg : pub;
928
1015
  return {
929
1016
  name: "simple-fang-icon",
930
1017
  resolveId(id) {
@@ -935,35 +1022,7 @@ function simpleFangIcon(options = {}) {
935
1022
  },
936
1023
  load(id) {
937
1024
  if (id === resolvedVirtualModuleId) {
938
- return `
939
- import { defineComponent, h,} from 'vue'
940
- import FangIcon from '@fangzhongya/icons/icon/index'
941
- export default defineComponent({
942
- props: {
943
- name: {
944
- type: [String, Object],
945
- },
946
- default: {
947
- type: String,
948
- default: '${type}'
949
- },
950
- directory: {
951
- type: String,
952
- default: '${directory}'
953
- }
954
- },
955
- setup(props, { attrs }) {
956
- return () => {
957
- return h(FangIcon, {
958
- ...attrs,
959
- name: props.name,
960
- default: props.default,
961
- directory: props.directory
962
- });
963
- };
964
- }
965
- })
966
- `;
1025
+ return text;
967
1026
  }
968
1027
  return null;
969
1028
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzhongya/icons",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.0.11",
5
+ "version": "0.0.13",
6
6
  "description ": "个人图标库",
7
7
  "author": "fangzhongya ",
8
8
  "license": "MIT",