@kiva/kv-components 7.6.2 → 7.6.3
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/vue/KvContentfulImg.js +88 -77
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { toRefs as v, computed as y, openBlock as a, createElementBlock as r, createElementVNode as c, Fragment as m, renderList as _, createCommentVNode as o, normalizeStyle as S, createTextVNode as q, toDisplayString as Q } from "vue";
|
|
2
|
+
import U from "../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const F = {
|
|
4
4
|
props: {
|
|
5
5
|
/**
|
|
6
6
|
* Large, uncompressed image url that you get back from contentful.
|
|
@@ -16,8 +16,8 @@ const Q = {
|
|
|
16
16
|
fallbackFormat: {
|
|
17
17
|
type: String,
|
|
18
18
|
default: "jpg",
|
|
19
|
-
validator(
|
|
20
|
-
return ["jpg", "png", "gif"].indexOf(
|
|
19
|
+
validator(n) {
|
|
20
|
+
return ["jpg", "png", "gif"].indexOf(n) !== -1;
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
/**
|
|
@@ -48,8 +48,8 @@ const Q = {
|
|
|
48
48
|
loading: {
|
|
49
49
|
type: String,
|
|
50
50
|
default: null,
|
|
51
|
-
validator(
|
|
52
|
-
return ["lazy", "eager"].indexOf(
|
|
51
|
+
validator(n) {
|
|
52
|
+
return ["lazy", "eager"].indexOf(n) !== -1;
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
/**
|
|
@@ -59,8 +59,8 @@ const Q = {
|
|
|
59
59
|
focus: {
|
|
60
60
|
type: String,
|
|
61
61
|
default: "center",
|
|
62
|
-
validator(
|
|
63
|
-
return ["center", "top", "right", "left", "bottom", "top_right", "top_left", "bottom_right", "bottom_left", "face", "faces"].indexOf(
|
|
62
|
+
validator(n) {
|
|
63
|
+
return ["center", "top", "right", "left", "bottom", "top_right", "top_left", "bottom_right", "bottom_left", "face", "faces"].indexOf(n) !== -1;
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
/**
|
|
@@ -70,8 +70,8 @@ const Q = {
|
|
|
70
70
|
fit: {
|
|
71
71
|
type: String,
|
|
72
72
|
default: "fill",
|
|
73
|
-
validator(
|
|
74
|
-
return ["pad", "fill", "scale", "crop", "thumb"].indexOf(
|
|
73
|
+
validator(n) {
|
|
74
|
+
return ["pad", "fill", "scale", "crop", "thumb"].indexOf(n) !== -1;
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
/**
|
|
@@ -91,106 +91,117 @@ const Q = {
|
|
|
91
91
|
default: () => []
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
setup(
|
|
94
|
+
setup(n) {
|
|
95
95
|
const {
|
|
96
|
-
alt:
|
|
96
|
+
alt: f,
|
|
97
97
|
contentfulSrc: t,
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
100
|
-
} =
|
|
101
|
-
let
|
|
102
|
-
return
|
|
103
|
-
},
|
|
98
|
+
width: e,
|
|
99
|
+
height: b
|
|
100
|
+
} = v(n), x = (l = null, w = 1) => {
|
|
101
|
+
let s = l && l.url ? `${l.url}?` : `${t.value}?`, h = l ? l.width : e.value, u = l ? l.height : b.value, g;
|
|
102
|
+
return h >= 2e3 && (g = h / 1999, h = 1999, u = Math.round(u / g)), u >= 2e3 && (g = u / 1999, u = 1999, h = Math.round(h / g)), h && (s += `w=${h * w}`), h && u && (s += "&"), u && (s += `h=${u * w}`), s;
|
|
103
|
+
}, i = (l, w) => w === "2x" ? 65 : l && parseInt(l, 10) < 200 ? 95 : 80, d = y(() => {
|
|
104
|
+
if (f.value && f.value.charAt(0) === "^") {
|
|
105
|
+
const l = f.value.charAt(1) === "#" ? 2 : 1;
|
|
106
|
+
return f.value.slice(l).trim();
|
|
107
|
+
}
|
|
108
|
+
return "";
|
|
109
|
+
}), k = y(() => !!(f.value && f.value.charAt(1) === "#"));
|
|
104
110
|
return {
|
|
105
|
-
buildUrl:
|
|
111
|
+
buildUrl: x,
|
|
106
112
|
caption: d,
|
|
107
|
-
|
|
113
|
+
removeLeafIcon: k,
|
|
114
|
+
setQuality: i
|
|
108
115
|
};
|
|
109
116
|
}
|
|
110
|
-
},
|
|
117
|
+
}, z = {
|
|
111
118
|
key: 0,
|
|
112
119
|
class: "tw-inline-block tw-not-prose"
|
|
113
|
-
},
|
|
120
|
+
}, j = {
|
|
114
121
|
class: "tw-h-full tw-w-full",
|
|
115
122
|
style: { "object-fit": "inherit" }
|
|
116
|
-
},
|
|
123
|
+
}, C = ["media", "width", "height", "srcset"], I = ["media", "width", "height", "srcset"], L = ["src", "alt", "loading"], N = ["srcset"], A = ["srcset", "src", "width", "height", "alt", "loading"], M = {
|
|
117
124
|
key: 0,
|
|
118
|
-
class: "tw-
|
|
125
|
+
class: "tw-inline-block tw-mr-0.5 tw-align-middle",
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
role: "img"
|
|
119
128
|
};
|
|
120
|
-
function
|
|
121
|
-
return (t.width || t.height) && t.contentfulSrc ? (
|
|
122
|
-
|
|
123
|
-
t.sourceSizes.length > 0 ? (
|
|
124
|
-
(
|
|
129
|
+
function O(n, f, t, e, b, x) {
|
|
130
|
+
return (t.width || t.height) && t.contentfulSrc ? (a(), r("figure", z, [
|
|
131
|
+
c("picture", j, [
|
|
132
|
+
t.sourceSizes.length > 0 ? (a(), r(m, { key: 0 }, [
|
|
133
|
+
(a(!0), r(m, null, _(t.sourceSizes, (i, d) => (a(), r("source", {
|
|
125
134
|
key: "webp-image" + d,
|
|
126
|
-
media: "(" +
|
|
135
|
+
media: "(" + i.media + ")",
|
|
127
136
|
type: "image/webp",
|
|
128
|
-
width:
|
|
129
|
-
height:
|
|
137
|
+
width: i.width ? i.width : null,
|
|
138
|
+
height: i.height ? i.height : null,
|
|
130
139
|
srcset: `
|
|
131
|
-
${
|
|
132
|
-
${
|
|
133
|
-
}, null, 8,
|
|
134
|
-
(
|
|
140
|
+
${e.buildUrl(i, 2)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${e.setQuality(i.width, "2x")} 2x,
|
|
141
|
+
${e.buildUrl(i)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${e.setQuality(i.width, "1x")} 1x`
|
|
142
|
+
}, null, 8, C))), 128)),
|
|
143
|
+
(a(!0), r(m, null, _(t.sourceSizes, (i, d) => (a(), r("source", {
|
|
135
144
|
key: "fallback-image" + d,
|
|
136
|
-
media: "(" +
|
|
137
|
-
width:
|
|
138
|
-
height:
|
|
145
|
+
media: "(" + i.media + ")",
|
|
146
|
+
width: i.width ? i.width : null,
|
|
147
|
+
height: i.height ? i.height : null,
|
|
139
148
|
srcset: `
|
|
140
|
-
${
|
|
141
|
-
${
|
|
142
|
-
}, null, 8,
|
|
143
|
-
|
|
149
|
+
${e.buildUrl(i, 2)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(i.width, "2x")} 2x,
|
|
150
|
+
${e.buildUrl(i)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(i.width, "1x")} 1x`
|
|
151
|
+
}, null, 8, I))), 128)),
|
|
152
|
+
c("img", {
|
|
144
153
|
class: "tw-max-w-full tw-max-h-full",
|
|
145
154
|
style: { width: "inherit", height: "inherit", "object-fit": "inherit" },
|
|
146
|
-
src: `${
|
|
147
|
-
alt:
|
|
155
|
+
src: `${e.buildUrl(t.width, t.height)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(t.width, "1x")}`,
|
|
156
|
+
alt: e.caption || t.alt,
|
|
148
157
|
loading: t.loading
|
|
149
|
-
}, null, 8,
|
|
150
|
-
], 64)) :
|
|
151
|
-
t.sourceSizes.length === 0 ? (
|
|
152
|
-
|
|
158
|
+
}, null, 8, L)
|
|
159
|
+
], 64)) : o("", !0),
|
|
160
|
+
t.sourceSizes.length === 0 ? (a(), r(m, { key: 1 }, [
|
|
161
|
+
c("source", {
|
|
153
162
|
type: "image/webp",
|
|
154
163
|
srcset: `
|
|
155
|
-
${
|
|
156
|
-
${
|
|
157
|
-
}, null, 8,
|
|
158
|
-
|
|
164
|
+
${e.buildUrl(null, 2)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${e.setQuality(t.width, "2x")} 2x,
|
|
165
|
+
${e.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${e.setQuality(t.width, "1x")} 1x`
|
|
166
|
+
}, null, 8, N),
|
|
167
|
+
c("img", {
|
|
159
168
|
class: "tw-max-w-full tw-max-h-full",
|
|
160
169
|
style: { width: "inherit", height: "inherit", "object-fit": "inherit" },
|
|
161
170
|
srcset: `
|
|
162
|
-
${
|
|
163
|
-
${
|
|
164
|
-
src: `${
|
|
171
|
+
${e.buildUrl(null, 2)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(t.width, "2x")} 2x,
|
|
172
|
+
${e.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(t.width, "1x")} 1x`,
|
|
173
|
+
src: `${e.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${e.setQuality(t.width, "1x")}`,
|
|
165
174
|
width: t.width ? t.width : null,
|
|
166
175
|
height: t.height ? t.height : null,
|
|
167
|
-
alt:
|
|
176
|
+
alt: e.caption || t.alt,
|
|
168
177
|
loading: t.loading
|
|
169
|
-
}, null, 8,
|
|
170
|
-
], 64)) :
|
|
178
|
+
}, null, 8, A)
|
|
179
|
+
], 64)) : o("", !0)
|
|
171
180
|
]),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
e.caption ? (a(), r("figcaption", {
|
|
182
|
+
key: 0,
|
|
183
|
+
class: "tw-italic tw-my-1.5 tw-break-words tw-max-w-full tw-font-book tw-text-action-highlight",
|
|
184
|
+
style: S({ maxWidth: t.width ? `${t.width}px` : void 0 })
|
|
185
|
+
}, [
|
|
186
|
+
e.removeLeafIcon ? o("", !0) : (a(), r("span", M, f[0] || (f[0] = [
|
|
187
|
+
c("svg", {
|
|
188
|
+
width: "16",
|
|
189
|
+
height: "12",
|
|
190
|
+
viewBox: "0 0 16 12",
|
|
191
|
+
fill: "none",
|
|
181
192
|
xmlns: "http://www.w3.org/2000/svg"
|
|
182
193
|
}, [
|
|
183
|
-
|
|
184
|
-
d: "
|
|
194
|
+
c("path", {
|
|
195
|
+
d: "M1.04689 11.2079C13.06 11.2079 15.8778 1.63084 15.8778 -1.6347e-07L14.831 -1.52692e-07C2.82661 -2.91013e-08 9.85148e-08 9.56873 1.15391e-07 11.2079L1.04689 11.2079Z",
|
|
185
196
|
fill: "currentColor"
|
|
186
197
|
})
|
|
187
|
-
])
|
|
188
|
-
]
|
|
189
|
-
|
|
190
|
-
])) :
|
|
191
|
-
])) :
|
|
198
|
+
], -1)
|
|
199
|
+
]))),
|
|
200
|
+
q(" " + Q(e.caption), 1)
|
|
201
|
+
], 4)) : o("", !0)
|
|
202
|
+
])) : o("", !0);
|
|
192
203
|
}
|
|
193
|
-
const E = /* @__PURE__ */
|
|
204
|
+
const E = /* @__PURE__ */ U(F, [["render", O]]);
|
|
194
205
|
export {
|
|
195
206
|
E as default
|
|
196
207
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/preset-env": "^7.24.8",
|
|
30
30
|
"@babel/preset-react": "^7.24.7",
|
|
31
31
|
"@babel/preset-typescript": "^7.24.7",
|
|
32
|
-
"@kiva/kv-tokens": "^3.6.
|
|
32
|
+
"@kiva/kv-tokens": "^3.6.2",
|
|
33
33
|
"@kiva/vite-plugin-vue-lib-css": "^2.0.0",
|
|
34
34
|
"@laynezh/vite-plugin-lib-assets": "^0.6.1",
|
|
35
35
|
"@mdi/js": "^7.4.47",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"embla-carousel-fade",
|
|
124
124
|
"popper.js"
|
|
125
125
|
],
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "139510f7b600b98f4f9655cf911ac08212952881"
|
|
127
127
|
}
|