aptechka 0.1.11 → 0.1.12
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/lib/utils/cssom.d.ts +5 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +97 -85
- package/package.json +1 -1
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),x=require("../browser-CpzFX2xg.cjs"),p=require("../dom-qY2LdCVL.cjs"),a=require("../easings-DsS5-Kqc.cjs"),y=require("../events-Crwi8fz6.cjs"),E=require("../file-EevnUtRj.cjs"),g=require("../function-MthRj-GJ.cjs"),h=require("../layout-8ryRAMGJ.cjs"),o=require("../math-GDWEqu7y.cjs"),f=require("../number-yVpzMdbQ.cjs"),u=require("../object-C1ph624j.cjs"),l=require("../string-vBu90jhV.cjs"),O=require("../style-At6aDoqG.cjs");function I(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function S(t,e){const n=t.measureText(e),i=n.actualBoundingBoxAscent+n.actualBoundingBoxDescent,s=n.width;return{height:i,width:s}}function w(t){return Math.floor(t)+.5}function Q(t,e,n,i,s,r){let m=t/e,C=n/i,c=0,d=0;return s=typeof s=="undefined"?.5:s,r=typeof r=="undefined"?.5:r,m>C?(c=i,d=i*m):(d=n,c=n/m),[(n-d)*s,(i-c)*r,d,c]}function T(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function v(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function D(t,e,n=!1){let i=t.x-e.width/2,s=e.height/2-t.y;return n&&(i=i/(e.width/2),s=s/(e.height/2)),{x:i,y:s}}function P(t,e){const n=t.x/e.x,i=t.y/e.y;return{x:n,y:i}}function q(t,e){return e=e||{x:0,y:0,width:document.documentElement.offsetWidth,height:innerHeight},{x:(t.x-e.x)/e.width*e.width,y:(t.y-e.y)/e.height*e.height}}function R(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(i=>{i instanceof CSSStyleRule&&i.selectorText===":root"&&t.forEach(s=>{const r=i.styleMap.get(s);r?e[s]=r.toString():console.warn(`variable named ${s} not found`)})})}),e}function A(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function N(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}exports.parseAttribute=b.parseAttribute;exports.parseAttributeValue=b.parseAttributeValue;exports.isBrowser=x.isBrowser;exports.findParentElement=p.findParentElement;exports.findScrollParentElement=p.findScrollParentElement;exports.getElement=p.getElement;exports.easeInCubic=a.easeInCubic;exports.easeInExpo=a.easeInExpo;exports.easeInOutCubic=a.easeInOutCubic;exports.easeInOutExpo=a.easeInOutExpo;exports.easeInOutQuad=a.easeInOutQuad;exports.easeInOutQuart=a.easeInOutQuart;exports.easeInOutQuint=a.easeInOutQuint;exports.easeInQuad=a.easeInQuad;exports.easeInQuart=a.easeInQuart;exports.easeInQuint=a.easeInQuint;exports.easeOutCubic=a.easeOutCubic;exports.easeOutExpo=a.easeOutExpo;exports.easeOutQuad=a.easeOutQuad;exports.easeOutQuart=a.easeOutQuart;exports.easeOutQuint=a.easeOutQuint;exports.linear=a.linear;exports.dispatchSizeChangeEvent=y.dispatchSizeChangeEvent;exports.createJSONAndSave=E.createJSONAndSave;exports.debounce=g.debounce;exports.throttle=g.throttle;exports.getCumulativeOffsetLeft=h.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=h.getCumulativeOffsetTop;exports.getCumulativePosition=h.getCumulativePosition;exports.calculateDistance=o.calculateDistance;exports.calculateDistanceWithRadius=o.calculateDistanceWithRadius;exports.clamp=o.clamp;exports.damp=o.damp;exports.lerp=o.lerp;exports.mapRange=o.mapRange;exports.round=o.round;exports.smootherstep=o.smootherstep;exports.smoothstep=o.smoothstep;exports.step=o.step;exports.preciseNumber=f.preciseNumber;exports.roundNumberTo=f.roundNumberTo;exports.cloneDeep=u.cloneDeep;exports.compareObjects=u.compareObjects;exports.isESClass=u.isESClass;exports.isNullish=u.isNullish;exports.isObject=u.isObject;exports.mergeDeep=u.mergeDeep;exports.omit=u.omit;exports.pick=u.pick;exports.camelToKebab=l.camelToKebab;exports.capitalize=l.capitalize;exports.generateId=l.generateId;exports.kebabToCamel=l.kebabToCamel;exports.snakeToDotted=l.snakeToDotted;exports.toPascalCase=l.toPascalCase;exports.uncapitalize=l.uncapitalize;exports.getElementTransitionDurationMS=O.getElementTransitionDurationMS;exports.getElementTransitionDurationS=O.getElementTransitionDurationS;exports.cover=Q;exports.decode=N;exports.dotCircleCollision=v;exports.dotRectCollision=T;exports.encode=A;exports.fixPosition=w;exports.getPointerPosition=q;exports.getRootVariables=R;exports.insert=I;exports.measureText=S;exports.normalize=P;exports.screenToCartesian=D;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { isBrowser } from './browser';
|
|
|
4
4
|
export { measureText, fixPosition, cover } from './canvas';
|
|
5
5
|
export { dotRectCollision, dotCircleCollision } from './collisions';
|
|
6
6
|
export { screenToCartesian, normalize, getPointerPosition } from './coordinates';
|
|
7
|
+
export { getRootVariables } from './cssom';
|
|
7
8
|
export { encode, decode } from './decoding';
|
|
8
9
|
export { findParentElement, getElement, findScrollParentElement, type ElementOrSelector, } from './dom';
|
|
9
10
|
export { linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInExpo, easeOutExpo, easeInOutExpo, type EasingFunction, } from './easings';
|
package/lib/utils/index.js
CHANGED
|
@@ -1,139 +1,151 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { i as
|
|
3
|
-
import { f as
|
|
4
|
-
import { c as
|
|
1
|
+
import { a as S, p as I } from "../attributes-69we3byR.js";
|
|
2
|
+
import { i as Q } from "../browser-0zX67oeU.js";
|
|
3
|
+
import { f as D, a as T, g as P } from "../dom-BY7JhTx5.js";
|
|
4
|
+
import { c as k, n as B, f as M, p as N, b as j, i as z, m as U, e as V, g as q, j as J, d as K, o as $, a as F, h as G, k as W, l as X } from "../easings-BKi40vHz.js";
|
|
5
5
|
import { d as Z } from "../events-_C2CztxR.js";
|
|
6
|
-
import { c as
|
|
7
|
-
import { d as
|
|
8
|
-
import { g as
|
|
9
|
-
import { e as
|
|
10
|
-
import { p as
|
|
11
|
-
import { c as
|
|
12
|
-
import { c as
|
|
13
|
-
import { g as ze, a as
|
|
14
|
-
function
|
|
15
|
-
return [...
|
|
6
|
+
import { c as H } from "../file-lxi_oXJf.js";
|
|
7
|
+
import { d as ee, t as te } from "../function-C10DGppn.js";
|
|
8
|
+
import { g as se, a as ne, b as oe } from "../layout-HoBT_Da2.js";
|
|
9
|
+
import { e as re, f as ue, c as le, d as ce, l as de, m as me, r as pe, b as fe, a as xe, s as he } from "../math-BOBiC4TN.js";
|
|
10
|
+
import { p as be, r as ye } from "../number-Bo5RdrA1.js";
|
|
11
|
+
import { c as Ce, d as Oe, i as Ee, b as Se, a as Ie, m as Re, o as Qe, p as ve } from "../object-DIPjdukP.js";
|
|
12
|
+
import { c as Te, a as Pe, g as Ae, k as ke, s as Be, t as Me, u as Ne } from "../string-3lAkpJJP.js";
|
|
13
|
+
import { g as ze, a as Ue } from "../style-j2TwriJ_.js";
|
|
14
|
+
function c(t, e, ...a) {
|
|
15
|
+
return [...t.slice(0, e), ...a, ...t.slice(e)];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
17
|
+
function d(t, e) {
|
|
18
|
+
const a = t.measureText(e), s = a.actualBoundingBoxAscent + a.actualBoundingBoxDescent, n = a.width;
|
|
19
19
|
return {
|
|
20
20
|
height: s,
|
|
21
21
|
width: n
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function m(
|
|
25
|
-
return Math.floor(
|
|
24
|
+
function m(t) {
|
|
25
|
+
return Math.floor(t) + 0.5;
|
|
26
26
|
}
|
|
27
|
-
function p(
|
|
28
|
-
let
|
|
29
|
-
return n = typeof n == "undefined" ? 0.5 : n, o = typeof o == "undefined" ? 0.5 : o,
|
|
30
|
-
(
|
|
27
|
+
function p(t, e, a, s, n, o) {
|
|
28
|
+
let u = t / e, l = a / s, i = 0, r = 0;
|
|
29
|
+
return n = typeof n == "undefined" ? 0.5 : n, o = typeof o == "undefined" ? 0.5 : o, u > l ? (i = s, r = s * u) : (r = a, i = a / u), [
|
|
30
|
+
(a - r) * n,
|
|
31
31
|
(s - i) * o,
|
|
32
|
-
|
|
32
|
+
r,
|
|
33
33
|
i
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function f(t, e) {
|
|
37
|
+
return t.x < e.x + e.width && t.x > e.x && t.y < e.y + e.height && t.y > e.y;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return Math.sqrt((
|
|
39
|
+
function x(t, e) {
|
|
40
|
+
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2) < e.radius;
|
|
41
41
|
}
|
|
42
|
-
function h(
|
|
43
|
-
let s =
|
|
44
|
-
return
|
|
42
|
+
function h(t, e, a = !1) {
|
|
43
|
+
let s = t.x - e.width / 2, n = e.height / 2 - t.y;
|
|
44
|
+
return a && (s = s / (e.width / 2), n = n / (e.height / 2)), { x: s, y: n };
|
|
45
45
|
}
|
|
46
|
-
function g(
|
|
47
|
-
const
|
|
48
|
-
return { x:
|
|
46
|
+
function g(t, e) {
|
|
47
|
+
const a = t.x / e.x, s = t.y / e.y;
|
|
48
|
+
return { x: a, y: s };
|
|
49
49
|
}
|
|
50
|
-
function b(
|
|
50
|
+
function b(t, e) {
|
|
51
51
|
return e = e || {
|
|
52
52
|
x: 0,
|
|
53
53
|
y: 0,
|
|
54
54
|
width: document.documentElement.offsetWidth,
|
|
55
55
|
height: innerHeight
|
|
56
56
|
}, {
|
|
57
|
-
x: (
|
|
58
|
-
y: (
|
|
57
|
+
x: (t.x - e.x) / e.width * e.width,
|
|
58
|
+
y: (t.y - e.y) / e.height * e.height
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const e =
|
|
61
|
+
function y(...t) {
|
|
62
|
+
const e = {};
|
|
63
|
+
return Array.from(document.styleSheets).forEach((a) => {
|
|
64
|
+
Array.from(a.cssRules).forEach((s) => {
|
|
65
|
+
s instanceof CSSStyleRule && s.selectorText === ":root" && t.forEach((n) => {
|
|
66
|
+
const o = s.styleMap.get(n);
|
|
67
|
+
o ? e[n] = o.toString() : console.warn(`variable named ${n} not found`);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}), e;
|
|
71
|
+
}
|
|
72
|
+
function w(t) {
|
|
73
|
+
const e = window.atob(t);
|
|
63
74
|
return decodeURIComponent(window.escape(e));
|
|
64
75
|
}
|
|
65
|
-
function
|
|
66
|
-
const e = window.unescape(encodeURIComponent(
|
|
76
|
+
function C(t) {
|
|
77
|
+
const e = window.unescape(encodeURIComponent(t));
|
|
67
78
|
return window.btoa(e);
|
|
68
79
|
}
|
|
69
80
|
export {
|
|
70
|
-
|
|
81
|
+
re as calculateDistance,
|
|
71
82
|
ue as calculateDistanceWithRadius,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
Te as camelToKebab,
|
|
84
|
+
Pe as capitalize,
|
|
85
|
+
le as clamp,
|
|
86
|
+
Ce as cloneDeep,
|
|
87
|
+
Oe as compareObjects,
|
|
77
88
|
p as cover,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
H as createJSONAndSave,
|
|
90
|
+
ce as damp,
|
|
91
|
+
ee as debounce,
|
|
92
|
+
C as decode,
|
|
82
93
|
Z as dispatchSizeChangeEvent,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
x as dotCircleCollision,
|
|
95
|
+
f as dotRectCollision,
|
|
96
|
+
k as easeInCubic,
|
|
86
97
|
B as easeInExpo,
|
|
87
|
-
|
|
98
|
+
M as easeInOutCubic,
|
|
88
99
|
N as easeInOutExpo,
|
|
89
100
|
j as easeInOutQuad,
|
|
90
101
|
z as easeInOutQuart,
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
U as easeInOutQuint,
|
|
103
|
+
V as easeInQuad,
|
|
93
104
|
q as easeInQuart,
|
|
94
105
|
J as easeInQuint,
|
|
95
106
|
K as easeOutCubic,
|
|
96
|
-
|
|
107
|
+
$ as easeOutExpo,
|
|
97
108
|
F as easeOutQuad,
|
|
98
109
|
G as easeOutQuart,
|
|
99
110
|
W as easeOutQuint,
|
|
100
111
|
w as encode,
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
D as findParentElement,
|
|
113
|
+
T as findScrollParentElement,
|
|
103
114
|
m as fixPosition,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
Ae as generateId,
|
|
116
|
+
se as getCumulativeOffsetLeft,
|
|
117
|
+
ne as getCumulativeOffsetTop,
|
|
118
|
+
oe as getCumulativePosition,
|
|
119
|
+
P as getElement,
|
|
109
120
|
ze as getElementTransitionDurationMS,
|
|
110
|
-
|
|
121
|
+
Ue as getElementTransitionDurationS,
|
|
111
122
|
b as getPointerPosition,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
y as getRootVariables,
|
|
124
|
+
c as insert,
|
|
125
|
+
Q as isBrowser,
|
|
126
|
+
Ee as isESClass,
|
|
127
|
+
Se as isNullish,
|
|
128
|
+
Ie as isObject,
|
|
129
|
+
ke as kebabToCamel,
|
|
118
130
|
de as lerp,
|
|
119
131
|
X as linear,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
132
|
+
me as mapRange,
|
|
133
|
+
d as measureText,
|
|
134
|
+
Re as mergeDeep,
|
|
123
135
|
g as normalize,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
Qe as omit,
|
|
137
|
+
S as parseAttribute,
|
|
138
|
+
I as parseAttributeValue,
|
|
139
|
+
ve as pick,
|
|
140
|
+
be as preciseNumber,
|
|
141
|
+
pe as round,
|
|
142
|
+
ye as roundNumberTo,
|
|
131
143
|
h as screenToCartesian,
|
|
132
|
-
|
|
144
|
+
fe as smootherstep,
|
|
133
145
|
xe as smoothstep,
|
|
134
146
|
Be as snakeToDotted,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
147
|
+
he as step,
|
|
148
|
+
te as throttle,
|
|
149
|
+
Me as toPascalCase,
|
|
138
150
|
Ne as uncapitalize
|
|
139
151
|
};
|