Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@marvr/storyblok-rich-text-vue-renderer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marvr/storyblok-rich-text-vue-renderer - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

101

dist/storyblok-rich-text-vue-renderer.d.ts

@@ -11,4 +11,5 @@ import { AllowedComponentProps } from 'vue';

import { LinkAttributes } from '@marvr/storyblok-rich-text-types';
import { NodeAttributes as NodeAttributes_2 } from '@marvr/storyblok-rich-text-types';
import { NodeTypes as NodeTypes_2 } from '@marvr/storyblok-rich-text-types';
import { Node as Node_2 } from '@marvr/storyblok-rich-text-types';
import { NodeAttributes } from '@marvr/storyblok-rich-text-types';
import { NodeTypes } from '@marvr/storyblok-rich-text-types';
import { OrderedListAttributes } from '@marvr/storyblok-rich-text-types';

@@ -32,3 +33,3 @@ import { Plugin as Plugin_2 } from 'vue';

declare type BlockResolverWithAttributes<A extends NodeAttributes_2> = Component | BlockResolverFunctionWithOptions<{
declare type BlockResolverWithAttributes<A extends NodeAttributes> = Component | BlockResolverFunctionWithOptions<{
attrs: A;

@@ -41,3 +42,3 @@ }>;

declare type BlockResolverWithChildrenAndAttributes<A extends NodeAttributes_2> = Component | BlockResolverFunctionWithOptions<{
declare type BlockResolverWithChildrenAndAttributes<A extends NodeAttributes> = Component | BlockResolverFunctionWithOptions<{
children: RenderedNode[];

@@ -64,2 +65,10 @@ attrs: A;

declare function createRenderer(resolvers: MergedResolvers): {
renderDocument: (node: Node_2) => VNode<RendererNode, RendererElement, {
[key: string]: any;
}> | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>[];
};
export declare function defineResolvers(resolvers: Partial<ResolversOption>): MergedResolvers;

@@ -73,3 +82,3 @@

declare type MarkResolverFunctionWithAttributes<A extends NodeAttributes_2> = (options: {
declare type MarkResolverFunctionWithAttributes<A extends NodeAttributes> = (options: {
text: TextNode['text'];

@@ -79,38 +88,6 @@ attrs: A;

declare type MarkResolverWithAttributes<A extends NodeAttributes_2> = Component | MarkResolverFunctionWithAttributes<A>;
declare type MarkResolverWithAttributes<A extends NodeAttributes> = Component | MarkResolverFunctionWithAttributes<A>;
export declare type MergedResolvers = Required<ResolversOption>;
declare interface Node_2 {
type: NodeTypes;
attrs?: NodeAttributes;
}
declare interface NodeAttributes {
}
declare enum NodeTypes {
DOCUMENT = "doc",
HEADING = "heading",
PARAGRAPH = "paragraph",
QUOTE = "blockquote",
OL_LIST = "ordered_list",
UL_LIST = "bullet_list",
LIST_ITEM = "list_item",
CODE_BLOCK = "code_block",
HR = "horizontal_rule",
BR = "hard_break",
IMAGE = "image",
BOLD = "bold",
STRONG = "strong",
STRIKE = "strike",
UNDERLINE = "underline",
ITALIC = "italic",
CODE = "code",
LINK = "link",
STYLED = "styled",
TEXT = "text",
COMPONENT = "blok"
}
export declare const plugin: (options?: PluginOptions | undefined) => Plugin_2;

@@ -125,22 +102,22 @@

declare type Resolvers = {
[NodeTypes_2.DOCUMENT]: BlockResolverWithChildren;
[NodeTypes_2.HEADING]: BlockResolverWithChildrenAndAttributes<HeadingAttributes>;
[NodeTypes_2.PARAGRAPH]: BlockResolverWithChildren;
[NodeTypes_2.QUOTE]: BlockResolverWithChildren;
[NodeTypes_2.OL_LIST]: BlockResolverWithChildrenAndAttributes<OrderedListAttributes>;
[NodeTypes_2.UL_LIST]: BlockResolverWithChildren;
[NodeTypes_2.LIST_ITEM]: BlockResolverWithChildren;
[NodeTypes_2.CODE_BLOCK]: BlockResolverWithChildrenAndAttributes<CodeBlockAttributes>;
[NodeTypes_2.HR]: BlockResolver;
[NodeTypes_2.BR]: BlockResolver;
[NodeTypes_2.IMAGE]: BlockResolverWithAttributes<ImageAttributes>;
[NodeTypes_2.BOLD]: MarkResolver;
[NodeTypes_2.STRONG]: MarkResolver;
[NodeTypes_2.STRIKE]: MarkResolver;
[NodeTypes_2.UNDERLINE]: MarkResolver;
[NodeTypes_2.ITALIC]: MarkResolver;
[NodeTypes_2.CODE]: MarkResolver;
[NodeTypes_2.LINK]: MarkResolverWithAttributes<LinkAttributes>;
[NodeTypes_2.STYLED]: MarkResolverWithAttributes<StyledAttributes>;
[NodeTypes_2.COMPONENT]: () => RenderedNode;
[NodeTypes.DOCUMENT]: BlockResolverWithChildren;
[NodeTypes.HEADING]: BlockResolverWithChildrenAndAttributes<HeadingAttributes>;
[NodeTypes.PARAGRAPH]: BlockResolverWithChildren;
[NodeTypes.QUOTE]: BlockResolverWithChildren;
[NodeTypes.OL_LIST]: BlockResolverWithChildrenAndAttributes<OrderedListAttributes>;
[NodeTypes.UL_LIST]: BlockResolverWithChildren;
[NodeTypes.LIST_ITEM]: BlockResolverWithChildren;
[NodeTypes.CODE_BLOCK]: BlockResolverWithChildrenAndAttributes<CodeBlockAttributes>;
[NodeTypes.HR]: BlockResolver;
[NodeTypes.BR]: BlockResolver;
[NodeTypes.IMAGE]: BlockResolverWithAttributes<ImageAttributes>;
[NodeTypes.BOLD]: MarkResolver;
[NodeTypes.STRONG]: MarkResolver;
[NodeTypes.STRIKE]: MarkResolver;
[NodeTypes.UNDERLINE]: MarkResolver;
[NodeTypes.ITALIC]: MarkResolver;
[NodeTypes.CODE]: MarkResolver;
[NodeTypes.LINK]: MarkResolverWithAttributes<LinkAttributes>;
[NodeTypes.STYLED]: MarkResolverWithAttributes<StyledAttributes>;
[NodeTypes.COMPONENT]: () => RenderedNode;
};

@@ -167,10 +144,4 @@

export declare function useRenderer(): {
renderDocument: (node: Node_2) => VNode<RendererNode, RendererElement, {
[key: string]: any;
}> | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>[];
};
export declare function useRenderer(): ReturnType<typeof createRenderer>;
export { }

@@ -1,1 +0,1 @@

var t=Object.defineProperty,e=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=(e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,l=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&c(t,n,e[n]);if(r)for(var n of r(e))s.call(e,n)&&c(t,n,e[n]);return t},i=(t,r)=>e(t,n(r)),a=(t,e)=>{var n={};for(var c in t)o.call(t,c)&&e.indexOf(c)<0&&(n[c]=t[c]);if(null!=t&&r)for(var c of r(t))e.indexOf(c)<0&&s.call(t,c)&&(n[c]=t[c]);return n};function u(t,e){const n=Object.create(null),r=t.split(",");for(let o=0;o<r.length;o++)n[r[o]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const f=u("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt");function p(t){if(I(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],o=p(x(r)?y(r):r);if(o)for(const t in o)e[t]=o[t]}return e}if(C(t))return t}const d=/;(?![^(]*\))/g,h=/:(.+)/;function y(t){const e={};return t.split(d).forEach((t=>{if(t){const n=t.split(h);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}function g(t){let e="";if(x(t))e=t;else if(I(t))for(let n=0;n<t.length;n++){const r=g(t[n]);r&&(e+=r+" ")}else if(C(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const _={},v=()=>{},m=/^on[^a-z]/,b=t=>m.test(t),O=Object.assign,E=Object.prototype.hasOwnProperty,S=(t,e)=>E.call(t,e),I=Array.isArray,T=t=>"function"==typeof t,x=t=>"string"==typeof t,C=t=>null!==t&&"object"==typeof t,R=Object.prototype.toString,L=t=>R.call(t),A=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},N=/-(\w)/g,w=A((t=>t.replace(N,((t,e)=>e?e.toUpperCase():"")))),k=A((t=>t.charAt(0).toUpperCase()+t.slice(1))),P=(t,e)=>t!==e&&(t==t||e==e),D=new WeakMap,M=[];let U;function j(t,e=_){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const n=function(t,e){const n=function(){if(!n.active)return t();if(!M.includes(n)){B(n);try{return G.push(F),F=!0,M.push(n),U=n,t()}finally{M.pop(),H(),U=M[M.length-1]}}};return n.id=$++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||n(),n}let $=0;function B(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let F=!0;const G=[];function H(){const t=G.pop();F=void 0===t||t}function K(t){return z(t)?K(t.__v_raw):!(!t||!t.__v_isReactive)}function z(t){return!(!t||!t.__v_isReadonly)}function Y(t){return K(t)||z(t)}function Q(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}function q(t){return Boolean(t&&!0===t.__v_isRef)}new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter((t=>"symbol"==typeof t)));const V={get:(t,e,n)=>{return q(r=Reflect.get(t,e,n))?r.value:r;var r},set:(t,e,n,r)=>{const o=t[e];return q(o)&&!q(n)?(o.value=n,!0):Reflect.set(t,e,n,r)}};function X(t,e,n,r){let o;try{o=r?t(...r):t()}catch(s){W(s,e,n)}return o}function J(t,e,n,r){if(T(t)){const s=X(t,e,n,r);return s&&(C(o=s)&&T(o.then)&&T(o.catch))&&s.catch((t=>{W(t,e,n)})),s}var o;const s=[];for(let c=0;c<t.length;c++)s.push(J(t[c],e,n,r));return s}function W(t,e,n,r=!0){e&&e.vnode;if(e){let r=e.parent;const o=e.proxy,s=n;for(;r;){const e=r.ec;if(e)for(let n=0;n<e.length;n++)if(!1===e[n](t,o,s))return;r=r.parent}const c=e.appContext.config.errorHandler;if(c)return void X(c,null,10,[t,o,s])}!function(t,e,n,r=!0){console.error(t)}(t,0,0,r)}let Z=!1,tt=!1;const et=[];let nt=0;const rt=[];let ot=null,st=0;const ct=[];let lt=null,it=0;const at=Promise.resolve();let ut=null,ft=null;function pt(t){const e=ut||at;return t?e.then(this?t.bind(this):t):e}function dt(t){if(!(et.length&&et.includes(t,Z&&t.allowRecurse?nt+1:nt)||t===ft)){const e=function(t){let e=nt+1,n=et.length;const r=_t(t);for(;e<n;){const t=e+n>>>1;_t(et[t])<r?e=t+1:n=t}return e}(t);e>-1?et.splice(e,0,t):et.push(t),ht()}}function ht(){Z||tt||(tt=!0,ut=at.then(vt))}function yt(t,e,n,r){I(t)?n.push(...t):e&&e.includes(t,t.allowRecurse?r+1:r)||n.push(t),ht()}function gt(t,e=null){if(rt.length){for(ft=e,ot=[...new Set(rt)],rt.length=0,st=0;st<ot.length;st++)ot[st]();ot=null,st=0,ft=null,gt(t,e)}}const _t=t=>null==t.id?1/0:t.id;function vt(t){tt=!1,Z=!0,gt(t),et.sort(((t,e)=>_t(t)-_t(e)));try{for(nt=0;nt<et.length;nt++){const t=et[nt];t&&!1!==t.active&&X(t,null,14)}}finally{nt=0,et.length=0,function(t){if(ct.length){const t=[...new Set(ct)];if(ct.length=0,lt)return void lt.push(...t);for(lt=t,lt.sort(((t,e)=>_t(t)-_t(e))),it=0;it<lt.length;it++)lt[it]();lt=null,it=0}}(),Z=!1,ut=null,(et.length||rt.length||ct.length)&&vt(t)}}const mt={};function bt(t,e,{immediate:n,deep:r,flush:o,onTrack:s,onTrigger:c}=_,l=Yt){let i,a,u=!1,f=!1;if(q(t)?(i=()=>t.value,u=!!t._shallow):K(t)?(i=()=>t,r=!0):I(t)?(f=!0,u=t.some(K),i=()=>t.map((t=>q(t)?t.value:K(t)?Et(t):T(t)?X(t,l,2):void 0))):i=T(t)?e?()=>X(t,l,2):()=>{if(!l||!l.isUnmounted)return a&&a(),J(t,l,3,[p])}:v,e&&r){const t=i;i=()=>Et(t())}let p=t=>{a=g.options.onStop=()=>{X(t,l,4)}},d=f?[]:mt;const h=()=>{if(g.active)if(e){const t=g();(r||u||(f?t.some(((t,e)=>P(t,d[e]))):P(t,d)))&&(a&&a(),J(e,l,3,[t,d===mt?void 0:d,p]),d=t)}else g()};let y;h.allowRecurse=!!e,y="sync"===o?h:"post"===o?()=>Lt(h,l&&l.suspense):()=>{!l||l.isMounted?function(t){yt(t,ot,rt,st)}(h):h()};const g=j(i,{lazy:!0,onTrack:s,onTrigger:c,scheduler:y});return function(t,e=Yt){e&&(e.effects||(e.effects=[])).push(t)}(g,l),e?n?h():d=g():"post"===o?Lt(g,l&&l.suspense):g(),()=>{var t;(t=g).active&&(B(t),t.options.onStop&&t.options.onStop(),t.active=!1),l&&((t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)})(l.effects,g)}}function Ot(t,e,n){const r=this.proxy,o=x(t)?t.includes(".")?function(t,e){const n=e.split(".");return()=>{let e=t;for(let t=0;t<n.length&&e;t++)e=e[n[t]];return e}}(r,t):()=>r[t]:t.bind(r,r);let s;return T(e)?s=e:(s=e.handler,n=e),bt(o,s.bind(r),n,this)}function Et(t,e=new Set){if(!C(t)||t.__v_skip)return t;if((e=e||new Set).has(t))return t;if(e.add(t),q(t))Et(t.value,e);else if(I(t))for(let n=0;n<t.length;n++)Et(t[n],e);else if("[object Set]"===L(t)||(t=>"[object Map]"===L(t))(t))t.forEach((t=>{Et(t,e)}));else if((t=>"[object Object]"===L(t))(t))for(const n in t)Et(t[n],e);return t}function St(t,e,n,r=!1){const{mixins:o,extends:s}=e;s&&St(t,s,n,!0),o&&o.forEach((e=>St(t,e,n,!0)));for(const c in e)if(r&&"expose"===c);else{const r=It[c]||n&&n[c];t[c]=r?r(t[c],e[c]):e[c]}return t}const It={data:Tt,props:Rt,emits:Rt,methods:Rt,computed:Rt,beforeCreate:Ct,created:Ct,beforeMount:Ct,mounted:Ct,beforeUpdate:Ct,updated:Ct,beforeDestroy:Ct,destroyed:Ct,activated:Ct,deactivated:Ct,errorCaptured:Ct,serverPrefetch:Ct,components:Rt,directives:Rt,watch:function(t,e){if(!t)return e;if(!e)return t;const n=O(Object.create(null),t);for(const r in e)n[r]=Ct(t[r],e[r]);return n},provide:Tt,inject:function(t,e){return Rt(xt(t),xt(e))}};function Tt(t,e){return e?t?function(){return O(T(t)?t.call(this,this):t,T(e)?e.call(this,this):e)}:e:t}function xt(t){if(I(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Ct(t,e){return t?[...new Set([].concat(t,e))]:e}function Rt(t,e){return t?O(O(Object.create(null),t),e):e}const Lt=function(t,e){e&&e.pendingBranch?I(t)?e.effects.push(...t):e.effects.push(t):yt(t,lt,ct,it)},At=Symbol();function Nt(t){return x(t)?function(t,e,n=!0,r=!1){const o=Yt;if(o){const n=o.type;if("components"===t){const t=Qt(n);if(t&&(t===e||t===w(e)||t===k(w(e))))return n}const s=wt(o[t]||n[t],e)||wt(o.appContext[t],e);return!s&&r?n:s}}("components",t,!1)||t:t||At}function wt(t,e){return t&&(t[e]||t[w(e)]||t[k(w(e))])}const kt=Symbol(void 0),Pt=Symbol(void 0),Dt=Symbol(void 0);function Mt(t){return!!t&&!0===t.__v_isVNode}const Ut=({key:t})=>null!=t?t:null,jt=({ref:t})=>null!=t?x(t)||q(t)||T(t)?{i:null,r:t}:t:null,$t=function(t,e=null,n=null,r=0,o=null,s=!1){t&&t!==At||(t=Dt);if(Mt(t)){const r=Bt(t,e,!0);return n&&Gt(r,n),r}c=t,T(c)&&"__vccOpts"in c&&(t=t.__vccOpts);var c;if(e){(Y(e)||"__vInternal"in e)&&(e=O({},e));let{class:t,style:n}=e;t&&!x(t)&&(e.class=g(t)),C(n)&&(Y(n)&&!I(n)&&(n=O({},n)),e.style=p(n))}const l=x(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:C(t)?4:T(t)?2:0,i={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Ut(e),ref:e&&jt(e),scopeId:null,slotScopeIds:null,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,shapeFlag:l,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null};Gt(i,n),128&l&&t.normalize(i);0;return i};function Bt(t,e,n=!1){const{props:r,ref:o,patchFlag:s,children:c}=t,l=e?function(...t){const e=O({},t[0]);for(let n=1;n<t.length;n++){const r=t[n];for(const t in r)if("class"===t)e.class!==r.class&&(e.class=g([e.class,r.class]));else if("style"===t)e.style=p([e.style,r.style]);else if(b(t)){const n=e[t],o=r[t];n!==o&&(e[t]=n?[].concat(n,o):o)}else""!==t&&(e[t]=r[t])}return e}(r||{},e):r;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Ut(l),ref:e&&e.ref?n&&o?I(o)?o.concat(jt(e)):[o,jt(e)]:jt(e):o,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:c,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==kt?-1===s?16:16|s:s,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Bt(t.ssContent),ssFallback:t.ssFallback&&Bt(t.ssFallback),el:t.el,anchor:t.anchor}}function Ft(t=" ",e=0){return $t(Pt,null,t,e)}function Gt(t,e){let n=0;const{shapeFlag:r}=t;if(null==e)e=null;else if(I(e))n=16;else if("object"==typeof e){if(1&r||64&r){const n=e.default;return void(n&&(n._c&&(n._d=!1),Gt(t,n()),n._c&&(n._d=!0)))}{n=32;const t=e._;t||"__vInternal"in e||(e._ctx=null)}}else T(e)?(e={default:e,_ctx:null},n=32):(e=String(e),64&r?(n=16,e=[Ft(e)]):n=8);t.children=e,t.shapeFlag|=n}const Ht=t=>t?4&t.vnode.shapeFlag?function(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(K(e=Q(t.exposed))?e:new Proxy(e,V),{get:(e,n)=>n in e?e[n]:n in Kt?Kt[n](t):void 0}));var e}(t)||t.proxy:Ht(t.parent):null,Kt=O(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Ht(t.parent),$root:t=>Ht(t.root),$emit:t=>t.emit,$options:t=>function(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:o,optionsCache:s,config:{optionMergeStrategies:c}}=t.appContext,l=s.get(e);let i;return l?i=l:o.length||n||r?(i={},o.length&&o.forEach((t=>St(i,t,c,!0))),St(i,e,c)):i=e,s.set(e,i),i}(t),$forceUpdate:t=>()=>dt(t.update),$nextTick:t=>pt.bind(t.proxy),$watch:t=>Ot.bind(t)}),zt={get({_:t},e){const{ctx:n,setupState:r,data:o,props:s,accessCache:c,type:l,appContext:i}=t;let a;if("$"!==e[0]){const l=c[e];if(void 0!==l)switch(l){case 0:return r[e];case 1:return o[e];case 3:return n[e];case 2:return s[e]}else{if(r!==_&&S(r,e))return c[e]=0,r[e];if(o!==_&&S(o,e))return c[e]=1,o[e];if((a=t.propsOptions[0])&&S(a,e))return c[e]=2,s[e];if(n!==_&&S(n,e))return c[e]=3,n[e];c[e]=4}}const u=Kt[e];let f,p;return u?("$attrs"===e&&function(t,e,n){if(!F||void 0===U)return;let r=D.get(t);r||D.set(t,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(U)||(o.add(U),U.deps.push(o))}(t,0,e),u(t)):(f=l.__cssModules)&&(f=f[e])?f:n!==_&&S(n,e)?(c[e]=3,n[e]):(p=i.config.globalProperties,S(p,e)?p[e]:void 0)},set({_:t},e,n){const{data:r,setupState:o,ctx:s}=t;if(o!==_&&S(o,e))o[e]=n;else if(r!==_&&S(r,e))r[e]=n;else if(S(t.props,e))return!1;return("$"!==e[0]||!(e.slice(1)in t))&&(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:o,propsOptions:s}},c){let l;return void 0!==n[c]||t!==_&&S(t,c)||e!==_&&S(e,c)||(l=s[0])&&S(l,c)||S(r,c)||S(Kt,c)||S(o.config.globalProperties,c)}};O({},zt,{get(t,e){if(e!==Symbol.unscopables)return zt.get(t,e,t)},has:(t,e)=>"_"!==e[0]&&!f(e)});let Yt=null;function Qt(t){return T(t)&&t.displayName||t.name}function qt(t,e,n){const r=arguments.length;return 2===r?C(e)&&!I(e)?Mt(e)?$t(t,null,[e]):$t(t,e):$t(t,null,e):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&Mt(n)&&(n=[n]),$t(t,e,n))}var Vt,Xt;(Xt=Vt||(Vt={})).DOCUMENT="doc",Xt.HEADING="heading",Xt.PARAGRAPH="paragraph",Xt.QUOTE="blockquote",Xt.OL_LIST="ordered_list",Xt.UL_LIST="bullet_list",Xt.LIST_ITEM="list_item",Xt.CODE_BLOCK="code_block",Xt.HR="horizontal_rule",Xt.BR="hard_break",Xt.IMAGE="image",Xt.BOLD="bold",Xt.STRONG="strong",Xt.STRIKE="strike",Xt.UNDERLINE="underline",Xt.ITALIC="italic",Xt.CODE="code",Xt.LINK="link",Xt.STYLED="styled",Xt.TEXT="text",Xt.COMPONENT="blok";const Jt=[Vt.DOCUMENT,Vt.HEADING,Vt.PARAGRAPH,Vt.QUOTE,Vt.OL_LIST,Vt.UL_LIST,Vt.LIST_ITEM,Vt.CODE_BLOCK,Vt.HR,Vt.BR,Vt.IMAGE];var Wt,Zt,te,ee;function ne(t){const e=t=>function(t){return t.type===Vt.TEXT}(t)?t.marks?t.marks.map((e=>o(e,t.text))):c(t):function(t){return Jt.includes(t.type)}(t)?r(t):function(t){return t.type===Vt.COMPONENT}(t)?s(t):qt("div","fallback node"),n=t=>{const n=[];return t.forEach((t=>{const r=e(t);Array.isArray(r)?r.forEach((t=>{n.push(t)})):n.push(r)})),n},r=e=>{switch(e.type){case Vt.DOCUMENT:case Vt.PARAGRAPH:case Vt.QUOTE:case Vt.UL_LIST:case Vt.LIST_ITEM:return function(e){const n=t[e.type],r=l(e);if(re(n))return qt(n,null,{default:()=>r});return n({children:r})}(e);case Vt.HEADING:case Vt.OL_LIST:case Vt.CODE_BLOCK:return function(e){const n=t[e.type],r=l(e);if(re(n))return qt(n,e.attrs,{default:()=>r});return n({children:r,attrs:e.attrs})}(e);case Vt.HR:case Vt.BR:return function(e){const n=t[e.type];if(re(n))return qt(n);return n()}(e);case Vt.IMAGE:return function(e){const n=t[e.type];if(re(n))return qt(n,e.attrs);return n({attrs:e.attrs})}(e);default:return qt("div","fallback block")}},o=(e,n)=>{switch(e.type){case Vt.BOLD:case Vt.STRONG:case Vt.STRIKE:case Vt.UNDERLINE:case Vt.ITALIC:case Vt.CODE:return function(e,n){const r=t[e.type];if(re(r))return qt(r,{default:()=>n});return r({text:n})}(e,n);case Vt.LINK:case Vt.STYLED:return function(e,n){const r=t[e.type];if(re(r))return qt(r,e.attrs,{default:()=>n});return r({text:n,attrs:e.attrs})}(e,n);default:return qt("span","fallback mark")}},s=e=>{const n=[];return e.attrs.body.forEach((r=>{const o=r,{component:s,_uid:c}=o,l=a(o,["component","_uid"]),i=t.components[s];i?n.push(i({id:e.attrs.id,component:s,_uid:c,fields:l})):n.push(t[Vt.COMPONENT]())})),n},c=t=>Ft(t.text),l=t=>t.content&&t.content.length?n(t.content):[];return{renderDocument:t=>Array.isArray(t)?n(t):e(t)}}function re(t){return"function"!=typeof t&&!Mt(t)}(Zt=Wt||(Wt={})).SELF="_self",Zt.BLANK="_blank",(ee=te||(te={})).URL="url",ee.STORY="story",ee.ASSET="asset",ee.EMAIL="email";var oe,se=T(oe={name:"RichTextRenderer",props:{document:{type:Object,required:!0}},setup(t){const e=ae();return()=>e.renderDocument(t.document)}})?{setup:oe,name:oe.name}:oe;const ce={[Vt.DOCUMENT]:({children:t})=>t,[Vt.HEADING]:({children:t,attrs:e})=>qt(`h${e.level}`,t),[Vt.PARAGRAPH]:({children:t})=>qt("p",t),[Vt.QUOTE]:({children:t})=>qt("blockquote",t),[Vt.OL_LIST]:({children:t,attrs:e})=>qt("ol",t),[Vt.UL_LIST]:({children:t})=>qt("ul",t),[Vt.LIST_ITEM]:({children:t})=>qt("li",t),[Vt.CODE_BLOCK]:({children:t,attrs:e})=>qt("pre",e,t),[Vt.HR]:()=>qt("hr"),[Vt.BR]:()=>qt("br"),[Vt.IMAGE]:({attrs:t})=>qt("img",t),[Vt.BOLD]:({text:t})=>qt("b",t),[Vt.STRONG]:({text:t})=>qt("strong",t),[Vt.STRIKE]:({text:t})=>qt("s",t),[Vt.UNDERLINE]:({text:t})=>qt("u",t),[Vt.ITALIC]:({text:t})=>qt("i",t),[Vt.CODE]:({text:t})=>qt("code",t),[Vt.LINK]:({text:t,attrs:e})=>{let n="";switch(e.linktype){case te.ASSET:case te.URL:n=e.href;break;case te.EMAIL:n=`mailto:${e.href}`;break;case te.STORY:const r=function(){const t=Nt("RouterLink");return"string"!=typeof t&&t}();return r?qt(r,{to:e.href,target:e.target},{default:()=>t}):qt("a",{href:n,target:e.target},t)}return qt("a",{href:e.href,target:e.target},t)},[Vt.STYLED]:({text:t,attrs:e})=>qt("span",e,t),[Vt.COMPONENT]:()=>qt("div","component")};const le=Symbol("Rich Text Renderer"),ie=t=>({install(e){const n=ne((null==t?void 0:t.resolvers)||i(l({},ce),{components:{}}));e.provide(le,n)}});function ae(){const t=function(t,e,n=!1){const r=Yt||null;if(r){const o=null==r.parent?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides;if(o&&t in o)return o[t];if(arguments.length>1)return n&&T(e)?e.call(r.proxy):e}}(le);if(!t)throw new Error("Rich Text Renderer not provided.");return t}function ue(t){const e=t,{components:n={}}=e,r=a(e,["components"]);return l(i(l({},ce),{components:n}),r)}export{se as RichTextRenderer,ue as defineResolvers,ie as plugin,ae as useRenderer};
var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=(e,r,n)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,s=(t,e)=>{for(var r in e||(e={}))c.call(e,r)&&a(t,r,e[r]);if(n)for(var r of n(e))o.call(e,r)&&a(t,r,e[r]);return t},u=(t,n)=>e(t,r(n)),i=(t,e)=>{var r={};for(var a in t)c.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(null!=t&&n)for(var a of n(t))e.indexOf(a)<0&&o.call(t,a)&&(r[a]=t[a]);return r};import{h as l,createTextVNode as f,isVNode as p,defineComponent as d,resolveDynamicComponent as h,inject as O}from"vue";import{isTextNode as E,isBlockNode as m,isComponentNode as y,NodeTypes as T,LinkTypes as L}from"@marvr/storyblok-rich-text-types";function b(t){const e=t=>E(t)?t.marks?t.marks.map((e=>c(e,t.text))):a(t):m(t)?n(t):y(t)?o(t):l("div","fallback node"),r=t=>{const r=[];return t.forEach((t=>{const n=e(t);Array.isArray(n)?n.forEach((t=>{r.push(t)})):r.push(n)})),r},n=e=>{switch(e.type){case T.DOCUMENT:case T.PARAGRAPH:case T.QUOTE:case T.UL_LIST:case T.LIST_ITEM:return function(e){const r=t[e.type],n=s(e);if(I(r))return l(r,null,{default:()=>n});return r({children:n})}(e);case T.HEADING:case T.OL_LIST:case T.CODE_BLOCK:return function(e){const r=t[e.type],n=s(e);if(I(r))return l(r,e.attrs,{default:()=>n});return r({children:n,attrs:e.attrs})}(e);case T.HR:case T.BR:return function(e){const r=t[e.type];if(I(r))return l(r);return r()}(e);case T.IMAGE:return function(e){const r=t[e.type];if(I(r))return l(r,e.attrs);return r({attrs:e.attrs})}(e);default:return l("div","fallback block")}},c=(e,r)=>{switch(e.type){case T.BOLD:case T.STRONG:case T.STRIKE:case T.UNDERLINE:case T.ITALIC:case T.CODE:return function(e,r){const n=t[e.type];if(I(n))return l(n,{default:()=>r});return n({text:r})}(e,r);case T.LINK:case T.STYLED:return function(e,r){const n=t[e.type];if(I(n))return l(n,e.attrs,{default:()=>r});return n({text:r,attrs:e.attrs})}(e,r);default:return l("span","fallback mark")}},o=e=>{const r=[];return e.attrs.body.forEach((n=>{const c=n,{component:o,_uid:a}=c,s=i(c,["component","_uid"]),u=t.components[o];u?r.push(u({id:e.attrs.id,component:o,_uid:a,fields:s})):r.push(t[T.COMPONENT]())})),r},a=t=>f(t.text),s=t=>t.content&&t.content.length?r(t.content):[];return{renderDocument:t=>Array.isArray(t)?r(t):e(t)}}function I(t){return"function"!=typeof t&&!p(t)}var R=d({name:"RichTextRenderer",props:{document:{type:Object,required:!0}},setup(t){const e=D();return()=>e.renderDocument(t.document)}});const x={[T.DOCUMENT]:({children:t})=>t,[T.HEADING]:({children:t,attrs:e})=>l(`h${e.level}`,t),[T.PARAGRAPH]:({children:t})=>l("p",t),[T.QUOTE]:({children:t})=>l("blockquote",t),[T.OL_LIST]:({children:t,attrs:e})=>l("ol",t),[T.UL_LIST]:({children:t})=>l("ul",t),[T.LIST_ITEM]:({children:t})=>l("li",t),[T.CODE_BLOCK]:({children:t,attrs:e})=>l("pre",e,t),[T.HR]:()=>l("hr"),[T.BR]:()=>l("br"),[T.IMAGE]:({attrs:t})=>l("img",t),[T.BOLD]:({text:t})=>l("b",t),[T.STRONG]:({text:t})=>l("strong",t),[T.STRIKE]:({text:t})=>l("s",t),[T.UNDERLINE]:({text:t})=>l("u",t),[T.ITALIC]:({text:t})=>l("i",t),[T.CODE]:({text:t})=>l("code",t),[T.LINK]:({text:t,attrs:e})=>{let r="";switch(e.linktype){case L.ASSET:case L.URL:r=e.href;break;case L.EMAIL:r=`mailto:${e.href}`;break;case L.STORY:const n=function(){const t=h("RouterLink");return"string"!=typeof t&&t}();return n?l(n,{to:e.href,target:e.target},{default:()=>t}):l("a",{href:r,target:e.target},t)}return l("a",{href:e.href,target:e.target},t)},[T.STYLED]:({text:t,attrs:e})=>l("span",e,t),[T.COMPONENT]:()=>l("div","component")};const v=Symbol("Rich Text Renderer"),A=t=>({install(e){const r=b((null==t?void 0:t.resolvers)||u(s({},x),{components:{}}));e.provide(v,r)}});function D(){const t=O(v);if(!t)throw new Error("Rich Text Renderer not provided.");return t}function S(t){const e=t,{components:r={}}=e,n=i(e,["components"]);return s(u(s({},x),{components:r}),n)}export{R as RichTextRenderer,S as defineResolvers,A as plugin,D as useRenderer};

@@ -1,1 +0,1 @@

var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__objRest=(e,t)=>{var n={};for(var r in e)__hasOwnProp.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))t.indexOf(r)<0&&__propIsEnum.call(e,r)&&(n[r]=e[r]);return n};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).StoryblokRichTextVueRenderer={})}(this,(function(e){"use strict";function t(e,t){const n=Object.create(null),r=e.split(",");for(let o=0;o<r.length;o++)n[r[o]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const n=t("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt");function r(e){if(_(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],s=r(g(o)?c(o):o);if(s)for(const e in s)t[e]=s[e]}return t}if(m(e))return e}const o=/;(?![^(]*\))/g,s=/:(.+)/;function c(e){const t={};return e.split(o).forEach((e=>{if(e){const n=e.split(s);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function l(e){let t="";if(g(e))t=e;else if(_(e))for(let n=0;n<e.length;n++){const r=l(e[n]);r&&(t+=r+" ")}else if(m(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const i={},a=()=>{},u=/^on[^a-z]/,p=e=>u.test(e),f=Object.assign,d=Object.prototype.hasOwnProperty,h=(e,t)=>d.call(e,t),_=Array.isArray,y=e=>"function"==typeof e,g=e=>"string"==typeof e,m=e=>null!==e&&"object"==typeof e,b=Object.prototype.toString,O=e=>b.call(e),v=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},S=/-(\w)/g,E=v((e=>e.replace(S,((e,t)=>t?t.toUpperCase():"")))),T=v((e=>e.charAt(0).toUpperCase()+e.slice(1))),x=(e,t)=>e!==t&&(e==e||t==t),I=new WeakMap,R=[];let P;function C(e,t=i){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const n=function(e,t){const n=function(){if(!n.active)return e();if(!R.includes(n)){w(n);try{return A.push(N),N=!0,R.push(n),P=n,e()}finally{R.pop(),k(),P=R[R.length-1]}}};return n.id=L++,n.allowRecurse=!!t.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||n(),n}let L=0;function w(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let N=!0;const A=[];function k(){const e=A.pop();N=void 0===e||e}function D(e){return j(e)?D(e.__v_raw):!(!e||!e.__v_isReactive)}function j(e){return!(!e||!e.__v_isReadonly)}function M(e){return D(e)||j(e)}function U(e){return((e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})})(e,"__v_skip",!0),e}function $(e){return Boolean(e&&!0===e.__v_isRef)}new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter((e=>"symbol"==typeof e)));const B={get:(e,t,n)=>{return $(r=Reflect.get(e,t,n))?r.value:r;var r},set:(e,t,n,r)=>{const o=e[t];return $(o)&&!$(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function F(e,t,n,r){let o;try{o=r?e(...r):e()}catch(s){H(s,t,n)}return o}function G(e,t,n,r){if(y(e)){const s=F(e,t,n,r);return s&&(m(o=s)&&y(o.then)&&y(o.catch))&&s.catch((e=>{H(e,t,n)})),s}var o;const s=[];for(let c=0;c<e.length;c++)s.push(G(e[c],t,n,r));return s}function H(e,t,n,r=!0){t&&t.vnode;if(t){let r=t.parent;const o=t.proxy,s=n;for(;r;){const t=r.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,o,s))return;r=r.parent}const c=t.appContext.config.errorHandler;if(c)return void F(c,null,10,[e,o,s])}!function(e,t,n,r=!0){console.error(e)}(e,0,0,r)}let K=!1,V=!1;const z=[];let Y=0;const Q=[];let q=null,X=0;const J=[];let W=null,Z=0;const ee=Promise.resolve();let te=null,ne=null;function re(e){const t=te||ee;return e?t.then(this?e.bind(this):e):t}function oe(e){if(!(z.length&&z.includes(e,K&&e.allowRecurse?Y+1:Y)||e===ne)){const t=function(e){let t=Y+1,n=z.length;const r=ie(e);for(;t<n;){const e=t+n>>>1;ie(z[e])<r?t=e+1:n=e}return t}(e);t>-1?z.splice(t,0,e):z.push(e),se()}}function se(){K||V||(V=!0,te=ee.then(ae))}function ce(e,t,n,r){_(e)?n.push(...e):t&&t.includes(e,e.allowRecurse?r+1:r)||n.push(e),se()}function le(e,t=null){if(Q.length){for(ne=t,q=[...new Set(Q)],Q.length=0,X=0;X<q.length;X++)q[X]();q=null,X=0,ne=null,le(e,t)}}const ie=e=>null==e.id?1/0:e.id;function ae(e){V=!1,K=!0,le(e),z.sort(((e,t)=>ie(e)-ie(t)));try{for(Y=0;Y<z.length;Y++){const e=z[Y];e&&!1!==e.active&&F(e,null,14)}}finally{Y=0,z.length=0,function(e){if(J.length){const e=[...new Set(J)];if(J.length=0,W)return void W.push(...e);for(W=e,W.sort(((e,t)=>ie(e)-ie(t))),Z=0;Z<W.length;Z++)W[Z]();W=null,Z=0}}(),K=!1,te=null,(z.length||Q.length||J.length)&&ae(e)}}let ue=null;const pe={};function fe(e,t,{immediate:n,deep:r,flush:o,onTrack:s,onTrigger:c}=i,l=Be){let u,p,f=!1,d=!1;if($(e)?(u=()=>e.value,f=!!e._shallow):D(e)?(u=()=>e,r=!0):_(e)?(d=!0,f=e.some(D),u=()=>e.map((e=>$(e)?e.value:D(e)?he(e):y(e)?F(e,l,2):void 0))):u=y(e)?t?()=>F(e,l,2):()=>{if(!l||!l.isUnmounted)return p&&p(),G(e,l,3,[h])}:a,t&&r){const e=u;u=()=>he(e())}let h=e=>{p=O.options.onStop=()=>{F(e,l,4)}},g=d?[]:pe;const m=()=>{if(O.active)if(t){const e=O();(r||f||(d?e.some(((e,t)=>x(e,g[t]))):x(e,g)))&&(p&&p(),G(t,l,3,[e,g===pe?void 0:g,h]),g=e)}else O()};let b;m.allowRecurse=!!t,b="sync"===o?m:"post"===o?()=>ve(m,l&&l.suspense):()=>{!l||l.isMounted?function(e){ce(e,q,Q,X)}(m):m()};const O=C(u,{lazy:!0,onTrack:s,onTrigger:c,scheduler:b});return function(e,t=Be){t&&(t.effects||(t.effects=[])).push(e)}(O,l),t?n?m():g=O():"post"===o?ve(O,l&&l.suspense):O(),()=>{var e;(e=O).active&&(w(e),e.options.onStop&&e.options.onStop(),e.active=!1),l&&((e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)})(l.effects,O)}}function de(e,t,n){const r=this.proxy,o=g(e)?e.includes(".")?function(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}(r,e):()=>r[e]:e.bind(r,r);let s;return y(t)?s=t:(s=t.handler,n=t),fe(o,s.bind(r),n,this)}function he(e,t=new Set){if(!m(e)||e.__v_skip)return e;if((t=t||new Set).has(e))return e;if(t.add(e),$(e))he(e.value,t);else if(_(e))for(let n=0;n<e.length;n++)he(e[n],t);else if("[object Set]"===O(e)||(e=>"[object Map]"===O(e))(e))e.forEach((e=>{he(e,t)}));else if((e=>"[object Object]"===O(e))(e))for(const n in e)he(e[n],t);return e}function _e(e,t,n,r=!1){const{mixins:o,extends:s}=t;s&&_e(e,s,n,!0),o&&o.forEach((t=>_e(e,t,n,!0)));for(const c in t)if(r&&"expose"===c);else{const r=ye[c]||n&&n[c];e[c]=r?r(e[c],t[c]):t[c]}return e}const ye={data:ge,props:Oe,emits:Oe,methods:Oe,computed:Oe,beforeCreate:be,created:be,beforeMount:be,mounted:be,beforeUpdate:be,updated:be,beforeDestroy:be,destroyed:be,activated:be,deactivated:be,errorCaptured:be,serverPrefetch:be,components:Oe,directives:Oe,watch:function(e,t){if(!e)return t;if(!t)return e;const n=f(Object.create(null),e);for(const r in t)n[r]=be(e[r],t[r]);return n},provide:ge,inject:function(e,t){return Oe(me(e),me(t))}};function ge(e,t){return t?e?function(){return f(y(e)?e.call(this,this):e,y(t)?t.call(this,this):t)}:t:e}function me(e){if(_(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function be(e,t){return e?[...new Set([].concat(e,t))]:t}function Oe(e,t){return e?f(f(Object.create(null),e),t):t}const ve=function(e,t){t&&t.pendingBranch?_(e)?t.effects.push(...e):t.effects.push(e):ce(e,W,J,Z)},Se="components",Ee=Symbol();function Te(e){return g(e)?function(e,t,n=!0,r=!1){const o=Be;if(o){const n=o.type;if(e===Se){const e=Fe(n);if(e&&(e===t||e===E(t)||e===T(E(t))))return n}const s=xe(o[e]||n[e],t)||xe(o.appContext[e],t);return!s&&r?n:s}}(Se,e,!1)||e:e||Ee}function xe(e,t){return e&&(e[t]||e[E(t)]||e[T(E(t))])}const Ie=Symbol(void 0),Re=Symbol(void 0),Pe=Symbol(void 0);function Ce(e){return!!e&&!0===e.__v_isVNode}const Le="__vInternal",we=({key:e})=>null!=e?e:null,Ne=({ref:e})=>null!=e?g(e)||$(e)||y(e)?{i:ue,r:e}:e:null,Ae=function(e,t=null,n=null,o=0,s=null,c=!1){e&&e!==Ee||(e=Pe);if(Ce(e)){const r=ke(e,t,!0);return n&&je(r,n),r}i=e,y(i)&&"__vccOpts"in i&&(e=e.__vccOpts);var i;if(t){(M(t)||Le in t)&&(t=f({},t));let{class:e,style:n}=t;e&&!g(e)&&(t.class=l(e)),m(n)&&(M(n)&&!_(n)&&(n=f({},n)),t.style=r(n))}const a=g(e)?1:(e=>e.__isSuspense)(e)?128:(e=>e.__isTeleport)(e)?64:m(e)?4:y(e)?2:0,u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&we(t),ref:t&&Ne(t),scopeId:null,slotScopeIds:null,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,shapeFlag:a,patchFlag:o,dynamicProps:s,dynamicChildren:null,appContext:null};je(u,n),128&a&&e.normalize(u);0;return u};function ke(e,t,n=!1){const{props:o,ref:s,patchFlag:c,children:i}=e,a=t?function(...e){const t=f({},e[0]);for(let n=1;n<e.length;n++){const o=e[n];for(const e in o)if("class"===e)t.class!==o.class&&(t.class=l([t.class,o.class]));else if("style"===e)t.style=r([t.style,o.style]);else if(p(e)){const n=t[e],r=o[e];n!==r&&(t[e]=n?[].concat(n,r):r)}else""!==e&&(t[e]=o[e])}return t}(o||{},t):o;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&we(a),ref:t&&t.ref?n&&s?_(s)?s.concat(Ne(t)):[s,Ne(t)]:Ne(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ie?-1===c?16:16|c:c,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ke(e.ssContent),ssFallback:e.ssFallback&&ke(e.ssFallback),el:e.el,anchor:e.anchor}}function De(e=" ",t=0){return Ae(Re,null,e,t)}function je(e,t){let n=0;const{shapeFlag:r}=e;if(null==t)t=null;else if(_(t))n=16;else if("object"==typeof t){if(1&r||64&r){const n=t.default;return void(n&&(n._c&&(n._d=!1),je(e,n()),n._c&&(n._d=!0)))}{n=32;const e=t._;e||Le in t||(t._ctx=ue)}}else y(t)?(t={default:t,_ctx:ue},n=32):(t=String(t),64&r?(n=16,t=[De(t)]):n=8);e.children=t,e.shapeFlag|=n}const Me=e=>e?4&e.vnode.shapeFlag?function(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(D(t=U(e.exposed))?t:new Proxy(t,B),{get:(t,n)=>n in t?t[n]:n in Ue?Ue[n](e):void 0}));var t}(e)||e.proxy:Me(e.parent):null,Ue=f(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Me(e.parent),$root:e=>Me(e.root),$emit:e=>e.emit,$options:e=>function(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:c}}=e.appContext,l=s.get(t);let i;return l?i=l:o.length||n||r?(i={},o.length&&o.forEach((e=>_e(i,e,c,!0))),_e(i,t,c)):i=t,s.set(t,i),i}(e),$forceUpdate:e=>()=>oe(e.update),$nextTick:e=>re.bind(e.proxy),$watch:e=>de.bind(e)}),$e={get({_:e},t){const{ctx:n,setupState:r,data:o,props:s,accessCache:c,type:l,appContext:a}=e;let u;if("$"!==t[0]){const l=c[t];if(void 0!==l)switch(l){case 0:return r[t];case 1:return o[t];case 3:return n[t];case 2:return s[t]}else{if(r!==i&&h(r,t))return c[t]=0,r[t];if(o!==i&&h(o,t))return c[t]=1,o[t];if((u=e.propsOptions[0])&&h(u,t))return c[t]=2,s[t];if(n!==i&&h(n,t))return c[t]=3,n[t];c[t]=4}}const p=Ue[t];let f,d;return p?("$attrs"===t&&function(e,t,n){if(!N||void 0===P)return;let r=I.get(e);r||I.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(P)||(o.add(P),P.deps.push(o))}(e,0,t),p(e)):(f=l.__cssModules)&&(f=f[t])?f:n!==i&&h(n,t)?(c[t]=3,n[t]):(d=a.config.globalProperties,h(d,t)?d[t]:void 0)},set({_:e},t,n){const{data:r,setupState:o,ctx:s}=e;if(o!==i&&h(o,t))o[t]=n;else if(r!==i&&h(r,t))r[t]=n;else if(h(e.props,t))return!1;return("$"!==t[0]||!(t.slice(1)in e))&&(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,propsOptions:s}},c){let l;return void 0!==n[c]||e!==i&&h(e,c)||t!==i&&h(t,c)||(l=s[0])&&h(l,c)||h(r,c)||h(Ue,c)||h(o.config.globalProperties,c)}};f({},$e,{get(e,t){if(t!==Symbol.unscopables)return $e.get(e,t,e)},has:(e,t)=>"_"!==t[0]&&!n(t)});let Be=null;function Fe(e){return y(e)&&e.displayName||e.name}function Ge(e,t,n){const r=arguments.length;return 2===r?m(t)&&!_(t)?Ce(t)?Ae(e,null,[t]):Ae(e,t):Ae(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&Ce(n)&&(n=[n]),Ae(e,t,n))}var He,Ke;(Ke=He||(He={})).DOCUMENT="doc",Ke.HEADING="heading",Ke.PARAGRAPH="paragraph",Ke.QUOTE="blockquote",Ke.OL_LIST="ordered_list",Ke.UL_LIST="bullet_list",Ke.LIST_ITEM="list_item",Ke.CODE_BLOCK="code_block",Ke.HR="horizontal_rule",Ke.BR="hard_break",Ke.IMAGE="image",Ke.BOLD="bold",Ke.STRONG="strong",Ke.STRIKE="strike",Ke.UNDERLINE="underline",Ke.ITALIC="italic",Ke.CODE="code",Ke.LINK="link",Ke.STYLED="styled",Ke.TEXT="text",Ke.COMPONENT="blok";const Ve=[He.DOCUMENT,He.HEADING,He.PARAGRAPH,He.QUOTE,He.OL_LIST,He.UL_LIST,He.LIST_ITEM,He.CODE_BLOCK,He.HR,He.BR,He.IMAGE];var ze,Ye,Qe,qe;function Xe(e){const t=e=>function(e){return e.type===He.TEXT}(e)?e.marks?e.marks.map((t=>o(t,e.text))):c(e):function(e){return Ve.includes(e.type)}(e)?r(e):function(e){return e.type===He.COMPONENT}(e)?s(e):Ge("div","fallback node"),n=e=>{const n=[];return e.forEach((e=>{const r=t(e);Array.isArray(r)?r.forEach((e=>{n.push(e)})):n.push(r)})),n},r=t=>{switch(t.type){case He.DOCUMENT:case He.PARAGRAPH:case He.QUOTE:case He.UL_LIST:case He.LIST_ITEM:return function(t){const n=e[t.type],r=l(t);if(Je(n))return Ge(n,null,{default:()=>r});return n({children:r})}(t);case He.HEADING:case He.OL_LIST:case He.CODE_BLOCK:return function(t){const n=e[t.type],r=l(t);if(Je(n))return Ge(n,t.attrs,{default:()=>r});return n({children:r,attrs:t.attrs})}(t);case He.HR:case He.BR:return function(t){const n=e[t.type];if(Je(n))return Ge(n);return n()}(t);case He.IMAGE:return function(t){const n=e[t.type];if(Je(n))return Ge(n,t.attrs);return n({attrs:t.attrs})}(t);default:return Ge("div","fallback block")}},o=(t,n)=>{switch(t.type){case He.BOLD:case He.STRONG:case He.STRIKE:case He.UNDERLINE:case He.ITALIC:case He.CODE:return function(t,n){const r=e[t.type];if(Je(r))return Ge(r,{default:()=>n});return r({text:n})}(t,n);case He.LINK:case He.STYLED:return function(t,n){const r=e[t.type];if(Je(r))return Ge(r,t.attrs,{default:()=>n});return r({text:n,attrs:t.attrs})}(t,n);default:return Ge("span","fallback mark")}},s=t=>{const n=[];return t.attrs.body.forEach((r=>{const o=r,{component:s,_uid:c}=o,l=__objRest(o,["component","_uid"]),i=e.components[s];i?n.push(i({id:t.attrs.id,component:s,_uid:c,fields:l})):n.push(e[He.COMPONENT]())})),n},c=e=>De(e.text),l=e=>e.content&&e.content.length?n(e.content):[];return{renderDocument:e=>Array.isArray(e)?n(e):t(e)}}function Je(e){return"function"!=typeof e&&!Ce(e)}(Ye=ze||(ze={})).SELF="_self",Ye.BLANK="_blank",(qe=Qe||(Qe={})).URL="url",qe.STORY="story",qe.ASSET="asset",qe.EMAIL="email";var We,Ze=y(We={name:"RichTextRenderer",props:{document:{type:Object,required:!0}},setup(e){const t=nt();return()=>t.renderDocument(e.document)}})?{setup:We,name:We.name}:We;const et={[He.DOCUMENT]:({children:e})=>e,[He.HEADING]:({children:e,attrs:t})=>Ge(`h${t.level}`,e),[He.PARAGRAPH]:({children:e})=>Ge("p",e),[He.QUOTE]:({children:e})=>Ge("blockquote",e),[He.OL_LIST]:({children:e,attrs:t})=>Ge("ol",e),[He.UL_LIST]:({children:e})=>Ge("ul",e),[He.LIST_ITEM]:({children:e})=>Ge("li",e),[He.CODE_BLOCK]:({children:e,attrs:t})=>Ge("pre",t,e),[He.HR]:()=>Ge("hr"),[He.BR]:()=>Ge("br"),[He.IMAGE]:({attrs:e})=>Ge("img",e),[He.BOLD]:({text:e})=>Ge("b",e),[He.STRONG]:({text:e})=>Ge("strong",e),[He.STRIKE]:({text:e})=>Ge("s",e),[He.UNDERLINE]:({text:e})=>Ge("u",e),[He.ITALIC]:({text:e})=>Ge("i",e),[He.CODE]:({text:e})=>Ge("code",e),[He.LINK]:({text:e,attrs:t})=>{let n="";switch(t.linktype){case Qe.ASSET:case Qe.URL:n=t.href;break;case Qe.EMAIL:n=`mailto:${t.href}`;break;case Qe.STORY:const r=function(){const e=Te("RouterLink");return"string"!=typeof e&&e}();return r?Ge(r,{to:t.href,target:t.target},{default:()=>e}):Ge("a",{href:n,target:t.target},e)}return Ge("a",{href:t.href,target:t.target},e)},[He.STYLED]:({text:e,attrs:t})=>Ge("span",t,e),[He.COMPONENT]:()=>Ge("div","component")};const tt=Symbol("Rich Text Renderer");function nt(){const e=function(e,t,n=!1){const r=Be||ue;if(r){const o=null==r.parent?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&y(t)?t.call(r.proxy):t}}(tt);if(!e)throw new Error("Rich Text Renderer not provided.");return e}e.RichTextRenderer=Ze,e.defineResolvers=function(e){const t=e,{components:n={}}=t,r=__objRest(t,["components"]);return __spreadValues(__spreadProps(__spreadValues({},et),{components:n}),r)},e.plugin=e=>({install(t){const n=Xe((null==e?void 0:e.resolvers)||__spreadProps(__spreadValues({},et),{components:{}}));t.provide(tt,n)}}),e.useRenderer=nt,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__objRest=(e,t)=>{var r={};for(var o in e)__hasOwnProp.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))t.indexOf(o)<0&&__propIsEnum.call(e,o)&&(r[o]=e[o]);return r};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@marvr/storyblok-rich-text-types")):"function"==typeof define&&define.amd?define(["exports","vue","@marvr/storyblok-rich-text-types"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).StoryblokRichTextVueRenderer={},e.Vue,e.StoryblokRichTextTypes)}(this,(function(e,t,r){"use strict";function o(e){const o=e=>r.isTextNode(e)?e.marks?e.marks.map((t=>c(t,e.text))):d(e):r.isBlockNode(e)?p(e):r.isComponentNode(e)?a(e):t.h("div","fallback node"),n=e=>{const t=[];return e.forEach((e=>{const r=o(e);Array.isArray(r)?r.forEach((e=>{t.push(e)})):t.push(r)})),t},p=o=>{switch(o.type){case r.NodeTypes.DOCUMENT:case r.NodeTypes.PARAGRAPH:case r.NodeTypes.QUOTE:case r.NodeTypes.UL_LIST:case r.NodeTypes.LIST_ITEM:return function(r){const o=e[r.type],n=i(r);if(s(o))return t.h(o,null,{default:()=>n});return o({children:n})}(o);case r.NodeTypes.HEADING:case r.NodeTypes.OL_LIST:case r.NodeTypes.CODE_BLOCK:return function(r){const o=e[r.type],n=i(r);if(s(o))return t.h(o,r.attrs,{default:()=>n});return o({children:n,attrs:r.attrs})}(o);case r.NodeTypes.HR:case r.NodeTypes.BR:return function(r){const o=e[r.type];if(s(o))return t.h(o);return o()}(o);case r.NodeTypes.IMAGE:return function(r){const o=e[r.type];if(s(o))return t.h(o,r.attrs);return o({attrs:r.attrs})}(o);default:return t.h("div","fallback block")}},c=(o,n)=>{switch(o.type){case r.NodeTypes.BOLD:case r.NodeTypes.STRONG:case r.NodeTypes.STRIKE:case r.NodeTypes.UNDERLINE:case r.NodeTypes.ITALIC:case r.NodeTypes.CODE:return function(r,o){const n=e[r.type];if(s(n))return t.h(n,{default:()=>o});return n({text:o})}(o,n);case r.NodeTypes.LINK:case r.NodeTypes.STYLED:return function(r,o){const n=e[r.type];if(s(n))return t.h(n,r.attrs,{default:()=>o});return n({text:o,attrs:r.attrs})}(o,n);default:return t.h("span","fallback mark")}},a=t=>{const o=[];return t.attrs.body.forEach((s=>{const n=s,{component:p,_uid:c}=n,a=__objRest(n,["component","_uid"]),d=e.components[p];d?o.push(d({id:t.attrs.id,component:p,_uid:c,fields:a})):o.push(e[r.NodeTypes.COMPONENT]())})),o},d=e=>t.createTextVNode(e.text),i=e=>e.content&&e.content.length?n(e.content):[];return{renderDocument:e=>Array.isArray(e)?n(e):o(e)}}function s(e){return"function"!=typeof e&&!t.isVNode(e)}var n=t.defineComponent({name:"RichTextRenderer",props:{document:{type:Object,required:!0}},setup(e){const t=a();return()=>t.renderDocument(e.document)}});const p={[r.NodeTypes.DOCUMENT]:({children:e})=>e,[r.NodeTypes.HEADING]:({children:e,attrs:r})=>t.h(`h${r.level}`,e),[r.NodeTypes.PARAGRAPH]:({children:e})=>t.h("p",e),[r.NodeTypes.QUOTE]:({children:e})=>t.h("blockquote",e),[r.NodeTypes.OL_LIST]:({children:e,attrs:r})=>t.h("ol",e),[r.NodeTypes.UL_LIST]:({children:e})=>t.h("ul",e),[r.NodeTypes.LIST_ITEM]:({children:e})=>t.h("li",e),[r.NodeTypes.CODE_BLOCK]:({children:e,attrs:r})=>t.h("pre",r,e),[r.NodeTypes.HR]:()=>t.h("hr"),[r.NodeTypes.BR]:()=>t.h("br"),[r.NodeTypes.IMAGE]:({attrs:e})=>t.h("img",e),[r.NodeTypes.BOLD]:({text:e})=>t.h("b",e),[r.NodeTypes.STRONG]:({text:e})=>t.h("strong",e),[r.NodeTypes.STRIKE]:({text:e})=>t.h("s",e),[r.NodeTypes.UNDERLINE]:({text:e})=>t.h("u",e),[r.NodeTypes.ITALIC]:({text:e})=>t.h("i",e),[r.NodeTypes.CODE]:({text:e})=>t.h("code",e),[r.NodeTypes.LINK]:({text:e,attrs:o})=>{let s="";switch(o.linktype){case r.LinkTypes.ASSET:case r.LinkTypes.URL:s=o.href;break;case r.LinkTypes.EMAIL:s=`mailto:${o.href}`;break;case r.LinkTypes.STORY:const n=function(){const e=t.resolveDynamicComponent("RouterLink");return"string"!=typeof e&&e}();return n?t.h(n,{to:o.href,target:o.target},{default:()=>e}):t.h("a",{href:s,target:o.target},e)}return t.h("a",{href:o.href,target:o.target},e)},[r.NodeTypes.STYLED]:({text:e,attrs:r})=>t.h("span",r,e),[r.NodeTypes.COMPONENT]:()=>t.h("div","component")};const c=Symbol("Rich Text Renderer");function a(){const e=t.inject(c);if(!e)throw new Error("Rich Text Renderer not provided.");return e}e.RichTextRenderer=n,e.defineResolvers=function(e){const t=e,{components:r={}}=t,o=__objRest(t,["components"]);return __spreadValues(__spreadProps(__spreadValues({},p),{components:r}),o)},e.plugin=e=>({install(t){const r=o((null==e?void 0:e.resolvers)||__spreadProps(__spreadValues({},p),{components:{}}));t.provide(c,r)}}),e.useRenderer=a,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
{
"name": "@marvr/storyblok-rich-text-vue-renderer",
"version": "3.1.1",
"version": "3.1.2",
"main": "./dist/storyblok-rich-text-vue-renderer.umd.js",

@@ -19,10 +19,10 @@ "module": "./dist/storyblok-rich-text-vue-renderer.es.js",

"dependencies": {
"@marvr/storyblok-rich-text-types": "^3.0.0",
"vue": "^3.0.5"
"@marvr/storyblok-rich-text-types": "^3.1.2",
"vue": "^3.1.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.2.2",
"@vue/compiler-sfc": "^3.0.5",
"typescript": "^4.1.3",
"vite": "^2.3.0",
"@vitejs/plugin-vue": "^1.3.0",
"@vue/compiler-sfc": "^3.1.5",
"typescript": "^4.3.5",
"vite": "^2.4.4",
"vue-router": "^4.0.1",

@@ -32,3 +32,3 @@ "vue-tsc": "^0.0.24"

"optionalDependencies": {
"vue-router": "^4.0.1"
"vue-router": "^4.0.10"
},

@@ -38,3 +38,3 @@ "files": [

],
"gitHead": "2a177bb92028a5e877f279baf6c70de1f4a7d536"
"gitHead": "8dda1678cf682d8cf7ae1d7389bea69d0e7c673d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc