lucide 0.97.0 → 0.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,19 @@
1
1
  /**
2
- * lucide v0.97.0 - ISC
2
+ * lucide v0.99.0 - ISC
3
3
  */
4
4
 
5
5
  'use strict';
6
6
 
7
- Object.defineProperty(exports, '__esModule', { value: true });
8
-
9
7
  function _extends() {
10
8
  _extends = Object.assign ? Object.assign.bind() : function (target) {
11
9
  for (var i = 1; i < arguments.length; i++) {
12
10
  var source = arguments[i];
13
-
14
11
  for (var key in source) {
15
12
  if (Object.prototype.hasOwnProperty.call(source, key)) {
16
13
  target[key] = source[key];
17
14
  }
18
15
  }
19
16
  }
20
-
21
17
  return target;
22
18
  };
23
19
  return _extends.apply(this, arguments);
@@ -34,32 +30,28 @@ var createElement = function createElement(tag, attrs, children) {
34
30
  if (children === void 0) {
35
31
  children = [];
36
32
  }
37
-
38
33
  var element = document.createElementNS('http://www.w3.org/2000/svg', tag);
39
34
  Object.keys(attrs).forEach(function (name) {
40
35
  element.setAttribute(name, attrs[name]);
41
36
  });
42
-
43
37
  if (children.length) {
44
38
  children = children.forEach(function (child) {
45
39
  var childElement = createElement.apply(void 0, child);
46
40
  element.appendChild(childElement);
47
41
  });
48
42
  }
49
-
50
43
  return element;
51
44
  };
45
+
52
46
  /**
53
47
  * Creates a new HTMLElement from icon node
54
48
  * @param {[tag: string, attrs: object, children: array]} iconNode
55
49
  * @returns {HTMLElement}
56
50
  */
57
-
58
-
59
51
  var createElement$1 = (function (_ref) {
60
52
  var tag = _ref[0],
61
- attrs = _ref[1],
62
- children = _ref[2];
53
+ attrs = _ref[1],
54
+ children = _ref[2];
63
55
  return createElement(tag, attrs, children);
64
56
  });
65
57
 
@@ -68,39 +60,35 @@ var createElement$1 = (function (_ref) {
68
60
  * @param {HTMLElement} element
69
61
  * @returns {Object}
70
62
  */
71
-
72
63
  var getAttrs = function getAttrs(element) {
73
64
  return Array.from(element.attributes).reduce(function (attrs, attr) {
74
65
  attrs[attr.name] = attr.value;
75
66
  return attrs;
76
67
  }, {});
77
68
  };
69
+
78
70
  /**
79
71
  * Gets the classNames of an attributes Object.
80
72
  * @param {Object} attrs
81
73
  * @returns {Array}
82
74
  */
83
-
84
75
  var getClassNames = function getClassNames(attrs) {
85
76
  if (typeof attrs === 'string') return attrs;
86
77
  if (!attrs || !attrs["class"]) return '';
87
-
88
78
  if (attrs["class"] && typeof attrs["class"] === 'string') {
89
79
  return attrs["class"].split(' ');
90
80
  }
91
-
92
81
  if (attrs["class"] && Array.isArray(attrs["class"])) {
93
82
  return attrs["class"];
94
83
  }
95
-
96
84
  return '';
97
85
  };
86
+
98
87
  /**
99
88
  * Combines the classNames of array of classNames to a String
100
89
  * @param {array} arrayOfClassnames
101
90
  * @returns {string}
102
91
  */
103
-
104
92
  var combineClassNames = function combineClassNames(arrayOfClassnames) {
105
93
  var classNameArray = arrayOfClassnames.flatMap(getClassNames);
106
94
  return classNameArray.map(function (classItem) {
@@ -109,47 +97,39 @@ var combineClassNames = function combineClassNames(arrayOfClassnames) {
109
97
  return self.indexOf(value) === index;
110
98
  }).join(' ');
111
99
  };
112
-
113
100
  var toPascalCase = function toPascalCase(string) {
114
101
  return string.replace(/(\w)(\w*)(_|-|\s*)/g, function (g0, g1, g2) {
115
102
  return g1.toUpperCase() + g2.toLowerCase();
116
103
  });
117
104
  };
105
+
118
106
  /**
119
107
  * ReplaceElement, replaces the given element with the created icon.
120
108
  * @param {HTMLElement} element
121
109
  * @param {{ nameAttr: string, icons: object, attrs: object }} options: { nameAttr, icons, attrs }
122
110
  * @returns {Function}
123
111
  */
124
-
125
-
126
112
  var replaceElement = (function (element, _ref) {
127
113
  var nameAttr = _ref.nameAttr,
128
- icons = _ref.icons,
129
- attrs = _ref.attrs;
114
+ icons = _ref.icons,
115
+ attrs = _ref.attrs;
130
116
  var iconName = element.getAttribute(nameAttr);
131
117
  var ComponentName = toPascalCase(iconName);
132
118
  var iconNode = icons[ComponentName];
133
-
134
119
  if (!iconNode) {
135
120
  return console.warn(element.outerHTML + " icon name was not found in the provided icons object.");
136
121
  }
137
-
138
122
  var elementAttrs = getAttrs(element);
139
123
  var tag = iconNode[0],
140
- iconAttributes = iconNode[1],
141
- children = iconNode[2];
142
-
124
+ iconAttributes = iconNode[1],
125
+ children = iconNode[2];
143
126
  var iconAttrs = _extends({}, iconAttributes, {
144
127
  'icon-name': iconName
145
128
  }, attrs, elementAttrs);
146
-
147
129
  var classNames = combineClassNames(['lucide', "lucide-" + iconName, elementAttrs, attrs]);
148
-
149
130
  if (classNames) {
150
131
  iconAttrs["class"] = classNames;
151
132
  }
152
-
153
133
  var svgElement = createElement$1([tag, iconAttrs, children]);
154
134
  return element.parentNode.replaceChild(svgElement, element);
155
135
  });
@@ -3958,6 +3938,23 @@ var Drumstick = ['svg', defaultAttributes, [['path', {
3958
3938
  }]]];
3959
3939
  var Drumstick$1 = Drumstick;
3960
3940
 
3941
+ var Dumbbell = ['svg', defaultAttributes, [['path', {
3942
+ d: 'm6.5 6.5 11 11'
3943
+ }], ['path', {
3944
+ d: 'm21 21-1-1'
3945
+ }], ['path', {
3946
+ d: 'm3 3 1 1'
3947
+ }], ['path', {
3948
+ d: 'm18 22 4-4'
3949
+ }], ['path', {
3950
+ d: 'm2 6 4-4'
3951
+ }], ['path', {
3952
+ d: 'm3 10 7-7'
3953
+ }], ['path', {
3954
+ d: 'm14 21 7-7'
3955
+ }]]];
3956
+ var Dumbbell$1 = Dumbbell;
3957
+
3961
3958
  var EarOff = ['svg', defaultAttributes, [['path', {
3962
3959
  d: 'M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46'
3963
3960
  }], ['path', {
@@ -7827,6 +7824,21 @@ var MonitorOff = ['svg', defaultAttributes, [['path', {
7827
7824
  }]]];
7828
7825
  var MonitorOff$1 = MonitorOff;
7829
7826
 
7827
+ var MonitorSmartphone = ['svg', defaultAttributes, [['path', {
7828
+ d: 'M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8'
7829
+ }], ['path', {
7830
+ d: 'M10 19v-3.96 3.15'
7831
+ }], ['path', {
7832
+ d: 'M7 19h5'
7833
+ }], ['rect', {
7834
+ x: '16',
7835
+ y: '12',
7836
+ width: '6',
7837
+ height: '10',
7838
+ rx: '2'
7839
+ }]]];
7840
+ var MonitorSmartphone$1 = MonitorSmartphone;
7841
+
7830
7842
  var MonitorSpeaker = ['svg', defaultAttributes, [['path', {
7831
7843
  d: 'M5.5 20H8'
7832
7844
  }], ['path', {
@@ -12035,6 +12047,7 @@ var allIcons = /*#__PURE__*/Object.freeze({
12035
12047
  Droplet: Droplet$1,
12036
12048
  Droplets: Droplets$1,
12037
12049
  Drumstick: Drumstick$1,
12050
+ Dumbbell: Dumbbell$1,
12038
12051
  EarOff: EarOff$1,
12039
12052
  Ear: Ear$1,
12040
12053
  Edit2: Edit2$1,
@@ -12324,6 +12337,7 @@ var allIcons = /*#__PURE__*/Object.freeze({
12324
12337
  MinusSquare: MinusSquare$1,
12325
12338
  Minus: Minus$1,
12326
12339
  MonitorOff: MonitorOff$1,
12340
+ MonitorSmartphone: MonitorSmartphone$1,
12327
12341
  MonitorSpeaker: MonitorSpeaker$1,
12328
12342
  Monitor: Monitor$1,
12329
12343
  Moon: Moon$1,
@@ -12630,24 +12644,20 @@ var allIcons = /*#__PURE__*/Object.freeze({
12630
12644
  * Replaces all elements with matching nameAttr with the defined icons
12631
12645
  * @param {{ icons?: object, nameAttr?: string, attrs?: object }} options
12632
12646
  */
12633
-
12634
12647
  var createIcons = function createIcons(_temp) {
12635
12648
  var _ref = _temp === void 0 ? {} : _temp,
12636
- _ref$icons = _ref.icons,
12637
- icons = _ref$icons === void 0 ? allIcons : _ref$icons,
12638
- _ref$nameAttr = _ref.nameAttr,
12639
- nameAttr = _ref$nameAttr === void 0 ? 'icon-name' : _ref$nameAttr,
12640
- _ref$attrs = _ref.attrs,
12641
- attrs = _ref$attrs === void 0 ? {} : _ref$attrs;
12642
-
12649
+ _ref$icons = _ref.icons,
12650
+ icons = _ref$icons === void 0 ? allIcons : _ref$icons,
12651
+ _ref$nameAttr = _ref.nameAttr,
12652
+ nameAttr = _ref$nameAttr === void 0 ? 'icon-name' : _ref$nameAttr,
12653
+ _ref$attrs = _ref.attrs,
12654
+ attrs = _ref$attrs === void 0 ? {} : _ref$attrs;
12643
12655
  if (!Object.values(icons).length) {
12644
12656
  throw new Error("Please provide an icons object.\nIf you want to use all the icons you can import it like:\n `import { createIcons, icons } from 'lucide';\nlucide.createIcons({icons});`");
12645
12657
  }
12646
-
12647
12658
  if (typeof document === 'undefined') {
12648
12659
  throw new Error('`createIcons()` only works in a browser environment.');
12649
12660
  }
12650
-
12651
12661
  var elementsToReplace = document.querySelectorAll("[" + nameAttr + "]");
12652
12662
  Array.from(elementsToReplace).forEach(function (element) {
12653
12663
  return replaceElement(element, {
@@ -12934,6 +12944,7 @@ exports.Dribbble = Dribbble$1;
12934
12944
  exports.Droplet = Droplet$1;
12935
12945
  exports.Droplets = Droplets$1;
12936
12946
  exports.Drumstick = Drumstick$1;
12947
+ exports.Dumbbell = Dumbbell$1;
12937
12948
  exports.Ear = Ear$1;
12938
12949
  exports.EarOff = EarOff$1;
12939
12950
  exports.Edit = Edit$1;
@@ -13224,6 +13235,7 @@ exports.MinusCircle = MinusCircle$1;
13224
13235
  exports.MinusSquare = MinusSquare$1;
13225
13236
  exports.Monitor = Monitor$1;
13226
13237
  exports.MonitorOff = MonitorOff$1;
13238
+ exports.MonitorSmartphone = MonitorSmartphone$1;
13227
13239
  exports.MonitorSpeaker = MonitorSpeaker$1;
13228
13240
  exports.Moon = Moon$1;
13229
13241
  exports.MoreHorizontal = MoreHorizontal$1;