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