@storyblok/astro 6.2.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,4 +1,4 @@
1
- (function(k,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(k=typeof globalThis<"u"?globalThis:k||self,A(k.storyblokAstro={}))})(this,function(k){"use strict";const A=`<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
1
+ (function(w,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(w=typeof globalThis<"u"?globalThis:w||self,$(w.storyblokAstro={}))})(this,function(w){"use strict";const $=`<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,56 +7,33 @@
7
7
  </g>
8
8
  </g>
9
9
  </g>
10
- </svg>`,V=/[\p{Lu}]/u,X=/[\p{Ll}]/u,B=/^[\p{Lu}](?![\p{Lu}])/gu,D=/([\p{Alpha}\p{N}_]|$)/u,_=/[_.\- ]+/,Z=new RegExp("^"+_.source),U=new RegExp(_.source+D.source,"gu"),z=new RegExp("\\d+"+D.source,"gu"),Q=(t,e,r,o)=>{let n=!1,s=!1,l=!1,p=!1;for(let c=0;c<t.length;c++){const u=t[c];p=c>2?t[c-3]==="-":!0,n&&V.test(u)?(t=t.slice(0,c)+"-"+t.slice(c),n=!1,l=s,s=!0,c++):s&&l&&X.test(u)&&(!p||o)?(t=t.slice(0,c-1)+"-"+t.slice(c-1),l=s,s=!1,n=!0):(n=e(u)===u&&r(u)!==u,l=s,s=r(u)===u&&e(u)!==u)}return t},ee=(t,e)=>(B.lastIndex=0,t.replaceAll(B,r=>e(r))),te=(t,e)=>(U.lastIndex=0,z.lastIndex=0,t.replaceAll(z,(r,o,n)=>["_","-"].includes(t.charAt(n+r.length))?r:e(r)).replaceAll(U,(r,o)=>e(o)));function re(t,e){if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(s=>s.trim()).filter(s=>s.length).join("-"):t=t.trim(),t.length===0)return"";const r=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),o=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return t.length===1?_.test(t)?"":e.pascalCase?o(t):r(t):(t!==r(t)&&(t=Q(t,r,o,e.preserveConsecutiveUppercase)),t=t.replace(Z,""),t=e.preserveConsecutiveUppercase?ee(t,r):r(t),e.pascalCase&&(t=o(t.charAt(0))+t.slice(1)),te(t,o))}function M(t){return re(t)}function oe(t,e={},r,o){const n="virtual:storyblok-components",s=`\0${n}`;return{name:"vite-plugin-storyblok-components",async resolveId(l){if(l===n)return s},async load(l){if(l===s){const p=[],c=[];for await(const[h,w]of Object.entries(e)){const v=await this.resolve(`/${t}/${w}.astro`);if(v)p.push(`import ${M(h)} from "${v.id}"`);else if(r)c.push(h);else throw new Error(`Component could not be found for blok "${h}"! Does "${`/${t}/${w}`}.astro" exist?`)}let u="";if(r)if(u=",FallbackComponent",o){const h=await this.resolve(`/${t}/${o}.astro`);if(!h)throw new Error(`Custom fallback component could not be found. Does "${`/${t}/${o}`}.astro" exist?`);p.push(`import FallbackComponent from "${h.id}"`)}else p.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(e).length)return`${p.join(";")};export default {${Object.keys(e).filter(h=>!c.includes(h)).map(h=>M(h)).join(",")}${u}}`;if(r)return`${p[0]}; export default {${u.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 se(t,e,r){const o="virtual:storyblok-init",n=`\0${o}`;return{name:"vite-plugin-storyblok-init",async resolveId(s){if(s===o)return n},async load(s){if(s===n)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
- accessToken: "${t}",
16
- use: ${e?"[]":"[apiPlugin]"},
17
- apiOptions: ${JSON.stringify(r)},
15
+ accessToken: "${e}",
16
+ use: ${t?"[]":"[apiPlugin]"},
17
+ apiOptions: ${JSON.stringify(s)},
18
18
  });
19
19
  export const storyblokApiInstance = storyblokApi;
20
- `}}}function ne(t){const e="virtual:storyblok-options",r=`\0${e}`;return{name:"vite-plugin-storyblok-options",async resolveId(o){if(o===e)return r},async load(o){if(o===r)return`export default ${JSON.stringify(t)}`}}}let H=!1;const F=[],ae=t=>new Promise((e,r)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=n=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}H?n():F.push(n)},document.getElementById("storyblok-javascript-bridge")))return;const o=document.createElement("script");o.async=!0,o.src=t,o.id="storyblok-javascript-bridge",o.onerror=n=>r(n),o.onload=n=>{F.forEach(s=>s()),H=!0,e(n)},document.getElementsByTagName("head")[0].appendChild(o)});var le=Object.defineProperty,ie=(t,e,r)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S=(t,e,r)=>ie(t,typeof e!="symbol"?e+"":e,r);class ce{constructor(){S(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),S(this,"getOptionsPage",(e,r=25,o=1)=>({...e,per_page:r,page:o})),S(this,"delay",e=>new Promise(r=>setTimeout(r,e))),S(this,"arrayFrom",(e=0,r)=>Array.from({length:e},r)),S(this,"range",(e=0,r=e)=>{const o=Math.abs(r-e)||0,n=e<r?1:-1;return this.arrayFrom(o,(s,l)=>l*n+e)}),S(this,"asyncMap",async(e,r)=>Promise.all(e.map(r))),S(this,"flatMap",(e=[],r)=>e.map(r).reduce((o,n)=>[...o,...n],[])),S(this,"escapeHTML",function(e){const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o=/[&<>"']/g,n=new RegExp(o.source);return e&&n.test(e)?e.replace(o,s=>r[s]):e})}stringify(e,r,o){const n=[];for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const l=e[s];if(l==null)continue;const p=o?"":encodeURIComponent(s);let c;typeof l=="object"?c=this.stringify(l,r?r+encodeURIComponent(`[${p}]`):p,Array.isArray(l)):c=`${r?r+encodeURIComponent(`[${p}]`):p}=${encodeURIComponent(l)}`,n.push(c)}return n.join("&")}getRegionURL(e){const r="api.storyblok.com",o="api-us.storyblok.com",n="app.storyblokchina.cn",s="api-ap.storyblok.com",l="api-ca.storyblok.com";switch(e){case"us":return o;case"cn":return n;case"ap":return s;case"ca":return l;default:return r}}}const ue=function(t,e){const r={};for(const o in t){const n=t[o];e.includes(o)&&n!==null&&(r[o]=n)}return r},de=t=>t==="email",ge=()=>({singleTag:"hr"}),pe=()=>({tag:"blockquote"}),fe=()=>({tag:"ul"}),he=t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),be=()=>({singleTag:"br"}),ye=t=>({tag:`h${t.attrs.level}`}),me=t=>({singleTag:[{tag:"img",attrs:ue(t.attrs,["src","alt","title"])}]}),ke=()=>({tag:"li"}),$e=()=>({tag:"ol"}),we=()=>({tag:"p"}),Te=t=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":t.attrs.name,emoji:t.attrs.emoji}}]}),ve=()=>({tag:"b"}),Ce=()=>({tag:"s"}),Ee=()=>({tag:"u"}),Se=()=>({tag:"strong"}),Ie=()=>({tag:"code"}),Le=()=>({tag:"i"}),Ae=t=>{if(!t.attrs)return{tag:""};const e=new ce().escapeHTML,r={...t.attrs},{linktype:o="url"}=t.attrs;if(delete r.linktype,r.href&&(r.href=e(t.attrs.href||"")),de(o)&&(r.href=`mailto:${r.href}`),r.anchor&&(r.href=`${r.href}#${r.anchor}`,delete r.anchor),r.custom){for(const n in r.custom)r[n]=r.custom[n];delete r.custom}return{tag:[{tag:"a",attrs:r}]}},Re=t=>({tag:[{tag:"span",attrs:t.attrs}]}),xe=()=>({tag:"sub"}),je=()=>({tag:"sup"}),Oe=t=>({tag:[{tag:"span",attrs:t.attrs}]}),_e=t=>{var e;return(e=t.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${t.attrs.color};`}}]}:{tag:""}},Me=t=>{var e;return(e=t.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${t.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:ge,blockquote:pe,bullet_list:fe,code_block:he,hard_break:be,heading:ye,image:me,list_item:ke,ordered_list:$e,paragraph:we,emoji:Te},marks:{bold:ve,strike:Ce,underline:Ee,strong:Se,code:Ie,italic:Le,link:Ae,styled:Re,subscript:xe,superscript:je,anchor:Oe,highlight:_e,textStyle:Me}},Ne=function(t){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},r=/[&<>"']/g,o=new RegExp(r.source);return t&&o.test(t)?t.replace(r,n=>e[n]):t};let G=!1;class K{constructor(e){S(this,"marks"),S(this,"nodes"),e||(e=q),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,r){this.nodes[e]=r}addMark(e,r){this.marks[e]=r}render(e,r={optimizeImages:!1},o=!0){if(!G&&o&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),G=!0),e&&e.content&&Array.isArray(e.content)){let n="";return e.content.forEach(s=>{n+=this.renderNode(s)}),r.optimizeImages?this.optimizeImages(n,r.optimizeImages):n}return console.warn(`The render method must receive an Object with a "content" field.
21
- The "content" field must be an array of nodes as the type ISbRichtext.
22
- ISbRichtext:
23
- content?: ISbRichtext[]
24
- marks?: ISbRichtext[]
25
- attrs?: any
26
- text?: string
27
- type: string
28
-
29
- Example:
30
- {
31
- content: [
32
- {
33
- content: [
34
- {
35
- text: 'Hello World',
36
- type: 'text'
37
- }
38
- ],
39
- type: 'paragraph'
40
- }
41
- ],
42
- type: 'doc'
43
- }`),""}optimizeImages(e,r){let o=0,n=0,s="",l="";typeof r!="boolean"&&(typeof r.width=="number"&&r.width>0&&(s+=`width="${r.width}" `,o=r.width),typeof r.height=="number"&&r.height>0&&(s+=`height="${r.height}" `,n=r.height),(r.loading==="lazy"||r.loading==="eager")&&(s+=`loading="${r.loading}" `),typeof r.class=="string"&&r.class.length>0&&(s+=`class="${r.class}" `),r.filters&&(typeof r.filters.blur=="number"&&r.filters.blur>=0&&r.filters.blur<=100&&(l+=`:blur(${r.filters.blur})`),typeof r.filters.brightness=="number"&&r.filters.brightness>=-100&&r.filters.brightness<=100&&(l+=`:brightness(${r.filters.brightness})`),r.filters.fill&&(r.filters.fill.match(/[0-9A-F]{6}/gi)||r.filters.fill==="transparent")&&(l+=`:fill(${r.filters.fill})`),r.filters.format&&["webp","png","jpeg"].includes(r.filters.format)&&(l+=`:format(${r.filters.format})`),typeof r.filters.grayscale=="boolean"&&r.filters.grayscale&&(l+=":grayscale()"),typeof r.filters.quality=="number"&&r.filters.quality>=0&&r.filters.quality<=100&&(l+=`:quality(${r.filters.quality})`),r.filters.rotate&&[90,180,270].includes(r.filters.rotate)&&(l+=`:rotate(${r.filters.rotate})`),l.length>0&&(l=`/filters${l}`))),s.length>0&&(e=e.replace(/<img/g,`<img ${s.trim()}`));const p=o>0||n>0||l.length>0?`${o}x${n}${l}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${p}`),typeof r!="boolean"&&(r.sizes||r.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,c=>{var u,h;const w=c.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(w&&w.length>0){const v={srcset:(u=r.srcset)==null?void 0:u.map(f=>{if(typeof f=="number")return`//${w}/m/${f}x0${l} ${f}w`;if(typeof f=="object"&&f.length===2){let I=0,j=0;return typeof f[0]=="number"&&(I=f[0]),typeof f[1]=="number"&&(j=f[1]),`//${w}/m/${I}x${j}${l} ${I}w`}return""}).join(", "),sizes:(h=r.sizes)==null?void 0:h.map(f=>f).join(", ")};let L="";return v.srcset&&(L+=`srcset="${v.srcset}" `),v.sizes&&(L+=`sizes="${v.sizes}" `),c.replace(/<img/g,`<img ${L.trim()}`)}return c})),e}renderNode(e){const r=[];e.marks&&e.marks.forEach(n=>{const s=this.getMatchingMark(n);s&&s.tag!==""&&r.push(this.renderOpeningTag(s.tag))});const o=this.getMatchingNode(e);return o&&o.tag&&r.push(this.renderOpeningTag(o.tag)),e.content?e.content.forEach(n=>{r.push(this.renderNode(n))}):e.text?r.push(Ne(e.text)):o&&o.singleTag?r.push(this.renderTag(o.singleTag," /")):o&&o.html?r.push(o.html):e.type==="emoji"&&r.push(this.renderEmoji(e)),o&&o.tag&&r.push(this.renderClosingTag(o.tag)),e.marks&&e.marks.slice(0).reverse().forEach(n=>{const s=this.getMatchingMark(n);s&&s.tag!==""&&r.push(this.renderClosingTag(s.tag))}),r.join("")}renderTag(e,r){return e.constructor===String?`<${e}${r}>`:e.map(o=>{if(o.constructor===String)return`<${o}${r}>`;{let n=`<${o.tag}`;if(o.attrs){for(const s in o.attrs)if(Object.prototype.hasOwnProperty.call(o.attrs,s)){const l=o.attrs[s];l!==null&&(n+=` ${s}="${l}"`)}}return`${n}${r}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(r=>r.constructor===String?`</${r}>`:`</${r.tag}>`).join("")}getMatchingNode(e){const r=this.nodes[e.type];if(typeof r=="function")return r(e)}getMatchingMark(e){const r=this.marks[e.type];if(typeof r=="function")return r(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const r=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(r," /")}}const Pe=t=>{if(typeof t!="object"||typeof t._editable>"u")return{};try{const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function Be(t,e){if(!e)return{src:t,attrs:{}};let r=0,o=0;const n={},s=[];function l(c,u,h,w,v){typeof c!="number"||c<=u||c>=h?console.warn(`[StoryblokRichText] - ${w.charAt(0).toUpperCase()+w.slice(1)} value must be a number between ${u} and ${h} (inclusive)`):v.push(`${w}(${c})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(n.width=e.width,r=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(n.height=e.height,o=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(n.loading=e.loading),e.class&&(n.class=e.class),e.filters){const{filters:c}=e||{},{blur:u,brightness:h,fill:w,format:v,grayscale:L,quality:f,rotate:I}=c||{};u&&l(u,0,100,"blur",s),f&&l(f,0,100,"quality",s),h&&l(h,0,100,"brightness",s),w&&s.push(`fill(${w})`),L&&s.push("grayscale()"),I&&[0,90,180,270].includes(e.filters.rotate||0)&&s.push(`rotate(${I})`),v&&["webp","png","jpeg"].includes(v)&&s.push(`format(${v})`)}e.srcset&&(n.srcset=e.srcset.map(c=>{if(typeof c=="number")return`${t}/m/${c}x0/${s.length>0?`filters:${s.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[u,h]=c;return`${t}/m/${u}x${h}/${s.length>0?`filters:${s.join(":")}`:""} ${u}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(n.sizes=e.sizes.join(", "))}let p=`${t}/m/`;return r>0&&o>0&&(p=`${p}${r}x${o}/`),s.length>0&&(p=`${p}filters:${s.join(":")}`),{src:p,attrs:n}}var y=(t=>(t.DOCUMENT="doc",t.HEADING="heading",t.PARAGRAPH="paragraph",t.QUOTE="blockquote",t.OL_LIST="ordered_list",t.UL_LIST="bullet_list",t.LIST_ITEM="list_item",t.CODE_BLOCK="code_block",t.HR="horizontal_rule",t.BR="hard_break",t.IMAGE="image",t.EMOJI="emoji",t.COMPONENT="blok",t.TABLE="table",t.TABLE_ROW="tableRow",t.TABLE_CELL="tableCell",t.TABLE_HEADER="tableHeader",t))(y||{}),E=(t=>(t.BOLD="bold",t.STRONG="strong",t.STRIKE="strike",t.UNDERLINE="underline",t.ITALIC="italic",t.CODE="code",t.LINK="link",t.ANCHOR="anchor",t.STYLED="styled",t.SUPERSCRIPT="superscript",t.SUBSCRIPT="subscript",t.TEXT_STYLE="textStyle",t.HIGHLIGHT="highlight",t))(E||{}),N=(t=>(t.TEXT="text",t))(N||{}),R=(t=>(t.URL="url",t.STORY="story",t.ASSET="asset",t.EMAIL="email",t))(R||{});const De=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ue=(t={})=>Object.keys(t).map(e=>`${e}="${t[e]}"`).join(" "),ze=(t={})=>Object.keys(t).map(e=>`${e}: ${t[e]}`).join("; ");function He(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const x=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>r!==void 0));function W(t,e={},r){const o=Ue(e),n=o?`${t} ${o}`:t,s=Array.isArray(r)?r.join(""):r||"";if(t){if(De.includes(t))return`<${n}>`}else return s;return`<${n}>${s}</${t}>`}function Fe(t={}){const e=new Map,{renderFn:r=W,textFn:o=He,resolvers:n={},optimizeImages:s=!1,keyedResolvers:l=!1}=t,p=r!==W,c=()=>({render:(a,i={},d)=>{if(l&&a){const g=e.get(a)||0;e.set(a,g+1),i.key=`${a}-${g}`}return r(a,i,d)}}),u=a=>(i,d)=>{const g=i.attrs||{};return d.render(a,g,i.children||null)},h=(a,i)=>{const{src:d,alt:g,title:b,srcset:T,sizes:m}=a.attrs||{};let $=d,C={};if(s){const{src:dt,attrs:gt}=Be(d,s);$=dt,C=gt}const ut={src:$,alt:g,title:b,srcset:T,sizes:m,...C};return i.render("img",x(ut))},w=(a,i)=>{const{level:d,...g}=a.attrs||{};return i.render(`h${d}`,g,a.children)},v=(a,i)=>{var d,g,b,T;const m=i.render("img",{src:(d=a.attrs)==null?void 0:d.fallbackImage,alt:(g=a.attrs)==null?void 0:g.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return i.render("span",{"data-type":"emoji","data-name":(b=a.attrs)==null?void 0:b.name,"data-emoji":(T=a.attrs)==null?void 0:T.emoji},m)},L=(a,i)=>i.render("pre",a.attrs||{},i.render("code",{},a.children||"")),f=(a,i=!1)=>({text:d,attrs:g},b)=>{const{class:T,id:m,...$}=g||{},C=i?{class:T,id:m,style:ze($)||void 0}:g||{};return b.render(a,x(C),d)},I=a=>P(a),j=a=>{const{marks:i,...d}=a;if("text"in a){if(i)return i.reduce((b,T)=>I({...T,text:b}),I({...d,children:d.children}));const g=a.attrs||{};if(l){const b=e.get("txt")||0;e.set("txt",b+1),g.key=`txt-${b}`}return o(d.text,g)}return""},Y=(a,i)=>{const{linktype:d,href:g,anchor:b,...T}=a.attrs||{};let m="";switch(d){case R.ASSET:case R.URL:m=g;break;case R.EMAIL:m=`mailto:${g}`;break;case R.STORY:m=g,b&&(m=`${m}#${b}`);break;default:m=g;break}const $={...T};return m&&($.href=m),i.render("a",$,a.text)},st=(a,i)=>{var d,g;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),i.render("span",{blok:(d=a==null?void 0:a.attrs)==null?void 0:d.body[0],id:(g=a.attrs)==null?void 0:g.id,style:"display: none"})},nt=(a,i)=>{const d={},g=i.render("tbody",{},a.children);return i.render("table",d,g)},at=(a,i)=>{const d={};return i.render("tr",d,a.children)},lt=(a,i)=>{const{colspan:d,rowspan:g,colwidth:b,backgroundColor:T,...m}=a.attrs||{},$={...m};d>1&&($.colspan=d),g>1&&($.rowspan=g);const C=[];return b&&C.push(`width: ${b}px;`),T&&C.push(`background-color: ${T};`),C.length>0&&($.style=C.join(" ")),i.render("td",x($),a.children)},it=(a,i)=>{const{colspan:d,rowspan:g,colwidth:b,backgroundColor:T,...m}=a.attrs||{},$={...m};d>1&&($.colspan=d),g>1&&($.rowspan=g);const C=[];return b&&C.push(`width: ${b}px;`),T&&C.push(`background-color: ${T};`),C.length>0&&($.style=C.join(" ")),i.render("th",x($),a.children)},ct=new Map([[y.DOCUMENT,u("")],[y.HEADING,w],[y.PARAGRAPH,u("p")],[y.UL_LIST,u("ul")],[y.OL_LIST,u("ol")],[y.LIST_ITEM,u("li")],[y.IMAGE,h],[y.EMOJI,v],[y.CODE_BLOCK,L],[y.HR,u("hr")],[y.BR,u("br")],[y.QUOTE,u("blockquote")],[y.COMPONENT,st],[N.TEXT,j],[E.LINK,Y],[E.ANCHOR,Y],[E.STYLED,f("span",!0)],[E.BOLD,f("strong")],[E.TEXT_STYLE,f("span",!0)],[E.ITALIC,f("em")],[E.UNDERLINE,f("u")],[E.STRIKE,f("s")],[E.CODE,f("code")],[E.SUPERSCRIPT,f("sup")],[E.SUBSCRIPT,f("sub")],[E.HIGHLIGHT,f("mark")],[y.TABLE,nt],[y.TABLE_ROW,at],[y.TABLE_CELL,lt],[y.TABLE_HEADER,it],...Object.entries(n).map(([a,i])=>[a,i])]);function O(a){const i=ct.get(a.type);if(!i)return console.error("<Storyblok>",`No resolver found for node type ${a.type}`),"";const d=c();if(a.type==="text")return i(a,d);const g=a.content?a.content.map(P):void 0;return i({...a,children:g},d)}function P(a){return a.type==="doc"?p?a.content.map(O):a.content.map(O).join(""):Array.isArray(a)?a.map(O):O(a)}return{render:P}}let qe,Ge="https://app.storyblok.com/f/storyblok-v2-latest.js";const Ke=(t,e)=>{t.addNode("blok",r=>{let o="";return r.attrs.body.forEach(n=>{o+=e(n.component,n)}),{html:o}})},We=t=>{var e;return!t||!((e=t==null?void 0:t.content)!=null&&e.some(r=>r.content||r.type==="blok"||r.type==="horizontal_rule"))},Je=(t,e,r)=>{let o=r||qe;if(!o){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return We(t)?"":(e&&(o=new K(e.schema),e.resolver&&Ke(o,e.resolver)),o.render(t,{},!1))},Ye=()=>ae(Ge);function Ve(){if(!(globalThis!=null&&globalThis.storyblokApiInstance))throw new Error("storyblokApiInstance has not been initialized correctly");return globalThis.storyblokApiInstance}async function Xe(t){let e=null;return t&&t.locals._storyblok_preview_data&&(e=t.locals._storyblok_preview_data),e}function Ze(t,e){var o;const r=(o=globalThis==null?void 0:globalThis.storyblokApiInstance)==null?void 0:o.richTextResolver;if(!r)throw new Error("Please initialize the Storyblok SDK before calling the renderRichText function");return Je(t,e,r)}function Qe(t){return typeof t=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(t)});`:"const storyblokInstance = new StoryblokBridge();"}function et(t){const e={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...t},r=Qe(e.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:o,updateConfig:n,addDevToolbarApp:s,addMiddleware:l,config:p})=>{if(n({vite:{plugins:[se(e.accessToken,e.useCustomApi,e.apiOptions),oe(e.componentsDir,e.components,e.enableFallbackComponent,e.customFallbackComponent),ne(e)]}}),e.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.");o("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",`
44
21
  import { storyblokApiInstance } from "virtual:storyblok-init";
45
22
  globalThis.storyblokApiInstance = storyblokApiInstance;
46
- `),e.bridge&&!e.livePreview&&o("page",`import { loadStoryblokBridge } from "@storyblok/astro";
23
+ `),t.bridge&&!t.livePreview&&n("page",`import { loadStoryblokBridge } from "@storyblok/astro";
47
24
  loadStoryblokBridge().then(() => {
48
25
  const { StoryblokBridge, location } = window;
49
- ${r}
26
+ ${s}
50
27
  storyblokInstance.on(["published", "change"], (event) => {
51
28
  if (!event.slugChanged) {
52
29
  location.reload(true);
53
30
  }
54
31
  });
55
32
  });
56
- `),e.livePreview&&(o("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
33
+ `),t.livePreview&&(n("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
57
34
  loadStoryblokBridge().then(() => {
58
35
  const { StoryblokBridge, location } = window;
59
- ${r}
36
+ ${s}
60
37
  storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
61
38
  });
62
- `),l({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),s({id:"storyblok",name:"Storyblok",icon:A,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let J;async function tt(t){const{action:e,story:r}=t||{};if(e==="input"&&r){const o=async()=>{const s=await ot(r),l=document.body;if(s.outerHTML===l.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');rt(l,s,p),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(J),J=setTimeout(o,500)}["published","change"].includes(t==null?void 0:t.action)&&location.reload()}function rt(t,e,r){if(r){const o=r.getAttribute("data-blok-uid"),n=e.querySelector(`[data-blok-uid="${o}"]`);n&&(n.setAttribute("data-blok-focused","true"),r.replaceWith(n))}else t.replaceWith(e)}async function ot(t){const r=await(await fetch(location.href,{method:"POST",body:JSON.stringify({...t,is_storyblok_preview:!0}),headers:{"Content-Type":"application/json"}})).text();return new DOMParser().parseFromString(r,"text/html").body}k.RichTextResolver=K,k.RichTextSchema=q,k.TextTypes=N,k.getLiveStory=Xe,k.handleStoryblokMessage=tt,k.loadStoryblokBridge=Ye,k.renderRichText=Ze,k.richTextResolver=Fe,k.storyblok=et,k.storyblokEditable=Pe,k.toCamelCase=M,k.useStoryblokApi=Ve,Object.defineProperty(k,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/dist/types.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- export type { ArrayFn, AsyncFn, ISbAlternateObject, // previously AlternateObject
1
+ export type { ArrayFn, AsyncFn, BlockTypes, ISbAlternateObject, // previously AlternateObject
2
2
  ISbCache, // previously StoryblokCache
3
3
  ISbConfig, // previously StoryblokConfig
4
4
  ISbContentMangmntAPI, ISbDimensions, ISbError, ISbEventPayload, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
5
- ISbNode, ISbResponse, ISbResult, // previously StoryblokResult
6
- ISbRichtext, // previously Richtext
5
+ ISbResponse, ISbResult, // previously StoryblokResult
7
6
  ISbSchema, ISbStories, // previously Stories
8
7
  ISbStoriesParams, // previously StoriesParams
9
8
  ISbStory, // previously Story
10
9
  ISbStoryData, // previously StoryData
11
10
  ISbStoryParams, // previously StoryParams
12
- RichTextResolver, SbBlokData, SbBlokKeyDataTypes, SbPluginFactory, SbRichTextOptions, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, } from '@storyblok/js';
11
+ MarkTypes, SbBlokData, SbBlokKeyDataTypes, SbPluginFactory, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, StoryblokRichTextDocumentNode, StoryblokRichTextImageOptimizationOptions, StoryblokRichTextNode, StoryblokRichTextNodeResolver, StoryblokRichTextNodeTypes, StoryblokRichTextOptions, StoryblokRichTextResolvers, TextTypes, } from '@storyblok/js';
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@storyblok/astro",
3
3
  "type": "module",
4
- "version": "6.2.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": "3.5.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
+ }