phosphor-solid
Version:
A clean and friendly icon family for Solid-js
212 lines (152 loc) • 10.4 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="68" y1="32" x2="134" y2="164" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></line></svg>`, 4, true),
_tmpl$2 = template(`<svg><rect x="68" y="32" width="66" height="132" stroke-width="24" stroke-linecap="round" stroke-linejoin="round" fill="none"></rect></svg>`, 4, true),
_tmpl$3 = template(`<svg><path d="M134,164v66a66,66,0,0,1-66-66" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$4 = template(`<svg><path d="M134,164h8a66,66,0,0,0,0-132h-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$5 = template(`<svg><polygon points="68 32 68 164 134 164 68 32" opacity="0.2"></polygon></svg>`, 4, true),
_tmpl$6 = template(`<svg><line x1="68" y1="32" x2="134" y2="164" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line></svg>`, 4, true),
_tmpl$7 = template(`<svg><rect x="68" y="32" width="66" height="132" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" fill="none"></rect></svg>`, 4, true),
_tmpl$8 = template(`<svg><path d="M134,164v66a66,66,0,0,1-66-66" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$9 = template(`<svg><path d="M134,164h8a66,66,0,0,0,0-132h-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$10 = template(`<svg><path d="M134,164h8a66,66,0,0,0,0-132h-8Z" opacity="0.2"></path></svg>`, 4, true),
_tmpl$11 = template(`<svg><path d="M142,24H68c-.06836,0-.13477.00855-.20264.01026-.16162.004-.32275.01056-.48486.02447-.11377.00971-.22607.02387-.33838.03833-.14307.0185-.28613.039-.42871.06543-.13232.02429-.26221.05359-.39209.08435-.11865.02826-.23682.05725-.35449.09113-.15088.04315-.29883.09216-.4458.14386-.09668.034-.19287.06769-.28907.10565-.16113.06366-.31787.134-.47363.20764-.05566.02625-.11279.046-.168.07361-.03027.0152-.05761.03412-.08789.04968-.14795.0766-.2915.15979-.43408.24512-.0918.05481-.18457.10828-.27393.16626-.11572.07574-.22607.15729-.33789.23871-.10644.07776-.21435.15423-.3164.23657-.084.06811-.16309.14117-.24463.21258-.11719.10267-.23438.20472-.34473.31336-.06543.06445-.12549.13342-.18847.20007-.11426.12036-.228.2403-.3335.36682-.064.07611-.12158.15693-.18213.23542-.09424.12188-.18945.24267-.27637.36926-.07129.10406-.13476.21338-.20166.321-.06591.10669-.13427.21155-.19482.321-.0752.13513-.14111.27551-.2085.41528-.04248.08838-.08838.17493-.12744.26471-.0664.15186-.123.30841-.18017.465-.03125.08538-.06543.16943-.09375.25586-.04834.14813-.08741.2998-.127.45159-.02685.10328-.05664.20563-.07959.31-.02832.13-.04931.26233-.07129.39453-.02246.134-.04541.2674-.06152.40259-.01221.10742-.01855.21619-.02637.32483-.01269.16376-.023.32745-.0249.49225C60.00488,31.93187,60,31.96537,60,32V164a74.08385,74.08385,0,0,0,74,74,8.00008,8.00008,0,0,0,8-8V172a74,74,0,0,0,0-148ZM126,130.11137,80.94434,40H126ZM76.55176,172H126v49.4502A58.12735,58.12735,0,0,1,76.55176,172ZM142,156V40a58,58,0,0,1,0,116Z"></path></svg>`, 4, true),
_tmpl$12 = template(`<svg><line x1="68" y1="32" x2="134" y2="164" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></line></svg>`, 4, true),
_tmpl$13 = template(`<svg><rect x="68" y="32" width="66" height="132" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" fill="none"></rect></svg>`, 4, true),
_tmpl$14 = template(`<svg><path d="M134,164v66a66,66,0,0,1-66-66" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$15 = template(`<svg><path d="M134,164h8a66,66,0,0,0,0-132h-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$16 = template(`<svg><line x1="68" y1="32" x2="134" y2="164" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></line></svg>`, 4, true),
_tmpl$17 = template(`<svg><rect x="68" y="32" width="66" height="132" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" fill="none"></rect></svg>`, 4, true),
_tmpl$18 = template(`<svg><path d="M134,164v66a66,66,0,0,1-66-66" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$19 = template(`<svg><path d="M134,164h8a66,66,0,0,0,0-132h-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$20 = template(`<svg><g><line x1="68" y1="32" x2="134" y2="164" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line><rect x="68" y="32" width="66" height="132" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" fill="none"></rect><path d="M134,164v66a66,66,0,0,1-66-66" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path><path d="M134,164h8a66,66,0,0,0,0-132h-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></g></svg>`, 12, true),
_tmpl$21 = 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 [_tmpl$5.cloneNode(true), 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;
}(), function () {
var _el$9 = _tmpl$9.cloneNode(true);
setAttribute(_el$9, "stroke", color);
return _el$9;
}(), _tmpl$10.cloneNode(true)];
case "fill":
return _tmpl$11.cloneNode(true);
case "light":
return [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;
}(), 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;
}()];
case "thin":
return [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;
}(), function () {
var _el$18 = _tmpl$18.cloneNode(true);
setAttribute(_el$18, "stroke", color);
return _el$18;
}(), function () {
var _el$19 = _tmpl$19.cloneNode(true);
setAttribute(_el$19, "stroke", color);
return _el$19;
}()];
case "regular":
return function () {
var _el$20 = _tmpl$20.cloneNode(true),
_el$21 = _el$20.firstChild,
_el$22 = _el$21.nextSibling,
_el$23 = _el$22.nextSibling,
_el$24 = _el$23.nextSibling;
setAttribute(_el$21, "stroke", color);
setAttribute(_el$22, "stroke", color);
setAttribute(_el$23, "stroke", color);
setAttribute(_el$24, "stroke", color);
return _el$20;
}();
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var PhosphorLogo = function PhosphorLogo(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$25 = _tmpl$21.cloneNode(true),
_el$26 = _el$25.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$25) : ref = _el$25;
setAttribute(_el$25, "width", size != null ? size : contextSize);
setAttribute(_el$25, "height", size != null ? size : contextSize);
setAttribute(_el$25, "fill", color != null ? color : contextColor);
setAttribute(_el$25, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$25, restContext, true, true);
spread(_el$25, restProps, true, true);
insert(_el$25, children, _el$26);
insert(_el$25, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$25;
}();
};
export default PhosphorLogo;
//# sourceMappingURL=PhosphorLogo.esm.js.map