phosphor-solid
Version:
A clean and friendly icon family for Solid-js
150 lines (107 loc) • 7.25 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><circle cx="128" cy="128" r="84" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></circle></svg>`, 4, true),
_tmpl$2 = template(`<svg><path d="M179.45516,61.6015c30.106-8.94046,52.92047-8.81761,59.39609,2.3985C249.897,83.1317,209.22146,127.29479,148,162.641S28.19444,211.1317,17.14875,192c-6.47514-11.21527,4.82354-31.03251,27.61578-52.63295" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$3 = template(`<svg><circle cx="128" cy="128" r="88" opacity="0.2"></circle></svg>`, 4, true),
_tmpl$4 = template(`<svg><circle cx="128" cy="128" r="88" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></circle></svg>`, 4, true),
_tmpl$5 = template(`<svg><path d="M184.17224,60.25854c27.75785-7.55343,48.54608-6.88109,54.679,3.74146C249.897,83.1317,209.22146,127.29479,148,162.641S28.19444,211.1317,17.14875,192c-6.13187-10.6207,3.67551-28.95548,24.08867-49.21359" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$6 = template(`<svg><path d="M223.251,115.99854A96.03076,96.03076,0,0,1,128,224a95.50329,95.50329,0,0,1-57.96045-19.52515C94.58984,198.321,123.48145,186.03418,152,169.56934,180.542,153.09009,205.645,134.196,223.251,115.99854ZM245.7793,60c-5.46875-9.47119-20.31592-18.42773-59.82373-8.47852A95.94717,95.94717,0,0,0,32,128a96.48271,96.48271,0,0,0,.748,11.99414C4.41748,169.2085,4.75488,186.5332,10.2207,196c3.69336,6.39746,11.875,12.78809,29.81348,12.78809a117.6895,117.6895,0,0,0,25.47559-3.23243c1.49121-.33447,3.0039-.69824,4.52978-1.08081a96.84991,96.84991,0,0,1-14.24219-13.27978c-18.65527,3.31811-29.31591.96924-31.72021-3.19507-1.501-2.59961-.6582-7.48535,2.31152-13.4043a83.04134,83.04134,0,0,1,10.74121-15.61841,96.04543,96.04543,0,0,0,18.66748,32.21778q2.97071-.52845,6.20948-1.25171c23.94628-5.37207,53.06543-17.5293,81.99316-34.23047s54.01514-35.84082,70.6416-53.89258q2.27271-2.46827,4.228-4.79883a96.04556,96.04556,0,0,0-18.668-32.21752A83.29551,83.29551,0,0,1,219.1543,63.2998c6.61328.38672,11.26758,2.09961,12.76855,4.7002,2.40186,4.15967-.88428,14.54932-13.05322,29.02148a95.19186,95.19186,0,0,1,4.38135,18.97706c1.07959-1.11548,2.1372-2.229,3.15918-3.33838C251.69678,85.20508,250.90039,68.86914,245.7793,60Z"></path></svg>`, 4, true),
_tmpl$7 = template(`<svg><circle cx="128" cy="128" r="88" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></circle></svg>`, 4, true),
_tmpl$8 = template(`<svg><path d="M184.17224,60.25854c27.75785-7.55343,48.54608-6.88109,54.679,3.74146C249.897,83.1317,209.22146,127.29479,148,162.641S28.19444,211.1317,17.14875,192c-6.13187-10.6207,3.67551-28.95548,24.08867-49.21359" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$9 = template(`<svg><circle cx="128" cy="128" r="88" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></circle></svg>`, 4, true),
_tmpl$10 = template(`<svg><path d="M184.17224,60.25854c27.75785-7.55343,48.54608-6.88109,54.679,3.74146C249.897,83.1317,209.22146,127.29479,148,162.641S28.19444,211.1317,17.14875,192c-6.13187-10.6207,3.67551-28.95548,24.08867-49.21359" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$11 = 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$;
}(), function () {
var _el$2 = _tmpl$2.cloneNode(true);
setAttribute(_el$2, "stroke", color);
return _el$2;
}()];
case "duotone":
return [_tmpl$3.cloneNode(true), function () {
var _el$4 = _tmpl$4.cloneNode(true);
setAttribute(_el$4, "stroke", color);
return _el$4;
}(), function () {
var _el$5 = _tmpl$5.cloneNode(true);
setAttribute(_el$5, "stroke", color);
return _el$5;
}()];
case "fill":
return _tmpl$6.cloneNode(true);
case "light":
return [function () {
var _el$7 = _tmpl$7.cloneNode(true);
setAttribute(_el$7, "stroke", color);
return _el$7;
}(), function () {
var _el$8 = _tmpl$8.cloneNode(true);
setAttribute(_el$8, "stroke", color);
return _el$8;
}()];
case "thin":
return [function () {
var _el$9 = _tmpl$9.cloneNode(true);
setAttribute(_el$9, "stroke", color);
return _el$9;
}(), function () {
var _el$10 = _tmpl$10.cloneNode(true);
setAttribute(_el$10, "stroke", color);
return _el$10;
}()];
case "regular":
return [function () {
var _el$11 = _tmpl$4.cloneNode(true);
setAttribute(_el$11, "stroke", color);
return _el$11;
}(), function () {
var _el$12 = _tmpl$5.cloneNode(true);
setAttribute(_el$12, "stroke", color);
return _el$12;
}()];
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var Planet = function Planet(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$13 = _tmpl$11.cloneNode(true),
_el$14 = _el$13.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$13) : ref = _el$13;
setAttribute(_el$13, "width", size != null ? size : contextSize);
setAttribute(_el$13, "height", size != null ? size : contextSize);
setAttribute(_el$13, "fill", color != null ? color : contextColor);
setAttribute(_el$13, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$13, restContext, true, true);
spread(_el$13, restProps, true, true);
insert(_el$13, children, _el$14);
insert(_el$13, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$13;
}();
};
export default Planet;
//# sourceMappingURL=Planet.esm.js.map