best-unit 0.0.6 → 0.0.7
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/dist/best-unit.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function de(){console.log("npm package test!!!")}function ve(){console.log("Current time:",new Date().toISOString())}var O,d,te,C,Q,ne,_e,re,z,R,B,L={},oe=[],me=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,H=Array.isArray;function k(t,e){for(var n in e)t[n]=e[n];return t}function G(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function x(t,e,n){var o,l,_,i={};for(_ in e)_=="key"?o=e[_]:_=="ref"?l=e[_]:i[_]=e[_];if(arguments.length>2&&(i.children=arguments.length>3?O.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(_ in t.defaultProps)i[_]===void 0&&(i[_]=t.defaultProps[_]);return $(t,i,o,l,null)}function $(t,e,n,o,l){var _={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++te,__i:-1,__u:0};return l==null&&d.vnode!=null&&d.vnode(_),_}function F(t){return t.children}function j(t,e){this.props=t,this.context=e}function P(t,e){if(e==null)return t.__?P(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?P(t):null}function le(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return le(t)}}function X(t){(!t.__d&&(t.__d=!0)&&C.push(t)&&!N.__r++||Q!=d.debounceRendering)&&((Q=d.debounceRendering)||ne)(N)}function N(){for(var t,e,n,o,l,_,i,s=1;C.length;)C.length>s&&C.sort(_e),t=C.shift(),s=C.length,t.__d&&(n=void 0,l=(o=(e=t).__v).__e,_=[],i=[],e.__P&&((n=k({},o)).__v=o.__v+1,d.vnode&&d.vnode(n),V(e.__P,n,o,e.__n,e.__P.namespaceURI,32&o.__u?[l]:null,_,l??P(o),!!(32&o.__u),i),n.__v=o.__v,n.__.__k[n.__i]=n,ue(_,n,i),n.__e!=l&&le(n)));N.__r=0}function ie(t,e,n,o,l,_,i,s,c,u,a){var r,v,p,m,g,y,f=o&&o.__k||oe,h=e.length;for(c=ye(n,e,f,c,h),r=0;r<h;r++)(p=n.__k[r])!=null&&(v=p.__i==-1?L:f[p.__i]||L,p.__i=r,y=V(t,p,v,l,_,i,s,c,u,a),m=p.__e,p.ref&&v.ref!=p.ref&&(v.ref&&q(v.ref,null,p),a.push(p.ref,p.__c||m,p)),g==null&&m!=null&&(g=m),4&p.__u||v.__k===p.__k?c=se(p,c,t):typeof p.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=g,c}function ye(t,e,n,o,l){var _,i,s,c,u,a=n.length,r=a,v=0;for(t.__k=new Array(l),_=0;_<l;_++)(i=e[_])!=null&&typeof i!="boolean"&&typeof i!="function"?(c=_+v,(i=t.__k[_]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?$(null,i,null,null,null):H(i)?$(F,{children:i},null,null,null):i.constructor==null&&i.__b>0?$(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=t,i.__b=t.__b+1,s=null,(u=i.__i=ge(i,n,c,r))!=-1&&(r--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(l>a?v--:l<a&&v++),typeof i.type!="function"&&(i.__u|=4)):u!=c&&(u==c-1?v--:u==c+1?v++:(u>c?v--:v++,i.__u|=4))):t.__k[_]=null;if(r)for(_=0;_<a;_++)(s=n[_])!=null&&(2&s.__u)==0&&(s.__e==o&&(o=P(s)),pe(s,s));return o}function se(t,e,n){var o,l;if(typeof t.type=="function"){for(o=t.__k,l=0;o&&l<o.length;l++)o[l]&&(o[l].__=t,e=se(o[l],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=P(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ge(t,e,n,o){var l,_,i=t.key,s=t.type,c=e[n];if(c===null&&t.key==null||c&&i==c.key&&s==c.type&&(2&c.__u)==0)return n;if(o>(c!=null&&(2&c.__u)==0?1:0))for(l=n-1,_=n+1;l>=0||_<e.length;){if(l>=0){if((c=e[l])&&(2&c.__u)==0&&i==c.key&&s==c.type)return l;l--}if(_<e.length){if((c=e[_])&&(2&c.__u)==0&&i==c.key&&s==c.type)return _;_++}}return-1}function Y(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||me.test(e)?n:n+"px"}function A(t,e,n,o,l){var _,i;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||Y(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||Y(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")_=e!=(e=e.replace(re,"$1")),i=e.toLowerCase(),e=i in t||e=="onFocusOut"||e=="onFocusIn"?i.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+_]=n,n?o?n.u=o.u:(n.u=z,t.addEventListener(e,_?B:R,_)):t.removeEventListener(e,_?B:R,_);else{if(l=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function Z(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=z++;else if(e.t<n.u)return;return n(d.event?d.event(e):e)}}}function V(t,e,n,o,l,_,i,s,c,u){var a,r,v,p,m,g,y,f,h,S,w,D,T,K,U,E,I,b=e.type;if(e.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),_=[s=e.__e=n.__e]),(a=d.__b)&&a(e);e:if(typeof b=="function")try{if(f=e.props,h="prototype"in b&&b.prototype.render,S=(a=b.contextType)&&o[a.__c],w=a?S?S.props.value:a.__:o,n.__c?y=(r=e.__c=n.__c).__=r.__E:(h?e.__c=r=new b(f,w):(e.__c=r=new j(f,w),r.constructor=b,r.render=ke),S&&S.sub(r),r.props=f,r.state||(r.state={}),r.context=w,r.__n=o,v=r.__d=!0,r.__h=[],r._sb=[]),h&&r.__s==null&&(r.__s=r.state),h&&b.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=k({},r.__s)),k(r.__s,b.getDerivedStateFromProps(f,r.__s))),p=r.props,m=r.state,r.__v=e,v)h&&b.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),h&&r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(h&&b.getDerivedStateFromProps==null&&f!==p&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(f,w),!r.__e&&r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(f,r.__s,w)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(r.props=f,r.state=r.__s,r.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(M){M&&(M.__=e)}),D=0;D<r._sb.length;D++)r.__h.push(r._sb[D]);r._sb=[],r.__h.length&&i.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(f,r.__s,w),h&&r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(p,m,g)})}if(r.context=w,r.props=f,r.__P=t,r.__e=!1,T=d.__r,K=0,h){for(r.state=r.__s,r.__d=!1,T&&T(e),a=r.render(r.props,r.state,r.context),U=0;U<r._sb.length;U++)r.__h.push(r._sb[U]);r._sb=[]}else do r.__d=!1,T&&T(e),a=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++K<25);r.state=r.__s,r.getChildContext!=null&&(o=k(k({},o),r.getChildContext())),h&&!v&&r.getSnapshotBeforeUpdate!=null&&(g=r.getSnapshotBeforeUpdate(p,m)),E=a,a!=null&&a.type===F&&a.key==null&&(E=ce(a.props.children)),s=ie(t,H(E)?E:[E],e,n,o,l,_,i,s,c,u),r.base=e.__e,e.__u&=-161,r.__h.length&&i.push(r),y&&(r.__E=r.__=null)}catch(M){if(e.__v=null,c||_!=null)if(M.then){for(e.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;_[_.indexOf(s)]=null,e.__e=s}else for(I=_.length;I--;)G(_[I]);else e.__e=n.__e,e.__k=n.__k;d.__e(M,e,n)}else _==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):s=e.__e=be(n.__e,e,n,o,l,_,i,c,u);return(a=d.diffed)&&a(e),128&e.__u?void 0:s}function ue(t,e,n){for(var o=0;o<n.length;o++)q(n[o],n[++o],n[++o]);d.__c&&d.__c(e,t),t.some(function(l){try{t=l.__h,l.__h=[],t.some(function(_){_.call(l)})}catch(_){d.__e(_,l.__v)}})}function ce(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:H(t)?t.map(ce):k({},t)}function be(t,e,n,o,l,_,i,s,c){var u,a,r,v,p,m,g,y=n.props,f=e.props,h=e.type;if(h=="svg"?l="http://www.w3.org/2000/svg":h=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),_!=null){for(u=0;u<_.length;u++)if((p=_[u])&&"setAttribute"in p==!!h&&(h?p.localName==h:p.nodeType==3)){t=p,_[u]=null;break}}if(t==null){if(h==null)return document.createTextNode(f);t=document.createElementNS(l,h,f.is&&f),s&&(d.__m&&d.__m(e,_),s=!1),_=null}if(h==null)y===f||s&&t.data==f||(t.data=f);else{if(_=_&&O.call(t.childNodes),y=n.props||L,!s&&_!=null)for(y={},u=0;u<t.attributes.length;u++)y[(p=t.attributes[u]).name]=p.value;for(u in y)if(p=y[u],u!="children"){if(u=="dangerouslySetInnerHTML")r=p;else if(!(u in f)){if(u=="value"&&"defaultValue"in f||u=="checked"&&"defaultChecked"in f)continue;A(t,u,null,p,l)}}for(u in f)p=f[u],u=="children"?v=p:u=="dangerouslySetInnerHTML"?a=p:u=="value"?m=p:u=="checked"?g=p:s&&typeof p!="function"||y[u]===p||A(t,u,p,y[u],l);if(a)s||r&&(a.__html==r.__html||a.__html==t.innerHTML)||(t.innerHTML=a.__html),e.__k=[];else if(r&&(t.innerHTML=""),ie(e.type=="template"?t.content:t,H(v)?v:[v],e,n,o,h=="foreignObject"?"http://www.w3.org/1999/xhtml":l,_,i,_?_[0]:n.__k&&P(n,0),s,c),_!=null)for(u=_.length;u--;)G(_[u]);s||(u="value",h=="progress"&&m==null?t.removeAttribute("value"):m!=null&&(m!==t[u]||h=="progress"&&!m||h=="option"&&m!=y[u])&&A(t,u,m,y[u],l),u="checked",g!=null&&g!=t[u]&&A(t,u,g,y[u],l))}return t}function q(t,e,n){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(l){d.__e(l,n)}}function pe(t,e,n){var o,l;if(d.unmount&&d.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||q(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(_){d.__e(_,e)}o.base=o.__P=null}if(o=t.__k)for(l=0;l<o.length;l++)o[l]&&pe(o[l],e,n||typeof t.type!="function");n||G(t.__e),t.__c=t.__=t.__e=void 0}function ke(t,e,n){return this.constructor(t,n)}function W(t,e,n){var o,l,_,i;e==document&&(e=document.documentElement),d.__&&d.__(t,e),l=(o=typeof n=="function")?null:n&&n.__k||e.__k,_=[],i=[],V(e,t=(!o&&n||e).__k=x(F,null,[t]),l||L,L,e.namespaceURI,!o&&n?[n]:l?null:e.firstChild?O.call(e.childNodes):null,_,!o&&n?n:l?l.__e:e.firstChild,o,i),ue(_,t,i)}function ae(t,e){W(t,e,ae)}function fe(t,e,n){var o,l,_,i,s=k({},t.props);for(_ in t.type&&t.type.defaultProps&&(i=t.type.defaultProps),e)_=="key"?o=e[_]:_=="ref"?l=e[_]:s[_]=e[_]===void 0&&i!=null?i[_]:e[_];return arguments.length>2&&(s.children=arguments.length>3?O.call(arguments,2):n),$(t.type,s,o||t.key,l||t.ref,null)}O=oe.slice,d={__e:function(t,e,n,o){for(var l,_,i;e=e.__;)if((l=e.__c)&&!l.__)try{if((_=l.constructor)&&_.getDerivedStateFromError!=null&&(l.setState(_.getDerivedStateFromError(t)),i=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(t,o||{}),i=l.__d),i)return l.__E=l}catch(s){t=s}throw t}},te=0,j.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=k({},this.state),typeof t=="function"&&(t=t(k({},n),this.props)),t&&k(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),X(this))},j.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),X(this))},j.prototype.render=F,C=[],ne=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_e=function(t,e){return t.__v.__b-e.__v.__b},N.__r=0,re=/(PointerCapture)$|Capture$/i,z=0,R=Z(!1),B=Z(!0);var we=0;function Ce(t,e,n,o,l,_){e||(e={});var i,s,c=e;if("ref"in c)for(s in c={},e)s=="ref"?i=e[s]:c[s]=e[s];var u={type:t,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--we,__i:-1,__u:0,__source:l,__self:_};return d.vnode&&d.vnode(u),u}function J(){return(J=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}var xe=["context","children"];function Pe(t){this.getChildContext=function(){return t.context};var e=t.children,n=function(o,l){if(o==null)return{};var _,i,s={},c=Object.keys(o);for(i=0;i<c.length;i++)l.indexOf(_=c[i])>=0||(s[_]=o[_]);return s}(t,xe);return fe(e,n)}function Se(){var t=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(Pe,J({},this._props,{context:t.detail.context}),function e(n,o){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var l=[],_={},i=0,s=n.attributes,c=n.childNodes;for(i=s.length;i--;)s[i].name!=="slot"&&(_[s[i].name]=s[i].value,_[he(s[i].name)]=s[i].value);for(i=c.length;i--;){var u=e(c[i],null),a=c[i].slot;a?_[a]=x(ee,{name:a},u):l[i]=u}var r=o?x(ee,null,l):l;return x(o||n.nodeName.toLowerCase(),_,r)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?ae:W)(this._vdom,this._root)}function he(t){return t.replace(/-(\w)/g,function(e,n){return n?n.toUpperCase():""})}function Te(t,e,n){if(this._vdom){var o={};o[t]=n=n??void 0,o[he(t)]=n,this._vdom=fe(this._vdom,o),W(this._vdom,this._root)}}function Ee(){W(this._vdom=null,this._root)}function ee(t,e){var n=this;return x("slot",J({},t,{ref:function(o){o?(n.ref=o,n._listener||(n._listener=function(l){l.stopPropagation(),l.detail.context=e},o.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function Me(t,e,n,o){function l(){var _=Reflect.construct(HTMLElement,[],l);return _._vdomComponent=t,_._root=_,_}return(l.prototype=Object.create(HTMLElement.prototype)).constructor=l,l.prototype.connectedCallback=Se,l.prototype.attributeChangedCallback=Te,l.prototype.disconnectedCallback=Ee,n=n||t.observedAttributes||Object.keys(t.propTypes||{}),l.observedAttributes=n,n.forEach(function(_){Object.defineProperty(l.prototype,_,{get:function(){return this._vdom.props[_]},set:function(i){this._vdom?this.attributeChangedCallback(_,null,i):(this._props||(this._props={}),this._props[_]=i,this.connectedCallback());var s=typeof i;i!=null&&s!=="string"&&s!=="boolean"&&s!=="number"||this.setAttribute(_,i)}})}),customElements.define(e,l)}const $e=({name:t="World"})=>Ce("p",{children:["Hello, ",t,"!"]});Me($e,"x-greeting",["name"]);const Le=["x-greeting"];exports.components=Le;exports.npmTest=de;exports.printCurrentTime=ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Me(){console.log("npm package test!!!")}function De(){console.log("Current time:",new Date().toISOString())}var D,d,ye,$,oe,ge,be,ke,Z,J,K,M={},we=[],Fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,B=Array.isArray;function C(e,t){for(var _ in t)e[_]=t[_];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function E(e,t,_){var n,o,r,l={};for(r in t)r=="key"?n=t[r]:r=="ref"?o=t[r]:l[r]=t[r];if(arguments.length>2&&(l.children=arguments.length>3?D.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)l[r]===void 0&&(l[r]=e.defaultProps[r]);return L(e,l,n,o,null)}function L(e,t,_,n,o){var r={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++ye,__i:-1,__u:0};return o==null&&d.vnode!=null&&d.vnode(r),r}function q(e){return e.children}function I(e,t){this.props=e,this.context=t}function P(e,t){if(t==null)return e.__?P(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?P(e):null}function xe(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return xe(e)}}function ie(e){(!e.__d&&(e.__d=!0)&&$.push(e)&&!R.__r++||oe!=d.debounceRendering)&&((oe=d.debounceRendering)||ge)(R)}function R(){for(var e,t,_,n,o,r,l,u=1;$.length;)$.length>u&&$.sort(be),e=$.shift(),u=$.length,e.__d&&(_=void 0,o=(n=(t=e).__v).__e,r=[],l=[],t.__P&&((_=C({},n)).__v=n.__v+1,d.vnode&&d.vnode(_),te(t.__P,_,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,r,o??P(n),!!(32&n.__u),l),_.__v=n.__v,_.__.__k[_.__i]=_,$e(r,_,l),_.__e!=o&&xe(_)));R.__r=0}function Ce(e,t,_,n,o,r,l,u,c,s,f){var i,p,a,g,w,b,h=n&&n.__k||we,m=t.length;for(c=Oe(_,t,h,c,m),i=0;i<m;i++)(a=_.__k[i])!=null&&(p=a.__i==-1?M:h[a.__i]||M,a.__i=i,b=te(e,a,p,o,r,l,u,c,s,f),g=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&_e(p.ref,null,a),f.push(a.ref,a.__c||g,a)),w==null&&g!=null&&(w=g),4&a.__u||p.__k===a.__k?c=Se(a,c,e):typeof a.type=="function"&&b!==void 0?c=b:g&&(c=g.nextSibling),a.__u&=-7);return _.__e=w,c}function Oe(e,t,_,n,o){var r,l,u,c,s,f=_.length,i=f,p=0;for(e.__k=new Array(o),r=0;r<o;r++)(l=t[r])!=null&&typeof l!="boolean"&&typeof l!="function"?(c=r+p,(l=e.__k[r]=typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?L(null,l,null,null,null):B(l)?L(q,{children:l},null,null,null):l.constructor==null&&l.__b>0?L(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,u=null,(s=l.__i=je(l,_,c,i))!=-1&&(i--,(u=_[s])&&(u.__u|=2)),u==null||u.__v==null?(s==-1&&(o>f?p--:o<f&&p++),typeof l.type!="function"&&(l.__u|=4)):s!=c&&(s==c-1?p--:s==c+1?p++:(s>c?p--:p++,l.__u|=4))):e.__k[r]=null;if(i)for(r=0;r<f;r++)(u=_[r])!=null&&(2&u.__u)==0&&(u.__e==n&&(n=P(u)),Pe(u,u));return n}function Se(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=Se(n[o],t,_));return t}e.__e!=t&&(t&&e.type&&!_.contains(t)&&(t=P(e)),_.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function je(e,t,_,n){var o,r,l=e.key,u=e.type,c=t[_];if(c===null&&e.key==null||c&&l==c.key&&u==c.type&&(2&c.__u)==0)return _;if(n>(c!=null&&(2&c.__u)==0?1:0))for(o=_-1,r=_+1;o>=0||r<t.length;){if(o>=0){if((c=t[o])&&(2&c.__u)==0&&l==c.key&&u==c.type)return o;o--}if(r<t.length){if((c=t[r])&&(2&c.__u)==0&&l==c.key&&u==c.type)return r;r++}}return-1}function le(e,t,_){t[0]=="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||Fe.test(t)?_:_+"px"}function j(e,t,_,n,o){var r,l;e:if(t=="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||le(e.style,t,"");if(_)for(t in _)n&&_[t]==n[t]||le(e.style,t,_[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(ke,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=_,_?n?_.u=n.u:(_.u=Z,e.addEventListener(t,r?K:J,r)):e.removeEventListener(t,r?K:J,r);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&_==1?"":_))}}function ue(e){return function(t){if(this.l){var _=this.l[t.type+e];if(t.t==null)t.t=Z++;else if(t.t<_.u)return;return _(d.event?d.event(t):t)}}}function te(e,t,_,n,o,r,l,u,c,s){var f,i,p,a,g,w,b,h,m,T,S,F,H,re,O,N,V,x=t.type;if(t.constructor!=null)return null;128&_.__u&&(c=!!(32&_.__u),r=[u=t.__e=_.__e]),(f=d.__b)&&f(t);e:if(typeof x=="function")try{if(h=t.props,m="prototype"in x&&x.prototype.render,T=(f=x.contextType)&&n[f.__c],S=f?T?T.props.value:f.__:n,_.__c?b=(i=t.__c=_.__c).__=i.__E:(m?t.__c=i=new x(h,S):(t.__c=i=new I(h,S),i.constructor=x,i.render=We),T&&T.sub(i),i.props=h,i.state||(i.state={}),i.context=S,i.__n=n,p=i.__d=!0,i.__h=[],i._sb=[]),m&&i.__s==null&&(i.__s=i.state),m&&x.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,x.getDerivedStateFromProps(h,i.__s))),a=i.props,g=i.state,i.__v=t,p)m&&x.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),m&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(m&&x.getDerivedStateFromProps==null&&h!==a&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(h,S),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(h,i.__s,S)===!1||t.__v==_.__v){for(t.__v!=_.__v&&(i.props=h,i.state=i.__s,i.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.some(function(U){U&&(U.__=t)}),F=0;F<i._sb.length;F++)i.__h.push(i._sb[F]);i._sb=[],i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(h,i.__s,S),m&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(a,g,w)})}if(i.context=S,i.props=h,i.__P=e,i.__e=!1,H=d.__r,re=0,m){for(i.state=i.__s,i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),O=0;O<i._sb.length;O++)i.__h.push(i._sb[O]);i._sb=[]}else do i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++re<25);i.state=i.__s,i.getChildContext!=null&&(n=C(C({},n),i.getChildContext())),m&&!p&&i.getSnapshotBeforeUpdate!=null&&(w=i.getSnapshotBeforeUpdate(a,g)),N=f,f!=null&&f.type===q&&f.key==null&&(N=Ee(f.props.children)),u=Ce(e,B(N)?N:[N],t,_,n,o,r,l,u,c,s),i.base=t.__e,t.__u&=-161,i.__h.length&&l.push(i),b&&(i.__E=i.__=null)}catch(U){if(t.__v=null,c||r!=null)if(U.then){for(t.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;r[r.indexOf(u)]=null,t.__e=u}else for(V=r.length;V--;)ee(r[V]);else t.__e=_.__e,t.__k=_.__k;d.__e(U,t,_)}else r==null&&t.__v==_.__v?(t.__k=_.__k,t.__e=_.__e):u=t.__e=Ie(_.__e,t,_,n,o,r,l,c,s);return(f=d.diffed)&&f(t),128&t.__u?void 0:u}function $e(e,t,_){for(var n=0;n<_.length;n++)_e(_[n],_[++n],_[++n]);d.__c&&d.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){d.__e(r,o.__v)}})}function Ee(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:B(e)?e.map(Ee):C({},e)}function Ie(e,t,_,n,o,r,l,u,c){var s,f,i,p,a,g,w,b=_.props,h=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(s=0;s<r.length;s++)if((a=r[s])&&"setAttribute"in a==!!m&&(m?a.localName==m:a.nodeType==3)){e=a,r[s]=null;break}}if(e==null){if(m==null)return document.createTextNode(h);e=document.createElementNS(o,m,h.is&&h),u&&(d.__m&&d.__m(t,r),u=!1),r=null}if(m==null)b===h||u&&e.data==h||(e.data=h);else{if(r=r&&D.call(e.childNodes),b=_.props||M,!u&&r!=null)for(b={},s=0;s<e.attributes.length;s++)b[(a=e.attributes[s]).name]=a.value;for(s in b)if(a=b[s],s!="children"){if(s=="dangerouslySetInnerHTML")i=a;else if(!(s in h)){if(s=="value"&&"defaultValue"in h||s=="checked"&&"defaultChecked"in h)continue;j(e,s,null,a,o)}}for(s in h)a=h[s],s=="children"?p=a:s=="dangerouslySetInnerHTML"?f=a:s=="value"?g=a:s=="checked"?w=a:u&&typeof a!="function"||b[s]===a||j(e,s,a,b[s],o);if(f)u||i&&(f.__html==i.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),Ce(t.type=="template"?e.content:e,B(p)?p:[p],t,_,n,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,l,r?r[0]:_.__k&&P(_,0),u,c),r!=null)for(s=r.length;s--;)ee(r[s]);u||(s="value",m=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[s]||m=="progress"&&!g||m=="option"&&g!=b[s])&&j(e,s,g,b[s],o),s="checked",w!=null&&w!=e[s]&&j(e,s,w,b[s],o))}return e}function _e(e,t,_){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){d.__e(o,_)}}function Pe(e,t,_){var n,o;if(d.unmount&&d.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||_e(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){d.__e(r,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&Pe(n[o],t,_||typeof e.type!="function");_||ee(e.__e),e.__c=e.__=e.__e=void 0}function We(e,t,_){return this.constructor(e,_)}function z(e,t,_){var n,o,r,l;t==document&&(t=document.documentElement),d.__&&d.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,r=[],l=[],te(t,e=(!n&&_||t).__k=E(q,null,[e]),o||M,M,t.namespaceURI,!n&&_?[_]:o?null:t.firstChild?D.call(t.childNodes):null,r,!n&&_?_:o?o.__e:t.firstChild,n,l),$e(r,e,l)}function Te(e,t){z(e,t,Te)}function He(e,t,_){var n,o,r,l,u=C({},e.props);for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)r=="key"?n=t[r]:r=="ref"?o=t[r]:u[r]=t[r]===void 0&&l!=null?l[r]:t[r];return arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):_),L(e.type,u,n||e.key,o||e.ref,null)}D=we.slice,d={__e:function(e,t,_,n){for(var o,r,l;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),l=o.__d),l)return o.__E=o}catch(u){e=u}throw e}},ye=0,I.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},_),this.props)),e&&C(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ie(this))},I.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ie(this))},I.prototype.render=q,$=[],ge=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,be=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0,ke=/(PointerCapture)$|Capture$/i,Z=0,J=ue(!1),K=ue(!0);var Re=0;function k(e,t,_,n,o,r){t||(t={});var l,u,c=t;if("ref"in c)for(u in c={},t)u=="ref"?l=t[u]:c[u]=t[u];var s={type:e,props:c,key:_,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Re,__i:-1,__u:0,__source:o,__self:r};if(typeof e=="function"&&(l=e.defaultProps))for(u in l)c[u]===void 0&&(c[u]=l[u]);return d.vnode&&d.vnode(s),s}function ne(){return(ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var _=arguments[t];for(var n in _)Object.prototype.hasOwnProperty.call(_,n)&&(e[n]=_[n])}return e}).apply(this,arguments)}var Be=["context","children"];function qe(e){this.getChildContext=function(){return e.context};var t=e.children,_=function(n,o){if(n==null)return{};var r,l,u={},c=Object.keys(n);for(l=0;l<c.length;l++)o.indexOf(r=c[l])>=0||(u[r]=n[r]);return u}(e,Be);return He(t,_)}function ze(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=E(qe,ne({},this._props,{context:e.detail.context}),function t(_,n){if(_.nodeType===3)return _.data;if(_.nodeType!==1)return null;var o=[],r={},l=0,u=_.attributes,c=_.childNodes;for(l=u.length;l--;)u[l].name!=="slot"&&(r[u[l].name]=u[l].value,r[Ne(u[l].name)]=u[l].value);for(l=c.length;l--;){var s=t(c[l],null),f=c[l].slot;f?r[f]=E(se,{name:f},s):o[l]=s}var i=n?E(se,null,o):o;return E(n||_.nodeName.toLowerCase(),r,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Te:z)(this._vdom,this._root)}function Ne(e){return e.replace(/-(\w)/g,function(t,_){return _?_.toUpperCase():""})}function Ve(e,t,_){if(this._vdom){var n={};n[e]=_=_??void 0,n[Ne(e)]=_,this._vdom=He(this._vdom,n),z(this._vdom,this._root)}}function Ge(){z(this._vdom=null,this._root)}function se(e,t){var _=this;return E("slot",ne({},e,{ref:function(n){n?(_.ref=n,_._listener||(_._listener=function(o){o.stopPropagation(),o.detail.context=t},n.addEventListener("_preact",_._listener))):_.ref.removeEventListener("_preact",_._listener)}}))}function Ue(e,t,_,n){function o(){var r=Reflect.construct(HTMLElement,[],o);return r._vdomComponent=e,r._root=n&&n.shadow?r.attachShadow({mode:n.mode||"open"}):r,r}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=ze,o.prototype.attributeChangedCallback=Ve,o.prototype.disconnectedCallback=Ge,_=_||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=_,_.forEach(function(r){Object.defineProperty(o.prototype,r,{get:function(){return this._vdom.props[r]},set:function(l){this._vdom?this.attributeChangedCallback(r,null,l):(this._props||(this._props={}),this._props[r]=l,this.connectedCallback());var u=typeof l;l!=null&&u!=="string"&&u!=="boolean"&&u!=="number"||this.setAttribute(r,l)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}const Je=({name:e="World"})=>k("p",{children:["Hello, ",e,"!"]});Ue(Je,"x-greeting",["name"],{shadow:!1});var Q,v,G,ce,X=0,Ae=[],y=d,ae=y.__b,fe=y.__r,pe=y.diffed,de=y.__c,he=y.unmount,me=y.__;function Ke(e,t){y.__h&&y.__h(v,e,X||t),X=0;var _=v.__H||(v.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({}),_.__[e]}function A(e){return X=1,Qe(Le,e)}function Qe(e,t,_){var n=Ke(Q++,2);if(n.t=e,!n.__c&&(n.__=[Le(void 0,t),function(u){var c=n.__N?n.__N[0]:n.__[0],s=n.t(c,u);c!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.__f)){var o=function(u,c,s){if(!n.__c.__H)return!0;var f=n.__c.__H.__.filter(function(p){return!!p.__c});if(f.every(function(p){return!p.__N}))return!r||r.call(this,u,c,s);var i=n.__c.props!==u;return f.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(i=!0)}}),r&&r.call(this,u,c,s)||i};v.__f=!0;var r=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(u,c,s){if(this.__e){var f=r;r=void 0,o(u,c,s),r=f}l&&l.call(this,u,c,s)},v.shouldComponentUpdate=o}return n.__N||n.__}function Xe(){for(var e;e=Ae.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(t){e.__H.__h=[],y.__e(t,e.__v)}}y.__b=function(e){v=null,ae&&ae(e)},y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),me&&me(e,t)},y.__r=function(e){fe&&fe(e),Q=0;var t=(v=e.__c).__H;t&&(G===v?(t.__h=[],v.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.u=_.__N=void 0})):(t.__h.forEach(W),t.__h.forEach(Y),t.__h=[],Q=0)),G=v},y.diffed=function(e){pe&&pe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ae.push(t)!==1&&ce===y.requestAnimationFrame||((ce=y.requestAnimationFrame)||Ye)(Xe)),t.__H.__.forEach(function(_){_.u&&(_.__H=_.u),_.u=void 0})),G=v=null},y.__c=function(e,t){t.some(function(_){try{_.__h.forEach(W),_.__h=_.__h.filter(function(n){return!n.__||Y(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],y.__e(n,_.__v)}}),de&&de(e,t)},y.unmount=function(e){he&&he(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{W(n)}catch(o){t=o}}),_.__H=void 0,t&&y.__e(t,_.__v))};var ve=typeof requestAnimationFrame=="function";function Ye(e){var t,_=function(){clearTimeout(n),ve&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,35);ve&&(t=requestAnimationFrame(_))}function W(e){var t=v,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),v=t}function Y(e){var t=v;e.__c=e.__(),v=t}function Le(e,t){return typeof t=="function"?t(e):t}function Ze({onClick:e,color:t,children:_}){return k("button",{style:{background:t||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},onClick:e,children:_})}function et({visible:e,onClose:t,onSubmit:_,color:n}){const[o,r]=A(""),[l,u]=A(""),[c,s]=A(!1),[f,i]=A("");return e?k("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},children:k("form",{onSubmit:async a=>{a.preventDefault(),s(!0),i("");try{await _({name:o,email:l}),t()}catch{i("提交失败,请重试")}finally{s(!1)}},style:{background:"#fff",padding:24,borderRadius:8,minWidth:320},children:[k("h2",{style:{color:n||"#1890ff"},children:"表单"}),k("div",{style:{marginBottom:12},children:[k("input",{type:"text",placeholder:"姓名",value:o,onInput:a=>r(a.target.value),required:!0,style:{width:"100%",padding:8,marginBottom:8}}),k("input",{type:"email",placeholder:"邮箱",value:l,onInput:a=>u(a.target.value),required:!0,style:{width:"100%",padding:8}})]}),f&&k("div",{style:{color:"red",marginBottom:8},children:f}),k("button",{type:"submit",disabled:c,style:{background:n||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},children:c?"提交中...":"提交"}),k("button",{type:"button",onClick:t,style:{marginLeft:12,background:"#eee",color:"#333",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},children:"取消"})]})}):null}function tt(e){const[t,_]=A(!1),n=e.theme?.primaryColor;return k("div",{children:[k(Ze,{color:n,onClick:()=>_(!0),children:"打开表单"}),k(et,{visible:t,onClose:()=>_(!1),onSubmit:async r=>{console.log("submit",r)},color:n})]})}Ue(tt,"x-best-modal-form",["theme"],{shadow:!1});const _t=["x-greeting","x-best-modal-form"];exports.components=_t;exports.npmTest=Me;exports.printCurrentTime=De;
|
package/dist/best-unit.js
CHANGED
|
@@ -1,348 +1,576 @@
|
|
|
1
|
-
function
|
|
1
|
+
function et() {
|
|
2
2
|
console.log("npm package test!!!");
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function tt() {
|
|
5
5
|
console.log("Current time:", (/* @__PURE__ */ new Date()).toISOString());
|
|
6
6
|
}
|
|
7
|
-
var D, d,
|
|
8
|
-
function
|
|
9
|
-
for (var
|
|
10
|
-
return
|
|
7
|
+
var D, d, ye, S, oe, ge, be, ke, Z, J, K, M = {}, we = [], Me = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, B = Array.isArray;
|
|
8
|
+
function C(e, t) {
|
|
9
|
+
for (var _ in t) e[_] = t[_];
|
|
10
|
+
return e;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
12
|
+
function ee(e) {
|
|
13
|
+
e && e.parentNode && e.parentNode.removeChild(e);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
var
|
|
17
|
-
for (
|
|
18
|
-
if (arguments.length > 2 && (
|
|
19
|
-
return L(
|
|
15
|
+
function E(e, t, _) {
|
|
16
|
+
var n, o, r, l = {};
|
|
17
|
+
for (r in t) r == "key" ? n = t[r] : r == "ref" ? o = t[r] : l[r] = t[r];
|
|
18
|
+
if (arguments.length > 2 && (l.children = arguments.length > 3 ? D.call(arguments, 2) : _), typeof e == "function" && e.defaultProps != null) for (r in e.defaultProps) l[r] === void 0 && (l[r] = e.defaultProps[r]);
|
|
19
|
+
return L(e, l, n, o, null);
|
|
20
20
|
}
|
|
21
|
-
function L(t,
|
|
22
|
-
var
|
|
23
|
-
return
|
|
21
|
+
function L(e, t, _, n, o) {
|
|
22
|
+
var r = { type: e, props: t, key: _, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++ye, __i: -1, __u: 0 };
|
|
23
|
+
return o == null && d.vnode != null && d.vnode(r), r;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function q(e) {
|
|
26
|
+
return e.children;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
this.props =
|
|
28
|
+
function I(e, t) {
|
|
29
|
+
this.props = e, this.context = t;
|
|
30
30
|
}
|
|
31
|
-
function P(
|
|
32
|
-
if (
|
|
33
|
-
for (var
|
|
34
|
-
return typeof
|
|
31
|
+
function P(e, t) {
|
|
32
|
+
if (t == null) return e.__ ? P(e.__, e.__i + 1) : null;
|
|
33
|
+
for (var _; t < e.__k.length; t++) if ((_ = e.__k[t]) != null && _.__e != null) return _.__e;
|
|
34
|
+
return typeof e.type == "function" ? P(e) : null;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
var
|
|
38
|
-
if ((
|
|
39
|
-
for (
|
|
40
|
-
|
|
36
|
+
function xe(e) {
|
|
37
|
+
var t, _;
|
|
38
|
+
if ((e = e.__) != null && e.__c != null) {
|
|
39
|
+
for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((_ = e.__k[t]) != null && _.__e != null) {
|
|
40
|
+
e.__e = e.__c.base = _.__e;
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return xe(e);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
(!
|
|
46
|
+
function ie(e) {
|
|
47
|
+
(!e.__d && (e.__d = !0) && S.push(e) && !R.__r++ || oe != d.debounceRendering) && ((oe = d.debounceRendering) || ge)(R);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
for (var t,
|
|
51
|
-
|
|
49
|
+
function R() {
|
|
50
|
+
for (var e, t, _, n, o, r, l, u = 1; S.length; ) S.length > u && S.sort(be), e = S.shift(), u = S.length, e.__d && (_ = void 0, o = (n = (t = e).__v).__e, r = [], l = [], t.__P && ((_ = C({}, n)).__v = n.__v + 1, d.vnode && d.vnode(_), te(t.__P, _, n, t.__n, t.__P.namespaceURI, 32 & n.__u ? [o] : null, r, o ?? P(n), !!(32 & n.__u), l), _.__v = n.__v, _.__.__k[_.__i] = _, Se(r, _, l), _.__e != o && xe(_)));
|
|
51
|
+
R.__r = 0;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
55
|
-
for (c =
|
|
56
|
-
return
|
|
53
|
+
function Ce(e, t, _, n, o, r, l, u, c, s, f) {
|
|
54
|
+
var i, p, a, g, w, b, h = n && n.__k || we, m = t.length;
|
|
55
|
+
for (c = De(_, t, h, c, m), i = 0; i < m; i++) (a = _.__k[i]) != null && (p = a.__i == -1 ? M : h[a.__i] || M, a.__i = i, b = te(e, a, p, o, r, l, u, c, s, f), g = a.__e, a.ref && p.ref != a.ref && (p.ref && _e(p.ref, null, a), f.push(a.ref, a.__c || g, a)), w == null && g != null && (w = g), 4 & a.__u || p.__k === a.__k ? c = $e(a, c, e) : typeof a.type == "function" && b !== void 0 ? c = b : g && (c = g.nextSibling), a.__u &= -7);
|
|
56
|
+
return _.__e = w, c;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
var
|
|
60
|
-
for (
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
58
|
+
function De(e, t, _, n, o) {
|
|
59
|
+
var r, l, u, c, s, f = _.length, i = f, p = 0;
|
|
60
|
+
for (e.__k = new Array(o), r = 0; r < o; r++) (l = t[r]) != null && typeof l != "boolean" && typeof l != "function" ? (c = r + p, (l = e.__k[r] = typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? L(null, l, null, null, null) : B(l) ? L(q, { children: l }, null, null, null) : l.constructor == null && l.__b > 0 ? L(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : l).__ = e, l.__b = e.__b + 1, u = null, (s = l.__i = Fe(l, _, c, i)) != -1 && (i--, (u = _[s]) && (u.__u |= 2)), u == null || u.__v == null ? (s == -1 && (o > f ? p-- : o < f && p++), typeof l.type != "function" && (l.__u |= 4)) : s != c && (s == c - 1 ? p-- : s == c + 1 ? p++ : (s > c ? p-- : p++, l.__u |= 4))) : e.__k[r] = null;
|
|
61
|
+
if (i) for (r = 0; r < f; r++) (u = _[r]) != null && (2 & u.__u) == 0 && (u.__e == n && (n = P(u)), Pe(u, u));
|
|
62
|
+
return n;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
var
|
|
66
|
-
if (typeof
|
|
67
|
-
for (
|
|
68
|
-
return
|
|
64
|
+
function $e(e, t, _) {
|
|
65
|
+
var n, o;
|
|
66
|
+
if (typeof e.type == "function") {
|
|
67
|
+
for (n = e.__k, o = 0; n && o < n.length; o++) n[o] && (n[o].__ = e, t = $e(n[o], t, _));
|
|
68
|
+
return t;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
e.__e != t && (t && e.type && !_.contains(t) && (t = P(e)), _.insertBefore(e.__e, t || null), t = e.__e);
|
|
71
71
|
do
|
|
72
|
-
|
|
73
|
-
while (
|
|
74
|
-
return
|
|
72
|
+
t = t && t.nextSibling;
|
|
73
|
+
while (t != null && t.nodeType == 8);
|
|
74
|
+
return t;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
var
|
|
78
|
-
if (c === null &&
|
|
79
|
-
if (
|
|
80
|
-
if (
|
|
81
|
-
if ((c =
|
|
82
|
-
|
|
76
|
+
function Fe(e, t, _, n) {
|
|
77
|
+
var o, r, l = e.key, u = e.type, c = t[_];
|
|
78
|
+
if (c === null && e.key == null || c && l == c.key && u == c.type && (2 & c.__u) == 0) return _;
|
|
79
|
+
if (n > (c != null && (2 & c.__u) == 0 ? 1 : 0)) for (o = _ - 1, r = _ + 1; o >= 0 || r < t.length; ) {
|
|
80
|
+
if (o >= 0) {
|
|
81
|
+
if ((c = t[o]) && (2 & c.__u) == 0 && l == c.key && u == c.type) return o;
|
|
82
|
+
o--;
|
|
83
83
|
}
|
|
84
|
-
if (
|
|
85
|
-
if ((c =
|
|
86
|
-
|
|
84
|
+
if (r < t.length) {
|
|
85
|
+
if ((c = t[r]) && (2 & c.__u) == 0 && l == c.key && u == c.type) return r;
|
|
86
|
+
r++;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
return -1;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
91
|
+
function le(e, t, _) {
|
|
92
|
+
t[0] == "-" ? e.setProperty(t, _ ?? "") : e[t] = _ == null ? "" : typeof _ != "number" || Me.test(t) ? _ : _ + "px";
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
var
|
|
96
|
-
e: if (
|
|
94
|
+
function j(e, t, _, n, o) {
|
|
95
|
+
var r, l;
|
|
96
|
+
e: if (t == "style") if (typeof _ == "string") e.style.cssText = _;
|
|
97
97
|
else {
|
|
98
|
-
if (typeof
|
|
99
|
-
if (
|
|
98
|
+
if (typeof n == "string" && (e.style.cssText = n = ""), n) for (t in n) _ && t in _ || le(e.style, t, "");
|
|
99
|
+
if (_) for (t in _) n && _[t] == n[t] || le(e.style, t, _[t]);
|
|
100
100
|
}
|
|
101
|
-
else if (
|
|
101
|
+
else if (t[0] == "o" && t[1] == "n") r = t != (t = t.replace(ke, "$1")), l = t.toLowerCase(), t = l in e || t == "onFocusOut" || t == "onFocusIn" ? l.slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + r] = _, _ ? n ? _.u = n.u : (_.u = Z, e.addEventListener(t, r ? K : J, r)) : e.removeEventListener(t, r ? K : J, r);
|
|
102
102
|
else {
|
|
103
|
-
if (
|
|
104
|
-
else if (
|
|
105
|
-
t
|
|
103
|
+
if (o == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
104
|
+
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
|
|
105
|
+
e[t] = _ ?? "";
|
|
106
106
|
break e;
|
|
107
107
|
} catch {
|
|
108
108
|
}
|
|
109
|
-
typeof
|
|
109
|
+
typeof _ == "function" || (_ == null || _ === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && _ == 1 ? "" : _));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
return function(
|
|
112
|
+
function ue(e) {
|
|
113
|
+
return function(t) {
|
|
114
114
|
if (this.l) {
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
117
|
-
else if (
|
|
118
|
-
return
|
|
115
|
+
var _ = this.l[t.type + e];
|
|
116
|
+
if (t.t == null) t.t = Z++;
|
|
117
|
+
else if (t.t < _.u) return;
|
|
118
|
+
return _(d.event ? d.event(t) : t);
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
var
|
|
124
|
-
if (
|
|
125
|
-
128 &
|
|
126
|
-
e: if (typeof
|
|
127
|
-
if (
|
|
122
|
+
function te(e, t, _, n, o, r, l, u, c, s) {
|
|
123
|
+
var f, i, p, a, g, w, b, h, m, H, $, F, T, re, O, N, V, x = t.type;
|
|
124
|
+
if (t.constructor != null) return null;
|
|
125
|
+
128 & _.__u && (c = !!(32 & _.__u), r = [u = t.__e = _.__e]), (f = d.__b) && f(t);
|
|
126
|
+
e: if (typeof x == "function") try {
|
|
127
|
+
if (h = t.props, m = "prototype" in x && x.prototype.render, H = (f = x.contextType) && n[f.__c], $ = f ? H ? H.props.value : f.__ : n, _.__c ? b = (i = t.__c = _.__c).__ = i.__E : (m ? t.__c = i = new x(h, $) : (t.__c = i = new I(h, $), i.constructor = x, i.render = je), H && H.sub(i), i.props = h, i.state || (i.state = {}), i.context = $, i.__n = n, p = i.__d = !0, i.__h = [], i._sb = []), m && i.__s == null && (i.__s = i.state), m && x.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = C({}, i.__s)), C(i.__s, x.getDerivedStateFromProps(h, i.__s))), a = i.props, g = i.state, i.__v = t, p) m && x.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), m && i.componentDidMount != null && i.__h.push(i.componentDidMount);
|
|
128
128
|
else {
|
|
129
|
-
if (
|
|
130
|
-
for (
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
|
|
129
|
+
if (m && x.getDerivedStateFromProps == null && h !== a && i.componentWillReceiveProps != null && i.componentWillReceiveProps(h, $), !i.__e && i.shouldComponentUpdate != null && i.shouldComponentUpdate(h, i.__s, $) === !1 || t.__v == _.__v) {
|
|
130
|
+
for (t.__v != _.__v && (i.props = h, i.state = i.__s, i.__d = !1), t.__e = _.__e, t.__k = _.__k, t.__k.some(function(U) {
|
|
131
|
+
U && (U.__ = t);
|
|
132
|
+
}), F = 0; F < i._sb.length; F++) i.__h.push(i._sb[F]);
|
|
133
|
+
i._sb = [], i.__h.length && l.push(i);
|
|
134
134
|
break e;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
i.componentWillUpdate != null && i.componentWillUpdate(h, i.__s, $), m && i.componentDidUpdate != null && i.__h.push(function() {
|
|
137
|
+
i.componentDidUpdate(a, g, w);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
141
|
-
for (
|
|
142
|
-
|
|
140
|
+
if (i.context = $, i.props = h, i.__P = e, i.__e = !1, T = d.__r, re = 0, m) {
|
|
141
|
+
for (i.state = i.__s, i.__d = !1, T && T(t), f = i.render(i.props, i.state, i.context), O = 0; O < i._sb.length; O++) i.__h.push(i._sb[O]);
|
|
142
|
+
i._sb = [];
|
|
143
143
|
} else do
|
|
144
|
-
|
|
145
|
-
while (
|
|
146
|
-
|
|
147
|
-
} catch (
|
|
148
|
-
if (
|
|
149
|
-
for (
|
|
150
|
-
|
|
151
|
-
} else for (
|
|
152
|
-
else
|
|
153
|
-
d.__e(
|
|
144
|
+
i.__d = !1, T && T(t), f = i.render(i.props, i.state, i.context), i.state = i.__s;
|
|
145
|
+
while (i.__d && ++re < 25);
|
|
146
|
+
i.state = i.__s, i.getChildContext != null && (n = C(C({}, n), i.getChildContext())), m && !p && i.getSnapshotBeforeUpdate != null && (w = i.getSnapshotBeforeUpdate(a, g)), N = f, f != null && f.type === q && f.key == null && (N = Ee(f.props.children)), u = Ce(e, B(N) ? N : [N], t, _, n, o, r, l, u, c, s), i.base = t.__e, t.__u &= -161, i.__h.length && l.push(i), b && (i.__E = i.__ = null);
|
|
147
|
+
} catch (U) {
|
|
148
|
+
if (t.__v = null, c || r != null) if (U.then) {
|
|
149
|
+
for (t.__u |= c ? 160 : 128; u && u.nodeType == 8 && u.nextSibling; ) u = u.nextSibling;
|
|
150
|
+
r[r.indexOf(u)] = null, t.__e = u;
|
|
151
|
+
} else for (V = r.length; V--; ) ee(r[V]);
|
|
152
|
+
else t.__e = _.__e, t.__k = _.__k;
|
|
153
|
+
d.__e(U, t, _);
|
|
154
154
|
}
|
|
155
|
-
else
|
|
156
|
-
return (
|
|
155
|
+
else r == null && t.__v == _.__v ? (t.__k = _.__k, t.__e = _.__e) : u = t.__e = Oe(_.__e, t, _, n, o, r, l, c, s);
|
|
156
|
+
return (f = d.diffed) && f(t), 128 & t.__u ? void 0 : u;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
for (var
|
|
160
|
-
d.__c && d.__c(
|
|
158
|
+
function Se(e, t, _) {
|
|
159
|
+
for (var n = 0; n < _.length; n++) _e(_[n], _[++n], _[++n]);
|
|
160
|
+
d.__c && d.__c(t, e), e.some(function(o) {
|
|
161
161
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
e = o.__h, o.__h = [], e.some(function(r) {
|
|
163
|
+
r.call(o);
|
|
164
164
|
});
|
|
165
|
-
} catch (
|
|
166
|
-
d.__e(
|
|
165
|
+
} catch (r) {
|
|
166
|
+
d.__e(r, o.__v);
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
return typeof
|
|
170
|
+
function Ee(e) {
|
|
171
|
+
return typeof e != "object" || e == null || e.__b && e.__b > 0 ? e : B(e) ? e.map(Ee) : C({}, e);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
var
|
|
175
|
-
if (
|
|
176
|
-
for (
|
|
177
|
-
|
|
173
|
+
function Oe(e, t, _, n, o, r, l, u, c) {
|
|
174
|
+
var s, f, i, p, a, g, w, b = _.props, h = t.props, m = t.type;
|
|
175
|
+
if (m == "svg" ? o = "http://www.w3.org/2000/svg" : m == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), r != null) {
|
|
176
|
+
for (s = 0; s < r.length; s++) if ((a = r[s]) && "setAttribute" in a == !!m && (m ? a.localName == m : a.nodeType == 3)) {
|
|
177
|
+
e = a, r[s] = null;
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
if (
|
|
182
|
-
if (
|
|
183
|
-
|
|
181
|
+
if (e == null) {
|
|
182
|
+
if (m == null) return document.createTextNode(h);
|
|
183
|
+
e = document.createElementNS(o, m, h.is && h), u && (d.__m && d.__m(t, r), u = !1), r = null;
|
|
184
184
|
}
|
|
185
|
-
if (
|
|
185
|
+
if (m == null) b === h || u && e.data == h || (e.data = h);
|
|
186
186
|
else {
|
|
187
|
-
if (
|
|
188
|
-
for (
|
|
189
|
-
if (
|
|
190
|
-
else if (!(
|
|
191
|
-
if (
|
|
192
|
-
|
|
187
|
+
if (r = r && D.call(e.childNodes), b = _.props || M, !u && r != null) for (b = {}, s = 0; s < e.attributes.length; s++) b[(a = e.attributes[s]).name] = a.value;
|
|
188
|
+
for (s in b) if (a = b[s], s != "children") {
|
|
189
|
+
if (s == "dangerouslySetInnerHTML") i = a;
|
|
190
|
+
else if (!(s in h)) {
|
|
191
|
+
if (s == "value" && "defaultValue" in h || s == "checked" && "defaultChecked" in h) continue;
|
|
192
|
+
j(e, s, null, a, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
for (
|
|
196
|
-
if (
|
|
197
|
-
else if (
|
|
198
|
-
|
|
195
|
+
for (s in h) a = h[s], s == "children" ? p = a : s == "dangerouslySetInnerHTML" ? f = a : s == "value" ? g = a : s == "checked" ? w = a : u && typeof a != "function" || b[s] === a || j(e, s, a, b[s], o);
|
|
196
|
+
if (f) u || i && (f.__html == i.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
|
|
197
|
+
else if (i && (e.innerHTML = ""), Ce(t.type == "template" ? e.content : e, B(p) ? p : [p], t, _, n, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, r, l, r ? r[0] : _.__k && P(_, 0), u, c), r != null) for (s = r.length; s--; ) ee(r[s]);
|
|
198
|
+
u || (s = "value", m == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[s] || m == "progress" && !g || m == "option" && g != b[s]) && j(e, s, g, b[s], o), s = "checked", w != null && w != e[s] && j(e, s, w, b[s], o));
|
|
199
199
|
}
|
|
200
|
-
return
|
|
200
|
+
return e;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function _e(e, t, _) {
|
|
203
203
|
try {
|
|
204
|
-
if (typeof
|
|
205
|
-
var
|
|
206
|
-
|
|
207
|
-
} else
|
|
208
|
-
} catch (
|
|
209
|
-
d.__e(
|
|
204
|
+
if (typeof e == "function") {
|
|
205
|
+
var n = typeof e.__u == "function";
|
|
206
|
+
n && e.__u(), n && t == null || (e.__u = e(t));
|
|
207
|
+
} else e.current = t;
|
|
208
|
+
} catch (o) {
|
|
209
|
+
d.__e(o, _);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
var
|
|
214
|
-
if (d.unmount && d.unmount(
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
} catch (
|
|
218
|
-
d.__e(
|
|
212
|
+
function Pe(e, t, _) {
|
|
213
|
+
var n, o;
|
|
214
|
+
if (d.unmount && d.unmount(e), (n = e.ref) && (n.current && n.current != e.__e || _e(n, null, t)), (n = e.__c) != null) {
|
|
215
|
+
if (n.componentWillUnmount) try {
|
|
216
|
+
n.componentWillUnmount();
|
|
217
|
+
} catch (r) {
|
|
218
|
+
d.__e(r, t);
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
n.base = n.__P = null;
|
|
221
221
|
}
|
|
222
|
-
if (
|
|
223
|
-
|
|
222
|
+
if (n = e.__k) for (o = 0; o < n.length; o++) n[o] && Pe(n[o], t, _ || typeof e.type != "function");
|
|
223
|
+
_ || ee(e.__e), e.__c = e.__ = e.__e = void 0;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
return this.constructor(
|
|
225
|
+
function je(e, t, _) {
|
|
226
|
+
return this.constructor(e, _);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var
|
|
230
|
-
|
|
228
|
+
function z(e, t, _) {
|
|
229
|
+
var n, o, r, l;
|
|
230
|
+
t == document && (t = document.documentElement), d.__ && d.__(e, t), o = (n = typeof _ == "function") ? null : _ && _.__k || t.__k, r = [], l = [], te(t, e = (!n && _ || t).__k = E(q, null, [e]), o || M, M, t.namespaceURI, !n && _ ? [_] : o ? null : t.firstChild ? D.call(t.childNodes) : null, r, !n && _ ? _ : o ? o.__e : t.firstChild, n, l), Se(r, e, l);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
232
|
+
function He(e, t) {
|
|
233
|
+
z(e, t, He);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
var
|
|
237
|
-
for (
|
|
238
|
-
return arguments.length > 2 && (
|
|
235
|
+
function Te(e, t, _) {
|
|
236
|
+
var n, o, r, l, u = C({}, e.props);
|
|
237
|
+
for (r in e.type && e.type.defaultProps && (l = e.type.defaultProps), t) r == "key" ? n = t[r] : r == "ref" ? o = t[r] : u[r] = t[r] === void 0 && l != null ? l[r] : t[r];
|
|
238
|
+
return arguments.length > 2 && (u.children = arguments.length > 3 ? D.call(arguments, 2) : _), L(e.type, u, n || e.key, o || e.ref, null);
|
|
239
239
|
}
|
|
240
|
-
D =
|
|
241
|
-
for (var
|
|
242
|
-
if ((
|
|
243
|
-
} catch (
|
|
244
|
-
|
|
240
|
+
D = we.slice, d = { __e: function(e, t, _, n) {
|
|
241
|
+
for (var o, r, l; t = t.__; ) if ((o = t.__c) && !o.__) try {
|
|
242
|
+
if ((r = o.constructor) && r.getDerivedStateFromError != null && (o.setState(r.getDerivedStateFromError(e)), l = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, n || {}), l = o.__d), l) return o.__E = o;
|
|
243
|
+
} catch (u) {
|
|
244
|
+
e = u;
|
|
245
245
|
}
|
|
246
|
-
throw
|
|
247
|
-
} },
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
this.__v && (this.__e = !0,
|
|
252
|
-
},
|
|
253
|
-
return
|
|
254
|
-
},
|
|
255
|
-
var
|
|
256
|
-
function
|
|
257
|
-
|
|
258
|
-
var
|
|
259
|
-
if ("ref" in c) for (
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
246
|
+
throw e;
|
|
247
|
+
} }, ye = 0, I.prototype.setState = function(e, t) {
|
|
248
|
+
var _;
|
|
249
|
+
_ = this.__s != null && this.__s != this.state ? this.__s : this.__s = C({}, this.state), typeof e == "function" && (e = e(C({}, _), this.props)), e && C(_, e), e != null && this.__v && (t && this._sb.push(t), ie(this));
|
|
250
|
+
}, I.prototype.forceUpdate = function(e) {
|
|
251
|
+
this.__v && (this.__e = !0, e && this.__h.push(e), ie(this));
|
|
252
|
+
}, I.prototype.render = q, S = [], ge = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, be = function(e, t) {
|
|
253
|
+
return e.__v.__b - t.__v.__b;
|
|
254
|
+
}, R.__r = 0, ke = /(PointerCapture)$|Capture$/i, Z = 0, J = ue(!1), K = ue(!0);
|
|
255
|
+
var Ie = 0;
|
|
256
|
+
function k(e, t, _, n, o, r) {
|
|
257
|
+
t || (t = {});
|
|
258
|
+
var l, u, c = t;
|
|
259
|
+
if ("ref" in c) for (u in c = {}, t) u == "ref" ? l = t[u] : c[u] = t[u];
|
|
260
|
+
var s = { type: e, props: c, key: _, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Ie, __i: -1, __u: 0, __source: o, __self: r };
|
|
261
|
+
if (typeof e == "function" && (l = e.defaultProps)) for (u in l) c[u] === void 0 && (c[u] = l[u]);
|
|
262
|
+
return d.vnode && d.vnode(s), s;
|
|
263
|
+
}
|
|
264
|
+
function ne() {
|
|
265
|
+
return (ne = Object.assign ? Object.assign.bind() : function(e) {
|
|
266
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
267
|
+
var _ = arguments[t];
|
|
268
|
+
for (var n in _) Object.prototype.hasOwnProperty.call(_, n) && (e[n] = _[n]);
|
|
268
269
|
}
|
|
269
|
-
return
|
|
270
|
+
return e;
|
|
270
271
|
}).apply(this, arguments);
|
|
271
272
|
}
|
|
272
|
-
var
|
|
273
|
-
function
|
|
273
|
+
var We = ["context", "children"];
|
|
274
|
+
function Re(e) {
|
|
274
275
|
this.getChildContext = function() {
|
|
275
|
-
return
|
|
276
|
+
return e.context;
|
|
276
277
|
};
|
|
277
|
-
var
|
|
278
|
-
if (
|
|
279
|
-
var
|
|
280
|
-
for (
|
|
281
|
-
return
|
|
282
|
-
}(
|
|
283
|
-
return
|
|
284
|
-
}
|
|
285
|
-
function
|
|
286
|
-
var
|
|
287
|
-
this.dispatchEvent(
|
|
288
|
-
if (
|
|
289
|
-
if (
|
|
290
|
-
var
|
|
291
|
-
for (
|
|
292
|
-
for (
|
|
293
|
-
var
|
|
294
|
-
|
|
278
|
+
var t = e.children, _ = function(n, o) {
|
|
279
|
+
if (n == null) return {};
|
|
280
|
+
var r, l, u = {}, c = Object.keys(n);
|
|
281
|
+
for (l = 0; l < c.length; l++) o.indexOf(r = c[l]) >= 0 || (u[r] = n[r]);
|
|
282
|
+
return u;
|
|
283
|
+
}(e, We);
|
|
284
|
+
return Te(t, _);
|
|
285
|
+
}
|
|
286
|
+
function Be() {
|
|
287
|
+
var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
|
|
288
|
+
this.dispatchEvent(e), this._vdom = E(Re, ne({}, this._props, { context: e.detail.context }), function t(_, n) {
|
|
289
|
+
if (_.nodeType === 3) return _.data;
|
|
290
|
+
if (_.nodeType !== 1) return null;
|
|
291
|
+
var o = [], r = {}, l = 0, u = _.attributes, c = _.childNodes;
|
|
292
|
+
for (l = u.length; l--; ) u[l].name !== "slot" && (r[u[l].name] = u[l].value, r[Ne(u[l].name)] = u[l].value);
|
|
293
|
+
for (l = c.length; l--; ) {
|
|
294
|
+
var s = t(c[l], null), f = c[l].slot;
|
|
295
|
+
f ? r[f] = E(se, { name: f }, s) : o[l] = s;
|
|
295
296
|
}
|
|
296
|
-
var
|
|
297
|
-
return
|
|
298
|
-
}(this, this._vdomComponent)), (this.hasAttribute("hydrate") ?
|
|
297
|
+
var i = n ? E(se, null, o) : o;
|
|
298
|
+
return E(n || _.nodeName.toLowerCase(), r, i);
|
|
299
|
+
}(this, this._vdomComponent)), (this.hasAttribute("hydrate") ? He : z)(this._vdom, this._root);
|
|
299
300
|
}
|
|
300
|
-
function
|
|
301
|
-
return
|
|
302
|
-
return
|
|
301
|
+
function Ne(e) {
|
|
302
|
+
return e.replace(/-(\w)/g, function(t, _) {
|
|
303
|
+
return _ ? _.toUpperCase() : "";
|
|
303
304
|
});
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
+
function qe(e, t, _) {
|
|
306
307
|
if (this._vdom) {
|
|
307
|
-
var
|
|
308
|
-
|
|
308
|
+
var n = {};
|
|
309
|
+
n[e] = _ = _ ?? void 0, n[Ne(e)] = _, this._vdom = Te(this._vdom, n), z(this._vdom, this._root);
|
|
309
310
|
}
|
|
310
311
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
312
|
+
function ze() {
|
|
313
|
+
z(this._vdom = null, this._root);
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
-
var
|
|
316
|
-
return
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
315
|
+
function se(e, t) {
|
|
316
|
+
var _ = this;
|
|
317
|
+
return E("slot", ne({}, e, { ref: function(n) {
|
|
318
|
+
n ? (_.ref = n, _._listener || (_._listener = function(o) {
|
|
319
|
+
o.stopPropagation(), o.detail.context = t;
|
|
320
|
+
}, n.addEventListener("_preact", _._listener))) : _.ref.removeEventListener("_preact", _._listener);
|
|
320
321
|
} }));
|
|
321
322
|
}
|
|
322
|
-
function
|
|
323
|
-
function
|
|
324
|
-
var
|
|
325
|
-
return
|
|
323
|
+
function Ue(e, t, _, n) {
|
|
324
|
+
function o() {
|
|
325
|
+
var r = Reflect.construct(HTMLElement, [], o);
|
|
326
|
+
return r._vdomComponent = e, r._root = n && n.shadow ? r.attachShadow({ mode: n.mode || "open" }) : r, r;
|
|
326
327
|
}
|
|
327
|
-
return (
|
|
328
|
-
Object.defineProperty(
|
|
329
|
-
return this._vdom.props[
|
|
330
|
-
}, set: function(
|
|
331
|
-
this._vdom ? this.attributeChangedCallback(
|
|
332
|
-
var
|
|
333
|
-
|
|
328
|
+
return (o.prototype = Object.create(HTMLElement.prototype)).constructor = o, o.prototype.connectedCallback = Be, o.prototype.attributeChangedCallback = qe, o.prototype.disconnectedCallback = ze, _ = _ || e.observedAttributes || Object.keys(e.propTypes || {}), o.observedAttributes = _, _.forEach(function(r) {
|
|
329
|
+
Object.defineProperty(o.prototype, r, { get: function() {
|
|
330
|
+
return this._vdom.props[r];
|
|
331
|
+
}, set: function(l) {
|
|
332
|
+
this._vdom ? this.attributeChangedCallback(r, null, l) : (this._props || (this._props = {}), this._props[r] = l, this.connectedCallback());
|
|
333
|
+
var u = typeof l;
|
|
334
|
+
l != null && u !== "string" && u !== "boolean" && u !== "number" || this.setAttribute(r, l);
|
|
334
335
|
} });
|
|
335
|
-
}), customElements.define(e,
|
|
336
|
+
}), customElements.define(t || e.tagName || e.displayName || e.name, o);
|
|
336
337
|
}
|
|
337
|
-
const
|
|
338
|
+
const Ve = ({ name: e = "World" }) => /* @__PURE__ */ k("p", { children: [
|
|
338
339
|
"Hello, ",
|
|
339
|
-
|
|
340
|
+
e,
|
|
340
341
|
"!"
|
|
341
342
|
] });
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
Ue(Ve, "x-greeting", ["name"], { shadow: !1 });
|
|
344
|
+
var Q, v, G, ce, X = 0, Ae = [], y = d, ae = y.__b, fe = y.__r, pe = y.diffed, de = y.__c, he = y.unmount, me = y.__;
|
|
345
|
+
function Ge(e, t) {
|
|
346
|
+
y.__h && y.__h(v, e, X || t), X = 0;
|
|
347
|
+
var _ = v.__H || (v.__H = { __: [], __h: [] });
|
|
348
|
+
return e >= _.__.length && _.__.push({}), _.__[e];
|
|
349
|
+
}
|
|
350
|
+
function A(e) {
|
|
351
|
+
return X = 1, Je(Le, e);
|
|
352
|
+
}
|
|
353
|
+
function Je(e, t, _) {
|
|
354
|
+
var n = Ge(Q++, 2);
|
|
355
|
+
if (n.t = e, !n.__c && (n.__ = [Le(void 0, t), function(u) {
|
|
356
|
+
var c = n.__N ? n.__N[0] : n.__[0], s = n.t(c, u);
|
|
357
|
+
c !== s && (n.__N = [s, n.__[1]], n.__c.setState({}));
|
|
358
|
+
}], n.__c = v, !v.__f)) {
|
|
359
|
+
var o = function(u, c, s) {
|
|
360
|
+
if (!n.__c.__H) return !0;
|
|
361
|
+
var f = n.__c.__H.__.filter(function(p) {
|
|
362
|
+
return !!p.__c;
|
|
363
|
+
});
|
|
364
|
+
if (f.every(function(p) {
|
|
365
|
+
return !p.__N;
|
|
366
|
+
})) return !r || r.call(this, u, c, s);
|
|
367
|
+
var i = n.__c.props !== u;
|
|
368
|
+
return f.forEach(function(p) {
|
|
369
|
+
if (p.__N) {
|
|
370
|
+
var a = p.__[0];
|
|
371
|
+
p.__ = p.__N, p.__N = void 0, a !== p.__[0] && (i = !0);
|
|
372
|
+
}
|
|
373
|
+
}), r && r.call(this, u, c, s) || i;
|
|
374
|
+
};
|
|
375
|
+
v.__f = !0;
|
|
376
|
+
var r = v.shouldComponentUpdate, l = v.componentWillUpdate;
|
|
377
|
+
v.componentWillUpdate = function(u, c, s) {
|
|
378
|
+
if (this.__e) {
|
|
379
|
+
var f = r;
|
|
380
|
+
r = void 0, o(u, c, s), r = f;
|
|
381
|
+
}
|
|
382
|
+
l && l.call(this, u, c, s);
|
|
383
|
+
}, v.shouldComponentUpdate = o;
|
|
384
|
+
}
|
|
385
|
+
return n.__N || n.__;
|
|
386
|
+
}
|
|
387
|
+
function Ke() {
|
|
388
|
+
for (var e; e = Ae.shift(); ) if (e.__P && e.__H) try {
|
|
389
|
+
e.__H.__h.forEach(W), e.__H.__h.forEach(Y), e.__H.__h = [];
|
|
390
|
+
} catch (t) {
|
|
391
|
+
e.__H.__h = [], y.__e(t, e.__v);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
y.__b = function(e) {
|
|
395
|
+
v = null, ae && ae(e);
|
|
396
|
+
}, y.__ = function(e, t) {
|
|
397
|
+
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), me && me(e, t);
|
|
398
|
+
}, y.__r = function(e) {
|
|
399
|
+
fe && fe(e), Q = 0;
|
|
400
|
+
var t = (v = e.__c).__H;
|
|
401
|
+
t && (G === v ? (t.__h = [], v.__h = [], t.__.forEach(function(_) {
|
|
402
|
+
_.__N && (_.__ = _.__N), _.u = _.__N = void 0;
|
|
403
|
+
})) : (t.__h.forEach(W), t.__h.forEach(Y), t.__h = [], Q = 0)), G = v;
|
|
404
|
+
}, y.diffed = function(e) {
|
|
405
|
+
pe && pe(e);
|
|
406
|
+
var t = e.__c;
|
|
407
|
+
t && t.__H && (t.__H.__h.length && (Ae.push(t) !== 1 && ce === y.requestAnimationFrame || ((ce = y.requestAnimationFrame) || Qe)(Ke)), t.__H.__.forEach(function(_) {
|
|
408
|
+
_.u && (_.__H = _.u), _.u = void 0;
|
|
409
|
+
})), G = v = null;
|
|
410
|
+
}, y.__c = function(e, t) {
|
|
411
|
+
t.some(function(_) {
|
|
412
|
+
try {
|
|
413
|
+
_.__h.forEach(W), _.__h = _.__h.filter(function(n) {
|
|
414
|
+
return !n.__ || Y(n);
|
|
415
|
+
});
|
|
416
|
+
} catch (n) {
|
|
417
|
+
t.some(function(o) {
|
|
418
|
+
o.__h && (o.__h = []);
|
|
419
|
+
}), t = [], y.__e(n, _.__v);
|
|
420
|
+
}
|
|
421
|
+
}), de && de(e, t);
|
|
422
|
+
}, y.unmount = function(e) {
|
|
423
|
+
he && he(e);
|
|
424
|
+
var t, _ = e.__c;
|
|
425
|
+
_ && _.__H && (_.__H.__.forEach(function(n) {
|
|
426
|
+
try {
|
|
427
|
+
W(n);
|
|
428
|
+
} catch (o) {
|
|
429
|
+
t = o;
|
|
430
|
+
}
|
|
431
|
+
}), _.__H = void 0, t && y.__e(t, _.__v));
|
|
432
|
+
};
|
|
433
|
+
var ve = typeof requestAnimationFrame == "function";
|
|
434
|
+
function Qe(e) {
|
|
435
|
+
var t, _ = function() {
|
|
436
|
+
clearTimeout(n), ve && cancelAnimationFrame(t), setTimeout(e);
|
|
437
|
+
}, n = setTimeout(_, 35);
|
|
438
|
+
ve && (t = requestAnimationFrame(_));
|
|
439
|
+
}
|
|
440
|
+
function W(e) {
|
|
441
|
+
var t = v, _ = e.__c;
|
|
442
|
+
typeof _ == "function" && (e.__c = void 0, _()), v = t;
|
|
443
|
+
}
|
|
444
|
+
function Y(e) {
|
|
445
|
+
var t = v;
|
|
446
|
+
e.__c = e.__(), v = t;
|
|
447
|
+
}
|
|
448
|
+
function Le(e, t) {
|
|
449
|
+
return typeof t == "function" ? t(e) : t;
|
|
450
|
+
}
|
|
451
|
+
function Xe({ onClick: e, color: t, children: _ }) {
|
|
452
|
+
return /* @__PURE__ */ k(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
style: {
|
|
456
|
+
background: t || "#1890ff",
|
|
457
|
+
color: "#fff",
|
|
458
|
+
border: "none",
|
|
459
|
+
borderRadius: 4,
|
|
460
|
+
padding: "8px 16px",
|
|
461
|
+
cursor: "pointer",
|
|
462
|
+
fontSize: 16
|
|
463
|
+
},
|
|
464
|
+
onClick: e,
|
|
465
|
+
children: _
|
|
466
|
+
}
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
function Ye({ visible: e, onClose: t, onSubmit: _, color: n }) {
|
|
470
|
+
const [o, r] = A(""), [l, u] = A(""), [c, s] = A(!1), [f, i] = A("");
|
|
471
|
+
return e ? /* @__PURE__ */ k("div", { style: {
|
|
472
|
+
position: "fixed",
|
|
473
|
+
top: 0,
|
|
474
|
+
left: 0,
|
|
475
|
+
right: 0,
|
|
476
|
+
bottom: 0,
|
|
477
|
+
background: "rgba(0,0,0,0.3)",
|
|
478
|
+
display: "flex",
|
|
479
|
+
alignItems: "center",
|
|
480
|
+
justifyContent: "center",
|
|
481
|
+
zIndex: 9999
|
|
482
|
+
}, children: /* @__PURE__ */ k(
|
|
483
|
+
"form",
|
|
484
|
+
{
|
|
485
|
+
onSubmit: async (a) => {
|
|
486
|
+
a.preventDefault(), s(!0), i("");
|
|
487
|
+
try {
|
|
488
|
+
await _({ name: o, email: l }), t();
|
|
489
|
+
} catch {
|
|
490
|
+
i("提交失败,请重试");
|
|
491
|
+
} finally {
|
|
492
|
+
s(!1);
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
style: { background: "#fff", padding: 24, borderRadius: 8, minWidth: 320 },
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ k("h2", { style: { color: n || "#1890ff" }, children: "表单" }),
|
|
498
|
+
/* @__PURE__ */ k("div", { style: { marginBottom: 12 }, children: [
|
|
499
|
+
/* @__PURE__ */ k(
|
|
500
|
+
"input",
|
|
501
|
+
{
|
|
502
|
+
type: "text",
|
|
503
|
+
placeholder: "姓名",
|
|
504
|
+
value: o,
|
|
505
|
+
onInput: (a) => r(a.target.value),
|
|
506
|
+
required: !0,
|
|
507
|
+
style: { width: "100%", padding: 8, marginBottom: 8 }
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
/* @__PURE__ */ k(
|
|
511
|
+
"input",
|
|
512
|
+
{
|
|
513
|
+
type: "email",
|
|
514
|
+
placeholder: "邮箱",
|
|
515
|
+
value: l,
|
|
516
|
+
onInput: (a) => u(a.target.value),
|
|
517
|
+
required: !0,
|
|
518
|
+
style: { width: "100%", padding: 8 }
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
] }),
|
|
522
|
+
f && /* @__PURE__ */ k("div", { style: { color: "red", marginBottom: 8 }, children: f }),
|
|
523
|
+
/* @__PURE__ */ k(
|
|
524
|
+
"button",
|
|
525
|
+
{
|
|
526
|
+
type: "submit",
|
|
527
|
+
disabled: c,
|
|
528
|
+
style: {
|
|
529
|
+
background: n || "#1890ff",
|
|
530
|
+
color: "#fff",
|
|
531
|
+
border: "none",
|
|
532
|
+
borderRadius: 4,
|
|
533
|
+
padding: "8px 16px",
|
|
534
|
+
cursor: "pointer",
|
|
535
|
+
fontSize: 16
|
|
536
|
+
},
|
|
537
|
+
children: c ? "提交中..." : "提交"
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
/* @__PURE__ */ k(
|
|
541
|
+
"button",
|
|
542
|
+
{
|
|
543
|
+
type: "button",
|
|
544
|
+
onClick: t,
|
|
545
|
+
style: { marginLeft: 12, background: "#eee", color: "#333", border: "none", borderRadius: 4, padding: "8px 16px", cursor: "pointer", fontSize: 16 },
|
|
546
|
+
children: "取消"
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
) }) : null;
|
|
552
|
+
}
|
|
553
|
+
function Ze(e) {
|
|
554
|
+
const [t, _] = A(!1), n = e.theme?.primaryColor;
|
|
555
|
+
return /* @__PURE__ */ k("div", { children: [
|
|
556
|
+
/* @__PURE__ */ k(Xe, { color: n, onClick: () => _(!0), children: "打开表单" }),
|
|
557
|
+
/* @__PURE__ */ k(
|
|
558
|
+
Ye,
|
|
559
|
+
{
|
|
560
|
+
visible: t,
|
|
561
|
+
onClose: () => _(!1),
|
|
562
|
+
onSubmit: async (r) => {
|
|
563
|
+
console.log("submit", r);
|
|
564
|
+
},
|
|
565
|
+
color: n
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
] });
|
|
569
|
+
}
|
|
570
|
+
Ue(Ze, "x-best-modal-form", ["theme"], { shadow: !1 });
|
|
571
|
+
const _t = ["x-greeting", "x-best-modal-form"];
|
|
344
572
|
export {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
573
|
+
_t as components,
|
|
574
|
+
et as npmTest,
|
|
575
|
+
tt as printCurrentTime
|
|
348
576
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
color?: string;
|
|
6
|
+
children: ComponentChildren;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ThemedButton({ onClick, color, children }: ButtonProps) {
|
|
10
|
+
return (
|
|
11
|
+
<button
|
|
12
|
+
style={{
|
|
13
|
+
background: color || '#1890ff',
|
|
14
|
+
color: '#fff',
|
|
15
|
+
border: 'none',
|
|
16
|
+
borderRadius: 4,
|
|
17
|
+
padding: '8px 16px',
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
fontSize: 16,
|
|
20
|
+
}}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</button>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useState } from 'preact/hooks';
|
|
2
|
+
|
|
3
|
+
interface ModalFormProps {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onSubmit: (form: { name: string; email: string }) => Promise<void>;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ModalForm({ visible, onClose, onSubmit, color }: ModalFormProps) {
|
|
11
|
+
const [name, setName] = useState('');
|
|
12
|
+
const [email, setEmail] = useState('');
|
|
13
|
+
const [loading, setLoading] = useState(false);
|
|
14
|
+
const [error, setError] = useState('');
|
|
15
|
+
|
|
16
|
+
if (!visible) return null;
|
|
17
|
+
|
|
18
|
+
const handleSubmit = async (e: Event) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
setLoading(true);
|
|
21
|
+
setError('');
|
|
22
|
+
try {
|
|
23
|
+
await onSubmit({ name, email });
|
|
24
|
+
onClose();
|
|
25
|
+
} catch {
|
|
26
|
+
setError('提交失败,请重试');
|
|
27
|
+
} finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div style={{
|
|
34
|
+
position: 'fixed', top: 0, left: 0, right: 0, bottom: 0,
|
|
35
|
+
background: 'rgba(0,0,0,0.3)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999
|
|
36
|
+
}}>
|
|
37
|
+
<form
|
|
38
|
+
onSubmit={handleSubmit}
|
|
39
|
+
style={{ background: '#fff', padding: 24, borderRadius: 8, minWidth: 320 }}
|
|
40
|
+
>
|
|
41
|
+
<h2 style={{ color: color || '#1890ff' }}>表单</h2>
|
|
42
|
+
<div style={{ marginBottom: 12 }}>
|
|
43
|
+
<input
|
|
44
|
+
type="text"
|
|
45
|
+
placeholder="姓名"
|
|
46
|
+
value={name}
|
|
47
|
+
onInput={e => setName((e.target as HTMLInputElement).value)}
|
|
48
|
+
required
|
|
49
|
+
style={{ width: '100%', padding: 8, marginBottom: 8 }}
|
|
50
|
+
/>
|
|
51
|
+
<input
|
|
52
|
+
type="email"
|
|
53
|
+
placeholder="邮箱"
|
|
54
|
+
value={email}
|
|
55
|
+
onInput={e => setEmail((e.target as HTMLInputElement).value)}
|
|
56
|
+
required
|
|
57
|
+
style={{ width: '100%', padding: 8 }}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
{error && <div style={{ color: 'red', marginBottom: 8 }}>{error}</div>}
|
|
61
|
+
<button
|
|
62
|
+
type="submit"
|
|
63
|
+
disabled={loading}
|
|
64
|
+
style={{
|
|
65
|
+
background: color || '#1890ff', color: '#fff', border: 'none', borderRadius: 4, padding: '8px 16px', cursor: 'pointer', fontSize: 16
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{loading ? '提交中...' : '提交'}
|
|
69
|
+
</button>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={onClose}
|
|
73
|
+
style={{ marginLeft: 12, background: '#eee', color: '#333', border: 'none', borderRadius: 4, padding: '8px 16px', cursor: 'pointer', fontSize: 16 }}
|
|
74
|
+
>
|
|
75
|
+
取消
|
|
76
|
+
</button>
|
|
77
|
+
</form>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from 'preact/hooks';
|
|
2
|
+
import { ThemedButton } from './components/Button';
|
|
3
|
+
import { ModalForm } from './components/ModalForm';
|
|
4
|
+
import register from 'preact-custom-element';
|
|
5
|
+
|
|
6
|
+
export function BestUnit(props: any) {
|
|
7
|
+
const [visible, setVisible] = useState(false);
|
|
8
|
+
const color = props.theme?.primaryColor;
|
|
9
|
+
|
|
10
|
+
const handleSubmit = async (form: { name: string; email: string }) => {
|
|
11
|
+
console.log('submit', form);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<ThemedButton color={color} onClick={() => setVisible(true)}>
|
|
17
|
+
打开表单
|
|
18
|
+
</ThemedButton>
|
|
19
|
+
<ModalForm
|
|
20
|
+
visible={visible}
|
|
21
|
+
onClose={() => setVisible(false)}
|
|
22
|
+
onSubmit={handleSubmit}
|
|
23
|
+
color={color}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
register(BestUnit, 'x-best-modal-form', ['theme'], { shadow: false });
|
|
31
|
+
|
|
32
|
+
export default BestUnit;
|
package/src/main.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { npmTest, printCurrentTime } from './index.ts'
|
|
3
3
|
import './app.tsx'
|
|
4
|
+
import './components/ModalForm'
|
|
4
5
|
|
|
5
6
|
// 可选:导出组件列表或版本信息
|
|
6
|
-
export const components = ['x-greeting'];
|
|
7
|
+
export const components = ['x-greeting', 'x-best-modal-form'];
|
|
7
8
|
export {
|
|
8
9
|
npmTest,
|
|
9
10
|
printCurrentTime,
|