nodality 1.0.0-beta.1
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/dist/animator.cjs.js +1 -0
- package/dist/animator.esm.js +1 -0
- package/dist/audionew.cjs.js +1 -0
- package/dist/audionew.esm.js +1 -0
- package/dist/base.cjs.js +1 -0
- package/dist/base.esm.js +1 -0
- package/dist/betaDesktopBar.esm.js +1 -0
- package/dist/betaMobileBar.esm.js +1 -0
- package/dist/bundle.umd.js +1 -0
- package/dist/button.cjs.js +1 -0
- package/dist/button.esm.js +1 -0
- package/dist/cardGetter.cjs.js +1 -0
- package/dist/cardGetter.esm.js +1 -0
- package/dist/center.cjs.js +1 -0
- package/dist/center.esm.js +1 -0
- package/dist/checkbox.cjs.js +1 -0
- package/dist/checkbox.esm.js +1 -0
- package/dist/code.cjs.js +1 -0
- package/dist/code.esm.js +1 -0
- package/dist/container.cjs.js +1 -0
- package/dist/container.esm.js +1 -0
- package/dist/datalist.cjs.js +1 -0
- package/dist/datalist.esm.js +1 -0
- package/dist/designer.cjs.js +1 -0
- package/dist/designer.esm.js +1 -0
- package/dist/dropdown.cjs.js +1 -0
- package/dist/dropdown.esm.js +1 -0
- package/dist/elementMapper.cjs.js +1 -0
- package/dist/elementMapper.esm.js +1 -0
- package/dist/finalresult.esm.js +1 -0
- package/dist/flexCard.cjs.js +1 -0
- package/dist/flexCard.esm.js +1 -0
- package/dist/flexGrid.cjs.js +1 -0
- package/dist/flexGrid.esm.js +1 -0
- package/dist/flexRow.cjs.js +1 -0
- package/dist/flexRow.esm.js +1 -0
- package/dist/floatingInput.cjs.js +1 -0
- package/dist/floatingInput.esm.js +1 -0
- package/dist/free.cjs.js +1 -0
- package/dist/free.esm.js +1 -0
- package/dist/horizontalScroller.esm.js +1 -0
- package/dist/image.cjs.js +1 -0
- package/dist/image.esm.js +1 -0
- package/dist/imagePicker.cjs.js +1 -0
- package/dist/imagePicker.esm.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/link.cjs.js +1 -0
- package/dist/link.esm.js +1 -0
- package/dist/linkGetter.cjs.js +1 -0
- package/dist/linkGetter.esm.js +1 -0
- package/dist/metaAdder.cjs.js +1 -0
- package/dist/metaAdder.esm.js +1 -0
- package/dist/modal2025.cjs.js +1 -0
- package/dist/modal2025.esm.js +1 -0
- package/dist/multiswitchers.esm.js +1 -0
- package/dist/newNavBar.cjs.js +1 -0
- package/dist/newNavBar.esm.js +1 -0
- package/dist/picker.cjs.js +1 -0
- package/dist/picker.esm.js +1 -0
- package/dist/progress.cjs.js +1 -0
- package/dist/progress.esm.js +1 -0
- package/dist/radio.cjs.js +1 -0
- package/dist/radio.esm.js +1 -0
- package/dist/range.cjs.js +1 -0
- package/dist/range.esm.js +1 -0
- package/dist/sideBar.cjs.js +1 -0
- package/dist/sideBar.esm.js +1 -0
- package/dist/sideNavBar.cjs.js +1 -0
- package/dist/sideNavBar.esm.js +1 -0
- package/dist/simpleBar.cjs.js +1 -0
- package/dist/simpleBar.esm.js +1 -0
- package/dist/stack.cjs.js +1 -0
- package/dist/stack.esm.js +1 -0
- package/dist/table.cjs.js +1 -0
- package/dist/table.esm.js +1 -0
- package/dist/text.cjs.js +1 -0
- package/dist/text.esm.js +1 -0
- package/dist/textField.cjs.js +1 -0
- package/dist/textField.esm.js +1 -0
- package/dist/wrap.cjs.js +1 -0
- package/dist/wrap.esm.js +1 -0
- package/dist/zoomCard.cjs.js +1 -0
- package/dist/zoomCard.esm.js +1 -0
- package/layout/<head> +59 -0
- package/layout/DEADJOE +49 -0
- package/layout/DEPRECATED-PARAGRAPH.js +103 -0
- package/layout/animator.js +1915 -0
- package/layout/audio.js +145 -0
- package/layout/audionew.js +70 -0
- package/layout/base-2.js +92 -0
- package/layout/base.js +161 -0
- package/layout/betaDesktopBar.js +126 -0
- package/layout/betaMobileBar.js +293 -0
- package/layout/box.js +29 -0
- package/layout/button.js +516 -0
- package/layout/cards.js +136 -0
- package/layout/center.js +143 -0
- package/layout/checkbox.js +183 -0
- package/layout/cleanRow.js +775 -0
- package/layout/code.js +60 -0
- package/layout/container.js +1005 -0
- package/layout/custom.js +289 -0
- package/layout/divImage.js +209 -0
- package/layout/dropdown.js +154 -0
- package/layout/dropdown2025.js +152 -0
- package/layout/edit.sh +39 -0
- package/layout/emptyElement.js +21 -0
- package/layout/externalStylesheet.js +19 -0
- package/layout/flexCard.js +220 -0
- package/layout/flexGrid.js +192 -0
- package/layout/flexrow.js +866 -0
- package/layout/footer.js +83 -0
- package/layout/formComponents/custom.js +0 -0
- package/layout/formComponents/dataList.js +183 -0
- package/layout/formComponents/edit.sh +39 -0
- package/layout/formComponents/floatingInput.js +163 -0
- package/layout/formComponents/form-all.js +161 -0
- package/layout/formComponents/form.js +76 -0
- package/layout/formComponents/imagePicker.js +266 -0
- package/layout/formComponents/picker.js +208 -0
- package/layout/formComponents/radio.js +231 -0
- package/layout/formComponents/radiogroup.js +231 -0
- package/layout/formComponents/range.js +158 -0
- package/layout/free.js +232 -0
- package/layout/grid-new.js +299 -0
- package/layout/grid.js +190 -0
- package/layout/gridSwitcher.js +188 -0
- package/layout/group.js +163 -0
- package/layout/header.js +175 -0
- package/layout/hello.html +126 -0
- package/layout/horizontalScroller.js +222 -0
- package/layout/image-old.js +487 -0
- package/layout/image.js +1039 -0
- package/layout/index.js +183 -0
- package/layout/label.js +50 -0
- package/layout/link.js +1085 -0
- package/layout/list-OLD.js +0 -0
- package/layout/list.js +127 -0
- package/layout/metaAdder.js +17 -0
- package/layout/modal2025.js +142 -0
- package/layout/modernwrap.js +92 -0
- package/layout/multiswitcher.js +224 -0
- package/layout/multiswitcherBeta.js +63 -0
- package/layout/navBar-OLD.js +261 -0
- package/layout/navBar.js +371 -0
- package/layout/navFactor/customDiv.js +60 -0
- package/layout/navFactor/edit.sh +39 -0
- package/layout/newFlatAdder.js +41 -0
- package/layout/newNavBar copy 2.js +915 -0
- package/layout/newNavBar copy.js +774 -0
- package/layout/newNavBar.js +925 -0
- package/layout/offsetContainer.js +395 -0
- package/layout/progress.js +111 -0
- package/layout/remWin.sh +20 -0
- package/layout/row.js +208 -0
- package/layout/savedNewNavBar.js +437 -0
- package/layout/scrollvideo.js +120 -0
- package/layout/sideBar.js +183 -0
- package/layout/sideNavBar.js +313 -0
- package/layout/simpleBar.js +25 -0
- package/layout/slider2025.js +198 -0
- package/layout/spacer.js +44 -0
- package/layout/stack.js +76 -0
- package/layout/styler.js +113 -0
- package/layout/switcher.js +102 -0
- package/layout/table.js +155 -0
- package/layout/text.js +1685 -0
- package/layout/textField.js +282 -0
- package/layout/ulist.js +147 -0
- package/layout/video.js +70 -0
- package/layout/withoutNew.js +60 -0
- package/layout/wrap.js +140 -0
- package/layout/zoomCard.js +219 -0
- package/lib/cardGetter.js +80 -0
- package/lib/designer.js +875 -0
- package/lib/elementMapper.js +1428 -0
- package/lib/linkGetter.js +202 -0
- package/package.json +33 -0
|
@@ -0,0 +1,1915 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// 22/08/2020 - 16:30
|
|
5
|
+
class Animator {
|
|
6
|
+
|
|
7
|
+
constructor(){
|
|
8
|
+
this.state = {
|
|
9
|
+
isExpanded: false,
|
|
10
|
+
isMovedUp: false,
|
|
11
|
+
isMovedDown: false
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
keySet(obj){
|
|
16
|
+
this.temporaryVal = 1;
|
|
17
|
+
this.res.style[obj.key] = obj.value;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onScroll(data){
|
|
22
|
+
|
|
23
|
+
if (data.value === "opacity"){
|
|
24
|
+
this.res.style.opacity = data.valMin;
|
|
25
|
+
} else if (data.value === "scale") {
|
|
26
|
+
this.res.style.transform = `scale(${data.valMax})`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
window.addEventListener("scroll", () => {
|
|
31
|
+
let resa = this.smartRange(window.scrollY, {
|
|
32
|
+
min: data.from,
|
|
33
|
+
max: data.to // has to be switched
|
|
34
|
+
}, {
|
|
35
|
+
min: data.valMin,
|
|
36
|
+
max: data.valMax
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (data.value === "opacity"){
|
|
40
|
+
this.res.style.opacity = resa;
|
|
41
|
+
|
|
42
|
+
} else if (data.value === "scale") {
|
|
43
|
+
this.res.style.transform = `scale(${resa})`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
setAny(obj){
|
|
54
|
+
this[Object.keys(obj)[0]] = [Object.values(obj)[0]];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setID(id){
|
|
58
|
+
this.id = id;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setPrevText(prevText){ // 12:12:43 20/03/25 OK :)
|
|
62
|
+
this.prevText = prevText;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getCSS(){
|
|
66
|
+
return this.css;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
getPX(value) {
|
|
71
|
+
const breakpoints = {
|
|
72
|
+
xs: "0px", // Extra small
|
|
73
|
+
sm: "576px", // Small
|
|
74
|
+
md: "768px", // Medium
|
|
75
|
+
lg: "992px", // Large
|
|
76
|
+
xl: "1200px", // Extra large
|
|
77
|
+
xxl: "1400px", // Extra extra large
|
|
78
|
+
mxxl: "1800px" // Extra extra large
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return breakpoints[value] || "Invalid breakpoint"; // Fallback for invalid input
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// [{ breakpoint: "sm" , values: [...]}]
|
|
85
|
+
respad(arr){
|
|
86
|
+
const react = () => { // 00:49:12 22/03/2025
|
|
87
|
+
this.pad(arr[0].values);
|
|
88
|
+
|
|
89
|
+
for(let i = 0; i < arr.length; i++) {
|
|
90
|
+
let point = arr[i].breakpoint;
|
|
91
|
+
if (window.matchMedia(`(min-width: ${this.getPX(point)}`).matches){
|
|
92
|
+
// console.clear();
|
|
93
|
+
// console.log("MATCHING " + point);
|
|
94
|
+
this.pad(arr[i].values);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
window.addEventListener("resize", react);
|
|
101
|
+
react();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
resmar(arr){
|
|
105
|
+
const react = () => { // 00:49:12 22/03/2025
|
|
106
|
+
this.mar(arr[0].values);
|
|
107
|
+
|
|
108
|
+
for(let i = 0; i < arr.length; i++) {
|
|
109
|
+
let point = arr[i].breakpoint;
|
|
110
|
+
if (window.matchMedia(`(max-width: ${this.getPX(point)}`).matches){
|
|
111
|
+
this.mar(arr[i].values);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
window.addEventListener("resize", react);
|
|
118
|
+
react();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
resprop(arr) {
|
|
123
|
+
|
|
124
|
+
this.prevBackground = this.res.style.background;
|
|
125
|
+
this.prevWidth = this.res.style.width;
|
|
126
|
+
this.prevHeight = this.res.style.height;
|
|
127
|
+
this.prevBorder = this.res.style.border;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
const react = () => { // 00:49:12 22/03/2025
|
|
131
|
+
|
|
132
|
+
this.res.style.background = this.prevBackground;
|
|
133
|
+
this.res.style.width = this.prevWidth;
|
|
134
|
+
this.res.style.height = this.prevHeight;
|
|
135
|
+
this.res.style.border = this.prevBorder;
|
|
136
|
+
|
|
137
|
+
for (let i = 0; i < arr.length; i++) {
|
|
138
|
+
let point = arr[i].breakpoint;
|
|
139
|
+
if (window.matchMedia(`(max-width: ${this.getPX(point)}`).matches) {
|
|
140
|
+
const filteredObj = {};
|
|
141
|
+
for (const key in arr[i]) {
|
|
142
|
+
if (key !== "breakpoint") {
|
|
143
|
+
filteredObj[key] = arr[i][key];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.set(filteredObj);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
window.addEventListener("resize", react);
|
|
154
|
+
react();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
isNumber(value) {
|
|
158
|
+
return typeof value === 'number' && !isNaN(value);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
pad(arr){
|
|
162
|
+
|
|
163
|
+
for(let i = 0; i < arr.length; i++) {
|
|
164
|
+
|
|
165
|
+
let keys = Object.keys(arr[i]);
|
|
166
|
+
for(let j = 0; j < keys.length; j++) {
|
|
167
|
+
let key = keys[j];
|
|
168
|
+
let value = arr[i][key];
|
|
169
|
+
for(let k = 0; k < key.length; k++) {
|
|
170
|
+
switch(key[k]) {
|
|
171
|
+
case 'a':
|
|
172
|
+
|
|
173
|
+
//alert("OIHOI")
|
|
174
|
+
this.res.style.padding = this.isNumber(value) ? `${value}px` : value;
|
|
175
|
+
break;
|
|
176
|
+
case 't':
|
|
177
|
+
this.res.style.paddingTop = this.isNumber(value) ? `${value}px` : value;
|
|
178
|
+
break;
|
|
179
|
+
case 'l':
|
|
180
|
+
this.res.style.paddingLeft = this.isNumber(value) ? `${value}px` : value;
|
|
181
|
+
break;
|
|
182
|
+
case 'r':
|
|
183
|
+
this.res.style.paddingRight = this.isNumber(value) ? `${value}px` : value;
|
|
184
|
+
break;
|
|
185
|
+
case 'b':
|
|
186
|
+
this.res.style.paddingBottom = this.isNumber(value) ? `${value}px` : value;
|
|
187
|
+
break;
|
|
188
|
+
default:
|
|
189
|
+
// console.log(`Invalid key: ${key[k]}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
as(asa){
|
|
199
|
+
this.res.style.alignSelf = asa;
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
mar(arr){
|
|
206
|
+
|
|
207
|
+
for(let i = 0; i < arr.length; i++) {
|
|
208
|
+
let keys = Object.keys(arr[i]);
|
|
209
|
+
for(let j = 0; j < keys.length; j++) {
|
|
210
|
+
let key = keys[j];
|
|
211
|
+
let value = arr[i][key];
|
|
212
|
+
for(let k = 0; k < key.length; k++) {
|
|
213
|
+
switch(key[k]) {
|
|
214
|
+
case 'a':
|
|
215
|
+
// this.res.style.fontWeight = `bold`;
|
|
216
|
+
this.res.style.margin = this.isNumber(value) ? `${value}px` : value;//`${value}px`;
|
|
217
|
+
break;
|
|
218
|
+
case 't':
|
|
219
|
+
this.res.style.marginTop = this.isNumber(value) ? `${value}px` : value;//`${value}px`;
|
|
220
|
+
break;
|
|
221
|
+
case 'l':
|
|
222
|
+
this.res.style.marginLeft = this.isNumber(value) ? `${value}px` : value; //`${value}px`;
|
|
223
|
+
break;
|
|
224
|
+
case 'r':
|
|
225
|
+
this.res.style.marginRight = this.isNumber(value) ? `${value}px` : value; //`${value}px`;
|
|
226
|
+
break;
|
|
227
|
+
case 'b':
|
|
228
|
+
this.res.style.marginBottom = this.isNumber(value) ? `${value}px` : value;//`${value}px`;
|
|
229
|
+
break;
|
|
230
|
+
default:
|
|
231
|
+
// console.log(`Invalid key: ${key[k]}`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (key[k] === "auto"){
|
|
235
|
+
this.res.style.marginLeft = "auto";
|
|
236
|
+
this.res.style.marginRight = "auto";
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
smartRange(val, from, to) {
|
|
246
|
+
|
|
247
|
+
if (val < from.min) {
|
|
248
|
+
val = from.min;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (val > from.max) {
|
|
252
|
+
val = from.max;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
let percent = (val - from.min) / (from.max - from.min);
|
|
256
|
+
|
|
257
|
+
if (from.min > from.max) {
|
|
258
|
+
percent = (val - from.max) / (from.min - from.max);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let toRange = (to.min - to.max) * percent - to.min;
|
|
262
|
+
toRange = Math.abs(toRange);
|
|
263
|
+
|
|
264
|
+
if (to.min < to.max) {
|
|
265
|
+
let sm = to.max + Math.abs(to.min);
|
|
266
|
+
let timesPerc = sm * percent;
|
|
267
|
+
toRange = to.min + timesPerc;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
return toRange;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
gpos(obj){
|
|
276
|
+
//alert(obj.col);
|
|
277
|
+
this.res.style.gridColumn = obj.col;
|
|
278
|
+
this.res.style.gridRow = obj.row;
|
|
279
|
+
//this.res.style.border = "1px solid green";
|
|
280
|
+
return this;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
fluidCopy(name){
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
if (name instanceof Object){
|
|
287
|
+
this.prevStylex = this.res.style;
|
|
288
|
+
this.res = document.createElement("h1");
|
|
289
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
290
|
+
let node = document.createTextNode(this.text);
|
|
291
|
+
this.res.appendChild(node);
|
|
292
|
+
this.res.style.fontSize = name.exact;
|
|
293
|
+
|
|
294
|
+
// alert(name.exact);
|
|
295
|
+
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const display1 = "calc(1.625rem + 5.075vw)";
|
|
300
|
+
|
|
301
|
+
if (name === "S1"){
|
|
302
|
+
this.prevStylex = this.res.style;
|
|
303
|
+
this.res = document.createElement("h1");
|
|
304
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
305
|
+
let node = document.createTextNode(this.text);
|
|
306
|
+
this.res.appendChild(node);
|
|
307
|
+
this.res.style.fontSize = display1;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const display2 = "calc(1.500rem + 4.3vw)";
|
|
311
|
+
|
|
312
|
+
if (name === "S2"){
|
|
313
|
+
this.prevStylex = this.res.style;
|
|
314
|
+
this.res = document.createElement("h2");
|
|
315
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
316
|
+
let node = document.createTextNode(this.text);
|
|
317
|
+
this.res.appendChild(node);
|
|
318
|
+
this.res.style.fontSize = display2;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
const display3 = "calc(1.375rem + 3.525vw)";
|
|
323
|
+
|
|
324
|
+
if (name === "S3"){
|
|
325
|
+
this.prevStylex = this.res.style;
|
|
326
|
+
this.res = document.createElement("h3");
|
|
327
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
328
|
+
let node = document.createTextNode(this.text);
|
|
329
|
+
this.res.appendChild(node);
|
|
330
|
+
this.res.style.fontSize = display3;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const display4 = "calc(1.250rem + 2.75vw)";
|
|
334
|
+
|
|
335
|
+
if (name === "S4"){
|
|
336
|
+
this.prevStylex = this.res.style;
|
|
337
|
+
this.res = document.createElement("h4");
|
|
338
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
339
|
+
let node = document.createTextNode(this.text);
|
|
340
|
+
this.res.appendChild(node);
|
|
341
|
+
this.res.style.fontSize = display4;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const display5 = "calc(1.125rem + 1.975vw)";
|
|
345
|
+
|
|
346
|
+
if (name === "S5"){
|
|
347
|
+
this.prevStylex = this.res.style;
|
|
348
|
+
this.res = document.createElement("h5");
|
|
349
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
350
|
+
let node = document.createTextNode(this.text);
|
|
351
|
+
this.res.appendChild(node);
|
|
352
|
+
this.res.style.fontSize = display5;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
const display6 = "calc(1rem + 0.5vw)"; // calc(1rem + 1.2vw)
|
|
358
|
+
|
|
359
|
+
if (name === "S6"){
|
|
360
|
+
this.res.style.fontSize = display6;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
setIndex(idx){
|
|
370
|
+
this.index = idx;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
borderObj(options){
|
|
374
|
+
let type = options.type ?? "solid";
|
|
375
|
+
this.res.style.border = `${options.width} ${type} ${options.color}`
|
|
376
|
+
this.res.style.borderRadius = options.radius;
|
|
377
|
+
return this;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
protoReact(queries, id) {
|
|
382
|
+
// Sort the queries based on the starting range value in ascending order
|
|
383
|
+
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
384
|
+
|
|
385
|
+
// Function to check and log queries based on screen size
|
|
386
|
+
const checkQueries =() => {
|
|
387
|
+
const screenSize = window.innerWidth;
|
|
388
|
+
let ops = "";
|
|
389
|
+
|
|
390
|
+
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
391
|
+
|
|
392
|
+
for (const query of queries) {
|
|
393
|
+
this.counterIndex++;
|
|
394
|
+
|
|
395
|
+
const [startRange, endRange] = query.range;
|
|
396
|
+
const startSize = parseInt(startRange);
|
|
397
|
+
const endSize = parseInt(endRange);
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
let all = true;
|
|
401
|
+
|
|
402
|
+
if (query.target){
|
|
403
|
+
all = false;
|
|
404
|
+
|
|
405
|
+
for (var i = 0; i < query.target.length; i++){
|
|
406
|
+
if (query.target[i] === id){ // #id is required
|
|
407
|
+
all = true;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (screenSize >= startSize && screenSize <= endSize && all) { // NEED TO COMMENT ALL
|
|
413
|
+
// USE THIS, but apply all properties all the time !! 255447
|
|
414
|
+
|
|
415
|
+
if (query.log === "gradient"){
|
|
416
|
+
ops += "gradient";
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (query.log === "blast"){
|
|
420
|
+
ops += "blast";
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (query.log === "animation"){
|
|
424
|
+
ops += "animation";
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (query.log === "shadow"){
|
|
428
|
+
ops += "shadow";
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (query.log === "span"){
|
|
432
|
+
ops += "span";
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (query.log === "filter"){
|
|
436
|
+
ops += "filter";
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (query.log === "background"){
|
|
440
|
+
ops += "background";
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
this.res.style.margin = "";
|
|
447
|
+
// Everything works 12:48:45 06/10/23
|
|
448
|
+
|
|
449
|
+
let defaultColor = this.res.style.color; // 11:05:40 Nice
|
|
450
|
+
|
|
451
|
+
let mapped = queries.map(el => el.log).filter(el => el != undefined);
|
|
452
|
+
|
|
453
|
+
if (mapped.includes("gradient")) {
|
|
454
|
+
this.res.style.WebkitBackgroundClip = "";
|
|
455
|
+
this.res.style.background = "";
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
// Reset stroke
|
|
460
|
+
this.res.style['-webkit-text-stroke'] = "";
|
|
461
|
+
this.res.style.filter = ``;
|
|
462
|
+
|
|
463
|
+
// Reset shadow
|
|
464
|
+
this.res.style.textShadow = "";
|
|
465
|
+
|
|
466
|
+
// Temp reset border
|
|
467
|
+
this.res.style.border = "";
|
|
468
|
+
|
|
469
|
+
while(this.res.firstChild) { // not the problem...
|
|
470
|
+
this.res.removeChild(this.res.firstChild); // Remove all children
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
this.res.textContent = this.text;
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
if (ops === "") {
|
|
479
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
480
|
+
this.res.style.color = defaultColor; //"green";
|
|
481
|
+
//this.resCopy = this.res;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
if (ops === "blast") { // Chekc id here ???
|
|
486
|
+
// alert("O")
|
|
487
|
+
for (var i = 0; i < queries.length; i++){
|
|
488
|
+
const off = queries[i].op.offsets;
|
|
489
|
+
// console.log(off);
|
|
490
|
+
if (off && this.index !== undefined){
|
|
491
|
+
// console.warn("READ INDEXO");
|
|
492
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// alert(this.passedID.id);
|
|
497
|
+
// this.res.style.border = "1px solid yellow";
|
|
498
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
499
|
+
this.res.style['-webkit-text-stroke'] = this.globalBlast; //this.globalBlast; //`3px orange`;
|
|
500
|
+
//this.resCopy = this.res;
|
|
501
|
+
|
|
502
|
+
for (var i = 0; i < queries.length; i++){
|
|
503
|
+
const off = queries[i].op.offsets;
|
|
504
|
+
// console.log(off);
|
|
505
|
+
if (off && this.index !== undefined){
|
|
506
|
+
// console.warn("READ INDEX");
|
|
507
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
if (ops === "gradient") { // the problem is not here
|
|
515
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
516
|
+
this.res.style.background = this.globalGradient;// "linear-gradient(to left, #3498db, #1abc9c)";
|
|
517
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
518
|
+
|
|
519
|
+
this.res.style.border = "1px solid orange"; // Something on Wrapper prevents border works on text
|
|
520
|
+
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
if (ops === "background"){
|
|
525
|
+
|
|
526
|
+
this.res.style.background = "orange";
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
if (ops === "gradientblast") {
|
|
533
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
534
|
+
this.res.style.background = this.globalGradient;//"linear-gradient(to left, #3498db, #1abc9c)";
|
|
535
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
536
|
+
this.res.style['-webkit-text-stroke'] = this.globalBlast; // `3px orange`;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
if (ops === "gradientanimation") { // 12:33:14 Nice
|
|
543
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
544
|
+
this.res.style.background = this.globalGradient; //"linear-gradient(to left, #3498db, #1abc9c)";
|
|
545
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// // // console.log("GL " + this.globalShadow);
|
|
549
|
+
if (ops === "gradientanimationshadow"){
|
|
550
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
551
|
+
this.res.style.background = this.globalGradient; //"linear-gradient(to left, #3498db, #1abc9c)";
|
|
552
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
553
|
+
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px, #1abc9c9f -12px 12px, #1abc9c40 -18px 18px";
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (ops === "animationshadow"){
|
|
557
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
558
|
+
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px , #1abc9c40 -12px 12px";
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (ops === "shadow"){
|
|
562
|
+
// Clear all children and add text content
|
|
563
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
564
|
+
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px , #1abc9c40 -12px 12px";
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
if (ops === "span"){
|
|
569
|
+
if (this.options.span){
|
|
570
|
+
let noiseObject;
|
|
571
|
+
|
|
572
|
+
if (Array.isArray(this.options.span)){
|
|
573
|
+
noiseObject = this.options.span.filter(a => a.op.name === "span")[0];
|
|
574
|
+
} else {
|
|
575
|
+
noiseObject = this.options.span;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
this.res.textContent = ""; // creating new element not helping
|
|
579
|
+
|
|
580
|
+
for (var i = 0; i < noiseObject.op.parts.length; i++){
|
|
581
|
+
let opts = noiseObject.op.parts[i].style;
|
|
582
|
+
let span = new Text(noiseObject.op.parts[i].text).setup({type: "span"}).set(opts).render();
|
|
583
|
+
this.res.appendChild(span);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
if (ops === "filter"){
|
|
590
|
+
|
|
591
|
+
let filterName = this.options.filtera.op.filter;
|
|
592
|
+
// alert(filterName);
|
|
593
|
+
this.res.style.filter = filterName;
|
|
594
|
+
this.res.style.border = "8px solid orange";
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// Add an event listener to check queries on window resize
|
|
599
|
+
window.addEventListener('resize', checkQueries);
|
|
600
|
+
|
|
601
|
+
// Initial check
|
|
602
|
+
checkQueries();
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
setPref(id){
|
|
609
|
+
this.preffersId = id;
|
|
610
|
+
//alert(id);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
setClass(id){
|
|
615
|
+
this.class = id;
|
|
616
|
+
//alert(id);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
betaReact(queries, id) {
|
|
623
|
+
|
|
624
|
+
// // console.log("PPP");
|
|
625
|
+
// // console.log(queries);
|
|
626
|
+
|
|
627
|
+
this.ap = false;
|
|
628
|
+
this.cta = 0;
|
|
629
|
+
this.once = false;
|
|
630
|
+
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
631
|
+
|
|
632
|
+
// Function to check and log queries based on screen size
|
|
633
|
+
const checkQueries =() => {
|
|
634
|
+
const screenSize = window.innerWidth;
|
|
635
|
+
let ops = "";
|
|
636
|
+
|
|
637
|
+
this.resCopy = this.res;
|
|
638
|
+
|
|
639
|
+
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
640
|
+
// // // console.log(this.storedQueries);
|
|
641
|
+
|
|
642
|
+
for (const query of queries) {
|
|
643
|
+
this.counterIndex++;
|
|
644
|
+
|
|
645
|
+
const [startRange, endRange] = query.range;
|
|
646
|
+
const startSize = parseInt(startRange);
|
|
647
|
+
const endSize = parseInt(endRange);
|
|
648
|
+
let all = true;
|
|
649
|
+
|
|
650
|
+
if (query.target){
|
|
651
|
+
//alert("KKK")
|
|
652
|
+
all = false;
|
|
653
|
+
//alert(this.res.id);
|
|
654
|
+
|
|
655
|
+
for (var i = 0; i < query.target.length; i++){
|
|
656
|
+
// // // console.log("QT " + query.target[i]);
|
|
657
|
+
// // // console.log("QS " + id);
|
|
658
|
+
|
|
659
|
+
if (query.target[i] === id){ // #id is required
|
|
660
|
+
|
|
661
|
+
all = true;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
if (screenSize >= startSize && screenSize <= endSize && all) { // NEED TO COMMENT ALL
|
|
667
|
+
if (query.log === "blast"){
|
|
668
|
+
ops += "blast";
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
if (query.log === "shadow"){
|
|
672
|
+
ops += "shadow";
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (query.log === "background"){
|
|
676
|
+
ops += "background";
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (query.log === "gradient"){
|
|
680
|
+
ops += "gradient";
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (query.log === "spana"){
|
|
684
|
+
ops += "spana";
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
if (query.log === "layout"){
|
|
688
|
+
ops += "layout";
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (query.log === "margin"){
|
|
692
|
+
ops += "margin";
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
if (query.op && query.op.margin){
|
|
696
|
+
this.useMargin = query.op.margin;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
this.res.style.background = "";
|
|
705
|
+
this.res.style.backgroundColor = "";
|
|
706
|
+
this.res.style.textShadow = "";
|
|
707
|
+
this.res.style.border = "";
|
|
708
|
+
this.res.style.margin = ""
|
|
709
|
+
|
|
710
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
711
|
+
this.res.style['-webkit-text-stroke'] = "";
|
|
712
|
+
this.res.style['-webkit-text-stroke-width'] = "";
|
|
713
|
+
|
|
714
|
+
if (ops === "background"){
|
|
715
|
+
// alert("PPPA")
|
|
716
|
+
this.res.style.backgroundColor = "green";
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (ops === "margin"){
|
|
720
|
+
|
|
721
|
+
for (var i = 0; i < queries.length; i++){
|
|
722
|
+
|
|
723
|
+
if (!queries[i].op){
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const off = queries[i].op.offsets;
|
|
727
|
+
if (off && this.index !== undefined){
|
|
728
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
if (ops === "blastbackgroundmargin"){
|
|
736
|
+
|
|
737
|
+
for (var i = 0; i < queries.length; i++){
|
|
738
|
+
if (!queries[i].op){
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const off = queries[i].op.offsets;
|
|
743
|
+
// console.log(off);
|
|
744
|
+
|
|
745
|
+
if (off && this.index !== undefined){
|
|
746
|
+
// console.warn("READ INDEX");
|
|
747
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
this.res.style.backgroundColor = "green";
|
|
753
|
+
//this.useMargin ? this.res.style.margin = "1rem" : null;
|
|
754
|
+
// alert("PPPA")
|
|
755
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
756
|
+
this.res.style.border = "1px solid orange";
|
|
757
|
+
} else {
|
|
758
|
+
this.res.textContent = this.text; //"a"
|
|
759
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
760
|
+
//this.res.style['-webkit-background-clip'] = 'text';
|
|
761
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
762
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
766
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
767
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (ops === "blastbackground"){
|
|
771
|
+
|
|
772
|
+
for (var i = 0; i < queries.length; i++){
|
|
773
|
+
if (!queries[i].op){
|
|
774
|
+
continue;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
const off = queries[i].op.offsets;
|
|
778
|
+
|
|
779
|
+
if (off && this.index !== undefined){
|
|
780
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
this.res.style.backgroundColor = "green";
|
|
785
|
+
// no unused expression
|
|
786
|
+
this.useMargin ? this.res.style.margin = "1rem" : this.res.setAttribute("id", "iofhwoiefhoih");
|
|
787
|
+
//this.useMargin ? this.res.style.margin = "1rem" : null;
|
|
788
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
789
|
+
this.res.style.border = "1px solid orange";
|
|
790
|
+
} else {
|
|
791
|
+
this.res.textContent = this.text; //"a"
|
|
792
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
793
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
794
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
798
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
799
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (ops === "layout"){
|
|
803
|
+
this.res.style.alignSelf = "start";
|
|
804
|
+
this.res.style.border = "1px solid purple";
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
if (ops === "blast") { // the problem is not here
|
|
811
|
+
|
|
812
|
+
for (var i = 0; i < queries.length; i++){
|
|
813
|
+
if (!queries[i].op){
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
const off = queries[i].op.offsets;
|
|
818
|
+
if (off && this.index !== undefined){
|
|
819
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
824
|
+
this.res.style.border = "1px solid orange";
|
|
825
|
+
} else {
|
|
826
|
+
this.res.textContent = this.text; //"a"
|
|
827
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
828
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
829
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
830
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
834
|
+
this.res.style['-webkit-text-stroke'] = "orange";
|
|
835
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
if (ops === "blastgradientbackground"){
|
|
840
|
+
this.res.style.border = "1px solid yellow";
|
|
841
|
+
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
842
|
+
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
if (ops === "gradient") {
|
|
849
|
+
|
|
850
|
+
//alert("P")
|
|
851
|
+
|
|
852
|
+
this.res.style.background = "linear-gradient(to left, #3498db, #1abc9c)";
|
|
853
|
+
|
|
854
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
855
|
+
} else {
|
|
856
|
+
|
|
857
|
+
this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
858
|
+
//// console.warn(this.res.children[0]);
|
|
859
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
860
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
861
|
+
this.res.textContent = this.text; //"a"
|
|
862
|
+
//this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
if (ops === "shadow"){
|
|
869
|
+
|
|
870
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
871
|
+
} else {
|
|
872
|
+
|
|
873
|
+
this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
874
|
+
//// console.warn(this.res.children[0]);
|
|
875
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
876
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
877
|
+
this.res.style.textShadow = "#1abc9cff -6px 6px , #1abc9c40 -12px 12px";
|
|
878
|
+
this.res.textContent = this.text; //"a"
|
|
879
|
+
//this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// this.res.style['-webkit-text-stroke'] = "orange";
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// Add an event listener to check queries on window resize
|
|
888
|
+
window.addEventListener('resize', checkQueries);
|
|
889
|
+
|
|
890
|
+
// Initial check
|
|
891
|
+
checkQueries();
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
//--------- START OF INDEPENDENT
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
// React without condition
|
|
899
|
+
// loop through queries
|
|
900
|
+
// to make all CSS immediatelly...
|
|
901
|
+
|
|
902
|
+
cssGen(queries, id, classa, preffersClass){
|
|
903
|
+
|
|
904
|
+
this.css = [""];
|
|
905
|
+
return [""];
|
|
906
|
+
|
|
907
|
+
this.css = [];
|
|
908
|
+
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
909
|
+
|
|
910
|
+
// Function to check and log queries based on screen size
|
|
911
|
+
const checkQueries =() => {
|
|
912
|
+
const screenSize = window.innerWidth;
|
|
913
|
+
let ops = "";
|
|
914
|
+
let operations = [];
|
|
915
|
+
|
|
916
|
+
this.resCopy = this.res;
|
|
917
|
+
|
|
918
|
+
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
919
|
+
|
|
920
|
+
// console.log("ULTRA");
|
|
921
|
+
// console.log(queries);
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
for (const query of queries) {
|
|
926
|
+
this.counterIndex++;
|
|
927
|
+
|
|
928
|
+
const [startRange, endRange] = query.range;
|
|
929
|
+
const startSize = parseInt(startRange);
|
|
930
|
+
const endSize = parseInt(endRange);
|
|
931
|
+
let all = true;
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
if (query.target){
|
|
936
|
+
//alert("KKK")
|
|
937
|
+
all = false;
|
|
938
|
+
//alert(this.res.id);
|
|
939
|
+
|
|
940
|
+
for (var i = 0; i < query.target.length; i++){
|
|
941
|
+
// // // console.log("QT " + query.target[i]);
|
|
942
|
+
// // // console.log("QS " + id);
|
|
943
|
+
|
|
944
|
+
if (query.target[i] === id){ // #id is required
|
|
945
|
+
|
|
946
|
+
all = true;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
if (all){ // make it work only with ID ???
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
operations.push(query.log);
|
|
960
|
+
|
|
961
|
+
let range = `\n @media (min-width: ${startSize}px) and (max-width: ${endSize}px)`;
|
|
962
|
+
this.range = range; // this.range is always the last one!!!
|
|
963
|
+
this.css.push({log: query.log, range: range, rules:[]});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
if (operations.includes("blast")){
|
|
970
|
+
let ft = this.css.map(q => q.log).lastIndexOf("blast");
|
|
971
|
+
//// console.log("BLAST IDO IS " + ft + "TR" + this.range);
|
|
972
|
+
|
|
973
|
+
// should be 0-900
|
|
974
|
+
// is 880-930
|
|
975
|
+
//alert(this.preffersId);
|
|
976
|
+
//alert(this.class);
|
|
977
|
+
|
|
978
|
+
this.css[ft].rules.push(`
|
|
979
|
+
${this.preffersId ? id : "." + this.class}{
|
|
980
|
+
-webkit-text-stroke-width: 1px;
|
|
981
|
+
-webkit-text-stroke-color: orange;
|
|
982
|
+
-webkit-text-fill-color: transparent;
|
|
983
|
+
}
|
|
984
|
+
`);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
if (operations.includes("gradient")){
|
|
988
|
+
//let ft = this.css.map(q => q.range).lastIndexOf(this.range);
|
|
989
|
+
//// console.log("IDO IS " + ft);
|
|
990
|
+
let ft = this.css.map(q => q.log).lastIndexOf("gradient");
|
|
991
|
+
// // console.log("BLAST IDO IS " + ft + "TR" + this.range);
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
this.css[ft].rules.push(`
|
|
995
|
+
${this.preffersId ? id : "." + this.class}{
|
|
996
|
+
background: ${this.globalGradient};
|
|
997
|
+
-webkit-background-clip: text;
|
|
998
|
+
-webkit-text-fill-color: transparent;
|
|
999
|
+
}
|
|
1000
|
+
`);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (operations.includes("background")){
|
|
1004
|
+
//let ft = this.css.map(q => q.range).lastIndexOf(this.range);
|
|
1005
|
+
//// console.log("IDO IS " + ft);
|
|
1006
|
+
let ft = this.css.map(q => q.log).lastIndexOf("background");
|
|
1007
|
+
// console.log("ABLAST IDO IS " + ft + "TR" + this.range);
|
|
1008
|
+
//alert("Hello" + ft);
|
|
1009
|
+
//alert(this.class);
|
|
1010
|
+
this.css[ft].rules.push(`
|
|
1011
|
+
${this.preffersId ? this.id : "." + this.class}{
|
|
1012
|
+
background: green;
|
|
1013
|
+
}
|
|
1014
|
+
`);
|
|
1015
|
+
|
|
1016
|
+
// console.log("-----Hello-----");
|
|
1017
|
+
// console.warn(this.css[ft]);
|
|
1018
|
+
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
if (operations.includes("shadow")){
|
|
1023
|
+
let ft = this.css.map(q => q.log).lastIndexOf("shadow");
|
|
1024
|
+
|
|
1025
|
+
let str = "";
|
|
1026
|
+
let off = 0;
|
|
1027
|
+
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
1028
|
+
off += 3;
|
|
1029
|
+
str += `drop-shadow(${off}px ${off}px ${off}px gray) `;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// BEWARE OF INDENTATION
|
|
1033
|
+
this.css[ft].rules.push(`
|
|
1034
|
+
${this.preffersId ? this.id : "." + this.class}{
|
|
1035
|
+
filter: ${str};
|
|
1036
|
+
}
|
|
1037
|
+
`);
|
|
1038
|
+
// this.res.style.filter = str;
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
checkQueries();
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
// console.log("FINAL QUERIES HERE");
|
|
1049
|
+
// console.log(this.css.map(r => r.rules));
|
|
1050
|
+
// console.log("::::::::::::::::::::::");
|
|
1051
|
+
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
chainReact(queries, id, keep) { // we use this
|
|
1055
|
+
|
|
1056
|
+
this.cssGen(queries, id, this.class, this.class !== undefined); // 02/04/2024 10:43:40 Nice!!!
|
|
1057
|
+
|
|
1058
|
+
this.ap = false;
|
|
1059
|
+
this.cta = 0;
|
|
1060
|
+
this.once = false;
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
// REPLACE WITH DEFAULT RANGE INSIDE FOR LOOP IF NONE IS FOUND
|
|
1064
|
+
// FOR LET QUEYR OF Q
|
|
1065
|
+
// if !q.range => q.range = ["0px", "99999px"]
|
|
1066
|
+
for (let q of queries){
|
|
1067
|
+
if (!q.range){
|
|
1068
|
+
// console.log("NOPA");
|
|
1069
|
+
q.range = ["0px", "999999px"];
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
1074
|
+
|
|
1075
|
+
// Function to check and log queries based on screen size
|
|
1076
|
+
const checkQueries = () => {
|
|
1077
|
+
//alert("/P")
|
|
1078
|
+
const screenSize = window.visualViewport.width; // window.innerWidth window.screen.width window.visualViewport.width
|
|
1079
|
+
let ops = "";
|
|
1080
|
+
let operations = [];
|
|
1081
|
+
let globalQueries = [];
|
|
1082
|
+
|
|
1083
|
+
this.resCopy = this.res;
|
|
1084
|
+
|
|
1085
|
+
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
1086
|
+
|
|
1087
|
+
for (const query of queries) {
|
|
1088
|
+
this.counterIndex++;
|
|
1089
|
+
|
|
1090
|
+
const [startRange, endRange] = query.range;
|
|
1091
|
+
const startSize = parseInt(startRange);
|
|
1092
|
+
const endSize = parseInt(endRange);
|
|
1093
|
+
let all = true;
|
|
1094
|
+
|
|
1095
|
+
if (query.target){
|
|
1096
|
+
|
|
1097
|
+
all = false;
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
for (var i = 0; i < query.target.length; i++){
|
|
1101
|
+
|
|
1102
|
+
if (query.target[i] === id){ // #id is required
|
|
1103
|
+
|
|
1104
|
+
all = true;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
if (screenSize >= startSize && screenSize <= endSize && all) { // NEED TO COMMENT ALL
|
|
1110
|
+
operations.push(query.log);
|
|
1111
|
+
globalQueries.push(query);
|
|
1112
|
+
|
|
1113
|
+
if (query.op && query.op.margin){
|
|
1114
|
+
this.useMargin = query.op.margin;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
if (keep && !keep.includes("background")){
|
|
1123
|
+
this.res.style.background = "";
|
|
1124
|
+
this.res.style.backgroundColor = "";
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
this.res.style.textShadow = "";
|
|
1129
|
+
|
|
1130
|
+
if (keep && !keep.includes("border")){
|
|
1131
|
+
this.res.style.border = "";
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
if (keep && !keep.includes("margin")){
|
|
1136
|
+
this.res.style.margin = "";
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
this.res.style['-webkit-text-fill-color'] = '';
|
|
1141
|
+
this.res.style['-webkit-text-stroke-color'] = "";
|
|
1142
|
+
this.res.style['-webkit-text-stroke-width'] = "";
|
|
1143
|
+
// this.res.style['-webkit-background-clip'] = 'unset';
|
|
1144
|
+
this.res.style.filter = "";
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
// NO CONITION, ALWAYS!!!!
|
|
1148
|
+
if (operations.includes("gradient") || operations.includes("shadow")){
|
|
1149
|
+
this.res.style.position = "relative";
|
|
1150
|
+
this.res.style.zIndex = -1;
|
|
1151
|
+
} // FIX 23:31:56 10/11/24
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
if (operations.includes("blast")){
|
|
1156
|
+
|
|
1157
|
+
let gl = globalQueries.filter(x => x.log === "blast")[0].op.color;
|
|
1158
|
+
// console.log(gl);
|
|
1159
|
+
|
|
1160
|
+
let w = globalQueries.filter(x => x.log === "blast")[0].op.width ?? "1px";
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
1164
|
+
this.res.style.border = `${w}px solid orange`;
|
|
1165
|
+
} else {
|
|
1166
|
+
|
|
1167
|
+
this.res.textContent = this.text; //"a"
|
|
1168
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
1169
|
+
|
|
1170
|
+
this.res.style['-webkit-text-stroke-color'] = gl;//"orange";
|
|
1171
|
+
this.res.style['-webkit-text-stroke-width'] = `${w}`;
|
|
1172
|
+
//alert("HIOH")
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (operations.includes("filter")){
|
|
1177
|
+
let w = globalQueries.filter(x => x.log === "filter")[0]
|
|
1178
|
+
// console.log(w);
|
|
1179
|
+
let filterName = w.op.filter;
|
|
1180
|
+
this.res.style.filter = filterName;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
if (operations.includes("background")){
|
|
1184
|
+
this.res.style.backgroundColor = "green";
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
if (operations.includes("gradient")){
|
|
1188
|
+
|
|
1189
|
+
// Set gradient to text
|
|
1190
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
1191
|
+
this.res.style.background = this.globalGradient;// "linear-gradient(to left, #3498db, #1abc9c)";
|
|
1192
|
+
this.res.style['background-clip'] = 'text'; // 19:23:05 05/05/2024 -webkit was a problem here!
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
// In Safari background linear gradient sets background-clip to border-box; this ai automatically put after
|
|
1196
|
+
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
if (operations.includes("shadow")){
|
|
1201
|
+
if (this.getType() === "FlexRowLayoutElement"){
|
|
1202
|
+
} else {
|
|
1203
|
+
|
|
1204
|
+
let str = "";
|
|
1205
|
+
let off = 0;
|
|
1206
|
+
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
1207
|
+
off += 3;
|
|
1208
|
+
str += `drop-shadow(${off}px ${off}px ${off}px gray) `;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
this.res.style.filter = str;
|
|
1213
|
+
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
if (operations.includes("margin")){
|
|
1218
|
+
for (var i = 0; i < queries.length; i++){
|
|
1219
|
+
if (!queries[i].op){
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
const off = queries[i].op.offsets;
|
|
1224
|
+
|
|
1225
|
+
if (off && this.index !== undefined){
|
|
1226
|
+
this.res.style.margin = off[Number(this.index)] + "px";
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/*if (operations.includes("spana") || operations.includes("span")){
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
this.res = this.resCopy;
|
|
1235
|
+
|
|
1236
|
+
if (this.options.span){
|
|
1237
|
+
let noiseObject;
|
|
1238
|
+
|
|
1239
|
+
if (Array.isArray(this.options.span)){
|
|
1240
|
+
noiseObject = this.options.span.filter(a => a.op.name === "span")[0];
|
|
1241
|
+
} else {
|
|
1242
|
+
noiseObject = this.options.span;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
this.res.textContent = ""; // creating new element not helping
|
|
1246
|
+
|
|
1247
|
+
for (var i = 0; i < noiseObject.op.parts.length; i++){
|
|
1248
|
+
let opts = noiseObject.op.parts[i].style;
|
|
1249
|
+
let span = new Text(noiseObject.op.parts[i].text).setup({type: "span"}).set(opts).render();
|
|
1250
|
+
this.res.appendChild(span);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
} else {
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
while (this.res.firstChild) {
|
|
1260
|
+
this.res.removeChild(this.res.firstChild);
|
|
1261
|
+
}
|
|
1262
|
+
let t = new Text(this.prevText).set({}).render();
|
|
1263
|
+
this.res.appendChild(t);
|
|
1264
|
+
}*/
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
if (id === "#home"){
|
|
1272
|
+
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
if (operations.includes("animation")) {
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
if (this.options.animation && !this.hasAnimated && !this.options.animation.op.fireAt){
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
this.hasAnimated = true;
|
|
1283
|
+
let ass = this.options.animation.op;
|
|
1284
|
+
|
|
1285
|
+
this.res.animate(ass.keyframesClose, {
|
|
1286
|
+
duration: 0,
|
|
1287
|
+
fill: "forwards"
|
|
1288
|
+
});
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
this.res.animate(ass.keyframesOpen, ass.openOptions);
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
// 18:42:30 it works! 02/02/2025
|
|
1298
|
+
// Thanks ChatGPT!
|
|
1299
|
+
if (this.options.animation && this.options.animation.op.fireAt && this.options.animation.op.fireAt.endsWith("px")) {
|
|
1300
|
+
|
|
1301
|
+
let ass = this.options.animation.op;
|
|
1302
|
+
|
|
1303
|
+
this.res.animate(ass.keyframesClose, {
|
|
1304
|
+
duration: 0,
|
|
1305
|
+
fill: "forwards"
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
const scrollHandler = () => {
|
|
1309
|
+
if (window.scrollY > parseFloat(ass.fireAt)) {
|
|
1310
|
+
this.res.animate(ass.keyframesOpen, ass.openOptions);
|
|
1311
|
+
window.removeEventListener("scroll", scrollHandler);
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
window.addEventListener("scroll", scrollHandler);
|
|
1316
|
+
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
if (this.options.animation && this.options.animation.op.fireAt && this.options.animation.op.fireAt === "inview") {
|
|
1320
|
+
|
|
1321
|
+
let ass = this.options.animation.op;
|
|
1322
|
+
|
|
1323
|
+
this.res.animate(ass.keyframesClose, {
|
|
1324
|
+
duration: 0,
|
|
1325
|
+
fill: "forwards"
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
const observer = new IntersectionObserver((entries, observer) => {
|
|
1330
|
+
entries.forEach(entry => {
|
|
1331
|
+
if (entry.isIntersecting) {
|
|
1332
|
+
// console.log("Element is in view!");
|
|
1333
|
+
this.res.animate(ass.keyframesOpen, ass.openOptions);
|
|
1334
|
+
// Perform your action here
|
|
1335
|
+
observer.disconnect(); // Stop observing if you only want it to fire once
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
// Start observing the element
|
|
1341
|
+
observer.observe(this.res);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// Add an event listener to check queries on window resize
|
|
1350
|
+
window.addEventListener('resize', checkQueries);
|
|
1351
|
+
checkQueries();
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
//--------- END OF INDEPENDENT
|
|
1355
|
+
|
|
1356
|
+
reactOnTransform = (obj) => {
|
|
1357
|
+
|
|
1358
|
+
if (obj.transform || obj.op && obj.op.transform){
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
let transform = obj.transform;
|
|
1362
|
+
|
|
1363
|
+
if (!obj.transform ){ // 21:48:05 Nice!!! 30/03/25
|
|
1364
|
+
transform = obj.op.transform;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
if (!transform.duration){
|
|
1368
|
+
transform.duration = "3s-ease-in-out";
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
this.setDefault = (value, defaultValue = "0px") => {
|
|
1373
|
+
return value.length === 0 ? defaultValue + " " : value;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
const convertRotateString = (input) => {
|
|
1377
|
+
const match = input.match(/rotate\(([^)]+)\)/);
|
|
1378
|
+
if (!match) return input; // Return unchanged if no match found
|
|
1379
|
+
|
|
1380
|
+
const values = match[1].split(',').map(v => v.trim());
|
|
1381
|
+
|
|
1382
|
+
if (values.length === 1) {
|
|
1383
|
+
return `rotate(${values[0]})`;
|
|
1384
|
+
} else if (values.length === 2) {
|
|
1385
|
+
return `rotateX(${values[0]}) rotateY(${values[1]})`;
|
|
1386
|
+
} else if (values.length === 3) {
|
|
1387
|
+
return `rotateX(${values[0]}) rotateY(${values[1]}) rotate(${values[2]})`;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
return input; // Return unchanged if more than 3 values
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
const perform = () => {
|
|
1395
|
+
let translateX = '';
|
|
1396
|
+
let translateY = '';
|
|
1397
|
+
let translateZ = '';
|
|
1398
|
+
let scale = '';
|
|
1399
|
+
let skew = '';
|
|
1400
|
+
let rotate = '';
|
|
1401
|
+
let perspective = '';
|
|
1402
|
+
let matrix = '';
|
|
1403
|
+
let opacity = '';
|
|
1404
|
+
|
|
1405
|
+
// Check if the transform values array is empty
|
|
1406
|
+
if (transform.values.length === 0) {
|
|
1407
|
+
return; // If the array is empty, exit the function
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
// Loop through the transform values and extract the needed ones
|
|
1411
|
+
transform.values.forEach(value => {
|
|
1412
|
+
if (value.startsWith('tx:')) {
|
|
1413
|
+
translateX = value.replace('tx:', ''); // Extract -20px from ty:-20px
|
|
1414
|
+
} if (value.startsWith('ty:')) {
|
|
1415
|
+
translateY = value.replace('ty:', ''); // Extract -20px from ty:-20px
|
|
1416
|
+
} if (value.startsWith('tz:')) {
|
|
1417
|
+
translateZ = value.replace('tz:', ''); // Extract -20px from ty:-20px
|
|
1418
|
+
} else if (value.startsWith('scale(')) {
|
|
1419
|
+
scale = value; // Extract scale(3) or any other scale
|
|
1420
|
+
} else if (value.startsWith("skew(")) {
|
|
1421
|
+
skew = value;
|
|
1422
|
+
} else if (value.startsWith("rotate(")) {
|
|
1423
|
+
rotate = convertRotateString(value);
|
|
1424
|
+
} else if (value.startsWith("perspective(")) {
|
|
1425
|
+
perspective = value;
|
|
1426
|
+
} else if (value.startsWith("matrix(")) {
|
|
1427
|
+
matrix = value;
|
|
1428
|
+
} else if (value.startsWith("opacity:")) {
|
|
1429
|
+
opacity = value.replace('opacity:', '');
|
|
1430
|
+
//alert(opacity);
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
translateX = this.setDefault(translateX);
|
|
1437
|
+
translateY = this.setDefault(translateY);
|
|
1438
|
+
translateZ = this.setDefault(translateZ);
|
|
1439
|
+
|
|
1440
|
+
// Apply the transform to the element, only if translateY or scale is present
|
|
1441
|
+
let transformValue = '';
|
|
1442
|
+
// PROBLEM HERE
|
|
1443
|
+
// transformValue += `translate(30px, 0px, 0px)`; // CSS translate has only two vals (need trans3D for 3)
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
if (translateY != "0px" && translateX != "0px" && translateZ != "0px") {
|
|
1447
|
+
transformValue += `translate3d(${translateX}, ${translateY}, ${translateZ})`;
|
|
1448
|
+
} else if (translateY != "0px" || translateX != "0px") {
|
|
1449
|
+
transformValue += `translate(${translateX}, ${translateY})`
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
if (scale) transformValue += ` ${scale}`;
|
|
1454
|
+
if (rotate) transformValue += ` ${rotate}`;
|
|
1455
|
+
if (skew) transformValue += ` ${skew}`;
|
|
1456
|
+
if (perspective) transformValue += ` ${perspective}`;
|
|
1457
|
+
if (matrix) transformValue += ` ${matrix}`;
|
|
1458
|
+
|
|
1459
|
+
if (transformValue) {
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
if (obj.op.transform.duration){ // transform 3s in and out takes 8 secs instead of 6....
|
|
1463
|
+
let newStr = obj.op.transform.duration.replace(/^(\d+)(s)-/, (_, n, s) => n / 2 + s + " ");
|
|
1464
|
+
let trans = `transform ${newStr}, opacity ${newStr}`; // Reset transition
|
|
1465
|
+
this.res.style.transition = trans;
|
|
1466
|
+
} else {
|
|
1467
|
+
this.res.style.transition = "transform 3s ease-in-out, opacity 3s ease-in-out"; // Reset transition
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
// 17:37:15 a comma was missing
|
|
1471
|
+
this.res.style.transform = transformValue;
|
|
1472
|
+
this.res.style.opacity = opacity;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
if (transform.on){
|
|
1478
|
+
this.res.addEventListener(transform.on, () => {
|
|
1479
|
+
if (transform.delay) {
|
|
1480
|
+
setTimeout(() => {
|
|
1481
|
+
perform();
|
|
1482
|
+
}, transform.delay);
|
|
1483
|
+
|
|
1484
|
+
} else {
|
|
1485
|
+
perform()
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
|
|
1489
|
+
} else {
|
|
1490
|
+
window.addEventListener("load", () => {
|
|
1491
|
+
if (transform.delay) {
|
|
1492
|
+
|
|
1493
|
+
setTimeout(() => {
|
|
1494
|
+
perform();
|
|
1495
|
+
}, transform.delay);
|
|
1496
|
+
} else {
|
|
1497
|
+
perform();
|
|
1498
|
+
}
|
|
1499
|
+
})
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
const reset = () => {
|
|
1506
|
+
let resetTransformValue = '';
|
|
1507
|
+
|
|
1508
|
+
transform.values.forEach(value => {
|
|
1509
|
+
if (value.startsWith('tx:')) {
|
|
1510
|
+
resetTransformValue += "translateX(0) ";
|
|
1511
|
+
} else if (value.startsWith('ty:')) {
|
|
1512
|
+
resetTransformValue += "translateY(0) ";
|
|
1513
|
+
} else if (value.startsWith('tz:')) {
|
|
1514
|
+
resetTransformValue += "translateZ(0) ";
|
|
1515
|
+
} else if (value.startsWith('scale(')) {
|
|
1516
|
+
resetTransformValue += "scale(1) ";
|
|
1517
|
+
} else if (value.startsWith('skew(')) {
|
|
1518
|
+
resetTransformValue += "skew(0, 0) "; // Assuming 2D skew reset
|
|
1519
|
+
} else if (value.startsWith('rotate(')) {
|
|
1520
|
+
resetTransformValue += "rotate(0) ";
|
|
1521
|
+
} else if (value.startsWith('perspective(')) {
|
|
1522
|
+
resetTransformValue += "perspective(0) "; // Assuming 0 for perspective
|
|
1523
|
+
} else if (value.startsWith('matrix(')) {
|
|
1524
|
+
resetTransformValue += "matrix(1, 0, 0, 1, 0, 0) "; // Reset to identity matrix
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
this.res.style.opacity = "1";
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
// Apply reset transform if any values were provided
|
|
1533
|
+
if (resetTransformValue) {
|
|
1534
|
+
// this.res.style.transition = "transform 0.5s ease-in-out"; // Reset transition
|
|
1535
|
+
this.res.style.transform = resetTransformValue.trim(); // Remove trailing space
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
if (transform.on){
|
|
1541
|
+
|
|
1542
|
+
this.res.addEventListener("mouseout", () => {
|
|
1543
|
+
if (!transform.keep){
|
|
1544
|
+
reset();
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
});
|
|
1548
|
+
} else {
|
|
1549
|
+
let duration = parseFloat(transform.duration) * 1000;
|
|
1550
|
+
let resetAfter = transform.closeAfter ? transform.closeAfter : 0;
|
|
1551
|
+
|
|
1552
|
+
setTimeout(() => {
|
|
1553
|
+
if (!transform.keep) {
|
|
1554
|
+
reset();
|
|
1555
|
+
}
|
|
1556
|
+
}, duration / 2 + resetAfter); // 15:16:26 Nice!!!
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
maxWidth(w){
|
|
1568
|
+
this.res.style.maxWidth = w;
|
|
1569
|
+
return this;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
removeQuotesFromFirstWord(jsonString) {
|
|
1573
|
+
const modifiedJSON = jsonString.replace(/"([^"]+)":/g, '$1:');
|
|
1574
|
+
return modifiedJSON;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
arrayMargin(arr, value) { // 224857 redefined earlier
|
|
1579
|
+
|
|
1580
|
+
// // console.log(arr);
|
|
1581
|
+
if (arr.includes("left")){
|
|
1582
|
+
this.res.style.marginLeft = value;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
if (arr.includes("right")){
|
|
1586
|
+
this.res.style.marginRight = value;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
if (arr.includes("top")){
|
|
1590
|
+
this.res.style.marginTop = value;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
if (arr.includes("bottom")){
|
|
1594
|
+
this.res.style.marginBottom = value;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
if (arr.includes("all")){
|
|
1598
|
+
this.res.style.margin = value;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
if (!value){
|
|
1602
|
+
this.res.style.marginBottom = arr;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
return this;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
navBarExpand(){
|
|
1610
|
+
this.res.style.backgroundColor = "green";
|
|
1611
|
+
this.res.animate([
|
|
1612
|
+
{transform: "scaleY(3.0)"}
|
|
1613
|
+
], {
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
duration: 2000,
|
|
1617
|
+
iterations: 1,
|
|
1618
|
+
fill: "both"
|
|
1619
|
+
|
|
1620
|
+
})//.play();
|
|
1621
|
+
|
|
1622
|
+
return this;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
scrollFade(duration, direction){
|
|
1631
|
+
this.res.style.visibility = "hidden";
|
|
1632
|
+
this.faden(duration, direction, "scroll");
|
|
1633
|
+
return this;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
expand(obj){
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
if (this.state.isExpanded === false){
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
if (obj.on === "click"){
|
|
1647
|
+
this.res.addEventListener("click", () => {
|
|
1648
|
+
this.innerExpand(obj);
|
|
1649
|
+
// this.moveUp(obj);
|
|
1650
|
+
});
|
|
1651
|
+
} else {
|
|
1652
|
+
this.innerExpand(obj);
|
|
1653
|
+
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
} else {
|
|
1657
|
+
|
|
1658
|
+
this.innerExpandBack(obj);
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
this.state.isExpanded = !this.state.isExpanded;
|
|
1664
|
+
|
|
1665
|
+
// // // console.log("IS EXPANDED: " + this.state.isExpanded);
|
|
1666
|
+
return this;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
move(obj){
|
|
1671
|
+
|
|
1672
|
+
if (obj.on === "click"){
|
|
1673
|
+
this.res.addEventListener("click", () => {
|
|
1674
|
+
this.moveUpa(obj);
|
|
1675
|
+
// this.moveUp(obj);
|
|
1676
|
+
});
|
|
1677
|
+
} else {
|
|
1678
|
+
if (obj.direction === "up"){
|
|
1679
|
+
this.moveUpa(obj);
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
if (obj.direction === "down"){
|
|
1683
|
+
this.moveDowna(obj);
|
|
1684
|
+
}
|
|
1685
|
+
// }
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
this.state.isMovedUp = !this.state.isMovedUp;
|
|
1689
|
+
|
|
1690
|
+
if (obj.direction === "left"){
|
|
1691
|
+
this.moveLeft(obj);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
return this;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
moveLeft(obj){
|
|
1702
|
+
this.res.animate([
|
|
1703
|
+
{transform: `translateX(0px)`},
|
|
1704
|
+
{transform: `translateX(-${obj.distance})`},
|
|
1705
|
+
|
|
1706
|
+
],{
|
|
1707
|
+
|
|
1708
|
+
duration: 900,
|
|
1709
|
+
iterations: obj.iterations,
|
|
1710
|
+
fill: "both"
|
|
1711
|
+
}).play();
|
|
1712
|
+
|
|
1713
|
+
return this;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
moveUpa(obj){
|
|
1718
|
+
if (this.state.isMovedUp === false){
|
|
1719
|
+
|
|
1720
|
+
this.res.animate([
|
|
1721
|
+
{transform: `translateX(0px)`},
|
|
1722
|
+
{transform: `translateY(-${obj.distance})`},
|
|
1723
|
+
],{
|
|
1724
|
+
duration: 900,
|
|
1725
|
+
iterations: obj.iterations,
|
|
1726
|
+
fill: "both"
|
|
1727
|
+
}).play();
|
|
1728
|
+
|
|
1729
|
+
} else {
|
|
1730
|
+
|
|
1731
|
+
this.res.animate([
|
|
1732
|
+
{transform: `translateX(0px)`},
|
|
1733
|
+
{transform: `translateY(${obj.distance})`},
|
|
1734
|
+
],{
|
|
1735
|
+
duration: 900,
|
|
1736
|
+
iterations: obj.iterations,
|
|
1737
|
+
fill: "both"
|
|
1738
|
+
}).play();
|
|
1739
|
+
|
|
1740
|
+
}
|
|
1741
|
+
return this;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
moveDowna(obj){
|
|
1746
|
+
if (this.state.isMovedDown === false){
|
|
1747
|
+
|
|
1748
|
+
this.res.animate([
|
|
1749
|
+
{transform: `translateX(0px)`},
|
|
1750
|
+
{transform: `translateY(${obj.distance})`},
|
|
1751
|
+
],{
|
|
1752
|
+
duration: 900,
|
|
1753
|
+
iterations: obj.iterations,
|
|
1754
|
+
fill: "both"
|
|
1755
|
+
}).play();
|
|
1756
|
+
|
|
1757
|
+
} else {
|
|
1758
|
+
|
|
1759
|
+
this.res.animate([
|
|
1760
|
+
{transform: `translateX(0px)`},
|
|
1761
|
+
{transform: `translateY(-${obj.distance})`},
|
|
1762
|
+
],{
|
|
1763
|
+
duration: 900,
|
|
1764
|
+
iterations: obj.iterations,
|
|
1765
|
+
fill: "both"
|
|
1766
|
+
}).play();
|
|
1767
|
+
|
|
1768
|
+
}
|
|
1769
|
+
return this;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
moveUpaBack(obj){
|
|
1775
|
+
this.res.animate([
|
|
1776
|
+
{transform: `translateX(0px)`},
|
|
1777
|
+
],{
|
|
1778
|
+
|
|
1779
|
+
duration: 900,
|
|
1780
|
+
iterations: obj.iterations,
|
|
1781
|
+
fill: "both"
|
|
1782
|
+
}).play();
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
return this;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
innerExpandBack(obj){
|
|
1791
|
+
this.res.animate([
|
|
1792
|
+
|
|
1793
|
+
|
|
1794
|
+
{width: this.prevWidth,
|
|
1795
|
+
height: this.prevHeight},
|
|
1796
|
+
|
|
1797
|
+
// {width: "100px", height: "100px"}
|
|
1798
|
+
],{
|
|
1799
|
+
|
|
1800
|
+
duration: 900,
|
|
1801
|
+
iterations: obj.iterations,
|
|
1802
|
+
fill: "both"
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
innerExpand(obj){
|
|
1807
|
+
this.prevWidth = this.res.style.width;
|
|
1808
|
+
this.prevHeight = this.res.style.height;
|
|
1809
|
+
|
|
1810
|
+
this.res.animate([
|
|
1811
|
+
{width: this.prevWidth,
|
|
1812
|
+
height: this.prevHeight},
|
|
1813
|
+
|
|
1814
|
+
{width: obj.width ?? this.prevWidth,
|
|
1815
|
+
height: obj.height ?? this.prevHeight},
|
|
1816
|
+
],{
|
|
1817
|
+
|
|
1818
|
+
duration: 900,
|
|
1819
|
+
iterations: obj.iterations,
|
|
1820
|
+
fill: "both"
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
return this;
|
|
1824
|
+
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
fade(obj){
|
|
1829
|
+
|
|
1830
|
+
this.res.style.visibility = "hidden";
|
|
1831
|
+
this.faden(obj.duration, obj.from, "load");
|
|
1832
|
+
|
|
1833
|
+
if (obj.finalOpacity){
|
|
1834
|
+
this.finalOpacity = obj.finalOpacity;
|
|
1835
|
+
}
|
|
1836
|
+
return this;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
faden(duration, direction, event){
|
|
1840
|
+
this.res.style.visibility = "hidden";
|
|
1841
|
+
this.scrolled = false;
|
|
1842
|
+
|
|
1843
|
+
window.addEventListener(event, () => {
|
|
1844
|
+
this.res.style.visibility = "visible";
|
|
1845
|
+
var height = window.innerHeight;
|
|
1846
|
+
var top = this.res.getBoundingClientRect().top;
|
|
1847
|
+
if ((top - height <= 0) || (event == "load")) {
|
|
1848
|
+
|
|
1849
|
+
if (this.scrolled == false){
|
|
1850
|
+
|
|
1851
|
+
if (direction == "left"){
|
|
1852
|
+
|
|
1853
|
+
this.res.animate([
|
|
1854
|
+
{transform: "translateX(-30px)"},
|
|
1855
|
+
{transform: "translateX(0px)"},
|
|
1856
|
+
],{
|
|
1857
|
+
|
|
1858
|
+
duration: duration,
|
|
1859
|
+
iterations: 1
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
if (direction == "right"){
|
|
1864
|
+
|
|
1865
|
+
this.res.animate([
|
|
1866
|
+
{transform: "translateX(30px)"},
|
|
1867
|
+
{transform: "translateX(0px)"},
|
|
1868
|
+
],{
|
|
1869
|
+
|
|
1870
|
+
duration: duration,
|
|
1871
|
+
iterations: 1
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
if (direction == "top"){
|
|
1877
|
+
this.res.animate([
|
|
1878
|
+
{transform: "translateY(-30px)"},
|
|
1879
|
+
{transform: "translateY(0px)"},
|
|
1880
|
+
],{
|
|
1881
|
+
|
|
1882
|
+
duration: duration,
|
|
1883
|
+
iterations: 1
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
if (direction == "bottom"){
|
|
1889
|
+
this.res.animate([
|
|
1890
|
+
{transform: "translateY(30px)"},
|
|
1891
|
+
{transform: "translateY(0px)"},
|
|
1892
|
+
],{
|
|
1893
|
+
|
|
1894
|
+
duration: duration,
|
|
1895
|
+
iterations: 1
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
this.res.animate([
|
|
1900
|
+
{opacity: "0.0"},
|
|
1901
|
+
{opacity: "1.0"}
|
|
1902
|
+
],{
|
|
1903
|
+
duration: duration,
|
|
1904
|
+
iterations: 1
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
this.scrolled = true;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
});
|
|
1911
|
+
return this;
|
|
1912
|
+
}
|
|
1913
|
+
} // 2600-1870
|
|
1914
|
+
|
|
1915
|
+
export { Animator };
|