@openkit-labs/ngx-kit-ui 0.0.43 → 0.0.44
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.
|
@@ -5731,11 +5731,9 @@ class KitImageComponent {
|
|
|
5731
5731
|
effect(() => {
|
|
5732
5732
|
const url = this.src();
|
|
5733
5733
|
if (!url) {
|
|
5734
|
-
console.log('[ImageComponent] src is null → error state');
|
|
5735
5734
|
this.handleError();
|
|
5736
5735
|
return;
|
|
5737
5736
|
}
|
|
5738
|
-
console.log('[ImageComponent] new src detected:', url);
|
|
5739
5737
|
this.isLoading.set(true);
|
|
5740
5738
|
this.errored.set(false);
|
|
5741
5739
|
this.showImage.set(false);
|
|
@@ -5745,18 +5743,15 @@ class KitImageComponent {
|
|
|
5745
5743
|
const img = new Image();
|
|
5746
5744
|
img.src = url;
|
|
5747
5745
|
img.onload = () => {
|
|
5748
|
-
console.log('[ImageComponent] image loaded successfully');
|
|
5749
5746
|
this.imageWidth.set(img.naturalWidth);
|
|
5750
5747
|
this.imageHeight.set(img.naturalHeight);
|
|
5751
5748
|
setTimeout(() => {
|
|
5752
|
-
console.log('[ImageComponent] rendering image after 1s delay');
|
|
5753
5749
|
this.showImage.set(true);
|
|
5754
5750
|
this.isLoading.set(false);
|
|
5755
5751
|
this.errored.set(false);
|
|
5756
5752
|
}, 100);
|
|
5757
5753
|
};
|
|
5758
5754
|
img.onerror = () => {
|
|
5759
|
-
console.error('[ImageComponent] main image failed to load');
|
|
5760
5755
|
this.handleError();
|
|
5761
5756
|
};
|
|
5762
5757
|
});
|
|
@@ -5771,7 +5766,6 @@ class KitImageComponent {
|
|
|
5771
5766
|
this.imageHeight.set(200);
|
|
5772
5767
|
const placeholder = this.errorSrc();
|
|
5773
5768
|
if (placeholder) {
|
|
5774
|
-
console.log('[ImageComponent] using provided error placeholder:', placeholder);
|
|
5775
5769
|
// Preload the placeholder image
|
|
5776
5770
|
const img = new Image();
|
|
5777
5771
|
img.src = placeholder;
|
|
@@ -5780,15 +5774,11 @@ class KitImageComponent {
|
|
|
5780
5774
|
this.imageHeight.set(img.naturalHeight);
|
|
5781
5775
|
this.showImage.set(true);
|
|
5782
5776
|
this.errored.set(false);
|
|
5783
|
-
console.log('[ImageComponent] error placeholder loaded');
|
|
5784
5777
|
};
|
|
5785
5778
|
img.onerror = () => {
|
|
5786
|
-
console.error('[ImageComponent] error placeholder failed to load, using default');
|
|
5779
|
+
// console.error('[ImageComponent] error placeholder failed to load, using default');
|
|
5787
5780
|
};
|
|
5788
5781
|
}
|
|
5789
|
-
else {
|
|
5790
|
-
console.log('[ImageComponent] no error placeholder provided, using default fallback');
|
|
5791
|
-
}
|
|
5792
5782
|
}
|
|
5793
5783
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: KitImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5794
5784
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: KitImageComponent, isStandalone: true, selector: "kit-image", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, objectFit: { classPropertyName: "objectFit", publicName: "objectFit", 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 }, aspectRatio: { classPropertyName: "aspectRatio", publicName: "aspectRatio", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"kit-image-container\"\n [style.object-fit]=\"objectFit()\"\n [style.width]=\"width() ? width() : (imageWidth() ? imageWidth() + 'px' : '200px')\"\n [style.height]=\"height() ? height() : (imageHeight() ? imageHeight() + 'px' : '200px')\"\n [style.aspectRatio]=\"aspectRatio() ?? null\"\n [style.borderRadius]=\"borderRadius() ?? null\">\n\n <!-- Image -->\n @if(showImage())\n {\n <ng-container>\n <img [src]=\"src()\"\n [style.object-fit]=\"objectFit()\"\n [style.borderRadius]=\"borderRadius() ?? null\"\n class=\"kit-image\">\n </ng-container>\n }\n\n <!-- Skeleton shimmer while loading -->\n\n @if(isLoading())\n {\n <ng-container>\n <div class=\"kit-image-skeleton\"></div>\n </ng-container>\n }\n\n @if(errored() && errorSrc())\n {\n <ng-container>\n <img [src]=\"errorSrc()\"\n [style.object-fit]=\"objectFit()\"\n [style.borderRadius]=\"borderRadius() ?? null\"\n class=\"kit-image\">\n </ng-container>\n }\n\n @if(errored() && !errorSrc())\n {\n <ng-container>\n <div class=\"kit-image-error\"></div>\n </ng-container>\n }\n</div>", styles: [":host{display:inline-block}.kit-image-container{position:relative;display:inline-block;overflow:hidden;border-radius:var(--kit-image-border-radius);min-width:100px;min-height:100px}.kit-image{width:100%;height:100%;object-fit:contain;display:block;transition:opacity .2s ease-in-out}.kit-image-skeleton{position:absolute;inset:0;background:linear-gradient(90deg,#ffffff0d,#0000000a 40%,#ffffff0d);background-size:200% 100%;animation:shimmer 1.2s linear infinite;border-radius:inherit}.kit-image-error{position:absolute;inset:0;background:#ffffff0d 100%;border-radius:inherit}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}\n"] });
|