@canopy-iiif/app 1.10.1 → 1.10.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",
package/ui/dist/index.mjs CHANGED
@@ -46547,6 +46547,15 @@ function ReferencedManifestCard({
46547
46547
  var DAY_MS = 24 * 60 * 60 * 1e3;
46548
46548
  var DEFAULT_TRACK_HEIGHT = 640;
46549
46549
  var MIN_HEIGHT_PER_POINT = 220;
46550
+ var SCALE_MODES = {
46551
+ TIME: "time",
46552
+ UNIFORM: "uniform"
46553
+ };
46554
+ var ALIGN_OPTIONS = {
46555
+ CENTER: "center",
46556
+ LEFT: "left",
46557
+ RIGHT: "right"
46558
+ };
46550
46559
  function getThresholdMs(threshold, granularity) {
46551
46560
  const value = Number(threshold);
46552
46561
  if (!Number.isFinite(value) || value <= 0) return 0;
@@ -46736,6 +46745,8 @@ function Timeline({
46736
46745
  locale: localeProp = "en-US",
46737
46746
  height = DEFAULT_TRACK_HEIGHT,
46738
46747
  threshold: thresholdProp = null,
46748
+ scale: scale2 = SCALE_MODES.TIME,
46749
+ align = ALIGN_OPTIONS.CENTER,
46739
46750
  steps = null,
46740
46751
  points: pointsProp,
46741
46752
  __canopyTimeline: payload = null,
@@ -46770,20 +46781,24 @@ function Timeline({
46770
46781
  );
46771
46782
  const spanStart = effectiveRange.startDate.getTime();
46772
46783
  const span = effectiveRange.span;
46784
+ const scaleValue = scale2 === SCALE_MODES.UNIFORM ? SCALE_MODES.UNIFORM : SCALE_MODES.TIME;
46785
+ const useUniformSpacing = scaleValue === SCALE_MODES.UNIFORM;
46786
+ const alignValue = align === ALIGN_OPTIONS.LEFT ? ALIGN_OPTIONS.LEFT : align === ALIGN_OPTIONS.RIGHT ? ALIGN_OPTIONS.RIGHT : ALIGN_OPTIONS.CENTER;
46787
+ const enforcedSide = alignValue === ALIGN_OPTIONS.LEFT ? "right" : alignValue === ALIGN_OPTIONS.RIGHT ? "left" : null;
46773
46788
  const pointsWithPosition = React41.useMemo(() => {
46774
46789
  if (!sanitizedPoints.length) return [];
46775
46790
  return sanitizedPoints.map((point2, index) => {
46776
46791
  const timestamp = point2.meta.timestamp;
46777
46792
  const fallbackProgress = sanitizedPoints.length > 1 ? index / (sanitizedPoints.length - 1) : 0;
46778
- const progress = Number.isFinite(timestamp) ? clampProgress((timestamp - spanStart) / span) : fallbackProgress;
46779
- const side = point2.side || (index % 2 === 0 ? "left" : "right");
46793
+ const progress = useUniformSpacing ? fallbackProgress : Number.isFinite(timestamp) ? clampProgress((timestamp - spanStart) / span) : fallbackProgress;
46794
+ const side = enforcedSide || point2.side || (index % 2 === 0 ? "left" : "right");
46780
46795
  return {
46781
46796
  ...point2,
46782
46797
  progress,
46783
46798
  side
46784
46799
  };
46785
46800
  });
46786
- }, [sanitizedPoints, spanStart, span]);
46801
+ }, [sanitizedPoints, spanStart, span, useUniformSpacing, enforcedSide]);
46787
46802
  const [activeId, setActiveId] = React41.useState(
46788
46803
  () => getActivePointId(pointsWithPosition)
46789
46804
  );
@@ -46830,7 +46845,11 @@ function Timeline({
46830
46845
  });
46831
46846
  }, []);
46832
46847
  const trackHeight = resolveTrackHeight(height, pointsWithPosition.length);
46833
- const containerClasses = ["canopy-timeline", className].filter(Boolean).join(" ");
46848
+ const containerClasses = [
46849
+ "canopy-timeline",
46850
+ alignValue ? `canopy-timeline--align-${alignValue}` : "",
46851
+ className
46852
+ ].filter(Boolean).join(" ");
46834
46853
  const rangeLabel = formatRangeLabel(effectiveRange);
46835
46854
  function renderPointEntry(point2) {
46836
46855
  if (!point2) return null;