@kieler/klighd-core
Version:
Core KLighD diagram visualization with Sprotty
47 lines • 1.91 kB
JavaScript
;
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2021-2024 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
/** @jsx html */
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeatherIcon = void 0;
const feather_icons_1 = require("feather-icons");
const sprotty_1 = require("sprotty"); // eslint-disable-line @typescript-eslint/no-unused-vars
/**
* Add the feather icon with the given icon ID to a snabbdom VNode as used in sprotty.
*
* @param props properties containing the ID of the feather icon.
* @returns The SVG VNode resulting from this feather icon ID.
*/
function FeatherIcon(props) {
// Imitates what feather would usually do, all attributes are put in the styles (if possible) and
// the classes are written in as well. Missing are the xmlns and viewBox, but they do not seem to
// be necessary anyways.
const classes = { feather: true, 'sidebar-icon-size': true };
classes[`feather-${props.iconId}`] = true;
return ((0, sprotty_1.html)("svg", { style: {
// FIXME This actual size of the svg is now captured by the sidebar-icon-size class.
// width: '24',
// height: '24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: '2',
strokeLinecap: 'round',
strokeLinejoin: 'round',
}, class: classes, props: { innerHTML: feather_icons_1.icons[props.iconId].toString() } }));
}
exports.FeatherIcon = FeatherIcon;
//# sourceMappingURL=feather-icons-snabbdom.js.map