@axel669/zephyr 1.0.0-beta.0 → 1.0.0-dev.0
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/compiler/build.js +13 -0
- package/compiler/parser.js +2973 -0
- package/compiler/rollup.js +28 -0
- package/compiler/transpiler.js +140 -0
- package/dist/zephyr-unstyled.js +555 -0
- package/dist/zephyr-unstyled.min.js +1 -0
- package/dist/zephyr.js +1946 -0
- package/dist/zephyr.min.js +47 -0
- package/package.json +50 -48
- package/readme.md +194 -19
- package/src/changed.svelte.js +0 -23
- package/src/component/adorn.svelte +0 -9
- package/src/component/alert.svelte +0 -32
- package/src/component/application.svelte +0 -17
- package/src/component/async-button.svelte +0 -53
- package/src/component/avatar.svelte +0 -15
- package/src/component/badge.svelte +0 -7
- package/src/component/button.svelte +0 -7
- package/src/component/chip.svelte +0 -10
- package/src/component/circle-spinner.svelte +0 -6
- package/src/component/confirm.svelte +0 -40
- package/src/component/control-label.svelte +0 -41
- package/src/component/data-table.svelte +0 -227
- package/src/component/details.svelte +0 -22
- package/src/component/dialog-element.svelte +0 -35
- package/src/component/dialog.svelte +0 -43
- package/src/component/drawer.svelte +0 -20
- package/src/component/flex.svelte +0 -7
- package/src/component/grid.svelte +0 -7
- package/src/component/hexagon-spinner.svelte +0 -6
- package/src/component/icon.svelte +0 -7
- package/src/component/link.svelte +0 -11
- package/src/component/modal.svelte +0 -32
- package/src/component/paper.svelte +0 -33
- package/src/component/popover.svelte +0 -19
- package/src/component/progress.svelte +0 -6
- package/src/component/prompt.svelte +0 -58
- package/src/component/route.svelte +0 -62
- package/src/component/routing.svelte.js +0 -63
- package/src/component/screen.svelte +0 -30
- package/src/component/select.svelte +0 -40
- package/src/component/suspend.svelte +0 -44
- package/src/component/table.svelte +0 -49
- package/src/component/tabs.svelte +0 -2
- package/src/component/text.svelte +0 -26
- package/src/component/title.svelte +0 -28
- package/src/component/titlebar.svelte +0 -23
- package/src/component/toast.svelte +0 -7
- package/src/component/toaster.svelte +0 -60
- package/src/component/toggle-label.svelte +0 -11
- package/src/component/tooltip.svelte +0 -11
- package/src/custom-macros.js +0 -11
- package/src/handler$.js +0 -20
- package/src/hash.js +0 -14
- package/src/index.js +0 -65
- package/src/internals.js +0 -12
- package/src/main.js +0 -47
- package/src/props.js +0 -24
- package/src/variant.js +0 -10
- package/src/wind.js +0 -4
- package/src/ws.js +0 -10
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
var n,l$2,u$2,i$2,r$2,o$2,e$1,f$2,c$2,a$2,s$2,h$2,p$2,v$2,y$2,d$2={},w$2=[],_$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g$2=Array.isArray;function m$2(n,l){for(var u in l)n[u]=l[u];return n}function b$1(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function k$2(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return x$2(l,e,i,r,null)}function x$2(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$2:o,__i:-1,__u:0};return null==o&&null!=l$2.vnode&&l$2.vnode(e),e}function S(n){return n.children}function C$2(n,l){this.props=n,this.context=l;}function $$1(n,l){if(null==l)return n.__?$$1(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?$$1(n):null}function I$1(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m$2({},u);o.__v=u.__v+1,l$2.vnode&&l$2.vnode(o),q$2(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$$1(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D$2(i,o,r),u.__e=u.__=null,o.__e!=t&&P$2(o);}}function P$2(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P$2(n)}function A$1(n){(!n.__d&&(n.__d=true)&&i$2.push(n)&&!H$2.__r++||r$2!=l$2.debounceRendering)&&((r$2=l$2.debounceRendering)||o$2)(H$2);}function H$2(){try{for(var n,l=1;i$2.length;)i$2.length>l&&i$2.sort(e$1),n=i$2.shift(),l=i$2.length,I$1(n);}finally{i$2.length=H$2.__r=0;}}function L(n,l,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,_,g,m=t&&t.__k||w$2,b=l.length;for(f=T$2(u,l,m,f,b),s=0;s<b;s++)null!=(p=u.__k[s])&&(h=-1!=p.__i&&m[p.__i]||d$2,p.__i=s,_=q$2(n,p,h,i,r,o,e,f,c,a),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J$2(h.ref,null,p),a.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),(g=!!(4&p.__u))||h.__k===p.__k?(f=j$2(p,f,n,g),g&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T$2(n,l,u,t,i){var r,o,e,f,c,a=u.length,s=a,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=x$2(null,o,null,null,null):g$2(o)?o=n.__k[r]=x$2(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x$2(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O$2(o,u,f,s))&&(s--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>a?h--:i<a&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(s)for(r=0;r<a;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$$1(e)),K$2(e,e));return t}function j$2(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=j$2(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=$$1(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function F$1(n,l){return l=l||[],null==n||"boolean"==typeof n||(g$2(n)?n.some(function(n){F$1(n,l);}):l.push(n)),l}function O$2(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],a=null!=c&&0==(2&c.__u);if(null===c&&null==e||a&&e==c.key&&f==c.type)return u;if(t>(a?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function z$2(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||_$1.test(l)?u:u+"px";}function N$2(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||z$2(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||z$2(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(s$2,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[a$2]=t[a$2]:(u[a$2]=h$2,n.addEventListener(l,r?v$2:p$2,r)):n.removeEventListener(l,r?v$2:p$2,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function V$2(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c$2])u[c$2]=h$2++;else if(u[c$2]<t[a$2])return;return t(l$2.event?l$2.event(u):u)}}}function q$2(n,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,d,_,k,x,M,$,I,P,A,H,T,j=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(s=l$2.__b)&&s(u);n:if("function"==typeof j){h=e.length;try{if(x=u.props,M=j.prototype&&j.prototype.render,$=(s=j.contextType)&&i[s.__c],I=s?$?$.props.value:s.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(M?u.__c=p=new j(x,I):(u.__c=p=new C$2(x,I),p.constructor=j,p.render=Q$1),$&&$.sub(p),p.state||(p.state={}),p.__n=i,v=p.__d=!0,p.__h=[],p._sb=[]),M&&null==p.__s&&(p.__s=p.state),M&&null!=j.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=m$2({},p.__s)),m$2(p.__s,j.getDerivedStateFromProps(x,p.__s))),y=p.props,d=p.state,p.__v=u,v)M&&null==j.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),M&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else {if(M&&null==j.getDerivedStateFromProps&&x!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(x,I),u.__v==t.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(x,p.__s,I)){u.__v!=t.__v&&(p.props=x,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),w$2.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&e.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(x,p.__s,I),M&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,d,_);});}if(p.context=I,p.props=x,p.__P=n,p.__e=!1,P=l$2.__r,A=0,M)p.state=p.__s,p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),w$2.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),p.state=p.__s;}while(p.__d&&++A<25);p.state=p.__s,null!=p.getChildContext&&(i=m$2(m$2({},i),p.getChildContext())),M&&!v&&null!=p.getSnapshotBeforeUpdate&&(_=p.getSnapshotBeforeUpdate(y,d)),H=null!=s&&s.type===S&&null==s.key?E$1(s.props.children):s,f=L(n,g$2(H)?H:[H],u,t,i,r,o,e,f,c,a),p.base=u.__e,u.__u&=-161,p.__h.length&&e.push(p),k&&(p.__E=p.__=null);}catch(n){if(e.length=h,u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;null!=o&&(o[o.indexOf(f)]=null),u.__e=f;}else {if(null!=o)for(T=o.length;T--;)b$1(o[T]);B$3(u);}else u.__e=t.__e,!u.__k&&t.__k&&(u.__k=t.__k),n.then||B$3(u);l$2.__e(n,u,t);}}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G$1(t.__e,u,t,i,r,o,e,c,a);return (s=l$2.diffed)&&s(u),128&u.__u?void 0:f}function B$3(n){n&&(n.__c&&(n.__c.__e=true),n.__k&&n.__k.some(B$3));}function D$2(n,u,t){for(var i=0;i<t.length;i++)J$2(t[i],t[++i],t[++i]);l$2.__c&&l$2.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$2.__e(n,u.__v);}});}function E$1(n){return "object"!=typeof n||null==n||n.__b>0?n:g$2(n)?n.map(E$1):void 0!==n.constructor?null:m$2({},n)}function G$1(u,t,i,r,o,e,f,c,a){var s,h,p,v,y,w,_,m=i.props||d$2,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(s=0;s<e.length;s++)if((y=e[s])&&"setAttribute"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[s]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$2.__m&&l$2.__m(t,e),c=false),e=null;}if(null==x)m===k||c&&u.data==k||(u.data=k);else {if(e="textarea"==x&&null!=k.defaultValue?null:e&&n.call(u.childNodes),!c&&null!=e)for(m={},s=0;s<u.attributes.length;s++)m[(y=u.attributes[s]).name]=y.value;for(s in m)y=m[s],"dangerouslySetInnerHTML"==s?p=y:"children"==s||s in k||"value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k||N$2(u,s,null,y,o);for(s in k)y=k[s],"children"==s?v=y:"dangerouslySetInnerHTML"==s?h=y:"value"==s?w=y:"checked"==s?_=y:c&&"function"!=typeof y||m[s]===y||N$2(u,s,y,m[s],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=""),L("template"==t.type?u.content:u,g$2(v)?v:[v],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&$$1(i,0),c,a),null!=e)for(s=e.length;s--;)b$1(e[s]);c&&"textarea"!=x||(s="value","progress"==x&&null==w?u.removeAttribute("value"):null!=w&&(w!==u[s]||"progress"==x&&!w||"option"==x&&w!=m[s])&&N$2(u,s,w,m[s],o),s="checked",null!=_&&_!=u[s]&&N$2(u,s,_,m[s],o));}return u}function J$2(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$2.__e(n,t);}}function K$2(n,u,t){var i,r;if(l$2.unmount&&l$2.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J$2(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$2.__e(n,u);}i.base=i.__P=i.__n=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K$2(i[r],u,t||"function"!=typeof n.type);t||b$1(n.__e),n.__c=n.__=n.__e=void 0;}function Q$1(n,l,u){return this.constructor(n,u)}function R$1(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$2.__&&l$2.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q$2(t,u=(!r&&i||t).__k=k$2(S,null,[u]),o||d$2,d$2,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D$2(e,u,f),u.props.children=null;}function W$2(l,u,t){var i,r,o,e,f=m$2({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),x$2(l.type,f,i||l.key,r||l.ref,null)}function X$1(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null;},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=true,A$1(n);});},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n);};}),n.children}return l.__c="__cC"+y$2++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=w$2.slice,l$2={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$2=0,C$2.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m$2({},this.state),"function"==typeof n&&(n=n(m$2({},u),this.props)),n&&m$2(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A$1(this));},C$2.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),A$1(this));},C$2.prototype.render=S,i$2=[],o$2="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},H$2.__r=0,f$2=Math.random().toString(8),c$2="__d"+f$2,a$2="__a"+f$2,s$2=/(PointerCapture)$|Capture$/i,h$2=0,p$2=V$2(false),v$2=V$2(true),y$2=0;
|
|
2
|
+
|
|
3
|
+
var r$1="diffed",o$1="__c",i$1="__s",a$1="__c",c$1="__k",u$1="__d",s$1="__s",l$1=/[\s\n\\/='"\0<>]/,f$1=/^(xlink|xmlns|xml)([A-Z])/,p$1=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,h$1=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,d$1=new Set(["draggable","spellcheck"]);function v$1(e){ void 0!==e.__g?e.__g|=8:e[u$1]=true;}function m$1(e){ void 0!==e.__g?e.__g&=-9:e[u$1]=false;}function y$1(e){return void 0!==e.__g?!!(8&e.__g):true===e[u$1]}var _=/["&<]/;function g$1(e){if(0===e.length||false===_.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1;}return n!==t&&(r+=e.slice(t,n)),r}var b={},x$1=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),k$1=/[A-Z]/g;function w$1(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:b[n]||(b[n]=n.replace(k$1,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||x$1.has(o)||(i="px;"),t=t+o+":"+r+i;}}return t||void 0}function C$1(){this.__d=true;}function A(e,t){return {__v:e,context:t,props:e.props,setState:C$1,forceUpdate:C$1,__d:true,__h:new Array(0)}}var D$1,P$1,$,U$1,F={},M$1=[],W$1=Array.isArray,z$1=Object.assign,H$1="",N$1="\x3c!--$s--\x3e",q$1="\x3c!--/$s--\x3e";function B$2(e){return "string"==typeof e?N$1+e+q$1:W$1(e)?(e.unshift(N$1),e.push(q$1),e):e&&"function"==typeof e.then?e.then(B$2):N$1+e+q$1}function I(a,u,s){var l=l$2[i$1];l$2[i$1]=true,D$1=l$2.__b,P$1=l$2[r$1],$=l$2.__r,U$1=l$2.unmount;var f=k$2(S,null);f[c$1]=[a];try{var p=R(a,u||F,!1,void 0,f,!1,s);return W$1(p)?p.join(H$1):p}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{l$2[o$1]&&l$2[o$1](a,M$1),l$2[i$1]=l,M$1.length=0;}}function O$1(e,t){var n,r=e.type,o=true;return e[a$1]?(o=false,(n=e[a$1]).state=n[s$1]):n=new r(e.props,t),e[a$1]=n,n.__v=e,n.props=e.props,n.context=t,v$1(n),null==n.state&&(n.state=F),null==n[s$1]&&(n[s$1]=n.state),r.getDerivedStateFromProps?n.state=z$1({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n[s$1]!==n.state?n[s$1]:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),$&&$(e),n.render(n.props,n.state,t)}function R(t,r,o,i,u,_,b){if(null==t||true===t||false===t||t===H$1)return H$1;var x=typeof t;if("object"!=x)return "function"==x?H$1:"string"==x?g$1(t):t+H$1;if(W$1(t)){var k,C=H$1;u[c$1]=t;for(var S$1=t.length,L=0;L<S$1;L++){var E=t[L];if(null!=E&&"boolean"!=typeof E){var j,T=R(E,r,o,i,u,_,b);"string"==typeof T?C+=T:(k||(k=new Array(S$1)),C&&k.push(C),C=H$1,W$1(T)?(j=k).push.apply(j,T):k.push(T));}}return k?(C&&k.push(C),k):C}if(void 0!==t.constructor)return H$1;t.__=u,D$1&&D$1(t);var Z=t.type,M=t.props;if("function"==typeof Z){var N,q,I,K=r;if(Z===S){if("tpl"in M){for(var G=H$1,Q=0;Q<M.tpl.length;Q++)if(G+=M.tpl[Q],M.exprs&&Q<M.exprs.length){var X=M.exprs[Q];if(null==X)continue;"object"!=typeof X||void 0!==X.constructor&&!W$1(X)?G+=X:G+=R(X,r,o,i,t,_,b);}return G}if("UNSTABLE_comment"in M)return "\x3c!--"+g$1(M.UNSTABLE_comment)+"--\x3e";q=M.children;}else {if(null!=(N=Z.contextType)){var Y=r[N.__c];K=Y?Y.props.value:N.__;}var ee=Z.prototype&&"function"==typeof Z.prototype.render;if(ee)q=/**#__NOINLINE__**/O$1(t,K),I=t[a$1];else {t[a$1]=I=/**#__NOINLINE__**/A(t,K);for(var te=0;y$1(I)&&te++<25;){m$1(I),$&&$(t);try{q=Z.call(I,M,K);}catch(e){throw e}}v$1(I);}if(null!=I.getChildContext&&(r=z$1({},r,I.getChildContext())),ee&&l$2.errorBoundaries&&(Z.getDerivedStateFromError||I.componentDidCatch)){q=null!=q&&q.type===S&&null==q.key&&null==q.props.tpl?q.props.children:q;try{return R(q,r,o,i,t,_,!1)}catch(e){return Z.getDerivedStateFromError&&(I[s$1]=Z.getDerivedStateFromError(e)),I.componentDidCatch&&I.componentDidCatch(e,F),y$1(I)?(q=O$1(t,r),null!=(I=t[a$1]).getChildContext&&(r=z$1({},r,I.getChildContext())),R(q=null!=q&&q.type===S&&null==q.key&&null==q.props.tpl?q.props.children:q,r,o,i,t,_,b)):H$1}finally{P$1&&P$1(t),U$1&&U$1(t);}}}q=null!=q&&q.type===S&&null==q.key&&null==q.props.tpl?q.props.children:q;try{var ne=R(q,r,o,i,t,_,b);return P$1&&P$1(t),l$2.unmount&&l$2.unmount(t),t._suspended?B$2(ne):ne}catch(n){if(b&&b.onError){var re=function e(n){return b.onError(n,t,function(t,n){try{return R(t,r,o,i,n,_,b)}catch(t){return e(t)}})}(n);if(void 0!==re)return re;var oe=l$2.__e;return oe&&oe(n,t),H$1}throw n;}}var ie,ae="<"+Z,ce=H$1;for(var ue in M){var se=M[ue];if("function"!=typeof(se=J$1(se)?se.value:se)||"class"===ue||"className"===ue){switch(ue){case "children":ie=se;continue;case "key":case "ref":case "__self":case "__source":continue;case "htmlFor":if("for"in M)continue;ue="for";break;case "className":if("class"in M)continue;ue="class";break;case "defaultChecked":ue="checked";break;case "defaultSelected":ue="selected";break;case "defaultValue":case "value":switch(ue="value",Z){case "textarea":ie=se;continue;case "select":i=se;continue;case "option":i!=se||"selected"in M||(ae+=" selected");}break;case "dangerouslySetInnerHTML":ce=se&&se.__html;continue;case "style":"object"==typeof se&&(se=w$1(se));break;case "acceptCharset":ue="accept-charset";break;case "httpEquiv":ue="http-equiv";break;default:if(l$1.test(ue))continue;f$1.test(ue)?ue=ue.replace(f$1,"$1:$2").toLowerCase():"-"!==ue[4]&&!d$1.has(ue)||null==se?o?h$1.test(ue)&&(ue="panose1"===ue?"panose-1":ue.replace(/([A-Z])/g,"-$1").toLowerCase()):p$1.test(ue)&&(ue=ue.toLowerCase()):se+=H$1;}null!=se&&false!==se&&(ae=true===se||se===H$1?ae+" "+ue:ae+" "+ue+'="'+("string"==typeof se?g$1(se):se+H$1)+'"');}}if(l$1.test(Z))throw new Error(Z+" is not a valid HTML tag name in "+ae+">");if(ce||("string"==typeof ie?ce=g$1(ie):null!=ie&&false!==ie&&true!==ie&&(ce=R(ie,r,"svg"===Z||"foreignObject"!==Z&&o,i,t,_,b))),P$1&&P$1(t),U$1&&U$1(t),!ce&&V$1.has(Z))return ae+"/>";var le="</"+Z+">",fe=ae+">";return W$1(ce)?[fe].concat(ce,[le]):"string"!=typeof ce?[fe,ce,le]:fe+ce+le}var V$1=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),K$1=I;function J$1(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}
|
|
4
|
+
|
|
5
|
+
var t,r,u,i,o=0,f=[],c=l$2,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,p=c.__;function s(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,y(D,n)}function y(n,u,i){var o=s(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return true;var u=false,i=o.__c.props!==n;if(o.__c.__H.__.some(function(n){if(n.__N){u=true;var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=true);}}),c){var f=c.call(this,n,t,r);return u?f||i:f}return !u||i};r.__f=true;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function h(n,u){var i=s(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i));}function T$1(n,r){var u=s(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function x(n){var u=r.context[n.__c],i=s(t++,9);return i.c=n,u?(null==i.__&&(i.__=true,u.sub(r)),u.props.value):n.__}function j$1(){for(var n;n=f.shift();){var t=n.__H;if(n.__P&&t)try{t.__h.some(z),t.__h.some(B$1),t.__h=[];}catch(r){t.__h=[],c.__e(r,n.__v);}}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t);},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(i.__h.length&&j$1(),t=0)),u=r;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j$1)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0);})),u=r=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.some(z),n.__h=n.__h.filter(function(n){return !n.__||B$1(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.some(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B$1(n){var t=r;n.__c=n.__(),r=t;}function C(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
|
|
6
|
+
|
|
7
|
+
function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if("__source"!==e&&!(e in t))return true;for(var r in t)if("__source"!==r&&n[r]!==t[r])return true;return false}function M(n,t){this.props=n,this.context=t;}function N(n,e){function r(n){var t=this.props.ref;return t!=n.ref&&t&&("function"==typeof t?t(null):t.current=null),e?!e(this.props,n)||t!=n.ref:E(this.props,n)}function u(e){return this.shouldComponentUpdate=r,k$2(n,e)}return u.displayName="Memo("+(n.displayName||n.name)+")",u.__f=u.prototype.isReactComponent=true,u.type=n,u}(M.prototype=new C$2).isPureReactComponent=true,M.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var T=l$2.__b;l$2.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),T&&T(n);};var O=l$2.__e;l$2.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);O(n,t,e,r);};var U=l$2.unmount;function V(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=true,n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return V(n,t,e)})),n}function W(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return W(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=true,n.__c.__P=e)),n}function P(){this.__u=0,this.o=null,this.__b=null;}function j(n){var t=n.__&&n.__.__c;return t&&t.__a&&t.__a(n)}function B(){this.i=null,this.l=null;}l$2.unmount=function(n){var t=n.__c;t&&(t.__z=true),t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),U&&U(n);},(P.prototype=new C$2).__c=function(n,t){var e=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(e);var u=j(r.__v),o=false,i=function(){o||r.__z||(o=true,e.__R=null,u?u(f):f());};e.__R=i;var l=e.__P;e.__P=null;var f=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=W(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=l,t.forceUpdate();}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i);},P.prototype.componentWillUnmount=function(){this.o=[];},P.prototype.render=function(n,e){var r=this.__v;if(!r.__m){for(var o=r;o.__;)o=o.__;o=o.__m||(o.__m=[0,0]),r.__m=[o[1]++,0];}if(this.__b){if(r.__k){var i=document.createElement("div"),l=r.__k[0].__c;r.__k[0]=V(this.__b,i,l.__O=l.__P);}this.__b=null;}var f=e.__a&&k$2(S,null,n.fallback);return f&&(f.__u&=-33),[k$2(S,null,e.__a?null:n.children),f]};var H=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2];}};(B.prototype=new C$2).__a=function(n){var t=this,e=j(t.__v),r=t.l.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),H(t,n,r)):u();};e?e(o):o();}},B.prototype.render=function(n){this.i=null,this.l=new Map;var t=F$1(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},B.prototype.componentDidUpdate=B.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){H(n,e,t);});};var q="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,G=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,J=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,K=/[A-Z0-9]/g,Q="undefined"!=typeof document,X=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};C$2.prototype.isReactComponent=true,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(C$2.prototype,t,{configurable:true,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:true,writable:true,value:n});}});});var en=l$2.event;l$2.event=function(n){return en&&(n=en(n)),n.persist=function(){},n.isPropagationStopped=function(){return this.cancelBubble},n.isDefaultPrevented=function(){return this.defaultPrevented},n.nativeEvent=n};var un={configurable:true,get:function(){return this.class}},on=l$2.vnode;l$2.vnode=function(n){"string"==typeof n.type&&function(n){var t=n.props,e=n.type,u={},o=-1==e.indexOf("-");for(var i in t){var l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||Q&&"children"===i&&"noscript"===e||"class"===i||"className"===i)){var f=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&true===l?l="":"translate"===f&&"no"===l?l=false:"o"===f[0]&&"n"===f[1]?"ondoubleclick"===f?i="ondblclick":"onchange"!==f||"input"!==e&&"textarea"!==e||X(t.type)?"onfocus"===f?i="onfocusin":"onblur"===f?i="onfocusout":J.test(i)&&(i=f):f=i="oninput":o&&G.test(i)?i=i.replace(K,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===f&&u[i=f]&&(i="oninputCapture"),u[i]=l;}}"select"==e&&(u.multiple&&Array.isArray(u.value)&&(u.value=F$1(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value);})),null!=u.defaultValue&&(u.value=F$1(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value;}))),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,"className",un)):t.className&&(u.class=u.className=t.className),n.props=u;}(n),n.$$typeof=q,on&&on(n);};var ln=l$2.__r;l$2.__r=function(n){ln&&ln(n),n.__c;};var fn=l$2.diffed;l$2.diffed=function(n){fn&&fn(n);var t=n.props,e=n.__e;null!=e&&"textarea"===n.type&&"value"in t&&t.value!==e.value&&(e.value=null==t.value?"":t.value);};
|
|
8
|
+
|
|
9
|
+
/* eslint @typescript-eslint/no-explicit-any: off */
|
|
10
|
+
// symbols
|
|
11
|
+
const GET_ORIGINAL_SYMBOL = Symbol();
|
|
12
|
+
// get object prototype
|
|
13
|
+
const getProto = Object.getPrototypeOf;
|
|
14
|
+
const objectsToTrack = new WeakMap();
|
|
15
|
+
// check if obj is a plain object or an array
|
|
16
|
+
const isObjectToTrack = (obj) => obj &&
|
|
17
|
+
(objectsToTrack.has(obj)
|
|
18
|
+
? objectsToTrack.get(obj)
|
|
19
|
+
: getProto(obj) === Object.prototype || getProto(obj) === Array.prototype);
|
|
20
|
+
/**
|
|
21
|
+
* Unwrap proxy to get the original object.
|
|
22
|
+
*
|
|
23
|
+
* Used to retrieve the original object used to create the proxy instance with `createProxy`.
|
|
24
|
+
*
|
|
25
|
+
* @param {Proxy<object>} obj - The proxy wrapper of the originial object.
|
|
26
|
+
* @returns {object | null} - Return either the unwrapped object if exists.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* import { createProxy, getUntracked } from 'proxy-compare';
|
|
30
|
+
*
|
|
31
|
+
* const original = { a: "1", c: "2", d: { e: "3" } };
|
|
32
|
+
* const affected = new WeakMap();
|
|
33
|
+
*
|
|
34
|
+
* const proxy = createProxy(original, affected);
|
|
35
|
+
* const originalFromProxy = getUntracked(proxy)
|
|
36
|
+
*
|
|
37
|
+
* Object.is(original, originalFromProxy) // true
|
|
38
|
+
* isChanged(original, originalFromProxy, affected) // false
|
|
39
|
+
*/
|
|
40
|
+
const getUntracked = (obj) => {
|
|
41
|
+
if (isObjectToTrack(obj)) {
|
|
42
|
+
return obj[GET_ORIGINAL_SYMBOL] || null;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Mark object to be tracked.
|
|
48
|
+
*
|
|
49
|
+
* This function marks an object that will be passed into `createProxy`
|
|
50
|
+
* as marked to track or not. By default only Array and Object are marked to track,
|
|
51
|
+
* so this is useful for example to mark a class instance to track or to mark a object
|
|
52
|
+
* to be untracked when creating your proxy.
|
|
53
|
+
*
|
|
54
|
+
* @param obj - Object to mark as tracked or not.
|
|
55
|
+
* @param mark - Boolean indicating whether you want to track this object or not.
|
|
56
|
+
* @returns - No return.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* import { createProxy, markToTrack, isChanged } from 'proxy-compare';
|
|
60
|
+
*
|
|
61
|
+
* const nested = { e: "3" }
|
|
62
|
+
*
|
|
63
|
+
* markToTrack(nested, false)
|
|
64
|
+
*
|
|
65
|
+
* const original = { a: "1", c: "2", d: nested };
|
|
66
|
+
* const affected = new WeakMap();
|
|
67
|
+
*
|
|
68
|
+
* const proxy = createProxy(original, affected);
|
|
69
|
+
*
|
|
70
|
+
* proxy.d.e
|
|
71
|
+
*
|
|
72
|
+
* isChanged(original, { d: { e: "3" } }, affected) // true
|
|
73
|
+
*/
|
|
74
|
+
const markToTrack = (obj, mark = true) => {
|
|
75
|
+
objectsToTrack.set(obj, mark);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const isObject = (x) => typeof x === "object" && x !== null;
|
|
79
|
+
const canProxyDefault = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer) && !(x instanceof Promise);
|
|
80
|
+
const createSnapshotDefault = (target, version) => {
|
|
81
|
+
const cache = snapCache.get(target);
|
|
82
|
+
if ((cache == null ? void 0 : cache[0]) === version) {
|
|
83
|
+
return cache[1];
|
|
84
|
+
}
|
|
85
|
+
const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
|
|
86
|
+
markToTrack(snap, true);
|
|
87
|
+
snapCache.set(target, [version, snap]);
|
|
88
|
+
Reflect.ownKeys(target).forEach((key) => {
|
|
89
|
+
if (Object.getOwnPropertyDescriptor(snap, key)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const value = Reflect.get(target, key);
|
|
93
|
+
const { enumerable } = Reflect.getOwnPropertyDescriptor(
|
|
94
|
+
target,
|
|
95
|
+
key
|
|
96
|
+
);
|
|
97
|
+
const desc = {
|
|
98
|
+
value,
|
|
99
|
+
enumerable,
|
|
100
|
+
// This is intentional to avoid copying with proxy-compare.
|
|
101
|
+
// It's still non-writable, so it avoids assigning a value.
|
|
102
|
+
configurable: true
|
|
103
|
+
};
|
|
104
|
+
if (refSet.has(value)) {
|
|
105
|
+
markToTrack(value, false);
|
|
106
|
+
} else if (proxyStateMap.has(value)) {
|
|
107
|
+
const [target2, ensureVersion] = proxyStateMap.get(
|
|
108
|
+
value
|
|
109
|
+
);
|
|
110
|
+
desc.value = createSnapshotDefault(target2, ensureVersion());
|
|
111
|
+
}
|
|
112
|
+
Object.defineProperty(snap, key, desc);
|
|
113
|
+
});
|
|
114
|
+
return snap;
|
|
115
|
+
};
|
|
116
|
+
const createHandlerDefault = (isInitializing, addPropListener, removePropListener, notifyUpdate) => ({
|
|
117
|
+
deleteProperty(target, prop) {
|
|
118
|
+
Reflect.get(target, prop);
|
|
119
|
+
removePropListener(prop);
|
|
120
|
+
const deleted = Reflect.deleteProperty(target, prop);
|
|
121
|
+
if (deleted) {
|
|
122
|
+
notifyUpdate(void 0 );
|
|
123
|
+
}
|
|
124
|
+
return deleted;
|
|
125
|
+
},
|
|
126
|
+
set(target, prop, value, receiver) {
|
|
127
|
+
const hasPrevValue = !isInitializing() && Reflect.has(target, prop);
|
|
128
|
+
const prevValue = Reflect.get(target, prop, receiver);
|
|
129
|
+
if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
removePropListener(prop);
|
|
133
|
+
if (isObject(value)) {
|
|
134
|
+
value = getUntracked(value) || value;
|
|
135
|
+
}
|
|
136
|
+
const nextValue = !proxyStateMap.has(value) && canProxy(value) ? proxy(value) : value;
|
|
137
|
+
addPropListener(prop, nextValue);
|
|
138
|
+
Reflect.set(target, prop, nextValue, receiver);
|
|
139
|
+
notifyUpdate(void 0 );
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const proxyStateMap = /* @__PURE__ */ new WeakMap();
|
|
144
|
+
const refSet = /* @__PURE__ */ new WeakSet();
|
|
145
|
+
const snapCache = /* @__PURE__ */ new WeakMap();
|
|
146
|
+
const versionHolder = [1];
|
|
147
|
+
const proxyCache = /* @__PURE__ */ new WeakMap();
|
|
148
|
+
let objectIs = Object.is;
|
|
149
|
+
let newProxy = (target, handler) => new Proxy(target, handler);
|
|
150
|
+
let canProxy = canProxyDefault;
|
|
151
|
+
let createSnapshot = createSnapshotDefault;
|
|
152
|
+
let createHandler = createHandlerDefault;
|
|
153
|
+
function proxy(baseObject = {}) {
|
|
154
|
+
if (!isObject(baseObject)) {
|
|
155
|
+
throw new Error("object required");
|
|
156
|
+
}
|
|
157
|
+
const found = proxyCache.get(baseObject);
|
|
158
|
+
if (found) {
|
|
159
|
+
return found;
|
|
160
|
+
}
|
|
161
|
+
let version = versionHolder[0];
|
|
162
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
163
|
+
const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
|
|
164
|
+
if (version !== nextVersion) {
|
|
165
|
+
checkVersion = version = nextVersion;
|
|
166
|
+
listeners.forEach((listener) => listener(op, nextVersion));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
let checkVersion = version;
|
|
170
|
+
const ensureVersion = (nextCheckVersion = versionHolder[0]) => {
|
|
171
|
+
if (checkVersion !== nextCheckVersion) {
|
|
172
|
+
checkVersion = nextCheckVersion;
|
|
173
|
+
propProxyStates.forEach(([propProxyState]) => {
|
|
174
|
+
const propVersion = propProxyState[1](nextCheckVersion);
|
|
175
|
+
if (propVersion > version) {
|
|
176
|
+
version = propVersion;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return version;
|
|
181
|
+
};
|
|
182
|
+
const createPropListener = (prop) => (op, nextVersion) => {
|
|
183
|
+
let newOp;
|
|
184
|
+
if (op) {
|
|
185
|
+
newOp = [...op];
|
|
186
|
+
newOp[1] = [prop, ...newOp[1]];
|
|
187
|
+
}
|
|
188
|
+
notifyUpdate(newOp, nextVersion);
|
|
189
|
+
};
|
|
190
|
+
const propProxyStates = /* @__PURE__ */ new Map();
|
|
191
|
+
const addPropListener = (prop, propValue) => {
|
|
192
|
+
const propProxyState = !refSet.has(propValue) && proxyStateMap.get(propValue);
|
|
193
|
+
if (propProxyState) {
|
|
194
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && propProxyStates.has(prop)) {
|
|
195
|
+
throw new Error("prop listener already exists");
|
|
196
|
+
}
|
|
197
|
+
if (listeners.size) {
|
|
198
|
+
const remove = propProxyState[2](createPropListener(prop));
|
|
199
|
+
propProxyStates.set(prop, [propProxyState, remove]);
|
|
200
|
+
} else {
|
|
201
|
+
propProxyStates.set(prop, [propProxyState]);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const removePropListener = (prop) => {
|
|
206
|
+
var _a;
|
|
207
|
+
const entry = propProxyStates.get(prop);
|
|
208
|
+
if (entry) {
|
|
209
|
+
propProxyStates.delete(prop);
|
|
210
|
+
(_a = entry[1]) == null ? void 0 : _a.call(entry);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const addListener = (listener) => {
|
|
214
|
+
listeners.add(listener);
|
|
215
|
+
if (listeners.size === 1) {
|
|
216
|
+
propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
|
|
217
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && prevRemove) {
|
|
218
|
+
throw new Error("remove already exists");
|
|
219
|
+
}
|
|
220
|
+
const remove = propProxyState[2](createPropListener(prop));
|
|
221
|
+
propProxyStates.set(prop, [propProxyState, remove]);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const removeListener = () => {
|
|
225
|
+
listeners.delete(listener);
|
|
226
|
+
if (listeners.size === 0) {
|
|
227
|
+
propProxyStates.forEach(([propProxyState, remove], prop) => {
|
|
228
|
+
if (remove) {
|
|
229
|
+
remove();
|
|
230
|
+
propProxyStates.set(prop, [propProxyState]);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return removeListener;
|
|
236
|
+
};
|
|
237
|
+
let initializing = true;
|
|
238
|
+
const handler = createHandler(
|
|
239
|
+
() => initializing,
|
|
240
|
+
addPropListener,
|
|
241
|
+
removePropListener,
|
|
242
|
+
notifyUpdate
|
|
243
|
+
);
|
|
244
|
+
const proxyObject = newProxy(baseObject, handler);
|
|
245
|
+
proxyCache.set(baseObject, proxyObject);
|
|
246
|
+
const proxyState = [baseObject, ensureVersion, addListener];
|
|
247
|
+
proxyStateMap.set(proxyObject, proxyState);
|
|
248
|
+
Reflect.ownKeys(baseObject).forEach((key) => {
|
|
249
|
+
const desc = Object.getOwnPropertyDescriptor(
|
|
250
|
+
baseObject,
|
|
251
|
+
key
|
|
252
|
+
);
|
|
253
|
+
if ("value" in desc && desc.writable) {
|
|
254
|
+
proxyObject[key] = baseObject[key];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
initializing = false;
|
|
258
|
+
return proxyObject;
|
|
259
|
+
}
|
|
260
|
+
function getVersion(proxyObject) {
|
|
261
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
262
|
+
return proxyState == null ? void 0 : proxyState[1]();
|
|
263
|
+
}
|
|
264
|
+
function subscribe(proxyObject, callback, notifyInSync) {
|
|
265
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
266
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !proxyState) {
|
|
267
|
+
console.warn("Please use proxy object");
|
|
268
|
+
}
|
|
269
|
+
let promise;
|
|
270
|
+
const ops = [];
|
|
271
|
+
const addListener = proxyState[2];
|
|
272
|
+
let isListenerActive = false;
|
|
273
|
+
const listener = (op) => {
|
|
274
|
+
if (op) {
|
|
275
|
+
ops.push(op);
|
|
276
|
+
}
|
|
277
|
+
if (notifyInSync) {
|
|
278
|
+
callback(ops.splice(0));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!promise) {
|
|
282
|
+
promise = Promise.resolve().then(() => {
|
|
283
|
+
promise = void 0;
|
|
284
|
+
if (isListenerActive) {
|
|
285
|
+
callback(ops.splice(0));
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
const removeListener = addListener(listener);
|
|
291
|
+
isListenerActive = true;
|
|
292
|
+
return () => {
|
|
293
|
+
isListenerActive = false;
|
|
294
|
+
removeListener();
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function snapshot(proxyObject) {
|
|
298
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
299
|
+
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && !proxyState) {
|
|
300
|
+
console.warn("Please use proxy object");
|
|
301
|
+
}
|
|
302
|
+
const [target, ensureVersion] = proxyState;
|
|
303
|
+
return createSnapshot(target, ensureVersion());
|
|
304
|
+
}
|
|
305
|
+
function ref$1(obj) {
|
|
306
|
+
refSet.add(obj);
|
|
307
|
+
return obj;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const eventNames = {
|
|
311
|
+
"details.open": "toggle",
|
|
312
|
+
"input.value": "input",
|
|
313
|
+
"input.checked": "input",
|
|
314
|
+
"select.value": "change",
|
|
315
|
+
"select.selectedIndex": "change",
|
|
316
|
+
};
|
|
317
|
+
const boolProps = ["checked", "sticky-header"];
|
|
318
|
+
|
|
319
|
+
const tagGetValue = {
|
|
320
|
+
details: (element) => element.open,
|
|
321
|
+
input: (element) => {
|
|
322
|
+
if (element.type === "checkbox") {
|
|
323
|
+
return element.checked
|
|
324
|
+
}
|
|
325
|
+
if (element.type === "number") {
|
|
326
|
+
if (isNaN(element.valueAsNumber) === true) {
|
|
327
|
+
return null
|
|
328
|
+
}
|
|
329
|
+
return element.valueAsNumber
|
|
330
|
+
}
|
|
331
|
+
if (element.type === "date") {
|
|
332
|
+
return element.valueAsDate
|
|
333
|
+
}
|
|
334
|
+
return element.value
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const registerInputValue = (tag, getter) => {
|
|
338
|
+
const name = tag.toLowerCase();
|
|
339
|
+
if (tagGetValue[name] !== undefined) {
|
|
340
|
+
return
|
|
341
|
+
}
|
|
342
|
+
tagGetValue[tag.toLowerCase()] = getter;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
var options = /*#__PURE__*/Object.freeze({
|
|
346
|
+
__proto__: null,
|
|
347
|
+
boolProps: boolProps,
|
|
348
|
+
eventNames: eventNames,
|
|
349
|
+
registerInputValue: registerInputValue,
|
|
350
|
+
tagGetValue: tagGetValue
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
const propMods = [
|
|
354
|
+
(comp, props) => {
|
|
355
|
+
if (typeof comp === "string") {
|
|
356
|
+
return props
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const { slot, ...rest } = props;
|
|
360
|
+
const filtered = {
|
|
361
|
+
slot: slot ?? {}
|
|
362
|
+
};
|
|
363
|
+
Object.keys(rest).forEach(
|
|
364
|
+
(key) => {
|
|
365
|
+
const value = props[key];
|
|
366
|
+
if (key.startsWith("slot:") === true) {
|
|
367
|
+
filtered.slot[key.slice(5)] = value;
|
|
368
|
+
return
|
|
369
|
+
}
|
|
370
|
+
filtered[key] = value;
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
return filtered
|
|
374
|
+
},
|
|
375
|
+
(comp, props) => {
|
|
376
|
+
if (typeof comp !== "string") {
|
|
377
|
+
return props
|
|
378
|
+
}
|
|
379
|
+
const filtered = {};
|
|
380
|
+
Object.keys(props).forEach(
|
|
381
|
+
(key) => {
|
|
382
|
+
const value = props[key];
|
|
383
|
+
if (key === "slot") {
|
|
384
|
+
return
|
|
385
|
+
}
|
|
386
|
+
if (key.startsWith("$$") === true) {
|
|
387
|
+
const prop = key.slice(2);
|
|
388
|
+
const target = `${comp.toLowerCase()}.${prop}`;
|
|
389
|
+
const evtname = eventNames[target] ?? "input";
|
|
390
|
+
filtered[prop] = value.value;
|
|
391
|
+
filtered[`on${evtname}`] = value.update;
|
|
392
|
+
return
|
|
393
|
+
}
|
|
394
|
+
if (key.startsWith("$") === true) {
|
|
395
|
+
return
|
|
396
|
+
}
|
|
397
|
+
// if prop is a boolean then pass the bool value, even if false
|
|
398
|
+
if (boolProps.includes(key) === true) {
|
|
399
|
+
filtered[key] = (value === true);
|
|
400
|
+
return
|
|
401
|
+
}
|
|
402
|
+
if (value === false || value === null) {
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
filtered[key] = (value === true) ? "" : value;
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
return filtered
|
|
409
|
+
},
|
|
410
|
+
// allow ws prop across entire codebase, convert at last minute
|
|
411
|
+
(component, props) => {
|
|
412
|
+
if (typeof component !== "string") {
|
|
413
|
+
return props
|
|
414
|
+
}
|
|
415
|
+
if (props.ws === undefined) {
|
|
416
|
+
return props
|
|
417
|
+
}
|
|
418
|
+
const { ws, ...rest } = props;
|
|
419
|
+
return { "data-ws": ws, ...rest }
|
|
420
|
+
},
|
|
421
|
+
];
|
|
422
|
+
const modProps = (comp, props) => {
|
|
423
|
+
let modifiedProps = props;
|
|
424
|
+
for (const mod of propMods) {
|
|
425
|
+
modifiedProps = mod(comp, modifiedProps);
|
|
426
|
+
}
|
|
427
|
+
return modifiedProps
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const diffChildren = (prev, next) => {
|
|
431
|
+
const nxt = next.children;
|
|
432
|
+
const prv = prev.children;
|
|
433
|
+
if (nxt.length !== prv.length) {
|
|
434
|
+
return true
|
|
435
|
+
}
|
|
436
|
+
const difIndex = nxt.findIndex(
|
|
437
|
+
(item, index) => prv[index] !== item
|
|
438
|
+
);
|
|
439
|
+
return difIndex !== -1
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const versionCache = new WeakMap();
|
|
443
|
+
const valtimemo = (prev, next) => {
|
|
444
|
+
const prevVersion = versionCache.get(prev);
|
|
445
|
+
const nextVersion = Math.max(
|
|
446
|
+
...Object.values(next).map(
|
|
447
|
+
value => getVersion(value) ?? 0
|
|
448
|
+
)
|
|
449
|
+
);
|
|
450
|
+
versionCache.set(next, nextVersion);
|
|
451
|
+
if (prevVersion !== nextVersion) {
|
|
452
|
+
return false
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const keys = [...Object.keys(prev), ...Object.keys(next)];
|
|
456
|
+
for (const key of keys) {
|
|
457
|
+
if (key === "children" && diffChildren(prev, next) === true) {
|
|
458
|
+
return false
|
|
459
|
+
}
|
|
460
|
+
if (prev[key] !== next[key]) {
|
|
461
|
+
return false
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return true
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
const cache = new WeakMap();
|
|
468
|
+
const memod = (component) => {
|
|
469
|
+
if (typeof component === "string") {
|
|
470
|
+
return component
|
|
471
|
+
}
|
|
472
|
+
if (component.noMemo === true) {
|
|
473
|
+
return component
|
|
474
|
+
}
|
|
475
|
+
if (cache.has(component) === true) {
|
|
476
|
+
return cache.get(component)
|
|
477
|
+
}
|
|
478
|
+
cache.set(
|
|
479
|
+
component,
|
|
480
|
+
N(component, valtimemo)
|
|
481
|
+
);
|
|
482
|
+
return cache.get(component)
|
|
483
|
+
};
|
|
484
|
+
const normalizeChildren = (props, children) => {
|
|
485
|
+
const source = (children.length > 0) ? children : props.children;
|
|
486
|
+
const list =
|
|
487
|
+
[source]
|
|
488
|
+
.flat(Number.POSITIVE_INFINITY)
|
|
489
|
+
.filter(
|
|
490
|
+
item => (
|
|
491
|
+
item !== null
|
|
492
|
+
&& item !== false
|
|
493
|
+
&& item !== undefined
|
|
494
|
+
)
|
|
495
|
+
);
|
|
496
|
+
return {
|
|
497
|
+
...props,
|
|
498
|
+
children: list,
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const Element = (comp, props, ...children) => {
|
|
502
|
+
if (comp === undefined || comp === null) {
|
|
503
|
+
return null
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return k$2(
|
|
507
|
+
memod(comp),
|
|
508
|
+
modProps(
|
|
509
|
+
comp,
|
|
510
|
+
normalizeChildren(props, children)
|
|
511
|
+
)
|
|
512
|
+
)
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const randName = () => {
|
|
516
|
+
const rand = Math.floor(Math.random() * 1679615).toString(36);
|
|
517
|
+
return `${Date.now().toString(36)}${rand}`
|
|
518
|
+
};
|
|
519
|
+
const randKey = () => {
|
|
520
|
+
const rand = Math.floor(Math.random() * 4294967296).toString(36);
|
|
521
|
+
return `${Date.now().toString(36)}:${rand}`
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
const ref = (obj) => {
|
|
525
|
+
if (obj === null || obj === undefined) {
|
|
526
|
+
return null
|
|
527
|
+
}
|
|
528
|
+
return ref$1(obj)
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
const getInputValue = (element) => {
|
|
532
|
+
const tag = element.tagName?.toLowerCase?.() ?? null;
|
|
533
|
+
const getValue = tagGetValue[tag];
|
|
534
|
+
return getValue?.(element) ?? element.value
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
const __eachAlt = (list, alt) =>
|
|
538
|
+
(list.length > 0) ? list : alt();
|
|
539
|
+
|
|
540
|
+
const SubSlot = (props) => props.children;
|
|
541
|
+
const Slot = (props) => {
|
|
542
|
+
const { "*render": render, ...pass } = props;
|
|
543
|
+
if (render === null || render === undefined) {
|
|
544
|
+
return null
|
|
545
|
+
}
|
|
546
|
+
if (typeof render === "string") {
|
|
547
|
+
return render
|
|
548
|
+
}
|
|
549
|
+
return Element(
|
|
550
|
+
SubSlot,
|
|
551
|
+
{ children: render(pass) }
|
|
552
|
+
)
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
export { Element, S as Fragment, Slot, __eachAlt, W$2 as cloneElement, X$1 as createContext, getInputValue, getVersion, N as memo, options, l$2 as preactOptions, proxy, randKey, randName, ref, R$1 as renderApp, K$1 as renderString, snapshot, subscribe, x as useContext, h as useEffect, T$1 as useMemo, d as useState };
|