preact-render-to-string 5.2.3 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +102 -102
- package/dist/commonjs.js +1 -1
- package/dist/commonjs.js.map +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/jsx-entry.js +1 -1
- package/dist/jsx-entry.js.map +1 -1
- package/dist/jsx.d.ts +13 -13
- package/dist/jsx.js.map +1 -1
- package/dist/jsx.mjs +1 -1
- package/dist/jsx.modern.js +1 -1
- package/dist/jsx.modern.js.map +1 -1
- package/dist/jsx.module.js +1 -1
- package/dist/jsx.module.js.map +1 -1
- package/jsx.js +1 -1
- package/package.json +148 -148
- package/src/constants.js +16 -14
- package/src/index.d.ts +16 -16
- package/src/index.js +396 -366
- package/src/jsx.d.ts +13 -13
- package/src/jsx.js +76 -76
- package/src/polyfills.js +8 -8
- package/src/pretty.js +385 -385
- package/src/util.js +125 -125
- package/typings.json +5 -5
package/dist/jsx-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t;t=function(t,e){if("function"!=typeof Symbol){var n=0;Symbol=function(t){return"@@"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\s\n\\/='"\0<>]/,a=/^xlink:?./,s=/["&<]/;function f(t){if(!1===s.test(t+=""))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var u=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},l=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},c={},p=/([A-Z])/g;function d(t){var e="";for(var n in t){var o=t[n];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==n[0]?n:c[n]||(c[n]=n.replace(p,"-$1").toLowerCase()),e="number"==typeof o&&!1===r.test(n)?e+": "+o+"px;":e+": "+o+";")}return e||void 0}function v(t,e){return Array.isArray(e)?e.reduce(v,t):null!=e&&!1!==e&&t.push(e),t}function y(){this.__d=!0}function _(t,e){return{__v:t,context:e,props:t.props,setState:y,forceUpdate:y,__d:!0,__h:[]}}function g(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,s,c,p){if(null==t||"boolean"==typeof t)return"";if("object"!=typeof t)return f(t);var y=r.pretty,h=y&&"string"==typeof y?y:"\t";if(Array.isArray(t)){for(var j="",x=0;x<t.length;x++)y&&x>0&&(j+="\n"),j+=m(t[x],n,r,s,c,p);return j}var S,k=t.type,A=t.props,O=!1;if("function"==typeof k){if(O=!0,!r.shallow||!s&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return v(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,c,p)}var F,C=t.__c=_(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&"function"==typeof k.prototype.render){var M=g(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=g(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,c,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e="UnnamedComponent"+n}return e}(S)}var D,I,L="<"+k;if(A){var W=Object.keys(A);r&&!0===r.sortAttributes&&W.sort();for(var $=0;$<W.length;$++){var P=W[$],T=A[P];if("children"!==P){if(!i.test(P)&&(r&&r.allAttributes||"key"!==P&&"ref"!==P&&"__self"!==P&&"__source"!==P)){if("defaultValue"===P)P="value";else if("defaultChecked"===P)P="checked";else if("defaultSelected"===P)P="selected";else if("className"===P){if(void 0!==A.class)continue;P="class"}else c&&a.test(P)&&(P=P.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===P){if(A.for)continue;P="for"}"style"===P&&T&&"object"==typeof T&&(T=d(T)),"a"===P[0]&&"r"===P[1]&&"boolean"==typeof T&&(T=String(T));var U=r.attributeHook&&r.attributeHook(P,T,n,r,O);if(U||""===U)L+=U;else if("dangerouslySetInnerHTML"===P)I=T&&T.__html;else if("textarea"===k&&"value"===P)D=T;else if((T||0===T||""===T)&&"function"!=typeof T){if(!(!0!==T&&""!==T||(T=P,r&&r.xml))){L=L+" "+P;continue}if("value"===P){if("select"===k){p=T;continue}"option"===k&&p==T&&void 0===A.selected&&(L+=" selected")}L=L+" "+P+'="'+f(T)+'"'}}}else D=T}}if(y){var R=L.replace(/\n\s*/," ");R===L||~R.indexOf("\n")?y&&~L.indexOf("\n")&&(L+="\n"):L=R}if(L+=">",i.test(k))throw new Error(k+" is not a valid HTML tag name in "+L);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)y&&l(I)&&(I="\n"+h+u(I,h)),L+=I;else if(null!=D&&v(J=[],D).length){for(var z=y&&~L.indexOf("\n"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,"svg"===k||"foreignObject"!==k&&c,p);if(y&&!z&&l(K)&&(z=!0),K)if(y){var Q=K.length>0&&"<"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(y&&z)for(var X=q.length;X--;)q[X]="\n"+h+u(q[X],h)}if(q.length||I)L+=q.join("");else if(r&&r.xml)return L.substring(0,L.length-1)+" />";return!V||J||I?(y&&~L.indexOf("\n")&&(L+="\n"),L=L+"</"+k+">"):L=L.replace(/>$/," />"),L}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o,i=e.options.__s;return e.options.__s=!0,o=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0),e.options.__c&&e.options.__c(t,j),e.options.__s=i,j.length=0,o}function S(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function k(t,e){return"style"===t&&null!=e&&"object"==typeof e?d(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return f(t);if(A(t)){for(var s="",u=0;u<t.length;u++)s+=w(t[u],n,r,a);return s}e.options.__b&&e.options.__b(t);var l=t.type,c=t.props;if("function"==typeof l){if(l===e.Fragment)return w(t.props.children,n,r,a);var p;p=l.prototype&&"function"==typeof l.prototype.render?function(t,n){var r=t.type,o=g(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=_(t,n),i=g(t.type,n);t.__c=o;for(var a=e.options.__r,s=0;o.__d&&s++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var d=t.__c;d.getChildContext&&(n=O({},n,d.getChildContext()));var v=w(p,n,r,a);return e.options.diffed&&e.options.diffed(t),v}var y,b,m="<";if(m+=l,c)for(var h in y=c.children,c){var j=c[h];if(!("key"===h||"ref"===h||"__self"===h||"__source"===h||"children"===h||"className"===h&&"class"in c||"htmlFor"===h&&"for"in c||i.test(h)))if(j=k(h=S(h,r),j),"dangerouslySetInnerHTML"===h)b=j&&j.__html;else if("textarea"===l&&"value"===h)y=j;else if((j||0===j||""===j)&&"function"!=typeof j){if(!0===j||""===j){j=h,m=m+" "+h;continue}if("value"===h){if("select"===l){a=j;continue}"option"!==l||a!=j||"selected"in c||(m+=" selected")}m=m+" "+h+'="'+f(j)+'"'}}var x=m;if(m+=">",i.test(l))throw new Error(l+" is not a valid HTML tag name in "+m);var F="",C=!1;if(b)F+=b,C=!0;else if("string"==typeof y)F+=f(y),C=!0;else if(A(y))for(var E=0;E<y.length;E++){var M=y[E];if(null!=M&&!1!==M){var H=w(M,n,"svg"===l||"foreignObject"!==l&&r,a);H&&(F+=H,C=!0)}}else if(null!=y&&!1!==y&&!0!==y){var N=w(y,n,"svg"===l||"foreignObject"!==l&&r,a);N&&(F+=N,C=!0)}if(e.options.diffed&&e.options.diffed(t),C)m+=F;else if(o.test(l))return x+" />";return m+"</"+l+">"}x.shallowRender=function(t,e){return x(t,e,h)};var F=/(\\|\"|\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\((.*)\)(.*)$/,I=/\n/gi,L=Object.getOwnPropertySymbols||function(t){return[]};function W(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 $(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function P(t){return N.call(t).replace(D,"Symbol($1)")}function T(t){return"["+M.call(t)+"]"}function U(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";var 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(F,"\\$1")}(t)+'"';if("function"===e)return $(t);if("symbol"===e)return P(t);var n=C.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?$(t,min):"[object Symbol]"===n?P(t):"[object Date]"===n?E.call(t):"[object Error]"===n?T(t):"[object RegExp]"===n?H.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":W(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&T(t)}function R(t,e,n,r,o,i,a,s,f,u){var l="";if(t.length){l+=o;for(var c=n+e,p=0;p<t.length;p++)l+=c+q(t[p],e,c,r,o,i,a,s,f,u),p<t.length-1&&(l+=","+r);l+=o+n}return"["+l+"]"}function J(t,e,n,r,o,i,a,s,f,u){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var l=++s>a;if(!l&&t.toJSON&&"function"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,s,f,u);var c=C.call(t);return"[object Arguments]"===c?l?"[Arguments]":function(t,e,n,r,o,i,a,s,f,u){return(u?"":"Arguments ")+R(t,e,n,r,o,i,a,s,f,u)}(t,e,n,r,o,i,a,s,f,u):W(c)?l?"[Array]":function(t,e,n,r,o,i,a,s,f,u){return(u?"":t.constructor.name+" ")+R(t,e,n,r,o,i,a,s,f,u)}(t,e,n,r,o,i,a,s,f,u):"[object Map]"===c?l?"[Map]":function(t,e,n,r,o,i,a,s,f,u){var l="Map {",c=t.entries(),p=c.next();if(!p.done){l+=o;for(var d=n+e;!p.done;)l+=d+q(p.value[0],e,d,r,o,i,a,s,f,u)+" => "+q(p.value[1],e,d,r,o,i,a,s,f,u),(p=c.next()).done||(l+=","+r);l+=o+n}return l+"}"}(t,e,n,r,o,i,a,s,f,u):"[object Set]"===c?l?"[Set]":function(t,e,n,r,o,i,a,s,f,u){var l="Set {",c=t.entries(),p=c.next();if(!p.done){l+=o;for(var d=n+e;!p.done;)l+=d+q(p.value[1],e,d,r,o,i,a,s,f,u),(p=c.next()).done||(l+=","+r);l+=o+n}return l+"}"}(t,e,n,r,o,i,a,s,f,u):"object"==typeof t?l?"[Object]":function(t,e,n,r,o,i,a,s,f,u){var l=(u?"":t.constructor?t.constructor.name+" ":"Object ")+"{",c=Object.keys(t).sort(),p=L(t);if(p.length&&(c=c.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===C.call(t))}).concat(p)),c.length){l+=o;for(var d=n+e,v=0;v<c.length;v++){var y=c[v];l+=d+q(y,e,d,r,o,i,a,s,f,u)+": "+q(t[y],e,d,r,o,i,a,s,f,u),v<c.length-1&&(l+=","+r)}l+=o+n}return l+"}"}(t,e,n,r,o,i,a,s,f,u):void 0}function V(t,e,n,r,o,i,a,s,f,u){for(var l,c=!1,p=0;p<f.length;p++)if((l=f[p]).test(t)){c=!0;break}return!!c&&l.print(t,function(t){return q(t,e,n,r,o,i,a,s,f,u)},function(t){var r=n+e;return r+t.replace(I,"\n"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,s,f,u){return U(t)||V(t,e,n,r,o,i,a,s,f,u)||J(t,e,n,r,o,i,a,s,f,u)}var z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(" ")}var G={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){var n,r;e?(function(t){if(Object.keys(t).forEach(function(t){if(!z.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){var e={};return Object.keys(z).forEach(function(n){return e[n]=t.hasOwnProperty(n)?t[n]:z[n]}),e.min&&(e.indent=0),e}(e)):e=z;var o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){var a=V(t,n=B(e.indent),"",o,i,r=[],e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf("\n")&&(e=u("\n"+e,a)+"\n")):e="Function",u("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+f(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q},"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);
|
|
1
|
+
var t;t=function(t,e){if("function"!=typeof Symbol){var n=0;Symbol=function(t){return"@@"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\s\n\\/='"\0<>]/,a=/^xlink:?./,u=/["&<]/;function s(t){if(!1===u.test(t+=""))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var l=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},c={},p=/([A-Z])/g;function d(t){var e="";for(var n in t){var o=t[n];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==n[0]?n:c[n]||(c[n]=n.replace(p,"-$1").toLowerCase()),e="number"==typeof o&&!1===r.test(n)?e+": "+o+"px;":e+": "+o+";")}return e||void 0}function v(t,e){return Array.isArray(e)?e.reduce(v,t):null!=e&&!1!==e&&t.push(e),t}function _(){this.__d=!0}function y(t,e){return{__v:t,context:e,props:t.props,setState:_,forceUpdate:_,__d:!0,__h:[]}}function g(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,u,c,p){if(null==t||"boolean"==typeof t)return"";if("object"!=typeof t)return s(t);var _=r.pretty,h=_&&"string"==typeof _?_:"\t";if(Array.isArray(t)){for(var j="",x=0;x<t.length;x++)_&&x>0&&(j+="\n"),j+=m(t[x],n,r,u,c,p);return j}var S,k=t.type,A=t.props,O=!1;if("function"==typeof k){if(O=!0,!r.shallow||!u&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return v(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,c,p)}var F,C=t.__c=y(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&"function"==typeof k.prototype.render){var M=g(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=g(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,c,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e="UnnamedComponent"+n}return e}(S)}var D,I,L="<"+k;if(A){var W=Object.keys(A);r&&!0===r.sortAttributes&&W.sort();for(var $=0;$<W.length;$++){var P=W[$],T=A[P];if("children"!==P){if(!i.test(P)&&(r&&r.allAttributes||"key"!==P&&"ref"!==P&&"__self"!==P&&"__source"!==P)){if("defaultValue"===P)P="value";else if("defaultChecked"===P)P="checked";else if("defaultSelected"===P)P="selected";else if("className"===P){if(void 0!==A.class)continue;P="class"}else c&&a.test(P)&&(P=P.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===P){if(A.for)continue;P="for"}"style"===P&&T&&"object"==typeof T&&(T=d(T)),"a"===P[0]&&"r"===P[1]&&"boolean"==typeof T&&(T=String(T));var U=r.attributeHook&&r.attributeHook(P,T,n,r,O);if(U||""===U)L+=U;else if("dangerouslySetInnerHTML"===P)I=T&&T.__html;else if("textarea"===k&&"value"===P)D=T;else if((T||0===T||""===T)&&"function"!=typeof T){if(!(!0!==T&&""!==T||(T=P,r&&r.xml))){L=L+" "+P;continue}if("value"===P){if("select"===k){p=T;continue}"option"===k&&p==T&&void 0===A.selected&&(L+=" selected")}L=L+" "+P+'="'+s(T)+'"'}}}else D=T}}if(_){var R=L.replace(/\n\s*/," ");R===L||~R.indexOf("\n")?_&&~L.indexOf("\n")&&(L+="\n"):L=R}if(L+=">",i.test(k))throw new Error(k+" is not a valid HTML tag name in "+L);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)_&&f(I)&&(I="\n"+h+l(I,h)),L+=I;else if(null!=D&&v(J=[],D).length){for(var z=_&&~L.indexOf("\n"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,"svg"===k||"foreignObject"!==k&&c,p);if(_&&!z&&f(K)&&(z=!0),K)if(_){var Q=K.length>0&&"<"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(_&&z)for(var X=q.length;X--;)q[X]="\n"+h+l(q[X],h)}if(q.length||I)L+=q.join("");else if(r&&r.xml)return L.substring(0,L.length-1)+" />";return!V||J||I?(_&&~L.indexOf("\n")&&(L+="\n"),L=L+"</"+k+">"):L=L.replace(/>$/," />"),L}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o=e.options.__s;e.options.__s=!0;var i,a=e.h(e.Fragment,null);return a.__k=[t],i=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0,a),e.options.__c&&e.options.__c(t,j),e.options.__s=o,j.length=0,i}function S(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function k(t,e){return"style"===t&&null!=e&&"object"==typeof e?d(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a,u){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return s(t);if(A(t)){var l="";u.__k=t;for(var f=0;f<t.length;f++)l+=w(t[f],n,r,a,u);return l}t.__=u,e.options.__b&&e.options.__b(t);var c=t.type,p=t.props;if("function"==typeof c){var d;if(c===e.Fragment)d=p.children;else{d=c.prototype&&"function"==typeof c.prototype.render?function(t,n){var r=t.type,o=g(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=y(t,n),i=g(t.type,n);t.__c=o;for(var a=e.options.__r,u=0;o.__d&&u++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var v=t.__c;v.getChildContext&&(n=O({},n,v.getChildContext()))}var _=w(d,n,r,a,t);return e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),_}var b,m,h="<";if(h+=c,p)for(var j in b=p.children,p){var x=p[j];if(!("key"===j||"ref"===j||"__self"===j||"__source"===j||"children"===j||"className"===j&&"class"in p||"htmlFor"===j&&"for"in p||i.test(j)))if(x=k(j=S(j,r),x),"dangerouslySetInnerHTML"===j)m=x&&x.__html;else if("textarea"===c&&"value"===j)b=x;else if((x||0===x||""===x)&&"function"!=typeof x){if(!0===x||""===x){x=j,h=h+" "+j;continue}if("value"===j){if("select"===c){a=x;continue}"option"!==c||a!=x||"selected"in p||(h+=" selected")}h=h+" "+j+'="'+s(x)+'"'}}var F=h;if(h+=">",i.test(c))throw new Error(c+" is not a valid HTML tag name in "+h);var C="",E=!1;if(m)C+=m,E=!0;else if("string"==typeof b)C+=s(b),E=!0;else if(A(b)){t.__k=b;for(var M=0;M<b.length;M++){var H=b[M];if(null!=H&&!1!==H){var N=w(H,n,"svg"===c||"foreignObject"!==c&&r,a,t);N&&(C+=N,E=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[b];var D=w(b,n,"svg"===c||"foreignObject"!==c&&r,a,t);D&&(C+=D,E=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),E)h+=C;else if(o.test(c))return F+" />";return h+"</"+c+">"}x.shallowRender=function(t,e){return x(t,e,h)};var F=/(\\|\"|\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\((.*)\)(.*)$/,I=/\n/gi,L=Object.getOwnPropertySymbols||function(t){return[]};function W(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 $(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function P(t){return N.call(t).replace(D,"Symbol($1)")}function T(t){return"["+M.call(t)+"]"}function U(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";var 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(F,"\\$1")}(t)+'"';if("function"===e)return $(t);if("symbol"===e)return P(t);var n=C.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?$(t,min):"[object Symbol]"===n?P(t):"[object Date]"===n?E.call(t):"[object Error]"===n?T(t):"[object RegExp]"===n?H.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":W(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&T(t)}function R(t,e,n,r,o,i,a,u,s,l){var f="";if(t.length){f+=o;for(var c=n+e,p=0;p<t.length;p++)f+=c+q(t[p],e,c,r,o,i,a,u,s,l),p<t.length-1&&(f+=","+r);f+=o+n}return"["+f+"]"}function J(t,e,n,r,o,i,a,u,s,l){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var f=++u>a;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,u,s,l);var c=C.call(t);return"[object Arguments]"===c?f?"[Arguments]":function(t,e,n,r,o,i,a,u,s,l){return(l?"":"Arguments ")+R(t,e,n,r,o,i,a,u,s,l)}(t,e,n,r,o,i,a,u,s,l):W(c)?f?"[Array]":function(t,e,n,r,o,i,a,u,s,l){return(l?"":t.constructor.name+" ")+R(t,e,n,r,o,i,a,u,s,l)}(t,e,n,r,o,i,a,u,s,l):"[object Map]"===c?f?"[Map]":function(t,e,n,r,o,i,a,u,s,l){var f="Map {",c=t.entries(),p=c.next();if(!p.done){f+=o;for(var d=n+e;!p.done;)f+=d+q(p.value[0],e,d,r,o,i,a,u,s,l)+" => "+q(p.value[1],e,d,r,o,i,a,u,s,l),(p=c.next()).done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,a,u,s,l):"[object Set]"===c?f?"[Set]":function(t,e,n,r,o,i,a,u,s,l){var f="Set {",c=t.entries(),p=c.next();if(!p.done){f+=o;for(var d=n+e;!p.done;)f+=d+q(p.value[1],e,d,r,o,i,a,u,s,l),(p=c.next()).done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,a,u,s,l):"object"==typeof t?f?"[Object]":function(t,e,n,r,o,i,a,u,s,l){var f=(l?"":t.constructor?t.constructor.name+" ":"Object ")+"{",c=Object.keys(t).sort(),p=L(t);if(p.length&&(c=c.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===C.call(t))}).concat(p)),c.length){f+=o;for(var d=n+e,v=0;v<c.length;v++){var _=c[v];f+=d+q(_,e,d,r,o,i,a,u,s,l)+": "+q(t[_],e,d,r,o,i,a,u,s,l),v<c.length-1&&(f+=","+r)}f+=o+n}return f+"}"}(t,e,n,r,o,i,a,u,s,l):void 0}function V(t,e,n,r,o,i,a,u,s,l){for(var f,c=!1,p=0;p<s.length;p++)if((f=s[p]).test(t)){c=!0;break}return!!c&&f.print(t,function(t){return q(t,e,n,r,o,i,a,u,s,l)},function(t){var r=n+e;return r+t.replace(I,"\n"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,u,s,l){return U(t)||V(t,e,n,r,o,i,a,u,s,l)||J(t,e,n,r,o,i,a,u,s,l)}var z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(" ")}var G={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){var n,r;e?(function(t){if(Object.keys(t).forEach(function(t){if(!z.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){var e={};return Object.keys(z).forEach(function(n){return e[n]=t.hasOwnProperty(n)?t[n]:z[n]}),e.min&&(e.indent=0),e}(e)):e=z;var o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){var a=V(t,n=B(e.indent),"",o,i,r=[],e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf("\n")&&(e=l("\n"+e,a)+"\n")):e="Function",l("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+s(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q},"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);
|
|
2
2
|
//# sourceMappingURL=jsx.js.map
|
package/dist/jsx-entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.js","sources":["jsx.js"],"sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports,require(\"preact\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"preact\"],e):e((t||self).preactRenderToString={},t.preact)}(this,function(t,e){if(\"function\"!=typeof Symbol){var n=0;Symbol=function(t){return\"@@\"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\\s\\n\\\\/='\"\\0<>]/,a=/^xlink:?./,s=/[\"&<]/;function l(t){if(!1===s.test(t+=\"\"))return t;for(var e=0,n=0,r=\"\",o=\"\";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=\""\";break;case 38:o=\"&\";break;case 60:o=\"<\";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var c=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf(\"\\n\")||-1!==String(t).indexOf(\"<\")},u={},p=/([A-Z])/g;function d(t){var e=\"\";for(var n in t){var o=t[n];null!=o&&\"\"!==o&&(e&&(e+=\" \"),e+=\"-\"==n[0]?n:u[n]||(u[n]=n.replace(p,\"-$1\").toLowerCase()),e=\"number\"==typeof o&&!1===r.test(n)?e+\": \"+o+\"px;\":e+\": \"+o+\";\")}return e||void 0}function y(t,e){return Array.isArray(e)?e.reduce(y,t):null!=e&&!1!==e&&t.push(e),t}function g(){this.__d=!0}function _(t,e){return{__v:t,context:e,props:t.props,setState:g,forceUpdate:g,__d:!0,__h:[]}}function v(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,s,u,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return l(t);var g=r.pretty,h=g&&\"string\"==typeof g?g:\"\\t\";if(Array.isArray(t)){for(var j=\"\",x=0;x<t.length;x++)g&&x>0&&(j+=\"\\n\"),j+=m(t[x],n,r,s,u,p);return j}var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!s&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return y(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,u,p)}var F,C=t.__c=_(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&\"function\"==typeof k.prototype.render){var M=v(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=v(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,u,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\\s*function\\s+([^( ]+)/)||\"\")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e=\"UnnamedComponent\"+n}return e}(S)}var D,I,T=\"<\"+k;if(A){var L=Object.keys(A);r&&!0===r.sortAttributes&&L.sort();for(var W=0;W<L.length;W++){var $=L[W],P=A[$];if(\"children\"!==$){if(!i.test($)&&(r&&r.allAttributes||\"key\"!==$&&\"ref\"!==$&&\"__self\"!==$&&\"__source\"!==$)){if(\"defaultValue\"===$)$=\"value\";else if(\"defaultChecked\"===$)$=\"checked\";else if(\"defaultSelected\"===$)$=\"selected\";else if(\"className\"===$){if(void 0!==A.class)continue;$=\"class\"}else u&&a.test($)&&($=$.toLowerCase().replace(/^xlink:?/,\"xlink:\"));if(\"htmlFor\"===$){if(A.for)continue;$=\"for\"}\"style\"===$&&P&&\"object\"==typeof P&&(P=d(P)),\"a\"===$[0]&&\"r\"===$[1]&&\"boolean\"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook($,P,n,r,O);if(U||\"\"===U)T+=U;else if(\"dangerouslySetInnerHTML\"===$)I=P&&P.__html;else if(\"textarea\"===k&&\"value\"===$)D=P;else if((P||0===P||\"\"===P)&&\"function\"!=typeof P){if(!(!0!==P&&\"\"!==P||(P=$,r&&r.xml))){T=T+\" \"+$;continue}if(\"value\"===$){if(\"select\"===k){p=P;continue}\"option\"===k&&p==P&&void 0===A.selected&&(T+=\" selected\")}T=T+\" \"+$+'=\"'+l(P)+'\"'}}}else D=P}}if(g){var R=T.replace(/\\n\\s*/,\" \");R===T||~R.indexOf(\"\\n\")?g&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"):T=R}if(T+=\">\",i.test(k))throw new Error(k+\" is not a valid HTML tag name in \"+T);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)g&&f(I)&&(I=\"\\n\"+h+c(I,h)),T+=I;else if(null!=D&&y(J=[],D).length){for(var z=g&&~T.indexOf(\"\\n\"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,\"svg\"===k||\"foreignObject\"!==k&&u,p);if(g&&!z&&f(K)&&(z=!0),K)if(g){var Q=K.length>0&&\"<\"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(g&&z)for(var X=q.length;X--;)q[X]=\"\\n\"+h+c(q[X],h)}if(q.length||I)T+=q.join(\"\");else if(r&&r.xml)return T.substring(0,T.length-1)+\" />\";return!V||J||I?(g&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"),T=T+\"</\"+k+\">\"):T=T.replace(/>$/,\" />\"),T}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o,i=e.options.__s;return e.options.__s=!0,o=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0),e.options.__c&&e.options.__c(t,j),e.options.__s=i,j.length=0,o}function S(t,e){return\"className\"===t?\"class\":\"htmlFor\"===t?\"for\":\"defaultValue\"===t?\"value\":\"defaultChecked\"===t?\"checked\":\"defaultSelected\"===t?\"selected\":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,\"xlink:\"):t}function k(t,e){return\"style\"===t&&null!=e&&\"object\"==typeof e?d(e):\"a\"===t[0]&&\"r\"===t[1]&&\"boolean\"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return l(t);if(A(t)){for(var s=\"\",c=0;c<t.length;c++)s+=w(t[c],n,r,a);return s}e.options.__b&&e.options.__b(t);var f=t.type,u=t.props;if(\"function\"==typeof f){if(f===e.Fragment)return w(t.props.children,n,r,a);var p;p=f.prototype&&\"function\"==typeof f.prototype.render?function(t,n){var r=t.type,o=v(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=_(t,n),i=v(t.type,n);t.__c=o;for(var a=e.options.__r,s=0;o.__d&&s++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var d=t.__c;d.getChildContext&&(n=O({},n,d.getChildContext()));var y=w(p,n,r,a);return e.options.diffed&&e.options.diffed(t),y}var g,b,m=\"<\";if(m+=f,u)for(var h in g=u.children,u){var j=u[h];if(!(\"key\"===h||\"ref\"===h||\"__self\"===h||\"__source\"===h||\"children\"===h||\"className\"===h&&\"class\"in u||\"htmlFor\"===h&&\"for\"in u||i.test(h)))if(j=k(h=S(h,r),j),\"dangerouslySetInnerHTML\"===h)b=j&&j.__html;else if(\"textarea\"===f&&\"value\"===h)g=j;else if((j||0===j||\"\"===j)&&\"function\"!=typeof j){if(!0===j||\"\"===j){j=h,m=m+\" \"+h;continue}if(\"value\"===h){if(\"select\"===f){a=j;continue}\"option\"!==f||a!=j||\"selected\"in u||(m+=\" selected\")}m=m+\" \"+h+'=\"'+l(j)+'\"'}}var x=m;if(m+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+m);var F=\"\",C=!1;if(b)F+=b,C=!0;else if(\"string\"==typeof g)F+=l(g),C=!0;else if(A(g))for(var E=0;E<g.length;E++){var M=g[E];if(null!=M&&!1!==M){var H=w(M,n,\"svg\"===f||\"foreignObject\"!==f&&r,a);H&&(F+=H,C=!0)}}else if(null!=g&&!1!==g&&!0!==g){var N=w(g,n,\"svg\"===f||\"foreignObject\"!==f&&r,a);N&&(F+=N,C=!0)}if(e.options.diffed&&e.options.diffed(t),C)m+=F;else if(o.test(f))return x+\" />\";return m+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};const F=/(\\\\|\\\"|\\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\\((.*)\\)(.*)$/,I=/\\n/gi,T=Object.getOwnPropertySymbols||(t=>[]);function L(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 W(t){return\"\"===t.name?\"[Function anonymous]\":\"[Function \"+t.name+\"]\"}function $(t){return N.call(t).replace(D,\"Symbol($1)\")}function P(t){return\"[\"+M.call(t)+\"]\"}function U(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(F,\"\\\\$1\")}(t)+'\"';if(\"function\"===e)return W(t);if(\"symbol\"===e)return $(t);const n=C.call(t);return\"[object WeakMap]\"===n?\"WeakMap {}\":\"[object WeakSet]\"===n?\"WeakSet {}\":\"[object Function]\"===n||\"[object GeneratorFunction]\"===n?W(t,min):\"[object Symbol]\"===n?$(t):\"[object Date]\"===n?E.call(t):\"[object Error]\"===n?P(t):\"[object RegExp]\"===n?H.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":L(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&P(t)}function R(t,e,n,r,o,i,a,s,l,c){let f=\"\";if(t.length){f+=o;const u=n+e;for(let n=0;n<t.length;n++)f+=u+q(t[n],e,u,r,o,i,a,s,l,c),n<t.length-1&&(f+=\",\"+r);f+=o+n}return\"[\"+f+\"]\"}function J(t,e,n,r,o,i,a,s,l,c){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const f=++s>a;if(!f&&t.toJSON&&\"function\"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,s,l,c);const u=C.call(t);return\"[object Arguments]\"===u?f?\"[Arguments]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":\"Arguments \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):L(u)?f?\"[Array]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":t.constructor.name+\" \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):\"[object Map]\"===u?f?\"[Map]\":function(t,e,n,r,o,i,a,s,l,c){let f=\"Map {\";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[0],e,t,r,o,i,a,s,l,c)+\" => \"+q(p.value[1],e,t,r,o,i,a,s,l,c),p=u.next(),p.done||(f+=\",\"+r);f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"[object Set]\"===u?f?\"[Set]\":function(t,e,n,r,o,i,a,s,l,c){let f=\"Set {\";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[1],e,t,r,o,i,a,s,l,c),p=u.next(),p.done||(f+=\",\"+r);f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"object\"==typeof t?f?\"[Object]\":function(t,e,n,r,o,i,a,s,l,c){let f=(c?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",u=Object.keys(t).sort();const p=T(t);if(p.length&&(u=u.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===C.call(t))).concat(p)),u.length){f+=o;const p=n+e;for(let n=0;n<u.length;n++){const d=u[n];f+=p+q(d,e,p,r,o,i,a,s,l,c)+\": \"+q(t[d],e,p,r,o,i,a,s,l,c),n<u.length-1&&(f+=\",\"+r)}f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):void 0}function V(t,e,n,r,o,i,a,s,l,c){let f,u=!1;for(let e=0;e<l.length;e++)if(f=l[e],f.test(t)){u=!0;break}return!!u&&f.print(t,function(t){return q(t,e,n,r,o,i,a,s,l,c)},function(t){const r=n+e;return r+t.replace(I,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,s,l,c){return U(t)||V(t,e,n,r,o,i,a,s,l,c)||J(t,e,n,r,o,i,a,s,l,c)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(\" \")}var G={test:function(t){return t&&\"object\"==typeof t&&\"type\"in t&&\"props\"in t&&\"key\"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if(\"dangerouslySetInnerHTML\"===t)return!1;if(null==e||\"function\"===i&&!r.functions)return\"\";if(r.skipFalseAttributes&&!o&&(!1===e||(\"class\"===t||\"style\"===t)&&\"\"===e))return\"\";var a=\"string\"==typeof r.pretty?r.pretty:\"\\t\";return\"string\"!==i?(\"function\"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?\" \":\"\\n\",i=e.min?\"\":\"\\n\";if(e&&e.plugins.length){n=B(e.indent),r=[];var a=V(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf(\"\\n\")&&(e=c(\"\\n\"+e,a)+\"\\n\")):e=\"Function\",c(\"\\n\"+t+\"={\"+e+\"}\",a)):\"\\n\"+a+t+'=\"'+l(e)+'\"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:\" \"};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q});\n//# sourceMappingURL=jsx.js.map\n"],"names":["t","Symbol","n","s","c"],"mappings":"mEAAA,SAAsBA,GAAA,MAAXC,KAAAA,KAAuBC,GACjCD,WAEAA,SAASD,GAAUG,MAClB,KAAAH,OAAkBI,EAAAA"}
|
|
1
|
+
{"version":3,"file":"jsx.js","sources":["jsx.js"],"sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports,require(\"preact\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"preact\"],e):e((t||self).preactRenderToString={},t.preact)}(this,function(t,e){if(\"function\"!=typeof Symbol){var n=0;Symbol=function(t){return\"@@\"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\\s\\n\\\\/='\"\\0<>]/,a=/^xlink:?./,s=/[\"&<]/;function l(t){if(!1===s.test(t+=\"\"))return t;for(var e=0,n=0,r=\"\",o=\"\";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=\""\";break;case 38:o=\"&\";break;case 60:o=\"<\";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var c=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},u=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf(\"\\n\")||-1!==String(t).indexOf(\"<\")},f={},p=/([A-Z])/g;function d(t){var e=\"\";for(var n in t){var o=t[n];null!=o&&\"\"!==o&&(e&&(e+=\" \"),e+=\"-\"==n[0]?n:f[n]||(f[n]=n.replace(p,\"-$1\").toLowerCase()),e=\"number\"==typeof o&&!1===r.test(n)?e+\": \"+o+\"px;\":e+\": \"+o+\";\")}return e||void 0}function _(t,e){return Array.isArray(e)?e.reduce(_,t):null!=e&&!1!==e&&t.push(e),t}function y(){this.__d=!0}function g(t,e){return{__v:t,context:e,props:t.props,setState:y,forceUpdate:y,__d:!0,__h:[]}}function v(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,s,f,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return l(t);var y=r.pretty,h=y&&\"string\"==typeof y?y:\"\\t\";if(Array.isArray(t)){for(var j=\"\",x=0;x<t.length;x++)y&&x>0&&(j+=\"\\n\"),j+=m(t[x],n,r,s,f,p);return j}var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!s&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return _(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,f,p)}var F,C=t.__c=g(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&\"function\"==typeof k.prototype.render){var M=v(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=v(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,f,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\\s*function\\s+([^( ]+)/)||\"\")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e=\"UnnamedComponent\"+n}return e}(S)}var D,I,T=\"<\"+k;if(A){var L=Object.keys(A);r&&!0===r.sortAttributes&&L.sort();for(var W=0;W<L.length;W++){var $=L[W],P=A[$];if(\"children\"!==$){if(!i.test($)&&(r&&r.allAttributes||\"key\"!==$&&\"ref\"!==$&&\"__self\"!==$&&\"__source\"!==$)){if(\"defaultValue\"===$)$=\"value\";else if(\"defaultChecked\"===$)$=\"checked\";else if(\"defaultSelected\"===$)$=\"selected\";else if(\"className\"===$){if(void 0!==A.class)continue;$=\"class\"}else f&&a.test($)&&($=$.toLowerCase().replace(/^xlink:?/,\"xlink:\"));if(\"htmlFor\"===$){if(A.for)continue;$=\"for\"}\"style\"===$&&P&&\"object\"==typeof P&&(P=d(P)),\"a\"===$[0]&&\"r\"===$[1]&&\"boolean\"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook($,P,n,r,O);if(U||\"\"===U)T+=U;else if(\"dangerouslySetInnerHTML\"===$)I=P&&P.__html;else if(\"textarea\"===k&&\"value\"===$)D=P;else if((P||0===P||\"\"===P)&&\"function\"!=typeof P){if(!(!0!==P&&\"\"!==P||(P=$,r&&r.xml))){T=T+\" \"+$;continue}if(\"value\"===$){if(\"select\"===k){p=P;continue}\"option\"===k&&p==P&&void 0===A.selected&&(T+=\" selected\")}T=T+\" \"+$+'=\"'+l(P)+'\"'}}}else D=P}}if(y){var R=T.replace(/\\n\\s*/,\" \");R===T||~R.indexOf(\"\\n\")?y&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"):T=R}if(T+=\">\",i.test(k))throw new Error(k+\" is not a valid HTML tag name in \"+T);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)y&&u(I)&&(I=\"\\n\"+h+c(I,h)),T+=I;else if(null!=D&&_(J=[],D).length){for(var z=y&&~T.indexOf(\"\\n\"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,\"svg\"===k||\"foreignObject\"!==k&&f,p);if(y&&!z&&u(K)&&(z=!0),K)if(y){var Q=K.length>0&&\"<\"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(y&&z)for(var X=q.length;X--;)q[X]=\"\\n\"+h+c(q[X],h)}if(q.length||I)T+=q.join(\"\");else if(r&&r.xml)return T.substring(0,T.length-1)+\" />\";return!V||J||I?(y&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"),T=T+\"</\"+k+\">\"):T=T.replace(/>$/,\" />\"),T}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o=e.options.__s;e.options.__s=!0;var i,a=e.h(e.Fragment,null);return a.__k=[t],i=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0,a),e.options.__c&&e.options.__c(t,j),e.options.__s=o,j.length=0,i}function S(t,e){return\"className\"===t?\"class\":\"htmlFor\"===t?\"for\":\"defaultValue\"===t?\"value\":\"defaultChecked\"===t?\"checked\":\"defaultSelected\"===t?\"selected\":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,\"xlink:\"):t}function k(t,e){return\"style\"===t&&null!=e&&\"object\"==typeof e?d(e):\"a\"===t[0]&&\"r\"===t[1]&&\"boolean\"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a,s){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return l(t);if(A(t)){var c=\"\";s.__k=t;for(var u=0;u<t.length;u++)c+=w(t[u],n,r,a,s);return c}t.__=s,e.options.__b&&e.options.__b(t);var f=t.type,p=t.props;if(\"function\"==typeof f){var d;if(f===e.Fragment)d=p.children;else{d=f.prototype&&\"function\"==typeof f.prototype.render?function(t,n){var r=t.type,o=v(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=g(t,n),i=v(t.type,n);t.__c=o;for(var a=e.options.__r,s=0;o.__d&&s++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var _=t.__c;_.getChildContext&&(n=O({},n,_.getChildContext()))}var y=w(d,n,r,a,t);return e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),y}var b,m,h=\"<\";if(h+=f,p)for(var j in b=p.children,p){var x=p[j];if(!(\"key\"===j||\"ref\"===j||\"__self\"===j||\"__source\"===j||\"children\"===j||\"className\"===j&&\"class\"in p||\"htmlFor\"===j&&\"for\"in p||i.test(j)))if(x=k(j=S(j,r),x),\"dangerouslySetInnerHTML\"===j)m=x&&x.__html;else if(\"textarea\"===f&&\"value\"===j)b=x;else if((x||0===x||\"\"===x)&&\"function\"!=typeof x){if(!0===x||\"\"===x){x=j,h=h+\" \"+j;continue}if(\"value\"===j){if(\"select\"===f){a=x;continue}\"option\"!==f||a!=x||\"selected\"in p||(h+=\" selected\")}h=h+\" \"+j+'=\"'+l(x)+'\"'}}var F=h;if(h+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+h);var C=\"\",E=!1;if(m)C+=m,E=!0;else if(\"string\"==typeof b)C+=l(b),E=!0;else if(A(b)){t.__k=b;for(var M=0;M<b.length;M++){var H=b[M];if(null!=H&&!1!==H){var N=w(H,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);N&&(C+=N,E=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[b];var D=w(b,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);D&&(C+=D,E=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),E)h+=C;else if(o.test(f))return F+\" />\";return h+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};const F=/(\\\\|\\\"|\\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\\((.*)\\)(.*)$/,I=/\\n/gi,T=Object.getOwnPropertySymbols||(t=>[]);function L(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 W(t){return\"\"===t.name?\"[Function anonymous]\":\"[Function \"+t.name+\"]\"}function $(t){return N.call(t).replace(D,\"Symbol($1)\")}function P(t){return\"[\"+M.call(t)+\"]\"}function U(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(F,\"\\\\$1\")}(t)+'\"';if(\"function\"===e)return W(t);if(\"symbol\"===e)return $(t);const n=C.call(t);return\"[object WeakMap]\"===n?\"WeakMap {}\":\"[object WeakSet]\"===n?\"WeakSet {}\":\"[object Function]\"===n||\"[object GeneratorFunction]\"===n?W(t,min):\"[object Symbol]\"===n?$(t):\"[object Date]\"===n?E.call(t):\"[object Error]\"===n?P(t):\"[object RegExp]\"===n?H.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":L(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&P(t)}function R(t,e,n,r,o,i,a,s,l,c){let u=\"\";if(t.length){u+=o;const f=n+e;for(let n=0;n<t.length;n++)u+=f+q(t[n],e,f,r,o,i,a,s,l,c),n<t.length-1&&(u+=\",\"+r);u+=o+n}return\"[\"+u+\"]\"}function J(t,e,n,r,o,i,a,s,l,c){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const u=++s>a;if(!u&&t.toJSON&&\"function\"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,s,l,c);const f=C.call(t);return\"[object Arguments]\"===f?u?\"[Arguments]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":\"Arguments \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):L(f)?u?\"[Array]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":t.constructor.name+\" \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):\"[object Map]\"===f?u?\"[Map]\":function(t,e,n,r,o,i,a,s,l,c){let u=\"Map {\";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+q(p.value[0],e,t,r,o,i,a,s,l,c)+\" => \"+q(p.value[1],e,t,r,o,i,a,s,l,c),p=f.next(),p.done||(u+=\",\"+r);u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"[object Set]\"===f?u?\"[Set]\":function(t,e,n,r,o,i,a,s,l,c){let u=\"Set {\";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+q(p.value[1],e,t,r,o,i,a,s,l,c),p=f.next(),p.done||(u+=\",\"+r);u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"object\"==typeof t?u?\"[Object]\":function(t,e,n,r,o,i,a,s,l,c){let u=(c?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",f=Object.keys(t).sort();const p=T(t);if(p.length&&(f=f.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===C.call(t))).concat(p)),f.length){u+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];u+=p+q(d,e,p,r,o,i,a,s,l,c)+\": \"+q(t[d],e,p,r,o,i,a,s,l,c),n<f.length-1&&(u+=\",\"+r)}u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):void 0}function V(t,e,n,r,o,i,a,s,l,c){let u,f=!1;for(let e=0;e<l.length;e++)if(u=l[e],u.test(t)){f=!0;break}return!!f&&u.print(t,function(t){return q(t,e,n,r,o,i,a,s,l,c)},function(t){const r=n+e;return r+t.replace(I,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,s,l,c){return U(t)||V(t,e,n,r,o,i,a,s,l,c)||J(t,e,n,r,o,i,a,s,l,c)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(\" \")}var G={test:function(t){return t&&\"object\"==typeof t&&\"type\"in t&&\"props\"in t&&\"key\"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if(\"dangerouslySetInnerHTML\"===t)return!1;if(null==e||\"function\"===i&&!r.functions)return\"\";if(r.skipFalseAttributes&&!o&&(!1===e||(\"class\"===t||\"style\"===t)&&\"\"===e))return\"\";var a=\"string\"==typeof r.pretty?r.pretty:\"\\t\";return\"string\"!==i?(\"function\"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?\" \":\"\\n\",i=e.min?\"\":\"\\n\";if(e&&e.plugins.length){n=B(e.indent),r=[];var a=V(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf(\"\\n\")&&(e=c(\"\\n\"+e,a)+\"\\n\")):e=\"Function\",c(\"\\n\"+t+\"={\"+e+\"}\",a)):\"\\n\"+a+t+'=\"'+l(e)+'\"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:\" \"};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q});\n//# sourceMappingURL=jsx.js.map\n"],"names":["t","Symbol","n","s","c"],"mappings":"mEAAA,SAAsBA,GAAA,MAAXC,KAAAA,KAAuBC,GACjCD,WAEAA,SAASD,GAAUG,MAClB,KAAAH,OAAkBI,EAAAA"}
|
package/dist/jsx.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
jsx?: boolean;
|
|
5
|
-
xml?: boolean;
|
|
6
|
-
functions?: boolean;
|
|
7
|
-
functionNames?: boolean;
|
|
8
|
-
skipFalseAttributes?: boolean;
|
|
9
|
-
pretty?: boolean | string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function render(vnode: VNode, context?: any, options?: Options): string;
|
|
13
|
-
export default render;
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface Options {
|
|
4
|
+
jsx?: boolean;
|
|
5
|
+
xml?: boolean;
|
|
6
|
+
functions?: boolean;
|
|
7
|
+
functionNames?: boolean;
|
|
8
|
+
skipFalseAttributes?: boolean;
|
|
9
|
+
pretty?: boolean | string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function render(vnode: VNode, context?: any, options?: Options): string;
|
|
13
|
+
export default render;
|
package/dist/jsx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.js","sources":["jsx.js"],"sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports,require(\"preact\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"preact\"],e):e((t||self).preactRenderToString={},t.preact)}(this,function(t,e){if(\"function\"!=typeof Symbol){var n=0;Symbol=function(t){return\"@@\"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\\s\\n\\\\/='\"\\0<>]/,a=/^xlink:?./,s=/[\"&<]/;function l(t){if(!1===s.test(t+=\"\"))return t;for(var e=0,n=0,r=\"\",o=\"\";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=\""\";break;case 38:o=\"&\";break;case 60:o=\"<\";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var c=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf(\"\\n\")||-1!==String(t).indexOf(\"<\")},u={},p=/([A-Z])/g;function d(t){var e=\"\";for(var n in t){var o=t[n];null!=o&&\"\"!==o&&(e&&(e+=\" \"),e+=\"-\"==n[0]?n:u[n]||(u[n]=n.replace(p,\"-$1\").toLowerCase()),e=\"number\"==typeof o&&!1===r.test(n)?e+\": \"+o+\"px;\":e+\": \"+o+\";\")}return e||void 0}function y(t,e){return Array.isArray(e)?e.reduce(y,t):null!=e&&!1!==e&&t.push(e),t}function g(){this.__d=!0}function _(t,e){return{__v:t,context:e,props:t.props,setState:g,forceUpdate:g,__d:!0,__h:[]}}function v(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,s,u,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return l(t);var g=r.pretty,h=g&&\"string\"==typeof g?g:\"\\t\";if(Array.isArray(t)){for(var j=\"\",x=0;x<t.length;x++)g&&x>0&&(j+=\"\\n\"),j+=m(t[x],n,r,s,u,p);return j}var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!s&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return y(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,u,p)}var F,C=t.__c=_(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&\"function\"==typeof k.prototype.render){var M=v(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=v(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,u,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\\s*function\\s+([^( ]+)/)||\"\")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e=\"UnnamedComponent\"+n}return e}(S)}var D,I,T=\"<\"+k;if(A){var L=Object.keys(A);r&&!0===r.sortAttributes&&L.sort();for(var W=0;W<L.length;W++){var $=L[W],P=A[$];if(\"children\"!==$){if(!i.test($)&&(r&&r.allAttributes||\"key\"!==$&&\"ref\"!==$&&\"__self\"!==$&&\"__source\"!==$)){if(\"defaultValue\"===$)$=\"value\";else if(\"defaultChecked\"===$)$=\"checked\";else if(\"defaultSelected\"===$)$=\"selected\";else if(\"className\"===$){if(void 0!==A.class)continue;$=\"class\"}else u&&a.test($)&&($=$.toLowerCase().replace(/^xlink:?/,\"xlink:\"));if(\"htmlFor\"===$){if(A.for)continue;$=\"for\"}\"style\"===$&&P&&\"object\"==typeof P&&(P=d(P)),\"a\"===$[0]&&\"r\"===$[1]&&\"boolean\"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook($,P,n,r,O);if(U||\"\"===U)T+=U;else if(\"dangerouslySetInnerHTML\"===$)I=P&&P.__html;else if(\"textarea\"===k&&\"value\"===$)D=P;else if((P||0===P||\"\"===P)&&\"function\"!=typeof P){if(!(!0!==P&&\"\"!==P||(P=$,r&&r.xml))){T=T+\" \"+$;continue}if(\"value\"===$){if(\"select\"===k){p=P;continue}\"option\"===k&&p==P&&void 0===A.selected&&(T+=\" selected\")}T=T+\" \"+$+'=\"'+l(P)+'\"'}}}else D=P}}if(g){var R=T.replace(/\\n\\s*/,\" \");R===T||~R.indexOf(\"\\n\")?g&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"):T=R}if(T+=\">\",i.test(k))throw new Error(k+\" is not a valid HTML tag name in \"+T);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)g&&f(I)&&(I=\"\\n\"+h+c(I,h)),T+=I;else if(null!=D&&y(J=[],D).length){for(var z=g&&~T.indexOf(\"\\n\"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,\"svg\"===k||\"foreignObject\"!==k&&u,p);if(g&&!z&&f(K)&&(z=!0),K)if(g){var Q=K.length>0&&\"<\"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(g&&z)for(var X=q.length;X--;)q[X]=\"\\n\"+h+c(q[X],h)}if(q.length||I)T+=q.join(\"\");else if(r&&r.xml)return T.substring(0,T.length-1)+\" />\";return!V||J||I?(g&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"),T=T+\"</\"+k+\">\"):T=T.replace(/>$/,\" />\"),T}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o,i=e.options.__s;return e.options.__s=!0,o=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0),e.options.__c&&e.options.__c(t,j),e.options.__s=i,j.length=0,o}function S(t,e){return\"className\"===t?\"class\":\"htmlFor\"===t?\"for\":\"defaultValue\"===t?\"value\":\"defaultChecked\"===t?\"checked\":\"defaultSelected\"===t?\"selected\":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,\"xlink:\"):t}function k(t,e){return\"style\"===t&&null!=e&&\"object\"==typeof e?d(e):\"a\"===t[0]&&\"r\"===t[1]&&\"boolean\"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return l(t);if(A(t)){for(var s=\"\",c=0;c<t.length;c++)s+=w(t[c],n,r,a);return s}e.options.__b&&e.options.__b(t);var f=t.type,u=t.props;if(\"function\"==typeof f){if(f===e.Fragment)return w(t.props.children,n,r,a);var p;p=f.prototype&&\"function\"==typeof f.prototype.render?function(t,n){var r=t.type,o=v(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=_(t,n),i=v(t.type,n);t.__c=o;for(var a=e.options.__r,s=0;o.__d&&s++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var d=t.__c;d.getChildContext&&(n=O({},n,d.getChildContext()));var y=w(p,n,r,a);return e.options.diffed&&e.options.diffed(t),y}var g,b,m=\"<\";if(m+=f,u)for(var h in g=u.children,u){var j=u[h];if(!(\"key\"===h||\"ref\"===h||\"__self\"===h||\"__source\"===h||\"children\"===h||\"className\"===h&&\"class\"in u||\"htmlFor\"===h&&\"for\"in u||i.test(h)))if(j=k(h=S(h,r),j),\"dangerouslySetInnerHTML\"===h)b=j&&j.__html;else if(\"textarea\"===f&&\"value\"===h)g=j;else if((j||0===j||\"\"===j)&&\"function\"!=typeof j){if(!0===j||\"\"===j){j=h,m=m+\" \"+h;continue}if(\"value\"===h){if(\"select\"===f){a=j;continue}\"option\"!==f||a!=j||\"selected\"in u||(m+=\" selected\")}m=m+\" \"+h+'=\"'+l(j)+'\"'}}var x=m;if(m+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+m);var F=\"\",C=!1;if(b)F+=b,C=!0;else if(\"string\"==typeof g)F+=l(g),C=!0;else if(A(g))for(var E=0;E<g.length;E++){var M=g[E];if(null!=M&&!1!==M){var H=w(M,n,\"svg\"===f||\"foreignObject\"!==f&&r,a);H&&(F+=H,C=!0)}}else if(null!=g&&!1!==g&&!0!==g){var N=w(g,n,\"svg\"===f||\"foreignObject\"!==f&&r,a);N&&(F+=N,C=!0)}if(e.options.diffed&&e.options.diffed(t),C)m+=F;else if(o.test(f))return x+\" />\";return m+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};const F=/(\\\\|\\\"|\\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\\((.*)\\)(.*)$/,I=/\\n/gi,T=Object.getOwnPropertySymbols||(t=>[]);function L(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 W(t){return\"\"===t.name?\"[Function anonymous]\":\"[Function \"+t.name+\"]\"}function $(t){return N.call(t).replace(D,\"Symbol($1)\")}function P(t){return\"[\"+M.call(t)+\"]\"}function U(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(F,\"\\\\$1\")}(t)+'\"';if(\"function\"===e)return W(t);if(\"symbol\"===e)return $(t);const n=C.call(t);return\"[object WeakMap]\"===n?\"WeakMap {}\":\"[object WeakSet]\"===n?\"WeakSet {}\":\"[object Function]\"===n||\"[object GeneratorFunction]\"===n?W(t,min):\"[object Symbol]\"===n?$(t):\"[object Date]\"===n?E.call(t):\"[object Error]\"===n?P(t):\"[object RegExp]\"===n?H.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":L(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&P(t)}function R(t,e,n,r,o,i,a,s,l,c){let f=\"\";if(t.length){f+=o;const u=n+e;for(let n=0;n<t.length;n++)f+=u+q(t[n],e,u,r,o,i,a,s,l,c),n<t.length-1&&(f+=\",\"+r);f+=o+n}return\"[\"+f+\"]\"}function J(t,e,n,r,o,i,a,s,l,c){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const f=++s>a;if(!f&&t.toJSON&&\"function\"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,s,l,c);const u=C.call(t);return\"[object Arguments]\"===u?f?\"[Arguments]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":\"Arguments \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):L(u)?f?\"[Array]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":t.constructor.name+\" \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):\"[object Map]\"===u?f?\"[Map]\":function(t,e,n,r,o,i,a,s,l,c){let f=\"Map {\";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[0],e,t,r,o,i,a,s,l,c)+\" => \"+q(p.value[1],e,t,r,o,i,a,s,l,c),p=u.next(),p.done||(f+=\",\"+r);f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"[object Set]\"===u?f?\"[Set]\":function(t,e,n,r,o,i,a,s,l,c){let f=\"Set {\";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[1],e,t,r,o,i,a,s,l,c),p=u.next(),p.done||(f+=\",\"+r);f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"object\"==typeof t?f?\"[Object]\":function(t,e,n,r,o,i,a,s,l,c){let f=(c?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",u=Object.keys(t).sort();const p=T(t);if(p.length&&(u=u.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===C.call(t))).concat(p)),u.length){f+=o;const p=n+e;for(let n=0;n<u.length;n++){const d=u[n];f+=p+q(d,e,p,r,o,i,a,s,l,c)+\": \"+q(t[d],e,p,r,o,i,a,s,l,c),n<u.length-1&&(f+=\",\"+r)}f+=o+n}return f+\"}\"}(t,e,n,r,o,i,a,s,l,c):void 0}function V(t,e,n,r,o,i,a,s,l,c){let f,u=!1;for(let e=0;e<l.length;e++)if(f=l[e],f.test(t)){u=!0;break}return!!u&&f.print(t,function(t){return q(t,e,n,r,o,i,a,s,l,c)},function(t){const r=n+e;return r+t.replace(I,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,s,l,c){return U(t)||V(t,e,n,r,o,i,a,s,l,c)||J(t,e,n,r,o,i,a,s,l,c)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(\" \")}var G={test:function(t){return t&&\"object\"==typeof t&&\"type\"in t&&\"props\"in t&&\"key\"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if(\"dangerouslySetInnerHTML\"===t)return!1;if(null==e||\"function\"===i&&!r.functions)return\"\";if(r.skipFalseAttributes&&!o&&(!1===e||(\"class\"===t||\"style\"===t)&&\"\"===e))return\"\";var a=\"string\"==typeof r.pretty?r.pretty:\"\\t\";return\"string\"!==i?(\"function\"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?\" \":\"\\n\",i=e.min?\"\":\"\\n\";if(e&&e.plugins.length){n=B(e.indent),r=[];var a=V(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf(\"\\n\")&&(e=c(\"\\n\"+e,a)+\"\\n\")):e=\"Function\",c(\"\\n\"+t+\"={\"+e+\"}\",a)):\"\\n\"+a+t+'=\"'+l(e)+'\"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:\" \"};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q});\n//# sourceMappingURL=jsx.js.map\n"],"names":["t","Symbol","n","s","c"],"mappings":"mEAAA,SAAsBA,GAAA,MAAXC,KAAAA,KAAuBC,GACjCD,WAEAA,SAASD,GAAUG,MAClB,KAAAH,OAAkBI,EAAAA"}
|
|
1
|
+
{"version":3,"file":"jsx.js","sources":["jsx.js"],"sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports,require(\"preact\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"preact\"],e):e((t||self).preactRenderToString={},t.preact)}(this,function(t,e){if(\"function\"!=typeof Symbol){var n=0;Symbol=function(t){return\"@@\"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\\s\\n\\\\/='\"\\0<>]/,a=/^xlink:?./,s=/[\"&<]/;function l(t){if(!1===s.test(t+=\"\"))return t;for(var e=0,n=0,r=\"\",o=\"\";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=\""\";break;case 38:o=\"&\";break;case 60:o=\"<\";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var c=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},u=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf(\"\\n\")||-1!==String(t).indexOf(\"<\")},f={},p=/([A-Z])/g;function d(t){var e=\"\";for(var n in t){var o=t[n];null!=o&&\"\"!==o&&(e&&(e+=\" \"),e+=\"-\"==n[0]?n:f[n]||(f[n]=n.replace(p,\"-$1\").toLowerCase()),e=\"number\"==typeof o&&!1===r.test(n)?e+\": \"+o+\"px;\":e+\": \"+o+\";\")}return e||void 0}function _(t,e){return Array.isArray(e)?e.reduce(_,t):null!=e&&!1!==e&&t.push(e),t}function y(){this.__d=!0}function g(t,e){return{__v:t,context:e,props:t.props,setState:y,forceUpdate:y,__d:!0,__h:[]}}function v(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(t,n,r,s,f,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return l(t);var y=r.pretty,h=y&&\"string\"==typeof y?y:\"\\t\";if(Array.isArray(t)){for(var j=\"\",x=0;x<t.length;x++)y&&x>0&&(j+=\"\\n\"),j+=m(t[x],n,r,s,f,p);return j}var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!s&&!1!==r.renderRootComponent){if(k===e.Fragment){var w=[];return _(w,t.props.children),m(w,n,r,!1!==r.shallowHighOrder,f,p)}var F,C=t.__c=g(t,n);e.options.__b&&e.options.__b(t);var E=e.options.__r;if(k.prototype&&\"function\"==typeof k.prototype.render){var M=v(k,n);(C=t.__c=new k(A,M)).__v=t,C._dirty=C.__d=!0,C.props=A,null==C.state&&(C.state={}),null==C._nextState&&null==C.__s&&(C._nextState=C.__s=C.state),C.context=M,k.getDerivedStateFromProps?C.state=Object.assign({},C.state,k.getDerivedStateFromProps(C.props,C.state)):C.componentWillMount&&(C.componentWillMount(),C.state=C._nextState!==C.state?C._nextState:C.__s!==C.state?C.__s:C.state),E&&E(t),F=C.render(C.props,C.state,C.context)}else for(var H=v(k,n),N=0;C.__d&&N++<25;)C.__d=!1,E&&E(t),F=k.call(t.__c,A,H);return C.getChildContext&&(n=Object.assign({},n,C.getChildContext())),e.options.diffed&&e.options.diffed(t),m(F,n,r,!1!==r.shallowHighOrder,f,p)}k=(S=k).displayName||S!==Function&&S.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\\s*function\\s+([^( ]+)/)||\"\")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e=\"UnnamedComponent\"+n}return e}(S)}var D,I,T=\"<\"+k;if(A){var L=Object.keys(A);r&&!0===r.sortAttributes&&L.sort();for(var W=0;W<L.length;W++){var $=L[W],P=A[$];if(\"children\"!==$){if(!i.test($)&&(r&&r.allAttributes||\"key\"!==$&&\"ref\"!==$&&\"__self\"!==$&&\"__source\"!==$)){if(\"defaultValue\"===$)$=\"value\";else if(\"defaultChecked\"===$)$=\"checked\";else if(\"defaultSelected\"===$)$=\"selected\";else if(\"className\"===$){if(void 0!==A.class)continue;$=\"class\"}else f&&a.test($)&&($=$.toLowerCase().replace(/^xlink:?/,\"xlink:\"));if(\"htmlFor\"===$){if(A.for)continue;$=\"for\"}\"style\"===$&&P&&\"object\"==typeof P&&(P=d(P)),\"a\"===$[0]&&\"r\"===$[1]&&\"boolean\"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook($,P,n,r,O);if(U||\"\"===U)T+=U;else if(\"dangerouslySetInnerHTML\"===$)I=P&&P.__html;else if(\"textarea\"===k&&\"value\"===$)D=P;else if((P||0===P||\"\"===P)&&\"function\"!=typeof P){if(!(!0!==P&&\"\"!==P||(P=$,r&&r.xml))){T=T+\" \"+$;continue}if(\"value\"===$){if(\"select\"===k){p=P;continue}\"option\"===k&&p==P&&void 0===A.selected&&(T+=\" selected\")}T=T+\" \"+$+'=\"'+l(P)+'\"'}}}else D=P}}if(y){var R=T.replace(/\\n\\s*/,\" \");R===T||~R.indexOf(\"\\n\")?y&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"):T=R}if(T+=\">\",i.test(k))throw new Error(k+\" is not a valid HTML tag name in \"+T);var J,V=o.test(k)||r.voidElements&&r.voidElements.test(k),q=[];if(I)y&&u(I)&&(I=\"\\n\"+h+c(I,h)),T+=I;else if(null!=D&&_(J=[],D).length){for(var z=y&&~T.indexOf(\"\\n\"),B=!1,G=0;G<J.length;G++){var Z=J[G];if(null!=Z&&!1!==Z){var K=m(Z,n,r,!0,\"svg\"===k||\"foreignObject\"!==k&&f,p);if(y&&!z&&u(K)&&(z=!0),K)if(y){var Q=K.length>0&&\"<\"!=K[0];B&&Q?q[q.length-1]+=K:q.push(K),B=Q}else q.push(K)}}if(y&&z)for(var X=q.length;X--;)q[X]=\"\\n\"+h+c(q[X],h)}if(q.length||I)T+=q.join(\"\");else if(r&&r.xml)return T.substring(0,T.length-1)+\" />\";return!V||J||I?(y&&~T.indexOf(\"\\n\")&&(T+=\"\\n\"),T=T+\"</\"+k+\">\"):T=T.replace(/>$/,\" />\"),T}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o=e.options.__s;e.options.__s=!0;var i,a=e.h(e.Fragment,null);return a.__k=[t],i=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0,a),e.options.__c&&e.options.__c(t,j),e.options.__s=o,j.length=0,i}function S(t,e){return\"className\"===t?\"class\":\"htmlFor\"===t?\"for\":\"defaultValue\"===t?\"value\":\"defaultChecked\"===t?\"checked\":\"defaultSelected\"===t?\"selected\":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,\"xlink:\"):t}function k(t,e){return\"style\"===t&&null!=e&&\"object\"==typeof e?d(e):\"a\"===t[0]&&\"r\"===t[1]&&\"boolean\"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(t,n,r,a,s){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return l(t);if(A(t)){var c=\"\";s.__k=t;for(var u=0;u<t.length;u++)c+=w(t[u],n,r,a,s);return c}t.__=s,e.options.__b&&e.options.__b(t);var f=t.type,p=t.props;if(\"function\"==typeof f){var d;if(f===e.Fragment)d=p.children;else{d=f.prototype&&\"function\"==typeof f.prototype.render?function(t,n){var r=t.type,o=v(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.options.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(t,n):function(t,n){var r,o=g(t,n),i=v(t.type,n);t.__c=o;for(var a=e.options.__r,s=0;o.__d&&s++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var _=t.__c;_.getChildContext&&(n=O({},n,_.getChildContext()))}var y=w(d,n,r,a,t);return e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),y}var b,m,h=\"<\";if(h+=f,p)for(var j in b=p.children,p){var x=p[j];if(!(\"key\"===j||\"ref\"===j||\"__self\"===j||\"__source\"===j||\"children\"===j||\"className\"===j&&\"class\"in p||\"htmlFor\"===j&&\"for\"in p||i.test(j)))if(x=k(j=S(j,r),x),\"dangerouslySetInnerHTML\"===j)m=x&&x.__html;else if(\"textarea\"===f&&\"value\"===j)b=x;else if((x||0===x||\"\"===x)&&\"function\"!=typeof x){if(!0===x||\"\"===x){x=j,h=h+\" \"+j;continue}if(\"value\"===j){if(\"select\"===f){a=x;continue}\"option\"!==f||a!=x||\"selected\"in p||(h+=\" selected\")}h=h+\" \"+j+'=\"'+l(x)+'\"'}}var F=h;if(h+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+h);var C=\"\",E=!1;if(m)C+=m,E=!0;else if(\"string\"==typeof b)C+=l(b),E=!0;else if(A(b)){t.__k=b;for(var M=0;M<b.length;M++){var H=b[M];if(null!=H&&!1!==H){var N=w(H,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);N&&(C+=N,E=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[b];var D=w(b,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);D&&(C+=D,E=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),E)h+=C;else if(o.test(f))return F+\" />\";return h+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};const F=/(\\\\|\\\"|\\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\\((.*)\\)(.*)$/,I=/\\n/gi,T=Object.getOwnPropertySymbols||(t=>[]);function L(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 W(t){return\"\"===t.name?\"[Function anonymous]\":\"[Function \"+t.name+\"]\"}function $(t){return N.call(t).replace(D,\"Symbol($1)\")}function P(t){return\"[\"+M.call(t)+\"]\"}function U(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(F,\"\\\\$1\")}(t)+'\"';if(\"function\"===e)return W(t);if(\"symbol\"===e)return $(t);const n=C.call(t);return\"[object WeakMap]\"===n?\"WeakMap {}\":\"[object WeakSet]\"===n?\"WeakSet {}\":\"[object Function]\"===n||\"[object GeneratorFunction]\"===n?W(t,min):\"[object Symbol]\"===n?$(t):\"[object Date]\"===n?E.call(t):\"[object Error]\"===n?P(t):\"[object RegExp]\"===n?H.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":L(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&P(t)}function R(t,e,n,r,o,i,a,s,l,c){let u=\"\";if(t.length){u+=o;const f=n+e;for(let n=0;n<t.length;n++)u+=f+q(t[n],e,f,r,o,i,a,s,l,c),n<t.length-1&&(u+=\",\"+r);u+=o+n}return\"[\"+u+\"]\"}function J(t,e,n,r,o,i,a,s,l,c){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const u=++s>a;if(!u&&t.toJSON&&\"function\"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,s,l,c);const f=C.call(t);return\"[object Arguments]\"===f?u?\"[Arguments]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":\"Arguments \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):L(f)?u?\"[Array]\":function(t,e,n,r,o,i,a,s,l,c){return(c?\"\":t.constructor.name+\" \")+R(t,e,n,r,o,i,a,s,l,c)}(t,e,n,r,o,i,a,s,l,c):\"[object Map]\"===f?u?\"[Map]\":function(t,e,n,r,o,i,a,s,l,c){let u=\"Map {\";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+q(p.value[0],e,t,r,o,i,a,s,l,c)+\" => \"+q(p.value[1],e,t,r,o,i,a,s,l,c),p=f.next(),p.done||(u+=\",\"+r);u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"[object Set]\"===f?u?\"[Set]\":function(t,e,n,r,o,i,a,s,l,c){let u=\"Set {\";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+q(p.value[1],e,t,r,o,i,a,s,l,c),p=f.next(),p.done||(u+=\",\"+r);u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):\"object\"==typeof t?u?\"[Object]\":function(t,e,n,r,o,i,a,s,l,c){let u=(c?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",f=Object.keys(t).sort();const p=T(t);if(p.length&&(f=f.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===C.call(t))).concat(p)),f.length){u+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];u+=p+q(d,e,p,r,o,i,a,s,l,c)+\": \"+q(t[d],e,p,r,o,i,a,s,l,c),n<f.length-1&&(u+=\",\"+r)}u+=o+n}return u+\"}\"}(t,e,n,r,o,i,a,s,l,c):void 0}function V(t,e,n,r,o,i,a,s,l,c){let u,f=!1;for(let e=0;e<l.length;e++)if(u=l[e],u.test(t)){f=!0;break}return!!f&&u.print(t,function(t){return q(t,e,n,r,o,i,a,s,l,c)},function(t){const r=n+e;return r+t.replace(I,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,s,l,c){return U(t)||V(t,e,n,r,o,i,a,s,l,c)||J(t,e,n,r,o,i,a,s,l,c)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(\" \")}var G={test:function(t){return t&&\"object\"==typeof t&&\"type\"in t&&\"props\"in t&&\"key\"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if(\"dangerouslySetInnerHTML\"===t)return!1;if(null==e||\"function\"===i&&!r.functions)return\"\";if(r.skipFalseAttributes&&!o&&(!1===e||(\"class\"===t||\"style\"===t)&&\"\"===e))return\"\";var a=\"string\"==typeof r.pretty?r.pretty:\"\\t\";return\"string\"!==i?(\"function\"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?\" \":\"\\n\",i=e.min?\"\":\"\\n\";if(e&&e.plugins.length){n=B(e.indent),r=[];var a=V(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,\"\",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf(\"\\n\")&&(e=c(\"\\n\"+e,a)+\"\\n\")):e=\"Function\",c(\"\\n\"+t+\"={\"+e+\"}\",a)):\"\\n\"+a+t+'=\"'+l(e)+'\"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:\" \"};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}t.default=Q,t.render=Q});\n//# sourceMappingURL=jsx.js.map\n"],"names":["t","Symbol","n","s","c"],"mappings":"mEAAA,SAAsBA,GAAA,MAAXC,KAAAA,KAAuBC,GACjCD,WAEAA,SAASD,GAAUG,MAClB,KAAAH,OAAkBI,EAAAA"}
|
package/dist/jsx.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as t,options as e}from"preact";if("function"!=typeof Symbol){var n=0;Symbol=function(t){return"@@"+t+ ++n},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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\s\n\\/='"\0<>]/,a=/^xlink:?./,l=/["&<]/;function c(t){if(!1===l.test(t+=""))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var s=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},u={},p=/([A-Z])/g;function d(t){var e="";for(var n in t){var o=t[n];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==n[0]?n:u[n]||(u[n]=n.replace(p,"-$1").toLowerCase()),e="number"==typeof o&&!1===r.test(n)?e+": "+o+"px;":e+": "+o+";")}return e||void 0}function y(t,e){return Array.isArray(e)?e.reduce(y,t):null!=e&&!1!==e&&t.push(e),t}function _(){this.__d=!0}function g(t,e){return{__v:t,context:e,props:t.props,setState:_,forceUpdate:_,__d:!0,__h:[]}}function v(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var b=[];function m(n,r,l,u,p,_){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return c(n);var h=l.pretty,j=h&&"string"==typeof h?h:"\t";if(Array.isArray(n)){for(var x="",S=0;S<n.length;S++)h&&S>0&&(x+="\n"),x+=m(n[S],r,l,u,p,_);return x}var k,A=n.type,O=n.props,w=!1;if("function"==typeof A){if(w=!0,!l.shallow||!u&&!1!==l.renderRootComponent){if(A===t){var F=[];return y(F,n.props.children),m(F,r,l,!1!==l.shallowHighOrder,p,_)}var C,E=n.__c=g(n,r);e.__b&&e.__b(n);var M=e.__r;if(A.prototype&&"function"==typeof A.prototype.render){var H=v(A,r);(E=n.__c=new A(O,H)).__v=n,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=H,A.getDerivedStateFromProps?E.state=Object.assign({},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),M&&M(n),C=E.render(E.props,E.state,E.context)}else for(var N=v(A,r),D=0;E.__d&&D++<25;)E.__d=!1,M&&M(n),C=A.call(n.__c,O,N);return E.getChildContext&&(r=Object.assign({},r,E.getChildContext())),e.diffed&&e.diffed(n),m(C,r,l,!1!==l.shallowHighOrder,p,_)}A=(k=A).displayName||k!==Function&&k.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){for(var n=-1,r=b.length;r--;)if(b[r]===t){n=r;break}n<0&&(n=b.push(t)-1),e="UnnamedComponent"+n}return e}(k)}var I,L,W="<"+A;if(O){var $=Object.keys(O);l&&!0===l.sortAttributes&&$.sort();for(var P=0;P<$.length;P++){var T=$[P],U=O[T];if("children"!==T){if(!i.test(T)&&(l&&l.allAttributes||"key"!==T&&"ref"!==T&&"__self"!==T&&"__source"!==T)){if("defaultValue"===T)T="value";else if("defaultChecked"===T)T="checked";else if("defaultSelected"===T)T="selected";else if("className"===T){if(void 0!==O.class)continue;T="class"}else p&&a.test(T)&&(T=T.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===T){if(O.for)continue;T="for"}"style"===T&&U&&"object"==typeof U&&(U=d(U)),"a"===T[0]&&"r"===T[1]&&"boolean"==typeof U&&(U=String(U));var R=l.attributeHook&&l.attributeHook(T,U,r,l,w);if(R||""===R)W+=R;else if("dangerouslySetInnerHTML"===T)L=U&&U.__html;else if("textarea"===A&&"value"===T)I=U;else if((U||0===U||""===U)&&"function"!=typeof U){if(!(!0!==U&&""!==U||(U=T,l&&l.xml))){W=W+" "+T;continue}if("value"===T){if("select"===A){_=U;continue}"option"===A&&_==U&&void 0===O.selected&&(W+=" selected")}W=W+" "+T+'="'+c(U)+'"'}}}else I=U}}if(h){var J=W.replace(/\n\s*/," ");J===W||~J.indexOf("\n")?h&&~W.indexOf("\n")&&(W+="\n"):W=J}if(W+=">",i.test(A))throw new Error(A+" is not a valid HTML tag name in "+W);var V,q=o.test(A)||l.voidElements&&l.voidElements.test(A),z=[];if(L)h&&f(L)&&(L="\n"+j+s(L,j)),W+=L;else if(null!=I&&y(V=[],I).length){for(var B=h&&~W.indexOf("\n"),G=!1,Z=0;Z<V.length;Z++){var K=V[Z];if(null!=K&&!1!==K){var Q=m(K,r,l,!0,"svg"===A||"foreignObject"!==A&&p,_);if(h&&!B&&f(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"+j+s(z[Y],j)}if(z.length||L)W+=z.join("");else if(l&&l.xml)return W.substring(0,W.length-1)+" />";return!q||V||L?(h&&~W.indexOf("\n")&&(W+="\n"),W=W+"</"+A+">"):W=W.replace(/>$/," />"),W}var h={shallow:!0};x.render=x;var j=[];function x(t,n,r){n=n||{};var o,i=e.__s;return e.__s=!0,o=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):w(t,n,!1,void 0),e.__c&&e.__c(t,j),e.__s=i,j.length=0,o}function S(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&a.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function k(t,e){return"style"===t&&null!=e&&"object"==typeof e?d(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}var A=Array.isArray,O=Object.assign;function w(n,r,a,l){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return c(n);if(A(n)){for(var s="",f=0;f<n.length;f++)s+=w(n[f],r,a,l);return s}e.__b&&e.__b(n);var u=n.type,p=n.props;if("function"==typeof u){if(u===t)return w(n.props.children,r,a,l);var d;d=u.prototype&&"function"==typeof u.prototype.render?function(t,n){var r=t.type,o=v(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(n,r):function(t,n){var r,o=g(t,n),i=v(t.type,n);t.__c=o;for(var a=e.__r,l=0;o.__d&&l++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(n,r);var y=n.__c;y.getChildContext&&(r=O({},r,y.getChildContext()));var _=w(d,r,a,l);return e.diffed&&e.diffed(n),_}var b,m,h="<";if(h+=u,p)for(var j in b=p.children,p){var x=p[j];if(!("key"===j||"ref"===j||"__self"===j||"__source"===j||"children"===j||"className"===j&&"class"in p||"htmlFor"===j&&"for"in p||i.test(j)))if(x=k(j=S(j,a),x),"dangerouslySetInnerHTML"===j)m=x&&x.__html;else if("textarea"===u&&"value"===j)b=x;else if((x||0===x||""===x)&&"function"!=typeof x){if(!0===x||""===x){x=j,h=h+" "+j;continue}if("value"===j){if("select"===u){l=x;continue}"option"!==u||l!=x||"selected"in p||(h+=" selected")}h=h+" "+j+'="'+c(x)+'"'}}var F=h;if(h+=">",i.test(u))throw new Error(u+" is not a valid HTML tag name in "+h);var C="",E=!1;if(m)C+=m,E=!0;else if("string"==typeof b)C+=c(b),E=!0;else if(A(b))for(var M=0;M<b.length;M++){var H=b[M];if(null!=H&&!1!==H){var N=w(H,r,"svg"===u||"foreignObject"!==u&&a,l);N&&(C+=N,E=!0)}}else if(null!=b&&!1!==b&&!0!==b){var D=w(b,r,"svg"===u||"foreignObject"!==u&&a,l);D&&(C+=D,E=!0)}if(e.diffed&&e.diffed(n),E)h+=C;else if(o.test(u))return F+" />";return h+"</"+u+">"}x.shallowRender=function(t,e){return x(t,e,h)};const F=/(\\|\"|\')/g,C=Object.prototype.toString,E=Date.prototype.toISOString,M=Error.prototype.toString,H=RegExp.prototype.toString,N=Symbol.prototype.toString,D=/^Symbol\((.*)\)(.*)$/,I=/\n/gi,L=Object.getOwnPropertySymbols||(t=>[]);function W(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 $(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function P(t){return N.call(t).replace(D,"Symbol($1)")}function T(t){return"["+M.call(t)+"]"}function U(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(F,"\\$1")}(t)+'"';if("function"===e)return $(t);if("symbol"===e)return P(t);const n=C.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?$(t,min):"[object Symbol]"===n?P(t):"[object Date]"===n?E.call(t):"[object Error]"===n?T(t):"[object RegExp]"===n?H.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":W(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&T(t)}function R(t,e,n,r,o,i,a,l,c,s){let f="";if(t.length){f+=o;const u=n+e;for(let n=0;n<t.length;n++)f+=u+q(t[n],e,u,r,o,i,a,l,c,s),n<t.length-1&&(f+=","+r);f+=o+n}return"["+f+"]"}function J(t,e,n,r,o,i,a,l,c,s){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const f=++l>a;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,a,l,c,s);const u=C.call(t);return"[object Arguments]"===u?f?"[Arguments]":function(t,e,n,r,o,i,a,l,c,s){return(s?"":"Arguments ")+R(t,e,n,r,o,i,a,l,c,s)}(t,e,n,r,o,i,a,l,c,s):W(u)?f?"[Array]":function(t,e,n,r,o,i,a,l,c,s){return(s?"":t.constructor.name+" ")+R(t,e,n,r,o,i,a,l,c,s)}(t,e,n,r,o,i,a,l,c,s):"[object Map]"===u?f?"[Map]":function(t,e,n,r,o,i,a,l,c,s){let f="Map {";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[0],e,t,r,o,i,a,l,c,s)+" => "+q(p.value[1],e,t,r,o,i,a,l,c,s),p=u.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,a,l,c,s):"[object Set]"===u?f?"[Set]":function(t,e,n,r,o,i,a,l,c,s){let f="Set {";const u=t.entries();let p=u.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[1],e,t,r,o,i,a,l,c,s),p=u.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,a,l,c,s):"object"==typeof t?f?"[Object]":function(t,e,n,r,o,i,a,l,c,s){let f=(s?"":t.constructor?t.constructor.name+" ":"Object ")+"{",u=Object.keys(t).sort();const p=L(t);if(p.length&&(u=u.filter(t=>!("symbol"==typeof t||"[object Symbol]"===C.call(t))).concat(p)),u.length){f+=o;const p=n+e;for(let n=0;n<u.length;n++){const d=u[n];f+=p+q(d,e,p,r,o,i,a,l,c,s)+": "+q(t[d],e,p,r,o,i,a,l,c,s),n<u.length-1&&(f+=","+r)}f+=o+n}return f+"}"}(t,e,n,r,o,i,a,l,c,s):void 0}function V(t,e,n,r,o,i,a,l,c,s){let f,u=!1;for(let e=0;e<c.length;e++)if(f=c[e],f.test(t)){u=!0;break}return!!u&&f.print(t,function(t){return q(t,e,n,r,o,i,a,l,c,s)},function(t){const r=n+e;return r+t.replace(I,"\n"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,a,l,c,s){return U(t)||V(t,e,n,r,o,i,a,l,c,s)||J(t,e,n,r,o,i,a,l,c,s)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(" ")}var G={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,e,n){return x(t,G.context,G.opts)}},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){var i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=B(e.indent),r=[];var a=V(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf("\n")&&(e=s("\n"+e,a)+"\n")):e="Function",s("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+c(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function Q(t,e,n,r){return x(t,e,n=Object.assign({},K,n||{}))}export default Q;export{Q as render};
|
|
1
|
+
import{Fragment as t,options as e,h as n}from"preact";if("function"!=typeof Symbol){var r=0;Symbol=function(t){return"@@"+t+ ++r},Symbol.for=function(t){return"@@"+t}}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,i=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,a=/[\s\n\\/='"\0<>]/,l=/^xlink:?./,c=/["&<]/;function s(t){if(!1===c.test(t+=""))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var u=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},p={},d=/([A-Z])/g;function _(t){var e="";for(var n in t){var r=t[n];null!=r&&""!==r&&(e&&(e+=" "),e+="-"==n[0]?n:p[n]||(p[n]=n.replace(d,"-$1").toLowerCase()),e="number"==typeof r&&!1===o.test(n)?e+": "+r+"px;":e+": "+r+";")}return e||void 0}function y(t,e){return Array.isArray(e)?e.reduce(y,t):null!=e&&!1!==e&&t.push(e),t}function v(){this.__d=!0}function g(t,e){return{__v:t,context:e,props:t.props,setState:v,forceUpdate:v,__d:!0,__h:[]}}function b(t,e){var n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}var m=[];function h(n,r,o,c,p,d){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return s(n);var v=o.pretty,j=v&&"string"==typeof v?v:"\t";if(Array.isArray(n)){for(var x="",S=0;S<n.length;S++)v&&S>0&&(x+="\n"),x+=h(n[S],r,o,c,p,d);return x}var k,A=n.type,O=n.props,w=!1;if("function"==typeof A){if(w=!0,!o.shallow||!c&&!1!==o.renderRootComponent){if(A===t){var F=[];return y(F,n.props.children),h(F,r,o,!1!==o.shallowHighOrder,p,d)}var C,E=n.__c=g(n,r);e.__b&&e.__b(n);var M=e.__r;if(A.prototype&&"function"==typeof A.prototype.render){var H=b(A,r);(E=n.__c=new A(O,H)).__v=n,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=H,A.getDerivedStateFromProps?E.state=Object.assign({},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),M&&M(n),C=E.render(E.props,E.state,E.context)}else for(var N=b(A,r),D=0;E.__d&&D++<25;)E.__d=!1,M&&M(n),C=A.call(n.__c,O,N);return E.getChildContext&&(r=Object.assign({},r,E.getChildContext())),e.diffed&&e.diffed(n),h(C,r,o,!1!==o.shallowHighOrder,p,d)}A=(k=A).displayName||k!==Function&&k.name||function(t){var e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){for(var n=-1,r=m.length;r--;)if(m[r]===t){n=r;break}n<0&&(n=m.push(t)-1),e="UnnamedComponent"+n}return e}(k)}var I,L,W="<"+A;if(O){var $=Object.keys(O);o&&!0===o.sortAttributes&&$.sort();for(var P=0;P<$.length;P++){var T=$[P],U=O[T];if("children"!==T){if(!a.test(T)&&(o&&o.allAttributes||"key"!==T&&"ref"!==T&&"__self"!==T&&"__source"!==T)){if("defaultValue"===T)T="value";else if("defaultChecked"===T)T="checked";else if("defaultSelected"===T)T="selected";else if("className"===T){if(void 0!==O.class)continue;T="class"}else p&&l.test(T)&&(T=T.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===T){if(O.for)continue;T="for"}"style"===T&&U&&"object"==typeof U&&(U=_(U)),"a"===T[0]&&"r"===T[1]&&"boolean"==typeof U&&(U=String(U));var R=o.attributeHook&&o.attributeHook(T,U,r,o,w);if(R||""===R)W+=R;else if("dangerouslySetInnerHTML"===T)L=U&&U.__html;else if("textarea"===A&&"value"===T)I=U;else if((U||0===U||""===U)&&"function"!=typeof U){if(!(!0!==U&&""!==U||(U=T,o&&o.xml))){W=W+" "+T;continue}if("value"===T){if("select"===A){d=U;continue}"option"===A&&d==U&&void 0===O.selected&&(W+=" selected")}W=W+" "+T+'="'+s(U)+'"'}}}else I=U}}if(v){var J=W.replace(/\n\s*/," ");J===W||~J.indexOf("\n")?v&&~W.indexOf("\n")&&(W+="\n"):W=J}if(W+=">",a.test(A))throw new Error(A+" is not a valid HTML tag name in "+W);var V,q=i.test(A)||o.voidElements&&o.voidElements.test(A),z=[];if(L)v&&f(L)&&(L="\n"+j+u(L,j)),W+=L;else if(null!=I&&y(V=[],I).length){for(var B=v&&~W.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(v&&!B&&f(Q)&&(B=!0),Q)if(v){var X=Q.length>0&&"<"!=Q[0];G&&X?z[z.length-1]+=Q:z.push(Q),G=X}else z.push(Q)}}if(v&&B)for(var Y=z.length;Y--;)z[Y]="\n"+j+u(z[Y],j)}if(z.length||L)W+=z.join("");else if(o&&o.xml)return W.substring(0,W.length-1)+" />";return!q||V||L?(v&&~W.indexOf("\n")&&(W+="\n"),W=W+"</"+A+">"):W=W.replace(/>$/," />"),W}var j={shallow:!0};S.render=S;var x=[];function S(r,o,i){o=o||{};var a=e.__s;e.__s=!0;var l,c=n(t,null);return c.__k=[r],l=i&&(i.pretty||i.voidElements||i.sortAttributes||i.shallow||i.allAttributes||i.xml||i.attributeHook)?h(r,o,i):F(r,o,!1,void 0,c),e.__c&&e.__c(r,x),e.__s=a,x.length=0,l}function k(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&l.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function A(t,e){return"style"===t&&null!=e&&"object"==typeof e?_(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}var O=Array.isArray,w=Object.assign;function F(n,r,o,l,c){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return s(n);if(O(n)){var u="";c.__k=n;for(var f=0;f<n.length;f++)u+=F(n[f],r,o,l,c);return u}n.__=c,e.__b&&e.__b(n);var p=n.type,d=n.props;if("function"==typeof p){var _;if(p===t)_=d.children;else{_=p.prototype&&"function"==typeof p.prototype.render?function(t,n){var r=t.type,o=b(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=w({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);var a=e.__r;return a&&a(t),i.render(i.props,i.state,i.context)}(n,r):function(t,n){var r,o=g(t,n),i=b(t.type,n);t.__c=o;for(var a=e.__r,l=0;o.__d&&l++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(n,r);var y=n.__c;y.getChildContext&&(r=w({},r,y.getChildContext()))}var v=F(_,r,o,l,n);return e.diffed&&e.diffed(n),n.__=void 0,e.unmount&&e.unmount(n),v}var m,h,j="<";if(j+=p,d)for(var x in m=d.children,d){var S=d[x];if(!("key"===x||"ref"===x||"__self"===x||"__source"===x||"children"===x||"className"===x&&"class"in d||"htmlFor"===x&&"for"in d||a.test(x)))if(S=A(x=k(x,o),S),"dangerouslySetInnerHTML"===x)h=S&&S.__html;else if("textarea"===p&&"value"===x)m=S;else if((S||0===S||""===S)&&"function"!=typeof S){if(!0===S||""===S){S=x,j=j+" "+x;continue}if("value"===x){if("select"===p){l=S;continue}"option"!==p||l!=S||"selected"in d||(j+=" selected")}j=j+" "+x+'="'+s(S)+'"'}}var C=j;if(j+=">",a.test(p))throw new Error(p+" is not a valid HTML tag name in "+j);var E="",M=!1;if(h)E+=h,M=!0;else if("string"==typeof m)E+=s(m),M=!0;else if(O(m)){n.__k=m;for(var H=0;H<m.length;H++){var N=m[H];if(null!=N&&!1!==N){var D=F(N,r,"svg"===p||"foreignObject"!==p&&o,l,n);D&&(E+=D,M=!0)}}}else if(null!=m&&!1!==m&&!0!==m){n.__k=[m];var I=F(m,r,"svg"===p||"foreignObject"!==p&&o,l,n);I&&(E+=I,M=!0)}if(e.diffed&&e.diffed(n),n.__=void 0,e.unmount&&e.unmount(n),M)j+=E;else if(i.test(p))return C+" />";return j+"</"+p+">"}S.shallowRender=function(t,e){return S(t,e,j)};const C=/(\\|\"|\')/g,E=Object.prototype.toString,M=Date.prototype.toISOString,H=Error.prototype.toString,N=RegExp.prototype.toString,D=Symbol.prototype.toString,I=/^Symbol\((.*)\)(.*)$/,L=/\n/gi,W=Object.getOwnPropertySymbols||(t=>[]);function $(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 P(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function T(t){return D.call(t).replace(I,"Symbol($1)")}function U(t){return"["+H.call(t)+"]"}function R(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(C,"\\$1")}(t)+'"';if("function"===e)return P(t);if("symbol"===e)return T(t);const n=E.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?P(t,min):"[object Symbol]"===n?T(t):"[object Date]"===n?M.call(t):"[object Error]"===n?U(t):"[object RegExp]"===n?N.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":$(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&U(t)}function J(t,e,n,r,o,i,a,l,c,s){let u="";if(t.length){u+=o;const f=n+e;for(let n=0;n<t.length;n++)u+=f+z(t[n],e,f,r,o,i,a,l,c,s),n<t.length-1&&(u+=","+r);u+=o+n}return"["+u+"]"}function V(t,e,n,r,o,i,a,l,c,s){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const u=++l>a;if(!u&&t.toJSON&&"function"==typeof t.toJSON)return z(t.toJSON(),e,n,r,o,i,a,l,c,s);const f=E.call(t);return"[object Arguments]"===f?u?"[Arguments]":function(t,e,n,r,o,i,a,l,c,s){return(s?"":"Arguments ")+J(t,e,n,r,o,i,a,l,c,s)}(t,e,n,r,o,i,a,l,c,s):$(f)?u?"[Array]":function(t,e,n,r,o,i,a,l,c,s){return(s?"":t.constructor.name+" ")+J(t,e,n,r,o,i,a,l,c,s)}(t,e,n,r,o,i,a,l,c,s):"[object Map]"===f?u?"[Map]":function(t,e,n,r,o,i,a,l,c,s){let u="Map {";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+z(p.value[0],e,t,r,o,i,a,l,c,s)+" => "+z(p.value[1],e,t,r,o,i,a,l,c,s),p=f.next(),p.done||(u+=","+r);u+=o+n}return u+"}"}(t,e,n,r,o,i,a,l,c,s):"[object Set]"===f?u?"[Set]":function(t,e,n,r,o,i,a,l,c,s){let u="Set {";const f=t.entries();let p=f.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+z(p.value[1],e,t,r,o,i,a,l,c,s),p=f.next(),p.done||(u+=","+r);u+=o+n}return u+"}"}(t,e,n,r,o,i,a,l,c,s):"object"==typeof t?u?"[Object]":function(t,e,n,r,o,i,a,l,c,s){let u=(s?"":t.constructor?t.constructor.name+" ":"Object ")+"{",f=Object.keys(t).sort();const p=W(t);if(p.length&&(f=f.filter(t=>!("symbol"==typeof t||"[object Symbol]"===E.call(t))).concat(p)),f.length){u+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];u+=p+z(d,e,p,r,o,i,a,l,c,s)+": "+z(t[d],e,p,r,o,i,a,l,c,s),n<f.length-1&&(u+=","+r)}u+=o+n}return u+"}"}(t,e,n,r,o,i,a,l,c,s):void 0}function q(t,e,n,r,o,i,a,l,c,s){let u,f=!1;for(let e=0;e<c.length;e++)if(u=c[e],u.test(t)){f=!0;break}return!!f&&u.print(t,function(t){return z(t,e,n,r,o,i,a,l,c,s)},function(t){const r=n+e;return r+t.replace(L,"\n"+r)},{edgeSpacing:o,spacing:r})}function z(t,e,n,r,o,i,a,l,c,s){return R(t)||q(t,e,n,r,o,i,a,l,c,s)||V(t,e,n,r,o,i,a,l,c,s)}const B={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function G(t){return new Array(t+1).join(" ")}var Z={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,e,n){return S(t,Z.context,Z.opts)}},K={plugins:[Z]},Q={attributeHook:function(t,e,n,r,o){var i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(Z.context=n,Z.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!B.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(B).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:B[n]),e.min&&(e.indent=0),e}(e)):e=B;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=G(e.indent),r=[];var a=q(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return R(t)||(n||(n=G(e.indent)),r||(r=[]),V(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,K)).indexOf("\n")&&(e=u("\n"+e,a)+"\n")):e="Function",u("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+s(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function X(t,e,n,r){return S(t,e,n=Object.assign({},Q,n||{}))}export default X;export{X as render};
|
|
2
2
|
//# sourceMappingURL=jsx.module.js.map
|
package/dist/jsx.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as t,options 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=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,o=/[\s\n\\/='"\0<>]/,i=/^xlink:?./,l=/["&<]/;function s(t){if(!1===l.test(t+=""))return t;let e=0,n=0,r="",o="";for(;n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}let c=(t,e)=>String(t).replace(/(\n+)/g,"$1"+(e||"\t")),f=(t,e,n)=>String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<");const u={},a=/([A-Z])/g;function p(t){let e="";for(let r in t){let o=t[r];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==r[0]?r:u[r]||(u[r]=r.replace(a,"-$1").toLowerCase()),e="number"==typeof o&&!1===n.test(r)?e+": "+o+"px;":e+": "+o+";")}return e||void 0}function d(t,e){return Array.isArray(e)?e.reduce(d,t):null!=e&&!1!==e&&t.push(e),t}function y(){this.__d=!0}function _(t,e){return{__v:t,context:e,props:t.props,setState:y,forceUpdate:y,__d:!0,__h:[]}}function g(t,e){let n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}const b=[];function m(n,l,u,a,y,h){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return s(n);let j=u.pretty,x=j&&"string"==typeof j?j:"\t";if(Array.isArray(n)){let t="";for(let e=0;e<n.length;e++)j&&e>0&&(t+="\n"),t+=m(n[e],l,u,a,y,h);return t}let S=n.type,v=n.props,k=!1;if("function"==typeof S){if(k=!0,!u.shallow||!a&&!1!==u.renderRootComponent){if(S===t){const t=[];return d(t,n.props.children),m(t,l,u,!1!==u.shallowHighOrder,y,h)}{let t,r=n.__c=_(n,l);e.__b&&e.__b(n);let o=e.__r;if(S.prototype&&"function"==typeof S.prototype.render){let e=g(S,l);r=n.__c=new S(v,e),r.__v=n,r._dirty=r.__d=!0,r.props=v,null==r.state&&(r.state={}),null==r._nextState&&null==r.__s&&(r._nextState=r.__s=r.state),r.context=e,S.getDerivedStateFromProps?r.state=Object.assign({},r.state,S.getDerivedStateFromProps(r.props,r.state)):r.componentWillMount&&(r.componentWillMount(),r.state=r._nextState!==r.state?r._nextState:r.__s!==r.state?r.__s:r.state),o&&o(n),t=r.render(r.props,r.state,r.context)}else{let e=g(S,l),i=0;for(;r.__d&&i++<25;)r.__d=!1,o&&o(n),t=S.call(n.__c,v,e)}return r.getChildContext&&(l=Object.assign({},l,r.getChildContext())),e.diffed&&e.diffed(n),m(t,l,u,!1!==u.shallowHighOrder,y,h)}}S=(A=S).displayName||A!==Function&&A.name||function(t){let e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){let n=-1;for(let e=b.length;e--;)if(b[e]===t){n=e;break}n<0&&(n=b.push(t)-1),e=`UnnamedComponent${n}`}return e}(A)}var A;let O,w,$="<"+S;if(v){let t=Object.keys(v);u&&!0===u.sortAttributes&&t.sort();for(let e=0;e<t.length;e++){let n=t[e],r=v[n];if("children"===n){O=r;continue}if(o.test(n))continue;if(!(u&&u.allAttributes||"key"!==n&&"ref"!==n&&"__self"!==n&&"__source"!==n))continue;if("defaultValue"===n)n="value";else if("defaultChecked"===n)n="checked";else if("defaultSelected"===n)n="selected";else if("className"===n){if(void 0!==v.class)continue;n="class"}else y&&i.test(n)&&(n=n.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===n){if(v.for)continue;n="for"}"style"===n&&r&&"object"==typeof r&&(r=p(r)),"a"===n[0]&&"r"===n[1]&&"boolean"==typeof r&&(r=String(r));let c=u.attributeHook&&u.attributeHook(n,r,l,u,k);if(c||""===c)$+=c;else if("dangerouslySetInnerHTML"===n)w=r&&r.__html;else if("textarea"===S&&"value"===n)O=r;else if((r||0===r||""===r)&&"function"!=typeof r){if(!(!0!==r&&""!==r||(r=n,u&&u.xml))){$=$+" "+n;continue}if("value"===n){if("select"===S){h=r;continue}"option"===S&&h==r&&void 0===v.selected&&($+=" selected")}$+=` ${n}="${s(r)}"`}}}if(j){let t=$.replace(/\n\s*/," ");t===$||~t.indexOf("\n")?j&&~$.indexOf("\n")&&($+="\n"):$=t}if($+=">",o.test(S))throw new Error(`${S} is not a valid HTML tag name in ${$}`);let F,C=r.test(S)||u.voidElements&&u.voidElements.test(S),E=[];if(w)j&&f(w)&&(w="\n"+x+c(w,x)),$+=w;else if(null!=O&&d(F=[],O).length){let t=j&&~$.indexOf("\n"),e=!1;for(let n=0;n<F.length;n++){let r=F[n];if(null!=r&&!1!==r){let n=m(r,l,u,!0,"svg"===S||"foreignObject"!==S&&y,h);if(j&&!t&&f(n)&&(t=!0),n)if(j){let t=n.length>0&&"<"!=n[0];e&&t?E[E.length-1]+=n:E.push(n),e=t}else E.push(n)}}if(j&&t)for(let t=E.length;t--;)E[t]="\n"+x+c(E[t],x)}if(E.length||w)$+=E.join("");else if(u&&u.xml)return $.substring(0,$.length-1)+" />";return!C||F||w?(j&&~$.indexOf("\n")&&($+="\n"),$+=`</${S}>`):$=$.replace(/>$/," />"),$}const h={shallow:!0};x.render=x;const j=[];function x(t,n,r){n=n||{};const o=e.__s;let i;return e.__s=!0,i=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?m(t,n,r):O(t,n,!1,void 0),e.__c&&e.__c(t,j),e.__s=o,j.length=0,i}function S(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&i.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function v(t,e){return"style"===t&&null!=e&&"object"==typeof e?p(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}const k=Array.isArray,A=Object.assign;function O(n,i,l,c){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return s(n);if(k(n)){let t="";for(let e=0;e<n.length;e++)t+=O(n[e],i,l,c);return t}e.__b&&e.__b(n);let f=n.type,u=n.props;if("function"==typeof f){if(f===t)return O(n.props.children,i,l,c);let r;r=f.prototype&&"function"==typeof f.prototype.render?function(t,n){let r=t.type,o=g(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=A({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);let l=e.__r;return l&&l(t),i.render(i.props,i.state,i.context)}(n,i):function(t,n){let r,o=_(t,n),i=g(t.type,n);t.__c=o;let l=e.__r,s=0;for(;o.__d&&s++<25;)o.__d=!1,l&&l(t),r=t.type.call(o,t.props,i);return r}(n,i);let o=n.__c;o.getChildContext&&(i=A({},i,o.getChildContext()));const s=O(r,i,l,c);return e.diffed&&e.diffed(n),s}let a,p,d="<";if(d+=f,u){a=u.children;for(let t in u){let e=u[t];if(!("key"===t||"ref"===t||"__self"===t||"__source"===t||"children"===t||"className"===t&&"class"in u||"htmlFor"===t&&"for"in u||o.test(t)))if(t=S(t,l),e=v(t,e),"dangerouslySetInnerHTML"===t)p=e&&e.__html;else if("textarea"===f&&"value"===t)a=e;else if((e||0===e||""===e)&&"function"!=typeof e){if(!0===e||""===e){e=t,d=d+" "+t;continue}if("value"===t){if("select"===f){c=e;continue}"option"!==f||c!=e||"selected"in u||(d+=" selected")}d=d+" "+t+'="'+s(e)+'"'}}}let y=d;if(d+=">",o.test(f))throw new Error(`${f} is not a valid HTML tag name in ${d}`);let b="",m=!1;if(p)b+=p,m=!0;else if("string"==typeof a)b+=s(a),m=!0;else if(k(a))for(let t=0;t<a.length;t++){let e=a[t];if(null!=e&&!1!==e){let t=O(e,i,"svg"===f||"foreignObject"!==f&&l,c);t&&(b+=t,m=!0)}}else if(null!=a&&!1!==a&&!0!==a){let t=O(a,i,"svg"===f||"foreignObject"!==f&&l,c);t&&(b+=t,m=!0)}if(e.diffed&&e.diffed(n),m)d+=b;else if(r.test(f))return y+" />";return d+"</"+f+">"}x.shallowRender=(t,e)=>x(t,e,h);const w=/(\\|\"|\')/g,$=Object.prototype.toString,F=Date.prototype.toISOString,C=Error.prototype.toString,E=RegExp.prototype.toString,M=Symbol.prototype.toString,H=/^Symbol\((.*)\)(.*)$/,N=/\n/gi,D=Object.getOwnPropertySymbols||(t=>[]);function I(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 L(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function W(t){return M.call(t).replace(H,"Symbol($1)")}function P(t){return"["+C.call(t)+"]"}function T(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(w,"\\$1")}(t)+'"';if("function"===e)return L(t);if("symbol"===e)return W(t);const n=$.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?L(t,min):"[object Symbol]"===n?W(t):"[object Date]"===n?F.call(t):"[object Error]"===n?P(t):"[object RegExp]"===n?E.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":I(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&P(t)}function U(t,e,n,r,o,i,l,s,c,f){let u="";if(t.length){u+=o;const a=n+e;for(let n=0;n<t.length;n++)u+=a+V(t[n],e,a,r,o,i,l,s,c,f),n<t.length-1&&(u+=","+r);u+=o+n}return"["+u+"]"}function R(t,e,n,r,o,i,l,s,c,f){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const u=++s>l;if(!u&&t.toJSON&&"function"==typeof t.toJSON)return V(t.toJSON(),e,n,r,o,i,l,s,c,f);const a=$.call(t);return"[object Arguments]"===a?u?"[Arguments]":function(t,e,n,r,o,i,l,s,c,f){return(f?"":"Arguments ")+U(t,e,n,r,o,i,l,s,c,f)}(t,e,n,r,o,i,l,s,c,f):I(a)?u?"[Array]":function(t,e,n,r,o,i,l,s,c,f){return(f?"":t.constructor.name+" ")+U(t,e,n,r,o,i,l,s,c,f)}(t,e,n,r,o,i,l,s,c,f):"[object Map]"===a?u?"[Map]":function(t,e,n,r,o,i,l,s,c,f){let u="Map {";const a=t.entries();let p=a.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+V(p.value[0],e,t,r,o,i,l,s,c,f)+" => "+V(p.value[1],e,t,r,o,i,l,s,c,f),p=a.next(),p.done||(u+=","+r);u+=o+n}return u+"}"}(t,e,n,r,o,i,l,s,c,f):"[object Set]"===a?u?"[Set]":function(t,e,n,r,o,i,l,s,c,f){let u="Set {";const a=t.entries();let p=a.next();if(!p.done){u+=o;const t=n+e;for(;!p.done;)u+=t+V(p.value[1],e,t,r,o,i,l,s,c,f),p=a.next(),p.done||(u+=","+r);u+=o+n}return u+"}"}(t,e,n,r,o,i,l,s,c,f):"object"==typeof t?u?"[Object]":function(t,e,n,r,o,i,l,s,c,f){let u=(f?"":t.constructor?t.constructor.name+" ":"Object ")+"{",a=Object.keys(t).sort();const p=D(t);if(p.length&&(a=a.filter(t=>!("symbol"==typeof t||"[object Symbol]"===$.call(t))).concat(p)),a.length){u+=o;const p=n+e;for(let n=0;n<a.length;n++){const d=a[n];u+=p+V(d,e,p,r,o,i,l,s,c,f)+": "+V(t[d],e,p,r,o,i,l,s,c,f),n<a.length-1&&(u+=","+r)}u+=o+n}return u+"}"}(t,e,n,r,o,i,l,s,c,f):void 0}function J(t,e,n,r,o,i,l,s,c,f){let u,a=!1;for(let e=0;e<c.length;e++)if(u=c[e],u.test(t)){a=!0;break}return!!a&&u.print(t,function(t){return V(t,e,n,r,o,i,l,s,c,f)},function(t){const r=n+e;return r+t.replace(N,"\n"+r)},{edgeSpacing:o,spacing:r})}function V(t,e,n,r,o,i,l,s,c,f){return T(t)||J(t,e,n,r,o,i,l,s,c,f)||R(t,e,n,r,o,i,l,s,c,f)}const q={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function z(t){return new Array(t+1).join(" ")}let B={test:t=>t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t,print:(t,e,n)=>x(t,B.context,B.opts)},G={plugins:[B]},Z={attributeHook:function(t,e,n,r,o){let i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";let l="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(B.context=n,B.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!q.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(q).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:q[n]),e.min&&(e.indent=0),e}(e)):e=q;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=z(e.indent),r=[];var l=J(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(l)return l}return T(t)||(n||(n=z(e.indent)),r||(r=[]),R(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,G)).indexOf("\n")&&(e=`${c("\n"+e,l)}\n`)):e="Function",c(`\n${t}={${e}}`,l)):`\n${l}${t}="${s(e)}"`},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function K(t,e,n,r){return x(t,e,n=Object.assign({},Z,n||{}))}export default K;export{K as render};
|
|
1
|
+
import{Fragment as t,options as e,h as n}from"preact";if("function"!=typeof Symbol){let t=0;Symbol=function(e){return`@@${e}${++t}`},Symbol.for=t=>`@@${t}`}const r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,o=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,i=/[\s\n\\/='"\0<>]/,l=/^xlink:?./,s=/["&<]/;function c(t){if(!1===s.test(t+=""))return t;let e=0,n=0,r="",o="";for(;n<t.length;n++){switch(t.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}let u=(t,e)=>String(t).replace(/(\n+)/g,"$1"+(e||"\t")),f=(t,e,n)=>String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<");const a={},p=/([A-Z])/g;function d(t){let e="";for(let n in t){let o=t[n];null!=o&&""!==o&&(e&&(e+=" "),e+="-"==n[0]?n:a[n]||(a[n]=n.replace(p,"-$1").toLowerCase()),e="number"==typeof o&&!1===r.test(n)?e+": "+o+"px;":e+": "+o+";")}return e||void 0}function _(t,e){return Array.isArray(e)?e.reduce(_,t):null!=e&&!1!==e&&t.push(e),t}function y(){this.__d=!0}function g(t,e){return{__v:t,context:e,props:t.props,setState:y,forceUpdate:y,__d:!0,__h:[]}}function b(t,e){let n=t.contextType,r=n&&e[n.__c];return null!=n?r?r.props.value:n.__:e}const m=[];function h(n,r,s,a,p,y){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return c(n);let j=s.pretty,x=j&&"string"==typeof j?j:"\t";if(Array.isArray(n)){let t="";for(let e=0;e<n.length;e++)j&&e>0&&(t+="\n"),t+=h(n[e],r,s,a,p,y);return t}let S=n.type,k=n.props,v=!1;if("function"==typeof S){if(v=!0,!s.shallow||!a&&!1!==s.renderRootComponent){if(S===t){const t=[];return _(t,n.props.children),h(t,r,s,!1!==s.shallowHighOrder,p,y)}{let t,o=n.__c=g(n,r);e.__b&&e.__b(n);let i=e.__r;if(S.prototype&&"function"==typeof S.prototype.render){let e=b(S,r);o=n.__c=new S(k,e),o.__v=n,o._dirty=o.__d=!0,o.props=k,null==o.state&&(o.state={}),null==o._nextState&&null==o.__s&&(o._nextState=o.__s=o.state),o.context=e,S.getDerivedStateFromProps?o.state=Object.assign({},o.state,S.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),i&&i(n),t=o.render(o.props,o.state,o.context)}else{let e=b(S,r),l=0;for(;o.__d&&l++<25;)o.__d=!1,i&&i(n),t=S.call(n.__c,k,e)}return o.getChildContext&&(r=Object.assign({},r,o.getChildContext())),e.diffed&&e.diffed(n),h(t,r,s,!1!==s.shallowHighOrder,p,y)}}S=(A=S).displayName||A!==Function&&A.name||function(t){let e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){let n=-1;for(let e=m.length;e--;)if(m[e]===t){n=e;break}n<0&&(n=m.push(t)-1),e=`UnnamedComponent${n}`}return e}(A)}var A;let O,w,$="<"+S;if(k){let t=Object.keys(k);s&&!0===s.sortAttributes&&t.sort();for(let e=0;e<t.length;e++){let n=t[e],o=k[n];if("children"===n){O=o;continue}if(i.test(n))continue;if(!(s&&s.allAttributes||"key"!==n&&"ref"!==n&&"__self"!==n&&"__source"!==n))continue;if("defaultValue"===n)n="value";else if("defaultChecked"===n)n="checked";else if("defaultSelected"===n)n="selected";else if("className"===n){if(void 0!==k.class)continue;n="class"}else p&&l.test(n)&&(n=n.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===n){if(k.for)continue;n="for"}"style"===n&&o&&"object"==typeof o&&(o=d(o)),"a"===n[0]&&"r"===n[1]&&"boolean"==typeof o&&(o=String(o));let u=s.attributeHook&&s.attributeHook(n,o,r,s,v);if(u||""===u)$+=u;else if("dangerouslySetInnerHTML"===n)w=o&&o.__html;else if("textarea"===S&&"value"===n)O=o;else if((o||0===o||""===o)&&"function"!=typeof o){if(!(!0!==o&&""!==o||(o=n,s&&s.xml))){$=$+" "+n;continue}if("value"===n){if("select"===S){y=o;continue}"option"===S&&y==o&&void 0===k.selected&&($+=" selected")}$+=` ${n}="${c(o)}"`}}}if(j){let t=$.replace(/\n\s*/," ");t===$||~t.indexOf("\n")?j&&~$.indexOf("\n")&&($+="\n"):$=t}if($+=">",i.test(S))throw new Error(`${S} is not a valid HTML tag name in ${$}`);let F,C=o.test(S)||s.voidElements&&s.voidElements.test(S),E=[];if(w)j&&f(w)&&(w="\n"+x+u(w,x)),$+=w;else if(null!=O&&_(F=[],O).length){let t=j&&~$.indexOf("\n"),e=!1;for(let n=0;n<F.length;n++){let o=F[n];if(null!=o&&!1!==o){let n=h(o,r,s,!0,"svg"===S||"foreignObject"!==S&&p,y);if(j&&!t&&f(n)&&(t=!0),n)if(j){let t=n.length>0&&"<"!=n[0];e&&t?E[E.length-1]+=n:E.push(n),e=t}else E.push(n)}}if(j&&t)for(let t=E.length;t--;)E[t]="\n"+x+u(E[t],x)}if(E.length||w)$+=E.join("");else if(s&&s.xml)return $.substring(0,$.length-1)+" />";return!C||F||w?(j&&~$.indexOf("\n")&&($+="\n"),$+=`</${S}>`):$=$.replace(/>$/," />"),$}const j={shallow:!0};S.render=S;const x=[];function S(r,o,i){o=o||{};const l=e.__s;e.__s=!0;const s=n(t,null);let c;return s.__k=[r],c=i&&(i.pretty||i.voidElements||i.sortAttributes||i.shallow||i.allAttributes||i.xml||i.attributeHook)?h(r,o,i):w(r,o,!1,void 0,s),e.__c&&e.__c(r,x),e.__s=l,x.length=0,c}function k(t,e){return"className"===t?"class":"htmlFor"===t?"for":"defaultValue"===t?"value":"defaultChecked"===t?"checked":"defaultSelected"===t?"selected":e&&l.test(t)?t.toLowerCase().replace(/^xlink:?/,"xlink:"):t}function v(t,e){return"style"===t&&null!=e&&"object"==typeof e?d(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}const A=Array.isArray,O=Object.assign;function w(n,r,l,s,u){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return c(n);if(A(n)){let t="";u.__k=n;for(let e=0;e<n.length;e++)t+=w(n[e],r,l,s,u);return t}n.__=u,e.__b&&e.__b(n);let f=n.type,a=n.props;if("function"==typeof f){let o;if(f===t)o=a.children;else{o=f.prototype&&"function"==typeof f.prototype.render?function(t,n){let r=t.type,o=b(r,n),i=new r(t.props,o);t.__c=i,i.__v=t,i.__d=!0,i.props=t.props,null==i.state&&(i.state={}),null==i.__s&&(i.__s=i.state),i.context=o,r.getDerivedStateFromProps?i.state=O({},i.state,r.getDerivedStateFromProps(i.props,i.state)):i.componentWillMount&&(i.componentWillMount(),i.state=i.__s!==i.state?i.__s:i.state);let l=e.__r;return l&&l(t),i.render(i.props,i.state,i.context)}(n,r):function(t,n){let r,o=g(t,n),i=b(t.type,n);t.__c=o;let l=e.__r,s=0;for(;o.__d&&s++<25;)o.__d=!1,l&&l(t),r=t.type.call(o,t.props,i);return r}(n,r);let t=n.__c;t.getChildContext&&(r=O({},r,t.getChildContext()))}const i=w(o,r,l,s,n);return e.diffed&&e.diffed(n),n.__=void 0,e.unmount&&e.unmount(n),i}let p,d,_="<";if(_+=f,a){p=a.children;for(let t in a){let e=a[t];if(!("key"===t||"ref"===t||"__self"===t||"__source"===t||"children"===t||"className"===t&&"class"in a||"htmlFor"===t&&"for"in a||i.test(t)))if(t=k(t,l),e=v(t,e),"dangerouslySetInnerHTML"===t)d=e&&e.__html;else if("textarea"===f&&"value"===t)p=e;else if((e||0===e||""===e)&&"function"!=typeof e){if(!0===e||""===e){e=t,_=_+" "+t;continue}if("value"===t){if("select"===f){s=e;continue}"option"!==f||s!=e||"selected"in a||(_+=" selected")}_=_+" "+t+'="'+c(e)+'"'}}}let y=_;if(_+=">",i.test(f))throw new Error(`${f} is not a valid HTML tag name in ${_}`);let m="",h=!1;if(d)m+=d,h=!0;else if("string"==typeof p)m+=c(p),h=!0;else if(A(p)){n.__k=p;for(let t=0;t<p.length;t++){let e=p[t];if(null!=e&&!1!==e){let t=w(e,r,"svg"===f||"foreignObject"!==f&&l,s,n);t&&(m+=t,h=!0)}}}else if(null!=p&&!1!==p&&!0!==p){n.__k=[p];let t=w(p,r,"svg"===f||"foreignObject"!==f&&l,s,n);t&&(m+=t,h=!0)}if(e.diffed&&e.diffed(n),n.__=void 0,e.unmount&&e.unmount(n),h)_+=m;else if(o.test(f))return y+" />";return _+"</"+f+">"}S.shallowRender=(t,e)=>S(t,e,j);const $=/(\\|\"|\')/g,F=Object.prototype.toString,C=Date.prototype.toISOString,E=Error.prototype.toString,M=RegExp.prototype.toString,H=Symbol.prototype.toString,N=/^Symbol\((.*)\)(.*)$/,D=/\n/gi,I=Object.getOwnPropertySymbols||(t=>[]);function L(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 W(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function P(t){return H.call(t).replace(N,"Symbol($1)")}function T(t){return"["+E.call(t)+"]"}function U(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 W(t);if("symbol"===e)return P(t);const n=F.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?W(t,min):"[object Symbol]"===n?P(t):"[object Date]"===n?C.call(t):"[object Error]"===n?T(t):"[object RegExp]"===n?M.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":L(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&T(t)}function R(t,e,n,r,o,i,l,s,c,u){let f="";if(t.length){f+=o;const a=n+e;for(let n=0;n<t.length;n++)f+=a+q(t[n],e,a,r,o,i,l,s,c,u),n<t.length-1&&(f+=","+r);f+=o+n}return"["+f+"]"}function J(t,e,n,r,o,i,l,s,c,u){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const f=++s>l;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return q(t.toJSON(),e,n,r,o,i,l,s,c,u);const a=F.call(t);return"[object Arguments]"===a?f?"[Arguments]":function(t,e,n,r,o,i,l,s,c,u){return(u?"":"Arguments ")+R(t,e,n,r,o,i,l,s,c,u)}(t,e,n,r,o,i,l,s,c,u):L(a)?f?"[Array]":function(t,e,n,r,o,i,l,s,c,u){return(u?"":t.constructor.name+" ")+R(t,e,n,r,o,i,l,s,c,u)}(t,e,n,r,o,i,l,s,c,u):"[object Map]"===a?f?"[Map]":function(t,e,n,r,o,i,l,s,c,u){let f="Map {";const a=t.entries();let p=a.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[0],e,t,r,o,i,l,s,c,u)+" => "+q(p.value[1],e,t,r,o,i,l,s,c,u),p=a.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,l,s,c,u):"[object Set]"===a?f?"[Set]":function(t,e,n,r,o,i,l,s,c,u){let f="Set {";const a=t.entries();let p=a.next();if(!p.done){f+=o;const t=n+e;for(;!p.done;)f+=t+q(p.value[1],e,t,r,o,i,l,s,c,u),p=a.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,l,s,c,u):"object"==typeof t?f?"[Object]":function(t,e,n,r,o,i,l,s,c,u){let f=(u?"":t.constructor?t.constructor.name+" ":"Object ")+"{",a=Object.keys(t).sort();const p=I(t);if(p.length&&(a=a.filter(t=>!("symbol"==typeof t||"[object Symbol]"===F.call(t))).concat(p)),a.length){f+=o;const p=n+e;for(let n=0;n<a.length;n++){const d=a[n];f+=p+q(d,e,p,r,o,i,l,s,c,u)+": "+q(t[d],e,p,r,o,i,l,s,c,u),n<a.length-1&&(f+=","+r)}f+=o+n}return f+"}"}(t,e,n,r,o,i,l,s,c,u):void 0}function V(t,e,n,r,o,i,l,s,c,u){let f,a=!1;for(let e=0;e<c.length;e++)if(f=c[e],f.test(t)){a=!0;break}return!!a&&f.print(t,function(t){return q(t,e,n,r,o,i,l,s,c,u)},function(t){const r=n+e;return r+t.replace(D,"\n"+r)},{edgeSpacing:o,spacing:r})}function q(t,e,n,r,o,i,l,s,c,u){return U(t)||V(t,e,n,r,o,i,l,s,c,u)||J(t,e,n,r,o,i,l,s,c,u)}const z={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function B(t){return new Array(t+1).join(" ")}let G={test:t=>t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t,print:(t,e,n)=>S(t,G.context,G.opts)},Z={plugins:[G]},K={attributeHook:function(t,e,n,r,o){let i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";let l="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(G.context=n,G.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!z.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(z).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:z[n]),e.min&&(e.indent=0),e}(e)):e=z;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=B(e.indent),r=[];var l=V(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(l)return l}return U(t)||(n||(n=B(e.indent)),r||(r=[]),J(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Z)).indexOf("\n")&&(e=`${u("\n"+e,l)}\n`)):e="Function",u(`\n${t}={${e}}`,l)):`\n${l}${t}="${c(e)}"`},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function Q(t,e,n,r){return S(t,e,n=Object.assign({},K,n||{}))}export default Q;export{Q as render};
|
|
2
2
|
//# sourceMappingURL=jsx.modern.js.map
|