@ngxi/lucide 0.12.23 → 0.12.24

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,
@@ -11173,53 +11173,66 @@ const lucideXSquare = {
11173
11173
  "height": 24,
11174
11174
  "viewBox": "0 0 24 24"
11175
11175
  };
11176
+ function __decorate(decorators, target, key, desc) {
11177
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11178
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11179
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11180
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
11181
+ }
11182
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
11183
+ var e = new Error(message);
11184
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
11185
+ };
11176
11186
  class Ngxi {
11177
11187
  constructor() {
11178
- this.sanitizer = inject(DomSanitizer);
11179
- this.icon = input(...[]);
11180
- this.width = input(...[]);
11181
- this.height = input(...[]);
11188
+ this.el = inject(ElementRef);
11189
+ this.platformId = inject(PLATFORM_ID);
11190
+ this.ngxi = input.required(...[]);
11191
+ this.width = input(void 0, ...[{
11192
+ transform: numberAttribute
11193
+ }]);
11194
+ this.height = input(void 0, ...[{
11195
+ transform: numberAttribute
11196
+ }]);
11182
11197
  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 ?? ""), ...[]);
11198
+ effect(() => {
11199
+ this.updateSvg();
11200
+ });
11201
+ }
11202
+ updateSvg() {
11203
+ if (isPlatformBrowser(this.platformId)) {
11204
+ const svg = this.el.nativeElement;
11205
+ svg.innerHTML = "";
11206
+ if (!this.ngxi) {
11207
+ return;
11208
+ }
11209
+ svg.innerHTML = this.ngxi().body;
11210
+ svg.setAttribute("width", (this.width() ?? this.ngxi()?.width ?? "").toString());
11211
+ svg.setAttribute("height", (this.height() ?? this.ngxi()?.height ?? "").toString());
11212
+ svg.setAttribute("viewBox", this.viewBox() ?? this.ngxi()?.viewBox ?? "");
11213
+ }
11187
11214
  }
11188
11215
  static {
11189
11216
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
11190
11217
  }
11191
11218
  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 });
11219
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { ngxi: { classPropertyName: "ngxi", publicName: "ngxi", 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
11220
  }
11194
11221
  }
11195
11222
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
11196
11223
  type: Directive,
11197
11224
  args: [{
11198
- standalone: true,
11199
11225
  selector: "svg[ngxi]",
11200
- host: {
11201
- "role": "img",
11202
- "[attr.width]": "resolvedWidth()",
11203
- "[attr.height]": "resolvedHeight()",
11204
- "[attr.viewBox]": "resolvedViewBox()",
11205
- "[innerHTML]": "safeSVG()"
11206
- }
11226
+ standalone: true
11207
11227
  }]
11208
- }] });
11209
- class NgxiLucide {
11228
+ }], ctorParameters: () => [] });
11229
+ let NgxiLucide = class NgxiLucide2 {
11210
11230
  constructor() {
11211
11231
  this.ngxiLucide = input.required(...[]);
11212
11232
  }
11213
- static {
11214
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiLucide, deps: [], target: i0.ɵɵFactoryTarget.Directive });
11215
- }
11216
- static {
11217
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiLucide, isStandalone: true, selector: "svg[ngxiLucide]", inputs: { ngxiLucide: { classPropertyName: "ngxiLucide", publicName: "ngxiLucide", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiLucide", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
11218
- }
11219
- }
11220
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiLucide, decorators: [{
11221
- type: Directive,
11222
- args: [{
11233
+ };
11234
+ NgxiLucide = __decorate([
11235
+ Directive({
11223
11236
  standalone: true,
11224
11237
  selector: "svg[ngxiLucide]",
11225
11238
  hostDirectives: [
@@ -11228,8 +11241,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
11228
11241
  inputs: ["icon:ngxiLucide", "width", "height", "viewBox"]
11229
11242
  }
11230
11243
  ]
11231
- }]
11232
- }] });
11244
+ })
11245
+ ], NgxiLucide);
11233
11246
  export {
11234
11247
  NgxiLucide,
11235
11248
  lucideAArrowDown,