phosphor-solid
Version:
A clean and friendly icon family for Solid-js
217 lines (154 loc) • 10.8 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><polyline points="200 88 224 64 200 40" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></polyline></svg>`, 4, true),
_tmpl$2 = template(`<svg><path d="M32,128A64,64,0,0,1,96,64H224" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$3 = template(`<svg><polyline points="56 168 32 192 56 216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></polyline></svg>`, 4, true),
_tmpl$4 = template(`<svg><path d="M224,128a64,64,0,0,1-64,64H32" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$5 = template(`<svg><polyline points="200 88 224 64 200 40" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline></svg>`, 4, true),
_tmpl$6 = template(`<svg><path d="M32,128A64,64,0,0,1,96,64H224" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$7 = template(`<svg><polyline points="56 168 32 192 56 216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline></svg>`, 4, true),
_tmpl$8 = template(`<svg><path d="M224,128a64,64,0,0,1-64,64H32" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$9 = template(`<svg><g><path d="M32,136a8.00039,8.00039,0,0,0,8-8A56.06322,56.06322,0,0,1,96,72H204.68628L194.34277,82.34326a8.00018,8.00018,0,0,0,11.31446,11.31348l24-24c.0271-.02686.04956-.05713.07617-.08447.15649-.16065.30908-.32569.45166-.49952.08423-.10254.15771-.21045.23608-.31591.07715-.10352.15747-.20459.22949-.312.082-.12255.15333-.24951.22779-.375.05859-.09863.12036-.19433.17456-.29541.06811-.127.12573-.25732.18652-.38671.05029-.10743.10425-.2129.1499-.32325.052-.12549.094-.25341.13941-.38086.04248-.11914.08838-.23632.12524-.35791.03882-.12841.06763-.25927.09986-.38916.03076-.123.06567-.24511.09057-.3706.03-.15088.04859-.30371.06958-.45654.0149-.106.0354-.21.0459-.31739a8.02276,8.02276,0,0,0,0-1.584c-.0105-.10742-.031-.21143-.0459-.31739-.021-.15283-.03955-.30566-.06958-.45654-.0249-.12549-.05981-.24756-.09057-.3706-.03223-.12989-.061-.26075-.09986-.38916-.03686-.12159-.08276-.23877-.12524-.35791-.04541-.12745-.0874-.25537-.13941-.38086-.04565-.11035-.09961-.21582-.1499-.32325-.06079-.12939-.11841-.25976-.18652-.38671-.0542-.10108-.116-.19678-.17456-.29541-.07446-.12549-.14575-.25245-.22779-.375-.072-.10743-.15234-.2085-.22949-.312-.07837-.10546-.15185-.21337-.23608-.31591-.14527-.17725-.30054-.34522-.46021-.50928-.02368-.02393-.0437-.05078-.06762-.07471l-24-24a8.00018,8.00018,0,1,0-11.31446,11.31348L204.68628,56H96a72.08124,72.08124,0,0,0-72,72A8.00039,8.00039,0,0,0,32,136Z"></path><path d="M224,120a8.00039,8.00039,0,0,0-8,8,56.06322,56.06322,0,0,1-56,56H51.31372l10.34351-10.34326a8.00018,8.00018,0,0,0-11.31446-11.31348l-24,24c-.02392.02393-.04394.05078-.06762.07471-.15967.16406-.31494.332-.46021.50928-.08423.10254-.15771.21045-.23608.31591-.07715.10352-.15747.20459-.22949.312-.082.12255-.15333.24951-.22779.375-.05859.09863-.12036.19433-.17456.29541-.06811.12695-.12573.25732-.18652.38671-.05029.10743-.10425.2129-.1499.32325-.052.12549-.094.25341-.13941.38086-.04248.11914-.08838.23632-.12524.35791-.03882.12841-.06763.25927-.09986.38916-.03076.123-.06567.24511-.09057.3706-.03.15088-.04859.30371-.06958.45654-.0149.106-.0354.21-.0459.31739a8.02276,8.02276,0,0,0,0,1.584c.0105.10742.031.21143.0459.31739.021.15283.03955.30566.06958.45654.0249.12549.05981.24756.09057.3706.03223.12989.061.26075.09986.38916.03686.12159.08276.23877.12524.35791.04541.12745.0874.25537.13941.38086.04565.11035.09961.21582.1499.32325.06079.12939.11841.25976.18652.38671.0542.10108.116.19678.17456.29541.07446.12549.14575.25245.22779.375.072.10743.15234.2085.22949.312.07837.10546.15185.21337.23608.31591.14258.17383.29517.33887.45166.49952.02661.02734.04907.05761.07617.08447l24,24a8.00018,8.00018,0,1,0,11.31446-11.31348L51.31372,200H160a72.08124,72.08124,0,0,0,72-72A8.00039,8.00039,0,0,0,224,120Z"></path></g></svg>`, 8, true),
_tmpl$10 = template(`<svg><polyline points="200 88 224 64 200 40" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></polyline></svg>`, 4, true),
_tmpl$11 = template(`<svg><path d="M32,128A64,64,0,0,1,96,64H224" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$12 = template(`<svg><polyline points="56 168 32 192 56 216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></polyline></svg>`, 4, true),
_tmpl$13 = template(`<svg><path d="M224,128a64,64,0,0,1-64,64H32" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$14 = template(`<svg><polyline points="200 88 224 64 200 40" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></polyline></svg>`, 4, true),
_tmpl$15 = template(`<svg><path d="M32,128A64,64,0,0,1,96,64H224" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$16 = template(`<svg><polyline points="56 168 32 192 56 216" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></polyline></svg>`, 4, true),
_tmpl$17 = template(`<svg><path d="M224,128a64,64,0,0,1-64,64H32" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$18 = 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;
}(), 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 "duotone":
return [function () {
var _el$5 = _tmpl$5.cloneNode(true);
setAttribute(_el$5, "stroke", color);
return _el$5;
}(), 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;
}(), function () {
var _el$8 = _tmpl$8.cloneNode(true);
setAttribute(_el$8, "stroke", color);
return _el$8;
}()];
case "fill":
return _tmpl$9.cloneNode(true);
case "light":
return [function () {
var _el$10 = _tmpl$10.cloneNode(true);
setAttribute(_el$10, "stroke", color);
return _el$10;
}(), function () {
var _el$11 = _tmpl$11.cloneNode(true);
setAttribute(_el$11, "stroke", color);
return _el$11;
}(), function () {
var _el$12 = _tmpl$12.cloneNode(true);
setAttribute(_el$12, "stroke", color);
return _el$12;
}(), function () {
var _el$13 = _tmpl$13.cloneNode(true);
setAttribute(_el$13, "stroke", color);
return _el$13;
}()];
case "thin":
return [function () {
var _el$14 = _tmpl$14.cloneNode(true);
setAttribute(_el$14, "stroke", color);
return _el$14;
}(), function () {
var _el$15 = _tmpl$15.cloneNode(true);
setAttribute(_el$15, "stroke", color);
return _el$15;
}(), function () {
var _el$16 = _tmpl$16.cloneNode(true);
setAttribute(_el$16, "stroke", color);
return _el$16;
}(), function () {
var _el$17 = _tmpl$17.cloneNode(true);
setAttribute(_el$17, "stroke", color);
return _el$17;
}()];
case "regular":
return [function () {
var _el$18 = _tmpl$5.cloneNode(true);
setAttribute(_el$18, "stroke", color);
return _el$18;
}(), function () {
var _el$19 = _tmpl$6.cloneNode(true);
setAttribute(_el$19, "stroke", color);
return _el$19;
}(), function () {
var _el$20 = _tmpl$7.cloneNode(true);
setAttribute(_el$20, "stroke", color);
return _el$20;
}(), function () {
var _el$21 = _tmpl$8.cloneNode(true);
setAttribute(_el$21, "stroke", color);
return _el$21;
}()];
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var Repeat = function Repeat(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$22 = _tmpl$18.cloneNode(true),
_el$23 = _el$22.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$22) : ref = _el$22;
setAttribute(_el$22, "width", size != null ? size : contextSize);
setAttribute(_el$22, "height", size != null ? size : contextSize);
setAttribute(_el$22, "fill", color != null ? color : contextColor);
setAttribute(_el$22, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$22, restContext, true, true);
spread(_el$22, restProps, true, true);
insert(_el$22, children, _el$23);
insert(_el$22, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$22;
}();
};
export default Repeat;
//# sourceMappingURL=Repeat.esm.js.map