aptechka 0.87.2 → 0.88.0
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/color/Color.d.ts +19 -0
- package/lib/color/DocumentColors.d.ts +13 -0
- package/lib/color/index.cjs +1 -0
- package/lib/color/index.d.ts +2 -0
- package/lib/color/index.js +169 -0
- package/lib/notched/index.cjs +2 -2
- package/lib/notched/index.js +4 -4
- package/lib/utils/cssom.d.ts +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +5 -4
- package/package.json +9 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class Color {
|
|
2
|
+
#private;
|
|
3
|
+
constructor(color: string);
|
|
4
|
+
get r(): number;
|
|
5
|
+
get g(): number;
|
|
6
|
+
get b(): number;
|
|
7
|
+
get a(): number;
|
|
8
|
+
get hex(): string;
|
|
9
|
+
get rgba(): {
|
|
10
|
+
r: number;
|
|
11
|
+
g: number;
|
|
12
|
+
b: number;
|
|
13
|
+
a: number;
|
|
14
|
+
};
|
|
15
|
+
mix(otherColor: Color, ratio?: number): Color;
|
|
16
|
+
toString(): string;
|
|
17
|
+
toRGBString(): string;
|
|
18
|
+
toRGBAString(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Color } from './Color';
|
|
2
|
+
export declare class DocumentColors {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
get size(): number;
|
|
6
|
+
get(variableName: string): Color | undefined;
|
|
7
|
+
getAll(): Map<string, Color>;
|
|
8
|
+
getAllAsObject(): Record<string, Color>;
|
|
9
|
+
getVariableNames(): string[];
|
|
10
|
+
refresh(): void;
|
|
11
|
+
getColor(variableName: string): Color;
|
|
12
|
+
has(variableName: string): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _hex,_rgba,_Color_instances,parseColor_fn,parseHex_fn,parseRgb_fn,setRGBA_fn,setHexFromRGBA_fn;const _Color=class _Color{constructor(color){__privateAdd(this,_Color_instances);__privateAdd(this,_hex,"");__privateAdd(this,_rgba,{r:0,g:0,b:0,a:1});__privateMethod(this,_Color_instances,parseColor_fn).call(this,color)}get r(){return __privateGet(this,_rgba).r}get g(){return __privateGet(this,_rgba).g}get b(){return __privateGet(this,_rgba).b}get a(){return __privateGet(this,_rgba).a}get hex(){return __privateGet(this,_hex)}get rgba(){return __spreadValues({},__privateGet(this,_rgba))}mix(otherColor,ratio=.5){if(!(otherColor instanceof _Color))throw new Error("Argument must be an instance of Color");if(ratio<0||ratio>1)throw new Error("Ratio must be between 0 and 1");const r=Math.round(this.r*(1-ratio)+otherColor.r*ratio),g=Math.round(this.g*(1-ratio)+otherColor.g*ratio),b=Math.round(this.b*(1-ratio)+otherColor.b*ratio),a=this.a*(1-ratio)+otherColor.a*ratio;return new _Color(`rgba(${r}, ${g}, ${b}, ${a})`)}toString(){return this.a===1?this.hex:`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}toRGBString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}toRGBAString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}};_hex=new WeakMap,_rgba=new WeakMap,_Color_instances=new WeakSet,parseColor_fn=__name(function(color){if(typeof color!="string")throw new Error("Color must be a string");const trimmedColor=color.trim().toLowerCase();if(trimmedColor.startsWith("#"))__privateMethod(this,_Color_instances,parseHex_fn).call(this,trimmedColor);else if(trimmedColor.startsWith("rgb"))__privateMethod(this,_Color_instances,parseRgb_fn).call(this,trimmedColor);else throw new Error("Unsupported color format. Use hex, rgb, or rgba.")},"#parseColor"),parseHex_fn=__name(function(hexColor){let hex=hexColor.replace("#","");if(hex.length===3&&(hex=hex.split("").map(char=>char+char).join("")),hex.length===8){const r=parseInt(hex.substring(0,2),16),g=parseInt(hex.substring(2,4),16),b=parseInt(hex.substring(4,6),16),a=parseInt(hex.substring(6,8),16)/255;__privateMethod(this,_Color_instances,setRGBA_fn).call(this,r,g,b,a),__privateMethod(this,_Color_instances,setHexFromRGBA_fn).call(this);return}if(hex.length===6){const r=parseInt(hex.substring(0,2),16),g=parseInt(hex.substring(2,4),16),b=parseInt(hex.substring(4,6),16);__privateMethod(this,_Color_instances,setRGBA_fn).call(this,r,g,b,1),__privateMethod(this,_Color_instances,setHexFromRGBA_fn).call(this);return}throw new Error("Invalid HEX color format")},"#parseHex"),parseRgb_fn=__name(function(rgbColor){const match=rgbColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!match)throw new Error("Invalid RGB/RGBA color format");const r=Math.max(0,Math.min(255,parseInt(match[1]))),g=Math.max(0,Math.min(255,parseInt(match[2]))),b=Math.max(0,Math.min(255,parseInt(match[3]))),a=match[4]?Math.max(0,Math.min(1,parseFloat(match[4]))):1;__privateMethod(this,_Color_instances,setRGBA_fn).call(this,r,g,b,a),__privateMethod(this,_Color_instances,setHexFromRGBA_fn).call(this)},"#parseRgb"),setRGBA_fn=__name(function(r,g,b,a){__privateSet(this,_rgba,{r:Math.round(r),g:Math.round(g),b:Math.round(b),a:Math.round(a*100)/100})},"#setRGBA"),setHexFromRGBA_fn=__name(function(){const{r,g,b,a}=__privateGet(this,_rgba),hexR=r.toString(16).padStart(2,"0"),hexG=g.toString(16).padStart(2,"0"),hexB=b.toString(16).padStart(2,"0");if(__privateSet(this,_hex,`#${hexR}${hexG}${hexB}`),a<1){const hexA=Math.round(a*255).toString(16).padStart(2,"0");__privateSet(this,_hex,__privateGet(this,_hex)+hexA)}},"#setHexFromRGBA"),__name(_Color,"Color");let Color=_Color;var _colorMap,_DocumentColors_instances,collectColors_fn;const _DocumentColors=class _DocumentColors{constructor(){__privateAdd(this,_DocumentColors_instances);__privateAdd(this,_colorMap);__privateSet(this,_colorMap,new Map),__privateMethod(this,_DocumentColors_instances,collectColors_fn).call(this)}get size(){return __privateGet(this,_colorMap).size}get(variableName){return __privateGet(this,_colorMap).get(variableName)}getAll(){return new Map(__privateGet(this,_colorMap))}getAllAsObject(){const result={};return __privateGet(this,_colorMap).forEach((color,variableName)=>{result[variableName]=color}),result}getVariableNames(){return Array.from(__privateGet(this,_colorMap).keys())}refresh(){__privateGet(this,_colorMap).clear(),__privateMethod(this,_DocumentColors_instances,collectColors_fn).call(this)}getColor(variableName){const color=__privateGet(this,_colorMap).get(variableName);if(!color)throw new Error(`Цветовая переменная ${variableName} не найдена`);return color}has(variableName){return __privateGet(this,_colorMap).has(variableName)}};_colorMap=new WeakMap,_DocumentColors_instances=new WeakSet,collectColors_fn=__name(function(){const styles=getComputedStyle(document.documentElement);Array.from(document.styleSheets).forEach(stylesheet=>{Array.from(stylesheet.cssRules).forEach(rule=>{rule instanceof CSSStyleRule&&rule.selectorText==="html"&&Array.from(rule.style).forEach(variableName=>{const value=styles.getPropertyValue(variableName).trim();try{const color=new Color(value);__privateGet(this,_colorMap).set(variableName,color)}catch(error){console.warn(`Не удалось распарсить цвет ${variableName}: ${value}`,error)}})})})},"#collectColors"),__name(_DocumentColors,"DocumentColors");let DocumentColors=_DocumentColors;exports.Color=Color;exports.DocumentColors=DocumentColors;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __typeError = (msg) => {
|
|
5
|
+
throw TypeError(msg);
|
|
6
|
+
};
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b))
|
|
12
|
+
__propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
13
|
+
return a;
|
|
14
|
+
};
|
|
15
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
16
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
17
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
18
|
+
var _hex, _rgba, _Color_instances, parseColor_fn, parseHex_fn, parseRgb_fn, setRGBA_fn, setHexFromRGBA_fn;
|
|
19
|
+
const _Color = class _Color {
|
|
20
|
+
constructor(color) {
|
|
21
|
+
__privateAdd(this, _Color_instances);
|
|
22
|
+
__privateAdd(this, _hex, "");
|
|
23
|
+
__privateAdd(this, _rgba, { r: 0, g: 0, b: 0, a: 1 });
|
|
24
|
+
__privateMethod(this, _Color_instances, parseColor_fn).call(this, color);
|
|
25
|
+
}
|
|
26
|
+
get r() {
|
|
27
|
+
return __privateGet(this, _rgba).r;
|
|
28
|
+
}
|
|
29
|
+
get g() {
|
|
30
|
+
return __privateGet(this, _rgba).g;
|
|
31
|
+
}
|
|
32
|
+
get b() {
|
|
33
|
+
return __privateGet(this, _rgba).b;
|
|
34
|
+
}
|
|
35
|
+
get a() {
|
|
36
|
+
return __privateGet(this, _rgba).a;
|
|
37
|
+
}
|
|
38
|
+
get hex() {
|
|
39
|
+
return __privateGet(this, _hex);
|
|
40
|
+
}
|
|
41
|
+
get rgba() {
|
|
42
|
+
return __spreadValues({}, __privateGet(this, _rgba));
|
|
43
|
+
}
|
|
44
|
+
mix(otherColor, ratio = 0.5) {
|
|
45
|
+
if (!(otherColor instanceof _Color))
|
|
46
|
+
throw new Error("Argument must be an instance of Color");
|
|
47
|
+
if (ratio < 0 || ratio > 1)
|
|
48
|
+
throw new Error("Ratio must be between 0 and 1");
|
|
49
|
+
const r = Math.round(this.r * (1 - ratio) + otherColor.r * ratio), g = Math.round(this.g * (1 - ratio) + otherColor.g * ratio), b = Math.round(this.b * (1 - ratio) + otherColor.b * ratio), a = this.a * (1 - ratio) + otherColor.a * ratio;
|
|
50
|
+
return new _Color(`rgba(${r}, ${g}, ${b}, ${a})`);
|
|
51
|
+
}
|
|
52
|
+
toString() {
|
|
53
|
+
return this.a === 1 ? this.hex : `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;
|
|
54
|
+
}
|
|
55
|
+
toRGBString() {
|
|
56
|
+
return `rgb(${this.r}, ${this.g}, ${this.b})`;
|
|
57
|
+
}
|
|
58
|
+
toRGBAString() {
|
|
59
|
+
return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
_hex = new WeakMap(), _rgba = new WeakMap(), _Color_instances = new WeakSet(), parseColor_fn = /* @__PURE__ */ __name(function(color) {
|
|
63
|
+
if (typeof color != "string")
|
|
64
|
+
throw new Error("Color must be a string");
|
|
65
|
+
const trimmedColor = color.trim().toLowerCase();
|
|
66
|
+
if (trimmedColor.startsWith("#"))
|
|
67
|
+
__privateMethod(this, _Color_instances, parseHex_fn).call(this, trimmedColor);
|
|
68
|
+
else if (trimmedColor.startsWith("rgb"))
|
|
69
|
+
__privateMethod(this, _Color_instances, parseRgb_fn).call(this, trimmedColor);
|
|
70
|
+
else
|
|
71
|
+
throw new Error("Unsupported color format. Use hex, rgb, or rgba.");
|
|
72
|
+
}, "#parseColor"), parseHex_fn = /* @__PURE__ */ __name(function(hexColor) {
|
|
73
|
+
let hex = hexColor.replace("#", "");
|
|
74
|
+
if (hex.length === 3 && (hex = hex.split("").map((char) => char + char).join("")), hex.length === 8) {
|
|
75
|
+
const r = parseInt(hex.substring(0, 2), 16), g = parseInt(hex.substring(2, 4), 16), b = parseInt(hex.substring(4, 6), 16), a = parseInt(hex.substring(6, 8), 16) / 255;
|
|
76
|
+
__privateMethod(this, _Color_instances, setRGBA_fn).call(this, r, g, b, a), __privateMethod(this, _Color_instances, setHexFromRGBA_fn).call(this);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (hex.length === 6) {
|
|
80
|
+
const r = parseInt(hex.substring(0, 2), 16), g = parseInt(hex.substring(2, 4), 16), b = parseInt(hex.substring(4, 6), 16);
|
|
81
|
+
__privateMethod(this, _Color_instances, setRGBA_fn).call(this, r, g, b, 1), __privateMethod(this, _Color_instances, setHexFromRGBA_fn).call(this);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
throw new Error("Invalid HEX color format");
|
|
85
|
+
}, "#parseHex"), parseRgb_fn = /* @__PURE__ */ __name(function(rgbColor) {
|
|
86
|
+
const match = rgbColor.match(
|
|
87
|
+
/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
|
|
88
|
+
);
|
|
89
|
+
if (!match)
|
|
90
|
+
throw new Error("Invalid RGB/RGBA color format");
|
|
91
|
+
const r = Math.max(0, Math.min(255, parseInt(match[1]))), g = Math.max(0, Math.min(255, parseInt(match[2]))), b = Math.max(0, Math.min(255, parseInt(match[3]))), a = match[4] ? Math.max(0, Math.min(1, parseFloat(match[4]))) : 1;
|
|
92
|
+
__privateMethod(this, _Color_instances, setRGBA_fn).call(this, r, g, b, a), __privateMethod(this, _Color_instances, setHexFromRGBA_fn).call(this);
|
|
93
|
+
}, "#parseRgb"), setRGBA_fn = /* @__PURE__ */ __name(function(r, g, b, a) {
|
|
94
|
+
__privateSet(this, _rgba, {
|
|
95
|
+
r: Math.round(r),
|
|
96
|
+
g: Math.round(g),
|
|
97
|
+
b: Math.round(b),
|
|
98
|
+
a: Math.round(a * 100) / 100
|
|
99
|
+
});
|
|
100
|
+
}, "#setRGBA"), setHexFromRGBA_fn = /* @__PURE__ */ __name(function() {
|
|
101
|
+
const { r, g, b, a } = __privateGet(this, _rgba), hexR = r.toString(16).padStart(2, "0"), hexG = g.toString(16).padStart(2, "0"), hexB = b.toString(16).padStart(2, "0");
|
|
102
|
+
if (__privateSet(this, _hex, `#${hexR}${hexG}${hexB}`), a < 1) {
|
|
103
|
+
const hexA = Math.round(a * 255).toString(16).padStart(2, "0");
|
|
104
|
+
__privateSet(this, _hex, __privateGet(this, _hex) + hexA);
|
|
105
|
+
}
|
|
106
|
+
}, "#setHexFromRGBA"), __name(_Color, "Color");
|
|
107
|
+
let Color = _Color;
|
|
108
|
+
var _colorMap, _DocumentColors_instances, collectColors_fn;
|
|
109
|
+
const _DocumentColors = class _DocumentColors {
|
|
110
|
+
constructor() {
|
|
111
|
+
__privateAdd(this, _DocumentColors_instances);
|
|
112
|
+
__privateAdd(this, _colorMap);
|
|
113
|
+
__privateSet(this, _colorMap, /* @__PURE__ */ new Map()), __privateMethod(this, _DocumentColors_instances, collectColors_fn).call(this);
|
|
114
|
+
}
|
|
115
|
+
get size() {
|
|
116
|
+
return __privateGet(this, _colorMap).size;
|
|
117
|
+
}
|
|
118
|
+
get(variableName) {
|
|
119
|
+
return __privateGet(this, _colorMap).get(variableName);
|
|
120
|
+
}
|
|
121
|
+
getAll() {
|
|
122
|
+
return new Map(__privateGet(this, _colorMap));
|
|
123
|
+
}
|
|
124
|
+
getAllAsObject() {
|
|
125
|
+
const result = {};
|
|
126
|
+
return __privateGet(this, _colorMap).forEach((color, variableName) => {
|
|
127
|
+
result[variableName] = color;
|
|
128
|
+
}), result;
|
|
129
|
+
}
|
|
130
|
+
getVariableNames() {
|
|
131
|
+
return Array.from(__privateGet(this, _colorMap).keys());
|
|
132
|
+
}
|
|
133
|
+
refresh() {
|
|
134
|
+
__privateGet(this, _colorMap).clear(), __privateMethod(this, _DocumentColors_instances, collectColors_fn).call(this);
|
|
135
|
+
}
|
|
136
|
+
getColor(variableName) {
|
|
137
|
+
const color = __privateGet(this, _colorMap).get(variableName);
|
|
138
|
+
if (!color)
|
|
139
|
+
throw new Error(`Цветовая переменная ${variableName} не найдена`);
|
|
140
|
+
return color;
|
|
141
|
+
}
|
|
142
|
+
has(variableName) {
|
|
143
|
+
return __privateGet(this, _colorMap).has(variableName);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
_colorMap = new WeakMap(), _DocumentColors_instances = new WeakSet(), collectColors_fn = /* @__PURE__ */ __name(function() {
|
|
147
|
+
const styles = getComputedStyle(document.documentElement);
|
|
148
|
+
Array.from(document.styleSheets).forEach((stylesheet) => {
|
|
149
|
+
Array.from(stylesheet.cssRules).forEach((rule) => {
|
|
150
|
+
rule instanceof CSSStyleRule && rule.selectorText === "html" && Array.from(rule.style).forEach((variableName) => {
|
|
151
|
+
const value = styles.getPropertyValue(variableName).trim();
|
|
152
|
+
try {
|
|
153
|
+
const color = new Color(value);
|
|
154
|
+
__privateGet(this, _colorMap).set(variableName, color);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
console.warn(
|
|
157
|
+
`Не удалось распарсить цвет ${variableName}: ${value}`,
|
|
158
|
+
error
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}, "#collectColors"), __name(_DocumentColors, "DocumentColors");
|
|
165
|
+
let DocumentColors = _DocumentColors;
|
|
166
|
+
export {
|
|
167
|
+
Color,
|
|
168
|
+
DocumentColors
|
|
169
|
+
};
|
package/lib/notched/index.cjs
CHANGED
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
a ${cornerRadius} ${cornerRadius} 0 0 1 ${arcSectionLength} -${arcSectionLength}
|
|
45
45
|
c ${c} ${-d}
|
|
46
46
|
${b+c} ${-d}
|
|
47
|
-
${a+b+c} ${-d}`:rounded`l 0 ${-p}`}__name(drawTopLeftPath,"drawTopLeftPath");function toRadians(degrees){return degrees*Math.PI/180}__name(toRadians,"toRadians");function rounded(strings,...values){return strings.reduce((acc,str,i)=>{const value=values[i];return typeof value=="number"?acc+str+value.toFixed(4):acc+str+(value!=null?value:"")},"")}__name(rounded,"rounded");function getSvgPath({cornerRadius=0,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha=90,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing=!1,topNotches,rightNotches,bottomNotches,leftNotches,width,height}){if(topLeftCornerRadius=topLeftCornerRadius!=null?topLeftCornerRadius:cornerRadius,topRightCornerRadius=topRightCornerRadius!=null?topRightCornerRadius:cornerRadius,bottomLeftCornerRadius=bottomLeftCornerRadius!=null?bottomLeftCornerRadius:cornerRadius,bottomRightCornerRadius=bottomRightCornerRadius!=null?bottomRightCornerRadius:cornerRadius,topLeftCornerAngleAlpha=topLeftCornerAngleAlpha!=null?topLeftCornerAngleAlpha:cornerAngleAlpha,topRightCornerAngleAlpha=topRightCornerAngleAlpha!=null?topRightCornerAngleAlpha:cornerAngleAlpha,bottomLeftCornerAngleAlpha=bottomLeftCornerAngleAlpha!=null?bottomLeftCornerAngleAlpha:cornerAngleAlpha,bottomRightCornerAngleAlpha=bottomRightCornerAngleAlpha!=null?bottomRightCornerAngleAlpha:cornerAngleAlpha,topLeftCornerRadius===topRightCornerRadius&&topRightCornerRadius===bottomRightCornerRadius&&bottomRightCornerRadius===bottomLeftCornerRadius&&bottomLeftCornerRadius===topLeftCornerRadius&&topLeftCornerAngleAlpha===topRightCornerAngleAlpha&&topRightCornerAngleAlpha===bottomRightCornerAngleAlpha&&bottomRightCornerAngleAlpha===bottomLeftCornerAngleAlpha&&bottomLeftCornerAngleAlpha===topLeftCornerAngleAlpha){const roundingAndSmoothingBudget=Math.min(width,height)/2,cornerRadius2=Math.min(topLeftCornerRadius,roundingAndSmoothingBudget),pathParams=getPathParamsForCorner({cornerRadius:cornerRadius2,cornerSmoothing,cornerAngleAlpha,preserveSmoothing,roundingAndSmoothingBudget});return getSVGPathFromPathParams({width,height,topLeftPathParams:pathParams,topRightPathParams:pathParams,bottomLeftPathParams:pathParams,bottomRightPathParams:pathParams,topNotches,rightNotches,bottomNotches,leftNotches})}const{topLeft,topRight,bottomLeft,bottomRight}=distributeAndNormalize({topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,width,height});return getSVGPathFromPathParams({width,height,topLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topLeft.radius,roundingAndSmoothingBudget:topLeft.roundingAndSmoothingBudget,cornerAngleAlpha:topLeftCornerAngleAlpha}),topRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topRight.radius,roundingAndSmoothingBudget:topRight.roundingAndSmoothingBudget,cornerAngleAlpha:topRightCornerAngleAlpha}),bottomRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomRight.radius,roundingAndSmoothingBudget:bottomRight.roundingAndSmoothingBudget,cornerAngleAlpha:bottomRightCornerAngleAlpha}),bottomLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomLeft.radius,roundingAndSmoothingBudget:bottomLeft.roundingAndSmoothingBudget,cornerAngleAlpha:bottomLeftCornerAngleAlpha}),topNotches,rightNotches,bottomNotches,leftNotches})}__name(getSvgPath,"getSvgPath");var _svgElement,_pathElement,_resizeListener,_NotchedElement_instances,parseCSSNotchValue_fn;const _NotchedElement=class _NotchedElement extends HTMLElement{constructor(){super();__privateAdd(this,_NotchedElement_instances);__privateAdd(this,_svgElement);__privateAdd(this,_pathElement);__privateAdd(this,_resizeListener,__name(()=>{const width=this.offsetWidth,height=this.offsetHeight,computed=getComputedStyle(this);__privateGet(this,_svgElement).setAttributeNS("http://www.w3.org/2000/svg","viewBox",`0 0 ${width} ${height}`);const cornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-corner-radius")),topLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-left-corner-radius")),topRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-right-corner-radius")),bottomRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-right-corner-radius")),bottomLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-left-corner-radius")),cornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-corner-angle-alpha"))||void 0,topLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-left-corner-angle-alpha"))||void 0,topRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-right-corner-angle-alpha"))||void 0,bottomRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-right-corner-angle-alpha"))||void 0,bottomLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-left-corner-angle-alpha"))||void 0,cornerSmoothing=parseFloat(computed.getPropertyValue("--notched-corner-smoothing"))||0,preserveSmoothing=computed.getPropertyValue("--notched-preserve-smoothing")!=="false",topNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-top-notches")),rightNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-right-notches")),bottomNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-bottom-notches")),leftNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-left-notches")),
|
|
47
|
+
${a+b+c} ${-d}`:rounded`l 0 ${-p}`}__name(drawTopLeftPath,"drawTopLeftPath");function toRadians(degrees){return degrees*Math.PI/180}__name(toRadians,"toRadians");function rounded(strings,...values){return strings.reduce((acc,str,i)=>{const value=values[i];return typeof value=="number"?acc+str+value.toFixed(4):acc+str+(value!=null?value:"")},"")}__name(rounded,"rounded");function getSvgPath({cornerRadius=0,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha=90,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing=!1,topNotches,rightNotches,bottomNotches,leftNotches,width,height}){if(topLeftCornerRadius=topLeftCornerRadius!=null?topLeftCornerRadius:cornerRadius,topRightCornerRadius=topRightCornerRadius!=null?topRightCornerRadius:cornerRadius,bottomLeftCornerRadius=bottomLeftCornerRadius!=null?bottomLeftCornerRadius:cornerRadius,bottomRightCornerRadius=bottomRightCornerRadius!=null?bottomRightCornerRadius:cornerRadius,topLeftCornerAngleAlpha=topLeftCornerAngleAlpha!=null?topLeftCornerAngleAlpha:cornerAngleAlpha,topRightCornerAngleAlpha=topRightCornerAngleAlpha!=null?topRightCornerAngleAlpha:cornerAngleAlpha,bottomLeftCornerAngleAlpha=bottomLeftCornerAngleAlpha!=null?bottomLeftCornerAngleAlpha:cornerAngleAlpha,bottomRightCornerAngleAlpha=bottomRightCornerAngleAlpha!=null?bottomRightCornerAngleAlpha:cornerAngleAlpha,topLeftCornerRadius===topRightCornerRadius&&topRightCornerRadius===bottomRightCornerRadius&&bottomRightCornerRadius===bottomLeftCornerRadius&&bottomLeftCornerRadius===topLeftCornerRadius&&topLeftCornerAngleAlpha===topRightCornerAngleAlpha&&topRightCornerAngleAlpha===bottomRightCornerAngleAlpha&&bottomRightCornerAngleAlpha===bottomLeftCornerAngleAlpha&&bottomLeftCornerAngleAlpha===topLeftCornerAngleAlpha){const roundingAndSmoothingBudget=Math.min(width,height)/2,cornerRadius2=Math.min(topLeftCornerRadius,roundingAndSmoothingBudget),pathParams=getPathParamsForCorner({cornerRadius:cornerRadius2,cornerSmoothing,cornerAngleAlpha,preserveSmoothing,roundingAndSmoothingBudget});return getSVGPathFromPathParams({width,height,topLeftPathParams:pathParams,topRightPathParams:pathParams,bottomLeftPathParams:pathParams,bottomRightPathParams:pathParams,topNotches,rightNotches,bottomNotches,leftNotches})}const{topLeft,topRight,bottomLeft,bottomRight}=distributeAndNormalize({topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,width,height});return getSVGPathFromPathParams({width,height,topLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topLeft.radius,roundingAndSmoothingBudget:topLeft.roundingAndSmoothingBudget,cornerAngleAlpha:topLeftCornerAngleAlpha}),topRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topRight.radius,roundingAndSmoothingBudget:topRight.roundingAndSmoothingBudget,cornerAngleAlpha:topRightCornerAngleAlpha}),bottomRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomRight.radius,roundingAndSmoothingBudget:bottomRight.roundingAndSmoothingBudget,cornerAngleAlpha:bottomRightCornerAngleAlpha}),bottomLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomLeft.radius,roundingAndSmoothingBudget:bottomLeft.roundingAndSmoothingBudget,cornerAngleAlpha:bottomLeftCornerAngleAlpha}),topNotches,rightNotches,bottomNotches,leftNotches})}__name(getSvgPath,"getSvgPath");var _svgElement,_pathElement,_resizeListener,_NotchedElement_instances,parseCSSNotchValue_fn;const _NotchedElement=class _NotchedElement extends HTMLElement{constructor(){super();__privateAdd(this,_NotchedElement_instances);__privateAdd(this,_svgElement);__privateAdd(this,_pathElement);__privateAdd(this,_resizeListener,__name(()=>{const width=this.offsetWidth,height=this.offsetHeight,computed=getComputedStyle(this);__privateGet(this,_svgElement).setAttributeNS("http://www.w3.org/2000/svg","viewBox",`0 0 ${width} ${height}`);const cornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-corner-radius")),topLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-left-corner-radius")),topRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-right-corner-radius")),bottomRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-right-corner-radius")),bottomLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-left-corner-radius")),cornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-corner-angle-alpha"))||void 0,topLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-left-corner-angle-alpha"))||void 0,topRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-right-corner-angle-alpha"))||void 0,bottomRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-right-corner-angle-alpha"))||void 0,bottomLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-left-corner-angle-alpha"))||void 0,cornerSmoothing=parseFloat(computed.getPropertyValue("--notched-corner-smoothing"))||0,preserveSmoothing=computed.getPropertyValue("--notched-preserve-smoothing")!=="false",topNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-top-notches")),rightNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-right-notches")),bottomNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-bottom-notches")),leftNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-left-notches")),fill=computed.getPropertyValue("--notched-fill"),path=getSvgPath({cornerRadius,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing,topNotches,rightNotches,bottomNotches,leftNotches,width,height});__privateGet(this,_pathElement).setAttribute("d",path),fill&&__privateGet(this,_pathElement).setAttribute("fill",fill)},"#resizeListener"));const clipContent=this.hasAttribute("clip-content"),clipId=this.hasAttribute("clip")||clipContent?"clip-"+string.generateId(10):null,tmpElement=document.createElement("div");tmpElement.innerHTML=`
|
|
48
48
|
<svg xmlns="http://www.w3.org/2000/svg">
|
|
49
49
|
${clipId?`<clipPath id="${clipId}">`:""}
|
|
50
50
|
<path></path>
|
|
51
51
|
${clipId?"</clipPath>":""}
|
|
52
52
|
</svg>
|
|
53
53
|
<slot></slot>
|
|
54
|
-
`,clipId&&(this.style.clipPath=`url(#${clipId})`),this.style.position="relative",__privateSet(this,_svgElement,tmpElement.querySelector("svg")),__privateGet(this,_svgElement).style.cssText=`
|
|
54
|
+
`,clipId&&(clipContent&&this.firstElementChild instanceof HTMLElement?this.firstElementChild.style.clipPath=`url(#${clipId})`:this.style.clipPath=`url(#${clipId})`),this.style.position="relative",__privateSet(this,_svgElement,tmpElement.querySelector("svg")),__privateGet(this,_svgElement).style.cssText=`
|
|
55
55
|
position: absolute;
|
|
56
56
|
top: 0;
|
|
57
57
|
left: 0;
|
package/lib/notched/index.js
CHANGED
|
@@ -404,7 +404,7 @@ const _NotchedElement = class _NotchedElement extends HTMLElement {
|
|
|
404
404
|
computed.getPropertyValue("--notched-bottom-right-corner-angle-alpha")
|
|
405
405
|
) || void 0, bottomLeftCornerAngleAlpha = parseFloat(
|
|
406
406
|
computed.getPropertyValue("--notched-bottom-left-corner-angle-alpha")
|
|
407
|
-
) || void 0, cornerSmoothing = parseFloat(computed.getPropertyValue("--notched-corner-smoothing")) || 0, preserveSmoothing = computed.getPropertyValue("--notched-preserve-smoothing") !== "false", topNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-top-notches")), rightNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-right-notches")), bottomNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-bottom-notches")), leftNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-left-notches")),
|
|
407
|
+
) || void 0, cornerSmoothing = parseFloat(computed.getPropertyValue("--notched-corner-smoothing")) || 0, preserveSmoothing = computed.getPropertyValue("--notched-preserve-smoothing") !== "false", topNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-top-notches")), rightNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-right-notches")), bottomNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-bottom-notches")), leftNotches = __privateMethod(this, _NotchedElement_instances, parseCSSNotchValue_fn).call(this, computed.getPropertyValue("--notched-left-notches")), fill = computed.getPropertyValue("--notched-fill"), path = getSvgPath({
|
|
408
408
|
cornerRadius,
|
|
409
409
|
topLeftCornerRadius,
|
|
410
410
|
topRightCornerRadius,
|
|
@@ -424,9 +424,9 @@ const _NotchedElement = class _NotchedElement extends HTMLElement {
|
|
|
424
424
|
width,
|
|
425
425
|
height
|
|
426
426
|
});
|
|
427
|
-
__privateGet(this, _pathElement).setAttribute("d", path),
|
|
427
|
+
__privateGet(this, _pathElement).setAttribute("d", path), fill && __privateGet(this, _pathElement).setAttribute("fill", fill);
|
|
428
428
|
}, "#resizeListener"));
|
|
429
|
-
const clipId = this.hasAttribute("clip") ? "clip-" + generateId(10) : null, tmpElement = document.createElement("div");
|
|
429
|
+
const clipContent = this.hasAttribute("clip-content"), clipId = this.hasAttribute("clip") || clipContent ? "clip-" + generateId(10) : null, tmpElement = document.createElement("div");
|
|
430
430
|
tmpElement.innerHTML = `
|
|
431
431
|
<svg xmlns="http://www.w3.org/2000/svg">
|
|
432
432
|
${clipId ? `<clipPath id="${clipId}">` : ""}
|
|
@@ -434,7 +434,7 @@ const _NotchedElement = class _NotchedElement extends HTMLElement {
|
|
|
434
434
|
${clipId ? "</clipPath>" : ""}
|
|
435
435
|
</svg>
|
|
436
436
|
<slot></slot>
|
|
437
|
-
`, clipId && (this.style.clipPath = `url(#${clipId})`), this.style.position = "relative", __privateSet(this, _svgElement, tmpElement.querySelector("svg")), __privateGet(this, _svgElement).style.cssText = `
|
|
437
|
+
`, clipId && (clipContent && this.firstElementChild instanceof HTMLElement ? this.firstElementChild.style.clipPath = `url(#${clipId})` : this.style.clipPath = `url(#${clipId})`), this.style.position = "relative", __privateSet(this, _svgElement, tmpElement.querySelector("svg")), __privateGet(this, _svgElement).style.cssText = `
|
|
438
438
|
position: absolute;
|
|
439
439
|
top: 0;
|
|
440
440
|
left: 0;
|
package/lib/utils/cssom.d.ts
CHANGED
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const attributes=require("../attributes-BADnRZpK.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),canvas=require("../canvas-BP1ceie3.cjs"),coordinates=require("../coordinates-DQ9XV9M1.cjs"),customElements=require("../custom-elements-BfZCJde6.cjs"),dom=require("../dom-B40i6NXw.cjs"),easings=require("../easings-BWq0pPLq.cjs"),element=require("../element-CqD0jqBJ.cjs"),events=require("../events-UlGk63iC.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),stylesheet=require("../stylesheet-xM7sMeuo.cjs"),layout=require("../layout-CnGLl7oe.cjs"),math=require("../math-C-knY2TL.cjs"),metadata=require("../metadata-BrHUfpV9.cjs"),morph=require("../morph-Buhxq-X0.cjs"),number=require("../number-Bu4sGvW7.cjs"),object=require("../object-DTY_W6xG.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-BtUpTUwr.cjs"),string=require("../string-CbRNzmd9.cjs"),style=require("../style-IDJ6db6n.cjs"),url=require("../url-CPCO10Sy.cjs");function insert(arr,index,...newItems){return[...arr.slice(0,index),...newItems,...arr.slice(index)]}__name(insert,"insert");function shiftArray(arr,positions){const len=arr.length;positions=positions%len;const result=new Array(len);for(let i=0;i<len;i++){const newPos=(i+positions)%len;result[newPos]=arr[i]}return result}__name(shiftArray,"shiftArray");function formatBytes(bytes,decimals=2){if(!+bytes)return"0 Bytes";const k=1024,dm=decimals<0?0:decimals,sizes=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(bytes)/Math.log(k));return`${parseFloat((bytes/Math.pow(k,i)).toFixed(dm))} ${sizes[i]}`}__name(formatBytes,"formatBytes");function copyTextToClipboard(text){if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(err=>{console.error("Failed to copy text to clipboard:",err)});else{const textArea=document.createElement("textarea");textArea.value=text,textArea.style.position="fixed",textArea.style.top="0",textArea.style.left="0",document.body.appendChild(textArea),textArea.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(err){console.error("Failed to copy text to clipboard:",err)}document.body.removeChild(textArea)}}__name(copyTextToClipboard,"copyTextToClipboard");function dotRectCollision(dot,rect){return dot.x<rect.x+rect.width&&dot.x>rect.x&&dot.y<rect.y+rect.height&&dot.y>rect.y}__name(dotRectCollision,"dotRectCollision");function dotCircleCollision(dot,circle){return Math.sqrt((dot.x-circle.x)**2+(dot.y-circle.y)**2)<circle.radius}__name(dotCircleCollision,"dotCircleCollision");function dotPolygonCollision(dot,polygon){let inside=!1;const{x,y}=dot;for(let i=0,j=polygon.length-1;i<polygon.length;j=i++){const xi=polygon[i].x,yi=polygon[i].y,xj=polygon[j].x,yj=polygon[j].y;yi>y!=yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi&&(inside=!inside)}return inside}__name(dotPolygonCollision,"dotPolygonCollision");function rgbToHex(r,g,b){const toHex=__name(c=>{const hex=c.toString(16);return hex.length===1?"0"+hex:hex},"toHex");return`#${toHex(r)}${toHex(g)}${toHex(b)}`}__name(rgbToHex,"rgbToHex");function getActualValue(rule,name){const obj=rule.style.getPropertyValue(name);if(obj){const stringValue=obj.toString();return stringValue.startsWith("var")?getActualValue(rule,stringValue.slice(4,-1)):stringValue}}__name(getActualValue,"getActualValue");function getRootVariables(...names){const variables={};return Array.from(document.styleSheets).forEach(stylesheet2=>{Array.from(stylesheet2.cssRules).forEach(rule=>{rule instanceof CSSStyleRule&&rule.selectorText===":root"&&names.forEach(name=>{const value=getActualValue(rule,name);value&&(variables[name]=value)})})}),names.forEach(name=>{variables[name]||console.warn(`variable named ${name} not found`)}),variables}__name(getRootVariables,"getRootVariables");function encode(string2){const decodedStr=window.atob(string2);return decodeURIComponent(window.escape(decodedStr))}__name(encode,"encode");function decode(string2){const encodedStr=window.unescape(encodeURIComponent(string2));return window.btoa(encodedStr)}__name(decode,"decode");const phoneRegex=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,emailRegex=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function tryCreateHrefFromContact(contact){let href,type;return emailRegex.test(contact)?(href=`mailto:${contact.trim()}`,type="email"):phoneRegex.test(contact)&&(href=`tel:${contact.replace(/[^0-9\\.\\+]+/g,"")}`,type="phone"),{href,type,contact}}__name(tryCreateHrefFromContact,"tryCreateHrefFromContact");function transliterate(text,options={}){const{separator="-",lowercase=!0,replaceNumbers=!0,maxLength=60}=options,charMap={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"",ы:"y",ь:"",э:"e",ю:"yu",я:"ya"};let result=text.replace(/[а-яё]/gi,char=>{const lowerChar=char.toLowerCase(),replacement=charMap[lowerChar]||"";return char===lowerChar?replacement:replacement.toUpperCase()});if(replaceNumbers){const numberMap={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};result=result.replace(/[0-9]/g,num=>numberMap[num]||num)}return lowercase&&(result=result.toLowerCase()),result=result.replace(/[^\w\-]+/g,separator).replace(new RegExp(`\\${separator}+`,"g"),separator).replace(new RegExp(`(^\\${separator}|\\${separator}$)`,"g"),""),maxLength>0&&result.length>maxLength&&(result=result.substring(0,maxLength).replace(new RegExp(`\\${separator}[^\\${separator}]*$`),"")),result}__name(transliterate,"transliterate");function requestLoadingCallback(event,callback){let idleId;const domListener=__name(()=>{window.removeEventListener("DOMContentLoaded",loadListener),callback()},"domListener"),loadListener=__name(()=>{window.removeEventListener("load",loadListener),callback()},"loadListener"),idleListener=__name(()=>{idleId=void 0,callback()},"idleListener"),clear=__name(()=>{window.removeEventListener("DOMContentLoaded",domListener),window.removeEventListener("load",loadListener),idleId&&window.cancelIdleCallback&&window.cancelIdleCallback(idleId)},"clear");return event==="idle"&&window.requestIdleCallback?idleId=window.requestIdleCallback(idleListener,{timeout:1e4}):event==="load"?document.readyState==="complete"?loadListener():window.addEventListener("load",loadListener):event==="DOMContentLoaded"&&window.addEventListener("DOMContentLoaded",domListener),clear}__name(requestLoadingCallback,"requestLoadingCallback");function setElementsProgress(progress,elements,initialItemsWithFullProgress=0){const totalItems=elements.length-initialItemsWithFullProgress;elements.forEach((el,index)=>{const offset=index/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));el.style.setProperty("--item-progress",itemProgress.toString())})}__name(setElementsProgress,"setElementsProgress");function setActiveContentClasses(index,elements){elements.forEach((el,i)=>{i>index?(el.classList.remove("current","previous"),el.classList.add("next")):i<index?(el.classList.remove("current","next"),el.classList.add("previous")):(el.classList.remove("previous","next"),el.classList.add("current"))})}__name(setActiveContentClasses,"setActiveContentClasses");function cloneTemplateContent(templateElement,callback){if(templateElement){const element2=templateElement.content.cloneNode(!0).firstElementChild;return element2&&(callback==null||callback(element2)),element2}return null}__name(cloneTemplateContent,"cloneTemplateContent");function setIntervalOnIntersection(element2,delay,callback,options){let intervalId,isIntersecting=!1,current=0,previous=0,tickerUnsubsribe;const toggleInterval=__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe(),options!=null&&options.restartCounter&&(current=0),isIntersecting&&(callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker(),intervalId=setInterval(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),current++,callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker()},delay))},"toggleInterval"),restartTicker=__name(()=>intersector_index.ticker.subscribe(e=>{const progress=e.timeElapsedSinceSubscription/delay;callback({current,previous,progress})}),"restartTicker"),intersectorUnsubscribe=intersector_index.intersector.subscribe(element2,e=>{isIntersecting=e.isIntersecting,toggleInterval()});return{destroy:__name(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),intersectorUnsubscribe(),clearInterval(intervalId)},"destroy"),restart:__name((currentValue,previousValue)=>{current=currentValue||0,previousValue&&(previous=previousValue),toggleInterval()},"restart"),stop:__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe()},"stop")}}__name(setIntervalOnIntersection,"setIntervalOnIntersection");exports.getElementAttributesAdvanced=attributes.getElementAttributesAdvanced;exports.parseAttribute=attributes.parseAttribute;exports.parseAttributeValue=attributes.parseAttributeValue;exports.parseAttributeValueAdvanced=attributes.parseAttributeValueAdvanced;exports.isBrowser=intersector_index.isBrowser;exports.contain=canvas.contain;exports.cover=canvas.cover;exports.fixPosition=canvas.fixPosition;exports.measureText=canvas.measureText;exports.getPointerPosition=coordinates.getPointerPosition;exports.normalize=coordinates.normalize;exports.screenToCartesian=coordinates.screenToCartesian;exports.whenDefined=customElements.whenDefined;exports.createScriptElement=dom.createScriptElement;exports.deepQuerySelectorAll=dom.deepQuerySelectorAll;exports.excludeElements=dom.excludeElements;exports.findParentElement=dom.findParentElement;exports.findScrollParentElement=dom.findScrollParentElement;exports.getAllParentElements=dom.getAllParentElements;exports.getElement=dom.getElement;exports.intersectElements=dom.intersectElements;exports.traverseNodes=dom.traverseNodes;exports.traverseShadowRoots=dom.traverseShadowRoots;exports.easeInCubic=easings.easeInCubic;exports.easeInExpo=easings.easeInExpo;exports.easeInOutCubic=easings.easeInOutCubic;exports.easeInOutExpo=easings.easeInOutExpo;exports.easeInOutQuad=easings.easeInOutQuad;exports.easeInOutQuart=easings.easeInOutQuart;exports.easeInOutQuint=easings.easeInOutQuint;exports.easeInQuad=easings.easeInQuad;exports.easeInQuart=easings.easeInQuart;exports.easeInQuint=easings.easeInQuint;exports.easeOutCubic=easings.easeOutCubic;exports.easeOutExpo=easings.easeOutExpo;exports.easeOutQuad=easings.easeOutQuad;exports.easeOutQuart=easings.easeOutQuart;exports.easeOutQuint=easings.easeOutQuint;exports.linear=easings.linear;exports.isElementVisible=element.isElementVisible;exports.dispatchEvent=events.dispatchEvent;exports.createJSONAndSave=file.createJSONAndSave;exports.downloadURI=file.downloadURI;exports.debounce=_function.debounce;exports.throttle=_function.throttle;exports.setupDrag=gestures.setupDrag;exports.createStylesheet=stylesheet.createStylesheet;exports.styleToString=stylesheet.styleToString;exports.getCumulativeOffsetLeft=layout.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=layout.getCumulativeOffsetTop;exports.getCumulativePosition=layout.getCumulativePosition;exports.getStickyOffset=layout.getStickyOffset;exports.calculateDistance=math.calculateDistance;exports.calculateDistanceWithRadius=math.calculateDistanceWithRadius;exports.clamp=math.clamp;exports.damp=math.damp;exports.lerp=math.lerp;exports.mapRange=math.mapRange;exports.round=math.round;exports.smootherstep=math.smootherstep;exports.smoothstep=math.smoothstep;exports.step=math.step;exports.formatMediaDuration=metadata.formatMediaDuration;exports.ACTION_CREATE=morph.ACTION_CREATE;exports.ACTION_PRESERVE=morph.ACTION_PRESERVE;exports.ACTION_REMOVE=morph.ACTION_REMOVE;exports.ACTION_REMOVE_ATTR=morph.ACTION_REMOVE_ATTR;exports.ACTION_REPLACE=morph.ACTION_REPLACE;exports.ACTION_SET_ATTR=morph.ACTION_SET_ATTR;exports.ACTION_SKIP=morph.ACTION_SKIP;exports.ACTION_UPDATE=morph.ACTION_UPDATE;exports.NODE_TYPE_COMMENT=morph.NODE_TYPE_COMMENT;exports.NODE_TYPE_DOCUMENT=morph.NODE_TYPE_DOCUMENT;exports.NODE_TYPE_ELEMENT=morph.NODE_TYPE_ELEMENT;exports.NODE_TYPE_TEXT=morph.NODE_TYPE_TEXT;exports.diff=morph.diff;exports.morph=morph.morph;exports.patch=morph.patch;exports.beautifyNumber=number.beautifyNumber;exports.loopNumber=number.loopNumber;exports.preciseNumber=number.preciseNumber;exports.roundNumberTo=number.roundNumberTo;exports.toStep=number.toStep;exports.cloneDeep=object.cloneDeep;exports.compareObjects=object.compareObjects;exports.isESClass=object.isESClass;exports.isNullish=object.isNullish;exports.isObject=object.isObject;exports.mergeDeep=object.mergeDeep;exports.mixin=object.mixin;exports.omit=object.omit;exports.pick=object.pick;exports.nullishCoalescing=polyfills.nullishCoalescing;exports.requestIdleCallback=polyfills.requestIdleCallback;exports.wait=promises.wait;exports.getScrollToElementPosition=scroll.getScrollToElementPosition;exports.scrollToElement=scroll.scrollToElement;exports.camelToKebab=string.camelToKebab;exports.capitalize=string.capitalize;exports.declension=string.declension;exports.decodeHtmlEntities=string.decodeHtmlEntities;exports.generateId=string.generateId;exports.isUppercase=string.isUppercase;exports.kebabToCamel=string.kebabToCamel;exports.snakeToDotted=string.snakeToDotted;exports.toPascalCase=string.toPascalCase;exports.uncapitalize=string.uncapitalize;exports.getElementTransitionDurationMS=style.getElementTransitionDurationMS;exports.getElementTransitionDurationS=style.getElementTransitionDurationS;exports.changeHistory=url.changeHistory;exports.isLocalUrl=url.isLocalUrl;exports.normalizeBase=url.normalizeBase;exports.normalizeRelativeURLs=url.normalizeRelativeURLs;exports.normalizeURL=url.normalizeURL;exports.parseSearchParameters=url.parseSearchParameters;exports.searchParamsObjectToString=url.searchParamsObjectToString;exports.searchParamsToObject=url.searchParamsToObject;exports.splitPath=url.splitPath;exports.updateSearchParameter=url.updateSearchParameter;exports.cloneTemplateContent=cloneTemplateContent;exports.copyTextToClipboard=copyTextToClipboard;exports.decode=decode;exports.dotCircleCollision=dotCircleCollision;exports.dotPolygonCollision=dotPolygonCollision;exports.dotRectCollision=dotRectCollision;exports.encode=encode;exports.formatBytes=formatBytes;exports.getRootVariables=getRootVariables;exports.insert=insert;exports.requestLoadingCallback=requestLoadingCallback;exports.rgbToHex=rgbToHex;exports.setActiveContentClasses=setActiveContentClasses;exports.setElementsProgress=setElementsProgress;exports.setIntervalOnIntersection=setIntervalOnIntersection;exports.shiftArray=shiftArray;exports.transliterate=transliterate;exports.tryCreateHrefFromContact=tryCreateHrefFromContact;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const attributes=require("../attributes-BADnRZpK.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),canvas=require("../canvas-BP1ceie3.cjs"),coordinates=require("../coordinates-DQ9XV9M1.cjs"),customElements=require("../custom-elements-BfZCJde6.cjs"),dom=require("../dom-B40i6NXw.cjs"),easings=require("../easings-BWq0pPLq.cjs"),element=require("../element-CqD0jqBJ.cjs"),events=require("../events-UlGk63iC.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),stylesheet=require("../stylesheet-xM7sMeuo.cjs"),layout=require("../layout-CnGLl7oe.cjs"),math=require("../math-C-knY2TL.cjs"),metadata=require("../metadata-BrHUfpV9.cjs"),morph=require("../morph-Buhxq-X0.cjs"),number=require("../number-Bu4sGvW7.cjs"),object=require("../object-DTY_W6xG.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-BtUpTUwr.cjs"),string=require("../string-CbRNzmd9.cjs"),style=require("../style-IDJ6db6n.cjs"),url=require("../url-CPCO10Sy.cjs");function insert(arr,index,...newItems){return[...arr.slice(0,index),...newItems,...arr.slice(index)]}__name(insert,"insert");function shiftArray(arr,positions){const len=arr.length;positions=positions%len;const result=new Array(len);for(let i=0;i<len;i++){const newPos=(i+positions)%len;result[newPos]=arr[i]}return result}__name(shiftArray,"shiftArray");function formatBytes(bytes,decimals=2){if(!+bytes)return"0 Bytes";const k=1024,dm=decimals<0?0:decimals,sizes=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(bytes)/Math.log(k));return`${parseFloat((bytes/Math.pow(k,i)).toFixed(dm))} ${sizes[i]}`}__name(formatBytes,"formatBytes");function copyTextToClipboard(text){if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(err=>{console.error("Failed to copy text to clipboard:",err)});else{const textArea=document.createElement("textarea");textArea.value=text,textArea.style.position="fixed",textArea.style.top="0",textArea.style.left="0",document.body.appendChild(textArea),textArea.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(err){console.error("Failed to copy text to clipboard:",err)}document.body.removeChild(textArea)}}__name(copyTextToClipboard,"copyTextToClipboard");function dotRectCollision(dot,rect){return dot.x<rect.x+rect.width&&dot.x>rect.x&&dot.y<rect.y+rect.height&&dot.y>rect.y}__name(dotRectCollision,"dotRectCollision");function dotCircleCollision(dot,circle){return Math.sqrt((dot.x-circle.x)**2+(dot.y-circle.y)**2)<circle.radius}__name(dotCircleCollision,"dotCircleCollision");function dotPolygonCollision(dot,polygon){let inside=!1;const{x,y}=dot;for(let i=0,j=polygon.length-1;i<polygon.length;j=i++){const xi=polygon[i].x,yi=polygon[i].y,xj=polygon[j].x,yj=polygon[j].y;yi>y!=yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi&&(inside=!inside)}return inside}__name(dotPolygonCollision,"dotPolygonCollision");function rgbToHex(r,g,b){const toHex=__name(c=>{const hex=c.toString(16);return hex.length===1?"0"+hex:hex},"toHex");return`#${toHex(r)}${toHex(g)}${toHex(b)}`}__name(rgbToHex,"rgbToHex");function getStyleRuleActualValue(rule,name){const obj=rule.style.getPropertyValue(name);if(obj){const stringValue=obj.toString();return stringValue.startsWith("var")?getStyleRuleActualValue(rule,stringValue.slice(4,-1)):stringValue}}__name(getStyleRuleActualValue,"getStyleRuleActualValue");function getRootVariables(...names){const variables={};return Array.from(document.styleSheets).forEach(stylesheet2=>{Array.from(stylesheet2.cssRules).forEach(rule=>{rule instanceof CSSStyleRule&&rule.selectorText===":root"&&names.forEach(name=>{const value=getStyleRuleActualValue(rule,name);value&&(variables[name]=value)})})}),names.forEach(name=>{variables[name]||console.warn(`variable named ${name} not found`)}),variables}__name(getRootVariables,"getRootVariables");function encode(string2){const decodedStr=window.atob(string2);return decodeURIComponent(window.escape(decodedStr))}__name(encode,"encode");function decode(string2){const encodedStr=window.unescape(encodeURIComponent(string2));return window.btoa(encodedStr)}__name(decode,"decode");const phoneRegex=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,emailRegex=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function tryCreateHrefFromContact(contact){let href,type;return emailRegex.test(contact)?(href=`mailto:${contact.trim()}`,type="email"):phoneRegex.test(contact)&&(href=`tel:${contact.replace(/[^0-9\\.\\+]+/g,"")}`,type="phone"),{href,type,contact}}__name(tryCreateHrefFromContact,"tryCreateHrefFromContact");function transliterate(text,options={}){const{separator="-",lowercase=!0,replaceNumbers=!0,maxLength=60}=options,charMap={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"",ы:"y",ь:"",э:"e",ю:"yu",я:"ya"};let result=text.replace(/[а-яё]/gi,char=>{const lowerChar=char.toLowerCase(),replacement=charMap[lowerChar]||"";return char===lowerChar?replacement:replacement.toUpperCase()});if(replaceNumbers){const numberMap={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};result=result.replace(/[0-9]/g,num=>numberMap[num]||num)}return lowercase&&(result=result.toLowerCase()),result=result.replace(/[^\w\-]+/g,separator).replace(new RegExp(`\\${separator}+`,"g"),separator).replace(new RegExp(`(^\\${separator}|\\${separator}$)`,"g"),""),maxLength>0&&result.length>maxLength&&(result=result.substring(0,maxLength).replace(new RegExp(`\\${separator}[^\\${separator}]*$`),"")),result}__name(transliterate,"transliterate");function requestLoadingCallback(event,callback){let idleId;const domListener=__name(()=>{window.removeEventListener("DOMContentLoaded",loadListener),callback()},"domListener"),loadListener=__name(()=>{window.removeEventListener("load",loadListener),callback()},"loadListener"),idleListener=__name(()=>{idleId=void 0,callback()},"idleListener"),clear=__name(()=>{window.removeEventListener("DOMContentLoaded",domListener),window.removeEventListener("load",loadListener),idleId&&window.cancelIdleCallback&&window.cancelIdleCallback(idleId)},"clear");return event==="idle"&&window.requestIdleCallback?idleId=window.requestIdleCallback(idleListener,{timeout:1e4}):event==="load"?document.readyState==="complete"?loadListener():window.addEventListener("load",loadListener):event==="DOMContentLoaded"&&window.addEventListener("DOMContentLoaded",domListener),clear}__name(requestLoadingCallback,"requestLoadingCallback");function setElementsProgress(progress,elements,initialItemsWithFullProgress=0){const totalItems=elements.length-initialItemsWithFullProgress;elements.forEach((el,index)=>{const offset=index/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));el.style.setProperty("--item-progress",itemProgress.toString())})}__name(setElementsProgress,"setElementsProgress");function setActiveContentClasses(index,elements){elements.forEach((el,i)=>{i>index?(el.classList.remove("current","previous"),el.classList.add("next")):i<index?(el.classList.remove("current","next"),el.classList.add("previous")):(el.classList.remove("previous","next"),el.classList.add("current"))})}__name(setActiveContentClasses,"setActiveContentClasses");function cloneTemplateContent(templateElement,callback){if(templateElement){const element2=templateElement.content.cloneNode(!0).firstElementChild;return element2&&(callback==null||callback(element2)),element2}return null}__name(cloneTemplateContent,"cloneTemplateContent");function setIntervalOnIntersection(element2,delay,callback,options){let intervalId,isIntersecting=!1,current=0,previous=0,tickerUnsubsribe;const toggleInterval=__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe(),options!=null&&options.restartCounter&&(current=0),isIntersecting&&(callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker(),intervalId=setInterval(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),current++,callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker()},delay))},"toggleInterval"),restartTicker=__name(()=>intersector_index.ticker.subscribe(e=>{const progress=e.timeElapsedSinceSubscription/delay;callback({current,previous,progress})}),"restartTicker"),intersectorUnsubscribe=intersector_index.intersector.subscribe(element2,e=>{isIntersecting=e.isIntersecting,toggleInterval()});return{destroy:__name(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),intersectorUnsubscribe(),clearInterval(intervalId)},"destroy"),restart:__name((currentValue,previousValue)=>{current=currentValue||0,previousValue&&(previous=previousValue),toggleInterval()},"restart"),stop:__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe()},"stop")}}__name(setIntervalOnIntersection,"setIntervalOnIntersection");exports.getElementAttributesAdvanced=attributes.getElementAttributesAdvanced;exports.parseAttribute=attributes.parseAttribute;exports.parseAttributeValue=attributes.parseAttributeValue;exports.parseAttributeValueAdvanced=attributes.parseAttributeValueAdvanced;exports.isBrowser=intersector_index.isBrowser;exports.contain=canvas.contain;exports.cover=canvas.cover;exports.fixPosition=canvas.fixPosition;exports.measureText=canvas.measureText;exports.getPointerPosition=coordinates.getPointerPosition;exports.normalize=coordinates.normalize;exports.screenToCartesian=coordinates.screenToCartesian;exports.whenDefined=customElements.whenDefined;exports.createScriptElement=dom.createScriptElement;exports.deepQuerySelectorAll=dom.deepQuerySelectorAll;exports.excludeElements=dom.excludeElements;exports.findParentElement=dom.findParentElement;exports.findScrollParentElement=dom.findScrollParentElement;exports.getAllParentElements=dom.getAllParentElements;exports.getElement=dom.getElement;exports.intersectElements=dom.intersectElements;exports.traverseNodes=dom.traverseNodes;exports.traverseShadowRoots=dom.traverseShadowRoots;exports.easeInCubic=easings.easeInCubic;exports.easeInExpo=easings.easeInExpo;exports.easeInOutCubic=easings.easeInOutCubic;exports.easeInOutExpo=easings.easeInOutExpo;exports.easeInOutQuad=easings.easeInOutQuad;exports.easeInOutQuart=easings.easeInOutQuart;exports.easeInOutQuint=easings.easeInOutQuint;exports.easeInQuad=easings.easeInQuad;exports.easeInQuart=easings.easeInQuart;exports.easeInQuint=easings.easeInQuint;exports.easeOutCubic=easings.easeOutCubic;exports.easeOutExpo=easings.easeOutExpo;exports.easeOutQuad=easings.easeOutQuad;exports.easeOutQuart=easings.easeOutQuart;exports.easeOutQuint=easings.easeOutQuint;exports.linear=easings.linear;exports.isElementVisible=element.isElementVisible;exports.dispatchEvent=events.dispatchEvent;exports.createJSONAndSave=file.createJSONAndSave;exports.downloadURI=file.downloadURI;exports.debounce=_function.debounce;exports.throttle=_function.throttle;exports.setupDrag=gestures.setupDrag;exports.createStylesheet=stylesheet.createStylesheet;exports.styleToString=stylesheet.styleToString;exports.getCumulativeOffsetLeft=layout.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=layout.getCumulativeOffsetTop;exports.getCumulativePosition=layout.getCumulativePosition;exports.getStickyOffset=layout.getStickyOffset;exports.calculateDistance=math.calculateDistance;exports.calculateDistanceWithRadius=math.calculateDistanceWithRadius;exports.clamp=math.clamp;exports.damp=math.damp;exports.lerp=math.lerp;exports.mapRange=math.mapRange;exports.round=math.round;exports.smootherstep=math.smootherstep;exports.smoothstep=math.smoothstep;exports.step=math.step;exports.formatMediaDuration=metadata.formatMediaDuration;exports.ACTION_CREATE=morph.ACTION_CREATE;exports.ACTION_PRESERVE=morph.ACTION_PRESERVE;exports.ACTION_REMOVE=morph.ACTION_REMOVE;exports.ACTION_REMOVE_ATTR=morph.ACTION_REMOVE_ATTR;exports.ACTION_REPLACE=morph.ACTION_REPLACE;exports.ACTION_SET_ATTR=morph.ACTION_SET_ATTR;exports.ACTION_SKIP=morph.ACTION_SKIP;exports.ACTION_UPDATE=morph.ACTION_UPDATE;exports.NODE_TYPE_COMMENT=morph.NODE_TYPE_COMMENT;exports.NODE_TYPE_DOCUMENT=morph.NODE_TYPE_DOCUMENT;exports.NODE_TYPE_ELEMENT=morph.NODE_TYPE_ELEMENT;exports.NODE_TYPE_TEXT=morph.NODE_TYPE_TEXT;exports.diff=morph.diff;exports.morph=morph.morph;exports.patch=morph.patch;exports.beautifyNumber=number.beautifyNumber;exports.loopNumber=number.loopNumber;exports.preciseNumber=number.preciseNumber;exports.roundNumberTo=number.roundNumberTo;exports.toStep=number.toStep;exports.cloneDeep=object.cloneDeep;exports.compareObjects=object.compareObjects;exports.isESClass=object.isESClass;exports.isNullish=object.isNullish;exports.isObject=object.isObject;exports.mergeDeep=object.mergeDeep;exports.mixin=object.mixin;exports.omit=object.omit;exports.pick=object.pick;exports.nullishCoalescing=polyfills.nullishCoalescing;exports.requestIdleCallback=polyfills.requestIdleCallback;exports.wait=promises.wait;exports.getScrollToElementPosition=scroll.getScrollToElementPosition;exports.scrollToElement=scroll.scrollToElement;exports.camelToKebab=string.camelToKebab;exports.capitalize=string.capitalize;exports.declension=string.declension;exports.decodeHtmlEntities=string.decodeHtmlEntities;exports.generateId=string.generateId;exports.isUppercase=string.isUppercase;exports.kebabToCamel=string.kebabToCamel;exports.snakeToDotted=string.snakeToDotted;exports.toPascalCase=string.toPascalCase;exports.uncapitalize=string.uncapitalize;exports.getElementTransitionDurationMS=style.getElementTransitionDurationMS;exports.getElementTransitionDurationS=style.getElementTransitionDurationS;exports.changeHistory=url.changeHistory;exports.isLocalUrl=url.isLocalUrl;exports.normalizeBase=url.normalizeBase;exports.normalizeRelativeURLs=url.normalizeRelativeURLs;exports.normalizeURL=url.normalizeURL;exports.parseSearchParameters=url.parseSearchParameters;exports.searchParamsObjectToString=url.searchParamsObjectToString;exports.searchParamsToObject=url.searchParamsToObject;exports.splitPath=url.splitPath;exports.updateSearchParameter=url.updateSearchParameter;exports.cloneTemplateContent=cloneTemplateContent;exports.copyTextToClipboard=copyTextToClipboard;exports.decode=decode;exports.dotCircleCollision=dotCircleCollision;exports.dotPolygonCollision=dotPolygonCollision;exports.dotRectCollision=dotRectCollision;exports.encode=encode;exports.formatBytes=formatBytes;exports.getRootVariables=getRootVariables;exports.getStyleRuleActualValue=getStyleRuleActualValue;exports.insert=insert;exports.requestLoadingCallback=requestLoadingCallback;exports.rgbToHex=rgbToHex;exports.setActiveContentClasses=setActiveContentClasses;exports.setElementsProgress=setElementsProgress;exports.setIntervalOnIntersection=setIntervalOnIntersection;exports.shiftArray=shiftArray;exports.transliterate=transliterate;exports.tryCreateHrefFromContact=tryCreateHrefFromContact;
|
package/lib/utils/index.js
CHANGED
|
@@ -102,20 +102,20 @@ function rgbToHex(r4, g10, b11) {
|
|
|
102
102
|
return `#${toHex(r4)}${toHex(g10)}${toHex(b11)}`;
|
|
103
103
|
}
|
|
104
104
|
__name(rgbToHex, "rgbToHex");
|
|
105
|
-
function
|
|
105
|
+
function getStyleRuleActualValue(rule, name) {
|
|
106
106
|
const obj = rule.style.getPropertyValue(name);
|
|
107
107
|
if (obj) {
|
|
108
108
|
const stringValue = obj.toString();
|
|
109
|
-
return stringValue.startsWith("var") ?
|
|
109
|
+
return stringValue.startsWith("var") ? getStyleRuleActualValue(rule, stringValue.slice(4, -1)) : stringValue;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
__name(
|
|
112
|
+
__name(getStyleRuleActualValue, "getStyleRuleActualValue");
|
|
113
113
|
function getRootVariables(...names) {
|
|
114
114
|
const variables = {};
|
|
115
115
|
return Array.from(document.styleSheets).forEach((stylesheet) => {
|
|
116
116
|
Array.from(stylesheet.cssRules).forEach((rule) => {
|
|
117
117
|
rule instanceof CSSStyleRule && rule.selectorText === ":root" && names.forEach((name) => {
|
|
118
|
-
const value =
|
|
118
|
+
const value = getStyleRuleActualValue(rule, name);
|
|
119
119
|
value && (variables[name] = value);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
@@ -355,6 +355,7 @@ export {
|
|
|
355
355
|
getRootVariables,
|
|
356
356
|
g7 as getScrollToElementPosition,
|
|
357
357
|
g5 as getStickyOffset,
|
|
358
|
+
getStyleRuleActualValue,
|
|
358
359
|
insert,
|
|
359
360
|
i2 as intersectElements,
|
|
360
361
|
i as isBrowser,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aptechka",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/denisavitski/aptechka.git"
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
"require": "./lib/canvas/index.cjs",
|
|
54
54
|
"default": "./lib/canvas/index.js"
|
|
55
55
|
},
|
|
56
|
+
"./color": {
|
|
57
|
+
"types": "./lib/color/index.d.ts",
|
|
58
|
+
"require": "./lib/color/index.cjs",
|
|
59
|
+
"default": "./lib/color/index.js"
|
|
60
|
+
},
|
|
56
61
|
"./element-linked-store": {
|
|
57
62
|
"types": "./lib/element-linked-store/index.d.ts",
|
|
58
63
|
"require": "./lib/element-linked-store/index.cjs",
|
|
@@ -317,6 +322,9 @@
|
|
|
317
322
|
"canvas": [
|
|
318
323
|
"lib/canvas/index.d.ts"
|
|
319
324
|
],
|
|
325
|
+
"color": [
|
|
326
|
+
"lib/color/index.d.ts"
|
|
327
|
+
],
|
|
320
328
|
"element-linked-store": [
|
|
321
329
|
"lib/element-linked-store/index.d.ts"
|
|
322
330
|
],
|