@storyblok/astro 7.2.7 → 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.
@@ -1,4 +1,4 @@
1
- const Q = `<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">
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>`, ee = /[\p{Lu}]/u, te = /[\p{Ll}]/u, N = /^[\p{Lu}](?![\p{Lu}])/gu, G = /([\p{Alpha}\p{N}_]|$)/u, O = /[_.\- ]+/, re = new RegExp("^" + O.source), M = new RegExp(O.source + G.source, "gu"), P = new RegExp("\\d+" + G.source, "gu"), oe = (e, t, s, n) => {
11
- let l = !1, o = !1, b = !1, p = !1;
12
- for (let i = 0; i < e.length; i++) {
13
- const u = e[i];
14
- p = i > 2 ? e[i - 3] === "-" : !0, l && ee.test(u) ? (e = e.slice(0, i) + "-" + e.slice(i), l = !1, b = o, o = !0, i++) : o && b && te.test(u) && (!p || n) ? (e = e.slice(0, i - 1) + "-" + e.slice(i - 1), b = o, o = !1, l = !0) : (l = t(u) === u && s(u) !== u, b = o, o = s(u) === u && t(u) !== u);
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
- }, se = (e, t) => (N.lastIndex = 0, e.replaceAll(N, (s) => t(s))), ne = (e, t) => (M.lastIndex = 0, P.lastIndex = 0, e.replaceAll(P, (s, n, l) => ["_", "-"].includes(e.charAt(l + s.length)) ? s : t(s)).replaceAll(M, (s, n) => t(n)));
18
- function le(e, t) {
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 = oe(e, s, n, t.preserveConsecutiveUppercase)), e = e.replace(re, ""), e = t.preserveConsecutiveUppercase ? se(e, s) : s(e), t.pascalCase && (e = n(e.charAt(0)) + e.slice(1)), ne(e, n));
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 j(e) {
31
- return le(e);
30
+ function D(e) {
31
+ return ae(e);
32
32
  }
33
- function ae(e, t = {}, s, n) {
34
- const l = "virtual:storyblok-components", o = `\0${l}`;
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(b) {
38
- if (b === l)
37
+ async resolveId(f) {
38
+ if (f === a)
39
39
  return o;
40
40
  },
41
- async load(b) {
42
- if (b === o) {
43
- const p = [], i = [];
44
- for await (const [y, E] of Object.entries(t)) {
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}/${E}.astro`
46
+ `/${e}/${C}.astro`
47
47
  );
48
48
  if (L)
49
- p.push(`import ${j(y)} from "${L.id}"`);
49
+ y.push(`import ${D(h)} from "${L.id}"`);
50
50
  else if (s)
51
- i.push(y);
51
+ d.push(h);
52
52
  else
53
53
  throw new Error(
54
- `Component could not be found for blok "${y}"! Does "${`/${e}/${E}`}.astro" exist?`
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 y = await this.resolve(
60
+ const h = await this.resolve(
61
61
  `/${e}/${n}.astro`
62
62
  );
63
- if (!y)
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
- p.push(
68
- `import FallbackComponent from "${y.id}"`
67
+ y.push(
68
+ `import FallbackComponent from "${h.id}"`
69
69
  );
70
70
  } else
71
- p.push(
71
+ y.push(
72
72
  "import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'"
73
73
  );
74
74
  if (Object.values(t).length)
75
- return `${p.join(";")};export default {${Object.keys(t).filter((y) => !i.includes(y)).map((y) => j(y)).join(",")}${u}}`;
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 `${p[0]}; export default {${u.replace(",", "")}}`;
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 ie(e, t, s) {
88
- const n = "virtual:storyblok-init", l = `\0${n}`;
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 l;
93
+ return a;
94
94
  },
95
95
  async load(o) {
96
- if (o === l)
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 ce(e) {
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 Ce() {
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 Ee(e) {
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 de(e) {
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 Le(e) {
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 = de(t.bridge);
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: l,
149
+ updateConfig: a,
150
150
  addDevToolbarApp: o,
151
- addMiddleware: b,
152
- config: p
151
+ addMiddleware: f,
152
+ config: y
153
153
  }) => {
154
- if (l({
154
+ if (a({
155
155
  vite: {
156
156
  plugins: [
157
- ie(
157
+ ce(
158
158
  t.accessToken,
159
159
  t.useCustomApi,
160
160
  t.apiOptions
161
161
  ),
162
- ae(
162
+ ie(
163
163
  t.componentsDir,
164
164
  t.components,
165
165
  t.enableFallbackComponent,
166
166
  t.customFallbackComponent
167
167
  ),
168
- ce(t)
168
+ de(t)
169
169
  ]
170
170
  }
171
- }), t.livePreview && (p == null ? void 0 : p.output) !== "server")
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
- ), b({
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: Q,
209
+ icon: ee,
210
210
  entrypoint: "@storyblok/astro/toolbarApp.ts"
211
211
  });
212
212
  }
213
213
  }
214
214
  };
215
215
  }
216
- let D;
217
- async function Te(e) {
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 pe(s), b = document.body;
222
- if (o.outerHTML === b.outerHTML)
221
+ const o = await be(s), f = document.body;
222
+ if (o.outerHTML === f.outerHTML)
223
223
  return;
224
- const p = document.querySelector('[data-blok-focused="true"]');
225
- ue(b, o, p), document.dispatchEvent(new Event("storyblok-live-preview-updated"));
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(D), D = setTimeout(n, 500);
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 ue(e, t, s) {
231
+ function pe(e, t, s) {
232
232
  if (s) {
233
- const n = s.getAttribute("data-blok-uid"), l = t.querySelector(
233
+ const n = s.getAttribute("data-blok-uid"), a = t.querySelector(
234
234
  `[data-blok-uid="${n}"]`
235
235
  );
236
- l && (l.setAttribute("data-blok-focused", "true"), s.replaceWith(l));
236
+ a && (a.setAttribute("data-blok-focused", "true"), s.replaceWith(a));
237
237
  } else
238
238
  e.replaceWith(t);
239
239
  }
240
- async function pe(e) {
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 m = /* @__PURE__ */ function(e) {
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
- }({}), C = /* @__PURE__ */ function(e) {
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
- }({}), be = /* @__PURE__ */ function(e) {
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 ye = [
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
- ], fe = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), he = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
278
- function ge(e) {
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
280
280
  }
281
- const A = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
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 l = {}, o = [];
289
- function b(i, u, y, E, L) {
290
- typeof i != "number" || i <= u || i >= y ? console.warn(`[StoryblokRichText] - ${E.charAt(0).toUpperCase() + E.slice(1)} value must be a number between ${u} and ${y} (inclusive)`) : L.push(`${E}(${i})`);
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 ? (l.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 ? (l.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) && (l.loading = t.loading), t.class && (l.class = t.class), t.filters) {
294
- const { filters: i } = t || {}, { blur: u, brightness: y, fill: E, format: L, grayscale: v, quality: T, rotate: $ } = i || {};
295
- u && b(u, 0, 100, "blur", o), T && b(T, 0, 100, "quality", o), y && b(y, 0, 100, "brightness", o), E && o.push(`fill(${E})`), v && o.push("grayscale()"), $ && [
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(${$})`), L && [
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 && (l.srcset = t.srcset.map((i) => {
307
- if (typeof i == "number") return `${e}/m/${i}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${i}w`;
308
- if (Array.isArray(i) && i.length === 2) {
309
- const [u, y] = i;
310
- return `${e}/m/${u}x${y}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${u}w`;
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 && (l.sizes = t.sizes.join(", "));
315
+ }).join(", ")), t.sizes && (a.sizes = t.sizes.join(", "));
316
316
  }
317
- let p = `${e}/m/`;
318
- return s > 0 && n > 0 && (p = `${p}${s}x${n}/`), o.length > 0 && (p = `${p}filters:${o.join(":")}`), {
319
- src: p,
320
- attrs: l
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 U(e, t = {}, s) {
324
- const n = fe(t), l = n ? `${e} ${n}` : e, o = Array.isArray(s) ? s.join("") : s || "";
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 (ye.includes(e)) return `<${l}>`;
326
+ if (fe.includes(e)) return `<${a}>`;
327
327
  } else return o;
328
- return `<${l}>${o}</${e}>`;
328
+ return `<${a}>${o}</${e}>`;
329
329
  }
330
- function ke(e = {}) {
331
- const t = /* @__PURE__ */ new Map(), { renderFn: s = U, textFn: n = ge, resolvers: l = {}, optimizeImages: o = !1, keyedResolvers: b = !1 } = e, p = s !== U, i = (r) => (a, c) => {
332
- const d = a.attrs || {};
333
- return c.render(r, d, a.children || null);
334
- }, u = (r, a) => {
335
- const { src: c, alt: d, title: f, srcset: k, sizes: h } = r.attrs || {};
336
- let g = c, w = {};
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: Z, attrs: V } = me(c, o);
339
- g = Z, w = V;
346
+ const { src: V, attrs: Q } = me(i, o);
347
+ E = V, m = Q;
340
348
  }
341
- const X = {
342
- src: g,
343
- alt: d,
344
- title: f,
345
- srcset: k,
346
- sizes: h,
347
- ...w
349
+ const $ = {
350
+ src: E,
351
+ alt: c,
352
+ title: p,
353
+ srcset: g,
354
+ sizes: b,
355
+ ...m
348
356
  };
349
- return a.render("img", A(X));
350
- }, y = (r, a) => {
351
- const { level: c, ...d } = r.attrs || {};
352
- return a.render(`h${c}`, d, r.children);
353
- }, E = (r, a) => {
354
- var c, d, f, k;
355
- const h = a.render("img", {
356
- src: (c = r.attrs) == null ? void 0 : c.fallbackImage,
357
- alt: (d = r.attrs) == null ? void 0 : d.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 a.render("span", {
370
+ return l.render("span", {
363
371
  "data-type": "emoji",
364
- "data-name": (f = r.attrs) == null ? void 0 : f.name,
365
- "data-emoji": (k = r.attrs) == null ? void 0 : k.emoji
366
- }, h);
367
- }, L = (r, a) => a.render("pre", r.attrs || {}, a.render("code", {}, r.children || "")), v = (r, a = !1) => ({ text: c, attrs: d }, f) => {
368
- const { class: k, id: h, ...g } = d || {}, w = a ? {
369
- class: k,
370
- id: h,
371
- style: he(g) || void 0
372
- } : d || {};
373
- return f.render(r, A(w), c);
374
- }, T = (r) => R(r), $ = (r) => {
375
- const { marks: a, ...c } = r;
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 (a) return a.reduce((f, k) => T({
378
- ...k,
379
- text: f
380
- }), T({
381
- ...c,
382
- children: c.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 d = r.attrs || {};
385
- if (b) {
386
- const f = t.get("txt") || 0;
387
- t.set("txt", f + 1), d.key = `txt-${f}`;
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(c.text, d);
397
+ return n(i.text, c);
390
398
  }
391
399
  return "";
392
- }, x = (r, a) => {
393
- const { linktype: c, href: d, anchor: f, ...k } = r.attrs || {};
394
- let h = "";
395
- switch (c) {
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
- h = d;
406
+ b = c;
399
407
  break;
400
408
  case I.EMAIL:
401
- h = `mailto:${d}`;
409
+ b = `mailto:${c}`;
402
410
  break;
403
411
  case I.STORY:
404
- h = d, f && (h = `${h}#${f}`);
412
+ b = c, p && (b = `${b}#${p}`);
405
413
  break;
406
414
  default:
407
- h = d;
415
+ b = c;
408
416
  break;
409
417
  }
410
- const g = { ...k };
411
- return h && (g.href = h), a.render("a", g, r.text);
412
- }, z = (r, a) => {
413
- var c, d;
414
- return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), a.render("span", {
415
- blok: (c = r == null ? void 0 : r.attrs) == null ? void 0 : c.body[0],
416
- id: (d = r.attrs) == null ? void 0 : d.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
- }, K = (r, a) => {
420
- const c = {}, d = a.render("tbody", {}, r.children);
421
- return a.render("table", c, d);
422
- }, J = (r, a) => {
423
- const c = {};
424
- return a.render("tr", c, r.children);
425
- }, W = (r, a) => {
426
- const { colspan: c, rowspan: d, colwidth: f, backgroundColor: k, ...h } = r.attrs || {}, g = { ...h };
427
- c > 1 && (g.colspan = c), d > 1 && (g.rowspan = d);
428
- const w = [];
429
- return f && w.push(`width: ${f}px;`), k && w.push(`background-color: ${k};`), w.length > 0 && (g.style = w.join(" ")), a.render("td", A(g), r.children);
430
- }, Y = (r, a) => {
431
- const { colspan: c, rowspan: d, colwidth: f, backgroundColor: k, ...h } = r.attrs || {}, g = { ...h };
432
- c > 1 && (g.colspan = c), d > 1 && (g.rowspan = d);
433
- const w = [];
434
- return f && w.push(`width: ${f}px;`), k && w.push(`background-color: ${k};`), w.length > 0 && (g.style = w.join(" ")), a.render("th", A(g), r.children);
435
- }, _ = /* @__PURE__ */ new Map([
436
- [m.DOCUMENT, i("")],
437
- [m.HEADING, y],
438
- [m.PARAGRAPH, i("p")],
439
- [m.UL_LIST, i("ul")],
440
- [m.OL_LIST, i("ol")],
441
- [m.LIST_ITEM, i("li")],
442
- [m.IMAGE, u],
443
- [m.EMOJI, E],
444
- [m.CODE_BLOCK, L],
445
- [m.HR, i("hr")],
446
- [m.BR, i("br")],
447
- [m.QUOTE, i("blockquote")],
448
- [m.COMPONENT, z],
449
- [be.TEXT, $],
450
- [C.LINK, x],
451
- [C.ANCHOR, x],
452
- [C.STYLED, v("span", !0)],
453
- [C.BOLD, v("strong")],
454
- [C.TEXT_STYLE, v("span", !0)],
455
- [C.ITALIC, v("em")],
456
- [C.UNDERLINE, v("u")],
457
- [C.STRIKE, v("s")],
458
- [C.CODE, v("code")],
459
- [C.SUPERSCRIPT, v("sup")],
460
- [C.SUBSCRIPT, v("sub")],
461
- [C.HIGHLIGHT, v("mark")],
462
- [m.TABLE, K],
463
- [m.TABLE_ROW, J],
464
- [m.TABLE_CELL, W],
465
- [m.TABLE_HEADER, Y]
466
- ]), B = new Map([..._, ...Object.entries(l).map(([r, a]) => [r, a])]), q = () => ({
467
- render: (r, a = {}, c) => {
468
- if (b && r) {
469
- const d = t.get(r) || 0;
470
- t.set(r, d + 1), a.key = `${r}-${d}`;
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, a, c);
490
+ return s(r, l, i);
473
491
  },
474
- originalResolvers: _,
475
- mergedResolvers: B
492
+ originalResolvers: B,
493
+ mergedResolvers: N
476
494
  });
477
- function S(r) {
478
- const a = B.get(r.type);
479
- if (!a)
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 c = q();
482
- if (r.type === "text") return a(r, c);
483
- const d = r.content ? r.content.map(R) : void 0;
484
- return a({
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: d
487
- }, c);
504
+ children: c
505
+ }, i);
488
506
  }
489
- function R(r) {
490
- return r.type === "doc" ? p ? r.content.map(S) : r.content.map(S).join("") : Array.isArray(r) ? r.map(S) : S(r);
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: R };
510
+ return { render: x };
493
511
  }
494
- let H = !1;
495
- const F = [], we = (e) => new Promise((t, s) => {
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 = (l) => {
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
- H ? l() : F.push(l);
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 = (l) => s(l), n.onload = (l) => {
512
- F.forEach((o) => o()), H = !0, t(l);
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
- }), $e = (e) => {
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 ve = "https://app.storyblok.com/f/storyblok-v2-latest.js";
530
- function Se(e, t) {
531
- return ke(t).render(e);
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(ve);
551
+ const Ie = () => we(Ce);
534
552
  export {
535
- Ee as getLiveStory,
536
- Te as handleStoryblokMessage,
553
+ Le as getLiveStory,
554
+ $e as handleStoryblokMessage,
537
555
  Ie as loadStoryblokBridge,
538
- Se as renderRichText,
539
- ke as richTextResolver,
540
- Le as storyblok,
541
- $e as storyblokEditable,
542
- j as toCamelCase,
543
- Ce as useStoryblokApi
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,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(v=typeof globalThis<"u"?globalThis:v||self,T(v.storyblokAstro={}))})(this,function(v){"use strict";const T=`<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">
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>`,W=/[\p{Lu}]/u,Y=/[\p{Ll}]/u,B=/^[\p{Lu}](?![\p{Lu}])/gu,N=/([\p{Alpha}\p{N}_]|$)/u,_=/[_.\- ]+/,q=new RegExp("^"+_.source),j=new RegExp(_.source+N.source,"gu"),P=new RegExp("\\d+"+N.source,"gu"),X=(e,t,n,s)=>{let l=!1,o=!1,b=!1,p=!1;for(let i=0;i<e.length;i++){const u=e[i];p=i>2?e[i-3]==="-":!0,l&&W.test(u)?(e=e.slice(0,i)+"-"+e.slice(i),l=!1,b=o,o=!0,i++):o&&b&&Y.test(u)&&(!p||s)?(e=e.slice(0,i-1)+"-"+e.slice(i-1),b=o,o=!1,l=!0):(l=t(u)===u&&n(u)!==u,b=o,o=n(u)===u&&t(u)!==u)}return e},Z=(e,t)=>(B.lastIndex=0,e.replaceAll(B,n=>t(n))),V=(e,t)=>(j.lastIndex=0,P.lastIndex=0,e.replaceAll(P,(n,s,l)=>["_","-"].includes(e.charAt(l+n.length))?n:t(n)).replaceAll(j,(n,s)=>t(s)));function Q(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?_.test(e)?"":t.pascalCase?s(e):n(e):(e!==n(e)&&(e=X(e,n,s,t.preserveConsecutiveUppercase)),e=e.replace(q,""),e=t.preserveConsecutiveUppercase?Z(e,n):n(e),t.pascalCase&&(e=s(e.charAt(0))+e.slice(1)),V(e,s))}function x(e){return Q(e)}function ee(e,t={},n,s){const l="virtual:storyblok-components",o=`\0${l}`;return{name:"vite-plugin-storyblok-components",async resolveId(b){if(b===l)return o},async load(b){if(b===o){const p=[],i=[];for await(const[y,L]of Object.entries(t)){const S=await this.resolve(`/${e}/${L}.astro`);if(S)p.push(`import ${x(y)} from "${S.id}"`);else if(n)i.push(y);else throw new Error(`Component could not be found for blok "${y}"! Does "${`/${e}/${L}`}.astro" exist?`)}let u="";if(n)if(u=",FallbackComponent",s){const y=await this.resolve(`/${e}/${s}.astro`);if(!y)throw new Error(`Custom fallback component could not be found. Does "${`/${e}/${s}`}.astro" exist?`);p.push(`import FallbackComponent from "${y.id}"`)}else p.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(t).length)return`${p.join(";")};export default {${Object.keys(t).filter(y=>!i.includes(y)).map(y=>x(y)).join(",")}${u}}`;if(n)return`${p[0]}; export default {${u.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
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 te(e,t,n){const s="virtual:storyblok-init",l=`\0${s}`;return{name:"vite-plugin-storyblok-init",async resolveId(o){if(o===s)return l},async load(o){if(o===l)return`
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 re(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 oe(){if(!(globalThis!=null&&globalThis.storyblokApiInstance))throw new Error("storyblokApiInstance has not been initialized correctly");return globalThis.storyblokApiInstance}async function ne(e){let t=null;return e&&e.locals._storyblok_preview_data&&(t=e.locals._storyblok_preview_data),t}function se(e){return typeof e=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});`:"const storyblokInstance = new StoryblokBridge();"}function le(e){const t={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...e},n=se(t.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:s,updateConfig:l,addDevToolbarApp:o,addMiddleware:b,config:p})=>{if(l({vite:{plugins:[te(t.accessToken,t.useCustomApi,t.apiOptions),ee(t.componentsDir,t.components,t.enableFallbackComponent,t.customFallbackComponent),re(t)]}}),t.livePreview&&(p==null?void 0:p.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",`
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
- `),b({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),o({id:"storyblok",name:"Storyblok",icon:T,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let D;async function ae(e){const{action:t,story:n}=e||{};if(t==="input"&&n){const s=async()=>{const o=await ce(n),b=document.body;if(o.outerHTML===b.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');ie(b,o,p),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(D),D=setTimeout(s,500)}["published","change"].includes(e==null?void 0:e.action)&&location.reload()}function ie(e,t,n){if(n){const s=n.getAttribute("data-blok-uid"),l=t.querySelector(`[data-blok-uid="${s}"]`);l&&(l.setAttribute("data-blok-focused","true"),n.replaceWith(l))}else e.replaceWith(t)}async function ce(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 g=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}({}),de=function(e){return e.TEXT="text",e}({}),A=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});const ue=["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(" "),be=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function ye(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const I=e=>Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0));function fe(e,t){if(!t)return{src:e,attrs:{}};let n=0,s=0;const l={},o=[];function b(i,u,y,L,S){typeof i!="number"||i<=u||i>=y?console.warn(`[StoryblokRichText] - ${L.charAt(0).toUpperCase()+L.slice(1)} value must be a number between ${u} and ${y} (inclusive)`):S.push(`${L}(${i})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(l.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?(l.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)&&(l.loading=t.loading),t.class&&(l.class=t.class),t.filters){const{filters:i}=t||{},{blur:u,brightness:y,fill:L,format:S,grayscale:E,quality:$,rotate:R}=i||{};u&&b(u,0,100,"blur",o),$&&b($,0,100,"quality",o),y&&b(y,0,100,"brightness",o),L&&o.push(`fill(${L})`),E&&o.push("grayscale()"),R&&[0,90,180,270].includes(t.filters.rotate||0)&&o.push(`rotate(${R})`),S&&["webp","png","jpeg"].includes(S)&&o.push(`format(${S})`)}t.srcset&&(l.srcset=t.srcset.map(i=>{if(typeof i=="number")return`${e}/m/${i}x0/${o.length>0?`filters:${o.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[u,y]=i;return`${e}/m/${u}x${y}/${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&&(l.sizes=t.sizes.join(", "))}let p=`${e}/m/`;return n>0&&s>0&&(p=`${p}${n}x${s}/`),o.length>0&&(p=`${p}filters:${o.join(":")}`),{src:p,attrs:l}}function U(e,t={},n){const s=pe(t),l=s?`${e} ${s}`:e,o=Array.isArray(n)?n.join(""):n||"";if(e){if(ue.includes(e))return`<${l}>`}else return o;return`<${l}>${o}</${e}>`}function H(e={}){const t=new Map,{renderFn:n=U,textFn:s=ye,resolvers:l={},optimizeImages:o=!1,keyedResolvers:b=!1}=e,p=n!==U,i=r=>(a,c)=>{const d=a.attrs||{};return c.render(r,d,a.children||null)},u=(r,a)=>{const{src:c,alt:d,title:f,srcset:k,sizes:h}=r.attrs||{};let m=c,w={};if(o){const{src:Ae,attrs:Ie}=fe(c,o);m=Ae,w=Ie}const $e={src:m,alt:d,title:f,srcset:k,sizes:h,...w};return a.render("img",I($e))},y=(r,a)=>{const{level:c,...d}=r.attrs||{};return a.render(`h${c}`,d,r.children)},L=(r,a)=>{var c,d,f,k;const h=a.render("img",{src:(c=r.attrs)==null?void 0:c.fallbackImage,alt:(d=r.attrs)==null?void 0:d.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return a.render("span",{"data-type":"emoji","data-name":(f=r.attrs)==null?void 0:f.name,"data-emoji":(k=r.attrs)==null?void 0:k.emoji},h)},S=(r,a)=>a.render("pre",r.attrs||{},a.render("code",{},r.children||"")),E=(r,a=!1)=>({text:c,attrs:d},f)=>{const{class:k,id:h,...m}=d||{},w=a?{class:k,id:h,style:be(m)||void 0}:d||{};return f.render(r,I(w),c)},$=r=>M(r),R=r=>{const{marks:a,...c}=r;if("text"in r){if(a)return a.reduce((f,k)=>$({...k,text:f}),$({...c,children:c.children}));const d=r.attrs||{};if(b){const f=t.get("txt")||0;t.set("txt",f+1),d.key=`txt-${f}`}return s(c.text,d)}return""},z=(r,a)=>{const{linktype:c,href:d,anchor:f,...k}=r.attrs||{};let h="";switch(c){case A.ASSET:case A.URL:h=d;break;case A.EMAIL:h=`mailto:${d}`;break;case A.STORY:h=d,f&&(h=`${h}#${f}`);break;default:h=d;break}const m={...k};return h&&(m.href=h),a.render("a",m,r.text)},we=(r,a)=>{var c,d;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),a.render("span",{blok:(c=r==null?void 0:r.attrs)==null?void 0:c.body[0],id:(d=r.attrs)==null?void 0:d.id,style:"display: none"})},Ce=(r,a)=>{const c={},d=a.render("tbody",{},r.children);return a.render("table",c,d)},Ee=(r,a)=>{const c={};return a.render("tr",c,r.children)},Le=(r,a)=>{const{colspan:c,rowspan:d,colwidth:f,backgroundColor:k,...h}=r.attrs||{},m={...h};c>1&&(m.colspan=c),d>1&&(m.rowspan=d);const w=[];return f&&w.push(`width: ${f}px;`),k&&w.push(`background-color: ${k};`),w.length>0&&(m.style=w.join(" ")),a.render("td",I(m),r.children)},Se=(r,a)=>{const{colspan:c,rowspan:d,colwidth:f,backgroundColor:k,...h}=r.attrs||{},m={...h};c>1&&(m.colspan=c),d>1&&(m.rowspan=d);const w=[];return f&&w.push(`width: ${f}px;`),k&&w.push(`background-color: ${k};`),w.length>0&&(m.style=w.join(" ")),a.render("th",I(m),r.children)},K=new Map([[g.DOCUMENT,i("")],[g.HEADING,y],[g.PARAGRAPH,i("p")],[g.UL_LIST,i("ul")],[g.OL_LIST,i("ol")],[g.LIST_ITEM,i("li")],[g.IMAGE,u],[g.EMOJI,L],[g.CODE_BLOCK,S],[g.HR,i("hr")],[g.BR,i("br")],[g.QUOTE,i("blockquote")],[g.COMPONENT,we],[de.TEXT,R],[C.LINK,z],[C.ANCHOR,z],[C.STYLED,E("span",!0)],[C.BOLD,E("strong")],[C.TEXT_STYLE,E("span",!0)],[C.ITALIC,E("em")],[C.UNDERLINE,E("u")],[C.STRIKE,E("s")],[C.CODE,E("code")],[C.SUPERSCRIPT,E("sup")],[C.SUBSCRIPT,E("sub")],[C.HIGHLIGHT,E("mark")],[g.TABLE,Ce],[g.TABLE_ROW,Ee],[g.TABLE_CELL,Le],[g.TABLE_HEADER,Se]]),J=new Map([...K,...Object.entries(l).map(([r,a])=>[r,a])]),Te=()=>({render:(r,a={},c)=>{if(b&&r){const d=t.get(r)||0;t.set(r,d+1),a.key=`${r}-${d}`}return n(r,a,c)},originalResolvers:K,mergedResolvers:J});function O(r){const a=J.get(r.type);if(!a)return console.error("<Storyblok>",`No resolver found for node type ${r.type}`),"";const c=Te();if(r.type==="text")return a(r,c);const d=r.content?r.content.map(M):void 0;return a({...r,children:d},c)}function M(r){return r.type==="doc"?p?r.content.map(O):r.content.map(O).join(""):Array.isArray(r)?r.map(O):O(r)}return{render:M}}let F=!1;const G=[],he=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=l=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?l():G.push(l)},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=l=>n(l),s.onload=l=>{G.forEach(o=>o()),F=!0,t(l)},document.getElementsByTagName("head")[0].appendChild(s)}),ge=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 ke(e,t){return H(t).render(e)}const ve=()=>he(me);v.getLiveStory=ne,v.handleStoryblokMessage=ae,v.loadStoryblokBridge=ve,v.renderRichText=ke,v.richTextResolver=H,v.storyblok=le,v.storyblokEditable=ge,v.toCamelCase=x,v.useStoryblokApi=oe,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}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.7",
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.7"
59
+ "@storyblok/js": "4.2.8"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@cypress/vite-dev-server": "^6.0.3",