phosphor-solid
Version:
A clean and friendly icon family for Solid-js
115 lines (82 loc) • 5.02 kB
JavaScript
import { useContext } from 'solid-js';
import { IconContext } from '../lib/index.esm.js';
import { template, setAttribute, spread, insert } from 'solid-js/web';
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.js';
const _tmpl$ = template(`<svg><path d="M24,92.8S56,48,104,48c104,0,96,160,0,160-64,0-64-96,32-96,64,0,104,48,104,48" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$2 = template(`<svg><path d="M24,92.8S56,48,104,48c104,0,96,160,0,160-64,0-64-96,32-96,64,0,104,48,104,48" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$3 = template(`<svg><path d="M246.14551,154.87842c-1.24219-1.49072-22.92774-27.03711-59.82129-41.3501C184.21387,95.708,177.43262,79.4668,166.709,66.91113,151.6709,49.30566,129.98633,40,104,40,52.47559,40,18.89453,86.18408,17.49023,88.1499A8.00013,8.00013,0,0,0,30.50293,97.46C30.80078,97.04541,60.8125,56,104,56c21.16113,0,38.63867,7.36621,50.542,21.30273a69.15627,69.15627,0,0,1,14.69629,30.792A136.9288,136.9288,0,0,0,136,104c-26.06055,0-47.93848,6.80957-63.26758,19.69189-13.55957,11.39551-21.33691,27.27149-21.33691,43.55665a47.58841,47.58841,0,0,0,13.87207,34.05468C74.92871,210.918,88.32227,216,104,216c25.22266,0,46.68848-9.97607,62.0752-28.84961,12.21484-14.98291,19.65136-35.09668,20.79882-55.90185,29.38184,13.26708,46.73145,33.57617,46.98047,33.873a7.99987,7.99987,0,1,0,12.291-10.24316ZM104,200c-25.28613,0-36.60449-16.44922-36.60449-32.75146C67.39551,144.49219,88.86426,120,136,120a120.00113,120.00113,0,0,1,35.0293,5.27344c0,.10937.001.22021.001.32959C171.03027,162.57373,148.00586,200,104,200Z"></path></svg>`, 4, true),
_tmpl$4 = template(`<svg><path d="M24,92.8S56,48,104,48c104,0,96,160,0,160-64,0-64-96,32-96,64,0,104,48,104,48" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$5 = template(`<svg><path d="M24,92.8S56,48,104,48c104,0,96,160,0,160-64,0-64-96,32-96,64,0,104,48,104,48" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$6 = template(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect></svg>`, 4);
var renderPathFor = function renderPathFor(weight, color) {
switch (weight) {
case "bold":
return function () {
var _el$ = _tmpl$.cloneNode(true);
setAttribute(_el$, "stroke", color);
return _el$;
}();
case "duotone":
return function () {
var _el$2 = _tmpl$2.cloneNode(true);
setAttribute(_el$2, "stroke", color);
return _el$2;
}();
case "fill":
return _tmpl$3.cloneNode(true);
case "light":
return function () {
var _el$4 = _tmpl$4.cloneNode(true);
setAttribute(_el$4, "stroke", color);
return _el$4;
}();
case "thin":
return function () {
var _el$5 = _tmpl$5.cloneNode(true);
setAttribute(_el$5, "stroke", color);
return _el$5;
}();
case "regular":
return function () {
var _el$6 = _tmpl$2.cloneNode(true);
setAttribute(_el$6, "stroke", color);
return _el$6;
}();
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var ScribbleLoop = function ScribbleLoop(props, ref) {
var color = props.color,
size = props.size,
weight = props.weight,
mirrored = props.mirrored,
children = props.children,
restProps = _objectWithoutPropertiesLoose(props, ["color", "size", "weight", "mirrored", "children"]);
var _useContext = useContext(IconContext),
contextColor = _useContext.color,
contextSize = _useContext.size,
contextWeight = _useContext.weight,
contextMirrored = _useContext.mirrored,
restContext = _objectWithoutPropertiesLoose(_useContext, ["color", "size", "weight", "mirrored"]);
return function () {
var _el$7 = _tmpl$6.cloneNode(true),
_el$8 = _el$7.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$7) : ref = _el$7;
setAttribute(_el$7, "width", size != null ? size : contextSize);
setAttribute(_el$7, "height", size != null ? size : contextSize);
setAttribute(_el$7, "fill", color != null ? color : contextColor);
setAttribute(_el$7, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$7, restContext, true, true);
spread(_el$7, restProps, true, true);
insert(_el$7, children, _el$8);
insert(_el$7, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$7;
}();
};
export default ScribbleLoop;
//# sourceMappingURL=ScribbleLoop.esm.js.map