@storyblok/vue 11.2.0 → 11.2.2
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/index-CtMAhUF--JC8YsZOI.js +576 -0
- package/dist/storyblok-vue.js +211 -2
- package/dist/storyblok-vue.mjs +130 -123
- package/package.json +2 -2
package/dist/storyblok-vue.mjs
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
var ue = Object.defineProperty;
|
|
8
8
|
var he = (e, t, r) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
9
9
|
var f = (e, t, r) => he(e, typeof t != "symbol" ? t + "" : t, r);
|
|
10
|
-
import { defineComponent as
|
|
11
|
-
const
|
|
10
|
+
import { defineComponent as F, useSlots as fe, ref as x, resolveDynamicComponent as O, inject as de, openBlock as ye, createBlock as pe, mergeProps as ge, createSlots as me, renderList as be, unref as ke, withCtx as ve, renderSlot as _e, normalizeProps as Re, guardReactiveProps as we, h as y, createTextVNode as b, defineAsyncComponent as Ae, onMounted as Se } from "vue";
|
|
11
|
+
const N = (e = "") => e.includes("/cdn/"), $e = (e, t = 25, r = 1) => ({
|
|
12
12
|
...e,
|
|
13
13
|
per_page: t,
|
|
14
14
|
page: r
|
|
15
|
-
}),
|
|
15
|
+
}), Le = (e) => new Promise((t) => setTimeout(t, e)), Te = (e = 0, t) => Array.from({ length: e }, t), Ce = (e = 0, t = e) => {
|
|
16
16
|
const r = Math.abs(t - e) || 0, n = e < t ? 1 : -1;
|
|
17
|
-
return
|
|
18
|
-
},
|
|
17
|
+
return Te(r, (s, i) => i * n + e);
|
|
18
|
+
}, Ee = async (e, t) => Promise.all(e.map(t)), Me = (e = [], t) => e.map(t).reduce((r, n) => [...r, ...n], []), D = (e) => {
|
|
19
19
|
if (/%[0-9A-F]{2}/i.test(e)) try {
|
|
20
20
|
return decodeURIComponent(e);
|
|
21
21
|
} catch {
|
|
22
22
|
return e;
|
|
23
23
|
}
|
|
24
24
|
return e;
|
|
25
|
-
},
|
|
25
|
+
}, V = (e, t, r) => {
|
|
26
26
|
const n = [];
|
|
27
27
|
for (const s in e) {
|
|
28
28
|
if (!Object.prototype.hasOwnProperty.call(e, s)) continue;
|
|
@@ -30,10 +30,10 @@ const O = (e = "") => e.includes("/cdn/"), $e = (e, t = 25, r = 1) => ({
|
|
|
30
30
|
if (i == null) continue;
|
|
31
31
|
const l = r ? "" : encodeURIComponent(s);
|
|
32
32
|
let o;
|
|
33
|
-
typeof i == "object" ? o =
|
|
33
|
+
typeof i == "object" ? o = V(i, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(i)) : o = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(i)}`, n.push(o);
|
|
34
34
|
}
|
|
35
35
|
return n.join("&");
|
|
36
|
-
},
|
|
36
|
+
}, B = (e) => {
|
|
37
37
|
const t = {
|
|
38
38
|
eu: "api.storyblok.com",
|
|
39
39
|
us: "api-us.storyblok.com",
|
|
@@ -92,7 +92,7 @@ var Pe = class {
|
|
|
92
92
|
}
|
|
93
93
|
async _methodHandler(e) {
|
|
94
94
|
let t = `${this.baseURL}${this.url}`, r = null;
|
|
95
|
-
e === "get" ? t = `${this.baseURL}${this.url}?${
|
|
95
|
+
e === "get" ? t = `${this.baseURL}${this.url}?${V(this.parameters)}` : r = JSON.stringify(this.parameters);
|
|
96
96
|
const n = new URL(t), s = new AbortController(), { signal: i } = s;
|
|
97
97
|
let l = null;
|
|
98
98
|
this.timeout && (l = setTimeout(() => s.abort(), this.timeout));
|
|
@@ -148,7 +148,7 @@ var Pe = class {
|
|
|
148
148
|
};
|
|
149
149
|
const Oe = {
|
|
150
150
|
PUBLISHED: "published"
|
|
151
|
-
},
|
|
151
|
+
}, Ne = 25, I = {
|
|
152
152
|
SMALL: 25,
|
|
153
153
|
MEDIUM: 50,
|
|
154
154
|
LARGE: 75
|
|
@@ -157,8 +157,8 @@ const Oe = {
|
|
|
157
157
|
MEDIUM: 15,
|
|
158
158
|
LARGE: 10,
|
|
159
159
|
VERY_LARGE: 6
|
|
160
|
-
},
|
|
161
|
-
function
|
|
160
|
+
}, K = 1e3, _ = 3;
|
|
161
|
+
function Ie(e, t) {
|
|
162
162
|
const r = e.includes("/cdn/stories/"), n = e.split("/").length > 3 && !e.endsWith("/cdn/stories"), s = "find_by" in t;
|
|
163
163
|
return r && n || s;
|
|
164
164
|
}
|
|
@@ -166,9 +166,9 @@ function je(e) {
|
|
|
166
166
|
return e <= I.SMALL ? m.SINGLE_OR_SMALL : e <= I.MEDIUM ? m.MEDIUM : e <= I.LARGE ? m.LARGE : m.VERY_LARGE;
|
|
167
167
|
}
|
|
168
168
|
function R(e, t, r = {}, n) {
|
|
169
|
-
return r.userRateLimit !== void 0 ? Math.min(r.userRateLimit,
|
|
169
|
+
return r.userRateLimit !== void 0 ? Math.min(r.userRateLimit, K) : r.serverHeadersRateLimit !== void 0 ? Math.min(r.serverHeadersRateLimit, K) : n !== void 0 ? n : !e || !t || Ie(e, t) ? m.SINGLE_OR_SMALL : je(t.per_page || Ne);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function xe(e) {
|
|
172
172
|
if (!e) return null;
|
|
173
173
|
const t = e["x-ratelimit"] || e["X-RateLimit"], r = e["x-ratelimit-policy"] || e["X-RateLimit-Policy"];
|
|
174
174
|
if (!t && !r) return null;
|
|
@@ -183,7 +183,7 @@ function qe(e) {
|
|
|
183
183
|
}
|
|
184
184
|
return Object.keys(n).length > 0 ? n : null;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function qe(e, t = !1) {
|
|
187
187
|
return {
|
|
188
188
|
userRateLimit: e,
|
|
189
189
|
serverHeadersRateLimit: void 0,
|
|
@@ -260,7 +260,7 @@ var ze = class {
|
|
|
260
260
|
return this.queues.size;
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
|
-
let
|
|
263
|
+
let T = {};
|
|
264
264
|
const g = {};
|
|
265
265
|
var Fe = class {
|
|
266
266
|
/**
|
|
@@ -293,12 +293,12 @@ var Fe = class {
|
|
|
293
293
|
let r = e.endpoint || t;
|
|
294
294
|
if (!r) {
|
|
295
295
|
const i = e.https === !1 ? "http" : "https";
|
|
296
|
-
e.oauthToken ? r = `${i}://${
|
|
296
|
+
e.oauthToken ? r = `${i}://${B(e.region)}/v1` : r = `${i}://${B(e.region)}/v2`;
|
|
297
297
|
}
|
|
298
298
|
const n = new Headers();
|
|
299
299
|
!e.oauthToken && typeof window < "u" || n.set("Content-Type", "application/json"), n.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([i, l]) => {
|
|
300
300
|
n.set(i, l);
|
|
301
|
-
}), e.oauthToken && n.set("Authorization", e.oauthToken), this.rateLimitConfig =
|
|
301
|
+
}), e.oauthToken && n.set("Authorization", e.oauthToken), this.rateLimitConfig = qe(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = e.retriesDelay ?? 300, this.throttleManager = new ze(this.throttledRequest.bind(this), 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.cvMode = ((s = e.cache) == null ? void 0 : s.cv) ?? "auto", this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Oe.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Pe({
|
|
302
302
|
baseURL: r,
|
|
303
303
|
timeout: e.timeout || 0,
|
|
304
304
|
headers: n,
|
|
@@ -307,10 +307,10 @@ var Fe = class {
|
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
parseParams(e) {
|
|
310
|
-
return e.token || (e.token = this.getToken()), !e.cv && this.cvMode === "auto" && (e.cv = g[e.token]), Array.isArray(e.resolve_relations) ? e.resolve_relations = e.resolve_relations.map(
|
|
310
|
+
return e.token || (e.token = this.getToken()), !e.cv && this.cvMode === "auto" && (e.cv = g[e.token]), Array.isArray(e.resolve_relations) ? e.resolve_relations = e.resolve_relations.map(D).join(",") : typeof e.resolve_relations == "string" && (e.resolve_relations = D(e.resolve_relations)), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
|
|
311
311
|
}
|
|
312
312
|
factoryParamOptions(e, t) {
|
|
313
|
-
return
|
|
313
|
+
return N(e) ? this.parseParams(t) : t;
|
|
314
314
|
}
|
|
315
315
|
makeRequest(e, t, r, n, s) {
|
|
316
316
|
const i = this.factoryParamOptions(e, $e(t, r, n));
|
|
@@ -319,7 +319,7 @@ var Fe = class {
|
|
|
319
319
|
get(e, t = {}, r) {
|
|
320
320
|
t || (t = {});
|
|
321
321
|
const n = `/${e}`;
|
|
322
|
-
|
|
322
|
+
N(n) && (t.version = t.version || this.version);
|
|
323
323
|
const s = this.factoryParamOptions(n, t);
|
|
324
324
|
return this.cacheResponse(n, s, void 0, r);
|
|
325
325
|
}
|
|
@@ -327,7 +327,7 @@ var Fe = class {
|
|
|
327
327
|
const s = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`.replace(/\/$/, ""), l = r ?? i.substring(i.lastIndexOf("/") + 1);
|
|
328
328
|
t.version = t.version || this.version;
|
|
329
329
|
const o = 1, a = await this.makeRequest(i, t, s, o, n);
|
|
330
|
-
return Me([a, ...await Ce(
|
|
330
|
+
return Me([a, ...await Ee(Ce(o, a.total ? Math.ceil(a.total / (a.perPage || s)) : 1), (c) => this.makeRequest(i, t, s, c + 1, n))], (c) => Object.values(c.data[l]));
|
|
331
331
|
}
|
|
332
332
|
post(e, t = {}, r) {
|
|
333
333
|
const n = `/${e}`, s = R(void 0, void 0, this.rateLimitConfig, _);
|
|
@@ -509,7 +509,7 @@ var Fe = class {
|
|
|
509
509
|
}), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
|
|
510
510
|
}
|
|
511
511
|
async cacheResponse(e, t, r, n) {
|
|
512
|
-
const s =
|
|
512
|
+
const s = V({
|
|
513
513
|
url: e,
|
|
514
514
|
params: t
|
|
515
515
|
}), i = this.cacheProvider();
|
|
@@ -517,7 +517,7 @@ var Fe = class {
|
|
|
517
517
|
const a = await i.get(s);
|
|
518
518
|
if (a) return Promise.resolve(a);
|
|
519
519
|
}
|
|
520
|
-
const l = !
|
|
520
|
+
const l = !N(e) && this.rateLimitConfig.isManagementApi ? _ : void 0, o = R(e, t, this.rateLimitConfig, l);
|
|
521
521
|
return new Promise(async (a, c) => {
|
|
522
522
|
var u;
|
|
523
523
|
try {
|
|
@@ -527,20 +527,20 @@ var Fe = class {
|
|
|
527
527
|
data: h.data,
|
|
528
528
|
headers: h.headers
|
|
529
529
|
};
|
|
530
|
-
const p =
|
|
530
|
+
const p = xe(h.headers);
|
|
531
531
|
if ((p == null ? void 0 : p.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = p.max), (u = h.headers) != null && u["per-page"] && (d = Object.assign({}, d, {
|
|
532
532
|
perPage: h.headers["per-page"] ? Number.parseInt(h.headers["per-page"]) : 0,
|
|
533
533
|
total: h.headers["per-page"] ? Number.parseInt(h.headers.total) : 0
|
|
534
534
|
})), d.data.story || d.data.stories) {
|
|
535
|
-
const
|
|
536
|
-
await this.resolveStories(d.data, t, `${
|
|
535
|
+
const L = this.resolveCounter = ++this.resolveCounter % 1e3;
|
|
536
|
+
await this.resolveStories(d.data, t, `${L}`), d = await this.processInlineAssets(d);
|
|
537
537
|
}
|
|
538
538
|
t.version === "published" && e !== "/cdn/spaces/me" && await i.set(s, d);
|
|
539
539
|
const $ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
|
|
540
540
|
return t.token && d.data.cv && ($ && g[t.token] && g[t.token] !== d.data.cv && await this.flushCache(), g[t.token] = d.data.cv), a(d);
|
|
541
541
|
} catch (h) {
|
|
542
542
|
if (h.response && h.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
|
|
543
|
-
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await
|
|
543
|
+
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Le(this.retriesDelay), this.cacheResponse(e, t, r).then(a).catch(c);
|
|
544
544
|
c(h);
|
|
545
545
|
}
|
|
546
546
|
});
|
|
@@ -565,16 +565,16 @@ var Fe = class {
|
|
|
565
565
|
case "memory":
|
|
566
566
|
return {
|
|
567
567
|
get(e) {
|
|
568
|
-
return Promise.resolve(
|
|
568
|
+
return Promise.resolve(T[e]);
|
|
569
569
|
},
|
|
570
570
|
getAll() {
|
|
571
|
-
return Promise.resolve(
|
|
571
|
+
return Promise.resolve(T);
|
|
572
572
|
},
|
|
573
573
|
set(e, t) {
|
|
574
|
-
return
|
|
574
|
+
return T[e] = t, Promise.resolve(void 0);
|
|
575
575
|
},
|
|
576
576
|
flush() {
|
|
577
|
-
return
|
|
577
|
+
return T = {}, Promise.resolve(void 0);
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
case "custom":
|
|
@@ -627,13 +627,13 @@ function W(e, t) {
|
|
|
627
627
|
}
|
|
628
628
|
if (typeof t == "object") {
|
|
629
629
|
if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (s.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (s.height = t.height, n = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete s.width, delete s.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (s.loading = t.loading), t.class && (s.class = t.class), t.filters) {
|
|
630
|
-
const { filters: a } = t || {}, { blur: c, brightness: u, fill: h, format: d, grayscale: p, quality: $, rotate:
|
|
631
|
-
c && l(c, 0, 100, "blur", i), $ && l($, 0, 100, "quality", i), u && l(u, 0, 100, "brightness", i), h && i.push(`fill(${h})`), p && i.push("grayscale()"),
|
|
630
|
+
const { filters: a } = t || {}, { blur: c, brightness: u, fill: h, format: d, grayscale: p, quality: $, rotate: L } = a || {};
|
|
631
|
+
c && l(c, 0, 100, "blur", i), $ && l($, 0, 100, "quality", i), u && l(u, 0, 100, "brightness", i), h && i.push(`fill(${h})`), p && i.push("grayscale()"), L && [
|
|
632
632
|
0,
|
|
633
633
|
90,
|
|
634
634
|
180,
|
|
635
635
|
270
|
|
636
|
-
].includes(t.filters.rotate || 0) && i.push(`rotate(${
|
|
636
|
+
].includes(t.filters.rotate || 0) && i.push(`rotate(${L})`), d && [
|
|
637
637
|
"webp",
|
|
638
638
|
"png",
|
|
639
639
|
"jpeg"
|
|
@@ -656,14 +656,14 @@ function W(e, t) {
|
|
|
656
656
|
attrs: s
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function q(e, t) {
|
|
660
660
|
if (e === t) return !0;
|
|
661
661
|
if (e == null || t === null || t === void 0) return e === t;
|
|
662
662
|
if (typeof e != typeof t || typeof e != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
663
663
|
if (Array.isArray(e))
|
|
664
|
-
return e.length !== t.length ? !1 : e.every((s, i) =>
|
|
664
|
+
return e.length !== t.length ? !1 : e.every((s, i) => q(s, t[i]));
|
|
665
665
|
const r = Object.keys(e), n = Object.keys(t);
|
|
666
|
-
return r.length !== n.length ? !1 : r.every((s) => Object.prototype.hasOwnProperty.call(t, s) &&
|
|
666
|
+
return r.length !== n.length ? !1 : r.every((s) => Object.prototype.hasOwnProperty.call(t, s) && q(e[s], t[s]));
|
|
667
667
|
}
|
|
668
668
|
const Ve = [
|
|
669
669
|
"area",
|
|
@@ -815,7 +815,7 @@ const Be = (e) => `h${typeof (e == null ? void 0 : e.level) == "number" ? Math.m
|
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
function Je(e) {
|
|
818
|
-
return Object.entries(e).filter(([, t]) =>
|
|
818
|
+
return Object.entries(e).filter(([, t]) => H(t)).map(([t, r]) => `${Qe(t)}: ${r};`).join(" ");
|
|
819
819
|
}
|
|
820
820
|
function We(e) {
|
|
821
821
|
return e.split(";").map((t) => t.trim()).filter(Boolean).reduce((t, r) => {
|
|
@@ -831,7 +831,7 @@ function Ye(e) {
|
|
|
831
831
|
function Qe(e) {
|
|
832
832
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function H(e) {
|
|
835
835
|
return e != null && e !== "";
|
|
836
836
|
}
|
|
837
837
|
const Xe = {
|
|
@@ -892,10 +892,10 @@ function st(e) {
|
|
|
892
892
|
return Array.isArray(e) ? e[0] != null ? `${e[0]}px` : void 0 : typeof e == "number" || typeof e == "string" ? e : String(e);
|
|
893
893
|
}
|
|
894
894
|
function it(e, t, r, n, s, i, l) {
|
|
895
|
-
if (!
|
|
895
|
+
if (!H(t) || et.has(e) || tt.has(e) && t === 1) return;
|
|
896
896
|
if (e in n) {
|
|
897
897
|
const a = n[e], c = st(t);
|
|
898
|
-
c !== void 0 &&
|
|
898
|
+
c !== void 0 && H(c) && (i[a] = c);
|
|
899
899
|
return;
|
|
900
900
|
}
|
|
901
901
|
const o = s[e] ?? e;
|
|
@@ -943,13 +943,13 @@ const ot = (e) => String(e).replace(/[&"'<>]/g, (t) => {
|
|
|
943
943
|
return t;
|
|
944
944
|
}
|
|
945
945
|
});
|
|
946
|
-
function
|
|
946
|
+
function M(e) {
|
|
947
947
|
if (e.type !== "text" || !e.marks) return null;
|
|
948
948
|
for (const t of e.marks) if (t.type === "link") return t;
|
|
949
949
|
return null;
|
|
950
950
|
}
|
|
951
951
|
function Y(e, t) {
|
|
952
|
-
return !e || !t ? !1 :
|
|
952
|
+
return !e || !t ? !1 : q(e.attrs ?? {}, t.attrs ?? {});
|
|
953
953
|
}
|
|
954
954
|
function lt(e) {
|
|
955
955
|
return e.type !== "text" || !e.marks ? [] : e.marks.filter((t) => t.type !== "link");
|
|
@@ -959,11 +959,11 @@ function at(e) {
|
|
|
959
959
|
let r = 0;
|
|
960
960
|
const n = e.length;
|
|
961
961
|
for (; r < n; ) {
|
|
962
|
-
const s = e[r], i =
|
|
962
|
+
const s = e[r], i = M(s);
|
|
963
963
|
if (i) {
|
|
964
964
|
const l = [s];
|
|
965
965
|
let o = r + 1;
|
|
966
|
-
for (; o < n && Y(i,
|
|
966
|
+
for (; o < n && Y(i, M(e[o])); )
|
|
967
967
|
l.push(e[o]), o++;
|
|
968
968
|
t.push({
|
|
969
969
|
nodes: l,
|
|
@@ -1021,7 +1021,7 @@ function v(e) {
|
|
|
1021
1021
|
const t = e.type, r = E[t] ?? Ke[t];
|
|
1022
1022
|
return r ? "resolve" in r && typeof r.resolve == "function" ? r.resolve(e.attrs) : "tag" in r && typeof r.tag == "string" ? r.tag : null : null;
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function P(e) {
|
|
1025
1025
|
return Ve.includes(e);
|
|
1026
1026
|
}
|
|
1027
1027
|
function ee(e) {
|
|
@@ -1036,11 +1036,11 @@ function ut(e) {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
return t;
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Ct(e, t) {
|
|
1040
1040
|
const r = X(e);
|
|
1041
1041
|
return r != null && r.length ? te(r, t) : "";
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function U(e, t) {
|
|
1044
1044
|
var o, a;
|
|
1045
1045
|
const r = e.type !== "text" && e.content ? te(e.content, t) : "", n = (o = t == null ? void 0 : t.renderers) == null ? void 0 : o[e.type];
|
|
1046
1046
|
if (n) {
|
|
@@ -1064,7 +1064,7 @@ function x(e, t) {
|
|
|
1064
1064
|
if (!s) return r;
|
|
1065
1065
|
if (e.type === "image" && (t != null && t.optimizeImage)) return ht(e, t);
|
|
1066
1066
|
const i = S(e.type, e.attrs);
|
|
1067
|
-
if (
|
|
1067
|
+
if (P(s)) return `<${s}${i}>`;
|
|
1068
1068
|
if (e.type === "table") return `<${s}${i}>${yt(e.content, t)}</${s}>`;
|
|
1069
1069
|
const l = ee(e);
|
|
1070
1070
|
return l ? `<${s}>${ne(e.type, l, e.attrs, r)}</${s}>` : `<${s}${i}>${r}</${s}>`;
|
|
@@ -1087,13 +1087,13 @@ function te(e, t) {
|
|
|
1087
1087
|
let r = "", n = 0;
|
|
1088
1088
|
const s = e.length;
|
|
1089
1089
|
for (; n < s; ) {
|
|
1090
|
-
const i = e[n], l =
|
|
1090
|
+
const i = e[n], l = M(i);
|
|
1091
1091
|
if (l) {
|
|
1092
1092
|
let o = n + 1;
|
|
1093
|
-
for (; o < s && Y(l,
|
|
1093
|
+
for (; o < s && Y(l, M(e[o])); ) o++;
|
|
1094
1094
|
r += dt(e, n, o, l, t), n = o;
|
|
1095
1095
|
} else
|
|
1096
|
-
r +=
|
|
1096
|
+
r += U(i, t), n++;
|
|
1097
1097
|
}
|
|
1098
1098
|
return r;
|
|
1099
1099
|
}
|
|
@@ -1137,12 +1137,12 @@ function yt(e, t) {
|
|
|
1137
1137
|
let n = "";
|
|
1138
1138
|
if (r > 0) {
|
|
1139
1139
|
n += "<thead>";
|
|
1140
|
-
for (let s = 0; s < r; s++) n +=
|
|
1140
|
+
for (let s = 0; s < r; s++) n += U(e[s], t);
|
|
1141
1141
|
n += "</thead>";
|
|
1142
1142
|
}
|
|
1143
1143
|
if (r < e.length) {
|
|
1144
1144
|
n += "<tbody>";
|
|
1145
|
-
for (let s = r; s < e.length; s++) n +=
|
|
1145
|
+
for (let s = r; s < e.length; s++) n += U(e[s], t);
|
|
1146
1146
|
n += "</tbody>";
|
|
1147
1147
|
}
|
|
1148
1148
|
return n;
|
|
@@ -1154,7 +1154,7 @@ function ne(e, t, r, n) {
|
|
|
1154
1154
|
...a,
|
|
1155
1155
|
...r
|
|
1156
1156
|
});
|
|
1157
|
-
if (
|
|
1157
|
+
if (P(l)) s += `<${l}${c}>`;
|
|
1158
1158
|
else {
|
|
1159
1159
|
const u = o ? ne(e, o, r, n) : n;
|
|
1160
1160
|
s += `<${l}${c}>${u}</${l}>`;
|
|
@@ -1169,27 +1169,20 @@ function S(e, t) {
|
|
|
1169
1169
|
}), n = r.style, s = { ...r };
|
|
1170
1170
|
return n && (s.style = Je(n)), ut(s);
|
|
1171
1171
|
}
|
|
1172
|
-
let
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1172
|
+
let j = !1, C;
|
|
1173
|
+
const J = [], pt = () => typeof window > "u" ? Promise.reject(
|
|
1174
|
+
new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)")
|
|
1175
|
+
) : (window.storyblokRegisterEvent = (e) => {
|
|
1176
|
+
if (!window.location.search.includes("_storyblok")) {
|
|
1177
|
+
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
1176
1178
|
return;
|
|
1177
1179
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}, document.getElementById("storyblok-javascript-bridge")) {
|
|
1185
|
-
t(void 0);
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
const n = document.createElement("script");
|
|
1189
|
-
n.async = !0, n.src = e, n.id = "storyblok-javascript-bridge", n.onerror = (s) => r(s), n.onload = (s) => {
|
|
1190
|
-
K.forEach((i) => i()), B = !0, t(s);
|
|
1191
|
-
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
1192
|
-
}), Et = (e = {}) => {
|
|
1180
|
+
j ? e() : J.push(e);
|
|
1181
|
+
}, j ? Promise.resolve() : C || (C = import("./index-CtMAhUF--JC8YsZOI.js").then(({ default: e }) => {
|
|
1182
|
+
window.StoryblokBridge = e, J.forEach((t) => t()), j = !0;
|
|
1183
|
+
}).catch((e) => {
|
|
1184
|
+
throw C = void 0, e;
|
|
1185
|
+
}), C)), Et = (e = {}) => {
|
|
1193
1186
|
const { apiOptions: t } = e;
|
|
1194
1187
|
if (!t || !t.accessToken) {
|
|
1195
1188
|
console.error(
|
|
@@ -1213,8 +1206,18 @@ const K = [], pt = (e) => new Promise((t, r) => {
|
|
|
1213
1206
|
return {};
|
|
1214
1207
|
}
|
|
1215
1208
|
};
|
|
1216
|
-
|
|
1217
|
-
const
|
|
1209
|
+
function mt(e) {
|
|
1210
|
+
const { language: t, resolveRelations: r, ...n } = e;
|
|
1211
|
+
return t && console.warn(
|
|
1212
|
+
"[Storyblok] The `language` bridge option is no longer supported by the bundled bridge. Language context is now passed automatically by the Visual Editor via the `_storyblok_lang` URL parameter."
|
|
1213
|
+
), {
|
|
1214
|
+
...n,
|
|
1215
|
+
...r !== void 0 && {
|
|
1216
|
+
resolveRelations: Array.isArray(r) ? r : [r]
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
const bt = (e, t, r = {}) => {
|
|
1218
1221
|
var n;
|
|
1219
1222
|
const s = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", i = new URL((n = window.location) == null ? void 0 : n.href).searchParams.get(
|
|
1220
1223
|
"_storyblok"
|
|
@@ -1225,13 +1228,15 @@ const mt = (e, t, r = {}) => {
|
|
|
1225
1228
|
return;
|
|
1226
1229
|
}
|
|
1227
1230
|
window.storyblokRegisterEvent(() => {
|
|
1228
|
-
new window.StoryblokBridge(
|
|
1231
|
+
new window.StoryblokBridge(
|
|
1232
|
+
mt(r)
|
|
1233
|
+
).on(["input", "published", "change"], (o) => {
|
|
1229
1234
|
var a;
|
|
1230
1235
|
o && (o.action === "input" && ((a = o.story) == null ? void 0 : a.id) === e ? t(o.story) : (o.action === "change" || o.action === "published") && o.storyId === e && window.location.reload());
|
|
1231
1236
|
});
|
|
1232
1237
|
});
|
|
1233
1238
|
}
|
|
1234
|
-
},
|
|
1239
|
+
}, kt = (e = {}) => {
|
|
1235
1240
|
var t, r;
|
|
1236
1241
|
const {
|
|
1237
1242
|
bridge: n,
|
|
@@ -1240,31 +1245,33 @@ const mt = (e, t, r = {}) => {
|
|
|
1240
1245
|
apiOptions: l = {},
|
|
1241
1246
|
bridgeUrl: o
|
|
1242
1247
|
} = e;
|
|
1243
|
-
|
|
1248
|
+
o && console.warn(
|
|
1249
|
+
"[Storyblok] The `bridgeUrl` option is deprecated and will be removed in a future major version. The Storyblok bridge is now bundled and is no longer loaded from a CDN URL."
|
|
1250
|
+
), l.accessToken = l.accessToken || s;
|
|
1244
1251
|
const a = { bridge: n, apiOptions: l };
|
|
1245
1252
|
let c = {};
|
|
1246
1253
|
i.forEach((h) => {
|
|
1247
1254
|
c = { ...c, ...h(a) };
|
|
1248
|
-
})
|
|
1255
|
+
});
|
|
1249
1256
|
const u = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
|
|
1250
|
-
return n !== !1 && u && pt(
|
|
1251
|
-
}, se = /* @__PURE__ */
|
|
1257
|
+
return n !== !1 && u && pt(), c;
|
|
1258
|
+
}, se = /* @__PURE__ */ F({
|
|
1252
1259
|
__name: "StoryblokComponent",
|
|
1253
1260
|
props: {
|
|
1254
1261
|
blok: {}
|
|
1255
1262
|
},
|
|
1256
1263
|
setup(e, { expose: t }) {
|
|
1257
1264
|
var a;
|
|
1258
|
-
const r = e, n = fe(), s =
|
|
1265
|
+
const r = e, n = fe(), s = x();
|
|
1259
1266
|
t({
|
|
1260
1267
|
value: s
|
|
1261
1268
|
});
|
|
1262
|
-
const i = typeof
|
|
1263
|
-
return !i && l && (l.enableFallbackComponent ? (o.value = l.customFallbackComponent ?? "FallbackComponent", typeof
|
|
1269
|
+
const i = typeof O(r.blok.component) != "string", l = de("VueSDKOptions"), o = x((a = r.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
|
|
1270
|
+
return !i && l && (l.enableFallbackComponent ? (o.value = l.customFallbackComponent ?? "FallbackComponent", typeof O(o.value) == "string" && console.error(
|
|
1264
1271
|
`Is the Fallback component "${o.value}" registered properly?`
|
|
1265
1272
|
)) : console.error(
|
|
1266
1273
|
`Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`
|
|
1267
|
-
)), (c, u) => (ye(), pe(
|
|
1274
|
+
)), (c, u) => (ye(), pe(O(o.value), ge({
|
|
1268
1275
|
ref_key: "blokRef",
|
|
1269
1276
|
ref: s
|
|
1270
1277
|
}, { ...c.$props, ...c.$attrs }), me({ _: 2 }, [
|
|
@@ -1276,7 +1283,7 @@ const mt = (e, t, r = {}) => {
|
|
|
1276
1283
|
}))
|
|
1277
1284
|
]), 1040));
|
|
1278
1285
|
}
|
|
1279
|
-
}), ie =
|
|
1286
|
+
}), ie = F({
|
|
1280
1287
|
name: "StoryblokBlokRenderer",
|
|
1281
1288
|
props: {
|
|
1282
1289
|
type: {
|
|
@@ -1316,7 +1323,7 @@ const mt = (e, t, r = {}) => {
|
|
|
1316
1323
|
};
|
|
1317
1324
|
}
|
|
1318
1325
|
});
|
|
1319
|
-
function
|
|
1326
|
+
function G(e, t) {
|
|
1320
1327
|
return t == null ? void 0 : t[e];
|
|
1321
1328
|
}
|
|
1322
1329
|
function oe(e) {
|
|
@@ -1328,13 +1335,13 @@ function oe(e) {
|
|
|
1328
1335
|
};
|
|
1329
1336
|
}
|
|
1330
1337
|
function w(e, t) {
|
|
1331
|
-
return at(e).map((n, s) => n.linkMark ?
|
|
1338
|
+
return at(e).map((n, s) => n.linkMark ? vt(n.nodes, n.linkMark, t, n._key || s) : z(n.nodes[0], t, n._key || s));
|
|
1332
1339
|
}
|
|
1333
|
-
function
|
|
1340
|
+
function vt(e, t, r, n) {
|
|
1334
1341
|
const s = e.map((o, a) => {
|
|
1335
1342
|
const c = o, u = lt(o);
|
|
1336
1343
|
return ae(c, u, r);
|
|
1337
|
-
}), i =
|
|
1344
|
+
}), i = G(t.type, r.components);
|
|
1338
1345
|
if (i)
|
|
1339
1346
|
return y(i, { key: n, ...t, context: r }, {
|
|
1340
1347
|
default: () => s
|
|
@@ -1342,9 +1349,9 @@ function kt(e, t, r, n) {
|
|
|
1342
1349
|
const l = v(t);
|
|
1343
1350
|
return l ? y(l, { key: n, ...k(t.type, t.attrs) }, s) : s.length > 0 ? s[0] : b("");
|
|
1344
1351
|
}
|
|
1345
|
-
function
|
|
1352
|
+
function z(e, t, r) {
|
|
1346
1353
|
var c;
|
|
1347
|
-
const n = e.type !== "text" && e.content ? w(e.content, t) : [], s =
|
|
1354
|
+
const n = e.type !== "text" && e.content ? w(e.content, t) : [], s = G(e.type, t.components);
|
|
1348
1355
|
if (s) {
|
|
1349
1356
|
const u = (c = t.components) != null && c[e.type] ? { ...t, components: { ...t.components, [e.type]: void 0 } } : t;
|
|
1350
1357
|
return y(s, { key: r, ...e, context: u }, n.length ? {
|
|
@@ -1352,19 +1359,19 @@ function H(e, t, r) {
|
|
|
1352
1359
|
} : void 0);
|
|
1353
1360
|
}
|
|
1354
1361
|
if (e.type === "text")
|
|
1355
|
-
return
|
|
1362
|
+
return wt(e, t);
|
|
1356
1363
|
const i = v(e);
|
|
1357
1364
|
if (!i) {
|
|
1358
1365
|
const u = e.content ? w(e.content, t) : [];
|
|
1359
1366
|
return u.length === 0 ? b("") : u.length === 1 ? u[0] : y("div", { key: r }, u);
|
|
1360
1367
|
}
|
|
1361
1368
|
if (e.type === "image" && t.optimizeImage)
|
|
1362
|
-
return
|
|
1369
|
+
return _t(e, t, r);
|
|
1363
1370
|
const l = k(e.type, e.attrs);
|
|
1364
|
-
if (
|
|
1371
|
+
if (P(i))
|
|
1365
1372
|
return y(i, { key: r, ...l });
|
|
1366
1373
|
if (e.type === "table")
|
|
1367
|
-
return
|
|
1374
|
+
return Rt(e, t, r, i, l);
|
|
1368
1375
|
const o = ee(e);
|
|
1369
1376
|
if (o) {
|
|
1370
1377
|
const u = e.content ? w(e.content, t) : [], h = le(e.type, o, e.attrs, u);
|
|
@@ -1373,7 +1380,7 @@ function H(e, t, r) {
|
|
|
1373
1380
|
const a = e.content ? w(e.content, t) : [];
|
|
1374
1381
|
return y(i, { key: r, ...l }, a);
|
|
1375
1382
|
}
|
|
1376
|
-
function
|
|
1383
|
+
function _t(e, t, r) {
|
|
1377
1384
|
const n = e.attrs, s = n == null ? void 0 : n.src;
|
|
1378
1385
|
if (!s)
|
|
1379
1386
|
return b("");
|
|
@@ -1384,35 +1391,35 @@ function vt(e, t, r) {
|
|
|
1384
1391
|
});
|
|
1385
1392
|
return y("img", { key: r, ...o });
|
|
1386
1393
|
}
|
|
1387
|
-
function
|
|
1394
|
+
function Rt(e, t, r, n, s) {
|
|
1388
1395
|
const { headerRows: i, bodyRows: l } = ct(e.content), o = [];
|
|
1389
1396
|
return i.length > 0 && o.push(
|
|
1390
|
-
y("thead", { key: "thead" }, i.map((a, c) =>
|
|
1397
|
+
y("thead", { key: "thead" }, i.map((a, c) => z(a, t, c)))
|
|
1391
1398
|
), l.length > 0 && o.push(
|
|
1392
|
-
y("tbody", { key: "tbody" }, l.map((a, c) =>
|
|
1399
|
+
y("tbody", { key: "tbody" }, l.map((a, c) => z(a, t, c)))
|
|
1393
1400
|
), y(n, { key: r, ...s }, o);
|
|
1394
1401
|
}
|
|
1395
1402
|
function le(e, t, r, n) {
|
|
1396
1403
|
return t.map((s, i) => {
|
|
1397
1404
|
const { tag: l, children: o, attrs: a } = s, c = { ...a, ...r }, u = k(e, c);
|
|
1398
|
-
if (
|
|
1405
|
+
if (P(l))
|
|
1399
1406
|
return y(l, { key: i, ...u });
|
|
1400
1407
|
const h = o ? le(e, o, r, n) : n;
|
|
1401
1408
|
return y(l, { key: i, ...u }, h);
|
|
1402
1409
|
});
|
|
1403
1410
|
}
|
|
1404
|
-
function
|
|
1411
|
+
function wt(e, t, r) {
|
|
1405
1412
|
return ae(e, e.marks, t);
|
|
1406
1413
|
}
|
|
1407
1414
|
function ae(e, t, r, n) {
|
|
1408
1415
|
let s = e.text;
|
|
1409
1416
|
if (t != null && t.length)
|
|
1410
1417
|
for (const i of t)
|
|
1411
|
-
s =
|
|
1418
|
+
s = At(s, i, r);
|
|
1412
1419
|
return typeof s == "string" ? b(s) : s;
|
|
1413
1420
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const n =
|
|
1421
|
+
function At(e, t, r) {
|
|
1422
|
+
const n = G(t.type, r.components);
|
|
1416
1423
|
if (n) {
|
|
1417
1424
|
const i = typeof e == "string" ? b(e) : e;
|
|
1418
1425
|
return y(n, { ...t, context: r }, {
|
|
@@ -1422,7 +1429,7 @@ function wt(e, t, r) {
|
|
|
1422
1429
|
const s = v(t);
|
|
1423
1430
|
return s ? y(s, k(t.type, t.attrs), typeof e == "string" ? e : [e]) : typeof e == "string" ? b(e) : e;
|
|
1424
1431
|
}
|
|
1425
|
-
const
|
|
1432
|
+
const St = F({
|
|
1426
1433
|
name: "StoryblokRichText",
|
|
1427
1434
|
props: {
|
|
1428
1435
|
document: {
|
|
@@ -1454,7 +1461,7 @@ const At = U({
|
|
|
1454
1461
|
return () => t(e.document);
|
|
1455
1462
|
}
|
|
1456
1463
|
});
|
|
1457
|
-
function
|
|
1464
|
+
function Mt(e) {
|
|
1458
1465
|
return oe({
|
|
1459
1466
|
optimizeImage: e.optimizeImage,
|
|
1460
1467
|
components: {
|
|
@@ -1463,7 +1470,7 @@ function Ct(e) {
|
|
|
1463
1470
|
}
|
|
1464
1471
|
});
|
|
1465
1472
|
}
|
|
1466
|
-
const
|
|
1473
|
+
const $t = {
|
|
1467
1474
|
beforeMount(e, t) {
|
|
1468
1475
|
if (t.value) {
|
|
1469
1476
|
const r = gt(t.value);
|
|
@@ -1475,10 +1482,10 @@ const St = {
|
|
|
1475
1482
|
`);
|
|
1476
1483
|
};
|
|
1477
1484
|
let A = null;
|
|
1478
|
-
const
|
|
1479
|
-
const n =
|
|
1485
|
+
const Pt = () => (A || ce("useStoryblokApi"), A), Ot = async (e, t = {}, r = {}) => {
|
|
1486
|
+
const n = x(null);
|
|
1480
1487
|
if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, Se(() => {
|
|
1481
|
-
n.value && n.value.id &&
|
|
1488
|
+
n.value && n.value.id && bt(
|
|
1482
1489
|
n.value.id,
|
|
1483
1490
|
(s) => n.value = s,
|
|
1484
1491
|
r
|
|
@@ -1492,27 +1499,27 @@ const Mt = () => (A || ce("useStoryblokApi"), A), Pt = async (e, t = {}, r = {})
|
|
|
1492
1499
|
} else
|
|
1493
1500
|
ce("useStoryblok");
|
|
1494
1501
|
return n;
|
|
1495
|
-
},
|
|
1502
|
+
}, Nt = {
|
|
1496
1503
|
install(e, t = {}) {
|
|
1497
|
-
e.directive("editable",
|
|
1504
|
+
e.directive("editable", $t), e.component("StoryblokComponent", se), e.component("StoryblokRichText", St), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
|
|
1498
1505
|
"FallbackComponent",
|
|
1499
1506
|
Ae(() => import("./FallbackComponent-1UpuMdw-.js"))
|
|
1500
1507
|
);
|
|
1501
|
-
const { storyblokApi: r } =
|
|
1508
|
+
const { storyblokApi: r } = kt(t);
|
|
1502
1509
|
A = r || null, e.provide("VueSDKOptions", t);
|
|
1503
1510
|
}
|
|
1504
1511
|
};
|
|
1505
1512
|
export {
|
|
1506
1513
|
Fe as StoryblokClient,
|
|
1507
1514
|
se as StoryblokComponent,
|
|
1508
|
-
|
|
1509
|
-
|
|
1515
|
+
St as StoryblokRichText,
|
|
1516
|
+
Nt as StoryblokVue,
|
|
1510
1517
|
Et as apiPlugin,
|
|
1511
1518
|
W as buildStoryblokImage,
|
|
1512
|
-
|
|
1519
|
+
Ct as renderRichText,
|
|
1513
1520
|
ct as splitTableRows,
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1521
|
+
Ot as useStoryblok,
|
|
1522
|
+
Pt as useStoryblokApi,
|
|
1523
|
+
bt as useStoryblokBridge,
|
|
1524
|
+
Mt as useStoryblokRichText
|
|
1518
1525
|
};
|