laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
70 lines (69 loc) • 2.29 kB
JavaScript
"use client";
import { identity as M } from "./continuous.js";
import { initInterpolator as g } from "./init.js";
import { linearish as S } from "./linear.js";
import { loggish as q } from "./log.js";
import { copy as f } from "./sequential.js";
import { symlogish as x } from "./symlog.js";
import { powish as I } from "./pow.js";
import L from "../../d3-interpolate/src/piecewise.js";
import P from "../../d3-interpolate/src/value.js";
import j from "../../d3-interpolate/src/round.js";
function s() {
var n = 0, a = 0.5, m = 1, c = 1, o, t, u, l, y, i = M, p, d = !1, h;
function e(r) {
return isNaN(r = +r) ? h : (r = 0.5 + ((r = +p(r)) - t) * (c * r < c * t ? l : y), i(d ? Math.max(0, Math.min(1, r)) : r));
}
e.domain = function(r) {
return arguments.length ? ([n, a, m] = r, o = p(n = +n), t = p(a = +a), u = p(m = +m), l = o === t ? 0 : 0.5 / (t - o), y = t === u ? 0 : 0.5 / (u - t), c = t < o ? -1 : 1, e) : [n, a, m];
}, e.clamp = function(r) {
return arguments.length ? (d = !!r, e) : d;
}, e.interpolator = function(r) {
return arguments.length ? (i = r, e) : i;
};
function v(r) {
return function(R) {
var w, k, b;
return arguments.length ? ([w, k, b] = R, i = L(r, [w, k, b]), e) : [i(0), i(0.5), i(1)];
};
}
return e.range = v(P), e.rangeRound = v(j), e.unknown = function(r) {
return arguments.length ? (h = r, e) : h;
}, function(r) {
return p = r, o = r(n), t = r(a), u = r(m), l = o === t ? 0 : 0.5 / (t - o), y = t === u ? 0 : 0.5 / (u - t), c = t < o ? -1 : 1, e;
};
}
function z() {
var n = S(s()(M));
return n.copy = function() {
return f(n, z());
}, g.apply(n, arguments);
}
function A() {
var n = q(s()).domain([0.1, 1, 10]);
return n.copy = function() {
return f(n, A()).base(n.base());
}, g.apply(n, arguments);
}
function B() {
var n = x(s());
return n.copy = function() {
return f(n, B()).constant(n.constant());
}, g.apply(n, arguments);
}
function N() {
var n = I(s());
return n.copy = function() {
return f(n, N()).exponent(n.exponent());
}, g.apply(n, arguments);
}
function T() {
return N.apply(null, arguments).exponent(0.5);
}
export {
z as default,
A as divergingLog,
N as divergingPow,
T as divergingSqrt,
B as divergingSymlog
};