@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260625120328 → 0.8.1-dev.20260627063733

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.
package/dist/index.js CHANGED
@@ -5373,18 +5373,17 @@ var deviceToMediaQuery = (device) => {
5373
5373
  case "sm":
5374
5374
  return "(max-width: 480px)";
5375
5375
  case "md":
5376
- return "(max-width: 768px)";
5376
+ return "(min-width: 481px) and (max-width: 768px)";
5377
5377
  case "lg":
5378
5378
  return "(min-width: 769px)";
5379
- // case "tv":
5380
- // return "(min-width: 1920px)";
5381
5379
  default:
5382
5380
  return null;
5383
5381
  }
5384
5382
  };
5385
5383
  var DEVICE_ORDER = ["sm", "md", "lg", "tv"];
5386
5384
  var parseMaybeNumber = (value) => {
5387
- if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
5385
+ if (typeof value === "number")
5386
+ return Number.isFinite(value) ? value : void 0;
5388
5387
  if (typeof value !== "string") return void 0;
5389
5388
  const n = Number(value);
5390
5389
  return Number.isFinite(n) ? n : void 0;
@@ -5423,25 +5422,16 @@ var getNestedValue3 = (obj, path) => {
5423
5422
  if (!obj || !path) {
5424
5423
  return void 0;
5425
5424
  }
5426
- return path.split(".").reduce(
5427
- (current, key) => {
5428
- return current?.[key];
5429
- },
5430
- obj
5431
- );
5425
+ return path.split(".").reduce((current, key) => {
5426
+ return current?.[key];
5427
+ }, obj);
5432
5428
  };
5433
5429
  var ImageGalleryNode = (props) => {
5434
5430
  const resolveImageUrl = (image) => {
5435
5431
  let imageUrl = image.imageUrl;
5436
5432
  if (image.datafield && props.dataitem) {
5437
- const fieldValue = getNestedValue3(
5438
- props.dataitem,
5439
- image.datafield
5440
- );
5441
- const resolvedAsset = resolveAssetUrl(
5442
- fieldValue,
5443
- image.tag
5444
- );
5433
+ const fieldValue = getNestedValue3(props.dataitem, image.datafield);
5434
+ const resolvedAsset = resolveAssetUrl(fieldValue, image.tag);
5445
5435
  if (resolvedAsset) {
5446
5436
  imageUrl = resolvedAsset;
5447
5437
  }
@@ -5475,7 +5465,13 @@ var ImageGalleryNode = (props) => {
5475
5465
  if (!src) return [];
5476
5466
  const media = deviceToMediaQuery(img.device);
5477
5467
  const posterUrl = resolvePosterUrl(img.posterUrl);
5478
- return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
5468
+ return [
5469
+ {
5470
+ src,
5471
+ ...media ? { media } : {},
5472
+ ...posterUrl ? { posterUrl } : {}
5473
+ }
5474
+ ];
5479
5475
  }),
5480
5476
  ...hlsImages.filter((img) => !img.device).map((img) => {
5481
5477
  const src = resolveImageUrl(img);
@@ -5489,9 +5485,10 @@ var ImageGalleryNode = (props) => {
5489
5485
  const hlsStyles = {};
5490
5486
  if (primaryHls?.height) hlsStyles.height = primaryHls.height;
5491
5487
  if (primaryHls?.width) hlsStyles.width = primaryHls.width;
5492
- if (primaryHls?.borderRadius) hlsStyles.borderRadius = primaryHls.borderRadius;
5488
+ if (primaryHls?.borderRadius)
5489
+ hlsStyles.borderRadius = primaryHls.borderRadius;
5493
5490
  const staticSources = staticImages.filter((img) => !!img.device);
5494
- const staticFallback = staticImages.find((img) => !img.device) ?? staticImages[0] ?? null;
5491
+ const staticFallback = staticImages.find((img) => !img.device) ?? null;
5495
5492
  const FormatClass = {
5496
5493
  center: "justify-center",
5497
5494
  left: "justify-start",
@@ -5514,17 +5511,22 @@ var ImageGalleryNode = (props) => {
5514
5511
  styles: hlsStyles
5515
5512
  }
5516
5513
  ) }),
5517
- staticFallback && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("picture", { children: [
5514
+ (staticFallback || staticSources.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: staticFallback ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("picture", { children: [
5518
5515
  DEVICE_ORDER.map((deviceKey) => {
5519
- const match = staticSources.find((img) => img.device === deviceKey);
5520
- if (!match) return null;
5516
+ const match = staticSources.find(
5517
+ (img) => img.device === deviceKey
5518
+ );
5519
+ if (!match) {
5520
+ return null;
5521
+ }
5521
5522
  const srcUrl = resolveImageUrl(match);
5522
- if (!srcUrl) return null;
5523
- const mediaQuery = deviceToMediaQuery(match.device);
5523
+ if (!srcUrl) {
5524
+ return null;
5525
+ }
5524
5526
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
5525
5527
  "source",
5526
5528
  {
5527
- media: mediaQuery,
5529
+ media: deviceToMediaQuery(match.device),
5528
5530
  srcSet: srcUrl,
5529
5531
  width: parseMaybeNumber(match.intrinsicWidth),
5530
5532
  height: parseMaybeNumber(match.intrinsicHeight)
@@ -5535,31 +5537,75 @@ var ImageGalleryNode = (props) => {
5535
5537
  (() => {
5536
5538
  const img = staticFallback;
5537
5539
  const imageUrl = resolveImageUrl(img);
5538
- if (!imageUrl) return null;
5539
- const intrinsicWidth = parseMaybeNumber(img.intrinsicWidth);
5540
- const intrinsicHeight = parseMaybeNumber(img.intrinsicHeight);
5541
- const alt = img.title || "Gallery image";
5542
- const styles = {};
5543
- if (img.height) styles.height = img.height;
5544
- if (img.width) styles.width = img.width;
5545
- if (img.borderRadius) styles.borderRadius = img.borderRadius;
5546
- return (
5547
- // eslint-disable-next-line @next/next/no-img-element
5548
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
5549
- "img",
5550
- {
5551
- loading: "lazy",
5552
- style: styles,
5553
- className: "object-cover max-w-full",
5554
- src: imageUrl,
5555
- width: intrinsicWidth,
5556
- height: intrinsicHeight,
5557
- alt
5558
- }
5559
- )
5540
+ if (!imageUrl) {
5541
+ return null;
5542
+ }
5543
+ const styles = {
5544
+ width: img.width || "auto",
5545
+ height: img.height || "auto"
5546
+ };
5547
+ if (img.borderRadius) {
5548
+ styles.borderRadius = img.borderRadius;
5549
+ }
5550
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
5551
+ "img",
5552
+ {
5553
+ loading: "lazy",
5554
+ style: styles,
5555
+ className: "object-cover max-w-full",
5556
+ src: imageUrl,
5557
+ width: parseMaybeNumber(img.intrinsicWidth),
5558
+ height: parseMaybeNumber(img.intrinsicHeight),
5559
+ alt: img.title ?? "Gallery image"
5560
+ }
5560
5561
  );
5561
5562
  })()
5562
- ] }) })
5563
+ ] }) : (
5564
+ /* Case 2: Only device-specific images exist */
5565
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: staticSources.map((img, index) => {
5566
+ const imageUrl = resolveImageUrl(img);
5567
+ if (!imageUrl) {
5568
+ return null;
5569
+ }
5570
+ const styles = {
5571
+ width: img.width || "auto",
5572
+ height: img.height || "auto"
5573
+ };
5574
+ if (img.borderRadius) {
5575
+ styles.borderRadius = img.borderRadius;
5576
+ }
5577
+ let display = "none";
5578
+ switch (img.device) {
5579
+ case "sm":
5580
+ display = props.device === "sm" ? "block" : "none";
5581
+ break;
5582
+ case "md":
5583
+ display = props.device === "md" ? "block" : "none";
5584
+ break;
5585
+ case "lg":
5586
+ display = props.device === "lg" ? "block" : "none";
5587
+ break;
5588
+ default:
5589
+ display = "block";
5590
+ }
5591
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
5592
+ "img",
5593
+ {
5594
+ loading: "lazy",
5595
+ src: imageUrl,
5596
+ style: {
5597
+ ...styles,
5598
+ display
5599
+ },
5600
+ className: "object-cover max-w-full",
5601
+ width: parseMaybeNumber(img.intrinsicWidth),
5602
+ height: parseMaybeNumber(img.intrinsicHeight),
5603
+ alt: img.title ?? "Gallery image"
5604
+ },
5605
+ index
5606
+ );
5607
+ }) })
5608
+ ) })
5563
5609
  ] });
5564
5610
  };
5565
5611
  var ImageGalleryNode_default = ImageGalleryNode;
package/dist/index.mjs CHANGED
@@ -3767,18 +3767,17 @@ var deviceToMediaQuery = (device) => {
3767
3767
  case "sm":
3768
3768
  return "(max-width: 480px)";
3769
3769
  case "md":
3770
- return "(max-width: 768px)";
3770
+ return "(min-width: 481px) and (max-width: 768px)";
3771
3771
  case "lg":
3772
3772
  return "(min-width: 769px)";
3773
- // case "tv":
3774
- // return "(min-width: 1920px)";
3775
3773
  default:
3776
3774
  return null;
3777
3775
  }
3778
3776
  };
3779
3777
  var DEVICE_ORDER = ["sm", "md", "lg", "tv"];
3780
3778
  var parseMaybeNumber = (value) => {
3781
- if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
3779
+ if (typeof value === "number")
3780
+ return Number.isFinite(value) ? value : void 0;
3782
3781
  if (typeof value !== "string") return void 0;
3783
3782
  const n = Number(value);
3784
3783
  return Number.isFinite(n) ? n : void 0;
@@ -3817,25 +3816,16 @@ var getNestedValue3 = (obj, path) => {
3817
3816
  if (!obj || !path) {
3818
3817
  return void 0;
3819
3818
  }
3820
- return path.split(".").reduce(
3821
- (current, key) => {
3822
- return current?.[key];
3823
- },
3824
- obj
3825
- );
3819
+ return path.split(".").reduce((current, key) => {
3820
+ return current?.[key];
3821
+ }, obj);
3826
3822
  };
3827
3823
  var ImageGalleryNode = (props) => {
3828
3824
  const resolveImageUrl = (image) => {
3829
3825
  let imageUrl = image.imageUrl;
3830
3826
  if (image.datafield && props.dataitem) {
3831
- const fieldValue = getNestedValue3(
3832
- props.dataitem,
3833
- image.datafield
3834
- );
3835
- const resolvedAsset = resolveAssetUrl(
3836
- fieldValue,
3837
- image.tag
3838
- );
3827
+ const fieldValue = getNestedValue3(props.dataitem, image.datafield);
3828
+ const resolvedAsset = resolveAssetUrl(fieldValue, image.tag);
3839
3829
  if (resolvedAsset) {
3840
3830
  imageUrl = resolvedAsset;
3841
3831
  }
@@ -3869,7 +3859,13 @@ var ImageGalleryNode = (props) => {
3869
3859
  if (!src) return [];
3870
3860
  const media = deviceToMediaQuery(img.device);
3871
3861
  const posterUrl = resolvePosterUrl(img.posterUrl);
3872
- return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
3862
+ return [
3863
+ {
3864
+ src,
3865
+ ...media ? { media } : {},
3866
+ ...posterUrl ? { posterUrl } : {}
3867
+ }
3868
+ ];
3873
3869
  }),
3874
3870
  ...hlsImages.filter((img) => !img.device).map((img) => {
3875
3871
  const src = resolveImageUrl(img);
@@ -3883,9 +3879,10 @@ var ImageGalleryNode = (props) => {
3883
3879
  const hlsStyles = {};
3884
3880
  if (primaryHls?.height) hlsStyles.height = primaryHls.height;
3885
3881
  if (primaryHls?.width) hlsStyles.width = primaryHls.width;
3886
- if (primaryHls?.borderRadius) hlsStyles.borderRadius = primaryHls.borderRadius;
3882
+ if (primaryHls?.borderRadius)
3883
+ hlsStyles.borderRadius = primaryHls.borderRadius;
3887
3884
  const staticSources = staticImages.filter((img) => !!img.device);
3888
- const staticFallback = staticImages.find((img) => !img.device) ?? staticImages[0] ?? null;
3885
+ const staticFallback = staticImages.find((img) => !img.device) ?? null;
3889
3886
  const FormatClass = {
3890
3887
  center: "justify-center",
3891
3888
  left: "justify-start",
@@ -3908,17 +3905,22 @@ var ImageGalleryNode = (props) => {
3908
3905
  styles: hlsStyles
3909
3906
  }
3910
3907
  ) }),
3911
- staticFallback && /* @__PURE__ */ jsx58(Fragment8, { children: /* @__PURE__ */ jsxs31("picture", { children: [
3908
+ (staticFallback || staticSources.length > 0) && /* @__PURE__ */ jsx58(Fragment8, { children: staticFallback ? /* @__PURE__ */ jsxs31("picture", { children: [
3912
3909
  DEVICE_ORDER.map((deviceKey) => {
3913
- const match = staticSources.find((img) => img.device === deviceKey);
3914
- if (!match) return null;
3910
+ const match = staticSources.find(
3911
+ (img) => img.device === deviceKey
3912
+ );
3913
+ if (!match) {
3914
+ return null;
3915
+ }
3915
3916
  const srcUrl = resolveImageUrl(match);
3916
- if (!srcUrl) return null;
3917
- const mediaQuery = deviceToMediaQuery(match.device);
3917
+ if (!srcUrl) {
3918
+ return null;
3919
+ }
3918
3920
  return /* @__PURE__ */ jsx58(
3919
3921
  "source",
3920
3922
  {
3921
- media: mediaQuery,
3923
+ media: deviceToMediaQuery(match.device),
3922
3924
  srcSet: srcUrl,
3923
3925
  width: parseMaybeNumber(match.intrinsicWidth),
3924
3926
  height: parseMaybeNumber(match.intrinsicHeight)
@@ -3929,31 +3931,75 @@ var ImageGalleryNode = (props) => {
3929
3931
  (() => {
3930
3932
  const img = staticFallback;
3931
3933
  const imageUrl = resolveImageUrl(img);
3932
- if (!imageUrl) return null;
3933
- const intrinsicWidth = parseMaybeNumber(img.intrinsicWidth);
3934
- const intrinsicHeight = parseMaybeNumber(img.intrinsicHeight);
3935
- const alt = img.title || "Gallery image";
3936
- const styles = {};
3937
- if (img.height) styles.height = img.height;
3938
- if (img.width) styles.width = img.width;
3939
- if (img.borderRadius) styles.borderRadius = img.borderRadius;
3940
- return (
3941
- // eslint-disable-next-line @next/next/no-img-element
3942
- /* @__PURE__ */ jsx58(
3943
- "img",
3944
- {
3945
- loading: "lazy",
3946
- style: styles,
3947
- className: "object-cover max-w-full",
3948
- src: imageUrl,
3949
- width: intrinsicWidth,
3950
- height: intrinsicHeight,
3951
- alt
3952
- }
3953
- )
3934
+ if (!imageUrl) {
3935
+ return null;
3936
+ }
3937
+ const styles = {
3938
+ width: img.width || "auto",
3939
+ height: img.height || "auto"
3940
+ };
3941
+ if (img.borderRadius) {
3942
+ styles.borderRadius = img.borderRadius;
3943
+ }
3944
+ return /* @__PURE__ */ jsx58(
3945
+ "img",
3946
+ {
3947
+ loading: "lazy",
3948
+ style: styles,
3949
+ className: "object-cover max-w-full",
3950
+ src: imageUrl,
3951
+ width: parseMaybeNumber(img.intrinsicWidth),
3952
+ height: parseMaybeNumber(img.intrinsicHeight),
3953
+ alt: img.title ?? "Gallery image"
3954
+ }
3954
3955
  );
3955
3956
  })()
3956
- ] }) })
3957
+ ] }) : (
3958
+ /* Case 2: Only device-specific images exist */
3959
+ /* @__PURE__ */ jsx58(Fragment8, { children: staticSources.map((img, index) => {
3960
+ const imageUrl = resolveImageUrl(img);
3961
+ if (!imageUrl) {
3962
+ return null;
3963
+ }
3964
+ const styles = {
3965
+ width: img.width || "auto",
3966
+ height: img.height || "auto"
3967
+ };
3968
+ if (img.borderRadius) {
3969
+ styles.borderRadius = img.borderRadius;
3970
+ }
3971
+ let display = "none";
3972
+ switch (img.device) {
3973
+ case "sm":
3974
+ display = props.device === "sm" ? "block" : "none";
3975
+ break;
3976
+ case "md":
3977
+ display = props.device === "md" ? "block" : "none";
3978
+ break;
3979
+ case "lg":
3980
+ display = props.device === "lg" ? "block" : "none";
3981
+ break;
3982
+ default:
3983
+ display = "block";
3984
+ }
3985
+ return /* @__PURE__ */ jsx58(
3986
+ "img",
3987
+ {
3988
+ loading: "lazy",
3989
+ src: imageUrl,
3990
+ style: {
3991
+ ...styles,
3992
+ display
3993
+ },
3994
+ className: "object-cover max-w-full",
3995
+ width: parseMaybeNumber(img.intrinsicWidth),
3996
+ height: parseMaybeNumber(img.intrinsicHeight),
3997
+ alt: img.title ?? "Gallery image"
3998
+ },
3999
+ index
4000
+ );
4001
+ }) })
4002
+ ) })
3957
4003
  ] });
3958
4004
  };
3959
4005
  var ImageGalleryNode_default = ImageGalleryNode;
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.20260625120328",
3
+ "version": "0.8.1-dev.20260627063733",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",