@storyblok/astro 7.2.4 → 7.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/storyblok-astro.es.js +259 -295
- package/dist/storyblok-astro.umd.js +10 -10
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
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">
|
|
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,74 +7,74 @@ const te = `<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xm
|
|
|
7
7
|
</g>
|
|
8
8
|
</g>
|
|
9
9
|
</g>
|
|
10
|
-
</svg>`,
|
|
11
|
-
let
|
|
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
12
|
for (let i = 0; i < e.length; i++) {
|
|
13
|
-
const
|
|
14
|
-
p = i > 2 ? e[i - 3] === "-" : !0,
|
|
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);
|
|
15
15
|
}
|
|
16
16
|
return e;
|
|
17
|
-
},
|
|
18
|
-
function
|
|
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) {
|
|
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 = {
|
|
22
22
|
pascalCase: !1,
|
|
23
23
|
preserveConsecutiveUppercase: !1,
|
|
24
24
|
...t
|
|
25
|
-
}, Array.isArray(e) ? e = e.map((
|
|
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
|
-
const
|
|
28
|
-
return e.length === 1 ? O.test(e) ? "" : t.pascalCase ? n(e) :
|
|
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));
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function j(e) {
|
|
31
|
+
return le(e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
33
|
+
function ae(e, t = {}, s, n) {
|
|
34
|
+
const l = "virtual:storyblok-components", o = `\0${l}`;
|
|
35
35
|
return {
|
|
36
36
|
name: "vite-plugin-storyblok-components",
|
|
37
|
-
async resolveId(
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
37
|
+
async resolveId(b) {
|
|
38
|
+
if (b === l)
|
|
39
|
+
return o;
|
|
40
40
|
},
|
|
41
|
-
async load(
|
|
42
|
-
if (
|
|
41
|
+
async load(b) {
|
|
42
|
+
if (b === o) {
|
|
43
43
|
const p = [], i = [];
|
|
44
|
-
for await (const [
|
|
45
|
-
const
|
|
44
|
+
for await (const [y, E] of Object.entries(t)) {
|
|
45
|
+
const L = await this.resolve(
|
|
46
46
|
`/${e}/${E}.astro`
|
|
47
47
|
);
|
|
48
|
-
if (
|
|
49
|
-
p.push(`import ${
|
|
50
|
-
else if (
|
|
51
|
-
i.push(
|
|
48
|
+
if (L)
|
|
49
|
+
p.push(`import ${j(y)} from "${L.id}"`);
|
|
50
|
+
else if (s)
|
|
51
|
+
i.push(y);
|
|
52
52
|
else
|
|
53
53
|
throw new Error(
|
|
54
|
-
`Component could not be found for blok "${
|
|
54
|
+
`Component could not be found for blok "${y}"! Does "${`/${e}/${E}`}.astro" exist?`
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
|
-
let
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
57
|
+
let u = "";
|
|
58
|
+
if (s)
|
|
59
|
+
if (u = ",FallbackComponent", n) {
|
|
60
|
+
const y = await this.resolve(
|
|
61
61
|
`/${e}/${n}.astro`
|
|
62
62
|
);
|
|
63
|
-
if (!
|
|
63
|
+
if (!y)
|
|
64
64
|
throw new Error(
|
|
65
65
|
`Custom fallback component could not be found. Does "${`/${e}/${n}`}.astro" exist?`
|
|
66
66
|
);
|
|
67
67
|
p.push(
|
|
68
|
-
`import FallbackComponent from "${
|
|
68
|
+
`import FallbackComponent from "${y.id}"`
|
|
69
69
|
);
|
|
70
70
|
} else
|
|
71
71
|
p.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((
|
|
76
|
-
if (
|
|
77
|
-
return `${p[0]}; export default {${
|
|
75
|
+
return `${p.join(";")};export default {${Object.keys(t).filter((y) => !i.includes(y)).map((y) => j(y)).join(",")}${u}}`;
|
|
76
|
+
if (s)
|
|
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,55 +84,55 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const n = "virtual:storyblok-init",
|
|
87
|
+
function ie(e, t, s) {
|
|
88
|
+
const n = "virtual:storyblok-init", l = `\0${n}`;
|
|
89
89
|
return {
|
|
90
90
|
name: "vite-plugin-storyblok-init",
|
|
91
|
-
async resolveId(
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
91
|
+
async resolveId(o) {
|
|
92
|
+
if (o === n)
|
|
93
|
+
return l;
|
|
94
94
|
},
|
|
95
|
-
async load(
|
|
96
|
-
if (
|
|
95
|
+
async load(o) {
|
|
96
|
+
if (o === l)
|
|
97
97
|
return `
|
|
98
98
|
import { storyblokInit, apiPlugin } from "@storyblok/js";
|
|
99
99
|
const { storyblokApi } = storyblokInit({
|
|
100
100
|
accessToken: "${e}",
|
|
101
101
|
use: ${t ? "[]" : "[apiPlugin]"},
|
|
102
|
-
apiOptions: ${JSON.stringify(
|
|
102
|
+
apiOptions: ${JSON.stringify(s)},
|
|
103
103
|
});
|
|
104
104
|
export const storyblokApiInstance = storyblokApi;
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
const t = "virtual:storyblok-options",
|
|
109
|
+
function ce(e) {
|
|
110
|
+
const t = "virtual:storyblok-options", s = `\0${t}`;
|
|
111
111
|
return {
|
|
112
112
|
name: "vite-plugin-storyblok-options",
|
|
113
113
|
async resolveId(n) {
|
|
114
114
|
if (n === t)
|
|
115
|
-
return
|
|
115
|
+
return s;
|
|
116
116
|
},
|
|
117
117
|
async load(n) {
|
|
118
|
-
if (n ===
|
|
118
|
+
if (n === s)
|
|
119
119
|
return `export default ${JSON.stringify(e)}`;
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Ce() {
|
|
124
124
|
if (!(globalThis != null && globalThis.storyblokApiInstance))
|
|
125
125
|
throw new Error("storyblokApiInstance has not been initialized correctly");
|
|
126
126
|
return globalThis.storyblokApiInstance;
|
|
127
127
|
}
|
|
128
|
-
async function
|
|
128
|
+
async function 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
|
|
132
|
+
function de(e) {
|
|
133
133
|
return typeof e == "object" ? `const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});` : "const storyblokInstance = new StoryblokBridge();";
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Le(e) {
|
|
136
136
|
const t = {
|
|
137
137
|
useCustomApi: !1,
|
|
138
138
|
bridge: !0,
|
|
@@ -140,32 +140,32 @@ function Ne(e) {
|
|
|
140
140
|
enableFallbackComponent: !1,
|
|
141
141
|
livePreview: !1,
|
|
142
142
|
...e
|
|
143
|
-
},
|
|
143
|
+
}, s = de(t.bridge);
|
|
144
144
|
return {
|
|
145
145
|
name: "@storyblok/astro",
|
|
146
146
|
hooks: {
|
|
147
147
|
"astro:config:setup": ({
|
|
148
148
|
injectScript: n,
|
|
149
|
-
updateConfig:
|
|
150
|
-
addDevToolbarApp:
|
|
151
|
-
addMiddleware:
|
|
149
|
+
updateConfig: l,
|
|
150
|
+
addDevToolbarApp: o,
|
|
151
|
+
addMiddleware: b,
|
|
152
152
|
config: p
|
|
153
153
|
}) => {
|
|
154
|
-
if (
|
|
154
|
+
if (l({
|
|
155
155
|
vite: {
|
|
156
156
|
plugins: [
|
|
157
|
-
|
|
157
|
+
ie(
|
|
158
158
|
t.accessToken,
|
|
159
159
|
t.useCustomApi,
|
|
160
160
|
t.apiOptions
|
|
161
161
|
),
|
|
162
|
-
|
|
162
|
+
ae(
|
|
163
163
|
t.componentsDir,
|
|
164
164
|
t.components,
|
|
165
165
|
t.enableFallbackComponent,
|
|
166
166
|
t.customFallbackComponent
|
|
167
167
|
),
|
|
168
|
-
|
|
168
|
+
ce(t)
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
}), t.livePreview && (p == null ? void 0 : p.output) !== "server")
|
|
@@ -183,7 +183,7 @@ function Ne(e) {
|
|
|
183
183
|
`import { loadStoryblokBridge } from "@storyblok/astro";
|
|
184
184
|
loadStoryblokBridge().then(() => {
|
|
185
185
|
const { StoryblokBridge, location } = window;
|
|
186
|
-
${
|
|
186
|
+
${s}
|
|
187
187
|
storyblokInstance.on(["published", "change"], (event) => {
|
|
188
188
|
if (!event.slugChanged) {
|
|
189
189
|
location.reload(true);
|
|
@@ -196,49 +196,49 @@ function Ne(e) {
|
|
|
196
196
|
`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|
|
197
197
|
loadStoryblokBridge().then(() => {
|
|
198
198
|
const { StoryblokBridge, location } = window;
|
|
199
|
-
${
|
|
199
|
+
${s}
|
|
200
200
|
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
201
201
|
});
|
|
202
202
|
`
|
|
203
|
-
),
|
|
203
|
+
), b({
|
|
204
204
|
entrypoint: "@storyblok/astro/middleware.ts",
|
|
205
205
|
order: "pre"
|
|
206
|
-
})),
|
|
206
|
+
})), o({
|
|
207
207
|
id: "storyblok",
|
|
208
208
|
name: "Storyblok",
|
|
209
|
-
icon:
|
|
209
|
+
icon: Q,
|
|
210
210
|
entrypoint: "@storyblok/astro/toolbarApp.ts"
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
let
|
|
217
|
-
async function
|
|
218
|
-
const { action: t, story:
|
|
219
|
-
if (t === "input" &&
|
|
216
|
+
let D;
|
|
217
|
+
async function Te(e) {
|
|
218
|
+
const { action: t, story: s } = e || {};
|
|
219
|
+
if (t === "input" && s) {
|
|
220
220
|
const n = async () => {
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
221
|
+
const o = await pe(s), b = document.body;
|
|
222
|
+
if (o.outerHTML === b.outerHTML)
|
|
223
223
|
return;
|
|
224
224
|
const p = document.querySelector('[data-blok-focused="true"]');
|
|
225
|
-
|
|
225
|
+
ue(b, o, p), document.dispatchEvent(new Event("storyblok-live-preview-updated"));
|
|
226
226
|
};
|
|
227
|
-
clearTimeout(
|
|
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
|
|
232
|
-
if (
|
|
233
|
-
const n =
|
|
231
|
+
function ue(e, t, s) {
|
|
232
|
+
if (s) {
|
|
233
|
+
const n = s.getAttribute("data-blok-uid"), l = t.querySelector(
|
|
234
234
|
`[data-blok-uid="${n}"]`
|
|
235
235
|
);
|
|
236
|
-
|
|
236
|
+
l && (l.setAttribute("data-blok-focused", "true"), s.replaceWith(l));
|
|
237
237
|
} else
|
|
238
238
|
e.replaceWith(t);
|
|
239
239
|
}
|
|
240
|
-
async function
|
|
241
|
-
const
|
|
240
|
+
async function pe(e) {
|
|
241
|
+
const s = await (await fetch(location.href, {
|
|
242
242
|
method: "POST",
|
|
243
243
|
body: JSON.stringify({
|
|
244
244
|
...e,
|
|
@@ -248,306 +248,270 @@ async function be(e) {
|
|
|
248
248
|
"Content-Type": "application/json"
|
|
249
249
|
}
|
|
250
250
|
})).text();
|
|
251
|
-
return new DOMParser().parseFromString(
|
|
252
|
-
}
|
|
253
|
-
function I(e, t, r) {
|
|
254
|
-
this.type = e, this.tag = t, this.attrs = null, this.map = null, this.nesting = r, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
|
|
251
|
+
return new DOMParser().parseFromString(s, "text/html").body;
|
|
255
252
|
}
|
|
256
|
-
I.prototype.attrIndex = function(e) {
|
|
257
|
-
if (!this.attrs)
|
|
258
|
-
return -1;
|
|
259
|
-
const t = this.attrs;
|
|
260
|
-
for (let r = 0, n = t.length; r < n; r++)
|
|
261
|
-
if (t[r][0] === e)
|
|
262
|
-
return r;
|
|
263
|
-
return -1;
|
|
264
|
-
};
|
|
265
|
-
I.prototype.attrPush = function(e) {
|
|
266
|
-
this.attrs ? this.attrs.push(e) : this.attrs = [e];
|
|
267
|
-
};
|
|
268
|
-
I.prototype.attrSet = function(e, t) {
|
|
269
|
-
const r = this.attrIndex(e), n = [e, t];
|
|
270
|
-
r < 0 ? this.attrPush(n) : this.attrs[r] = n;
|
|
271
|
-
};
|
|
272
|
-
I.prototype.attrGet = function(e) {
|
|
273
|
-
const t = this.attrIndex(e);
|
|
274
|
-
let r = null;
|
|
275
|
-
return t >= 0 && (r = this.attrs[t][1]), r;
|
|
276
|
-
};
|
|
277
|
-
I.prototype.attrJoin = function(e, t) {
|
|
278
|
-
const r = this.attrIndex(e);
|
|
279
|
-
r < 0 ? this.attrPush([e, t]) : this.attrs[r][1] = this.attrs[r][1] + " " + t;
|
|
280
|
-
};
|
|
281
|
-
const ye = "[a-zA-Z_:][a-zA-Z0-9:._-]*", fe = "[^\"'=<>`\\x00-\\x20]+", ge = "'[^']*'", me = '"[^"]*"', ke = "(?:" + fe + "|" + ge + "|" + me + ")", we = "(?:\\s+" + ye + "(?:\\s*=\\s*" + ke + ")?)", Ce = "<[A-Za-z][A-Za-z0-9\\-]*" + we + "*\\s*\\/?>", ve = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", Ee = new RegExp("^(?:" + Ce + "|" + ve + ")");
|
|
282
|
-
new RegExp(Ee.source + "\\s*$");
|
|
283
|
-
const K = [];
|
|
284
|
-
for (let e = 0; e < 256; e++)
|
|
285
|
-
K.push(0);
|
|
286
|
-
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e) {
|
|
287
|
-
K[e.charCodeAt(0)] = 1;
|
|
288
|
-
});
|
|
289
253
|
let m = /* @__PURE__ */ function(e) {
|
|
290
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;
|
|
291
|
-
}({}),
|
|
255
|
+
}({}), C = /* @__PURE__ */ function(e) {
|
|
292
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;
|
|
293
|
-
}({}),
|
|
257
|
+
}({}), be = /* @__PURE__ */ function(e) {
|
|
294
258
|
return e.TEXT = "text", e;
|
|
295
|
-
}({}),
|
|
259
|
+
}({}), I = /* @__PURE__ */ function(e) {
|
|
296
260
|
return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
|
|
297
261
|
}({});
|
|
298
|
-
|
|
262
|
+
const ye = [
|
|
263
|
+
"area",
|
|
264
|
+
"base",
|
|
265
|
+
"br",
|
|
266
|
+
"col",
|
|
267
|
+
"embed",
|
|
268
|
+
"hr",
|
|
269
|
+
"img",
|
|
270
|
+
"input",
|
|
271
|
+
"link",
|
|
272
|
+
"meta",
|
|
273
|
+
"param",
|
|
274
|
+
"source",
|
|
275
|
+
"track",
|
|
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) {
|
|
279
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
280
|
+
}
|
|
281
|
+
const A = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
|
|
282
|
+
function me(e, t) {
|
|
299
283
|
if (!t) return {
|
|
300
284
|
src: e,
|
|
301
285
|
attrs: {}
|
|
302
286
|
};
|
|
303
|
-
let
|
|
304
|
-
const
|
|
305
|
-
function
|
|
306
|
-
typeof i != "number" || i <=
|
|
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})`);
|
|
307
291
|
}
|
|
308
292
|
if (typeof t == "object") {
|
|
309
|
-
if (typeof t.width == "number" && t.width > 0 ? (
|
|
310
|
-
const { filters: i } = t || {}, { blur:
|
|
311
|
-
|
|
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()"), $ && [
|
|
312
296
|
0,
|
|
313
297
|
90,
|
|
314
298
|
180,
|
|
315
299
|
270
|
|
316
|
-
].includes(t.filters.rotate || 0) &&
|
|
300
|
+
].includes(t.filters.rotate || 0) && o.push(`rotate(${$})`), L && [
|
|
317
301
|
"webp",
|
|
318
302
|
"png",
|
|
319
303
|
"jpeg"
|
|
320
|
-
].includes(
|
|
304
|
+
].includes(L) && o.push(`format(${L})`);
|
|
321
305
|
}
|
|
322
|
-
t.srcset && (
|
|
323
|
-
if (typeof i == "number") return `${e}/m/${i}x0/${
|
|
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`;
|
|
324
308
|
if (Array.isArray(i) && i.length === 2) {
|
|
325
|
-
const [
|
|
326
|
-
return `${e}/m/${
|
|
309
|
+
const [u, y] = i;
|
|
310
|
+
return `${e}/m/${u}x${y}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${u}w`;
|
|
327
311
|
} else {
|
|
328
312
|
console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
|
|
329
313
|
return;
|
|
330
314
|
}
|
|
331
|
-
}).join(", ")), t.sizes && (
|
|
315
|
+
}).join(", ")), t.sizes && (l.sizes = t.sizes.join(", "));
|
|
332
316
|
}
|
|
333
317
|
let p = `${e}/m/`;
|
|
334
|
-
return
|
|
318
|
+
return s > 0 && n > 0 && (p = `${p}${s}x${n}/`), o.length > 0 && (p = `${p}filters:${o.join(":")}`), {
|
|
335
319
|
src: p,
|
|
336
|
-
attrs:
|
|
320
|
+
attrs: l
|
|
337
321
|
};
|
|
338
322
|
}
|
|
339
|
-
|
|
340
|
-
"
|
|
341
|
-
"base",
|
|
342
|
-
"br",
|
|
343
|
-
"col",
|
|
344
|
-
"embed",
|
|
345
|
-
"hr",
|
|
346
|
-
"img",
|
|
347
|
-
"input",
|
|
348
|
-
"link",
|
|
349
|
-
"meta",
|
|
350
|
-
"param",
|
|
351
|
-
"source",
|
|
352
|
-
"track",
|
|
353
|
-
"wbr"
|
|
354
|
-
], $e = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), Se = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
|
|
355
|
-
function Te(e) {
|
|
356
|
-
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
357
|
-
}
|
|
358
|
-
const R = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
|
|
359
|
-
function F(e, t = {}, r) {
|
|
360
|
-
const n = $e(t), a = n ? `${e} ${n}` : e, s = Array.isArray(r) ? r.join("") : r || "";
|
|
323
|
+
function U(e, t = {}, s) {
|
|
324
|
+
const n = fe(t), l = n ? `${e} ${n}` : e, o = Array.isArray(s) ? s.join("") : s || "";
|
|
361
325
|
if (e) {
|
|
362
|
-
if (
|
|
363
|
-
} else return
|
|
364
|
-
return `<${
|
|
326
|
+
if (ye.includes(e)) return `<${l}>`;
|
|
327
|
+
} else return o;
|
|
328
|
+
return `<${l}>${o}</${e}>`;
|
|
365
329
|
}
|
|
366
|
-
function
|
|
367
|
-
const t = /* @__PURE__ */ new Map(), { renderFn:
|
|
368
|
-
const
|
|
369
|
-
return c.render(
|
|
370
|
-
},
|
|
371
|
-
const { src: c, alt:
|
|
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 || {};
|
|
372
336
|
let g = c, w = {};
|
|
373
|
-
if (
|
|
374
|
-
const { src:
|
|
375
|
-
g =
|
|
337
|
+
if (o) {
|
|
338
|
+
const { src: Z, attrs: V } = me(c, o);
|
|
339
|
+
g = Z, w = V;
|
|
376
340
|
}
|
|
377
341
|
const X = {
|
|
378
342
|
src: g,
|
|
379
|
-
alt:
|
|
380
|
-
title:
|
|
343
|
+
alt: d,
|
|
344
|
+
title: f,
|
|
381
345
|
srcset: k,
|
|
382
|
-
sizes:
|
|
346
|
+
sizes: h,
|
|
383
347
|
...w
|
|
384
348
|
};
|
|
385
|
-
return
|
|
386
|
-
},
|
|
387
|
-
const { level: c, ...
|
|
388
|
-
return
|
|
389
|
-
}, E = (
|
|
390
|
-
var c,
|
|
391
|
-
const
|
|
392
|
-
src: (c =
|
|
393
|
-
alt: (
|
|
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,
|
|
394
358
|
style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
|
|
395
359
|
draggable: "false",
|
|
396
360
|
loading: "lazy"
|
|
397
361
|
});
|
|
398
|
-
return
|
|
362
|
+
return a.render("span", {
|
|
399
363
|
"data-type": "emoji",
|
|
400
|
-
"data-name": (
|
|
401
|
-
"data-emoji": (k =
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
const { class: k, id:
|
|
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 ? {
|
|
405
369
|
class: k,
|
|
406
|
-
id:
|
|
407
|
-
style:
|
|
408
|
-
} :
|
|
409
|
-
return
|
|
410
|
-
},
|
|
411
|
-
const { marks:
|
|
412
|
-
if ("text" in
|
|
413
|
-
if (
|
|
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;
|
|
376
|
+
if ("text" in r) {
|
|
377
|
+
if (a) return a.reduce((f, k) => T({
|
|
414
378
|
...k,
|
|
415
|
-
text:
|
|
416
|
-
}),
|
|
379
|
+
text: f
|
|
380
|
+
}), T({
|
|
417
381
|
...c,
|
|
418
382
|
children: c.children
|
|
419
383
|
}));
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
422
|
-
const
|
|
423
|
-
t.set("txt",
|
|
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}`;
|
|
424
388
|
}
|
|
425
|
-
return n(c.text,
|
|
389
|
+
return n(c.text, d);
|
|
426
390
|
}
|
|
427
391
|
return "";
|
|
428
|
-
},
|
|
429
|
-
const { linktype: c, href:
|
|
430
|
-
let
|
|
392
|
+
}, x = (r, a) => {
|
|
393
|
+
const { linktype: c, href: d, anchor: f, ...k } = r.attrs || {};
|
|
394
|
+
let h = "";
|
|
431
395
|
switch (c) {
|
|
432
|
-
case
|
|
433
|
-
case
|
|
434
|
-
|
|
396
|
+
case I.ASSET:
|
|
397
|
+
case I.URL:
|
|
398
|
+
h = d;
|
|
435
399
|
break;
|
|
436
|
-
case
|
|
437
|
-
|
|
400
|
+
case I.EMAIL:
|
|
401
|
+
h = `mailto:${d}`;
|
|
438
402
|
break;
|
|
439
|
-
case
|
|
440
|
-
|
|
403
|
+
case I.STORY:
|
|
404
|
+
h = d, f && (h = `${h}#${f}`);
|
|
441
405
|
break;
|
|
442
406
|
default:
|
|
443
|
-
|
|
407
|
+
h = d;
|
|
444
408
|
break;
|
|
445
409
|
}
|
|
446
410
|
const g = { ...k };
|
|
447
|
-
return
|
|
448
|
-
},
|
|
449
|
-
var c,
|
|
450
|
-
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),
|
|
451
|
-
blok: (c =
|
|
452
|
-
id: (
|
|
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,
|
|
453
417
|
style: "display: none"
|
|
454
418
|
});
|
|
455
|
-
},
|
|
456
|
-
const c = {},
|
|
457
|
-
return
|
|
458
|
-
},
|
|
419
|
+
}, K = (r, a) => {
|
|
420
|
+
const c = {}, d = a.render("tbody", {}, r.children);
|
|
421
|
+
return a.render("table", c, d);
|
|
422
|
+
}, J = (r, a) => {
|
|
459
423
|
const c = {};
|
|
460
|
-
return
|
|
461
|
-
},
|
|
462
|
-
const { colspan: c, rowspan:
|
|
463
|
-
c > 1 && (g.colspan = 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);
|
|
464
428
|
const w = [];
|
|
465
|
-
return
|
|
466
|
-
},
|
|
467
|
-
const { colspan: c, rowspan:
|
|
468
|
-
c > 1 && (g.colspan = c),
|
|
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);
|
|
469
433
|
const w = [];
|
|
470
|
-
return
|
|
471
|
-
},
|
|
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([
|
|
472
436
|
[m.DOCUMENT, i("")],
|
|
473
|
-
[m.HEADING,
|
|
437
|
+
[m.HEADING, y],
|
|
474
438
|
[m.PARAGRAPH, i("p")],
|
|
475
439
|
[m.UL_LIST, i("ul")],
|
|
476
440
|
[m.OL_LIST, i("ol")],
|
|
477
441
|
[m.LIST_ITEM, i("li")],
|
|
478
|
-
[m.IMAGE,
|
|
442
|
+
[m.IMAGE, u],
|
|
479
443
|
[m.EMOJI, E],
|
|
480
|
-
[m.CODE_BLOCK,
|
|
444
|
+
[m.CODE_BLOCK, L],
|
|
481
445
|
[m.HR, i("hr")],
|
|
482
446
|
[m.BR, i("br")],
|
|
483
447
|
[m.QUOTE, i("blockquote")],
|
|
484
|
-
[m.COMPONENT,
|
|
485
|
-
[
|
|
486
|
-
[
|
|
487
|
-
[
|
|
488
|
-
[
|
|
489
|
-
[
|
|
490
|
-
[
|
|
491
|
-
[
|
|
492
|
-
[
|
|
493
|
-
[
|
|
494
|
-
[
|
|
495
|
-
[
|
|
496
|
-
[
|
|
497
|
-
[
|
|
498
|
-
[m.TABLE,
|
|
499
|
-
[m.TABLE_ROW,
|
|
500
|
-
[m.TABLE_CELL,
|
|
501
|
-
[m.TABLE_HEADER,
|
|
502
|
-
]),
|
|
503
|
-
render: (
|
|
504
|
-
if (
|
|
505
|
-
const
|
|
506
|
-
t.set(
|
|
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}`;
|
|
507
471
|
}
|
|
508
|
-
return r
|
|
472
|
+
return s(r, a, c);
|
|
509
473
|
},
|
|
510
|
-
originalResolvers:
|
|
511
|
-
mergedResolvers:
|
|
474
|
+
originalResolvers: _,
|
|
475
|
+
mergedResolvers: B
|
|
512
476
|
});
|
|
513
|
-
function S(
|
|
514
|
-
const
|
|
515
|
-
if (!
|
|
516
|
-
return console.error("<Storyblok>", `No resolver found for node type ${
|
|
517
|
-
const c =
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
return
|
|
521
|
-
...
|
|
522
|
-
children:
|
|
477
|
+
function S(r) {
|
|
478
|
+
const a = B.get(r.type);
|
|
479
|
+
if (!a)
|
|
480
|
+
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({
|
|
485
|
+
...r,
|
|
486
|
+
children: d
|
|
523
487
|
}, c);
|
|
524
488
|
}
|
|
525
|
-
function
|
|
526
|
-
return
|
|
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);
|
|
527
491
|
}
|
|
528
|
-
return { render:
|
|
492
|
+
return { render: R };
|
|
529
493
|
}
|
|
530
494
|
let H = !1;
|
|
531
|
-
const
|
|
495
|
+
const F = [], we = (e) => new Promise((t, s) => {
|
|
532
496
|
if (typeof window > "u") {
|
|
533
|
-
|
|
497
|
+
s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
|
|
534
498
|
return;
|
|
535
499
|
}
|
|
536
|
-
if (window.storyblokRegisterEvent = (
|
|
500
|
+
if (window.storyblokRegisterEvent = (l) => {
|
|
537
501
|
if (!window.location.search.includes("_storyblok")) {
|
|
538
502
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
539
503
|
return;
|
|
540
504
|
}
|
|
541
|
-
H ?
|
|
505
|
+
H ? l() : F.push(l);
|
|
542
506
|
}, document.getElementById("storyblok-javascript-bridge")) {
|
|
543
507
|
t(void 0);
|
|
544
508
|
return;
|
|
545
509
|
}
|
|
546
510
|
const n = document.createElement("script");
|
|
547
|
-
n.async = !0, n.src = e, n.id = "storyblok-javascript-bridge", n.onerror = (
|
|
548
|
-
|
|
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);
|
|
549
513
|
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
550
|
-
}),
|
|
514
|
+
}), $e = (e) => {
|
|
551
515
|
if (typeof e != "object" || typeof e._editable > "u")
|
|
552
516
|
return {};
|
|
553
517
|
try {
|
|
@@ -562,19 +526,19 @@ const z = [], xe = (e) => new Promise((t, r) => {
|
|
|
562
526
|
return {};
|
|
563
527
|
}
|
|
564
528
|
};
|
|
565
|
-
let
|
|
566
|
-
function
|
|
567
|
-
return
|
|
529
|
+
let ve = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
530
|
+
function Se(e, t) {
|
|
531
|
+
return ke(t).render(e);
|
|
568
532
|
}
|
|
569
|
-
const
|
|
533
|
+
const Ie = () => we(ve);
|
|
570
534
|
export {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
535
|
+
Ee as getLiveStory,
|
|
536
|
+
Te as handleStoryblokMessage,
|
|
537
|
+
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
|
|
580
544
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
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">
|
|
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,33 +7,33 @@
|
|
|
7
7
|
</g>
|
|
8
8
|
</g>
|
|
9
9
|
</g>
|
|
10
|
-
</svg>`,
|
|
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.
|
|
11
11
|
Please register your components or enable the fallback component.
|
|
12
|
-
Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function
|
|
12
|
+
Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function 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`
|
|
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(
|
|
17
|
+
apiOptions: ${JSON.stringify(n)},
|
|
18
18
|
});
|
|
19
19
|
export const storyblokApiInstance = storyblokApi;
|
|
20
|
-
`}}}function
|
|
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",`
|
|
21
21
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
22
22
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
23
|
-
`),t.bridge&&!t.livePreview&&
|
|
23
|
+
`),t.bridge&&!t.livePreview&&s("page",`import { loadStoryblokBridge } from "@storyblok/astro";
|
|
24
24
|
loadStoryblokBridge().then(() => {
|
|
25
25
|
const { StoryblokBridge, location } = window;
|
|
26
|
-
${
|
|
26
|
+
${n}
|
|
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&&(
|
|
33
|
+
`),t.livePreview&&(s("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|
|
34
34
|
loadStoryblokBridge().then(() => {
|
|
35
35
|
const { StoryblokBridge, location } = window;
|
|
36
|
-
${
|
|
36
|
+
${n}
|
|
37
37
|
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
38
38
|
});
|
|
39
|
-
`),h({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),s({id:"storyblok",name:"Storyblok",icon:S,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let U;async function ce(e){const{action:t,story:r}=e||{};if(t==="input"&&r){const n=async()=>{const s=await de(r),h=document.body;if(s.outerHTML===h.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');ue(h,s,p),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(U),U=setTimeout(n,500)}["published","change"].includes(e==null?void 0:e.action)&&location.reload()}function ue(e,t,r){if(r){const n=r.getAttribute("data-blok-uid"),l=t.querySelector(`[data-blok-uid="${n}"]`);l&&(l.setAttribute("data-blok-focused","true"),r.replaceWith(l))}else e.replaceWith(t)}async function de(e){const r=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(r,"text/html").body}function I(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}I.prototype.attrIndex=function(e){if(!this.attrs)return-1;const t=this.attrs;for(let r=0,n=t.length;r<n;r++)if(t[r][0]===e)return r;return-1},I.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},I.prototype.attrSet=function(e,t){const r=this.attrIndex(e),n=[e,t];r<0?this.attrPush(n):this.attrs[r]=n},I.prototype.attrGet=function(e){const t=this.attrIndex(e);let r=null;return t>=0&&(r=this.attrs[t][1]),r},I.prototype.attrJoin=function(e,t){const r=this.attrIndex(e);r<0?this.attrPush([e,t]):this.attrs[r][1]=this.attrs[r][1]+" "+t};const pe="[a-zA-Z_:][a-zA-Z0-9:._-]*",he="[^\"'=<>`\\x00-\\x20]+",be="'[^']*'",fe='"[^"]*"',ye="(?:"+he+"|"+be+"|"+fe+")",ge="(?:\\s+"+pe+"(?:\\s*=\\s*"+ye+")?)",me="<[A-Za-z][A-Za-z0-9\\-]*"+ge+"*\\s*\\/?>",ke="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",we=new RegExp("^(?:"+me+"|"+ke+")");new RegExp(we.source+"\\s*$");const F=[];for(let e=0;e<256;e++)F.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){F[e.charCodeAt(0)]=1});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}({}),v=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}({}),Ce=function(e){return e.TEXT="text",e}({}),$=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});function ve(e,t){if(!t)return{src:e,attrs:{}};let r=0,n=0;const l={},s=[];function h(i,d,b,A,L){typeof i!="number"||i<=d||i>=b?console.warn(`[StoryblokRichText] - ${A.charAt(0).toUpperCase()+A.slice(1)} value must be a number between ${d} and ${b} (inclusive)`):L.push(`${A}(${i})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(l.width=t.width,r=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:d,brightness:b,fill:A,format:L,grayscale:E,quality:T,rotate:O}=i||{};d&&h(d,0,100,"blur",s),T&&h(T,0,100,"quality",s),b&&h(b,0,100,"brightness",s),A&&s.push(`fill(${A})`),E&&s.push("grayscale()"),O&&[0,90,180,270].includes(t.filters.rotate||0)&&s.push(`rotate(${O})`),L&&["webp","png","jpeg"].includes(L)&&s.push(`format(${L})`)}t.srcset&&(l.srcset=t.srcset.map(i=>{if(typeof i=="number")return`${e}/m/${i}x0/${s.length>0?`filters:${s.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[d,b]=i;return`${e}/m/${d}x${b}/${s.length>0?`filters:${s.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 r>0&&n>0&&(p=`${p}${r}x${n}/`),s.length>0&&(p=`${p}filters:${s.join(":")}`),{src:p,attrs:l}}const Ee=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ae=(e={})=>Object.keys(e).map(t=>`${t}="${e[t]}"`).join(" "),Le=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function Se(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const R=e=>Object.fromEntries(Object.entries(e).filter(([t,r])=>r!==void 0));function H(e,t={},r){const n=Ae(t),l=n?`${e} ${n}`:e,s=Array.isArray(r)?r.join(""):r||"";if(e){if(Ee.includes(e))return`<${l}>`}else return s;return`<${l}>${s}</${e}>`}function z(e={}){const t=new Map,{renderFn:r=H,textFn:n=Se,resolvers:l={},optimizeImages:s=!1,keyedResolvers:h=!1}=e,p=r!==H,i=o=>(a,c)=>{const u=a.attrs||{};return c.render(o,u,a.children||null)},d=(o,a)=>{const{src:c,alt:u,title:f,srcset:k,sizes:y}=o.attrs||{};let m=c,C={};if(s){const{src:De,attrs:Ue}=ve(c,s);m=De,C=Ue}const je={src:m,alt:u,title:f,srcset:k,sizes:y,...C};return a.render("img",R(je))},b=(o,a)=>{const{level:c,...u}=o.attrs||{};return a.render(`h${c}`,u,o.children)},A=(o,a)=>{var c,u,f,k;const y=a.render("img",{src:(c=o.attrs)==null?void 0:c.fallbackImage,alt:(u=o.attrs)==null?void 0:u.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=o.attrs)==null?void 0:f.name,"data-emoji":(k=o.attrs)==null?void 0:k.emoji},y)},L=(o,a)=>a.render("pre",o.attrs||{},a.render("code",{},o.children||"")),E=(o,a=!1)=>({text:c,attrs:u},f)=>{const{class:k,id:y,...m}=u||{},C=a?{class:k,id:y,style:Le(m)||void 0}:u||{};return f.render(o,R(C),c)},T=o=>B(o),O=o=>{const{marks:a,...c}=o;if("text"in o){if(a)return a.reduce((f,k)=>T({...k,text:f}),T({...c,children:c.children}));const u=o.attrs||{};if(h){const f=t.get("txt")||0;t.set("txt",f+1),u.key=`txt-${f}`}return n(c.text,u)}return""},Z=(o,a)=>{const{linktype:c,href:u,anchor:f,...k}=o.attrs||{};let y="";switch(c){case $.ASSET:case $.URL:y=u;break;case $.EMAIL:y=`mailto:${u}`;break;case $.STORY:y=u,f&&(y=`${y}#${f}`);break;default:y=u;break}const m={...k};return y&&(m.href=y),a.render("a",m,o.text)},xe=(o,a)=>{var c,u;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:(u=o.attrs)==null?void 0:u.id,style:"display: none"})},_e=(o,a)=>{const c={},u=a.render("tbody",{},o.children);return a.render("table",c,u)},Me=(o,a)=>{const c={};return a.render("tr",c,o.children)},Be=(o,a)=>{const{colspan:c,rowspan:u,colwidth:f,backgroundColor:k,...y}=o.attrs||{},m={...y};c>1&&(m.colspan=c),u>1&&(m.rowspan=u);const C=[];return f&&C.push(`width: ${f}px;`),k&&C.push(`background-color: ${k};`),C.length>0&&(m.style=C.join(" ")),a.render("td",R(m),o.children)},Ne=(o,a)=>{const{colspan:c,rowspan:u,colwidth:f,backgroundColor:k,...y}=o.attrs||{},m={...y};c>1&&(m.colspan=c),u>1&&(m.rowspan=u);const C=[];return f&&C.push(`width: ${f}px;`),k&&C.push(`background-color: ${k};`),C.length>0&&(m.style=C.join(" ")),a.render("th",R(m),o.children)},J=new Map([[g.DOCUMENT,i("")],[g.HEADING,b],[g.PARAGRAPH,i("p")],[g.UL_LIST,i("ul")],[g.OL_LIST,i("ol")],[g.LIST_ITEM,i("li")],[g.IMAGE,d],[g.EMOJI,A],[g.CODE_BLOCK,L],[g.HR,i("hr")],[g.BR,i("br")],[g.QUOTE,i("blockquote")],[g.COMPONENT,xe],[Ce.TEXT,O],[v.LINK,Z],[v.ANCHOR,Z],[v.STYLED,E("span",!0)],[v.BOLD,E("strong")],[v.TEXT_STYLE,E("span",!0)],[v.ITALIC,E("em")],[v.UNDERLINE,E("u")],[v.STRIKE,E("s")],[v.CODE,E("code")],[v.SUPERSCRIPT,E("sup")],[v.SUBSCRIPT,E("sub")],[v.HIGHLIGHT,E("mark")],[g.TABLE,_e],[g.TABLE_ROW,Me],[g.TABLE_CELL,Be],[g.TABLE_HEADER,Ne]]),Y=new Map([...J,...Object.entries(l).map(([o,a])=>[o,a])]),Pe=()=>({render:(o,a={},c)=>{if(h&&o){const u=t.get(o)||0;t.set(o,u+1),a.key=`${o}-${u}`}return r(o,a,c)},originalResolvers:J,mergedResolvers:Y});function x(o){const a=Y.get(o.type);if(!a)return console.error("<Storyblok>",`No resolver found for node type ${o.type}`),"";const c=Pe();if(o.type==="text")return a(o,c);const u=o.content?o.content.map(B):void 0;return a({...o,children:u},c)}function B(o){return o.type==="doc"?p?o.content.map(x):o.content.map(x).join(""):Array.isArray(o)?o.map(x):x(o)}return{render:B}}let G=!1;const K=[],Ie=e=>new Promise((t,r)=>{if(typeof window>"u"){r(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}G?l():K.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=>r(l),n.onload=l=>{K.forEach(s=>s()),G=!0,t(l)},document.getElementsByTagName("head")[0].appendChild(n)}),Te=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 $e="https://app.storyblok.com/f/storyblok-v2-latest.js";function Re(e,t){return z(t).render(e)}const Oe=()=>Ie($e);w.getLiveStory=le,w.handleStoryblokMessage=ce,w.loadStoryblokBridge=Oe,w.renderRichText=Re,w.richTextResolver=z,w.storyblok=ie,w.storyblokEditable=Te,w.toCamelCase=M,w.useStoryblokApi=ne,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}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"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/astro",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.2.
|
|
4
|
+
"version": "7.2.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Official Astro integration for the Storyblok Headless CMS",
|
|
7
7
|
"author": "Storyblok",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"main": "./dist/storyblok-astro.es.js",
|
|
48
48
|
"module": "./dist/storyblok-astro.js",
|
|
49
|
-
"types": "./dist/
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
50
|
"files": [
|
|
51
51
|
"*.d.ts",
|
|
52
52
|
"dist"
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"camelcase": "^8.0.0",
|
|
59
|
-
"@storyblok/js": "4.2.
|
|
59
|
+
"@storyblok/js": "4.2.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@cypress/vite-dev-server": "^6.0.3",
|
|
63
63
|
"@rollup/plugin-dynamic-import-vars": "^2.1.5",
|
|
64
64
|
"@types/lodash.mergewith": "^4.6.9",
|
|
65
65
|
"@types/node": "^22.15.18",
|
|
66
|
-
"astro": "^5.
|
|
66
|
+
"astro": "^5.13.2",
|
|
67
67
|
"cypress": "^14.3.3",
|
|
68
68
|
"eslint": "^9.26.0",
|
|
69
69
|
"eslint-config-prettier": "^10.0.1",
|