nodality 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animator.cjs.js +1 -0
- package/dist/animator.esm.js +1 -0
- package/dist/audionew.cjs.js +1 -0
- package/dist/audionew.esm.js +1 -0
- package/dist/base.cjs.js +1 -0
- package/dist/base.esm.js +1 -0
- package/dist/betaDesktopBar.esm.js +1 -0
- package/dist/betaMobileBar.esm.js +1 -0
- package/dist/bundle.umd.js +1 -0
- package/dist/button.cjs.js +1 -0
- package/dist/button.esm.js +1 -0
- package/dist/cardGetter.cjs.js +1 -0
- package/dist/cardGetter.esm.js +1 -0
- package/dist/center.cjs.js +1 -0
- package/dist/center.esm.js +1 -0
- package/dist/checkbox.cjs.js +1 -0
- package/dist/checkbox.esm.js +1 -0
- package/dist/code.cjs.js +1 -0
- package/dist/code.esm.js +1 -0
- package/dist/container.cjs.js +1 -0
- package/dist/container.esm.js +1 -0
- package/dist/datalist.cjs.js +1 -0
- package/dist/datalist.esm.js +1 -0
- package/dist/designer.cjs.js +1 -0
- package/dist/designer.esm.js +1 -0
- package/dist/dropdown.cjs.js +1 -0
- package/dist/dropdown.esm.js +1 -0
- package/dist/elementMapper.cjs.js +1 -0
- package/dist/elementMapper.esm.js +1 -0
- package/dist/finalresult.esm.js +1 -0
- package/dist/flexCard.cjs.js +1 -0
- package/dist/flexCard.esm.js +1 -0
- package/dist/flexGrid.cjs.js +1 -0
- package/dist/flexGrid.esm.js +1 -0
- package/dist/flexRow.cjs.js +1 -0
- package/dist/flexRow.esm.js +1 -0
- package/dist/floatingInput.cjs.js +1 -0
- package/dist/floatingInput.esm.js +1 -0
- package/dist/free.cjs.js +1 -0
- package/dist/free.esm.js +1 -0
- package/dist/horizontalScroller.esm.js +1 -0
- package/dist/image.cjs.js +1 -0
- package/dist/image.esm.js +1 -0
- package/dist/imagePicker.cjs.js +1 -0
- package/dist/imagePicker.esm.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/link.cjs.js +1 -0
- package/dist/link.esm.js +1 -0
- package/dist/linkGetter.cjs.js +1 -0
- package/dist/linkGetter.esm.js +1 -0
- package/dist/metaAdder.cjs.js +1 -0
- package/dist/metaAdder.esm.js +1 -0
- package/dist/modal2025.cjs.js +1 -0
- package/dist/modal2025.esm.js +1 -0
- package/dist/multiswitchers.esm.js +1 -0
- package/dist/newNavBar.cjs.js +1 -0
- package/dist/newNavBar.esm.js +1 -0
- package/dist/picker.cjs.js +1 -0
- package/dist/picker.esm.js +1 -0
- package/dist/progress.cjs.js +1 -0
- package/dist/progress.esm.js +1 -0
- package/dist/radio.cjs.js +1 -0
- package/dist/radio.esm.js +1 -0
- package/dist/range.cjs.js +1 -0
- package/dist/range.esm.js +1 -0
- package/dist/sideBar.cjs.js +1 -0
- package/dist/sideBar.esm.js +1 -0
- package/dist/sideNavBar.cjs.js +1 -0
- package/dist/sideNavBar.esm.js +1 -0
- package/dist/simpleBar.cjs.js +1 -0
- package/dist/simpleBar.esm.js +1 -0
- package/dist/stack.cjs.js +1 -0
- package/dist/stack.esm.js +1 -0
- package/dist/table.cjs.js +1 -0
- package/dist/table.esm.js +1 -0
- package/dist/text.cjs.js +1 -0
- package/dist/text.esm.js +1 -0
- package/dist/textField.cjs.js +1 -0
- package/dist/textField.esm.js +1 -0
- package/dist/wrap.cjs.js +1 -0
- package/dist/wrap.esm.js +1 -0
- package/dist/zoomCard.cjs.js +1 -0
- package/dist/zoomCard.esm.js +1 -0
- package/layout/<head> +59 -0
- package/layout/DEADJOE +49 -0
- package/layout/DEPRECATED-PARAGRAPH.js +103 -0
- package/layout/animator.js +1915 -0
- package/layout/audio.js +145 -0
- package/layout/audionew.js +70 -0
- package/layout/base-2.js +92 -0
- package/layout/base.js +161 -0
- package/layout/betaDesktopBar.js +126 -0
- package/layout/betaMobileBar.js +293 -0
- package/layout/box.js +29 -0
- package/layout/button.js +516 -0
- package/layout/cards.js +136 -0
- package/layout/center.js +143 -0
- package/layout/checkbox.js +183 -0
- package/layout/cleanRow.js +775 -0
- package/layout/code.js +60 -0
- package/layout/container.js +1005 -0
- package/layout/custom.js +289 -0
- package/layout/divImage.js +209 -0
- package/layout/dropdown.js +154 -0
- package/layout/dropdown2025.js +152 -0
- package/layout/edit.sh +39 -0
- package/layout/emptyElement.js +21 -0
- package/layout/externalStylesheet.js +19 -0
- package/layout/flexCard.js +220 -0
- package/layout/flexGrid.js +192 -0
- package/layout/flexrow.js +866 -0
- package/layout/footer.js +83 -0
- package/layout/formComponents/custom.js +0 -0
- package/layout/formComponents/dataList.js +183 -0
- package/layout/formComponents/edit.sh +39 -0
- package/layout/formComponents/floatingInput.js +163 -0
- package/layout/formComponents/form-all.js +161 -0
- package/layout/formComponents/form.js +76 -0
- package/layout/formComponents/imagePicker.js +266 -0
- package/layout/formComponents/picker.js +208 -0
- package/layout/formComponents/radio.js +231 -0
- package/layout/formComponents/radiogroup.js +231 -0
- package/layout/formComponents/range.js +158 -0
- package/layout/free.js +232 -0
- package/layout/grid-new.js +299 -0
- package/layout/grid.js +190 -0
- package/layout/gridSwitcher.js +188 -0
- package/layout/group.js +163 -0
- package/layout/header.js +175 -0
- package/layout/hello.html +126 -0
- package/layout/horizontalScroller.js +222 -0
- package/layout/image-old.js +487 -0
- package/layout/image.js +1039 -0
- package/layout/index.js +183 -0
- package/layout/label.js +50 -0
- package/layout/link.js +1085 -0
- package/layout/list-OLD.js +0 -0
- package/layout/list.js +127 -0
- package/layout/metaAdder.js +17 -0
- package/layout/modal2025.js +142 -0
- package/layout/modernwrap.js +92 -0
- package/layout/multiswitcher.js +224 -0
- package/layout/multiswitcherBeta.js +63 -0
- package/layout/navBar-OLD.js +261 -0
- package/layout/navBar.js +371 -0
- package/layout/navFactor/customDiv.js +60 -0
- package/layout/navFactor/edit.sh +39 -0
- package/layout/newFlatAdder.js +41 -0
- package/layout/newNavBar copy 2.js +915 -0
- package/layout/newNavBar copy.js +774 -0
- package/layout/newNavBar.js +925 -0
- package/layout/offsetContainer.js +395 -0
- package/layout/progress.js +111 -0
- package/layout/remWin.sh +20 -0
- package/layout/row.js +208 -0
- package/layout/savedNewNavBar.js +437 -0
- package/layout/scrollvideo.js +120 -0
- package/layout/sideBar.js +183 -0
- package/layout/sideNavBar.js +313 -0
- package/layout/simpleBar.js +25 -0
- package/layout/slider2025.js +198 -0
- package/layout/spacer.js +44 -0
- package/layout/stack.js +76 -0
- package/layout/styler.js +113 -0
- package/layout/switcher.js +102 -0
- package/layout/table.js +155 -0
- package/layout/text.js +1685 -0
- package/layout/textField.js +282 -0
- package/layout/ulist.js +147 -0
- package/layout/video.js +70 -0
- package/layout/withoutNew.js +60 -0
- package/layout/wrap.js +140 -0
- package/layout/zoomCard.js +219 -0
- package/lib/cardGetter.js +80 -0
- package/lib/designer.js +875 -0
- package/lib/elementMapper.js +1428 -0
- package/lib/linkGetter.js +202 -0
- package/package.json +33 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Animator } from "./animator.js";
|
|
2
|
+
|
|
3
|
+
class Dropdown extends Animator {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.res = document.createElement("div");
|
|
7
|
+
|
|
8
|
+
// Wrapper for the collapsed dropdown
|
|
9
|
+
this.toggleWrap = document.createElement("div");
|
|
10
|
+
// this.toggleWrap.style.background = "olive";
|
|
11
|
+
this.toggleWrap.style.zIndex = 9999;
|
|
12
|
+
this.toggleWrap.style.borderRadius = "0.3rem";
|
|
13
|
+
//this.toggleWrap.style.width = "200px"; // Explicit width for collapsed dropdown
|
|
14
|
+
this.toggleWrap.style.height = "40px"; // Fixed height for collapsed dropdown
|
|
15
|
+
this.toggleWrap.style.cursor = "pointer";
|
|
16
|
+
this.toggleWrap.style.display = "flex";
|
|
17
|
+
this.toggleWrap.style.alignItems = "center";
|
|
18
|
+
this.toggleWrap.style.justifyContent = "center";
|
|
19
|
+
this.res.appendChild(this.toggleWrap);
|
|
20
|
+
|
|
21
|
+
// Container for dropdown content
|
|
22
|
+
this.contentWrap = document.createElement("div");
|
|
23
|
+
this.contentWrap.style.position = "absolute";
|
|
24
|
+
this.contentWrap.style.background = "#ecf0f1";
|
|
25
|
+
this.contentWrap.style.borderRadius = "0.3rem";
|
|
26
|
+
this.contentWrap.style.boxShadow = "0 2px 5px rgba(0, 0, 0, 0.15)";
|
|
27
|
+
this.contentWrap.style.marginTop = "10px"; // Visual separation
|
|
28
|
+
this.contentWrap.style.width = "250px"; // Explicit width for dropdown content
|
|
29
|
+
this.contentWrap.style.display = "none"; // Hidden by default
|
|
30
|
+
|
|
31
|
+
this.res.appendChild(this.contentWrap);
|
|
32
|
+
|
|
33
|
+
this.styles = {};
|
|
34
|
+
this.children = [];
|
|
35
|
+
this.isExpanded = false;
|
|
36
|
+
|
|
37
|
+
this.toggleWrap.addEventListener("click", () => this.toggle());
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set(obj) {
|
|
43
|
+
this.options = obj;
|
|
44
|
+
|
|
45
|
+
if (obj.title) {
|
|
46
|
+
this.toggleWrap.textContent = obj.title;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (obj.width) {
|
|
50
|
+
this.toggleWrap.style.width = obj.width;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (obj.contentWidth) {
|
|
54
|
+
this.contentWrap.style.width = obj.contentWidth;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (obj.background) {
|
|
58
|
+
this.contentWrap.style.backgroundColor = obj.background;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
obj.mar && this.mar(obj.mar);//alert("/")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const adjust = () => {
|
|
65
|
+
// alert("OBJA");
|
|
66
|
+
// alert(obj.breakpoint);
|
|
67
|
+
let media2 = window.matchMedia(`(max-device-width: 415px)`);
|
|
68
|
+
let smallScreen = window.matchMedia(`(max-width: ${obj.breakpoint ?? "600px"})`); // was 600px
|
|
69
|
+
|
|
70
|
+
if (media2.matches || smallScreen.matches) {
|
|
71
|
+
this.contentWrap.style.position = "relative";
|
|
72
|
+
} else {
|
|
73
|
+
this.contentWrap.style.position = "absolute";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
window.addEventListener("resize", adjust);
|
|
78
|
+
adjust();
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
add(children) {
|
|
85
|
+
if (!Array.isArray(children)) {
|
|
86
|
+
throw new Error("The 'add' method expects an array of children.");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
children.forEach((child, i) => {
|
|
90
|
+
if (i !== 0){
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if (child.res instanceof HTMLElement) {
|
|
94
|
+
this.contentWrap.appendChild(child.res);
|
|
95
|
+
} else {
|
|
96
|
+
throw new Error("Each child must have a valid 'element' property that is an HTMLElement.");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Set the first child as the title of the toggleWrap if no title is explicitly set
|
|
103
|
+
if (!this.options || !this.options.title) {
|
|
104
|
+
const firstChild = children[0];
|
|
105
|
+
if (firstChild && firstChild.res) {
|
|
106
|
+
this.toggleWrap.appendChild(firstChild.res);
|
|
107
|
+
// this.toggleWrap.textContent = firstChild.res.textContent || "Dropdown";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.children.push(...children);
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
toggle() {
|
|
117
|
+
this.isExpanded = !this.isExpanded;
|
|
118
|
+
this.contentWrap.style.display = this.isExpanded ? "block" : "none";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
toCode() {
|
|
122
|
+
const props = this.options
|
|
123
|
+
? Object.entries(this.options)
|
|
124
|
+
.map(([key, value]) => {
|
|
125
|
+
if (typeof value === "string") return `${key}: \"${value}\"`;
|
|
126
|
+
if (typeof value === "object") return `${key}: ${JSON.stringify(value)}`;
|
|
127
|
+
return `${key}: ${value}`;
|
|
128
|
+
})
|
|
129
|
+
.join(",\n ")
|
|
130
|
+
: "";
|
|
131
|
+
|
|
132
|
+
let finalCode = this.children
|
|
133
|
+
.map((el, i) =>
|
|
134
|
+
el
|
|
135
|
+
.toCode()
|
|
136
|
+
.flatMap((l) => l)
|
|
137
|
+
.join("") + (i < this.children.length - 1 ? "," : "")
|
|
138
|
+
)
|
|
139
|
+
.join("");
|
|
140
|
+
|
|
141
|
+
return [`new Dropdown().set({\n ${props}\n}).add([\n ${finalCode}\n])`];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
render(id) {
|
|
145
|
+
if (id) {
|
|
146
|
+
document.querySelector(id).appendChild(this.res);
|
|
147
|
+
}
|
|
148
|
+
return this.res;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { Dropdown };
|
package/layout/edit.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Loop through all .js files in the current directory
|
|
4
|
+
for file in ./*.js; do
|
|
5
|
+
# Skip if no .js files are found
|
|
6
|
+
[ -e "$file" ] || continue
|
|
7
|
+
|
|
8
|
+
# Extract the class name using a basic regex and awk
|
|
9
|
+
class_name=$(grep -o 'class [a-zA-Z_][a-zA-Z0-9_]*' "$file" | awk '{print $2}')
|
|
10
|
+
|
|
11
|
+
# Check if the class name was found
|
|
12
|
+
if [ -z "$class_name" ]; then
|
|
13
|
+
echo "No class definition found in $file. Skipping..."
|
|
14
|
+
continue
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Temporary file to store the output
|
|
18
|
+
temp_file=$(mktemp)
|
|
19
|
+
|
|
20
|
+
# Preserve class content and add imports/exports
|
|
21
|
+
{
|
|
22
|
+
echo 'import {Animator} from "./animator.js";'
|
|
23
|
+
echo
|
|
24
|
+
cat "$file"
|
|
25
|
+
echo
|
|
26
|
+
echo "window.$class_name = $class_name;"
|
|
27
|
+
echo "export { $class_name };"
|
|
28
|
+
} > "$temp_file"
|
|
29
|
+
|
|
30
|
+
# Replace the original file with the transformed content
|
|
31
|
+
mv "$temp_file" "$file"
|
|
32
|
+
|
|
33
|
+
echo "Transformed: $file"
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
echo "All .js files in the current folder have been processed."
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# ./edit.sh in your folder, only ONE class per file!
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
class Empty {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.res = document.createElement("null");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
toCode(){
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
render(div) {
|
|
13
|
+
if (div) {
|
|
14
|
+
document.querySelector(div).appendChild(this.res);
|
|
15
|
+
} else {
|
|
16
|
+
|
|
17
|
+
return this.res;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} // 183934
|
|
21
|
+
export { Empty };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
class ExternalStylesheet extends Base {
|
|
4
|
+
constructor(link){
|
|
5
|
+
super();
|
|
6
|
+
this.link = link;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
render(){
|
|
10
|
+
let el = document.createElement("link");
|
|
11
|
+
el.setAttribute("rel", "stylesheet");
|
|
12
|
+
el.setAttribute("href", this.link);
|
|
13
|
+
document.getElementsByTagName( "head" )[0].appendChild( el );
|
|
14
|
+
return el;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export { ExternalStylesheet };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Card extends Animator {
|
|
6
|
+
constructor(text, url) {
|
|
7
|
+
super();
|
|
8
|
+
this.text = text;
|
|
9
|
+
this.url = url;
|
|
10
|
+
this.setup();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getType(){
|
|
14
|
+
return "sCardElement";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setup() {
|
|
18
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
19
|
+
let card = document.createElement("div");
|
|
20
|
+
card.style.display = "flex";
|
|
21
|
+
card.style.flexDirection = "column";
|
|
22
|
+
card.style.alignItems = "center";
|
|
23
|
+
card.style.backgroundColor = "#fff";
|
|
24
|
+
card.style.fontFamily = "Arial";
|
|
25
|
+
card.style.width = "100%";
|
|
26
|
+
card.style.boxShadow = "3px 3px 10px #111";
|
|
27
|
+
card.style.overflow = "hidden"
|
|
28
|
+
this.res = card;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set(obj){
|
|
33
|
+
let stra = "";
|
|
34
|
+
this.obj = obj;
|
|
35
|
+
|
|
36
|
+
if (obj.border){
|
|
37
|
+
this.res.style.border = obj.border;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (obj.radius){
|
|
41
|
+
this.res.style.borderRadius = obj.radius;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (obj.arrayPadding){
|
|
45
|
+
let sides = obj.arrayPadding.sides;
|
|
46
|
+
//console.log(sides);
|
|
47
|
+
//console.log(sides.map(x => `"${x}"`).join(", "));
|
|
48
|
+
|
|
49
|
+
const mapped = sides.map(x => `"${x}"`).join(", ")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
obj.arrayPadding && this.arrayPadding(obj.arrayPadding.sides, obj.arrayPadding.value);
|
|
54
|
+
//obj.arrayPadding && this.arrayPadding(obj.arrayMargin.sides, obj.arrayMargin.value);
|
|
55
|
+
obj.arrayPadding && (stra += `\n arrayPadding: {sides: [${mapped}], value: "${obj.arrayPadding.value}"},`); // 2345 06/03
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
|
|
61
|
+
//obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
|
|
62
|
+
obj.arrayMargin && (stra += `\n arrayMargin: {sides: [${obj.arrayMargin.sides.map(side => `"${side}", `)}], value: "${obj.arrayMargin.value}"},`); // 2345 06/03
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
obj.width && (this.res.style.width = obj.width);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
arrayPadding(arr, value) {
|
|
72
|
+
|
|
73
|
+
if (!value){ // LTRB
|
|
74
|
+
this.res.style.marginLeft = `${arr[0]}px`;
|
|
75
|
+
this.res.style.marginTop = `${arr[1]}px`;
|
|
76
|
+
this.res.style.marginRight = `${arr[2]}px`;
|
|
77
|
+
this.res.style.marginBottom = `${arr[3]}px`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (arr[0] === "all"){
|
|
81
|
+
this.res.style.paddingLeft = value;
|
|
82
|
+
this.res.style.paddingTop = value;
|
|
83
|
+
this.res.style.paddingRight = value;
|
|
84
|
+
this.res.style.paddingBottom = value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if (arr.includes("left")){
|
|
89
|
+
this.res.style.paddingLeft = value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (arr.includes("right")){
|
|
93
|
+
this.res.style.paddingRight = value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (arr.includes("top")){
|
|
97
|
+
this.res.style.paddingTop = value;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (arr.includes("bottom")){
|
|
101
|
+
this.res.style.paddingBottom = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!value){
|
|
105
|
+
this.res.style.paddingBottom = arr;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
//alert(value);
|
|
110
|
+
|
|
111
|
+
return this;
|
|
112
|
+
} //22155 snap to change phone screen
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
arrayMargin(arr, value) { // 224857 redefined earlier
|
|
116
|
+
|
|
117
|
+
// console.log(arr);
|
|
118
|
+
if (arr.includes("left")){
|
|
119
|
+
this.res.style.marginLeft = value;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (arr.includes("right")){
|
|
123
|
+
this.res.style.marginRight = value;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (arr.includes("top")){
|
|
127
|
+
this.res.style.marginTop = value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (arr.includes("bottom")){
|
|
131
|
+
this.res.style.marginBottom = value;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (arr.includes("all")){
|
|
135
|
+
this.res.style.margin = value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!value){
|
|
139
|
+
this.res.style.marginBottom = arr;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
frame(obj){
|
|
146
|
+
|
|
147
|
+
if (obj.height){
|
|
148
|
+
this.res.style.height = obj.height;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (obj.width){
|
|
152
|
+
this.res.style.width = obj.width;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
scale(obj){
|
|
159
|
+
|
|
160
|
+
let previousWidth = this.res.style.width;
|
|
161
|
+
|
|
162
|
+
this.res.style.transition= "0.5s all";
|
|
163
|
+
// alert(previousWidth);
|
|
164
|
+
|
|
165
|
+
this.res.addEventListener("mouseover", () => {
|
|
166
|
+
let previousWidth = this.res.style.width;
|
|
167
|
+
this.res.style.transform = "scale(1.04)";
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
this.res.addEventListener("mouseout", () => {
|
|
171
|
+
let previousWidth = this.res.style.width;
|
|
172
|
+
this.res.style.transform = "scale(1.0)";
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
background(color){
|
|
180
|
+
this.res.style.backgroundColor = color;
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
color(color){
|
|
185
|
+
this.res.style.color = color;
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
padding(pad){
|
|
190
|
+
this.res.style.padding = `${pad}px`;
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
items(els){
|
|
195
|
+
for (var i = 0; i < els.length; i++){
|
|
196
|
+
this.res.appendChild(els[i].render());
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
shadow(){
|
|
203
|
+
this.res.style.boxShadow = "1px 1px 20px rgba(0, 0, 0, 0.60)";
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
round(value){
|
|
208
|
+
this.res.style.borderRadius = `${value}px`;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
render(div){
|
|
213
|
+
if (div){
|
|
214
|
+
document.querySelector(div).appendChild(this.res);
|
|
215
|
+
} else {
|
|
216
|
+
return this.res;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export { Card };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Add code-gen after backup
|
|
5
|
+
class FlexGrid {
|
|
6
|
+
constructor(){
|
|
7
|
+
this.code = [];
|
|
8
|
+
this.setup();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
toCode(){
|
|
12
|
+
return this.code;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
setup(){
|
|
17
|
+
this.code.push("new FlexGrid()");
|
|
18
|
+
this.code.push(".setup()")
|
|
19
|
+
let gr = document.createElement("div");
|
|
20
|
+
gr.style.display = "flex";
|
|
21
|
+
//gr.style.flexWrap = "wrap";
|
|
22
|
+
|
|
23
|
+
gr.style.padding = 0;
|
|
24
|
+
gr.style.margin = 0;
|
|
25
|
+
//gr.style.width = "100%";
|
|
26
|
+
this.res = gr;
|
|
27
|
+
return this; // DANGEROUS FEBRUARY ?
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// flex: 1, maxWidth: "400px", wrap: true
|
|
31
|
+
|
|
32
|
+
set(options){
|
|
33
|
+
this.code.push(".set({");
|
|
34
|
+
// this.code.push(JSON.stringify(options));
|
|
35
|
+
// console.log("OPE");
|
|
36
|
+
|
|
37
|
+
options.width && this.code.push(`width: "${options.width}",`);
|
|
38
|
+
options.flex && (this.res.style.flex = options.flex);
|
|
39
|
+
options.flex && this.code.push(`flex: ${options.flex},`);
|
|
40
|
+
|
|
41
|
+
options.maxWidth && (this.res.style.maxWidth = options.maxWidth);
|
|
42
|
+
options.maxWidth && this.code.push(`maxWidth: "${options.maxWidth}",`);
|
|
43
|
+
|
|
44
|
+
options.maxWidth && (this.res.style.minWidth = "400px");
|
|
45
|
+
options.maxWidth && (this.res.style.marginLeft = "auto");
|
|
46
|
+
options.maxWidth && (this.res.style.marginRight = "auto");
|
|
47
|
+
|
|
48
|
+
// this.res.style.width = "400px"
|
|
49
|
+
options.width && (this.res.style.width = `${options.width}`);
|
|
50
|
+
options.wrap && (this.res.style.flexWrap = `wrap`); // ok
|
|
51
|
+
|
|
52
|
+
options.wrap && this.code.push(`wrap: ${options.wrap},`);
|
|
53
|
+
|
|
54
|
+
options.align && (this.res.style.justifyContent = options.align);
|
|
55
|
+
options.align && this.code.push(`align: ${options.align},`);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
options.colat && this.toColumnAt(options.colat);
|
|
60
|
+
options.colat && this.code.push(`\n colat: "${options.colat}",`);
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
this.code.push("}),");
|
|
65
|
+
|
|
66
|
+
// console.log(this.code);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
toColumnAt(at){ // THIS IS THE ONE!!!
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (!this.columnAlways){
|
|
74
|
+
// alert(this.columnAlways);
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const toCol = () => {
|
|
78
|
+
|
|
79
|
+
let media = window.matchMedia(`(max-width: ${at})`);
|
|
80
|
+
let mobileMedia = window.matchMedia(`(max-device-width: 415px)`);
|
|
81
|
+
|
|
82
|
+
if (media.matches || mobileMedia.matches){
|
|
83
|
+
|
|
84
|
+
this.res.style.flexDirection = "column";
|
|
85
|
+
this.res.style.alignItems = "center";
|
|
86
|
+
} else {
|
|
87
|
+
this.res.style.flexDirection = "row";
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
toCol();
|
|
93
|
+
window.addEventListener("resize", toCol);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
flex(str){
|
|
98
|
+
this.arra = Array.from(str.replace(/\s/g, ''));
|
|
99
|
+
this.areas = Array.from(Array(str.replace(/\s/g, '')).join(""));
|
|
100
|
+
this.save = `"${str}"`;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
padding(value){
|
|
106
|
+
this.res.style.padding = `${value}px`;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
center(){
|
|
112
|
+
this.res.style.marginLeft = "auto";
|
|
113
|
+
this.res.style.marginRight = "auto";
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
items(elements){
|
|
118
|
+
this.items = elements;
|
|
119
|
+
this.code.push("\n .items([");
|
|
120
|
+
|
|
121
|
+
var count = -1;
|
|
122
|
+
for (var i = 0; i < elements.length; i++){
|
|
123
|
+
var el = elements[i];
|
|
124
|
+
count += 1;
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
if (el != undefined){
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
let ela = el.render()
|
|
131
|
+
|
|
132
|
+
if (el.toCode !== undefined){
|
|
133
|
+
this.code.push(el.toCode().flatMap(l=>l)); // 20:10:00 Nice!
|
|
134
|
+
// 12:25:10 Wow!!!
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// ela.style.flex = this.areas[count];
|
|
139
|
+
this.res.appendChild(ela);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.code.push("\n ])");
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
width(w){
|
|
150
|
+
this.res.style.width = w;
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
border(color, width){
|
|
156
|
+
this.res.style.border = `${width}px solid ${color}`;
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
adjust(h){
|
|
161
|
+
const adj = () => {
|
|
162
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
163
|
+
|
|
164
|
+
if (window.innerWidth < h || query.matches) {
|
|
165
|
+
for (var i = 0; i < this.res.children.length; i++){
|
|
166
|
+
this.res.children[i].style.flex = "";
|
|
167
|
+
this.res.children[i].style.width = "100%";
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
//console.warn(this.arra);
|
|
171
|
+
for (var i = 0; i < this.res.children.length; i++){
|
|
172
|
+
this.res.children[i].style.flex = `${this.arra[i]}`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
adj();
|
|
178
|
+
window.addEventListener("resize", adj);
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
render(el) {
|
|
183
|
+
if (el) {
|
|
184
|
+
document.querySelector("body").style.margin = 0;
|
|
185
|
+
document.querySelector("body").style.padding = 0;
|
|
186
|
+
document.querySelector(el).appendChild(this.res);
|
|
187
|
+
} else {
|
|
188
|
+
return this.res;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export { FlexGrid };
|