@readium/shared 2.6.0 → 2.7.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/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{EmptyFetcher as o}from"./fetcher/Fetcher.js";import{HttpFetcher as i,HttpResource as a}from"./fetcher/HttpFetcher.js";import{NumberRange as n,Resource as p}from"./fetcher/Resource.js";import{AccessMode as x,Accessibility as l,AccessibilityProfile as s,Certification as g,Exemption as c,Feature as d,Hazard as u,PrimaryAccessMode as T}from"./publication/accessibility/Accessibility.js";import{AccessibilityMetadataDisplayGuide as y,AccessibilitySummary as C,AdditionalInformation as A,Conformance as P,HazardType as L,Hazards as N,Legal as S,Navigation as I,NonvisualReading as O,PrerecordedAudio as R,RichContent as v,RichContentType as E,VisualAdjustments as H,WaysOfReading as M}from"./publication/accessibility/AccessibilityMetadataDisplayGuide.js";import{Localization as k}from"./publication/accessibility/Localization.js";import{Encryption as F}from"./publication/encryption/Encryption.js";import{getEncryption as J}from"./publication/encryption/Properties.js";import{MediaOverlay as G}from"./publication/epub/MediaOverlay.js";import{getMediaOverlay as q}from"./publication/epub/Metadata.js";import{getContains as U}from"./publication/epub/Properties.js";import{getLandmarks as Q,getListOfAudioClips as W,getListOfIllustrations as w,getListOfTables as X,getListOfVideoClips as Y,getPageList as Z}from"./publication/epub/Publication.js";import{DomRange as $}from"./publication/html/DomRange.js";import{DomRangePoint as te}from"./publication/html/DomRangePoint.js";import{getCssSelector as re,getDomRange as ie,getFragmentParameters as ae,getHtmlId as me,getPage as ne,getPartialCfi as pe,getSpace as fe,getTextFragment as xe,getTime as le}from"./publication/html/Locations.js";import{getAuthenticate as ge,getAvailability as ce,getCopies as de,getHolds as ue,getIndirectAcquisitions as Te,getNumberOfItems as be,getPrice as ye}from"./publication/opds/Properties.js";import{getImages as Ae}from"./publication/opds/Publication.js";import{buildHtmlTimeline as Le}from"./publication/services/timeline/html.js";import{buildAudioTimeline as Se}from"./publication/services/timeline/audio.js";import{Timeline as Oe}from"./publication/services/timeline/Timeline.js";import{buildTimeline as ve}from"./publication/services/timeline/index.js";import{Content as He}from"./publication/services/content/Content.js";import{TextContentTokenizer as De}from"./publication/services/content/ContentTokenizer.js";import{IllegalStateError as ze,Iterator as Fe}from"./publication/services/content/Iterator.js";import{AudioElement as Je,ContentElement as je,ImageElement as Ge,TextElement as Ve,TextSegment as qe,TextualElement as Be,VideoElement as Ue}from"./publication/services/content/element/element.js";import{Attribute as Qe,AttributeKeys as We,AttributesHolder as we}from"./publication/services/content/element/attributes.js";import{Body as Ye,Footnote as Ze,Heading as _e,TextQuote as $e}from"./publication/services/content/element/text_role.js";import{PublicationContentIterator as tt}from"./publication/services/content/iterators/PublicationContentIterator.js";import{PDFContentElement as rt,PageContentIteratorPDF as it}from"./publication/services/content/iterators/PDFTextContentIterator.js";import{HTMLResourceContentIterator as mt}from"./publication/services/content/iterators/HTMLResourceContentIterator.js";import{AltIdentifier as pt}from"./publication/AltIdentifier.js";import{BelongsTo as xt}from"./publication/BelongsTo.js";import{Contributor as st,Contributors as gt}from"./publication/Contributor.js";import{Link as dt,Links as ut}from"./publication/Link.js";import{LocalizedString as bt}from"./publication/LocalizedString.js";import{Locator as Ct,LocatorLocations as At,LocatorText as Pt}from"./publication/Locator.js";import{LocatorCollection as Nt,LocatorCollectionMetadata as St}from"./publication/LocatorCollection.js";import{Manifest as Ot}from"./publication/Manifest.js";import{Metadata as vt}from"./publication/Metadata.js";import{Profile as Ht}from"./publication/Profiles.js";import{Page as Dt,Properties as kt}from"./publication/Properties.js";import{Publication as Ft}from"./publication/Publication.js";import{PublicationCollection as Jt}from"./publication/PublicationCollection.js";import{Layout as Gt}from"./publication/Layout.js";import{ReadingProgression as qt,leadingPage as Bt}from"./publication/ReadingProgression.js";import{Subject as Kt,Subjects as Qt}from"./publication/Subject.js";import{TDM as wt,TDMReservation as Xt}from"./publication/TDM.js";import{GuidedNavigationDocument as Zt,GuidedNavigationObject as _t,GuidedNavigationText as $t}from"./publication/GuidedNavigation.js";import{Price as to}from"./opds/Price.js";import{Acquisition as ro}from"./opds/Acquisition.js";import{Holds as ao}from"./opds/Holds.js";import{Copies as no}from"./opds/Copies.js";import{Availability as fo,AvailabilityStatus as xo}from"./opds/Availability.js";import{MediaType as so}from"./util/mediatype/MediaType.js";import{arrayfromJSON as co,arrayfromJSONorString as uo,datefromJSON as To,numberfromJSON as bo,positiveNumberfromJSON as yo,setToArray as Co}from"./util/JSONParse.js";import{formatNptTime as Po,isNptStartOfResource as Lo,parseNptTime as No}from"./util/npt.js";import{URITemplate as Io}from"./util/URITemplate.js";import{DefaultTextContentTokenizer as Ro,IntlTextTokenizer as vo,NaiveTextTokenizer as Eo,TextUnit as Ho,speakableToken as Mo}from"./util/tokenizer/TextTokenizer.js";export{x as AccessMode,l as Accessibility,y as AccessibilityMetadataDisplayGuide,s as AccessibilityProfile,C as AccessibilitySummary,ro as Acquisition,A as AdditionalInformation,pt as AltIdentifier,Qe as Attribute,We as AttributeKeys,we as AttributesHolder,Je as AudioElement,fo as Availability,xo as AvailabilityStatus,xt as BelongsTo,Ye as Body,g as Certification,P as Conformance,He as Content,je as ContentElement,st as Contributor,gt as Contributors,no as Copies,Ro as DefaultTextContentTokenizer,$ as DomRange,te as DomRangePoint,o as EmptyFetcher,F as Encryption,c as Exemption,d as Feature,Ze as Footnote,Zt as GuidedNavigationDocument,_t as GuidedNavigationObject,$t as GuidedNavigationText,mt as HTMLResourceContentIterator,u as Hazard,L as HazardType,N as Hazards,_e as Heading,ao as Holds,i as HttpFetcher,a as HttpResource,ze as IllegalStateError,Ge as ImageElement,vo as IntlTextTokenizer,Fe as Iterator,Gt as Layout,S as Legal,dt as Link,ut as Links,k as Localization,bt as LocalizedString,Ct as Locator,Nt as LocatorCollection,St as LocatorCollectionMetadata,At as LocatorLocations,Pt as LocatorText,Ot as Manifest,G as MediaOverlay,so as MediaType,vt as Metadata,Eo as NaiveTextTokenizer,I as Navigation,O as NonvisualReading,n as NumberRange,rt as PDFContentElement,Dt as Page,it as PageContentIteratorPDF,R as PrerecordedAudio,to as Price,T as PrimaryAccessMode,Ht as Profile,kt as Properties,Ft as Publication,Jt as PublicationCollection,tt as PublicationContentIterator,qt as ReadingProgression,p as Resource,v as RichContent,E as RichContentType,Kt as Subject,Qt as Subjects,wt as TDM,Xt as TDMReservation,De as TextContentTokenizer,Ve as TextElement,$e as TextQuote,qe as TextSegment,Ho as TextUnit,Be as TextualElement,Oe as Timeline,Io as URITemplate,Ue as VideoElement,H as VisualAdjustments,M as WaysOfReading,co as arrayfromJSON,uo as arrayfromJSONorString,Se as buildAudioTimeline,Le as buildHtmlTimeline,ve as buildTimeline,To as datefromJSON,Po as formatNptTime,ge as getAuthenticate,ce as getAvailability,U as getContains,de as getCopies,re as getCssSelector,ie as getDomRange,J as getEncryption,ae as getFragmentParameters,ue as getHolds,me as getHtmlId,Ae as getImages,Te as getIndirectAcquisitions,Q as getLandmarks,W as getListOfAudioClips,w as getListOfIllustrations,X as getListOfTables,Y as getListOfVideoClips,q as getMediaOverlay,be as getNumberOfItems,ne as getPage,Z as getPageList,pe as getPartialCfi,ye as getPrice,fe as getSpace,xe as getTextFragment,le as getTime,Lo as isNptStartOfResource,Bt as leadingPage,bo as numberfromJSON,No as parseNptTime,yo as positiveNumberfromJSON,Co as setToArray,Mo as speakableToken};
1
+ import{EmptyFetcher as o}from"./fetcher/Fetcher.js";import{HttpFetcher as i,HttpResource as a}from"./fetcher/HttpFetcher.js";import{NumberRange as n,Resource as p}from"./fetcher/Resource.js";import{AccessMode as x,Accessibility as l,AccessibilityProfile as s,Certification as g,Exemption as c,Feature as d,Hazard as u,PrimaryAccessMode as T}from"./publication/accessibility/Accessibility.js";import{AccessibilityMetadataDisplayGuide as y,AccessibilitySummary as C,AdditionalInformation as A,Conformance as P,HazardType as L,Hazards as N,Legal as S,Navigation as I,NonvisualReading as O,PrerecordedAudio as R,RichContent as v,RichContentType as E,VisualAdjustments as H,WaysOfReading as M}from"./publication/accessibility/AccessibilityMetadataDisplayGuide.js";import{Localization as k}from"./publication/accessibility/Localization.js";import{Encryption as F}from"./publication/encryption/Encryption.js";import{getEncryption as G}from"./publication/encryption/Properties.js";import{MediaOverlay as j}from"./publication/epub/MediaOverlay.js";import{getMediaOverlay as q}from"./publication/epub/Metadata.js";import{getContains as U}from"./publication/epub/Properties.js";import{getLandmarks as Q,getListOfAudioClips as W,getListOfIllustrations as w,getListOfTables as X,getListOfVideoClips as Y,getPageList as Z}from"./publication/epub/Publication.js";import{DomRange as $}from"./publication/html/DomRange.js";import{DomRangePoint as te}from"./publication/html/DomRangePoint.js";import{getCssSelector as re,getDomRange as ie,getFragmentParameters as ae,getHtmlId as me,getPage as ne,getPartialCfi as pe,getSpace as fe,getTextFragment as xe,getTime as le}from"./publication/html/Locations.js";import{getAuthenticate as ge,getAvailability as ce,getCopies as de,getHolds as ue,getIndirectAcquisitions as Te,getNumberOfItems as be,getPrice as ye}from"./publication/opds/Properties.js";import{getImages as Ae}from"./publication/opds/Publication.js";import{buildHtmlTimeline as Le}from"./publication/services/timeline/html.js";import{buildAudioTimeline as Se}from"./publication/services/timeline/audio.js";import{Timeline as Oe}from"./publication/services/timeline/Timeline.js";import{buildTimeline as ve}from"./publication/services/timeline/index.js";import{Content as He}from"./publication/services/content/Content.js";import{TextContentTokenizer as De}from"./publication/services/content/ContentTokenizer.js";import{IllegalStateError as ze,Iterator as Fe}from"./publication/services/content/Iterator.js";import{AudioElement as Ge,ContentElement as Je,ImageElement as je,TextElement as Ve,TextSegment as qe,TextualElement as Be,VideoElement as Ue}from"./publication/services/content/element/element.js";import{Attribute as Qe,AttributeKeys as We,AttributesHolder as we}from"./publication/services/content/element/attributes.js";import{Body as Ye,Footnote as Ze,Heading as _e,TextQuote as $e}from"./publication/services/content/element/text_role.js";import{PublicationContentIterator as tt}from"./publication/services/content/iterators/PublicationContentIterator.js";import{PDFContentElement as rt,PageContentIteratorPDF as it}from"./publication/services/content/iterators/PDFTextContentIterator.js";import{HTMLResourceContentIterator as mt}from"./publication/services/content/iterators/HTMLResourceContentIterator.js";import{AltIdentifier as pt}from"./publication/AltIdentifier.js";import{BelongsTo as xt}from"./publication/BelongsTo.js";import{Contributor as st,Contributors as gt}from"./publication/Contributor.js";import{Link as dt,Links as ut}from"./publication/Link.js";import{LocalizedString as bt}from"./publication/LocalizedString.js";import{Locator as Ct,LocatorLocations as At,LocatorText as Pt}from"./publication/Locator.js";import{LocatorCollection as Nt,LocatorCollectionMetadata as St}from"./publication/LocatorCollection.js";import{Manifest as Ot}from"./publication/Manifest.js";import{Metadata as vt}from"./publication/Metadata.js";import{Profile as Ht}from"./publication/Profiles.js";import{Page as Dt,Properties as kt}from"./publication/Properties.js";import{Publication as Ft}from"./publication/Publication.js";import{PublicationCollection as Gt}from"./publication/PublicationCollection.js";import{Layout as jt}from"./publication/Layout.js";import{ReadingProgression as qt,leadingPage as Bt}from"./publication/ReadingProgression.js";import{Subject as Kt,Subjects as Qt}from"./publication/Subject.js";import{TDM as wt,TDMReservation as Xt}from"./publication/TDM.js";import{GuidedNavigationDescription as Zt,GuidedNavigationDocument as _t,GuidedNavigationObject as $t,GuidedNavigationText as eo}from"./publication/GuidedNavigation.js";import{Price as oo}from"./opds/Price.js";import{Acquisition as io}from"./opds/Acquisition.js";import{Holds as mo}from"./opds/Holds.js";import{Copies as po}from"./opds/Copies.js";import{Availability as xo,AvailabilityStatus as lo}from"./opds/Availability.js";import{MediaType as go}from"./util/mediatype/MediaType.js";import{arrayfromJSON as uo,arrayfromJSONorString as To,datefromJSON as bo,numberfromJSON as yo,positiveNumberfromJSON as Co,setToArray as Ao}from"./util/JSONParse.js";import{formatNptTime as Lo,isNptStartOfResource as No,parseNptTime as So}from"./util/npt.js";import{URITemplate as Oo}from"./util/URITemplate.js";import{DefaultTextContentTokenizer as vo,IntlTextTokenizer as Eo,NaiveTextTokenizer as Ho,TextUnit as Mo,speakableToken as Do}from"./util/tokenizer/TextTokenizer.js";export{x as AccessMode,l as Accessibility,y as AccessibilityMetadataDisplayGuide,s as AccessibilityProfile,C as AccessibilitySummary,io as Acquisition,A as AdditionalInformation,pt as AltIdentifier,Qe as Attribute,We as AttributeKeys,we as AttributesHolder,Ge as AudioElement,xo as Availability,lo as AvailabilityStatus,xt as BelongsTo,Ye as Body,g as Certification,P as Conformance,He as Content,Je as ContentElement,st as Contributor,gt as Contributors,po as Copies,vo as DefaultTextContentTokenizer,$ as DomRange,te as DomRangePoint,o as EmptyFetcher,F as Encryption,c as Exemption,d as Feature,Ze as Footnote,Zt as GuidedNavigationDescription,_t as GuidedNavigationDocument,$t as GuidedNavigationObject,eo as GuidedNavigationText,mt as HTMLResourceContentIterator,u as Hazard,L as HazardType,N as Hazards,_e as Heading,mo as Holds,i as HttpFetcher,a as HttpResource,ze as IllegalStateError,je as ImageElement,Eo as IntlTextTokenizer,Fe as Iterator,jt as Layout,S as Legal,dt as Link,ut as Links,k as Localization,bt as LocalizedString,Ct as Locator,Nt as LocatorCollection,St as LocatorCollectionMetadata,At as LocatorLocations,Pt as LocatorText,Ot as Manifest,j as MediaOverlay,go as MediaType,vt as Metadata,Ho as NaiveTextTokenizer,I as Navigation,O as NonvisualReading,n as NumberRange,rt as PDFContentElement,Dt as Page,it as PageContentIteratorPDF,R as PrerecordedAudio,oo as Price,T as PrimaryAccessMode,Ht as Profile,kt as Properties,Ft as Publication,Gt as PublicationCollection,tt as PublicationContentIterator,qt as ReadingProgression,p as Resource,v as RichContent,E as RichContentType,Kt as Subject,Qt as Subjects,wt as TDM,Xt as TDMReservation,De as TextContentTokenizer,Ve as TextElement,$e as TextQuote,qe as TextSegment,Mo as TextUnit,Be as TextualElement,Oe as Timeline,Oo as URITemplate,Ue as VideoElement,H as VisualAdjustments,M as WaysOfReading,uo as arrayfromJSON,To as arrayfromJSONorString,Se as buildAudioTimeline,Le as buildHtmlTimeline,ve as buildTimeline,bo as datefromJSON,Lo as formatNptTime,ge as getAuthenticate,ce as getAvailability,U as getContains,de as getCopies,re as getCssSelector,ie as getDomRange,G as getEncryption,ae as getFragmentParameters,ue as getHolds,me as getHtmlId,Ae as getImages,Te as getIndirectAcquisitions,Q as getLandmarks,W as getListOfAudioClips,w as getListOfIllustrations,X as getListOfTables,Y as getListOfVideoClips,q as getMediaOverlay,be as getNumberOfItems,ne as getPage,Z as getPageList,pe as getPartialCfi,ye as getPrice,fe as getSpace,xe as getTextFragment,le as getTime,No as isNptStartOfResource,Bt as leadingPage,yo as numberfromJSON,So as parseNptTime,Co as positiveNumberfromJSON,Ao as setToArray,Do as speakableToken};
@@ -1 +1 @@
1
- import{arrayfromJSONorString as a,setToArray as n}from"../util/JSONParse.js";import{Links as o}from"./Link.js";class d{constructor(i){this.links=i.links,this.guided=i.guided}static deserialize(i){if(i)return new d({links:o.deserialize(i.links),guided:r.deserializeArray(i.guided)})}serialize(){const i={};return this.links!==void 0&&(i.links=this.links.serialize()),this.guided!==void 0&&(i.guided=this.guided.map(e=>e.serialize())),i}}class s{constructor(i){this.plain=i.plain,this.ssml=i.ssml,this.language=i.language}static deserialize(i){if(i!=null){if(typeof i=="string")return new s({plain:i});if(i.plain||i.ssml||i.language)return new s({plain:i.plain,ssml:i.ssml,language:i.language})}}serialize(){const i={};return this.plain!==void 0&&(i.plain=this.plain),this.ssml!==void 0&&(i.ssml=this.ssml),this.language!==void 0&&(i.language=this.language),Object.keys(i).length>0?i:void 0}}class r{constructor(i){this.audioref=i.audioref,this.children=i.children,this.imgref=i.imgref,this.role=i.role,this.level=i.level!==void 0?Math.min(6,Math.max(1,i.level)):void 0,this.text=i.text,this.textref=i.textref,this.description=i.description}get plainText(){return this.text?.plain}get ssmlText(){return this.text?.ssml}get textLanguage(){return this.text?.language}static deserialize(i){if(i)return new r({audioref:i.audioref,children:r.deserializeArray(i.children),imgref:i.imgref,role:i.role?new Set(a(i.role)):void 0,level:typeof i.level=="number"?i.level:void 0,text:s.deserialize(i.text),textref:i.textref,description:r.deserialize(i.description)})}static deserializeArray(i){if(Array.isArray(i))return i.map(e=>r.deserialize(e)).filter(e=>e!==void 0)}serialize(){const i={};if(this.audioref!==void 0&&(i.audioref=this.audioref),this.children!==void 0&&(i.children=this.children.map(e=>e.serialize())),this.imgref!==void 0&&(i.imgref=this.imgref),this.role!==void 0&&(i.role=n(this.role)),this.level!==void 0&&(i.level=this.level),this.text!==void 0){const e=this.text.serialize();e!==void 0&&(i.text=e)}return this.textref!==void 0&&(i.textref=this.textref),this.description&&(i.description=this.description.serialize()),i}get audioFile(){return this.audioref?.split("#")[0]}get audioTime(){if(this.audioref?.includes("#"))return this.audioref.split("#",2)[1]}get textFile(){return this.textref?.split("#")[0]}get fragmentId(){if(this.textref?.includes("#"))return this.textref.split("#",2)[1]}get clip(){const i=this.audioFile;if(!i)return;const e=this.audioTime,t={audioResource:i,fragmentId:this.fragmentId};if(!e)return t;const l=this.parseTimer(e);return t.start=l[0],t.end=l[1],t}parseTimer(i){if(!i||!i.startsWith("t="))return[void 0,void 0];const e=i.substring(2).split(",").map(t=>parseFloat(t));return e.length===1?[isNaN(e[0])?void 0:e[0],void 0]:e.length>2?[void 0,void 0]:[isNaN(e[0])?void 0:e[0],isNaN(e[1])?void 0:e[1]]}}export{d as GuidedNavigationDocument,r as GuidedNavigationObject,s as GuidedNavigationText};
1
+ import{arrayfromJSONorString as a,setToArray as n}from"../util/JSONParse.js";class f{constructor(i){this.guided=i.guided}static deserialize(i){if(!i)return;const e=r.deserializeArray(i.guided);if(!(!e||e.length===0))return new f({guided:e})}serialize(){return{guided:this.guided.map(i=>i.serialize())}}}class d{constructor(i){this.plain=i.plain,this.ssml=i.ssml,this.language=i.language}static deserialize(i){if(i!=null){if(typeof i=="string")return i.length>0?new d({plain:i}):void 0;if(i.plain||i.ssml)return new d({plain:i.plain,ssml:i.ssml,language:i.language})}}serialize(){const i={};return this.plain!==void 0&&(i.plain=this.plain),this.ssml!==void 0&&(i.ssml=this.ssml),this.language!==void 0&&(i.language=this.language),Object.keys(i).length>0?i:void 0}}class s{constructor(i){this.audioref=i.audioref,this.imgref=i.imgref,this.textref=i.textref,this.videoref=i.videoref,this.text=i.text}static deserialize(i){if(!i)return;const e=new s({audioref:i.audioref,imgref:i.imgref,textref:i.textref,videoref:i.videoref,text:d.deserialize(i.text)});if(!(e.audioref===void 0&&e.imgref===void 0&&e.textref===void 0&&e.videoref===void 0&&e.text===void 0))return e}serialize(){const i={};this.audioref!==void 0&&(i.audioref=this.audioref),this.imgref!==void 0&&(i.imgref=this.imgref),this.textref!==void 0&&(i.textref=this.textref),this.videoref!==void 0&&(i.videoref=this.videoref);const e=this.text?.serialize();return e!==void 0&&(i.text=e),i}}class r{constructor(i){this.id=i.id,this.audioref=i.audioref,this.children=i.children,this.imgref=i.imgref,this.role=i.role,this.text=i.text,this.textref=i.textref,this.videoref=i.videoref,this.description=i.description}get plainText(){return this.text?.plain}get ssmlText(){return this.text?.ssml}get textLanguage(){return this.text?.language}static deserialize(i){if(!i)return;const e=r.deserializeArray(i.children),t=new r({id:typeof i.id=="string"?i.id:void 0,audioref:i.audioref,children:e&&e.length>0?e:void 0,imgref:i.imgref,role:i.role?new Set(a(i.role)):void 0,text:d.deserialize(i.text),textref:i.textref,videoref:i.videoref,description:s.deserialize(i.description)});if(!(t.audioref===void 0&&t.imgref===void 0&&t.textref===void 0&&t.videoref===void 0&&t.text===void 0&&t.children===void 0))return t}static deserializeArray(i){if(Array.isArray(i))return i.map(e=>r.deserialize(e)).filter(e=>e!==void 0)}serialize(){const i={};if(this.id!==void 0&&(i.id=this.id),this.audioref!==void 0&&(i.audioref=this.audioref),this.children!==void 0&&(i.children=this.children.map(e=>e.serialize())),this.imgref!==void 0&&(i.imgref=this.imgref),this.role!==void 0&&(i.role=n(this.role)),this.text!==void 0){const e=this.text.serialize();e!==void 0&&(i.text=e)}return this.textref!==void 0&&(i.textref=this.textref),this.videoref!==void 0&&(i.videoref=this.videoref),this.description!==void 0&&(i.description=this.description.serialize()),i}get audioFile(){return this.audioref?.split("#")[0]}get audioTime(){if(this.audioref?.includes("#"))return this.audioref.split("#",2)[1]}get textFile(){return this.textref?.split("#")[0]}get fragmentId(){if(this.textref?.includes("#"))return this.textref.split("#",2)[1]}get clip(){const i=this.audioFile;if(!i)return;const e=this.audioTime,t={audioResource:i,fragmentId:this.fragmentId};if(!e)return t;const o=this.parseTimer(e);return t.start=o[0],t.end=o[1],t}parseTimer(i){if(!i||!i.startsWith("t="))return[void 0,void 0];const e=i.substring(2).split(",").map(t=>parseFloat(t));return e.length===1?[isNaN(e[0])?void 0:e[0],void 0]:e.length>2?[void 0,void 0]:[isNaN(e[0])?void 0:e[0],isNaN(e[1])?void 0:e[1]]}}export{s as GuidedNavigationDescription,f as GuidedNavigationDocument,r as GuidedNavigationObject,d as GuidedNavigationText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/shared",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "description": "Shared models to be used across other Readium projects and implementations in Typescript",
6
6
  "author": "readium",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "sideEffects": false,
58
58
  "dependencies": {
59
- "@readium/helpers": "1.1.1"
59
+ "@readium/helpers": "1.2.0"
60
60
  },
61
61
  "files": [
62
62
  "dist",
@@ -64,7 +64,7 @@
64
64
  "types"
65
65
  ],
66
66
  "engines": {
67
- "node": ">=18"
67
+ "node": ">=24"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/core": "^7.28.6",
@@ -2,7 +2,6 @@ import {
2
2
  arrayfromJSONorString,
3
3
  setToArray,
4
4
  } from '../util/JSONParse.ts';
5
- import { Links } from "./Link.ts";
6
5
 
7
6
  export interface Clip {
8
7
  audioResource: string;
@@ -16,35 +15,34 @@ export interface Clip {
16
15
  * https://readium.org/guided-navigation/schema/document.schema.json
17
16
  */
18
17
  export class GuidedNavigationDocument {
19
- public readonly links?: Links;
20
- public readonly guided?: GuidedNavigationObject[];
18
+ /** Non-empty sequence of objects meant to be presented sequentially to the user. */
19
+ public readonly guided: GuidedNavigationObject[];
21
20
 
22
21
  constructor(values: {
23
- links?: Links;
24
- guided?: GuidedNavigationObject[];
22
+ guided: GuidedNavigationObject[];
25
23
  }) {
26
- this.links = values.links;
27
24
  this.guided = values.guided;
28
25
  }
29
26
 
27
+ /**
28
+ * Deserializes a GuidedNavigationDocument from JSON.
29
+ * Returns undefined if `guided` is missing or has no valid object.
30
+ */
30
31
  public static deserialize(json: any): GuidedNavigationDocument | undefined {
31
32
  if (!json) return;
32
- return new GuidedNavigationDocument({
33
- links: Links.deserialize(json.links),
34
- guided: GuidedNavigationObject.deserializeArray(json.guided),
35
- });
33
+ const guided = GuidedNavigationObject.deserializeArray(json.guided);
34
+ if (!guided || guided.length === 0) return;
35
+ return new GuidedNavigationDocument({ guided });
36
36
  }
37
37
 
38
38
  public serialize(): any {
39
- const json: any = {};
40
- if (this.links !== undefined) json.links = this.links.serialize();
41
- if (this.guided !== undefined) json.guided = this.guided.map(x => x.serialize());
42
- return json;
39
+ return { guided: this.guided.map(x => x.serialize()) };
43
40
  }
44
41
  }
45
42
 
46
43
  /**
47
44
  * Represents a text value containing plain text, SSML, and language information.
45
+ * https://readium.org/guided-navigation/schema/text.schema.json
48
46
  */
49
47
  export class GuidedNavigationText {
50
48
  /** Plain text content */
@@ -76,11 +74,11 @@ export class GuidedNavigationText {
76
74
  if (json === undefined || json === null) return undefined;
77
75
 
78
76
  if (typeof json === 'string') {
79
- return new GuidedNavigationText({ plain: json });
77
+ return json.length > 0 ? new GuidedNavigationText({ plain: json }) : undefined;
80
78
  }
81
79
 
82
- // Only create if there are actual values
83
- if (json.plain || json.ssml || json.language) {
80
+ // The schema requires a non-empty `plain` or `ssml`
81
+ if (json.plain || json.ssml) {
84
82
  return new GuidedNavigationText({
85
83
  plain: json.plain,
86
84
  ssml: json.ssml,
@@ -104,11 +102,82 @@ export class GuidedNavigationText {
104
102
  }
105
103
 
106
104
  /**
107
- * Guided Navigation Object
108
- * https://github.com/readium/guided-navigation/blob/main/schema/object.schema.json
105
+ * Text, audio, image or video description of a Guided Navigation Object.
106
+ * https://readium.org/guided-navigation/schema/description.schema.json
109
107
  */
108
+ export class GuidedNavigationDescription {
109
+ /** References an audio resource or a fragment of it. */
110
+ public readonly audioref?: string;
111
+
112
+ /** References an image or a fragment of it. */
113
+ public readonly imgref?: string;
114
+
115
+ /** References a textual resource or a fragment of it. */
116
+ public readonly textref?: string;
117
+
118
+ /** References a video resource or a fragment of it. */
119
+ public readonly videoref?: string;
120
+
121
+ /** Textual description. */
122
+ public readonly text?: GuidedNavigationText;
123
+
124
+ constructor(values: {
125
+ audioref?: string;
126
+ imgref?: string;
127
+ textref?: string;
128
+ videoref?: string;
129
+ text?: GuidedNavigationText;
130
+ }) {
131
+ this.audioref = values.audioref;
132
+ this.imgref = values.imgref;
133
+ this.textref = values.textref;
134
+ this.videoref = values.videoref;
135
+ this.text = values.text;
136
+ }
137
+
138
+ /**
139
+ * Deserializes a GuidedNavigationDescription from JSON.
140
+ * Returns undefined if it has none of the refs nor text.
141
+ */
142
+ public static deserialize(json: any): GuidedNavigationDescription | undefined {
143
+ if (!json) return undefined;
144
+ const description = new GuidedNavigationDescription({
145
+ audioref: json.audioref,
146
+ imgref: json.imgref,
147
+ textref: json.textref,
148
+ videoref: json.videoref,
149
+ text: GuidedNavigationText.deserialize(json.text)
150
+ });
151
+ if (
152
+ description.audioref === undefined &&
153
+ description.imgref === undefined &&
154
+ description.textref === undefined &&
155
+ description.videoref === undefined &&
156
+ description.text === undefined
157
+ ) return undefined;
158
+ return description;
159
+ }
160
+
161
+ public serialize(): any {
162
+ const json: any = {};
163
+ if (this.audioref !== undefined) json.audioref = this.audioref;
164
+ if (this.imgref !== undefined) json.imgref = this.imgref;
165
+ if (this.textref !== undefined) json.textref = this.textref;
166
+ if (this.videoref !== undefined) json.videoref = this.videoref;
167
+ const text = this.text?.serialize();
168
+ if (text !== undefined) json.text = text;
169
+ return json;
170
+ }
171
+ }
110
172
 
173
+ /**
174
+ * Guided Navigation Object
175
+ * https://readium.org/guided-navigation/schema/document.schema.json
176
+ */
111
177
  export class GuidedNavigationObject {
178
+ /** Identifier of the object. */
179
+ public readonly id?: string;
180
+
112
181
  /** References an audio resource or a fragment of it. */
113
182
  public readonly audioref?: string;
114
183
 
@@ -121,13 +190,6 @@ export class GuidedNavigationObject {
121
190
  /** Convey the structural semantics of a publication. */
122
191
  public readonly role?: Set<string>;
123
192
 
124
- /**
125
- * Indicates the heading level (1-6) for the navigation object.
126
- * @minimum 1
127
- * @maximum 6
128
- */
129
- public readonly level?: number;
130
-
131
193
  /**
132
194
  * Textual equivalent of the resources or fragment of the resources referenced by the current Guided Navigation Object.
133
195
  */
@@ -136,32 +198,34 @@ export class GuidedNavigationObject {
136
198
  /** References a textual resource or a fragment of it. */
137
199
  public readonly textref?: string;
138
200
 
139
- /**
140
- * Describes the image referenced by the current Guided Navigation Object.
141
- * This is a GuidedNavigationObject that should not contain 'level' or 'children' properties.
142
- */
143
- public readonly description?: Omit<GuidedNavigationObject, 'level' | 'children'>;
201
+ /** References a video resource or a fragment of it. */
202
+ public readonly videoref?: string;
203
+
204
+ /** Text, audio, image or video description of the current Guided Navigation Object. */
205
+ public readonly description?: GuidedNavigationDescription;
144
206
 
145
207
  /**
146
208
  * Creates a [GuidedNavigation] object.
147
209
  */
148
210
  constructor(values: {
211
+ id?: string;
149
212
  audioref?: string;
150
213
  children?: GuidedNavigationObject[];
151
214
  imgref?: string;
152
215
  role?: Set<string>;
153
- level?: number;
154
216
  text?: GuidedNavigationText;
155
217
  textref?: string;
156
- description?: Omit<GuidedNavigationObject, 'level' | 'children'>;
218
+ videoref?: string;
219
+ description?: GuidedNavigationDescription;
157
220
  }) {
221
+ this.id = values.id;
158
222
  this.audioref = values.audioref;
159
223
  this.children = values.children;
160
224
  this.imgref = values.imgref;
161
225
  this.role = values.role;
162
- this.level = values.level !== undefined ? Math.min(6, Math.max(1, values.level)) : undefined;
163
226
  this.text = values.text;
164
227
  this.textref = values.textref;
228
+ this.videoref = values.videoref;
165
229
  this.description = values.description;
166
230
  }
167
231
 
@@ -188,23 +252,35 @@ export class GuidedNavigationObject {
188
252
  }
189
253
 
190
254
  /**
191
- * Deserializes a GuidedNavigationObject from JSON
255
+ * Deserializes a GuidedNavigationObject from JSON.
256
+ * Returns undefined if it has none of the refs, text, nor children.
192
257
  */
193
258
  public static deserialize(json: any): GuidedNavigationObject | undefined {
194
259
  if (!json) return undefined;
195
260
 
196
- return new GuidedNavigationObject({
261
+ const children = GuidedNavigationObject.deserializeArray(json.children);
262
+ const obj = new GuidedNavigationObject({
263
+ id: typeof json.id === 'string' ? json.id : undefined,
197
264
  audioref: json.audioref,
198
- children: GuidedNavigationObject.deserializeArray(json.children),
265
+ children: children && children.length > 0 ? children : undefined,
199
266
  imgref: json.imgref,
200
267
  role: json.role
201
268
  ? new Set<string>(arrayfromJSONorString(json.role))
202
269
  : undefined,
203
- level: typeof json.level === 'number' ? json.level : undefined,
204
270
  text: GuidedNavigationText.deserialize(json.text),
205
271
  textref: json.textref,
206
- description: GuidedNavigationObject.deserialize(json.description)
272
+ videoref: json.videoref,
273
+ description: GuidedNavigationDescription.deserialize(json.description)
207
274
  });
275
+ if (
276
+ obj.audioref === undefined &&
277
+ obj.imgref === undefined &&
278
+ obj.textref === undefined &&
279
+ obj.videoref === undefined &&
280
+ obj.text === undefined &&
281
+ obj.children === undefined
282
+ ) return undefined;
283
+ return obj;
208
284
  }
209
285
 
210
286
  /**
@@ -213,8 +289,8 @@ export class GuidedNavigationObject {
213
289
  public static deserializeArray(json: any): GuidedNavigationObject[] | undefined {
214
290
  if (!(Array.isArray(json))) return undefined;
215
291
  return json
216
- .map<GuidedNavigationObject>((item) => GuidedNavigationObject.deserialize(item) as GuidedNavigationObject)
217
- .filter((x) => x !== undefined);
292
+ .map((item) => GuidedNavigationObject.deserialize(item))
293
+ .filter((x): x is GuidedNavigationObject => x !== undefined);
218
294
  }
219
295
 
220
296
  /**
@@ -222,11 +298,11 @@ export class GuidedNavigationObject {
222
298
  */
223
299
  public serialize(): any {
224
300
  const json: any = {};
301
+ if (this.id !== undefined) json.id = this.id;
225
302
  if (this.audioref !== undefined) json.audioref = this.audioref;
226
303
  if (this.children !== undefined) json.children = this.children.map(x => x.serialize());
227
304
  if (this.imgref !== undefined) json.imgref = this.imgref;
228
305
  if (this.role !== undefined) json.role = setToArray(this.role);
229
- if (this.level !== undefined) json.level = this.level;
230
306
  if (this.text !== undefined) {
231
307
  const serializedText = this.text.serialize();
232
308
  if (serializedText !== undefined) {
@@ -234,9 +310,8 @@ export class GuidedNavigationObject {
234
310
  }
235
311
  }
236
312
  if (this.textref !== undefined) json.textref = this.textref;
237
- if (this.description) {
238
- json.description = this.description.serialize();
239
- }
313
+ if (this.videoref !== undefined) json.videoref = this.videoref;
314
+ if (this.description !== undefined) json.description = this.description.serialize();
240
315
  return json;
241
316
  }
242
317
 
@@ -2,9 +2,13 @@ import { DefaultTextContentTokenizer, Range, TextTokenizer, TextUnit, Tokenizer
2
2
  import { Locator, LocatorText } from "../../Locator.ts";
3
3
  import { ContentElement, TextElement, TextSegment } from "./element/index.ts";
4
4
 
5
- // A tokenizer splitting a [Content.Element] into smaller pieces.
5
+ /**
6
+ * A tokenizer splitting a [Content.Element] into smaller pieces.
7
+ * @deprecated Use `@readium/speech`, which segments text itself.
8
+ */
6
9
  export type ContentTokenizer = Tokenizer<ContentElement, ContentElement>;
7
10
 
11
+ /** @deprecated Use `@readium/speech`, which segments text itself. */
8
12
  export class TextContentTokenizer implements ContentTokenizer {
9
13
  /**
10
14
  *
@@ -21,6 +21,8 @@ interface ElementWithDelta {
21
21
  * If you want to start from the end of the resource, the [locator] must have a `progression` of 1.0.
22
22
  *
23
23
  * Locators will contain a `before` context of up to `beforeMaxLength` characters.
24
+ *
25
+ * @deprecated Use `@readium/guided-navigation` and `@readium/speech` instead.
24
26
  */
25
27
  export class HTMLResourceContentIterator extends Iterator {
26
28
  private currentElement: ElementWithDelta | null = null;
@@ -3,16 +3,21 @@ import { Tokenizer } from "./Tokenizer.ts";
3
3
  import BasicEnglishTokenizer from "./tokenize-english/index.js";
4
4
  import BasicTokenizer, { TextlintSegment } from "./tokenize-text/index.js";
5
5
 
6
- // Start / End
6
+ /**
7
+ * Start / End
8
+ * @deprecated Use `@readium/speech`, which segments text itself.
9
+ */
7
10
  export type Range = [number, number];
8
11
 
9
12
  /**
10
13
  * A tokenizer splitting a String into range tokens (e.g. words, sentences, etc.).
14
+ * @deprecated Use `@readium/speech`, which segments text itself.
11
15
  */
12
16
  export type TextTokenizer = Tokenizer<string, Range>;
13
17
 
14
18
  /**
15
19
  * A text token unit which can be used with a [TextTokenizer].
20
+ * @deprecated Use `@readium/speech`, which segments text itself.
16
21
  */
17
22
  export enum TextUnit {
18
23
  Word = "word",
@@ -20,7 +25,10 @@ export enum TextUnit {
20
25
  Paragraph = "paragraph",
21
26
  }
22
27
 
23
- // A default cluster [TextTokenizer] taking advantage of the best capabilities of the navigator
28
+ /**
29
+ * A default cluster [TextTokenizer] taking advantage of the best capabilities of the navigator
30
+ * @deprecated Use `@readium/speech`, which segments text itself.
31
+ */
24
32
  export const DefaultTextContentTokenizer = (language: Language | null, unit: TextUnit): TextTokenizer => {
25
33
  if("Segmenter" in Intl) {
26
34
  // Available in any evergreen browser EXCEPT for Firefox.
@@ -35,6 +43,7 @@ export const DefaultTextContentTokenizer = (language: Language | null, unit: Tex
35
43
  /**
36
44
  * A [TextTokenizer] using the Intl.Segmenter API.
37
45
  * Very aware of language-specific rules since it uses ICU behind the scenes.
46
+ * @deprecated Use `@readium/speech`, which segments text itself.
38
47
  */
39
48
  export class IntlTextTokenizer implements TextTokenizer {
40
49
  private segmenter: Intl.Segmenter;
@@ -68,6 +77,7 @@ export class IntlTextTokenizer implements TextTokenizer {
68
77
  * A [TextTokenizer] using a naive approach to splitting text into tokens.
69
78
  * This is a fallback for browsers that don't support Intl.Segmenter.
70
79
  * It works mainly on English and similar languages. Don't use unless necessary.
80
+ * @deprecated Use `@readium/speech`, which segments text itself.
71
81
  */
72
82
  export class NaiveTextTokenizer {
73
83
  private tokenizer: BasicTokenizer;
@@ -116,8 +126,11 @@ export class NaiveTextTokenizer {
116
126
 
117
127
  const trimmedMatcher = new RegExp("[\\p{L}\\p{N}]+", "u");
118
128
 
119
- // Unicode-aware of checking if there's anything that can be spoken in a string
120
- // "Spoken" in this case means at least one unicode letter or unicode number character
129
+ /**
130
+ * Unicode-aware of checking if there's anything that can be spoken in a string
131
+ * "Spoken" in this case means at least one unicode letter or unicode number character
132
+ * @deprecated Use `@readium/speech`, which segments text itself.
133
+ */
121
134
  export const speakableToken = (token: string): string | null => {
122
135
  const trimmedToken = token.trimEnd();
123
136
  if(trimmedToken.length === 0) return null;
@@ -2,6 +2,7 @@
2
2
 
3
3
  /**
4
4
  * A tokenizer splits a piece of data [D] into a list of [T] tokens.
5
+ * @deprecated Use `@readium/speech`, which segments text itself.
5
6
  */
6
7
  export interface Tokenizer<D, T> {
7
8
  tokenize(data: D): T[];
@@ -1,4 +1,3 @@
1
- import { Links } from "./Link.ts";
2
1
  export interface Clip {
3
2
  audioResource: string;
4
3
  fragmentId?: string;
@@ -10,17 +9,21 @@ export interface Clip {
10
9
  * https://readium.org/guided-navigation/schema/document.schema.json
11
10
  */
12
11
  export declare class GuidedNavigationDocument {
13
- readonly links?: Links;
14
- readonly guided?: GuidedNavigationObject[];
12
+ /** Non-empty sequence of objects meant to be presented sequentially to the user. */
13
+ readonly guided: GuidedNavigationObject[];
15
14
  constructor(values: {
16
- links?: Links;
17
- guided?: GuidedNavigationObject[];
15
+ guided: GuidedNavigationObject[];
18
16
  });
17
+ /**
18
+ * Deserializes a GuidedNavigationDocument from JSON.
19
+ * Returns undefined if `guided` is missing or has no valid object.
20
+ */
19
21
  static deserialize(json: any): GuidedNavigationDocument | undefined;
20
22
  serialize(): any;
21
23
  }
22
24
  /**
23
25
  * Represents a text value containing plain text, SSML, and language information.
26
+ * https://readium.org/guided-navigation/schema/text.schema.json
24
27
  */
25
28
  export declare class GuidedNavigationText {
26
29
  /** Plain text content */
@@ -46,11 +49,42 @@ export declare class GuidedNavigationText {
46
49
  */
47
50
  serialize(): any;
48
51
  }
52
+ /**
53
+ * Text, audio, image or video description of a Guided Navigation Object.
54
+ * https://readium.org/guided-navigation/schema/description.schema.json
55
+ */
56
+ export declare class GuidedNavigationDescription {
57
+ /** References an audio resource or a fragment of it. */
58
+ readonly audioref?: string;
59
+ /** References an image or a fragment of it. */
60
+ readonly imgref?: string;
61
+ /** References a textual resource or a fragment of it. */
62
+ readonly textref?: string;
63
+ /** References a video resource or a fragment of it. */
64
+ readonly videoref?: string;
65
+ /** Textual description. */
66
+ readonly text?: GuidedNavigationText;
67
+ constructor(values: {
68
+ audioref?: string;
69
+ imgref?: string;
70
+ textref?: string;
71
+ videoref?: string;
72
+ text?: GuidedNavigationText;
73
+ });
74
+ /**
75
+ * Deserializes a GuidedNavigationDescription from JSON.
76
+ * Returns undefined if it has none of the refs nor text.
77
+ */
78
+ static deserialize(json: any): GuidedNavigationDescription | undefined;
79
+ serialize(): any;
80
+ }
49
81
  /**
50
82
  * Guided Navigation Object
51
- * https://github.com/readium/guided-navigation/blob/main/schema/object.schema.json
83
+ * https://readium.org/guided-navigation/schema/document.schema.json
52
84
  */
53
85
  export declare class GuidedNavigationObject {
86
+ /** Identifier of the object. */
87
+ readonly id?: string;
54
88
  /** References an audio resource or a fragment of it. */
55
89
  readonly audioref?: string;
56
90
  /** Items that are children of the containing Guided Navigation Object. */
@@ -59,35 +93,29 @@ export declare class GuidedNavigationObject {
59
93
  readonly imgref?: string;
60
94
  /** Convey the structural semantics of a publication. */
61
95
  readonly role?: Set<string>;
62
- /**
63
- * Indicates the heading level (1-6) for the navigation object.
64
- * @minimum 1
65
- * @maximum 6
66
- */
67
- readonly level?: number;
68
96
  /**
69
97
  * Textual equivalent of the resources or fragment of the resources referenced by the current Guided Navigation Object.
70
98
  */
71
99
  readonly text?: GuidedNavigationText;
72
100
  /** References a textual resource or a fragment of it. */
73
101
  readonly textref?: string;
74
- /**
75
- * Describes the image referenced by the current Guided Navigation Object.
76
- * This is a GuidedNavigationObject that should not contain 'level' or 'children' properties.
77
- */
78
- readonly description?: Omit<GuidedNavigationObject, 'level' | 'children'>;
102
+ /** References a video resource or a fragment of it. */
103
+ readonly videoref?: string;
104
+ /** Text, audio, image or video description of the current Guided Navigation Object. */
105
+ readonly description?: GuidedNavigationDescription;
79
106
  /**
80
107
  * Creates a [GuidedNavigation] object.
81
108
  */
82
109
  constructor(values: {
110
+ id?: string;
83
111
  audioref?: string;
84
112
  children?: GuidedNavigationObject[];
85
113
  imgref?: string;
86
114
  role?: Set<string>;
87
- level?: number;
88
115
  text?: GuidedNavigationText;
89
116
  textref?: string;
90
- description?: Omit<GuidedNavigationObject, 'level' | 'children'>;
117
+ videoref?: string;
118
+ description?: GuidedNavigationDescription;
91
119
  });
92
120
  /**
93
121
  * Gets the plain text content.
@@ -103,7 +131,8 @@ export declare class GuidedNavigationObject {
103
131
  */
104
132
  get textLanguage(): string | undefined;
105
133
  /**
106
- * Deserializes a GuidedNavigationObject from JSON
134
+ * Deserializes a GuidedNavigationObject from JSON.
135
+ * Returns undefined if it has none of the refs, text, nor children.
107
136
  */
108
137
  static deserialize(json: any): GuidedNavigationObject | undefined;
109
138
  /**
@@ -1,6 +1,11 @@
1
1
  import { TextTokenizer, TextUnit, Tokenizer } from "../../../util/index.ts";
2
2
  import { ContentElement } from "./element/index.ts";
3
+ /**
4
+ * A tokenizer splitting a [Content.Element] into smaller pieces.
5
+ * @deprecated Use `@readium/speech`, which segments text itself.
6
+ */
3
7
  export type ContentTokenizer = Tokenizer<ContentElement, ContentElement>;
8
+ /** @deprecated Use `@readium/speech`, which segments text itself. */
4
9
  export declare class TextContentTokenizer implements ContentTokenizer {
5
10
  private readonly defaultLanguage;
6
11
  private readonly contextSnippetLength;
@@ -11,6 +11,8 @@ import { ContentElement } from "../element/index.ts";
11
11
  * If you want to start from the end of the resource, the [locator] must have a `progression` of 1.0.
12
12
  *
13
13
  * Locators will contain a `before` context of up to `beforeMaxLength` characters.
14
+ *
15
+ * @deprecated Use `@readium/guided-navigation` and `@readium/speech` instead.
14
16
  */
15
17
  export declare class HTMLResourceContentIterator extends Iterator {
16
18
  private resource;
@@ -1,22 +1,33 @@
1
1
  import { Language } from "../Language.ts";
2
2
  import { Tokenizer } from "./Tokenizer.ts";
3
+ /**
4
+ * Start / End
5
+ * @deprecated Use `@readium/speech`, which segments text itself.
6
+ */
3
7
  export type Range = [number, number];
4
8
  /**
5
9
  * A tokenizer splitting a String into range tokens (e.g. words, sentences, etc.).
10
+ * @deprecated Use `@readium/speech`, which segments text itself.
6
11
  */
7
12
  export type TextTokenizer = Tokenizer<string, Range>;
8
13
  /**
9
14
  * A text token unit which can be used with a [TextTokenizer].
15
+ * @deprecated Use `@readium/speech`, which segments text itself.
10
16
  */
11
17
  export declare enum TextUnit {
12
18
  Word = "word",
13
19
  Sentence = "sentence",
14
20
  Paragraph = "paragraph"
15
21
  }
22
+ /**
23
+ * A default cluster [TextTokenizer] taking advantage of the best capabilities of the navigator
24
+ * @deprecated Use `@readium/speech`, which segments text itself.
25
+ */
16
26
  export declare const DefaultTextContentTokenizer: (language: Language | null, unit: TextUnit) => TextTokenizer;
17
27
  /**
18
28
  * A [TextTokenizer] using the Intl.Segmenter API.
19
29
  * Very aware of language-specific rules since it uses ICU behind the scenes.
30
+ * @deprecated Use `@readium/speech`, which segments text itself.
20
31
  */
21
32
  export declare class IntlTextTokenizer implements TextTokenizer {
22
33
  private unit;
@@ -28,6 +39,7 @@ export declare class IntlTextTokenizer implements TextTokenizer {
28
39
  * A [TextTokenizer] using a naive approach to splitting text into tokens.
29
40
  * This is a fallback for browsers that don't support Intl.Segmenter.
30
41
  * It works mainly on English and similar languages. Don't use unless necessary.
42
+ * @deprecated Use `@readium/speech`, which segments text itself.
31
43
  */
32
44
  export declare class NaiveTextTokenizer {
33
45
  private unit;
@@ -36,4 +48,9 @@ export declare class NaiveTextTokenizer {
36
48
  constructor(language: Language | null, unit: TextUnit);
37
49
  tokenize(data: string): Range[];
38
50
  }
51
+ /**
52
+ * Unicode-aware of checking if there's anything that can be spoken in a string
53
+ * "Spoken" in this case means at least one unicode letter or unicode number character
54
+ * @deprecated Use `@readium/speech`, which segments text itself.
55
+ */
39
56
  export declare const speakableToken: (token: string) => string | null;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * A tokenizer splits a piece of data [D] into a list of [T] tokens.
3
+ * @deprecated Use `@readium/speech`, which segments text itself.
3
4
  */
4
5
  export interface Tokenizer<D, T> {
5
6
  tokenize(data: D): T[];