dbf-mirador 4.3.9 → 4.5.0

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/README.md CHANGED
@@ -66,6 +66,16 @@ for the host page to style, so only use it with that CSS in place:
66
66
  <MapViewer manifestId={manifestUrl} lang="ar" site />
67
67
  ```
68
68
 
69
+ With `site`, `initialView` sets how the map opens. `fill` (the default) fills the view with
70
+ every POI in it; `halfway` then moves halfway from there to the `firstPoi` view (half the zoom,
71
+ with the first POI of the tour half way to where `firstPoi` centres it), and
72
+ `firstPoi` zooms onto it the way the panel focuses on a POI, without selecting it. Only the map
73
+ `MapViewer` opens: a nested map always opens filling the view, as does a map without POIs.
74
+
75
+ ```jsx
76
+ <MapViewer manifestId={manifestUrl} site initialView="halfway" />
77
+ ```
78
+
69
79
  ### Mirador
70
80
 
71
81
  Check the `demo` folder for runnable examples, including `demo/index.html` (raw
@@ -7337,7 +7337,7 @@ function Qe(e, t, n) {
7337
7337
  y: t + ($.y - qe.y) * r
7338
7338
  };
7339
7339
  }
7340
- var $e = class {
7340
+ var $e = (e) => Number.isFinite(e) && e > 0 ? 2 ** Math.round(Math.log2(e)) : 1, et = class {
7341
7341
  constructor({ resource: e, palette: t, zoomRatio: n, offset: r, selected: i, hovered: a, journeyStopNumber: o, lineStyle: s = null }) {
7342
7342
  this.resource = e, this.lineStyle = s, this.journeyStopNumber = o, this.palette = t, this.zoomRatio = n, this.offset = r, this.selected = i, this.hovered = a;
7343
7343
  }
@@ -7393,7 +7393,10 @@ var $e = class {
7393
7393
  n.getAttribute(e) && (this.context[a[e]] = n.getAttribute(e));
7394
7394
  }), this.context.lineWidth /= this.zoomRatio, (this.selected || this.hovered) && (this.context.strokeStyle = e.strokeStyle || e.fillStyle), t) {
7395
7395
  let { lineDash: e, lineWidth: n, strokeStyle: r } = t;
7396
- r && (this.context.strokeStyle = r), n && (this.context.lineWidth = n / this.zoomRatio), e && this.context.setLineDash(e.map((e) => e / this.zoomRatio));
7396
+ if (r && (this.context.strokeStyle = r), n && (this.context.lineWidth = n / this.zoomRatio), e) {
7397
+ let t = $e(this.zoomRatio);
7398
+ this.context.setLineDash(e.map((e) => e / t));
7399
+ }
7397
7400
  }
7398
7401
  this.context.globalAlpha = e.globalAlpha, n.getAttribute("fill") && n.getAttribute("fill") !== "none" && (n.getAttribute("fill-opacity") && (this.context.globalAlpha = e.globalAlpha * this.parseOpacity(n.getAttribute("fill-opacity"))), this.context.fill(i)), n.getAttribute("stroke-opacity") ? this.context.globalAlpha = e.globalAlpha * this.parseOpacity(n.getAttribute("stroke-opacity")) : this.context.globalAlpha = e.globalAlpha, this.context.stroke(i), this.context.restore();
7399
7402
  });
@@ -7413,10 +7416,10 @@ var $e = class {
7413
7416
  };
7414
7417
  //#endregion
7415
7418
  //#region src/components/AnnotationsOverlay.jsx
7416
- function et({ canvasWorld: e, osdCanvasOverlay: t, viewer: n }, r, i, a) {
7419
+ function tt({ canvasWorld: e, osdCanvasOverlay: t, viewer: n }, r, i, a) {
7417
7420
  let [o, s] = e.canvasToWorldCoordinates(i.id), c = a.x - o, l = a.y - s;
7418
7421
  if (r.svgSelector) {
7419
- let e = t.context2d, { svgPaths: n } = new $e({ resource: r });
7422
+ let e = t.context2d, { svgPaths: n } = new et({ resource: r });
7420
7423
  return [...n].some((t) => e.isPointInPath(ze(t), c, l));
7421
7424
  }
7422
7425
  if (r.pointSelector) {
@@ -7431,17 +7434,17 @@ function et({ canvasWorld: e, osdCanvasOverlay: t, viewer: n }, r, i, a) {
7431
7434
  }
7432
7435
  return !1;
7433
7436
  }
7434
- function tt(e) {
7437
+ function nt(e) {
7435
7438
  let t = e.originalEvent?.pointerType;
7436
7439
  return (t === "touch" || t === "pen") && e.quick === !1;
7437
7440
  }
7438
- function nt(e) {
7441
+ function rt(e) {
7439
7442
  let t = /* @__PURE__ */ new Map();
7440
7443
  return Object.values((0, Ne.default)(e.filter((e) => e.journeyId != null), (e) => e.journeyId)).forEach((e) => {
7441
7444
  (0, Ie.default)(e, (e) => e.journeyOrder).forEach((e, n) => t.set(e.id, n + 1));
7442
7445
  }), t;
7443
7446
  }
7444
- function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () => {}, drawAnnotations: r = !0, drawSearchAnnotations: i = !0, highlightAllAnnotations: a = !1, hoverAnnotation: o = () => {}, hoveredAnnotationIds: s = [], lineStyle: c = null, palette: l = {}, searchAnnotations: u = [], selectAnnotation: d = () => {}, selectedAnnotationId: f = null, viewer: p = null, windowId: m }) {
7447
+ function it({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () => {}, drawAnnotations: r = !0, drawSearchAnnotations: i = !0, highlightAllAnnotations: a = !1, hoverAnnotation: o = () => {}, hoveredAnnotationIds: s = [], lineStyle: c = null, palette: l = {}, searchAnnotations: u = [], selectAnnotation: d = () => {}, selectedAnnotationId: f = null, viewer: p = null, windowId: m }) {
7445
7448
  let h = Y(), g = J(() => new Re(p, h), [h, p]), _ = G((e) => {
7446
7449
  f === e ? n(m, e) : d(m, e);
7447
7450
  }, [
@@ -7450,7 +7453,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7450
7453
  d,
7451
7454
  m
7452
7455
  ]), v = G((e, n) => {
7453
- let r = g.context2d, i = e.flatMap((e) => e.resources), [o, l] = (0, Fe.default)(i, (e) => !e.pointSelector), [u, d] = (0, Fe.default)(l, (e) => e.id !== f), m = nt(l);
7456
+ let r = g.context2d, i = e.flatMap((e) => e.resources), [o, l] = (0, Fe.default)(i, (e) => !e.pointSelector), [u, d] = (0, Fe.default)(l, (e) => e.id !== f), m = rt(l);
7454
7457
  [
7455
7458
  ...o,
7456
7459
  ...u,
@@ -7461,7 +7464,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7461
7464
  let o = p.world.getItemAt(i);
7462
7465
  if (!o) return;
7463
7466
  let l = t.offsetByCanvas(e.targetId), u = o.viewportToImageZoom(p.viewport.getZoom(!0));
7464
- new $e({
7467
+ new et({
7465
7468
  hovered: s.includes(e.id),
7466
7469
  journeyStopNumber: m.get(e.id),
7467
7470
  lineStyle: c,
@@ -7497,7 +7500,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7497
7500
  u
7498
7501
  ]), b = G(() => {
7499
7502
  g && (g.clear(), g.resize(), g.canvasUpdate(y));
7500
- }, [g, y]), x = G((n, r) => [...e, ...u].flatMap((e) => e.resources).filter((e) => n.id === e.targetId && et({
7503
+ }, [g, y]), x = G((n, r) => [...e, ...u].flatMap((e) => e.resources).filter((e) => n.id === e.targetId && tt({
7501
7504
  canvasWorld: t,
7502
7505
  osdCanvasOverlay: g,
7503
7506
  viewer: p
@@ -7508,7 +7511,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7508
7511
  u,
7509
7512
  p
7510
7513
  ]), S = G((e) => {
7511
- if (tt(e)) return;
7514
+ if (nt(e)) return;
7512
7515
  let { position: n, eventSource: { viewport: r } } = e, i = r.pointFromPixel(n), a = t.canvasAtPoint(i);
7513
7516
  if (!a) return;
7514
7517
  let [o, s, c, l] = t.canvasToWorldCoordinates(a.id), u = x(a, i);
@@ -7522,7 +7525,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7522
7525
  let o = 0;
7523
7526
  for (let s = 0; s < 360; s += 1) {
7524
7527
  let c = Math.cos(s * n) * e + i.x, l = Math.sin(s * n) * e + i.y;
7525
- et({
7528
+ tt({
7526
7529
  canvasWorld: t,
7527
7530
  osdCanvasOverlay: g,
7528
7531
  viewer: p
@@ -7608,7 +7611,7 @@ function rt({ annotations: e = [], canvasWorld: t, deselectAnnotation: n = () =>
7608
7611
  children: /* @__PURE__ */ X("canvas", {})
7609
7612
  }), p.canvas) : null;
7610
7613
  }
7611
- rt.propTypes = {
7614
+ it.propTypes = {
7612
7615
  annotations: Z.default.arrayOf(Z.default.object),
7613
7616
  canvasWorld: Z.default.instanceOf(z).isRequired,
7614
7617
  deselectAnnotation: Z.default.func,
@@ -7632,7 +7635,7 @@ rt.propTypes = {
7632
7635
  };
7633
7636
  //#endregion
7634
7637
  //#region src/components/ImageFailureMessage.jsx
7635
- var it = _e(be)(({ theme: e }) => ({
7638
+ var at = _e(be)(({ theme: e }) => ({
7636
7639
  position: "absolute",
7637
7640
  top: e.spacing(2),
7638
7641
  left: "50%",
@@ -7644,9 +7647,9 @@ var it = _e(be)(({ theme: e }) => ({
7644
7647
  zIndex: 1e3,
7645
7648
  pointerEvents: "none"
7646
7649
  }));
7647
- function at({ imageUrls: e = [] }) {
7650
+ function ot({ imageUrls: e = [] }) {
7648
7651
  let { failedImages: t } = K(F), { t: n } = ge();
7649
- return e.some((e) => t.has(e)) ? /* @__PURE__ */ X(it, {
7652
+ return e.some((e) => t.has(e)) ? /* @__PURE__ */ X(at, {
7650
7653
  role: "status",
7651
7654
  "aria-live": "polite",
7652
7655
  children: /* @__PURE__ */ X(ve, {
@@ -7655,8 +7658,8 @@ function at({ imageUrls: e = [] }) {
7655
7658
  })
7656
7659
  }) : null;
7657
7660
  }
7658
- at.propTypes = { imageUrls: Z.default.arrayOf(Z.default.string) };
7659
- var ot = i(h((e, { windowId: t }) => ({
7661
+ ot.propTypes = { imageUrls: Z.default.arrayOf(Z.default.string) };
7662
+ var st = i(h((e, { windowId: t }) => ({
7660
7663
  annotations: re(e, { windowId: t }),
7661
7664
  canvasWorld: xe(e, { windowId: t }),
7662
7665
  drawAnnotations: O(e).window.forceDrawAnnotations || _(e, {
@@ -7676,7 +7679,7 @@ var ot = i(h((e, { windowId: t }) => ({
7676
7679
  deselectAnnotation: N,
7677
7680
  hoverAnnotation: P,
7678
7681
  selectAnnotation: ie
7679
- }), d("AnnotationsOverlay"))(rt), st = {
7682
+ }), d("AnnotationsOverlay"))(it), ct = {
7680
7683
  get(e) {
7681
7684
  return this.refs[e];
7682
7685
  },
@@ -7687,10 +7690,10 @@ var ot = i(h((e, { windowId: t }) => ({
7687
7690
  set(e, t) {
7688
7691
  this.refs[e] = t;
7689
7692
  }
7690
- }, ct = de(void 0);
7693
+ }, lt = de(void 0);
7691
7694
  //#endregion
7692
7695
  //#region src/components/OpenSeadragonComponent.jsx
7693
- function lt({ children: e = void 0, Container: t = "div", osdConfig: n = {}, viewerConfig: r = {}, onUpdateViewport: i = () => {}, setViewer: a = () => {}, style: o = {}, ...s }) {
7696
+ function ut({ children: e = void 0, Container: t = "div", osdConfig: n = {}, viewerConfig: r = {}, onUpdateViewport: i = () => {}, setViewer: a = () => {}, style: o = {}, ...s }) {
7694
7697
  let c = fe(), l = Y(), [u, d] = me(!1), f = Y(void 0), p = Y(!1), m = Y(null), h = Y(!1), [, g] = pe((e) => e + 1, 0), _ = B(G((e) => {
7695
7698
  f.current?.raiseEvent("mouse-move", e);
7696
7699
  }, [f]), 10), v = G((e) => {
@@ -7755,7 +7758,7 @@ function lt({ children: e = void 0, Container: t = "div", osdConfig: n = {}, vie
7755
7758
  f?.current?.canvas?.firstElementChild,
7756
7759
  c,
7757
7760
  b
7758
- ]), /* @__PURE__ */ X(ct.Provider, {
7761
+ ]), /* @__PURE__ */ X(lt.Provider, {
7759
7762
  value: f,
7760
7763
  children: /* @__PURE__ */ X(t, {
7761
7764
  id: c,
@@ -7769,7 +7772,7 @@ function lt({ children: e = void 0, Container: t = "div", osdConfig: n = {}, vie
7769
7772
  })
7770
7773
  });
7771
7774
  }
7772
- lt.propTypes = {
7775
+ ut.propTypes = {
7773
7776
  children: Z.default.node,
7774
7777
  Container: Z.default.elementType,
7775
7778
  onUpdateViewport: Z.default.func,
@@ -7787,8 +7790,8 @@ lt.propTypes = {
7787
7790
  };
7788
7791
  //#endregion
7789
7792
  //#region src/components/OpenSeadragonTileSource.jsx
7790
- function ut({ index: e = void 0, opacity: t = void 0, fitBounds: n = void 0, tileSource: r = {}, url: i = void 0 }) {
7791
- let a = K(ct), { notifyFailure: o, fallbackImage: s } = K(F), c = Y(void 0);
7793
+ function dt({ index: e = void 0, opacity: t = void 0, fitBounds: n = void 0, tileSource: r = {}, url: i = void 0 }) {
7794
+ let a = K(lt), { notifyFailure: o, fallbackImage: s } = K(F), c = Y(void 0);
7792
7795
  return q(() => {
7793
7796
  t != null && c.current?.setOpacity(t);
7794
7797
  }, [t]), q(() => {
@@ -7836,7 +7839,7 @@ function ut({ index: e = void 0, opacity: t = void 0, fitBounds: n = void 0, til
7836
7839
  });
7837
7840
  }, [a?.current, i]), null;
7838
7841
  }
7839
- ut.propTypes = {
7842
+ dt.propTypes = {
7840
7843
  fitBounds: Z.default.arrayOf(Z.default.number),
7841
7844
  index: Z.default.number,
7842
7845
  opacity: Z.default.number,
@@ -7845,12 +7848,12 @@ ut.propTypes = {
7845
7848
  };
7846
7849
  //#endregion
7847
7850
  //#region src/components/OpenSeadragonViewer.jsx
7848
- var dt = _e("section")({
7851
+ var ft = _e("section")({
7849
7852
  cursor: "grab",
7850
7853
  flex: 1,
7851
7854
  position: "relative"
7852
7855
  });
7853
- function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {}, viewerConfig: i = null, drawAnnotations: a = !1, infoResponses: o = [], canvasWorld: s, nonTiledImages: c = [], site: l = !1, updateViewport: u, ...d }) {
7856
+ function pt({ children: e = null, label: t = null, windowId: n, osdConfig: r = {}, viewerConfig: i = null, drawAnnotations: a = !1, infoResponses: o = [], canvasWorld: s, nonTiledImages: c = [], site: l = !1, updateViewport: u, ...d }) {
7854
7857
  let { t: f } = ge(), p = Y(), [m, h] = me(null), g = G(({ flip: e, rotation: t, x: r, y: i, zoom: a }) => {
7855
7858
  u(n, {
7856
7859
  flip: e,
@@ -7862,7 +7865,7 @@ function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {
7862
7865
  }, [u, n]), _ = G((e = !0) => {
7863
7866
  p.current?.viewport && p.current.viewport.fitBounds(new Q.default.Rect(...s.worldBounds()), e);
7864
7867
  }, [s, p]);
7865
- q(() => (st.set(n, p), () => st.remove(n)), [p, n]), q(() => {
7868
+ q(() => (ct.set(n, p), () => ct.remove(n)), [p, n]), q(() => {
7866
7869
  p.current = m;
7867
7870
  }, [p, m]);
7868
7871
  let v = W.map(e, (e) => ue(e, { zoomToWorld: _ })), y = {
@@ -7878,9 +7881,9 @@ function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {
7878
7881
  windowId: n,
7879
7882
  ...d
7880
7883
  }, b = J(() => [...o.map((e) => e.id), ...c.map((e) => e.id)], [o, c]);
7881
- return /* @__PURE__ */ he(lt, {
7884
+ return /* @__PURE__ */ he(ut, {
7882
7885
  className: (0, Pe.default)(le("osd-container")),
7883
- Container: dt,
7886
+ Container: ft,
7884
7887
  osdConfig: r,
7885
7888
  viewerConfig: i || (s.hasDimensions() ? { bounds: s.worldBounds() } : void 0),
7886
7889
  onUpdateViewport: g,
@@ -7892,7 +7895,7 @@ function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {
7892
7895
  let t = s.contentResource(e.id);
7893
7896
  if (!t) return null;
7894
7897
  let n = s.contentResourceToWorldCoordinates(t), r = s.layerIndexOfImageResource(t), i = s.layerOpacityOfImageResource(t);
7895
- return /* @__PURE__ */ X(ut, {
7898
+ return /* @__PURE__ */ X(dt, {
7896
7899
  tileSource: e.json,
7897
7900
  fitBounds: n,
7898
7901
  index: r,
@@ -7903,19 +7906,19 @@ function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {
7903
7906
  let t = e.getProperty("type"), n = e.getProperty("format") || "";
7904
7907
  if (!(t === "Image" || t === "dctypes:Image" || n.startsWith("image/"))) return null;
7905
7908
  let r = s.contentResourceToWorldCoordinates(e), i = s.layerIndexOfImageResource(e), a = s.layerOpacityOfImageResource(e);
7906
- return /* @__PURE__ */ X(ut, {
7909
+ return /* @__PURE__ */ X(dt, {
7907
7910
  url: e.id,
7908
7911
  fitBounds: r,
7909
7912
  index: i,
7910
7913
  opacity: a
7911
7914
  }, e.id);
7912
7915
  }),
7913
- a && /* @__PURE__ */ X(ot, {
7916
+ a && /* @__PURE__ */ X(st, {
7914
7917
  viewer: m,
7915
7918
  windowId: n
7916
7919
  }),
7917
7920
  v,
7918
- /* @__PURE__ */ X(at, { imageUrls: b }),
7921
+ /* @__PURE__ */ X(ot, { imageUrls: b }),
7919
7922
  /* @__PURE__ */ X(U, {
7920
7923
  targetName: "OpenSeadragonViewer",
7921
7924
  viewer: m,
@@ -7924,7 +7927,7 @@ function ft({ children: e = null, label: t = null, windowId: n, osdConfig: r = {
7924
7927
  ]
7925
7928
  });
7926
7929
  }
7927
- ft.propTypes = {
7930
+ pt.propTypes = {
7928
7931
  site: Z.default.bool,
7929
7932
  canvasWorld: Z.default.instanceOf(z).isRequired,
7930
7933
  children: Z.default.node,
@@ -7939,7 +7942,7 @@ ft.propTypes = {
7939
7942
  };
7940
7943
  //#endregion
7941
7944
  //#region src/containers/OpenSeadragonViewer.js
7942
- var pt = /* @__PURE__ */ l({ default: () => mt }), mt = i(h((e, { windowId: t }) => {
7945
+ var mt = /* @__PURE__ */ l({ default: () => ht }), ht = i(h((e, { windowId: t }) => {
7943
7946
  let n = xe(e, { windowId: t }), r = j(e), i = n.canvases.flatMap((e) => e.imageServiceIds);
7944
7947
  return {
7945
7948
  canvasWorld: n,
@@ -7960,8 +7963,8 @@ var pt = /* @__PURE__ */ l({ default: () => mt }), mt = i(h((e, { windowId: t })
7960
7963
  site: O(e).maps?.site === !0,
7961
7964
  viewerConfig: f(e, { windowId: t })
7962
7965
  };
7963
- }, { updateViewport: V }), d("OpenSeadragonViewer"))(ft);
7966
+ }, { updateViewport: V }), d("OpenSeadragonViewer"))(pt);
7964
7967
  //#endregion
7965
- export { ot as a, nt as c, Me as d, xe as f, st as i, $e as l, pt as n, at as o, ft as r, rt as s, mt as t, Re as u };
7968
+ export { st as a, rt as c, Me as d, xe as f, ct as i, et as l, mt as n, ot as o, pt as r, it as s, ht as t, Re as u };
7966
7969
 
7967
- //# sourceMappingURL=OpenSeadragonViewer-Dm_GZoQ8.js.map
7970
+ //# sourceMappingURL=OpenSeadragonViewer-DDT-hCCn.js.map