@storyblok/astro 7.2.5 → 7.2.8
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/storyblok-astro.es.js +257 -239
- package/dist/storyblok-astro.umd.js +5 -5
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ee = `<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
2
2
|
<g id="storyblok-logo-kit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
3
3
|
<g id="storyblok-partner-logo" transform="translate(-59.000000, -169.000000)" fill-rule="nonzero">
|
|
4
4
|
<g id="storyblok-symbol" transform="translate(59.000000, 169.000000)">
|
|
@@ -7,15 +7,15 @@ const Q = `<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xml
|
|
|
7
7
|
</g>
|
|
8
8
|
</g>
|
|
9
9
|
</g>
|
|
10
|
-
</svg>`,
|
|
11
|
-
let
|
|
12
|
-
for (let
|
|
13
|
-
const u = e[
|
|
14
|
-
|
|
10
|
+
</svg>`, te = /[\p{Lu}]/u, re = /[\p{Ll}]/u, M = /^[\p{Lu}](?![\p{Lu}])/gu, z = /([\p{Alpha}\p{N}_]|$)/u, O = /[_.\- ]+/, oe = new RegExp("^" + O.source), P = new RegExp(O.source + z.source, "gu"), j = new RegExp("\\d+" + z.source, "gu"), se = (e, t, s, n) => {
|
|
11
|
+
let a = !1, o = !1, f = !1, y = !1;
|
|
12
|
+
for (let d = 0; d < e.length; d++) {
|
|
13
|
+
const u = e[d];
|
|
14
|
+
y = d > 2 ? e[d - 3] === "-" : !0, a && te.test(u) ? (e = e.slice(0, d) + "-" + e.slice(d), a = !1, f = o, o = !0, d++) : o && f && re.test(u) && (!y || n) ? (e = e.slice(0, d - 1) + "-" + e.slice(d - 1), f = o, o = !1, a = !0) : (a = t(u) === u && s(u) !== u, f = o, o = s(u) === u && t(u) !== u);
|
|
15
15
|
}
|
|
16
16
|
return e;
|
|
17
|
-
},
|
|
18
|
-
function
|
|
17
|
+
}, ne = (e, t) => (M.lastIndex = 0, e.replaceAll(M, (s) => t(s))), le = (e, t) => (P.lastIndex = 0, j.lastIndex = 0, e.replaceAll(j, (s, n, a) => ["_", "-"].includes(e.charAt(a + s.length)) ? s : t(s)).replaceAll(P, (s, n) => t(n)));
|
|
18
|
+
function ae(e, t) {
|
|
19
19
|
if (!(typeof e == "string" || Array.isArray(e)))
|
|
20
20
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
21
21
|
if (t = {
|
|
@@ -25,56 +25,56 @@ function le(e, t) {
|
|
|
25
25
|
}, Array.isArray(e) ? e = e.map((o) => o.trim()).filter((o) => o.length).join("-") : e = e.trim(), e.length === 0)
|
|
26
26
|
return "";
|
|
27
27
|
const s = t.locale === !1 ? (o) => o.toLowerCase() : (o) => o.toLocaleLowerCase(t.locale), n = t.locale === !1 ? (o) => o.toUpperCase() : (o) => o.toLocaleUpperCase(t.locale);
|
|
28
|
-
return e.length === 1 ? O.test(e) ? "" : t.pascalCase ? n(e) : s(e) : (e !== s(e) && (e =
|
|
28
|
+
return e.length === 1 ? O.test(e) ? "" : t.pascalCase ? n(e) : s(e) : (e !== s(e) && (e = se(e, s, n, t.preserveConsecutiveUppercase)), e = e.replace(oe, ""), e = t.preserveConsecutiveUppercase ? ne(e, s) : s(e), t.pascalCase && (e = n(e.charAt(0)) + e.slice(1)), le(e, n));
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function D(e) {
|
|
31
|
+
return ae(e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
33
|
+
function ie(e, t = {}, s, n) {
|
|
34
|
+
const a = "virtual:storyblok-components", o = `\0${a}`;
|
|
35
35
|
return {
|
|
36
36
|
name: "vite-plugin-storyblok-components",
|
|
37
|
-
async resolveId(
|
|
38
|
-
if (
|
|
37
|
+
async resolveId(f) {
|
|
38
|
+
if (f === a)
|
|
39
39
|
return o;
|
|
40
40
|
},
|
|
41
|
-
async load(
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
for await (const [
|
|
41
|
+
async load(f) {
|
|
42
|
+
if (f === o) {
|
|
43
|
+
const y = [], d = [];
|
|
44
|
+
for await (const [h, C] of Object.entries(t)) {
|
|
45
45
|
const L = await this.resolve(
|
|
46
|
-
`/${e}/${
|
|
46
|
+
`/${e}/${C}.astro`
|
|
47
47
|
);
|
|
48
48
|
if (L)
|
|
49
|
-
|
|
49
|
+
y.push(`import ${D(h)} from "${L.id}"`);
|
|
50
50
|
else if (s)
|
|
51
|
-
|
|
51
|
+
d.push(h);
|
|
52
52
|
else
|
|
53
53
|
throw new Error(
|
|
54
|
-
`Component could not be found for blok "${
|
|
54
|
+
`Component could not be found for blok "${h}"! Does "${`/${e}/${C}`}.astro" exist?`
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
let u = "";
|
|
58
58
|
if (s)
|
|
59
59
|
if (u = ",FallbackComponent", n) {
|
|
60
|
-
const
|
|
60
|
+
const h = await this.resolve(
|
|
61
61
|
`/${e}/${n}.astro`
|
|
62
62
|
);
|
|
63
|
-
if (!
|
|
63
|
+
if (!h)
|
|
64
64
|
throw new Error(
|
|
65
65
|
`Custom fallback component could not be found. Does "${`/${e}/${n}`}.astro" exist?`
|
|
66
66
|
);
|
|
67
|
-
|
|
68
|
-
`import FallbackComponent from "${
|
|
67
|
+
y.push(
|
|
68
|
+
`import FallbackComponent from "${h.id}"`
|
|
69
69
|
);
|
|
70
70
|
} else
|
|
71
|
-
|
|
71
|
+
y.push(
|
|
72
72
|
"import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'"
|
|
73
73
|
);
|
|
74
74
|
if (Object.values(t).length)
|
|
75
|
-
return `${
|
|
75
|
+
return `${y.join(";")};export default {${Object.keys(t).filter((h) => !d.includes(h)).map((h) => D(h)).join(",")}${u}}`;
|
|
76
76
|
if (s)
|
|
77
|
-
return `${
|
|
77
|
+
return `${y[0]}; export default {${u.replace(",", "")}}`;
|
|
78
78
|
throw new Error(
|
|
79
79
|
`Currently, no Storyblok components are registered in astro.config.mjs.
|
|
80
80
|
Please register your components or enable the fallback component.
|
|
@@ -84,16 +84,16 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const n = "virtual:storyblok-init",
|
|
87
|
+
function ce(e, t, s) {
|
|
88
|
+
const n = "virtual:storyblok-init", a = `\0${n}`;
|
|
89
89
|
return {
|
|
90
90
|
name: "vite-plugin-storyblok-init",
|
|
91
91
|
async resolveId(o) {
|
|
92
92
|
if (o === n)
|
|
93
|
-
return
|
|
93
|
+
return a;
|
|
94
94
|
},
|
|
95
95
|
async load(o) {
|
|
96
|
-
if (o ===
|
|
96
|
+
if (o === a)
|
|
97
97
|
return `
|
|
98
98
|
import { storyblokInit, apiPlugin } from "@storyblok/js";
|
|
99
99
|
const { storyblokApi } = storyblokInit({
|
|
@@ -106,7 +106,7 @@ function ie(e, t, s) {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function de(e) {
|
|
110
110
|
const t = "virtual:storyblok-options", s = `\0${t}`;
|
|
111
111
|
return {
|
|
112
112
|
name: "vite-plugin-storyblok-options",
|
|
@@ -120,19 +120,19 @@ function ce(e) {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Ee() {
|
|
124
124
|
if (!(globalThis != null && globalThis.storyblokApiInstance))
|
|
125
125
|
throw new Error("storyblokApiInstance has not been initialized correctly");
|
|
126
126
|
return globalThis.storyblokApiInstance;
|
|
127
127
|
}
|
|
128
|
-
async function
|
|
128
|
+
async function Le(e) {
|
|
129
129
|
let t = null;
|
|
130
130
|
return e && e.locals._storyblok_preview_data && (t = e.locals._storyblok_preview_data), t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ue(e) {
|
|
133
133
|
return typeof e == "object" ? `const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});` : "const storyblokInstance = new StoryblokBridge();";
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Ae(e) {
|
|
136
136
|
const t = {
|
|
137
137
|
useCustomApi: !1,
|
|
138
138
|
bridge: !0,
|
|
@@ -140,35 +140,35 @@ function Le(e) {
|
|
|
140
140
|
enableFallbackComponent: !1,
|
|
141
141
|
livePreview: !1,
|
|
142
142
|
...e
|
|
143
|
-
}, s =
|
|
143
|
+
}, s = ue(t.bridge);
|
|
144
144
|
return {
|
|
145
145
|
name: "@storyblok/astro",
|
|
146
146
|
hooks: {
|
|
147
147
|
"astro:config:setup": ({
|
|
148
148
|
injectScript: n,
|
|
149
|
-
updateConfig:
|
|
149
|
+
updateConfig: a,
|
|
150
150
|
addDevToolbarApp: o,
|
|
151
|
-
addMiddleware:
|
|
152
|
-
config:
|
|
151
|
+
addMiddleware: f,
|
|
152
|
+
config: y
|
|
153
153
|
}) => {
|
|
154
|
-
if (
|
|
154
|
+
if (a({
|
|
155
155
|
vite: {
|
|
156
156
|
plugins: [
|
|
157
|
-
|
|
157
|
+
ce(
|
|
158
158
|
t.accessToken,
|
|
159
159
|
t.useCustomApi,
|
|
160
160
|
t.apiOptions
|
|
161
161
|
),
|
|
162
|
-
|
|
162
|
+
ie(
|
|
163
163
|
t.componentsDir,
|
|
164
164
|
t.components,
|
|
165
165
|
t.enableFallbackComponent,
|
|
166
166
|
t.customFallbackComponent
|
|
167
167
|
),
|
|
168
|
-
|
|
168
|
+
de(t)
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
|
-
}), t.livePreview && (
|
|
171
|
+
}), t.livePreview && (y == null ? void 0 : y.output) !== "server")
|
|
172
172
|
throw new Error(
|
|
173
173
|
"To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode."
|
|
174
174
|
);
|
|
@@ -200,44 +200,44 @@ function Le(e) {
|
|
|
200
200
|
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
201
201
|
});
|
|
202
202
|
`
|
|
203
|
-
),
|
|
203
|
+
), f({
|
|
204
204
|
entrypoint: "@storyblok/astro/middleware.ts",
|
|
205
205
|
order: "pre"
|
|
206
206
|
})), o({
|
|
207
207
|
id: "storyblok",
|
|
208
208
|
name: "Storyblok",
|
|
209
|
-
icon:
|
|
209
|
+
icon: ee,
|
|
210
210
|
entrypoint: "@storyblok/astro/toolbarApp.ts"
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
let
|
|
217
|
-
async function
|
|
216
|
+
let U;
|
|
217
|
+
async function $e(e) {
|
|
218
218
|
const { action: t, story: s } = e || {};
|
|
219
219
|
if (t === "input" && s) {
|
|
220
220
|
const n = async () => {
|
|
221
|
-
const o = await
|
|
222
|
-
if (o.outerHTML ===
|
|
221
|
+
const o = await be(s), f = document.body;
|
|
222
|
+
if (o.outerHTML === f.outerHTML)
|
|
223
223
|
return;
|
|
224
|
-
const
|
|
225
|
-
|
|
224
|
+
const y = document.querySelector('[data-blok-focused="true"]');
|
|
225
|
+
pe(f, o, y), document.dispatchEvent(new Event("storyblok-live-preview-updated"));
|
|
226
226
|
};
|
|
227
|
-
clearTimeout(
|
|
227
|
+
clearTimeout(U), U = setTimeout(n, 500);
|
|
228
228
|
}
|
|
229
229
|
["published", "change"].includes(e == null ? void 0 : e.action) && location.reload();
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function pe(e, t, s) {
|
|
232
232
|
if (s) {
|
|
233
|
-
const n = s.getAttribute("data-blok-uid"),
|
|
233
|
+
const n = s.getAttribute("data-blok-uid"), a = t.querySelector(
|
|
234
234
|
`[data-blok-uid="${n}"]`
|
|
235
235
|
);
|
|
236
|
-
|
|
236
|
+
a && (a.setAttribute("data-blok-focused", "true"), s.replaceWith(a));
|
|
237
237
|
} else
|
|
238
238
|
e.replaceWith(t);
|
|
239
239
|
}
|
|
240
|
-
async function
|
|
240
|
+
async function be(e) {
|
|
241
241
|
const s = await (await fetch(location.href, {
|
|
242
242
|
method: "POST",
|
|
243
243
|
body: JSON.stringify({
|
|
@@ -250,16 +250,16 @@ async function pe(e) {
|
|
|
250
250
|
})).text();
|
|
251
251
|
return new DOMParser().parseFromString(s, "text/html").body;
|
|
252
252
|
}
|
|
253
|
-
let
|
|
253
|
+
let k = /* @__PURE__ */ function(e) {
|
|
254
254
|
return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
|
|
255
|
-
}({}),
|
|
255
|
+
}({}), w = /* @__PURE__ */ function(e) {
|
|
256
256
|
return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
|
|
257
|
-
}({}),
|
|
257
|
+
}({}), ye = /* @__PURE__ */ function(e) {
|
|
258
258
|
return e.TEXT = "text", e;
|
|
259
259
|
}({}), I = /* @__PURE__ */ function(e) {
|
|
260
260
|
return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
|
|
261
261
|
}({});
|
|
262
|
-
const
|
|
262
|
+
const fe = [
|
|
263
263
|
"area",
|
|
264
264
|
"base",
|
|
265
265
|
"br",
|
|
@@ -274,244 +274,262 @@ const ye = [
|
|
|
274
274
|
"source",
|
|
275
275
|
"track",
|
|
276
276
|
"wbr"
|
|
277
|
-
],
|
|
278
|
-
function
|
|
277
|
+
], he = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), ge = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
|
|
278
|
+
function ke(e) {
|
|
279
279
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
280
280
|
}
|
|
281
|
-
const
|
|
281
|
+
const S = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
|
|
282
282
|
function me(e, t) {
|
|
283
283
|
if (!t) return {
|
|
284
284
|
src: e,
|
|
285
285
|
attrs: {}
|
|
286
286
|
};
|
|
287
287
|
let s = 0, n = 0;
|
|
288
|
-
const
|
|
289
|
-
function
|
|
290
|
-
typeof
|
|
288
|
+
const a = {}, o = [];
|
|
289
|
+
function f(d, u, h, C, L) {
|
|
290
|
+
typeof d != "number" || d <= u || d >= h ? console.warn(`[StoryblokRichText] - ${C.charAt(0).toUpperCase() + C.slice(1)} value must be a number between ${u} and ${h} (inclusive)`) : L.push(`${C}(${d})`);
|
|
291
291
|
}
|
|
292
292
|
if (typeof t == "object") {
|
|
293
|
-
if (typeof t.width == "number" && t.width > 0 ? (
|
|
294
|
-
const { filters:
|
|
295
|
-
u &&
|
|
293
|
+
if (typeof t.width == "number" && t.width > 0 ? (a.width = t.width, s = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (a.height = t.height, n = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (a.loading = t.loading), t.class && (a.class = t.class), t.filters) {
|
|
294
|
+
const { filters: d } = t || {}, { blur: u, brightness: h, fill: C, format: L, grayscale: R, quality: v, rotate: A } = d || {};
|
|
295
|
+
u && f(u, 0, 100, "blur", o), v && f(v, 0, 100, "quality", o), h && f(h, 0, 100, "brightness", o), C && o.push(`fill(${C})`), R && o.push("grayscale()"), A && [
|
|
296
296
|
0,
|
|
297
297
|
90,
|
|
298
298
|
180,
|
|
299
299
|
270
|
|
300
|
-
].includes(t.filters.rotate || 0) && o.push(`rotate(${
|
|
300
|
+
].includes(t.filters.rotate || 0) && o.push(`rotate(${A})`), L && [
|
|
301
301
|
"webp",
|
|
302
302
|
"png",
|
|
303
303
|
"jpeg"
|
|
304
304
|
].includes(L) && o.push(`format(${L})`);
|
|
305
305
|
}
|
|
306
|
-
t.srcset && (
|
|
307
|
-
if (typeof
|
|
308
|
-
if (Array.isArray(
|
|
309
|
-
const [u,
|
|
310
|
-
return `${e}/m/${u}x${
|
|
306
|
+
t.srcset && (a.srcset = t.srcset.map((d) => {
|
|
307
|
+
if (typeof d == "number") return `${e}/m/${d}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${d}w`;
|
|
308
|
+
if (Array.isArray(d) && d.length === 2) {
|
|
309
|
+
const [u, h] = d;
|
|
310
|
+
return `${e}/m/${u}x${h}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${u}w`;
|
|
311
311
|
} else {
|
|
312
312
|
console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
|
-
}).join(", ")), t.sizes && (
|
|
315
|
+
}).join(", ")), t.sizes && (a.sizes = t.sizes.join(", "));
|
|
316
316
|
}
|
|
317
|
-
let
|
|
318
|
-
return s > 0 && n > 0 && (
|
|
319
|
-
src:
|
|
320
|
-
attrs:
|
|
317
|
+
let y = `${e}/m/`;
|
|
318
|
+
return s > 0 && n > 0 && (y = `${y}${s}x${n}/`), o.length > 0 && (y = `${y}filters:${o.join(":")}`), {
|
|
319
|
+
src: y,
|
|
320
|
+
attrs: a
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
const n =
|
|
323
|
+
function H(e, t = {}, s) {
|
|
324
|
+
const n = he(t), a = n ? `${e} ${n}` : e, o = Array.isArray(s) ? s.join("") : s || "";
|
|
325
325
|
if (e) {
|
|
326
|
-
if (
|
|
326
|
+
if (fe.includes(e)) return `<${a}>`;
|
|
327
327
|
} else return o;
|
|
328
|
-
return `<${
|
|
328
|
+
return `<${a}>${o}</${e}>`;
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
const t = /* @__PURE__ */ new Map(), { renderFn: s =
|
|
332
|
-
const
|
|
333
|
-
return
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
function ve(e = {}) {
|
|
331
|
+
const t = /* @__PURE__ */ new Map(), { renderFn: s = H, textFn: n = ke, resolvers: a = {}, optimizeImages: o = !1, keyedResolvers: f = !1 } = e, y = s !== H, d = (r = {}) => {
|
|
332
|
+
const { textAlign: l, class: i, id: c, style: p, ...g } = r, b = [];
|
|
333
|
+
return p && b.push(p.endsWith(";") ? p : `${p};`), l && b.push(`text-align: ${l};`), S({
|
|
334
|
+
...g,
|
|
335
|
+
class: i,
|
|
336
|
+
id: c,
|
|
337
|
+
...b.length > 0 ? { style: b.join(" ") } : {}
|
|
338
|
+
});
|
|
339
|
+
}, u = (r) => (l, i) => {
|
|
340
|
+
const c = d(l.attrs);
|
|
341
|
+
return i.render(r, c, l.children || null);
|
|
342
|
+
}, h = (r, l) => {
|
|
343
|
+
const { src: i, alt: c, title: p, srcset: g, sizes: b } = r.attrs || {};
|
|
344
|
+
let E = i, m = {};
|
|
337
345
|
if (o) {
|
|
338
|
-
const { src:
|
|
339
|
-
|
|
346
|
+
const { src: V, attrs: Q } = me(i, o);
|
|
347
|
+
E = V, m = Q;
|
|
340
348
|
}
|
|
341
|
-
const
|
|
342
|
-
src:
|
|
343
|
-
alt:
|
|
344
|
-
title:
|
|
345
|
-
srcset:
|
|
346
|
-
sizes:
|
|
347
|
-
...
|
|
349
|
+
const $ = {
|
|
350
|
+
src: E,
|
|
351
|
+
alt: c,
|
|
352
|
+
title: p,
|
|
353
|
+
srcset: g,
|
|
354
|
+
sizes: b,
|
|
355
|
+
...m
|
|
348
356
|
};
|
|
349
|
-
return
|
|
350
|
-
},
|
|
351
|
-
const { level:
|
|
352
|
-
return
|
|
353
|
-
},
|
|
354
|
-
var
|
|
355
|
-
const
|
|
356
|
-
src: (
|
|
357
|
-
alt: (
|
|
357
|
+
return l.render("img", S($));
|
|
358
|
+
}, C = (r, l) => {
|
|
359
|
+
const { level: i, ...c } = r.attrs || {}, p = d(c);
|
|
360
|
+
return l.render(`h${i}`, p, r.children);
|
|
361
|
+
}, L = (r, l) => {
|
|
362
|
+
var i, c, p, g;
|
|
363
|
+
const b = l.render("img", {
|
|
364
|
+
src: (i = r.attrs) == null ? void 0 : i.fallbackImage,
|
|
365
|
+
alt: (c = r.attrs) == null ? void 0 : c.alt,
|
|
358
366
|
style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
|
|
359
367
|
draggable: "false",
|
|
360
368
|
loading: "lazy"
|
|
361
369
|
});
|
|
362
|
-
return
|
|
370
|
+
return l.render("span", {
|
|
363
371
|
"data-type": "emoji",
|
|
364
|
-
"data-name": (
|
|
365
|
-
"data-emoji": (
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
const { class:
|
|
369
|
-
class:
|
|
370
|
-
id:
|
|
371
|
-
style:
|
|
372
|
-
} :
|
|
373
|
-
return
|
|
374
|
-
},
|
|
375
|
-
const { marks:
|
|
372
|
+
"data-name": (p = r.attrs) == null ? void 0 : p.name,
|
|
373
|
+
"data-emoji": (g = r.attrs) == null ? void 0 : g.emoji
|
|
374
|
+
}, b);
|
|
375
|
+
}, R = (r, l) => l.render("pre", r.attrs || {}, l.render("code", {}, r.children || "")), v = (r, l = !1) => ({ text: i, attrs: c }, p) => {
|
|
376
|
+
const { class: g, id: b, ...E } = c || {}, m = l ? {
|
|
377
|
+
class: g,
|
|
378
|
+
id: b,
|
|
379
|
+
style: ge(E) || void 0
|
|
380
|
+
} : c || {};
|
|
381
|
+
return p.render(r, S(m), i);
|
|
382
|
+
}, A = (r) => x(r), K = (r) => {
|
|
383
|
+
const { marks: l, ...i } = r;
|
|
376
384
|
if ("text" in r) {
|
|
377
|
-
if (
|
|
378
|
-
...
|
|
379
|
-
text:
|
|
380
|
-
}),
|
|
381
|
-
...
|
|
382
|
-
children:
|
|
385
|
+
if (l) return l.reduce((p, g) => A({
|
|
386
|
+
...g,
|
|
387
|
+
text: p
|
|
388
|
+
}), A({
|
|
389
|
+
...i,
|
|
390
|
+
children: i.children
|
|
383
391
|
}));
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
const
|
|
387
|
-
t.set("txt",
|
|
392
|
+
const c = r.attrs || {};
|
|
393
|
+
if (f) {
|
|
394
|
+
const p = t.get("txt") || 0;
|
|
395
|
+
t.set("txt", p + 1), c.key = `txt-${p}`;
|
|
388
396
|
}
|
|
389
|
-
return n(
|
|
397
|
+
return n(i.text, c);
|
|
390
398
|
}
|
|
391
399
|
return "";
|
|
392
|
-
},
|
|
393
|
-
const { linktype:
|
|
394
|
-
let
|
|
395
|
-
switch (
|
|
400
|
+
}, _ = (r, l) => {
|
|
401
|
+
const { linktype: i, href: c, anchor: p, ...g } = r.attrs || {};
|
|
402
|
+
let b = "";
|
|
403
|
+
switch (i) {
|
|
396
404
|
case I.ASSET:
|
|
397
405
|
case I.URL:
|
|
398
|
-
|
|
406
|
+
b = c;
|
|
399
407
|
break;
|
|
400
408
|
case I.EMAIL:
|
|
401
|
-
|
|
409
|
+
b = `mailto:${c}`;
|
|
402
410
|
break;
|
|
403
411
|
case I.STORY:
|
|
404
|
-
|
|
412
|
+
b = c, p && (b = `${b}#${p}`);
|
|
405
413
|
break;
|
|
406
414
|
default:
|
|
407
|
-
|
|
415
|
+
b = c;
|
|
408
416
|
break;
|
|
409
417
|
}
|
|
410
|
-
const
|
|
411
|
-
return
|
|
412
|
-
},
|
|
413
|
-
var
|
|
414
|
-
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),
|
|
415
|
-
blok: (
|
|
416
|
-
id: (
|
|
418
|
+
const E = { ...g };
|
|
419
|
+
return b && (E.href = b), l.render("a", E, r.text);
|
|
420
|
+
}, J = (r, l) => {
|
|
421
|
+
var i, c;
|
|
422
|
+
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), l.render("span", {
|
|
423
|
+
blok: (i = r == null ? void 0 : r.attrs) == null ? void 0 : i.body[0],
|
|
424
|
+
id: (c = r.attrs) == null ? void 0 : c.id,
|
|
417
425
|
style: "display: none"
|
|
418
426
|
});
|
|
419
|
-
},
|
|
420
|
-
const
|
|
421
|
-
return
|
|
422
|
-
},
|
|
423
|
-
const
|
|
424
|
-
return
|
|
425
|
-
},
|
|
426
|
-
const { colspan:
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return
|
|
435
|
-
},
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
[
|
|
447
|
-
[
|
|
448
|
-
[
|
|
449
|
-
[
|
|
450
|
-
[
|
|
451
|
-
[
|
|
452
|
-
[
|
|
453
|
-
[
|
|
454
|
-
[
|
|
455
|
-
[
|
|
456
|
-
[
|
|
457
|
-
[
|
|
458
|
-
[
|
|
459
|
-
[
|
|
460
|
-
[
|
|
461
|
-
[
|
|
462
|
-
[
|
|
463
|
-
[
|
|
464
|
-
[
|
|
465
|
-
[
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
427
|
+
}, W = (r, l) => {
|
|
428
|
+
const i = d(r.attrs), c = r.children || null;
|
|
429
|
+
return l.render("table", i, l.render("tbody", {}, c));
|
|
430
|
+
}, q = (r, l) => {
|
|
431
|
+
const i = d(r.attrs);
|
|
432
|
+
return l.render("tr", i, r.children);
|
|
433
|
+
}, Y = (r, l) => {
|
|
434
|
+
const { colspan: i, rowspan: c, colwidth: p, backgroundColor: g, textAlign: b, ...E } = r.attrs || {}, m = [];
|
|
435
|
+
p && m.push(`width: ${p}px;`), g && m.push(`background-color: ${g};`), b && m.push(`text-align: ${b};`);
|
|
436
|
+
const $ = {
|
|
437
|
+
...E,
|
|
438
|
+
...i > 1 ? { colspan: i } : {},
|
|
439
|
+
...c > 1 ? { rowspan: c } : {},
|
|
440
|
+
...m.length > 0 ? { style: m.join(" ") } : {}
|
|
441
|
+
};
|
|
442
|
+
return l.render("td", S($), r.children);
|
|
443
|
+
}, X = (r, l) => {
|
|
444
|
+
const { colspan: i, rowspan: c, colwidth: p, backgroundColor: g, textAlign: b, ...E } = r.attrs || {}, m = [];
|
|
445
|
+
p && m.push(`width: ${p}px;`), g && m.push(`background-color: ${g};`), b && m.push(`text-align: ${b};`);
|
|
446
|
+
const $ = {
|
|
447
|
+
...E,
|
|
448
|
+
...i > 1 ? { colspan: i } : {},
|
|
449
|
+
...c > 1 ? { rowspan: c } : {},
|
|
450
|
+
...m.length > 0 ? { style: m.join(" ") } : {}
|
|
451
|
+
};
|
|
452
|
+
return l.render("th", S($), r.children);
|
|
453
|
+
}, B = /* @__PURE__ */ new Map([
|
|
454
|
+
[k.DOCUMENT, u("")],
|
|
455
|
+
[k.HEADING, C],
|
|
456
|
+
[k.PARAGRAPH, u("p")],
|
|
457
|
+
[k.UL_LIST, u("ul")],
|
|
458
|
+
[k.OL_LIST, u("ol")],
|
|
459
|
+
[k.LIST_ITEM, u("li")],
|
|
460
|
+
[k.IMAGE, h],
|
|
461
|
+
[k.EMOJI, L],
|
|
462
|
+
[k.CODE_BLOCK, R],
|
|
463
|
+
[k.HR, u("hr")],
|
|
464
|
+
[k.BR, u("br")],
|
|
465
|
+
[k.QUOTE, u("blockquote")],
|
|
466
|
+
[k.COMPONENT, J],
|
|
467
|
+
[ye.TEXT, K],
|
|
468
|
+
[w.LINK, _],
|
|
469
|
+
[w.ANCHOR, _],
|
|
470
|
+
[w.STYLED, v("span", !0)],
|
|
471
|
+
[w.BOLD, v("strong")],
|
|
472
|
+
[w.TEXT_STYLE, v("span", !0)],
|
|
473
|
+
[w.ITALIC, v("em")],
|
|
474
|
+
[w.UNDERLINE, v("u")],
|
|
475
|
+
[w.STRIKE, v("s")],
|
|
476
|
+
[w.CODE, v("code")],
|
|
477
|
+
[w.SUPERSCRIPT, v("sup")],
|
|
478
|
+
[w.SUBSCRIPT, v("sub")],
|
|
479
|
+
[w.HIGHLIGHT, v("mark")],
|
|
480
|
+
[k.TABLE, W],
|
|
481
|
+
[k.TABLE_ROW, q],
|
|
482
|
+
[k.TABLE_CELL, Y],
|
|
483
|
+
[k.TABLE_HEADER, X]
|
|
484
|
+
]), N = new Map([...B, ...Object.entries(a).map(([r, l]) => [r, l])]), Z = () => ({
|
|
485
|
+
render: (r, l = {}, i) => {
|
|
486
|
+
if (f && r) {
|
|
487
|
+
const c = t.get(r) || 0;
|
|
488
|
+
t.set(r, c + 1), l.key = `${r}-${c}`;
|
|
471
489
|
}
|
|
472
|
-
return s(r,
|
|
490
|
+
return s(r, l, i);
|
|
473
491
|
},
|
|
474
|
-
originalResolvers:
|
|
475
|
-
mergedResolvers:
|
|
492
|
+
originalResolvers: B,
|
|
493
|
+
mergedResolvers: N
|
|
476
494
|
});
|
|
477
|
-
function
|
|
478
|
-
const
|
|
479
|
-
if (!
|
|
495
|
+
function T(r) {
|
|
496
|
+
const l = N.get(r.type);
|
|
497
|
+
if (!l)
|
|
480
498
|
return console.error("<Storyblok>", `No resolver found for node type ${r.type}`), "";
|
|
481
|
-
const
|
|
482
|
-
if (r.type === "text") return
|
|
483
|
-
const
|
|
484
|
-
return
|
|
499
|
+
const i = Z();
|
|
500
|
+
if (r.type === "text") return l(r, i);
|
|
501
|
+
const c = r.content ? r.content.map(x) : void 0;
|
|
502
|
+
return l({
|
|
485
503
|
...r,
|
|
486
|
-
children:
|
|
487
|
-
},
|
|
504
|
+
children: c
|
|
505
|
+
}, i);
|
|
488
506
|
}
|
|
489
|
-
function
|
|
490
|
-
return r.type === "doc" ?
|
|
507
|
+
function x(r) {
|
|
508
|
+
return r.type === "doc" ? y ? r.content.map(T) : r.content.map(T).join("") : Array.isArray(r) ? r.map(T) : T(r);
|
|
491
509
|
}
|
|
492
|
-
return { render:
|
|
510
|
+
return { render: x };
|
|
493
511
|
}
|
|
494
|
-
let
|
|
495
|
-
const
|
|
512
|
+
let F = !1;
|
|
513
|
+
const G = [], we = (e) => new Promise((t, s) => {
|
|
496
514
|
if (typeof window > "u") {
|
|
497
515
|
s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
|
|
498
516
|
return;
|
|
499
517
|
}
|
|
500
|
-
if (window.storyblokRegisterEvent = (
|
|
518
|
+
if (window.storyblokRegisterEvent = (a) => {
|
|
501
519
|
if (!window.location.search.includes("_storyblok")) {
|
|
502
520
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
503
521
|
return;
|
|
504
522
|
}
|
|
505
|
-
|
|
523
|
+
F ? a() : G.push(a);
|
|
506
524
|
}, document.getElementById("storyblok-javascript-bridge")) {
|
|
507
525
|
t(void 0);
|
|
508
526
|
return;
|
|
509
527
|
}
|
|
510
528
|
const n = document.createElement("script");
|
|
511
|
-
n.async = !0, n.src = e, n.id = "storyblok-javascript-bridge", n.onerror = (
|
|
512
|
-
|
|
529
|
+
n.async = !0, n.src = e, n.id = "storyblok-javascript-bridge", n.onerror = (a) => s(a), n.onload = (a) => {
|
|
530
|
+
G.forEach((o) => o()), F = !0, t(a);
|
|
513
531
|
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
514
|
-
}),
|
|
532
|
+
}), Se = (e) => {
|
|
515
533
|
if (typeof e != "object" || typeof e._editable > "u")
|
|
516
534
|
return {};
|
|
517
535
|
try {
|
|
@@ -526,19 +544,19 @@ const F = [], we = (e) => new Promise((t, s) => {
|
|
|
526
544
|
return {};
|
|
527
545
|
}
|
|
528
546
|
};
|
|
529
|
-
let
|
|
530
|
-
function
|
|
531
|
-
return
|
|
547
|
+
let Ce = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
548
|
+
function Te(e, t) {
|
|
549
|
+
return ve(t).render(e);
|
|
532
550
|
}
|
|
533
|
-
const Ie = () => we(
|
|
551
|
+
const Ie = () => we(Ce);
|
|
534
552
|
export {
|
|
535
|
-
|
|
536
|
-
|
|
553
|
+
Le as getLiveStory,
|
|
554
|
+
$e as handleStoryblokMessage,
|
|
537
555
|
Ie as loadStoryblokBridge,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
556
|
+
Te as renderRichText,
|
|
557
|
+
ve as richTextResolver,
|
|
558
|
+
Ae as storyblok,
|
|
559
|
+
Se as storyblokEditable,
|
|
560
|
+
D as toCamelCase,
|
|
561
|
+
Ee as useStoryblokApi
|
|
544
562
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(v,
|
|
1
|
+
(function(v,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(v=typeof globalThis<"u"?globalThis:v||self,S(v.storyblokAstro={}))})(this,function(v){"use strict";const S=`<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
2
2
|
<g id="storyblok-logo-kit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
3
3
|
<g id="storyblok-partner-logo" transform="translate(-59.000000, -169.000000)" fill-rule="nonzero">
|
|
4
4
|
<g id="storyblok-symbol" transform="translate(59.000000, 169.000000)">
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
</g>
|
|
8
8
|
</g>
|
|
9
9
|
</g>
|
|
10
|
-
</svg>`,
|
|
10
|
+
</svg>`,q=/[\p{Lu}]/u,Y=/[\p{Ll}]/u,N=/^[\p{Lu}](?![\p{Lu}])/gu,j=/([\p{Alpha}\p{N}_]|$)/u,x=/[_.\- ]+/,X=new RegExp("^"+x.source),P=new RegExp(x.source+j.source,"gu"),D=new RegExp("\\d+"+j.source,"gu"),Z=(e,t,n,s)=>{let a=!1,o=!1,y=!1,f=!1;for(let d=0;d<e.length;d++){const u=e[d];f=d>2?e[d-3]==="-":!0,a&&q.test(u)?(e=e.slice(0,d)+"-"+e.slice(d),a=!1,y=o,o=!0,d++):o&&y&&Y.test(u)&&(!f||s)?(e=e.slice(0,d-1)+"-"+e.slice(d-1),y=o,o=!1,a=!0):(a=t(u)===u&&n(u)!==u,y=o,o=n(u)===u&&t(u)!==u)}return e},V=(e,t)=>(N.lastIndex=0,e.replaceAll(N,n=>t(n))),Q=(e,t)=>(P.lastIndex=0,D.lastIndex=0,e.replaceAll(D,(n,s,a)=>["_","-"].includes(e.charAt(a+n.length))?n:t(n)).replaceAll(P,(n,s)=>t(s)));function ee(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const n=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),s=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?x.test(e)?"":t.pascalCase?s(e):n(e):(e!==n(e)&&(e=Z(e,n,s,t.preserveConsecutiveUppercase)),e=e.replace(X,""),e=t.preserveConsecutiveUppercase?V(e,n):n(e),t.pascalCase&&(e=s(e.charAt(0))+e.slice(1)),Q(e,s))}function _(e){return ee(e)}function te(e,t={},n,s){const a="virtual:storyblok-components",o=`\0${a}`;return{name:"vite-plugin-storyblok-components",async resolveId(y){if(y===a)return o},async load(y){if(y===o){const f=[],d=[];for await(const[h,E]of Object.entries(t)){const A=await this.resolve(`/${e}/${E}.astro`);if(A)f.push(`import ${_(h)} from "${A.id}"`);else if(n)d.push(h);else throw new Error(`Component could not be found for blok "${h}"! Does "${`/${e}/${E}`}.astro" exist?`)}let u="";if(n)if(u=",FallbackComponent",s){const h=await this.resolve(`/${e}/${s}.astro`);if(!h)throw new Error(`Custom fallback component could not be found. Does "${`/${e}/${s}`}.astro" exist?`);f.push(`import FallbackComponent from "${h.id}"`)}else f.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(t).length)return`${f.join(";")};export default {${Object.keys(t).filter(h=>!d.includes(h)).map(h=>_(h)).join(",")}${u}}`;if(n)return`${f[0]}; export default {${u.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
|
|
11
11
|
Please register your components or enable the fallback component.
|
|
12
|
-
Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function
|
|
12
|
+
Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function re(e,t,n){const s="virtual:storyblok-init",a=`\0${s}`;return{name:"vite-plugin-storyblok-init",async resolveId(o){if(o===s)return a},async load(o){if(o===a)return`
|
|
13
13
|
import { storyblokInit, apiPlugin } from "@storyblok/js";
|
|
14
14
|
const { storyblokApi } = storyblokInit({
|
|
15
15
|
accessToken: "${e}",
|
|
@@ -17,7 +17,7 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
17
17
|
apiOptions: ${JSON.stringify(n)},
|
|
18
18
|
});
|
|
19
19
|
export const storyblokApiInstance = storyblokApi;
|
|
20
|
-
`}}}function
|
|
20
|
+
`}}}function oe(e){const t="virtual:storyblok-options",n=`\0${t}`;return{name:"vite-plugin-storyblok-options",async resolveId(s){if(s===t)return n},async load(s){if(s===n)return`export default ${JSON.stringify(e)}`}}}function ne(){if(!(globalThis!=null&&globalThis.storyblokApiInstance))throw new Error("storyblokApiInstance has not been initialized correctly");return globalThis.storyblokApiInstance}async function se(e){let t=null;return e&&e.locals._storyblok_preview_data&&(t=e.locals._storyblok_preview_data),t}function le(e){return typeof e=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});`:"const storyblokInstance = new StoryblokBridge();"}function ae(e){const t={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...e},n=le(t.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:s,updateConfig:a,addDevToolbarApp:o,addMiddleware:y,config:f})=>{if(a({vite:{plugins:[re(t.accessToken,t.useCustomApi,t.apiOptions),te(t.componentsDir,t.components,t.enableFallbackComponent,t.customFallbackComponent),oe(t)]}}),t.livePreview&&(f==null?void 0:f.output)!=="server")throw new Error("To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode.");s("page-ssr",`
|
|
21
21
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
22
22
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
23
23
|
`),t.bridge&&!t.livePreview&&s("page",`import { loadStoryblokBridge } from "@storyblok/astro";
|
|
@@ -36,4 +36,4 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
36
36
|
${n}
|
|
37
37
|
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
38
38
|
});
|
|
39
|
-
`),
|
|
39
|
+
`),y({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),o({id:"storyblok",name:"Storyblok",icon:S,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let U;async function ie(e){const{action:t,story:n}=e||{};if(t==="input"&&n){const s=async()=>{const o=await de(n),y=document.body;if(o.outerHTML===y.outerHTML)return;const f=document.querySelector('[data-blok-focused="true"]');ce(y,o,f),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(U),U=setTimeout(s,500)}["published","change"].includes(e==null?void 0:e.action)&&location.reload()}function ce(e,t,n){if(n){const s=n.getAttribute("data-blok-uid"),a=t.querySelector(`[data-blok-uid="${s}"]`);a&&(a.setAttribute("data-blok-focused","true"),n.replaceWith(a))}else e.replaceWith(t)}async function de(e){const n=await(await fetch(location.href,{method:"POST",body:JSON.stringify({...e,is_storyblok_preview:!0}),headers:{"Content-Type":"application/json"}})).text();return new DOMParser().parseFromString(n,"text/html").body}let k=function(e){return e.DOCUMENT="doc",e.HEADING="heading",e.PARAGRAPH="paragraph",e.QUOTE="blockquote",e.OL_LIST="ordered_list",e.UL_LIST="bullet_list",e.LIST_ITEM="list_item",e.CODE_BLOCK="code_block",e.HR="horizontal_rule",e.BR="hard_break",e.IMAGE="image",e.EMOJI="emoji",e.COMPONENT="blok",e.TABLE="table",e.TABLE_ROW="tableRow",e.TABLE_CELL="tableCell",e.TABLE_HEADER="tableHeader",e}({}),C=function(e){return e.BOLD="bold",e.STRONG="strong",e.STRIKE="strike",e.UNDERLINE="underline",e.ITALIC="italic",e.CODE="code",e.LINK="link",e.ANCHOR="anchor",e.STYLED="styled",e.SUPERSCRIPT="superscript",e.SUBSCRIPT="subscript",e.TEXT_STYLE="textStyle",e.HIGHLIGHT="highlight",e}({}),ue=function(e){return e.TEXT="text",e}({}),R=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});const be=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pe=(e={})=>Object.keys(e).map(t=>`${t}="${e[t]}"`).join(" "),fe=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function ye(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const $=e=>Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0));function he(e,t){if(!t)return{src:e,attrs:{}};let n=0,s=0;const a={},o=[];function y(d,u,h,E,A){typeof d!="number"||d<=u||d>=h?console.warn(`[StoryblokRichText] - ${E.charAt(0).toUpperCase()+E.slice(1)} value must be a number between ${u} and ${h} (inclusive)`):A.push(`${E}(${d})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(a.width=t.width,n=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),t.height&&typeof t.height=="number"&&t.height>0?(a.height=t.height,s=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),t.loading&&["lazy","eager"].includes(t.loading)&&(a.loading=t.loading),t.class&&(a.class=t.class),t.filters){const{filters:d}=t||{},{blur:u,brightness:h,fill:E,format:A,grayscale:B,quality:w,rotate:T}=d||{};u&&y(u,0,100,"blur",o),w&&y(w,0,100,"quality",o),h&&y(h,0,100,"brightness",o),E&&o.push(`fill(${E})`),B&&o.push("grayscale()"),T&&[0,90,180,270].includes(t.filters.rotate||0)&&o.push(`rotate(${T})`),A&&["webp","png","jpeg"].includes(A)&&o.push(`format(${A})`)}t.srcset&&(a.srcset=t.srcset.map(d=>{if(typeof d=="number")return`${e}/m/${d}x0/${o.length>0?`filters:${o.join(":")}`:""} ${d}w`;if(Array.isArray(d)&&d.length===2){const[u,h]=d;return`${e}/m/${u}x${h}/${o.length>0?`filters:${o.join(":")}`:""} ${u}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(a.sizes=t.sizes.join(", "))}let f=`${e}/m/`;return n>0&&s>0&&(f=`${f}${n}x${s}/`),o.length>0&&(f=`${f}filters:${o.join(":")}`),{src:f,attrs:a}}function H(e,t={},n){const s=pe(t),a=s?`${e} ${s}`:e,o=Array.isArray(n)?n.join(""):n||"";if(e){if(be.includes(e))return`<${a}>`}else return o;return`<${a}>${o}</${e}>`}function F(e={}){const t=new Map,{renderFn:n=H,textFn:s=ye,resolvers:a={},optimizeImages:o=!1,keyedResolvers:y=!1}=e,f=n!==H,d=(r={})=>{const{textAlign:l,class:i,id:c,style:b,...g}=r,p=[];return b&&p.push(b.endsWith(";")?b:`${b};`),l&&p.push(`text-align: ${l};`),$({...g,class:i,id:c,...p.length>0?{style:p.join(" ")}:{}})},u=r=>(l,i)=>{const c=d(l.attrs);return i.render(r,c,l.children||null)},h=(r,l)=>{const{src:i,alt:c,title:b,srcset:g,sizes:p}=r.attrs||{};let L=i,m={};if(o){const{src:Ie,attrs:Re}=he(i,o);L=Ie,m=Re}const I={src:L,alt:c,title:b,srcset:g,sizes:p,...m};return l.render("img",$(I))},E=(r,l)=>{const{level:i,...c}=r.attrs||{},b=d(c);return l.render(`h${i}`,b,r.children)},A=(r,l)=>{var i,c,b,g;const p=l.render("img",{src:(i=r.attrs)==null?void 0:i.fallbackImage,alt:(c=r.attrs)==null?void 0:c.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return l.render("span",{"data-type":"emoji","data-name":(b=r.attrs)==null?void 0:b.name,"data-emoji":(g=r.attrs)==null?void 0:g.emoji},p)},B=(r,l)=>l.render("pre",r.attrs||{},l.render("code",{},r.children||"")),w=(r,l=!1)=>({text:i,attrs:c},b)=>{const{class:g,id:p,...L}=c||{},m=l?{class:g,id:p,style:fe(L)||void 0}:c||{};return b.render(r,$(m),i)},T=r=>M(r),Ce=r=>{const{marks:l,...i}=r;if("text"in r){if(l)return l.reduce((b,g)=>T({...g,text:b}),T({...i,children:i.children}));const c=r.attrs||{};if(y){const b=t.get("txt")||0;t.set("txt",b+1),c.key=`txt-${b}`}return s(i.text,c)}return""},K=(r,l)=>{const{linktype:i,href:c,anchor:b,...g}=r.attrs||{};let p="";switch(i){case R.ASSET:case R.URL:p=c;break;case R.EMAIL:p=`mailto:${c}`;break;case R.STORY:p=c,b&&(p=`${p}#${b}`);break;default:p=c;break}const L={...g};return p&&(L.href=p),l.render("a",L,r.text)},Ee=(r,l)=>{var i,c;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),l.render("span",{blok:(i=r==null?void 0:r.attrs)==null?void 0:i.body[0],id:(c=r.attrs)==null?void 0:c.id,style:"display: none"})},Le=(r,l)=>{const i=d(r.attrs),c=r.children||null;return l.render("table",i,l.render("tbody",{},c))},Ae=(r,l)=>{const i=d(r.attrs);return l.render("tr",i,r.children)},Se=(r,l)=>{const{colspan:i,rowspan:c,colwidth:b,backgroundColor:g,textAlign:p,...L}=r.attrs||{},m=[];b&&m.push(`width: ${b}px;`),g&&m.push(`background-color: ${g};`),p&&m.push(`text-align: ${p};`);const I={...L,...i>1?{colspan:i}:{},...c>1?{rowspan:c}:{},...m.length>0?{style:m.join(" ")}:{}};return l.render("td",$(I),r.children)},$e=(r,l)=>{const{colspan:i,rowspan:c,colwidth:b,backgroundColor:g,textAlign:p,...L}=r.attrs||{},m=[];b&&m.push(`width: ${b}px;`),g&&m.push(`background-color: ${g};`),p&&m.push(`text-align: ${p};`);const I={...L,...i>1?{colspan:i}:{},...c>1?{rowspan:c}:{},...m.length>0?{style:m.join(" ")}:{}};return l.render("th",$(I),r.children)},J=new Map([[k.DOCUMENT,u("")],[k.HEADING,E],[k.PARAGRAPH,u("p")],[k.UL_LIST,u("ul")],[k.OL_LIST,u("ol")],[k.LIST_ITEM,u("li")],[k.IMAGE,h],[k.EMOJI,A],[k.CODE_BLOCK,B],[k.HR,u("hr")],[k.BR,u("br")],[k.QUOTE,u("blockquote")],[k.COMPONENT,Ee],[ue.TEXT,Ce],[C.LINK,K],[C.ANCHOR,K],[C.STYLED,w("span",!0)],[C.BOLD,w("strong")],[C.TEXT_STYLE,w("span",!0)],[C.ITALIC,w("em")],[C.UNDERLINE,w("u")],[C.STRIKE,w("s")],[C.CODE,w("code")],[C.SUPERSCRIPT,w("sup")],[C.SUBSCRIPT,w("sub")],[C.HIGHLIGHT,w("mark")],[k.TABLE,Le],[k.TABLE_ROW,Ae],[k.TABLE_CELL,Se],[k.TABLE_HEADER,$e]]),W=new Map([...J,...Object.entries(a).map(([r,l])=>[r,l])]),Te=()=>({render:(r,l={},i)=>{if(y&&r){const c=t.get(r)||0;t.set(r,c+1),l.key=`${r}-${c}`}return n(r,l,i)},originalResolvers:J,mergedResolvers:W});function O(r){const l=W.get(r.type);if(!l)return console.error("<Storyblok>",`No resolver found for node type ${r.type}`),"";const i=Te();if(r.type==="text")return l(r,i);const c=r.content?r.content.map(M):void 0;return l({...r,children:c},i)}function M(r){return r.type==="doc"?f?r.content.map(O):r.content.map(O).join(""):Array.isArray(r)?r.map(O):O(r)}return{render:M}}let G=!1;const z=[],ge=e=>new Promise((t,n)=>{if(typeof window>"u"){n(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=a=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}G?a():z.push(a)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const s=document.createElement("script");s.async=!0,s.src=e,s.id="storyblok-javascript-bridge",s.onerror=a=>n(a),s.onload=a=>{z.forEach(o=>o()),G=!0,t(a)},document.getElementsByTagName("head")[0].appendChild(s)}),ke=e=>{if(typeof e!="object"||typeof e._editable>"u")return{};try{const t=JSON.parse(e._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let me="https://app.storyblok.com/f/storyblok-v2-latest.js";function ve(e,t){return F(t).render(e)}const we=()=>ge(me);v.getLiveStory=se,v.handleStoryblokMessage=ie,v.loadStoryblokBridge=we,v.renderRichText=ve,v.richTextResolver=F,v.storyblok=ae,v.storyblokEditable=ke,v.toCamelCase=_,v.useStoryblokApi=ne,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/astro",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.2.
|
|
4
|
+
"version": "7.2.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Official Astro integration for the Storyblok Headless CMS",
|
|
7
7
|
"author": "Storyblok",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"camelcase": "^8.0.0",
|
|
59
|
-
"@storyblok/js": "4.2.
|
|
59
|
+
"@storyblok/js": "4.2.8"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@cypress/vite-dev-server": "^6.0.3",
|