@storyblok/astro 7.0.0 → 7.0.1

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,7 +1,7 @@
1
1
  import { ISbStoryData, StoryblokBridgeConfigV2, StoryblokClient } from '../types';
2
2
  import { AstroGlobal } from 'astro';
3
3
  export declare function useStoryblokApi(): StoryblokClient;
4
- export declare function getLiveStory(Astro: Readonly<AstroGlobal>): Promise<ISbStoryData<import('@storyblok/js').StoryblokComponentType<string> & {
4
+ export declare function getLiveStory(Astro: Readonly<AstroGlobal>): Promise<ISbStoryData<import('storyblok-js-client').ISbComponentType<string> & {
5
5
  [index: string]: any;
6
6
  }> | null>;
7
7
  export declare function initStoryblokBridge(config: boolean | StoryblokBridgeConfigV2): string;
@@ -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, _ = /^[\p{Lu}](?![\p{Lu}])/gu, H = /([\p{Alpha}\p{N}_]|$)/u, O = /[_.\- ]+/, oe = new RegExp("^" + O.source), B = new RegExp(O.source + H.source, "gu"), N = new RegExp("\\d+" + H.source, "gu"), re = (e, t, s, n) => {
10
+ </svg>`, te = /[\p{Lu}]/u, oe = /[\p{Ll}]/u, M = /^[\p{Lu}](?![\p{Lu}])/gu, G = /([\p{Alpha}\p{N}_]|$)/u, O = /[_.\- ]+/, re = new RegExp("^" + O.source), N = new RegExp(O.source + G.source, "gu"), j = new RegExp("\\d+" + G.source, "gu"), se = (e, t, s, n) => {
11
11
  let l = !1, r = !1, b = !1, p = !1;
12
- for (let u = 0; u < e.length; u++) {
13
- const d = e[u];
14
- p = u > 2 ? e[u - 3] === "-" : !0, l && ee.test(d) ? (e = e.slice(0, u) + "-" + e.slice(u), l = !1, b = r, r = !0, u++) : r && b && te.test(d) && (!p || n) ? (e = e.slice(0, u - 1) + "-" + e.slice(u - 1), b = r, r = !1, l = !0) : (l = t(d) === d && s(d) !== d, b = r, r = s(d) === d && t(d) !== d);
12
+ for (let i = 0; i < e.length; i++) {
13
+ const u = e[i];
14
+ p = i > 2 ? e[i - 3] === "-" : !0, l && te.test(u) ? (e = e.slice(0, i) + "-" + e.slice(i), l = !1, b = r, r = !0, i++) : r && b && oe.test(u) && (!p || n) ? (e = e.slice(0, i - 1) + "-" + e.slice(i - 1), b = r, r = !1, l = !0) : (l = t(u) === u && s(u) !== u, b = r, r = s(u) === u && t(u) !== u);
15
15
  }
16
16
  return e;
17
- }, se = (e, t) => (_.lastIndex = 0, e.replaceAll(_, (s) => t(s))), ne = (e, t) => (B.lastIndex = 0, N.lastIndex = 0, e.replaceAll(N, (s, n, l) => ["_", "-"].includes(e.charAt(l + s.length)) ? s : t(s)).replaceAll(B, (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) => (N.lastIndex = 0, j.lastIndex = 0, e.replaceAll(j, (s, n, l) => ["_", "-"].includes(e.charAt(l + s.length)) ? s : t(s)).replaceAll(N, (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,12 +25,12 @@ function le(e, t) {
25
25
  }, Array.isArray(e) ? e = e.map((r) => r.trim()).filter((r) => r.length).join("-") : e = e.trim(), e.length === 0)
26
26
  return "";
27
27
  const s = t.locale === !1 ? (r) => r.toLowerCase() : (r) => r.toLocaleLowerCase(t.locale), n = t.locale === !1 ? (r) => r.toUpperCase() : (r) => r.toLocaleUpperCase(t.locale);
28
- return e.length === 1 ? O.test(e) ? "" : t.pascalCase ? n(e) : s(e) : (e !== s(e) && (e = re(e, s, n, t.preserveConsecutiveUppercase)), e = e.replace(oe, ""), 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(re, ""), 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 M(e) {
31
- return le(e);
30
+ function P(e) {
31
+ return ae(e);
32
32
  }
33
- function ae(e, t = {}, s, n) {
33
+ function ie(e, t = {}, s, n) {
34
34
  const l = "virtual:storyblok-components", r = `\0${l}`;
35
35
  return {
36
36
  name: "vite-plugin-storyblok-components",
@@ -40,23 +40,23 @@ function ae(e, t = {}, s, n) {
40
40
  },
41
41
  async load(b) {
42
42
  if (b === r) {
43
- const p = [], u = [];
44
- for await (const [f, L] of Object.entries(t)) {
45
- const $ = await this.resolve(
46
- `/${e}/${L}.astro`
43
+ const p = [], i = [];
44
+ for await (const [f, E] of Object.entries(t)) {
45
+ const L = await this.resolve(
46
+ `/${e}/${E}.astro`
47
47
  );
48
- if ($)
49
- p.push(`import ${M(f)} from "${$.id}"`);
48
+ if (L)
49
+ p.push(`import ${P(f)} from "${L.id}"`);
50
50
  else if (s)
51
- u.push(f);
51
+ i.push(f);
52
52
  else
53
53
  throw new Error(
54
- `Component could not be found for blok "${f}"! Does "${`/${e}/${L}`}.astro" exist?`
54
+ `Component could not be found for blok "${f}"! Does "${`/${e}/${E}`}.astro" exist?`
55
55
  );
56
56
  }
57
- let d = "";
57
+ let u = "";
58
58
  if (s)
59
- if (d = ",FallbackComponent", n) {
59
+ if (u = ",FallbackComponent", n) {
60
60
  const f = await this.resolve(
61
61
  `/${e}/${n}.astro`
62
62
  );
@@ -72,9 +72,9 @@ function ae(e, t = {}, s, n) {
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((f) => !u.includes(f)).map((f) => M(f)).join(",")}${d}}`;
75
+ return `${p.join(";")};export default {${Object.keys(t).filter((f) => !i.includes(f)).map((f) => P(f)).join(",")}${u}}`;
76
76
  if (s)
77
- return `${p[0]}; export default {${d.replace(",", "")}}`;
77
+ return `${p[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,7 +84,7 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
84
84
  }
85
85
  };
86
86
  }
87
- function ie(e, t, s) {
87
+ function ce(e, t, s) {
88
88
  const n = "virtual:storyblok-init", l = `\0${n}`;
89
89
  return {
90
90
  name: "vite-plugin-storyblok-init",
@@ -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",
@@ -129,7 +129,7 @@ async function Ee(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
135
  function Le(e) {
@@ -140,7 +140,7 @@ 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: {
@@ -154,18 +154,18 @@ function Le(e) {
154
154
  if (l({
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
171
  }), t.livePreview && (p == null ? void 0 : p.output) !== "server")
@@ -206,29 +206,29 @@ function Le(e) {
206
206
  })), r({
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 j;
216
+ let D;
217
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 r = await pe(s), b = document.body;
221
+ const r = await be(s), b = document.body;
222
222
  if (r.outerHTML === b.outerHTML)
223
223
  return;
224
224
  const p = document.querySelector('[data-blok-focused="true"]');
225
- ue(b, r, p), document.dispatchEvent(new Event("storyblok-live-preview-updated"));
225
+ pe(b, r, p), document.dispatchEvent(new Event("storyblok-live-preview-updated"));
226
226
  };
227
- clearTimeout(j), j = setTimeout(n, 500);
227
+ clearTimeout(D), D = 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
233
  const n = s.getAttribute("data-blok-uid"), l = t.querySelector(
234
234
  `[data-blok-uid="${n}"]`
@@ -237,7 +237,7 @@ function ue(e, t, s) {
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,25 +250,25 @@ async function pe(e) {
250
250
  })).text();
251
251
  return new DOMParser().parseFromString(s, "text/html").body;
252
252
  }
253
- function be(e, t) {
253
+ function fe(e, t) {
254
254
  if (!t)
255
255
  return { src: e, attrs: {} };
256
256
  let s = 0, n = 0;
257
257
  const l = {}, r = [];
258
- function b(u, d, f, L, $) {
259
- typeof u != "number" || u <= d || u >= f ? console.warn(`[StoryblokRichText] - ${L.charAt(0).toUpperCase() + L.slice(1)} value must be a number between ${d} and ${f} (inclusive)`) : $.push(`${L}(${u})`);
258
+ function b(i, u, f, E, L) {
259
+ typeof i != "number" || i <= u || i >= f ? console.warn(`[StoryblokRichText] - ${E.charAt(0).toUpperCase() + E.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : L.push(`${E}(${i})`);
260
260
  }
261
261
  if (typeof t == "object") {
262
262
  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) {
263
- const { filters: u } = t || {}, { blur: d, brightness: f, fill: L, format: $, grayscale: A, quality: C, rotate: T } = u || {};
264
- d && b(d, 0, 100, "blur", r), C && b(C, 0, 100, "quality", r), f && b(f, 0, 100, "brightness", r), L && r.push(`fill(${L})`), A && r.push("grayscale()"), T && [0, 90, 180, 270].includes(t.filters.rotate || 0) && r.push(`rotate(${T})`), $ && ["webp", "png", "jpeg"].includes($) && r.push(`format(${$})`);
263
+ const { filters: i } = t || {}, { blur: u, brightness: f, fill: E, format: L, grayscale: C, quality: $, rotate: T } = i || {};
264
+ u && b(u, 0, 100, "blur", r), $ && b($, 0, 100, "quality", r), f && b(f, 0, 100, "brightness", r), E && r.push(`fill(${E})`), C && r.push("grayscale()"), T && [0, 90, 180, 270].includes(t.filters.rotate || 0) && r.push(`rotate(${T})`), L && ["webp", "png", "jpeg"].includes(L) && r.push(`format(${L})`);
265
265
  }
266
- t.srcset && (l.srcset = t.srcset.map((u) => {
267
- if (typeof u == "number")
268
- return `${e}/m/${u}x0/${r.length > 0 ? `filters:${r.join(":")}` : ""} ${u}w`;
269
- if (Array.isArray(u) && u.length === 2) {
270
- const [d, f] = u;
271
- return `${e}/m/${d}x${f}/${r.length > 0 ? `filters:${r.join(":")}` : ""} ${d}w`;
266
+ t.srcset && (l.srcset = t.srcset.map((i) => {
267
+ if (typeof i == "number")
268
+ return `${e}/m/${i}x0/${r.length > 0 ? `filters:${r.join(":")}` : ""} ${i}w`;
269
+ if (Array.isArray(i) && i.length === 2) {
270
+ const [u, f] = i;
271
+ return `${e}/m/${u}x${f}/${r.length > 0 ? `filters:${r.join(":")}` : ""} ${u}w`;
272
272
  } else {
273
273
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
274
274
  return;
@@ -281,8 +281,8 @@ function be(e, t) {
281
281
  attrs: l
282
282
  };
283
283
  }
284
- var g = /* @__PURE__ */ ((e) => (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))(g || {}), E = /* @__PURE__ */ ((e) => (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))(E || {}), F = /* @__PURE__ */ ((e) => (e.TEXT = "text", e))(F || {}), I = /* @__PURE__ */ ((e) => (e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e))(I || {});
285
- const fe = [
284
+ var g = /* @__PURE__ */ ((e) => (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))(g || {}), v = /* @__PURE__ */ ((e) => (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))(v || {}), z = /* @__PURE__ */ ((e) => (e.TEXT = "text", e))(z || {}), I = /* @__PURE__ */ ((e) => (e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e))(I || {});
285
+ const ye = [
286
286
  "area",
287
287
  "base",
288
288
  "br",
@@ -297,59 +297,53 @@ const fe = [
297
297
  "source",
298
298
  "track",
299
299
  "wbr"
300
- ], ye = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), he = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
301
- function ge(e) {
300
+ ], he = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), ge = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
301
+ function ke(e) {
302
302
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
303
303
  }
304
- const v = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
305
- function P(e, t = {}, s) {
306
- const n = ye(t), l = n ? `${e} ${n}` : e, r = Array.isArray(s) ? s.join("") : s || "";
304
+ const S = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
305
+ function U(e, t = {}, s) {
306
+ const n = he(t), l = n ? `${e} ${n}` : e, r = Array.isArray(s) ? s.join("") : s || "";
307
307
  if (e) {
308
- if (fe.includes(e))
308
+ if (ye.includes(e))
309
309
  return `<${l}>`;
310
310
  } else return r;
311
311
  return `<${l}>${r}</${e}>`;
312
312
  }
313
- function ke(e = {}) {
313
+ function me(e = {}) {
314
314
  const t = /* @__PURE__ */ new Map(), {
315
- renderFn: s = P,
316
- textFn: n = ge,
315
+ renderFn: s = U,
316
+ textFn: n = ke,
317
317
  resolvers: l = {},
318
318
  optimizeImages: r = !1,
319
319
  keyedResolvers: b = !1
320
- } = e, p = s !== P, u = () => ({ render: (o, a = {}, i) => {
321
- if (b && o) {
322
- const c = t.get(o) || 0;
323
- t.set(o, c + 1), a.key = `${o}-${c}`;
324
- }
325
- return s(o, a, i);
326
- } }), d = (o) => (a, i) => {
327
- const c = a.attrs || {};
328
- return i.render(o, c, a.children || null);
329
- }, f = (o, a) => {
330
- const { src: i, alt: c, title: y, srcset: m, sizes: h } = o.attrs || {};
331
- let k = i, w = {};
320
+ } = e, p = s !== U, i = (o) => (a, c) => {
321
+ const d = a.attrs || {};
322
+ return c.render(o, d, a.children || null);
323
+ }, u = (o, a) => {
324
+ const { src: c, alt: d, title: y, srcset: m, sizes: h } = o.attrs || {};
325
+ let k = c, w = {};
332
326
  if (r) {
333
- const { src: X, attrs: Z } = be(i, r);
334
- k = X, w = Z;
327
+ const { src: Z, attrs: Q } = fe(c, r);
328
+ k = Z, w = Q;
335
329
  }
336
- const V = {
330
+ const X = {
337
331
  src: k,
338
- alt: c,
332
+ alt: d,
339
333
  title: y,
340
334
  srcset: m,
341
335
  sizes: h,
342
336
  ...w
343
337
  };
344
- return a.render("img", v(V));
345
- }, L = (o, a) => {
346
- const { level: i, ...c } = o.attrs || {};
347
- return a.render(`h${i}`, c, o.children);
348
- }, $ = (o, a) => {
349
- var i, c, y, m;
338
+ return a.render("img", S(X));
339
+ }, f = (o, a) => {
340
+ const { level: c, ...d } = o.attrs || {};
341
+ return a.render(`h${c}`, d, o.children);
342
+ }, E = (o, a) => {
343
+ var c, d, y, m;
350
344
  const h = a.render("img", {
351
- src: (i = o.attrs) == null ? void 0 : i.fallbackImage,
352
- alt: (c = o.attrs) == null ? void 0 : c.alt,
345
+ src: (c = o.attrs) == null ? void 0 : c.fallbackImage,
346
+ alt: (d = o.attrs) == null ? void 0 : d.alt,
353
347
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
354
348
  draggable: "false",
355
349
  loading: "lazy"
@@ -359,148 +353,166 @@ function ke(e = {}) {
359
353
  "data-name": (y = o.attrs) == null ? void 0 : y.name,
360
354
  "data-emoji": (m = o.attrs) == null ? void 0 : m.emoji
361
355
  }, h);
362
- }, A = (o, a) => a.render(
356
+ }, L = (o, a) => a.render(
363
357
  "pre",
364
358
  o.attrs || {},
365
359
  a.render("code", {}, o.children || "")
366
- ), C = (o, a = !1) => ({ text: i, attrs: c }, y) => {
367
- const { class: m, id: h, ...k } = c || {}, w = a ? {
360
+ ), C = (o, a = !1) => ({ text: c, attrs: d }, y) => {
361
+ const { class: m, id: h, ...k } = d || {}, w = a ? {
368
362
  class: m,
369
363
  id: h,
370
- style: he(k) || void 0
371
- } : c || {};
372
- return y.render(o, v(w), i);
373
- }, T = (o) => R(o), G = (o) => {
374
- const { marks: a, ...i } = o;
364
+ style: ge(k) || void 0
365
+ } : d || {};
366
+ return y.render(o, S(w), c);
367
+ }, $ = (o) => R(o), T = (o) => {
368
+ const { marks: a, ...c } = o;
375
369
  if ("text" in o) {
376
370
  if (a)
377
371
  return a.reduce(
378
- (y, m) => T({ ...m, text: y }),
379
- T({ ...i, children: i.children })
372
+ (y, m) => $({ ...m, text: y }),
373
+ $({ ...c, children: c.children })
380
374
  );
381
- const c = o.attrs || {};
375
+ const d = o.attrs || {};
382
376
  if (b) {
383
377
  const y = t.get("txt") || 0;
384
- t.set("txt", y + 1), c.key = `txt-${y}`;
378
+ t.set("txt", y + 1), d.key = `txt-${y}`;
385
379
  }
386
- return n(i.text, c);
380
+ return n(c.text, d);
387
381
  }
388
382
  return "";
389
383
  }, x = (o, a) => {
390
- const { linktype: i, href: c, anchor: y, ...m } = o.attrs || {};
384
+ const { linktype: c, href: d, anchor: y, ...m } = o.attrs || {};
391
385
  let h = "";
392
- switch (i) {
386
+ switch (c) {
393
387
  case I.ASSET:
394
388
  case I.URL:
395
- h = c;
389
+ h = d;
396
390
  break;
397
391
  case I.EMAIL:
398
- h = `mailto:${c}`;
392
+ h = `mailto:${d}`;
399
393
  break;
400
394
  case I.STORY:
401
- h = c, y && (h = `${h}#${y}`);
395
+ h = d, y && (h = `${h}#${y}`);
402
396
  break;
403
397
  default:
404
- h = c;
398
+ h = d;
405
399
  break;
406
400
  }
407
401
  const k = { ...m };
408
402
  return h && (k.href = h), a.render("a", k, o.text);
409
- }, z = (o, a) => {
410
- var i, c;
403
+ }, K = (o, a) => {
404
+ var c, d;
411
405
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), a.render("span", {
412
- blok: (i = o == null ? void 0 : o.attrs) == null ? void 0 : i.body[0],
413
- id: (c = o.attrs) == null ? void 0 : c.id,
406
+ blok: (c = o == null ? void 0 : o.attrs) == null ? void 0 : c.body[0],
407
+ id: (d = o.attrs) == null ? void 0 : d.id,
414
408
  style: "display: none"
415
409
  });
416
- }, K = (o, a) => {
417
- const i = {}, c = a.render("tbody", {}, o.children);
418
- return a.render("table", i, c);
419
410
  }, J = (o, a) => {
420
- const i = {};
421
- return a.render("tr", i, o.children);
411
+ const c = {}, d = a.render("tbody", {}, o.children);
412
+ return a.render("table", c, d);
422
413
  }, q = (o, a) => {
423
- const { colspan: i, rowspan: c, colwidth: y, backgroundColor: m, ...h } = o.attrs || {}, k = {
414
+ const c = {};
415
+ return a.render("tr", c, o.children);
416
+ }, W = (o, a) => {
417
+ const { colspan: c, rowspan: d, colwidth: y, backgroundColor: m, ...h } = o.attrs || {}, k = {
424
418
  ...h
425
419
  };
426
- i > 1 && (k.colspan = i), c > 1 && (k.rowspan = c);
420
+ c > 1 && (k.colspan = c), d > 1 && (k.rowspan = d);
427
421
  const w = [];
428
- return y && w.push(`width: ${y}px;`), m && w.push(`background-color: ${m};`), w.length > 0 && (k.style = w.join(" ")), a.render("td", v(k), o.children);
429
- }, W = (o, a) => {
430
- const { colspan: i, rowspan: c, colwidth: y, backgroundColor: m, ...h } = o.attrs || {}, k = {
422
+ return y && w.push(`width: ${y}px;`), m && w.push(`background-color: ${m};`), w.length > 0 && (k.style = w.join(" ")), a.render("td", S(k), o.children);
423
+ }, Y = (o, a) => {
424
+ const { colspan: c, rowspan: d, colwidth: y, backgroundColor: m, ...h } = o.attrs || {}, k = {
431
425
  ...h
432
426
  };
433
- i > 1 && (k.colspan = i), c > 1 && (k.rowspan = c);
427
+ c > 1 && (k.colspan = c), d > 1 && (k.rowspan = d);
434
428
  const w = [];
435
- return y && w.push(`width: ${y}px;`), m && w.push(`background-color: ${m};`), w.length > 0 && (k.style = w.join(" ")), a.render("th", v(k), o.children);
436
- }, Y = new Map([
437
- [g.DOCUMENT, d("")],
438
- [g.HEADING, L],
439
- [g.PARAGRAPH, d("p")],
440
- [g.UL_LIST, d("ul")],
441
- [g.OL_LIST, d("ol")],
442
- [g.LIST_ITEM, d("li")],
443
- [g.IMAGE, f],
444
- [g.EMOJI, $],
445
- [g.CODE_BLOCK, A],
446
- [g.HR, d("hr")],
447
- [g.BR, d("br")],
448
- [g.QUOTE, d("blockquote")],
449
- [g.COMPONENT, z],
450
- [F.TEXT, G],
451
- [E.LINK, x],
452
- [E.ANCHOR, x],
453
- [E.STYLED, C("span", !0)],
454
- [E.BOLD, C("strong")],
455
- [E.TEXT_STYLE, C("span", !0)],
456
- [E.ITALIC, C("em")],
457
- [E.UNDERLINE, C("u")],
458
- [E.STRIKE, C("s")],
459
- [E.CODE, C("code")],
460
- [E.SUPERSCRIPT, C("sup")],
461
- [E.SUBSCRIPT, C("sub")],
462
- [E.HIGHLIGHT, C("mark")],
463
- [g.TABLE, K],
464
- [g.TABLE_ROW, J],
465
- [g.TABLE_CELL, q],
466
- [g.TABLE_HEADER, W],
429
+ return y && w.push(`width: ${y}px;`), m && w.push(`background-color: ${m};`), w.length > 0 && (k.style = w.join(" ")), a.render("th", S(k), o.children);
430
+ }, _ = /* @__PURE__ */ new Map([
431
+ [g.DOCUMENT, i("")],
432
+ [g.HEADING, f],
433
+ [g.PARAGRAPH, i("p")],
434
+ [g.UL_LIST, i("ul")],
435
+ [g.OL_LIST, i("ol")],
436
+ [g.LIST_ITEM, i("li")],
437
+ [g.IMAGE, u],
438
+ [g.EMOJI, E],
439
+ [g.CODE_BLOCK, L],
440
+ [g.HR, i("hr")],
441
+ [g.BR, i("br")],
442
+ [g.QUOTE, i("blockquote")],
443
+ [g.COMPONENT, K],
444
+ [z.TEXT, T],
445
+ [v.LINK, x],
446
+ [v.ANCHOR, x],
447
+ [v.STYLED, C("span", !0)],
448
+ [v.BOLD, C("strong")],
449
+ [v.TEXT_STYLE, C("span", !0)],
450
+ [v.ITALIC, C("em")],
451
+ [v.UNDERLINE, C("u")],
452
+ [v.STRIKE, C("s")],
453
+ [v.CODE, C("code")],
454
+ [v.SUPERSCRIPT, C("sup")],
455
+ [v.SUBSCRIPT, C("sub")],
456
+ [v.HIGHLIGHT, C("mark")],
457
+ [g.TABLE, J],
458
+ [g.TABLE_ROW, q],
459
+ [g.TABLE_CELL, W],
460
+ [g.TABLE_HEADER, Y]
461
+ ]), B = new Map([
462
+ ..._,
467
463
  ...Object.entries(l).map(([o, a]) => [o, a])
468
- ]);
469
- function S(o) {
470
- const a = Y.get(o.type);
464
+ ]), V = () => ({
465
+ render: (o, a = {}, c) => {
466
+ if (b && o) {
467
+ const d = t.get(o) || 0;
468
+ t.set(o, d + 1), a.key = `${o}-${d}`;
469
+ }
470
+ return s(o, a, c);
471
+ },
472
+ originalResolvers: _,
473
+ mergedResolvers: B
474
+ });
475
+ function A(o) {
476
+ const a = B.get(o.type);
471
477
  if (!a)
472
478
  return console.error("<Storyblok>", `No resolver found for node type ${o.type}`), "";
473
- const i = u();
479
+ const c = V();
474
480
  if (o.type === "text")
475
- return a(o, i);
476
- const c = o.content ? o.content.map(R) : void 0;
481
+ return a(o, c);
482
+ const d = o.content ? o.content.map(R) : void 0;
477
483
  return a({
478
484
  ...o,
479
- children: c
480
- }, i);
485
+ children: d
486
+ }, c);
481
487
  }
482
488
  function R(o) {
483
- return o.type === "doc" ? p ? o.content.map(S) : o.content.map(S).join("") : Array.isArray(o) ? o.map(S) : S(o);
489
+ return o.type === "doc" ? p ? o.content.map(A) : o.content.map(A).join("") : Array.isArray(o) ? o.map(A) : A(o);
484
490
  }
485
491
  return {
486
492
  render: R
487
493
  };
488
494
  }
489
- let D = !1;
490
- const U = [], me = (e) => new Promise((t, s) => {
491
- if (typeof window > "u" || (window.storyblokRegisterEvent = (l) => {
495
+ let H = !1;
496
+ const F = [], we = (e) => new Promise((t, s) => {
497
+ if (typeof window > "u") {
498
+ s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
499
+ return;
500
+ }
501
+ if (window.storyblokRegisterEvent = (l) => {
492
502
  if (window.location === window.parent.location) {
493
503
  console.warn("You are not in Draft Mode or in the Visual Editor.");
494
504
  return;
495
505
  }
496
- D ? l() : U.push(l);
497
- }, document.getElementById("storyblok-javascript-bridge")))
506
+ H ? l() : F.push(l);
507
+ }, document.getElementById("storyblok-javascript-bridge")) {
508
+ t(void 0);
498
509
  return;
510
+ }
499
511
  const n = document.createElement("script");
500
512
  n.async = !0, n.src = e, n.id = "storyblok-javascript-bridge", n.onerror = (l) => s(l), n.onload = (l) => {
501
- U.forEach((r) => r()), D = !0, t(l);
513
+ F.forEach((r) => r()), H = !0, t(l);
502
514
  }, document.getElementsByTagName("head")[0].appendChild(n);
503
- }), Te = (e) => {
515
+ }), Ie = (e) => {
504
516
  if (typeof e != "object" || typeof e._editable > "u")
505
517
  return {};
506
518
  try {
@@ -515,19 +527,19 @@ const U = [], me = (e) => new Promise((t, s) => {
515
527
  return {};
516
528
  }
517
529
  };
518
- let we = "https://app.storyblok.com/f/storyblok-v2-latest.js";
519
- function Ie(e, t) {
520
- return ke(t).render(e);
530
+ let ve = "https://app.storyblok.com/f/storyblok-v2-latest.js";
531
+ function Te(e, t) {
532
+ return me(t).render(e);
521
533
  }
522
- const Se = () => me(we);
534
+ const Ae = () => we(ve);
523
535
  export {
524
536
  Ee as getLiveStory,
525
537
  $e as handleStoryblokMessage,
526
- Se as loadStoryblokBridge,
527
- Ie as renderRichText,
528
- ke as richTextResolver,
538
+ Ae as loadStoryblokBridge,
539
+ Te as renderRichText,
540
+ me as richTextResolver,
529
541
  Le as storyblok,
530
- Te as storyblokEditable,
531
- M as toCamelCase,
542
+ Ie as storyblokEditable,
543
+ P as toCamelCase,
532
544
  Ce as useStoryblokApi
533
545
  };
@@ -7,33 +7,33 @@
7
7
  </g>
8
8
  </g>
9
9
  </g>
10
- </svg>`,J=/[\p{Lu}]/u,q=/[\p{Ll}]/u,M=/^[\p{Lu}](?![\p{Lu}])/gu,N=/([\p{Alpha}\p{N}_]|$)/u,O=/[_.\- ]+/,W=new RegExp("^"+O.source),j=new RegExp(O.source+N.source,"gu"),P=new RegExp("\\d+"+N.source,"gu"),Y=(e,t,n,s)=>{let l=!1,r=!1,b=!1,p=!1;for(let u=0;u<e.length;u++){const d=e[u];p=u>2?e[u-3]==="-":!0,l&&J.test(d)?(e=e.slice(0,u)+"-"+e.slice(u),l=!1,b=r,r=!0,u++):r&&b&&q.test(d)&&(!p||s)?(e=e.slice(0,u-1)+"-"+e.slice(u-1),b=r,r=!1,l=!0):(l=t(d)===d&&n(d)!==d,b=r,r=n(d)===d&&t(d)!==d)}return e},V=(e,t)=>(M.lastIndex=0,e.replaceAll(M,n=>t(n))),X=(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 Z(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(r=>r.trim()).filter(r=>r.length).join("-"):e=e.trim(),e.length===0)return"";const n=t.locale===!1?r=>r.toLowerCase():r=>r.toLocaleLowerCase(t.locale),s=t.locale===!1?r=>r.toUpperCase():r=>r.toLocaleUpperCase(t.locale);return e.length===1?O.test(e)?"":t.pascalCase?s(e):n(e):(e!==n(e)&&(e=Y(e,n,s,t.preserveConsecutiveUppercase)),e=e.replace(W,""),e=t.preserveConsecutiveUppercase?V(e,n):n(e),t.pascalCase&&(e=s(e.charAt(0))+e.slice(1)),X(e,s))}function x(e){return Z(e)}function Q(e,t={},n,s){const l="virtual:storyblok-components",r=`\0${l}`;return{name:"vite-plugin-storyblok-components",async resolveId(b){if(b===l)return r},async load(b){if(b===r){const p=[],u=[];for await(const[f,S]of Object.entries(t)){const T=await this.resolve(`/${e}/${S}.astro`);if(T)p.push(`import ${x(f)} from "${T.id}"`);else if(n)u.push(f);else throw new Error(`Component could not be found for blok "${f}"! Does "${`/${e}/${S}`}.astro" exist?`)}let d="";if(n)if(d=",FallbackComponent",s){const f=await this.resolve(`/${e}/${s}.astro`);if(!f)throw new Error(`Custom fallback component could not be found. Does "${`/${e}/${s}`}.astro" exist?`);p.push(`import FallbackComponent from "${f.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(f=>!u.includes(f)).map(f=>x(f)).join(",")}${d}}`;if(n)return`${p[0]}; export default {${d.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
10
+ </svg>`,W=/[\p{Lu}]/u,Y=/[\p{Ll}]/u,B=/^[\p{Lu}](?![\p{Lu}])/gu,N=/([\p{Alpha}\p{N}_]|$)/u,x=/[_.\- ]+/,V=new RegExp("^"+x.source),j=new RegExp(x.source+N.source,"gu"),P=new RegExp("\\d+"+N.source,"gu"),X=(e,t,s,n)=>{let l=!1,r=!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=r,r=!0,i++):r&&b&&Y.test(u)&&(!p||n)?(e=e.slice(0,i-1)+"-"+e.slice(i-1),b=r,r=!1,l=!0):(l=t(u)===u&&s(u)!==u,b=r,r=s(u)===u&&t(u)!==u)}return e},Z=(e,t)=>(B.lastIndex=0,e.replaceAll(B,s=>t(s))),Q=(e,t)=>(j.lastIndex=0,P.lastIndex=0,e.replaceAll(P,(s,n,l)=>["_","-"].includes(e.charAt(l+s.length))?s:t(s)).replaceAll(j,(s,n)=>t(n)));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(r=>r.trim()).filter(r=>r.length).join("-"):e=e.trim(),e.length===0)return"";const s=t.locale===!1?r=>r.toLowerCase():r=>r.toLocaleLowerCase(t.locale),n=t.locale===!1?r=>r.toUpperCase():r=>r.toLocaleUpperCase(t.locale);return e.length===1?x.test(e)?"":t.pascalCase?n(e):s(e):(e!==s(e)&&(e=X(e,s,n,t.preserveConsecutiveUppercase)),e=e.replace(V,""),e=t.preserveConsecutiveUppercase?Z(e,s):s(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),Q(e,n))}function _(e){return ee(e)}function te(e,t={},s,n){const l="virtual:storyblok-components",r=`\0${l}`;return{name:"vite-plugin-storyblok-components",async resolveId(b){if(b===l)return r},async load(b){if(b===r){const p=[],i=[];for await(const[f,L]of Object.entries(t)){const S=await this.resolve(`/${e}/${L}.astro`);if(S)p.push(`import ${_(f)} from "${S.id}"`);else if(s)i.push(f);else throw new Error(`Component could not be found for blok "${f}"! Does "${`/${e}/${L}`}.astro" exist?`)}let u="";if(s)if(u=",FallbackComponent",n){const f=await this.resolve(`/${e}/${n}.astro`);if(!f)throw new Error(`Custom fallback component could not be found. Does "${`/${e}/${n}`}.astro" exist?`);p.push(`import FallbackComponent from "${f.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(f=>!i.includes(f)).map(f=>_(f)).join(",")}${u}}`;if(s)return`${p[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 ee(e,t,n){const s="virtual:storyblok-init",l=`\0${s}`;return{name:"vite-plugin-storyblok-init",async resolveId(r){if(r===s)return l},async load(r){if(r===l)return`
12
+ Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function oe(e,t,s){const n="virtual:storyblok-init",l=`\0${n}`;return{name:"vite-plugin-storyblok-init",async resolveId(r){if(r===n)return l},async load(r){if(r===l)return`
13
13
  import { storyblokInit, apiPlugin } from "@storyblok/js";
14
14
  const { storyblokApi } = storyblokInit({
15
15
  accessToken: "${e}",
16
16
  use: ${t?"[]":"[apiPlugin]"},
17
- apiOptions: ${JSON.stringify(n)},
17
+ apiOptions: ${JSON.stringify(s)},
18
18
  });
19
19
  export const storyblokApiInstance = storyblokApi;
20
- `}}}function te(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 re(e){let t=null;return e&&e.locals._storyblok_preview_data&&(t=e.locals._storyblok_preview_data),t}function ne(e){return typeof e=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});`:"const storyblokInstance = new StoryblokBridge();"}function se(e){const t={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...e},n=ne(t.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:s,updateConfig:l,addDevToolbarApp:r,addMiddleware:b,config:p})=>{if(l({vite:{plugins:[ee(t.accessToken,t.useCustomApi,t.apiOptions),Q(t.componentsDir,t.components,t.enableFallbackComponent,t.customFallbackComponent),te(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 re(e){const t="virtual:storyblok-options",s=`\0${t}`;return{name:"vite-plugin-storyblok-options",async resolveId(n){if(n===t)return s},async load(n){if(n===s)return`export default ${JSON.stringify(e)}`}}}function se(){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 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},s=le(t.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:n,updateConfig:l,addDevToolbarApp:r,addMiddleware:b,config:p})=>{if(l({vite:{plugins:[oe(t.accessToken,t.useCustomApi,t.apiOptions),te(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.");n("page-ssr",`
21
21
  import { storyblokApiInstance } from "virtual:storyblok-init";
22
22
  globalThis.storyblokApiInstance = storyblokApiInstance;
23
- `),t.bridge&&!t.livePreview&&s("page",`import { loadStoryblokBridge } from "@storyblok/astro";
23
+ `),t.bridge&&!t.livePreview&&n("page",`import { loadStoryblokBridge } from "@storyblok/astro";
24
24
  loadStoryblokBridge().then(() => {
25
25
  const { StoryblokBridge, location } = window;
26
- ${n}
26
+ ${s}
27
27
  storyblokInstance.on(["published", "change"], (event) => {
28
28
  if (!event.slugChanged) {
29
29
  location.reload(true);
30
30
  }
31
31
  });
32
32
  });
33
- `),t.livePreview&&(s("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
33
+ `),t.livePreview&&(n("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
34
34
  loadStoryblokBridge().then(() => {
35
35
  const { StoryblokBridge, location } = window;
36
- ${n}
36
+ ${s}
37
37
  storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
38
38
  });
39
- `),b({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),r({id:"storyblok",name:"Storyblok",icon:$,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let D;async function le(e){const{action:t,story:n}=e||{};if(t==="input"&&n){const s=async()=>{const r=await ie(n),b=document.body;if(r.outerHTML===b.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');ae(b,r,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 ae(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 ie(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}function ce(e,t){if(!t)return{src:e,attrs:{}};let n=0,s=0;const l={},r=[];function b(u,d,f,S,T){typeof u!="number"||u<=d||u>=f?console.warn(`[StoryblokRichText] - ${S.charAt(0).toUpperCase()+S.slice(1)} value must be a number between ${d} and ${f} (inclusive)`):T.push(`${S}(${u})`)}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:u}=t||{},{blur:d,brightness:f,fill:S,format:T,grayscale:_,quality:L,rotate:A}=u||{};d&&b(d,0,100,"blur",r),L&&b(L,0,100,"quality",r),f&&b(f,0,100,"brightness",r),S&&r.push(`fill(${S})`),_&&r.push("grayscale()"),A&&[0,90,180,270].includes(t.filters.rotate||0)&&r.push(`rotate(${A})`),T&&["webp","png","jpeg"].includes(T)&&r.push(`format(${T})`)}t.srcset&&(l.srcset=t.srcset.map(u=>{if(typeof u=="number")return`${e}/m/${u}x0/${r.length>0?`filters:${r.join(":")}`:""} ${u}w`;if(Array.isArray(u)&&u.length===2){const[d,f]=u;return`${e}/m/${d}x${f}/${r.length>0?`filters:${r.join(":")}`:""} ${d}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}/`),r.length>0&&(p=`${p}filters:${r.join(":")}`),{src:p,attrs:l}}var h=(e=>(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))(h||{}),E=(e=>(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))(E||{}),U=(e=>(e.TEXT="text",e))(U||{}),v=(e=>(e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e))(v||{});const de=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ue=(e={})=>Object.keys(e).map(t=>`${t}="${e[t]}"`).join(" "),pe=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function be(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 H(e,t={},n){const s=ue(t),l=s?`${e} ${s}`:e,r=Array.isArray(n)?n.join(""):n||"";if(e){if(de.includes(e))return`<${l}>`}else return r;return`<${l}>${r}</${e}>`}function F(e={}){const t=new Map,{renderFn:n=H,textFn:s=be,resolvers:l={},optimizeImages:r=!1,keyedResolvers:b=!1}=e,p=n!==H,u=()=>({render:(o,a={},i)=>{if(b&&o){const c=t.get(o)||0;t.set(o,c+1),a.key=`${o}-${c}`}return n(o,a,i)}}),d=o=>(a,i)=>{const c=a.attrs||{};return i.render(o,c,a.children||null)},f=(o,a)=>{const{src:i,alt:c,title:y,srcset:m,sizes:g}=o.attrs||{};let k=i,C={};if(r){const{src:ve,attrs:Ae}=ce(i,r);k=ve,C=Ae}const $e={src:k,alt:c,title:y,srcset:m,sizes:g,...C};return a.render("img",I($e))},S=(o,a)=>{const{level:i,...c}=o.attrs||{};return a.render(`h${i}`,c,o.children)},T=(o,a)=>{var i,c,y,m;const g=a.render("img",{src:(i=o.attrs)==null?void 0:i.fallbackImage,alt:(c=o.attrs)==null?void 0:c.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":(y=o.attrs)==null?void 0:y.name,"data-emoji":(m=o.attrs)==null?void 0:m.emoji},g)},_=(o,a)=>a.render("pre",o.attrs||{},a.render("code",{},o.children||"")),L=(o,a=!1)=>({text:i,attrs:c},y)=>{const{class:m,id:g,...k}=c||{},C=a?{class:m,id:g,style:pe(k)||void 0}:c||{};return y.render(o,I(C),i)},A=o=>B(o),me=o=>{const{marks:a,...i}=o;if("text"in o){if(a)return a.reduce((y,m)=>A({...m,text:y}),A({...i,children:i.children}));const c=o.attrs||{};if(b){const y=t.get("txt")||0;t.set("txt",y+1),c.key=`txt-${y}`}return s(i.text,c)}return""},K=(o,a)=>{const{linktype:i,href:c,anchor:y,...m}=o.attrs||{};let g="";switch(i){case v.ASSET:case v.URL:g=c;break;case v.EMAIL:g=`mailto:${c}`;break;case v.STORY:g=c,y&&(g=`${g}#${y}`);break;default:g=c;break}const k={...m};return g&&(k.href=g),a.render("a",k,o.text)},we=(o,a)=>{var i,c;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),a.render("span",{blok:(i=o==null?void 0:o.attrs)==null?void 0:i.body[0],id:(c=o.attrs)==null?void 0:c.id,style:"display: none"})},Ce=(o,a)=>{const i={},c=a.render("tbody",{},o.children);return a.render("table",i,c)},Ee=(o,a)=>{const i={};return a.render("tr",i,o.children)},Le=(o,a)=>{const{colspan:i,rowspan:c,colwidth:y,backgroundColor:m,...g}=o.attrs||{},k={...g};i>1&&(k.colspan=i),c>1&&(k.rowspan=c);const C=[];return y&&C.push(`width: ${y}px;`),m&&C.push(`background-color: ${m};`),C.length>0&&(k.style=C.join(" ")),a.render("td",I(k),o.children)},Se=(o,a)=>{const{colspan:i,rowspan:c,colwidth:y,backgroundColor:m,...g}=o.attrs||{},k={...g};i>1&&(k.colspan=i),c>1&&(k.rowspan=c);const C=[];return y&&C.push(`width: ${y}px;`),m&&C.push(`background-color: ${m};`),C.length>0&&(k.style=C.join(" ")),a.render("th",I(k),o.children)},Te=new Map([[h.DOCUMENT,d("")],[h.HEADING,S],[h.PARAGRAPH,d("p")],[h.UL_LIST,d("ul")],[h.OL_LIST,d("ol")],[h.LIST_ITEM,d("li")],[h.IMAGE,f],[h.EMOJI,T],[h.CODE_BLOCK,_],[h.HR,d("hr")],[h.BR,d("br")],[h.QUOTE,d("blockquote")],[h.COMPONENT,we],[U.TEXT,me],[E.LINK,K],[E.ANCHOR,K],[E.STYLED,L("span",!0)],[E.BOLD,L("strong")],[E.TEXT_STYLE,L("span",!0)],[E.ITALIC,L("em")],[E.UNDERLINE,L("u")],[E.STRIKE,L("s")],[E.CODE,L("code")],[E.SUPERSCRIPT,L("sup")],[E.SUBSCRIPT,L("sub")],[E.HIGHLIGHT,L("mark")],[h.TABLE,Ce],[h.TABLE_ROW,Ee],[h.TABLE_CELL,Le],[h.TABLE_HEADER,Se],...Object.entries(l).map(([o,a])=>[o,a])]);function R(o){const a=Te.get(o.type);if(!a)return console.error("<Storyblok>",`No resolver found for node type ${o.type}`),"";const i=u();if(o.type==="text")return a(o,i);const c=o.content?o.content.map(B):void 0;return a({...o,children:c},i)}function B(o){return o.type==="doc"?p?o.content.map(R):o.content.map(R).join(""):Array.isArray(o)?o.map(R):R(o)}return{render:B}}let G=!1;const z=[],fe=e=>new Promise((t,n)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=l=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}G?l():z.push(l)},document.getElementById("storyblok-javascript-bridge")))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=>{z.forEach(r=>r()),G=!0,t(l)},document.getElementsByTagName("head")[0].appendChild(s)}),ye=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 he="https://app.storyblok.com/f/storyblok-v2-latest.js";function ge(e,t){return F(t).render(e)}const ke=()=>fe(he);w.getLiveStory=re,w.handleStoryblokMessage=le,w.loadStoryblokBridge=ke,w.renderRichText=ge,w.richTextResolver=F,w.storyblok=se,w.storyblokEditable=ye,w.toCamelCase=x,w.useStoryblokApi=oe,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
39
+ `),b({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),r({id:"storyblok",name:"Storyblok",icon:$,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let D;async function ie(e){const{action:t,story:s}=e||{};if(t==="input"&&s){const n=async()=>{const r=await de(s),b=document.body;if(r.outerHTML===b.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');ce(b,r,p),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(D),D=setTimeout(n,500)}["published","change"].includes(e==null?void 0:e.action)&&location.reload()}function ce(e,t,s){if(s){const n=s.getAttribute("data-blok-uid"),l=t.querySelector(`[data-blok-uid="${n}"]`);l&&(l.setAttribute("data-blok-focused","true"),s.replaceWith(l))}else e.replaceWith(t)}async function de(e){const s=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(s,"text/html").body}function ue(e,t){if(!t)return{src:e,attrs:{}};let s=0,n=0;const l={},r=[];function b(i,u,f,L,S){typeof i!="number"||i<=u||i>=f?console.warn(`[StoryblokRichText] - ${L.charAt(0).toUpperCase()+L.slice(1)} value must be a number between ${u} and ${f} (inclusive)`):S.push(`${L}(${i})`)}if(typeof t=="object"){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){const{filters:i}=t||{},{blur:u,brightness:f,fill:L,format:S,grayscale:E,quality:A,rotate:R}=i||{};u&&b(u,0,100,"blur",r),A&&b(A,0,100,"quality",r),f&&b(f,0,100,"brightness",r),L&&r.push(`fill(${L})`),E&&r.push("grayscale()"),R&&[0,90,180,270].includes(t.filters.rotate||0)&&r.push(`rotate(${R})`),S&&["webp","png","jpeg"].includes(S)&&r.push(`format(${S})`)}t.srcset&&(l.srcset=t.srcset.map(i=>{if(typeof i=="number")return`${e}/m/${i}x0/${r.length>0?`filters:${r.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[u,f]=i;return`${e}/m/${u}x${f}/${r.length>0?`filters:${r.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 s>0&&n>0&&(p=`${p}${s}x${n}/`),r.length>0&&(p=`${p}filters:${r.join(":")}`),{src:p,attrs:l}}var h=(e=>(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))(h||{}),C=(e=>(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))(C||{}),U=(e=>(e.TEXT="text",e))(U||{}),T=(e=>(e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e))(T||{});const pe=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],be=(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 I=e=>Object.fromEntries(Object.entries(e).filter(([t,s])=>s!==void 0));function H(e,t={},s){const n=be(t),l=n?`${e} ${n}`:e,r=Array.isArray(s)?s.join(""):s||"";if(e){if(pe.includes(e))return`<${l}>`}else return r;return`<${l}>${r}</${e}>`}function F(e={}){const t=new Map,{renderFn:s=H,textFn:n=ye,resolvers:l={},optimizeImages:r=!1,keyedResolvers:b=!1}=e,p=s!==H,i=o=>(a,c)=>{const d=a.attrs||{};return c.render(o,d,a.children||null)},u=(o,a)=>{const{src:c,alt:d,title:y,srcset:k,sizes:g}=o.attrs||{};let m=c,v={};if(r){const{src:Ae,attrs:Ie}=ue(c,r);m=Ae,v=Ie}const Te={src:m,alt:d,title:y,srcset:k,sizes:g,...v};return a.render("img",I(Te))},f=(o,a)=>{const{level:c,...d}=o.attrs||{};return a.render(`h${c}`,d,o.children)},L=(o,a)=>{var c,d,y,k;const g=a.render("img",{src:(c=o.attrs)==null?void 0:c.fallbackImage,alt:(d=o.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":(y=o.attrs)==null?void 0:y.name,"data-emoji":(k=o.attrs)==null?void 0:k.emoji},g)},S=(o,a)=>a.render("pre",o.attrs||{},a.render("code",{},o.children||"")),E=(o,a=!1)=>({text:c,attrs:d},y)=>{const{class:k,id:g,...m}=d||{},v=a?{class:k,id:g,style:fe(m)||void 0}:d||{};return y.render(o,I(v),c)},A=o=>M(o),R=o=>{const{marks:a,...c}=o;if("text"in o){if(a)return a.reduce((y,k)=>A({...k,text:y}),A({...c,children:c.children}));const d=o.attrs||{};if(b){const y=t.get("txt")||0;t.set("txt",y+1),d.key=`txt-${y}`}return n(c.text,d)}return""},K=(o,a)=>{const{linktype:c,href:d,anchor:y,...k}=o.attrs||{};let g="";switch(c){case T.ASSET:case T.URL:g=d;break;case T.EMAIL:g=`mailto:${d}`;break;case T.STORY:g=d,y&&(g=`${g}#${y}`);break;default:g=d;break}const m={...k};return g&&(m.href=g),a.render("a",m,o.text)},ve=(o,a)=>{var c,d;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),a.render("span",{blok:(c=o==null?void 0:o.attrs)==null?void 0:c.body[0],id:(d=o.attrs)==null?void 0:d.id,style:"display: none"})},Ce=(o,a)=>{const c={},d=a.render("tbody",{},o.children);return a.render("table",c,d)},Ee=(o,a)=>{const c={};return a.render("tr",c,o.children)},Le=(o,a)=>{const{colspan:c,rowspan:d,colwidth:y,backgroundColor:k,...g}=o.attrs||{},m={...g};c>1&&(m.colspan=c),d>1&&(m.rowspan=d);const v=[];return y&&v.push(`width: ${y}px;`),k&&v.push(`background-color: ${k};`),v.length>0&&(m.style=v.join(" ")),a.render("td",I(m),o.children)},Se=(o,a)=>{const{colspan:c,rowspan:d,colwidth:y,backgroundColor:k,...g}=o.attrs||{},m={...g};c>1&&(m.colspan=c),d>1&&(m.rowspan=d);const v=[];return y&&v.push(`width: ${y}px;`),k&&v.push(`background-color: ${k};`),v.length>0&&(m.style=v.join(" ")),a.render("th",I(m),o.children)},J=new Map([[h.DOCUMENT,i("")],[h.HEADING,f],[h.PARAGRAPH,i("p")],[h.UL_LIST,i("ul")],[h.OL_LIST,i("ol")],[h.LIST_ITEM,i("li")],[h.IMAGE,u],[h.EMOJI,L],[h.CODE_BLOCK,S],[h.HR,i("hr")],[h.BR,i("br")],[h.QUOTE,i("blockquote")],[h.COMPONENT,ve],[U.TEXT,R],[C.LINK,K],[C.ANCHOR,K],[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")],[h.TABLE,Ce],[h.TABLE_ROW,Ee],[h.TABLE_CELL,Le],[h.TABLE_HEADER,Se]]),q=new Map([...J,...Object.entries(l).map(([o,a])=>[o,a])]),$e=()=>({render:(o,a={},c)=>{if(b&&o){const d=t.get(o)||0;t.set(o,d+1),a.key=`${o}-${d}`}return s(o,a,c)},originalResolvers:J,mergedResolvers:q});function O(o){const a=q.get(o.type);if(!a)return console.error("<Storyblok>",`No resolver found for node type ${o.type}`),"";const c=$e();if(o.type==="text")return a(o,c);const d=o.content?o.content.map(M):void 0;return a({...o,children:d},c)}function M(o){return o.type==="doc"?p?o.content.map(O):o.content.map(O).join(""):Array.isArray(o)?o.map(O):O(o)}return{render:M}}let G=!1;const z=[],he=e=>new Promise((t,s)=>{if(typeof window>"u"){s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=l=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}G?l():z.push(l)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const n=document.createElement("script");n.async=!0,n.src=e,n.id="storyblok-javascript-bridge",n.onerror=l=>s(l),n.onload=l=>{z.forEach(r=>r()),G=!0,t(l)},document.getElementsByTagName("head")[0].appendChild(n)}),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 F(t).render(e)}const we=()=>he(me);w.getLiveStory=ne,w.handleStoryblokMessage=ie,w.loadStoryblokBridge=we,w.renderRichText=ke,w.richTextResolver=F,w.storyblok=ae,w.storyblokEditable=ge,w.toCamelCase=_,w.useStoryblokApi=se,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@storyblok/astro",
3
3
  "type": "module",
4
- "version": "7.0.0",
4
+ "version": "7.0.1",
5
5
  "private": false,
6
- "packageManager": "pnpm@9.13.2",
7
6
  "description": "Official Astro integration for the Storyblok Headless CMS",
8
7
  "author": "Storyblok",
9
8
  "license": "MIT",
@@ -50,75 +49,33 @@
50
49
  "*.d.ts",
51
50
  "dist"
52
51
  ],
53
- "scripts": {
54
- "dev": "vite",
55
- "build": "vite build && tsc --project tsconfig.json",
56
- "playground": "pnpm run --filter ./playground/ssg dev",
57
- "playground:ssr": "pnpm run --filter ./playground/ssr dev",
58
- "playground:test": "pnpm run --filter ./playground/test dev",
59
- "lint": "eslint .",
60
- "lint:fix": "eslint . --fix",
61
- "lint:playground": "pnpm -r --parallel --filter='./playground/*' run lint",
62
- "lint:playground:fix": "pnpm -r --parallel --filter='./playground/*' run lint:fix",
63
- "test": "pnpm run test:unit:ci && pnpm run test:e2e",
64
- "test:unit": "vitest",
65
- "test:unit:ci": "vitest run",
66
- "test:e2e": "start-server-and-test playground:test http://localhost:4321/ cy:run",
67
- "test:e2e-watch": "start-server-and-test playground:test http://localhost:4321/ cy:open",
68
- "cy:run": "cypress run",
69
- "cy:open": "cypress open",
70
- "check-licenses": "node scripts/license-checker.mjs"
71
- },
72
52
  "peerDependencies": {
73
53
  "astro": "^3.0.0 || ^4.0.0 || ^5.0.0"
74
54
  },
75
55
  "dependencies": {
76
- "@storyblok/js": "4.0.0",
77
- "camelcase": "^8.0.0"
56
+ "camelcase": "^8.0.0",
57
+ "@storyblok/js": "4.0.3"
78
58
  },
79
59
  "devDependencies": {
80
- "@commitlint/cli": "^19.5.0",
81
- "@commitlint/config-conventional": "^19.5.0",
82
- "@cypress/vite-dev-server": "^5.2.0",
60
+ "@cypress/vite-dev-server": "^6.0.3",
83
61
  "@rollup/plugin-dynamic-import-vars": "^2.1.5",
84
62
  "@storyblok/eslint-config": "^0.3.0",
85
63
  "@types/lodash.mergewith": "^4.6.9",
86
- "@types/node": "22.10.2",
64
+ "@types/node": "^22.15.1",
87
65
  "astro": "^5.0.9",
88
- "cypress": "^13.15.2",
89
- "eslint": "^9.15.0",
90
- "eslint-config-prettier": "^9.1.0",
66
+ "cypress": "^14.3.3",
67
+ "eslint": "^9.26.0",
68
+ "eslint-config-prettier": "^10.0.1",
91
69
  "eslint-plugin-astro": "^1.3.1",
92
- "eslint-plugin-cypress": "^4.1.0",
93
- "license-checker": "^25.0.1",
94
- "lint-staged": "^15.2.10",
95
- "prettier": "^3.3.3",
70
+ "eslint-plugin-cypress": "^4.3.0",
71
+ "prettier": "^3.4.2",
96
72
  "prettier-plugin-astro": "^0.13.0",
97
- "simple-git-hooks": "^2.11.1",
98
- "start-server-and-test": "^2.0.8",
99
- "typescript": "5.7.2",
100
- "vite": "^6.0.1",
101
- "vite-plugin-dts": "^4.3.0",
73
+ "start-server-and-test": "^2.0.11",
74
+ "typescript": "5.8.3",
75
+ "vite": "^6.3.5",
76
+ "vite-plugin-dts": "^4.5.3",
102
77
  "vite-plugin-static-copy": "^2.2.0",
103
- "vitest": "^2.1.8"
104
- },
105
- "simple-git-hooks": {
106
- "pre-commit": "pnpm lint",
107
- "pre-push": "pnpm commitlint --last --verbose"
108
- },
109
- "lint-staged": {
110
- "*.{astro,js,css}": [
111
- "prettier --write",
112
- "eslint"
113
- ],
114
- "*.md": [
115
- "prettier --write"
116
- ]
117
- },
118
- "commitlint": {
119
- "extends": [
120
- "@commitlint/config-conventional"
121
- ]
78
+ "vitest": "^3.1.3"
122
79
  },
123
80
  "eslintConfig": {
124
81
  "env": {
@@ -163,5 +120,31 @@
163
120
  },
164
121
  "publishConfig": {
165
122
  "access": "public"
123
+ },
124
+ "nx": {
125
+ "implicitDependencies": [
126
+ "!@storyblok/playground-*"
127
+ ],
128
+ "tags": [
129
+ "type:lib"
130
+ ]
131
+ },
132
+ "scripts": {
133
+ "dev": "vite",
134
+ "build": "vite build && tsc --project tsconfig.json",
135
+ "playground": "pnpm run --filter ./playground/ssg dev",
136
+ "playground:ssr": "pnpm run --filter ./playground/ssr dev",
137
+ "playground:test": "pnpm run --filter ./playground/test dev",
138
+ "lint": "eslint .",
139
+ "lint:fix": "eslint . --fix",
140
+ "lint:playground": "pnpm -r --parallel --filter='./playground/*' run lint",
141
+ "lint:playground:fix": "pnpm -r --parallel --filter='./playground/*' run lint:fix",
142
+ "test": "pnpm run test:unit:ci && pnpm run test:e2e",
143
+ "test:unit": "vitest",
144
+ "test:unit:ci": "vitest run",
145
+ "test:e2e": "start-server-and-test playground:test http://localhost:4321/ cy:run",
146
+ "test:e2e-watch": "start-server-and-test playground:test http://localhost:4321/ cy:open",
147
+ "cy:run": "cypress run",
148
+ "cy:open": "cypress open"
166
149
  }
167
- }
150
+ }