@aw-studio/vue-lit-image-next
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,2 +0,2 @@ | ||
import { defineComponent, openBlock, createElementBlock, createElementVNode, mergeProps } from 'vue'; | ||
import { defineComponent, openBlock, createElementBlock, createElementVNode, mergeProps, createCommentVNode } from 'vue'; | ||
import 'lazysizes'; | ||
@@ -8,3 +8,3 @@ | ||
image: { | ||
type: Object, | ||
type: [Object, Array], | ||
required: true, | ||
@@ -37,6 +37,15 @@ }, | ||
var conversionName = this.getMediaConversions()[0][0]; | ||
if (this.image.conversion_urls.hasOwnProperty(conversionName)) { | ||
return this.image.conversion_urls[conversionName]; | ||
// Check if image is object or array of image objects | ||
if (!Array.isArray(this.image)) { | ||
if (this.image.conversion_urls.hasOwnProperty(conversionName)) { | ||
return this.image.conversion_urls[conversionName]; | ||
} | ||
return this.image.url; | ||
} | ||
return this.image.url; | ||
else { | ||
if (this.image[0].conversion_urls.hasOwnProperty(conversionName)) { | ||
return this.image[0].conversion_urls[conversionName]; | ||
} | ||
return this.image[0].url; | ||
} | ||
}, | ||
@@ -50,22 +59,2 @@ locale: function () { | ||
}, | ||
alt: function () { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
if (this.locale == 'de') { | ||
return ((_c = (_b = (_a = this.image.custom_properties.de) === null || _a === void 0 ? void 0 : _a.alt) !== null && _b !== void 0 ? _b : this.image.custom_properties.alt) !== null && _c !== void 0 ? _c : ''); | ||
} | ||
if (this.locale == 'en') { | ||
return ((_f = (_e = (_d = this.image.custom_properties.en) === null || _d === void 0 ? void 0 : _d.alt) !== null && _e !== void 0 ? _e : this.image.custom_properties.alt) !== null && _f !== void 0 ? _f : ''); | ||
} | ||
return (_g = this.image.custom_properties.alt) !== null && _g !== void 0 ? _g : ''; | ||
}, | ||
title: function () { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
if (this.locale == 'de') { | ||
return ((_c = (_b = (_a = this.image.custom_properties.de) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : this.image.custom_properties.title) !== null && _c !== void 0 ? _c : ''); | ||
} | ||
if (this.locale == 'en') { | ||
return ((_f = (_e = (_d = this.image.custom_properties.en) === null || _d === void 0 ? void 0 : _d.title) !== null && _e !== void 0 ? _e : this.image.custom_properties.title) !== null && _f !== void 0 ? _f : ''); | ||
} | ||
return (_g = this.image.custom_properties.title) !== null && _g !== void 0 ? _g : ''; | ||
}, | ||
dataSrcset: function () { | ||
@@ -75,8 +64,19 @@ var srcset = ''; | ||
var urls = []; | ||
for (var _i = 0, _a = Object.entries(this.image.conversion_urls); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (key in this.conversionSizes) { | ||
urls.push([key, value]); | ||
// Check if image is object or array of image objects | ||
if (!Array.isArray(this.image)) { | ||
for (var _i = 0, _a = Object.entries(this.image.conversion_urls); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (key in this.conversionSizes) { | ||
urls.push([key, value]); | ||
} | ||
} | ||
} | ||
else { | ||
for (var _c = 0, _d = Object.entries(this.image[0].conversion_urls); _c < _d.length; _c++) { | ||
var _e = _d[_c], key = _e[0], value = _e[1]; | ||
if (key in this.conversionSizes) { | ||
urls.push([key, value]); | ||
} | ||
} | ||
} | ||
for (var i = 0; i < conversions.length; i++) { | ||
@@ -95,3 +95,3 @@ var conversion = conversions[i]; | ||
const _hoisted_1 = { class: "image-container" }; | ||
const _hoisted_2 = ["src", "data-srcset", "alt", "title"]; | ||
const _hoisted_2 = ["src", "data-srcset"]; | ||
@@ -105,6 +105,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
"data-srcset": _ctx.dataSrcset, | ||
"data-sizes": "auto", | ||
alt: _ctx.alt, | ||
title: _ctx.title | ||
}), null, 16 /* FULL_PROPS */, _hoisted_2) | ||
"data-sizes": "auto" | ||
}), null, 16 /* FULL_PROPS */, _hoisted_2), | ||
createCommentVNode(" TODO: "), | ||
createCommentVNode(" :alt=\"alt\"\n :title=\"title\" ") | ||
])) | ||
@@ -111,0 +111,0 @@ } |
{ | ||
"name": "@aw-studio/vue-lit-image-next", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A vue-lit-image that supports vue 3.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26347