phosphor-solid
Version:
A clean and friendly icon family for Solid-js
218 lines (155 loc) • 11.1 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="M80,159.99316H208a8,8,0,0,0,8-8v-104a8,8,0,0,0-8-8H96a8,8,0,0,0-8,8v8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$2 = template(`<svg><polyline points="104 136 80 160 104 184" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></polyline></svg>`, 4, true),
_tmpl$3 = template(`<svg><path d="M176,96H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H160a8,8,0,0,0,8-8v-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true),
_tmpl$4 = template(`<svg><polyline points="152 119.993 176 95.993 152 71.993" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></polyline></svg>`, 4, true),
_tmpl$5 = template(`<svg><path d="M208,40H96a8,8,0,0,0-8,8V96H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H160a8,8,0,0,0,8-8V160h40a8,8,0,0,0,8-8V48A8,8,0,0,0,208,40Z" opacity="0.2"></path></svg>`, 4, true),
_tmpl$6 = template(`<svg><path d="M80,159.99316H208a8,8,0,0,0,8-8v-104a8,8,0,0,0-8-8H96a8,8,0,0,0-8,8v8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$7 = template(`<svg><polyline points="104 136 80 160 104 184" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline></svg>`, 4, true),
_tmpl$8 = template(`<svg><path d="M176,96H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H160a8,8,0,0,0,8-8v-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true),
_tmpl$9 = template(`<svg><polyline points="152 119.993 176 95.993 152 71.993" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline></svg>`, 4, true),
_tmpl$10 = template(`<svg><path d="M224,47.99316v104a16.01833,16.01833,0,0,1-16,16H112V184a8.00018,8.00018,0,0,1-13.65674,5.65723l-24-24a7.98872,7.98872,0,0,1-1.36011-1.822c-.00622-.01124-.01367-.022-.01977-.03333-.10376-.192-.19556-.38843-.28259-.58655-.01892-.04309-.04114-.08435-.05921-.12768-.07483-.179-.13794-.36121-.19922-.54407-.0227-.06751-.04944-.13318-.07043-.20154-.0531-.17383-.09436-.34985-.13538-.52624-.01867-.08045-.04223-.15882-.05859-.24012-.03809-.19043-.06348-.38232-.08765-.57446-.00879-.06934-.023-.137-.02978-.20691-.02637-.26575-.04053-.53235-.04041-.79907L72,159.99316c0-.025.00342-.04907.00366-.07409.00244-.23572.0127-.47132.03577-.70606.01526-.15759.043-.31128.06726-.46618.01587-.09986.02612-.20032.04565-.29969.03565-.18139.083-.358.13062-.53479.01953-.072.03418-.145.05566-.21655.05591-.18652.123-.3678.1919-.54834.02331-.06116.04248-.12329.06738-.184.07739-.18884.16553-.37146.25659-.55286.02527-.05041.04688-.10229.07324-.15222.1084-.20459.22706-.40222.35218-.59582.0155-.024.02844-.04907.04431-.073a8.02882,8.02882,0,0,1,1.09057-1.31836l23.92847-23.92847A8.00037,8.00037,0,0,1,112,136v15.99316h96v-104H96v8a8,8,0,0,1-16,0v-8a16.01833,16.01833,0,0,1,16-16H208A16.01833,16.01833,0,0,1,224,47.99316ZM168,192a8.00008,8.00008,0,0,0-8,8v8H48V104h96v15.99316a8.00018,8.00018,0,0,0,13.65674,5.65723l23.92847-23.92847a8.0284,8.0284,0,0,0,1.09057-1.31836c.01587-.02392.02881-.049.04431-.073.12512-.19361.24378-.39124.35218-.59583.02648-.05017.04809-.10217.0736-.15283.09095-.18091.17884-.36316.256-.55164.02539-.06176.04492-.12524.06872-.1875.06848-.17968.13513-.35986.1908-.54541.02148-.07153.03613-.14453.05566-.21655.04761-.17676.095-.35339.13062-.53479.01953-.09936.02978-.19983.04565-.29968.02429-.15491.052-.3086.06726-.46619.02307-.23474.03333-.47034.03577-.70605C183.99658,96.04907,184,96.025,184,96l-.00012-.00208c.00012-.26672-.014-.53332-.04041-.79907-.00683-.06994-.021-.13757-.02978-.20691-.02417-.19214-.04956-.384-.08765-.57446-.01636-.0813-.03992-.15967-.05859-.24011-.041-.17639-.08228-.35242-.13538-.52625-.02087-.06787-.04748-.13305-.06995-.20019-.06152-.1836-.12475-.36634-.2-.5459-.01782-.04248-.0393-.08252-.05786-.12463-.08716-.1991-.17944-.39637-.28369-.58912-.0061-.01135-.01355-.02209-.01977-.03332a7.9885,7.9885,0,0,0-1.36011-1.822l-24-24A8.00037,8.00037,0,0,0,144,71.99316V88H48a16.01833,16.01833,0,0,0-16,16V208a16.01833,16.01833,0,0,0,16,16H160a16.01833,16.01833,0,0,0,16-16v-8A8.00008,8.00008,0,0,0,168,192Z"></path></svg>`, 4, true),
_tmpl$11 = template(`<svg><path d="M80,159.99316H208a8,8,0,0,0,8-8v-104a8,8,0,0,0-8-8H96a8,8,0,0,0-8,8v8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$12 = template(`<svg><polyline points="104 136 80 160 104 184" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></polyline></svg>`, 4, true),
_tmpl$13 = template(`<svg><path d="M176,96H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H160a8,8,0,0,0,8-8v-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true),
_tmpl$14 = template(`<svg><polyline points="152 119.993 176 95.993 152 71.993" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></polyline></svg>`, 4, true),
_tmpl$15 = template(`<svg><path d="M80,159.99316H208a8,8,0,0,0,8-8v-104a8,8,0,0,0-8-8H96a8,8,0,0,0-8,8v8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$16 = template(`<svg><polyline points="104 136 80 160 104 184" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></polyline></svg>`, 4, true),
_tmpl$17 = template(`<svg><path d="M176,96H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H160a8,8,0,0,0,8-8v-8" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true),
_tmpl$18 = template(`<svg><polyline points="152 119.993 176 95.993 152 71.993" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></polyline></svg>`, 4, true),
_tmpl$19 = 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;
}()];
case "fill":
return _tmpl$10.cloneNode(true);
case "light":
return [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;
}(), function () {
var _el$14 = _tmpl$14.cloneNode(true);
setAttribute(_el$14, "stroke", color);
return _el$14;
}()];
case "thin":
return [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;
}(), function () {
var _el$18 = _tmpl$18.cloneNode(true);
setAttribute(_el$18, "stroke", color);
return _el$18;
}()];
case "regular":
return [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;
}(), function () {
var _el$22 = _tmpl$9.cloneNode(true);
setAttribute(_el$22, "stroke", color);
return _el$22;
}()];
default:
console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
return null;
}
};
var Swap = function Swap(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$23 = _tmpl$19.cloneNode(true),
_el$24 = _el$23.firstChild;
var _ref$ = ref;
typeof _ref$ === "function" ? _ref$(_el$23) : ref = _el$23;
setAttribute(_el$23, "width", size != null ? size : contextSize);
setAttribute(_el$23, "height", size != null ? size : contextSize);
setAttribute(_el$23, "fill", color != null ? color : contextColor);
setAttribute(_el$23, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : undefined);
spread(_el$23, restContext, true, true);
spread(_el$23, restProps, true, true);
insert(_el$23, children, _el$24);
insert(_el$23, function () {
return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
}, null);
return _el$23;
}();
};
export default Swap;
//# sourceMappingURL=Swap.esm.js.map