@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.
@@ -1,6 +1,6 @@
1
- import { toRefs as _, computed as k, openBlock as h, createElementBlock as c, createElementVNode as r, Fragment as g, renderList as y, createCommentVNode as b, createTextVNode as S, toDisplayString as v } from "vue";
2
- import q from "../_virtual/_plugin-vue_export-helper.js";
3
- const Q = {
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(e) {
20
- return ["jpg", "png", "gif"].indexOf(e) !== -1;
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(e) {
52
- return ["lazy", "eager"].indexOf(e) !== -1;
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(e) {
63
- return ["center", "top", "right", "left", "bottom", "top_right", "top_left", "bottom_right", "bottom_left", "face", "faces"].indexOf(e) !== -1;
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(e) {
74
- return ["pad", "fill", "scale", "crop", "thumb"].indexOf(e) !== -1;
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(e) {
94
+ setup(n) {
95
95
  const {
96
- alt: u,
96
+ alt: f,
97
97
  contentfulSrc: t,
98
- width: i,
99
- height: x
100
- } = _(e), m = (n = null, o = 1) => {
101
- let w = n && n.url ? `${n.url}?` : `${t.value}?`, f = n ? n.width : i.value, a = n ? n.height : x.value, s;
102
- return f >= 2e3 && (s = f / 1999, f = 1999, a = Math.round(a / s)), a >= 2e3 && (s = a / 1999, a = 1999, f = Math.round(f / s)), f && (w += `w=${f * o}`), f && a && (w += "&"), a && (w += `h=${a * o}`), w;
103
- }, l = (n, o) => o === "2x" ? 65 : n && parseInt(n, 10) < 200 ? 95 : 80, d = k(() => u.value && u.value.charAt(0) === "^" ? u.value.slice(1).trim() : "");
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: m,
111
+ buildUrl: x,
106
112
  caption: d,
107
- setQuality: l
113
+ removeLeafIcon: k,
114
+ setQuality: i
108
115
  };
109
116
  }
110
- }, U = {
117
+ }, z = {
111
118
  key: 0,
112
119
  class: "tw-inline-block tw-not-prose"
113
- }, F = {
120
+ }, j = {
114
121
  class: "tw-h-full tw-w-full",
115
122
  style: { "object-fit": "inherit" }
116
- }, z = ["media", "width", "height", "srcset"], j = ["media", "width", "height", "srcset"], N = ["src", "alt", "loading"], O = ["srcset"], B = ["srcset", "src", "width", "height", "alt", "loading"], C = {
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-text-h4 tw-mt-2"
125
+ class: "tw-inline-block tw-mr-0.5 tw-align-middle",
126
+ "aria-hidden": "true",
127
+ role: "img"
119
128
  };
120
- function M(e, u, t, i, x, m) {
121
- return (t.width || t.height) && t.contentfulSrc ? (h(), c("figure", U, [
122
- r("picture", F, [
123
- t.sourceSizes.length > 0 ? (h(), c(g, { key: 0 }, [
124
- (h(!0), c(g, null, y(t.sourceSizes, (l, d) => (h(), c("source", {
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: "(" + l.media + ")",
135
+ media: "(" + i.media + ")",
127
136
  type: "image/webp",
128
- width: l.width ? l.width : null,
129
- height: l.height ? l.height : null,
137
+ width: i.width ? i.width : null,
138
+ height: i.height ? i.height : null,
130
139
  srcset: `
131
- ${i.buildUrl(l, 2)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${i.setQuality(l.width, "2x")} 2x,
132
- ${i.buildUrl(l)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${i.setQuality(l.width, "1x")} 1x`
133
- }, null, 8, z))), 128)),
134
- (h(!0), c(g, null, y(t.sourceSizes, (l, d) => (h(), c("source", {
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: "(" + l.media + ")",
137
- width: l.width ? l.width : null,
138
- height: l.height ? l.height : null,
145
+ media: "(" + i.media + ")",
146
+ width: i.width ? i.width : null,
147
+ height: i.height ? i.height : null,
139
148
  srcset: `
140
- ${i.buildUrl(l, 2)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(l.width, "2x")} 2x,
141
- ${i.buildUrl(l)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(l.width, "1x")} 1x`
142
- }, null, 8, j))), 128)),
143
- r("img", {
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: `${i.buildUrl(t.width, t.height)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(t.width, "1x")}`,
147
- alt: i.caption || t.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, N)
150
- ], 64)) : b("", !0),
151
- t.sourceSizes.length === 0 ? (h(), c(g, { key: 1 }, [
152
- r("source", {
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
- ${i.buildUrl(null, 2)}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${i.setQuality(t.width, "2x")} 2x,
156
- ${i.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=webp&q=${i.setQuality(t.width, "1x")} 1x`
157
- }, null, 8, O),
158
- r("img", {
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
- ${i.buildUrl(null, 2)}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(t.width, "2x")} 2x,
163
- ${i.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(t.width, "1x")} 1x`,
164
- src: `${i.buildUrl()}&fit=${t.fit}&f=${t.focus}&fm=${t.fallbackFormat}&q=${i.setQuality(t.width, "1x")}`,
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: i.caption || t.alt,
176
+ alt: e.caption || t.alt,
168
177
  loading: t.loading
169
- }, null, 8, B)
170
- ], 64)) : b("", !0)
178
+ }, null, 8, A)
179
+ ], 64)) : o("", !0)
171
180
  ]),
172
- i.caption ? (h(), c("figcaption", C, [
173
- u[0] || (u[0] = r("span", {
174
- class: "tw-inline-flex tw-align-text-top",
175
- "aria-hidden": "true",
176
- role: "img"
177
- }, [
178
- r("svg", {
179
- class: "tw-h-2 tw-w-2.5",
180
- viewBox: "0 0 20 20",
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
- r("path", {
184
- d: "m3.12088 18.7441c12.86212 0 15.87912-14.52631 15.87912-16.99996h-1.1209c-12.85272 0-15.8791 14.51376-15.8791 16.99996z",
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
- ], -1)),
189
- S(" " + v(i.caption), 1)
190
- ])) : b("", !0)
191
- ])) : b("", !0);
198
+ ], -1)
199
+ ]))),
200
+ q(" " + Q(e.caption), 1)
201
+ ], 4)) : o("", !0)
202
+ ])) : o("", !0);
192
203
  }
193
- const E = /* @__PURE__ */ q(Q, [["render", M]]);
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.2",
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.1",
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": "f68de2ef6e9d2b237b7779a5cb0971a29c845e4a"
126
+ "gitHead": "139510f7b600b98f4f9655cf911ac08212952881"
127
127
  }