@ascentgl/ads-icons 21.1.0 → 21.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,10 +19,10 @@ class AdsIconRegistry {
|
|
|
19
19
|
}
|
|
20
20
|
return this.registry.get(iconName);
|
|
21
21
|
}
|
|
22
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
23
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
23
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconRegistry, providedIn: 'root' }); }
|
|
24
24
|
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconRegistry, decorators: [{
|
|
26
26
|
type: Injectable,
|
|
27
27
|
args: [{
|
|
28
28
|
providedIn: 'root',
|
|
@@ -138,10 +138,10 @@ class AdsIconComponent {
|
|
|
138
138
|
getSvgElement() {
|
|
139
139
|
return this.element.nativeElement.querySelector('svg');
|
|
140
140
|
}
|
|
141
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
142
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
141
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconComponent, deps: [{ token: i0.ElementRef }, { token: AdsIconRegistry }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
142
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AdsIconComponent, isStandalone: false, selector: "ads-icon", inputs: { size: "size", name: "name", color: "color", theme: "theme", stroke: "stroke" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-flex;justify-content:center;align-items:center;width:32px;height:32px;font-size:32px;fill:currentColor}:host ::ng-deep [data-no-fill]{fill:none!important}:host ::ng-deep [data-no-stroke]{stroke:none!important}:host ::ng-deep [data-stroke-white]{stroke:var(--color-white)}:host ::ng-deep [data-fill-white]{fill:var(--color-white)}\n"] }); }
|
|
143
143
|
}
|
|
144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconComponent, decorators: [{
|
|
145
145
|
type: Component,
|
|
146
146
|
args: [{ selector: 'ads-icon', template: '', standalone: false, styles: [":host{display:inline-flex;justify-content:center;align-items:center;width:32px;height:32px;font-size:32px;fill:currentColor}:host ::ng-deep [data-no-fill]{fill:none!important}:host ::ng-deep [data-no-stroke]{stroke:none!important}:host ::ng-deep [data-stroke-white]{stroke:var(--color-white)}:host ::ng-deep [data-fill-white]{fill:var(--color-white)}\n"] }]
|
|
147
147
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: AdsIconRegistry }, { type: i0.Renderer2 }], propDecorators: { size: [{
|
|
@@ -157,11 +157,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
157
157
|
}] } });
|
|
158
158
|
|
|
159
159
|
class AdsIconModule {
|
|
160
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
161
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
162
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
160
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
161
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: AdsIconModule, declarations: [AdsIconComponent], exports: [AdsIconComponent] }); }
|
|
162
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconModule }); }
|
|
163
163
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AdsIconModule, decorators: [{
|
|
165
165
|
type: NgModule,
|
|
166
166
|
args: [{
|
|
167
167
|
declarations: [AdsIconComponent],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ascentgl-ads-icons.mjs","sources":["../../../../libs/ads-icons/src/lib/ads-icon-registry.service.ts","../../../../libs/ads-icons/src/lib/ads-icon.component.ts","../../../../libs/ads-icons/src/lib/ads-icon.module.ts","../../../../libs/ads-icons/src/public-api.ts","../../../../libs/ads-icons/src/ascentgl-ads-icons.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { AdsIcon } from '@ascentgl/ads-icons/icons';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AdsIconRegistry {\r\n private registry = new Map<string, string>();\r\n\r\n public register(icons: AdsIcon | AdsIcon[]): void {\r\n if (Array.isArray(icons)) {\r\n icons.forEach((icon: AdsIcon) => this.registry.set(icon.name, icon.data));\r\n } else {\r\n this.registry.set(icons.name, icons.data);\r\n }\r\n }\r\n\r\n public get(iconName: string): string | undefined {\r\n if (!this.registry.has(iconName)) {\r\n console.warn(`Could not find a Ads Icon with the name ${iconName}. Did you add it to the icon registry?`);\r\n }\r\n\r\n return this.registry.get(iconName);\r\n }\r\n}\r\n","import { Component, ElementRef, Input, OnInit, Renderer2, OnChanges, SimpleChanges } from '@angular/core';\r\nimport { AdsIconRegistry } from './ads-icon-registry.service';\r\nimport { adsIcon } from '@ascentgl/ads-icons/icons';\r\n\r\ntype Sizes = {\r\n xxl: string;\r\n xl: string;\r\n lg: string;\r\n md: string;\r\n sm: string;\r\n xs: string;\r\n xxs: string;\r\n xxxs: string;\r\n xxxxs: string;\r\n auto: string;\r\n};\r\n\r\nexport type IconThemes = {\r\n iconPrimary: string;\r\n primary: string;\r\n secondary: string;\r\n secondaryHover: string;\r\n success: string;\r\n warn: string;\r\n white: string;\r\n 'dark-50': string;\r\n dark: string;\r\n link: string;\r\n 'medium-50': string;\r\n};\r\n\r\n@Component({\r\n selector: 'ads-icon',\r\n template: '',\r\n styleUrls: ['./ads-icon.component.scss'],\r\n standalone: false,\r\n})\r\nexport class AdsIconComponent implements OnInit, OnChanges {\r\n /**\r\n * The size of the icon\r\n */\r\n @Input() size: keyof Sizes = 'md';\r\n /**\r\n * The icon name\r\n */\r\n @Input() name!: adsIcon;\r\n /**\r\n * The color of the icon\r\n */\r\n @Input() color?: string;\r\n\r\n /**\r\n * The icon theme\r\n */\r\n @Input() theme?: keyof IconThemes;\r\n /**\r\n * The icon stroke\r\n */\r\n @Input() stroke?: keyof IconThemes;\r\n\r\n /** @ignore */\r\n private sizes: Sizes = {\r\n xxl: '128px',\r\n xl: '64px',\r\n lg: '48px',\r\n md: '32px',\r\n sm: '24px',\r\n xs: '20px',\r\n xxs: '14px',\r\n xxxs: '12px',\r\n xxxxs: '8px',\r\n auto: 'auto',\r\n };\r\n\r\n /** @ignore */\r\n private themes: IconThemes = {\r\n iconPrimary: '--color-medium',\r\n 'medium-50': '--color-medium-50',\r\n secondary: '--color-secondary',\r\n success: '--color-success',\r\n warn: '--color-error',\r\n primary: '--color-primary',\r\n white: '--color-white',\r\n 'dark-50': '--color-dark-50',\r\n dark: '--color-dark',\r\n link: '--color-link',\r\n secondaryHover: '--color-secondary-hover',\r\n };\r\n\r\n /** @ignore */\r\n constructor(\r\n private element: ElementRef,\r\n private registry: AdsIconRegistry,\r\n private renderer: Renderer2,\r\n ) {}\r\n\r\n /** @ignore */\r\n ngOnInit(): void {\r\n this.renderIcon();\r\n }\r\n\r\n /** @ignore */\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if (changes.size || changes.color || changes.theme || changes.stroke || changes.fill || changes.name) {\r\n this.renderIcon();\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private renderIcon(): void {\r\n const iconSVG = this.registry.get(this.name);\r\n\r\n if (iconSVG) {\r\n this.element.nativeElement.innerHTML = iconSVG;\r\n this.updateSize();\r\n this.updateColor();\r\n this.updateTheme();\r\n this.updateStroke();\r\n } else {\r\n console.warn(`${this.name} is missing from the icon registry`);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateSize(): void {\r\n const size = this.sizes[this.size];\r\n this.renderer.setStyle(this.element.nativeElement, 'fontSize', size);\r\n this.renderer.setStyle(this.element.nativeElement, 'width', size);\r\n this.renderer.setStyle(this.element.nativeElement, 'height', size);\r\n\r\n const svgElement = this.getSvgElement();\r\n if (svgElement) {\r\n this.renderer.setStyle(svgElement, 'width', size);\r\n this.renderer.setStyle(svgElement, 'height', size);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateColor(): void {\r\n if (this.color) {\r\n const svg = this.element.nativeElement.querySelector('svg');\r\n this.renderer.setStyle(svg, 'fill', `var(${this.color})`);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateTheme(): void {\r\n if (this.theme) {\r\n const themeColor = this.themes[this.theme];\r\n if (themeColor) {\r\n this.renderer.setStyle(this.element.nativeElement, 'color', `var(${themeColor})`);\r\n } else {\r\n console.warn(\r\n `${this.theme} is not a valid ads-icon theme. Valid themes include: 'iconPrimary', 'primary', 'secondary', 'success', 'warn', 'white'`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateStroke(): void {\r\n if (this.stroke) {\r\n const strokeColor = this.themes[this.stroke];\r\n if (strokeColor) {\r\n this.renderer.setStyle(this.element.nativeElement, 'stroke', `var(${strokeColor})`);\r\n } else {\r\n console.warn(\r\n `${this.stroke} is not a valid ads-icon stroke. Valid strokes include: 'iconPrimary', 'primary', 'secondary', 'success', 'warn', 'white', 'dark-50', 'dark'`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private getSvgElement(): SVGElement | null {\r\n return this.element.nativeElement.querySelector('svg');\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { AdsIconComponent } from './ads-icon.component';\r\n\r\n@NgModule({\r\n declarations: [AdsIconComponent],\r\n exports: [AdsIconComponent],\r\n})\r\nexport class AdsIconModule {}\r\n","/*\r\n * Public API Surface of ads-icons\r\n */\r\n\r\nexport * from './lib/ads-icon-registry.service';\r\nexport * from './lib/ads-icon.component';\r\nexport * from './lib/ads-icon.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AdsIconRegistry"],"mappings":";;;MAMa,eAAe,CAAA;AAH5B,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB;AAiB7C,IAAA;AAfQ,IAAA,QAAQ,CAAC,KAA0B,EAAA;AACxC,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E;aAAO;AACL,YAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;QAC3C;IACF;AAEO,IAAA,GAAG,CAAC,QA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BAIA;;;MCnDU,aAAa,CAAA;8GAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAb,aAAa,EAAA,YAAA,EAAA,CAHT,gBAAgB,CAAA,EAAA,OAAA,EAAA,CACrB,gBAAgB,CAAA,EAAA,CAAA,CAAA;+GAEf,aAAa,EAAA,CAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,gBAAgB,CAAC;oBAChC,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC5B,iBAAA;;;ACND;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ascentgl-ads-icons.mjs","sources":["../../../../libs/ads-icons/src/lib/ads-icon-registry.service.ts","../../../../libs/ads-icons/src/lib/ads-icon.component.ts","../../../../libs/ads-icons/src/lib/ads-icon.module.ts","../../../../libs/ads-icons/src/public-api.ts","../../../../libs/ads-icons/src/ascentgl-ads-icons.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { AdsIcon } from '@ascentgl/ads-icons/icons';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AdsIconRegistry {\r\n private registry = new Map<string, string>();\r\n\r\n public register(icons: AdsIcon | AdsIcon[]): void {\r\n if (Array.isArray(icons)) {\r\n icons.forEach((icon: AdsIcon) => this.registry.set(icon.name, icon.data));\r\n } else {\r\n this.registry.set(icons.name, icons.data);\r\n }\r\n }\r\n\r\n public get(iconName: string): string | undefined {\r\n if (!this.registry.has(iconName)) {\r\n console.warn(`Could not find a Ads Icon with the name ${iconName}. Did you add it to the icon registry?`);\r\n }\r\n\r\n return this.registry.get(iconName);\r\n }\r\n}\r\n","import { Component, ElementRef, Input, OnInit, Renderer2, OnChanges, SimpleChanges } from '@angular/core';\r\nimport { AdsIconRegistry } from './ads-icon-registry.service';\r\nimport { adsIcon } from '@ascentgl/ads-icons/icons';\r\n\r\ntype Sizes = {\r\n xxl: string;\r\n xl: string;\r\n lg: string;\r\n md: string;\r\n sm: string;\r\n xs: string;\r\n xxs: string;\r\n xxxs: string;\r\n xxxxs: string;\r\n auto: string;\r\n};\r\n\r\nexport type IconThemes = {\r\n iconPrimary: string;\r\n primary: string;\r\n secondary: string;\r\n secondaryHover: string;\r\n success: string;\r\n warn: string;\r\n white: string;\r\n 'dark-50': string;\r\n dark: string;\r\n link: string;\r\n 'medium-50': string;\r\n};\r\n\r\n@Component({\r\n selector: 'ads-icon',\r\n template: '',\r\n styleUrls: ['./ads-icon.component.scss'],\r\n standalone: false,\r\n})\r\nexport class AdsIconComponent implements OnInit, OnChanges {\r\n /**\r\n * The size of the icon\r\n */\r\n @Input() size: keyof Sizes = 'md';\r\n /**\r\n * The icon name\r\n */\r\n @Input() name!: adsIcon;\r\n /**\r\n * The color of the icon\r\n */\r\n @Input() color?: string;\r\n\r\n /**\r\n * The icon theme\r\n */\r\n @Input() theme?: keyof IconThemes;\r\n /**\r\n * The icon stroke\r\n */\r\n @Input() stroke?: keyof IconThemes;\r\n\r\n /** @ignore */\r\n private sizes: Sizes = {\r\n xxl: '128px',\r\n xl: '64px',\r\n lg: '48px',\r\n md: '32px',\r\n sm: '24px',\r\n xs: '20px',\r\n xxs: '14px',\r\n xxxs: '12px',\r\n xxxxs: '8px',\r\n auto: 'auto',\r\n };\r\n\r\n /** @ignore */\r\n private themes: IconThemes = {\r\n iconPrimary: '--color-medium',\r\n 'medium-50': '--color-medium-50',\r\n secondary: '--color-secondary',\r\n success: '--color-success',\r\n warn: '--color-error',\r\n primary: '--color-primary',\r\n white: '--color-white',\r\n 'dark-50': '--color-dark-50',\r\n dark: '--color-dark',\r\n link: '--color-link',\r\n secondaryHover: '--color-secondary-hover',\r\n };\r\n\r\n /** @ignore */\r\n constructor(\r\n private element: ElementRef,\r\n private registry: AdsIconRegistry,\r\n private renderer: Renderer2,\r\n ) {}\r\n\r\n /** @ignore */\r\n ngOnInit(): void {\r\n this.renderIcon();\r\n }\r\n\r\n /** @ignore */\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if (changes.size || changes.color || changes.theme || changes.stroke || changes.fill || changes.name) {\r\n this.renderIcon();\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private renderIcon(): void {\r\n const iconSVG = this.registry.get(this.name);\r\n\r\n if (iconSVG) {\r\n this.element.nativeElement.innerHTML = iconSVG;\r\n this.updateSize();\r\n this.updateColor();\r\n this.updateTheme();\r\n this.updateStroke();\r\n } else {\r\n console.warn(`${this.name} is missing from the icon registry`);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateSize(): void {\r\n const size = this.sizes[this.size];\r\n this.renderer.setStyle(this.element.nativeElement, 'fontSize', size);\r\n this.renderer.setStyle(this.element.nativeElement, 'width', size);\r\n this.renderer.setStyle(this.element.nativeElement, 'height', size);\r\n\r\n const svgElement = this.getSvgElement();\r\n if (svgElement) {\r\n this.renderer.setStyle(svgElement, 'width', size);\r\n this.renderer.setStyle(svgElement, 'height', size);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateColor(): void {\r\n if (this.color) {\r\n const svg = this.element.nativeElement.querySelector('svg');\r\n this.renderer.setStyle(svg, 'fill', `var(${this.color})`);\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateTheme(): void {\r\n if (this.theme) {\r\n const themeColor = this.themes[this.theme];\r\n if (themeColor) {\r\n this.renderer.setStyle(this.element.nativeElement, 'color', `var(${themeColor})`);\r\n } else {\r\n console.warn(\r\n `${this.theme} is not a valid ads-icon theme. Valid themes include: 'iconPrimary', 'primary', 'secondary', 'success', 'warn', 'white'`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private updateStroke(): void {\r\n if (this.stroke) {\r\n const strokeColor = this.themes[this.stroke];\r\n if (strokeColor) {\r\n this.renderer.setStyle(this.element.nativeElement, 'stroke', `var(${strokeColor})`);\r\n } else {\r\n console.warn(\r\n `${this.stroke} is not a valid ads-icon stroke. Valid strokes include: 'iconPrimary', 'primary', 'secondary', 'success', 'warn', 'white', 'dark-50', 'dark'`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /** @ignore */\r\n private getSvgElement(): SVGElement | null {\r\n return this.element.nativeElement.querySelector('svg');\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { AdsIconComponent } from './ads-icon.component';\r\n\r\n@NgModule({\r\n declarations: [AdsIconComponent],\r\n exports: [AdsIconComponent],\r\n})\r\nexport class AdsIconModule {}\r\n","/*\r\n * Public API Surface of ads-icons\r\n */\r\n\r\nexport * from './lib/ads-icon-registry.service';\r\nexport * from './lib/ads-icon.component';\r\nexport * from './lib/ads-icon.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AdsIconRegistry"],"mappings":";;;MAMa,eAAe,CAAA;AAH5B,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB;AAiB7C,IAAA;AAfQ,IAAA,QAAQ,CAAC,KAA0B,EAAA;AACxC,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E;aAAO;AACL,YAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;QAC3C;IACF;AAEO,IAAA,GAAG,CAAC,QAAgB,EAAA;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;AAChC,YAAA,OAAO,CAAC,IAAI,CAAC,2CAA2C,QAAQ,CAAA,sCAAA,CAAwC,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AAA,CAHT,gBAAgB,CAAA,EAAA,OAAA,EAAA,CACrB,gBAAgB,CAAA,EAAA,CAAA,CAAA;gHAEf,aAAa,EAAA,CAAA,CAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,gBAAgB,CAAC;oBAChC,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC5B,iBAAA;;;ACND;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascentgl/ads-icons",
|
|
3
|
-
"version": "21.1.
|
|
3
|
+
"version": "21.1.2",
|
|
4
4
|
"description": "This library was generated with [Nx](https://nx.dev).",
|
|
5
5
|
"main": "jest.config.js",
|
|
6
6
|
"author": "Sergii Sichkar",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"module": "fesm2022/ascentgl-ads-icons.mjs",
|
|
9
|
-
"typings": "
|
|
9
|
+
"typings": "index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
"./package.json": {
|
|
12
12
|
"default": "./package.json"
|
|
13
13
|
},
|
|
14
14
|
".": {
|
|
15
|
-
"types": "./
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
16
|
"default": "./fesm2022/ascentgl-ads-icons.mjs"
|
|
17
17
|
},
|
|
18
18
|
"./icons": {
|
|
19
|
-
"types": "./
|
|
19
|
+
"types": "./icons/index.d.ts",
|
|
20
20
|
"default": "./fesm2022/ascentgl-ads-icons-icons.mjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
File without changes
|
|
File without changes
|