lucide 0.98.0 → 0.100.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.
- package/dist/cjs/lucide.js +36 -43
- package/dist/cjs/lucide.js.map +1 -1
- package/dist/esm/createElement.js +3 -7
- package/dist/esm/icons/baby.js +2 -2
- package/dist/esm/icons/index.js +1 -0
- package/dist/esm/icons/monitor-smartphone.js +15 -0
- package/dist/esm/lucide.js +9 -13
- package/dist/esm/replaceElement.js +8 -20
- package/dist/lucide.d.ts +1 -0
- package/dist/umd/lucide.js +36 -43
- package/dist/umd/lucide.js.map +1 -1
- package/dist/umd/lucide.min.js +2 -2
- package/dist/umd/lucide.min.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/lucide.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lucide v0.
|
|
2
|
+
* lucide v0.100.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
|
-
|
|
62
|
-
|
|
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
|
-
|
|
129
|
-
|
|
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
|
-
|
|
141
|
-
|
|
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
|
});
|
|
@@ -1157,9 +1137,9 @@ var Axis3d = ['svg', defaultAttributes, [['path', {
|
|
|
1157
1137
|
var Axis3d$1 = Axis3d;
|
|
1158
1138
|
|
|
1159
1139
|
var Baby = ['svg', defaultAttributes, [['path', {
|
|
1160
|
-
d: 'M9 12h0'
|
|
1140
|
+
d: 'M9 12h0.01'
|
|
1161
1141
|
}], ['path', {
|
|
1162
|
-
d: 'M15 12h0'
|
|
1142
|
+
d: 'M15 12h0.01'
|
|
1163
1143
|
}], ['path', {
|
|
1164
1144
|
d: 'M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5'
|
|
1165
1145
|
}], ['path', {
|
|
@@ -7844,6 +7824,21 @@ var MonitorOff = ['svg', defaultAttributes, [['path', {
|
|
|
7844
7824
|
}]]];
|
|
7845
7825
|
var MonitorOff$1 = MonitorOff;
|
|
7846
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
|
+
|
|
7847
7842
|
var MonitorSpeaker = ['svg', defaultAttributes, [['path', {
|
|
7848
7843
|
d: 'M5.5 20H8'
|
|
7849
7844
|
}], ['path', {
|
|
@@ -12342,6 +12337,7 @@ var allIcons = /*#__PURE__*/Object.freeze({
|
|
|
12342
12337
|
MinusSquare: MinusSquare$1,
|
|
12343
12338
|
Minus: Minus$1,
|
|
12344
12339
|
MonitorOff: MonitorOff$1,
|
|
12340
|
+
MonitorSmartphone: MonitorSmartphone$1,
|
|
12345
12341
|
MonitorSpeaker: MonitorSpeaker$1,
|
|
12346
12342
|
Monitor: Monitor$1,
|
|
12347
12343
|
Moon: Moon$1,
|
|
@@ -12648,24 +12644,20 @@ var allIcons = /*#__PURE__*/Object.freeze({
|
|
|
12648
12644
|
* Replaces all elements with matching nameAttr with the defined icons
|
|
12649
12645
|
* @param {{ icons?: object, nameAttr?: string, attrs?: object }} options
|
|
12650
12646
|
*/
|
|
12651
|
-
|
|
12652
12647
|
var createIcons = function createIcons(_temp) {
|
|
12653
12648
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
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;
|
|
12661
12655
|
if (!Object.values(icons).length) {
|
|
12662
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});`");
|
|
12663
12657
|
}
|
|
12664
|
-
|
|
12665
12658
|
if (typeof document === 'undefined') {
|
|
12666
12659
|
throw new Error('`createIcons()` only works in a browser environment.');
|
|
12667
12660
|
}
|
|
12668
|
-
|
|
12669
12661
|
var elementsToReplace = document.querySelectorAll("[" + nameAttr + "]");
|
|
12670
12662
|
Array.from(elementsToReplace).forEach(function (element) {
|
|
12671
12663
|
return replaceElement(element, {
|
|
@@ -13243,6 +13235,7 @@ exports.MinusCircle = MinusCircle$1;
|
|
|
13243
13235
|
exports.MinusSquare = MinusSquare$1;
|
|
13244
13236
|
exports.Monitor = Monitor$1;
|
|
13245
13237
|
exports.MonitorOff = MonitorOff$1;
|
|
13238
|
+
exports.MonitorSmartphone = MonitorSmartphone$1;
|
|
13246
13239
|
exports.MonitorSpeaker = MonitorSpeaker$1;
|
|
13247
13240
|
exports.Moon = Moon$1;
|
|
13248
13241
|
exports.MoreHorizontal = MoreHorizontal$1;
|