ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
2 lines (1 loc) • 6.18 kB
JavaScript
const s=require("./src-C9EhKhbk.cjs"),d=require("./defaultLocale-DSqtvhxg.cjs"),S=require("./init-CbDwVtpO.cjs");function M(n,e){return n==null||e==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function x(n,e){return n==null||e==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function N(n){let e,t,r;n.length!==2?(e=M,t=(f,c)=>M(n(f),c),r=(f,c)=>n(f)-c):(e=n===M||n===x?n:R,t=n,r=n);function i(f,c,u=0,m=f.length){if(u<m){if(e(c,c)!==0)return m;do{const l=u+m>>>1;t(f[l],c)<0?u=l+1:m=l}while(u<m)}return u}function o(f,c,u=0,m=f.length){if(u<m){if(e(c,c)!==0)return m;do{const l=u+m>>>1;t(f[l],c)<=0?u=l+1:m=l}while(u<m)}return u}function a(f,c,u=0,m=f.length){const l=i(f,c,u,m-1);return l>u&&r(f[l-1],c)>-r(f[l],c)?l-1:l}return{left:i,center:a,right:o}}function R(){return 0}function b(n){return n===null?NaN:+n}var k=N(M),D=k.right,en=k.left,rn=N(b).center,F=Math.sqrt(50),z=Math.sqrt(10),B=Math.sqrt(2);function v(n,e,t){const r=(e-n)/Math.max(0,t),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=F?10:o>=z?5:o>=B?2:1;let f,c,u;return i<0?(u=Math.pow(10,-i)/a,f=Math.round(n*u),c=Math.round(e*u),f/u<n&&++f,c/u>e&&--c,u=-u):(u=Math.pow(10,i)*a,f=Math.round(n/u),c=Math.round(e/u),f*u<n&&++f,c*u>e&&--c),c<f&&.5<=t&&t<2?v(n,e,t*2):[f,c,u]}function I(n,e,t){if(e=+e,n=+n,t=+t,!(t>0))return[];if(n===e)return[n];const r=e<n,[i,o,a]=r?v(e,n,t):v(n,e,t);if(!(o>=i))return[];const f=o-i+1,c=new Array(f);if(r)if(a<0)for(let u=0;u<f;++u)c[u]=(o-u)/-a;else for(let u=0;u<f;++u)c[u]=(o-u)*a;else if(a<0)for(let u=0;u<f;++u)c[u]=(i+u)/-a;else for(let u=0;u<f;++u)c[u]=(i+u)*a;return c}function y(n,e,t){return e=+e,n=+n,t=+t,v(n,e,t)[2]}function A(n,e,t){e=+e,n=+n,t=+t;const r=e<n,i=r?y(e,n,t):y(n,e,t);return(r?-1:1)*(i<0?1/-i:i)}function L(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,r=e.slice(),i;return function(o){for(i=0;i<t;++i)r[i]=n[i]*(1-o)+e[i]*o;return r}}function V(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function C(n,e){var t=e?e.length:0,r=n?Math.min(t,n.length):0,i=new Array(r),o=new Array(t),a;for(a=0;a<r;++a)i[a]=_(n[a],e[a]);for(;a<t;++a)o[a]=e[a];return function(f){for(a=0;a<r;++a)o[a]=i[a](f);return o}}function T(n,e){var t=new Date;return n=+n,e=+e,function(r){return t.setTime(n*(1-r)+e*r),t}}function $(n,e){var t={},r={},i;(n===null||typeof n!="object")&&(n={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in n?t[i]=_(n[i],e[i]):r[i]=e[i];return function(o){for(i in t)r[i]=t[i](o);return r}}function _(n,e){var t=typeof e,r;return e==null||t==="boolean"?s.constant_default(e):(t==="number"?s.number_default:t==="string"?(r=s.color(e))?(e=r,s.rgb_default):s.string_default:e instanceof s.color?s.rgb_default:e instanceof Date?T:V(e)?L:Array.isArray(e)?C:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?$:s.number_default)(n,e)}function E(n,e){return n=+n,e=+e,function(t){return Math.round(n*(1-t)+e*t)}}function G(n){return Math.max(0,-d.exponent_default(Math.abs(n)))}function H(n,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(d.exponent_default(e)/3)))*3-d.exponent_default(Math.abs(n)))}function J(n,e){return n=Math.abs(n),e=Math.abs(e)-n,Math.max(0,d.exponent_default(e)-d.exponent_default(n))+1}function K(n){return function(){return n}}function Q(n){return+n}var w=[0,1];function g(n){return n}function p(n,e){return(e-=n=+n)?function(t){return(t-n)/e}:K(isNaN(e)?NaN:.5)}function U(n,e){var t;return n>e&&(t=n,n=e,e=t),function(r){return Math.max(n,Math.min(e,r))}}function W(n,e,t){var r=n[0],i=n[1],o=e[0],a=e[1];return i<r?(r=p(i,r),o=t(a,o)):(r=p(r,i),o=t(o,a)),function(f){return o(r(f))}}function X(n,e,t){var r=Math.min(n.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(n[r]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=p(n[a],n[a+1]),o[a]=t(e[a],e[a+1]);return function(f){var c=D(n,f,1,r)-1;return o[c](i[c](f))}}function j(n,e){return e.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function Y(){var n=w,e=w,t=_,r,i,o,a=g,f,c,u;function m(){var h=Math.min(n.length,e.length);return a!==g&&(a=U(n[0],n[h-1])),f=h>2?X:W,c=u=null,l}function l(h){return h==null||isNaN(h=+h)?o:(c||(c=f(n.map(r),e,t)))(r(a(h)))}return l.invert=function(h){return a(i((u||(u=f(e,n.map(r),s.number_default)))(h)))},l.domain=function(h){return arguments.length?(n=Array.from(h,Q),m()):n.slice()},l.range=function(h){return arguments.length?(e=Array.from(h),m()):e.slice()},l.rangeRound=function(h){return e=Array.from(h),t=E,m()},l.clamp=function(h){return arguments.length?(a=h?!0:g,m()):a!==g},l.interpolate=function(h){return arguments.length?(t=h,m()):t},l.unknown=function(h){return arguments.length?(o=h,l):o},function(h,O){return r=h,i=O,m()}}function q(){return Y()(g,g)}function Z(n,e,t,r){var i=A(n,e,t),o;switch(r=d.formatSpecifier(r??",f"),r.type){case"s":var a=Math.max(Math.abs(n),Math.abs(e));return r.precision==null&&!isNaN(o=H(i,a))&&(r.precision=o),d.formatPrefix(r,a);case"":case"e":case"g":case"p":case"r":r.precision==null&&!isNaN(o=J(i,Math.max(Math.abs(n),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break;case"f":case"%":r.precision==null&&!isNaN(o=G(i))&&(r.precision=o-(r.type==="%")*2);break}return d.format(r)}function nn(n){var e=n.domain;return n.ticks=function(t){var r=e();return I(r[0],r[r.length-1],t??10)},n.tickFormat=function(t,r){var i=e();return Z(i[0],i[i.length-1],t??10,r)},n.nice=function(t){t==null&&(t=10);var r=e(),i=0,o=r.length-1,a=r[i],f=r[o],c,u,m=10;for(f<a&&(u=a,a=f,f=u,u=i,i=o,o=u);m-- >0;){if(u=y(a,f,t),u===c)return r[i]=a,r[o]=f,e(r);if(u>0)a=Math.floor(a/u)*u,f=Math.ceil(f/u)*u;else if(u<0)a=Math.ceil(a*u)/u,f=Math.floor(f*u)/u;else break;c=u}return n},n}function P(){var n=q();return n.copy=function(){return j(n,P())},S.initRange.apply(n,arguments),nn(n)}Object.defineProperty(exports,"bisector",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"copy",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"linear",{enumerable:!0,get:function(){return P}});Object.defineProperty(exports,"tickStep",{enumerable:!0,get:function(){return A}});