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,925 @@
1
+ import {Animator} from "./animator.js";
2
+ // import {CustomDivRenderer} from "./navFactor/customDiv.js";
3
+ // CORRECT
4
+ // const { TIS620_THAI_CI } = require("mysql/lib/protocol/constants/charsets");
5
+ class CustomDivRenderer {
6
+ constructor(obj, items) {
7
+ this.obj = obj || {};
8
+ this.items = items || [];
9
+ }
10
+
11
+ render() {
12
+ // Create inner div with flex display
13
+ let tempDiv = document.createElement("div");
14
+ tempDiv.style.display = "flex";
15
+ tempDiv.style.width = "100%";
16
+ tempDiv.style.justifyContent = "space-around";
17
+ tempDiv.setAttribute("id", "innerItemsWrapper");
18
+
19
+ let mobileMedia = window.matchMedia(`(max-device-width: 415px)`);
20
+ let media = window.matchMedia(`(max-width: 600px)`);
21
+
22
+ if (mobileMedia.matches || media.matches){
23
+ tempDiv.style.marginTop = "3rem";
24
+ }
25
+
26
+ // console.log("ITEMS ARE ORDERED");
27
+ // console.log(this.items);
28
+
29
+ // Append rendered items to inner div
30
+ for (let i = 0; i < this.items.length; i++) {
31
+ const item = this.items[i];
32
+ // alert("KOJO")
33
+ tempDiv.appendChild(item.render());
34
+ }
35
+
36
+ // Create outer div and apply styling based on obj properties
37
+ let outerDiv = document.createElement("div");
38
+ outerDiv.style.width = this.obj.isSide ? "333px" : "100%";
39
+ outerDiv.style.background = this.obj.background || "white";
40
+ outerDiv.style.display = "flex";
41
+ outerDiv.style.justifyContent = "center";
42
+ outerDiv.style.alignItems = "center";
43
+ outerDiv.style.height = "100%";
44
+ outerDiv.setAttribute("id", "outerItemsWrapper");
45
+ outerDiv.appendChild(tempDiv);
46
+
47
+ // Apply custom styles if specified in obj
48
+ if (this.obj.customStyle) {
49
+ tempDiv.style.width = "auto";
50
+ tempDiv.style.top = "0rem";
51
+ tempDiv.style.borderRadius = "1rem";
52
+ tempDiv.style.background = this.obj.background || "white";
53
+ tempDiv.style.margin = "1rem";
54
+ tempDiv.style.position = "absolute";
55
+ tempDiv.style.opacity = 0.8;
56
+ }
57
+
58
+ return outerDiv;
59
+ }
60
+ }
61
+
62
+ //window.CustomDivRenderer = CustomDivRenderer;
63
+ //export { CustomDivRenderer };
64
+
65
+
66
+ class UINavBar extends Animator {
67
+ constructor(els) {
68
+ super();
69
+ this.titleText = "";
70
+ this.hasHamburger = false;
71
+ this.code = [];
72
+ this.attributes = {};
73
+ }
74
+
75
+ toCode(){
76
+ let codeStr = `new UINavBar()`;
77
+ // 16:01:09 09/11/24 What????
78
+ // Convert attributes to .set({...}) format if there are any attributes
79
+ if (Object.keys(this.attributes).length > 0) {
80
+ codeStr += `.setup(${JSON.stringify(this.attributes, null, 2).replace(/"([^"]+)":/g, '$1:')})`;
81
+
82
+ // codeStr += `.set(${JSON.stringify(this.attributes, null, 2)})`;
83
+ } else {
84
+ codeStr += `.setup({})`;
85
+ }
86
+
87
+ codeStr += `.items([\n`;
88
+
89
+ // Generate the code for each item and join with commas only between items
90
+ codeStr += this.items
91
+ .map(item => item.toCode().join("").trim()) // Trim any line breaks or whitespace around the item code
92
+ .join(",\n"); // Insert commas only between items
93
+
94
+ codeStr += `\n])`;
95
+
96
+ return codeStr;
97
+
98
+ }
99
+
100
+ styled(obj) {
101
+ this.setup(obj);
102
+ this.styles = obj;
103
+ return this;
104
+ }
105
+
106
+ setup(obj) {
107
+ this.obj = obj;
108
+ if (!this.obj.isSide) { // fuck that, not even Ing. can solve this
109
+ this.obj.animate = false;
110
+ }
111
+
112
+ this.attributes = obj;
113
+ let wrap = document.createElement("div");
114
+ wrap.setAttribute("id", "sars");
115
+ wrap.style.padding = 0;
116
+ wrap.style.margin = 0;
117
+
118
+ let el = document.createElement("div");
119
+ el.setAttribute("id", "covid");
120
+ el.style.position = "absolute"; // KEEP THIS ?? 07/01/2025
121
+ el.style.width = "100%";
122
+ el.style.zIndex = 1;
123
+ el.style.alignItems = "flex-start";
124
+ // LINE 700 FINAL STYLING !!!
125
+
126
+
127
+
128
+ let back = document.createElement("div");
129
+ back.style.background = "green";
130
+ back.style.position = "absolute";
131
+
132
+ el.style.margin = "20px";
133
+ el.style.display = "flex";
134
+ el.style.alignItems = "flex-end";
135
+ el.style.margin = 0;
136
+ el.style.padding = 0;
137
+ el.style.margin = 0;
138
+
139
+ wrap.appendChild(el);
140
+
141
+
142
+ this.addCloseButton = false;
143
+ this.res = wrap;
144
+ // console.log(this.res);
145
+
146
+
147
+ if (obj.background) {
148
+ this.background({
149
+ color: obj.background
150
+ });
151
+ }
152
+
153
+
154
+ if (obj.openColor){
155
+ this.openColor = obj.openColor;
156
+ }
157
+
158
+
159
+ if (obj.sticky) {
160
+ this.sticky();
161
+ }
162
+
163
+ if (obj.pad){
164
+ this.pad(obj.pad);
165
+ }
166
+
167
+
168
+ if (obj.hamburgerColour) {
169
+ this.hamburgerColour = obj.hamburgerColour;
170
+ }
171
+
172
+ if (obj.mobileSize) {
173
+ this.mobileSize = obj.mobileSize;
174
+ }
175
+
176
+ if (obj.desktopSize) {
177
+ this.desktopSize = obj.desktopSize;
178
+ }
179
+
180
+ if (obj.height) {
181
+ this.res.children[0].style.height = obj.height;
182
+ }
183
+
184
+ return this;
185
+ }
186
+
187
+
188
+ items(items) {
189
+
190
+ this.items = items;
191
+ // alert(this.items);
192
+ let starts = ["Link", "Image", "Spacer", "Dropdown"].some(e => {
193
+ return items[0].__proto__
194
+ .constructor
195
+ .toString()
196
+ .startsWith(`class ${e}`);
197
+ });
198
+
199
+ // console.log(starts);
200
+ //alert("NEXT");
201
+ //alert(this.items);
202
+ console.log(this.items);
203
+ // alert(starts); //THIS SHOULD BE TRUE;
204
+
205
+ if (true) { // We are adding class instances to the Area
206
+
207
+ this.itemCount = items.length; // 675 lines was
208
+ let rend = new CustomDivRenderer(this.obj, this.items);
209
+ let outerDiv = rend.render();
210
+
211
+ this.res.children[0].appendChild(outerDiv);
212
+
213
+
214
+
215
+ let child = this.res.children[0].children[0].children[0];
216
+ // console.log("AHELLO");
217
+ // console.log(child);
218
+ // console.log(child.children);
219
+
220
+
221
+ // dont solve range object
222
+ // console.log("ANIMATION OBJECT ");
223
+
224
+ // Read initial state from this
225
+
226
+
227
+ let animationObj = this.items[0].options;
228
+
229
+
230
+ if (animationObj && animationObj.animation){
231
+
232
+
233
+ let animation = animationObj.animation.op;
234
+ // console.log(animation);
235
+
236
+
237
+
238
+ if (animation){
239
+
240
+
241
+ let mobileMedia = window.matchMedia(`(max-device-width: 415px)`);
242
+
243
+ let smallScreen = window.matchMedia(`(max-width: 600px)`);
244
+
245
+ if (!mobileMedia.matches && !smallScreen.matches){
246
+
247
+
248
+ for (var i = 0; i < child.children.length; i++){
249
+ //child.children[i].style.border = "1px solid purple";
250
+
251
+ // 1 - SET HIDDEN STATE BY IMMEDIATELLY FIRING ANIM
252
+ // set hidden state immediatelly on the mobile
253
+ let immediateAll = {
254
+ duration: 1, // 1 should be acceptable here when I close
255
+ fill: 'forwards',
256
+ delay: 1
257
+ }
258
+
259
+ child.children[i].animate(animation.keyframesClose, immediateAll);
260
+
261
+ // 2 - ANIMATE INTO THE VIEW
262
+ // animate using opening keyframes on the mobile when user click the button
263
+ // when mobile nav is in opended state an I click button to set it to closing state
264
+ // animate "#innerItemsWrapper" children using closing options
265
+ child.children[i].animate(animation.keyframesOpen, animation.openOptions);
266
+
267
+
268
+
269
+
270
+ }
271
+ } else { // We are in animated state on mobile
272
+ let immediateAll = {
273
+ duration: 1, // 1 should be acceptable here when I close
274
+ fill: 'forwards',
275
+ delay: 1
276
+ }
277
+
278
+ //console.log("CHILDREN");
279
+ //console.log(child);
280
+ //console.log(child.children);
281
+
282
+ for (var i = 0; i < child.children.length; i++){
283
+ child.children[i].animate(animation.keyframesClose, immediateAll);
284
+ }
285
+
286
+ }
287
+
288
+ }
289
+
290
+ }
291
+
292
+ this.adjust();
293
+ }
294
+
295
+ if (!starts) { // User is lazy
296
+
297
+ this.itemCount = items.length;
298
+
299
+ let div = document.createElement("div");
300
+ div.style.backgroundColor = "orange";
301
+
302
+ for (var i = 0; i < items.length; i++) {
303
+ let item = items[i];
304
+
305
+
306
+ if (item.logo) {
307
+ let logo = new Image(item.logo).width("100px");
308
+ let spacer = document.createElement("div");
309
+ spacer.style.flex = "1";
310
+ spacer.style.height = 23;
311
+
312
+ let wr = document.createElement("div");
313
+ wr.setAttribute("id", "WR")
314
+ wr.style.display = "flex";
315
+ wr.style.flexDirection = "row";
316
+ wr.appendChild(logo.render());
317
+ this.res.children[0].appendChild(logo.render());
318
+
319
+
320
+
321
+ // throws it
322
+
323
+ if (this.obj.spacing) {
324
+ this.res.children[0].appendChild(spacer);
325
+ }
326
+ }
327
+
328
+
329
+ if (item.logo) {
330
+ this.allowPad = true;
331
+ }
332
+
333
+ if (item.logo && this.obj.spacing) {
334
+ this.res.children[0].children[0].style.marginLeft = this.obj.spacing.sides;
335
+ this.res.children[0].children[0].style.marginRight = this.obj.spacing.sides;
336
+ }
337
+
338
+
339
+ if (item.title) {
340
+
341
+ let link;
342
+ if (this.allowPad) {
343
+ if (item.type) {
344
+ link = new Dropdown(item.items, item.title)
345
+ } else {
346
+ link = new Link(item.title, item.url)
347
+ .arrayPadding(["left", "right"], "1em");
348
+ }
349
+
350
+ } else {
351
+
352
+ if (item.type) {
353
+ link = new Link("DRPA", item.url);
354
+ } else {
355
+ link = new Link(item.title, item.url);
356
+ }
357
+
358
+ }
359
+
360
+ div.appendChild(link.render());
361
+ }
362
+
363
+ }
364
+
365
+ this.res.children[0].appendChild(div);
366
+ this.adjust();
367
+ }
368
+
369
+
370
+
371
+
372
+ // Insert hamburger button at the correct place
373
+ var btn = this.addHamburger();
374
+
375
+ let newCount = this.itemCount;
376
+ if (this.obj.spacing) {
377
+ newCount += 1;
378
+ }
379
+
380
+ btn.style.zIndex = 1;
381
+
382
+ if (this.res.children[0].children.length === 1) { // Problem here
383
+ this.res.children[0].insertBefore(btn, this.res.children[0].firstChild);
384
+ }
385
+
386
+ return this;
387
+ }
388
+
389
+ instance() {
390
+ return this.res.children[0];
391
+ }
392
+
393
+ sticky() {
394
+ this.res.children[0].style.position = "fixed";
395
+ return this;
396
+ }
397
+
398
+ font(family) {
399
+
400
+ for (var i = 0; i < this.res.children[0].children; i++) {
401
+ this.res.children[0].children[i].style.fontFamily = family;
402
+ }
403
+
404
+ return this;
405
+ }
406
+
407
+
408
+
409
+ openSymbol(symbol) {
410
+ this.symbol = symbol;
411
+ return this;
412
+ }
413
+
414
+
415
+ background(obj) {
416
+
417
+ if (!obj.background){
418
+ this.res.children[0].style.backgroundColor = "transparent";
419
+ return this;
420
+ }
421
+
422
+ this.res.children[0].style.backgroundColor = obj.color;
423
+ this.res.children[0].style.opacity = obj.opacity;
424
+ return this;
425
+ }
426
+
427
+ transluescent() {
428
+ this.res.children[0].style.backgroundColor = "rgba(255,255,255,0.72)";
429
+ return this;
430
+ }
431
+
432
+
433
+ keepItem(item) {
434
+ // console.log("Wow");
435
+ this.keepItem = item;
436
+ return this;
437
+ }
438
+
439
+ addHamburger = () => {
440
+
441
+
442
+
443
+ let media2 = window.matchMedia(`(max-device-width: 415px)`);
444
+
445
+ var btn = document.createElement("button");
446
+ btn.setAttribute("id", "hamburger");
447
+ btn.style.border = "none";
448
+ btn.style.fontWeight = "bold";
449
+ btn.style.position = "absolute"; // NEW
450
+ btn.style.color = "orange";//this.obj.hamColour.opened; //this.hamburgerColour ?? "#3498db";
451
+ btn.style.backgroundColor = "transparent";
452
+ btn.style.fontSize = media2.matches ? "2.1em" : "2em";
453
+
454
+ var node = document.createTextNode(this.symbol ? this.symbol : "☰");
455
+ btn.appendChild(node);
456
+ btn.style.marginLeft = "auto";
457
+
458
+ this.isShown = false;
459
+
460
+ btn.addEventListener("click", () => {
461
+
462
+
463
+ this.isShown = !this.isShown;
464
+
465
+ this.hasAnimatedToWide = false;
466
+
467
+ // alert("Hello");
468
+ // alert(this.res.children[0].children[1].children[0].getAttribute("id"));
469
+
470
+ // zmenším, otevřu, roztáhnu, zmenším => musím klinout 2x
471
+ // zmenším => kliknu => animace se rozjede 2x
472
+
473
+ // mám rotažené => zmenším, a při otevření se mi animace rozjede 2x
474
+
475
+ // When onResize < 400px the nav must disappear
476
+
477
+
478
+ let animationObj = this.items[0].options;
479
+
480
+
481
+ if (animationObj && animationObj.animation){
482
+
483
+
484
+ let animation = animationObj.animation.op;
485
+ // console.log(animation);
486
+
487
+
488
+
489
+
490
+
491
+ const innerItemsWrapper = this.res.children[0].children[1].children[0];
492
+
493
+ if (animation){
494
+
495
+
496
+
497
+ // console.log("Why not showing on 600px????");
498
+ // console.log(this.isShown);
499
+
500
+ if (this.isShown){
501
+
502
+
503
+
504
+
505
+
506
+ for (var i = 0; i < innerItemsWrapper.children.length; i++){
507
+ let inner = innerItemsWrapper.children[i];
508
+ let anima = inner.animate(animation.keyframesClose, {
509
+ duration: 1, // 1 should be acceptable here when I close
510
+ fill: 'forwards',
511
+ delay: 0
512
+ });
513
+
514
+
515
+ // 9:16:04 Nice! 21/11/24
516
+ anima.onfinish = () => {
517
+ innerItemsWrapper.parentElement.style.display = "block";
518
+ }
519
+ }
520
+
521
+
522
+ /* window.setTimeout(() => {
523
+ innerItemsWrapper.parentElement.style.display = "block";
524
+ }, 50);*/
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+ } else { // culprit??? not 565 533
533
+ innerItemsWrapper.parentElement.style.display = "none";
534
+ }
535
+
536
+ for (var i = 0; i < innerItemsWrapper.children.length; i++){
537
+ let inner = innerItemsWrapper.children[i];
538
+
539
+
540
+
541
+ inner.animate(animation.keyframesClose, {
542
+ duration: 1, // 1 should be acceptable here when I close
543
+ fill: 'forwards',
544
+ delay: 0
545
+ });
546
+
547
+
548
+ if (this.isShown){
549
+
550
+ // if (inner.style.translateX != 0)
551
+ inner.animate(animation.keyframesOpen, animation.openOptions);
552
+ } else {
553
+ inner.animate(animation.keyframesClose, animation.closeOptions);
554
+ }
555
+ }
556
+
557
+
558
+
559
+ }
560
+
561
+ } else {
562
+ if (this.isShown){
563
+ innerItemsWrapper.parentElement.style.display = "block";
564
+ } else {
565
+ innerItemsWrapper.parentElement.style.display = "none";
566
+ }
567
+ }
568
+
569
+
570
+ // Hide outerItemsWrapper or animate links
571
+ })
572
+
573
+ // let hamb = document.querySelector("#hamburger");
574
+ // alert(this.res.children[0].children[0].getAttribute("id"));
575
+
576
+ return btn;
577
+ }
578
+
579
+ /*--------------------------------------------------ADJUST--------------------------------------------------*/
580
+ // set habmurger icon
581
+ adjust(w) {
582
+ let media = window.matchMedia(`(max-width: 600px)`);
583
+ let media2 = window.matchMedia(`(max-device-width: 415px)`);
584
+
585
+ const adjustFontSize = () => {
586
+ //console.log("IN VIEWPORT");
587
+
588
+ // console.log(this.res);
589
+ for (var i = 0; i < this.res.children[0].children.length; i++) {
590
+ let el = this.res.children[0].children[i];
591
+ el.style.fontSize = media2.matches ? (this.mobileSize ? this.mobileSize : "1.2em") : (this.desktopSize ? this.desktopSize : "1em");
592
+
593
+
594
+ if (el.textContent === "☰") {
595
+ el.style.fontSize = "2em";
596
+ }
597
+ }
598
+
599
+
600
+ }
601
+
602
+
603
+ const findNestedDivWithId = (elements, targetId) => {
604
+ for (var i = 0; i < elements.length; i++) {
605
+ var element = elements[i];
606
+
607
+ if (element.id === targetId) {
608
+ return element; // Found the target div
609
+ }
610
+
611
+ // Check nested children recursively
612
+ var foundInChildren = findNestedDivWithId(element.children, targetId);
613
+ if (foundInChildren) {
614
+ return foundInChildren;
615
+ }
616
+ }
617
+ return null; // If not found
618
+ }
619
+
620
+ const toWideScreen = () => {
621
+
622
+
623
+ let my = this.res.children[0];
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+ for (var i = 0; i < this.res.children[0].children.length; i++) {
645
+
646
+ let child = this.res.children[0].children[i];
647
+
648
+ child.style.marginTop = "0em";
649
+
650
+ if (child.id === "WR") {
651
+ child.style.display = "flex";
652
+ } else {
653
+ child.style.display = "flex";
654
+ }
655
+
656
+ if (child.textContent === this.titleText && this.titleText.length > 0) {
657
+ // alert(child.textContent)
658
+ child.style.fontSize = "2em";
659
+ }
660
+ }
661
+
662
+
663
+
664
+
665
+ // animate back
666
+
667
+ let animationObj = this.items[0].options;
668
+
669
+
670
+ if (animationObj && animationObj.animation){
671
+
672
+
673
+ let animation = animationObj.animation.op;
674
+ // console.log(animation);
675
+
676
+
677
+
678
+
679
+
680
+ const covid = this.res.children[0];
681
+ const innerItemsWrapper = covid.children[1].children[0];
682
+ //findNestedDivWithId(this.res.children, 'innerItemsWrapper');
683
+ ///covid.children[0].children[1].children[0];
684
+
685
+ // console.log("KINNERA");
686
+ // console.log(innerItemsWrapper);
687
+
688
+ // console.log("COVID");
689
+ // console.log(covid);
690
+ // innerItemsWrapper.style.border = "3px solid orange";
691
+ innerItemsWrapper.style.marginTop = "0";
692
+
693
+ if (animation){
694
+ // console.log("Why not showing on 600px????")
695
+ // console.log("TOWIDE");
696
+
697
+
698
+ // console.log(covid);
699
+ // console.log(covid.children[1].children[0]);
700
+
701
+ // alert("OIJHIOHO")
702
+
703
+ // close the nav an expand bad
704
+
705
+ if (!this.hasAnimatedToWide){
706
+ this.hasAnimatedToWide = true;
707
+
708
+ for (var i = 0; i < innerItemsWrapper.children.length; i++){
709
+
710
+ let link = innerItemsWrapper.children[i];
711
+
712
+
713
+
714
+
715
+ link.animate(animation.keyframesOpen, animation.openOptions);
716
+
717
+ }
718
+ }
719
+
720
+
721
+ }
722
+
723
+
724
+ } else {
725
+ // alert("/");
726
+ console.log(this.res);
727
+ // const innerItemsWrapper = this.res.children[0].children[0].children[0];//findNestedDivWithId(this.res.children, 'innerItemsWrapper');
728
+ // innerItemsWrapper.style.marginTop = "0";
729
+ // const innerItemsWrapper = findNestedDivWithId(this.res.children, 'innerItemsWrapper');
730
+ // innerItemsWrapper.style.marginTop = "0";
731
+ }
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+ }
755
+
756
+ // nice library!
757
+ const doInAdjust = () => {
758
+
759
+ this.isShown = false;
760
+
761
+
762
+ let my = this.res.children[0];
763
+
764
+
765
+ adjustFontSize();
766
+ var closed = false;
767
+
768
+
769
+ this.res.children[0].style.flexDirection = "column";
770
+
771
+ for (var i = 0; i < this.res.children[0].children.length; i++) {
772
+ if (this.res.children[0].children[i].textContent == "☰" || this.res.children[0].children[i].textContent == /*"Lands"*/ this.keepItem) {
773
+
774
+
775
+ let child = this.res.children[0].children[i];
776
+ if (child.id === "WR") {
777
+ this.res.children[0].children[i].style.display = "flex";
778
+ } else {
779
+ this.res.children[0].children[i].style.display = "flex";
780
+ }
781
+
782
+
783
+
784
+ } else {
785
+ this.res.children[0].children[i].style.display = "none";
786
+ }
787
+ }
788
+ }
789
+
790
+ const adjust = () => {
791
+ if (!this.obj.isSide) {
792
+ if (media.matches || media2.matches) {
793
+
794
+
795
+
796
+ doInAdjust();
797
+
798
+ } else {
799
+ toWideScreen();
800
+ }
801
+ }
802
+
803
+
804
+ }
805
+
806
+
807
+ if (!this.obj.isSide) {
808
+
809
+ let inner = this.res.children[1]; //document.querySelector("#outerItemsWrapper")
810
+ if (inner != null) {
811
+ inner.style.background = "yellow";
812
+ }
813
+
814
+ if (media.matches || media2.matches) {
815
+ doInAdjust();
816
+ //alert("P")
817
+ //this.res.children[0].style.opacity = 0.3;
818
+ // console.log("884A");
819
+ // console.warn(this.res);
820
+ // console.log(this.res.children[0].children[0]);
821
+ } else {
822
+ toWideScreen();
823
+ }
824
+ } else {
825
+ doInAdjust();
826
+ }
827
+
828
+
829
+ // was double anim once we commented this out
830
+ // this.hasAnimatedToWide = false;
831
+ // window.addEventListener("resize", adjust);
832
+ return this;
833
+ }
834
+
835
+ /*--------------------------------------------------ADJUST--------------------------------------------------*/
836
+ render(div) {
837
+
838
+
839
+ const method = () => {
840
+ let media = window.matchMedia(`(max-width: 600px)`);
841
+
842
+ // This gets owervwritten, column fires
843
+
844
+ let myMedia = window.matchMedia(`(max-device-width: 415px)`);
845
+ let outerItemsWrapper = this.res.children[0].children[1];
846
+ let innerIW = outerItemsWrapper.children[0];
847
+
848
+ // console.log("TEETH");
849
+ // console.log(outerItemsWrapper);
850
+ // console.log(innerIW);
851
+
852
+
853
+ if (myMedia.matches) {
854
+ innerIW.style.position = "relative";
855
+ }
856
+
857
+
858
+
859
+ if ((media.matches || myMedia.matches) && innerIW != undefined) {
860
+ //alert("PP")
861
+ innerIW.style.flexDirection = "column";
862
+ } else if (innerIW != undefined && !this.obj.isSide) {
863
+ innerIW.style.flexDirection = "row";
864
+ }
865
+
866
+ if (!this.obj.isSide && !media.matches && !myMedia.matches) {
867
+ this.res.children[0].children[0].style.display = "none";
868
+ }
869
+
870
+
871
+ if (this.obj.isSide) {
872
+ innerIW.style.flexDirection = "column";
873
+ }
874
+
875
+ if (!this.obj.isSide && !media.matches) {
876
+ this.res.children[0].style.position = "relative";
877
+ outerItemsWrapper.style.transform = "translateY(0px)";
878
+ }
879
+
880
+ if (!this.obj.isSide && media.matches) {
881
+ // this.res.children[0].style.position = "absolute";
882
+ }
883
+
884
+
885
+ // my custom
886
+
887
+ if (this.obj.customStyle){
888
+ // this.res.children[0].children[1].children[0].style.width = "200px";
889
+ this.res.children[0].style.marginTop = "1rem";
890
+ this.res.children[0].style.position = "absolute";
891
+ this.res.children[0].style.borderRadius = "1rem";
892
+ outerItemsWrapper.style.borderRadius = "1rem";
893
+
894
+ }
895
+
896
+
897
+ // Add line 700
898
+ if (this.obj.radius){
899
+ // this.res.children[0].children[1].children[0].style.width = "200px";
900
+ // alert("P")
901
+
902
+ // Both need to be like this
903
+ this.res.children[0].style.borderRadius = "1rem";
904
+ outerItemsWrapper.style.borderRadius = "1rem";
905
+
906
+ }
907
+ }
908
+
909
+ window.addEventListener("resize", () => method());
910
+ method();
911
+
912
+ if (div) {
913
+ document.querySelector(div).style.padding = 0;
914
+ document.querySelector(div).style.margin = 0;
915
+ document.querySelector(div).appendChild(this.res);
916
+ } else {
917
+ return this.res; //.children[0];
918
+ }
919
+ return this.res; //.children[0];
920
+ }
921
+ }
922
+
923
+ // If I shrink window and open the nav animates 2x
924
+
925
+ export { UINavBar };