@kiva/kv-components 8.8.0 → 8.9.0
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.
|
@@ -1,94 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as e, createElementBlock as
|
|
3
|
-
import
|
|
1
|
+
import w from "./KvContentfulImg2.js";
|
|
2
|
+
import { openBlock as e, createElementBlock as a, createElementVNode as h, Fragment as c, renderList as o, createCommentVNode as r, normalizeStyle as f, createTextVNode as m, toDisplayString as s } from "vue";
|
|
3
|
+
import u from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
const b = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "tw-inline-block tw-not-prose"
|
|
7
|
-
},
|
|
7
|
+
}, x = {
|
|
8
8
|
class: "tw-h-full tw-w-full",
|
|
9
9
|
style: { "object-fit": "inherit" }
|
|
10
|
-
},
|
|
10
|
+
}, F = ["media", "width", "height", "srcset"], y = ["media", "width", "height", "srcset"], g = ["src", "alt", "loading"], k = ["srcset"], _ = ["srcset", "src", "width", "height", "alt", "loading"], P = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "tw-inline-block tw-mr-0.5 tw-align-middle",
|
|
13
13
|
"aria-hidden": "true",
|
|
14
14
|
role: "img"
|
|
15
15
|
};
|
|
16
|
-
function
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(e(!0),
|
|
16
|
+
function v(Q, n, i, t, U, S) {
|
|
17
|
+
return (i.width || i.height) && i.contentfulSrc ? (e(), a("figure", b, [
|
|
18
|
+
h("picture", x, [
|
|
19
|
+
i.sourceSizes.length > 0 ? (e(), a(c, { key: 0 }, [
|
|
20
|
+
t.isAnimatedGif ? r("", !0) : (e(!0), a(c, { key: 0 }, o(i.sourceSizes, (l, d) => (e(), a("source", {
|
|
21
21
|
key: "webp-image" + d,
|
|
22
22
|
media: "(" + l.media + ")",
|
|
23
23
|
type: "image/webp",
|
|
24
24
|
width: l.width ? l.width : null,
|
|
25
25
|
height: l.height ? l.height : null,
|
|
26
26
|
srcset: `
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, null, 8,
|
|
30
|
-
(e(!0),
|
|
27
|
+
${t.buildUrl(l, 2)}${t.fitFocusParams}&fm=webp&q=${t.setQuality(l.width, "2x")} 2x,
|
|
28
|
+
${t.buildUrl(l)}${t.fitFocusParams}&fm=webp&q=${t.setQuality(l.width, "1x")} 1x`
|
|
29
|
+
}, null, 8, F))), 128)),
|
|
30
|
+
(e(!0), a(c, null, o(i.sourceSizes, (l, d) => (e(), a("source", {
|
|
31
31
|
key: "fallback-image" + d,
|
|
32
32
|
media: "(" + l.media + ")",
|
|
33
33
|
width: l.width ? l.width : null,
|
|
34
34
|
height: l.height ? l.height : null,
|
|
35
35
|
srcset: `
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
}, null, 8,
|
|
39
|
-
|
|
36
|
+
${t.buildUrl(l, 2)}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, l.width, "2x")} 2x,
|
|
37
|
+
${t.buildUrl(l)}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, l.width, "1x")} 1x`
|
|
38
|
+
}, null, 8, y))), 128)),
|
|
39
|
+
h("img", {
|
|
40
40
|
class: "tw-max-w-full tw-max-h-full",
|
|
41
41
|
style: { width: "inherit", height: "inherit", "object-fit": "inherit" },
|
|
42
|
-
src: `${
|
|
43
|
-
alt:
|
|
44
|
-
loading:
|
|
45
|
-
}, null, 8,
|
|
46
|
-
], 64)) :
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
src: `${t.buildUrl()}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, i.width, "1x")}`,
|
|
43
|
+
alt: t.caption || i.alt,
|
|
44
|
+
loading: i.loading
|
|
45
|
+
}, null, 8, g)
|
|
46
|
+
], 64)) : r("", !0),
|
|
47
|
+
i.sourceSizes.length === 0 ? (e(), a(c, { key: 1 }, [
|
|
48
|
+
t.isAnimatedGif ? r("", !0) : (e(), a("source", {
|
|
49
|
+
key: 0,
|
|
49
50
|
type: "image/webp",
|
|
50
51
|
srcset: `
|
|
51
|
-
${
|
|
52
|
-
${
|
|
53
|
-
}, null, 8, k),
|
|
54
|
-
|
|
52
|
+
${t.buildUrl(null, 2)}${t.fitFocusParams}&fm=webp&q=${t.setQuality(i.width, "2x")} 2x,
|
|
53
|
+
${t.buildUrl()}${t.fitFocusParams}&fm=webp&q=${t.setQuality(i.width, "1x")} 1x`
|
|
54
|
+
}, null, 8, k)),
|
|
55
|
+
h("img", {
|
|
55
56
|
class: "tw-max-w-full tw-max-h-full",
|
|
56
57
|
style: { width: "inherit", height: "inherit", "object-fit": "inherit" },
|
|
57
58
|
srcset: `
|
|
58
|
-
${
|
|
59
|
-
${
|
|
60
|
-
src: `${
|
|
61
|
-
width:
|
|
62
|
-
height:
|
|
63
|
-
alt:
|
|
64
|
-
loading:
|
|
65
|
-
}, null, 8,
|
|
66
|
-
], 64)) :
|
|
59
|
+
${t.buildUrl(null, 2)}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, i.width, "2x")} 2x,
|
|
60
|
+
${t.buildUrl()}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, i.width, "1x")} 1x`,
|
|
61
|
+
src: `${t.buildUrl()}${t.fitFocusParams}${t.buildFormatQualityParams(t.effectiveFallbackFormat, i.width, "1x")}`,
|
|
62
|
+
width: i.width ? i.width : null,
|
|
63
|
+
height: i.height ? i.height : null,
|
|
64
|
+
alt: t.caption || i.alt,
|
|
65
|
+
loading: i.loading
|
|
66
|
+
}, null, 8, _)
|
|
67
|
+
], 64)) : r("", !0)
|
|
67
68
|
]),
|
|
68
|
-
|
|
69
|
+
t.caption ? (e(), a("figcaption", {
|
|
69
70
|
key: 0,
|
|
70
71
|
class: "tw-italic tw-my-1.5 tw-break-words tw-max-w-full tw-font-book tw-text-action-highlight",
|
|
71
|
-
style:
|
|
72
|
+
style: f({ maxWidth: i.width ? `${i.width}px` : void 0 })
|
|
72
73
|
}, [
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
t.removeLeafIcon ? r("", !0) : (e(), a("span", P, n[0] || (n[0] = [
|
|
75
|
+
h("svg", {
|
|
75
76
|
width: "16",
|
|
76
77
|
height: "12",
|
|
77
78
|
viewBox: "0 0 16 12",
|
|
78
79
|
fill: "none",
|
|
79
80
|
xmlns: "http://www.w3.org/2000/svg"
|
|
80
81
|
}, [
|
|
81
|
-
|
|
82
|
+
h("path", {
|
|
82
83
|
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",
|
|
83
84
|
fill: "currentColor"
|
|
84
85
|
})
|
|
85
86
|
], -1)
|
|
86
87
|
]))),
|
|
87
|
-
|
|
88
|
-
], 4)) :
|
|
89
|
-
])) :
|
|
88
|
+
m(" " + s(t.caption), 1)
|
|
89
|
+
], 4)) : r("", !0)
|
|
90
|
+
])) : r("", !0);
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
+
const L = /* @__PURE__ */ u(w, [["render", v]]);
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
L as default
|
|
94
95
|
};
|
|
@@ -12,7 +12,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
12
12
|
};
|
|
13
13
|
fallbackFormat: {
|
|
14
14
|
type: StringConstructor;
|
|
15
|
-
default:
|
|
15
|
+
default: any;
|
|
16
16
|
validator(value: string): boolean;
|
|
17
17
|
};
|
|
18
18
|
width: {
|
|
@@ -48,8 +48,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
48
48
|
default: () => any[];
|
|
49
49
|
};
|
|
50
50
|
}>, {
|
|
51
|
-
|
|
51
|
+
buildFormatQualityParams: (format: string, imgWidth: string | number, scale: string) => string;
|
|
52
|
+
buildUrl: (image?: any, multiplier?: number) => any;
|
|
52
53
|
caption: import('vue').ComputedRef<string>;
|
|
54
|
+
effectiveFallbackFormat: import('vue').ComputedRef<string>;
|
|
55
|
+
fitFocusParams: import('vue').ComputedRef<string>;
|
|
56
|
+
isAnimatedGif: import('vue').ComputedRef<boolean>;
|
|
53
57
|
removeLeafIcon: import('vue').ComputedRef<boolean>;
|
|
54
58
|
setQuality: (imgWidth: string | number, imgScale: string) => 65 | 95 | 80;
|
|
55
59
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -59,7 +63,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
59
63
|
};
|
|
60
64
|
fallbackFormat: {
|
|
61
65
|
type: StringConstructor;
|
|
62
|
-
default:
|
|
66
|
+
default: any;
|
|
63
67
|
validator(value: string): boolean;
|
|
64
68
|
};
|
|
65
69
|
width: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
const
|
|
1
|
+
import { toRefs as x, computed as i } from "vue";
|
|
2
|
+
const F = {
|
|
3
3
|
props: {
|
|
4
4
|
/**
|
|
5
5
|
* Large, uncompressed image url that you get back from contentful.
|
|
@@ -10,11 +10,12 @@ const S = {
|
|
|
10
10
|
},
|
|
11
11
|
/**
|
|
12
12
|
* If the browser can't support webp we fallback to this image format.
|
|
13
|
-
*
|
|
13
|
+
* Defaults to the format derived from the source URL: gif→gif, png→png, jpg→jpg, webp→jpg.
|
|
14
|
+
* `jpg, png, gif`
|
|
14
15
|
* */
|
|
15
16
|
fallbackFormat: {
|
|
16
17
|
type: String,
|
|
17
|
-
default:
|
|
18
|
+
default: null,
|
|
18
19
|
validator(e) {
|
|
19
20
|
return e === null || ["jpg", "png", "gif"].indexOf(e) !== -1;
|
|
20
21
|
}
|
|
@@ -92,28 +93,42 @@ const S = {
|
|
|
92
93
|
},
|
|
93
94
|
setup(e) {
|
|
94
95
|
const {
|
|
95
|
-
alt:
|
|
96
|
-
contentfulSrc:
|
|
97
|
-
width:
|
|
98
|
-
height:
|
|
99
|
-
} =
|
|
100
|
-
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
alt: a,
|
|
97
|
+
contentfulSrc: s,
|
|
98
|
+
width: p,
|
|
99
|
+
height: h
|
|
100
|
+
} = x(e), f = i(() => {
|
|
101
|
+
var r;
|
|
102
|
+
return (((r = s.value) == null ? void 0 : r.split("?")[0]) ?? "").toLowerCase().endsWith(".gif");
|
|
103
|
+
}), g = i(() => {
|
|
104
|
+
var r, u;
|
|
105
|
+
if (e.fallbackFormat) return e.fallbackFormat;
|
|
106
|
+
const t = (u = (r = s.value) == null ? void 0 : r.split("?")[0].split(".").pop()) == null ? void 0 : u.toLowerCase();
|
|
107
|
+
return t === "png" ? "png" : t === "gif" ? "gif" : "jpg";
|
|
108
|
+
}), v = i(() => f.value ? "" : `&fit=${e.fit}&f=${e.focus}`), m = (t = null, r = 1) => {
|
|
109
|
+
const u = t && t.url ? t.url : s.value;
|
|
110
|
+
if (f.value) return u;
|
|
111
|
+
let o = `${u}?`, l = t ? t.width : p.value, n = t ? t.height : h.value, c;
|
|
112
|
+
return l >= 2e3 && (c = l / 1999, l = 1999, n = Math.round(n / c)), n >= 2e3 && (c = n / 1999, n = 1999, l = Math.round(l / c)), l && (o += `w=${l * r}`), l && n && (o += "&"), n && (o += `h=${n * r}`), o;
|
|
113
|
+
}, d = (t, r) => r === "2x" ? 65 : t && parseInt(t.toString(), 10) < 200 ? 95 : 80, b = (t, r, u) => f.value ? "" : `&fm=${t}&q=${d(r, u)}`, y = i(() => {
|
|
114
|
+
if (a.value && a.value.charAt(0) === "^") {
|
|
115
|
+
const t = a.value.charAt(1) === "#" ? 2 : 1;
|
|
116
|
+
return a.value.slice(t).trim();
|
|
106
117
|
}
|
|
107
118
|
return "";
|
|
108
|
-
}),
|
|
119
|
+
}), S = i(() => !!(a.value && a.value.charAt(1) === "#"));
|
|
109
120
|
return {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
121
|
+
buildFormatQualityParams: b,
|
|
122
|
+
buildUrl: m,
|
|
123
|
+
caption: y,
|
|
124
|
+
effectiveFallbackFormat: g,
|
|
125
|
+
fitFocusParams: v,
|
|
126
|
+
isAnimatedGif: f,
|
|
127
|
+
removeLeafIcon: S,
|
|
128
|
+
setQuality: d
|
|
114
129
|
};
|
|
115
130
|
}
|
|
116
131
|
};
|
|
117
132
|
export {
|
|
118
|
-
|
|
133
|
+
F as default
|
|
119
134
|
};
|
|
@@ -182,7 +182,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
182
182
|
};
|
|
183
183
|
fallbackFormat: {
|
|
184
184
|
type: StringConstructor;
|
|
185
|
-
default:
|
|
185
|
+
default: any;
|
|
186
186
|
validator(value: string): boolean;
|
|
187
187
|
};
|
|
188
188
|
width: {
|
|
@@ -218,8 +218,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
218
218
|
default: () => any[];
|
|
219
219
|
};
|
|
220
220
|
}>, {
|
|
221
|
-
|
|
221
|
+
buildFormatQualityParams: (format: string, imgWidth: string | number, scale: string) => string;
|
|
222
|
+
buildUrl: (image?: any, multiplier?: number) => any;
|
|
222
223
|
caption: import('vue').ComputedRef<string>;
|
|
224
|
+
effectiveFallbackFormat: import('vue').ComputedRef<string>;
|
|
225
|
+
fitFocusParams: import('vue').ComputedRef<string>;
|
|
226
|
+
isAnimatedGif: import('vue').ComputedRef<boolean>;
|
|
223
227
|
removeLeafIcon: import('vue').ComputedRef<boolean>;
|
|
224
228
|
setQuality: (imgWidth: string | number, imgScale: string) => 65 | 95 | 80;
|
|
225
229
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -229,7 +233,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
229
233
|
};
|
|
230
234
|
fallbackFormat: {
|
|
231
235
|
type: StringConstructor;
|
|
232
|
-
default:
|
|
236
|
+
default: any;
|
|
233
237
|
validator(value: string): boolean;
|
|
234
238
|
};
|
|
235
239
|
width: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"embla-carousel-fade",
|
|
126
126
|
"popper.js"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "8e1a9900d6e8e1c8307875aad711ffa5080e1dd9"
|
|
129
129
|
}
|