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,516 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+ class Button extends Animator {
4
+ constructor(text, val){
5
+ super();
6
+ this.text = text;
7
+ this.res = null;
8
+ this.val = val;
9
+ this.setup();
10
+ }
11
+
12
+ setup(obj){
13
+ return this;
14
+ }
15
+
16
+
17
+
18
+
19
+ hover(obj){
20
+ this.prevColor = this.res.style.backgroundColor;
21
+ this.foreColor = this.res.style.color;
22
+
23
+ if (obj.animation){
24
+
25
+ this.res.style.transition = `${obj.animation}s ease-in-out`; // stop resize ???
26
+ this.res.style.transionProperty = `background, color`;
27
+ // this.transition(obj.animation);
28
+ }
29
+
30
+
31
+ this.res.onmouseout = () => {
32
+ this.res.style.backgroundColor = `${this.prevColor}`;
33
+ this.res.style.color = `${this.foreColor}`;
34
+ }
35
+
36
+ this.res.onmouseover = () => {
37
+ this.res.style.backgroundColor = obj.background;
38
+ this.res.style.color = obj.color;
39
+ }
40
+
41
+ return this;
42
+ }
43
+
44
+
45
+
46
+ set(obj){
47
+ this.options = obj;
48
+ let btn = document.createElement("button");
49
+ btn.style.background = "transparent";
50
+
51
+ if (obj.url){
52
+ let node = document.createElement("img");
53
+ node.setAttribute("src", obj.url);
54
+ node.style.width = obj.frame.width;
55
+ node.style.height = obj.frame.height;
56
+ btn.appendChild(node);
57
+ } else {
58
+ let node = document.createTextNode(this.text.replace("$", this.val));
59
+ btn.appendChild(node);
60
+ }
61
+
62
+
63
+ this.res = btn;
64
+
65
+ if (obj){
66
+
67
+
68
+ if (obj.type === "submit"){
69
+ btn.setAttribute("type", obj.type);
70
+ }
71
+ }
72
+
73
+
74
+ let stra = "";
75
+ this.border("none");
76
+
77
+ this.res.style.display = "block";
78
+
79
+ if (obj.background){
80
+ this.background(obj.background);
81
+ }
82
+
83
+ if (obj.padding){
84
+ this.padding(obj.padding);
85
+ }
86
+
87
+ if (obj.margin){
88
+ this.margin(obj.margin);
89
+ }
90
+
91
+ obj.mar && (this.mar(obj.mar));
92
+ obj.pad && (this.pad(obj.pad));
93
+
94
+ //this.pad([{"b": "3rem"}]); // add)
95
+
96
+
97
+ if (obj.centered){
98
+ // alert(this.res.width / 2);
99
+ this.res.style.marginRight = "auto";
100
+ this.res.style.marginLeft = "auto"; //`${this.res.style.width / 2}px`;
101
+
102
+ this.res.style.backgroundColor = "black";
103
+ }
104
+
105
+ if (obj.border){
106
+ this.border(obj.border);
107
+ }
108
+
109
+ if (obj.radius){
110
+ this.borderRadius(obj.radius);
111
+ }
112
+
113
+ if (obj.class){
114
+ this.setClass(obj.class);
115
+ }
116
+
117
+ if (obj.color){
118
+ this.color(obj.color);
119
+ }
120
+
121
+ if (obj.auto){
122
+ this.auto();
123
+ }
124
+
125
+
126
+ if (obj.weight){
127
+ this.res.style.fontWeight = obj.weight;
128
+ }
129
+
130
+ obj.fluidc && this.fluidButtonCopy(obj.fluidc);
131
+ obj.fluidc && (stra += `\n fluidc: "${obj.fluidc}",`); // 233559, correct collon 23:35:35 06/03
132
+
133
+ obj.onTap && (this.onTap(obj.onTap))//this.onTap(obj.onTap);
134
+
135
+
136
+ obj.frame && this.frame(obj.frame);
137
+ obj.frame && (stra += `\n frame: "${obj.frame}",`);
138
+
139
+ obj.arrpad && this.arrayPadding(obj.arrpad.sides, obj.arrpad.value);
140
+ obj.arrpad && (stra += `\n arrpad: {sides: ["${obj.arrpad.sides}"], value: "${obj.arrpad.value}"},`); // 2345 06/03
141
+
142
+ obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
143
+ obj.arrayMargin && (stra += `\n arrayMargin: {sides: ["${obj.arrayMargin.sides}"], value: "${obj.arrayMargin.value}"},`); // 2345 06/03
144
+
145
+ obj.keySet && this.keySet(obj.keySet); // 165411 22/01/25 Nice!
146
+ // Before S25 Ultra redesign!
147
+
148
+ /*.background("#1abc9c")
149
+ .padding("10px")
150
+ .margin("10px")
151
+ .border("none")
152
+ .borderRadius("7px")*/
153
+
154
+ return this;
155
+ }
156
+
157
+
158
+
159
+
160
+ arrayPadding(arr, value) {
161
+
162
+ if (arr.includes("left")){
163
+ this.res.style.paddingLeft = value;
164
+ }
165
+
166
+ // console.log("PAD");
167
+ // console.log(this.res.style.paddingLeft);
168
+ // console.log(arr);
169
+ // console.log(value);
170
+
171
+ if (arr.includes("right")){
172
+ this.res.style.paddingRight = value;
173
+ }
174
+
175
+ if (arr.includes("top")){
176
+ this.res.style.paddingTop = value;
177
+ }
178
+
179
+ if (arr.includes("bottom")){
180
+ this.res.style.paddingBottom = value;
181
+ }
182
+
183
+ if (arr.includes("all")){
184
+ this.res.style.padding = value;
185
+ }
186
+
187
+ if (!value){
188
+ this.res.style.paddingBottom = arr;
189
+ }
190
+
191
+
192
+ return this;
193
+ }
194
+
195
+ arrayMargin(arr, value) { // 224857 redefined earlier
196
+
197
+ if (!value){ // LTRB
198
+ this.res.style.marginLeft = `${arr[0]}px`;
199
+ this.res.style.marginTop = `${arr[1]}px`;
200
+ this.res.style.marginRight = `${arr[2]}px`;
201
+ this.res.style.marginBottom = `${arr[3]}px`;
202
+ }
203
+
204
+
205
+ if (value === "7rem"){
206
+ // The text does not react to margin changes
207
+ // alert(arr);
208
+ // alert(value);
209
+ }
210
+
211
+
212
+
213
+ // // console.log(arr);
214
+ if (arr.includes("left")){
215
+ this.res.style.marginLeft = value;
216
+ }
217
+
218
+ if (arr.includes("right")){
219
+ this.res.style.marginRight = value;
220
+ }
221
+
222
+ if (arr.includes("top")){
223
+ this.res.style.marginTop = value;
224
+ }
225
+
226
+ if (arr.includes("bottom")){
227
+ this.res.style.marginBottom = value;
228
+ }
229
+
230
+ if (arr.includes("all")){
231
+ this.res.style.margin = value;
232
+ }
233
+
234
+ if (!value){
235
+ this.res.style.marginBottom = arr;
236
+ }
237
+
238
+ return this;
239
+ }
240
+
241
+
242
+ fluidButtonCopy(name){
243
+
244
+ if (name instanceof Object){
245
+ this.prevStylex = this.res.style;
246
+ this.res = document.createElement("button");
247
+ this.res.style.cssText = this.prevStylex.cssText;
248
+ let node = document.createTextNode(this.text);
249
+ this.res.appendChild(node);
250
+ this.res.style.fontSize = name.exact;
251
+
252
+ // alert(name.exact);
253
+
254
+ return this;
255
+ }
256
+
257
+ const display1 = "calc(1.625rem + 5.075vw)";
258
+
259
+ if (name === "S1"){
260
+ this.prevStylex = this.res.style;
261
+ this.res = document.createElement("button");
262
+ this.res.style.cssText = this.prevStylex.cssText;
263
+ let node = document.createTextNode(this.text);
264
+ this.res.appendChild(node);
265
+ this.res.style.fontSize = display1;
266
+ }
267
+
268
+ const display2 = "calc(1.500rem + 4.3vw)";
269
+
270
+ if (name === "S2"){
271
+ this.prevStylex = this.res.style;
272
+ this.res = document.createElement("button");
273
+ this.res.style.cssText = this.prevStylex.cssText;
274
+ let node = document.createTextNode(this.text);
275
+ this.res.appendChild(node);
276
+ this.res.style.fontSize = display2;
277
+ }
278
+
279
+
280
+ const display3 = "calc(1.375rem + 3.525vw)";
281
+
282
+ if (name === "S3"){
283
+ this.prevStylex = this.res.style;
284
+ this.res = document.createElement("button");
285
+ this.res.style.cssText = this.prevStylex.cssText;
286
+ let node = document.createTextNode(this.text);
287
+ this.res.appendChild(node);
288
+ this.res.style.fontSize = display3;
289
+ }
290
+
291
+ const display4 = "calc(1.250rem + 2.75vw)";
292
+
293
+ if (name === "S4"){
294
+ this.prevStylex = this.res.style;
295
+ this.res = document.createElement("button");
296
+ this.res.style.cssText = this.prevStylex.cssText;
297
+ let node = document.createTextNode(this.text);
298
+ this.res.appendChild(node);
299
+ this.res.style.fontSize = display4;
300
+ }
301
+
302
+ const display5 = "calc(1.125rem + 1.975vw)";
303
+
304
+ if (name === "S5"){
305
+ this.prevStylex = this.res.style;
306
+ this.res = document.createElement("button");
307
+ this.res.style.cssText = this.prevStylex.cssText;
308
+ let node = document.createTextNode(this.text);
309
+ this.res.appendChild(node);
310
+ this.res.style.fontSize = display5;
311
+ }
312
+
313
+
314
+
315
+ const display6 = "calc(1rem + 0.5vw)"; // calc(1rem + 1.2vw)
316
+
317
+ if (name === "S6"){
318
+ this.res.style.fontSize = display6;
319
+ }
320
+
321
+ return this;
322
+ }
323
+
324
+
325
+ setClass(classa){
326
+ this.res.setAttribute("class", classa);
327
+ return this;
328
+ }
329
+
330
+ color(color){
331
+ this.res.style.color = color;
332
+ return this;
333
+ }
334
+
335
+ background(color){
336
+ this.res.style.background = color;
337
+ return this;
338
+ }
339
+
340
+ width(percentage){
341
+ this.res.style.width = percentage;
342
+ return this;
343
+ }
344
+
345
+
346
+ borderRadius(radius){
347
+ this.res.style.borderRadius = radius;
348
+ // console.warn(this.res);
349
+ return this;
350
+ }
351
+
352
+ padding(L, T, R, B){
353
+ if (L && T && R && B){
354
+ this.res.style.paddingLeft = L;
355
+ this.res.style.paddingTop = T;
356
+ this.res.style.paddingRight = R;
357
+ this.res.style.paddingBottom = B;
358
+ } else {
359
+ this.res.style.padding = L;
360
+ }
361
+
362
+ return this;
363
+ }
364
+
365
+ margin(L, T, R, B){
366
+
367
+ if (L && T && R && B){
368
+ this.res.style.marginLeft = L;
369
+ this.res.style.marginTop = T;
370
+ this.res.style.marginRight = R;
371
+ this.res.style.marginBottom = B;
372
+ } else {
373
+ this.res.style.margin = L;
374
+ }
375
+
376
+ return this;
377
+ }
378
+
379
+ auto() {
380
+ const adj = () => {
381
+ let query = window.matchMedia("(max-device-width: 415px)");
382
+ if (query.matches) {
383
+ this.res.style.fontSize = '2.2rem';
384
+ } else {
385
+ this.res.style.fontSize = '1rem';
386
+ }
387
+ }
388
+
389
+ adj();
390
+ window.addEventListener("resize", adj);
391
+ return this;
392
+ }
393
+
394
+
395
+ large() {
396
+ const adj = () => {
397
+ let query = window.matchMedia("(max-device-width: 415px)");
398
+ if (query.matches) {
399
+ alert("WOW")
400
+ this.res.style.fontSize = '6rem';
401
+ } else {
402
+ this.res.style.fontSize = '3rem';
403
+ }
404
+ }
405
+
406
+ adj();
407
+ window.addEventListener("resize", adj);
408
+ return this;
409
+ }
410
+
411
+
412
+
413
+ border(color, w){
414
+
415
+ if (color === "none"){
416
+ this.res.style.border = "none";
417
+ }
418
+
419
+
420
+ this.res.style.border = `${color} solid ${w}px`;
421
+ return this;
422
+ }
423
+
424
+ frame(obj){
425
+ this.res.style.width = obj.width;
426
+ this.res.style.height = obj.height;
427
+ return this;
428
+ }
429
+
430
+ updating(obj, key){
431
+
432
+ var copy = this.res;
433
+ var txt = this.text;
434
+
435
+ Object.defineProperty(obj, key, {
436
+ set(newVal){
437
+ // 22:01 - Reactivness
438
+ let node = document.createTextNode(txt.replace("$", newVal))
439
+ copy.replaceChild(node, copy.childNodes[0]);
440
+ }
441
+ });
442
+
443
+ return this;
444
+ }
445
+
446
+ onTap(e){
447
+ this.res.addEventListener("click", e);
448
+ return this;
449
+ }
450
+
451
+ toCode() {
452
+ //console.log("OPTIONS ARE");
453
+ //console.log(this.options);
454
+
455
+ // const objString = JSON.stringify(this.options, null, 4);
456
+
457
+ const objString = JSON.stringify(this.options, (key, value) => {
458
+ if (typeof value === "function") {
459
+ return value.toString(); // Convert functions to their string representation
460
+ }
461
+ return value;
462
+ }, 4);
463
+
464
+ const formattedString = objString
465
+ .replace(/"(\w+)":/g, '$1:') // Remove quotes from keys
466
+ .replace(/"(\(\)\s*=>\s*{[^}]*})"/gs, '$1') // Handle arrow functions correctly
467
+ .replace(/\\n/g, '') // Remove escaped newlines
468
+ .replace(/\\"/g, '"'); // Remove escaped quotes within the function
469
+
470
+ return [`new Button("${this.text}").set(${formattedString})`];
471
+
472
+ // 22/01/25 09:10:50 thanks for amazing RegEx ChatGPT!
473
+ }
474
+
475
+ /* toCoder() {
476
+ // Initialize the code string with the constructor
477
+ let code = `new Button("${this.text}", ${this.val})`;
478
+
479
+ // Collect the styles applied to the button
480
+ const style = this.res.style;
481
+ const setArgs = {};
482
+ if (style.background) setArgs.background = style.background;
483
+ if (style.color) setArgs.color = style.color;
484
+ if (style.padding) setArgs.padding = style.padding;
485
+ if (style.margin) setArgs.margin = style.margin;
486
+ if (style.border) setArgs.border = style.border;
487
+ if (style.borderRadius) setArgs.radius = style.borderRadius;
488
+ if (style.fontWeight) setArgs.weight = style.fontWeight;
489
+
490
+ // Add `set` call if any style properties exist
491
+ if (Object.keys(setArgs).length > 0) {
492
+ code += `.set(${JSON.stringify(setArgs)})`;
493
+ }
494
+
495
+ // Add event listeners if they exist
496
+ if (this.res.onclick) {
497
+ code += `.onTap(${this.res.onclick.toString()})`;
498
+ }
499
+
500
+ // Add rendering call
501
+ //code += `.render()`;
502
+
503
+ return [code];
504
+ }*/
505
+
506
+ render(el){
507
+ if (el){
508
+ document.querySelector(el).appendChild(this.res);
509
+ } else {
510
+ return this.res;
511
+ }
512
+ }
513
+ }
514
+
515
+
516
+ export { Button };
@@ -0,0 +1,136 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+
4
+ class Card {
5
+ constructor(text, url) {
6
+ this.text = text;
7
+ this.url = url;
8
+ this.setup();
9
+ }
10
+
11
+ setup() {
12
+ let query = window.matchMedia("(max-device-width: 415px)");
13
+ let card = document.createElement("div");
14
+ card.style.display = "flex";
15
+ card.style.flexDirection = "column";
16
+ card.style.backgroundColor = "#fff";
17
+ card.style.fontFamily = "Arial";
18
+ card.style.width = "100%"; // NOT THE CUPLRIT
19
+ // IMAGE NOT THE CUPLRIT
20
+ // NORMATEC IS
21
+ this.el = card;
22
+ return this;
23
+ }
24
+
25
+ background(color){
26
+ this.el.style.backgroundColor = color;
27
+ return this;
28
+ }
29
+
30
+ color(color){
31
+ this.el.style.color = color;
32
+ return this;
33
+ }
34
+
35
+ title(text){
36
+ let query = window.matchMedia("(max-device-width: 415px)");
37
+ let title = document.createElement("h2");
38
+ title.style.padding = "0.33em";
39
+ if (query.matches){
40
+ title.style.fontSize = "3em";
41
+ }
42
+
43
+ let node = document.createTextNode(text);
44
+ title.appendChild(node);
45
+
46
+ this.el.appendChild(title);
47
+ return this;
48
+ }
49
+
50
+ content(text, h){
51
+ let query = window.matchMedia("(max-device-width: 415px)");
52
+ let subtitle = document.createElement("p");
53
+ subtitle.style.padding = "0.33em";
54
+
55
+ if (query.matches){
56
+ subtitle.style.fontSize = "1.8em";
57
+ }
58
+
59
+ let snode = document.createTextNode(text);
60
+ subtitle.appendChild(snode);
61
+ subtitle.style.flex = 1;
62
+ this.el.appendChild(subtitle);
63
+ return this;
64
+ }
65
+
66
+ image(url, value, direction){
67
+ let query = window.matchMedia("(max-device-width: 415px)");
68
+ let back = document.createElement("div");
69
+ back.style.backgroundColor = "#ecf0f1";
70
+ back.style.width = "100%";
71
+ back.style.height = "200";
72
+
73
+ if (query.matches){
74
+ back.style.height = "500";
75
+ }
76
+
77
+ back.style.backgroundImage = `url(${url})`;
78
+ back.style.backgroundPosition = "center center";
79
+ back.style.backgroundSize = "cover";
80
+ back.style.borderTopLeftRadius = `${value}px`;
81
+ back.style.borderTopRightRadius = `${value}px`;
82
+
83
+ this.el.appendChild(back);
84
+ return this;
85
+ }
86
+
87
+
88
+ button(text, target){
89
+ let query = window.matchMedia("(max-device-width: 415px)");
90
+
91
+ let a = document.createElement("a");
92
+ a.setAttribute("href", target);
93
+ let node = document.createTextNode(text);
94
+ a.appendChild(node);
95
+ a.style.backgroundColor = "#3498db";
96
+ a.style.color = "white ";
97
+ a.style.textDecoration = "none";
98
+ a.style.padding = "1em";
99
+ a.style.margin = "1em"
100
+ a.style.borderRadius = "0.5em";
101
+
102
+ if (query.matches){
103
+ a.style.fontSize = "2.3em";
104
+ }
105
+
106
+ let flex = document.createElement("div");
107
+ flex.style.display = "flex";
108
+ flex.style.width = "100%";
109
+ flex.style.height = "auto";
110
+ flex.style.justifyContent = "center";
111
+ flex.appendChild(a);
112
+ this.el.appendChild(flex);
113
+ return this;
114
+ }
115
+
116
+ shadow(){
117
+ this.el.style.boxShadow = "1px 1px 20px rgba(0, 0, 0, 0.20)";
118
+ return this;
119
+ }
120
+
121
+
122
+ round(value){
123
+ this.el.style.borderRadius = `${value}px`;
124
+ return this;
125
+ }
126
+
127
+ render(div){
128
+ if (div){
129
+ document.querySelector(div).appendChild(this.el);
130
+ } else {
131
+
132
+ return this.el;
133
+ }
134
+ }
135
+ }
136
+ export { Card };