preact-render-to-string 5.2.4 → 5.2.6
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 +91 -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 +149 -148
- package/src/constants.js +16 -16
- package/src/index.d.ts +16 -16
- package/src/index.js +457 -396
- package/src/jsx.d.ts +13 -13
- package/src/jsx.js +76 -76
- package/src/polyfills.js +8 -8
- package/src/pretty.js +389 -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:?./,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);
|
|
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 l(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 f=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},s=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"function"==typeof t?"":l(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}if(void 0!==t.constructor)return"";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+'="'+l(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)_&&s(I)&&(I="\n"+h+f(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&&s(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+f(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):F(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){return null==t||"boolean"==typeof t?null:"string"==typeof t||"number"==typeof t||"bigint"==typeof t?e.h(null,null,t):t}function k(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 A(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 O=Array.isArray,w=Object.assign;function F(t,n,r,a,u){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return"function"==typeof t?"":l(t);if(O(t)){var f="";u.__k=t;for(var s=0;s<t.length;s++)f+=F(t[s],n,r,a,u),t[s]=S(t[s]);return f}if(void 0!==t.constructor)return"";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=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.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=w({},n,v.getChildContext()))}var _=F(d=null!=d&&d.type===e.Fragment&&null==d.key?d.props.children: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=A(j=k(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+'="'+l(x)+'"'}}var C=h;if(h+=">",i.test(c))throw new Error(c+" is not a valid HTML tag name in "+h);var E="",M=!1;if(m)E+=m,M=!0;else if("string"==typeof b)E+=l(b),M=!0;else if(O(b)){t.__k=b;for(var H=0;H<b.length;H++){var N=b[H];if(b[H]=S(N),null!=N&&!1!==N){var D=F(N,n,"svg"===c||"foreignObject"!==c&&r,a,t);D&&(E+=D,M=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[S(b)];var I=F(b,n,"svg"===c||"foreignObject"!==c&&r,a,t);I&&(E+=I,M=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),M)h+=E;else if(o.test(c))return C+" />";return h+"</"+c+">"}x.shallowRender=function(t,e){return x(t,e,h)};var 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||function(t){return[]};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";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(C,"\\$1")}(t)+'"';if("function"===e)return P(t);if("symbol"===e)return T(t);var 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,u,l,f){var s="";if(t.length){s+=o;for(var c=n+e,p=0;p<t.length;p++)s+=c+z(t[p],e,c,r,o,i,a,u,l,f),p<t.length-1&&(s+=","+r);s+=o+n}return"["+s+"]"}function V(t,e,n,r,o,i,a,u,l,f){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var s=++u>a;if(!s&&t.toJSON&&"function"==typeof t.toJSON)return z(t.toJSON(),e,n,r,o,i,a,u,l,f);var c=E.call(t);return"[object Arguments]"===c?s?"[Arguments]":function(t,e,n,r,o,i,a,u,l,f){return(f?"":"Arguments ")+J(t,e,n,r,o,i,a,u,l,f)}(t,e,n,r,o,i,a,u,l,f):$(c)?s?"[Array]":function(t,e,n,r,o,i,a,u,l,f){return(f?"":t.constructor.name+" ")+J(t,e,n,r,o,i,a,u,l,f)}(t,e,n,r,o,i,a,u,l,f):"[object Map]"===c?s?"[Map]":function(t,e,n,r,o,i,a,u,l,f){var s="Map {",c=t.entries(),p=c.next();if(!p.done){s+=o;for(var d=n+e;!p.done;)s+=d+z(p.value[0],e,d,r,o,i,a,u,l,f)+" => "+z(p.value[1],e,d,r,o,i,a,u,l,f),(p=c.next()).done||(s+=","+r);s+=o+n}return s+"}"}(t,e,n,r,o,i,a,u,l,f):"[object Set]"===c?s?"[Set]":function(t,e,n,r,o,i,a,u,l,f){var s="Set {",c=t.entries(),p=c.next();if(!p.done){s+=o;for(var d=n+e;!p.done;)s+=d+z(p.value[1],e,d,r,o,i,a,u,l,f),(p=c.next()).done||(s+=","+r);s+=o+n}return s+"}"}(t,e,n,r,o,i,a,u,l,f):"object"==typeof t?s?"[Object]":function(t,e,n,r,o,i,a,u,l,f){var s=(f?"":t.constructor?t.constructor.name+" ":"Object ")+"{",c=Object.keys(t).sort(),p=W(t);if(p.length&&(c=c.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===E.call(t))}).concat(p)),c.length){s+=o;for(var d=n+e,v=0;v<c.length;v++){var _=c[v];s+=d+z(_,e,d,r,o,i,a,u,l,f)+": "+z(t[_],e,d,r,o,i,a,u,l,f),v<c.length-1&&(s+=","+r)}s+=o+n}return s+"}"}(t,e,n,r,o,i,a,u,l,f):void 0}function q(t,e,n,r,o,i,a,u,l,f){for(var s,c=!1,p=0;p<l.length;p++)if((s=l[p]).test(t)){c=!0;break}return!!c&&s.print(t,function(t){return z(t,e,n,r,o,i,a,u,l,f)},function(t){var r=n+e;return r+t.replace(L,"\n"+r)},{edgeSpacing:o,spacing:r})}function z(t,e,n,r,o,i,a,u,l,f){return R(t)||q(t,e,n,r,o,i,a,u,l,f)||V(t,e,n,r,o,i,a,u,l,f)}var 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 x(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){var n,r;e?(function(t){if(Object.keys(t).forEach(function(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){var e={};return Object.keys(B).forEach(function(n){return e[n]=t.hasOwnProperty(n)?t[n]:B[n]}),e.min&&(e.indent=0),e}(e)):e=B;var o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){var a=q(t,n=G(e.indent),"",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=f("\n"+e,a)+"\n")):e="Function",f("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+l(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function X(t,e,n,r){return x(t,e,n=Object.assign({},Q,n||{}))}t.default=X,t.render=X},"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\"))},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"}
|
|
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:?./,l=/[\"&<]/;function s(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 u=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},c=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,l,f,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return\"function\"==typeof t?\"\":s(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,l,f,p);return j}if(void 0!==t.constructor)return\"\";var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!l&&!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+\" \"+$+'=\"'+s(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&&c(I)&&(I=\"\\n\"+h+u(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&&c(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)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):F(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){return null==t||\"boolean\"==typeof t?null:\"string\"==typeof t||\"number\"==typeof t||\"bigint\"==typeof t?e.h(null,null,t):t}function k(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 A(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 O=Array.isArray,w=Object.assign;function F(t,n,r,a,l){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return\"function\"==typeof t?\"\":s(t);if(O(t)){var u=\"\";l.__k=t;for(var c=0;c<t.length;c++)u+=F(t[c],n,r,a,l),t[c]=S(t[c]);return u}if(void 0!==t.constructor)return\"\";t.__=l,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=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.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,l=0;o.__d&&l++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var _=t.__c;_.getChildContext&&(n=w({},n,_.getChildContext()))}var y=F(d=null!=d&&d.type===e.Fragment&&null==d.key?d.props.children: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=A(j=k(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+'=\"'+s(x)+'\"'}}var C=h;if(h+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+h);var E=\"\",M=!1;if(m)E+=m,M=!0;else if(\"string\"==typeof b)E+=s(b),M=!0;else if(O(b)){t.__k=b;for(var H=0;H<b.length;H++){var N=b[H];if(b[H]=S(N),null!=N&&!1!==N){var D=F(N,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);D&&(E+=D,M=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[S(b)];var I=F(b,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);I&&(E+=I,M=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),M)h+=E;else if(o.test(f))return C+\" />\";return h+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};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\\((.*)\\)(.*)$/,T=/\\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 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 $(t);if(\"symbol\"===e)return P(t);const n=E.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?M.call(t):\"[object Error]\"===n?U(t):\"[object RegExp]\"===n?N.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":W(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&U(t)}function J(t,e,n,r,o,i,a,l,s,u){let c=\"\";if(t.length){c+=o;const f=n+e;for(let n=0;n<t.length;n++)c+=f+z(t[n],e,f,r,o,i,a,l,s,u),n<t.length-1&&(c+=\",\"+r);c+=o+n}return\"[\"+c+\"]\"}function V(t,e,n,r,o,i,a,l,s,u){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const c=++l>a;if(!c&&t.toJSON&&\"function\"==typeof t.toJSON)return z(t.toJSON(),e,n,r,o,i,a,l,s,u);const f=E.call(t);return\"[object Arguments]\"===f?c?\"[Arguments]\":function(t,e,n,r,o,i,a,l,s,u){return(u?\"\":\"Arguments \")+J(t,e,n,r,o,i,a,l,s,u)}(t,e,n,r,o,i,a,l,s,u):W(f)?c?\"[Array]\":function(t,e,n,r,o,i,a,l,s,u){return(u?\"\":t.constructor.name+\" \")+J(t,e,n,r,o,i,a,l,s,u)}(t,e,n,r,o,i,a,l,s,u):\"[object Map]\"===f?c?\"[Map]\":function(t,e,n,r,o,i,a,l,s,u){let c=\"Map {\";const f=t.entries();let p=f.next();if(!p.done){c+=o;const t=n+e;for(;!p.done;)c+=t+z(p.value[0],e,t,r,o,i,a,l,s,u)+\" => \"+z(p.value[1],e,t,r,o,i,a,l,s,u),p=f.next(),p.done||(c+=\",\"+r);c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):\"[object Set]\"===f?c?\"[Set]\":function(t,e,n,r,o,i,a,l,s,u){let c=\"Set {\";const f=t.entries();let p=f.next();if(!p.done){c+=o;const t=n+e;for(;!p.done;)c+=t+z(p.value[1],e,t,r,o,i,a,l,s,u),p=f.next(),p.done||(c+=\",\"+r);c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):\"object\"==typeof t?c?\"[Object]\":function(t,e,n,r,o,i,a,l,s,u){let c=(u?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",f=Object.keys(t).sort();const p=L(t);if(p.length&&(f=f.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===E.call(t))).concat(p)),f.length){c+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];c+=p+z(d,e,p,r,o,i,a,l,s,u)+\": \"+z(t[d],e,p,r,o,i,a,l,s,u),n<f.length-1&&(c+=\",\"+r)}c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):void 0}function q(t,e,n,r,o,i,a,l,s,u){let c,f=!1;for(let e=0;e<s.length;e++)if(c=s[e],c.test(t)){f=!0;break}return!!f&&c.print(t,function(t){return z(t,e,n,r,o,i,a,l,s,u)},function(t){const r=n+e;return r+t.replace(T,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function z(t,e,n,r,o,i,a,l,s,u){return R(t)||q(t,e,n,r,o,i,a,l,s,u)||V(t,e,n,r,o,i,a,l,s,u)}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 x(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 x(t,e,n=Object.assign({},Q,n||{}))}t.default=X,t.render=X});\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\"))},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"}
|
|
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:?./,l=/[\"&<]/;function s(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 u=function(t,e){return String(t).replace(/(\\n+)/g,\"$1\"+(e||\"\\t\"))},c=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,l,f,p){if(null==t||\"boolean\"==typeof t)return\"\";if(\"object\"!=typeof t)return\"function\"==typeof t?\"\":s(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,l,f,p);return j}if(void 0!==t.constructor)return\"\";var S,k=t.type,A=t.props,O=!1;if(\"function\"==typeof k){if(O=!0,!r.shallow||!l&&!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+\" \"+$+'=\"'+s(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&&c(I)&&(I=\"\\n\"+h+u(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&&c(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)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):F(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){return null==t||\"boolean\"==typeof t?null:\"string\"==typeof t||\"number\"==typeof t||\"bigint\"==typeof t?e.h(null,null,t):t}function k(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 A(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 O=Array.isArray,w=Object.assign;function F(t,n,r,a,l){if(null==t||!0===t||!1===t||\"\"===t)return\"\";if(\"object\"!=typeof t)return\"function\"==typeof t?\"\":s(t);if(O(t)){var u=\"\";l.__k=t;for(var c=0;c<t.length;c++)u+=F(t[c],n,r,a,l),t[c]=S(t[c]);return u}if(void 0!==t.constructor)return\"\";t.__=l,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=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.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,l=0;o.__d&&l++<25;)o.__d=!1,a&&a(t),r=t.type.call(o,t.props,i);return r}(t,n);var _=t.__c;_.getChildContext&&(n=w({},n,_.getChildContext()))}var y=F(d=null!=d&&d.type===e.Fragment&&null==d.key?d.props.children: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=A(j=k(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+'=\"'+s(x)+'\"'}}var C=h;if(h+=\">\",i.test(f))throw new Error(f+\" is not a valid HTML tag name in \"+h);var E=\"\",M=!1;if(m)E+=m,M=!0;else if(\"string\"==typeof b)E+=s(b),M=!0;else if(O(b)){t.__k=b;for(var H=0;H<b.length;H++){var N=b[H];if(b[H]=S(N),null!=N&&!1!==N){var D=F(N,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);D&&(E+=D,M=!0)}}}else if(null!=b&&!1!==b&&!0!==b){t.__k=[S(b)];var I=F(b,n,\"svg\"===f||\"foreignObject\"!==f&&r,a,t);I&&(E+=I,M=!0)}if(e.options.diffed&&e.options.diffed(t),t.__=void 0,e.options.unmount&&e.options.unmount(t),M)h+=E;else if(o.test(f))return C+\" />\";return h+\"</\"+f+\">\"}x.shallowRender=function(t,e){return x(t,e,h)};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\\((.*)\\)(.*)$/,T=/\\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 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 $(t);if(\"symbol\"===e)return P(t);const n=E.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?M.call(t):\"[object Error]\"===n?U(t):\"[object RegExp]\"===n?N.call(t):\"[object Arguments]\"===n&&0===t.length?\"Arguments []\":W(n)&&0===t.length?t.constructor.name+\" []\":t instanceof Error&&U(t)}function J(t,e,n,r,o,i,a,l,s,u){let c=\"\";if(t.length){c+=o;const f=n+e;for(let n=0;n<t.length;n++)c+=f+z(t[n],e,f,r,o,i,a,l,s,u),n<t.length-1&&(c+=\",\"+r);c+=o+n}return\"[\"+c+\"]\"}function V(t,e,n,r,o,i,a,l,s,u){if((i=i.slice()).indexOf(t)>-1)return\"[Circular]\";i.push(t);const c=++l>a;if(!c&&t.toJSON&&\"function\"==typeof t.toJSON)return z(t.toJSON(),e,n,r,o,i,a,l,s,u);const f=E.call(t);return\"[object Arguments]\"===f?c?\"[Arguments]\":function(t,e,n,r,o,i,a,l,s,u){return(u?\"\":\"Arguments \")+J(t,e,n,r,o,i,a,l,s,u)}(t,e,n,r,o,i,a,l,s,u):W(f)?c?\"[Array]\":function(t,e,n,r,o,i,a,l,s,u){return(u?\"\":t.constructor.name+\" \")+J(t,e,n,r,o,i,a,l,s,u)}(t,e,n,r,o,i,a,l,s,u):\"[object Map]\"===f?c?\"[Map]\":function(t,e,n,r,o,i,a,l,s,u){let c=\"Map {\";const f=t.entries();let p=f.next();if(!p.done){c+=o;const t=n+e;for(;!p.done;)c+=t+z(p.value[0],e,t,r,o,i,a,l,s,u)+\" => \"+z(p.value[1],e,t,r,o,i,a,l,s,u),p=f.next(),p.done||(c+=\",\"+r);c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):\"[object Set]\"===f?c?\"[Set]\":function(t,e,n,r,o,i,a,l,s,u){let c=\"Set {\";const f=t.entries();let p=f.next();if(!p.done){c+=o;const t=n+e;for(;!p.done;)c+=t+z(p.value[1],e,t,r,o,i,a,l,s,u),p=f.next(),p.done||(c+=\",\"+r);c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):\"object\"==typeof t?c?\"[Object]\":function(t,e,n,r,o,i,a,l,s,u){let c=(u?\"\":t.constructor?t.constructor.name+\" \":\"Object \")+\"{\",f=Object.keys(t).sort();const p=L(t);if(p.length&&(f=f.filter(t=>!(\"symbol\"==typeof t||\"[object Symbol]\"===E.call(t))).concat(p)),f.length){c+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];c+=p+z(d,e,p,r,o,i,a,l,s,u)+\": \"+z(t[d],e,p,r,o,i,a,l,s,u),n<f.length-1&&(c+=\",\"+r)}c+=o+n}return c+\"}\"}(t,e,n,r,o,i,a,l,s,u):void 0}function q(t,e,n,r,o,i,a,l,s,u){let c,f=!1;for(let e=0;e<s.length;e++)if(c=s[e],c.test(t)){f=!0;break}return!!f&&c.print(t,function(t){return z(t,e,n,r,o,i,a,l,s,u)},function(t){const r=n+e;return r+t.replace(T,\"\\n\"+r)},{edgeSpacing:o,spacing:r})}function z(t,e,n,r,o,i,a,l,s,u){return R(t)||q(t,e,n,r,o,i,a,l,s,u)||V(t,e,n,r,o,i,a,l,s,u)}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 x(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 x(t,e,n=Object.assign({},Q,n||{}))}t.default=X,t.render=X});\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,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};
|
|
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:?./,u=/["&<]/;function c(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 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("<")},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,u,p,d){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return"function"==typeof n?"":c(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,u,p,d);return x}if(void 0!==n.constructor)return"";var k,A=n.type,O=n.props,w=!1;if("function"==typeof A){if(w=!0,!o.shallow||!u&&!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+'="'+c(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+s(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+s(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,u=n(t,null);return u.__k=[r],l=i&&(i.pretty||i.voidElements||i.sortAttributes||i.shallow||i.allAttributes||i.xml||i.attributeHook)?h(r,o,i):C(r,o,!1,void 0,u),e.__c&&e.__c(r,x),e.__s=a,x.length=0,l}function k(t){return null==t||"boolean"==typeof t?null:"string"==typeof t||"number"==typeof t||"bigint"==typeof t?n(null,null,t):t}function A(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 O(t,e){return"style"===t&&null!=e&&"object"==typeof e?_(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}var w=Array.isArray,F=Object.assign;function C(n,r,o,l,u){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return"function"==typeof n?"":c(n);if(w(n)){var s="";u.__k=n;for(var f=0;f<n.length;f++)s+=C(n[f],r,o,l,u),n[f]=k(n[f]);return s}if(void 0!==n.constructor)return"";n.__=u,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=F({},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=F({},r,y.getChildContext()))}var v=C(_=null!=_&&_.type===t&&null==_.key?_.props.children:_,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=O(x=A(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+'="'+c(S)+'"'}}var E=j;if(j+=">",a.test(p))throw new Error(p+" is not a valid HTML tag name in "+j);var M="",H=!1;if(h)M+=h,H=!0;else if("string"==typeof m)M+=c(m),H=!0;else if(w(m)){n.__k=m;for(var N=0;N<m.length;N++){var D=m[N];if(m[N]=k(D),null!=D&&!1!==D){var I=C(D,r,"svg"===p||"foreignObject"!==p&&o,l,n);I&&(M+=I,H=!0)}}}else if(null!=m&&!1!==m&&!0!==m){n.__k=[k(m)];var L=C(m,r,"svg"===p||"foreignObject"!==p&&o,l,n);L&&(M+=L,H=!0)}if(e.diffed&&e.diffed(n),n.__=void 0,e.unmount&&e.unmount(n),H)j+=M;else if(i.test(p))return E+" />";return j+"</"+p+">"}S.shallowRender=function(t,e){return S(t,e,j)};const E=/(\\|\"|\')/g,M=Object.prototype.toString,H=Date.prototype.toISOString,N=Error.prototype.toString,D=RegExp.prototype.toString,I=Symbol.prototype.toString,L=/^Symbol\((.*)\)(.*)$/,W=/\n/gi,$=Object.getOwnPropertySymbols||(t=>[]);function P(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(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function U(t){return I.call(t).replace(L,"Symbol($1)")}function R(t){return"["+N.call(t)+"]"}function J(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(E,"\\$1")}(t)+'"';if("function"===e)return T(t);if("symbol"===e)return U(t);const n=M.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?T(t,min):"[object Symbol]"===n?U(t):"[object Date]"===n?H.call(t):"[object Error]"===n?R(t):"[object RegExp]"===n?D.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":P(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&R(t)}function V(t,e,n,r,o,i,a,l,u,c){let s="";if(t.length){s+=o;const f=n+e;for(let n=0;n<t.length;n++)s+=f+B(t[n],e,f,r,o,i,a,l,u,c),n<t.length-1&&(s+=","+r);s+=o+n}return"["+s+"]"}function q(t,e,n,r,o,i,a,l,u,c){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const s=++l>a;if(!s&&t.toJSON&&"function"==typeof t.toJSON)return B(t.toJSON(),e,n,r,o,i,a,l,u,c);const f=M.call(t);return"[object Arguments]"===f?s?"[Arguments]":function(t,e,n,r,o,i,a,l,u,c){return(c?"":"Arguments ")+V(t,e,n,r,o,i,a,l,u,c)}(t,e,n,r,o,i,a,l,u,c):P(f)?s?"[Array]":function(t,e,n,r,o,i,a,l,u,c){return(c?"":t.constructor.name+" ")+V(t,e,n,r,o,i,a,l,u,c)}(t,e,n,r,o,i,a,l,u,c):"[object Map]"===f?s?"[Map]":function(t,e,n,r,o,i,a,l,u,c){let s="Map {";const f=t.entries();let p=f.next();if(!p.done){s+=o;const t=n+e;for(;!p.done;)s+=t+B(p.value[0],e,t,r,o,i,a,l,u,c)+" => "+B(p.value[1],e,t,r,o,i,a,l,u,c),p=f.next(),p.done||(s+=","+r);s+=o+n}return s+"}"}(t,e,n,r,o,i,a,l,u,c):"[object Set]"===f?s?"[Set]":function(t,e,n,r,o,i,a,l,u,c){let s="Set {";const f=t.entries();let p=f.next();if(!p.done){s+=o;const t=n+e;for(;!p.done;)s+=t+B(p.value[1],e,t,r,o,i,a,l,u,c),p=f.next(),p.done||(s+=","+r);s+=o+n}return s+"}"}(t,e,n,r,o,i,a,l,u,c):"object"==typeof t?s?"[Object]":function(t,e,n,r,o,i,a,l,u,c){let s=(c?"":t.constructor?t.constructor.name+" ":"Object ")+"{",f=Object.keys(t).sort();const p=$(t);if(p.length&&(f=f.filter(t=>!("symbol"==typeof t||"[object Symbol]"===M.call(t))).concat(p)),f.length){s+=o;const p=n+e;for(let n=0;n<f.length;n++){const d=f[n];s+=p+B(d,e,p,r,o,i,a,l,u,c)+": "+B(t[d],e,p,r,o,i,a,l,u,c),n<f.length-1&&(s+=","+r)}s+=o+n}return s+"}"}(t,e,n,r,o,i,a,l,u,c):void 0}function z(t,e,n,r,o,i,a,l,u,c){let s,f=!1;for(let e=0;e<u.length;e++)if(s=u[e],s.test(t)){f=!0;break}return!!f&&s.print(t,function(t){return B(t,e,n,r,o,i,a,l,u,c)},function(t){const r=n+e;return r+t.replace(W,"\n"+r)},{edgeSpacing:o,spacing:r})}function B(t,e,n,r,o,i,a,l,u,c){return J(t)||z(t,e,n,r,o,i,a,l,u,c)||q(t,e,n,r,o,i,a,l,u,c)}const G={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function Z(t){return new Array(t+1).join(" ")}var K={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,K.context,K.opts)}},Q={plugins:[K]},X={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?(K.context=n,K.opts=r,~(e=function(t,e){let n,r;e?(function(t){if(Object.keys(t).forEach(t=>{if(!G.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(G).forEach(n=>e[n]=t.hasOwnProperty(n)?t[n]:G[n]),e.min&&(e.indent=0),e}(e)):e=G;const o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){n=Z(e.indent),r=[];var a=z(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(a)return a}return J(t)||(n||(n=Z(e.indent)),r||(r=[]),q(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))}(e,Q)).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 Y(t,e,n,r){return S(t,e,n=Object.assign({},X,n||{}))}export default Y;export{Y 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,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};
|
|
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:?./,c=/["&<]/;function s(t){if(!1===c.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,c,a,p,y){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return"function"==typeof n?"":s(n);let j=c.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,c,a,p,y);return t}if(void 0!==n.constructor)return"";let S=n.type,v=n.props,k=!1;if("function"==typeof S){if(k=!0,!c.shallow||!a&&!1!==c.renderRootComponent){if(S===t){const t=[];return _(t,n.props.children),h(t,r,c,!1!==c.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(v,e),o.__v=n,o._dirty=o.__d=!0,o.props=v,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,v,e)}return o.getChildContext&&(r=Object.assign({},r,o.getChildContext())),e.diffed&&e.diffed(n),h(t,r,c,!1!==c.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(v){let t=Object.keys(v);c&&!0===c.sortAttributes&&t.sort();for(let e=0;e<t.length;e++){let n=t[e],o=v[n];if("children"===n){O=o;continue}if(i.test(n))continue;if(!(c&&c.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 p&&l.test(n)&&(n=n.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===n){if(v.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=c.attributeHook&&c.attributeHook(n,o,r,c,k);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,c&&c.xml))){$=$+" "+n;continue}if("value"===n){if("select"===S){y=o;continue}"option"===S&&y==o&&void 0===v.selected&&($+=" selected")}$+=` ${n}="${s(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)||c.voidElements&&c.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,c,!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(c&&c.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 c=n(t,null);let s;return c.__k=[r],s=i&&(i.pretty||i.voidElements||i.sortAttributes||i.shallow||i.allAttributes||i.xml||i.attributeHook)?h(r,o,i):$(r,o,!1,void 0,c),e.__c&&e.__c(r,x),e.__s=l,x.length=0,s}function v(t){return null==t||"boolean"==typeof t?null:"string"==typeof t||"number"==typeof t||"bigint"==typeof t?n(null,null,t):t}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?d(e):"a"===t[0]&&"r"===t[1]&&"boolean"==typeof e?String(e):e}const O=Array.isArray,w=Object.assign;function $(n,r,l,c,u){if(null==n||!0===n||!1===n||""===n)return"";if("object"!=typeof n)return"function"==typeof n?"":s(n);if(O(n)){let t="";u.__k=n;for(let e=0;e<n.length;e++)t+=$(n[e],r,l,c,u),n[e]=v(n[e]);return t}if(void 0!==n.constructor)return"";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=w({},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,c=0;for(;o.__d&&c++<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=w({},r,t.getChildContext()))}o=null!=o&&o.type===t&&null==o.key?o.props.children:o;const i=$(o,r,l,c,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=A(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){c=e;continue}"option"!==f||c!=e||"selected"in a||(_+=" selected")}_=_+" "+t+'="'+s(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+=s(p),h=!0;else if(O(p)){n.__k=p;for(let t=0;t<p.length;t++){let e=p[t];if(p[t]=v(e),null!=e&&!1!==e){let t=$(e,r,"svg"===f||"foreignObject"!==f&&l,c,n);t&&(m+=t,h=!0)}}}else if(null!=p&&!1!==p&&!0!==p){n.__k=[v(p)];let t=$(p,r,"svg"===f||"foreignObject"!==f&&l,c,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 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 P(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function T(t){return N.call(t).replace(D,"Symbol($1)")}function U(t){return"["+M.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(F,"\\$1")}(t)+'"';if("function"===e)return P(t);if("symbol"===e)return T(t);const n=C.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?E.call(t):"[object Error]"===n?U(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&&U(t)}function J(t,e,n,r,o,i,l,c,s,u){let f="";if(t.length){f+=o;const a=n+e;for(let n=0;n<t.length;n++)f+=a+z(t[n],e,a,r,o,i,l,c,s,u),n<t.length-1&&(f+=","+r);f+=o+n}return"["+f+"]"}function V(t,e,n,r,o,i,l,c,s,u){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);const f=++c>l;if(!f&&t.toJSON&&"function"==typeof t.toJSON)return z(t.toJSON(),e,n,r,o,i,l,c,s,u);const a=C.call(t);return"[object Arguments]"===a?f?"[Arguments]":function(t,e,n,r,o,i,l,c,s,u){return(u?"":"Arguments ")+J(t,e,n,r,o,i,l,c,s,u)}(t,e,n,r,o,i,l,c,s,u):W(a)?f?"[Array]":function(t,e,n,r,o,i,l,c,s,u){return(u?"":t.constructor.name+" ")+J(t,e,n,r,o,i,l,c,s,u)}(t,e,n,r,o,i,l,c,s,u):"[object Map]"===a?f?"[Map]":function(t,e,n,r,o,i,l,c,s,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+z(p.value[0],e,t,r,o,i,l,c,s,u)+" => "+z(p.value[1],e,t,r,o,i,l,c,s,u),p=a.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,l,c,s,u):"[object Set]"===a?f?"[Set]":function(t,e,n,r,o,i,l,c,s,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+z(p.value[1],e,t,r,o,i,l,c,s,u),p=a.next(),p.done||(f+=","+r);f+=o+n}return f+"}"}(t,e,n,r,o,i,l,c,s,u):"object"==typeof t?f?"[Object]":function(t,e,n,r,o,i,l,c,s,u){let f=(u?"":t.constructor?t.constructor.name+" ":"Object ")+"{",a=Object.keys(t).sort();const p=L(t);if(p.length&&(a=a.filter(t=>!("symbol"==typeof t||"[object Symbol]"===C.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+z(d,e,p,r,o,i,l,c,s,u)+": "+z(t[d],e,p,r,o,i,l,c,s,u),n<a.length-1&&(f+=","+r)}f+=o+n}return f+"}"}(t,e,n,r,o,i,l,c,s,u):void 0}function q(t,e,n,r,o,i,l,c,s,u){let f,a=!1;for(let e=0;e<s.length;e++)if(f=s[e],f.test(t)){a=!0;break}return!!a&&f.print(t,function(t){return z(t,e,n,r,o,i,l,c,s,u)},function(t){const r=n+e;return r+t.replace(I,"\n"+r)},{edgeSpacing:o,spacing:r})}function z(t,e,n,r,o,i,l,c,s,u){return R(t)||q(t,e,n,r,o,i,l,c,s,u)||V(t,e,n,r,o,i,l,c,s,u)}const B={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function G(t){return new Array(t+1).join(" ")}let Z={test:t=>t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t,print:(t,e,n)=>S(t,Z.context,Z.opts)},K={plugins:[Z]},Q={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?(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 l=q(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min);if(l)return l}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,l)}\n`)):e="Function",u(`\n${t}={${e}}`,l)):`\n${l}${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.modern.js.map
|