@thisway/utils
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -10,3 +10,3 @@ export * from './lib/animation-frame-throttle'; | ||
export * from './lib/is'; | ||
export * from './lib/object'; | ||
export * from './lib/dom'; | ||
export * from './lib/transform'; |
81
index.js
@@ -15,7 +15,7 @@ import { derived as E } from "svelte/store"; | ||
} | ||
function h(e) { | ||
function b(e) { | ||
return e && Number.isFinite(e) ? e : 0; | ||
} | ||
const { hasOwn: I } = Object; | ||
function y(e, t) { | ||
function h(e, t) { | ||
for (const n in t) { | ||
@@ -33,34 +33,31 @@ if (!I(t, n)) | ||
}; | ||
function x(e, t, n) { | ||
function O(e, t, n) { | ||
return E(e, (r) => (r == null ? void 0 : r[t]) ?? n); | ||
} | ||
const O = (e, t, n) => e < t ? t : e > n ? n : e, b = (e, t) => { | ||
const x = (e, t, n) => e < t ? t : e > n ? n : e, p = (e, t) => { | ||
const n = new ResizeObserver(t); | ||
return n.observe(e), () => n.disconnect(); | ||
}, p = { | ||
}, y = { | ||
width: 0, | ||
height: 0 | ||
}, Y = (e) => Number.isFinite(e), A = (e, t) => e instanceof Node ? !0 : t ? e instanceof t.Node : !1, V = (e) => e.nodeType === Node.ELEMENT_NODE; | ||
}, Y = (e) => Number.isFinite(e), A = (e, t) => e instanceof Node ? !0 : t ? e instanceof t.Node : !1, R = (e) => e.nodeType === Node.ELEMENT_NODE; | ||
function _(e) { | ||
return ["INPUT", "TEXTAREA"].includes(e.tagName) || ["text", "vertical-text"].includes(getComputedStyle(e).cursor); | ||
} | ||
function P(e, t) { | ||
function v(e, t) { | ||
return e.tagName === t.toUpperCase(); | ||
} | ||
function R(e, t) { | ||
return Object.keys(e).find((n) => e[n] === t); | ||
function P(e) { | ||
return e.scrollingElement || e.documentElement; | ||
} | ||
function S(e) { | ||
return e.scrollingElement || e.documentElement; | ||
} | ||
function v(e) { | ||
let t = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY; | ||
for (const a of e) { | ||
const { x: o, y: u, right: s, bottom: c } = a.getBoundingClientRect(); | ||
o < t && (t = o), u < n && (n = u), s > r && (r = s), c > i && (i = c); | ||
const { x: m, y: f, right: N, bottom: l } = a.getBoundingClientRect(); | ||
m < t && (t = m), f < n && (n = f), N > r && (r = N), l > i && (i = l); | ||
} | ||
const m = t, f = n, l = r - t, N = i - n; | ||
return new DOMRectReadOnly(m, f, l, N); | ||
const o = t, u = n, c = r - t, s = i - n; | ||
return new DOMRectReadOnly(o, u, c, s); | ||
} | ||
function z(e) { | ||
function V(e) { | ||
try { | ||
@@ -72,13 +69,33 @@ return e == null ? void 0 : e.frameElement; | ||
} | ||
const X = [1, 0, 0, 1, 0, 0]; | ||
function z(e) { | ||
const [t, n, r, i] = e; | ||
return [t, n, r, i, 0, 0]; | ||
} | ||
function M(e, t, n) { | ||
return n[0] * e + n[2] * t + n[4]; | ||
} | ||
function C(e, t, n) { | ||
return n[1] * e + n[3] * t + n[5]; | ||
} | ||
function q(e, t, n) { | ||
const [r, i, o, u, c, s] = n; | ||
return (u * e - o * t + o * s - u * c) / (r * u - i * o); | ||
} | ||
function B(e, t, n) { | ||
const [r, i, o, u, c, s] = n; | ||
return (r * t - i * e + i * c - r * s) / (r * u - o * i); | ||
} | ||
export { | ||
p as EMPTY_SIZE, | ||
y as EMPTY_SIZE, | ||
X as NOOP_TRANSFORM, | ||
T as animationFrameThrottle, | ||
P as checkElementType, | ||
O as clamp, | ||
y as defaults, | ||
v as getElementsBounding, | ||
z as getFrameElement, | ||
R as getKeyByValue, | ||
S as getScrollingElement, | ||
V as isElement, | ||
v as checkElementType, | ||
x as clamp, | ||
h as defaults, | ||
z as deltaTransform, | ||
S as getElementsBounding, | ||
V as getFrameElement, | ||
P as getScrollingElement, | ||
R as isElement, | ||
A as isNode, | ||
@@ -88,6 +105,10 @@ _ as isTextInputElement, | ||
F as memoize, | ||
h as noFinite, | ||
x as pick$, | ||
b as resizeObserver, | ||
g as toPx | ||
b as noFinite, | ||
O as pick$, | ||
p as resizeObserver, | ||
q as reverseX, | ||
B as reverseY, | ||
g as toPx, | ||
M as transformX, | ||
C as transformY | ||
}; |
{ | ||
"name": "@thisway/utils", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
Sorry, the diff of this file is not supported yet
8480
169