@recogito/text-annotator 3.4.6 → 3.4.8

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.
@@ -2,6 +2,7 @@ export * from './canvas';
2
2
  export * from './highlights';
3
3
  export * from './span';
4
4
  export * from './Highlight';
5
- export * from './HighlightStyle';
6
5
  export * from './HighlightPainter';
6
+ export * from './HighlightStyle';
7
7
  export * from './Renderer';
8
+ export * from './viewport';
@@ -1 +1,2 @@
1
+ export * from './color';
1
2
  export * from './spansRenderer';
@@ -403,10 +403,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
403
403
  }), t = f;
404
404
  }
405
405
  };
406
- }, it = (e, t, n) => se(e, t, n, rt()), at = (e, t, n, r, s) => {
406
+ }, it = (e, t, n) => se(e, t, n, rt()), at = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), ct = (e, t, n, r, s) => {
407
407
  const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ? J : _) : n : e.state?.selected ? J : _;
408
408
  return r && r.paint(e, t) || o;
409
- }, ct = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), lt = (e, t) => {
409
+ }, lt = (e, t) => {
410
410
  const n = (o, i) => o.x <= i.x + i.width && o.x + o.width >= i.x && o.y <= i.y + i.height && o.y + o.height >= i.y, r = (o) => o.rects.reduce((i, c) => i + c.width, 0), s = t.filter(({ rects: o }) => o.some((i) => n(e, i)));
411
411
  return s.sort((o, i) => r(i) - r(o)), s.findIndex((o) => o.rects.includes(e));
412
412
  }, dt = (e) => {
@@ -426,10 +426,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
426
426
  return R && b ? R.getTime() - b.getTime() : 0;
427
427
  }).forEach((g) => {
428
428
  g.rects.map((x) => {
429
- const R = lt(x, i), b = at(g, c, l, f, R);
429
+ const R = lt(x, i), b = ct(g, c, l, f, R);
430
430
  if (y) {
431
431
  const p = document.createElement("span");
432
- p.className = "r6o-annotation", p.dataset.annotation = g.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor = ct(b), b.underlineStyle && (p.style.borderStyle = b.underlineStyle), b.underlineColor && (p.style.borderColor = b.underlineColor), b.underlineThickness && (p.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (p.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(p);
432
+ p.className = "r6o-annotation", p.dataset.annotation = g.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor = at(b), b.underlineStyle && (p.style.borderStyle = b.underlineStyle), b.underlineColor && (p.style.borderColor = b.underlineColor), b.underlineThickness && (p.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (p.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(p);
433
433
  }
434
434
  });
435
435
  }), n = i;
@@ -944,9 +944,11 @@ export {
944
944
  Ut as createTextAnnotator,
945
945
  Et as createTextAnnotatorState,
946
946
  At as fillDefaults,
947
+ at as getBackgroundColor,
947
948
  Ue as getHighlightClientRects,
948
949
  Fe as getQuoteContext,
949
950
  oe as getRangeAnnotatableContents,
951
+ Ze as getViewportBounds,
950
952
  ue as isMac,
951
953
  _t as isNodeWhitespaceOrEmpty,
952
954
  Q as isNotAnnotatable,
@@ -955,7 +957,7 @@ export {
955
957
  I as isRevived,
956
958
  Xe as mergeClientRects,
957
959
  ze as mergeRanges,
958
- at as paint,
960
+ ct as paint,
959
961
  mt as parseW3CTextAnnotation,
960
962
  De as programmaticallyFocusable,
961
963
  qe as rangeToSelector,
@@ -968,6 +970,7 @@ export {
968
970
  Ht as toDomRectList,
969
971
  je as toParentBounds,
970
972
  Pt as toViewportBounds,
973
+ Je as trackViewport,
971
974
  Ge as trimRangeToContainer,
972
975
  fe as whitespaceOrEmptyRegex
973
976
  };