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.
Files changed (179) hide show
  1. package/dist/animator.cjs.js +1 -0
  2. package/dist/animator.esm.js +1 -0
  3. package/dist/audionew.cjs.js +1 -0
  4. package/dist/audionew.esm.js +1 -0
  5. package/dist/base.cjs.js +1 -0
  6. package/dist/base.esm.js +1 -0
  7. package/dist/betaDesktopBar.esm.js +1 -0
  8. package/dist/betaMobileBar.esm.js +1 -0
  9. package/dist/bundle.umd.js +1 -0
  10. package/dist/button.cjs.js +1 -0
  11. package/dist/button.esm.js +1 -0
  12. package/dist/cardGetter.cjs.js +1 -0
  13. package/dist/cardGetter.esm.js +1 -0
  14. package/dist/center.cjs.js +1 -0
  15. package/dist/center.esm.js +1 -0
  16. package/dist/checkbox.cjs.js +1 -0
  17. package/dist/checkbox.esm.js +1 -0
  18. package/dist/code.cjs.js +1 -0
  19. package/dist/code.esm.js +1 -0
  20. package/dist/container.cjs.js +1 -0
  21. package/dist/container.esm.js +1 -0
  22. package/dist/datalist.cjs.js +1 -0
  23. package/dist/datalist.esm.js +1 -0
  24. package/dist/designer.cjs.js +1 -0
  25. package/dist/designer.esm.js +1 -0
  26. package/dist/dropdown.cjs.js +1 -0
  27. package/dist/dropdown.esm.js +1 -0
  28. package/dist/elementMapper.cjs.js +1 -0
  29. package/dist/elementMapper.esm.js +1 -0
  30. package/dist/finalresult.esm.js +1 -0
  31. package/dist/flexCard.cjs.js +1 -0
  32. package/dist/flexCard.esm.js +1 -0
  33. package/dist/flexGrid.cjs.js +1 -0
  34. package/dist/flexGrid.esm.js +1 -0
  35. package/dist/flexRow.cjs.js +1 -0
  36. package/dist/flexRow.esm.js +1 -0
  37. package/dist/floatingInput.cjs.js +1 -0
  38. package/dist/floatingInput.esm.js +1 -0
  39. package/dist/free.cjs.js +1 -0
  40. package/dist/free.esm.js +1 -0
  41. package/dist/horizontalScroller.esm.js +1 -0
  42. package/dist/image.cjs.js +1 -0
  43. package/dist/image.esm.js +1 -0
  44. package/dist/imagePicker.cjs.js +1 -0
  45. package/dist/imagePicker.esm.js +1 -0
  46. package/dist/index.cjs.js +1 -0
  47. package/dist/index.esm.js +1 -0
  48. package/dist/link.cjs.js +1 -0
  49. package/dist/link.esm.js +1 -0
  50. package/dist/linkGetter.cjs.js +1 -0
  51. package/dist/linkGetter.esm.js +1 -0
  52. package/dist/metaAdder.cjs.js +1 -0
  53. package/dist/metaAdder.esm.js +1 -0
  54. package/dist/modal2025.cjs.js +1 -0
  55. package/dist/modal2025.esm.js +1 -0
  56. package/dist/multiswitchers.esm.js +1 -0
  57. package/dist/newNavBar.cjs.js +1 -0
  58. package/dist/newNavBar.esm.js +1 -0
  59. package/dist/picker.cjs.js +1 -0
  60. package/dist/picker.esm.js +1 -0
  61. package/dist/progress.cjs.js +1 -0
  62. package/dist/progress.esm.js +1 -0
  63. package/dist/radio.cjs.js +1 -0
  64. package/dist/radio.esm.js +1 -0
  65. package/dist/range.cjs.js +1 -0
  66. package/dist/range.esm.js +1 -0
  67. package/dist/sideBar.cjs.js +1 -0
  68. package/dist/sideBar.esm.js +1 -0
  69. package/dist/sideNavBar.cjs.js +1 -0
  70. package/dist/sideNavBar.esm.js +1 -0
  71. package/dist/simpleBar.cjs.js +1 -0
  72. package/dist/simpleBar.esm.js +1 -0
  73. package/dist/stack.cjs.js +1 -0
  74. package/dist/stack.esm.js +1 -0
  75. package/dist/table.cjs.js +1 -0
  76. package/dist/table.esm.js +1 -0
  77. package/dist/text.cjs.js +1 -0
  78. package/dist/text.esm.js +1 -0
  79. package/dist/textField.cjs.js +1 -0
  80. package/dist/textField.esm.js +1 -0
  81. package/dist/wrap.cjs.js +1 -0
  82. package/dist/wrap.esm.js +1 -0
  83. package/dist/zoomCard.cjs.js +1 -0
  84. package/dist/zoomCard.esm.js +1 -0
  85. package/layout/<head> +59 -0
  86. package/layout/DEADJOE +49 -0
  87. package/layout/DEPRECATED-PARAGRAPH.js +103 -0
  88. package/layout/animator.js +1915 -0
  89. package/layout/audio.js +145 -0
  90. package/layout/audionew.js +70 -0
  91. package/layout/base-2.js +92 -0
  92. package/layout/base.js +161 -0
  93. package/layout/betaDesktopBar.js +126 -0
  94. package/layout/betaMobileBar.js +293 -0
  95. package/layout/box.js +29 -0
  96. package/layout/button.js +516 -0
  97. package/layout/cards.js +136 -0
  98. package/layout/center.js +143 -0
  99. package/layout/checkbox.js +183 -0
  100. package/layout/cleanRow.js +775 -0
  101. package/layout/code.js +60 -0
  102. package/layout/container.js +1005 -0
  103. package/layout/custom.js +289 -0
  104. package/layout/divImage.js +209 -0
  105. package/layout/dropdown.js +154 -0
  106. package/layout/dropdown2025.js +152 -0
  107. package/layout/edit.sh +39 -0
  108. package/layout/emptyElement.js +21 -0
  109. package/layout/externalStylesheet.js +19 -0
  110. package/layout/flexCard.js +220 -0
  111. package/layout/flexGrid.js +192 -0
  112. package/layout/flexrow.js +866 -0
  113. package/layout/footer.js +83 -0
  114. package/layout/formComponents/custom.js +0 -0
  115. package/layout/formComponents/dataList.js +183 -0
  116. package/layout/formComponents/edit.sh +39 -0
  117. package/layout/formComponents/floatingInput.js +163 -0
  118. package/layout/formComponents/form-all.js +161 -0
  119. package/layout/formComponents/form.js +76 -0
  120. package/layout/formComponents/imagePicker.js +266 -0
  121. package/layout/formComponents/picker.js +208 -0
  122. package/layout/formComponents/radio.js +231 -0
  123. package/layout/formComponents/radiogroup.js +231 -0
  124. package/layout/formComponents/range.js +158 -0
  125. package/layout/free.js +232 -0
  126. package/layout/grid-new.js +299 -0
  127. package/layout/grid.js +190 -0
  128. package/layout/gridSwitcher.js +188 -0
  129. package/layout/group.js +163 -0
  130. package/layout/header.js +175 -0
  131. package/layout/hello.html +126 -0
  132. package/layout/horizontalScroller.js +222 -0
  133. package/layout/image-old.js +487 -0
  134. package/layout/image.js +1039 -0
  135. package/layout/index.js +183 -0
  136. package/layout/label.js +50 -0
  137. package/layout/link.js +1085 -0
  138. package/layout/list-OLD.js +0 -0
  139. package/layout/list.js +127 -0
  140. package/layout/metaAdder.js +17 -0
  141. package/layout/modal2025.js +142 -0
  142. package/layout/modernwrap.js +92 -0
  143. package/layout/multiswitcher.js +224 -0
  144. package/layout/multiswitcherBeta.js +63 -0
  145. package/layout/navBar-OLD.js +261 -0
  146. package/layout/navBar.js +371 -0
  147. package/layout/navFactor/customDiv.js +60 -0
  148. package/layout/navFactor/edit.sh +39 -0
  149. package/layout/newFlatAdder.js +41 -0
  150. package/layout/newNavBar copy 2.js +915 -0
  151. package/layout/newNavBar copy.js +774 -0
  152. package/layout/newNavBar.js +925 -0
  153. package/layout/offsetContainer.js +395 -0
  154. package/layout/progress.js +111 -0
  155. package/layout/remWin.sh +20 -0
  156. package/layout/row.js +208 -0
  157. package/layout/savedNewNavBar.js +437 -0
  158. package/layout/scrollvideo.js +120 -0
  159. package/layout/sideBar.js +183 -0
  160. package/layout/sideNavBar.js +313 -0
  161. package/layout/simpleBar.js +25 -0
  162. package/layout/slider2025.js +198 -0
  163. package/layout/spacer.js +44 -0
  164. package/layout/stack.js +76 -0
  165. package/layout/styler.js +113 -0
  166. package/layout/switcher.js +102 -0
  167. package/layout/table.js +155 -0
  168. package/layout/text.js +1685 -0
  169. package/layout/textField.js +282 -0
  170. package/layout/ulist.js +147 -0
  171. package/layout/video.js +70 -0
  172. package/layout/withoutNew.js +60 -0
  173. package/layout/wrap.js +140 -0
  174. package/layout/zoomCard.js +219 -0
  175. package/lib/cardGetter.js +80 -0
  176. package/lib/designer.js +875 -0
  177. package/lib/elementMapper.js +1428 -0
  178. package/lib/linkGetter.js +202 -0
  179. package/package.json +33 -0
@@ -0,0 +1,83 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+
4
+
5
+ // 13:28 07/04/2020 - BEGIN NOTHING GONNA STOP US NOW Lets go!
6
+ class Footer {
7
+ constructor(text){
8
+ this.text = text;
9
+ this.ele = null;
10
+ this.setup();
11
+ }
12
+
13
+ setup(){
14
+ let el = document.createElement("footer");
15
+ let node = document.createTextNode(this.text);
16
+ el.appendChild(node);
17
+ this.ele = el;
18
+ this.ele.style.padding = 0;
19
+ this.ele.style.margin = 0;
20
+ this.ele.style.textAlign = "center";
21
+
22
+ this.padding(20);
23
+ this.bold();
24
+ this.ele.style.backgroundColor = "#ecf0f1";
25
+ return this;
26
+ }
27
+
28
+ font(font){
29
+ this.ele.style.fontFamily = font;
30
+ return this;
31
+ }
32
+
33
+ size(s){
34
+ this.ele.style.fontSize = s;
35
+ return this;
36
+ }
37
+
38
+ em(e){
39
+ this.ele.style.fontSize = `${e}em`;
40
+ return this;
41
+ }
42
+
43
+ color(color){
44
+ this.ele.style.color = color;
45
+ return this;
46
+ }
47
+
48
+ weight(weight){
49
+ this.ele.style.fontWeight = weight;
50
+ return this;
51
+ }
52
+
53
+ bold(){
54
+ this.ele.style.fontWeight = "bold";
55
+ return this;
56
+ }
57
+
58
+ italic(){
59
+ this.ele.style.fontStyle = "italic";
60
+ return this;
61
+ }
62
+
63
+ padding(val){
64
+ this.ele.style.padding = val;
65
+ return this;
66
+ }
67
+
68
+
69
+ margin(val){
70
+ this.ele.style.margin = val;
71
+ return this;
72
+ }
73
+
74
+ render(div){
75
+ if (div){
76
+ document.querySelector(div).appendChild(this.ele);
77
+ } else {
78
+ return this.ele;
79
+ }
80
+ }
81
+ }
82
+
83
+ export { Footer };
File without changes
@@ -0,0 +1,183 @@
1
+ import {Animator} from "../animator.js";
2
+
3
+
4
+ class DataList {
5
+ constructor(){
6
+ this.res = null;
7
+ this.currentItem = "";
8
+ }
9
+
10
+ set(items){
11
+
12
+ let obj = items;
13
+
14
+
15
+ this.options = items;
16
+ var container = document.createElement("input");
17
+ container.setAttribute("list", "dlCities");
18
+ container.setAttribute("id", "my");
19
+
20
+ var optionList = items.data;
21
+
22
+ var i = 0,
23
+ len = optionList.length,
24
+ dl = document.createElement('datalist');
25
+
26
+ dl.id = 'dlCities';
27
+
28
+ for (var i = 0; i < len; i += 1) {
29
+ var option = document.createElement('option');
30
+ option.value = optionList[i];
31
+ dl.appendChild(option);
32
+ }
33
+
34
+ container.appendChild(dl);
35
+ container.addEventListener("change", () => {
36
+ let val = document.querySelector("#my").value;
37
+ console.log(val);
38
+ this.currentItem = val;
39
+ });
40
+
41
+
42
+
43
+
44
+ container.setAttribute("placeholder", "Type value");
45
+ container.style.padding = ".4rem .75rem";
46
+ container.style.fontSize = "1rem";
47
+ this.res = container;
48
+ this.responsive();
49
+
50
+ obj.arrayPadding && this.arrayPadding(obj.arrayPadding.sides, obj.arrayPadding.value);
51
+ obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
52
+
53
+ obj.pad && this.pad(obj.pad);
54
+ obj.mar && this.mar(obj.mar);
55
+
56
+
57
+ return this;
58
+
59
+ }
60
+
61
+ toCode() {
62
+ const objString = JSON.stringify(this.options, null, 4);
63
+ return [`new DataList().set(${objString})`];
64
+ }
65
+
66
+ getValue(){
67
+ return this.res.value;
68
+ }
69
+
70
+
71
+ arrayPadding(arr, value) {
72
+ //alert("PP")
73
+ console.log(arr);
74
+ if (arr.includes("left")){
75
+ this.res.style.paddingLeft = value;
76
+ }
77
+
78
+ // console.log("PAD");
79
+ // console.log(this.res.style.paddingLeft);
80
+ // console.log(arr);
81
+ // console.log(value);
82
+
83
+ if (arr.includes("right")){
84
+ this.res.style.paddingRight = value;
85
+ }
86
+
87
+ if (arr.includes("top")){
88
+ this.res.style.paddingTop = value;
89
+ }
90
+
91
+ if (arr.includes("bottom")){
92
+ this.res.style.paddingBottom = value;
93
+ }
94
+
95
+ if (arr.includes("all")){
96
+ this.res.style.padding = value;
97
+ }
98
+
99
+
100
+ return this;
101
+ }
102
+
103
+ arrayMargin(arr, value) {
104
+ //alert("PP")
105
+ console.log(arr);
106
+ if (arr.includes("left")){
107
+ this.res.style.marginLeft = value;
108
+ }
109
+
110
+ // console.log("PAD");
111
+ // console.log(this.res.style.paddingLeft);
112
+ // console.log(arr);
113
+ // console.log(value);
114
+
115
+ if (arr.includes("right")){
116
+ this.res.style.marginRight = value;
117
+ }
118
+
119
+ if (arr.includes("top")){
120
+ this.res.style.marginTop = value;
121
+ }
122
+
123
+ if (arr.includes("bottom")){
124
+ this.res.style.marginBottom = value;
125
+ }
126
+
127
+ if (arr.includes("all")){
128
+ this.res.style.margin = value;
129
+ }
130
+
131
+
132
+ return this;
133
+ }
134
+
135
+
136
+ margin(val){
137
+ this.res.style.margin = val;
138
+ return this;
139
+ }
140
+
141
+ responsive(){
142
+ let query = window.matchMedia("(max-device-width: 415px)");
143
+
144
+ // window.matchMedia(query)
145
+ /* if (query.matches){
146
+
147
+ this.el.style.fontSize = "3rem";
148
+ } else {
149
+ this.el.style.fontSize = "1rem";
150
+ }*/
151
+
152
+
153
+
154
+ if (query.matches) {
155
+ this.res.style.width = "100%";
156
+
157
+ } else {
158
+
159
+ }
160
+
161
+
162
+ return this;
163
+ }
164
+
165
+
166
+
167
+ render(div){
168
+ if (div){
169
+ document.querySelector(div).appendChild(this.res);
170
+
171
+ } else {
172
+ return this.res;
173
+ }
174
+ }
175
+ }
176
+
177
+ // Call without new
178
+ var _oldDataList = DataList;
179
+ DataList = function(...args) { return new _oldDataList(...args) };
180
+
181
+
182
+ window.DataList = DataList;
183
+ export { DataList };
@@ -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,163 @@
1
+
2
+ import {Animator} from "../animator.js";
3
+
4
+ class FloatingInput extends Animator {
5
+ constructor(){
6
+ super();
7
+ this.el = null;
8
+ // this.setup();
9
+ }
10
+
11
+
12
+
13
+ set(obj){
14
+ this.options = obj;
15
+ let div = document.createElement("div");
16
+
17
+ let label = document.createElement("label");
18
+ label.style.position = "relative";
19
+ label.style.display = "block";
20
+
21
+ let node = document.createTextNode(obj.title);
22
+ label.appendChild(node);
23
+ label.style.opacity = 0;
24
+
25
+
26
+ var input = document.createElement("input");
27
+
28
+
29
+ if (obj.type === "textarea"){
30
+ input = document.createElement("textarea");
31
+ }
32
+
33
+
34
+
35
+
36
+ input.style.position = "relative";
37
+ input.placeholder = obj.title;
38
+
39
+
40
+
41
+ input.style.fontSize = "1rem";
42
+ input.style.padding = ".4rem .75rem";
43
+
44
+
45
+
46
+ div.appendChild(label);
47
+ div.appendChild(input);
48
+
49
+ this.res = div;
50
+ obj.mar && this.mar(obj.mar);
51
+ obj.pad && this.pad(obj.pad);
52
+
53
+
54
+ input.addEventListener("focus", () => {
55
+ label.style.transition = "transform ease 0.2s";
56
+ label.style.transform = "scale(0.80)";
57
+ label.style.textTransform = "uppercase";
58
+ label.style.transformOrigin = "left top";
59
+ label.style.fontWeight = "bold";
60
+ input.placeholder = "";
61
+ label.style.opacity = "1.0"; // 220654
62
+
63
+ if (obj.font){
64
+ label.style.fontFamily = obj.font;
65
+ }
66
+
67
+ if (obj.color){
68
+ label.style.color = obj.color;
69
+ }
70
+
71
+ if (obj.exact){
72
+ label.style.fontSize = obj.exact;
73
+ }
74
+
75
+ });
76
+
77
+ input.addEventListener("focusout", () => {
78
+ label.style.transform = "scale(1.0)";
79
+ input.placeholder = obj.title;
80
+ label.style.opacity = "0.0";
81
+ });
82
+
83
+ obj.name && input.setAttribute("name", obj.name);
84
+
85
+
86
+
87
+ let query = window.matchMedia("(max-device-width: 415px)");
88
+
89
+ // window.matchMedia(query)
90
+ if (query.matches){
91
+ // input.style.fontSize = "1rem";
92
+
93
+ //input.style.width = "100%";
94
+ // input.style.fontSize = "3em";
95
+ // label.style.fontSize = "1.20em";
96
+ input.style.width = "100%";
97
+ div.style.width = "100%";
98
+
99
+ }
100
+
101
+ // saviour
102
+ // input.style.width = "100%";
103
+ // div.style.width = "100%";
104
+ input.style.fontSize = "1rem"
105
+
106
+
107
+
108
+ this.el = div;
109
+
110
+
111
+
112
+
113
+
114
+ // this.responsive();
115
+
116
+
117
+ return this;
118
+ }
119
+
120
+ getValue(){
121
+ return this.el.children[1].value;
122
+ }
123
+
124
+ toCode() {
125
+ let objString = JSON.stringify(this.options, null, 4);
126
+ objString = objString.replace(/"(\w+)"(?=\s*:)/g, '$1');
127
+ return [`new FloatingInput().set(${objString})`];
128
+ }
129
+
130
+
131
+ margin(amount){
132
+ this.el.style.margin = amount;
133
+ return this;
134
+ }
135
+
136
+
137
+ /* responsive(){ HANDLED ABOVE
138
+ let query = window.matchMedia("(max-device-width: 415px)");
139
+
140
+ // window.matchMedia(query)
141
+ if (query.matches){
142
+ this.el.style.fontSize = "2rem";
143
+ }
144
+
145
+ return this;
146
+ } */
147
+
148
+
149
+
150
+
151
+ render(div){
152
+ if (div){
153
+ document.querySelector(div).appendChild(this.el);
154
+
155
+ } else {
156
+ return this.el;
157
+ }
158
+ }
159
+ }
160
+
161
+ // 31/01/25 22:06:50 works
162
+ window.FloatingInput = FloatingInput;
163
+ export { FloatingInput };
@@ -0,0 +1,161 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+ class Wrappera extends Base {
4
+ constructor(){
5
+ super();
6
+ this.state = {
7
+ time: '',
8
+ timeValid: false
9
+ };
10
+ document.querySelector("body").style.backgroundColor = "#c4cccf";
11
+ }
12
+
13
+ render() {
14
+ let rg = new RadioGroup()
15
+ .set({
16
+ items: ["Male", "Female", "Third shit"],
17
+ multiple: false,
18
+ font: "Arial"
19
+ })
20
+
21
+
22
+ let fp = new FilePickera()
23
+ .set({
24
+ id: "A",
25
+ title: "Add profile picture",
26
+ background: "#3498DB",
27
+ color: "white",
28
+ font: "Arial",
29
+ radius: "3rem"
30
+ })
31
+
32
+ let items = [["none", "select a car---"], ["tesla", "Tesla"], ["audi", "Audi"]];
33
+
34
+ let pc = new Picker()
35
+ .set({
36
+ items: items,
37
+ font: "Arial",
38
+ arrayPadding: ({sides: ["all"], value: "0.5rem"}),
39
+ rounded: true
40
+ })
41
+
42
+
43
+
44
+ let r = new Range().set({
45
+ min: 100,
46
+ max: 1000,
47
+ step: 10,
48
+ // plain: true,
49
+ width: "80%",
50
+ style: {
51
+ trackColor: "#1abc9c",
52
+ thumbColor: "#3498db"
53
+ },
54
+ arrayMargin: {sides: ["all"], value: "1rem"},
55
+ font: "Arial"
56
+ });
57
+
58
+
59
+ let dataList = DataList()
60
+ .set({
61
+ placeholder: "Test",
62
+ data:["Czech Republic", "Kongo", "Peru"],
63
+ arrayMargin: {sides: ["all"], value: "1rem"}
64
+ });
65
+
66
+
67
+ let timeInput = new TextField().set({
68
+ type: "text",
69
+ placeholder: "Enter swimming time",
70
+ arrayMargin: {sides: ["all"], value: "1rem"}
71
+ });
72
+
73
+ let floatTime = new FloatingInput()
74
+ .set({
75
+ title: "Your name",
76
+ type: "input"
77
+ });
78
+
79
+ return Center().items([
80
+
81
+ Text("Create an account")
82
+ .fluid("S1")
83
+ .font("Arial")
84
+ .color("#3498db"),
85
+
86
+ Text("Select your gender")
87
+ .fluid("S3")
88
+ .font("Arial"),
89
+
90
+ rg,
91
+ fp,
92
+
93
+ floatTime,
94
+
95
+ timeInput.onChange(current => {
96
+ const regex = /^[0-5]?\d:[0-5]\d$/;
97
+ let valid = regex.test(current);
98
+ timeInput.setValid(valid, current);
99
+ this.state.time = current;
100
+ this.state.timeValid = valid;
101
+ }),
102
+
103
+ dataList,
104
+ pc,
105
+ r,
106
+
107
+ new Button("Submit")
108
+ .set({
109
+ fluidc: "S6",
110
+ arrpad: {sides: ["all"], value: "1rem"},
111
+ arrayMargin: {sides: ["all"], value: "1rem"},
112
+ onTap: () => {
113
+
114
+
115
+
116
+ if (!fp.hasFile){
117
+ fp.highlight(); // highlights file picker
118
+ alert("No file");
119
+ }
120
+
121
+ if (this.state.timeValid === false){
122
+ alert("Time is innvalid.");
123
+ }
124
+
125
+
126
+ this.add({
127
+ a: this.state.time,
128
+ b: fp.file,
129
+ c: pc.el.options[pc.el.selectedIndex].value,
130
+ d: rg.getCheckedValues(),
131
+ e: r.value(),
132
+ g: dataList.getValue(),
133
+ h: floatTime.getValue()
134
+ });
135
+ },
136
+ color: "white",
137
+ background: "#3498db",
138
+
139
+ }),
140
+
141
+ new Text("By signing up, you agree with terms of use.")
142
+ ]);
143
+ }
144
+
145
+ add(data){
146
+ // perform sign up operations :D
147
+ console.clear();
148
+ console.log("Creating account with data:");
149
+ console.log(data.a);
150
+ console.log(data.b);
151
+ console.log(data.c);
152
+ console.log(data.d);
153
+ console.log(data.e);
154
+ console.log(data.g);
155
+ console.log(data.h);
156
+ }
157
+ }
158
+
159
+ new Wrappera().mount("#res");
160
+ window.Wrappera = Wrappera;
161
+ export { Wrappera };
@@ -0,0 +1,76 @@
1
+
2
+ import {Animator} from "../animator.js";
3
+
4
+ class Form {
5
+ constructor(action = "", method = "POST") {
6
+ this.action = action;
7
+ this.method = method;
8
+ this.elements = [];
9
+ this.formElement = document.createElement("form");
10
+ this.formElement.action = this.action;
11
+ this.formElement.method = this.method;
12
+ }
13
+
14
+ add(elements) {
15
+ this.elements = elements;
16
+ console.log("CODEA");
17
+ console.log(this.elements);
18
+ console.log(this.elements.length );
19
+
20
+ elements.forEach((element) => {
21
+ if (element && typeof element.render === "function") {
22
+ //this.elements.push(element);
23
+ this.formElement.appendChild(element.render());
24
+ } else {
25
+ throw new Error("Each element in the array must have a render method that returns an HTML DOM element.");
26
+ }
27
+ });
28
+
29
+ console.log(this.elements);
30
+
31
+ return this;
32
+ }
33
+
34
+ toCode(){
35
+
36
+ let mapped = this.elements.map(e => e.toCode());
37
+
38
+
39
+ let setCode = Object.entries(this.obj)
40
+ .map(([key, value]) => {
41
+ let formattedValue = typeof value === "string" ? `"${value}"` : value;
42
+ return `${key}: ${formattedValue}`;
43
+ })
44
+ .join(", ");
45
+
46
+ console.log("FORM DQ");
47
+ console.log(mapped);
48
+ return [`new Form().set({${setCode}}).add([ \n ${mapped.join(", \n")}])`];
49
+ }
50
+
51
+ set(obj) {
52
+ this.obj = obj;
53
+ obj.action && this.setAction(obj.action);
54
+ obj.method && this.setMethod(obj.method);
55
+ return this;
56
+ }
57
+
58
+ setAction(action) {
59
+ this.action = action;
60
+ this.formElement.action = this.action;
61
+ }
62
+
63
+ setMethod(method) {
64
+ this.method = method;
65
+ this.formElement.method = this.method;
66
+ }
67
+
68
+ render(el) {
69
+ if (el){
70
+ document.querySelector(el).appendChild(this.formElement);
71
+ }
72
+ return this.formElement;
73
+ }
74
+ }
75
+
76
+ export {Form};