react-portable-text
Advanced tools
Comparing version 0.2.4 to 0.3.0
@@ -1,3 +0,3 @@ | ||
var $=Object.create,m=Object.defineProperty,B=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,F=Object.getOwnPropertyNames,K=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertySymbols,M=Object.prototype.propertyIsEnumerable;var k=Object.assign,z=e=>m(e,"__esModule",{value:!0});var p=(e,t)=>{var c={};for(var r in e)O.call(e,r)&&t.indexOf(r)<0&&(c[r]=e[r]);if(e!=null&&q)for(var r of q(e))t.indexOf(r)<0&&M.call(e,r)&&(c[r]=e[r]);return c};var R=(e,t)=>{for(var c in t)m(e,c,{get:t[c],enumerable:!0})},U=(e,t,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of F(t))!O.call(e,r)&&r!=="default"&&m(e,r,{get:()=>t[r],enumerable:!(c=K(t,r))||c.enumerable});return e},P=e=>e&&e.__esModule?e:U(z(m(e!=null?$(B(e)):{},"default",{value:e,enumerable:!0})),e);z(exports);R(exports,{blockContentToPlainText:()=>H,default:()=>D});var S=P(require("react")),n=P(require("prop-types")),f=P(require("@sanity/block-content-to-react")),v=i=>{var{content:e,className:t,serializers:c={}}=i,r=p(i,["content","className","serializers"]);if(!e)throw new Error("No `content` provided to PortableText.");return S.default.createElement(f.default,k({blocks:e,className:t,serializers:A(c),renderContainerOnSingleChild:!0},r))},D=v;v.propTypes={content:n.default.array.isRequired,className:n.default.string,serializers:n.default.shape({link:n.default.func,strong:n.default.func,em:n.default.func,underline:n.default.func,del:n.default.func,code:n.default.func,ul:n.default.func,ol:n.default.func,li:n.default.func,h1:n.default.func,h2:n.default.func,h3:n.default.func,h4:n.default.func,h5:n.default.func,h6:n.default.func,blockquote:n.default.func})};var A=e=>{let{link:t,strong:c,em:r,underline:i,del:g,code:C,ul:s,ol:N,li:d,h1:h,h2:y,h3:_,h4:w,h5:T,h6:j,blockquote:x}=e,b=p(e,["link","strong","em","underline","del","code","ul","ol","li","h1","h2","h3","h4","h5","h6","blockquote"]),E={h1:h,h2:y,h3:_,h4:w,h5:T,h6:j,blockquote:x};return{marks:G(k({link:t,strong:c,em:r,underline:i,code:C,"strike-through":g},b)),list:o=>{let{type:l,children:u}=o,a=l==="bullet"?s:N;return a?a({children:u}):f.default.defaultSerializers.list(o)},listItem:o=>{let{children:l}=o;return d?d({children:l}):f.default.defaultSerializers.listItem(o)},types:k({block:o=>{let{node:{style:l},children:u}=o;return E[l]?E[l]({children:u}):b[l]?b[l]({children:u}):f.default.defaultSerializers.types.block(o)}},Object.entries(b).reduce((o,[l,u])=>{let a=({node:W})=>S.default.createElement(u,W);return a.displayName=`${I(l)}Wrapper`,o[l]=a,o},{}))}},G=e=>Object.entries(e).reduce((t,[c,r])=>{if(r){let i=y=>{var{_type:g,_key:C,mark:s,markKey:N,children:d}=y,h=p(y,["_type","_key","mark","markKey","children"]);if(typeof s=="object"){let{_type:_,_key:w}=s,T=p(s,["_type","_key"]);Object.entries(T).forEach(([j,x])=>{h[j]=x})}return S.default.createElement(r,h,d)};i.displayName=`${I(c)}Wrapper`,t[c]=i}return t},{}),H=(e=[])=>e.map(t=>t._type==="block"&&t.children?t.children.map(c=>c.text).join(""):"").join(` | ||
var B=Object.create,b=Object.defineProperty,F=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,K=Object.getOwnPropertyNames,M=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertySymbols,R=Object.prototype.propertyIsEnumerable;var m=Object.assign,v=e=>b(e,"__esModule",{value:!0});var d=(e,t)=>{var c={};for(var n in e)O.call(e,n)&&t.indexOf(n)<0&&(c[n]=e[n]);if(e!=null&&q)for(var n of q(e))t.indexOf(n)<0&&R.call(e,n)&&(c[n]=e[n]);return c};var U=(e,t)=>{for(var c in t)b(e,c,{get:t[c],enumerable:!0})},A=(e,t,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of K(t))!O.call(e,n)&&n!=="default"&&b(e,n,{get:()=>t[n],enumerable:!(c=M(t,n))||c.enumerable});return e},P=e=>e&&e.__esModule?e:A(v(b(e!=null?B(F(e)):{},"default",{value:e,enumerable:!0})),e);v(exports);U(exports,{blockContentToPlainText:()=>J,default:()=>G});var k=P(require("react")),r=P(require("prop-types")),f=P(require("@sanity/block-content-to-react")),z=i=>{var{content:e,className:t,serializers:c={}}=i,n=d(i,["content","className","serializers"]);if(!e)throw new Error("No `content` provided to PortableText.");return k.default.createElement(f.default,m({blocks:e,className:t,serializers:D(c),renderContainerOnSingleChild:!0},n))},G=z;z.propTypes={content:r.default.array.isRequired,className:r.default.string,serializers:r.default.shape({link:r.default.func,strong:r.default.func,em:r.default.func,underline:r.default.func,del:r.default.func,code:r.default.func,ul:r.default.func,ol:r.default.func,li:r.default.func,h1:r.default.func,h2:r.default.func,h3:r.default.func,h4:r.default.func,h5:r.default.func,h6:r.default.func,blockquote:r.default.func})};var D=e=>{let{container:t="div",link:c,strong:n,em:i,underline:g,del:C,code:s,ul:N,ol:S,li:a,h1:h,h2:_,h3:w,h4:T,h5:j,h6:x,blockquote:W}=e,y=d(e,["container","link","strong","em","underline","del","code","ul","ol","li","h1","h2","h3","h4","h5","h6","blockquote"]),E={h1:h,h2:_,h3:w,h4:T,h5:j,h6:x,blockquote:W};return{container:t,marks:H(m({link:c,strong:n,em:i,underline:g,code:s,"strike-through":C},y)),list:o=>{let{type:l,children:u}=o,p=l==="bullet"?N:S;return p?p({children:u}):f.default.defaultSerializers.list(o)},listItem:o=>{let{children:l}=o;return a?a({children:l}):f.default.defaultSerializers.listItem(o)},types:m({block:o=>{let{node:{style:l},children:u}=o;return E[l]?E[l]({children:u}):y[l]?y[l]({children:u}):f.default.defaultSerializers.types.block(o)}},Object.entries(y).reduce((o,[l,u])=>{let p=({node:$})=>k.default.createElement(u,$);return p.displayName=`${I(l)}Wrapper`,o[l]=p,o},{}))}},H=e=>Object.entries(e).reduce((t,[c,n])=>{if(n){let i=h=>{var{_type:g,_key:C,mark:s,markKey:N,children:S}=h,a=d(h,["_type","_key","mark","markKey","children"]);if(typeof s=="object"){let{_type:_,_key:w}=s,T=d(s,["_type","_key"]);Object.entries(T).forEach(([j,x])=>{a[j]=x})}return k.default.createElement(n,a,S)};i.displayName=`${I(c)}Wrapper`,t[c]=i}return t},{}),J=(e=[])=>e.map(t=>t._type==="block"&&t.children?t.children.map(c=>c.text).join(""):"").join(` | ||
`),I=e=>e.slice(0,1).toUpperCase()+e.slice(1); |
{ | ||
"name": "react-portable-text", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "An easy way to render Portable Text block content in React applications.", | ||
@@ -5,0 +5,0 @@ "author": "Corey Ward <corey@hey.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25902