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,299 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+ class Modal {
4
+ constructor(){
5
+ this.el = null;
6
+ this.obj = null;
7
+ }
8
+
9
+ setup(obj){
10
+ let el = document.createElement("div");
11
+ el.style.width = "100vw";
12
+ el.style.height = "160vh";
13
+ el.style.backgroundColor = obj.background;//"rgba(70,157,115,0.8)";
14
+ // el.style.backgroundColor = "#3498db";
15
+ el.style.zIndex = "1";
16
+ //el.style.opacity = 0.90;
17
+ el.style.position = "absolute";
18
+ el.style.overflowY = "scroll";
19
+ el.style.display = "block";
20
+
21
+ this.obj = obj;
22
+ this.res = el;
23
+ return this;
24
+ }
25
+
26
+
27
+
28
+
29
+
30
+ close(){
31
+ this.res.style.display = "none";
32
+ return this;
33
+ }
34
+
35
+ show(){
36
+ this.res.style.display = "block";
37
+ return this;
38
+ }
39
+
40
+
41
+ add(els){
42
+
43
+
44
+
45
+
46
+ let el = document.createElement("div");
47
+ el.style.marginTop = "60px";
48
+ el.style.width = this.obj.width; //"60%";
49
+ el.style.height = "auto";
50
+ el.style.marginLeft = "auto";
51
+ el.style.marginRight = "auto";
52
+ el.style.backgroundColor = "white"; // "#3498db";
53
+ el.style.opacity = 1.0;
54
+ el.style.zIndex = "2";
55
+ el.style.borderRadius = "16px";
56
+ // el.style.padding = "2em";
57
+
58
+
59
+ let mq = window.matchMedia("(max-device-width: 415px)");
60
+ if (mq.matches){
61
+ el.style.marginTop = "200px";
62
+ el.style.width = "100%";
63
+ }
64
+
65
+
66
+
67
+ for (var i = 0; i < els.length; i++){
68
+ console.log(els[i]);
69
+ el.appendChild(els[i].render());
70
+ }
71
+
72
+
73
+
74
+
75
+ this.res.appendChild(el);
76
+
77
+ /* let inner = new Text("WOW");
78
+ let ren = inner.render();
79
+ ren.style.zIndex = "2";
80
+
81
+ this.res.appendChild(ren);
82
+ */
83
+
84
+
85
+
86
+ return this;
87
+
88
+ }
89
+
90
+
91
+
92
+ render(el) {
93
+ if (el) {
94
+ document.querySelector("body").style.margin = 0;
95
+ document.querySelector("body").style.padding = 0;
96
+ document.querySelector(el).appendChild(this.res);
97
+ } else {
98
+ return this.res;
99
+ }
100
+ }
101
+
102
+
103
+ }
104
+
105
+
106
+ class GridNew {
107
+ constructor(frs, saveEl) {
108
+ this.saveEl = saveEl;
109
+ this.frs = frs;
110
+ this.res = null;
111
+ this.setup();
112
+ }
113
+
114
+ setup() {
115
+ let parent = document.createElement("div");
116
+ parent.setAttribute("id", "ABC34");
117
+ this.parent = parent;
118
+
119
+ let grid = document.createElement("div");
120
+ grid.style.margin = 0;
121
+ grid.style.padding = 0;
122
+ grid.style.display = "flex";
123
+ grid.style.flexWrap = "wrap";
124
+
125
+
126
+ /*
127
+ if (this.frs){
128
+ grid.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
129
+ }
130
+ grid.style.gridTemplateColumns = "repeat(auto-fit, minmax(250px, 1fr))";
131
+ */
132
+ this.res = grid;
133
+ return this;
134
+ }
135
+
136
+ absolute(){
137
+ // this.res.style.position = "absolute";
138
+ return this;
139
+ }
140
+
141
+ setAreas(areas){
142
+ console.log(areas);
143
+ this.res.children[0].style.gridArea = "a";
144
+ this.res.children[1].style.gridArea = "b";
145
+ this.res.style.gridTemplateAreas = `"a a a b"`;
146
+ console.warn(this.res.style.gridTemplateAreas);
147
+
148
+
149
+ return this;
150
+ }
151
+
152
+ detailView(){
153
+ /*let detail = document.createElement("img");
154
+
155
+ detail.setAttribute("src", "https://www.kasandbox.org/programming-images/animals/birds_rainbow-lorakeets.png");
156
+ detail.style.width = "400px";
157
+ detail.style.marginLeft = "auto";
158
+ detail.style.marginRight = "auto";
159
+ detail.style.position = "absolute";
160
+
161
+
162
+ detail.style.zIndex = 2;
163
+
164
+
165
+
166
+ this.parent.appendChild(detail);*/
167
+ this.parent.appendChild(this.res);
168
+ return this;
169
+
170
+ }
171
+
172
+
173
+
174
+
175
+
176
+ stretchFit() {
177
+ this.res.style.height = "auto";
178
+ this.res.style.width = "100%";
179
+ return this;
180
+ }
181
+
182
+ size(w, h) {
183
+ if (w === "wide") {
184
+ this.res.style.width = "100%";
185
+ } else {
186
+ this.res.style.width = w;
187
+ }
188
+
189
+ if (h === "fit") {
190
+ this.res.style.height = "auto";
191
+ } else {
192
+ this.res.style.height = h;
193
+ }
194
+
195
+ return this;
196
+ }
197
+
198
+ border(){
199
+ this.res.style.border = "3px solid green";
200
+ return this;
201
+ }
202
+
203
+ items(arr) {
204
+ console.warn(arr);
205
+ for (var i = 0; i < arr.length; i++) {
206
+ this.res.appendChild(arr[i].render());
207
+ }
208
+ return this;
209
+ }
210
+
211
+
212
+ center() {
213
+ this.res.style.justifyItems = "center";
214
+ return this;
215
+ }
216
+
217
+ padding(val, direction) {
218
+ if (direction) {
219
+ if (direction == "left") {
220
+ this.res.style.paddingLeft = val;
221
+ } else if (direction == "top") {
222
+ this.res.style.paddingTop = val;
223
+ }
224
+ } else {
225
+ this.res.style.padding = val;
226
+ }
227
+
228
+ return this;
229
+ }
230
+
231
+ onTap(e) {
232
+ this.res.addEventListener("click", e);
233
+ return this;
234
+ }
235
+
236
+ gap(value){
237
+ this.gap = `${value}px`;
238
+ return this;
239
+ }
240
+
241
+ setColumns(obj) { // (count, h)
242
+
243
+
244
+
245
+ let count = obj.count;
246
+ let h = obj.width;
247
+
248
+ //let media = window.matchMedia(`(max-width: 600px)`);
249
+ let query = window.matchMedia("(max-device-width: 415px)");
250
+
251
+ if (window.innerWidth < h || query.matches) {
252
+ this.res.style.gridTemplateColumns = Array(count).fill("1fr").join(" ");
253
+ this.res.style.gridGap = this.gap; //"30px";
254
+ } else {
255
+ this.res.style.gridGap = this.gap; // "30px";
256
+ this.res.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
257
+ }
258
+
259
+
260
+ const adjust = () => {
261
+
262
+ if (window.innerWidth < h) {
263
+ this.res.style.gridTemplateColumns = Array(count).fill("1fr").join(" ");
264
+ this.res.style.gridGap = this.gap; //"30px";
265
+ } else {
266
+ this.res.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
267
+ this.res.style.gridGap = this.gap; // "30px";
268
+ }
269
+ }
270
+
271
+
272
+
273
+ window.addEventListener("resize", adjust);
274
+
275
+
276
+ return this;
277
+ }
278
+
279
+ render(el) {
280
+ if (el){
281
+ document.querySelector(el).appendChild(this.parent);
282
+ } else {
283
+ return this.parent;
284
+ }
285
+
286
+ }
287
+ }
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+ window.Modal
296
+ GridNew = Modal
297
+ GridNew;
298
+ export { Modal
299
+ GridNew };
package/layout/grid.js ADDED
@@ -0,0 +1,190 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+
4
+ class Grid {
5
+ constructor(frs, saveEl) {
6
+ this.saveEl = saveEl;
7
+ this.frs = frs;
8
+ this.res = null;
9
+ this.setup();
10
+ }
11
+
12
+ getType(){
13
+ return "GridLayoutElement";
14
+ }
15
+
16
+ setup() {
17
+ let parent = document.createElement("div");
18
+ this.parent = parent;
19
+
20
+
21
+ let grid = document.createElement("div");
22
+ grid.style.margin = 0;
23
+ grid.style.padding = 0;
24
+ grid.style.display = "grid";
25
+
26
+ if (this.frs){
27
+ grid.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
28
+ }
29
+
30
+ this.res = grid;
31
+ return this;
32
+ }
33
+
34
+ freeAreas(){
35
+ this.res.style.gridTemplateAreas = `"a a a b c"`;
36
+ return this;
37
+ }
38
+
39
+
40
+ setAreas(areas){
41
+ console.log(areas);
42
+ this.res.children[0].style.gridArea = "a";
43
+ this.res.children[1].style.gridArea = "b";
44
+ this.res.style.gridTemplateAreas = `"a a a b"`;
45
+ console.warn(this.res.style.gridTemplateAreas);
46
+ return this;
47
+ }
48
+
49
+ detailView(){
50
+ let detail = document.createElement("img");
51
+ detail.setAttribute("src", "https://www.kasandbox.org/programming-images/animals/birds_rainbow-lorakeets.png");
52
+ detail.style.width = "400px";
53
+ detail.style.marginLeft = "auto";
54
+ detail.style.marginRight = "auto";
55
+
56
+ //this.res.style.zIndex = -1;
57
+
58
+ detail.style.zIndex = 2;
59
+
60
+
61
+
62
+ this.res.appendChild(detail);
63
+ return this;
64
+
65
+ }
66
+
67
+
68
+
69
+
70
+
71
+ stretchFit() {
72
+ this.res.style.height = "auto";
73
+ this.res.style.width = "100%";
74
+ return this;
75
+ }
76
+
77
+ size(w, h) {
78
+ if (w === "wide") {
79
+ this.res.style.width = "100%";
80
+ } else {
81
+ this.res.style.width = w;
82
+ }
83
+
84
+ if (h === "fit") {
85
+ this.res.style.height = "auto";
86
+ } else {
87
+ this.res.style.height = h;
88
+ }
89
+
90
+ return this;
91
+ }
92
+
93
+ border(){
94
+ this.res.style.border = "3px solid green";
95
+ return this;
96
+ }
97
+
98
+ items(arr) {
99
+ console.warn(arr);
100
+ for (var i = 0; i < arr.length; i++) {
101
+ this.res.appendChild(arr[i].render());
102
+ }
103
+ return this;
104
+ }
105
+
106
+
107
+ center() {
108
+ this.res.style.justifyItems = "center";
109
+ return this;
110
+ }
111
+
112
+ padding(val, direction) {
113
+ if (direction) {
114
+ if (direction == "left") {
115
+ this.res.style.paddingLeft = val;
116
+ } else if (direction == "top") {
117
+ this.res.style.paddingTop = val;
118
+ }
119
+ } else {
120
+ this.res.style.padding = val;
121
+ }
122
+
123
+ return this;
124
+ }
125
+
126
+ onTap(e) {
127
+ this.res.addEventListener("click", e);
128
+ return this;
129
+ }
130
+
131
+ gap(value){
132
+ this.gap = `${value}px`;
133
+ return this;
134
+ }
135
+
136
+ setColumns(obj) { // (count, h)
137
+
138
+
139
+
140
+ let count = obj.count;
141
+ let h = obj.width;
142
+
143
+ //let media = window.matchMedia(`(max-width: 600px)`);
144
+ let query = window.matchMedia("(max-device-width: 415px)");
145
+
146
+ if (window.innerWidth < h || query.matches) {
147
+ this.res.style.gridTemplateColumns = Array(count).fill("1fr").join(" ");
148
+ this.res.style.gridGap = this.gap; //"30px";
149
+ } else {
150
+ this.res.style.gridGap = this.gap; // "30px";
151
+ this.res.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
152
+ }
153
+
154
+
155
+ const adjust = () => {
156
+
157
+ if (window.innerWidth < h) {
158
+ this.res.style.gridTemplateColumns = Array(count).fill("1fr").join(" ");
159
+ this.res.style.gridGap = this.gap; //"30px";
160
+ } else {
161
+ this.res.style.gridTemplateColumns = Array(this.frs).fill("1fr").join(" ");
162
+ this.res.style.gridGap = this.gap; // "30px";
163
+ }
164
+ }
165
+
166
+
167
+
168
+ window.addEventListener("resize", adjust);
169
+
170
+
171
+ return this;
172
+ }
173
+
174
+ render(el) {
175
+ if (el){
176
+ document.querySelector(el).appendChild(this.res);
177
+ } else {
178
+ return this.res;
179
+ }
180
+
181
+ }
182
+ }
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ export { Grid };
@@ -0,0 +1,188 @@
1
+ class Simple {
2
+ constructor() {
3
+
4
+ this.gridContainer = document.createElement("div");
5
+ this.gridContainer.classList.add("grid-container");
6
+ this.gridContainer.style.display = "grid";
7
+ // this.gridContainer.style.gridAutoRows = "1fr"; EVIL LINE
8
+ }
9
+
10
+ set(obj){
11
+ obj.gap && (this.gridContainer.style.gap = obj.gap);
12
+ obj.height && (this.gridContainer.style.height = obj.height);
13
+ obj.width && (this.gridContainer.style.width = obj.width);
14
+ return this;
15
+ }
16
+
17
+ /*
18
+ [
19
+ {
20
+ at: "default",
21
+ template: [
22
+ "abbbbb",
23
+ "abbbbb",
24
+ "abbbbb",
25
+ "cccccc",
26
+ "cccccc",
27
+ "dddddd",
28
+ "eeeeee",
29
+ "eeeeee"
30
+ ]
31
+ },
32
+ */
33
+ react(arr){
34
+ const reacta = () => {
35
+ console.log(arr.length);
36
+ for (var i = 0; i < arr.length - 1; i++){
37
+ // alert(parseInt(arr[i].at))
38
+ console.warn(window.innerWidth);
39
+ //console.warn("BETWEEN" + parseInt(arr[i].at) + " - " + parseInt(arr[i + 1].at) );
40
+
41
+ let from = parseInt(arr[i].at);
42
+ let to = parseInt(arr[i + 1].at);
43
+
44
+
45
+ if ( window.innerWidth > from && window.innerWidth < to ){
46
+ //alert("O")
47
+ console.log("FROM " + from + " TO " + to);
48
+ let obj = arr[i].template;
49
+
50
+ let withSpaceObj = obj.map(str => str.split('').join(' '));
51
+ const outputString = withSpaceObj.map(row => `"${row}"`).join(" ");
52
+ this.gridContainer.style.gridTemplateAreas = outputString;
53
+
54
+ this.gridContainer.style.border = `3px solid ${arr[i].color}`;
55
+
56
+ } else if (window.innerWidth > to) {
57
+ this.gridContainer.style.border = `3px solid ${arr[arr.length - 1].color}`;
58
+ console.log("BIGGER THAN" + " " + to);
59
+ //alert("P")
60
+ // This always fires
61
+ let obj = arr[arr.length - 1].template;
62
+
63
+ let withSpaceObj = obj.map(str => str.split('').join(' '));
64
+ const outputString = withSpaceObj.map(row => `"${row}"`).join(" ");
65
+ this.gridContainer.style.gridTemplateAreas = outputString;
66
+
67
+ }
68
+
69
+
70
+ }
71
+ //return this;
72
+ }
73
+ reacta();
74
+ window.addEventListener("resize", reacta);
75
+ return this;
76
+ }
77
+
78
+ add(items){
79
+ console.log(items);
80
+
81
+ // let withSpaceObj = obj.map(str => str.split('').join(' '));
82
+ // const outputString = withSpaceObj.map(row => `"${row}"`).join(" ");
83
+ // this.gridContainer.style.gridTemplateAreas = outputString;//'"a a a" "b b b" "c d d" "c d d"';
84
+ // Function to generate alphabetic sequences
85
+ const generateAlphabeticSequence = (count) => {
86
+ const chars = [];
87
+ for (let i = 0; i < count; i++) {
88
+ let str = '';
89
+ let num = i;
90
+ do {
91
+ str = String.fromCharCode(65 + (num % 26)) + str; // Generate character
92
+ num = Math.floor(num / 26) - 1;
93
+ } while (num >= 0);
94
+ chars.push(str);
95
+ }
96
+ return chars;
97
+ };
98
+
99
+ // Generate 'els' array dynamically
100
+ let els = generateAlphabeticSequence(items.length); // ['A', 'B', ..., 'Z', 'AA', 'AB', ...]
101
+
102
+ for (let i = 0; i < items.length; i++) {
103
+ let e = items[i].render();
104
+ e.style.border = "1px solid gray";
105
+ e.style.gridArea = els[i].toLowerCase(); // e.g., 'a', 'b', 'aa', 'ab', ...
106
+
107
+ const gridItem = document.createElement("div");
108
+ gridItem.textContent = items[i].text;
109
+ gridItem.style.gridArea = els[i].toLowerCase();
110
+ this.gridContainer.appendChild(e);
111
+ }
112
+
113
+ return this;
114
+ }
115
+
116
+
117
+ render(el) {
118
+ el && document.querySelector(el).appendChild(this.gridContainer);
119
+ return this.gridContainer;
120
+ }
121
+
122
+ toCode(){
123
+ return `new Simple().set({}).react([])`;
124
+ }
125
+ }
126
+
127
+ // Usage example:
128
+ //const simpleGrid = new Simple();
129
+ //document.body.appendChild(simpleGrid.render());
130
+
131
+
132
+ class GridSwitcher {
133
+ constructor(){
134
+ this.el = document.createElement("div");
135
+ this.gridWrap = document.createElement("div");
136
+ }
137
+
138
+ DOMAdd(dom){
139
+ this.domStr = dom;
140
+ this.domEl = document.querySelector(dom);
141
+ return this;
142
+ }
143
+
144
+ items(arr){
145
+ this.items = arr;
146
+ return this;
147
+ }
148
+
149
+ dynamicItems(arr){
150
+ this.dynamicItems = arr;
151
+ return this;
152
+ }
153
+ switch(breakpoints){
154
+ const innerSwitch = () => {
155
+ for (let i = 0; i < breakpoints.length; i++){
156
+ const val = breakpoints[i];
157
+ let mq = window.matchMedia(`(max-width: ${val.at})`).matches;
158
+ if ((mq || val.at == "default") && mq !== this.lastMq){
159
+ const update = new Simple().set(val.template, this.dynamicItems).render();
160
+ this.el = update;
161
+ this.el.style.border = "1px solid black";
162
+ this.render(this.domStr);
163
+ this.lastMq = mq;
164
+ }
165
+ }
166
+ }
167
+ innerSwitch();
168
+ window.addEventListener("resize", innerSwitch);
169
+ return this;
170
+ }
171
+
172
+ render(div){
173
+ this.gridWrap.innerHTML = "";
174
+ this.gridWrap.appendChild(this.el);
175
+
176
+ // document.querySelector(div).removeChild(this.el);
177
+ if (div){
178
+ document.querySelector(div).appendChild(this.gridWrap);
179
+ }
180
+
181
+ return this.gridWrap;
182
+
183
+ // return this.el;
184
+ // Just return this.el it normally
185
+ }
186
+ }
187
+
188
+ export {Simple};