@readium/speech 0.12.0 → 0.13.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.
@@ -1,6 +1,7 @@
1
1
  import { Locator } from '@readium/shared';
2
2
  import { DomRangeJSON } from '@readium/guided-navigation';
3
3
  export interface LocatorOptions {
4
+ href?: string;
4
5
  text?: {
5
6
  highlight?: string;
6
7
  before?: string;
package/build/index.js CHANGED
@@ -2863,17 +2863,17 @@ function $s(n) {
2863
2863
  });
2864
2864
  }
2865
2865
  function Gs(n, e = window) {
2866
- const { text: t, cssSelector: s, domRange: i, fragment: a } = n, r = t ? new bn(t) : void 0, o = s || i ? /* @__PURE__ */ new Map() : void 0;
2867
- o && (s && o.set("cssSelector", s), i && o.set("domRange", $s(i).serialize()));
2868
- const c = o !== void 0 || a !== void 0 ? new wn({
2869
- fragments: a ? [a] : void 0,
2870
- otherLocations: o
2866
+ const { href: t, text: s, cssSelector: i, domRange: a, fragment: r } = n, o = s ? new bn(s) : void 0, l = i || a ? /* @__PURE__ */ new Map() : void 0;
2867
+ l && (i && l.set("cssSelector", i), a && l.set("domRange", $s(a).serialize()));
2868
+ const u = l !== void 0 || r !== void 0 ? new wn({
2869
+ fragments: r ? [r] : void 0,
2870
+ otherLocations: l
2871
2871
  }) : void 0;
2872
2872
  return new kn({
2873
- href: e.location.href,
2873
+ href: t ?? e.location.href,
2874
2874
  type: "text/html",
2875
- text: r,
2876
- locations: c
2875
+ text: o,
2876
+ locations: u
2877
2877
  });
2878
2878
  }
2879
2879
  class Ks extends vn {
@@ -3799,7 +3799,9 @@ function $e(n) {
3799
3799
  }
3800
3800
  function H(n, e) {
3801
3801
  const t = n.cssSelector ?? n.domRange?.start.cssSelector;
3802
- return t ? { cssSelector: t, text: { highlight: e } } : { ...n, text: { highlight: e } };
3802
+ if (!t) return { ...n, text: { highlight: e } };
3803
+ const s = { cssSelector: t, text: { highlight: e } };
3804
+ return n.href !== void 0 && (s.href = n.href), s;
3803
3805
  }
3804
3806
  function A(n, e) {
3805
3807
  const t = Xe(n);
@@ -3976,9 +3978,11 @@ function pe(n) {
3976
3978
  return { joined: e, ranges: t };
3977
3979
  }
3978
3980
  function Ce(n, e) {
3979
- const t = Rn(n);
3980
- if (t) return St({ cssSelector: t });
3981
- const s = A(n, e.ancestorChains)?.ref;
3981
+ const t = Rn(n), s = A(n, e.ancestorChains)?.ref;
3982
+ if (t) {
3983
+ const i = { cssSelector: t };
3984
+ return s?.href !== void 0 && (i.href = s.href), St(i);
3985
+ }
3982
3986
  return s && St(s);
3983
3987
  }
3984
3988
  function Ni(n, e, t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/speech",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "A TypeScript library for implementing read aloud features with Web technologies, following best practices for digital publishing.",
5
5
  "author": "Readium Foundation",
6
6
  "keywords": [
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@readium/decorator": "^1.2.5",
65
- "@readium/guided-navigation": "^1.0.1",
65
+ "@readium/guided-navigation": "^1.1.0",
66
66
  "@readium/helpers": "^1.2.0",
67
67
  "@readium/shared": "^2.7.0",
68
68
  "i18next": "^26.4.0"