phosphor-solid
Version:
A clean and friendly icon family for Solid-js
149 lines (106 loc) • 6.57 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><line x1="128" y1="40" x2="128" y2="216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></line></svg>`, 4, true),
_tmpl$2 = template(`<svg><polyline points="56 144 128 216 200 144" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></polyline></svg>`, 4, true),
_tmpl$3 = template(`<svg><line x1="128" y1="40" x2="128" y2="216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line></svg>`, 4, true),
_tmpl$4 = template(`<svg><polyline points="56 144 128 216 200 144" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline></svg>`, 4, true),
_tmpl$5 = template(`<svg><path d="M205.65674,138.34277a8.00182,8.00182,0,0,0-11.31348,0L136,196.68652V40a8,8,0,0,0-16,0V196.68652L61.65674,138.34277a8.00018,8.00018,0,0,0-11.31348,11.31446l72,72c.02588.02612.05469.0476.08106.07324.16211.158.32861.31128.50341.45508.09766.08032.20118.15039.30176.22534.1084.08105.21485.16528.32764.241.11621.07788.2373.1455.35693.21679.10449.06226.20655.12793.31446.18579.12011.06421.24414.1189.36669.17676.11426.054.22657.11084.34327.15942.11816.04883.23925.08838.35937.13135.126.04541.251.09375.37988.13282.11963.03613.24122.06274.36231.09326.13183.0332.26269.07031.397.09692.13965.02759.28028.04419.42041.06421.11817.01685.23389.03931.353.051.26269.02587.52588.03979.78955.03979s.52686-.01392.78955-.03979c.11914-.01172.23486-.03418.353-.051.14013-.02.28076-.03662.42041-.06421.13428-.02661.26513-.06372.397-.09692.12109-.03052.24268-.05713.36231-.09326.1289-.03907.2539-.08741.37988-.13282.12012-.043.24121-.08252.35937-.13135.1167-.04858.229-.10546.34327-.15942.12255-.05786.24658-.11255.36669-.17676.10791-.05786.21-.12353.31446-.18579.11963-.07129.24072-.13891.35693-.21679.11279-.07569.21924-.15992.32764-.241.10058-.075.2041-.145.30176-.22534.17822-.14624.34765-.30225.51269-.46338.023-.02271.04883-.04175.07178-.06494l72-72A8.00034,8.00034,0,0,0,205.65674,138.34277Z"></path></svg>`, 4, true),
_tmpl$6 = template(`<svg><line x1="128" y1="40" x2="128" y2="216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></line></svg>`, 4, true),
_tmpl$7 = template(`<svg><polyline points="56 144 128 216 200 144" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></polyline></svg>`, 4, true),
_tmpl$8 = template(`<svg><line x1="128" y1="40" x2="128" y2="216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></line></svg>`, 4, true),
_tmpl$9 = template(`<svg><polyline points="56 144 128 216 200 144" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></polyline></svg>`, 4, true),
_tmpl$10 = 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 [function () {
var _el$3 = _tmpl$3.cloneNode(true);
setAttribute(_el$3, "stroke", color);
return _el$3;
}(), function () {
var _el$4 = _tmpl$4.cloneNode(true);
setAttribute(_el$4, "stroke", color);
return _el$4;
}()];
case "fill":
return _tmpl$5.cloneNode(true);
case "light":
return [function () {
var _el$6 = _tmpl$6.cloneNode(true);
setAttribute(_el$6, "stroke", color);
return _el$6;
}(), function () {
var _el$7 = _tmpl$7.cloneNode(true);
setAttribute(_el$7, "stroke", color);
return _el$7;
}()];
case "thin":
return [function () {
var _el$8 = _tmpl$8.cloneNode(true);
setAttribute(_el$8, "stroke", color);
return _el$8;
}(), function () {
var _el$9 = _tmpl$9.cloneNode(true);
setAttribute(_el$9, "stroke", color);
return _el$9;
}()];
case "regular":
return [function () {
var _el$10 = _tmpl$3.cloneNode(true);
setAttribute(_el$10, "stroke", color);
return _el$10;
}(), function () {
var _el$11 = _tmpl$4.cloneNode(true);
setAttribute(_el$11, "stroke", color);
return _el$11;
}()];
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var ArrowDown = function ArrowDown(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$12 = _tmpl$10.cloneNode(true),
_el$13 = _el$12.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$12) : ref = _el$12;
setAttribute(_el$12, "width", size != null ? size : contextSize);
setAttribute(_el$12, "height", size != null ? size : contextSize);
setAttribute(_el$12, "fill", color != null ? color : contextColor);
setAttribute(_el$12, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$12, restContext, true, true);
spread(_el$12, restProps, true, true);
insert(_el$12, children, _el$13);
insert(_el$12, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$12;
}();
};
export default ArrowDown;
//# sourceMappingURL=ArrowDown.esm.js.map