@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20261015111022 → 0.8.1-dev.20261016035045

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.
@@ -31,9 +31,7 @@ var Slider = ({
31
31
  );
32
32
  const [isPlaying, setIsPlaying] = useState(autoplay);
33
33
  const trackRef = useRef(null);
34
- const prevSlideRef = useRef(currentSlide);
35
- const nextSlideRef = useRef(() => {
36
- });
34
+ console.log("trackRef:", trackRef);
37
35
  const [videoProgress, setVideoProgress] = useState(null);
38
36
  useEffect(() => {
39
37
  if (typeof initialSlidesToShow === "number") {
@@ -55,36 +53,16 @@ var Slider = ({
55
53
  }, [initialSlidesToShow]);
56
54
  useEffect(() => {
57
55
  if (!autoplay) return;
58
- if (trackRef.current) {
59
- Array.from(trackRef.current.children).forEach((child, index) => {
60
- if (index !== currentSlide) {
61
- const nonActiveVideos = child.querySelectorAll("video");
62
- nonActiveVideos.forEach((vid) => {
63
- vid.pause();
64
- vid.currentTime = 0;
65
- });
66
- }
67
- });
68
- }
69
56
  const activeSlideElement = trackRef.current?.children[currentSlide];
70
57
  const videoElement = activeSlideElement?.querySelector("video");
71
- const isNewSlide = prevSlideRef.current !== currentSlide;
72
- prevSlideRef.current = currentSlide;
73
58
  if (videoElement) {
74
59
  videoElement.loop = false;
75
- if (isNewSlide) {
76
- setVideoProgress(0);
60
+ setVideoProgress(0);
61
+ if (videoElement.ended) {
77
62
  videoElement.currentTime = 0;
78
63
  }
79
- if (isPlaying) {
80
- if (videoElement.ended) {
81
- videoElement.currentTime = 0;
82
- }
83
- videoElement.play().catch(() => {
84
- });
85
- } else {
86
- videoElement.pause();
87
- }
64
+ videoElement.play().catch(() => {
65
+ });
88
66
  const handleTimeUpdate = () => {
89
67
  if (videoElement.duration && !isNaN(videoElement.duration) && videoElement.duration > 0) {
90
68
  const pct = videoElement.currentTime / videoElement.duration * 100;
@@ -93,12 +71,10 @@ var Slider = ({
93
71
  };
94
72
  const handleVideoEnded = () => {
95
73
  setVideoProgress(100);
96
- nextSlideRef.current();
74
+ nextSlide();
97
75
  };
98
76
  const handleVideoError = () => {
99
- if (videoElement.error) {
100
- nextSlideRef.current();
101
- }
77
+ nextSlide();
102
78
  };
103
79
  videoElement.addEventListener("timeupdate", handleTimeUpdate);
104
80
  videoElement.addEventListener("loadedmetadata", handleTimeUpdate);
@@ -115,7 +91,7 @@ var Slider = ({
115
91
  }
116
92
  const timer = setInterval(() => {
117
93
  if (isPlaying) {
118
- nextSlideRef.current();
94
+ nextSlide();
119
95
  }
120
96
  }, autoplay_speed);
121
97
  return () => clearInterval(timer);
@@ -154,7 +130,6 @@ var Slider = ({
154
130
  setCurrentSlide(slidePositions[currentStepIndex + 1]);
155
131
  }
156
132
  };
157
- nextSlideRef.current = nextSlide;
158
133
  const prevSlide = () => {
159
134
  if (currentStepIndex <= 0) {
160
135
  if (infinite_scroll) {
@@ -33,9 +33,7 @@ var Slider = ({
33
33
  );
34
34
  const [isPlaying, setIsPlaying] = useState(autoplay);
35
35
  const trackRef = useRef(null);
36
- const prevSlideRef = useRef(currentSlide);
37
- const nextSlideRef = useRef(() => {
38
- });
36
+ console.log("trackRef:", trackRef);
39
37
  const [videoProgress, setVideoProgress] = useState(null);
40
38
  useEffect(() => {
41
39
  if (typeof initialSlidesToShow === "number") {
@@ -57,36 +55,16 @@ var Slider = ({
57
55
  }, [initialSlidesToShow]);
58
56
  useEffect(() => {
59
57
  if (!autoplay) return;
60
- if (trackRef.current) {
61
- Array.from(trackRef.current.children).forEach((child, index) => {
62
- if (index !== currentSlide) {
63
- const nonActiveVideos = child.querySelectorAll("video");
64
- nonActiveVideos.forEach((vid) => {
65
- vid.pause();
66
- vid.currentTime = 0;
67
- });
68
- }
69
- });
70
- }
71
58
  const activeSlideElement = trackRef.current?.children[currentSlide];
72
59
  const videoElement = activeSlideElement?.querySelector("video");
73
- const isNewSlide = prevSlideRef.current !== currentSlide;
74
- prevSlideRef.current = currentSlide;
75
60
  if (videoElement) {
76
61
  videoElement.loop = false;
77
- if (isNewSlide) {
78
- setVideoProgress(0);
62
+ setVideoProgress(0);
63
+ if (videoElement.ended) {
79
64
  videoElement.currentTime = 0;
80
65
  }
81
- if (isPlaying) {
82
- if (videoElement.ended) {
83
- videoElement.currentTime = 0;
84
- }
85
- videoElement.play().catch(() => {
86
- });
87
- } else {
88
- videoElement.pause();
89
- }
66
+ videoElement.play().catch(() => {
67
+ });
90
68
  const handleTimeUpdate = () => {
91
69
  if (videoElement.duration && !isNaN(videoElement.duration) && videoElement.duration > 0) {
92
70
  const pct = videoElement.currentTime / videoElement.duration * 100;
@@ -95,12 +73,10 @@ var Slider = ({
95
73
  };
96
74
  const handleVideoEnded = () => {
97
75
  setVideoProgress(100);
98
- nextSlideRef.current();
76
+ nextSlide();
99
77
  };
100
78
  const handleVideoError = () => {
101
- if (videoElement.error) {
102
- nextSlideRef.current();
103
- }
79
+ nextSlide();
104
80
  };
105
81
  videoElement.addEventListener("timeupdate", handleTimeUpdate);
106
82
  videoElement.addEventListener("loadedmetadata", handleTimeUpdate);
@@ -117,7 +93,7 @@ var Slider = ({
117
93
  }
118
94
  const timer = setInterval(() => {
119
95
  if (isPlaying) {
120
- nextSlideRef.current();
96
+ nextSlide();
121
97
  }
122
98
  }, autoplay_speed);
123
99
  return () => clearInterval(timer);
@@ -156,7 +132,6 @@ var Slider = ({
156
132
  setCurrentSlide(slidePositions[currentStepIndex + 1]);
157
133
  }
158
134
  };
159
- nextSlideRef.current = nextSlide;
160
135
  const prevSlide = () => {
161
136
  if (currentStepIndex <= 0) {
162
137
  if (infinite_scroll) {
package/dist/index.js CHANGED
@@ -7194,9 +7194,7 @@ var init_Slider = __esm({
7194
7194
  );
7195
7195
  const [isPlaying, setIsPlaying] = (0, import_react62.useState)(autoplay);
7196
7196
  const trackRef = (0, import_react62.useRef)(null);
7197
- const prevSlideRef = (0, import_react62.useRef)(currentSlide);
7198
- const nextSlideRef = (0, import_react62.useRef)(() => {
7199
- });
7197
+ console.log("trackRef:", trackRef);
7200
7198
  const [videoProgress, setVideoProgress] = (0, import_react62.useState)(null);
7201
7199
  (0, import_react62.useEffect)(() => {
7202
7200
  if (typeof initialSlidesToShow === "number") {
@@ -7218,36 +7216,16 @@ var init_Slider = __esm({
7218
7216
  }, [initialSlidesToShow]);
7219
7217
  (0, import_react62.useEffect)(() => {
7220
7218
  if (!autoplay) return;
7221
- if (trackRef.current) {
7222
- Array.from(trackRef.current.children).forEach((child, index) => {
7223
- if (index !== currentSlide) {
7224
- const nonActiveVideos = child.querySelectorAll("video");
7225
- nonActiveVideos.forEach((vid) => {
7226
- vid.pause();
7227
- vid.currentTime = 0;
7228
- });
7229
- }
7230
- });
7231
- }
7232
7219
  const activeSlideElement = trackRef.current?.children[currentSlide];
7233
7220
  const videoElement = activeSlideElement?.querySelector("video");
7234
- const isNewSlide = prevSlideRef.current !== currentSlide;
7235
- prevSlideRef.current = currentSlide;
7236
7221
  if (videoElement) {
7237
7222
  videoElement.loop = false;
7238
- if (isNewSlide) {
7239
- setVideoProgress(0);
7223
+ setVideoProgress(0);
7224
+ if (videoElement.ended) {
7240
7225
  videoElement.currentTime = 0;
7241
7226
  }
7242
- if (isPlaying) {
7243
- if (videoElement.ended) {
7244
- videoElement.currentTime = 0;
7245
- }
7246
- videoElement.play().catch(() => {
7247
- });
7248
- } else {
7249
- videoElement.pause();
7250
- }
7227
+ videoElement.play().catch(() => {
7228
+ });
7251
7229
  const handleTimeUpdate = () => {
7252
7230
  if (videoElement.duration && !isNaN(videoElement.duration) && videoElement.duration > 0) {
7253
7231
  const pct = videoElement.currentTime / videoElement.duration * 100;
@@ -7256,12 +7234,10 @@ var init_Slider = __esm({
7256
7234
  };
7257
7235
  const handleVideoEnded = () => {
7258
7236
  setVideoProgress(100);
7259
- nextSlideRef.current();
7237
+ nextSlide();
7260
7238
  };
7261
7239
  const handleVideoError = () => {
7262
- if (videoElement.error) {
7263
- nextSlideRef.current();
7264
- }
7240
+ nextSlide();
7265
7241
  };
7266
7242
  videoElement.addEventListener("timeupdate", handleTimeUpdate);
7267
7243
  videoElement.addEventListener("loadedmetadata", handleTimeUpdate);
@@ -7278,7 +7254,7 @@ var init_Slider = __esm({
7278
7254
  }
7279
7255
  const timer = setInterval(() => {
7280
7256
  if (isPlaying) {
7281
- nextSlideRef.current();
7257
+ nextSlide();
7282
7258
  }
7283
7259
  }, autoplay_speed);
7284
7260
  return () => clearInterval(timer);
@@ -7317,7 +7293,6 @@ var init_Slider = __esm({
7317
7293
  setCurrentSlide(slidePositions[currentStepIndex + 1]);
7318
7294
  }
7319
7295
  };
7320
- nextSlideRef.current = nextSlide;
7321
7296
  const prevSlide = () => {
7322
7297
  if (currentStepIndex <= 0) {
7323
7298
  if (infinite_scroll) {
package/dist/index.mjs CHANGED
@@ -2551,7 +2551,7 @@ var Pagination = dynamic16(() => import("./Pagination-6R4XZLF6.mjs"), { ssr: tru
2551
2551
  var DataBindingControls = dynamic16(() => import("./DataBindingControls-VSLL4WV2.mjs"), {
2552
2552
  ssr: true
2553
2553
  });
2554
- var Slider = dynamic16(() => import("./Slider-3URCZ3JU.mjs"), {
2554
+ var Slider = dynamic16(() => import("./Slider-XDYPGJYI.mjs"), {
2555
2555
  ssr: false
2556
2556
  });
2557
2557
  function toCamelCase(str) {
package/dist/server.js CHANGED
@@ -4829,9 +4829,7 @@ var init_Slider = __esm({
4829
4829
  );
4830
4830
  const [isPlaying, setIsPlaying] = (0, import_react42.useState)(autoplay);
4831
4831
  const trackRef = (0, import_react42.useRef)(null);
4832
- const prevSlideRef = (0, import_react42.useRef)(currentSlide);
4833
- const nextSlideRef = (0, import_react42.useRef)(() => {
4834
- });
4832
+ console.log("trackRef:", trackRef);
4835
4833
  const [videoProgress, setVideoProgress] = (0, import_react42.useState)(null);
4836
4834
  (0, import_react42.useEffect)(() => {
4837
4835
  if (typeof initialSlidesToShow === "number") {
@@ -4853,36 +4851,16 @@ var init_Slider = __esm({
4853
4851
  }, [initialSlidesToShow]);
4854
4852
  (0, import_react42.useEffect)(() => {
4855
4853
  if (!autoplay) return;
4856
- if (trackRef.current) {
4857
- Array.from(trackRef.current.children).forEach((child, index) => {
4858
- if (index !== currentSlide) {
4859
- const nonActiveVideos = child.querySelectorAll("video");
4860
- nonActiveVideos.forEach((vid) => {
4861
- vid.pause();
4862
- vid.currentTime = 0;
4863
- });
4864
- }
4865
- });
4866
- }
4867
4854
  const activeSlideElement = trackRef.current?.children[currentSlide];
4868
4855
  const videoElement = activeSlideElement?.querySelector("video");
4869
- const isNewSlide = prevSlideRef.current !== currentSlide;
4870
- prevSlideRef.current = currentSlide;
4871
4856
  if (videoElement) {
4872
4857
  videoElement.loop = false;
4873
- if (isNewSlide) {
4874
- setVideoProgress(0);
4858
+ setVideoProgress(0);
4859
+ if (videoElement.ended) {
4875
4860
  videoElement.currentTime = 0;
4876
4861
  }
4877
- if (isPlaying) {
4878
- if (videoElement.ended) {
4879
- videoElement.currentTime = 0;
4880
- }
4881
- videoElement.play().catch(() => {
4882
- });
4883
- } else {
4884
- videoElement.pause();
4885
- }
4862
+ videoElement.play().catch(() => {
4863
+ });
4886
4864
  const handleTimeUpdate = () => {
4887
4865
  if (videoElement.duration && !isNaN(videoElement.duration) && videoElement.duration > 0) {
4888
4866
  const pct = videoElement.currentTime / videoElement.duration * 100;
@@ -4891,12 +4869,10 @@ var init_Slider = __esm({
4891
4869
  };
4892
4870
  const handleVideoEnded = () => {
4893
4871
  setVideoProgress(100);
4894
- nextSlideRef.current();
4872
+ nextSlide();
4895
4873
  };
4896
4874
  const handleVideoError = () => {
4897
- if (videoElement.error) {
4898
- nextSlideRef.current();
4899
- }
4875
+ nextSlide();
4900
4876
  };
4901
4877
  videoElement.addEventListener("timeupdate", handleTimeUpdate);
4902
4878
  videoElement.addEventListener("loadedmetadata", handleTimeUpdate);
@@ -4913,7 +4889,7 @@ var init_Slider = __esm({
4913
4889
  }
4914
4890
  const timer = setInterval(() => {
4915
4891
  if (isPlaying) {
4916
- nextSlideRef.current();
4892
+ nextSlide();
4917
4893
  }
4918
4894
  }, autoplay_speed);
4919
4895
  return () => clearInterval(timer);
@@ -4952,7 +4928,6 @@ var init_Slider = __esm({
4952
4928
  setCurrentSlide(slidePositions[currentStepIndex + 1]);
4953
4929
  }
4954
4930
  };
4955
- nextSlideRef.current = nextSlide;
4956
4931
  const prevSlide = () => {
4957
4932
  if (currentStepIndex <= 0) {
4958
4933
  if (infinite_scroll) {
package/dist/server.mjs CHANGED
@@ -2507,7 +2507,7 @@ var Pagination = dynamic15(() => import("./Pagination-RMAXCIL7.mjs"), { ssr: tru
2507
2507
  var DataBindingControls = dynamic15(() => import("./DataBindingControls-Z2AHWFYX.mjs"), {
2508
2508
  ssr: true
2509
2509
  });
2510
- var Slider = dynamic15(() => import("./Slider-5VE2T2QN.mjs"), {
2510
+ var Slider = dynamic15(() => import("./Slider-BH5S4XRN.mjs"), {
2511
2511
  ssr: false
2512
2512
  });
2513
2513
  function toCamelCase(str) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clyrex-digital/clyrex-controls-dev",
3
- "version": "0.8.1-dev.20261015111022",
3
+ "version": "0.8.1-dev.20261016035045",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",