UNPKG

lucide-solid

Version:

A Lucide icon library package for Solid applications

53 lines (48 loc) 1.95 kB
/** * @license lucide-solid v0.488.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ 'use strict'; var web = require('solid-js/web'); var solidJs = require('solid-js'); var defaultAttributes = require('./defaultAttributes.js'); var utils = require('./shared/src/utils.js'); var _tmpl$ = /*#__PURE__*/web.template(`<svg>`); const Icon = props => { const [localProps, rest] = solidJs.splitProps(props, ['color', 'size', 'strokeWidth', 'children', 'class', 'name', 'iconNode', 'absoluteStrokeWidth']); return (() => { var _el$ = _tmpl$(); web.spread(_el$, web.mergeProps(defaultAttributes, { get width() { return localProps.size ?? defaultAttributes.width; }, get height() { return localProps.size ?? defaultAttributes.height; }, get stroke() { return localProps.color ?? defaultAttributes.stroke; }, get ["stroke-width"]() { return web.memo(() => !!localProps.absoluteStrokeWidth)() ? Number(localProps.strokeWidth ?? defaultAttributes['stroke-width']) * 24 / Number(localProps.size) : Number(localProps.strokeWidth ?? defaultAttributes['stroke-width']); }, get ["class"]() { return utils.mergeClasses('lucide', 'lucide-icon', ...(localProps.name != null ? [`lucide-${utils.toKebabCase(utils.toPascalCase(localProps.name))}`, `lucide-${utils.toKebabCase(localProps.name)}`] : []), localProps.class != null ? localProps.class : ''); } }, rest), true, true); web.insert(_el$, web.createComponent(solidJs.For, { get each() { return localProps.iconNode; }, children: ([elementName, attrs]) => { return web.createComponent(web.Dynamic, web.mergeProps({ component: elementName }, attrs)); } })); return _el$; })(); }; module.exports = Icon; //# sourceMappingURL=Icon.js.map