@ngxi/lucide 0.12.23 → 0.12.25

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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, input, computed, Directive } from "@angular/core";
3
- import { DomSanitizer } from "@angular/platform-browser";
2
+ import { inject, ElementRef, PLATFORM_ID, input, numberAttribute, effect, Directive } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
4
  const lucideAArrowDown = {
5
5
  "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m14 12l4 4l4-4m-4 4V7M2 16l4.039-9.69a.5.5 0 0 1 .923 0L11 16m-7.696-3h6.392"/>',
6
6
  "width": 24,
@@ -11175,37 +11175,47 @@ const lucideXSquare = {
11175
11175
  };
11176
11176
  class Ngxi {
11177
11177
  constructor() {
11178
- this.sanitizer = inject(DomSanitizer);
11179
- this.icon = input(...[]);
11180
- this.width = input(...[]);
11181
- this.height = input(...[]);
11178
+ this.el = inject(ElementRef);
11179
+ this.platformId = inject(PLATFORM_ID);
11180
+ this.icon = input.required(...[]);
11181
+ this.width = input(void 0, ...[{
11182
+ transform: numberAttribute
11183
+ }]);
11184
+ this.height = input(void 0, ...[{
11185
+ transform: numberAttribute
11186
+ }]);
11182
11187
  this.viewBox = input(...[]);
11183
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
11184
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
11185
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
11186
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
11188
+ effect(() => {
11189
+ this.updateSvg();
11190
+ });
11191
+ }
11192
+ updateSvg() {
11193
+ if (isPlatformBrowser(this.platformId)) {
11194
+ const svg = this.el.nativeElement;
11195
+ svg.innerHTML = "";
11196
+ if (!this.icon) {
11197
+ return;
11198
+ }
11199
+ svg.innerHTML = this.icon().body;
11200
+ svg.setAttribute("width", (this.width() ?? this.icon()?.width ?? "").toString());
11201
+ svg.setAttribute("height", (this.height() ?? this.icon()?.height ?? "").toString());
11202
+ svg.setAttribute("viewBox", this.viewBox() ?? this.icon()?.viewBox ?? "");
11203
+ }
11187
11204
  }
11188
11205
  static {
11189
11206
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
11190
11207
  }
11191
11208
  static {
11192
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, viewBox: { classPropertyName: "viewBox", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.width": "resolvedWidth()", "attr.height": "resolvedHeight()", "attr.viewBox": "resolvedViewBox()", "innerHTML": "safeSVG()" } }, ngImport: i0 });
11209
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, viewBox: { classPropertyName: "viewBox", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
11193
11210
  }
11194
11211
  }
11195
11212
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
11196
11213
  type: Directive,
11197
11214
  args: [{
11198
- standalone: true,
11199
11215
  selector: "svg[ngxi]",
11200
- host: {
11201
- "role": "img",
11202
- "[attr.width]": "resolvedWidth()",
11203
- "[attr.height]": "resolvedHeight()",
11204
- "[attr.viewBox]": "resolvedViewBox()",
11205
- "[innerHTML]": "safeSVG()"
11206
- }
11216
+ standalone: true
11207
11217
  }]
11208
- }] });
11218
+ }], ctorParameters: () => [] });
11209
11219
  class NgxiLucide {
11210
11220
  constructor() {
11211
11221
  this.ngxiLucide = input.required(...[]);