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,437 @@
1
+ import {Animator} from "./animator.js";
2
+
3
+ class UINavBar extends Animator {
4
+ constructor(els){
5
+ super();
6
+ this.res = null;
7
+ this.titleText = "";
8
+ this.hasHamburger = false;
9
+ // this.setup();
10
+
11
+ /*if (els){
12
+ this.items(els);
13
+ }*/
14
+ }
15
+
16
+
17
+
18
+
19
+ /*hamburger(colour){
20
+ this.hamburgerColour = colour;
21
+ return this;
22
+ }*/
23
+
24
+
25
+ styled(obj){
26
+ this.obj = obj;
27
+ this.setup(obj);
28
+ return this;
29
+ }
30
+
31
+ setup(obj){
32
+ let el = document.createElement("div");
33
+ el.setAttribute("id", "covid");
34
+ el.style.backgroundColor = "#fff";
35
+
36
+ el.style.display = "flex";
37
+ el.style.justifyContent = "space-around";
38
+ el.style.alignItems = "center";
39
+ el.style.margin = 0;
40
+ el.style.padding = 0;
41
+ el.style.width = "100%";
42
+ //-------------DEFAULT STYLING----------
43
+ el.style.margin = 0;
44
+ el.style.paddingTop = "1em";
45
+ el.style.paddingBottom = "1em";
46
+ this.res = el;
47
+
48
+ // EVIL LINE
49
+ // window.addEventListener("resize", this.adjust.bind(this));
50
+
51
+
52
+
53
+
54
+
55
+ if (obj.background){
56
+ this.background({color: obj.background});
57
+ }
58
+
59
+ if (obj.sticky){
60
+ this.sticky();
61
+ }
62
+
63
+
64
+ if (obj.hamburgerColour){
65
+ this.hamburgerColour = obj.hamburgerColour;
66
+ }
67
+
68
+
69
+ if (obj.mobileSize){
70
+ this.mobileSize = obj.mobileSize;
71
+ }
72
+
73
+ if (obj.desktopSize){
74
+ this.desktopSize = obj.desktopSize;
75
+ }
76
+
77
+ if (obj.height){
78
+ this.res.style.height = obj.height;
79
+ }
80
+
81
+ /*if (obj.height){
82
+ this.res.style.height = obj.height;
83
+ }*/
84
+
85
+ return this;
86
+ }
87
+
88
+
89
+
90
+
91
+ items(items){
92
+
93
+
94
+
95
+ /* var itemsa = items.filter(item => item.__proto__
96
+ .constructor
97
+ .toString()
98
+ .startsWith("class Spacer") === false);
99
+
100
+ this.itemCount = itemsa.length;
101
+ */
102
+
103
+
104
+
105
+
106
+ let starts = ["Link", "Image", "Spacer"].some(e => {
107
+
108
+ return items[0].__proto__
109
+ .constructor
110
+ .toString()
111
+ .startsWith(`class ${e}`);
112
+ });
113
+
114
+ console.log(starts)
115
+
116
+
117
+
118
+
119
+ // let allow = items[0] instanceof Link || items[0] instanceof Spacer || items[0] instanceof Text || items[0] instanceof Image
120
+
121
+
122
+ if (starts){
123
+
124
+ console.log(items[0]);
125
+ console.log(items[0] instanceof Spacer)
126
+ console.log("WHAT ?????")
127
+
128
+ this.itemCount = items.length;
129
+
130
+
131
+ for (var i = 0; i < items.length; i++){
132
+
133
+ var item = items[i];
134
+ var isSpacer = item.__proto__
135
+ .constructor
136
+ .toString()
137
+ .startsWith("class Spacer");
138
+ this.res.appendChild(item.render());
139
+ }
140
+
141
+
142
+ this.adjust();
143
+
144
+
145
+ }
146
+
147
+
148
+
149
+ if (!starts) { // User is lazy
150
+ this.itemCount = items.length;
151
+
152
+ for (var i = 0; i < items.length; i++) {
153
+ let item = items[i];
154
+
155
+
156
+ if (item.logo){
157
+ let logo = new Image(item.logo).width("100px");
158
+ this.res.appendChild(logo.render());
159
+ }
160
+
161
+ if (this.obj.spacing){
162
+ let d = document.createElement("div");
163
+ d.style.flex = "1";
164
+ //this.res.appendChild(d)
165
+ }
166
+
167
+ if (item.title){
168
+ let link = new Link(item.title, item.url);
169
+ this.res.appendChild(link.render());
170
+ }
171
+
172
+
173
+ }
174
+
175
+ this.adjust();
176
+ }
177
+
178
+
179
+
180
+
181
+ return this;
182
+
183
+ }
184
+
185
+
186
+
187
+ instance(){
188
+ return this.res;
189
+ }
190
+
191
+
192
+ /*items(items){
193
+ this.itemCount = items.length;
194
+ for (var i = 0; i < items.length; i++){
195
+ this.res.appendChild(items[i].render());
196
+ }
197
+
198
+ this.adjust();
199
+ return this;
200
+ }*/
201
+
202
+
203
+
204
+ sticky(){
205
+ this.res.style.position = "fixed";
206
+ return this;
207
+ }
208
+
209
+ font(family){
210
+
211
+ for (var i = 0; i < this.res.children; i++){
212
+ this.res.children[i].style.fontFamily = family;
213
+ }
214
+
215
+ return this;
216
+ }
217
+
218
+
219
+
220
+ openSymbol(symbol){
221
+ this.symbol = symbol;
222
+ return this;
223
+ }
224
+
225
+
226
+ background(obj){
227
+ this.res.style.backgroundColor = obj.color;
228
+ this.res.style.opacity = obj.opacity;
229
+ return this;
230
+ }
231
+
232
+ transluescent(){
233
+ this.res.style.backgroundColor = "rgba(255,255,255,0.72)";
234
+ return this;
235
+ //background-color: rgba(255,255,255,0.72);
236
+ }
237
+
238
+
239
+ keepItem(item){
240
+ console.log("Wow");
241
+ this.keepItem = item;
242
+ return this;
243
+ }
244
+
245
+ /*--------------------------------------------------ADJUST--------------------------------------------------*/
246
+ // set habmurger icon
247
+ adjust(w) {
248
+ let media = window.matchMedia(`(max-width: 600px)`);
249
+ let media2 = window.matchMedia(`(max-device-width: 415px)`);
250
+
251
+ if (media.matches || media2.matches) {
252
+ this.res.style.height = "auto";
253
+ this.res.style.flexDirection = "column";
254
+ } else {
255
+ this.res.style.flexDirection = "row";
256
+ this.res.style.marginLeft = 0;
257
+ }
258
+
259
+ const addHamburger = () => {
260
+ var btn = document.createElement("button");
261
+ var node = document.createTextNode(this.symbol ? this.symbol : "☰");
262
+ btn.style.border = "none";
263
+ btn.style.fontWeight = "bold";
264
+
265
+ // alert(this.hamburgerColour);
266
+ btn.style.color = this.hamburgerColour ?? "#3498db";
267
+ btn.style.backgroundColor = "#fff";
268
+ btn.style.fontSize = media2.matches ? "2.1em" : "2em";
269
+ btn.appendChild(node);
270
+ btn.style.marginLeft = "auto";
271
+
272
+
273
+ return btn;
274
+ }
275
+
276
+
277
+ const adjustFontSize = () => {
278
+ console.log("IN VIEWPORT")
279
+ for (var i = 0; i < this.res.children.length; i++) {
280
+ let el = this.res.children[i];
281
+ el.style.fontSize = media2.matches ? (this.mobileSize ? this.mobileSize : "1.2em") : (this.desktopSize ? this.desktopSize : "1em");
282
+
283
+
284
+ var isSpacer = el.__proto__
285
+ .constructor
286
+ .toString()
287
+ .startsWith("class Spacer");
288
+
289
+ // console.error("---------ERROR---------");
290
+ // console.warn(el.style.flexGrow == "1");
291
+ // console.log(el.style.getPropertyValue("flex-grow"));
292
+ // console.log(el.style.getPropertyValue("flex-grow") == 1);
293
+ // console.warn(isSpacer);
294
+
295
+
296
+ if (el.style.getPropertyValue("flex-grow") == 1){
297
+ // alert("A")
298
+ // el.style.setProperty("display", "none");
299
+ // el.style.marginTop = "0em";
300
+ // el.style.flex = "none";
301
+
302
+ // console.log(el.style)
303
+
304
+ }
305
+
306
+
307
+
308
+ if (el.textContent === "☰") {
309
+ el.style.fontSize = "2em";
310
+ }
311
+ }
312
+ }
313
+
314
+ const toWideScreen = () => {
315
+ for (var i = 0; i < this.res.children.length; i++) {
316
+
317
+ let child = this.res.children[i];
318
+
319
+ child.style.marginTop = "0em";
320
+ child.style.display = "block";
321
+
322
+ if (child.textContent === this.titleText && this.titleText.length > 0) {
323
+ alert(child.textContent)
324
+ child.style.fontSize = "2em";
325
+ }
326
+
327
+ if (this.res.childNodes[i].textContent == "☰") {
328
+ this.res.removeChild(this.res.childNodes[i]);
329
+ }
330
+
331
+ }
332
+
333
+
334
+ this.res.style.flexDirection = "row";
335
+ }
336
+
337
+
338
+
339
+ var added = false;
340
+
341
+ const doInAdjust = () => {
342
+
343
+ adjustFontSize();
344
+ var closed = false;
345
+ var btn = addHamburger();
346
+
347
+ /*(((this.res.children.length == this.itemCount + 1)||*/
348
+ if (this.res.children.length == this.itemCount) { // Problem here
349
+ this.res.insertBefore(btn, this.res.firstChild);
350
+ // alert("ADDA");
351
+ }
352
+
353
+ this.res.style.flexDirection = "column";
354
+ for (var i = 0; i < this.res.children.length; i++) {
355
+ if (this.res.children[i].textContent == "☰" || this.res.children[i].textContent == /*"Lands"*/ this.keepItem){
356
+ this.res.children[i].style.display = "block";
357
+ } else {
358
+ this.res.children[i].style.display = "none";
359
+ }
360
+ }
361
+
362
+ btn.addEventListener("click", () => {
363
+ // alert
364
+ closed = !closed;
365
+
366
+ for (var i = 0; i < this.res.children.length; i++) {
367
+ if (i != 0 && this.res.children[i].textContent != /*"Lands"*/ this.keepItem) {
368
+
369
+ if (!closed) {
370
+ this.res.children[i].style.display = "none";
371
+ this.res.children[i].style.marginTop = "0em";
372
+ } else {
373
+
374
+
375
+ if (this.res.children[i].getAttribute("class") === "innerHider"){
376
+ // alert("WOW");
377
+ this.res.children[i].style.display = "none";
378
+ } else {
379
+ this.res.children[i].style.display = "block";
380
+ this.res.children[i].style.marginTop = "3em";
381
+ }
382
+
383
+
384
+
385
+ }
386
+ }
387
+ }
388
+ });
389
+ }
390
+
391
+ const adjust = () => {
392
+ if (media.matches || media2.matches) {
393
+ doInAdjust();
394
+ } else {
395
+ toWideScreen();
396
+ }
397
+ }
398
+
399
+ if (media.matches || media2.matches) {
400
+ doInAdjust();
401
+ } else {
402
+ toWideScreen();
403
+ }
404
+
405
+
406
+
407
+ window.addEventListener("resize", adjust);
408
+ return this;
409
+ }
410
+
411
+ /*--------------------------------------------------ADJUST--------------------------------------------------*/
412
+ render(div){
413
+
414
+
415
+
416
+ if (div){
417
+ document.querySelector(div).style.padding = 0;
418
+ document.querySelector(div).style.margin = 0;
419
+ document.querySelector(div).appendChild(this.res);
420
+ } else {
421
+ return this.res;
422
+ }
423
+ return this.res;
424
+ }
425
+ }
426
+
427
+ window.UINavBar
428
+ Spacer
429
+ Spacer
430
+ Spacer = UINavBar
431
+ Spacer
432
+ Spacer
433
+ Spacer;
434
+ export { UINavBar
435
+ Spacer
436
+ Spacer
437
+ Spacer };
@@ -0,0 +1,120 @@
1
+ import { Animator } from "./animator.js";
2
+
3
+ class ScrollVideo {
4
+ constructor() {
5
+ this.frameNumber = 0; // Start video at frame 0
6
+ this.res = document.createElement("div");
7
+ this.vid = null;
8
+ this.minScrollHeight = 0; // Default minimum scroll height
9
+ this.maxScrollHeight = 1000; // Default maximum scroll height
10
+ this.videoUrl = ""; // Default video URL
11
+ }
12
+
13
+ set({ minScrollHeight = 0, maxScrollHeight = 1000, videoUrl = "" } = {}) {
14
+ this.minScrollHeight = minScrollHeight;
15
+ this.maxScrollHeight = maxScrollHeight;
16
+ this.videoUrl = videoUrl;
17
+
18
+ // Create elements after settings are provided
19
+ this.createElements("V0");
20
+
21
+ // Select video element after creation
22
+ this.vid = this.res.children[0];
23
+
24
+ // Initialize event listeners and behavior
25
+ this.init();
26
+ return this; // Allow chaining
27
+ }
28
+
29
+ createElements(videoElementId) {
30
+ // Create and style the video element
31
+ const video = document.createElement("video");
32
+ video.id = videoElementId;
33
+ video.setAttribute("tabindex", "0");
34
+ video.setAttribute("autobuffer", "autobuffer");
35
+ video.setAttribute("preload", "preload");
36
+ video.style.position = "sticky";
37
+ video.style.top = "0";
38
+ video.style.left = "0";
39
+ video.style.width = "100%";
40
+ video.style.height = "100vh";
41
+ video.style.border = "1px solid orange";
42
+
43
+ // Create and append the source element to the video
44
+ const source = document.createElement("source");
45
+ source.type = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"';
46
+ source.src = this.videoUrl;
47
+ video.appendChild(source);
48
+
49
+ // Append the video element to the container
50
+ this.res.appendChild(video);
51
+
52
+ // Create and style the paragraph element
53
+ const paragraph = document.createElement("p");
54
+ paragraph.id = "time";
55
+ paragraph.style.fontFamily = "Helvetica, Arial, sans-serif";
56
+ paragraph.style.fontSize = "24px";
57
+ this.res.appendChild(paragraph);
58
+
59
+ // Create and style the set-height div element
60
+ const setHeight = document.createElement("div");
61
+ setHeight.id = "set-height";
62
+ setHeight.style.display = "block";
63
+ this.res.appendChild(setHeight);
64
+ }
65
+
66
+ sticky() {
67
+ this.res.style.position = "sticky";
68
+ this.res.style.top = 0;
69
+ return this;
70
+ }
71
+
72
+ init() {
73
+ // Set up event listener for when the video metadata is loaded
74
+ this.vid.addEventListener("loadedmetadata", () => {
75
+ // Dynamically set the page height based on video duration
76
+ const setHeight = document.getElementById("set-height");
77
+ if (setHeight) {
78
+ const scrollableHeight = this.maxScrollHeight - this.minScrollHeight;
79
+ setHeight.style.height = `${scrollableHeight}px`;
80
+ } else {
81
+ console.error("Error: 'set-height' element not found.");
82
+ }
83
+ });
84
+
85
+ // Start the scroll-play functionality
86
+ this.scrollPlay();
87
+ }
88
+ scrollPlay() {
89
+ // Ensure the video duration is loaded before trying to calculate currentTime
90
+ if (!this.vid || isNaN(this.vid.duration)) {
91
+ window.requestAnimationFrame(() => this.scrollPlay());
92
+ return;
93
+ }
94
+
95
+ // Calculate the frame number based on scroll position
96
+ const scrollPosition = Math.max(
97
+ this.minScrollHeight,
98
+ Math.min(window.pageYOffset, this.maxScrollHeight)
99
+ );
100
+
101
+ const scrollRange = this.maxScrollHeight - this.minScrollHeight;
102
+ const normalizedScroll = (scrollPosition - this.minScrollHeight) / scrollRange;
103
+
104
+ // Update the video currentTime property
105
+ this.vid.currentTime = normalizedScroll * this.vid.duration;
106
+
107
+ // Request the next animation frame for smooth playback
108
+ window.requestAnimationFrame(() => this.scrollPlay());
109
+ }
110
+
111
+ toCode() {
112
+ return [""];
113
+ }
114
+ render() {
115
+ // Return the container div with all elements
116
+ return this.res;
117
+ }
118
+ }
119
+
120
+ export { ScrollVideo };