number-flow 0.3.1 → 0.3.2

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/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare class NumberFlowLite extends ServerSafeHTMLElement {
22
22
  respectMotionPreference: boolean;
23
23
  trend: RawTrend;
24
24
  continuous: boolean;
25
- get startingPlace(): number | undefined;
25
+ get startingPlace(): number | null | undefined;
26
26
  get computedTrend(): Trend | undefined;
27
27
  set parts(parts: PartitionedParts | undefined);
28
28
  willUpdate(): void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("esm-env");function n(a,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!i:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(a):i?i.value:t.get(a)}function h(a,t,e,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!s:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(a,e):s?s.value=e:t.set(a,e),e}const w=(a,t,e)=>{const i=document.createElement(a),[s,r]=Array.isArray(t)?[void 0,t]:[t,e];return s&&Object.assign(i,s),r==null||r.forEach(l=>i.appendChild(l)),i},mt=(a,t)=>{var e;return t==="left"?a.offsetLeft:(((e=a.offsetParent instanceof HTMLElement?a.offsetParent:null)==null?void 0:e.offsetWidth)??0)-a.offsetWidth-a.offsetLeft};function gt(a,t,{reverse:e=!1}={}){const i=a.length;for(let s=e?i-1:0;e?s>=0:s<i;e?s--:s++)t(a[s],s)}function wt(a,t){const e=t.formatToParts(a),i=[],s=[],r=[],l=[],o={},p=c=>{const f=o[c]==null?o[c]=0:++o[c];return`${c}:${f}`};let u="",m=!1,N=!1;for(const c of e){u+=c.value;const f=c.type==="minusSign"||c.type==="plusSign"?"sign":c.type;f==="integer"?(m=!0,s.push(...c.value.split("").map(J=>({type:f,value:parseInt(J)})))):f==="group"?s.push({type:f,value:c.value}):f==="decimal"?(N=!0,r.push({type:f,value:c.value,key:p(f)})):f==="fraction"?r.push(...c.value.split("").map(J=>({type:f,value:parseInt(J),key:p(f),place:-1-o[f]}))):(m||N?l:i).push({type:f,value:c.value,key:p(f)})}const d=[];for(let c=s.length-1;c>=0;c--){const f=s[c];d.unshift(f.type==="integer"?{...f,key:p(f.type),place:o[f.type]}:{...f,key:p(f.type)})}return{pre:i,integer:d,fraction:r,post:l,formatted:u,value:typeof a=="string"?parseFloat(a):a}}const yt=Z.BROWSER?HTMLElement:class{},vt=String.raw,_t=Z.BROWSER&&typeof CSS<"u"&&CSS.supports("line-height","mod(1,1)"),O=Z.BROWSER?matchMedia("(prefers-reduced-motion: reduce)"):null,Y="--_number-flow-d-opacity",it="--_number-flow-d-width",q="--_number-flow-dx",st="--_number-flow-d",bt=(()=>{try{return CSS.registerProperty({name:Y,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:q,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:it,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:st,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),rt="var(--number-flow-char-height, 1em)",g="var(--number-flow-mask-height, 0.25em)",C=`calc(${g} / 2)`,Q="var(--number-flow-mask-width, 0.5em)",S=`calc(${Q} / var(--scale-x))`,T="#000 0, transparent 71%",lt="span",St=({willChange:a})=>({fontKerning:"none",display:"inline-block",lineHeight:rt,padding:`${g} 0`,willChange:a?"transform":void 0}),nt=vt`:host{display:inline-flex;align-items:baseline;direction:ltr;white-space:nowrap;position:relative;line-height:${rt} !important;isolation:isolate;}::slotted(${lt}){position:absolute;left:0;top:0;color:transparent !important;z-index:-5;}:host > .number,:host > .section{pointer-events:none;user-select:none;}.number,.number__inner{display:inline-flex;align-items:baseline;transform-origin:left top;}:host([data-will-change]) .number,:host([data-will-change]) .number__inner{will-change:transform;}.number{--scale-x:calc(1 + var(${it}) / var(--width));transform:translateX(var(${q})) scaleX(var(--scale-x));margin:0 calc(-1 * ${Q});position:relative;z-index:-1;overflow:clip;-webkit-mask-image:linear-gradient( to right,transparent 0,#000 ${S},#000 calc(100% - ${S}),transparent ),linear-gradient( to bottom,transparent 0,#000 ${g},#000 calc(100% - ${g}),transparent 100% ),radial-gradient(at bottom right,${T}),radial-gradient(at bottom left,${T}),radial-gradient(at top left,${T}),radial-gradient(at top right,${T});-webkit-mask-size:100% calc(100% - ${g} * 2),calc(100% - ${S} * 2) 100%,${S} ${g},${S} ${g},${S} ${g},${S} ${g};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat;}.number__inner{padding:0 ${Q};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${q})));}.section{display:inline-flex;align-items:baseline;padding-bottom:${C};padding-top:${C};position:relative;isolation:isolate;}.section::after{content:'\200b';display:block;padding:${C} 0;}:host([data-will-change]) .section{will-change:transform;}.section--justify-left{transform-origin:center left;}.section--justify-right{transform-origin:center right;}.section__exiting{position:absolute !important;z-index:-1;}.digit{display:block;position:relative;--c:var(--current) + var(${st});}:host([data-will-change]) .digit,:host([data-will-change]) .digit__num{will-change:transform;}.digit__num{display:block;padding:${C} 0;--offset-raw:mod(10 + var(--n) - mod(var(--c),10),10);--offset:calc(var(--offset-raw) - 10 * round(down,var(--offset-raw) / 5,1));--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y));}.digit__num:not(.is-current){position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y));}.digit:not(.is-spinning) .digit__num:not(.is-current){display:none;}.symbol{display:inline-flex;align-items:baseline;position:relative;isolation:isolate;padding:${C} 0;}:host([data-will-change]) .symbol{will-change:transform;}.symbol__value{display:block;white-space:pre;}.symbol__exiting{position:absolute;z-index:-1;}.section--justify-left .symbol__exiting{left:0;}.section--justify-right .symbol__exiting{right:0;}.animate-presence{opacity:calc(1 + var(${Y}));}`,kt=(a,t)=>{if(a!=null&&t==null)return a;if(a==null&&t!=null)return t;if(a!=null&&t!=null)return Math.max(a,t)};var F,B,k,x,E,y,P,R,W,D,$,M,H,V,X,U,z,j,L,v,I,tt,_,G,K;const ht=_t&&bt;var b;(function(a){a[a.UP=1]="UP",a[a.DOWN=-1]="DOWN",a[a.NONE=0]="NONE"})(b||(b={}));const ct={duration:450,easing:"ease-out"},ft={duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"};let A;class xt extends yt{constructor(){super(...arguments),this.transformTiming=ft,this.opacityTiming=ct,F.set(this,!0),this.manual=!1,this.respectMotionPreference=!0,B.set(this,!1),k.set(this,void 0),x.set(this,void 0),E.set(this,void 0),this.trend=!0,y.set(this,void 0),this.continuous=!1,P.set(this,void 0),R.set(this,void 0),W.set(this,void 0)}static define(){Z.BROWSER&&customElements.define("number-flow",this)}get startingPlace(){return n(this,P,"f")}get computedTrend(){return n(this,y,"f")}set parts(t){if(t==null)return;const{pre:e,integer:i,fraction:s,post:r,value:l}=t;if(n(this,B,"f")){const o=n(this,R,"f");if(h(this,R,t,"f"),this.trend===!0?h(this,y,Math.sign(l-o.value),"f"):this.trend==="increasing"?h(this,y,b.UP,"f"):this.trend==="decreasing"?h(this,y,b.DOWN,"f"):h(this,y,b.NONE,"f"),h(this,P,void 0,"f"),n(this,y,"f")!==b.NONE&&this.continuous){const p=o.integer.concat(o.fraction).filter(d=>d.type==="integer"||d.type==="fraction"),u=t.integer.concat(t.fraction).filter(d=>d.type==="integer"||d.type==="fraction"),m=p.find(d=>!u.find(c=>c.place===d.place&&c.value===d.value)),N=u.find(d=>!p.find(c=>d.place===c.place&&d.value===c.value));h(this,P,kt(m==null?void 0:m.place,N==null?void 0:N.place),"f")}this.manual||this.willUpdate(),n(this,k,"f").update(e),n(this,x,"f").update({integer:i,fraction:s}),n(this,E,"f").update(r),this.manual||this.didUpdate()}else{if(h(this,R,t,"f"),this.attachShadow({mode:"open"}),typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)A||(A=new CSSStyleSheet,A.replaceSync(nt)),this.shadowRoot.adoptedStyleSheets=[A];else{const o=document.createElement("style");o.textContent=nt,this.shadowRoot.appendChild(o)}this.shadowRoot.appendChild(w("slot")),h(this,k,new ot(this,e,{inert:!0,ariaHidden:"true",justify:"right"}),"f"),this.shadowRoot.appendChild(n(this,k,"f").el),h(this,x,new Et(this,i,s,{inert:!0,ariaHidden:"true"}),"f"),this.shadowRoot.appendChild(n(this,x,"f").el),h(this,E,new ot(this,r,{inert:!0,ariaHidden:"true",justify:"left"}),"f"),this.shadowRoot.appendChild(n(this,E,"f").el)}h(this,B,!0,"f")}willUpdate(){this.animated&&(n(this,k,"f").willUpdate(),n(this,x,"f").willUpdate(),n(this,E,"f").willUpdate())}didUpdate(){if(!this.animated)return;n(this,W,"f")?n(this,W,"f").abort():this.dispatchEvent(new Event("animationsstart")),n(this,k,"f").didUpdate(),n(this,x,"f").didUpdate(),n(this,E,"f").didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(e=>e.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),h(this,W,void 0,"f"))}),h(this,W,t,"f")}get animated(){return ht&&n(this,F,"f")&&(!this.respectMotionPreference||!(O!=null&&O.matches))}set animated(t){var e;this.animated!==t&&(h(this,F,t,"f"),(e=this.shadowRoot)==null||e.getAnimations().forEach(i=>i.finish()))}}F=new WeakMap,B=new WeakMap,k=new WeakMap,x=new WeakMap,E=new WeakMap,y=new WeakMap,P=new WeakMap,R=new WeakMap,W=new WeakMap;class Et{constructor(t,e,i,{className:s,...r}={}){this.flow=t,D.set(this,void 0),$.set(this,void 0),M.set(this,void 0),H.set(this,void 0),V.set(this,void 0),h(this,$,new at(t,e,{justify:"right"}),"f"),h(this,M,new at(t,i,{justify:"left"}),"f"),h(this,D,w("span",{className:"number__inner"},[n(this,$,"f").el,n(this,M,"f").el]),"f"),this.el=w("span",{...r,className:`number ${s??""}`},[n(this,D,"f")])}willUpdate(){h(this,H,this.el.offsetWidth,"f"),h(this,V,this.el.getBoundingClientRect().left,"f"),n(this,$,"f").willUpdate(),n(this,M,"f").willUpdate()}update({integer:t,fraction:e}){n(this,$,"f").update(t),n(this,M,"f").update(e)}didUpdate(){const t=this.el.getBoundingClientRect();n(this,$,"f").didUpdate(),n(this,M,"f").didUpdate();const e=n(this,V,"f")-t.left,i=this.el.offsetWidth,s=n(this,H,"f")-i;this.el.style.setProperty("--width",String(i)),this.el.animate({[q]:[`${e}px`,"0px"],[it]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}D=new WeakMap,$=new WeakMap,M=new WeakMap,H=new WeakMap,V=new WeakMap;class dt{constructor(t,e,{justify:i,className:s,...r},l){this.flow=t,this.children=new Map,this.onCharRemove=p=>()=>{this.children.delete(p)},X.set(this,void 0),this.justify=i;const o=e.map(p=>this.addChar(p).el);this.el=w("span",{...r,className:`section section--justify-${i} ${s??""}`},l?l(o):o)}addChar(t,{startDigitsAtZero:e=!1,...i}={}){const s=t.type==="integer"||t.type==="fraction"?new ut(this,t.type,e?0:t.value,t.place,{...i,onRemove:this.onCharRemove(t.key)}):new $t(this,t.type,t.value,{...i,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.classList.remove("section__exiting"),t.el.style[this.justify]=""}pop(t){t.forEach(e=>{e.el.style[this.justify]=`${mt(e.el,this.justify)}px`}),t.forEach(e=>{e.el.classList.add("section__exiting"),e.present=!1})}addNewAndUpdateExisting(t){const e=new Map,i=new Map,s=this.justify==="left",r=s?"prepend":"append";if(gt(t,l=>{let o;this.children.has(l.key)?(o=this.children.get(l.key),i.set(l,o),this.unpop(o),o.present=!0):(o=this.addChar(l,{startDigitsAtZero:!0,animateIn:!0}),e.set(l,o)),this.el[r](o.el)},{reverse:s}),this.flow.animated){const l=this.el.getBoundingClientRect();e.forEach(o=>{o.willUpdate(l)})}e.forEach((l,o)=>{l.update(o.value)}),i.forEach((l,o)=>{l.update(o.value)})}willUpdate(){const t=this.el.getBoundingClientRect();h(this,X,t[this.justify],"f"),this.children.forEach(e=>e.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const e=t[this.justify],i=n(this,X,"f")-e;this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}X=new WeakMap;class at extends dt{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i),this.unpop(i)}),this.addNewAndUpdateExisting(t),e.forEach(i=>{i instanceof ut&&i.update(0)}),this.pop(e)}}class ot extends dt{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i)}),this.pop(e),this.addNewAndUpdateExisting(t)}}class et{constructor(t,e,{onRemove:i,animateIn:s=!1}={}){this.flow=t,this.el=e,U.set(this,!0),z.set(this,void 0),j.set(this,()=>{var r;this.el.remove(),(r=n(this,z,"f"))==null||r.call(this)}),this.el.classList.add("animate-presence"),this.flow.animated&&s&&this.el.animate({[Y]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),h(this,z,i,"f")}get present(){return n(this,U,"f")}set present(t){if(n(this,U,"f")!==t){if(h(this,U,t,"f"),!this.flow.animated){t||n(this,j,"f").call(this);return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[Y]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",n(this,j,"f")):this.flow.addEventListener("animationsfinish",n(this,j,"f"),{once:!0})}}}U=new WeakMap,z=new WeakMap,j=new WeakMap;class pt extends et{constructor(t,e,i,s){super(t.flow,i,s),this.section=t,this.value=e,this.el=i}}class ut extends pt{constructor(t,e,i,s,r){const l=Array.from({length:10}).map((p,u)=>{const m=w("span",{className:`digit__num${u===i?" is-current":""}`},[document.createTextNode(String(u))]);return m.style.setProperty("--n",String(u)),m}),o=w("span",{className:"digit"},l);o.style.setProperty("--current",String(i)),super(t,i,o,r),this.place=s,L.set(this,void 0),v.set(this,void 0),I.set(this,void 0),tt.set(this,()=>{this.el.classList.remove("is-spinning")}),h(this,L,l,"f")}willUpdate(t){const e=this.el.getBoundingClientRect();h(this,v,this.value,"f");const i=e[this.section.justify]-t[this.section.justify],s=e.width/2;h(this,I,this.section.justify==="left"?i+s:i-s,"f")}update(t){var e,i;(e=n(this,L,"f")[this.value])==null||e.classList.remove("is-current"),this.el.style.setProperty("--current",String(t)),(i=n(this,L,"f")[t])==null||i.classList.add("is-current"),this.value=t}didUpdate(t){const e=this.el.getBoundingClientRect(),i=e[this.section.justify]-t[this.section.justify],s=e.width/2,r=this.section.justify==="left"?i+s:i-s;this.el.animate({transform:[`translateX(${n(this,I,"f")-r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const l=this.diff;l&&(this.el.classList.add("is-spinning"),this.el.animate({[st]:[-l,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",n(this,tt,"f"),{once:!0}))}get diff(){let t=this.flow.computedTrend;const e=this.value-n(this,v,"f");return!e&&this.flow.startingPlace!=null&&this.flow.startingPlace>=this.place?10*t:(t||(t=Math.sign(e)),t===b.DOWN&&this.value>n(this,v,"f")?this.value-10-n(this,v,"f"):t===b.UP&&this.value<n(this,v,"f")?10-n(this,v,"f")+this.value:e)}}L=new WeakMap,v=new WeakMap,I=new WeakMap,tt=new WeakMap;class $t extends pt{constructor(t,e,i,s){const r=w("span",{className:"symbol__value",textContent:i});super(t,i,w("span",{className:"symbol"},[r]),s),this.type=e,_.set(this,new Map),G.set(this,void 0),K.set(this,l=>()=>{n(this,_,"f").delete(l)}),n(this,_,"f").set(i,new et(this.flow,r,{onRemove:n(this,K,"f").call(this,i)}))}willUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect();h(this,G,e[this.section.justify]-t[this.section.justify],"f")}update(t){if(this.value!==t){const e=n(this,_,"f").get(this.value);if(e.present=!1,e.el.classList.add("symbol__exiting"),n(this,_,"f").has(t)){const i=n(this,_,"f").get(t);i.present=!0,i.el.classList.remove("symbol__exiting")}else{const i=w("span",{className:"symbol__value",textContent:t});this.el.appendChild(i),n(this,_,"f").set(t,new et(this.flow,i,{animateIn:!0,onRemove:n(this,K,"f").call(this,t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const i=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify];this.el.animate({transform:[`translateX(${n(this,G,"f")-i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}_=new WeakMap,G=new WeakMap,K=new WeakMap;exports.NumberFlowLite=xt;exports.SlottedTag=lt;exports.canAnimate=ht;exports.defaultOpacityTiming=ct;exports.defaultTransformTiming=ft;exports.partitionParts=wt;exports.prefersReducedMotion=O;exports.slottedStyles=St;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("esm-env");function n(a,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!i:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(a):i?i.value:t.get(a)}function h(a,t,e,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!s:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(a,e):s?s.value=e:t.set(a,e),e}const w=(a,t,e)=>{const i=document.createElement(a),[s,r]=Array.isArray(t)?[void 0,t]:[t,e];return s&&Object.assign(i,s),r==null||r.forEach(l=>i.appendChild(l)),i},mt=(a,t)=>{var e;return t==="left"?a.offsetLeft:(((e=a.offsetParent instanceof HTMLElement?a.offsetParent:null)==null?void 0:e.offsetWidth)??0)-a.offsetWidth-a.offsetLeft};function gt(a,t,{reverse:e=!1}={}){const i=a.length;for(let s=e?i-1:0;e?s>=0:s<i;e?s--:s++)t(a[s],s)}function wt(a,t){const e=t.formatToParts(a),i=[],s=[],r=[],l=[],o={},p=c=>{const f=o[c]==null?o[c]=0:++o[c];return`${c}:${f}`};let u="",m=!1,W=!1;for(const c of e){u+=c.value;const f=c.type==="minusSign"||c.type==="plusSign"?"sign":c.type;f==="integer"?(m=!0,s.push(...c.value.split("").map(J=>({type:f,value:parseInt(J)})))):f==="group"?s.push({type:f,value:c.value}):f==="decimal"?(W=!0,r.push({type:f,value:c.value,key:p(f)})):f==="fraction"?r.push(...c.value.split("").map(J=>({type:f,value:parseInt(J),key:p(f),place:-1-o[f]}))):(m||W?l:i).push({type:f,value:c.value,key:p(f)})}const d=[];for(let c=s.length-1;c>=0;c--){const f=s[c];d.unshift(f.type==="integer"?{...f,key:p(f.type),place:o[f.type]}:{...f,key:p(f.type)})}return{pre:i,integer:d,fraction:r,post:l,formatted:u,value:typeof a=="string"?parseFloat(a):a}}const yt=T.BROWSER?HTMLElement:class{},vt=String.raw,_t=T.BROWSER&&typeof CSS<"u"&&CSS.supports("animation-timing-function","linear(1,2)"),bt=T.BROWSER&&typeof CSS<"u"&&CSS.supports("line-height","mod(1,1)"),F=T.BROWSER?matchMedia("(prefers-reduced-motion: reduce)"):null,q="--_number-flow-d-opacity",it="--_number-flow-d-width",Z="--_number-flow-dx",st="--_number-flow-d",St=(()=>{try{return CSS.registerProperty({name:q,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:Z,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:it,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:st,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),rt="var(--number-flow-char-height, 1em)",g="var(--number-flow-mask-height, 0.25em)",C=`calc(${g} / 2)`,Q="var(--number-flow-mask-width, 0.5em)",S=`calc(${Q} / var(--scale-x))`,A="#000 0, transparent 71%",lt="span",kt=({willChange:a})=>({fontKerning:"none",display:"inline-block",lineHeight:rt,padding:`${g} 0`,willChange:a?"transform":void 0}),nt=vt`:host{display:inline-flex;align-items:baseline;direction:ltr;white-space:nowrap;position:relative;line-height:${rt} !important;isolation:isolate;}::slotted(${lt}){position:absolute;left:0;top:0;color:transparent !important;z-index:-5;}:host > .number,:host > .section{pointer-events:none;user-select:none;}.number,.number__inner{display:inline-flex;align-items:baseline;transform-origin:left top;}:host([data-will-change]) .number,:host([data-will-change]) .number__inner{will-change:transform;}.number{--scale-x:calc(1 + var(${it}) / var(--width));transform:translateX(var(${Z})) scaleX(var(--scale-x));margin:0 calc(-1 * ${Q});position:relative;z-index:-1;overflow:clip;-webkit-mask-image:linear-gradient( to right,transparent 0,#000 ${S},#000 calc(100% - ${S}),transparent ),linear-gradient( to bottom,transparent 0,#000 ${g},#000 calc(100% - ${g}),transparent 100% ),radial-gradient(at bottom right,${A}),radial-gradient(at bottom left,${A}),radial-gradient(at top left,${A}),radial-gradient(at top right,${A});-webkit-mask-size:100% calc(100% - ${g} * 2),calc(100% - ${S} * 2) 100%,${S} ${g},${S} ${g},${S} ${g},${S} ${g};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat;}.number__inner{padding:0 ${Q};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${Z})));}.section{display:inline-flex;align-items:baseline;padding-bottom:${C};padding-top:${C};position:relative;isolation:isolate;}.section::after{content:'\200b';display:block;padding:${C} 0;}:host([data-will-change]) .section{will-change:transform;}.section--justify-left{transform-origin:center left;}.section--justify-right{transform-origin:center right;}.section__exiting{position:absolute !important;z-index:-1;}.digit{display:block;position:relative;--c:var(--current) + var(${st});}:host([data-will-change]) .digit,:host([data-will-change]) .digit__num{will-change:transform;}.digit__num{display:block;padding:${C} 0;--offset-raw:mod(10 + var(--n) - mod(var(--c),10),10);--offset:calc(var(--offset-raw) - 10 * round(down,var(--offset-raw) / 5,1));--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y));}.digit__num:not(.is-current){position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y));}.digit:not(.is-spinning) .digit__num:not(.is-current){display:none;}.symbol{display:inline-flex;align-items:baseline;position:relative;isolation:isolate;padding:${C} 0;}:host([data-will-change]) .symbol{will-change:transform;}.symbol__value{display:block;white-space:pre;}.symbol__exiting{position:absolute;z-index:-1;}.section--justify-left .symbol__exiting{left:0;}.section--justify-right .symbol__exiting{right:0;}.animate-presence{opacity:calc(1 + var(${q}));}`,xt=(a,t)=>a!=null&&t==null?a:a==null&&t!=null?t:a!=null&&t!=null?Math.max(a,t):null;var B,D,k,x,E,y,R,P,N,H,$,M,V,X,z,U,I,L,j,v,G,tt,_,K,Y;const ht=bt&&_t&&St;var b;(function(a){a[a.UP=1]="UP",a[a.DOWN=-1]="DOWN",a[a.NONE=0]="NONE"})(b||(b={}));const ct={duration:450,easing:"ease-out"},ft={duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"};let O;class Et extends yt{constructor(){super(...arguments),this.transformTiming=ft,this.opacityTiming=ct,B.set(this,!0),this.manual=!1,this.respectMotionPreference=!0,D.set(this,!1),k.set(this,void 0),x.set(this,void 0),E.set(this,void 0),this.trend=!0,y.set(this,void 0),this.continuous=!1,R.set(this,void 0),P.set(this,void 0),N.set(this,void 0)}static define(){T.BROWSER&&customElements.define("number-flow",this)}get startingPlace(){return n(this,R,"f")}get computedTrend(){return n(this,y,"f")}set parts(t){if(t==null)return;const{pre:e,integer:i,fraction:s,post:r,value:l}=t;if(n(this,D,"f")){const o=n(this,P,"f");if(h(this,P,t,"f"),this.trend===!0?h(this,y,Math.sign(l-o.value),"f"):this.trend==="increasing"?h(this,y,b.UP,"f"):this.trend==="decreasing"?h(this,y,b.DOWN,"f"):h(this,y,b.NONE,"f"),h(this,R,void 0,"f"),n(this,y,"f")!==b.NONE&&this.continuous){const p=o.integer.concat(o.fraction).filter(d=>d.type==="integer"||d.type==="fraction"),u=t.integer.concat(t.fraction).filter(d=>d.type==="integer"||d.type==="fraction"),m=p.find(d=>!u.find(c=>c.place===d.place&&c.value===d.value)),W=u.find(d=>!p.find(c=>d.place===c.place&&d.value===c.value));h(this,R,xt(m==null?void 0:m.place,W==null?void 0:W.place),"f")}this.manual||this.willUpdate(),n(this,k,"f").update(e),n(this,x,"f").update({integer:i,fraction:s}),n(this,E,"f").update(r),this.manual||this.didUpdate()}else{if(h(this,P,t,"f"),this.attachShadow({mode:"open"}),typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)O||(O=new CSSStyleSheet,O.replaceSync(nt)),this.shadowRoot.adoptedStyleSheets=[O];else{const o=document.createElement("style");o.textContent=nt,this.shadowRoot.appendChild(o)}this.shadowRoot.appendChild(w("slot")),h(this,k,new ot(this,e,{inert:!0,ariaHidden:"true",justify:"right"}),"f"),this.shadowRoot.appendChild(n(this,k,"f").el),h(this,x,new $t(this,i,s,{inert:!0,ariaHidden:"true"}),"f"),this.shadowRoot.appendChild(n(this,x,"f").el),h(this,E,new ot(this,r,{inert:!0,ariaHidden:"true",justify:"left"}),"f"),this.shadowRoot.appendChild(n(this,E,"f").el)}h(this,D,!0,"f")}willUpdate(){this.animated&&(n(this,k,"f").willUpdate(),n(this,x,"f").willUpdate(),n(this,E,"f").willUpdate())}didUpdate(){if(!this.animated)return;n(this,N,"f")?n(this,N,"f").abort():this.dispatchEvent(new Event("animationsstart")),n(this,k,"f").didUpdate(),n(this,x,"f").didUpdate(),n(this,E,"f").didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(e=>e.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),h(this,N,void 0,"f"))}),h(this,N,t,"f")}get animated(){return ht&&n(this,B,"f")&&(!this.respectMotionPreference||!(F!=null&&F.matches))}set animated(t){var e;this.animated!==t&&(h(this,B,t,"f"),(e=this.shadowRoot)==null||e.getAnimations().forEach(i=>i.finish()))}}B=new WeakMap,D=new WeakMap,k=new WeakMap,x=new WeakMap,E=new WeakMap,y=new WeakMap,R=new WeakMap,P=new WeakMap,N=new WeakMap;class $t{constructor(t,e,i,{className:s,...r}={}){this.flow=t,H.set(this,void 0),$.set(this,void 0),M.set(this,void 0),V.set(this,void 0),X.set(this,void 0),h(this,$,new at(t,e,{justify:"right"}),"f"),h(this,M,new at(t,i,{justify:"left"}),"f"),h(this,H,w("span",{className:"number__inner"},[n(this,$,"f").el,n(this,M,"f").el]),"f"),this.el=w("span",{...r,className:`number ${s??""}`},[n(this,H,"f")])}willUpdate(){h(this,V,this.el.offsetWidth,"f"),h(this,X,this.el.getBoundingClientRect().left,"f"),n(this,$,"f").willUpdate(),n(this,M,"f").willUpdate()}update({integer:t,fraction:e}){n(this,$,"f").update(t),n(this,M,"f").update(e)}didUpdate(){const t=this.el.getBoundingClientRect();n(this,$,"f").didUpdate(),n(this,M,"f").didUpdate();const e=n(this,X,"f")-t.left,i=this.el.offsetWidth,s=n(this,V,"f")-i;this.el.style.setProperty("--width",String(i)),this.el.animate({[Z]:[`${e}px`,"0px"],[it]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}H=new WeakMap,$=new WeakMap,M=new WeakMap,V=new WeakMap,X=new WeakMap;class dt{constructor(t,e,{justify:i,className:s,...r},l){this.flow=t,this.children=new Map,this.onCharRemove=p=>()=>{this.children.delete(p)},z.set(this,void 0),this.justify=i;const o=e.map(p=>this.addChar(p).el);this.el=w("span",{...r,className:`section section--justify-${i} ${s??""}`},l?l(o):o)}addChar(t,{startDigitsAtZero:e=!1,...i}={}){const s=t.type==="integer"||t.type==="fraction"?new ut(this,t.type,e?0:t.value,t.place,{...i,onRemove:this.onCharRemove(t.key)}):new Mt(this,t.type,t.value,{...i,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.classList.remove("section__exiting"),t.el.style[this.justify]=""}pop(t){t.forEach(e=>{e.el.style[this.justify]=`${mt(e.el,this.justify)}px`}),t.forEach(e=>{e.el.classList.add("section__exiting"),e.present=!1})}addNewAndUpdateExisting(t){const e=new Map,i=new Map,s=this.justify==="left",r=s?"prepend":"append";if(gt(t,l=>{let o;this.children.has(l.key)?(o=this.children.get(l.key),i.set(l,o),this.unpop(o),o.present=!0):(o=this.addChar(l,{startDigitsAtZero:!0,animateIn:!0}),e.set(l,o)),this.el[r](o.el)},{reverse:s}),this.flow.animated){const l=this.el.getBoundingClientRect();e.forEach(o=>{o.willUpdate(l)})}e.forEach((l,o)=>{l.update(o.value)}),i.forEach((l,o)=>{l.update(o.value)})}willUpdate(){const t=this.el.getBoundingClientRect();h(this,z,t[this.justify],"f"),this.children.forEach(e=>e.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const e=t[this.justify],i=n(this,z,"f")-e;this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}z=new WeakMap;class at extends dt{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i),this.unpop(i)}),this.addNewAndUpdateExisting(t),e.forEach(i=>{i instanceof ut&&i.update(0)}),this.pop(e)}}class ot extends dt{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i)}),this.pop(e),this.addNewAndUpdateExisting(t)}}class et{constructor(t,e,{onRemove:i,animateIn:s=!1}={}){this.flow=t,this.el=e,U.set(this,!0),I.set(this,void 0),L.set(this,()=>{var r;this.el.remove(),(r=n(this,I,"f"))==null||r.call(this)}),this.el.classList.add("animate-presence"),this.flow.animated&&s&&this.el.animate({[q]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),h(this,I,i,"f")}get present(){return n(this,U,"f")}set present(t){if(n(this,U,"f")!==t){if(h(this,U,t,"f"),!this.flow.animated){t||n(this,L,"f").call(this);return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[q]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",n(this,L,"f")):this.flow.addEventListener("animationsfinish",n(this,L,"f"),{once:!0})}}}U=new WeakMap,I=new WeakMap,L=new WeakMap;class pt extends et{constructor(t,e,i,s){super(t.flow,i,s),this.section=t,this.value=e,this.el=i}}class ut extends pt{constructor(t,e,i,s,r){const l=Array.from({length:10}).map((p,u)=>{const m=w("span",{className:`digit__num${u===i?" is-current":""}`},[document.createTextNode(String(u))]);return m.style.setProperty("--n",String(u)),m}),o=w("span",{className:"digit"},l);o.style.setProperty("--current",String(i)),super(t,i,o,r),this.place=s,j.set(this,void 0),v.set(this,void 0),G.set(this,void 0),tt.set(this,()=>{this.el.classList.remove("is-spinning")}),h(this,j,l,"f")}willUpdate(t){const e=this.el.getBoundingClientRect();h(this,v,this.value,"f");const i=e[this.section.justify]-t[this.section.justify],s=e.width/2;h(this,G,this.section.justify==="left"?i+s:i-s,"f")}update(t){var e,i;(e=n(this,j,"f")[this.value])==null||e.classList.remove("is-current"),this.el.style.setProperty("--current",String(t)),(i=n(this,j,"f")[t])==null||i.classList.add("is-current"),this.value=t}didUpdate(t){const e=this.el.getBoundingClientRect(),i=e[this.section.justify]-t[this.section.justify],s=e.width/2,r=this.section.justify==="left"?i+s:i-s;this.el.animate({transform:[`translateX(${n(this,G,"f")-r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const l=this.diff;l&&(this.el.classList.add("is-spinning"),this.el.animate({[st]:[-l,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",n(this,tt,"f"),{once:!0}))}get diff(){let t=this.flow.computedTrend;const e=this.value-n(this,v,"f");return!e&&this.flow.startingPlace!=null&&this.flow.startingPlace>=this.place?10*t:(t||(t=Math.sign(e)),t===b.DOWN&&this.value>n(this,v,"f")?this.value-10-n(this,v,"f"):t===b.UP&&this.value<n(this,v,"f")?10-n(this,v,"f")+this.value:e)}}j=new WeakMap,v=new WeakMap,G=new WeakMap,tt=new WeakMap;class Mt extends pt{constructor(t,e,i,s){const r=w("span",{className:"symbol__value",textContent:i});super(t,i,w("span",{className:"symbol"},[r]),s),this.type=e,_.set(this,new Map),K.set(this,void 0),Y.set(this,l=>()=>{n(this,_,"f").delete(l)}),n(this,_,"f").set(i,new et(this.flow,r,{onRemove:n(this,Y,"f").call(this,i)}))}willUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect();h(this,K,e[this.section.justify]-t[this.section.justify],"f")}update(t){if(this.value!==t){const e=n(this,_,"f").get(this.value);if(e.present=!1,e.el.classList.add("symbol__exiting"),n(this,_,"f").has(t)){const i=n(this,_,"f").get(t);i.present=!0,i.el.classList.remove("symbol__exiting")}else{const i=w("span",{className:"symbol__value",textContent:t});this.el.appendChild(i),n(this,_,"f").set(t,new et(this.flow,i,{animateIn:!0,onRemove:n(this,Y,"f").call(this,t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const i=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify];this.el.animate({transform:[`translateX(${n(this,K,"f")-i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}_=new WeakMap,K=new WeakMap,Y=new WeakMap;exports.NumberFlowLite=Et;exports.SlottedTag=lt;exports.canAnimate=ht;exports.defaultOpacityTiming=ct;exports.defaultTransformTiming=ft;exports.partitionParts=wt;exports.prefersReducedMotion=F;exports.slottedStyles=kt;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BROWSER as Z } from "esm-env";
1
+ import { BROWSER as T } from "esm-env";
2
2
  function n(a, t, e, i) {
3
3
  if (e === "a" && !i) throw new TypeError("Private accessor was defined without a getter");
4
4
  if (typeof t == "function" ? a !== t || !i : !t.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -22,7 +22,7 @@ function dt(a, t, { reverse: e = !1 } = {}) {
22
22
  for (let s = e ? i - 1 : 0; e ? s >= 0 : s < i; e ? s-- : s++)
23
23
  t(a[s], s);
24
24
  }
25
- function $t(a, t) {
25
+ function Et(a, t) {
26
26
  const e = t.formatToParts(a), i = [], s = [], r = [], l = [], o = {}, p = (c) => {
27
27
  const f = o[c] == null ? o[c] = 0 : ++o[c];
28
28
  return `${c}:${f}`;
@@ -63,16 +63,16 @@ function $t(a, t) {
63
63
  value: typeof a == "string" ? parseFloat(a) : a
64
64
  };
65
65
  }
66
- const pt = Z ? HTMLElement : class {
67
- }, ut = String.raw, mt = Z && typeof CSS < "u" && CSS.supports("line-height", "mod(1,1)"), J = Z ? matchMedia("(prefers-reduced-motion: reduce)") : null, K = "--_number-flow-d-opacity", it = "--_number-flow-d-width", Y = "--_number-flow-dx", st = "--_number-flow-d", gt = (() => {
66
+ const pt = T ? HTMLElement : class {
67
+ }, ut = String.raw, mt = T && typeof CSS < "u" && CSS.supports("animation-timing-function", "linear(1,2)"), gt = T && typeof CSS < "u" && CSS.supports("line-height", "mod(1,1)"), J = T ? matchMedia("(prefers-reduced-motion: reduce)") : null, Y = "--_number-flow-d-opacity", it = "--_number-flow-d-width", Z = "--_number-flow-dx", st = "--_number-flow-d", wt = (() => {
68
68
  try {
69
69
  return CSS.registerProperty({
70
- name: K,
70
+ name: Y,
71
71
  syntax: "<number>",
72
72
  inherits: !1,
73
73
  initialValue: "0"
74
74
  }), CSS.registerProperty({
75
- name: Y,
75
+ name: Z,
76
76
  syntax: "<length>",
77
77
  inherits: !0,
78
78
  initialValue: "0px"
@@ -90,38 +90,31 @@ const pt = Z ? HTMLElement : class {
90
90
  } catch {
91
91
  return !1;
92
92
  }
93
- })(), rt = "var(--number-flow-char-height, 1em)", g = "var(--number-flow-mask-height, 0.25em)", C = `calc(${g} / 2)`, Q = "var(--number-flow-mask-width, 0.5em)", S = `calc(${Q} / var(--scale-x))`, T = "#000 0, transparent 71%", wt = "span", Et = ({ willChange: a }) => ({
93
+ })(), rt = "var(--number-flow-char-height, 1em)", g = "var(--number-flow-mask-height, 0.25em)", C = `calc(${g} / 2)`, Q = "var(--number-flow-mask-width, 0.5em)", S = `calc(${Q} / var(--scale-x))`, A = "#000 0, transparent 71%", yt = "span", Mt = ({ willChange: a }) => ({
94
94
  fontKerning: "none",
95
95
  display: "inline-block",
96
96
  lineHeight: rt,
97
97
  padding: `${g} 0`,
98
98
  willChange: a ? "transform" : void 0
99
- }), nt = ut`:host{display:inline-flex;align-items:baseline;direction:ltr;white-space:nowrap;position:relative;line-height:${rt} !important;isolation:isolate;}::slotted(${wt}){position:absolute;left:0;top:0;color:transparent !important;z-index:-5;}:host > .number,:host > .section{pointer-events:none;user-select:none;}.number,.number__inner{display:inline-flex;align-items:baseline;transform-origin:left top;}:host([data-will-change]) .number,:host([data-will-change]) .number__inner{will-change:transform;}.number{--scale-x:calc(1 + var(${it}) / var(--width));transform:translateX(var(${Y})) scaleX(var(--scale-x));margin:0 calc(-1 * ${Q});position:relative;z-index:-1;overflow:clip;-webkit-mask-image:linear-gradient( to right,transparent 0,#000 ${S},#000 calc(100% - ${S}),transparent ),linear-gradient( to bottom,transparent 0,#000 ${g},#000 calc(100% - ${g}),transparent 100% ),radial-gradient(at bottom right,${T}),radial-gradient(at bottom left,${T}),radial-gradient(at top left,${T}),radial-gradient(at top right,${T});-webkit-mask-size:100% calc(100% - ${g} * 2),calc(100% - ${S} * 2) 100%,${S} ${g},${S} ${g},${S} ${g},${S} ${g};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat;}.number__inner{padding:0 ${Q};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${Y})));}.section{display:inline-flex;align-items:baseline;padding-bottom:${C};padding-top:${C};position:relative;isolation:isolate;}.section::after{content:'\200b';display:block;padding:${C} 0;}:host([data-will-change]) .section{will-change:transform;}.section--justify-left{transform-origin:center left;}.section--justify-right{transform-origin:center right;}.section__exiting{position:absolute !important;z-index:-1;}.digit{display:block;position:relative;--c:var(--current) + var(${st});}:host([data-will-change]) .digit,:host([data-will-change]) .digit__num{will-change:transform;}.digit__num{display:block;padding:${C} 0;--offset-raw:mod(10 + var(--n) - mod(var(--c),10),10);--offset:calc(var(--offset-raw) - 10 * round(down,var(--offset-raw) / 5,1));--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y));}.digit__num:not(.is-current){position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y));}.digit:not(.is-spinning) .digit__num:not(.is-current){display:none;}.symbol{display:inline-flex;align-items:baseline;position:relative;isolation:isolate;padding:${C} 0;}:host([data-will-change]) .symbol{will-change:transform;}.symbol__value{display:block;white-space:pre;}.symbol__exiting{position:absolute;z-index:-1;}.section--justify-left .symbol__exiting{left:0;}.section--justify-right .symbol__exiting{right:0;}.animate-presence{opacity:calc(1 + var(${K}));}`, yt = (a, t) => {
100
- if (a != null && t == null)
101
- return a;
102
- if (a == null && t != null)
103
- return t;
104
- if (a != null && t != null)
105
- return Math.max(a, t);
106
- };
107
- var F, D, x, k, $, y, P, U, W, O, E, M, B, H, V, j, X, L, R, v, z, tt, _, I, G;
108
- const vt = mt && gt;
99
+ }), nt = ut`:host{display:inline-flex;align-items:baseline;direction:ltr;white-space:nowrap;position:relative;line-height:${rt} !important;isolation:isolate;}::slotted(${yt}){position:absolute;left:0;top:0;color:transparent !important;z-index:-5;}:host > .number,:host > .section{pointer-events:none;user-select:none;}.number,.number__inner{display:inline-flex;align-items:baseline;transform-origin:left top;}:host([data-will-change]) .number,:host([data-will-change]) .number__inner{will-change:transform;}.number{--scale-x:calc(1 + var(${it}) / var(--width));transform:translateX(var(${Z})) scaleX(var(--scale-x));margin:0 calc(-1 * ${Q});position:relative;z-index:-1;overflow:clip;-webkit-mask-image:linear-gradient( to right,transparent 0,#000 ${S},#000 calc(100% - ${S}),transparent ),linear-gradient( to bottom,transparent 0,#000 ${g},#000 calc(100% - ${g}),transparent 100% ),radial-gradient(at bottom right,${A}),radial-gradient(at bottom left,${A}),radial-gradient(at top left,${A}),radial-gradient(at top right,${A});-webkit-mask-size:100% calc(100% - ${g} * 2),calc(100% - ${S} * 2) 100%,${S} ${g},${S} ${g},${S} ${g},${S} ${g};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat;}.number__inner{padding:0 ${Q};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${Z})));}.section{display:inline-flex;align-items:baseline;padding-bottom:${C};padding-top:${C};position:relative;isolation:isolate;}.section::after{content:'\200b';display:block;padding:${C} 0;}:host([data-will-change]) .section{will-change:transform;}.section--justify-left{transform-origin:center left;}.section--justify-right{transform-origin:center right;}.section__exiting{position:absolute !important;z-index:-1;}.digit{display:block;position:relative;--c:var(--current) + var(${st});}:host([data-will-change]) .digit,:host([data-will-change]) .digit__num{will-change:transform;}.digit__num{display:block;padding:${C} 0;--offset-raw:mod(10 + var(--n) - mod(var(--c),10),10);--offset:calc(var(--offset-raw) - 10 * round(down,var(--offset-raw) / 5,1));--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y));}.digit__num:not(.is-current){position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y));}.digit:not(.is-spinning) .digit__num:not(.is-current){display:none;}.symbol{display:inline-flex;align-items:baseline;position:relative;isolation:isolate;padding:${C} 0;}:host([data-will-change]) .symbol{will-change:transform;}.symbol__value{display:block;white-space:pre;}.symbol__exiting{position:absolute;z-index:-1;}.section--justify-left .symbol__exiting{left:0;}.section--justify-right .symbol__exiting{right:0;}.animate-presence{opacity:calc(1 + var(${Y}));}`, vt = (a, t) => a != null && t == null ? a : a == null && t != null ? t : a != null && t != null ? Math.max(a, t) : null;
100
+ var D, O, x, k, $, y, P, U, W, B, E, M, H, V, X, L, z, j, R, v, I, tt, _, G, K;
101
+ const _t = gt && mt && wt;
109
102
  var b;
110
103
  (function(a) {
111
104
  a[a.UP = 1] = "UP", a[a.DOWN = -1] = "DOWN", a[a.NONE = 0] = "NONE";
112
105
  })(b || (b = {}));
113
- const _t = { duration: 450, easing: "ease-out" }, bt = {
106
+ const bt = { duration: 450, easing: "ease-out" }, St = {
114
107
  duration: 900,
115
108
  // Make sure to keep this minified:
116
109
  easing: "linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"
117
110
  };
118
- let A;
119
- class Mt extends pt {
111
+ let F;
112
+ class Nt extends pt {
120
113
  constructor() {
121
- super(...arguments), this.transformTiming = bt, this.opacityTiming = _t, F.set(this, !0), this.manual = !1, this.respectMotionPreference = !0, D.set(this, !1), x.set(this, void 0), k.set(this, void 0), $.set(this, void 0), this.trend = !0, y.set(this, void 0), this.continuous = !1, P.set(this, void 0), U.set(this, void 0), W.set(this, void 0);
114
+ super(...arguments), this.transformTiming = St, this.opacityTiming = bt, D.set(this, !0), this.manual = !1, this.respectMotionPreference = !0, O.set(this, !1), x.set(this, void 0), k.set(this, void 0), $.set(this, void 0), this.trend = !0, y.set(this, void 0), this.continuous = !1, P.set(this, void 0), U.set(this, void 0), W.set(this, void 0);
122
115
  }
123
116
  static define() {
124
- Z && customElements.define("number-flow", this);
117
+ T && customElements.define("number-flow", this);
125
118
  }
126
119
  get startingPlace() {
127
120
  return n(this, P, "f");
@@ -133,16 +126,16 @@ class Mt extends pt {
133
126
  if (t == null)
134
127
  return;
135
128
  const { pre: e, integer: i, fraction: s, post: r, value: l } = t;
136
- if (n(this, D, "f")) {
129
+ if (n(this, O, "f")) {
137
130
  const o = n(this, U, "f");
138
131
  if (h(this, U, t, "f"), this.trend === !0 ? h(this, y, Math.sign(l - o.value), "f") : this.trend === "increasing" ? h(this, y, b.UP, "f") : this.trend === "decreasing" ? h(this, y, b.DOWN, "f") : h(this, y, b.NONE, "f"), h(this, P, void 0, "f"), n(this, y, "f") !== b.NONE && this.continuous) {
139
132
  const p = o.integer.concat(o.fraction).filter((d) => d.type === "integer" || d.type === "fraction"), u = t.integer.concat(t.fraction).filter((d) => d.type === "integer" || d.type === "fraction"), m = p.find((d) => !u.find((c) => c.place === d.place && c.value === d.value)), N = u.find((d) => !p.find((c) => d.place === c.place && d.value === c.value));
140
- h(this, P, yt(m == null ? void 0 : m.place, N == null ? void 0 : N.place), "f");
133
+ h(this, P, vt(m == null ? void 0 : m.place, N == null ? void 0 : N.place), "f");
141
134
  }
142
135
  this.manual || this.willUpdate(), n(this, x, "f").update(e), n(this, k, "f").update({ integer: i, fraction: s }), n(this, $, "f").update(r), this.manual || this.didUpdate();
143
136
  } else {
144
137
  if (h(this, U, t, "f"), this.attachShadow({ mode: "open" }), typeof CSSStyleSheet < "u" && this.shadowRoot.adoptedStyleSheets)
145
- A || (A = new CSSStyleSheet(), A.replaceSync(nt)), this.shadowRoot.adoptedStyleSheets = [A];
138
+ F || (F = new CSSStyleSheet(), F.replaceSync(nt)), this.shadowRoot.adoptedStyleSheets = [F];
146
139
  else {
147
140
  const o = document.createElement("style");
148
141
  o.textContent = nt, this.shadowRoot.appendChild(o);
@@ -151,7 +144,7 @@ class Mt extends pt {
151
144
  inert: !0,
152
145
  ariaHidden: "true",
153
146
  justify: "right"
154
- }), "f"), this.shadowRoot.appendChild(n(this, x, "f").el), h(this, k, new St(this, i, s, {
147
+ }), "f"), this.shadowRoot.appendChild(n(this, x, "f").el), h(this, k, new xt(this, i, s, {
155
148
  inert: !0,
156
149
  ariaHidden: "true"
157
150
  }), "f"), this.shadowRoot.appendChild(n(this, k, "f").el), h(this, $, new ot(this, r, {
@@ -160,7 +153,7 @@ class Mt extends pt {
160
153
  justify: "left"
161
154
  }), "f"), this.shadowRoot.appendChild(n(this, $, "f").el);
162
155
  }
163
- h(this, D, !0, "f");
156
+ h(this, O, !0, "f");
164
157
  }
165
158
  willUpdate() {
166
159
  this.animated && (n(this, x, "f").willUpdate(), n(this, k, "f").willUpdate(), n(this, $, "f").willUpdate());
@@ -175,29 +168,29 @@ class Mt extends pt {
175
168
  }), h(this, W, t, "f");
176
169
  }
177
170
  get animated() {
178
- return vt && n(this, F, "f") && (!this.respectMotionPreference || !(J != null && J.matches));
171
+ return _t && n(this, D, "f") && (!this.respectMotionPreference || !(J != null && J.matches));
179
172
  }
180
173
  set animated(t) {
181
174
  var e;
182
- this.animated !== t && (h(this, F, t, "f"), (e = this.shadowRoot) == null || e.getAnimations().forEach((i) => i.finish()));
175
+ this.animated !== t && (h(this, D, t, "f"), (e = this.shadowRoot) == null || e.getAnimations().forEach((i) => i.finish()));
183
176
  }
184
177
  }
185
- F = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
186
- class St {
178
+ D = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
179
+ class xt {
187
180
  constructor(t, e, i, { className: s, ...r } = {}) {
188
- this.flow = t, O.set(this, void 0), E.set(this, void 0), M.set(this, void 0), B.set(this, void 0), H.set(this, void 0), h(this, E, new at(t, e, {
181
+ this.flow = t, B.set(this, void 0), E.set(this, void 0), M.set(this, void 0), H.set(this, void 0), V.set(this, void 0), h(this, E, new at(t, e, {
189
182
  justify: "right"
190
183
  }), "f"), h(this, M, new at(t, i, {
191
184
  justify: "left"
192
- }), "f"), h(this, O, w("span", {
185
+ }), "f"), h(this, B, w("span", {
193
186
  className: "number__inner"
194
187
  }, [n(this, E, "f").el, n(this, M, "f").el]), "f"), this.el = w("span", {
195
188
  ...r,
196
189
  className: `number ${s ?? ""}`
197
- }, [n(this, O, "f")]);
190
+ }, [n(this, B, "f")]);
198
191
  }
199
192
  willUpdate() {
200
- h(this, B, this.el.offsetWidth, "f"), h(this, H, this.el.getBoundingClientRect().left, "f"), n(this, E, "f").willUpdate(), n(this, M, "f").willUpdate();
193
+ h(this, H, this.el.offsetWidth, "f"), h(this, V, this.el.getBoundingClientRect().left, "f"), n(this, E, "f").willUpdate(), n(this, M, "f").willUpdate();
201
194
  }
202
195
  update({ integer: t, fraction: e }) {
203
196
  n(this, E, "f").update(t), n(this, M, "f").update(e);
@@ -205,9 +198,9 @@ class St {
205
198
  didUpdate() {
206
199
  const t = this.el.getBoundingClientRect();
207
200
  n(this, E, "f").didUpdate(), n(this, M, "f").didUpdate();
208
- const e = n(this, H, "f") - t.left, i = this.el.offsetWidth, s = n(this, B, "f") - i;
201
+ const e = n(this, V, "f") - t.left, i = this.el.offsetWidth, s = n(this, H, "f") - i;
209
202
  this.el.style.setProperty("--width", String(i)), this.el.animate({
210
- [Y]: [`${e}px`, "0px"],
203
+ [Z]: [`${e}px`, "0px"],
211
204
  [it]: [s, 0]
212
205
  }, {
213
206
  ...this.flow.transformTiming,
@@ -215,12 +208,12 @@ class St {
215
208
  });
216
209
  }
217
210
  }
218
- O = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap();
211
+ B = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap();
219
212
  class lt {
220
213
  constructor(t, e, { justify: i, className: s, ...r }, l) {
221
214
  this.flow = t, this.children = /* @__PURE__ */ new Map(), this.onCharRemove = (p) => () => {
222
215
  this.children.delete(p);
223
- }, V.set(this, void 0), this.justify = i;
216
+ }, X.set(this, void 0), this.justify = i;
224
217
  const o = e.map((p) => this.addChar(p).el);
225
218
  this.el = w("span", {
226
219
  ...r,
@@ -231,7 +224,7 @@ class lt {
231
224
  const s = t.type === "integer" || t.type === "fraction" ? new ct(this, t.type, e ? 0 : t.value, t.place, {
232
225
  ...i,
233
226
  onRemove: this.onCharRemove(t.key)
234
- }) : new xt(this, t.type, t.value, {
227
+ }) : new kt(this, t.type, t.value, {
235
228
  ...i,
236
229
  onRemove: this.onCharRemove(t.key)
237
230
  });
@@ -266,12 +259,12 @@ class lt {
266
259
  }
267
260
  willUpdate() {
268
261
  const t = this.el.getBoundingClientRect();
269
- h(this, V, t[this.justify], "f"), this.children.forEach((e) => e.willUpdate(t));
262
+ h(this, X, t[this.justify], "f"), this.children.forEach((e) => e.willUpdate(t));
270
263
  }
271
264
  didUpdate() {
272
265
  const t = this.el.getBoundingClientRect();
273
266
  this.children.forEach((s) => s.didUpdate(t));
274
- const e = t[this.justify], i = n(this, V, "f") - e;
267
+ const e = t[this.justify], i = n(this, X, "f") - e;
275
268
  this.el.animate({
276
269
  transform: [`translateX(${i}px)`, "none"]
277
270
  }, {
@@ -280,7 +273,7 @@ class lt {
280
273
  });
281
274
  }
282
275
  }
283
- V = /* @__PURE__ */ new WeakMap();
276
+ X = /* @__PURE__ */ new WeakMap();
284
277
  class at extends lt {
285
278
  update(t) {
286
279
  const e = /* @__PURE__ */ new Map();
@@ -301,37 +294,37 @@ class ot extends lt {
301
294
  }
302
295
  class et {
303
296
  constructor(t, e, { onRemove: i, animateIn: s = !1 } = {}) {
304
- this.flow = t, this.el = e, j.set(this, !0), X.set(this, void 0), L.set(this, () => {
297
+ this.flow = t, this.el = e, L.set(this, !0), z.set(this, void 0), j.set(this, () => {
305
298
  var r;
306
- this.el.remove(), (r = n(this, X, "f")) == null || r.call(this);
299
+ this.el.remove(), (r = n(this, z, "f")) == null || r.call(this);
307
300
  }), this.el.classList.add("animate-presence"), this.flow.animated && s && this.el.animate({
308
- [K]: [-0.9999, 0]
301
+ [Y]: [-0.9999, 0]
309
302
  }, {
310
303
  ...this.flow.opacityTiming,
311
304
  composite: "accumulate"
312
- }), h(this, X, i, "f");
305
+ }), h(this, z, i, "f");
313
306
  }
314
307
  get present() {
315
- return n(this, j, "f");
308
+ return n(this, L, "f");
316
309
  }
317
310
  set present(t) {
318
- if (n(this, j, "f") !== t) {
319
- if (h(this, j, t, "f"), !this.flow.animated) {
320
- t || n(this, L, "f").call(this);
311
+ if (n(this, L, "f") !== t) {
312
+ if (h(this, L, t, "f"), !this.flow.animated) {
313
+ t || n(this, j, "f").call(this);
321
314
  return;
322
315
  }
323
316
  this.el.style.setProperty("--_number-flow-d-opacity", t ? "0" : "-.999"), this.el.animate({
324
- [K]: t ? [-0.9999, 0] : [0.999, 0]
317
+ [Y]: t ? [-0.9999, 0] : [0.999, 0]
325
318
  }, {
326
319
  ...this.flow.opacityTiming,
327
320
  composite: "accumulate"
328
- }), t ? this.flow.removeEventListener("animationsfinish", n(this, L, "f")) : this.flow.addEventListener("animationsfinish", n(this, L, "f"), {
321
+ }), t ? this.flow.removeEventListener("animationsfinish", n(this, j, "f")) : this.flow.addEventListener("animationsfinish", n(this, j, "f"), {
329
322
  once: !0
330
323
  });
331
324
  }
332
325
  }
333
326
  }
334
- j = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap();
327
+ L = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap();
335
328
  class ht extends et {
336
329
  constructor(t, e, i, s) {
337
330
  super(t.flow, i, s), this.section = t, this.value = e, this.el = i;
@@ -345,7 +338,7 @@ class ct extends ht {
345
338
  }), o = w("span", {
346
339
  className: "digit"
347
340
  }, l);
348
- o.style.setProperty("--current", String(i)), super(t, i, o, r), this.place = s, R.set(this, void 0), v.set(this, void 0), z.set(this, void 0), tt.set(this, () => {
341
+ o.style.setProperty("--current", String(i)), super(t, i, o, r), this.place = s, R.set(this, void 0), v.set(this, void 0), I.set(this, void 0), tt.set(this, () => {
349
342
  this.el.classList.remove("is-spinning");
350
343
  }), h(this, R, l, "f");
351
344
  }
@@ -353,7 +346,7 @@ class ct extends ht {
353
346
  const e = this.el.getBoundingClientRect();
354
347
  h(this, v, this.value, "f");
355
348
  const i = e[this.section.justify] - t[this.section.justify], s = e.width / 2;
356
- h(this, z, this.section.justify === "left" ? i + s : i - s, "f");
349
+ h(this, I, this.section.justify === "left" ? i + s : i - s, "f");
357
350
  }
358
351
  update(t) {
359
352
  var e, i;
@@ -362,7 +355,7 @@ class ct extends ht {
362
355
  didUpdate(t) {
363
356
  const e = this.el.getBoundingClientRect(), i = e[this.section.justify] - t[this.section.justify], s = e.width / 2, r = this.section.justify === "left" ? i + s : i - s;
364
357
  this.el.animate({
365
- transform: [`translateX(${n(this, z, "f") - r}px)`, "none"]
358
+ transform: [`translateX(${n(this, I, "f") - r}px)`, "none"]
366
359
  }, {
367
360
  ...this.flow.transformTiming,
368
361
  composite: "accumulate"
@@ -381,8 +374,8 @@ class ct extends ht {
381
374
  return !e && this.flow.startingPlace != null && this.flow.startingPlace >= this.place ? 10 * t : (t || (t = Math.sign(e)), t === b.DOWN && this.value > n(this, v, "f") ? this.value - 10 - n(this, v, "f") : t === b.UP && this.value < n(this, v, "f") ? 10 - n(this, v, "f") + this.value : e);
382
375
  }
383
376
  }
384
- R = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap();
385
- class xt extends ht {
377
+ R = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap();
378
+ class kt extends ht {
386
379
  constructor(t, e, i, s) {
387
380
  const r = w("span", {
388
381
  className: "symbol__value",
@@ -390,17 +383,17 @@ class xt extends ht {
390
383
  });
391
384
  super(t, i, w("span", {
392
385
  className: "symbol"
393
- }, [r]), s), this.type = e, _.set(this, /* @__PURE__ */ new Map()), I.set(this, void 0), G.set(this, (l) => () => {
386
+ }, [r]), s), this.type = e, _.set(this, /* @__PURE__ */ new Map()), G.set(this, void 0), K.set(this, (l) => () => {
394
387
  n(this, _, "f").delete(l);
395
388
  }), n(this, _, "f").set(i, new et(this.flow, r, {
396
- onRemove: n(this, G, "f").call(this, i)
389
+ onRemove: n(this, K, "f").call(this, i)
397
390
  }));
398
391
  }
399
392
  willUpdate(t) {
400
393
  if (this.type === "decimal")
401
394
  return;
402
395
  const e = this.el.getBoundingClientRect();
403
- h(this, I, e[this.section.justify] - t[this.section.justify], "f");
396
+ h(this, G, e[this.section.justify] - t[this.section.justify], "f");
404
397
  }
405
398
  update(t) {
406
399
  if (this.value !== t) {
@@ -415,7 +408,7 @@ class xt extends ht {
415
408
  });
416
409
  this.el.appendChild(i), n(this, _, "f").set(t, new et(this.flow, i, {
417
410
  animateIn: !0,
418
- onRemove: n(this, G, "f").call(this, t)
411
+ onRemove: n(this, K, "f").call(this, t)
419
412
  }));
420
413
  }
421
414
  }
@@ -426,18 +419,18 @@ class xt extends ht {
426
419
  return;
427
420
  const i = this.el.getBoundingClientRect()[this.section.justify] - t[this.section.justify];
428
421
  this.el.animate({
429
- transform: [`translateX(${n(this, I, "f") - i}px)`, "none"]
422
+ transform: [`translateX(${n(this, G, "f") - i}px)`, "none"]
430
423
  }, { ...this.flow.transformTiming, composite: "accumulate" });
431
424
  }
432
425
  }
433
- _ = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap();
426
+ _ = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap();
434
427
  export {
435
- Mt as NumberFlowLite,
436
- wt as SlottedTag,
437
- vt as canAnimate,
438
- _t as defaultOpacityTiming,
439
- bt as defaultTransformTiming,
440
- $t as partitionParts,
428
+ Nt as NumberFlowLite,
429
+ yt as SlottedTag,
430
+ _t as canAnimate,
431
+ bt as defaultOpacityTiming,
432
+ St as defaultTransformTiming,
433
+ Et as partitionParts,
441
434
  J as prefersReducedMotion,
442
- Et as slottedStyles
435
+ Mt as slottedStyles
443
436
  };
package/dist/styles.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const supportsLinear: boolean;
1
2
  export declare const supportsMod: boolean;
2
3
  export declare const prefersReducedMotion: MediaQueryList | null;
3
4
  export declare const opacityDeltaVar = "--_number-flow-d-opacity";
@@ -1 +1 @@
1
- export declare const max: (n1?: number, n2?: number) => number | undefined;
1
+ export declare const max: (n1?: number, n2?: number) => number | null;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.1",
6
+ "version": "0.3.2",
7
7
  "author": {
8
8
  "name": "Maxwell Barvian",
9
9
  "email": "max@barvian.me",