@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260422062852 → 0.8.1-dev.20260422073350

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  HlsPlayer_default
4
- } from "./chunk-Q46ODS3X.mjs";
4
+ } from "./chunk-ELASRK22.mjs";
5
5
  export {
6
6
  HlsPlayer_default as default
7
7
  };
@@ -20,7 +20,7 @@ var HlsPlayer = React.memo(
20
20
  const [isHovered, setIsHovered] = useState(false);
21
21
  const [isMobile, setIsMobile] = useState(false);
22
22
  const wasManuallyPausedRef = useRef(false);
23
- const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl }] : [];
23
+ const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
24
24
  useEffect(() => {
25
25
  const checkMobile = () => {
26
26
  const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
@@ -65,10 +65,7 @@ var HlsPlayer = React.memo(
65
65
  } else if (v.canPlayType("application/vnd.apple.mpegurl")) {
66
66
  v.load();
67
67
  }
68
- }, [
69
- // Serialise the source array so the dependency is a stable primitive.
70
- JSON.stringify(resolvedSources)
71
- ]);
68
+ }, [JSON.stringify(resolvedSources)]);
72
69
  const handlePlayPause = useCallback(() => {
73
70
  const v = videoRef.current;
74
71
  if (!v) return;
@@ -97,6 +94,8 @@ var HlsPlayer = React.memo(
97
94
  setIsPlaying(false);
98
95
  }
99
96
  }, [playOptions, isMobile]);
97
+ const posterSources = resolvedSources.filter((s) => s.media && s.posterUrl);
98
+ const fallbackPoster = posterUrl ?? resolvedSources.find((s) => !s.media)?.posterUrl ?? resolvedSources[0]?.posterUrl;
100
99
  if (resolvedSources.length === 0) return null;
101
100
  return /* @__PURE__ */ jsxs(
102
101
  "div",
@@ -110,7 +109,6 @@ var HlsPlayer = React.memo(
110
109
  {
111
110
  ref: videoRef,
112
111
  className: "w-full h-full object-contain",
113
- poster: posterUrl,
114
112
  controls: showControls && (isMobile || isPlaying),
115
113
  muted: playOptions === "autoplay" || playOptions === "playOnHover",
116
114
  autoPlay: playOptions === "autoplay",
@@ -128,14 +126,23 @@ var HlsPlayer = React.memo(
128
126
  ))
129
127
  }
130
128
  ),
131
- !isMobile && playOptions === "playOnHover" && posterUrl && /* @__PURE__ */ jsx(
132
- "img",
129
+ fallbackPoster && !isPlaying && /* @__PURE__ */ jsxs(
130
+ "picture",
133
131
  {
134
- src: posterUrl,
135
- width: intrinsicWidth,
136
- height: intrinsicHeight,
137
- alt: "poster",
138
- className: `absolute inset-0 object-cover transition-opacity ${isHovered ? "opacity-0" : "opacity-100"}`
132
+ className: `absolute inset-0 transition-opacity ${!isMobile && playOptions === "playOnHover" && isHovered ? "opacity-0" : "opacity-100"}`,
133
+ children: [
134
+ posterSources.map(({ media, posterUrl: src }, i) => /* @__PURE__ */ jsx("source", { media, srcSet: src }, i)),
135
+ /* @__PURE__ */ jsx(
136
+ "img",
137
+ {
138
+ src: fallbackPoster,
139
+ width: intrinsicWidth,
140
+ height: intrinsicHeight,
141
+ alt: "poster",
142
+ className: "w-full h-full object-cover"
143
+ }
144
+ )
145
+ ]
139
146
  }
140
147
  ),
141
148
  !isMobile && !isPlaying && /* @__PURE__ */ jsx(
package/dist/index.js CHANGED
@@ -297,7 +297,7 @@ var init_HlsPlayer = __esm({
297
297
  const [isHovered, setIsHovered] = (0, import_react33.useState)(false);
298
298
  const [isMobile, setIsMobile] = (0, import_react33.useState)(false);
299
299
  const wasManuallyPausedRef = (0, import_react33.useRef)(false);
300
- const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl }] : [];
300
+ const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
301
301
  (0, import_react33.useEffect)(() => {
302
302
  const checkMobile = () => {
303
303
  const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
@@ -342,10 +342,7 @@ var init_HlsPlayer = __esm({
342
342
  } else if (v.canPlayType("application/vnd.apple.mpegurl")) {
343
343
  v.load();
344
344
  }
345
- }, [
346
- // Serialise the source array so the dependency is a stable primitive.
347
- JSON.stringify(resolvedSources)
348
- ]);
345
+ }, [JSON.stringify(resolvedSources)]);
349
346
  const handlePlayPause = (0, import_react33.useCallback)(() => {
350
347
  const v = videoRef.current;
351
348
  if (!v) return;
@@ -374,6 +371,8 @@ var init_HlsPlayer = __esm({
374
371
  setIsPlaying(false);
375
372
  }
376
373
  }, [playOptions, isMobile]);
374
+ const posterSources = resolvedSources.filter((s) => s.media && s.posterUrl);
375
+ const fallbackPoster = posterUrl ?? resolvedSources.find((s) => !s.media)?.posterUrl ?? resolvedSources[0]?.posterUrl;
377
376
  if (resolvedSources.length === 0) return null;
378
377
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
379
378
  "div",
@@ -387,7 +386,6 @@ var init_HlsPlayer = __esm({
387
386
  {
388
387
  ref: videoRef,
389
388
  className: "w-full h-full object-contain",
390
- poster: posterUrl,
391
389
  controls: showControls && (isMobile || isPlaying),
392
390
  muted: playOptions === "autoplay" || playOptions === "playOnHover",
393
391
  autoPlay: playOptions === "autoplay",
@@ -405,14 +403,23 @@ var init_HlsPlayer = __esm({
405
403
  ))
406
404
  }
407
405
  ),
408
- !isMobile && playOptions === "playOnHover" && posterUrl && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
409
- "img",
406
+ fallbackPoster && !isPlaying && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
407
+ "picture",
410
408
  {
411
- src: posterUrl,
412
- width: intrinsicWidth,
413
- height: intrinsicHeight,
414
- alt: "poster",
415
- className: `absolute inset-0 object-cover transition-opacity ${isHovered ? "opacity-0" : "opacity-100"}`
409
+ className: `absolute inset-0 transition-opacity ${!isMobile && playOptions === "playOnHover" && isHovered ? "opacity-0" : "opacity-100"}`,
410
+ children: [
411
+ posterSources.map(({ media, posterUrl: src }, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("source", { media, srcSet: src }, i)),
412
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
413
+ "img",
414
+ {
415
+ src: fallbackPoster,
416
+ width: intrinsicWidth,
417
+ height: intrinsicHeight,
418
+ alt: "poster",
419
+ className: "w-full h-full object-cover"
420
+ }
421
+ )
422
+ ]
416
423
  }
417
424
  ),
418
425
  !isMobile && !isPlaying && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -5176,13 +5183,17 @@ var ImageGalleryNode = (props) => {
5176
5183
  const src = resolveImageUrl(img.imageUrl);
5177
5184
  if (!src) return [];
5178
5185
  const media = deviceToMediaQuery(img.device);
5179
- return [{ src, ...media ? { media } : {} }];
5186
+ const posterUrl = resolvePosterUrl(img.posterUrl);
5187
+ return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
5180
5188
  }),
5181
5189
  // Unconstrained fallback(s) — no media attr, always matches.
5182
- ...hlsImages.filter((img) => !img.device).map((img) => ({ src: resolveImageUrl(img.imageUrl) })).filter((s) => !!s.src)
5190
+ ...hlsImages.filter((img) => !img.device).map((img) => {
5191
+ const src = resolveImageUrl(img.imageUrl);
5192
+ const posterUrl = resolvePosterUrl(img.posterUrl);
5193
+ return { src, ...posterUrl ? { posterUrl } : {} };
5194
+ }).filter((s) => !!s.src)
5183
5195
  ];
5184
5196
  const primaryHls = hlsImages.find((img) => !img.device) ?? hlsImages[0];
5185
- const hlsPosterUrl = primaryHls ? resolvePosterUrl(primaryHls.posterUrl) : void 0;
5186
5197
  const hlsIntrinsicWidth = primaryHls ? parseMaybeNumber(primaryHls.intrinsicWidth)?.toString() : void 0;
5187
5198
  const hlsIntrinsicHeight = primaryHls ? parseMaybeNumber(primaryHls.intrinsicHeight)?.toString() : void 0;
5188
5199
  const staticSources = staticImages.filter((img) => !!img.device);
@@ -5198,7 +5209,6 @@ var ImageGalleryNode = (props) => {
5198
5209
  HlsPlayer3,
5199
5210
  {
5200
5211
  sources: hlsSources,
5201
- posterUrl: hlsPosterUrl,
5202
5212
  intrinsicWidth: hlsIntrinsicWidth,
5203
5213
  intrinsicHeight: hlsIntrinsicHeight,
5204
5214
  showControls: primaryHls?.showControls ?? false,
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HlsPlayer_default
3
- } from "./chunk-Q46ODS3X.mjs";
3
+ } from "./chunk-ELASRK22.mjs";
4
4
  import {
5
5
  Button_default,
6
6
  ServiceClient_default,
@@ -2638,7 +2638,7 @@ var DeviceAssetSelector_default = DeviceAssetSelector;
2638
2638
 
2639
2639
  // src/components/pageRenderingEngine/nodes/ImageNode.tsx
2640
2640
  import { Fragment as Fragment3, jsx as jsx39 } from "react/jsx-runtime";
2641
- var HlsPlayer = dynamic(() => import("./HlsPlayer-UECDBJDB.mjs"), {
2641
+ var HlsPlayer = dynamic(() => import("./HlsPlayer-IKEZJ5A5.mjs"), {
2642
2642
  ssr: false
2643
2643
  });
2644
2644
  var getNestedValue = (obj, path) => {
@@ -4107,7 +4107,7 @@ var Pagination_default = Pagination;
4107
4107
  // src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
4108
4108
  import dynamic5 from "next/dynamic";
4109
4109
  import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs33 } from "react/jsx-runtime";
4110
- var HlsPlayer2 = dynamic5(() => import("./HlsPlayer-UECDBJDB.mjs"), { ssr: false });
4110
+ var HlsPlayer2 = dynamic5(() => import("./HlsPlayer-IKEZJ5A5.mjs"), { ssr: false });
4111
4111
  var deviceToMediaQuery = (device) => {
4112
4112
  switch (device) {
4113
4113
  case "sm":
@@ -4156,13 +4156,17 @@ var ImageGalleryNode = (props) => {
4156
4156
  const src = resolveImageUrl(img.imageUrl);
4157
4157
  if (!src) return [];
4158
4158
  const media = deviceToMediaQuery(img.device);
4159
- return [{ src, ...media ? { media } : {} }];
4159
+ const posterUrl = resolvePosterUrl(img.posterUrl);
4160
+ return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
4160
4161
  }),
4161
4162
  // Unconstrained fallback(s) — no media attr, always matches.
4162
- ...hlsImages.filter((img) => !img.device).map((img) => ({ src: resolveImageUrl(img.imageUrl) })).filter((s) => !!s.src)
4163
+ ...hlsImages.filter((img) => !img.device).map((img) => {
4164
+ const src = resolveImageUrl(img.imageUrl);
4165
+ const posterUrl = resolvePosterUrl(img.posterUrl);
4166
+ return { src, ...posterUrl ? { posterUrl } : {} };
4167
+ }).filter((s) => !!s.src)
4163
4168
  ];
4164
4169
  const primaryHls = hlsImages.find((img) => !img.device) ?? hlsImages[0];
4165
- const hlsPosterUrl = primaryHls ? resolvePosterUrl(primaryHls.posterUrl) : void 0;
4166
4170
  const hlsIntrinsicWidth = primaryHls ? parseMaybeNumber(primaryHls.intrinsicWidth)?.toString() : void 0;
4167
4171
  const hlsIntrinsicHeight = primaryHls ? parseMaybeNumber(primaryHls.intrinsicHeight)?.toString() : void 0;
4168
4172
  const staticSources = staticImages.filter((img) => !!img.device);
@@ -4178,7 +4182,6 @@ var ImageGalleryNode = (props) => {
4178
4182
  HlsPlayer2,
4179
4183
  {
4180
4184
  sources: hlsSources,
4181
- posterUrl: hlsPosterUrl,
4182
4185
  intrinsicWidth: hlsIntrinsicWidth,
4183
4186
  intrinsicHeight: hlsIntrinsicHeight,
4184
4187
  showControls: primaryHls?.showControls ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260422062852",
3
+ "version": "0.8.1-dev.20260422073350",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",