@storyblok/svelte 2.0.2 → 2.0.3

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/README.md CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  `@storyblok/svelte` helps you connect your Svelte project to Storyblok by:
38
38
 
39
- - Providing the `useStoryblokApi` function to interact with the Storyblok APIs, using the [storyblok-js-client](https://github.com/storyblok/storyblok-js-client)
39
+ - Providing the `getStoryblokApi` function to interact with the Storyblok APIs, using the [storyblok-js-client](https://github.com/storyblok/storyblok-js-client)
40
40
  - Enabling real time editing through the [Storyblok Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
41
41
  - Providing the `StoryblokComponent` which allows you to connect your components to the Storyblok Visual Editor -->
42
42
 
@@ -88,15 +88,15 @@ Install the file from the CDN and access the methods via `window.storyblokSvelte
88
88
 
89
89
  ### 1. Fetching Content
90
90
 
91
- Use the `useStoryblokApi()` gets your stories from the Storyblok CDN API:
91
+ Use the `getStoryblokApi()` gets your stories from the Storyblok CDN API:
92
92
 
93
93
  ```html
94
94
  <script>
95
95
  import { onMount } from "svelte";
96
- import { useStoryblokApi } from "@storyblok/svelte";
96
+ import { getStoryblokApi } from "@storyblok/svelte";
97
97
 
98
98
  onMount(async () => {
99
- const storyblokApi = useStoryblokApi();
99
+ const storyblokApi = getStoryblokApi();
100
100
  const { data } = await storyblokApi.get("cdn/stories/home", {
101
101
  version: "draft",
102
102
  });
@@ -113,12 +113,12 @@ Use `useStoryBridge` to get the updated story every time a change event is trigg
113
113
  ```html
114
114
  <script>
115
115
  import { onMount } from "svelte";
116
- import { useStoryblokApi, useStoryblokBridge } from "@storyblok/svelte";
116
+ import { getStoryblokApi, useStoryblokBridge } from "@storyblok/svelte";
117
117
 
118
118
  let story = null;
119
119
 
120
120
  onMount(async () => {
121
- const storyblokApi = useStoryblokApi();
121
+ const storyblokApi = getStoryblokApi();
122
122
  const { data } = await storyblokApi.get("cdn/stories/home", {
123
123
  version: "draft",
124
124
  });
@@ -1,12 +1,12 @@
1
- (function(f,y){typeof exports=="object"&&typeof module!="undefined"?y(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],y):(f=typeof globalThis!="undefined"?globalThis:f||self,y(f.storyblokSvelte={},f.t))})(this,function(f,y){"use strict";function ne(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var re=ne(y),oe=Object.defineProperty,se=Object.defineProperties,ie=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,ae=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,B=(t,e,n)=>e in t?oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))ae.call(e,n)&&B(t,n,e[n]);if(N)for(var n of N(e))ce.call(e,n)&&B(t,n,e[n]);return t},E=(t,e)=>se(t,ie(e));let q=!1;const L=[],le=t=>new Promise((e,n)=>{if(typeof window=="undefined"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}q?o():L.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=t,r.id="storyblok-javascript-bridge",r.onerror=o=>n(o),r.onload=o=>{L.forEach(s=>s()),q=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(r)});/*!
1
+ (function(f,y){typeof exports=="object"&&typeof module!="undefined"?y(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],y):(f=typeof globalThis!="undefined"?globalThis:f||self,y(f.storyblokSvelte={},f.t))})(this,function(f,y){"use strict";function re(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var oe=re(y),se=Object.defineProperty,ie=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,B=(t,e,n)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))ce.call(e,n)&&B(t,n,e[n]);if(N)for(var n of N(e))le.call(e,n)&&B(t,n,e[n]);return t},E=(t,e)=>ie(t,ae(e));let q=!1;const L=[],ue=t=>new Promise((e,n)=>{if(typeof window=="undefined"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}q?o():L.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=t,r.id="storyblok-javascript-bridge",r.onerror=o=>n(o),r.onload=o=>{L.forEach(s=>s()),q=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(r)});/*!
2
2
  * storyblok-js-client v0.0.0-development
3
3
  * Universal JavaScript SDK for Storyblok's API
4
4
  * (c) 2020-2022 Stobylok Team
5
- */function D(t){return typeof t=="number"&&t==t&&t!==1/0&&t!==-1/0}function U(t,e,n){if(!D(e))throw new TypeError("Expected `limit` to be a finite number");if(!D(n))throw new TypeError("Expected `interval` to be a finite number");var r=[],o=[],s=0,a=function(){s++;var c=setTimeout(function(){s--,r.length>0&&a(),o=o.filter(function(u){return u!==c})},n);o.indexOf(c)<0&&o.push(c);var l=r.shift();l.resolve(t.apply(l.self,l.args))},i=function(){var c=arguments,l=this;return new Promise(function(u,d){r.push({resolve:u,reject:d,args:c,self:l}),s<e&&a()})};return i.abort=function(){o.forEach(clearTimeout),o=[],r.forEach(function(c){c.reject(new throttle.AbortError)}),r.length=0},i}U.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const ue=function(t,e){if(!t)return null;let n={};for(let r in t){let o=t[r];e.indexOf(r)>-1&&o!==null&&(n[r]=o)}return n};var fe={nodes:{horizontal_rule:t=>({singleTag:"hr"}),blockquote:t=>({tag:"blockquote"}),bullet_list:t=>({tag:"ul"}),code_block:t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),hard_break:t=>({singleTag:"br"}),heading:t=>({tag:"h"+t.attrs.level}),image:t=>({singleTag:[{tag:"img",attrs:ue(t.attrs,["src","alt","title"])}]}),list_item:t=>({tag:"li"}),ordered_list:t=>({tag:"ol"}),paragraph:t=>({tag:"p"})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link(t){const e=p({},t.attrs),{linktype:n="url"}=t.attrs;return n==="email"&&(e.href="mailto:"+e.href),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},styled:t=>({tag:[{tag:"span",attrs:t.attrs}]})}};class de{constructor(e){e||(e=fe),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,n){this.nodes[e]=n}addMark(e,n){this.marks[e]=n}render(e={}){if(e.content&&Array.isArray(e.content)){let n="";return e.content.forEach(r=>{n+=this.renderNode(r)}),n}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){let n=[];e.marks&&e.marks.forEach(o=>{const s=this.getMatchingMark(o);s&&n.push(this.renderOpeningTag(s.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&n.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(o=>{n.push(this.renderNode(o))}):e.text?n.push(function(o){const s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=/[&<>"']/g,i=RegExp(a.source);return o&&i.test(o)?o.replace(a,c=>s[c]):o}(e.text)):r&&r.singleTag?n.push(this.renderTag(r.singleTag," /")):r&&r.html&&n.push(r.html),r&&r.tag&&n.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const s=this.getMatchingMark(o);s&&n.push(this.renderClosingTag(s.tag))}),n.join("")}renderTag(e,n){return e.constructor===String?`<${e}${n}>`:e.map(r=>{if(r.constructor===String)return`<${r}${n}>`;{let o="<"+r.tag;if(r.attrs)for(let s in r.attrs){let a=r.attrs[s];a!==null&&(o+=` ${s}="${a}"`)}return`${o}${n}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(n=>n.constructor===String?`</${n}>`:`</${n.tag}>`).join("")}getMatchingNode(e){if(typeof this.nodes[e.type]=="function")return this.nodes[e.type](e)}getMatchingMark(e){if(typeof this.marks[e.type]=="function")return this.marks[e.type](e)}}const he=(t=0,e=t)=>{const n=Math.abs(e-t)||0,r=t<e?1:-1;return((o=0,s)=>[...Array(o)].map(s))(n,(o,s)=>s*r+t)},O=(t,e,n)=>{const r=[];for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const s=t[o],a=n?"":encodeURIComponent(o);let i;i=typeof s=="object"?O(s,e?e+encodeURIComponent("["+a+"]"):a,Array.isArray(s)):(e?e+encodeURIComponent("["+a+"]"):a)+"="+encodeURIComponent(s),r.push(i)}return r.join("&")};let b={},g={};class pe{constructor(e,n){if(!n){let s=e.region?"-"+e.region:"",a=e.https===!1?"http":"https";n=e.oauthToken===void 0?`${a}://api${s}.storyblok.com/v2`:`${a}://api${s}.storyblok.com/v1`}let r=Object.assign({},e.headers),o=5;e.oauthToken!==void 0&&(r.Authorization=e.oauthToken,o=3),e.rateLimit!==void 0&&(o=e.rateLimit),this.richTextResolver=new de(e.richTextSchema),typeof e.componentResolver=="function"&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=U(this.throttledRequest,o,1e3),this.accessToken=e.accessToken,this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.client=re.default.create({baseURL:n,timeout:e.timeout||0,headers:r,proxy:e.proxy||!1}),e.responseInterceptor&&this.client.interceptors.response.use(s=>e.responseInterceptor(s))}setComponentResolver(e){this.richTextResolver.addNode("blok",n=>{let r="";return n.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})}parseParams(e={}){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=g[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,n={}){return((r="")=>r.indexOf("/cdn/")>-1)(e)?this.parseParams(n):n}makeRequest(e,n,r,o){const s=this.factoryParamOptions(e,((a={},i=25,c=1)=>E(p({},a),{per_page:i,page:c}))(n,r,o));return this.cacheResponse(e,s)}get(e,n){let r="/"+e;const o=this.factoryParamOptions(r,n);return this.cacheResponse(r,o)}async getAll(e,n={},r){const o=n.per_page||25,s="/"+e,a=s.split("/");r=r||a[a.length-1];const i=await this.makeRequest(s,n,o,1),c=Math.ceil(i.total/o);return((l=[],u)=>l.map(u).reduce((d,$)=>[...d,...$],[]))([i,...await(async(l=[],u)=>Promise.all(l.map(u)))(he(1,c),async l=>this.makeRequest(s,n,o,l+1))],l=>Object.values(l.data[r]))}post(e,n){let r="/"+e;return this.throttle("post",r,n)}put(e,n){let r="/"+e;return this.throttle("put",r,n)}delete(e,n){let r="/"+e;return this.throttle("delete",r,n)}getStories(e){return this.get("cdn/stories",e)}getStory(e,n){return this.get("cdn/stories/"+e,n)}setToken(e){this.accessToken=e}getToken(){return this.accessToken}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,n){const r=e[n];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[r.id]?r.story=this._cleanCopy(this.links[r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[r.uuid]&&(r.story=this._cleanCopy(this.links[r.uuid]))}_insertRelations(e,n,r){if(r.indexOf(e.component+"."+n)>-1){if(typeof e[n]=="string")this.relations[e[n]]&&(e[n]=this._cleanCopy(this.relations[e[n]]));else if(e[n].constructor===Array){let o=[];e[n].forEach(s=>{this.relations[s]&&o.push(this._cleanCopy(this.relations[s]))}),e[n]=o}}}iterateTree(e,n){let r=o=>{if(o!=null){if(o.constructor===Array)for(let s=0;s<o.length;s++)r(o[s]);else if(o.constructor===Object){if(o._stopResolving)return;for(let s in o)(o.component&&o._uid||o.type==="link")&&(this._insertRelations(o,s,n),this._insertLinks(o,s)),r(o[s])}}};r(e.content)}async resolveLinks(e,n){let r=[];if(e.link_uuids){const o=e.link_uuids.length;let s=[];const a=50;for(let i=0;i<o;i+=a){const c=Math.min(o,i+a);s.push(e.link_uuids.slice(i,c))}for(let i=0;i<s.length;i++)(await this.getStories({per_page:a,language:n.language,version:n.version,by_uuids:s[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(o=>{this.links[o.uuid]=E(p({},o),{_stopResolving:!0})})}async resolveRelations(e,n){let r=[];if(e.rel_uuids){const o=e.rel_uuids.length;let s=[];const a=50;for(let i=0;i<o;i+=a){const c=Math.min(o,i+a);s.push(e.rel_uuids.slice(i,c))}for(let i=0;i<s.length;i++)(await this.getStories({per_page:a,language:n.language,version:n.version,by_uuids:s[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.rels;r.forEach(o=>{this.relations[o.uuid]=E(p({},o),{_stopResolving:!0})})}async resolveStories(e,n){let r=[];n.resolve_relations!==void 0&&n.resolve_relations.length>0&&(r=n.resolve_relations.split(","),await this.resolveRelations(e,n)),["1","story","url"].indexOf(n.resolve_links)>-1&&await this.resolveLinks(e,n);for(const o in this.relations)this.iterateTree(this.relations[o],r);e.story?this.iterateTree(e.story,r):e.stories.forEach(o=>{this.iterateTree(o,r)})}cacheResponse(e,n,r){return r===void 0&&(r=0),new Promise(async(o,s)=>{let a=O({url:e,params:n}),i=this.cacheProvider();if(this.cache.clear==="auto"&&n.version==="draft"&&await this.flushCache(),n.version==="published"&&e!="/cdn/spaces/me"){const l=await i.get(a);if(l)return o(l)}try{let l=await this.throttle("get",e,{params:n,paramsSerializer:d=>O(d)}),u={data:l.data,headers:l.headers};if(l.headers["per-page"]&&(u=Object.assign({},u,{perPage:parseInt(l.headers["per-page"]),total:parseInt(l.headers.total)})),l.status!=200)return s(l);(u.data.story||u.data.stories)&&await this.resolveStories(u.data,n),n.version==="published"&&e!="/cdn/spaces/me"&&i.set(a,u),u.data.cv&&(n.version=="draft"&&g[n.token]!=u.data.cv&&this.flushCache(),g[n.token]=u.data.cv),o(u)}catch(l){if(l.response&&l.response.status===429&&(r+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${r} seconds.`),await(c=1e3*r,new Promise(u=>setTimeout(u,c))),this.cacheResponse(e,n,r).then(o).catch(s);s(l)}var c})}throttledRequest(e,n,r){return this.client[e](n,r)}cacheVersions(){return g}cacheVersion(){return g[this.accessToken]}setCacheVersion(e){this.accessToken&&(g[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get:e=>b[e],getAll:()=>b,set(e,n){b[e]=n},flush(){b={}}};default:return{get(){},getAll(){},set(){},flush(){}}}}async flushCache(){return await this.cacheProvider().flush(),this}}var ge=(t={})=>{const{apiOptions:e}=t;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new pe(e)}},ye=t=>{if(typeof t!="object"||typeof t._editable=="undefined")return{};const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};const me=(t,e,n={})=>{if(typeof window!="undefined"){if(typeof window.storyblokRegisterEvent=="undefined"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(n).on(["input","published","change"],o=>{o.action=="input"&&o.story.id===t?e(o.story):window.location.reload()})})}},_e=(t={})=>{const{bridge:e,accessToken:n,use:r=[],apiOptions:o={}}=t;o.accessToken=o.accessToken||n;const s={bridge:e,apiOptions:o};let a={};return r.forEach(i=>{a=p(p({},a),i(s))}),e!==!1&&le("https://app.storyblok.com/f/storyblok-v2-latest.js"),a};function V(){}function R(t,e){for(const n in e)t[n]=e[n];return t}function J(t){return t()}function Y(){return Object.create(null)}function m(t){t.forEach(J)}function ke(t){return typeof t=="function"}function be(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ve(t){return Object.keys(t).length===0}function we(t){const e={};for(const n in t)n[0]!=="$"&&(e[n]=t[n]);return e}function z(t,e){const n={};e=new Set(e);for(const r in t)!e.has(r)&&r[0]!=="$"&&(n[r]=t[r]);return n}function Te(t,e,n){t.insertBefore(e,n||null)}function F(t){t.parentNode.removeChild(t)}function $e(t){return document.createTextNode(t)}function Ee(){return $e("")}function Oe(t){return Array.from(t.childNodes)}let S;function _(t){S=t}const k=[],H=[],v=[],G=[],Re=Promise.resolve();let P=!1;function Se(){P||(P=!0,Re.then(K))}function j(t){v.push(t)}const x=new Set;let w=0;function K(){const t=S;do{for(;w<k.length;){const e=k[w];w++,_(e),Pe(e.$$)}for(_(null),k.length=0,w=0;H.length;)H.pop()();for(let e=0;e<v.length;e+=1){const n=v[e];x.has(n)||(x.add(n),n())}v.length=0}while(k.length);for(;G.length;)G.pop()();P=!1,x.clear(),_(t)}function Pe(t){if(t.fragment!==null){t.update(),m(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(j)}}const T=new Set;let h;function je(){h={r:0,c:[],p:h}}function xe(){h.r||m(h.c),h=h.p}function A(t,e){t&&t.i&&(T.delete(t),t.i(e))}function Q(t,e,n,r){if(t&&t.o){if(T.has(t))return;T.add(t),h.c.push(()=>{T.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function Ae(t,e){const n={},r={},o={$$scope:1};let s=t.length;for(;s--;){const a=t[s],i=e[s];if(i){for(const c in a)c in i||(r[c]=1);for(const c in i)o[c]||(n[c]=i[c],o[c]=1);t[s]=i}else for(const c in a)o[c]=1}for(const a in r)a in n||(n[a]=void 0);return n}function Ce(t){return typeof t=="object"&&t!==null?t:{}}function W(t){t&&t.c()}function C(t,e,n,r){const{fragment:o,on_mount:s,on_destroy:a,after_update:i}=t.$$;o&&o.m(e,n),r||j(()=>{const c=s.map(J).filter(ke);a?a.push(...c):m(c),t.$$.on_mount=[]}),i.forEach(j)}function I(t,e){const n=t.$$;n.fragment!==null&&(m(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Ie(t,e){t.$$.dirty[0]===-1&&(k.push(t),Se(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Me(t,e,n,r,o,s,a,i=[-1]){const c=S;_(t);const l=t.$$={fragment:null,ctx:null,props:s,update:V,not_equal:o,bound:Y(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Y(),dirty:i,skip_bound:!1,root:e.target||c.$$.root};a&&a(l.root);let u=!1;if(l.ctx=n?n(t,e.props||{},(d,$,...ee)=>{const te=ee.length?ee[0]:$;return l.ctx&&o(l.ctx[d],l.ctx[d]=te)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](te),u&&Ie(t,d)),$}):[],l.update(),u=!0,m(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){const d=Oe(e.target);l.fragment&&l.fragment.l(d),d.forEach(F)}else l.fragment&&l.fragment.c();e.intro&&A(t.$$.fragment),C(t,e.target,e.anchor,e.customElement),K()}_(c)}class Ne{$destroy(){I(this,1),this.$destroy=V}$on(e,n){const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!ve(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Be(t){let e,n,r;const o=[{blok:t[0]},t[2]];var s=t[1];function a(i){let c={};for(let l=0;l<o.length;l+=1)c=R(c,o[l]);return{props:c}}return s&&(e=new s(a())),{c(){e&&W(e.$$.fragment),n=Ee()},m(i,c){e&&C(e,i,c),Te(i,n,c),r=!0},p(i,[c]){const l=c&5?Ae(o,[c&1&&{blok:i[0]},c&4&&Ce(i[2])]):{};if(s!==(s=i[1])){if(e){je();const u=e;Q(u.$$.fragment,1,0,()=>{I(u,1)}),xe()}s?(e=new s(a()),W(e.$$.fragment),A(e.$$.fragment,1),C(e,n.parentNode,n)):e=null}else s&&e.$set(l)},i(i){r||(e&&A(e.$$.fragment,i),r=!0)},o(i){e&&Q(e.$$.fragment,i),r=!1},d(i){i&&F(n),e&&I(e,i)}}}function qe(t,e,n){const r=["blok"];let o=z(e,r),{blok:s}=e,a;return s?a=Z(s.component):console.error("Please provide a 'blok' property to the StoryblokComponent"),t.$$set=i=>{e=R(R({},e),we(i)),n(2,o=z(e,r)),"blok"in i&&n(0,s=i.blok)},[s,a,o]}class Le extends Ne{constructor(e){super();Me(this,e,qe,Be,be,{blok:0})}}const De=(t,e)=>{const n=r=>{const o=ye(r);o["data-blok-c"]&&(t.setAttribute("data-blok-c",o["data-blok-c"]),t.setAttribute("data-blok-uid",o["data-blok-uid"]),t.classList.add("storyblok__outline"))};return n(e),{update(r){n(r)}}};let M=null;const Ue=()=>(M||console.log("You can't use useStoryblokApi if you're not loading apiPlugin."),M);let X=null;const Ve=t=>{const{storyblokApi:e}=_e(t);M=e,X=t.components||{}},Z=t=>{const e=X[t];return e||console.error(`You didn't load the ${t} component. Please load it in storyblokInit. For example:
5
+ */function D(t){return typeof t=="number"&&t==t&&t!==1/0&&t!==-1/0}function U(t,e,n){if(!D(e))throw new TypeError("Expected `limit` to be a finite number");if(!D(n))throw new TypeError("Expected `interval` to be a finite number");var r=[],o=[],s=0,a=function(){s++;var c=setTimeout(function(){s--,r.length>0&&a(),o=o.filter(function(u){return u!==c})},n);o.indexOf(c)<0&&o.push(c);var l=r.shift();l.resolve(t.apply(l.self,l.args))},i=function(){var c=arguments,l=this;return new Promise(function(u,d){r.push({resolve:u,reject:d,args:c,self:l}),s<e&&a()})};return i.abort=function(){o.forEach(clearTimeout),o=[],r.forEach(function(c){c.reject(new throttle.AbortError)}),r.length=0},i}U.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const fe=function(t,e){if(!t)return null;let n={};for(let r in t){let o=t[r];e.indexOf(r)>-1&&o!==null&&(n[r]=o)}return n};var de={nodes:{horizontal_rule:t=>({singleTag:"hr"}),blockquote:t=>({tag:"blockquote"}),bullet_list:t=>({tag:"ul"}),code_block:t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),hard_break:t=>({singleTag:"br"}),heading:t=>({tag:"h"+t.attrs.level}),image:t=>({singleTag:[{tag:"img",attrs:fe(t.attrs,["src","alt","title"])}]}),list_item:t=>({tag:"li"}),ordered_list:t=>({tag:"ol"}),paragraph:t=>({tag:"p"})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link(t){const e=p({},t.attrs),{linktype:n="url"}=t.attrs;return n==="email"&&(e.href="mailto:"+e.href),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},styled:t=>({tag:[{tag:"span",attrs:t.attrs}]})}};class he{constructor(e){e||(e=de),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,n){this.nodes[e]=n}addMark(e,n){this.marks[e]=n}render(e={}){if(e.content&&Array.isArray(e.content)){let n="";return e.content.forEach(r=>{n+=this.renderNode(r)}),n}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){let n=[];e.marks&&e.marks.forEach(o=>{const s=this.getMatchingMark(o);s&&n.push(this.renderOpeningTag(s.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&n.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(o=>{n.push(this.renderNode(o))}):e.text?n.push(function(o){const s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=/[&<>"']/g,i=RegExp(a.source);return o&&i.test(o)?o.replace(a,c=>s[c]):o}(e.text)):r&&r.singleTag?n.push(this.renderTag(r.singleTag," /")):r&&r.html&&n.push(r.html),r&&r.tag&&n.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const s=this.getMatchingMark(o);s&&n.push(this.renderClosingTag(s.tag))}),n.join("")}renderTag(e,n){return e.constructor===String?`<${e}${n}>`:e.map(r=>{if(r.constructor===String)return`<${r}${n}>`;{let o="<"+r.tag;if(r.attrs)for(let s in r.attrs){let a=r.attrs[s];a!==null&&(o+=` ${s}="${a}"`)}return`${o}${n}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(n=>n.constructor===String?`</${n}>`:`</${n.tag}>`).join("")}getMatchingNode(e){if(typeof this.nodes[e.type]=="function")return this.nodes[e.type](e)}getMatchingMark(e){if(typeof this.marks[e.type]=="function")return this.marks[e.type](e)}}const pe=(t=0,e=t)=>{const n=Math.abs(e-t)||0,r=t<e?1:-1;return((o=0,s)=>[...Array(o)].map(s))(n,(o,s)=>s*r+t)},O=(t,e,n)=>{const r=[];for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const s=t[o],a=n?"":encodeURIComponent(o);let i;i=typeof s=="object"?O(s,e?e+encodeURIComponent("["+a+"]"):a,Array.isArray(s)):(e?e+encodeURIComponent("["+a+"]"):a)+"="+encodeURIComponent(s),r.push(i)}return r.join("&")};let b={},g={};class ge{constructor(e,n){if(!n){let s=e.region?"-"+e.region:"",a=e.https===!1?"http":"https";n=e.oauthToken===void 0?`${a}://api${s}.storyblok.com/v2`:`${a}://api${s}.storyblok.com/v1`}let r=Object.assign({},e.headers),o=5;e.oauthToken!==void 0&&(r.Authorization=e.oauthToken,o=3),e.rateLimit!==void 0&&(o=e.rateLimit),this.richTextResolver=new he(e.richTextSchema),typeof e.componentResolver=="function"&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=U(this.throttledRequest,o,1e3),this.accessToken=e.accessToken,this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.client=oe.default.create({baseURL:n,timeout:e.timeout||0,headers:r,proxy:e.proxy||!1}),e.responseInterceptor&&this.client.interceptors.response.use(s=>e.responseInterceptor(s))}setComponentResolver(e){this.richTextResolver.addNode("blok",n=>{let r="";return n.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})}parseParams(e={}){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=g[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,n={}){return((r="")=>r.indexOf("/cdn/")>-1)(e)?this.parseParams(n):n}makeRequest(e,n,r,o){const s=this.factoryParamOptions(e,((a={},i=25,c=1)=>E(p({},a),{per_page:i,page:c}))(n,r,o));return this.cacheResponse(e,s)}get(e,n){let r="/"+e;const o=this.factoryParamOptions(r,n);return this.cacheResponse(r,o)}async getAll(e,n={},r){const o=n.per_page||25,s="/"+e,a=s.split("/");r=r||a[a.length-1];const i=await this.makeRequest(s,n,o,1),c=Math.ceil(i.total/o);return((l=[],u)=>l.map(u).reduce((d,$)=>[...d,...$],[]))([i,...await(async(l=[],u)=>Promise.all(l.map(u)))(pe(1,c),async l=>this.makeRequest(s,n,o,l+1))],l=>Object.values(l.data[r]))}post(e,n){let r="/"+e;return this.throttle("post",r,n)}put(e,n){let r="/"+e;return this.throttle("put",r,n)}delete(e,n){let r="/"+e;return this.throttle("delete",r,n)}getStories(e){return this.get("cdn/stories",e)}getStory(e,n){return this.get("cdn/stories/"+e,n)}setToken(e){this.accessToken=e}getToken(){return this.accessToken}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,n){const r=e[n];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[r.id]?r.story=this._cleanCopy(this.links[r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[r.uuid]&&(r.story=this._cleanCopy(this.links[r.uuid]))}_insertRelations(e,n,r){if(r.indexOf(e.component+"."+n)>-1){if(typeof e[n]=="string")this.relations[e[n]]&&(e[n]=this._cleanCopy(this.relations[e[n]]));else if(e[n].constructor===Array){let o=[];e[n].forEach(s=>{this.relations[s]&&o.push(this._cleanCopy(this.relations[s]))}),e[n]=o}}}iterateTree(e,n){let r=o=>{if(o!=null){if(o.constructor===Array)for(let s=0;s<o.length;s++)r(o[s]);else if(o.constructor===Object){if(o._stopResolving)return;for(let s in o)(o.component&&o._uid||o.type==="link")&&(this._insertRelations(o,s,n),this._insertLinks(o,s)),r(o[s])}}};r(e.content)}async resolveLinks(e,n){let r=[];if(e.link_uuids){const o=e.link_uuids.length;let s=[];const a=50;for(let i=0;i<o;i+=a){const c=Math.min(o,i+a);s.push(e.link_uuids.slice(i,c))}for(let i=0;i<s.length;i++)(await this.getStories({per_page:a,language:n.language,version:n.version,by_uuids:s[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(o=>{this.links[o.uuid]=E(p({},o),{_stopResolving:!0})})}async resolveRelations(e,n){let r=[];if(e.rel_uuids){const o=e.rel_uuids.length;let s=[];const a=50;for(let i=0;i<o;i+=a){const c=Math.min(o,i+a);s.push(e.rel_uuids.slice(i,c))}for(let i=0;i<s.length;i++)(await this.getStories({per_page:a,language:n.language,version:n.version,by_uuids:s[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.rels;r.forEach(o=>{this.relations[o.uuid]=E(p({},o),{_stopResolving:!0})})}async resolveStories(e,n){let r=[];n.resolve_relations!==void 0&&n.resolve_relations.length>0&&(r=n.resolve_relations.split(","),await this.resolveRelations(e,n)),["1","story","url"].indexOf(n.resolve_links)>-1&&await this.resolveLinks(e,n);for(const o in this.relations)this.iterateTree(this.relations[o],r);e.story?this.iterateTree(e.story,r):e.stories.forEach(o=>{this.iterateTree(o,r)})}cacheResponse(e,n,r){return r===void 0&&(r=0),new Promise(async(o,s)=>{let a=O({url:e,params:n}),i=this.cacheProvider();if(this.cache.clear==="auto"&&n.version==="draft"&&await this.flushCache(),n.version==="published"&&e!="/cdn/spaces/me"){const l=await i.get(a);if(l)return o(l)}try{let l=await this.throttle("get",e,{params:n,paramsSerializer:d=>O(d)}),u={data:l.data,headers:l.headers};if(l.headers["per-page"]&&(u=Object.assign({},u,{perPage:parseInt(l.headers["per-page"]),total:parseInt(l.headers.total)})),l.status!=200)return s(l);(u.data.story||u.data.stories)&&await this.resolveStories(u.data,n),n.version==="published"&&e!="/cdn/spaces/me"&&i.set(a,u),u.data.cv&&(n.version=="draft"&&g[n.token]!=u.data.cv&&this.flushCache(),g[n.token]=u.data.cv),o(u)}catch(l){if(l.response&&l.response.status===429&&(r+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${r} seconds.`),await(c=1e3*r,new Promise(u=>setTimeout(u,c))),this.cacheResponse(e,n,r).then(o).catch(s);s(l)}var c})}throttledRequest(e,n,r){return this.client[e](n,r)}cacheVersions(){return g}cacheVersion(){return g[this.accessToken]}setCacheVersion(e){this.accessToken&&(g[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get:e=>b[e],getAll:()=>b,set(e,n){b[e]=n},flush(){b={}}};default:return{get(){},getAll(){},set(){},flush(){}}}}async flushCache(){return await this.cacheProvider().flush(),this}}var ye=(t={})=>{const{apiOptions:e}=t;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new ge(e)}},me=t=>{if(typeof t!="object"||typeof t._editable=="undefined")return{};const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};const _e=(t,e,n={})=>{if(typeof window!="undefined"){if(typeof window.storyblokRegisterEvent=="undefined"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(n).on(["input","published","change"],o=>{o.action=="input"&&o.story.id===t?e(o.story):window.location.reload()})})}},ke=(t={})=>{const{bridge:e,accessToken:n,use:r=[],apiOptions:o={}}=t;o.accessToken=o.accessToken||n;const s={bridge:e,apiOptions:o};let a={};return r.forEach(i=>{a=p(p({},a),i(s))}),e!==!1&&ue("https://app.storyblok.com/f/storyblok-v2-latest.js"),a};function V(){}function S(t,e){for(const n in e)t[n]=e[n];return t}function J(t){return t()}function Y(){return Object.create(null)}function m(t){t.forEach(J)}function be(t){return typeof t=="function"}function ve(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function we(t){return Object.keys(t).length===0}function Te(t){const e={};for(const n in t)n[0]!=="$"&&(e[n]=t[n]);return e}function z(t,e){const n={};e=new Set(e);for(const r in t)!e.has(r)&&r[0]!=="$"&&(n[r]=t[r]);return n}function $e(t,e,n){t.insertBefore(e,n||null)}function F(t){t.parentNode.removeChild(t)}function Ee(t){return document.createTextNode(t)}function Oe(){return Ee("")}function Se(t){return Array.from(t.childNodes)}let R;function _(t){R=t}const k=[],H=[],v=[],G=[],Re=Promise.resolve();let P=!1;function Pe(){P||(P=!0,Re.then(K))}function j(t){v.push(t)}const x=new Set;let w=0;function K(){const t=R;do{for(;w<k.length;){const e=k[w];w++,_(e),je(e.$$)}for(_(null),k.length=0,w=0;H.length;)H.pop()();for(let e=0;e<v.length;e+=1){const n=v[e];x.has(n)||(x.add(n),n())}v.length=0}while(k.length);for(;G.length;)G.pop()();P=!1,x.clear(),_(t)}function je(t){if(t.fragment!==null){t.update(),m(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(j)}}const T=new Set;let h;function xe(){h={r:0,c:[],p:h}}function Ae(){h.r||m(h.c),h=h.p}function A(t,e){t&&t.i&&(T.delete(t),t.i(e))}function Q(t,e,n,r){if(t&&t.o){if(T.has(t))return;T.add(t),h.c.push(()=>{T.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function Ce(t,e){const n={},r={},o={$$scope:1};let s=t.length;for(;s--;){const a=t[s],i=e[s];if(i){for(const c in a)c in i||(r[c]=1);for(const c in i)o[c]||(n[c]=i[c],o[c]=1);t[s]=i}else for(const c in a)o[c]=1}for(const a in r)a in n||(n[a]=void 0);return n}function Ie(t){return typeof t=="object"&&t!==null?t:{}}function W(t){t&&t.c()}function C(t,e,n,r){const{fragment:o,on_mount:s,on_destroy:a,after_update:i}=t.$$;o&&o.m(e,n),r||j(()=>{const c=s.map(J).filter(be);a?a.push(...c):m(c),t.$$.on_mount=[]}),i.forEach(j)}function I(t,e){const n=t.$$;n.fragment!==null&&(m(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Me(t,e){t.$$.dirty[0]===-1&&(k.push(t),Pe(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Ne(t,e,n,r,o,s,a,i=[-1]){const c=R;_(t);const l=t.$$={fragment:null,ctx:null,props:s,update:V,not_equal:o,bound:Y(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Y(),dirty:i,skip_bound:!1,root:e.target||c.$$.root};a&&a(l.root);let u=!1;if(l.ctx=n?n(t,e.props||{},(d,$,...te)=>{const ne=te.length?te[0]:$;return l.ctx&&o(l.ctx[d],l.ctx[d]=ne)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](ne),u&&Me(t,d)),$}):[],l.update(),u=!0,m(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){const d=Se(e.target);l.fragment&&l.fragment.l(d),d.forEach(F)}else l.fragment&&l.fragment.c();e.intro&&A(t.$$.fragment),C(t,e.target,e.anchor,e.customElement),K()}_(c)}class Be{$destroy(){I(this,1),this.$destroy=V}$on(e,n){const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!we(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function qe(t){let e,n,r;const o=[{blok:t[0]},t[2]];var s=t[1];function a(i){let c={};for(let l=0;l<o.length;l+=1)c=S(c,o[l]);return{props:c}}return s&&(e=new s(a())),{c(){e&&W(e.$$.fragment),n=Oe()},m(i,c){e&&C(e,i,c),$e(i,n,c),r=!0},p(i,[c]){const l=c&5?Ce(o,[c&1&&{blok:i[0]},c&4&&Ie(i[2])]):{};if(s!==(s=i[1])){if(e){xe();const u=e;Q(u.$$.fragment,1,0,()=>{I(u,1)}),Ae()}s?(e=new s(a()),W(e.$$.fragment),A(e.$$.fragment,1),C(e,n.parentNode,n)):e=null}else s&&e.$set(l)},i(i){r||(e&&A(e.$$.fragment,i),r=!0)},o(i){e&&Q(e.$$.fragment,i),r=!1},d(i){i&&F(n),e&&I(e,i)}}}function Le(t,e,n){const r=["blok"];let o=z(e,r),{blok:s}=e,a;return s?a=ee(s.component):console.error("Please provide a 'blok' property to the StoryblokComponent"),t.$$set=i=>{e=S(S({},e),Te(i)),n(2,o=z(e,r)),"blok"in i&&n(0,s=i.blok)},[s,a,o]}class De extends Be{constructor(e){super();Ne(this,e,Le,qe,ve,{blok:0})}}const Ue=(t,e)=>{const n=r=>{const o=me(r);o["data-blok-c"]&&(t.setAttribute("data-blok-c",o["data-blok-c"]),t.setAttribute("data-blok-uid",o["data-blok-uid"]),t.classList.add("storyblok__outline"))};return n(e),{update(r){n(r)}}};let M=null;const X=()=>(M||console.log("You can't use getStoryblokApi if you're not loading apiPlugin."),M);let Z=null;const Ve=t=>{const{storyblokApi:e}=ke(t);M=e,Z=t.components||{}},ee=t=>{const e=Z[t];return e||console.error(`You didn't load the ${t} component. Please load it in storyblokInit. For example:
6
6
  storyblokInit({
7
7
  accessToken: "<your-token>",
8
8
  components: {
9
9
  "teaser": Teaser
10
10
  }
11
11
  })
12
- `),e};f.StoryblokComponent=Le,f.apiPlugin=ge,f.getComponent=Z,f.storyblokEditable=De,f.storyblokInit=Ve,f.useStoryblokApi=Ue,f.useStoryblokBridge=me,Object.defineProperty(f,"__esModule",{value:!0}),f[Symbol.toStringTag]="Module"});
12
+ `),e};f.StoryblokComponent=De,f.apiPlugin=ye,f.getComponent=ee,f.getStoryblokApi=X,f.storyblokEditable=Ue,f.storyblokInit=Ve,f.useStoryblokApi=X,f.useStoryblokBridge=_e,Object.defineProperty(f,"__esModule",{value:!0}),f[Symbol.toStringTag]="Module"});
@@ -854,7 +854,7 @@ const storyblokEditable = (node, value) => {
854
854
  let storyblokApiInstance = null;
855
855
  const useStoryblokApi = () => {
856
856
  if (!storyblokApiInstance) {
857
- console.log(`You can't use useStoryblokApi if you're not loading apiPlugin.`);
857
+ console.log(`You can't use getStoryblokApi if you're not loading apiPlugin.`);
858
858
  }
859
859
  return storyblokApiInstance;
860
860
  };
@@ -878,4 +878,4 @@ storyblokInit({
878
878
  }
879
879
  return component;
880
880
  };
881
- export { StoryblokComponent, api as apiPlugin, getComponent, storyblokEditable, storyblokInit, useStoryblokApi, useStoryblokBridge };
881
+ export { StoryblokComponent, api as apiPlugin, getComponent, useStoryblokApi as getStoryblokApi, storyblokEditable, storyblokInit, useStoryblokApi, useStoryblokBridge };
package/index.js CHANGED
@@ -28,12 +28,14 @@ let storyblokApiInstance = null;
28
28
  export const useStoryblokApi = () => {
29
29
  if (!storyblokApiInstance) {
30
30
  console.log(
31
- `You can't use useStoryblokApi if you're not loading apiPlugin.`
31
+ `You can't use getStoryblokApi if you're not loading apiPlugin.`
32
32
  );
33
33
  }
34
34
  return storyblokApiInstance;
35
35
  };
36
36
 
37
+ export { useStoryblokApi as getStoryblokApi };
38
+
37
39
  let componentsMap = null;
38
40
  export const storyblokInit = (options) => {
39
41
  const { storyblokApi } = sbInit(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/svelte",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Storyblok SDK to connect Storyblok with Svelte",
5
5
  "main": "./dist/storyblok-svelte.js",
6
6
  "module": "./dist/storyblok-svelte.mjs",
@@ -37,7 +37,7 @@
37
37
  "eslint-plugin-cypress": "^2.12.1",
38
38
  "eslint-plugin-jest": "^26.1.1",
39
39
  "jest": "^27.5.1",
40
- "vite": "^2.4.4"
40
+ "vite": "^2.8.6"
41
41
  },
42
42
  "eslintConfig": {
43
43
  "env": {