preact-render-to-string
Advanced tools
Comparing version 5.1.19 to 6.0.0-experimental.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/,g=function(){};y.render=y;var v=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,v){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,v);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,v)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:g,forceUpdate:g,__h:[]};if(t.options.__b&&t.options.__b(e),t.options.__r&&t.options.__r(e),w.prototype&&"function"==typeof w.prototype.render){var j=w.contextType,F=j&&n[j.__c],H=null!=j?F?F.props.value:j.__:n;(A=e.__c=new w(k,H)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=H,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),C=A.render(A.props,A.state,A.context)}else{var M=w.contextType,$=M&&n[M.__c];C=w.call(e.__c,k,null!=M?$?$.props.value:M.__:n)}return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,v)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var L,R,E="<"+w;if(k){var q=Object.keys(k);r&&!0===r.sortAttributes&&q.sort();for(var D=0;D<q.length;D++){var N=q[D],P=k[N];if("children"!==N){if(!d.test(N)&&(r&&r.allAttributes||"key"!==N&&"ref"!==N&&"__self"!==N&&"__source"!==N&&"defaultValue"!==N)){if("className"===N){if(k.class)continue;N="class"}else u&&N.match(/^xlink:?./)&&(N=N.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===N){if(k.for)continue;N="for"}"style"===N&&P&&"object"==typeof P&&(P=s(P)),"a"===N[0]&&"r"===N[1]&&"boolean"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook(N,P,n,r,O);if(U||""===U)E+=U;else if("dangerouslySetInnerHTML"===N)R=P&&P.__html;else if("textarea"===w&&"value"===N)L=P;else if((P||0===P||""===P)&&"function"!=typeof P){if(!(!0!==P&&""!==P||(P=N,r&&r.xml))){E+=" "+N;continue}if("value"===N){if("select"===w){v=P;continue}"option"===w&&v==P&&(E+=" selected")}E+=" "+N+'="'+o(P)+'"'}}}else L=P}}if(h){var W=E.replace(/\n\s*/," ");W===E||~W.indexOf("\n")?h&&~E.indexOf("\n")&&(E+="\n"):E=W}if(E+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+E);var z,I=_.test(w)||r.voidElements&&r.voidElements.test(w),V=[];if(R)h&&a(R)&&(R="\n"+y+i(R,y)),E+=R;else if(null!=L&&p(z=[],L).length){for(var Z=h&&~E.indexOf("\n"),B=!1,G=0;G<z.length;G++){var J=z[G];if(null!=J&&!1!==J){var K=m(J,n,r,!0,"svg"===w||"foreignObject"!==w&&u,v);if(h&&!Z&&a(K)&&(Z=!0),K)if(h){var Q=K.length>0&&"<"!=K[0];B&&Q?V[V.length-1]+=K:V.push(K),B=Q}else V.push(K)}}if(h&&Z)for(var X=V.length;X--;)V[X]="\n"+y+i(V[X],y)}if(V.length||R)E+=V.join("");else if(r&&r.xml)return E.substring(0,E.length-1)+" />";return!I||z||R?(h&&~E.indexOf("\n")&&(E+="\n"),E+="</"+w+">"):E=E.replace(/>$/," />"),E}y.shallowRender=v,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=v}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],d=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,_=/[\s\n\\/='"\0<>]/,v=function(){};y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,data:{}};t.options.__b&&t.options.__b(e);var j=function(e,t){return{type:e.type,props:e.props,data:{},c:t}}(e,n);if(t.options.__r&&t.options.__r(j),w.prototype&&"function"==typeof w.prototype.render){var F=w.contextType,H=F&&n[F.__c],M=null!=F?H?H.props.value:F.__:n;(A=e.__c=new w(k,M)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=M,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),C=A.render(A.props,A.state,A.context)}else{var $=w.contextType,L=$&&n[$.__c];C=w.call(e.__c,k,null!=$?L?L.props.value:$.__:n)}return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var R,E,q="<"+w;if(k){var D=Object.keys(k);r&&!0===r.sortAttributes&&D.sort();for(var N=0;N<D.length;N++){var P=D[N],U=k[P];if("children"!==P){if(!_.test(P)&&(r&&r.allAttributes||"key"!==P&&"ref"!==P&&"__self"!==P&&"__source"!==P)){if("defaultValue"===P)P="value";else if("className"===P){if(void 0!==k.class)continue;P="class"}else u&&P.match(/^xlink:?./)&&(P=P.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===P){if(k.for)continue;P="for"}"style"===P&&U&&"object"==typeof U&&(U=s(U)),"a"===P[0]&&"r"===P[1]&&"boolean"==typeof U&&(U=String(U));var W=r.attributeHook&&r.attributeHook(P,U,n,r,O);if(W||""===W)q+=W;else if("dangerouslySetInnerHTML"===P)E=U&&U.__html;else if("textarea"===w&&"value"===P)R=U;else if((U||0===U||""===U)&&"function"!=typeof U){if(!(!0!==U&&""!==U||(U=P,r&&r.xml))){q+=" "+P;continue}if("value"===P){if("select"===w){g=U;continue}"option"===w&&g==U&&(q+=" selected")}q+=" "+P+'="'+o(U)+'"'}}}else R=U}}if(h){var z=q.replace(/\n\s*/," ");z===q||~z.indexOf("\n")?h&&~q.indexOf("\n")&&(q+="\n"):q=z}if(q+=">",_.test(w))throw new Error(w+" is not a valid HTML tag name in "+q);var I,V=d.test(w)||r.voidElements&&r.voidElements.test(w),Z=[];if(E)h&&a(E)&&(E="\n"+y+i(E,y)),q+=E;else if(null!=R&&p(I=[],R).length){for(var B=h&&~q.indexOf("\n"),G=!1,J=0;J<I.length;J++){var K=I[J];if(null!=K&&!1!==K){var Q=m(K,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!B&&a(Q)&&(B=!0),Q)if(h){var X=Q.length>0&&"<"!=Q[0];G&&X?Z[Z.length-1]+=Q:Z.push(Q),G=X}else Z.push(Q)}}if(h&&B)for(var Y=Z.length;Y--;)Z[Y]="\n"+y+i(Z[Y],y)}if(Z.length||E)q+=Z.join("");else if(r&&r.xml)return q.substring(0,q.length-1)+" />";return!V||I||E?(h&&~q.indexOf("\n")&&(q+="\n"),q+="</"+w+">"):q=q.replace(/>$/," />"),q}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function u(e,t){return Array.isArray(t)?t.reduce(u,e):null!=t&&!1!==t&&e.push(t),e}var c={shallow:!0},p=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,v=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var g=function(e,t){return m(e,t,c)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=x(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function x(r,n,l,c,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,y=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=x(r[S],n,l,c,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!c&&!1!==l.renderRootComponent){if(k===t){var A=[];return u(A,r.props.children),x(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:d,forceUpdate:d,__h:[]};if(e.__b&&e.__b(r),e.__r&&e.__r(r),k.prototype&&"function"==typeof k.prototype.render){var F=k.contextType,M=F&&n[F.__c],T=null!=F?M?M.props.value:F.__:n;(j=r.__c=new k(O,T)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=T,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),H=j.render(j.props,j.state,j.context)}else{var $=k.contextType,L=$&&n[$.__c];H=k.call(r.__c,O,null!=$?L?L.props.value:$.__:n)}return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),x(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=p.length;n--;)if(p[n]===e){r=n;break}r<0&&(r=p.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var E,D,N="<"+k;if(O){var P=Object.keys(O);l&&!0===l.sortAttributes&&P.sort();for(var R=0;R<P.length;R++){var U=P[R],W=O[U];if("children"!==U){if(!v.test(U)&&(l&&l.allAttributes||"key"!==U&&"ref"!==U&&"__self"!==U&&"__source"!==U&&"defaultValue"!==U)){if("className"===U){if(O.class)continue;U="class"}else g&&U.match(/^xlink:?./)&&(U=U.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===U){if(O.for)continue;U="for"}"style"===U&&W&&"object"==typeof W&&(W=s(W)),"a"===U[0]&&"r"===U[1]&&"boolean"==typeof W&&(W=String(W));var q=l.attributeHook&&l.attributeHook(U,W,n,l,C);if(q||""===q)N+=q;else if("dangerouslySetInnerHTML"===U)D=W&&W.__html;else if("textarea"===k&&"value"===U)E=W;else if((W||0===W||""===W)&&"function"!=typeof W){if(!(!0!==W&&""!==W||(W=U,l&&l.xml))){N+=" "+U;continue}if("value"===U){if("select"===k){h=W;continue}"option"===k&&h==W&&(N+=" selected")}N+=" "+U+'="'+o(W)+'"'}}}else E=W}}if(m){var z=N.replace(/\n\s*/," ");z===N||~z.indexOf("\n")?m&&~N.indexOf("\n")&&(N+="\n"):N=z}if(N+=">",v.test(k))throw new Error(k+" is not a valid HTML tag name in "+N);var I,V=_.test(k)||l.voidElements&&l.voidElements.test(k),Z=[];if(D)m&&i(D)&&(D="\n"+y+a(D,y)),N+=D;else if(null!=E&&u(I=[],E).length){for(var B=m&&~N.indexOf("\n"),G=!1,J=0;J<I.length;J++){var K=I[J];if(null!=K&&!1!==K){var Q=x(K,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!B&&i(Q)&&(B=!0),Q)if(m){var X=Q.length>0&&"<"!=Q[0];G&&X?Z[Z.length-1]+=Q:Z.push(Q),G=X}else Z.push(Q)}}if(m&&B)for(var Y=Z.length;Y--;)Z[Y]="\n"+y+a(Z[Y],y)}if(Z.length||D)N+=Z.join("");else if(l&&l.xml)return N.substring(0,N.length-1)+" />";return!V||I||D?(m&&~N.indexOf("\n")&&(N+="\n"),N+="</"+k+">"):N=N.replace(/>$/," />"),N}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender}; | ||
import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,v=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var g=function(e,t){return m(e,t,u)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=y(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function y(r,n,l,u,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,x=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=y(r[S],n,l,u,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!u&&!1!==l.renderRootComponent){if(k===t){var A=[];return p(A,r.props.children),y(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:d,forceUpdate:d,data:{}};e.__b&&e.__b(r);var F=function(e,t){return{type:e.type,props:e.props,data:{},c:t}}(r,n);if(e.__r&&e.__r(F),k.prototype&&"function"==typeof k.prototype.render){var M=k.contextType,T=M&&n[M.__c],$=null!=M?T?T.props.value:M.__:n;(j=r.__c=new k(O,$)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=$,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),H=j.render(j.props,j.state,j.context)}else{var L=k.contextType,E=L&&n[L.__c];H=k.call(r.__c,O,null!=L?E?E.props.value:L.__:n)}return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),y(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=c.length;n--;)if(c[n]===e){r=n;break}r<0&&(r=c.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var D,N,P="<"+k;if(O){var R=Object.keys(O);l&&!0===l.sortAttributes&&R.sort();for(var U=0;U<R.length;U++){var W=R[U],q=O[W];if("children"!==W){if(!v.test(W)&&(l&&l.allAttributes||"key"!==W&&"ref"!==W&&"__self"!==W&&"__source"!==W)){if("defaultValue"===W)W="value";else if("className"===W){if(void 0!==O.class)continue;W="class"}else g&&W.match(/^xlink:?./)&&(W=W.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===W){if(O.for)continue;W="for"}"style"===W&&q&&"object"==typeof q&&(q=s(q)),"a"===W[0]&&"r"===W[1]&&"boolean"==typeof q&&(q=String(q));var z=l.attributeHook&&l.attributeHook(W,q,n,l,C);if(z||""===z)P+=z;else if("dangerouslySetInnerHTML"===W)N=q&&q.__html;else if("textarea"===k&&"value"===W)D=q;else if((q||0===q||""===q)&&"function"!=typeof q){if(!(!0!==q&&""!==q||(q=W,l&&l.xml))){P+=" "+W;continue}if("value"===W){if("select"===k){h=q;continue}"option"===k&&h==q&&(P+=" selected")}P+=" "+W+'="'+o(q)+'"'}}}else D=q}}if(m){var I=P.replace(/\n\s*/," ");I===P||~I.indexOf("\n")?m&&~P.indexOf("\n")&&(P+="\n"):P=I}if(P+=">",v.test(k))throw new Error(k+" is not a valid HTML tag name in "+P);var V,Z=_.test(k)||l.voidElements&&l.voidElements.test(k),B=[];if(N)m&&i(N)&&(N="\n"+x+a(N,x)),P+=N;else if(null!=D&&p(V=[],D).length){for(var G=m&&~P.indexOf("\n"),J=!1,K=0;K<V.length;K++){var Q=V[K];if(null!=Q&&!1!==Q){var X=y(Q,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!G&&i(X)&&(G=!0),X)if(m){var Y=X.length>0&&"<"!=X[0];J&&Y?B[B.length-1]+=X:B.push(X),J=Y}else B.push(X)}}if(m&&G)for(var ee=B.length;ee--;)B[ee]="\n"+x+a(B[ee],x)}if(B.length||N)P+=B.join("");else if(l&&l.xml)return P.substring(0,P.length-1)+" />";return!Z||V||N?(m&&~P.indexOf("\n")&&(P+="\n"),P+="</"+k+">"):P=P.replace(/>$/," />"),P}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
var t;t=function(t,n){if("function"!=typeof Symbol){var e=0;Symbol=function(t){return"@@"+t+ ++e},Symbol.for=function(t){return"@@"+t}}var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,o=/[&<>"]/;function i(t){var n=String(t);return o.test(n)?n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):n}var a=function(t,n){return String(t).replace(/(\n+)/g,"$1"+(n||"\t"))},u=function(t,n,e){return String(t).length>(n||40)||!e&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},c={};function f(t){var n="";for(var e in t){var o=t[e];null!=o&&""!==o&&(n&&(n+=" "),n+="-"==e[0]?e:c[e]||(c[e]=e.replace(/([A-Z])/g,"-$1").toLowerCase()),n+=": ",n+=o,"number"==typeof o&&!1===r.test(e)&&(n+="px"),n+=";")}return n||void 0}function l(t,n){for(var e in n)t[e]=n[e];return t}function s(t,n){return Array.isArray(n)?n.reduce(s,t):null!=n&&!1!==n&&t.push(n),t}var p={shallow:!0},y=[],g=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,v=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var b=[];function m(t,e,r){e=e||{},r=r||{};var o=n.options.__s;n.options.__s=!0;var i=_(t,e,r);return n.options.__c&&n.options.__c(t,b),b.length=0,n.options.__s=o,i}function _(t,e,r,o,c,p){if(null==t||"boolean"==typeof t)return"";if("object"!=typeof t)return i(t);var b=r.pretty,m=b&&"string"==typeof b?b:"\t";if(Array.isArray(t)){for(var h="",x=0;x<t.length;x++)b&&x>0&&(h+="\n"),h+=_(t[x],e,r,o,c,p);return h}var j,S=t.type,A=t.props,O=!1;if("function"==typeof S){if(O=!0,!r.shallow||!o&&!1!==r.renderRootComponent){if(S===n.Fragment){var w=[];return s(w,t.props.children),_(w,e,r,!1!==r.shallowHighOrder,c,p)}var k,F=t.__c={__v:t,context:e,props:t.props,setState:d,forceUpdate:d,__h:[]};if(n.options.__b&&n.options.__b(t),n.options.__r&&n.options.__r(t),S.prototype&&"function"==typeof S.prototype.render){var E=S.contextType,C=E&&e[E.__c],M=null!=E?C?C.props.value:E.__:e;(F=t.__c=new S(A,M)).__v=t,F._dirty=F.__d=!0,F.props=A,null==F.state&&(F.state={}),null==F._nextState&&null==F.__s&&(F._nextState=F.__s=F.state),F.context=M,S.getDerivedStateFromProps?F.state=l(l({},F.state),S.getDerivedStateFromProps(F.props,F.state)):F.componentWillMount&&(F.componentWillMount(),F.state=F._nextState!==F.state?F._nextState:F.__s!==F.state?F.__s:F.state),k=F.render(F.props,F.state,F.context)}else{var N=S.contextType,D=N&&e[N.__c];k=S.call(t.__c,A,null!=N?D?D.props.value:N.__:e)}return F.getChildContext&&(e=l(l({},e),F.getChildContext())),n.options.diffed&&n.options.diffed(t),_(k,e,r,!1!==r.shallowHighOrder,c,p)}S=(j=S).displayName||j!==Function&&j.name||function(t){var n=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!n){for(var e=-1,r=y.length;r--;)if(y[r]===t){e=r;break}e<0&&(e=y.push(t)-1),n="UnnamedComponent"+e}return n}(j)}var H,I,$="<"+S;if(A){var T=Object.keys(A);r&&!0===r.sortAttributes&&T.sort();for(var U=0;U<T.length;U++){var W=T[U],L=A[W];if("children"!==W){if(!v.test(W)&&(r&&r.allAttributes||"key"!==W&&"ref"!==W&&"__self"!==W&&"__source"!==W&&"defaultValue"!==W)){if("className"===W){if(A.class)continue;W="class"}else c&&W.match(/^xlink:?./)&&(W=W.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===W){if(A.for)continue;W="for"}"style"===W&&L&&"object"==typeof L&&(L=f(L)),"a"===W[0]&&"r"===W[1]&&"boolean"==typeof L&&(L=String(L));var P=r.attributeHook&&r.attributeHook(W,L,e,r,O);if(P||""===P)$+=P;else if("dangerouslySetInnerHTML"===W)I=L&&L.__html;else if("textarea"===S&&"value"===W)H=L;else if((L||0===L||""===L)&&"function"!=typeof L){if(!(!0!==L&&""!==L||(L=W,r&&r.xml))){$+=" "+W;continue}if("value"===W){if("select"===S){p=L;continue}"option"===S&&p==L&&($+=" selected")}$+=" "+W+'="'+i(L)+'"'}}}else H=L}}if(b){var R=$.replace(/\n\s*/," ");R===$||~R.indexOf("\n")?b&&~$.indexOf("\n")&&($+="\n"):$=R}if($+=">",v.test(S))throw new Error(S+" is not a valid HTML tag name in "+$);var J,q=g.test(S)||r.voidElements&&r.voidElements.test(S),V=[];if(I)b&&u(I)&&(I="\n"+m+a(I,m)),$+=I;else if(null!=H&&s(J=[],H).length){for(var z=b&&~$.indexOf("\n"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=_(Z,e,r,!0,"svg"===S||"foreignObject"!==S&&c,p);if(b&&!z&&u(K)&&(z=!0),K)if(b){var Q=K.length>0&&"<"!=K[0];B&&Q?V[V.length-1]+=K:V.push(K),B=Q}else V.push(K)}}if(b&&z)for(var X=V.length;X--;)V[X]="\n"+m+a(V[X],m)}if(V.length||I)$+=V.join("");else if(r&&r.xml)return $.substring(0,$.length-1)+" />";return!q||J||I?(b&&~$.indexOf("\n")&&($+="\n"),$+="</"+S+">"):$=$.replace(/>$/," />"),$}m.shallowRender=function(t,n){return m(t,n,p)};var h=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,w=/^Symbol\((.*)\)(.*)$/,k=/\n/gi,F=Object.getOwnPropertySymbols||function(t){return[]};function E(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function C(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function M(t){return O.call(t).replace(w,"Symbol($1)")}function N(t){return"["+S.call(t)+"]"}function D(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";var n=typeof t;if("number"===n)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===n)return'"'+function(t){return t.replace(h,"\\$1")}(t)+'"';if("function"===n)return C(t);if("symbol"===n)return M(t);var e=x.call(t);return"[object WeakMap]"===e?"WeakMap {}":"[object WeakSet]"===e?"WeakSet {}":"[object Function]"===e||"[object GeneratorFunction]"===e?C(t,min):"[object Symbol]"===e?M(t):"[object Date]"===e?j.call(t):"[object Error]"===e?N(t):"[object RegExp]"===e?A.call(t):"[object Arguments]"===e&&0===t.length?"Arguments []":E(e)&&0===t.length?t.constructor.name+" []":t instanceof Error&&N(t)}function H(t,n,e,r,o,i,a,u,c,f){var l="";if(t.length){l+=o;for(var s=e+n,p=0;p<t.length;p++)l+=s+T(t[p],n,s,r,o,i,a,u,c,f),p<t.length-1&&(l+=","+r);l+=o+e}return"["+l+"]"}function I(t,n,e,r,o,i,a,u,c,f){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var l=++u>a;if(!l&&t.toJSON&&"function"==typeof t.toJSON)return T(t.toJSON(),n,e,r,o,i,a,u,c,f);var s=x.call(t);return"[object Arguments]"===s?l?"[Arguments]":function(t,n,e,r,o,i,a,u,c,f){return(f?"":"Arguments ")+H(t,n,e,r,o,i,a,u,c,f)}(t,n,e,r,o,i,a,u,c,f):E(s)?l?"[Array]":function(t,n,e,r,o,i,a,u,c,f){return(f?"":t.constructor.name+" ")+H(t,n,e,r,o,i,a,u,c,f)}(t,n,e,r,o,i,a,u,c,f):"[object Map]"===s?l?"[Map]":function(t,n,e,r,o,i,a,u,c,f){var l="Map {",s=t.entries(),p=s.next();if(!p.done){l+=o;for(var y=e+n;!p.done;)l+=y+T(p.value[0],n,y,r,o,i,a,u,c,f)+" => "+T(p.value[1],n,y,r,o,i,a,u,c,f),(p=s.next()).done||(l+=","+r);l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):"[object Set]"===s?l?"[Set]":function(t,n,e,r,o,i,a,u,c,f){var l="Set {",s=t.entries(),p=s.next();if(!p.done){l+=o;for(var y=e+n;!p.done;)l+=y+T(p.value[1],n,y,r,o,i,a,u,c,f),(p=s.next()).done||(l+=","+r);l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):"object"==typeof t?l?"[Object]":function(t,n,e,r,o,i,a,u,c,f){var l=(f?"":t.constructor?t.constructor.name+" ":"Object ")+"{",s=Object.keys(t).sort(),p=F(t);if(p.length&&(s=s.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===x.call(t))}).concat(p)),s.length){l+=o;for(var y=e+n,g=0;g<s.length;g++){var v=s[g];l+=y+T(v,n,y,r,o,i,a,u,c,f)+": "+T(t[v],n,y,r,o,i,a,u,c,f),g<s.length-1&&(l+=","+r)}l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):void 0}function $(t,n,e,r,o,i,a,u,c,f){for(var l,s=!1,p=0;p<c.length;p++)if((l=c[p]).test(t)){s=!0;break}return!!s&&l.print(t,function(t){return T(t,n,e,r,o,i,a,u,c,f)},function(t){var r=e+n;return r+t.replace(k,"\n"+r)},{edgeSpacing:o,spacing:r})}function T(t,n,e,r,o,i,a,u,c,f){return D(t)||$(t,n,e,r,o,i,a,u,c,f)||I(t,n,e,r,o,i,a,u,c,f)}var U={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function W(t){return new Array(t+1).join(" ")}var L={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,n,e){return m(t,L.context,L.opts)}},P={plugins:[L]},R={attributeHook:function(t,n,e,r,o){var u=typeof n;if("dangerouslySetInnerHTML"===t)return!1;if(null==n||"function"===u&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===n||("class"===t||"style"===t)&&""===n))return"";var c="string"==typeof r.pretty?r.pretty:"\t";return"string"!==u?("function"!==u||r.functionNames?(L.context=e,L.opts=r,~(n=function(t,n){var e,r;n?(function(t){if(Object.keys(t).forEach(function(t){if(!U.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(n),n=function(t){var n={};return Object.keys(U).forEach(function(e){return n[e]=t.hasOwnProperty(e)?t[e]:U[e]}),n.min&&(n.indent=0),n}(n)):n=U;var o=n.min?" ":"\n",i=n.min?"":"\n";if(n&&n.plugins.length){var a=$(t,e=W(n.indent),"",o,i,r=[],n.maxDepth,0,n.plugins,n.min);if(a)return a}return D(t)||(e||(e=W(n.indent)),r||(r=[]),I(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min))}(n,P)).indexOf("\n")&&(n=a("\n"+n,c)+"\n")):n="Function",a("\n"+t+"={"+n+"}",c)):"\n"+c+t+'="'+i(n)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function J(t,n,e,r){return m(t,n,e=l(l({},R),e||{}))}t.default=J,t.render=J},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(self.preactRenderToString={},(void 0).preact); | ||
var t;t=function(t,n){if("function"!=typeof Symbol){var e=0;Symbol=function(t){return"@@"+t+ ++e},Symbol.for=function(t){return"@@"+t}}var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,o=/[&<>"]/;function i(t){var n=String(t);return o.test(n)?n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):n}var a=function(t,n){return String(t).replace(/(\n+)/g,"$1"+(n||"\t"))},u=function(t,n,e){return String(t).length>(n||40)||!e&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},c={};function f(t){var n="";for(var e in t){var o=t[e];null!=o&&""!==o&&(n&&(n+=" "),n+="-"==e[0]?e:c[e]||(c[e]=e.replace(/([A-Z])/g,"-$1").toLowerCase()),n+=": ",n+=o,"number"==typeof o&&!1===r.test(e)&&(n+="px"),n+=";")}return n||void 0}function l(t,n){for(var e in n)t[e]=n[e];return t}function s(t,n){return Array.isArray(n)?n.reduce(s,t):null!=n&&!1!==n&&t.push(n),t}var p={shallow:!0},y=[],v=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,g=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var b=[];function m(t,e,r){e=e||{},r=r||{};var o=n.options.__s;n.options.__s=!0;var i=h(t,e,r);return n.options.__c&&n.options.__c(t,b),b.length=0,n.options.__s=o,i}function h(t,e,r,o,c,p){if(null==t||"boolean"==typeof t)return"";if("object"!=typeof t)return i(t);var b=r.pretty,m=b&&"string"==typeof b?b:"\t";if(Array.isArray(t)){for(var _="",x=0;x<t.length;x++)b&&x>0&&(_+="\n"),_+=h(t[x],e,r,o,c,p);return _}var j,S=t.type,A=t.props,O=!1;if("function"==typeof S){if(O=!0,!r.shallow||!o&&!1!==r.renderRootComponent){if(S===n.Fragment){var w=[];return s(w,t.props.children),h(w,e,r,!1!==r.shallowHighOrder,c,p)}var k,F=t.__c={__v:t,context:e,props:t.props,setState:d,forceUpdate:d,data:{}};n.options.__b&&n.options.__b(t);var E=function(t,n){return{type:t.type,props:t.props,data:{},c:n}}(t,e);if(n.options.__r&&n.options.__r(E),S.prototype&&"function"==typeof S.prototype.render){var C=S.contextType,M=C&&e[C.__c],N=null!=C?M?M.props.value:C.__:e;(F=t.__c=new S(A,N)).__v=t,F._dirty=F.__d=!0,F.props=A,null==F.state&&(F.state={}),null==F._nextState&&null==F.__s&&(F._nextState=F.__s=F.state),F.context=N,S.getDerivedStateFromProps?F.state=l(l({},F.state),S.getDerivedStateFromProps(F.props,F.state)):F.componentWillMount&&(F.componentWillMount(),F.state=F._nextState!==F.state?F._nextState:F.__s!==F.state?F.__s:F.state),k=F.render(F.props,F.state,F.context)}else{var D=S.contextType,H=D&&e[D.__c];k=S.call(t.__c,A,null!=D?H?H.props.value:D.__:e)}return F.getChildContext&&(e=l(l({},e),F.getChildContext())),n.options.diffed&&n.options.diffed(t),h(k,e,r,!1!==r.shallowHighOrder,c,p)}S=(j=S).displayName||j!==Function&&j.name||function(t){var n=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!n){for(var e=-1,r=y.length;r--;)if(y[r]===t){e=r;break}e<0&&(e=y.push(t)-1),n="UnnamedComponent"+e}return n}(j)}var I,$,T="<"+S;if(A){var U=Object.keys(A);r&&!0===r.sortAttributes&&U.sort();for(var W=0;W<U.length;W++){var L=U[W],P=A[L];if("children"!==L){if(!g.test(L)&&(r&&r.allAttributes||"key"!==L&&"ref"!==L&&"__self"!==L&&"__source"!==L)){if("defaultValue"===L)L="value";else if("className"===L){if(void 0!==A.class)continue;L="class"}else c&&L.match(/^xlink:?./)&&(L=L.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===L){if(A.for)continue;L="for"}"style"===L&&P&&"object"==typeof P&&(P=f(P)),"a"===L[0]&&"r"===L[1]&&"boolean"==typeof P&&(P=String(P));var R=r.attributeHook&&r.attributeHook(L,P,e,r,O);if(R||""===R)T+=R;else if("dangerouslySetInnerHTML"===L)$=P&&P.__html;else if("textarea"===S&&"value"===L)I=P;else if((P||0===P||""===P)&&"function"!=typeof P){if(!(!0!==P&&""!==P||(P=L,r&&r.xml))){T+=" "+L;continue}if("value"===L){if("select"===S){p=P;continue}"option"===S&&p==P&&(T+=" selected")}T+=" "+L+'="'+i(P)+'"'}}}else I=P}}if(b){var J=T.replace(/\n\s*/," ");J===T||~J.indexOf("\n")?b&&~T.indexOf("\n")&&(T+="\n"):T=J}if(T+=">",g.test(S))throw new Error(S+" is not a valid HTML tag name in "+T);var q,V=v.test(S)||r.voidElements&&r.voidElements.test(S),z=[];if($)b&&u($)&&($="\n"+m+a($,m)),T+=$;else if(null!=I&&s(q=[],I).length){for(var B=b&&~T.indexOf("\n"),G=!1,Z=0;Z<q.length;Z++){var K=q[Z];if(null!=K&&!1!==K){var Q=h(K,e,r,!0,"svg"===S||"foreignObject"!==S&&c,p);if(b&&!B&&u(Q)&&(B=!0),Q)if(b){var X=Q.length>0&&"<"!=Q[0];G&&X?z[z.length-1]+=Q:z.push(Q),G=X}else z.push(Q)}}if(b&&B)for(var Y=z.length;Y--;)z[Y]="\n"+m+a(z[Y],m)}if(z.length||$)T+=z.join("");else if(r&&r.xml)return T.substring(0,T.length-1)+" />";return!V||q||$?(b&&~T.indexOf("\n")&&(T+="\n"),T+="</"+S+">"):T=T.replace(/>$/," />"),T}m.shallowRender=function(t,n){return m(t,n,p)};var _=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,w=/^Symbol\((.*)\)(.*)$/,k=/\n/gi,F=Object.getOwnPropertySymbols||function(t){return[]};function E(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function C(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function M(t){return O.call(t).replace(w,"Symbol($1)")}function N(t){return"["+S.call(t)+"]"}function D(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";var n=typeof t;if("number"===n)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===n)return'"'+function(t){return t.replace(_,"\\$1")}(t)+'"';if("function"===n)return C(t);if("symbol"===n)return M(t);var e=x.call(t);return"[object WeakMap]"===e?"WeakMap {}":"[object WeakSet]"===e?"WeakSet {}":"[object Function]"===e||"[object GeneratorFunction]"===e?C(t,min):"[object Symbol]"===e?M(t):"[object Date]"===e?j.call(t):"[object Error]"===e?N(t):"[object RegExp]"===e?A.call(t):"[object Arguments]"===e&&0===t.length?"Arguments []":E(e)&&0===t.length?t.constructor.name+" []":t instanceof Error&&N(t)}function H(t,n,e,r,o,i,a,u,c,f){var l="";if(t.length){l+=o;for(var s=e+n,p=0;p<t.length;p++)l+=s+T(t[p],n,s,r,o,i,a,u,c,f),p<t.length-1&&(l+=","+r);l+=o+e}return"["+l+"]"}function I(t,n,e,r,o,i,a,u,c,f){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var l=++u>a;if(!l&&t.toJSON&&"function"==typeof t.toJSON)return T(t.toJSON(),n,e,r,o,i,a,u,c,f);var s=x.call(t);return"[object Arguments]"===s?l?"[Arguments]":function(t,n,e,r,o,i,a,u,c,f){return(f?"":"Arguments ")+H(t,n,e,r,o,i,a,u,c,f)}(t,n,e,r,o,i,a,u,c,f):E(s)?l?"[Array]":function(t,n,e,r,o,i,a,u,c,f){return(f?"":t.constructor.name+" ")+H(t,n,e,r,o,i,a,u,c,f)}(t,n,e,r,o,i,a,u,c,f):"[object Map]"===s?l?"[Map]":function(t,n,e,r,o,i,a,u,c,f){var l="Map {",s=t.entries(),p=s.next();if(!p.done){l+=o;for(var y=e+n;!p.done;)l+=y+T(p.value[0],n,y,r,o,i,a,u,c,f)+" => "+T(p.value[1],n,y,r,o,i,a,u,c,f),(p=s.next()).done||(l+=","+r);l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):"[object Set]"===s?l?"[Set]":function(t,n,e,r,o,i,a,u,c,f){var l="Set {",s=t.entries(),p=s.next();if(!p.done){l+=o;for(var y=e+n;!p.done;)l+=y+T(p.value[1],n,y,r,o,i,a,u,c,f),(p=s.next()).done||(l+=","+r);l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):"object"==typeof t?l?"[Object]":function(t,n,e,r,o,i,a,u,c,f){var l=(f?"":t.constructor?t.constructor.name+" ":"Object ")+"{",s=Object.keys(t).sort(),p=F(t);if(p.length&&(s=s.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===x.call(t))}).concat(p)),s.length){l+=o;for(var y=e+n,v=0;v<s.length;v++){var g=s[v];l+=y+T(g,n,y,r,o,i,a,u,c,f)+": "+T(t[g],n,y,r,o,i,a,u,c,f),v<s.length-1&&(l+=","+r)}l+=o+e}return l+"}"}(t,n,e,r,o,i,a,u,c,f):void 0}function $(t,n,e,r,o,i,a,u,c,f){for(var l,s=!1,p=0;p<c.length;p++)if((l=c[p]).test(t)){s=!0;break}return!!s&&l.print(t,function(t){return T(t,n,e,r,o,i,a,u,c,f)},function(t){var r=e+n;return r+t.replace(k,"\n"+r)},{edgeSpacing:o,spacing:r})}function T(t,n,e,r,o,i,a,u,c,f){return D(t)||$(t,n,e,r,o,i,a,u,c,f)||I(t,n,e,r,o,i,a,u,c,f)}var U={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function W(t){return new Array(t+1).join(" ")}var L={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,n,e){return m(t,L.context,L.opts)}},P={plugins:[L]},R={attributeHook:function(t,n,e,r,o){var u=typeof n;if("dangerouslySetInnerHTML"===t)return!1;if(null==n||"function"===u&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===n||("class"===t||"style"===t)&&""===n))return"";var c="string"==typeof r.pretty?r.pretty:"\t";return"string"!==u?("function"!==u||r.functionNames?(L.context=e,L.opts=r,~(n=function(t,n){var e,r;n?(function(t){if(Object.keys(t).forEach(function(t){if(!U.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(n),n=function(t){var n={};return Object.keys(U).forEach(function(e){return n[e]=t.hasOwnProperty(e)?t[e]:U[e]}),n.min&&(n.indent=0),n}(n)):n=U;var o=n.min?" ":"\n",i=n.min?"":"\n";if(n&&n.plugins.length){var a=$(t,e=W(n.indent),"",o,i,r=[],n.maxDepth,0,n.plugins,n.min);if(a)return a}return D(t)||(e||(e=W(n.indent)),r||(r=[]),I(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min))}(n,P)).indexOf("\n")&&(n=a("\n"+n,c)+"\n")):n="Function",a("\n"+t+"={"+n+"}",c)):"\n"+c+t+'="'+i(n)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function J(t,n,e,r){return m(t,n,e=l(l({},R),e||{}))}t.default=J,t.render=J},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(self.preactRenderToString={},(void 0).preact); | ||
//# sourceMappingURL=jsx.js.map |
@@ -1,2 +0,2 @@ | ||
import{options as t,Fragment as e}from"preact";if("function"!=typeof Symbol){let t=0;Symbol=function(e){return`@@${e}${++t}`},Symbol.for=t=>`@@${t}`}const n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(t){const e=String(t);return r.test(e)?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):e}let i=(t,e)=>String(t).replace(/(\n+)/g,"$1"+(e||"\t")),l=(t,e,n)=>String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<");const c={};function u(t){let e="";for(let r in t){let o=t[r];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==r[0]?r:c[r]||(c[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),e+=": ",e+=o,"number"==typeof o&&!1===n.test(r)&&(e+="px"),e+=";")}return e||void 0}function s(t,e){for(let n in e)t[n]=e[n];return t}function a(t,e){return Array.isArray(e)?e.reduce(a,t):null!=e&&!1!==e&&t.push(e),t}const f={shallow:!0},p=[],y=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,g=/[\s\n\\/='"\0<>]/,b=()=>{};d.render=d;const m=[];function d(e,n,r){n=n||{},r=r||{};const o=t.__s;t.__s=!0;const i=_(e,n,r);return t.__c&&t.__c(e,m),m.length=0,t.__s=o,i}function _(n,r,c,f,m,d){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return o(n);let h=c.pretty,x=h&&"string"==typeof h?h:"\t";if(Array.isArray(n)){let t="";for(let e=0;e<n.length;e++)h&&e>0&&(t+="\n"),t+=_(n[e],r,c,f,m,d);return t}let j=n.type,S=n.props,A=!1;if("function"==typeof j){if(A=!0,!c.shallow||!f&&!1!==c.renderRootComponent){if(j===e){const t=[];return a(t,n.props.children),_(t,r,c,!1!==c.shallowHighOrder,m,d)}{let e,o=n.__c={__v:n,context:r,props:n.props,setState:b,forceUpdate:b,__h:[]};if(t.__b&&t.__b(n),t.__r&&t.__r(n),j.prototype&&"function"==typeof j.prototype.render){let t=j.contextType,i=t&&r[t.__c],l=null!=t?i?i.props.value:t.__:r;o=n.__c=new j(S,l),o.__v=n,o._dirty=o.__d=!0,o.props=S,null==o.state&&(o.state={}),null==o._nextState&&null==o.__s&&(o._nextState=o.__s=o.state),o.context=l,j.getDerivedStateFromProps?o.state=s(s({},o.state),j.getDerivedStateFromProps(o.props,o.state)):o.componentWillMount&&(o.componentWillMount(),o.state=o._nextState!==o.state?o._nextState:o.__s!==o.state?o.__s:o.state),e=o.render(o.props,o.state,o.context)}else{let t=j.contextType,o=t&&r[t.__c];e=j.call(n.__c,S,null!=t?o?o.props.value:t.__:r)}return o.getChildContext&&(r=s(s({},r),o.getChildContext())),t.diffed&&t.diffed(n),_(e,r,c,!1!==c.shallowHighOrder,m,d)}}j=(O=j).displayName||O!==Function&&O.name||function(t){let e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){let n=-1;for(let e=p.length;e--;)if(p[e]===t){n=e;break}n<0&&(n=p.push(t)-1),e=`UnnamedComponent${n}`}return e}(O)}var O;let w,$,k="<"+j;if(S){let t=Object.keys(S);c&&!0===c.sortAttributes&&t.sort();for(let e=0;e<t.length;e++){let n=t[e],i=S[n];if("children"===n){w=i;continue}if(g.test(n))continue;if(!(c&&c.allAttributes||"key"!==n&&"ref"!==n&&"__self"!==n&&"__source"!==n&&"defaultValue"!==n))continue;if("className"===n){if(S.class)continue;n="class"}else m&&n.match(/^xlink:?./)&&(n=n.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===n){if(S.for)continue;n="for"}"style"===n&&i&&"object"==typeof i&&(i=u(i)),"a"===n[0]&&"r"===n[1]&&"boolean"==typeof i&&(i=String(i));let l=c.attributeHook&&c.attributeHook(n,i,r,c,A);if(l||""===l)k+=l;else if("dangerouslySetInnerHTML"===n)$=i&&i.__html;else if("textarea"===j&&"value"===n)w=i;else if((i||0===i||""===i)&&"function"!=typeof i){if(!(!0!==i&&""!==i||(i=n,c&&c.xml))){k+=" "+n;continue}if("value"===n){if("select"===j){d=i;continue}"option"===j&&d==i&&(k+=" selected")}k+=` ${n}="${o(i)}"`}}}if(h){let t=k.replace(/\n\s*/," ");t===k||~t.indexOf("\n")?h&&~k.indexOf("\n")&&(k+="\n"):k=t}if(k+=">",g.test(j))throw new Error(`${j} is not a valid HTML tag name in ${k}`);let v,F=y.test(j)||c.voidElements&&c.voidElements.test(j),E=[];if($)h&&l($)&&($="\n"+x+i($,x)),k+=$;else if(null!=w&&a(v=[],w).length){let t=h&&~k.indexOf("\n"),e=!1;for(let n=0;n<v.length;n++){let o=v[n];if(null!=o&&!1!==o){let n=_(o,r,c,!0,"svg"===j||"foreignObject"!==j&&m,d);if(h&&!t&&l(n)&&(t=!0),n)if(h){let t=n.length>0&&"<"!=n[0];e&&t?E[E.length-1]+=n:E.push(n),e=t}else E.push(n)}}if(h&&t)for(let t=E.length;t--;)E[t]="\n"+x+i(E[t],x)}if(E.length||$)k+=E.join("");else if(c&&c.xml)return k.substring(0,k.length-1)+" />";return!F||v||$?(h&&~k.indexOf("\n")&&(k+="\n"),k+=`</${j}>`):k=k.replace(/>$/," />"),k}d.shallowRender=(t,e)=>d(t,e,f);const h=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,w=/^Symbol\((.*)\)(.*)$/,$=/\n/gi,k=Object.getOwnPropertySymbols||(t=>[]);function v(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function F(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function E(t){return O.call(t).replace(w,"Symbol($1)")}function C(t){return"["+S.call(t)+"]"}function M(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";const e=typeof t;if("number"===e)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===e)return'"'+function(t){return t.replace(h,"\\$1")}(t)+'"';if("function"===e)return F(t);if("symbol"===e)return E(t);const n=x.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?F(t,min):"[object Symbol]"===n?E(t):"[object Date]"===n?j.call(t):"[object Error]"===n?C(t):"[object RegExp]"===n?A.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":v(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&C(t)}function N(t,e,n,r,o,i,l,c,u,s){let a="";if(t.length){a+=o;const f=n+e;for(let n=0;n<t.length;n++)a+=f+I(t[n],e,f,r,o,i,l,c,u,s),n<t.length-1&&(a+=","+r);a+=o+n}return"["+a+"]"}function D(t,e,n,r,o,i,l,c,u,s){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const a=++c>l;if(!a&&t.toJSON&&"function"==typeof t.toJSON)return I(t.toJSON(),e,n,r,o,i,l,c,u,s);const f=x.call(t);return"[object Arguments]"===f?a?"[Arguments]":function(t,e,n,r,o,i,l,c,u,s){return(s?"":"Arguments ")+N(t,e,n,r,o,i,l,c,u,s)}(t,e,n,r,o,i,l,c,u,s):v(f)?a?"[Array]":function(t,e,n,r,o,i,l,c,u,s){return(s?"":t.constructor.name+" ")+N(t,e,n,r,o,i,l,c,u,s)}(t,e,n,r,o,i,l,c,u,s):"[object Map]"===f?a?"[Map]":function(t,e,n,r,o,i,l,c,u,s){let a="Map {";const f=t.entries();let p=f.next();if(!p.done){a+=o;const t=n+e;for(;!p.done;)a+=t+I(p.value[0],e,t,r,o,i,l,c,u,s)+" => "+I(p.value[1],e,t,r,o,i,l,c,u,s),p=f.next(),p.done||(a+=","+r);a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):"[object Set]"===f?a?"[Set]":function(t,e,n,r,o,i,l,c,u,s){let a="Set {";const f=t.entries();let p=f.next();if(!p.done){a+=o;const t=n+e;for(;!p.done;)a+=t+I(p.value[1],e,t,r,o,i,l,c,u,s),p=f.next(),p.done||(a+=","+r);a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):"object"==typeof t?a?"[Object]":function(t,e,n,r,o,i,l,c,u,s){let a=(s?"":t.constructor?t.constructor.name+" ":"Object ")+"{",f=Object.keys(t).sort();const p=k(t);if(p.length&&(f=f.filter(t=>!("symbol"==typeof t||"[object Symbol]"===x.call(t))).concat(p)),f.length){a+=o;const p=n+e;for(let n=0;n<f.length;n++){const y=f[n];a+=p+I(y,e,p,r,o,i,l,c,u,s)+": "+I(t[y],e,p,r,o,i,l,c,u,s),n<f.length-1&&(a+=","+r)}a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):void 0}function H(t,e,n,r,o,i,l,c,u,s){let a,f=!1;for(let e=0;e<u.length;e++)if(a=u[e],a.test(t)){f=!0;break}return!!f&&a.print(t,function(t){return I(t,e,n,r,o,i,l,c,u,s)},function(t){const r=n+e;return r+t.replace($,"\n"+r)},{edgeSpacing:o,spacing:r})}function I(t,e,n,r,o,i,l,c,u,s){return M(t)||H(t,e,n,r,o,i,l,c,u,s)||D(t,e,n,r,o,i,l,c,u,s)}const U={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function W(t){return new Array(t+1).join(" ")}let L={test:t=>t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t,print:(t,e,n)=>d(t,L.context,L.opts)},P={plugins:[L]},T={attributeHook:function(t,e,n,r,l){let c=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===c&&!r.functions)return"";if(r.skipFalseAttributes&&!l&&(!1===e||("class"===t||"style"===t)&&""===e))return"";let u="string"==typeof r.pretty?r.pretty:"\t";return"string"!==c?("function"!==c||r.functionNames?(L.context=n,L.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!U.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(e),e=function(t){const e={};return Object.keys(U).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:U[n]),e.min&&(e.indent=0),e}(e)):e=U;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=W(e.indent),r=[];var l=H(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(l)return l}return M(t)||(n||(n=W(e.indent)),r||(r=[]),D(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,P)).indexOf("\n")&&(e=`${i("\n"+e,u)}\n`)):e="Function",i(`\n${t}={${e}}`,u)):`\n${u}${t}="${o(e)}"`},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function R(t,e,n,r){return d(t,e,n=s(s({},T),n||{}))}export default R;export{R as render}; | ||
import{options as t,Fragment as e}from"preact";if("function"!=typeof Symbol){let t=0;Symbol=function(e){return`@@${e}${++t}`},Symbol.for=t=>`@@${t}`}const n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(t){const e=String(t);return r.test(e)?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):e}let i=(t,e)=>String(t).replace(/(\n+)/g,"$1"+(e||"\t")),l=(t,e,n)=>String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<");const c={};function u(t){let e="";for(let r in t){let o=t[r];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==r[0]?r:c[r]||(c[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),e+=": ",e+=o,"number"==typeof o&&!1===n.test(r)&&(e+="px"),e+=";")}return e||void 0}function s(t,e){for(let n in e)t[n]=e[n];return t}function a(t,e){return Array.isArray(e)?e.reduce(a,t):null!=e&&!1!==e&&t.push(e),t}const f={shallow:!0},p=[],y=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,g=/[\s\n\\/='"\0<>]/,b=()=>{};m.render=m;const d=[];function m(e,n,r){n=n||{},r=r||{};const o=t.__s;t.__s=!0;const i=h(e,n,r);return t.__c&&t.__c(e,d),d.length=0,t.__s=o,i}function h(n,r,c,f,d,m){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return o(n);let _=c.pretty,x=_&&"string"==typeof _?_:"\t";if(Array.isArray(n)){let t="";for(let e=0;e<n.length;e++)_&&e>0&&(t+="\n"),t+=h(n[e],r,c,f,d,m);return t}let j=n.type,S=n.props,A=!1;if("function"==typeof j){if(A=!0,!c.shallow||!f&&!1!==c.renderRootComponent){if(j===e){const t=[];return a(t,n.props.children),h(t,r,c,!1!==c.shallowHighOrder,d,m)}{let e,o=n.__c={__v:n,context:r,props:n.props,setState:b,forceUpdate:b,data:{}};t.__b&&t.__b(n);const i=function(t,e){return{type:t.type,props:t.props,data:{},c:e}}(n,r);if(t.__r&&t.__r(i),j.prototype&&"function"==typeof j.prototype.render){let t=j.contextType,i=t&&r[t.__c],l=null!=t?i?i.props.value:t.__:r;o=n.__c=new j(S,l),o.__v=n,o._dirty=o.__d=!0,o.props=S,null==o.state&&(o.state={}),null==o._nextState&&null==o.__s&&(o._nextState=o.__s=o.state),o.context=l,j.getDerivedStateFromProps?o.state=s(s({},o.state),j.getDerivedStateFromProps(o.props,o.state)):o.componentWillMount&&(o.componentWillMount(),o.state=o._nextState!==o.state?o._nextState:o.__s!==o.state?o.__s:o.state),e=o.render(o.props,o.state,o.context)}else{let t=j.contextType,o=t&&r[t.__c];e=j.call(n.__c,S,null!=t?o?o.props.value:t.__:r)}return o.getChildContext&&(r=s(s({},r),o.getChildContext())),t.diffed&&t.diffed(n),h(e,r,c,!1!==c.shallowHighOrder,d,m)}}j=(O=j).displayName||O!==Function&&O.name||function(t){let e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){let n=-1;for(let e=p.length;e--;)if(p[e]===t){n=e;break}n<0&&(n=p.push(t)-1),e=`UnnamedComponent${n}`}return e}(O)}var O;let v,w,$="<"+j;if(S){let t=Object.keys(S);c&&!0===c.sortAttributes&&t.sort();for(let e=0;e<t.length;e++){let n=t[e],i=S[n];if("children"===n){v=i;continue}if(g.test(n))continue;if(!(c&&c.allAttributes||"key"!==n&&"ref"!==n&&"__self"!==n&&"__source"!==n))continue;if("defaultValue"===n)n="value";else if("className"===n){if(void 0!==S.class)continue;n="class"}else d&&n.match(/^xlink:?./)&&(n=n.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===n){if(S.for)continue;n="for"}"style"===n&&i&&"object"==typeof i&&(i=u(i)),"a"===n[0]&&"r"===n[1]&&"boolean"==typeof i&&(i=String(i));let l=c.attributeHook&&c.attributeHook(n,i,r,c,A);if(l||""===l)$+=l;else if("dangerouslySetInnerHTML"===n)w=i&&i.__html;else if("textarea"===j&&"value"===n)v=i;else if((i||0===i||""===i)&&"function"!=typeof i){if(!(!0!==i&&""!==i||(i=n,c&&c.xml))){$+=" "+n;continue}if("value"===n){if("select"===j){m=i;continue}"option"===j&&m==i&&($+=" selected")}$+=` ${n}="${o(i)}"`}}}if(_){let t=$.replace(/\n\s*/," ");t===$||~t.indexOf("\n")?_&&~$.indexOf("\n")&&($+="\n"):$=t}if($+=">",g.test(j))throw new Error(`${j} is not a valid HTML tag name in ${$}`);let k,F=y.test(j)||c.voidElements&&c.voidElements.test(j),E=[];if(w)_&&l(w)&&(w="\n"+x+i(w,x)),$+=w;else if(null!=v&&a(k=[],v).length){let t=_&&~$.indexOf("\n"),e=!1;for(let n=0;n<k.length;n++){let o=k[n];if(null!=o&&!1!==o){let n=h(o,r,c,!0,"svg"===j||"foreignObject"!==j&&d,m);if(_&&!t&&l(n)&&(t=!0),n)if(_){let t=n.length>0&&"<"!=n[0];e&&t?E[E.length-1]+=n:E.push(n),e=t}else E.push(n)}}if(_&&t)for(let t=E.length;t--;)E[t]="\n"+x+i(E[t],x)}if(E.length||w)$+=E.join("");else if(c&&c.xml)return $.substring(0,$.length-1)+" />";return!F||k||w?(_&&~$.indexOf("\n")&&($+="\n"),$+=`</${j}>`):$=$.replace(/>$/," />"),$}m.shallowRender=(t,e)=>m(t,e,f);const _=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,v=/^Symbol\((.*)\)(.*)$/,w=/\n/gi,$=Object.getOwnPropertySymbols||(t=>[]);function k(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function F(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function E(t){return O.call(t).replace(v,"Symbol($1)")}function C(t){return"["+S.call(t)+"]"}function M(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";const e=typeof t;if("number"===e)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===e)return'"'+function(t){return t.replace(_,"\\$1")}(t)+'"';if("function"===e)return F(t);if("symbol"===e)return E(t);const n=x.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?F(t,min):"[object Symbol]"===n?E(t):"[object Date]"===n?j.call(t):"[object Error]"===n?C(t):"[object RegExp]"===n?A.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":k(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&C(t)}function N(t,e,n,r,o,i,l,c,u,s){let a="";if(t.length){a+=o;const f=n+e;for(let n=0;n<t.length;n++)a+=f+I(t[n],e,f,r,o,i,l,c,u,s),n<t.length-1&&(a+=","+r);a+=o+n}return"["+a+"]"}function D(t,e,n,r,o,i,l,c,u,s){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const a=++c>l;if(!a&&t.toJSON&&"function"==typeof t.toJSON)return I(t.toJSON(),e,n,r,o,i,l,c,u,s);const f=x.call(t);return"[object Arguments]"===f?a?"[Arguments]":function(t,e,n,r,o,i,l,c,u,s){return(s?"":"Arguments ")+N(t,e,n,r,o,i,l,c,u,s)}(t,e,n,r,o,i,l,c,u,s):k(f)?a?"[Array]":function(t,e,n,r,o,i,l,c,u,s){return(s?"":t.constructor.name+" ")+N(t,e,n,r,o,i,l,c,u,s)}(t,e,n,r,o,i,l,c,u,s):"[object Map]"===f?a?"[Map]":function(t,e,n,r,o,i,l,c,u,s){let a="Map {";const f=t.entries();let p=f.next();if(!p.done){a+=o;const t=n+e;for(;!p.done;)a+=t+I(p.value[0],e,t,r,o,i,l,c,u,s)+" => "+I(p.value[1],e,t,r,o,i,l,c,u,s),p=f.next(),p.done||(a+=","+r);a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):"[object Set]"===f?a?"[Set]":function(t,e,n,r,o,i,l,c,u,s){let a="Set {";const f=t.entries();let p=f.next();if(!p.done){a+=o;const t=n+e;for(;!p.done;)a+=t+I(p.value[1],e,t,r,o,i,l,c,u,s),p=f.next(),p.done||(a+=","+r);a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):"object"==typeof t?a?"[Object]":function(t,e,n,r,o,i,l,c,u,s){let a=(s?"":t.constructor?t.constructor.name+" ":"Object ")+"{",f=Object.keys(t).sort();const p=$(t);if(p.length&&(f=f.filter(t=>!("symbol"==typeof t||"[object Symbol]"===x.call(t))).concat(p)),f.length){a+=o;const p=n+e;for(let n=0;n<f.length;n++){const y=f[n];a+=p+I(y,e,p,r,o,i,l,c,u,s)+": "+I(t[y],e,p,r,o,i,l,c,u,s),n<f.length-1&&(a+=","+r)}a+=o+n}return a+"}"}(t,e,n,r,o,i,l,c,u,s):void 0}function H(t,e,n,r,o,i,l,c,u,s){let a,f=!1;for(let e=0;e<u.length;e++)if(a=u[e],a.test(t)){f=!0;break}return!!f&&a.print(t,function(t){return I(t,e,n,r,o,i,l,c,u,s)},function(t){const r=n+e;return r+t.replace(w,"\n"+r)},{edgeSpacing:o,spacing:r})}function I(t,e,n,r,o,i,l,c,u,s){return M(t)||H(t,e,n,r,o,i,l,c,u,s)||D(t,e,n,r,o,i,l,c,u,s)}const U={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function W(t){return new Array(t+1).join(" ")}let L={test:t=>t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t,print:(t,e,n)=>m(t,L.context,L.opts)},P={plugins:[L]},T={attributeHook:function(t,e,n,r,l){let c=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===c&&!r.functions)return"";if(r.skipFalseAttributes&&!l&&(!1===e||("class"===t||"style"===t)&&""===e))return"";let u="string"==typeof r.pretty?r.pretty:"\t";return"string"!==c?("function"!==c||r.functionNames?(L.context=n,L.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!U.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(e),e=function(t){const e={};return Object.keys(U).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:U[n]),e.min&&(e.indent=0),e}(e)):e=U;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=W(e.indent),r=[];var l=H(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(l)return l}return M(t)||(n||(n=W(e.indent)),r||(r=[]),D(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,P)).indexOf("\n")&&(e=`${i("\n"+e,u)}\n`)):e="Function",i(`\n${t}={${e}}`,u)):`\n${u}${t}="${o(e)}"`},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function R(t,e,n,r){return m(t,e,n=s(s({},T),n||{}))}export default R;export{R as render}; | ||
//# sourceMappingURL=jsx.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import{options as t,Fragment as n}from"preact";if("function"!=typeof Symbol){var e=0;Symbol=function(t){return"@@"+t+ ++e},Symbol.for=function(t){return"@@"+t}}var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,o=/[&<>"]/;function i(t){var n=String(t);return o.test(n)?n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):n}var a=function(t,n){return String(t).replace(/(\n+)/g,"$1"+(n||"\t"))},c=function(t,n,e){return String(t).length>(n||40)||!e&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},u={};function l(t){var n="";for(var e in t){var o=t[e];null!=o&&""!==o&&(n&&(n+=" "),n+="-"==e[0]?e:u[e]||(u[e]=e.replace(/([A-Z])/g,"-$1").toLowerCase()),n+=": ",n+=o,"number"==typeof o&&!1===r.test(e)&&(n+="px"),n+=";")}return n||void 0}function f(t,n){for(var e in n)t[e]=n[e];return t}function s(t,n){return Array.isArray(n)?n.reduce(s,t):null!=n&&!1!==n&&t.push(n),t}var p={shallow:!0},y=[],g=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,b=/[\s\n\\/='"\0<>]/,m=function(){};_.render=_;var d=[];function _(n,e,r){e=e||{},r=r||{};var o=t.__s;t.__s=!0;var i=h(n,e,r);return t.__c&&t.__c(n,d),d.length=0,t.__s=o,i}function h(e,r,o,u,p,d){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return i(e);var _=o.pretty,v=_&&"string"==typeof _?_:"\t";if(Array.isArray(e)){for(var x="",j=0;j<e.length;j++)_&&j>0&&(x+="\n"),x+=h(e[j],r,o,u,p,d);return x}var S,A=e.type,O=e.props,w=!1;if("function"==typeof A){if(w=!0,!o.shallow||!u&&!1!==o.renderRootComponent){if(A===n){var k=[];return s(k,e.props.children),h(k,r,o,!1!==o.shallowHighOrder,p,d)}var F,E=e.__c={__v:e,context:r,props:e.props,setState:m,forceUpdate:m,__h:[]};if(t.__b&&t.__b(e),t.__r&&t.__r(e),A.prototype&&"function"==typeof A.prototype.render){var C=A.contextType,M=C&&r[C.__c],N=null!=C?M?M.props.value:C.__:r;(E=e.__c=new A(O,N)).__v=e,E._dirty=E.__d=!0,E.props=O,null==E.state&&(E.state={}),null==E._nextState&&null==E.__s&&(E._nextState=E.__s=E.state),E.context=N,A.getDerivedStateFromProps?E.state=f(f({},E.state),A.getDerivedStateFromProps(E.props,E.state)):E.componentWillMount&&(E.componentWillMount(),E.state=E._nextState!==E.state?E._nextState:E.__s!==E.state?E.__s:E.state),F=E.render(E.props,E.state,E.context)}else{var D=A.contextType,H=D&&r[D.__c];F=A.call(e.__c,O,null!=D?H?H.props.value:D.__:r)}return E.getChildContext&&(r=f(f({},r),E.getChildContext())),t.diffed&&t.diffed(e),h(F,r,o,!1!==o.shallowHighOrder,p,d)}A=(S=A).displayName||S!==Function&&S.name||function(t){var n=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!n){for(var e=-1,r=y.length;r--;)if(y[r]===t){e=r;break}e<0&&(e=y.push(t)-1),n="UnnamedComponent"+e}return n}(S)}var I,$,U="<"+A;if(O){var W=Object.keys(O);o&&!0===o.sortAttributes&&W.sort();for(var L=0;L<W.length;L++){var P=W[L],T=O[P];if("children"!==P){if(!b.test(P)&&(o&&o.allAttributes||"key"!==P&&"ref"!==P&&"__self"!==P&&"__source"!==P&&"defaultValue"!==P)){if("className"===P){if(O.class)continue;P="class"}else p&&P.match(/^xlink:?./)&&(P=P.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===P){if(O.for)continue;P="for"}"style"===P&&T&&"object"==typeof T&&(T=l(T)),"a"===P[0]&&"r"===P[1]&&"boolean"==typeof T&&(T=String(T));var R=o.attributeHook&&o.attributeHook(P,T,r,o,w);if(R||""===R)U+=R;else if("dangerouslySetInnerHTML"===P)$=T&&T.__html;else if("textarea"===A&&"value"===P)I=T;else if((T||0===T||""===T)&&"function"!=typeof T){if(!(!0!==T&&""!==T||(T=P,o&&o.xml))){U+=" "+P;continue}if("value"===P){if("select"===A){d=T;continue}"option"===A&&d==T&&(U+=" selected")}U+=" "+P+'="'+i(T)+'"'}}}else I=T}}if(_){var J=U.replace(/\n\s*/," ");J===U||~J.indexOf("\n")?_&&~U.indexOf("\n")&&(U+="\n"):U=J}if(U+=">",b.test(A))throw new Error(A+" is not a valid HTML tag name in "+U);var V,q=g.test(A)||o.voidElements&&o.voidElements.test(A),z=[];if($)_&&c($)&&($="\n"+v+a($,v)),U+=$;else if(null!=I&&s(V=[],I).length){for(var B=_&&~U.indexOf("\n"),G=!1,Z=0;Z<V.length;Z++){var K=V[Z];if(null!=K&&!1!==K){var Q=h(K,r,o,!0,"svg"===A||"foreignObject"!==A&&p,d);if(_&&!B&&c(Q)&&(B=!0),Q)if(_){var X=Q.length>0&&"<"!=Q[0];G&&X?z[z.length-1]+=Q:z.push(Q),G=X}else z.push(Q)}}if(_&&B)for(var Y=z.length;Y--;)z[Y]="\n"+v+a(z[Y],v)}if(z.length||$)U+=z.join("");else if(o&&o.xml)return U.substring(0,U.length-1)+" />";return!q||V||$?(_&&~U.indexOf("\n")&&(U+="\n"),U+="</"+A+">"):U=U.replace(/>$/," />"),U}_.shallowRender=function(t,n){return _(t,n,p)};const v=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,w=/^Symbol\((.*)\)(.*)$/,k=/\n/gi,F=Object.getOwnPropertySymbols||(t=>[]);function E(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function C(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function M(t){return O.call(t).replace(w,"Symbol($1)")}function N(t){return"["+S.call(t)+"]"}function D(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";const n=typeof t;if("number"===n)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===n)return'"'+function(t){return t.replace(v,"\\$1")}(t)+'"';if("function"===n)return C(t);if("symbol"===n)return M(t);const e=x.call(t);return"[object WeakMap]"===e?"WeakMap {}":"[object WeakSet]"===e?"WeakSet {}":"[object Function]"===e||"[object GeneratorFunction]"===e?C(t,min):"[object Symbol]"===e?M(t):"[object Date]"===e?j.call(t):"[object Error]"===e?N(t):"[object RegExp]"===e?A.call(t):"[object Arguments]"===e&&0===t.length?"Arguments []":E(e)&&0===t.length?t.constructor.name+" []":t instanceof Error&&N(t)}function H(t,n,e,r,o,i,a,c,u,l){let f="";if(t.length){f+=o;const s=e+n;for(let e=0;e<t.length;e++)f+=s+U(t[e],n,s,r,o,i,a,c,u,l),e<t.length-1&&(f+=","+r);f+=o+e}return"["+f+"]"}function I(t,n,e,r,o,i,a,c,u,l){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const f=++c>a;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return U(t.toJSON(),n,e,r,o,i,a,c,u,l);const s=x.call(t);return"[object Arguments]"===s?f?"[Arguments]":function(t,n,e,r,o,i,a,c,u,l){return(l?"":"Arguments ")+H(t,n,e,r,o,i,a,c,u,l)}(t,n,e,r,o,i,a,c,u,l):E(s)?f?"[Array]":function(t,n,e,r,o,i,a,c,u,l){return(l?"":t.constructor.name+" ")+H(t,n,e,r,o,i,a,c,u,l)}(t,n,e,r,o,i,a,c,u,l):"[object Map]"===s?f?"[Map]":function(t,n,e,r,o,i,a,c,u,l){let f="Map {";const s=t.entries();let p=s.next();if(!p.done){f+=o;const t=e+n;for(;!p.done;)f+=t+U(p.value[0],n,t,r,o,i,a,c,u,l)+" => "+U(p.value[1],n,t,r,o,i,a,c,u,l),p=s.next(),p.done||(f+=","+r);f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):"[object Set]"===s?f?"[Set]":function(t,n,e,r,o,i,a,c,u,l){let f="Set {";const s=t.entries();let p=s.next();if(!p.done){f+=o;const t=e+n;for(;!p.done;)f+=t+U(p.value[1],n,t,r,o,i,a,c,u,l),p=s.next(),p.done||(f+=","+r);f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):"object"==typeof t?f?"[Object]":function(t,n,e,r,o,i,a,c,u,l){let f=(l?"":t.constructor?t.constructor.name+" ":"Object ")+"{",s=Object.keys(t).sort();const p=F(t);if(p.length&&(s=s.filter(t=>!("symbol"==typeof t||"[object Symbol]"===x.call(t))).concat(p)),s.length){f+=o;const p=e+n;for(let e=0;e<s.length;e++){const y=s[e];f+=p+U(y,n,p,r,o,i,a,c,u,l)+": "+U(t[y],n,p,r,o,i,a,c,u,l),e<s.length-1&&(f+=","+r)}f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):void 0}function $(t,n,e,r,o,i,a,c,u,l){let f,s=!1;for(let n=0;n<u.length;n++)if(f=u[n],f.test(t)){s=!0;break}return!!s&&f.print(t,function(t){return U(t,n,e,r,o,i,a,c,u,l)},function(t){const r=e+n;return r+t.replace(k,"\n"+r)},{edgeSpacing:o,spacing:r})}function U(t,n,e,r,o,i,a,c,u,l){return D(t)||$(t,n,e,r,o,i,a,c,u,l)||I(t,n,e,r,o,i,a,c,u,l)}const W={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function L(t){return new Array(t+1).join(" ")}var P={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,n,e){return _(t,P.context,P.opts)}},T={plugins:[P]},R={attributeHook:function(t,n,e,r,o){var c=typeof n;if("dangerouslySetInnerHTML"===t)return!1;if(null==n||"function"===c&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===n||("class"===t||"style"===t)&&""===n))return"";var u="string"==typeof r.pretty?r.pretty:"\t";return"string"!==c?("function"!==c||r.functionNames?(P.context=e,P.opts=r,~(n=function(t,n){let e,r;n?(function(t){if(Object.keys(t).forEach(t=>{if(!W.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(n),n=function(t){const n={};return Object.keys(W).forEach(e=>n[e]=t.hasOwnProperty(e)?t[e]:W[e]),n.min&&(n.indent=0),n}(n)):n=W;const o=n.min?" ":"\n",i=n.min?"":"\n";if(n&&n.plugins.length){e=L(n.indent),r=[];var a=$(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min);if(a)return a}return D(t)||(e||(e=L(n.indent)),r||(r=[]),I(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min))}(n,T)).indexOf("\n")&&(n=a("\n"+n,u)+"\n")):n="Function",a("\n"+t+"={"+n+"}",u)):"\n"+u+t+'="'+i(n)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function J(t,n,e,r){return _(t,n,e=f(f({},R),e||{}))}export default J;export{J as render}; | ||
import{options as t,Fragment as n}from"preact";if("function"!=typeof Symbol){var e=0;Symbol=function(t){return"@@"+t+ ++e},Symbol.for=function(t){return"@@"+t}}var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,o=/[&<>"]/;function i(t){var n=String(t);return o.test(n)?n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):n}var a=function(t,n){return String(t).replace(/(\n+)/g,"$1"+(n||"\t"))},c=function(t,n,e){return String(t).length>(n||40)||!e&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},u={};function l(t){var n="";for(var e in t){var o=t[e];null!=o&&""!==o&&(n&&(n+=" "),n+="-"==e[0]?e:u[e]||(u[e]=e.replace(/([A-Z])/g,"-$1").toLowerCase()),n+=": ",n+=o,"number"==typeof o&&!1===r.test(e)&&(n+="px"),n+=";")}return n||void 0}function f(t,n){for(var e in n)t[e]=n[e];return t}function s(t,n){return Array.isArray(n)?n.reduce(s,t):null!=n&&!1!==n&&t.push(n),t}var p={shallow:!0},y=[],g=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,b=/[\s\n\\/='"\0<>]/,d=function(){};v.render=v;var m=[];function v(n,e,r){e=e||{},r=r||{};var o=t.__s;t.__s=!0;var i=h(n,e,r);return t.__c&&t.__c(n,m),m.length=0,t.__s=o,i}function h(e,r,o,u,p,m){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return i(e);var v=o.pretty,_=v&&"string"==typeof v?v:"\t";if(Array.isArray(e)){for(var x="",j=0;j<e.length;j++)v&&j>0&&(x+="\n"),x+=h(e[j],r,o,u,p,m);return x}var S,A=e.type,O=e.props,w=!1;if("function"==typeof A){if(w=!0,!o.shallow||!u&&!1!==o.renderRootComponent){if(A===n){var k=[];return s(k,e.props.children),h(k,r,o,!1!==o.shallowHighOrder,p,m)}var F,E=e.__c={__v:e,context:r,props:e.props,setState:d,forceUpdate:d,data:{}};t.__b&&t.__b(e);var C=function(t,n){return{type:t.type,props:t.props,data:{},c:n}}(e,r);if(t.__r&&t.__r(C),A.prototype&&"function"==typeof A.prototype.render){var M=A.contextType,N=M&&r[M.__c],D=null!=M?N?N.props.value:M.__:r;(E=e.__c=new A(O,D)).__v=e,E._dirty=E.__d=!0,E.props=O,null==E.state&&(E.state={}),null==E._nextState&&null==E.__s&&(E._nextState=E.__s=E.state),E.context=D,A.getDerivedStateFromProps?E.state=f(f({},E.state),A.getDerivedStateFromProps(E.props,E.state)):E.componentWillMount&&(E.componentWillMount(),E.state=E._nextState!==E.state?E._nextState:E.__s!==E.state?E.__s:E.state),F=E.render(E.props,E.state,E.context)}else{var H=A.contextType,I=H&&r[H.__c];F=A.call(e.__c,O,null!=H?I?I.props.value:H.__:r)}return E.getChildContext&&(r=f(f({},r),E.getChildContext())),t.diffed&&t.diffed(e),h(F,r,o,!1!==o.shallowHighOrder,p,m)}A=(S=A).displayName||S!==Function&&S.name||function(t){var n=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!n){for(var e=-1,r=y.length;r--;)if(y[r]===t){e=r;break}e<0&&(e=y.push(t)-1),n="UnnamedComponent"+e}return n}(S)}var $,U,W="<"+A;if(O){var L=Object.keys(O);o&&!0===o.sortAttributes&&L.sort();for(var P=0;P<L.length;P++){var T=L[P],R=O[T];if("children"!==T){if(!b.test(T)&&(o&&o.allAttributes||"key"!==T&&"ref"!==T&&"__self"!==T&&"__source"!==T)){if("defaultValue"===T)T="value";else if("className"===T){if(void 0!==O.class)continue;T="class"}else p&&T.match(/^xlink:?./)&&(T=T.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===T){if(O.for)continue;T="for"}"style"===T&&R&&"object"==typeof R&&(R=l(R)),"a"===T[0]&&"r"===T[1]&&"boolean"==typeof R&&(R=String(R));var J=o.attributeHook&&o.attributeHook(T,R,r,o,w);if(J||""===J)W+=J;else if("dangerouslySetInnerHTML"===T)U=R&&R.__html;else if("textarea"===A&&"value"===T)$=R;else if((R||0===R||""===R)&&"function"!=typeof R){if(!(!0!==R&&""!==R||(R=T,o&&o.xml))){W+=" "+T;continue}if("value"===T){if("select"===A){m=R;continue}"option"===A&&m==R&&(W+=" selected")}W+=" "+T+'="'+i(R)+'"'}}}else $=R}}if(v){var V=W.replace(/\n\s*/," ");V===W||~V.indexOf("\n")?v&&~W.indexOf("\n")&&(W+="\n"):W=V}if(W+=">",b.test(A))throw new Error(A+" is not a valid HTML tag name in "+W);var q,z=g.test(A)||o.voidElements&&o.voidElements.test(A),B=[];if(U)v&&c(U)&&(U="\n"+_+a(U,_)),W+=U;else if(null!=$&&s(q=[],$).length){for(var G=v&&~W.indexOf("\n"),Z=!1,K=0;K<q.length;K++){var Q=q[K];if(null!=Q&&!1!==Q){var X=h(Q,r,o,!0,"svg"===A||"foreignObject"!==A&&p,m);if(v&&!G&&c(X)&&(G=!0),X)if(v){var Y=X.length>0&&"<"!=X[0];Z&&Y?B[B.length-1]+=X:B.push(X),Z=Y}else B.push(X)}}if(v&&G)for(var tt=B.length;tt--;)B[tt]="\n"+_+a(B[tt],_)}if(B.length||U)W+=B.join("");else if(o&&o.xml)return W.substring(0,W.length-1)+" />";return!z||q||U?(v&&~W.indexOf("\n")&&(W+="\n"),W+="</"+A+">"):W=W.replace(/>$/," />"),W}v.shallowRender=function(t,n){return v(t,n,p)};const _=/(\\|\"|\')/g,x=Object.prototype.toString,j=Date.prototype.toISOString,S=Error.prototype.toString,A=RegExp.prototype.toString,O=Symbol.prototype.toString,w=/^Symbol\((.*)\)(.*)$/,k=/\n/gi,F=Object.getOwnPropertySymbols||(t=>[]);function E(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function C(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function M(t){return O.call(t).replace(w,"Symbol($1)")}function N(t){return"["+S.call(t)+"]"}function D(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";const n=typeof t;if("number"===n)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===n)return'"'+function(t){return t.replace(_,"\\$1")}(t)+'"';if("function"===n)return C(t);if("symbol"===n)return M(t);const e=x.call(t);return"[object WeakMap]"===e?"WeakMap {}":"[object WeakSet]"===e?"WeakSet {}":"[object Function]"===e||"[object GeneratorFunction]"===e?C(t,min):"[object Symbol]"===e?M(t):"[object Date]"===e?j.call(t):"[object Error]"===e?N(t):"[object RegExp]"===e?A.call(t):"[object Arguments]"===e&&0===t.length?"Arguments []":E(e)&&0===t.length?t.constructor.name+" []":t instanceof Error&&N(t)}function H(t,n,e,r,o,i,a,c,u,l){let f="";if(t.length){f+=o;const s=e+n;for(let e=0;e<t.length;e++)f+=s+U(t[e],n,s,r,o,i,a,c,u,l),e<t.length-1&&(f+=","+r);f+=o+e}return"["+f+"]"}function I(t,n,e,r,o,i,a,c,u,l){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const f=++c>a;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return U(t.toJSON(),n,e,r,o,i,a,c,u,l);const s=x.call(t);return"[object Arguments]"===s?f?"[Arguments]":function(t,n,e,r,o,i,a,c,u,l){return(l?"":"Arguments ")+H(t,n,e,r,o,i,a,c,u,l)}(t,n,e,r,o,i,a,c,u,l):E(s)?f?"[Array]":function(t,n,e,r,o,i,a,c,u,l){return(l?"":t.constructor.name+" ")+H(t,n,e,r,o,i,a,c,u,l)}(t,n,e,r,o,i,a,c,u,l):"[object Map]"===s?f?"[Map]":function(t,n,e,r,o,i,a,c,u,l){let f="Map {";const s=t.entries();let p=s.next();if(!p.done){f+=o;const t=e+n;for(;!p.done;)f+=t+U(p.value[0],n,t,r,o,i,a,c,u,l)+" => "+U(p.value[1],n,t,r,o,i,a,c,u,l),p=s.next(),p.done||(f+=","+r);f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):"[object Set]"===s?f?"[Set]":function(t,n,e,r,o,i,a,c,u,l){let f="Set {";const s=t.entries();let p=s.next();if(!p.done){f+=o;const t=e+n;for(;!p.done;)f+=t+U(p.value[1],n,t,r,o,i,a,c,u,l),p=s.next(),p.done||(f+=","+r);f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):"object"==typeof t?f?"[Object]":function(t,n,e,r,o,i,a,c,u,l){let f=(l?"":t.constructor?t.constructor.name+" ":"Object ")+"{",s=Object.keys(t).sort();const p=F(t);if(p.length&&(s=s.filter(t=>!("symbol"==typeof t||"[object Symbol]"===x.call(t))).concat(p)),s.length){f+=o;const p=e+n;for(let e=0;e<s.length;e++){const y=s[e];f+=p+U(y,n,p,r,o,i,a,c,u,l)+": "+U(t[y],n,p,r,o,i,a,c,u,l),e<s.length-1&&(f+=","+r)}f+=o+e}return f+"}"}(t,n,e,r,o,i,a,c,u,l):void 0}function $(t,n,e,r,o,i,a,c,u,l){let f,s=!1;for(let n=0;n<u.length;n++)if(f=u[n],f.test(t)){s=!0;break}return!!s&&f.print(t,function(t){return U(t,n,e,r,o,i,a,c,u,l)},function(t){const r=e+n;return r+t.replace(k,"\n"+r)},{edgeSpacing:o,spacing:r})}function U(t,n,e,r,o,i,a,c,u,l){return D(t)||$(t,n,e,r,o,i,a,c,u,l)||I(t,n,e,r,o,i,a,c,u,l)}const W={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function L(t){return new Array(t+1).join(" ")}var P={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,n,e){return v(t,P.context,P.opts)}},T={plugins:[P]},R={attributeHook:function(t,n,e,r,o){var c=typeof n;if("dangerouslySetInnerHTML"===t)return!1;if(null==n||"function"===c&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===n||("class"===t||"style"===t)&&""===n))return"";var u="string"==typeof r.pretty?r.pretty:"\t";return"string"!==c?("function"!==c||r.functionNames?(P.context=e,P.opts=r,~(n=function(t,n){let e,r;n?(function(t){if(Object.keys(t).forEach(t=>{if(!W.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(n),n=function(t){const n={};return Object.keys(W).forEach(e=>n[e]=t.hasOwnProperty(e)?t[e]:W[e]),n.min&&(n.indent=0),n}(n)):n=W;const o=n.min?" ":"\n",i=n.min?"":"\n";if(n&&n.plugins.length){e=L(n.indent),r=[];var a=$(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min);if(a)return a}return D(t)||(e||(e=L(n.indent)),r||(r=[]),I(t,e,"",o,i,r,n.maxDepth,0,n.plugins,n.min))}(n,T)).indexOf("\n")&&(n=a("\n"+n,u)+"\n")):n="Function",a("\n"+t+"={"+n+"}",u)):"\n"+u+t+'="'+i(n)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function J(t,n,e,r){return v(t,n,e=f(f({},R),e||{}))}export default J;export{J as render}; | ||
//# sourceMappingURL=jsx.module.js.map |
{ | ||
"name": "preact-render-to-string", | ||
"amdName": "preactRenderToString", | ||
"version": "5.1.19", | ||
"version": "6.0.0-experimental.0", | ||
"description": "Render JSX to an HTML string, with support for Preact components.", | ||
@@ -33,3 +33,4 @@ "main": "dist/index.js", | ||
"test": "eslint src test && tsc && npm run test:mocha && npm run bench", | ||
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/**/*.test.js", | ||
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/**/[!compat]*.test.js && npm run test:mocha:compat", | ||
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/compat.test.js", | ||
"format": "prettier src/**/*.{d.ts,js} test/**/*.js --write", | ||
@@ -100,3 +101,3 @@ "prepublishOnly": "npm run build", | ||
"peerDependencies": { | ||
"preact": ">=10" | ||
"preact": ">=11" | ||
}, | ||
@@ -107,2 +108,4 @@ "devDependencies": { | ||
"@babel/register": "^7.12.10", | ||
"@changesets/cli": "^2.18.0", | ||
"@changesets/changelog-github": "^0.4.1", | ||
"benchmarkjs-pretty": "^2.0.1", | ||
@@ -117,3 +120,3 @@ "chai": "^4.2.0", | ||
"mocha": "^8.2.1", | ||
"preact": "^10.5.7", | ||
"preact": "^11.0.0-experimental.0", | ||
"prettier": "^2.2.1", | ||
@@ -120,0 +123,0 @@ "sinon": "^9.2.2", |
# preact-render-to-string | ||
[![NPM](http://img.shields.io/npm/v/preact-render-to-string.svg)](https://www.npmjs.com/package/preact-render-to-string) | ||
[![travis-ci](https://travis-ci.org/preactjs/preact-render-to-string.svg)](https://travis-ci.org/preactjs/preact-render-to-string) | ||
[![Build status](https://github.com/preactjs/preact-render-to-string/actions/workflows/ci.yml/badge.svg)](https://github.com/preactjs/preact-render-to-string/actions/workflows/ci.yml) | ||
@@ -6,0 +6,0 @@ Render JSX and [Preact] components to an HTML string. |
@@ -7,3 +7,4 @@ import { | ||
assign, | ||
getChildren | ||
getChildren, | ||
createInternalFromVnode | ||
} from './util'; | ||
@@ -131,3 +132,3 @@ import { options, Fragment } from 'preact'; | ||
// hooks | ||
__h: [] | ||
data: {} | ||
}); | ||
@@ -138,4 +139,5 @@ | ||
const internal = createInternalFromVnode(vnode, context); | ||
// options._render | ||
if (options.__r) options.__r(vnode); | ||
if (options.__r) options.__r(internal); | ||
@@ -246,9 +248,10 @@ if ( | ||
name === '__self' || | ||
name === '__source' || | ||
name === 'defaultValue') | ||
name === '__source') | ||
) | ||
continue; | ||
if (name === 'className') { | ||
if (props.class) continue; | ||
if (name === 'defaultValue') { | ||
name = 'value'; | ||
} else if (name === 'className') { | ||
if (typeof props.class !== 'undefined') continue; | ||
name = 'class'; | ||
@@ -255,0 +258,0 @@ } else if (isSvgMode && name.match(/^xlink:?./)) { |
@@ -79,1 +79,10 @@ // DOM properties that should NOT have "px" added when numeric | ||
} | ||
export function createInternalFromVnode(vnode, context) { | ||
return { | ||
type: vnode.type, | ||
props: vnode.props, | ||
data: {}, | ||
c: context | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
256660
801
19
3