@digitalculture/ochre-sdk 0.2.9 → 0.2.11

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.cjs CHANGED
@@ -1548,39 +1548,51 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1548
1548
  if (altTextSource === null) {
1549
1549
  altTextSource = "name";
1550
1550
  }
1551
- let secondsPerImage = images.length > 1 ? 5 : null;
1552
- const secondsPerImageProperty = getPropertyValueByLabel(
1553
- componentProperty.properties,
1554
- "seconds-per-image"
1555
- );
1556
- if (secondsPerImageProperty !== null) {
1557
- secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1558
- }
1559
- let isFullWidth = false;
1560
- const isFullWidthProperty = getPropertyValueByLabel(
1561
- componentProperty.properties,
1562
- "is-full-width"
1563
- );
1564
- if (isFullWidthProperty !== null) {
1565
- isFullWidth = isFullWidthProperty === "Yes";
1566
- }
1567
- let isFullHeight = false;
1568
- const isFullHeightProperty = getPropertyValueByLabel(
1569
- componentProperty.properties,
1570
- "is-full-height"
1571
- );
1572
- if (isFullHeightProperty !== null) {
1573
- isFullHeight = isFullHeightProperty === "Yes";
1551
+ let carouselOptions = null;
1552
+ if (images.length > 1) {
1553
+ const variantProperty = getPropertyByLabel(
1554
+ componentProperty.properties,
1555
+ "variant"
1556
+ );
1557
+ let secondsPerImage = 5;
1558
+ let isFullWidth = false;
1559
+ let isFullHeight = false;
1560
+ if (variantProperty && variantProperty.values[0].content === "carousel") {
1561
+ const secondsPerImageProperty = getPropertyValueByLabel(
1562
+ variantProperty.properties,
1563
+ "seconds-per-image"
1564
+ );
1565
+ if (secondsPerImageProperty !== null) {
1566
+ secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1567
+ }
1568
+ const isFullWidthProperty = getPropertyValueByLabel(
1569
+ variantProperty.properties,
1570
+ "is-full-width"
1571
+ );
1572
+ if (isFullWidthProperty !== null) {
1573
+ isFullWidth = isFullWidthProperty === "Yes";
1574
+ }
1575
+ const isFullHeightProperty = getPropertyValueByLabel(
1576
+ variantProperty.properties,
1577
+ "is-full-height"
1578
+ );
1579
+ if (isFullHeightProperty !== null) {
1580
+ isFullHeight = isFullHeightProperty === "Yes";
1581
+ }
1582
+ }
1583
+ carouselOptions = {
1584
+ secondsPerImage,
1585
+ isFullWidth,
1586
+ isFullHeight
1587
+ };
1574
1588
  }
1575
1589
  properties.images = images;
1576
1590
  properties.variant = variant;
1591
+ properties.carouselOptions = carouselOptions;
1577
1592
  properties.imageQuality = imageQuality;
1578
1593
  properties.captionLayout = captionLayout;
1579
1594
  properties.captionSource = captionSource;
1580
1595
  properties.altTextSource = altTextSource;
1581
- properties.secondsPerImage = secondsPerImage;
1582
- properties.isFullWidth = isFullWidth;
1583
- properties.isFullHeight = isFullHeight;
1584
1596
  break;
1585
1597
  }
1586
1598
  case "image-gallery": {
package/dist/index.d.cts CHANGED
@@ -496,15 +496,17 @@ type WebElementComponent = {
496
496
  IIIFId: string;
497
497
  } | {
498
498
  component: "image";
499
- variant: "default" | "carousel";
500
499
  images: Array<WebImage>;
500
+ variant: "default" | "carousel";
501
+ carouselOptions: {
502
+ secondsPerImage: number | null;
503
+ isFullWidth: boolean | null;
504
+ isFullHeight: boolean | null;
505
+ } | null;
501
506
  imageQuality: "high" | "low";
502
507
  captionSource: "name" | "abbreviation" | "description";
503
508
  captionLayout: "top" | "bottom" | "suppress";
504
509
  altTextSource: "name" | "abbreviation" | "description";
505
- secondsPerImage: number | null;
506
- isFullWidth: boolean | null;
507
- isFullHeight: boolean | null;
508
510
  } | {
509
511
  component: "image-gallery";
510
512
  galleryId: string;
package/dist/index.d.ts CHANGED
@@ -496,15 +496,17 @@ type WebElementComponent = {
496
496
  IIIFId: string;
497
497
  } | {
498
498
  component: "image";
499
- variant: "default" | "carousel";
500
499
  images: Array<WebImage>;
500
+ variant: "default" | "carousel";
501
+ carouselOptions: {
502
+ secondsPerImage: number | null;
503
+ isFullWidth: boolean | null;
504
+ isFullHeight: boolean | null;
505
+ } | null;
501
506
  imageQuality: "high" | "low";
502
507
  captionSource: "name" | "abbreviation" | "description";
503
508
  captionLayout: "top" | "bottom" | "suppress";
504
509
  altTextSource: "name" | "abbreviation" | "description";
505
- secondsPerImage: number | null;
506
- isFullWidth: boolean | null;
507
- isFullHeight: boolean | null;
508
510
  } | {
509
511
  component: "image-gallery";
510
512
  galleryId: string;
package/dist/index.js CHANGED
@@ -1470,39 +1470,51 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1470
1470
  if (altTextSource === null) {
1471
1471
  altTextSource = "name";
1472
1472
  }
1473
- let secondsPerImage = images.length > 1 ? 5 : null;
1474
- const secondsPerImageProperty = getPropertyValueByLabel(
1475
- componentProperty.properties,
1476
- "seconds-per-image"
1477
- );
1478
- if (secondsPerImageProperty !== null) {
1479
- secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1480
- }
1481
- let isFullWidth = false;
1482
- const isFullWidthProperty = getPropertyValueByLabel(
1483
- componentProperty.properties,
1484
- "is-full-width"
1485
- );
1486
- if (isFullWidthProperty !== null) {
1487
- isFullWidth = isFullWidthProperty === "Yes";
1488
- }
1489
- let isFullHeight = false;
1490
- const isFullHeightProperty = getPropertyValueByLabel(
1491
- componentProperty.properties,
1492
- "is-full-height"
1493
- );
1494
- if (isFullHeightProperty !== null) {
1495
- isFullHeight = isFullHeightProperty === "Yes";
1473
+ let carouselOptions = null;
1474
+ if (images.length > 1) {
1475
+ const variantProperty = getPropertyByLabel(
1476
+ componentProperty.properties,
1477
+ "variant"
1478
+ );
1479
+ let secondsPerImage = 5;
1480
+ let isFullWidth = false;
1481
+ let isFullHeight = false;
1482
+ if (variantProperty && variantProperty.values[0].content === "carousel") {
1483
+ const secondsPerImageProperty = getPropertyValueByLabel(
1484
+ variantProperty.properties,
1485
+ "seconds-per-image"
1486
+ );
1487
+ if (secondsPerImageProperty !== null) {
1488
+ secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1489
+ }
1490
+ const isFullWidthProperty = getPropertyValueByLabel(
1491
+ variantProperty.properties,
1492
+ "is-full-width"
1493
+ );
1494
+ if (isFullWidthProperty !== null) {
1495
+ isFullWidth = isFullWidthProperty === "Yes";
1496
+ }
1497
+ const isFullHeightProperty = getPropertyValueByLabel(
1498
+ variantProperty.properties,
1499
+ "is-full-height"
1500
+ );
1501
+ if (isFullHeightProperty !== null) {
1502
+ isFullHeight = isFullHeightProperty === "Yes";
1503
+ }
1504
+ }
1505
+ carouselOptions = {
1506
+ secondsPerImage,
1507
+ isFullWidth,
1508
+ isFullHeight
1509
+ };
1496
1510
  }
1497
1511
  properties.images = images;
1498
1512
  properties.variant = variant;
1513
+ properties.carouselOptions = carouselOptions;
1499
1514
  properties.imageQuality = imageQuality;
1500
1515
  properties.captionLayout = captionLayout;
1501
1516
  properties.captionSource = captionSource;
1502
1517
  properties.altTextSource = altTextSource;
1503
- properties.secondsPerImage = secondsPerImage;
1504
- properties.isFullWidth = isFullWidth;
1505
- properties.isFullHeight = isFullHeight;
1506
1518
  break;
1507
1519
  }
1508
1520
  case "image-gallery": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",