@synergy-design-system/components
Version:
This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define
30 lines (28 loc) • 822 B
JavaScript
// src/components/range/utility.ts
var numericSort = (a, b) => a - b;
var arraysDiffer = (a, b) => {
if (a.length !== b.length) return true;
const sortedA = a.slice().sort(numericSort);
const sortedB = b.slice().sort(numericSort);
for (let i = 0; i < sortedA.length; i += 1) {
if (sortedA[i] !== sortedB[i]) return true;
}
return false;
};
var getNormalizedValueFromClientX = (baseDiv, x, isRtl) => {
const bounds = baseDiv.getBoundingClientRect();
const size = bounds.width;
if (size <= 0) return 0;
let nextX = x;
nextX -= bounds.left;
if (nextX <= 0) return isRtl ? 1 : 0;
if (nextX >= size) return isRtl ? 0 : 1;
nextX /= size;
return isRtl ? 1 - nextX : nextX;
};
export {
numericSort,
arraysDiffer,
getNormalizedValueFromClientX
};
//# sourceMappingURL=chunk.236RSW67.js.map