nodality 1.0.216 → 1.0.217
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 -1
- package/dist/animator.cjs.js.LICENSE.txt +1 -1
- package/dist/animator.esm.js +1 -1
- package/dist/animator.esm.js.LICENSE.txt +1 -1
- package/dist/audionew.cjs.js +1 -1
- package/dist/audionew.cjs.js.LICENSE.txt +1 -1
- package/dist/audionew.esm.js +1 -1
- package/dist/audionew.esm.js.LICENSE.txt +1 -1
- package/dist/base.cjs.js +1 -1
- package/dist/base.cjs.js.LICENSE.txt +1 -1
- package/dist/base.esm.js +1 -1
- package/dist/base.esm.js.LICENSE.txt +1 -1
- package/dist/beta-desktop-bar.cjs.js +1 -1
- package/dist/beta-desktop-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/beta-desktop-bar.esm.js +1 -1
- package/dist/beta-desktop-bar.esm.js.LICENSE.txt +1 -1
- package/dist/beta-mobile-bar.cjs.js +1 -1
- package/dist/beta-mobile-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/beta-mobile-bar.esm.js +1 -1
- package/dist/beta-mobile-bar.esm.js.LICENSE.txt +1 -1
- package/dist/bundle.umd.js +1 -1
- package/dist/bundle.umd.js.LICENSE.txt +1 -1
- package/dist/button.cjs.js +1 -1
- package/dist/button.cjs.js.LICENSE.txt +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/button.esm.js.LICENSE.txt +1 -1
- package/dist/card-getter.cjs.js.LICENSE.txt +1 -1
- package/dist/card-getter.esm.js.LICENSE.txt +1 -1
- package/dist/center.cjs.js +1 -1
- package/dist/center.cjs.js.LICENSE.txt +1 -1
- package/dist/center.esm.js +1 -1
- package/dist/center.esm.js.LICENSE.txt +1 -1
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.cjs.js.LICENSE.txt +1 -1
- package/dist/checkbox.esm.js +1 -1
- package/dist/checkbox.esm.js.LICENSE.txt +1 -1
- package/dist/code.cjs.js +1 -1
- package/dist/code.cjs.js.LICENSE.txt +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/code.esm.js.LICENSE.txt +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.cjs.js.LICENSE.txt +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/container.esm.js.LICENSE.txt +1 -1
- package/dist/data-list.cjs.js.LICENSE.txt +1 -1
- package/dist/data-list.esm.js.LICENSE.txt +1 -1
- package/dist/designer.cjs.js +1 -1
- package/dist/designer.cjs.js.LICENSE.txt +1 -1
- package/dist/designer.esm.js +1 -1
- package/dist/designer.esm.js.LICENSE.txt +1 -1
- package/dist/element-mapper.cjs.js +1 -1
- package/dist/element-mapper.cjs.js.LICENSE.txt +1 -1
- package/dist/element-mapper.esm.js +1 -1
- package/dist/element-mapper.esm.js.LICENSE.txt +1 -1
- package/dist/finalresult.esm.js +1 -1
- package/dist/finalresult.esm.js.LICENSE.txt +1 -1
- package/dist/flex-card.cjs.js +1 -1
- package/dist/flex-card.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-card.esm.js +1 -1
- package/dist/flex-card.esm.js.LICENSE.txt +1 -1
- package/dist/flex-grid.cjs.js +1 -1
- package/dist/flex-grid.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-grid.esm.js +1 -1
- package/dist/flex-grid.esm.js.LICENSE.txt +1 -1
- package/dist/flex-row.cjs.js +1 -1
- package/dist/flex-row.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-row.esm.js +1 -1
- package/dist/flex-row.esm.js.LICENSE.txt +1 -1
- package/dist/floating-input.cjs.js +1 -1
- package/dist/floating-input.cjs.js.LICENSE.txt +1 -1
- package/dist/floating-input.esm.js +1 -1
- package/dist/floating-input.esm.js.LICENSE.txt +1 -1
- package/dist/free.cjs.js +1 -1
- package/dist/free.cjs.js.LICENSE.txt +1 -1
- package/dist/free.esm.js +1 -1
- package/dist/free.esm.js.LICENSE.txt +1 -1
- package/dist/horizontal-scroller.cjs.js.LICENSE.txt +1 -1
- package/dist/horizontal-scroller.esm.js.LICENSE.txt +1 -1
- package/dist/image-picker.cjs.js +1 -1
- package/dist/image-picker.cjs.js.LICENSE.txt +1 -1
- package/dist/image-picker.esm.js +1 -1
- package/dist/image-picker.esm.js.LICENSE.txt +1 -1
- package/dist/image.cjs.js +1 -1
- package/dist/image.cjs.js.LICENSE.txt +1 -1
- package/dist/image.esm.js +1 -1
- package/dist/image.esm.js.LICENSE.txt +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.LICENSE.txt +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.LICENSE.txt +1 -1
- package/dist/keyframe-animation.cjs.js.LICENSE.txt +1 -1
- package/dist/keyframe-animation.esm.js.LICENSE.txt +1 -1
- package/dist/link-getter.cjs.js +1 -1
- package/dist/link-getter.cjs.js.LICENSE.txt +1 -1
- package/dist/link-getter.esm.js +1 -1
- package/dist/link-getter.esm.js.LICENSE.txt +1 -1
- package/dist/link.cjs.js +1 -1
- package/dist/link.cjs.js.LICENSE.txt +1 -1
- package/dist/link.esm.js +1 -1
- package/dist/link.esm.js.LICENSE.txt +1 -1
- package/dist/meta-adder.cjs.js.LICENSE.txt +1 -1
- package/dist/meta-adder.esm.js.LICENSE.txt +1 -1
- package/dist/modal-2025.cjs.js.LICENSE.txt +1 -1
- package/dist/modal-2025.esm.js.LICENSE.txt +1 -1
- package/dist/multiswitcher.cjs.js +1 -1
- package/dist/multiswitcher.cjs.js.LICENSE.txt +1 -1
- package/dist/multiswitcher.esm.js +1 -1
- package/dist/multiswitcher.esm.js.LICENSE.txt +1 -1
- package/dist/new-nav-bar.cjs.js +1 -1
- package/dist/new-nav-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/new-nav-bar.esm.js +1 -1
- package/dist/new-nav-bar.esm.js.LICENSE.txt +1 -1
- package/dist/picker.cjs.js +1 -1
- package/dist/picker.cjs.js.LICENSE.txt +1 -1
- package/dist/picker.esm.js +1 -1
- package/dist/picker.esm.js.LICENSE.txt +1 -1
- package/dist/progress.cjs.js.LICENSE.txt +1 -1
- package/dist/progress.esm.js.LICENSE.txt +1 -1
- package/dist/radio.cjs.js.LICENSE.txt +1 -1
- package/dist/radio.esm.js.LICENSE.txt +1 -1
- package/dist/range.cjs.js.LICENSE.txt +1 -1
- package/dist/range.esm.js.LICENSE.txt +1 -1
- package/dist/scroll-video.cjs.js.LICENSE.txt +1 -1
- package/dist/scroll-video.esm.js.LICENSE.txt +1 -1
- package/dist/side-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/side-bar.esm.js.LICENSE.txt +1 -1
- package/dist/side-nav-bar.cjs.js +1 -1
- package/dist/side-nav-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/side-nav-bar.esm.js +1 -1
- package/dist/side-nav-bar.esm.js.LICENSE.txt +1 -1
- package/dist/simple-bar.cjs.js +1 -1
- package/dist/simple-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/simple-bar.esm.js +1 -1
- package/dist/simple-bar.esm.js.LICENSE.txt +1 -1
- package/dist/slider-2025.cjs.js +1 -1
- package/dist/slider-2025.cjs.js.LICENSE.txt +1 -1
- package/dist/slider-2025.esm.js +1 -1
- package/dist/slider-2025.esm.js.LICENSE.txt +1 -1
- package/dist/spacer.cjs.js.LICENSE.txt +1 -1
- package/dist/spacer.esm.js.LICENSE.txt +1 -1
- package/dist/stack.cjs.js.LICENSE.txt +1 -1
- package/dist/stack.esm.js.LICENSE.txt +1 -1
- package/dist/stacker.cjs.js.LICENSE.txt +1 -1
- package/dist/stacker.esm.js.LICENSE.txt +1 -1
- package/dist/table.cjs.js +1 -1
- package/dist/table.cjs.js.LICENSE.txt +1 -1
- package/dist/table.esm.js +1 -1
- package/dist/table.esm.js.LICENSE.txt +1 -1
- package/dist/text-field.cjs.js +1 -1
- package/dist/text-field.cjs.js.LICENSE.txt +1 -1
- package/dist/text-field.esm.js +1 -1
- package/dist/text-field.esm.js.LICENSE.txt +1 -1
- package/dist/text.cjs.js +1 -1
- package/dist/text.cjs.js.LICENSE.txt +1 -1
- package/dist/text.esm.js +1 -1
- package/dist/text.esm.js.LICENSE.txt +1 -1
- package/dist/theme.cjs.js.LICENSE.txt +1 -1
- package/dist/theme.esm.js.LICENSE.txt +1 -1
- package/dist/transform-anim.cjs.js.LICENSE.txt +1 -1
- package/dist/transform-anim.esm.js.LICENSE.txt +1 -1
- package/dist/ulist.cjs.js +1 -1
- package/dist/ulist.cjs.js.LICENSE.txt +1 -1
- package/dist/ulist.esm.js +1 -1
- package/dist/ulist.esm.js.LICENSE.txt +1 -1
- package/dist/video.cjs.js +1 -1
- package/dist/video.cjs.js.LICENSE.txt +1 -1
- package/dist/video.esm.js +1 -1
- package/dist/video.esm.js.LICENSE.txt +1 -1
- package/dist/wrap.cjs.js.LICENSE.txt +1 -1
- package/dist/wrap.esm.js.LICENSE.txt +1 -1
- package/dist/zoom-card.cjs.js +1 -1
- package/dist/zoom-card.cjs.js.LICENSE.txt +1 -1
- package/dist/zoom-card.esm.js +1 -1
- package/dist/zoom-card.esm.js.LICENSE.txt +1 -1
- package/layout/animator.js +321 -1987
- package/layout/audio.js +1 -1
- package/layout/audionew.js +1 -1
- package/layout/base.js +3 -17
- package/layout/beta-desktop-bar.js +1 -1
- package/layout/beta-mobile-bar.js +2 -9
- package/layout/button.js +1 -1
- package/layout/center.js +3 -10
- package/layout/checkbox.js +1 -1
- package/layout/circle.js +4 -7
- package/layout/code.js +1 -1
- package/layout/container.js +8 -38
- package/layout/dropdown-2025.js +1 -1
- package/layout/flex-card.js +1 -1
- package/layout/flex-grid.js +1 -1
- package/layout/flex-row.js +1 -70
- package/layout/form-components/custom.js +1 -1
- package/layout/form-components/data-list.js +1 -1
- package/layout/form-components/floating-input.js +1 -1
- package/layout/form-components/form-all.js +1 -1
- package/layout/form-components/form.js +1 -1
- package/layout/form-components/image-picker.js +1 -1
- package/layout/form-components/picker.js +1 -1
- package/layout/form-components/radio.js +1 -1
- package/layout/form-components/radiogroup.js +1 -1
- package/layout/form-components/range.js +1 -1
- package/layout/free.js +1 -1
- package/layout/grid-switcher.js +5 -12
- package/layout/grid.js +1 -40
- package/layout/horizontal-scroller.js +1 -1
- package/layout/image.js +10 -90
- package/layout/index.js +1 -1
- package/layout/link.js +1 -14
- package/layout/list.js +1 -1
- package/layout/meta-adder.js +1 -1
- package/layout/modal-2025.js +1 -1
- package/layout/multiswitcher.js +1 -1
- package/layout/nav-bar.js +4 -20
- package/layout/nav-factor/custom-div.js +1 -1
- package/layout/new-nav-bar.js +1 -16
- package/layout/polygon.js +1 -1
- package/layout/prerender-site.js +1 -1
- package/layout/prerender.js +1 -1
- package/layout/progress.js +1 -1
- package/layout/row.js +1 -4
- package/layout/scroll-video.js +1 -1
- package/layout/side-bar.js +1 -1
- package/layout/side-nav-bar.js +1 -1
- package/layout/simple-bar.js +1 -1
- package/layout/slider-2025.js +1 -1
- package/layout/spacer.js +1 -1
- package/layout/stack.js +1 -1
- package/layout/svg.js +1 -1
- package/layout/switcher.js +1 -1
- package/layout/table.js +1 -1
- package/layout/text-field.js +5 -11
- package/layout/text.js +4 -574
- package/layout/ulist.js +1 -14
- package/layout/video.js +1 -1
- package/layout/wrap.js +1 -1
- package/layout/zoom-card.js +1 -1
- package/lib/card-getter.js +1 -1
- package/lib/data.js +1 -1
- package/lib/designer.js +1 -1
- package/lib/element-mapper.js +1 -1
- package/lib/keyframe-animation.js +1 -1
- package/lib/link-getter.js +1 -1
- package/lib/raster-ops.js +1 -1
- package/lib/scroll-video.js +1 -1
- package/lib/seo.js +1 -1
- package/lib/stacker.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/transform-anim.js +1 -1
- package/package.json +1 -1
- package/layout/base-2.js +0 -97
- package/layout/cards.js +0 -147
- package/layout/external-stylesheet.js +0 -25
- package/layout/footer.js +0 -89
- package/layout/group.js +0 -129
- package/layout/label.js +0 -56
- package/layout/list-OLD.js +0 -6
- package/layout/navBar-OLD.js +0 -266
- package/layout/new-flat-adder.js +0 -47
- package/layout/offset-container.js +0 -380
- package/layout/saved-new-nav-bar.js +0 -437
- package/layout/without-new.js +0 -66
package/layout/animator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.0.
|
|
2
|
+
* nodality v1.0.217
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -199,47 +199,6 @@ class Animator {
|
|
|
199
199
|
|
|
200
200
|
*/
|
|
201
201
|
commonMethods(obj){ // define in anim
|
|
202
|
-
/* obj.pad && this.pad(obj.pad);
|
|
203
|
-
obj.mar && this.mar(obj.mar);
|
|
204
|
-
obj.respad && this.respad(obj.respad);
|
|
205
|
-
obj.resmar && this.resmar(obj.resmar);
|
|
206
|
-
obj.exact && (this.res.style.fontSize = obj.exact);
|
|
207
|
-
obj.zIndex && (this.res.style.zIndex = obj.zIndex);
|
|
208
|
-
obj.position && (this.res.style.position = obj.position);
|
|
209
|
-
obj.top && (this.res.style.top = obj.top);
|
|
210
|
-
obj.hover && this.hover(obj.hover);
|
|
211
|
-
obj.size && this.fluidCopy(obj.size);
|
|
212
|
-
obj.cursor && (this.res.style.cursor = obj.cursor);
|
|
213
|
-
// width xx, height xx, background xx, radius xx, resprop xx, keySet, maxHeight xx, maxWidth xx
|
|
214
|
-
|
|
215
|
-
obj.width && (this.res.style.width = obj.width);
|
|
216
|
-
obj.maxWidth && (this.res.style.maxWidth = obj.maxWidth);
|
|
217
|
-
|
|
218
|
-
obj.height && (this.res.style.height = obj.height);
|
|
219
|
-
obj.maxHeight && (this.res.style.maxHeight = obj.maxHeight);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
obj.background && (this.res.style.background = obj.background);
|
|
224
|
-
|
|
225
|
-
obj.resprop && this.resprop(obj.resprop);
|
|
226
|
-
|
|
227
|
-
obj.keySet && this.keySet(obj.keySet);
|
|
228
|
-
|
|
229
|
-
// weight, bold, font, hide, radus, lineHeight
|
|
230
|
-
|
|
231
|
-
obj.weight && (this.res.style.fontWeight = obj.weight);
|
|
232
|
-
|
|
233
|
-
obj.bold && (this.res.style.fontWeight = "bold");
|
|
234
|
-
|
|
235
|
-
obj.font && (this.res.style.fontFamily = obj.font);
|
|
236
|
-
|
|
237
|
-
obj.hide && this.isHidden(obj.hide);
|
|
238
|
-
|
|
239
|
-
obj.radius && (this.res.style.borderRadius = obj.radius);
|
|
240
|
-
|
|
241
|
-
obj.lineHeight && (this.res.style.lineHeight = obj.lineHeight);
|
|
242
|
-
*/
|
|
243
202
|
|
|
244
203
|
// Map of obj keys → style properties
|
|
245
204
|
// Extended 2026-04-27 — first-class CSS props so callers don't need keySet.
|
|
@@ -456,21 +415,6 @@ class Animator {
|
|
|
456
415
|
this.prevBoxShadow = this.res.style.boxShadow;
|
|
457
416
|
|
|
458
417
|
|
|
459
|
-
/* if (obj.border){
|
|
460
|
-
//this.res.style.border = `1px solid transparent`;
|
|
461
|
-
if (obj.borderObj && obj.borderObj.width){ // fix here
|
|
462
|
-
|
|
463
|
-
let w = this.options.borderObj.width ?? 3;
|
|
464
|
-
this.res.style.border = `${w}px solid transparent`;
|
|
465
|
-
|
|
466
|
-
} else {
|
|
467
|
-
// 14:53:15 this was stupid
|
|
468
|
-
//this.res.style.border = `1px solid transparent`;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
}*/
|
|
474
418
|
|
|
475
419
|
|
|
476
420
|
|
|
@@ -504,14 +448,6 @@ class Animator {
|
|
|
504
448
|
}
|
|
505
449
|
|
|
506
450
|
|
|
507
|
-
/* if (obj.borderObj && obj.borderObj.width){
|
|
508
|
-
|
|
509
|
-
let w = this.options.borderObj.width ?? 3;
|
|
510
|
-
this.res.style.border = `${w}px solid transparent`;
|
|
511
|
-
|
|
512
|
-
} else {
|
|
513
|
-
//this.res.style.border = `1px solid transparent`;
|
|
514
|
-
}*/
|
|
515
451
|
|
|
516
452
|
|
|
517
453
|
/*if (obj.border){
|
|
@@ -651,51 +587,12 @@ class Animator {
|
|
|
651
587
|
this.prevText = prevText;
|
|
652
588
|
}
|
|
653
589
|
|
|
654
|
-
getCSS(){
|
|
655
|
-
return this.css;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
590
|
|
|
659
|
-
getPX(value) {
|
|
660
|
-
const breakpoints = {
|
|
661
|
-
xs: "0px", // Extra small
|
|
662
|
-
sm: "576px", // Small
|
|
663
|
-
md: "768px", // Medium
|
|
664
|
-
lg: "992px", // Large
|
|
665
|
-
xl: "1200px", // Extra large
|
|
666
|
-
xxl: "1400px", // Extra extra large
|
|
667
|
-
mxxl: "1800px" // Extra extra large
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
return breakpoints[value] || "Invalid breakpoint"; // Fallback for invalid input
|
|
671
|
-
}
|
|
672
591
|
|
|
673
592
|
// [{ breakpoint: "sm" , values: [...]}]
|
|
674
|
-
/*respad(arr){
|
|
675
|
-
const react = () => { // 00:49:12 22/03/2025
|
|
676
|
-
this.pad(arr[0].values);
|
|
677
|
-
|
|
678
|
-
for(let i = 0; i < arr.length; i++) {
|
|
679
|
-
let point = arr[i].breakpoint;
|
|
680
|
-
if (window.matchMedia(`(min-width: ${this.getPX(point)}`).matches){
|
|
681
|
-
this.pad(arr[i].values);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
593
|
|
|
687
|
-
window.addEventListener("resize", react);
|
|
688
|
-
react();
|
|
689
|
-
}*/
|
|
690
594
|
|
|
691
595
|
|
|
692
|
-
|
|
693
|
-
/*
|
|
694
|
-
respad(arr) {
|
|
695
|
-
this._applyResponsive(arr, (applied) => {
|
|
696
|
-
this.pad(applied.values);
|
|
697
|
-
});
|
|
698
|
-
}*/
|
|
699
596
|
/**
|
|
700
597
|
* @private
|
|
701
598
|
* Sets up the single resize listener and runs all registered tasks.
|
|
@@ -989,48 +886,32 @@ respad(arr) {
|
|
|
989
886
|
}
|
|
990
887
|
|
|
991
888
|
|
|
992
|
-
|
|
993
|
-
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
resmar(arr) {
|
|
895
|
+
|
|
994
896
|
// --- 1. CONFIGURATION & NORMALIZATION ---
|
|
995
|
-
|
|
996
|
-
// Breakpoints defined by explicit [min, max] ranges
|
|
997
897
|
const breakpoints = {
|
|
998
|
-
default: [0, 100000],
|
|
999
|
-
|
|
1000
|
-
sm: [576, 767],
|
|
1001
|
-
md: [768, 991],
|
|
1002
|
-
lg: [992, 1199],
|
|
1003
|
-
xl: [1200, 1399],
|
|
1004
|
-
xxl: [1400, 100000]
|
|
898
|
+
default: [0, 100000], xs: [0, 575], sm: [576, 767], md: [768, 991],
|
|
899
|
+
lg: [992, 1199], xl: [1200, 1399], xxl: [1400, 100000]
|
|
1005
900
|
};
|
|
1006
|
-
|
|
1007
|
-
// Control keys: We exclude keys not related to the responsive style or range.
|
|
1008
|
-
const excludedKeys = ['resprop', 'breakpoint', 'range'];
|
|
901
|
+
// Note: 'values' is handled specifically here, so it is not excluded globally.
|
|
1009
902
|
|
|
1010
|
-
// A. Normalize
|
|
903
|
+
// A. Normalize breakpoints and assign range (handles named, [min, max], and "px" inputs)
|
|
1011
904
|
arr.forEach(item => {
|
|
1012
|
-
// 1. Check for named breakpoints (e.g., 'sm', 'md')
|
|
1013
905
|
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1014
906
|
item.range = breakpoints[item.breakpoint];
|
|
1015
|
-
|
|
1016
|
-
// 2. Check if the input is already an array [min, max] (e.g., [600, 700])
|
|
1017
907
|
} else if (Array.isArray(item.breakpoint) && item.breakpoint.length === 2) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
item.range = [
|
|
1021
|
-
parseInt(min, 10),
|
|
1022
|
-
parseInt(max, 10)
|
|
1023
|
-
];
|
|
1024
|
-
|
|
1025
|
-
// 3. Assume the input is a single pixel string (e.g., "700px")
|
|
908
|
+
item.range = [parseInt(item.breakpoint[0], 10), parseInt(item.breakpoint[1], 10)];
|
|
1026
909
|
} else {
|
|
1027
|
-
|
|
1028
|
-
const min = parseInt(item.breakpoint, 10);
|
|
1029
|
-
item.range = [min, 100000];
|
|
910
|
+
item.range = [parseInt(item.breakpoint, 10), 100000];
|
|
1030
911
|
}
|
|
1031
912
|
});
|
|
1032
913
|
|
|
1033
|
-
// B. Sort by the minimum value of the range
|
|
914
|
+
// B. Sort by the minimum value of the range
|
|
1034
915
|
arr.sort((a, b) => a.range[0] - b.range[0]);
|
|
1035
916
|
|
|
1036
917
|
// C. Find/Ensure the base style object
|
|
@@ -1040,23 +921,17 @@ respad(arr) { // COOL
|
|
|
1040
921
|
arr.unshift(defaultItem);
|
|
1041
922
|
}
|
|
1042
923
|
|
|
1043
|
-
// --- 2. STATE CAPTURE & RESET PREPARATION
|
|
924
|
+
// --- 2. STATE CAPTURE & RESET PREPARATION ---
|
|
1044
925
|
|
|
1045
|
-
// D.
|
|
1046
|
-
//
|
|
1047
|
-
// For simplicity with your usage, we will use the 'values' from the defaultItem itself.
|
|
1048
|
-
|
|
1049
|
-
// E. Ensure 'defaultItem' has a 'values' property, or it will use the base config.
|
|
926
|
+
// D. Ensure 'defaultItem' has a 'values' property, falling back to the base
|
|
927
|
+
// `mar` option. Same ordering caveat as respad() — see the note there.
|
|
1050
928
|
if (defaultItem.values === undefined) {
|
|
1051
|
-
|
|
1052
|
-
// If no 'default' values are set, use the base 'pad' option if available.
|
|
1053
|
-
defaultItem.values = this.options.pad || null;
|
|
929
|
+
defaultItem.values = (this.options && (this.options.mar || this.options.pad)) || null;
|
|
1054
930
|
}
|
|
1055
931
|
|
|
1056
932
|
|
|
1057
|
-
// --- 3. CORE LOGIC: The
|
|
1058
|
-
|
|
1059
|
-
const react = () => {
|
|
933
|
+
// --- 3. CORE LOGIC: The Responsive Task Function ---
|
|
934
|
+
const resmarTask = () => {
|
|
1060
935
|
const width = Animator.viewportWidth();
|
|
1061
936
|
let applied = defaultItem;
|
|
1062
937
|
|
|
@@ -1065,1505 +940,382 @@ respad(arr) { // COOL
|
|
|
1065
940
|
const bp = arr[i];
|
|
1066
941
|
const [min, max] = bp.range;
|
|
1067
942
|
|
|
1068
|
-
if (bp.breakpoint === "default")
|
|
1069
|
-
continue; // Skip default, it's the fallback
|
|
1070
|
-
}
|
|
943
|
+
if (bp.breakpoint === "default") continue;
|
|
1071
944
|
|
|
1072
|
-
// Check if width is WITHIN the [min, max] range
|
|
1073
945
|
if (width >= min && width <= max) {
|
|
1074
946
|
applied = bp;
|
|
1075
|
-
break;
|
|
947
|
+
break;
|
|
1076
948
|
}
|
|
1077
949
|
}
|
|
1078
950
|
|
|
1079
951
|
// --- Apply Pad Style ---
|
|
1080
952
|
|
|
1081
|
-
// Determine the final padding value
|
|
1082
|
-
// Use applied.values if it exists, otherwise fall back to defaultItem.values
|
|
953
|
+
// Determine the final padding value: use applied.values if it exists, otherwise defaultItem.values
|
|
1083
954
|
const finalPadValue = applied.values !== undefined ? applied.values : defaultItem.values;
|
|
1084
955
|
|
|
956
|
+
|
|
1085
957
|
|
|
1086
958
|
if (finalPadValue !== undefined && finalPadValue !== null) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
this.pad(finalPadValue);
|
|
959
|
+
// Note: We trust this.pad handles the style application and clearing
|
|
960
|
+
this.mar(finalPadValue);
|
|
1090
961
|
}
|
|
1091
962
|
};
|
|
1092
963
|
|
|
1093
964
|
|
|
1094
|
-
// --- 4.
|
|
965
|
+
// --- 4. REGISTRATION ---
|
|
966
|
+
this._responsiveTasks = this._responsiveTasks || [];
|
|
967
|
+
this._responsiveTasks.push(resmarTask);
|
|
968
|
+
|
|
969
|
+
// Ensure the unified handler is set up and starts listening
|
|
970
|
+
this._setupResponsiveManager();
|
|
971
|
+
}
|
|
1095
972
|
|
|
1096
|
-
// Prevent duplicate listeners
|
|
1097
|
-
if (this._responsiveHandler) window.removeEventListener("resize", this._responsiveHandler);
|
|
1098
|
-
this._responsiveHandler = react;
|
|
1099
973
|
|
|
1100
|
-
window.addEventListener("resize", react);
|
|
1101
|
-
|
|
1102
|
-
// Defer the initial execution to solve the refresh race condition.
|
|
1103
|
-
setTimeout(() => {
|
|
1104
|
-
react();
|
|
1105
|
-
}, 0);
|
|
1106
|
-
}*/
|
|
1107
974
|
|
|
1108
975
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Tells the caller they passed an option that no longer exists as the
|
|
978
|
+
* way to do this, and what to use instead.
|
|
979
|
+
*
|
|
980
|
+
* console.error only, deliberately. alert() is banned in live modules
|
|
981
|
+
* (see the "no live module calls alert()" invariant): alerts had sat in
|
|
982
|
+
* ordinary paths and blocked the page for every visitor, and the ban is
|
|
983
|
+
* worth more than making this one warning louder.
|
|
984
|
+
*/
|
|
985
|
+
deprecatedOption(name, replacement) {
|
|
986
|
+
console.error(`nodality: \`${name}\` is deprecated — use \`${replacement}\` instead.`);
|
|
987
|
+
return this;
|
|
988
|
+
}
|
|
1112
989
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
990
|
+
/**
|
|
991
|
+
* Centres this element's CHILDREN.
|
|
992
|
+
*
|
|
993
|
+
* center: true both axes
|
|
994
|
+
* center: "x" horizontally only
|
|
995
|
+
* center: "y" vertically only
|
|
996
|
+
*
|
|
997
|
+
* Replaces six overlapping methods — toCenter(), toCenter("both"),
|
|
998
|
+
* flexc(), toCol(), centerColumn and simpleCenter(). flexc() was
|
|
999
|
+
* byte-identical to toCenter() and toCol() to toCenter("both"), so the
|
|
1000
|
+
* same behaviour had four names and the two that differed did so by
|
|
1001
|
+
* one property each.
|
|
1002
|
+
*
|
|
1003
|
+
* To centre the element ITSELF inside its parent, that is `mar:
|
|
1004
|
+
* "center"` — a different thing, and the reason the old names were so
|
|
1005
|
+
* easy to confuse.
|
|
1006
|
+
*
|
|
1007
|
+
* Axis-aware rather than fixed. justify-content runs along the main
|
|
1008
|
+
* axis, so in a flex column it is the VERTICAL one and align-items is
|
|
1009
|
+
* horizontal — the opposite of a flex row. The old methods hardcoded
|
|
1010
|
+
* flex-direction: column and so only ever worked one way round; this
|
|
1011
|
+
* reads the direction already set and centres the axis you asked for.
|
|
1012
|
+
* A grid gets justify-items/align-items instead, which is what
|
|
1013
|
+
* simpleCenter() was reaching for without setting a display at all.
|
|
1014
|
+
*/
|
|
1015
|
+
center(axis = true, hint = {}){
|
|
1016
|
+
const s = this.res.style;
|
|
1017
|
+
// The hints matter because this runs from commonMethods, before a
|
|
1018
|
+
// component applies its own `disp`/`flexDir` aliases. Without them
|
|
1019
|
+
// center() sees a bare element, assumes a flex column, and puts the
|
|
1020
|
+
// centring on the wrong property for every row and grid.
|
|
1021
|
+
const display = s.display || hint.display || "";
|
|
1022
|
+
const direction = s.flexDirection || hint.flexDirection || "";
|
|
1023
|
+
const grid = display.includes("grid");
|
|
1024
|
+
|
|
1025
|
+
const x = axis === true || axis === "both" || axis === "x";
|
|
1026
|
+
const y = axis === true || axis === "both" || axis === "y";
|
|
1027
|
+
|
|
1028
|
+
if (grid){
|
|
1029
|
+
if (x){ s.justifyItems = "center"; s.justifyContent = "center"; }
|
|
1030
|
+
if (y){ s.alignItems = "center"; s.alignContent = "center"; }
|
|
1031
|
+
return this;
|
|
1118
1032
|
}
|
|
1033
|
+
|
|
1034
|
+
if (!display.includes("flex")) s.display = "flex";
|
|
1035
|
+
if (!s.flexDirection) s.flexDirection = direction || "column";
|
|
1036
|
+
|
|
1037
|
+
const column = (s.flexDirection || "column").startsWith("column");
|
|
1038
|
+
const mainIsY = column;
|
|
1039
|
+
|
|
1040
|
+
if (mainIsY ? y : x) s.justifyContent = "center";
|
|
1041
|
+
if (mainIsY ? x : y) s.alignItems = "center";
|
|
1042
|
+
return this;
|
|
1119
1043
|
}
|
|
1120
1044
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
_applyResponsive(arr, applyFn) {
|
|
1126
|
-
// Breakpoints defined by explicit [min, max] ranges
|
|
1127
|
-
const breakpoints = {
|
|
1128
|
-
default: [0, 100000],
|
|
1129
|
-
xs: [0, 575],
|
|
1130
|
-
sm: [576, 767],
|
|
1131
|
-
md: [768, 991],
|
|
1132
|
-
lg: [992, 1199],
|
|
1133
|
-
xl: [1200, 1399],
|
|
1134
|
-
xxl: [1400, 100000]
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
// ✅ Normalize breakpoints: Assign the [min, max] array to the 'range' property
|
|
1138
|
-
arr.forEach(item => {
|
|
1139
|
-
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1140
|
-
item.range = breakpoints[item.breakpoint];
|
|
1141
|
-
} else {
|
|
1142
|
-
const min = parseInt(item.breakpoint, 10);
|
|
1143
|
-
item.range = [min, 100000]; // Custom pixel value becomes a Min-Width range
|
|
1144
|
-
}
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
// ✅ Sort by the minimum value of the range (range[0])
|
|
1148
|
-
arr.sort((a, b) => a.range[0] - b.range[0]);
|
|
1045
|
+
isNumber(value) {
|
|
1046
|
+
return typeof value === 'number' && !isNaN(value);
|
|
1047
|
+
}
|
|
1149
1048
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1049
|
+
// Single source of truth for "how wide is the viewport". See the note in
|
|
1050
|
+
// chainReact — visualViewport is preferred (it tracks pinch-zoom) but is
|
|
1051
|
+
// not universally present.
|
|
1052
|
+
static viewportWidth() {
|
|
1053
|
+
if (typeof window === "undefined") return 0;
|
|
1054
|
+
const vv = window.visualViewport;
|
|
1055
|
+
return (vv && typeof vv.width === "number") ? vv.width : window.innerWidth;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
pad(arr){
|
|
1152
1059
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1060
|
+
for(let i = 0; i < arr.length; i++) {
|
|
1061
|
+
|
|
1062
|
+
let keys = Object.keys(arr[i]);
|
|
1063
|
+
for(let j = 0; j < keys.length; j++) {
|
|
1064
|
+
let key = keys[j];
|
|
1065
|
+
let value = arr[i][key];
|
|
1066
|
+
for(let k = 0; k < key.length; k++) {
|
|
1067
|
+
switch(key[k]) {
|
|
1068
|
+
case 'a':
|
|
1069
|
+
|
|
1070
|
+
//alert("OIHOI")
|
|
1071
|
+
this.res.style.padding = this.isNumber(value) ? `${value}px` : value;
|
|
1072
|
+
break;
|
|
1073
|
+
case 't':
|
|
1074
|
+
this.res.style.paddingTop = this.isNumber(value) ? `${value}px` : value;
|
|
1075
|
+
break;
|
|
1076
|
+
case 'l':
|
|
1077
|
+
this.res.style.paddingLeft = this.isNumber(value) ? `${value}px` : value;
|
|
1078
|
+
break;
|
|
1079
|
+
case 'r':
|
|
1080
|
+
this.res.style.paddingRight = this.isNumber(value) ? `${value}px` : value;
|
|
1081
|
+
break;
|
|
1082
|
+
case 'b':
|
|
1083
|
+
this.res.style.paddingBottom = this.isNumber(value) ? `${value}px` : value;
|
|
1084
|
+
break;
|
|
1085
|
+
default:
|
|
1086
|
+
// console.log(`Invalid key: ${key[k]}`);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
return this;
|
|
1092
|
+
}
|
|
1156
1093
|
|
|
1157
|
-
// ✅ RANGE LOGIC: Find the FIRST breakpoint whose range matches the current width.
|
|
1158
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1159
|
-
const bp = arr[i];
|
|
1160
|
-
const [min, max] = bp.range;
|
|
1161
1094
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1095
|
+
as(asa){
|
|
1096
|
+
this.res.style.alignSelf = asa;
|
|
1097
|
+
return this;
|
|
1098
|
+
}
|
|
1165
1099
|
|
|
1166
|
-
// Check if width is WITHIN the [min, max] range
|
|
1167
|
-
if (width >= min && width <= max) {
|
|
1168
|
-
applied = bp;
|
|
1169
|
-
break; // Found the exact range, no need to search further.
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
1100
|
|
|
1173
|
-
applyFn(applied);
|
|
1174
|
-
};
|
|
1175
1101
|
|
|
1102
|
+
mar(arr){
|
|
1176
1103
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1104
|
+
// Shorthand: mar: "center" → margin: 0 auto
|
|
1105
|
+
if (arr === "center"){
|
|
1106
|
+
this.res.style.marginLeft = "auto";
|
|
1107
|
+
this.res.style.marginRight = "auto";
|
|
1108
|
+
return this;
|
|
1109
|
+
}
|
|
1180
1110
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1111
|
+
for(let i = 0; i < arr.length; i++) {
|
|
1112
|
+
let keys = Object.keys(arr[i]);
|
|
1113
|
+
for(let j = 0; j < keys.length; j++) {
|
|
1114
|
+
let key = keys[j];
|
|
1115
|
+
let value = arr[i][key];
|
|
1116
|
+
for(let k = 0; k < key.length; k++) {
|
|
1117
|
+
switch(key[k]) {
|
|
1118
|
+
case 'a':
|
|
1119
|
+
// mar: [{ a: "auto" }] → margin: 0 auto (centers block-level elements)
|
|
1120
|
+
if (value === "auto"){
|
|
1121
|
+
this.res.style.marginLeft = "auto";
|
|
1122
|
+
this.res.style.marginRight = "auto";
|
|
1123
|
+
} else {
|
|
1124
|
+
this.res.style.margin = this.isNumber(value) ? `${value}px` : value;
|
|
1125
|
+
}
|
|
1126
|
+
break;
|
|
1127
|
+
case 't':
|
|
1128
|
+
this.res.style.marginTop = this.isNumber(value) ? `${value}px` : value;
|
|
1129
|
+
break;
|
|
1130
|
+
case 'l':
|
|
1131
|
+
this.res.style.marginLeft = this.isNumber(value) ? `${value}px` : value;
|
|
1132
|
+
break;
|
|
1133
|
+
case 'r':
|
|
1134
|
+
this.res.style.marginRight = this.isNumber(value) ? `${value}px` : value;
|
|
1135
|
+
break;
|
|
1136
|
+
case 'b':
|
|
1137
|
+
this.res.style.marginBottom = this.isNumber(value) ? `${value}px` : value;
|
|
1138
|
+
break;
|
|
1139
|
+
default:
|
|
1140
|
+
// console.log(`Invalid key: ${key[k]}`);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1188
1143
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
const breakpoints = {
|
|
1195
|
-
default: [0, 100000], // Use a huge max for default/base
|
|
1196
|
-
xs: [0, 575],
|
|
1197
|
-
sm: [576, 767],
|
|
1198
|
-
md: [768, 991],
|
|
1199
|
-
lg: [992, 1199], // Corrected range assumption based on XL starting at 1200
|
|
1200
|
-
xl: [1200, 1399],
|
|
1201
|
-
xxl: [1400, 100000] // Use a huge max for the largest range
|
|
1202
|
-
};
|
|
1144
|
+
// Per-entry shorthand: { center: true } → marginLeft/Right = auto
|
|
1145
|
+
if (key === "center" && value === true){
|
|
1146
|
+
this.res.style.marginLeft = "auto";
|
|
1147
|
+
this.res.style.marginRight = "auto";
|
|
1148
|
+
}
|
|
1203
1149
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
/*arr.forEach(item => {
|
|
1209
|
-
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1210
|
-
item.range = breakpoints[item.breakpoint];
|
|
1211
|
-
} else {
|
|
1212
|
-
// If a custom pixel value is used (e.g., "700px"), treat it as a min-width override.
|
|
1213
|
-
const min = parseInt(item.breakpoint, 10);
|
|
1214
|
-
item.range = [min, 100000];
|
|
1215
|
-
}
|
|
1216
|
-
});
|
|
1217
|
-
|
|
1218
|
-
arr.forEach(item => {
|
|
1219
|
-
// 1. Check for named breakpoints (e.g., 'sm', 'md')
|
|
1220
|
-
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1221
|
-
item.range = breakpoints[item.breakpoint];
|
|
1222
|
-
|
|
1223
|
-
// 2. Check if the input is already an array [min, max] (e.g., [600, 700])
|
|
1224
|
-
} else if (Array.isArray(item.breakpoint) && item.breakpoint.length === 2) {
|
|
1225
|
-
const [min, max] = item.breakpoint;
|
|
1226
|
-
|
|
1227
|
-
// Ensure values are treated as numbers and min <= max
|
|
1228
|
-
item.range = [
|
|
1229
|
-
parseInt(min, 10),
|
|
1230
|
-
parseInt(max, 10)
|
|
1231
|
-
];
|
|
1232
|
-
|
|
1233
|
-
// 3. Assume the input is a single pixel string (e.g., "700px")
|
|
1234
|
-
} else {
|
|
1235
|
-
// Treat as a min-width override up to a large maximum
|
|
1236
|
-
const min = parseInt(item.breakpoint, 10);
|
|
1237
|
-
item.range = [min, 100000];
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
|
|
1241
|
-
// B. Sort by the minimum value of the range (range[0])
|
|
1242
|
-
arr.sort((a, b) => a.range[0] - b.range[0]);
|
|
1243
|
-
|
|
1244
|
-
// C. Find/Ensure the base style object
|
|
1245
|
-
let defaultItem = arr.find(item => item.breakpoint === "default");
|
|
1246
|
-
if (!defaultItem) {
|
|
1247
|
-
defaultItem = { breakpoint: "default", range: breakpoints.default };
|
|
1248
|
-
arr.unshift(defaultItem);
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
// --- 2. STATE CAPTURE & RESET PREPARATION ---
|
|
1252
|
-
|
|
1253
|
-
// D. Capture initial non-responsive styles (for global reset)
|
|
1254
|
-
this.prevStyles = {};
|
|
1255
|
-
for (const prop in this.res.style) {
|
|
1256
|
-
if (this.res.style.hasOwnProperty(prop) && isNaN(parseInt(prop))) {
|
|
1257
|
-
this.prevStyles[prop] = this.res.style[prop];
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
// E. Identify all properties that are responsive (defined in *any* breakpoint)
|
|
1262
|
-
const responsiveProps = new Set();
|
|
1263
|
-
arr.forEach(bp => {
|
|
1264
|
-
Object.keys(bp).forEach(key => {
|
|
1265
|
-
if (!excludedKeys.includes(key) && key !== 'range') {
|
|
1266
|
-
responsiveProps.add(key);
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
});
|
|
1270
|
-
|
|
1271
|
-
// F. Ensure 'defaultItem' holds the base/reset value for every responsive property.
|
|
1272
|
-
responsiveProps.forEach(key => {
|
|
1273
|
-
if (defaultItem[key] === undefined) {
|
|
1274
|
-
// Use the initial component option (e.g., color: "white") as the true reset value.
|
|
1275
|
-
defaultItem[key] = this.options[key] || "initial";
|
|
1276
|
-
}
|
|
1277
|
-
});
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
// --- 3. CORE LOGIC: The 'react' function (Responsive Style Application) ---
|
|
1281
|
-
|
|
1282
|
-
const react = () => {
|
|
1283
|
-
const width = Animator.viewportWidth();
|
|
1284
|
-
let applied = defaultItem;
|
|
1285
|
-
|
|
1286
|
-
// 1. RANGE LOGIC: Find the FIRST breakpoint whose range matches the current width.
|
|
1287
|
-
// We skip defaultItem since it's the fallback.
|
|
1288
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1289
|
-
const bp = arr[i];
|
|
1290
|
-
const [min, max] = bp.range;
|
|
1291
|
-
|
|
1292
|
-
if (bp.breakpoint === "default") {
|
|
1293
|
-
continue; // Skip default, it's the fallback
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
// Check if width is WITHIN the [min, max] range
|
|
1297
|
-
if (width >= min && width <= max) {
|
|
1298
|
-
applied = bp;
|
|
1299
|
-
break; // Found the exact range, no need to search further.
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
// --- Apply Styles ---
|
|
1304
|
-
|
|
1305
|
-
// A. Full Reset: Restore all non-responsive styles captured initially.
|
|
1306
|
-
for (const key in this.prevStyles) {
|
|
1307
|
-
this.res.style[key] = this.prevStyles[key];
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
// B. Clear Responsive Props: Apply the 'default' item's base values.
|
|
1311
|
-
responsiveProps.forEach(key => {
|
|
1312
|
-
this.res.style[key] = defaultItem[key];
|
|
1313
|
-
});
|
|
1314
|
-
|
|
1315
|
-
// C. Apply Overrides: Apply the properties of the currently matching breakpoint
|
|
1316
|
-
for (const key in applied) {
|
|
1317
|
-
if (!excludedKeys.includes(key) && key !== 'range') {
|
|
1318
|
-
const value = applied[key];
|
|
1319
|
-
|
|
1320
|
-
if (typeof this[key] === 'function') {
|
|
1321
|
-
// Custom property (e.g., pad, size): call the internal method
|
|
1322
|
-
this[key](value);
|
|
1323
|
-
} else {
|
|
1324
|
-
// Standard CSS property: set the style directly.
|
|
1325
|
-
this.res.style[key] = value;
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
// --- 4. EVENT LISTENERS SETUP ---
|
|
1333
|
-
|
|
1334
|
-
// Prevent duplicate listeners
|
|
1335
|
-
if (this._responsiveHandler) window.removeEventListener("resize", this._responsiveHandler);
|
|
1336
|
-
this._responsiveHandler = react;
|
|
1337
|
-
|
|
1338
|
-
window.addEventListener("resize", react);
|
|
1339
|
-
|
|
1340
|
-
// Defer the initial execution to solve the refresh race condition.
|
|
1341
|
-
setTimeout(() => {
|
|
1342
|
-
react();
|
|
1343
|
-
}, 0);
|
|
1344
|
-
}*/
|
|
1345
|
-
|
|
1346
|
-
/*
|
|
1347
|
-
resprop(arr) {
|
|
1348
|
-
// --- 1. CONFIGURATION & NORMALIZATION ---
|
|
1349
|
-
const breakpoints = {
|
|
1350
|
-
default: 0,
|
|
1351
|
-
xs: [0, 577],
|
|
1352
|
-
sm: [576, 767],
|
|
1353
|
-
md: [768, 991],
|
|
1354
|
-
lg: [992, 993],
|
|
1355
|
-
xl: [1200, 1399],
|
|
1356
|
-
xxl: [1400, 10000]
|
|
1357
|
-
};
|
|
1358
|
-
// Ensure all control keys are excluded
|
|
1359
|
-
const excludedKeys = ['resprop', 'breakpoint', 'value', 'values'];
|
|
1360
|
-
|
|
1361
|
-
// A. Normalize custom breakpoints and assign numeric values to the 'value' property
|
|
1362
|
-
arr.forEach(item => {
|
|
1363
|
-
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1364
|
-
item.value = breakpoints[item.breakpoint];
|
|
1365
|
-
} else {
|
|
1366
|
-
item.value = parseInt(item.breakpoint, 10); // e.g. "700px" → 700
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
|
-
// B. Sort by numeric value ascending
|
|
1371
|
-
arr.sort((a, b) => a.value - b.value);
|
|
1372
|
-
|
|
1373
|
-
// C. Find/Ensure the base style object
|
|
1374
|
-
let defaultItem = arr.find(item => item.breakpoint === "default");
|
|
1375
|
-
if (!defaultItem) {
|
|
1376
|
-
defaultItem = { breakpoint: "default", value: 0 };
|
|
1377
|
-
arr.unshift(defaultItem);
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
// --- 2. STATE CAPTURE & RESET PREPARATION ---
|
|
1381
|
-
|
|
1382
|
-
// D. Capture initial non-responsive styles (for global reset)
|
|
1383
|
-
this.prevStyles = {};
|
|
1384
|
-
for (const prop in this.res.style) {
|
|
1385
|
-
if (this.res.style.hasOwnProperty(prop) && isNaN(parseInt(prop))) {
|
|
1386
|
-
this.prevStyles[prop] = this.res.style[prop];
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
// E. Identify all properties that are responsive (defined in *any* breakpoint)
|
|
1391
|
-
const responsiveProps = new Set();
|
|
1392
|
-
arr.forEach(bp => {
|
|
1393
|
-
Object.keys(bp).forEach(key => {
|
|
1394
|
-
if (!excludedKeys.includes(key)) {
|
|
1395
|
-
responsiveProps.add(key);
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
});
|
|
1399
|
-
|
|
1400
|
-
// F. Ensure 'defaultItem' holds the base/reset value for every responsive property.
|
|
1401
|
-
responsiveProps.forEach(key => {
|
|
1402
|
-
if (defaultItem[key] === undefined) {
|
|
1403
|
-
// Use the initial component option (e.g., color: "white") as the true reset value.
|
|
1404
|
-
defaultItem[key] = this.options[key] || "initial";
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
// --- 3. CORE LOGIC: The 'react' function (Responsive Style Application) ---
|
|
1410
|
-
|
|
1411
|
-
const react = () => {
|
|
1412
|
-
const width = Animator.viewportWidth();
|
|
1413
|
-
let applied = defaultItem;
|
|
1414
|
-
|
|
1415
|
-
// 1. STANDARD MIN-WIDTH LOGIC: Find the LARGEST breakpoint whose MIN-WIDTH is matched.
|
|
1416
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1417
|
-
const bp = arr[i];
|
|
1418
|
-
|
|
1419
|
-
if (bp.breakpoint !== "default" && width >= bp.value) {
|
|
1420
|
-
// Since the array is sorted, this continuously updates 'applied' to the widest match.
|
|
1421
|
-
applied = bp;
|
|
1422
|
-
} else if (width < bp.value) {
|
|
1423
|
-
// Optimization: stop searching once the breakpoint value is greater than the current width.
|
|
1424
|
-
break;
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
// --- Apply Styles ---
|
|
1429
|
-
|
|
1430
|
-
// A. Full Reset: Restore all non-responsive styles captured initially.
|
|
1431
|
-
for (const key in this.prevStyles) {
|
|
1432
|
-
this.res.style[key] = this.prevStyles[key];
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
// B. Clear Responsive Props: Apply the 'default' item's base values (e.g., "white" color)
|
|
1436
|
-
// This is done for all responsive properties to ensure a clean slate before applying overrides.
|
|
1437
|
-
responsiveProps.forEach(key => {
|
|
1438
|
-
this.res.style[key] = defaultItem[key];
|
|
1439
|
-
});
|
|
1440
|
-
|
|
1441
|
-
// C. Apply Overrides: Apply the properties of the currently matching breakpoint
|
|
1442
|
-
for (const key in applied) {
|
|
1443
|
-
if (!excludedKeys.includes(key)) {
|
|
1444
|
-
const value = applied[key];
|
|
1445
|
-
|
|
1446
|
-
if (typeof this[key] === 'function') {
|
|
1447
|
-
// Custom property (e.g., pad, size): call the internal method
|
|
1448
|
-
this[key](value);
|
|
1449
|
-
} else {
|
|
1450
|
-
// Standard CSS property: set the style directly.
|
|
1451
|
-
this.res.style[key] = value;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
};
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
// --- 4. EVENT LISTENERS SETUP (The Fix for Resize/Refresh) ---
|
|
1459
|
-
|
|
1460
|
-
// Prevent duplicate listeners
|
|
1461
|
-
if (this._responsiveHandler) window.removeEventListener("resize", this._responsiveHandler);
|
|
1462
|
-
this._responsiveHandler = react;
|
|
1463
|
-
|
|
1464
|
-
window.addEventListener("resize", react);
|
|
1465
|
-
|
|
1466
|
-
// Run immediately on load/refresh (This ensures the correct styles are applied on initial load)
|
|
1467
|
-
// react();
|
|
1468
|
-
setTimeout(() => {
|
|
1469
|
-
react();
|
|
1470
|
-
}, 0);
|
|
1471
|
-
}*/
|
|
1472
|
-
|
|
1473
|
-
/*
|
|
1474
|
-
resmar(arr) {
|
|
1475
|
-
this._applyResponsive(arr, (applied) => {
|
|
1476
|
-
this.mar(applied.values);
|
|
1477
|
-
});
|
|
1478
|
-
}*/
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
resmar(arr) {
|
|
1482
|
-
|
|
1483
|
-
// --- 1. CONFIGURATION & NORMALIZATION ---
|
|
1484
|
-
const breakpoints = {
|
|
1485
|
-
default: [0, 100000], xs: [0, 575], sm: [576, 767], md: [768, 991],
|
|
1486
|
-
lg: [992, 1199], xl: [1200, 1399], xxl: [1400, 100000]
|
|
1487
|
-
};
|
|
1488
|
-
// Note: 'values' is handled specifically here, so it is not excluded globally.
|
|
1489
|
-
|
|
1490
|
-
// A. Normalize breakpoints and assign range (handles named, [min, max], and "px" inputs)
|
|
1491
|
-
arr.forEach(item => {
|
|
1492
|
-
if (breakpoints[item.breakpoint] !== undefined) {
|
|
1493
|
-
item.range = breakpoints[item.breakpoint];
|
|
1494
|
-
} else if (Array.isArray(item.breakpoint) && item.breakpoint.length === 2) {
|
|
1495
|
-
item.range = [parseInt(item.breakpoint[0], 10), parseInt(item.breakpoint[1], 10)];
|
|
1496
|
-
} else {
|
|
1497
|
-
item.range = [parseInt(item.breakpoint, 10), 100000];
|
|
1498
|
-
}
|
|
1499
|
-
});
|
|
1500
|
-
|
|
1501
|
-
// B. Sort by the minimum value of the range
|
|
1502
|
-
arr.sort((a, b) => a.range[0] - b.range[0]);
|
|
1503
|
-
|
|
1504
|
-
// C. Find/Ensure the base style object
|
|
1505
|
-
let defaultItem = arr.find(item => item.breakpoint === "default");
|
|
1506
|
-
if (!defaultItem) {
|
|
1507
|
-
defaultItem = { breakpoint: "default", range: breakpoints.default };
|
|
1508
|
-
arr.unshift(defaultItem);
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
// --- 2. STATE CAPTURE & RESET PREPARATION ---
|
|
1512
|
-
|
|
1513
|
-
// D. Ensure 'defaultItem' has a 'values' property, falling back to the base
|
|
1514
|
-
// `mar` option. Same ordering caveat as respad() — see the note there.
|
|
1515
|
-
if (defaultItem.values === undefined) {
|
|
1516
|
-
defaultItem.values = (this.options && (this.options.mar || this.options.pad)) || null;
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
// --- 3. CORE LOGIC: The Responsive Task Function ---
|
|
1521
|
-
const resmarTask = () => {
|
|
1522
|
-
const width = Animator.viewportWidth();
|
|
1523
|
-
let applied = defaultItem;
|
|
1524
|
-
|
|
1525
|
-
// 1. RANGE LOGIC: Find the exact breakpoint whose range matches the current width.
|
|
1526
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1527
|
-
const bp = arr[i];
|
|
1528
|
-
const [min, max] = bp.range;
|
|
1529
|
-
|
|
1530
|
-
if (bp.breakpoint === "default") continue;
|
|
1531
|
-
|
|
1532
|
-
if (width >= min && width <= max) {
|
|
1533
|
-
applied = bp;
|
|
1534
|
-
break;
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
// --- Apply Pad Style ---
|
|
1539
|
-
|
|
1540
|
-
// Determine the final padding value: use applied.values if it exists, otherwise defaultItem.values
|
|
1541
|
-
const finalPadValue = applied.values !== undefined ? applied.values : defaultItem.values;
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
if (finalPadValue !== undefined && finalPadValue !== null) {
|
|
1546
|
-
// Note: We trust this.pad handles the style application and clearing
|
|
1547
|
-
this.mar(finalPadValue);
|
|
1548
|
-
}
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
// --- 4. REGISTRATION ---
|
|
1553
|
-
this._responsiveTasks = this._responsiveTasks || [];
|
|
1554
|
-
this._responsiveTasks.push(resmarTask);
|
|
1555
|
-
|
|
1556
|
-
// Ensure the unified handler is set up and starts listening
|
|
1557
|
-
this._setupResponsiveManager();
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
/*resprop(arr) {
|
|
1563
|
-
|
|
1564
|
-
this.prevBackground = this.res.style.background;
|
|
1565
|
-
this.prevWidth = this.res.style.width;
|
|
1566
|
-
this.prevHeight = this.res.style.height;
|
|
1567
|
-
this.prevBorder = this.res.style.border;
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
const react = () => { // 00:49:12 22/03/2025
|
|
1571
|
-
|
|
1572
|
-
this.res.style.background = this.prevBackground;
|
|
1573
|
-
this.res.style.width = this.prevWidth;
|
|
1574
|
-
this.res.style.height = this.prevHeight;
|
|
1575
|
-
this.res.style.border = this.prevBorder;
|
|
1576
|
-
|
|
1577
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1578
|
-
let point = arr[i].breakpoint;
|
|
1579
|
-
if (window.matchMedia(`(max-width: ${this.getPX(point)}`).matches) {
|
|
1580
|
-
const filteredObj = {};
|
|
1581
|
-
for (const key in arr[i]) {
|
|
1582
|
-
if (key !== "breakpoint") {
|
|
1583
|
-
filteredObj[key] = arr[i][key];
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
this.set(filteredObj);
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
window.addEventListener("resize", react);
|
|
1594
|
-
react();
|
|
1595
|
-
}*/
|
|
1596
|
-
|
|
1597
|
-
/**
|
|
1598
|
-
* Tells the caller they passed an option that no longer exists as the
|
|
1599
|
-
* way to do this, and what to use instead.
|
|
1600
|
-
*
|
|
1601
|
-
* console.error only, deliberately. alert() is banned in live modules
|
|
1602
|
-
* (see the "no live module calls alert()" invariant): alerts had sat in
|
|
1603
|
-
* ordinary paths and blocked the page for every visitor, and the ban is
|
|
1604
|
-
* worth more than making this one warning louder.
|
|
1605
|
-
*/
|
|
1606
|
-
deprecatedOption(name, replacement) {
|
|
1607
|
-
console.error(`nodality: \`${name}\` is deprecated — use \`${replacement}\` instead.`);
|
|
1608
|
-
return this;
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
/**
|
|
1612
|
-
* Centres this element's CHILDREN.
|
|
1613
|
-
*
|
|
1614
|
-
* center: true both axes
|
|
1615
|
-
* center: "x" horizontally only
|
|
1616
|
-
* center: "y" vertically only
|
|
1617
|
-
*
|
|
1618
|
-
* Replaces six overlapping methods — toCenter(), toCenter("both"),
|
|
1619
|
-
* flexc(), toCol(), centerColumn and simpleCenter(). flexc() was
|
|
1620
|
-
* byte-identical to toCenter() and toCol() to toCenter("both"), so the
|
|
1621
|
-
* same behaviour had four names and the two that differed did so by
|
|
1622
|
-
* one property each.
|
|
1623
|
-
*
|
|
1624
|
-
* To centre the element ITSELF inside its parent, that is `mar:
|
|
1625
|
-
* "center"` — a different thing, and the reason the old names were so
|
|
1626
|
-
* easy to confuse.
|
|
1627
|
-
*
|
|
1628
|
-
* Axis-aware rather than fixed. justify-content runs along the main
|
|
1629
|
-
* axis, so in a flex column it is the VERTICAL one and align-items is
|
|
1630
|
-
* horizontal — the opposite of a flex row. The old methods hardcoded
|
|
1631
|
-
* flex-direction: column and so only ever worked one way round; this
|
|
1632
|
-
* reads the direction already set and centres the axis you asked for.
|
|
1633
|
-
* A grid gets justify-items/align-items instead, which is what
|
|
1634
|
-
* simpleCenter() was reaching for without setting a display at all.
|
|
1635
|
-
*/
|
|
1636
|
-
center(axis = true, hint = {}){
|
|
1637
|
-
const s = this.res.style;
|
|
1638
|
-
// The hints matter because this runs from commonMethods, before a
|
|
1639
|
-
// component applies its own `disp`/`flexDir` aliases. Without them
|
|
1640
|
-
// center() sees a bare element, assumes a flex column, and puts the
|
|
1641
|
-
// centring on the wrong property for every row and grid.
|
|
1642
|
-
const display = s.display || hint.display || "";
|
|
1643
|
-
const direction = s.flexDirection || hint.flexDirection || "";
|
|
1644
|
-
const grid = display.includes("grid");
|
|
1645
|
-
|
|
1646
|
-
const x = axis === true || axis === "both" || axis === "x";
|
|
1647
|
-
const y = axis === true || axis === "both" || axis === "y";
|
|
1648
|
-
|
|
1649
|
-
if (grid){
|
|
1650
|
-
if (x){ s.justifyItems = "center"; s.justifyContent = "center"; }
|
|
1651
|
-
if (y){ s.alignItems = "center"; s.alignContent = "center"; }
|
|
1652
|
-
return this;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
if (!display.includes("flex")) s.display = "flex";
|
|
1656
|
-
if (!s.flexDirection) s.flexDirection = direction || "column";
|
|
1657
|
-
|
|
1658
|
-
const column = (s.flexDirection || "column").startsWith("column");
|
|
1659
|
-
const mainIsY = column;
|
|
1660
|
-
|
|
1661
|
-
if (mainIsY ? y : x) s.justifyContent = "center";
|
|
1662
|
-
if (mainIsY ? x : y) s.alignItems = "center";
|
|
1663
|
-
return this;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
isNumber(value) {
|
|
1667
|
-
return typeof value === 'number' && !isNaN(value);
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
// Single source of truth for "how wide is the viewport". See the note in
|
|
1671
|
-
// chainReact — visualViewport is preferred (it tracks pinch-zoom) but is
|
|
1672
|
-
// not universally present.
|
|
1673
|
-
static viewportWidth() {
|
|
1674
|
-
if (typeof window === "undefined") return 0;
|
|
1675
|
-
const vv = window.visualViewport;
|
|
1676
|
-
return (vv && typeof vv.width === "number") ? vv.width : window.innerWidth;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
pad(arr){
|
|
1680
|
-
|
|
1681
|
-
for(let i = 0; i < arr.length; i++) {
|
|
1682
|
-
|
|
1683
|
-
let keys = Object.keys(arr[i]);
|
|
1684
|
-
for(let j = 0; j < keys.length; j++) {
|
|
1685
|
-
let key = keys[j];
|
|
1686
|
-
let value = arr[i][key];
|
|
1687
|
-
for(let k = 0; k < key.length; k++) {
|
|
1688
|
-
switch(key[k]) {
|
|
1689
|
-
case 'a':
|
|
1690
|
-
|
|
1691
|
-
//alert("OIHOI")
|
|
1692
|
-
this.res.style.padding = this.isNumber(value) ? `${value}px` : value;
|
|
1693
|
-
break;
|
|
1694
|
-
case 't':
|
|
1695
|
-
this.res.style.paddingTop = this.isNumber(value) ? `${value}px` : value;
|
|
1696
|
-
break;
|
|
1697
|
-
case 'l':
|
|
1698
|
-
this.res.style.paddingLeft = this.isNumber(value) ? `${value}px` : value;
|
|
1699
|
-
break;
|
|
1700
|
-
case 'r':
|
|
1701
|
-
this.res.style.paddingRight = this.isNumber(value) ? `${value}px` : value;
|
|
1702
|
-
break;
|
|
1703
|
-
case 'b':
|
|
1704
|
-
this.res.style.paddingBottom = this.isNumber(value) ? `${value}px` : value;
|
|
1705
|
-
break;
|
|
1706
|
-
default:
|
|
1707
|
-
// console.log(`Invalid key: ${key[k]}`);
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
return this;
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
as(asa){
|
|
1717
|
-
this.res.style.alignSelf = asa;
|
|
1718
|
-
return this;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
mar(arr){
|
|
1724
|
-
|
|
1725
|
-
// Shorthand: mar: "center" → margin: 0 auto
|
|
1726
|
-
if (arr === "center"){
|
|
1727
|
-
this.res.style.marginLeft = "auto";
|
|
1728
|
-
this.res.style.marginRight = "auto";
|
|
1729
|
-
return this;
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
for(let i = 0; i < arr.length; i++) {
|
|
1733
|
-
let keys = Object.keys(arr[i]);
|
|
1734
|
-
for(let j = 0; j < keys.length; j++) {
|
|
1735
|
-
let key = keys[j];
|
|
1736
|
-
let value = arr[i][key];
|
|
1737
|
-
for(let k = 0; k < key.length; k++) {
|
|
1738
|
-
switch(key[k]) {
|
|
1739
|
-
case 'a':
|
|
1740
|
-
// mar: [{ a: "auto" }] → margin: 0 auto (centers block-level elements)
|
|
1741
|
-
if (value === "auto"){
|
|
1742
|
-
this.res.style.marginLeft = "auto";
|
|
1743
|
-
this.res.style.marginRight = "auto";
|
|
1744
|
-
} else {
|
|
1745
|
-
this.res.style.margin = this.isNumber(value) ? `${value}px` : value;
|
|
1746
|
-
}
|
|
1747
|
-
break;
|
|
1748
|
-
case 't':
|
|
1749
|
-
this.res.style.marginTop = this.isNumber(value) ? `${value}px` : value;
|
|
1750
|
-
break;
|
|
1751
|
-
case 'l':
|
|
1752
|
-
this.res.style.marginLeft = this.isNumber(value) ? `${value}px` : value;
|
|
1753
|
-
break;
|
|
1754
|
-
case 'r':
|
|
1755
|
-
this.res.style.marginRight = this.isNumber(value) ? `${value}px` : value;
|
|
1756
|
-
break;
|
|
1757
|
-
case 'b':
|
|
1758
|
-
this.res.style.marginBottom = this.isNumber(value) ? `${value}px` : value;
|
|
1759
|
-
break;
|
|
1760
|
-
default:
|
|
1761
|
-
// console.log(`Invalid key: ${key[k]}`);
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
// Per-entry shorthand: { center: true } → marginLeft/Right = auto
|
|
1766
|
-
if (key === "center" && value === true){
|
|
1767
|
-
this.res.style.marginLeft = "auto";
|
|
1768
|
-
this.res.style.marginRight = "auto";
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
// Value-based detection: if any value === "auto" on l/r/lr keys, force centering
|
|
1772
|
-
if (value === "auto" && (key.includes("l") || key.includes("r"))){
|
|
1773
|
-
if (key.includes("l")) this.res.style.marginLeft = "auto";
|
|
1774
|
-
if (key.includes("r")) this.res.style.marginRight = "auto";
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
return this;
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
smartRange(val, from, to) {
|
|
1783
|
-
|
|
1784
|
-
if (val < from.min) {
|
|
1785
|
-
val = from.min;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
if (val > from.max) {
|
|
1789
|
-
val = from.max;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
let percent = (val - from.min) / (from.max - from.min);
|
|
1793
|
-
|
|
1794
|
-
if (from.min > from.max) {
|
|
1795
|
-
percent = (val - from.max) / (from.min - from.max);
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
// Linear interpolation across the OUTPUT range. The old form added
|
|
1799
|
-
// |to.min| to to.max instead of subtracting it, so any range whose
|
|
1800
|
-
// minimum was above zero overshot: 0.2 -> 1 produced 0.2 + 1.2p = 1.4
|
|
1801
|
-
// at full scroll. Correct only when to.min <= 0, which is why the
|
|
1802
|
-
// 0 -> 1 demos never showed it.
|
|
1803
|
-
return to.min + (to.max - to.min) * percent;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
gpos(obj){
|
|
1808
|
-
//alert(obj.col);
|
|
1809
|
-
this.res.style.gridColumn = obj.col;
|
|
1810
|
-
this.res.style.gridRow = obj.row;
|
|
1811
|
-
//this.res.style.border = "1px solid green";
|
|
1812
|
-
return this;
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
fluidCopy(name){
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
if (name instanceof Object){
|
|
1819
|
-
this.prevStylex = this.res.style;
|
|
1820
|
-
this.res = document.createElement("h1");
|
|
1821
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1822
|
-
let node = document.createTextNode(this.text);
|
|
1823
|
-
this.res.appendChild(node);
|
|
1824
|
-
this.res.style.fontSize = name.exact;
|
|
1825
|
-
|
|
1826
|
-
// alert(name.exact);
|
|
1827
|
-
|
|
1828
|
-
return this;
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
const display1 = "calc(1.625rem + 5.075vw)";
|
|
1832
|
-
|
|
1833
|
-
if (name === "S1"){
|
|
1834
|
-
this.prevStylex = this.res.style;
|
|
1835
|
-
this.res = document.createElement("h1");
|
|
1836
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1837
|
-
let node = document.createTextNode(this.text);
|
|
1838
|
-
this.res.appendChild(node);
|
|
1839
|
-
this.res.style.fontSize = display1;
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
const display2 = "calc(1.500rem + 4.3vw)";
|
|
1843
|
-
|
|
1844
|
-
if (name === "S2"){
|
|
1845
|
-
this.prevStylex = this.res.style;
|
|
1846
|
-
this.res = document.createElement("h2");
|
|
1847
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1848
|
-
let node = document.createTextNode(this.text);
|
|
1849
|
-
this.res.appendChild(node);
|
|
1850
|
-
this.res.style.fontSize = display2;
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
const display3 = "calc(1.375rem + 3.525vw)";
|
|
1855
|
-
|
|
1856
|
-
if (name === "S3"){
|
|
1857
|
-
this.prevStylex = this.res.style;
|
|
1858
|
-
this.res = document.createElement("h3");
|
|
1859
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1860
|
-
let node = document.createTextNode(this.text);
|
|
1861
|
-
this.res.appendChild(node);
|
|
1862
|
-
this.res.style.fontSize = display3;
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
const display4 = "calc(1.250rem + 2.75vw)";
|
|
1866
|
-
|
|
1867
|
-
if (name === "S4"){
|
|
1868
|
-
this.prevStylex = this.res.style;
|
|
1869
|
-
this.res = document.createElement("h4");
|
|
1870
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1871
|
-
let node = document.createTextNode(this.text);
|
|
1872
|
-
this.res.appendChild(node);
|
|
1873
|
-
this.res.style.fontSize = display4;
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
const display5 = "calc(1.125rem + 1.975vw)";
|
|
1877
|
-
|
|
1878
|
-
if (name === "S5"){
|
|
1879
|
-
this.prevStylex = this.res.style;
|
|
1880
|
-
this.res = document.createElement("h5");
|
|
1881
|
-
this.res.style.cssText = this.prevStylex.cssText;
|
|
1882
|
-
let node = document.createTextNode(this.text);
|
|
1883
|
-
this.res.appendChild(node);
|
|
1884
|
-
this.res.style.fontSize = display5;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
const display6 = "calc(1rem + 0.5vw)"; // calc(1rem + 1.2vw)
|
|
1890
|
-
|
|
1891
|
-
if (name === "S6"){
|
|
1892
|
-
this.res.style.fontSize = display6;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
return this;
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
setIndex(idx){
|
|
1902
|
-
this.index = idx;
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
borderObj(options){
|
|
1906
|
-
let type = options.type ?? "solid";
|
|
1907
|
-
this.res.style.border = `${options.width} ${type} ${options.color}`
|
|
1908
|
-
// Only touch borderRadius when the caller actually provided one.
|
|
1909
|
-
// Otherwise we'd clobber the radius set via the styleMap (e.g.
|
|
1910
|
-
// `radius: "50%"` on a circle) with `undefined`, which clears it.
|
|
1911
|
-
if (options.radius !== undefined) {
|
|
1912
|
-
this.res.style.borderRadius = options.radius;
|
|
1913
|
-
}
|
|
1914
|
-
return this;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
/*
|
|
1918
|
-
protoReact(queries, id) {
|
|
1919
|
-
// Sort the queries based on the starting range value in ascending order
|
|
1920
|
-
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
1921
|
-
|
|
1922
|
-
// Function to check and log queries based on screen size
|
|
1923
|
-
const checkQueries =() => {
|
|
1924
|
-
const screenSize = window.innerWidth;
|
|
1925
|
-
let ops = "";
|
|
1926
|
-
|
|
1927
|
-
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
1928
|
-
|
|
1929
|
-
for (const query of queries) {
|
|
1930
|
-
this.counterIndex++;
|
|
1931
|
-
|
|
1932
|
-
const [startRange, endRange] = query.range;
|
|
1933
|
-
const startSize = parseInt(startRange);
|
|
1934
|
-
const endSize = parseInt(endRange);
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
let all = true;
|
|
1938
|
-
|
|
1939
|
-
if (query.target){
|
|
1940
|
-
all = false;
|
|
1941
|
-
|
|
1942
|
-
for (var i = 0; i < query.target.length; i++){
|
|
1943
|
-
if (query.target[i] === id){ // #id is required
|
|
1944
|
-
all = true;
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
|
-
if (screenSize >= startSize && screenSize <= endSize && all) { // NEED TO COMMENT ALL
|
|
1950
|
-
// USE THIS, but apply all properties all the time !! 255447
|
|
1951
|
-
|
|
1952
|
-
if (query.log === "gradient"){
|
|
1953
|
-
ops += "gradient";
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
if (query.log === "blast"){
|
|
1957
|
-
ops += "blast";
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
if (query.log === "animation"){
|
|
1961
|
-
ops += "animation";
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
if (query.log === "shadow"){
|
|
1965
|
-
ops += "shadow";
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
if (query.log === "span"){
|
|
1969
|
-
ops += "span";
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
if (query.log === "filter"){
|
|
1973
|
-
ops += "filter";
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
if (query.log === "background"){
|
|
1977
|
-
ops += "background";
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
this.res.style.margin = "";
|
|
1984
|
-
// Everything works 12:48:45 06/10/23
|
|
1985
|
-
|
|
1986
|
-
let defaultColor = this.res.style.color; // 11:05:40 Nice
|
|
1987
|
-
|
|
1988
|
-
let mapped = queries.map(el => el.log).filter(el => el != undefined);
|
|
1989
|
-
|
|
1990
|
-
if (mapped.includes("gradient")) {
|
|
1991
|
-
this.res.style.WebkitBackgroundClip = "";
|
|
1992
|
-
this.res.style.background = "";
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
// Reset stroke
|
|
1997
|
-
this.res.style['-webkit-text-stroke'] = "";
|
|
1998
|
-
this.res.style.filter = ``;
|
|
1999
|
-
|
|
2000
|
-
// Reset shadow
|
|
2001
|
-
this.res.style.textShadow = "";
|
|
2002
|
-
|
|
2003
|
-
// Temp reset border
|
|
2004
|
-
this.res.style.border = "";
|
|
2005
|
-
|
|
2006
|
-
while(this.res.firstChild) { // not the problem...
|
|
2007
|
-
this.res.removeChild(this.res.firstChild); // Remove all children
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
this.res.textContent = this.text;
|
|
2011
|
-
|
|
2012
|
-
if (ops === "") {
|
|
2013
|
-
this.res.style['-webkit-text-fill-color'] = '';
|
|
2014
|
-
this.res.style.color = defaultColor; //"green";
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
if (ops === "blast") { // Chekc id here ???
|
|
2019
|
-
for (var i = 0; i < queries.length; i++){
|
|
2020
|
-
const off = queries[i].op.offsets;
|
|
2021
|
-
|
|
2022
|
-
if (off && this.index !== undefined){
|
|
2023
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2028
|
-
this.res.style['-webkit-text-stroke'] = this.globalBlast; //this.globalBlast; //`3px orange`;
|
|
2029
|
-
|
|
2030
|
-
for (var i = 0; i < queries.length; i++){
|
|
2031
|
-
const off = queries[i].op.offsets;
|
|
2032
|
-
if (off && this.index !== undefined){
|
|
2033
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
if (ops === "gradient") { // the problem is not here
|
|
2041
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2042
|
-
this.res.style.background = this.globalGradient;// "linear-gradient(to left, #3498db, #1abc9c)";
|
|
2043
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2044
|
-
this.res.style.border = "1px solid orange"; // Something on Wrapper prevents border works on text
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
if (ops === "background"){
|
|
2049
|
-
this.res.style.background = "orange";
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
if (ops === "gradientblast") {
|
|
2054
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2055
|
-
this.res.style.background = this.globalGradient;//"linear-gradient(to left, #3498db, #1abc9c)";
|
|
2056
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2057
|
-
this.res.style['-webkit-text-stroke'] = this.globalBlast; // `3px orange`;
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
if (ops === "gradientanimation") { // 12:33:14 Nice
|
|
2061
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2062
|
-
this.res.style.background = this.globalGradient; //"linear-gradient(to left, #3498db, #1abc9c)";
|
|
2063
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
if (ops === "gradientanimationshadow"){
|
|
2067
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2068
|
-
this.res.style.background = this.globalGradient; //"linear-gradient(to left, #3498db, #1abc9c)";
|
|
2069
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2070
|
-
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px, #1abc9c9f -12px 12px, #1abc9c40 -18px 18px";
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
if (ops === "animationshadow"){
|
|
2074
|
-
this.res.style['-webkit-text-fill-color'] = '';
|
|
2075
|
-
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px , #1abc9c40 -12px 12px";
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
if (ops === "shadow"){
|
|
2079
|
-
// Clear all children and add text content
|
|
2080
|
-
this.res.style['-webkit-text-fill-color'] = '';
|
|
2081
|
-
this.res.style.textShadow = this.globalShadow; //"#1abc9cff -6px 6px , #1abc9c40 -12px 12px";
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
if (ops === "span"){
|
|
2086
|
-
if (this.options.span){
|
|
2087
|
-
let noiseObject;
|
|
2088
|
-
|
|
2089
|
-
if (Array.isArray(this.options.span)){
|
|
2090
|
-
noiseObject = this.options.span.filter(a => a.op.name === "span")[0];
|
|
2091
|
-
} else {
|
|
2092
|
-
noiseObject = this.options.span;
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
this.res.textContent = ""; // creating new element not helping
|
|
2096
|
-
|
|
2097
|
-
for (var i = 0; i < noiseObject.op.parts.length; i++){
|
|
2098
|
-
let opts = noiseObject.op.parts[i].style;
|
|
2099
|
-
let span = new Text(noiseObject.op.parts[i].text).setup({type: "span"}).set(opts).render();
|
|
2100
|
-
this.res.appendChild(span);
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
if (ops === "filter"){
|
|
2107
|
-
let filterName = this.options.filtera.op.filter;
|
|
2108
|
-
this.res.style.filter = filterName;
|
|
2109
|
-
this.res.style.border = "8px solid orange";
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
// Add an event listener to check queries on window resize
|
|
2114
|
-
window.addEventListener('resize', checkQueries);
|
|
2115
|
-
|
|
2116
|
-
// Initial check
|
|
2117
|
-
checkQueries();
|
|
2118
|
-
}
|
|
2119
|
-
*/
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
setPref(id){
|
|
2124
|
-
this.preffersId = id;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
setClass(id){
|
|
2129
|
-
this.class = id;
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
/*
|
|
2135
|
-
betaReact(queries, id) {
|
|
2136
|
-
|
|
2137
|
-
this.ap = false;
|
|
2138
|
-
this.cta = 0;
|
|
2139
|
-
this.once = false;
|
|
2140
|
-
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
2141
|
-
|
|
2142
|
-
// Function to check and log queries based on screen size
|
|
2143
|
-
const checkQueries =() => {
|
|
2144
|
-
const screenSize = window.innerWidth;
|
|
2145
|
-
let ops = "";
|
|
2146
|
-
|
|
2147
|
-
this.resCopy = this.res;
|
|
2148
|
-
|
|
2149
|
-
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
2150
|
-
// // // console.log(this.storedQueries);
|
|
2151
|
-
|
|
2152
|
-
for (const query of queries) {
|
|
2153
|
-
this.counterIndex++;
|
|
2154
|
-
|
|
2155
|
-
const [startRange, endRange] = query.range;
|
|
2156
|
-
const startSize = parseInt(startRange);
|
|
2157
|
-
const endSize = parseInt(endRange);
|
|
2158
|
-
let all = true;
|
|
2159
|
-
|
|
2160
|
-
if (query.target){
|
|
2161
|
-
//alert("KKK")
|
|
2162
|
-
all = false;
|
|
2163
|
-
//alert(this.res.id);
|
|
2164
|
-
|
|
2165
|
-
for (var i = 0; i < query.target.length; i++){
|
|
2166
|
-
// // // console.log("QT " + query.target[i]);
|
|
2167
|
-
// // // console.log("QS " + id);
|
|
2168
|
-
|
|
2169
|
-
if (query.target[i] === id){ // #id is required
|
|
2170
|
-
|
|
2171
|
-
all = true;
|
|
1150
|
+
// Value-based detection: if any value === "auto" on l/r/lr keys, force centering
|
|
1151
|
+
if (value === "auto" && (key.includes("l") || key.includes("r"))){
|
|
1152
|
+
if (key.includes("l")) this.res.style.marginLeft = "auto";
|
|
1153
|
+
if (key.includes("r")) this.res.style.marginRight = "auto";
|
|
2172
1154
|
}
|
|
2173
1155
|
}
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
if (screenSize >= startSize && screenSize <= endSize && all) { // NEED TO COMMENT ALL
|
|
2177
|
-
if (query.log === "blast"){
|
|
2178
|
-
ops += "blast";
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
if (query.log === "shadow"){
|
|
2182
|
-
ops += "shadow";
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
if (query.log === "background"){
|
|
2186
|
-
ops += "background";
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
if (query.log === "gradient"){
|
|
2190
|
-
ops += "gradient";
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
if (query.log === "spana"){
|
|
2194
|
-
ops += "spana";
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
if (query.log === "layout"){
|
|
2198
|
-
ops += "layout";
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
if (query.log === "margin"){
|
|
2202
|
-
ops += "margin";
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
if (query.op && query.op.margin){
|
|
2206
|
-
this.useMargin = query.op.margin;
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
this.res.style.background = "";
|
|
2215
|
-
this.res.style.backgroundColor = "";
|
|
2216
|
-
this.res.style.textShadow = "";
|
|
2217
|
-
this.res.style.border = "";
|
|
2218
|
-
this.res.style.margin = ""
|
|
2219
|
-
|
|
2220
|
-
this.res.style['-webkit-text-fill-color'] = '';
|
|
2221
|
-
this.res.style['-webkit-text-stroke'] = "";
|
|
2222
|
-
this.res.style['-webkit-text-stroke-width'] = "";
|
|
2223
|
-
|
|
2224
|
-
if (ops === "background"){
|
|
2225
|
-
// alert("PPPA")
|
|
2226
|
-
this.res.style.backgroundColor = "green";
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
|
-
if (ops === "margin"){
|
|
2230
|
-
|
|
2231
|
-
for (var i = 0; i < queries.length; i++){
|
|
2232
|
-
|
|
2233
|
-
if (!queries[i].op){
|
|
2234
|
-
continue;
|
|
2235
|
-
}
|
|
2236
|
-
const off = queries[i].op.offsets;
|
|
2237
|
-
if (off && this.index !== undefined){
|
|
2238
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
if (ops === "blastbackgroundmargin"){
|
|
2246
|
-
|
|
2247
|
-
for (var i = 0; i < queries.length; i++){
|
|
2248
|
-
if (!queries[i].op){
|
|
2249
|
-
continue;
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
const off = queries[i].op.offsets;
|
|
2253
|
-
// console.log(off);
|
|
2254
|
-
|
|
2255
|
-
if (off && this.index !== undefined){
|
|
2256
|
-
// console.warn("READ INDEX");
|
|
2257
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
this.res.style.backgroundColor = "green";
|
|
2263
|
-
//this.useMargin ? this.res.style.margin = "1rem" : null;
|
|
2264
|
-
// alert("PPPA")
|
|
2265
|
-
if (this.getType() === "FlexRowLayoutElement"){
|
|
2266
|
-
this.res.style.border = "1px solid orange";
|
|
2267
|
-
} else {
|
|
2268
|
-
this.res.textContent = this.text; //"a"
|
|
2269
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2270
|
-
//this.res.style['-webkit-background-clip'] = 'text';
|
|
2271
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2272
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2276
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2277
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
if (ops === "blastbackground"){
|
|
2281
|
-
|
|
2282
|
-
for (var i = 0; i < queries.length; i++){
|
|
2283
|
-
if (!queries[i].op){
|
|
2284
|
-
continue;
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
const off = queries[i].op.offsets;
|
|
2288
|
-
|
|
2289
|
-
if (off && this.index !== undefined){
|
|
2290
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
this.res.style.backgroundColor = "green";
|
|
2295
|
-
// no unused expression
|
|
2296
|
-
this.useMargin ? this.res.style.margin = "1rem" : this.res.setAttribute("id", "iofhwoiefhoih");
|
|
2297
|
-
//this.useMargin ? this.res.style.margin = "1rem" : null;
|
|
2298
|
-
if (this.getType() === "FlexRowLayoutElement"){
|
|
2299
|
-
this.res.style.border = "1px solid orange";
|
|
2300
|
-
} else {
|
|
2301
|
-
this.res.textContent = this.text; //"a"
|
|
2302
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2303
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2304
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2308
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2309
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
if (ops === "layout"){
|
|
2313
|
-
this.res.style.alignSelf = "start";
|
|
2314
|
-
this.res.style.border = "1px solid purple";
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
if (ops === "blast") { // the problem is not here
|
|
2321
|
-
|
|
2322
|
-
for (var i = 0; i < queries.length; i++){
|
|
2323
|
-
if (!queries[i].op){
|
|
2324
|
-
continue;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
const off = queries[i].op.offsets;
|
|
2328
|
-
if (off && this.index !== undefined){
|
|
2329
|
-
this.res.style.margin = off[Number(this.index)] + "px";
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
if (this.getType() === "FlexRowLayoutElement"){
|
|
2334
|
-
this.res.style.border = "1px solid orange";
|
|
2335
|
-
} else {
|
|
2336
|
-
this.res.textContent = this.text; //"a"
|
|
2337
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2338
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2339
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2340
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2341
1156
|
}
|
|
2342
|
-
|
|
2343
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2344
|
-
this.res.style['-webkit-text-stroke'] = "orange";
|
|
2345
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
if (ops === "blastgradientbackground"){
|
|
2350
|
-
this.res.style.border = "1px solid yellow";
|
|
2351
|
-
this.res.style['-webkit-text-stroke-color'] = "orange";
|
|
2352
|
-
this.res.style['-webkit-text-stroke-width'] = "1px";
|
|
1157
|
+
return this;
|
|
2353
1158
|
}
|
|
2354
1159
|
|
|
2355
1160
|
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
if (ops === "gradient") {
|
|
2359
|
-
|
|
2360
|
-
//alert("P")
|
|
2361
|
-
|
|
2362
|
-
this.res.style.background = "linear-gradient(to left, #3498db, #1abc9c)";
|
|
2363
|
-
|
|
2364
|
-
if (this.getType() === "FlexRowLayoutElement"){
|
|
2365
|
-
} else {
|
|
2366
|
-
|
|
2367
|
-
this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
2368
|
-
//// console.warn(this.res.children[0]);
|
|
2369
|
-
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
2370
|
-
this.res.style['-webkit-background-clip'] = 'text';
|
|
2371
|
-
this.res.textContent = this.text; //"a"
|
|
2372
|
-
//this.res.children[0] && this.res.removeChild(this.res.children[0]);
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
|
|
1161
|
+
smartRange(val, from, to) {
|
|
2376
1162
|
|
|
1163
|
+
if (val < from.min) {
|
|
1164
|
+
val = from.min;
|
|
1165
|
+
}
|
|
2377
1166
|
|
|
1167
|
+
if (val > from.max) {
|
|
1168
|
+
val = from.max;
|
|
1169
|
+
}
|
|
2378
1170
|
|
|
1171
|
+
let percent = (val - from.min) / (from.max - from.min);
|
|
2379
1172
|
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
let str = "";
|
|
2385
|
-
let off = 0;
|
|
2386
|
-
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
2387
|
-
off += 3;
|
|
1173
|
+
if (from.min > from.max) {
|
|
1174
|
+
percent = (val - from.max) / (from.min - from.max);
|
|
1175
|
+
}
|
|
2388
1176
|
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
1177
|
+
// Linear interpolation across the OUTPUT range. The old form added
|
|
1178
|
+
// |to.min| to to.max instead of subtracting it, so any range whose
|
|
1179
|
+
// minimum was above zero overshot: 0.2 -> 1 produced 0.2 + 1.2p = 1.4
|
|
1180
|
+
// at full scroll. Correct only when to.min <= 0, which is why the
|
|
1181
|
+
// 0 -> 1 demos never showed it.
|
|
1182
|
+
return to.min + (to.max - to.min) * percent;
|
|
1183
|
+
}
|
|
2392
1184
|
|
|
2393
1185
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
1186
|
+
gpos(obj){
|
|
1187
|
+
//alert(obj.col);
|
|
1188
|
+
this.res.style.gridColumn = obj.col;
|
|
1189
|
+
this.res.style.gridRow = obj.row;
|
|
1190
|
+
//this.res.style.border = "1px solid green";
|
|
1191
|
+
return this;
|
|
2397
1192
|
}
|
|
2398
1193
|
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
// Add an event listener to check queries on window resize
|
|
2402
|
-
window.addEventListener('resize', checkQueries);
|
|
2403
|
-
|
|
2404
|
-
// Initial check
|
|
2405
|
-
checkQueries();
|
|
2406
|
-
}*/
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
//--------- START OF INDEPENDENT
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
// React without condition
|
|
2413
|
-
// loop through queries
|
|
2414
|
-
// to make all CSS immediatelly...
|
|
2415
|
-
|
|
2416
|
-
/* cssGen(queries, id, classa, preffersClass){
|
|
2417
|
-
|
|
2418
|
-
this.css = [""];
|
|
2419
|
-
return [""];
|
|
2420
|
-
|
|
2421
|
-
this.css = [];
|
|
2422
|
-
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
2423
|
-
|
|
2424
|
-
// Function to check and log queries based on screen size
|
|
2425
|
-
const checkQueries =() => {
|
|
2426
|
-
const screenSize = window.innerWidth;
|
|
2427
|
-
let ops = "";
|
|
2428
|
-
let operations = [];
|
|
2429
|
-
|
|
2430
|
-
this.resCopy = this.res;
|
|
2431
|
-
|
|
2432
|
-
this.storedQueries = queries.map(el => el.target).filter(el => el != undefined);
|
|
2433
|
-
|
|
2434
|
-
// console.log("ULTRA");
|
|
2435
|
-
// console.log(queries);
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
for (const query of queries) {
|
|
2440
|
-
this.counterIndex++;
|
|
2441
|
-
|
|
2442
|
-
const [startRange, endRange] = query.range;
|
|
2443
|
-
const startSize = parseInt(startRange);
|
|
2444
|
-
const endSize = parseInt(endRange);
|
|
2445
|
-
let all = true;
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
if (query.target){
|
|
2450
|
-
//alert("KKK")
|
|
2451
|
-
all = false;
|
|
2452
|
-
//alert(this.res.id);
|
|
2453
|
-
|
|
2454
|
-
for (var i = 0; i < query.target.length; i++){
|
|
2455
|
-
// // // console.log("QT " + query.target[i]);
|
|
2456
|
-
// // // console.log("QS " + id);
|
|
2457
|
-
|
|
2458
|
-
if (query.target[i] === id){ // #id is required
|
|
2459
|
-
|
|
2460
|
-
all = true;
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
1194
|
+
fluidCopy(name){
|
|
2467
1195
|
|
|
2468
1196
|
|
|
2469
|
-
|
|
2470
|
-
|
|
1197
|
+
if (name instanceof Object){
|
|
1198
|
+
this.prevStylex = this.res.style;
|
|
1199
|
+
this.res = document.createElement("h1");
|
|
1200
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1201
|
+
let node = document.createTextNode(this.text);
|
|
1202
|
+
this.res.appendChild(node);
|
|
1203
|
+
this.res.style.fontSize = name.exact;
|
|
2471
1204
|
|
|
1205
|
+
// alert(name.exact);
|
|
2472
1206
|
|
|
2473
|
-
|
|
1207
|
+
return this;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
const display1 = "calc(1.625rem + 5.075vw)";
|
|
1211
|
+
|
|
1212
|
+
if (name === "S1"){
|
|
1213
|
+
this.prevStylex = this.res.style;
|
|
1214
|
+
this.res = document.createElement("h1");
|
|
1215
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1216
|
+
let node = document.createTextNode(this.text);
|
|
1217
|
+
this.res.appendChild(node);
|
|
1218
|
+
this.res.style.fontSize = display1;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
const display2 = "calc(1.500rem + 4.3vw)";
|
|
1222
|
+
|
|
1223
|
+
if (name === "S2"){
|
|
1224
|
+
this.prevStylex = this.res.style;
|
|
1225
|
+
this.res = document.createElement("h2");
|
|
1226
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1227
|
+
let node = document.createTextNode(this.text);
|
|
1228
|
+
this.res.appendChild(node);
|
|
1229
|
+
this.res.style.fontSize = display2;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
const display3 = "calc(1.375rem + 3.525vw)";
|
|
1234
|
+
|
|
1235
|
+
if (name === "S3"){
|
|
1236
|
+
this.prevStylex = this.res.style;
|
|
1237
|
+
this.res = document.createElement("h3");
|
|
1238
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1239
|
+
let node = document.createTextNode(this.text);
|
|
1240
|
+
this.res.appendChild(node);
|
|
1241
|
+
this.res.style.fontSize = display3;
|
|
1242
|
+
}
|
|
2474
1243
|
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
1244
|
+
const display4 = "calc(1.250rem + 2.75vw)";
|
|
1245
|
+
|
|
1246
|
+
if (name === "S4"){
|
|
1247
|
+
this.prevStylex = this.res.style;
|
|
1248
|
+
this.res = document.createElement("h4");
|
|
1249
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1250
|
+
let node = document.createTextNode(this.text);
|
|
1251
|
+
this.res.appendChild(node);
|
|
1252
|
+
this.res.style.fontSize = display4;
|
|
1253
|
+
}
|
|
2480
1254
|
|
|
2481
|
-
|
|
1255
|
+
const display5 = "calc(1.125rem + 1.975vw)";
|
|
1256
|
+
|
|
1257
|
+
if (name === "S5"){
|
|
1258
|
+
this.prevStylex = this.res.style;
|
|
1259
|
+
this.res = document.createElement("h5");
|
|
1260
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
1261
|
+
let node = document.createTextNode(this.text);
|
|
1262
|
+
this.res.appendChild(node);
|
|
1263
|
+
this.res.style.fontSize = display5;
|
|
1264
|
+
}
|
|
2482
1265
|
|
|
2483
|
-
if (operations.includes("blast")){
|
|
2484
|
-
let ft = this.css.map(q => q.log).lastIndexOf("blast");
|
|
2485
|
-
//// console.log("BLAST IDO IS " + ft + "TR" + this.range);
|
|
2486
1266
|
|
|
2487
|
-
// should be 0-900
|
|
2488
|
-
// is 880-930
|
|
2489
|
-
//alert(this.preffersId);
|
|
2490
|
-
//alert(this.class);
|
|
2491
1267
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
1268
|
+
const display6 = "calc(1rem + 0.5vw)"; // calc(1rem + 1.2vw)
|
|
1269
|
+
|
|
1270
|
+
if (name === "S6"){
|
|
1271
|
+
this.res.style.fontSize = display6;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
return this;
|
|
1275
|
+
}
|
|
2500
1276
|
|
|
2501
|
-
if (operations.includes("gradient")){
|
|
2502
|
-
//let ft = this.css.map(q => q.range).lastIndexOf(this.range);
|
|
2503
|
-
//// console.log("IDO IS " + ft);
|
|
2504
|
-
let ft = this.css.map(q => q.log).lastIndexOf("gradient");
|
|
2505
|
-
// // console.log("BLAST IDO IS " + ft + "TR" + this.range);
|
|
2506
1277
|
|
|
2507
1278
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
-webkit-background-clip: text;
|
|
2512
|
-
-webkit-text-fill-color: transparent;
|
|
2513
|
-
}
|
|
2514
|
-
`);
|
|
1279
|
+
|
|
1280
|
+
setIndex(idx){
|
|
1281
|
+
this.index = idx;
|
|
2515
1282
|
}
|
|
2516
1283
|
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
//
|
|
2522
|
-
//
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
${this.preffersId ? this.id : "." + this.class}{
|
|
2526
|
-
background: green;
|
|
1284
|
+
borderObj(options){
|
|
1285
|
+
let type = options.type ?? "solid";
|
|
1286
|
+
this.res.style.border = `${options.width} ${type} ${options.color}`
|
|
1287
|
+
// Only touch borderRadius when the caller actually provided one.
|
|
1288
|
+
// Otherwise we'd clobber the radius set via the styleMap (e.g.
|
|
1289
|
+
// `radius: "50%"` on a circle) with `undefined`, which clears it.
|
|
1290
|
+
if (options.radius !== undefined) {
|
|
1291
|
+
this.res.style.borderRadius = options.radius;
|
|
2527
1292
|
}
|
|
2528
|
-
|
|
1293
|
+
return this;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
2529
1296
|
|
|
2530
|
-
// console.log("-----Hello-----");
|
|
2531
|
-
// console.warn(this.css[ft]);
|
|
2532
1297
|
|
|
2533
|
-
}
|
|
2534
1298
|
|
|
1299
|
+
setPref(id){
|
|
1300
|
+
this.preffersId = id;
|
|
1301
|
+
}
|
|
2535
1302
|
|
|
2536
|
-
if (operations.includes("shadow")){
|
|
2537
|
-
let ft = this.css.map(q => q.log).lastIndexOf("shadow");
|
|
2538
|
-
|
|
2539
|
-
let str = "";
|
|
2540
|
-
let off = 0;
|
|
2541
|
-
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
2542
|
-
off += 3;
|
|
2543
|
-
str += `drop-shadow(${off}px ${off}px ${off}px gray) `;
|
|
2544
|
-
}
|
|
2545
1303
|
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
${this.preffersId ? this.id : "." + this.class}{
|
|
2549
|
-
filter: ${str};
|
|
2550
|
-
}
|
|
2551
|
-
`);
|
|
2552
|
-
// this.res.style.filter = str;
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
}
|
|
1304
|
+
setClass(id){
|
|
1305
|
+
this.class = id;
|
|
2556
1306
|
}
|
|
2557
1307
|
|
|
2558
|
-
checkQueries();
|
|
2559
1308
|
|
|
2560
1309
|
|
|
2561
1310
|
|
|
2562
|
-
// console.log("FINAL QUERIES HERE");
|
|
2563
|
-
// console.log(this.css.map(r => r.rules));
|
|
2564
|
-
// console.log("::::::::::::::::::::::");
|
|
2565
1311
|
|
|
2566
|
-
|
|
1312
|
+
//--------- START OF INDEPENDENT
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
// React without condition
|
|
1316
|
+
// loop through queries
|
|
1317
|
+
// to make all CSS immediatelly...
|
|
1318
|
+
|
|
2567
1319
|
setTags(obj){
|
|
2568
1320
|
//alert("TAGS SET")
|
|
2569
1321
|
this.openTag = obj.open;
|
|
@@ -2817,32 +1569,6 @@ if (this.getType() === "FlexRowLayoutElement" || this.getType() === "LayoutWrapp
|
|
|
2817
1569
|
|
|
2818
1570
|
//if (this.getType() === "FlexRowLayoutElement"){
|
|
2819
1571
|
//} else {
|
|
2820
|
-
/*
|
|
2821
|
-
|
|
2822
|
-
let str = "";
|
|
2823
|
-
let off = 0;
|
|
2824
|
-
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
2825
|
-
off += 3;
|
|
2826
|
-
str += `drop-shadow(${off}px ${off}px ${off}px ${this.options.shadow.op.colors[i] ?? "gray"}) `;
|
|
2827
|
-
}
|
|
2828
|
-
|
|
2829
|
-
if (this.getType() === "FlexRowLayoutElement" || this.getType() === "LayoutWrapperElement"){
|
|
2830
|
-
|
|
2831
|
-
let finalFilter = ""
|
|
2832
|
-
let offa = 0;
|
|
2833
|
-
for (var i = 0; i < this.options.shadow.op.steps; i++){
|
|
2834
|
-
offa += 3;
|
|
2835
|
-
finalFilter += `${off}px ${off}px ${off}px ${this.options.shadow.op.colors[i] ?? "gray"} `;
|
|
2836
|
-
}
|
|
2837
|
-
this.res.style.boxShadow = finalFilter;
|
|
2838
|
-
alert(finalFilter);
|
|
2839
|
-
|
|
2840
|
-
//this.res.style.boxShadow = `${off}px ${off}px ${off}px ${this.options.shadow.op.colors[i] ?? "gray"}`; //`${off}px ${off}px ${off}px ${this.options.shadow.op.colors[0] ?? "gray"}`;
|
|
2841
|
-
} else {
|
|
2842
|
-
this.res.style.filter = str;
|
|
2843
|
-
}
|
|
2844
|
-
|
|
2845
|
-
*/
|
|
2846
1572
|
|
|
2847
1573
|
|
|
2848
1574
|
// }
|
|
@@ -2861,39 +1587,6 @@ alert(finalFilter);
|
|
|
2861
1587
|
}
|
|
2862
1588
|
}
|
|
2863
1589
|
}
|
|
2864
|
-
/*
|
|
2865
|
-
if (operations.includes("spana") || operations.includes("span")){
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
this.res = this.resCopy;
|
|
2869
|
-
|
|
2870
|
-
if (this.options.span){
|
|
2871
|
-
let noiseObject;
|
|
2872
|
-
|
|
2873
|
-
if (Array.isArray(this.options.span)){
|
|
2874
|
-
noiseObject = this.options.span.filter(a => a.op.name === "span")[0];
|
|
2875
|
-
} else {
|
|
2876
|
-
noiseObject = this.options.span;
|
|
2877
|
-
}
|
|
2878
|
-
|
|
2879
|
-
this.res.textContent = ""; // creating new element not helping
|
|
2880
|
-
//console.log("OPOOOOO");
|
|
2881
|
-
//console.log(new Text("A"));
|
|
2882
|
-
for (var i = 0; i < noiseObject.op.parts.length; i++){
|
|
2883
|
-
let opts = noiseObject.op.parts[i].style;
|
|
2884
|
-
let span = new this.constructor(noiseObject.op.parts[i].text).setup({type: "span"}).set(opts).render();
|
|
2885
|
-
this.res.appendChild(span);
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
} else {
|
|
2892
|
-
|
|
2893
|
-
let t = new this.constructor(this.prevText).set({}).render();
|
|
2894
|
-
if (this.prevText && this.prevText.length > 0 && qban){
|
|
2895
|
-
this.res.appendChild(t);
|
|
2896
|
-
}*/
|
|
2897
1590
|
|
|
2898
1591
|
|
|
2899
1592
|
|
|
@@ -2910,13 +1603,6 @@ Object.assign(overlay.style, {
|
|
|
2910
1603
|
pointerEvents: "none",
|
|
2911
1604
|
});
|
|
2912
1605
|
|
|
2913
|
-
/*
|
|
2914
|
-
if (!this.res.querySelector("#oroa") && operations.includes("gradient")){
|
|
2915
|
-
// Set text content
|
|
2916
|
-
overlay.textContent = "SWIM FREE";
|
|
2917
|
-
overlay.style.position = "relative";
|
|
2918
|
-
this.res.appendChild(overlay);
|
|
2919
|
-
}*/
|
|
2920
1606
|
|
|
2921
1607
|
// 🛑 prevent re-creating spans on resize
|
|
2922
1608
|
if (this.res && this.res.querySelector('span')) return;
|
|
@@ -3063,57 +1749,10 @@ this._on(window, this.openTag, () => {
|
|
|
3063
1749
|
observer.observe(this.res);
|
|
3064
1750
|
this._track(() => observer.disconnect());
|
|
3065
1751
|
}
|
|
3066
|
-
/*
|
|
3067
|
-
if (!this.openedElements.get(this.res)) {
|
|
3068
|
-
const ass = this.options.animation.op;
|
|
3069
|
-
|
|
3070
|
-
this.res.querySelectorAll('span').forEach(span => {
|
|
3071
|
-
if (!span._hasOpened) {
|
|
3072
|
-
span.animate(ass.keyframesClose, { duration: 0, fill: "forwards" });
|
|
3073
|
-
|
|
3074
|
-
const observer = new IntersectionObserver(entries => {
|
|
3075
|
-
entries.forEach(entry => {
|
|
3076
|
-
if (entry.isIntersecting && !span._hasOpened) {
|
|
3077
|
-
span._hasOpened = true;
|
|
3078
|
-
span.animate(ass.keyframesOpen, ass.openOptions);
|
|
3079
|
-
observer.disconnect();
|
|
3080
|
-
}
|
|
3081
|
-
});
|
|
3082
|
-
});
|
|
3083
|
-
|
|
3084
|
-
observer.observe(span);
|
|
3085
|
-
}
|
|
3086
|
-
});
|
|
3087
|
-
}*/
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
1752
|
|
|
3091
1753
|
|
|
3092
|
-
/*
|
|
3093
|
-
if (this.options.animation && this.options.animation.op.fireAt && this.options.animation.op.fireAt === "inview") {
|
|
3094
|
-
|
|
3095
|
-
let ass = this.options.animation.op;
|
|
3096
|
-
|
|
3097
|
-
this.res.animate(ass.keyframesClose, {
|
|
3098
|
-
duration: 0,
|
|
3099
|
-
fill: "forwards"
|
|
3100
|
-
});
|
|
3101
|
-
|
|
3102
1754
|
|
|
3103
|
-
const observer = new IntersectionObserver((entries, observer) => {
|
|
3104
|
-
entries.forEach(entry => {
|
|
3105
|
-
if (entry.isIntersecting) {
|
|
3106
|
-
// console.log("Element is in view!");
|
|
3107
|
-
this.res.animate(ass.keyframesOpen, ass.openOptions);
|
|
3108
|
-
// Perform your action here
|
|
3109
|
-
observer.disconnect(); // Stop observing if you only want it to fire once
|
|
3110
|
-
}
|
|
3111
|
-
});
|
|
3112
|
-
});
|
|
3113
1755
|
|
|
3114
|
-
// Start observing the element
|
|
3115
|
-
observer.observe(this.res);
|
|
3116
|
-
}*/
|
|
3117
1756
|
|
|
3118
1757
|
|
|
3119
1758
|
}
|
|
@@ -3410,312 +2049,7 @@ removeQuotesFromFirstWord(jsonString) {
|
|
|
3410
2049
|
|
|
3411
2050
|
|
|
3412
2051
|
|
|
3413
|
-
/*
|
|
3414
|
-
|
|
3415
|
-
navBarExpand(){
|
|
3416
|
-
this.res.style.backgroundColor = "green";
|
|
3417
|
-
this.res.animate([
|
|
3418
|
-
{transform: "scaleY(3.0)"}
|
|
3419
|
-
], {
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
duration: 2000,
|
|
3423
|
-
iterations: 1,
|
|
3424
|
-
fill: "both"
|
|
3425
|
-
|
|
3426
|
-
})//.play();
|
|
3427
|
-
|
|
3428
|
-
return this;
|
|
3429
|
-
}
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
scrollFade(duration, direction){
|
|
3437
|
-
this.res.style.visibility = "hidden";
|
|
3438
|
-
this.faden(duration, direction, "scroll");
|
|
3439
|
-
return this;
|
|
3440
|
-
}
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
expand(obj){
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
if (this.state.isExpanded === false){
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
if (obj.on === "click"){
|
|
3453
|
-
this.res.addEventListener("click", () => {
|
|
3454
|
-
this.innerExpand(obj);
|
|
3455
|
-
// this.moveUp(obj);
|
|
3456
|
-
});
|
|
3457
|
-
} else {
|
|
3458
|
-
this.innerExpand(obj);
|
|
3459
|
-
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
} else {
|
|
3463
|
-
|
|
3464
|
-
this.innerExpandBack(obj);
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
}
|
|
3468
|
-
|
|
3469
|
-
this.state.isExpanded = !this.state.isExpanded;
|
|
3470
|
-
|
|
3471
|
-
// // // console.log("IS EXPANDED: " + this.state.isExpanded);
|
|
3472
|
-
return this;
|
|
3473
|
-
}*/
|
|
3474
|
-
|
|
3475
|
-
/*
|
|
3476
|
-
move(obj){
|
|
3477
|
-
|
|
3478
|
-
if (obj.on === "click"){
|
|
3479
|
-
this.res.addEventListener("click", () => {
|
|
3480
|
-
this.moveUpa(obj);
|
|
3481
|
-
// this.moveUp(obj);
|
|
3482
|
-
});
|
|
3483
|
-
} else {
|
|
3484
|
-
if (obj.direction === "up"){
|
|
3485
|
-
this.moveUpa(obj);
|
|
3486
|
-
}
|
|
3487
|
-
|
|
3488
|
-
if (obj.direction === "down"){
|
|
3489
|
-
this.moveDowna(obj);
|
|
3490
|
-
}
|
|
3491
|
-
// }
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
this.state.isMovedUp = !this.state.isMovedUp;
|
|
3495
|
-
|
|
3496
|
-
if (obj.direction === "left"){
|
|
3497
|
-
this.moveLeft(obj);
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
|
-
return this;
|
|
3502
|
-
}
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
moveLeft(obj){
|
|
3508
|
-
this.res.animate([
|
|
3509
|
-
{transform: `translateX(0px)`},
|
|
3510
|
-
{transform: `translateX(-${obj.distance})`},
|
|
3511
|
-
|
|
3512
|
-
],{
|
|
3513
|
-
|
|
3514
|
-
duration: 900,
|
|
3515
|
-
iterations: obj.iterations,
|
|
3516
|
-
fill: "both"
|
|
3517
|
-
}).play();
|
|
3518
|
-
|
|
3519
|
-
return this;
|
|
3520
|
-
}
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
moveUpa(obj){
|
|
3524
|
-
if (this.state.isMovedUp === false){
|
|
3525
|
-
|
|
3526
|
-
this.res.animate([
|
|
3527
|
-
{transform: `translateX(0px)`},
|
|
3528
|
-
{transform: `translateY(-${obj.distance})`},
|
|
3529
|
-
],{
|
|
3530
|
-
duration: 900,
|
|
3531
|
-
iterations: obj.iterations,
|
|
3532
|
-
fill: "both"
|
|
3533
|
-
}).play();
|
|
3534
|
-
|
|
3535
|
-
} else {
|
|
3536
|
-
|
|
3537
|
-
this.res.animate([
|
|
3538
|
-
{transform: `translateX(0px)`},
|
|
3539
|
-
{transform: `translateY(${obj.distance})`},
|
|
3540
|
-
],{
|
|
3541
|
-
duration: 900,
|
|
3542
|
-
iterations: obj.iterations,
|
|
3543
|
-
fill: "both"
|
|
3544
|
-
}).play();
|
|
3545
|
-
|
|
3546
|
-
}
|
|
3547
|
-
return this;
|
|
3548
|
-
}
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
moveDowna(obj){
|
|
3552
|
-
if (this.state.isMovedDown === false){
|
|
3553
|
-
|
|
3554
|
-
this.res.animate([
|
|
3555
|
-
{transform: `translateX(0px)`},
|
|
3556
|
-
{transform: `translateY(${obj.distance})`},
|
|
3557
|
-
],{
|
|
3558
|
-
duration: 900,
|
|
3559
|
-
iterations: obj.iterations,
|
|
3560
|
-
fill: "both"
|
|
3561
|
-
}).play();
|
|
3562
|
-
|
|
3563
|
-
} else {
|
|
3564
|
-
|
|
3565
|
-
this.res.animate([
|
|
3566
|
-
{transform: `translateX(0px)`},
|
|
3567
|
-
{transform: `translateY(-${obj.distance})`},
|
|
3568
|
-
],{
|
|
3569
|
-
duration: 900,
|
|
3570
|
-
iterations: obj.iterations,
|
|
3571
|
-
fill: "both"
|
|
3572
|
-
}).play();
|
|
3573
|
-
|
|
3574
|
-
}
|
|
3575
|
-
return this;
|
|
3576
|
-
}
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
moveUpaBack(obj){
|
|
3581
|
-
this.res.animate([
|
|
3582
|
-
{transform: `translateX(0px)`},
|
|
3583
|
-
],{
|
|
3584
|
-
|
|
3585
|
-
duration: 900,
|
|
3586
|
-
iterations: obj.iterations,
|
|
3587
|
-
fill: "both"
|
|
3588
|
-
}).play();
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
return this;
|
|
3592
|
-
}
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
innerExpandBack(obj){
|
|
3597
|
-
this.res.animate([
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
{width: this.prevWidth,
|
|
3601
|
-
height: this.prevHeight},
|
|
3602
|
-
|
|
3603
|
-
// {width: "100px", height: "100px"}
|
|
3604
|
-
],{
|
|
3605
|
-
|
|
3606
|
-
duration: 900,
|
|
3607
|
-
iterations: obj.iterations,
|
|
3608
|
-
fill: "both"
|
|
3609
|
-
});
|
|
3610
|
-
}
|
|
3611
2052
|
|
|
3612
|
-
innerExpand(obj){
|
|
3613
|
-
this.prevWidth = this.res.style.width;
|
|
3614
|
-
this.prevHeight = this.res.style.height;
|
|
3615
|
-
|
|
3616
|
-
this.res.animate([
|
|
3617
|
-
{width: this.prevWidth,
|
|
3618
|
-
height: this.prevHeight},
|
|
3619
|
-
|
|
3620
|
-
{width: obj.width ?? this.prevWidth,
|
|
3621
|
-
height: obj.height ?? this.prevHeight},
|
|
3622
|
-
],{
|
|
3623
|
-
|
|
3624
|
-
duration: 900,
|
|
3625
|
-
iterations: obj.iterations,
|
|
3626
|
-
fill: "both"
|
|
3627
|
-
});
|
|
3628
|
-
|
|
3629
|
-
return this;
|
|
3630
|
-
|
|
3631
|
-
}
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
fade(obj){
|
|
3635
|
-
|
|
3636
|
-
this.res.style.visibility = "hidden";
|
|
3637
|
-
this.faden(obj.duration, obj.from, "load");
|
|
3638
|
-
|
|
3639
|
-
if (obj.finalOpacity){
|
|
3640
|
-
this.finalOpacity = obj.finalOpacity;
|
|
3641
|
-
}
|
|
3642
|
-
return this;
|
|
3643
|
-
}
|
|
3644
|
-
|
|
3645
|
-
faden(duration, direction, event){
|
|
3646
|
-
this.res.style.visibility = "hidden";
|
|
3647
|
-
this.scrolled = false;
|
|
3648
|
-
|
|
3649
|
-
window.addEventListener(event, () => {
|
|
3650
|
-
this.res.style.visibility = "visible";
|
|
3651
|
-
var height = window.innerHeight;
|
|
3652
|
-
var top = this.res.getBoundingClientRect().top;
|
|
3653
|
-
if ((top - height <= 0) || (event == "load")) {
|
|
3654
|
-
|
|
3655
|
-
if (this.scrolled == false){
|
|
3656
|
-
|
|
3657
|
-
if (direction == "left"){
|
|
3658
|
-
|
|
3659
|
-
this.res.animate([
|
|
3660
|
-
{transform: "translateX(-30px)"},
|
|
3661
|
-
{transform: "translateX(0px)"},
|
|
3662
|
-
],{
|
|
3663
|
-
|
|
3664
|
-
duration: duration,
|
|
3665
|
-
iterations: 1
|
|
3666
|
-
});
|
|
3667
|
-
}
|
|
3668
|
-
|
|
3669
|
-
if (direction == "right"){
|
|
3670
|
-
|
|
3671
|
-
this.res.animate([
|
|
3672
|
-
{transform: "translateX(30px)"},
|
|
3673
|
-
{transform: "translateX(0px)"},
|
|
3674
|
-
],{
|
|
3675
|
-
|
|
3676
|
-
duration: duration,
|
|
3677
|
-
iterations: 1
|
|
3678
|
-
});
|
|
3679
|
-
}
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
if (direction == "top"){
|
|
3683
|
-
this.res.animate([
|
|
3684
|
-
{transform: "translateY(-30px)"},
|
|
3685
|
-
{transform: "translateY(0px)"},
|
|
3686
|
-
],{
|
|
3687
|
-
|
|
3688
|
-
duration: duration,
|
|
3689
|
-
iterations: 1
|
|
3690
|
-
});
|
|
3691
|
-
}
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
if (direction == "bottom"){
|
|
3695
|
-
this.res.animate([
|
|
3696
|
-
{transform: "translateY(30px)"},
|
|
3697
|
-
{transform: "translateY(0px)"},
|
|
3698
|
-
],{
|
|
3699
|
-
|
|
3700
|
-
duration: duration,
|
|
3701
|
-
iterations: 1
|
|
3702
|
-
});
|
|
3703
|
-
}
|
|
3704
|
-
|
|
3705
|
-
this.res.animate([
|
|
3706
|
-
{opacity: "0.0"},
|
|
3707
|
-
{opacity: "1.0"}
|
|
3708
|
-
],{
|
|
3709
|
-
duration: duration,
|
|
3710
|
-
iterations: 1
|
|
3711
|
-
});
|
|
3712
|
-
|
|
3713
|
-
this.scrolled = true;
|
|
3714
|
-
}
|
|
3715
|
-
}
|
|
3716
|
-
});
|
|
3717
|
-
return this;
|
|
3718
|
-
}*/
|
|
3719
2053
|
} // 2600-1870
|
|
3720
2054
|
|
|
3721
2055
|
export { Animator };
|