Socket
Socket
Sign inDemoInstall

@equinor/fusion-wc-icon

Package Overview
Dependencies
8
Maintainers
4
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

10

CHANGELOG.md
# Change Log
## 2.1.0
### Minor Changes
- [#888](https://github.com/equinor/fusion-web-components/pull/888) [`aeed5b1`](https://github.com/equinor/fusion-web-components/commit/aeed5b1d0bf8f540ec86ad1e28d09b1c2d0348a9) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - add possibility to add svg template to `fwc-icon`.
```html
<fwc-icon type="svg" icon='<svg width="100" height="100"><circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /></svg>'"></fwc-icon>
```
## 2.0.0

@@ -4,0 +14,0 @@

2

lib/custom-elements.json

@@ -267,3 +267,3 @@ {

{
"name": "name",
"name": "nameOrSvgTemplate",
"type": {

@@ -270,0 +270,0 @@ "text": "IconName | string"

@@ -8,3 +8,3 @@ import { __decorate } from "tslib";

render() {
return this.icon ? createIcon(this.icon) : null;
return this.icon ? createIcon(this.icon, this.type) : null;
}

@@ -11,0 +11,0 @@ }

@@ -7,6 +7,7 @@ import { SVGTemplateResult } from 'lit';

export declare enum IconType {
EDS = "eds"
EDS = "eds",
SVG = "svg"
}
export declare const createSvg: ({ height, width, svgPathData }: IconData) => SVGTemplateResult;
export declare const createIcon: (name: IconName | string, type?: IconType) => SVGTemplateResult | null;
export declare const createIcon: (nameOrSvgTemplate: IconName | string, type?: IconType) => SVGTemplateResult | null;
export default createIcon;
import { svg } from 'lit';
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
import * as edsIcons from '@equinor/eds-icons';

@@ -7,2 +8,3 @@ export const iconNames = Object.keys(edsIcons);

IconType["EDS"] = "eds";
IconType["SVG"] = "svg";
})(IconType || (IconType = {}));

@@ -14,5 +16,6 @@ export const createSvg = ({ height, width, svgPathData }) => svg `

`;
export const createIcon = (name, type = IconType.EDS) => {
export const createIcon = (nameOrSvgTemplate, type = IconType.EDS) => {
switch (type) {
case IconType.EDS: {
const name = nameOrSvgTemplate;
const icon = edsIcons[name];

@@ -25,2 +28,6 @@ if (!icon) {

}
case IconType.SVG: {
const svgString = nameOrSvgTemplate;
return svg `${unsafeSVG(svgString)}`;
}
}

@@ -27,0 +34,0 @@ };

{
"name": "@equinor/fusion-wc-icon",
"version": "2.0.0",
"version": "2.1.0",
"description": "",

@@ -35,3 +35,3 @@ "main": "lib/index.js",

},
"gitHead": "647a3469f1826766ac0ac7abf66327179dc5b6ce"
"gitHead": "5b1b245d9e0d04f931fd12634f11c621f52980f8"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc