Socket
Socket
Sign inDemoInstall

@ngaox/icons

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngaox/icons - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0

esm2020/lib/adapters/compact.adapter.mjs

1

index.d.ts

@@ -5,1 +5,2 @@ export * from './lib/icons.service';

export * from './lib/models';
export * from './lib/adapters';

10

lib/icon.component.d.ts

@@ -8,9 +8,11 @@ import { OnInit } from '@angular/core';

private sanitizer;
name?: string;
url?: string;
svgEl?: SafeHtml;
name?: string;
svgUrl?: string;
width?: string;
height?: string;
constructor(icons: IconsService, sanitizer: DomSanitizer);
ngOnInit(): Promise<void>;
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ngaox-icon", never, { "name": "name"; "svgUrl": "svgUrl"; }, {}, never, ["*"]>;
static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ngaox-icon", never, { "name": "name"; "url": "url"; "width": "width"; "height": "height"; }, {}, never, ["*"]>;
}
import { ModuleWithProviders } from '@angular/core';
import { IconsService } from './icons.service';
import { IconByUrl, SvgIcon } from './models';
import { INgaoxIcon } from './models';
import * as i0 from "@angular/core";
import * as i1 from "./icon.component";
interface GlobalIcons {
icons: SvgIcon[];
iconsByUrl: IconByUrl[];
}
/**

@@ -28,9 +24,20 @@ * Integrate `@ngaox/icons` to your app in the root module (`AppModule`). as follows:

export declare class IconsModule {
constructor(globalIcons: GlobalIcons, iconsService: IconsService);
constructor(icons: INgaoxIcon[] | undefined, iconsService: IconsService);
/**
* @param fallbackSvgIcon a string represent the svg element to fallback to when icon not exist
* @param icons an array of `SvgIcon` objects that are icons to be registered globally
* @param iconsByUrl an array of `IconByUrl` objects that are icons by url to be registered globally
* Creates and configures a module with module level Icons and optionally change the default fallbackHtml icon.
*
* For none root module use only add `IconsModule` to your imports
* For the root NgModule, import as follows:
*
* ```
* @NgModule({
* imports: [IconsModule.forRoot(APP_ICONS)]
* })
* class MyNgModule {}
* ```
*
* @param icons an arrays of icons to register
* @param fallbackHtml a string represent the svg element to fallback to when icon not found (default to an exclamation mark svg)
*/
static forRoot(fallbackSvgIcon?: string, icons?: SvgIcon[], iconsByUrl?: IconByUrl[]): ModuleWithProviders<IconsModule>;
static forRoot(icons?: INgaoxIcon[], fallbackHtml?: string): ModuleWithProviders<IconsModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<IconsModule, [{ optional: true; }, null]>;

@@ -40,2 +47,1 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<IconsModule, [typeof i1.IconComponent], never, [typeof i1.IconComponent]>;

}
export {};
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ILazyIcon } from './models';
import * as i0 from "@angular/core";

@@ -13,2 +14,8 @@ export declare class IconsService {

/**
* Get the fallback icon specified in the import of the `IconsModule.forRoot`
* Used in the `ngaox-icon` component when the icon is not found
* @see {@link https://ngaox-lab.web.app/docs/icons#fallback-icon}
*/
getFallbackIcon(): string;
/**
* get an already registered/added icon

@@ -18,22 +25,14 @@ *

*/
get(name: string): Observable<SVGElement | undefined> | undefined;
getFallbackIcon(): string;
get(name: string): Observable<SVGElement | undefined>;
/**
* Add an SVG icon to the registry with an alias `name`
* Add an SVG icon to the NgaoxIcons registry
*
* pass to it a `name` for the icon and the `svg` element
* you can pass also a boolean value `override` whether or not replacing existing `svg` if `name` already exists
* @param name the name of the Icon in the registry (used in `ngaox-icon` component and {@link IconsService.get})
* @param value the SVG content or {@link ILazyIcon} for lazy loaded icons
* @param override (default to true) whether or not replacing existing `svg` if `name` already exists
*
* @see {@link IconsService.addByUrl}
*/
add(name: string, svg: string, override?: boolean): void;
add(name: string, value: string | ILazyIcon, override?: boolean): Observable<SVGElement | undefined>;
/**
* Add an SVG icon to the registry via a `url` with an alias `name` (default to `url`)
*
* you can pass also a boolean value `override` (default to false) whether or not replacing existing `svg` if `name` already exists
*
* @see {@link IconsService.add}
*/
addByUrl(url: string, name?: string, override?: boolean): Promise<void>;
/**
* remove a registered icon

@@ -40,0 +39,0 @@ */

import { InjectionToken } from '@angular/core';
export declare const FALLBACK_ICON: InjectionToken<string>;
export interface SvgIcon {
export declare const NGAOX_FALLBACK: InjectionToken<string>;
export interface ILazyIcon {
url: string;
lazy: true;
}
export interface INgaoxIcon {
name: string;
svg: string;
data: string | ILazyIcon;
}
export interface IconByUrl {
name?: string;
url: string;
export interface ICompactIcons {
[name: string]: string | ILazyIcon;
}
{
"name": "@ngaox/icons",
"version": "3.0.2",
"version": "3.1.0",
"description": "Easily inline SVG icons into your angular app with a ready to import and use set of icons",

@@ -5,0 +5,0 @@ "ng-add": {

@@ -40,5 +40,4 @@ # Ngaox Icons <!-- omit in toc -->

- `fallbackSvgIcon` a string represent the SVG element to fallback to when the icon not exist
- `icons` an array of icons to be registered globally with a unique name
- `iconsByUrl` an array of icons urls to be registered globally with a name default to the icon url
- `fallbackHtml` a string represent the SVG element to fallback to when the icon not exist

@@ -59,3 +58,3 @@ And for other child modules that need access to `<ngaox-icon>` you only will need to import `IconsModule`.

```html
<svg-icon svgUrl="assets/my-icon.svg" style="width: 100px;"></svg-icon>
<svg-icon name="my-icon-name" url="assets/my-icon.svg" width="100px"></svg-icon>
```

@@ -68,3 +67,3 @@

```html
<svg-icon name="my-icon" style="width: 100px;"></svg-icon>
<svg-icon name="my-icon" width="100px"></svg-icon>
```

@@ -82,3 +81,6 @@

constructor(icons: IconsService) {
icons.addByUrl('assets/my-icon.svg', 'my-icon');
icons.add('my-icon-name', {
url: 'assets/my-icon.svg',
lazy: true
}, 'my-icon');
icons.remove('ugly-icon');

@@ -85,0 +87,0 @@ icons.add(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc