@canopy-iiif/app 1.10.1 → 1.10.4
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 +1 -1
- package/ui/dist/index.mjs +76 -6
- package/ui/dist/index.mjs.map +3 -3
- package/ui/dist/server.mjs +76 -6
- package/ui/dist/server.mjs.map +2 -2
- package/ui/styles/components/_gallery.scss +31 -9
- package/ui/styles/components/_timeline.scss +52 -10
- package/ui/styles/index.css +80 -19
package/package.json
CHANGED
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 = [
|
|
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;
|
|
@@ -48453,6 +48472,55 @@ var INLINE_SCRIPT = `(() => {
|
|
|
48453
48472
|
emitModalState(previous, 'close');
|
|
48454
48473
|
}
|
|
48455
48474
|
|
|
48475
|
+
function closeModalFromBackground(modal) {
|
|
48476
|
+
if (!modal) return;
|
|
48477
|
+
const closeId = modal.getAttribute('data-canopy-gallery-close');
|
|
48478
|
+
const targetHash = closeId ? '#' + closeId : '';
|
|
48479
|
+
if (targetHash) {
|
|
48480
|
+
if (window.location.hash === targetHash) {
|
|
48481
|
+
try {
|
|
48482
|
+
window.location.hash = targetHash;
|
|
48483
|
+
} catch (_) {}
|
|
48484
|
+
} else {
|
|
48485
|
+
window.location.hash = targetHash;
|
|
48486
|
+
}
|
|
48487
|
+
} else {
|
|
48488
|
+
window.location.hash = '';
|
|
48489
|
+
}
|
|
48490
|
+
}
|
|
48491
|
+
|
|
48492
|
+
function shouldCloseFromBackground(event, modal) {
|
|
48493
|
+
if (!event || !modal) return false;
|
|
48494
|
+
const target = event.target;
|
|
48495
|
+
if (!target) return false;
|
|
48496
|
+
const panel = modal.querySelector('.canopy-gallery__modal-panel');
|
|
48497
|
+
if (panel && panel.contains(target)) return false;
|
|
48498
|
+
const actions = modal.querySelector('.canopy-gallery__modal-actions');
|
|
48499
|
+
if (actions && actions.contains(target)) return false;
|
|
48500
|
+
if (target === modal) return true;
|
|
48501
|
+
const scrim = modal.querySelector('.canopy-gallery__modal-scrim');
|
|
48502
|
+
if (scrim && scrim.contains(target)) return true;
|
|
48503
|
+
return false;
|
|
48504
|
+
}
|
|
48505
|
+
|
|
48506
|
+
function bindModalDismissal(modal) {
|
|
48507
|
+
if (!modal || modal.getAttribute('data-canopy-gallery-dismiss-bound') === '1') {
|
|
48508
|
+
return;
|
|
48509
|
+
}
|
|
48510
|
+
modal.setAttribute('data-canopy-gallery-dismiss-bound', '1');
|
|
48511
|
+
modal.addEventListener('click', function (event) {
|
|
48512
|
+
if (!shouldCloseFromBackground(event, modal)) return;
|
|
48513
|
+
event.preventDefault();
|
|
48514
|
+
closeModalFromBackground(modal);
|
|
48515
|
+
});
|
|
48516
|
+
}
|
|
48517
|
+
|
|
48518
|
+
function bindModalDismissals() {
|
|
48519
|
+
const modals = document.querySelectorAll('[data-canopy-gallery-modal]');
|
|
48520
|
+
if (!modals || !modals.length) return;
|
|
48521
|
+
Array.prototype.forEach.call(modals, bindModalDismissal);
|
|
48522
|
+
}
|
|
48523
|
+
|
|
48456
48524
|
function modalFromHash() {
|
|
48457
48525
|
const id = window.location.hash.replace(/^#/, '');
|
|
48458
48526
|
if (!id) return null;
|
|
@@ -48736,10 +48804,12 @@ var INLINE_SCRIPT = `(() => {
|
|
|
48736
48804
|
window.addEventListener('pageshow', function () {
|
|
48737
48805
|
syncFromHash();
|
|
48738
48806
|
bindGalleryNavs();
|
|
48807
|
+
bindModalDismissals();
|
|
48739
48808
|
refreshGalleryNavs({reveal: true});
|
|
48740
48809
|
});
|
|
48741
48810
|
syncFromHash();
|
|
48742
48811
|
bindGalleryNavs();
|
|
48812
|
+
bindModalDismissals();
|
|
48743
48813
|
refreshGalleryNavs({reveal: true});
|
|
48744
48814
|
})()`;
|
|
48745
48815
|
var galleryInstanceCounter = 0;
|
|
@@ -49107,7 +49177,7 @@ function GalleryItem() {
|
|
|
49107
49177
|
GalleryItem.displayName = "GalleryItem";
|
|
49108
49178
|
function normalizePopupSize(value) {
|
|
49109
49179
|
const normalized = String(value || "full").toLowerCase();
|
|
49110
|
-
return normalized === "
|
|
49180
|
+
return normalized === "window" ? "window" : "full";
|
|
49111
49181
|
}
|
|
49112
49182
|
function Gallery({
|
|
49113
49183
|
children,
|
|
@@ -49131,7 +49201,7 @@ function Gallery({
|
|
|
49131
49201
|
const orderedItems = orderMode === "random" ? shuffleItems(items) : items;
|
|
49132
49202
|
const rootClassName = [
|
|
49133
49203
|
"canopy-gallery",
|
|
49134
|
-
popupMode === "
|
|
49204
|
+
popupMode === "window" ? "canopy-gallery--popup-window" : "canopy-gallery--popup-full",
|
|
49135
49205
|
className
|
|
49136
49206
|
].filter(Boolean).join(" ");
|
|
49137
49207
|
const navGroupName = `${galleryId}-nav`;
|