yc-pro-components 0.0.4 → 0.0.6

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.
Files changed (141) hide show
  1. package/es/components/check-card/index.d.ts +38 -38
  2. package/es/components/check-card/src/index.vue.d.ts +2 -2
  3. package/es/components/check-card-group/index.d.ts +19 -19
  4. package/es/components/check-card-group/src/index.vue.d.ts +1 -1
  5. package/es/components/dialog-form/index.d.ts +7 -7
  6. package/es/components/dialog-form/src/index.vue.d.ts +7 -7
  7. package/es/components/display-item/index.d.ts +21 -21
  8. package/es/components/display-item/src/index.vue.d.ts +21 -21
  9. package/es/components/drawer-form/index.d.ts +26 -26
  10. package/es/components/drawer-form/src/index.vue.d.ts +8 -8
  11. package/es/components/form/index.d.ts +14 -14
  12. package/es/components/form/src/form-content.vue.d.ts +20 -20
  13. package/es/components/form/src/index.vue.d.ts +14 -14
  14. package/es/components/form-item/index.d.ts +32 -32
  15. package/es/components/form-item/src/index.vue.d.ts +12 -12
  16. package/es/components/header/index.d.ts +19 -19
  17. package/es/components/header/src/index.vue.d.ts +1 -1
  18. package/es/components/index.d.ts +0 -1
  19. package/es/components/index.mjs +0 -2
  20. package/es/components/input-tag/index.d.ts +9 -9
  21. package/es/components/input-tag/src/index.vue.d.ts +1 -1
  22. package/es/components/page/index.d.ts +220 -220
  23. package/es/components/page/src/index.vue.d.ts +78 -78
  24. package/es/components/radio/index.d.ts +25 -25
  25. package/es/components/radio/src/index.vue.d.ts +25 -25
  26. package/es/components/render/index.d.ts +6 -6
  27. package/es/components/render/src/index.vue.d.ts +2 -2
  28. package/es/components/search/index.d.ts +49 -49
  29. package/es/components/search/src/index.vue.d.ts +21 -21
  30. package/es/components/table/index.d.ts +54 -54
  31. package/es/components/table/src/index.vue.d.ts +18 -18
  32. package/es/components/table/src/table-column-drag-sort.vue.d.ts +18 -18
  33. package/es/components/table/src/table-column.vue.d.ts +21 -21
  34. package/es/components/yc-count-to/index.d.ts +1 -1
  35. package/es/components/yc-count-to/src/normal/index.d.ts +1 -1
  36. package/es/components/yc-dialog/index.d.ts +24 -24
  37. package/es/components/yc-line-tree/src/index.vue2.mjs +2 -18
  38. package/es/components/yc-more-actions/index.d.ts +46 -46
  39. package/es/components/yc-more-actions/src/index.vue.d.ts +3 -3
  40. package/es/components/yc-plus-page/src/index.vue.d.ts +203 -203
  41. package/es/components/yc-select-v2/src/index.vue.d.ts +2 -2
  42. package/es/components/yc-status-dialog/src/index.vue.d.ts +1 -1
  43. package/es/components/yc-svg-icon/src/index.vue.d.ts +1 -1
  44. package/es/components/yc-text/src/index.vue.d.ts +2 -2
  45. package/es/hooks/usePlusFormReset.d.ts +90 -90
  46. package/es/index.mjs +0 -2
  47. package/index.js +11 -2066
  48. package/index.min.js +7 -7
  49. package/index.min.mjs +7 -7
  50. package/index.mjs +12 -2060
  51. package/lib/components/check-card/index.d.ts +38 -38
  52. package/lib/components/check-card/src/index.vue.d.ts +2 -2
  53. package/lib/components/check-card-group/index.d.ts +19 -19
  54. package/lib/components/check-card-group/src/index.vue.d.ts +1 -1
  55. package/lib/components/dialog-form/index.d.ts +7 -7
  56. package/lib/components/dialog-form/src/index.vue.d.ts +7 -7
  57. package/lib/components/display-item/index.d.ts +21 -21
  58. package/lib/components/display-item/src/index.vue.d.ts +21 -21
  59. package/lib/components/drawer-form/index.d.ts +26 -26
  60. package/lib/components/drawer-form/src/index.vue.d.ts +8 -8
  61. package/lib/components/form/index.d.ts +14 -14
  62. package/lib/components/form/src/form-content.vue.d.ts +20 -20
  63. package/lib/components/form/src/index.vue.d.ts +14 -14
  64. package/lib/components/form-item/index.d.ts +32 -32
  65. package/lib/components/form-item/src/index.vue.d.ts +12 -12
  66. package/lib/components/header/index.d.ts +19 -19
  67. package/lib/components/header/src/index.vue.d.ts +1 -1
  68. package/lib/components/index.d.ts +0 -1
  69. package/lib/components/index.js +10 -19
  70. package/lib/components/input-tag/index.d.ts +9 -9
  71. package/lib/components/input-tag/src/index.vue.d.ts +1 -1
  72. package/lib/components/page/index.d.ts +220 -220
  73. package/lib/components/page/src/index.vue.d.ts +78 -78
  74. package/lib/components/radio/index.d.ts +25 -25
  75. package/lib/components/radio/src/index.vue.d.ts +25 -25
  76. package/lib/components/render/index.d.ts +6 -6
  77. package/lib/components/render/src/index.vue.d.ts +2 -2
  78. package/lib/components/search/index.d.ts +49 -49
  79. package/lib/components/search/src/index.vue.d.ts +21 -21
  80. package/lib/components/table/index.d.ts +54 -54
  81. package/lib/components/table/src/index.vue.d.ts +18 -18
  82. package/lib/components/table/src/table-column-drag-sort.vue.d.ts +18 -18
  83. package/lib/components/table/src/table-column.vue.d.ts +21 -21
  84. package/lib/components/yc-count-to/index.d.ts +1 -1
  85. package/lib/components/yc-count-to/src/normal/index.d.ts +1 -1
  86. package/lib/components/yc-dialog/index.d.ts +24 -24
  87. package/lib/components/yc-line-tree/src/index.vue2.js +2 -18
  88. package/lib/components/yc-more-actions/index.d.ts +46 -46
  89. package/lib/components/yc-more-actions/src/index.vue.d.ts +3 -3
  90. package/lib/components/yc-plus-page/src/index.vue.d.ts +203 -203
  91. package/lib/components/yc-select-v2/src/index.vue.d.ts +2 -2
  92. package/lib/components/yc-status-dialog/src/index.vue.d.ts +1 -1
  93. package/lib/components/yc-svg-icon/src/index.vue.d.ts +1 -1
  94. package/lib/components/yc-text/src/index.vue.d.ts +2 -2
  95. package/lib/hooks/usePlusFormReset.d.ts +90 -90
  96. package/lib/index.js +10 -19
  97. package/locale/en.js +1 -1
  98. package/locale/en.min.js +1 -1
  99. package/locale/en.min.mjs +1 -1
  100. package/locale/en.mjs +1 -1
  101. package/locale/ja.js +1 -1
  102. package/locale/ja.min.js +1 -1
  103. package/locale/ja.min.mjs +1 -1
  104. package/locale/ja.mjs +1 -1
  105. package/locale/ko.js +1 -1
  106. package/locale/ko.min.js +1 -1
  107. package/locale/ko.min.mjs +1 -1
  108. package/locale/ko.mjs +1 -1
  109. package/locale/zh-cn.js +1 -1
  110. package/locale/zh-cn.min.js +1 -1
  111. package/locale/zh-cn.min.mjs +1 -1
  112. package/locale/zh-cn.mjs +1 -1
  113. package/locale/zh-tw.js +1 -1
  114. package/locale/zh-tw.min.js +1 -1
  115. package/locale/zh-tw.min.mjs +1 -1
  116. package/locale/zh-tw.mjs +1 -1
  117. package/package.json +1 -2
  118. package/es/components/yc-icon/index.d.ts +0 -49
  119. package/es/components/yc-icon/index.mjs +0 -10
  120. package/es/components/yc-icon/src/hooks.d.ts +0 -11
  121. package/es/components/yc-icon/src/hooks.mjs +0 -80
  122. package/es/components/yc-icon/src/iconfont.d.ts +0 -21
  123. package/es/components/yc-icon/src/iconfont.mjs +0 -45
  124. package/es/components/yc-icon/src/iconifyIconOffline.d.ts +0 -34
  125. package/es/components/yc-icon/src/iconifyIconOffline.mjs +0 -51
  126. package/es/components/yc-icon/src/iconifyIconOnline.d.ts +0 -19
  127. package/es/components/yc-icon/src/iconifyIconOnline.mjs +0 -30
  128. package/es/components/yc-icon/src/types.d.ts +0 -35
  129. package/es/components/yc-icon/src/types.mjs +0 -1
  130. package/lib/components/yc-icon/index.d.ts +0 -49
  131. package/lib/components/yc-icon/index.js +0 -18
  132. package/lib/components/yc-icon/src/hooks.d.ts +0 -11
  133. package/lib/components/yc-icon/src/hooks.js +0 -82
  134. package/lib/components/yc-icon/src/iconfont.d.ts +0 -21
  135. package/lib/components/yc-icon/src/iconfont.js +0 -49
  136. package/lib/components/yc-icon/src/iconifyIconOffline.d.ts +0 -34
  137. package/lib/components/yc-icon/src/iconifyIconOffline.js +0 -55
  138. package/lib/components/yc-icon/src/iconifyIconOnline.d.ts +0 -19
  139. package/lib/components/yc-icon/src/iconifyIconOnline.js +0 -34
  140. package/lib/components/yc-icon/src/types.d.ts +0 -35
  141. package/lib/components/yc-icon/src/types.js +0 -2
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! yc-pro-components v0.0.2 */
1
+ /*! yc-pro-components v0.0.6 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus'], factory) :
@@ -1169,7 +1169,7 @@
1169
1169
  objectTag$4 = '[object Object]',
1170
1170
  regexpTag$3 = '[object RegExp]',
1171
1171
  setTag$5 = '[object Set]',
1172
- stringTag$4 = '[object String]',
1172
+ stringTag$3 = '[object String]',
1173
1173
  weakMapTag$2 = '[object WeakMap]';
1174
1174
 
1175
1175
  var arrayBufferTag$3 = '[object ArrayBuffer]',
@@ -1197,7 +1197,7 @@
1197
1197
  typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] =
1198
1198
  typedArrayTags[mapTag$5] = typedArrayTags[numberTag$4] =
1199
1199
  typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] =
1200
- typedArrayTags[setTag$5] = typedArrayTags[stringTag$4] =
1200
+ typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] =
1201
1201
  typedArrayTags[weakMapTag$2] = false;
1202
1202
 
1203
1203
  /**
@@ -2668,7 +2668,7 @@
2668
2668
  numberTag$3 = '[object Number]',
2669
2669
  regexpTag$2 = '[object RegExp]',
2670
2670
  setTag$3 = '[object Set]',
2671
- stringTag$3 = '[object String]',
2671
+ stringTag$2 = '[object String]',
2672
2672
  symbolTag$2 = '[object Symbol]';
2673
2673
 
2674
2674
  var arrayBufferTag$2 = '[object ArrayBuffer]',
@@ -2717,7 +2717,7 @@
2717
2717
  return new Ctor;
2718
2718
 
2719
2719
  case numberTag$3:
2720
- case stringTag$3:
2720
+ case stringTag$2:
2721
2721
  return new Ctor(object);
2722
2722
 
2723
2723
  case regexpTag$2:
@@ -2834,7 +2834,7 @@
2834
2834
  objectTag$1 = '[object Object]',
2835
2835
  regexpTag$1 = '[object RegExp]',
2836
2836
  setTag$1 = '[object Set]',
2837
- stringTag$2 = '[object String]',
2837
+ stringTag$1 = '[object String]',
2838
2838
  symbolTag$1 = '[object Symbol]',
2839
2839
  weakMapTag = '[object WeakMap]';
2840
2840
 
@@ -2860,7 +2860,7 @@
2860
2860
  cloneableTags[int32Tag] = cloneableTags[mapTag$1] =
2861
2861
  cloneableTags[numberTag$2] = cloneableTags[objectTag$1] =
2862
2862
  cloneableTags[regexpTag$1] = cloneableTags[setTag$1] =
2863
- cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
2863
+ cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] =
2864
2864
  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
2865
2865
  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
2866
2866
  cloneableTags[errorTag$1] = cloneableTags[funcTag] =
@@ -3196,7 +3196,7 @@
3196
3196
  numberTag$1 = '[object Number]',
3197
3197
  regexpTag = '[object RegExp]',
3198
3198
  setTag = '[object Set]',
3199
- stringTag$1 = '[object String]',
3199
+ stringTag = '[object String]',
3200
3200
  symbolTag = '[object Symbol]';
3201
3201
 
3202
3202
  var arrayBufferTag = '[object ArrayBuffer]',
@@ -3251,7 +3251,7 @@
3251
3251
  return object.name == other.name && object.message == other.message;
3252
3252
 
3253
3253
  case regexpTag:
3254
- case stringTag$1:
3254
+ case stringTag:
3255
3255
  // Coerce regexes to strings and treat strings, primitives and objects,
3256
3256
  // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
3257
3257
  // for more details.
@@ -4286,31 +4286,6 @@
4286
4286
  return result;
4287
4287
  }
4288
4288
 
4289
- /** `Object#toString` result references. */
4290
- var stringTag = '[object String]';
4291
-
4292
- /**
4293
- * Checks if `value` is classified as a `String` primitive or object.
4294
- *
4295
- * @static
4296
- * @since 0.1.0
4297
- * @memberOf _
4298
- * @category Lang
4299
- * @param {*} value The value to check.
4300
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
4301
- * @example
4302
- *
4303
- * _.isString('abc');
4304
- * // => true
4305
- *
4306
- * _.isString(1);
4307
- * // => false
4308
- */
4309
- function isString$1(value) {
4310
- return typeof value == 'string' ||
4311
- (!isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
4312
- }
4313
-
4314
4289
  /**
4315
4290
  * Performs a deep comparison between two values to determine if they are
4316
4291
  * equivalent.
@@ -56173,35 +56148,19 @@
56173
56148
  "last-node-line": lastnodeArr[i] && this.node.level - 1 !== i,
56174
56149
  "last-node-isLeaf-line": lastnodeArr[i] && this.node.level - 1 === i
56175
56150
  },
56176
- style: {
56177
- position: "absolute",
56178
- top: "0",
56179
- display: "block",
56180
- height: lastnodeArr[i] && this.node.level - 1 === i ? "50%" : "100%",
56181
- left: this.indent * i + "px"
56182
- }
56151
+ style: { left: this.indent * i + "px" }
56183
56152
  })
56184
56153
  );
56185
56154
  }
56186
56155
  return vue.h(
56187
56156
  "span",
56188
56157
  {
56189
- class: "yc-tree-node-label-wrapper",
56190
- style: {
56191
- position: "relative",
56192
- display: "flex",
56193
- flex: "1",
56194
- alignItems: "center"
56195
- }
56158
+ class: "yc-tree-node-label-wrapper"
56196
56159
  },
56197
56160
  [labelNodes].concat(lineNodes).concat([
56198
56161
  vue.h("span", {
56199
56162
  class: "yc-tree-node-line-hor",
56200
56163
  style: {
56201
- position: "absolute",
56202
- top: "50%",
56203
- display: "block",
56204
- height: "0",
56205
56164
  width: (this.node.isLeaf ? 24 : 8) + "px",
56206
56165
  left: (this.node.level - 1) * this.indent + "px"
56207
56166
  }
@@ -59637,2013 +59596,6 @@
59637
59596
 
59638
59597
  var installer = makeInstaller([...plugins]);
59639
59598
 
59640
- const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
59641
- const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
59642
- const colonSeparated = value.split(":");
59643
- if (value.slice(0, 1) === "@") {
59644
- if (colonSeparated.length < 2 || colonSeparated.length > 3) {
59645
- return null;
59646
- }
59647
- provider = colonSeparated.shift().slice(1);
59648
- }
59649
- if (colonSeparated.length > 3 || !colonSeparated.length) {
59650
- return null;
59651
- }
59652
- if (colonSeparated.length > 1) {
59653
- const name2 = colonSeparated.pop();
59654
- const prefix = colonSeparated.pop();
59655
- const result = {
59656
- // Allow provider without '@': "provider:prefix:name"
59657
- provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
59658
- prefix,
59659
- name: name2
59660
- };
59661
- return validate && !validateIconName(result) ? null : result;
59662
- }
59663
- const name = colonSeparated[0];
59664
- const dashSeparated = name.split("-");
59665
- if (dashSeparated.length > 1) {
59666
- const result = {
59667
- provider,
59668
- prefix: dashSeparated.shift(),
59669
- name: dashSeparated.join("-")
59670
- };
59671
- return validate && !validateIconName(result) ? null : result;
59672
- }
59673
- if (allowSimpleName && provider === "") {
59674
- const result = {
59675
- provider,
59676
- prefix: "",
59677
- name
59678
- };
59679
- return validate && !validateIconName(result, allowSimpleName) ? null : result;
59680
- }
59681
- return null;
59682
- };
59683
- const validateIconName = (icon, allowSimpleName) => {
59684
- if (!icon) {
59685
- return false;
59686
- }
59687
- return !!// Check prefix: cannot be empty, unless allowSimpleName is enabled
59688
- // Check name: cannot be empty
59689
- ((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
59690
- };
59691
-
59692
- const defaultIconDimensions = Object.freeze(
59693
- {
59694
- left: 0,
59695
- top: 0,
59696
- width: 16,
59697
- height: 16
59698
- }
59699
- );
59700
- const defaultIconTransformations = Object.freeze({
59701
- rotate: 0,
59702
- vFlip: false,
59703
- hFlip: false
59704
- });
59705
- const defaultIconProps = Object.freeze({
59706
- ...defaultIconDimensions,
59707
- ...defaultIconTransformations
59708
- });
59709
- const defaultExtendedIconProps = Object.freeze({
59710
- ...defaultIconProps,
59711
- body: "",
59712
- hidden: false
59713
- });
59714
-
59715
- function mergeIconTransformations(obj1, obj2) {
59716
- const result = {};
59717
- if (!obj1.hFlip !== !obj2.hFlip) {
59718
- result.hFlip = true;
59719
- }
59720
- if (!obj1.vFlip !== !obj2.vFlip) {
59721
- result.vFlip = true;
59722
- }
59723
- const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
59724
- if (rotate) {
59725
- result.rotate = rotate;
59726
- }
59727
- return result;
59728
- }
59729
-
59730
- function mergeIconData(parent, child) {
59731
- const result = mergeIconTransformations(parent, child);
59732
- for (const key in defaultExtendedIconProps) {
59733
- if (key in defaultIconTransformations) {
59734
- if (key in parent && !(key in result)) {
59735
- result[key] = defaultIconTransformations[key];
59736
- }
59737
- } else if (key in child) {
59738
- result[key] = child[key];
59739
- } else if (key in parent) {
59740
- result[key] = parent[key];
59741
- }
59742
- }
59743
- return result;
59744
- }
59745
-
59746
- function getIconsTree(data, names) {
59747
- const icons = data.icons;
59748
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
59749
- const resolved = /* @__PURE__ */ Object.create(null);
59750
- function resolve(name) {
59751
- if (icons[name]) {
59752
- return resolved[name] = [];
59753
- }
59754
- if (!(name in resolved)) {
59755
- resolved[name] = null;
59756
- const parent = aliases[name] && aliases[name].parent;
59757
- const value = parent && resolve(parent);
59758
- if (value) {
59759
- resolved[name] = [parent].concat(value);
59760
- }
59761
- }
59762
- return resolved[name];
59763
- }
59764
- (Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
59765
- return resolved;
59766
- }
59767
-
59768
- function internalGetIconData(data, name, tree) {
59769
- const icons = data.icons;
59770
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
59771
- let currentProps = {};
59772
- function parse(name2) {
59773
- currentProps = mergeIconData(
59774
- icons[name2] || aliases[name2],
59775
- currentProps
59776
- );
59777
- }
59778
- parse(name);
59779
- tree.forEach(parse);
59780
- return mergeIconData(data, currentProps);
59781
- }
59782
-
59783
- function parseIconSet(data, callback) {
59784
- const names = [];
59785
- if (typeof data !== "object" || typeof data.icons !== "object") {
59786
- return names;
59787
- }
59788
- if (data.not_found instanceof Array) {
59789
- data.not_found.forEach((name) => {
59790
- callback(name, null);
59791
- names.push(name);
59792
- });
59793
- }
59794
- const tree = getIconsTree(data);
59795
- for (const name in tree) {
59796
- const item = tree[name];
59797
- if (item) {
59798
- callback(name, internalGetIconData(data, name, item));
59799
- names.push(name);
59800
- }
59801
- }
59802
- return names;
59803
- }
59804
-
59805
- const optionalPropertyDefaults = {
59806
- provider: "",
59807
- aliases: {},
59808
- not_found: {},
59809
- ...defaultIconDimensions
59810
- };
59811
- function checkOptionalProps(item, defaults) {
59812
- for (const prop in defaults) {
59813
- if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
59814
- return false;
59815
- }
59816
- }
59817
- return true;
59818
- }
59819
- function quicklyValidateIconSet(obj) {
59820
- if (typeof obj !== "object" || obj === null) {
59821
- return null;
59822
- }
59823
- const data = obj;
59824
- if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
59825
- return null;
59826
- }
59827
- if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
59828
- return null;
59829
- }
59830
- const icons = data.icons;
59831
- for (const name in icons) {
59832
- const icon = icons[name];
59833
- if (
59834
- // Name cannot be empty
59835
- !name || // Must have body
59836
- typeof icon.body !== "string" || // Check other props
59837
- !checkOptionalProps(
59838
- icon,
59839
- defaultExtendedIconProps
59840
- )
59841
- ) {
59842
- return null;
59843
- }
59844
- }
59845
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
59846
- for (const name in aliases) {
59847
- const icon = aliases[name];
59848
- const parent = icon.parent;
59849
- if (
59850
- // Name cannot be empty
59851
- !name || // Parent must be set and point to existing icon
59852
- typeof parent !== "string" || !icons[parent] && !aliases[parent] || // Check other props
59853
- !checkOptionalProps(
59854
- icon,
59855
- defaultExtendedIconProps
59856
- )
59857
- ) {
59858
- return null;
59859
- }
59860
- }
59861
- return data;
59862
- }
59863
-
59864
- const dataStorage = /* @__PURE__ */ Object.create(null);
59865
- function newStorage(provider, prefix) {
59866
- return {
59867
- provider,
59868
- prefix,
59869
- icons: /* @__PURE__ */ Object.create(null),
59870
- missing: /* @__PURE__ */ new Set()
59871
- };
59872
- }
59873
- function getStorage(provider, prefix) {
59874
- const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
59875
- return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
59876
- }
59877
- function addIconSet(storage, data) {
59878
- if (!quicklyValidateIconSet(data)) {
59879
- return [];
59880
- }
59881
- return parseIconSet(data, (name, icon) => {
59882
- if (icon) {
59883
- storage.icons[name] = icon;
59884
- } else {
59885
- storage.missing.add(name);
59886
- }
59887
- });
59888
- }
59889
- function addIconToStorage(storage, name, icon) {
59890
- try {
59891
- if (typeof icon.body === "string") {
59892
- storage.icons[name] = { ...icon };
59893
- return true;
59894
- }
59895
- } catch (err) {
59896
- }
59897
- return false;
59898
- }
59899
-
59900
- let simpleNames = false;
59901
- function allowSimpleNames(allow) {
59902
- if (typeof allow === "boolean") {
59903
- simpleNames = allow;
59904
- }
59905
- return simpleNames;
59906
- }
59907
- function getIconData(name) {
59908
- const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
59909
- if (icon) {
59910
- const storage = getStorage(icon.provider, icon.prefix);
59911
- const iconName = icon.name;
59912
- return storage.icons[iconName] || (storage.missing.has(iconName) ? null : void 0);
59913
- }
59914
- }
59915
- function addIcon(name, data) {
59916
- const icon = stringToIcon(name, true, simpleNames);
59917
- if (!icon) {
59918
- return false;
59919
- }
59920
- const storage = getStorage(icon.provider, icon.prefix);
59921
- if (data) {
59922
- return addIconToStorage(storage, icon.name, data);
59923
- } else {
59924
- storage.missing.add(icon.name);
59925
- return true;
59926
- }
59927
- }
59928
- function addCollection(data, provider) {
59929
- if (typeof data !== "object") {
59930
- return false;
59931
- }
59932
- if (typeof provider !== "string") {
59933
- provider = data.provider || "";
59934
- }
59935
- if (simpleNames && !provider && !data.prefix) {
59936
- let added = false;
59937
- if (quicklyValidateIconSet(data)) {
59938
- data.prefix = "";
59939
- parseIconSet(data, (name, icon) => {
59940
- if (addIcon(name, icon)) {
59941
- added = true;
59942
- }
59943
- });
59944
- }
59945
- return added;
59946
- }
59947
- const prefix = data.prefix;
59948
- if (!validateIconName({
59949
- prefix,
59950
- name: "a"
59951
- })) {
59952
- return false;
59953
- }
59954
- const storage = getStorage(provider, prefix);
59955
- return !!addIconSet(storage, data);
59956
- }
59957
-
59958
- const defaultIconSizeCustomisations = Object.freeze({
59959
- width: null,
59960
- height: null
59961
- });
59962
- const defaultIconCustomisations = Object.freeze({
59963
- // Dimensions
59964
- ...defaultIconSizeCustomisations,
59965
- // Transformations
59966
- ...defaultIconTransformations
59967
- });
59968
-
59969
- const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
59970
- const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
59971
- function calculateSize(size, ratio, precision) {
59972
- if (ratio === 1) {
59973
- return size;
59974
- }
59975
- precision = precision || 100;
59976
- if (typeof size === "number") {
59977
- return Math.ceil(size * ratio * precision) / precision;
59978
- }
59979
- if (typeof size !== "string") {
59980
- return size;
59981
- }
59982
- const oldParts = size.split(unitsSplit);
59983
- if (oldParts === null || !oldParts.length) {
59984
- return size;
59985
- }
59986
- const newParts = [];
59987
- let code = oldParts.shift();
59988
- let isNumber = unitsTest.test(code);
59989
- while (true) {
59990
- if (isNumber) {
59991
- const num = parseFloat(code);
59992
- if (isNaN(num)) {
59993
- newParts.push(code);
59994
- } else {
59995
- newParts.push(Math.ceil(num * ratio * precision) / precision);
59996
- }
59997
- } else {
59998
- newParts.push(code);
59999
- }
60000
- code = oldParts.shift();
60001
- if (code === void 0) {
60002
- return newParts.join("");
60003
- }
60004
- isNumber = !isNumber;
60005
- }
60006
- }
60007
-
60008
- function splitSVGDefs(content, tag = "defs") {
60009
- let defs = "";
60010
- const index = content.indexOf("<" + tag);
60011
- while (index >= 0) {
60012
- const start = content.indexOf(">", index);
60013
- const end = content.indexOf("</" + tag);
60014
- if (start === -1 || end === -1) {
60015
- break;
60016
- }
60017
- const endEnd = content.indexOf(">", end);
60018
- if (endEnd === -1) {
60019
- break;
60020
- }
60021
- defs += content.slice(start + 1, end).trim();
60022
- content = content.slice(0, index).trim() + content.slice(endEnd + 1);
60023
- }
60024
- return {
60025
- defs,
60026
- content
60027
- };
60028
- }
60029
- function mergeDefsAndContent(defs, content) {
60030
- return defs ? "<defs>" + defs + "</defs>" + content : content;
60031
- }
60032
- function wrapSVGContent(body, start, end) {
60033
- const split = splitSVGDefs(body);
60034
- return mergeDefsAndContent(split.defs, start + split.content + end);
60035
- }
60036
-
60037
- const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
60038
- function iconToSVG(icon, customisations) {
60039
- const fullIcon = {
60040
- ...defaultIconProps,
60041
- ...icon
60042
- };
60043
- const fullCustomisations = {
60044
- ...defaultIconCustomisations,
60045
- ...customisations
60046
- };
60047
- const box = {
60048
- left: fullIcon.left,
60049
- top: fullIcon.top,
60050
- width: fullIcon.width,
60051
- height: fullIcon.height
60052
- };
60053
- let body = fullIcon.body;
60054
- [fullIcon, fullCustomisations].forEach((props) => {
60055
- const transformations = [];
60056
- const hFlip = props.hFlip;
60057
- const vFlip = props.vFlip;
60058
- let rotation = props.rotate;
60059
- if (hFlip) {
60060
- if (vFlip) {
60061
- rotation += 2;
60062
- } else {
60063
- transformations.push(
60064
- "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
60065
- );
60066
- transformations.push("scale(-1 1)");
60067
- box.top = box.left = 0;
60068
- }
60069
- } else if (vFlip) {
60070
- transformations.push(
60071
- "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
60072
- );
60073
- transformations.push("scale(1 -1)");
60074
- box.top = box.left = 0;
60075
- }
60076
- let tempValue;
60077
- if (rotation < 0) {
60078
- rotation -= Math.floor(rotation / 4) * 4;
60079
- }
60080
- rotation = rotation % 4;
60081
- switch (rotation) {
60082
- case 1:
60083
- tempValue = box.height / 2 + box.top;
60084
- transformations.unshift(
60085
- "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
60086
- );
60087
- break;
60088
- case 2:
60089
- transformations.unshift(
60090
- "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
60091
- );
60092
- break;
60093
- case 3:
60094
- tempValue = box.width / 2 + box.left;
60095
- transformations.unshift(
60096
- "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
60097
- );
60098
- break;
60099
- }
60100
- if (rotation % 2 === 1) {
60101
- if (box.left !== box.top) {
60102
- tempValue = box.left;
60103
- box.left = box.top;
60104
- box.top = tempValue;
60105
- }
60106
- if (box.width !== box.height) {
60107
- tempValue = box.width;
60108
- box.width = box.height;
60109
- box.height = tempValue;
60110
- }
60111
- }
60112
- if (transformations.length) {
60113
- body = wrapSVGContent(
60114
- body,
60115
- '<g transform="' + transformations.join(" ") + '">',
60116
- "</g>"
60117
- );
60118
- }
60119
- });
60120
- const customisationsWidth = fullCustomisations.width;
60121
- const customisationsHeight = fullCustomisations.height;
60122
- const boxWidth = box.width;
60123
- const boxHeight = box.height;
60124
- let width;
60125
- let height;
60126
- if (customisationsWidth === null) {
60127
- height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
60128
- width = calculateSize(height, boxWidth / boxHeight);
60129
- } else {
60130
- width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
60131
- height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
60132
- }
60133
- const attributes = {};
60134
- const setAttr = (prop, value) => {
60135
- if (!isUnsetKeyword(value)) {
60136
- attributes[prop] = value.toString();
60137
- }
60138
- };
60139
- setAttr("width", width);
60140
- setAttr("height", height);
60141
- const viewBox = [box.left, box.top, boxWidth, boxHeight];
60142
- attributes.viewBox = viewBox.join(" ");
60143
- return {
60144
- attributes,
60145
- viewBox,
60146
- body
60147
- };
60148
- }
60149
-
60150
- const regex = /\sid="(\S+)"/g;
60151
- const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
60152
- let counter = 0;
60153
- function replaceIDs(body, prefix = randomPrefix) {
60154
- const ids = [];
60155
- let match;
60156
- while (match = regex.exec(body)) {
60157
- ids.push(match[1]);
60158
- }
60159
- if (!ids.length) {
60160
- return body;
60161
- }
60162
- const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
60163
- ids.forEach((id) => {
60164
- const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
60165
- const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
60166
- body = body.replace(
60167
- // Allowed characters before id: [#;"]
60168
- // Allowed characters after id: [)"], .[a-z]
60169
- new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
60170
- "$1" + newID + suffix + "$3"
60171
- );
60172
- });
60173
- body = body.replace(new RegExp(suffix, "g"), "");
60174
- return body;
60175
- }
60176
-
60177
- const storage = /* @__PURE__ */ Object.create(null);
60178
- function setAPIModule(provider, item) {
60179
- storage[provider] = item;
60180
- }
60181
- function getAPIModule(provider) {
60182
- return storage[provider] || storage[""];
60183
- }
60184
-
60185
- function createAPIConfig(source) {
60186
- let resources;
60187
- if (typeof source.resources === "string") {
60188
- resources = [source.resources];
60189
- } else {
60190
- resources = source.resources;
60191
- if (!(resources instanceof Array) || !resources.length) {
60192
- return null;
60193
- }
60194
- }
60195
- const result = {
60196
- // API hosts
60197
- resources,
60198
- // Root path
60199
- path: source.path || "/",
60200
- // URL length limit
60201
- maxURL: source.maxURL || 500,
60202
- // Timeout before next host is used.
60203
- rotate: source.rotate || 750,
60204
- // Timeout before failing query.
60205
- timeout: source.timeout || 5e3,
60206
- // Randomise default API end point.
60207
- random: source.random === true,
60208
- // Start index
60209
- index: source.index || 0,
60210
- // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
60211
- dataAfterTimeout: source.dataAfterTimeout !== false
60212
- };
60213
- return result;
60214
- }
60215
- const configStorage = /* @__PURE__ */ Object.create(null);
60216
- const fallBackAPISources = [
60217
- "https://api.simplesvg.com",
60218
- "https://api.unisvg.com"
60219
- ];
60220
- const fallBackAPI = [];
60221
- while (fallBackAPISources.length > 0) {
60222
- if (fallBackAPISources.length === 1) {
60223
- fallBackAPI.push(fallBackAPISources.shift());
60224
- } else {
60225
- if (Math.random() > 0.5) {
60226
- fallBackAPI.push(fallBackAPISources.shift());
60227
- } else {
60228
- fallBackAPI.push(fallBackAPISources.pop());
60229
- }
60230
- }
60231
- }
60232
- configStorage[""] = createAPIConfig({
60233
- resources: ["https://api.iconify.design"].concat(fallBackAPI)
60234
- });
60235
- function addAPIProvider(provider, customConfig) {
60236
- const config = createAPIConfig(customConfig);
60237
- if (config === null) {
60238
- return false;
60239
- }
60240
- configStorage[provider] = config;
60241
- return true;
60242
- }
60243
- function getAPIConfig(provider) {
60244
- return configStorage[provider];
60245
- }
60246
-
60247
- const detectFetch = () => {
60248
- let callback;
60249
- try {
60250
- callback = fetch;
60251
- if (typeof callback === "function") {
60252
- return callback;
60253
- }
60254
- } catch (err) {
60255
- }
60256
- };
60257
- let fetchModule = detectFetch();
60258
- function calculateMaxLength(provider, prefix) {
60259
- const config = getAPIConfig(provider);
60260
- if (!config) {
60261
- return 0;
60262
- }
60263
- let result;
60264
- if (!config.maxURL) {
60265
- result = 0;
60266
- } else {
60267
- let maxHostLength = 0;
60268
- config.resources.forEach((item) => {
60269
- const host = item;
60270
- maxHostLength = Math.max(maxHostLength, host.length);
60271
- });
60272
- const url = prefix + ".json?icons=";
60273
- result = config.maxURL - maxHostLength - config.path.length - url.length;
60274
- }
60275
- return result;
60276
- }
60277
- function shouldAbort(status) {
60278
- return status === 404;
60279
- }
60280
- const prepare = (provider, prefix, icons) => {
60281
- const results = [];
60282
- const maxLength = calculateMaxLength(provider, prefix);
60283
- const type = "icons";
60284
- let item = {
60285
- type,
60286
- provider,
60287
- prefix,
60288
- icons: []
60289
- };
60290
- let length = 0;
60291
- icons.forEach((name, index) => {
60292
- length += name.length + 1;
60293
- if (length >= maxLength && index > 0) {
60294
- results.push(item);
60295
- item = {
60296
- type,
60297
- provider,
60298
- prefix,
60299
- icons: []
60300
- };
60301
- length = name.length;
60302
- }
60303
- item.icons.push(name);
60304
- });
60305
- results.push(item);
60306
- return results;
60307
- };
60308
- function getPath(provider) {
60309
- if (typeof provider === "string") {
60310
- const config = getAPIConfig(provider);
60311
- if (config) {
60312
- return config.path;
60313
- }
60314
- }
60315
- return "/";
60316
- }
60317
- const send = (host, params, callback) => {
60318
- if (!fetchModule) {
60319
- callback("abort", 424);
60320
- return;
60321
- }
60322
- let path = getPath(params.provider);
60323
- switch (params.type) {
60324
- case "icons": {
60325
- const prefix = params.prefix;
60326
- const icons = params.icons;
60327
- const iconsList = icons.join(",");
60328
- const urlParams = new URLSearchParams({
60329
- icons: iconsList
60330
- });
60331
- path += prefix + ".json?" + urlParams.toString();
60332
- break;
60333
- }
60334
- case "custom": {
60335
- const uri = params.uri;
60336
- path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
60337
- break;
60338
- }
60339
- default:
60340
- callback("abort", 400);
60341
- return;
60342
- }
60343
- let defaultError = 503;
60344
- fetchModule(host + path).then((response) => {
60345
- const status = response.status;
60346
- if (status !== 200) {
60347
- setTimeout(() => {
60348
- callback(shouldAbort(status) ? "abort" : "next", status);
60349
- });
60350
- return;
60351
- }
60352
- defaultError = 501;
60353
- return response.json();
60354
- }).then((data) => {
60355
- if (typeof data !== "object" || data === null) {
60356
- setTimeout(() => {
60357
- if (data === 404) {
60358
- callback("abort", data);
60359
- } else {
60360
- callback("next", defaultError);
60361
- }
60362
- });
60363
- return;
60364
- }
60365
- setTimeout(() => {
60366
- callback("success", data);
60367
- });
60368
- }).catch(() => {
60369
- callback("next", defaultError);
60370
- });
60371
- };
60372
- const fetchAPIModule = {
60373
- prepare,
60374
- send
60375
- };
60376
-
60377
- function sortIcons(icons) {
60378
- const result = {
60379
- loaded: [],
60380
- missing: [],
60381
- pending: []
60382
- };
60383
- const storage = /* @__PURE__ */ Object.create(null);
60384
- icons.sort((a, b) => {
60385
- if (a.provider !== b.provider) {
60386
- return a.provider.localeCompare(b.provider);
60387
- }
60388
- if (a.prefix !== b.prefix) {
60389
- return a.prefix.localeCompare(b.prefix);
60390
- }
60391
- return a.name.localeCompare(b.name);
60392
- });
60393
- let lastIcon = {
60394
- provider: "",
60395
- prefix: "",
60396
- name: ""
60397
- };
60398
- icons.forEach((icon) => {
60399
- if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
60400
- return;
60401
- }
60402
- lastIcon = icon;
60403
- const provider = icon.provider;
60404
- const prefix = icon.prefix;
60405
- const name = icon.name;
60406
- const providerStorage = storage[provider] || (storage[provider] = /* @__PURE__ */ Object.create(null));
60407
- const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
60408
- let list;
60409
- if (name in localStorage.icons) {
60410
- list = result.loaded;
60411
- } else if (prefix === "" || localStorage.missing.has(name)) {
60412
- list = result.missing;
60413
- } else {
60414
- list = result.pending;
60415
- }
60416
- const item = {
60417
- provider,
60418
- prefix,
60419
- name
60420
- };
60421
- list.push(item);
60422
- });
60423
- return result;
60424
- }
60425
-
60426
- function removeCallback(storages, id) {
60427
- storages.forEach((storage) => {
60428
- const items = storage.loaderCallbacks;
60429
- if (items) {
60430
- storage.loaderCallbacks = items.filter((row) => row.id !== id);
60431
- }
60432
- });
60433
- }
60434
- function updateCallbacks(storage) {
60435
- if (!storage.pendingCallbacksFlag) {
60436
- storage.pendingCallbacksFlag = true;
60437
- setTimeout(() => {
60438
- storage.pendingCallbacksFlag = false;
60439
- const items = storage.loaderCallbacks ? storage.loaderCallbacks.slice(0) : [];
60440
- if (!items.length) {
60441
- return;
60442
- }
60443
- let hasPending = false;
60444
- const provider = storage.provider;
60445
- const prefix = storage.prefix;
60446
- items.forEach((item) => {
60447
- const icons = item.icons;
60448
- const oldLength = icons.pending.length;
60449
- icons.pending = icons.pending.filter((icon) => {
60450
- if (icon.prefix !== prefix) {
60451
- return true;
60452
- }
60453
- const name = icon.name;
60454
- if (storage.icons[name]) {
60455
- icons.loaded.push({
60456
- provider,
60457
- prefix,
60458
- name
60459
- });
60460
- } else if (storage.missing.has(name)) {
60461
- icons.missing.push({
60462
- provider,
60463
- prefix,
60464
- name
60465
- });
60466
- } else {
60467
- hasPending = true;
60468
- return true;
60469
- }
60470
- return false;
60471
- });
60472
- if (icons.pending.length !== oldLength) {
60473
- if (!hasPending) {
60474
- removeCallback([storage], item.id);
60475
- }
60476
- item.callback(
60477
- icons.loaded.slice(0),
60478
- icons.missing.slice(0),
60479
- icons.pending.slice(0),
60480
- item.abort
60481
- );
60482
- }
60483
- });
60484
- });
60485
- }
60486
- }
60487
- let idCounter = 0;
60488
- function storeCallback(callback, icons, pendingSources) {
60489
- const id = idCounter++;
60490
- const abort = removeCallback.bind(null, pendingSources, id);
60491
- if (!icons.pending.length) {
60492
- return abort;
60493
- }
60494
- const item = {
60495
- id,
60496
- icons,
60497
- callback,
60498
- abort
60499
- };
60500
- pendingSources.forEach((storage) => {
60501
- (storage.loaderCallbacks || (storage.loaderCallbacks = [])).push(item);
60502
- });
60503
- return abort;
60504
- }
60505
-
60506
- function listToIcons(list, validate = true, simpleNames = false) {
60507
- const result = [];
60508
- list.forEach((item) => {
60509
- const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames) : item;
60510
- if (icon) {
60511
- result.push(icon);
60512
- }
60513
- });
60514
- return result;
60515
- }
60516
-
60517
- // src/config.ts
60518
- var defaultConfig = {
60519
- resources: [],
60520
- index: 0,
60521
- timeout: 2e3,
60522
- rotate: 750,
60523
- random: false,
60524
- dataAfterTimeout: false
60525
- };
60526
-
60527
- // src/query.ts
60528
- function sendQuery(config, payload, query, done) {
60529
- const resourcesCount = config.resources.length;
60530
- const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
60531
- let resources;
60532
- if (config.random) {
60533
- let list = config.resources.slice(0);
60534
- resources = [];
60535
- while (list.length > 1) {
60536
- const nextIndex = Math.floor(Math.random() * list.length);
60537
- resources.push(list[nextIndex]);
60538
- list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
60539
- }
60540
- resources = resources.concat(list);
60541
- } else {
60542
- resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
60543
- }
60544
- const startTime = Date.now();
60545
- let status = "pending";
60546
- let queriesSent = 0;
60547
- let lastError;
60548
- let timer = null;
60549
- let queue = [];
60550
- let doneCallbacks = [];
60551
- if (typeof done === "function") {
60552
- doneCallbacks.push(done);
60553
- }
60554
- function resetTimer() {
60555
- if (timer) {
60556
- clearTimeout(timer);
60557
- timer = null;
60558
- }
60559
- }
60560
- function abort() {
60561
- if (status === "pending") {
60562
- status = "aborted";
60563
- }
60564
- resetTimer();
60565
- queue.forEach((item) => {
60566
- if (item.status === "pending") {
60567
- item.status = "aborted";
60568
- }
60569
- });
60570
- queue = [];
60571
- }
60572
- function subscribe(callback, overwrite) {
60573
- if (overwrite) {
60574
- doneCallbacks = [];
60575
- }
60576
- if (typeof callback === "function") {
60577
- doneCallbacks.push(callback);
60578
- }
60579
- }
60580
- function getQueryStatus() {
60581
- return {
60582
- startTime,
60583
- payload,
60584
- status,
60585
- queriesSent,
60586
- queriesPending: queue.length,
60587
- subscribe,
60588
- abort
60589
- };
60590
- }
60591
- function failQuery() {
60592
- status = "failed";
60593
- doneCallbacks.forEach((callback) => {
60594
- callback(void 0, lastError);
60595
- });
60596
- }
60597
- function clearQueue() {
60598
- queue.forEach((item) => {
60599
- if (item.status === "pending") {
60600
- item.status = "aborted";
60601
- }
60602
- });
60603
- queue = [];
60604
- }
60605
- function moduleResponse(item, response, data) {
60606
- const isError = response !== "success";
60607
- queue = queue.filter((queued) => queued !== item);
60608
- switch (status) {
60609
- case "pending":
60610
- break;
60611
- case "failed":
60612
- if (isError || !config.dataAfterTimeout) {
60613
- return;
60614
- }
60615
- break;
60616
- default:
60617
- return;
60618
- }
60619
- if (response === "abort") {
60620
- lastError = data;
60621
- failQuery();
60622
- return;
60623
- }
60624
- if (isError) {
60625
- lastError = data;
60626
- if (!queue.length) {
60627
- if (!resources.length) {
60628
- failQuery();
60629
- } else {
60630
- execNext();
60631
- }
60632
- }
60633
- return;
60634
- }
60635
- resetTimer();
60636
- clearQueue();
60637
- if (!config.random) {
60638
- const index = config.resources.indexOf(item.resource);
60639
- if (index !== -1 && index !== config.index) {
60640
- config.index = index;
60641
- }
60642
- }
60643
- status = "completed";
60644
- doneCallbacks.forEach((callback) => {
60645
- callback(data);
60646
- });
60647
- }
60648
- function execNext() {
60649
- if (status !== "pending") {
60650
- return;
60651
- }
60652
- resetTimer();
60653
- const resource = resources.shift();
60654
- if (resource === void 0) {
60655
- if (queue.length) {
60656
- timer = setTimeout(() => {
60657
- resetTimer();
60658
- if (status === "pending") {
60659
- clearQueue();
60660
- failQuery();
60661
- }
60662
- }, config.timeout);
60663
- return;
60664
- }
60665
- failQuery();
60666
- return;
60667
- }
60668
- const item = {
60669
- status: "pending",
60670
- resource,
60671
- callback: (status2, data) => {
60672
- moduleResponse(item, status2, data);
60673
- }
60674
- };
60675
- queue.push(item);
60676
- queriesSent++;
60677
- timer = setTimeout(execNext, config.rotate);
60678
- query(resource, payload, item.callback);
60679
- }
60680
- setTimeout(execNext);
60681
- return getQueryStatus;
60682
- }
60683
-
60684
- // src/index.ts
60685
- function initRedundancy(cfg) {
60686
- const config = {
60687
- ...defaultConfig,
60688
- ...cfg
60689
- };
60690
- let queries = [];
60691
- function cleanup() {
60692
- queries = queries.filter((item) => item().status === "pending");
60693
- }
60694
- function query(payload, queryCallback, doneCallback) {
60695
- const query2 = sendQuery(
60696
- config,
60697
- payload,
60698
- queryCallback,
60699
- (data, error) => {
60700
- cleanup();
60701
- if (doneCallback) {
60702
- doneCallback(data, error);
60703
- }
60704
- }
60705
- );
60706
- queries.push(query2);
60707
- return query2;
60708
- }
60709
- function find(callback) {
60710
- return queries.find((value) => {
60711
- return callback(value);
60712
- }) || null;
60713
- }
60714
- const instance = {
60715
- query,
60716
- find,
60717
- setIndex: (index) => {
60718
- config.index = index;
60719
- },
60720
- getIndex: () => config.index,
60721
- cleanup
60722
- };
60723
- return instance;
60724
- }
60725
-
60726
- function emptyCallback$1() {
60727
- }
60728
- const redundancyCache = /* @__PURE__ */ Object.create(null);
60729
- function getRedundancyCache(provider) {
60730
- if (!redundancyCache[provider]) {
60731
- const config = getAPIConfig(provider);
60732
- if (!config) {
60733
- return;
60734
- }
60735
- const redundancy = initRedundancy(config);
60736
- const cachedReundancy = {
60737
- config,
60738
- redundancy
60739
- };
60740
- redundancyCache[provider] = cachedReundancy;
60741
- }
60742
- return redundancyCache[provider];
60743
- }
60744
- function sendAPIQuery(target, query, callback) {
60745
- let redundancy;
60746
- let send;
60747
- if (typeof target === "string") {
60748
- const api = getAPIModule(target);
60749
- if (!api) {
60750
- callback(void 0, 424);
60751
- return emptyCallback$1;
60752
- }
60753
- send = api.send;
60754
- const cached = getRedundancyCache(target);
60755
- if (cached) {
60756
- redundancy = cached.redundancy;
60757
- }
60758
- } else {
60759
- const config = createAPIConfig(target);
60760
- if (config) {
60761
- redundancy = initRedundancy(config);
60762
- const moduleKey = target.resources ? target.resources[0] : "";
60763
- const api = getAPIModule(moduleKey);
60764
- if (api) {
60765
- send = api.send;
60766
- }
60767
- }
60768
- }
60769
- if (!redundancy || !send) {
60770
- callback(void 0, 424);
60771
- return emptyCallback$1;
60772
- }
60773
- return redundancy.query(query, send, callback)().abort;
60774
- }
60775
-
60776
- function emptyCallback() {
60777
- }
60778
- function loadedNewIcons(storage) {
60779
- if (!storage.iconsLoaderFlag) {
60780
- storage.iconsLoaderFlag = true;
60781
- setTimeout(() => {
60782
- storage.iconsLoaderFlag = false;
60783
- updateCallbacks(storage);
60784
- });
60785
- }
60786
- }
60787
- function checkIconNamesForAPI(icons) {
60788
- const valid = [];
60789
- const invalid = [];
60790
- icons.forEach((name) => {
60791
- (name.match(matchIconName) ? valid : invalid).push(name);
60792
- });
60793
- return {
60794
- valid,
60795
- invalid
60796
- };
60797
- }
60798
- function parseLoaderResponse(storage, icons, data) {
60799
- function checkMissing() {
60800
- const pending = storage.pendingIcons;
60801
- icons.forEach((name) => {
60802
- if (pending) {
60803
- pending.delete(name);
60804
- }
60805
- if (!storage.icons[name]) {
60806
- storage.missing.add(name);
60807
- }
60808
- });
60809
- }
60810
- if (data && typeof data === "object") {
60811
- try {
60812
- const parsed = addIconSet(storage, data);
60813
- if (!parsed.length) {
60814
- checkMissing();
60815
- return;
60816
- }
60817
- } catch (err) {
60818
- console.error(err);
60819
- }
60820
- }
60821
- checkMissing();
60822
- loadedNewIcons(storage);
60823
- }
60824
- function parsePossiblyAsyncResponse(response, callback) {
60825
- if (response instanceof Promise) {
60826
- response.then((data) => {
60827
- callback(data);
60828
- }).catch(() => {
60829
- callback(null);
60830
- });
60831
- } else {
60832
- callback(response);
60833
- }
60834
- }
60835
- function loadNewIcons(storage, icons) {
60836
- if (!storage.iconsToLoad) {
60837
- storage.iconsToLoad = icons;
60838
- } else {
60839
- storage.iconsToLoad = storage.iconsToLoad.concat(icons).sort();
60840
- }
60841
- if (!storage.iconsQueueFlag) {
60842
- storage.iconsQueueFlag = true;
60843
- setTimeout(() => {
60844
- storage.iconsQueueFlag = false;
60845
- const { provider, prefix } = storage;
60846
- const icons2 = storage.iconsToLoad;
60847
- delete storage.iconsToLoad;
60848
- if (!icons2 || !icons2.length) {
60849
- return;
60850
- }
60851
- const customIconLoader = storage.loadIcon;
60852
- if (storage.loadIcons && (icons2.length > 1 || !customIconLoader)) {
60853
- parsePossiblyAsyncResponse(
60854
- storage.loadIcons(icons2, prefix, provider),
60855
- (data) => {
60856
- parseLoaderResponse(storage, icons2, data);
60857
- }
60858
- );
60859
- return;
60860
- }
60861
- if (customIconLoader) {
60862
- icons2.forEach((name) => {
60863
- const response = customIconLoader(name, prefix, provider);
60864
- parsePossiblyAsyncResponse(response, (data) => {
60865
- const iconSet = data ? {
60866
- prefix,
60867
- icons: {
60868
- [name]: data
60869
- }
60870
- } : null;
60871
- parseLoaderResponse(storage, [name], iconSet);
60872
- });
60873
- });
60874
- return;
60875
- }
60876
- const { valid, invalid } = checkIconNamesForAPI(icons2);
60877
- if (invalid.length) {
60878
- parseLoaderResponse(storage, invalid, null);
60879
- }
60880
- if (!valid.length) {
60881
- return;
60882
- }
60883
- const api = prefix.match(matchIconName) ? getAPIModule(provider) : null;
60884
- if (!api) {
60885
- parseLoaderResponse(storage, valid, null);
60886
- return;
60887
- }
60888
- const params = api.prepare(provider, prefix, valid);
60889
- params.forEach((item) => {
60890
- sendAPIQuery(provider, item, (data) => {
60891
- parseLoaderResponse(storage, item.icons, data);
60892
- });
60893
- });
60894
- });
60895
- }
60896
- }
60897
- const loadIcons = (icons, callback) => {
60898
- const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
60899
- const sortedIcons = sortIcons(cleanedIcons);
60900
- if (!sortedIcons.pending.length) {
60901
- let callCallback = true;
60902
- if (callback) {
60903
- setTimeout(() => {
60904
- if (callCallback) {
60905
- callback(
60906
- sortedIcons.loaded,
60907
- sortedIcons.missing,
60908
- sortedIcons.pending,
60909
- emptyCallback
60910
- );
60911
- }
60912
- });
60913
- }
60914
- return () => {
60915
- callCallback = false;
60916
- };
60917
- }
60918
- const newIcons = /* @__PURE__ */ Object.create(null);
60919
- const sources = [];
60920
- let lastProvider, lastPrefix;
60921
- sortedIcons.pending.forEach((icon) => {
60922
- const { provider, prefix } = icon;
60923
- if (prefix === lastPrefix && provider === lastProvider) {
60924
- return;
60925
- }
60926
- lastProvider = provider;
60927
- lastPrefix = prefix;
60928
- sources.push(getStorage(provider, prefix));
60929
- const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
60930
- if (!providerNewIcons[prefix]) {
60931
- providerNewIcons[prefix] = [];
60932
- }
60933
- });
60934
- sortedIcons.pending.forEach((icon) => {
60935
- const { provider, prefix, name } = icon;
60936
- const storage = getStorage(provider, prefix);
60937
- const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set());
60938
- if (!pendingQueue.has(name)) {
60939
- pendingQueue.add(name);
60940
- newIcons[provider][prefix].push(name);
60941
- }
60942
- });
60943
- sources.forEach((storage) => {
60944
- const list = newIcons[storage.provider][storage.prefix];
60945
- if (list.length) {
60946
- loadNewIcons(storage, list);
60947
- }
60948
- });
60949
- return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
60950
- };
60951
-
60952
- function mergeCustomisations(defaults, item) {
60953
- const result = {
60954
- ...defaults
60955
- };
60956
- for (const key in item) {
60957
- const value = item[key];
60958
- const valueType = typeof value;
60959
- if (key in defaultIconSizeCustomisations) {
60960
- if (value === null || value && (valueType === "string" || valueType === "number")) {
60961
- result[key] = value;
60962
- }
60963
- } else if (valueType === typeof result[key]) {
60964
- result[key] = key === "rotate" ? value % 4 : value;
60965
- }
60966
- }
60967
- return result;
60968
- }
60969
-
60970
- const separator = /[\s,]+/;
60971
- function flipFromString(custom, flip) {
60972
- flip.split(separator).forEach((str) => {
60973
- const value = str.trim();
60974
- switch (value) {
60975
- case "horizontal":
60976
- custom.hFlip = true;
60977
- break;
60978
- case "vertical":
60979
- custom.vFlip = true;
60980
- break;
60981
- }
60982
- });
60983
- }
60984
-
60985
- function rotateFromString(value, defaultValue = 0) {
60986
- const units = value.replace(/^-?[0-9.]*/, "");
60987
- function cleanup(value2) {
60988
- while (value2 < 0) {
60989
- value2 += 4;
60990
- }
60991
- return value2 % 4;
60992
- }
60993
- if (units === "") {
60994
- const num = parseInt(value);
60995
- return isNaN(num) ? 0 : cleanup(num);
60996
- } else if (units !== value) {
60997
- let split = 0;
60998
- switch (units) {
60999
- case "%":
61000
- split = 25;
61001
- break;
61002
- case "deg":
61003
- split = 90;
61004
- }
61005
- if (split) {
61006
- let num = parseFloat(value.slice(0, value.length - units.length));
61007
- if (isNaN(num)) {
61008
- return 0;
61009
- }
61010
- num = num / split;
61011
- return num % 1 === 0 ? cleanup(num) : 0;
61012
- }
61013
- }
61014
- return defaultValue;
61015
- }
61016
-
61017
- function iconToHTML(body, attributes) {
61018
- let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
61019
- for (const attr in attributes) {
61020
- renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
61021
- }
61022
- return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
61023
- }
61024
-
61025
- function encodeSVGforURL(svg) {
61026
- return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
61027
- }
61028
- function svgToData(svg) {
61029
- return "data:image/svg+xml," + encodeSVGforURL(svg);
61030
- }
61031
- function svgToURL(svg) {
61032
- return 'url("' + svgToData(svg) + '")';
61033
- }
61034
-
61035
- const defaultExtendedIconCustomisations = {
61036
- ...defaultIconCustomisations,
61037
- inline: false,
61038
- };
61039
-
61040
- /**
61041
- * Default SVG attributes
61042
- */
61043
- const svgDefaults = {
61044
- 'xmlns': 'http://www.w3.org/2000/svg',
61045
- 'xmlns:xlink': 'http://www.w3.org/1999/xlink',
61046
- 'aria-hidden': true,
61047
- 'role': 'img',
61048
- };
61049
- /**
61050
- * Style modes
61051
- */
61052
- const commonProps = {
61053
- display: 'inline-block',
61054
- };
61055
- const monotoneProps = {
61056
- backgroundColor: 'currentColor',
61057
- };
61058
- const coloredProps = {
61059
- backgroundColor: 'transparent',
61060
- };
61061
- // Dynamically add common props to variables above
61062
- const propsToAdd = {
61063
- Image: 'var(--svg)',
61064
- Repeat: 'no-repeat',
61065
- Size: '100% 100%',
61066
- };
61067
- const propsToAddTo = {
61068
- webkitMask: monotoneProps,
61069
- mask: monotoneProps,
61070
- background: coloredProps,
61071
- };
61072
- for (const prefix in propsToAddTo) {
61073
- const list = propsToAddTo[prefix];
61074
- for (const prop in propsToAdd) {
61075
- list[prefix + prop] = propsToAdd[prop];
61076
- }
61077
- }
61078
- /**
61079
- * Aliases for customisations.
61080
- * In Vue 'v-' properties are reserved, so v-flip must be renamed
61081
- */
61082
- const customisationAliases = {};
61083
- ['horizontal', 'vertical'].forEach((prefix) => {
61084
- const attr = prefix.slice(0, 1) + 'Flip';
61085
- // vertical-flip
61086
- customisationAliases[prefix + '-flip'] = attr;
61087
- // v-flip
61088
- customisationAliases[prefix.slice(0, 1) + '-flip'] = attr;
61089
- // verticalFlip
61090
- customisationAliases[prefix + 'Flip'] = attr;
61091
- });
61092
- /**
61093
- * Fix size: add 'px' to numbers
61094
- */
61095
- function fixSize(value) {
61096
- return value + (value.match(/^[-0-9.]+$/) ? 'px' : '');
61097
- }
61098
- /**
61099
- * Render icon
61100
- */
61101
- const render = (
61102
- // Icon must be validated before calling this function
61103
- icon,
61104
- // Partial properties
61105
- props) => {
61106
- // Split properties
61107
- const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
61108
- const componentProps = { ...svgDefaults };
61109
- // Check mode
61110
- const mode = props.mode || 'svg';
61111
- // Copy style
61112
- const style = {};
61113
- const propsStyle = props.style;
61114
- const customStyle = typeof propsStyle === 'object' && !(propsStyle instanceof Array)
61115
- ? propsStyle
61116
- : {};
61117
- // Get element properties
61118
- for (let key in props) {
61119
- const value = props[key];
61120
- if (value === void 0) {
61121
- continue;
61122
- }
61123
- switch (key) {
61124
- // Properties to ignore
61125
- case 'icon':
61126
- case 'style':
61127
- case 'onLoad':
61128
- case 'mode':
61129
- case 'ssr':
61130
- break;
61131
- // Boolean attributes
61132
- case 'inline':
61133
- case 'hFlip':
61134
- case 'vFlip':
61135
- customisations[key] =
61136
- value === true || value === 'true' || value === 1;
61137
- break;
61138
- // Flip as string: 'horizontal,vertical'
61139
- case 'flip':
61140
- if (typeof value === 'string') {
61141
- flipFromString(customisations, value);
61142
- }
61143
- break;
61144
- // Color: override style
61145
- case 'color':
61146
- style.color = value;
61147
- break;
61148
- // Rotation as string
61149
- case 'rotate':
61150
- if (typeof value === 'string') {
61151
- customisations[key] = rotateFromString(value);
61152
- }
61153
- else if (typeof value === 'number') {
61154
- customisations[key] = value;
61155
- }
61156
- break;
61157
- // Remove aria-hidden
61158
- case 'ariaHidden':
61159
- case 'aria-hidden':
61160
- // Vue transforms 'aria-hidden' property to 'ariaHidden'
61161
- if (value !== true && value !== 'true') {
61162
- delete componentProps['aria-hidden'];
61163
- }
61164
- break;
61165
- default: {
61166
- const alias = customisationAliases[key];
61167
- if (alias) {
61168
- // Aliases for boolean customisations
61169
- if (value === true || value === 'true' || value === 1) {
61170
- customisations[alias] = true;
61171
- }
61172
- }
61173
- else if (defaultExtendedIconCustomisations[key] === void 0) {
61174
- // Copy missing property if it does not exist in customisations
61175
- componentProps[key] = value;
61176
- }
61177
- }
61178
- }
61179
- }
61180
- // Generate icon
61181
- const item = iconToSVG(icon, customisations);
61182
- const renderAttribs = item.attributes;
61183
- // Inline display
61184
- if (customisations.inline) {
61185
- style.verticalAlign = '-0.125em';
61186
- }
61187
- if (mode === 'svg') {
61188
- // Add style
61189
- componentProps.style = {
61190
- ...style,
61191
- ...customStyle,
61192
- };
61193
- // Add icon stuff
61194
- Object.assign(componentProps, renderAttribs);
61195
- // Counter for ids based on "id" property to render icons consistently on server and client
61196
- let localCounter = 0;
61197
- let id = props.id;
61198
- if (typeof id === 'string') {
61199
- // Convert '-' to '_' to avoid errors in animations
61200
- id = id.replace(/-/g, '_');
61201
- }
61202
- // Add innerHTML and style to props
61203
- componentProps['innerHTML'] = replaceIDs(item.body, id ? () => id + 'ID' + localCounter++ : 'iconifyVue');
61204
- // Render icon
61205
- return vue.h('svg', componentProps);
61206
- }
61207
- // Render <span> with style
61208
- const { body, width, height } = icon;
61209
- const useMask = mode === 'mask' ||
61210
- (mode === 'bg' ? false : body.indexOf('currentColor') !== -1);
61211
- // Generate SVG
61212
- const html = iconToHTML(body, {
61213
- ...renderAttribs,
61214
- width: width + '',
61215
- height: height + '',
61216
- });
61217
- // Generate style
61218
- componentProps.style = {
61219
- ...style,
61220
- '--svg': svgToURL(html),
61221
- 'width': fixSize(renderAttribs.width),
61222
- 'height': fixSize(renderAttribs.height),
61223
- ...commonProps,
61224
- ...(useMask ? monotoneProps : coloredProps),
61225
- ...customStyle,
61226
- };
61227
- return vue.h('span', componentProps);
61228
- };
61229
-
61230
- /**
61231
- * Initialise stuff
61232
- */
61233
- // Enable short names
61234
- allowSimpleNames(true);
61235
- // Set API module
61236
- setAPIModule('', fetchAPIModule);
61237
- /**
61238
- * Browser stuff
61239
- */
61240
- if (typeof document !== 'undefined' && typeof window !== 'undefined') {
61241
- const _window = window;
61242
- // Load icons from global "IconifyPreload"
61243
- if (_window.IconifyPreload !== void 0) {
61244
- const preload = _window.IconifyPreload;
61245
- const err = 'Invalid IconifyPreload syntax.';
61246
- if (typeof preload === 'object' && preload !== null) {
61247
- (preload instanceof Array ? preload : [preload]).forEach((item) => {
61248
- try {
61249
- if (
61250
- // Check if item is an object and not null/array
61251
- typeof item !== 'object' ||
61252
- item === null ||
61253
- item instanceof Array ||
61254
- // Check for 'icons' and 'prefix'
61255
- typeof item.icons !== 'object' ||
61256
- typeof item.prefix !== 'string' ||
61257
- // Add icon set
61258
- !addCollection(item)) {
61259
- console.error(err);
61260
- }
61261
- }
61262
- catch (e) {
61263
- console.error(err);
61264
- }
61265
- });
61266
- }
61267
- }
61268
- // Set API from global "IconifyProviders"
61269
- if (_window.IconifyProviders !== void 0) {
61270
- const providers = _window.IconifyProviders;
61271
- if (typeof providers === 'object' && providers !== null) {
61272
- for (let key in providers) {
61273
- const err = 'IconifyProviders[' + key + '] is invalid.';
61274
- try {
61275
- const value = providers[key];
61276
- if (typeof value !== 'object' ||
61277
- !value ||
61278
- value.resources === void 0) {
61279
- continue;
61280
- }
61281
- if (!addAPIProvider(key, value)) {
61282
- console.error(err);
61283
- }
61284
- }
61285
- catch (e) {
61286
- console.error(err);
61287
- }
61288
- }
61289
- }
61290
- }
61291
- }
61292
- /**
61293
- * Empty icon data, rendered when icon is not available
61294
- */
61295
- const emptyIcon = {
61296
- ...defaultIconProps,
61297
- body: '',
61298
- };
61299
- /**
61300
- * Component
61301
- */
61302
- const Icon = vue.defineComponent((props, { emit }) => {
61303
- const loader = vue.ref(null);
61304
- function abortLoading() {
61305
- if (loader.value) {
61306
- loader.value.abort?.();
61307
- loader.value = null;
61308
- }
61309
- }
61310
- // Render state
61311
- const rendering = vue.ref(!!props.ssr);
61312
- const lastRenderedIconName = vue.ref('');
61313
- const iconData = vue.shallowRef(null);
61314
- // Update icon data
61315
- function getIcon() {
61316
- const icon = props.icon;
61317
- // Icon is an object
61318
- if (typeof icon === 'object' &&
61319
- icon !== null &&
61320
- typeof icon.body === 'string') {
61321
- lastRenderedIconName.value = '';
61322
- return {
61323
- data: icon,
61324
- };
61325
- }
61326
- // Check for valid icon name
61327
- let iconName;
61328
- if (typeof icon !== 'string' ||
61329
- (iconName = stringToIcon(icon, false, true)) === null) {
61330
- return null;
61331
- }
61332
- // Load icon
61333
- let data = getIconData(iconName);
61334
- if (!data) {
61335
- // Icon data is not available
61336
- const oldState = loader.value;
61337
- if (!oldState || oldState.name !== icon) {
61338
- // Icon name does not match old loader state
61339
- if (data === null) {
61340
- // Failed to load
61341
- loader.value = {
61342
- name: icon,
61343
- };
61344
- }
61345
- else {
61346
- loader.value = {
61347
- name: icon,
61348
- abort: loadIcons([iconName], updateIconData),
61349
- };
61350
- }
61351
- }
61352
- return null;
61353
- }
61354
- // Icon data is available
61355
- abortLoading();
61356
- if (lastRenderedIconName.value !== icon) {
61357
- lastRenderedIconName.value = icon;
61358
- // Emit on next tick because render will be called on next tick
61359
- vue.nextTick(() => {
61360
- emit('load', icon);
61361
- });
61362
- }
61363
- // Customise icon
61364
- const customise = props.customise;
61365
- if (customise) {
61366
- // Clone data and customise it
61367
- data = Object.assign({}, data);
61368
- const customised = customise(data.body, iconName.name, iconName.prefix, iconName.provider);
61369
- if (typeof customised === 'string') {
61370
- data.body = customised;
61371
- }
61372
- }
61373
- // Add classes
61374
- const classes = ['iconify'];
61375
- if (iconName.prefix !== '') {
61376
- classes.push('iconify--' + iconName.prefix);
61377
- }
61378
- if (iconName.provider !== '') {
61379
- classes.push('iconify--' + iconName.provider);
61380
- }
61381
- return { data, classes };
61382
- }
61383
- function updateIconData() {
61384
- const icon = getIcon();
61385
- if (!icon) {
61386
- iconData.value = null;
61387
- }
61388
- else if (icon.data !== iconData.value?.data) {
61389
- iconData.value = icon;
61390
- }
61391
- }
61392
- // Set icon data
61393
- if (rendering.value) {
61394
- updateIconData();
61395
- }
61396
- else {
61397
- vue.onMounted(() => {
61398
- rendering.value = true;
61399
- updateIconData();
61400
- });
61401
- }
61402
- vue.watch(() => props.icon, updateIconData);
61403
- // Abort loading on unmount
61404
- vue.onUnmounted(abortLoading);
61405
- // Render function
61406
- return () => {
61407
- // Get icon data
61408
- const icon = iconData.value;
61409
- if (!icon) {
61410
- // Icon is not available
61411
- return render(emptyIcon, props);
61412
- }
61413
- // Add classes
61414
- let newProps = props;
61415
- if (icon.classes) {
61416
- newProps = {
61417
- ...props,
61418
- class: icon.classes.join(' '),
61419
- };
61420
- }
61421
- // Render icon
61422
- return render({
61423
- ...defaultIconProps,
61424
- ...icon.data,
61425
- }, newProps);
61426
- };
61427
- }, {
61428
- props: [
61429
- // Icon and render mode
61430
- 'icon',
61431
- 'mode',
61432
- 'ssr',
61433
- // Layout and style
61434
- 'width',
61435
- 'height',
61436
- 'style',
61437
- 'color',
61438
- 'inline',
61439
- // Transformations
61440
- 'rotate',
61441
- 'hFlip',
61442
- 'horizontalFlip',
61443
- 'vFlip',
61444
- 'verticalFlip',
61445
- 'flip',
61446
- // Misc
61447
- 'id',
61448
- 'ariaHidden',
61449
- 'customise',
61450
- 'title',
61451
- ],
61452
- emits: ['load'],
61453
- });
61454
-
61455
- function isIconifyIconData(icon) {
61456
- return typeof icon === "object" && icon !== null && "body" in icon && typeof icon.body === "string";
61457
- }
61458
- var IconifyIconOffline = vue.defineComponent({
61459
- name: "YcIconifyIconOffline",
61460
- components: { IconifyIcon: Icon },
61461
- props: {
61462
- icon: {
61463
- type: [String, Object, Function],
61464
- default: null
61465
- }
61466
- },
61467
- render() {
61468
- if (isIconifyIconData(this.icon)) {
61469
- const iconName = this.icon.name || "custom-icon";
61470
- addIcon(iconName, this.icon);
61471
- }
61472
- const attrs = this.$attrs;
61473
- if (typeof this.icon === "string") {
61474
- return vue.h(
61475
- Icon,
61476
- {
61477
- icon: this.icon,
61478
- "aria-hidden": false,
61479
- style: (attrs == null ? void 0 : attrs.style) ? Object.assign(attrs.style, { outline: "none" }) : { outline: "none" },
61480
- ...attrs
61481
- },
61482
- {
61483
- default: () => []
61484
- }
61485
- );
61486
- } else {
61487
- return vue.h(
61488
- this.icon,
61489
- {
61490
- "aria-hidden": false,
61491
- style: (attrs == null ? void 0 : attrs.style) ? Object.assign(attrs.style, { outline: "none" }) : { outline: "none" },
61492
- ...attrs
61493
- },
61494
- {
61495
- default: () => []
61496
- }
61497
- );
61498
- }
61499
- }
61500
- });
61501
-
61502
- var IconifyIconOnline = vue.defineComponent({
61503
- name: "YcIconifyIconOnline",
61504
- components: { IconifyIcon: Icon },
61505
- props: {
61506
- icon: {
61507
- type: String,
61508
- default: ""
61509
- }
61510
- },
61511
- render() {
61512
- const attrs = this.$attrs;
61513
- return vue.h(
61514
- Icon,
61515
- {
61516
- icon: `${this.icon}`,
61517
- "aria-hidden": false,
61518
- style: (attrs == null ? void 0 : attrs.style) ? Object.assign(attrs.style, { outline: "none" }) : { outline: "none" },
61519
- ...attrs
61520
- },
61521
- {
61522
- default: () => []
61523
- }
61524
- );
61525
- }
61526
- });
61527
-
61528
- var FontIcon = vue.defineComponent({
61529
- name: "YcFontIcon",
61530
- props: {
61531
- icon: {
61532
- type: String,
61533
- default: ""
61534
- }
61535
- },
61536
- render() {
61537
- const attrs = this.$attrs;
61538
- if (Object.keys(attrs).includes("uni") || (attrs == null ? void 0 : attrs.iconType) === "uni") {
61539
- return vue.h(
61540
- "i",
61541
- {
61542
- class: "iconfont",
61543
- ...attrs
61544
- },
61545
- this.icon
61546
- );
61547
- } else if (Object.keys(attrs).includes("svg") || (attrs == null ? void 0 : attrs.iconType) === "svg") {
61548
- return vue.h(
61549
- "svg",
61550
- {
61551
- class: "icon-svg"
61552
- },
61553
- {
61554
- default: () => [
61555
- vue.h("use", {
61556
- "xlink:href": `#${this.icon}`
61557
- })
61558
- ]
61559
- }
61560
- );
61561
- } else {
61562
- return vue.h("i", {
61563
- class: `iconfont ${this.icon}`,
61564
- ...attrs
61565
- });
61566
- }
61567
- }
61568
- });
61569
-
61570
- function isUrlIcon(icon) {
61571
- return /^https?:\/\//i.test(icon);
61572
- }
61573
- const UrlIconComponent = vue.defineComponent({
61574
- name: "YcUrlIcon",
61575
- props: {
61576
- src: { type: String, required: true },
61577
- size: { type: Number, default: 20 }
61578
- },
61579
- render() {
61580
- return vue.h("img", {
61581
- src: this.src,
61582
- class: "yc-url-icon",
61583
- style: {
61584
- width: `${this.size}px`,
61585
- height: `${this.size}px`,
61586
- objectFit: "contain"
61587
- },
61588
- alt: "icon"
61589
- });
61590
- }
61591
- });
61592
- function useRenderIcon(icon, attrs) {
61593
- const ifReg = /^IF-/;
61594
- if (isString$1(icon) && isUrlIcon(icon)) {
61595
- const attrSize = (attrs == null ? void 0 : attrs.width) || (attrs == null ? void 0 : attrs.height);
61596
- const size = typeof attrSize === "number" ? attrSize : 20;
61597
- return vue.h(UrlIconComponent, { src: icon, size });
61598
- }
61599
- if (isString$1(icon) && ifReg.test(icon)) {
61600
- const name = icon.split(ifReg)[1];
61601
- const iconName = name.slice(
61602
- 0,
61603
- name.indexOf(" ") == -1 ? name.length : name.indexOf(" ")
61604
- );
61605
- const iconType = name.slice(name.indexOf(" ") + 1, name.length);
61606
- return vue.defineComponent({
61607
- name: "YcFontIconWrapper",
61608
- render() {
61609
- return vue.h(FontIcon, {
61610
- icon: iconName,
61611
- iconType,
61612
- ...attrs
61613
- });
61614
- }
61615
- });
61616
- } else if (typeof icon === "function" || typeof (icon == null ? void 0 : icon.render) === "function") {
61617
- return attrs ? vue.h(icon, { ...attrs }) : icon;
61618
- } else if (typeof icon === "object") {
61619
- return vue.defineComponent({
61620
- name: "YcOfflineIconWrapper",
61621
- render() {
61622
- return vue.h(IconifyIconOffline, {
61623
- icon,
61624
- ...attrs
61625
- });
61626
- }
61627
- });
61628
- } else {
61629
- return vue.defineComponent({
61630
- name: "YcIconWrapper",
61631
- render() {
61632
- if (!icon) return;
61633
- const IconComponent = icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
61634
- return vue.h(IconComponent, {
61635
- icon,
61636
- ...attrs
61637
- });
61638
- }
61639
- });
61640
- }
61641
- }
61642
-
61643
- const YcIconifyIconOffline = IconifyIconOffline;
61644
- const YcIconifyIconOnline = IconifyIconOnline;
61645
- const YcFontIcon = FontIcon;
61646
-
61647
59599
  const version = "0.1.30";
61648
59600
 
61649
59601
  const install = installer.install;
@@ -61653,9 +59605,6 @@
61653
59605
  exports.DatePickerValueIsArrayList = DatePickerValueIsArrayList;
61654
59606
  exports.DefaultPageInfo = DefaultPageInfo;
61655
59607
  exports.DefaultPageSizeList = DefaultPageSizeList;
61656
- exports.FontIcon = YcFontIcon;
61657
- exports.IconifyIconOffline = YcIconifyIconOffline;
61658
- exports.IconifyIconOnline = YcIconifyIconOnline;
61659
59608
  exports.PlusBreadcrumb = PlusBreadcrumb;
61660
59609
  exports.PlusCheckCard = PlusCheckCard;
61661
59610
  exports.PlusCheckCardGroup = PlusCheckCardGroup;
@@ -61724,10 +59673,7 @@
61724
59673
  exports.YcDownloadDialogWithInstall = YcDownloadDialogWithInstall;
61725
59674
  exports.YcDrawer = YcDrawer;
61726
59675
  exports.YcFlicker = YcFlicker;
61727
- exports.YcFontIcon = YcFontIcon;
61728
59676
  exports.YcFormContainerHeader = YcFormContainerHeader;
61729
- exports.YcIconifyIconOffline = YcIconifyIconOffline;
61730
- exports.YcIconifyIconOnline = YcIconifyIconOnline;
61731
59677
  exports.YcLineTree = YcLineTree;
61732
59678
  exports.YcLineTreeWithInstall = YcLineTreeWithInstall;
61733
59679
  exports.YcMoreActions = YcMoreActions;
@@ -61772,7 +59718,6 @@
61772
59718
  exports.usePlusFormReset = usePlusFormReset;
61773
59719
  exports.usePlusProConfig = usePlusProConfig;
61774
59720
  exports.useRenderFlicker = useRenderFlicker;
61775
- exports.useRenderIcon = useRenderIcon;
61776
59721
  exports.useRenderReFlicker = useRenderFlicker;
61777
59722
  exports.useSelectWithMapping = useSelectWithMapping;
61778
59723
  exports.useSelectWithPagination = useSelectWithPagination;