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,231 @@
1
+ import {Animator} from "../animator.js";
2
+
3
+ class RadioGroup /*extends Animator*/ {
4
+ constructor(){
5
+ // super();
6
+ this.el = null;
7
+ this.radioCount = 0;
8
+ // this.setup();
9
+ }
10
+
11
+ set(objects){
12
+
13
+ this.options = objects;
14
+ console.log("ORARA");
15
+ console.log(this.options);
16
+
17
+
18
+ this.radioCount = objects.items.length;
19
+
20
+ let wrap = document.createElement("div");
21
+
22
+
23
+ let obj = objects.items;
24
+
25
+ for (var i = 0; i < obj.length; i++){
26
+
27
+
28
+ let label = document.createElement("label");
29
+
30
+ if (obj.font){
31
+ label.style.font = obj.font;
32
+ }
33
+
34
+ if (obj.color){
35
+ label.style.color = obj.color;
36
+ }
37
+
38
+ if (obj.exact){
39
+ label.style.fontSize = obj.exact;
40
+ }
41
+
42
+
43
+
44
+
45
+ let node = document.createTextNode(obj[i]);
46
+ label.appendChild(node);
47
+ label.setAttribute("for", obj[i]);
48
+
49
+ let card = document.createElement("input");
50
+ card.setAttribute("type", "radio");
51
+ card.setAttribute("id", `S${i}`);
52
+ card.setAttribute("value", obj[i].split(" ").join(""));
53
+
54
+ card.style.appearance = 'none';
55
+ card.style.width = '20px';
56
+ card.style.height = '20px';
57
+ card.style.border = this.options.tint ? `2px solid ${this.options.tint}` : '2px solid #007BFF';
58
+ card.style.borderRadius = '50%';
59
+ card.style.outline = 'none';
60
+ card.style.cursor = 'pointer';
61
+ card.style.transition = '0.3s';
62
+
63
+ // card.addEventListener('change', () => {
64
+ // alert("change");
65
+ /* if (card.checked) {
66
+ card.style.backgroundColor = '#007BFF';
67
+ card.style.boxShadow = '0 0 0 2px #0056b3 inset';
68
+ } else {
69
+ card.style.backgroundColor = 'transparent';
70
+ card.style.boxShadow = 'none';
71
+ }*/
72
+ // });
73
+
74
+ this.options.font && (label.style.fontFamily = this.options.font);
75
+
76
+ if (objects.multiple){
77
+ card.setAttribute("name", obj[i].split(" ").join(""));
78
+ } else {
79
+ card.setAttribute("name", objects.name);
80
+ // card.setAttribute("name", "same");
81
+ }
82
+
83
+
84
+ /* card.addEventListener("change", () => {
85
+ let picked = card.options[card.selectedIndex].value;
86
+ console.log(picked);
87
+ });*/
88
+
89
+
90
+ wrap.appendChild(card);
91
+ wrap.appendChild(label);
92
+ wrap.innerHTML += "</br>";
93
+
94
+ }
95
+
96
+ this.el = wrap;
97
+
98
+ this.responsive();
99
+ return this;
100
+ }
101
+
102
+
103
+
104
+ padding(val){
105
+ this.el.style.padding = val;
106
+ return this;
107
+ }
108
+
109
+ getCheckedValues(){
110
+ console.log("NOW");
111
+
112
+ var values = [];
113
+
114
+ for (var i = 0; i < this.radioCount; i++){
115
+
116
+
117
+ if (document.querySelector(`#S${i}`).checked) {
118
+ let value = document.querySelector(`#S${i}`);
119
+ console.log("VALUE IS " + value.value);
120
+ values.push(value.value);
121
+ }
122
+ }
123
+
124
+
125
+
126
+ return values;
127
+ }
128
+
129
+ toCode() {
130
+ /*let objString = JSON.stringify(
131
+ this.options,
132
+ (key, value) => (typeof key === "string" && key !== "" ? value : value),
133
+ 4
134
+ );*/
135
+
136
+ // 155735 preventing problem, no removal
137
+ let objString = JSON.stringify(this.options, null, 4);
138
+ objString = objString.replace(/"(\w+)"(?=\s*:)/g, '$1');
139
+ return [`new RadioGroup().set(${objString})`];
140
+ }
141
+
142
+
143
+
144
+ responsive(){
145
+ let query = window.matchMedia("(max-device-width: 415px)");
146
+
147
+ // window.matchMedia(query)
148
+ if (query.matches){
149
+ this.el.style.fontSize = "1.7em";
150
+ }
151
+
152
+ return this;
153
+ }
154
+
155
+
156
+
157
+ render(div){
158
+ if (div){
159
+ document.querySelector(div).appendChild(this.el);
160
+
161
+
162
+
163
+
164
+ } else {
165
+
166
+
167
+
168
+
169
+ console.log("MULA");
170
+ // console.log(this.el.children[0]);
171
+
172
+
173
+
174
+ for (var i = 0; i < this.el.children.length; i++){
175
+
176
+ let card = this.el.children[i];
177
+ // console.log(card.toString());
178
+
179
+
180
+
181
+
182
+ if (card.toString() === "[object HTMLInputElement]") {
183
+ card.addEventListener('change', () => {
184
+ if (card.checked) {
185
+ card.style.backgroundColor = this.options.tint ? this.options.tint : '#007BFF';
186
+ card.style.boxShadow = this.options.tint ?`0 0 0 2px ${this.options.tint} inset` : '0 0 0 2px #0056b3 inset';
187
+
188
+ // Reset styles for other radio buttons in the group
189
+ for (let j = 0; j < this.el.children.length; j++) {
190
+ const sibling = this.el.children[j];
191
+ // alert(this.options.multiple);
192
+ // Check if the sibling is an input element
193
+ if (sibling.tagName === 'INPUT' && sibling.type === 'radio') {
194
+ // Avoid resetting the current radio button
195
+ if (this.options.multiple === false && sibling !== card) {
196
+ sibling.style.backgroundColor = 'transparent';
197
+ sibling.style.boxShadow = 'none';
198
+ }
199
+ }
200
+ }
201
+ } else {
202
+ card.style.backgroundColor = 'transparent';
203
+ card.style.boxShadow = 'none';
204
+ }
205
+ });
206
+ }
207
+
208
+
209
+
210
+ }
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ return this.el;
220
+ }
221
+
222
+ }
223
+ }
224
+
225
+
226
+
227
+
228
+
229
+
230
+ window.RadioGroup = RadioGroup;
231
+ export { RadioGroup };
@@ -0,0 +1,158 @@
1
+ import {Animator} from "../animator.js";
2
+
3
+ class Range {
4
+ constructor(obj) {
5
+ this.el = null;
6
+ this.minLabel = null;
7
+ this.maxLabel = null;
8
+ this.currentLabel = null;
9
+ // this.setup(obj);
10
+ }
11
+
12
+ padding(val) {
13
+ this.el.style.padding = val;
14
+ return this;
15
+ }
16
+
17
+ toCode() {
18
+ const objString = JSON.stringify(this.options, null, 4);
19
+ return [`new Range().set(${objString})`];
20
+ }
21
+
22
+ set(obj) {
23
+ this.options = obj;
24
+ // Create slider input
25
+ let slider = document.createElement("input");
26
+ slider.setAttribute("id", "slider");
27
+ slider.setAttribute("type", "range");
28
+ slider.setAttribute("min", obj.min);
29
+ slider.setAttribute("max", obj.max);
30
+ slider.setAttribute("value", obj.min);
31
+
32
+ slider.style.width = obj.width ?? "100%";
33
+
34
+
35
+
36
+
37
+ if (!obj.plain){
38
+ // Default slider styling
39
+ slider.style.setProperty("-webkit-appearance", "none");
40
+ slider.style.appearance = "none";
41
+ slider.style.height = "9px";
42
+ slider.style.background = obj.style.trackColor ?? "orange";
43
+ slider.style.borderRadius = "5px";
44
+
45
+
46
+
47
+ // Create and append thumb styles
48
+ const thumbCSS = `
49
+ #slider::-webkit-slider-thumb {
50
+ -webkit-appearance: none;
51
+ appearance: none;
52
+ width: 25px;
53
+ height: 25px;
54
+ border-radius: 50%;
55
+ background: ${obj.style.thumbColor ?? "4CAF50"};
56
+ cursor: pointer;
57
+ }
58
+ `;
59
+ const style = document.createElement('style');
60
+ style.appendChild(document.createTextNode(thumbCSS));
61
+ document.head.appendChild(style);
62
+ }
63
+
64
+ // Create labels
65
+ let wrapper = document.createElement("div");
66
+ wrapper.style.display = "flex";
67
+ wrapper.style.flexDirection = "column";
68
+ wrapper.style.alignItems = "center";
69
+ wrapper.style.width = "100%";
70
+
71
+ let labelWrapper = document.createElement("div");
72
+ labelWrapper.style.display = "flex";
73
+ labelWrapper.style.justifyContent = "space-between";
74
+ // labelWrapper.style.width = "100%";
75
+ labelWrapper.style.width = obj.width ?? "100%";
76
+
77
+ this.minLabel = document.createElement("span");
78
+ this.minLabel.textContent = obj.min;
79
+
80
+ this.maxLabel = document.createElement("span");
81
+ this.maxLabel.textContent = obj.max;
82
+
83
+ this.currentLabel = document.createElement("span");
84
+ this.currentLabel.textContent = slider.value;
85
+
86
+ obj.font && (this.currentLabel.style.fontFamily = obj.font);
87
+ obj.font && (this.minLabel.style.fontFamily = obj.font);
88
+ obj.font && (this.maxLabel.style.fontFamily = obj.font);
89
+
90
+ if (!obj.plain){
91
+ labelWrapper.appendChild(this.minLabel);
92
+ labelWrapper.appendChild(this.currentLabel);
93
+ labelWrapper.appendChild(this.maxLabel);
94
+ }
95
+
96
+ // Update current label on slider input
97
+ slider.addEventListener("input", () => {
98
+ this.currentLabel.textContent = slider.value;
99
+ });
100
+
101
+ // Mobile-specific styles
102
+ let query = window.matchMedia("(max-device-width: 415px)");
103
+ if (query.matches) {
104
+ if (!obj.plain){
105
+ slider.style.height = "20px";
106
+ slider.style.background = obj.style.trackColor ?? "1abc9C";
107
+ slider.style.borderRadius = "10px";
108
+ slider.style.fontSize = "3rem";
109
+ slider.style.width = "80%";
110
+
111
+ const mobileThumbCSS = `
112
+ #slider::-webkit-slider-thumb {
113
+ -webkit-appearance: none;
114
+ appearance: none;
115
+ width: 25px;
116
+ height: 25px;
117
+ border-radius: 50%;
118
+ background: ${obj.style.thumbColor ?? "blue"};
119
+ cursor: pointer;
120
+ }
121
+ `;
122
+
123
+ const mobileStyle = document.createElement('style');
124
+ mobileStyle.appendChild(document.createTextNode(mobileThumbCSS));
125
+ document.head.appendChild(mobileStyle);
126
+ } else {
127
+ slider.style.width = "80%";
128
+ }
129
+ }
130
+
131
+ wrapper.appendChild(labelWrapper);
132
+ wrapper.appendChild(slider);
133
+
134
+ this.el = wrapper;
135
+ return this;
136
+ }
137
+
138
+ value() {
139
+ return this.el.querySelector("#slider").value;
140
+ }
141
+
142
+ render(div) {
143
+ if (div) {
144
+ document.querySelector(div).appendChild(this.el);
145
+ } else {
146
+ return this.el;
147
+ }
148
+ }
149
+ }
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ window.Range = Range;
158
+ export { Range };
package/layout/free.js ADDED
@@ -0,0 +1,232 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+ class Free extends Animator {
4
+ constructor(){
5
+ super();
6
+ this.res = document.createElement("div");
7
+ this.res.style.display = "grid";
8
+ this.attributes = {};
9
+ }
10
+
11
+ set(obj){
12
+ this.options = obj;
13
+ this.attributes = obj;
14
+ this.templateCols = obj.templateCols;
15
+ // alert(this.templateCols);
16
+
17
+ if (obj.templateCols) { // condition wrong
18
+ this.res.style.gridTemplateColumns = `repeat(${obj.templateCols.cols}, 1fr)`;
19
+ this.res.style.gridTemplateRows = `repeat(${obj.templateCols.cols}, 1fr)`;
20
+ }
21
+
22
+
23
+ this.res.style.height = obj.height ? obj.height : "600px";
24
+
25
+ obj.positions && (this.storedPositions = obj.positions); //this.generateGridPositions(obj.position);
26
+
27
+ return this;
28
+ }
29
+
30
+
31
+ // move this function into free class
32
+ generateGridPositions(attractions, rows = 30, cols = 50) {
33
+ const container = document.createElement("div");
34
+ container.classList.add("container");
35
+ container.style.display = "grid";
36
+ container.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;
37
+ container.style.gridTemplateRows = `repeat(${rows}, 1fr)`;
38
+ container.style.width = "100%";
39
+ container.style.height = "100vh";
40
+
41
+ let defaultPositions = attractions.map((_, index) => ({
42
+ row: Math.floor(rows / 2) + index, // Slightly offset to avoid exact overlap
43
+ col: Math.floor(cols / 2) + index
44
+ }));
45
+
46
+ // Function to compute resulting force vector for a specific element
47
+ function computeForceVector(targetIndex) {
48
+ let forceX = 0;
49
+ let forceY = 0;
50
+
51
+ attractions.forEach((attr, index) => {
52
+ const { weight, direction } = attr;
53
+ const targetPosition = defaultPositions[targetIndex];
54
+ const attractionPosition = defaultPositions[index];
55
+
56
+ // Calculate the distance between the target and the attraction
57
+ const dx = targetPosition.col - attractionPosition.col;
58
+ const dy = targetPosition.row - attractionPosition.row;
59
+ const distance = Math.sqrt(dx * dx + dy * dy);
60
+
61
+ // Add a softening factor: make the force fall off gradually with distance
62
+ const scalingFactor = 1 / (distance + 1); // Smaller influence for greater distance
63
+
64
+ // Scale the force by the weight and the softening factor
65
+ const scaledWeight = weight * scalingFactor;
66
+
67
+ // Apply the force
68
+ switch (direction) {
69
+ case "L":
70
+ forceX -= scaledWeight;
71
+ break;
72
+ case "R":
73
+ forceX += scaledWeight;
74
+ break;
75
+ case "U":
76
+ forceY -= scaledWeight;
77
+ break;
78
+ case "B":
79
+ forceY += scaledWeight;
80
+ break;
81
+ }
82
+ });
83
+
84
+ return { forceX, forceY };
85
+ }
86
+
87
+ attractions.forEach((attr, index) => {
88
+ let { row, col } = defaultPositions[index];
89
+
90
+ // Compute the force vector for the current element
91
+ const { forceX, forceY } = computeForceVector(index);
92
+
93
+ // Apply the force to determine new position (apply moderate force)
94
+ col = Math.max(1, Math.min(cols, col + Math.round(forceX)));
95
+ row = Math.max(1, Math.min(rows, row + Math.round(forceY)));
96
+
97
+ console.log(this.items.map(el => el.id));
98
+ console.log(attr.attract.slice(1));
99
+ // alert("#" + attr.attract.slice(1));
100
+ const element = this.items.filter(el => el.id === attr.attract.slice(1))[0].render(); //Array(this.res.children).filter(el => el.getAttribute("id") === attr.attract.slice(1)); //this.res.querySelector("#" + attr.attract.slice(1));//document.createElement("div");
101
+ console.log(element);
102
+
103
+ // element.id = attr.attract.slice(1);
104
+ element.style.gridRowStart = row;
105
+ element.style.gridRowEnd = row + 3; // Example height of 3 grid cells
106
+ element.style.gridColumnStart = col;
107
+ element.style.gridColumnEnd = col + 5; // Example width of 5 grid cells
108
+
109
+ element.style.border = `3px solid #${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`;//[]
110
+
111
+ /*if (element.toString() === "[HTMLParagaphElement]"){
112
+ element.style.width = "fit-content";
113
+ }*/
114
+
115
+ // Optional: Add some content or styles for better visibility
116
+ // element.textContent = `${attr.attract.slice(1)}`
117
+
118
+ //\n(${forceX.toFixed(2)}, ${forceY.toFixed(2)})`;
119
+ element.style.display = "flex";
120
+ element.style.alignItems = "center";
121
+ element.style.justifyContent = "center";
122
+ element.style.fontWeight = "bold";
123
+ element.style.color = "white";
124
+ // alert(element)
125
+ this.res.appendChild(element);
126
+
127
+ // this.res.style.border = "3px solid #1abc9c";
128
+ });
129
+
130
+ // document.body.appendChild(container);
131
+ console.log("ARAO");
132
+ console.log(this.res.children.length);
133
+ return this;
134
+ }
135
+
136
+
137
+ add(items){
138
+ this.items = items;
139
+
140
+ // Render each component in the grid container
141
+ for (const component of items) {
142
+ this.res.appendChild(component.render());
143
+ // alert("PP");
144
+ // console.log("ORAA");
145
+ // console.log(this.res.children.length);
146
+ }
147
+
148
+ // alert("PP");
149
+ // alert(this.res);
150
+
151
+ if (this.storedPositions){
152
+ this.generateGridPositions(this.storedPositions);
153
+
154
+ }
155
+
156
+ console.log("MORAA");
157
+ console.log(this.res.children.length);
158
+
159
+ return this;
160
+ }
161
+
162
+ /* toCode(){
163
+ let codeStr = `new Free()`;
164
+
165
+ // 16:01:09 09/11/24 What????
166
+ // Convert attributes to .set({...}) format if there are any attributes
167
+ if (Object.keys(this.attributes).length > 0) {
168
+ codeStr += `.set(${JSON.stringify(this.attributes, null, 2).replace(/"([^"]+)":/g, '$1:')})`;
169
+
170
+ // codeStr += `.set(${JSON.stringify(this.attributes, null, 2)})`;
171
+ } else {
172
+ codeStr += `.set({})`;
173
+ }
174
+
175
+ codeStr += `.add([\n`;
176
+
177
+ // Generate the code for each item and join with commas only between items
178
+ codeStr += this.items
179
+ .map(item => item.toCode().join("").trim()) // Trim any line breaks or whitespace around the item code
180
+ .join(",\n"); // Insert commas only between items
181
+
182
+ codeStr += `\n])`;
183
+
184
+
185
+ return codeStr;
186
+ }*/
187
+
188
+ toCode() {
189
+ if (this.excludeFromCodeTrue){
190
+ // this.code = ["new Text('').set({})"];
191
+ return [""];
192
+ }
193
+
194
+ const objString = JSON
195
+ .stringify(this.options, null, 4)
196
+ .replace(/"([^"]+)":/g, '$1:');
197
+
198
+
199
+ var codeStr = "";
200
+ codeStr += `.add([\n`;
201
+
202
+ // Generate the code for each item and join with commas only between items
203
+ codeStr += this.items
204
+ .map(item => item.toCode().join("").trim()) // Trim any line breaks or whitespace around the item code
205
+ .join(",\n"); // Insert commas only between items
206
+
207
+ codeStr += `\n])`;
208
+
209
+
210
+ return [`new Free().set(${objString})${codeStr}`];
211
+ }
212
+
213
+ render(div){
214
+
215
+ // ARE THERE CHILDREN
216
+ console.log("CHILDREN IN RENDER");
217
+ console.log(this.res.children.length);
218
+
219
+
220
+ if (div){
221
+ document.querySelector(div).appendChild(this.res);
222
+ return;
223
+ }
224
+
225
+
226
+
227
+ // alert("PP");
228
+ // alert(this.res);
229
+ return this.res;
230
+ }
231
+ }
232
+ export { Free };