@readium/shared 2.3.0 → 2.4.0-alpha.1
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/LICENSE +28 -0
- package/README.MD +7 -8
- package/dist/ar-DyHX_uy2.js +7 -0
- package/dist/da-Dct0PS3E.js +7 -0
- package/dist/fr-C5HEel98.js +7 -0
- package/dist/index.js +4993 -1
- package/dist/index.umd.cjs +3 -0
- package/dist/it-DFOBoXGy.js +7 -0
- package/dist/pt_PT-Di3sVjze.js +7 -0
- package/dist/sv-BfzAFsVN.js +7 -0
- package/package.json +26 -33
- package/src/fetcher/HttpFetcher.ts +5 -5
- package/src/fetcher/Resource.ts +10 -5
- package/src/publication/Link.ts +6 -2
- package/src/publication/Locator.ts +3 -21
- package/src/publication/Manifest.ts +10 -10
- package/src/publication/Publication.ts +1 -2
- package/src/publication/accessibility/Localization.ts +14 -12
- package/src/publication/accessibility/SupportedLanguages.ts +1 -1
- package/src/publication/encryption/Properties.ts +15 -3
- package/src/publication/epub/Metadata.ts +12 -6
- package/src/publication/epub/Properties.ts +13 -3
- package/src/publication/epub/Publication.ts +39 -18
- package/src/publication/html/Locations.ts +101 -54
- package/src/publication/opds/Properties.ts +66 -21
- package/src/publication/opds/Publication.ts +9 -3
- package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +1 -3
- package/src/publication/services/timeline/Timeline.ts +59 -268
- package/src/publication/services/timeline/TimelineItem.ts +3 -3
- package/src/publication/services/timeline/index.ts +0 -12
- package/src/util/npt.ts +0 -19
- package/types/src/fetcher/HttpFetcher.d.ts +3 -3
- package/types/src/fetcher/Resource.d.ts +6 -2
- package/types/src/publication/encryption/Properties.d.ts +9 -2
- package/types/src/publication/epub/Metadata.d.ts +6 -3
- package/types/src/publication/epub/Properties.d.ts +10 -2
- package/types/src/publication/epub/Publication.d.ts +18 -7
- package/types/src/publication/html/Locations.d.ts +44 -15
- package/types/src/publication/opds/Properties.d.ts +36 -8
- package/types/src/publication/opds/Publication.d.ts +5 -2
- package/types/src/publication/services/timeline/Timeline.d.ts +12 -78
- package/types/src/publication/services/timeline/TimelineItem.d.ts +3 -3
- package/types/src/publication/services/timeline/index.d.ts +0 -6
- package/types/src/util/npt.d.ts +0 -10
- package/dist/_virtual/preload-helper.js +0 -1
- package/dist/fetcher/Fetcher.js +0 -1
- package/dist/fetcher/HttpFetcher.js +0 -1
- package/dist/fetcher/Resource.js +0 -1
- package/dist/locales/publication-metadata/ar.json.js +0 -1
- package/dist/locales/publication-metadata/da.json.js +0 -1
- package/dist/locales/publication-metadata/el.json.js +0 -1
- package/dist/locales/publication-metadata/en.json.js +0 -1
- package/dist/locales/publication-metadata/es.json.js +0 -1
- package/dist/locales/publication-metadata/et.json.js +0 -1
- package/dist/locales/publication-metadata/fi.json.js +0 -1
- package/dist/locales/publication-metadata/fr.json.js +0 -1
- package/dist/locales/publication-metadata/it.json.js +0 -1
- package/dist/locales/publication-metadata/pl.json.js +0 -1
- package/dist/locales/publication-metadata/pt_PT.json.js +0 -1
- package/dist/locales/publication-metadata/sv.json.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/constants.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/index.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-attribute.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-class.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-fallback.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-id.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-nth-child.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-nth-of-type.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-tag.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/types.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-cartesian.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-data.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-dom.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-element-data.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-iselement.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-messages.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-options.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-powerset.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-selectors.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-typescript.js +0 -1
- package/dist/opds/Acquisition.js +0 -1
- package/dist/opds/Availability.js +0 -1
- package/dist/opds/Copies.js +0 -1
- package/dist/opds/Holds.js +0 -1
- package/dist/opds/Price.js +0 -1
- package/dist/publication/AltIdentifier.js +0 -1
- package/dist/publication/BelongsTo.js +0 -1
- package/dist/publication/Contributor.js +0 -1
- package/dist/publication/GuidedNavigation.js +0 -1
- package/dist/publication/Layout.js +0 -1
- package/dist/publication/Link.js +0 -1
- package/dist/publication/LocalizedString.js +0 -1
- package/dist/publication/Locator.js +0 -1
- package/dist/publication/LocatorCollection.js +0 -1
- package/dist/publication/Manifest.js +0 -1
- package/dist/publication/Metadata.js +0 -1
- package/dist/publication/Profiles.js +0 -1
- package/dist/publication/Properties.js +0 -1
- package/dist/publication/Publication.js +0 -1
- package/dist/publication/PublicationCollection.js +0 -1
- package/dist/publication/ReadingProgression.js +0 -1
- package/dist/publication/Subject.js +0 -1
- package/dist/publication/TDM.js +0 -1
- package/dist/publication/accessibility/Accessibility.js +0 -1
- package/dist/publication/accessibility/AccessibilityMetadataDisplayGuide.js +0 -1
- package/dist/publication/accessibility/Localization.js +0 -1
- package/dist/publication/accessibility/SupportedLanguages.js +0 -1
- package/dist/publication/encryption/Encryption.js +0 -1
- package/dist/publication/encryption/Properties.js +0 -1
- package/dist/publication/encryption/index.js +0 -1
- package/dist/publication/epub/MediaOverlay.js +0 -1
- package/dist/publication/epub/Metadata.js +0 -1
- package/dist/publication/epub/Properties.js +0 -1
- package/dist/publication/epub/Publication.js +0 -1
- package/dist/publication/epub/index.js +0 -1
- package/dist/publication/html/DomRange.js +0 -1
- package/dist/publication/html/DomRangePoint.js +0 -1
- package/dist/publication/html/Locations.js +0 -1
- package/dist/publication/html/index.js +0 -1
- package/dist/publication/opds/Properties.js +0 -1
- package/dist/publication/opds/Publication.js +0 -1
- package/dist/publication/opds/index.js +0 -1
- package/dist/publication/services/content/Content.js +0 -2
- package/dist/publication/services/content/ContentTokenizer.js +0 -1
- package/dist/publication/services/content/Iterator.js +0 -1
- package/dist/publication/services/content/element/attributes.js +0 -1
- package/dist/publication/services/content/element/element.js +0 -1
- package/dist/publication/services/content/element/text_role.js +0 -1
- package/dist/publication/services/content/iterators/HTMLResourceContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/PDFTextContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/PublicationContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/helpers.js +0 -1
- package/dist/publication/services/timeline/Timeline.js +0 -1
- package/dist/publication/services/timeline/audio.js +0 -1
- package/dist/publication/services/timeline/html.js +0 -1
- package/dist/publication/services/timeline/index.js +0 -1
- package/dist/util/JSONParse.js +0 -1
- package/dist/util/URITemplate.js +0 -1
- package/dist/util/mediatype/MediaType.js +0 -1
- package/dist/util/npt.js +0 -1
- package/dist/util/tokenizer/TextTokenizer.js +0 -1
- package/dist/util/tokenizer/tokenize-english/abbreviations.js +0 -1
- package/dist/util/tokenizer/tokenize-english/index.js +0 -2
- package/dist/util/tokenizer/tokenize-english/utils.js +0 -1
- package/dist/util/tokenizer/tokenize-text/index.js +0 -1
- package/dist/util/tokenizer/tokenize-text/tokens.js +0 -1
- package/src/locales/publication-metadata/ar.json +0 -402
- package/src/locales/publication-metadata/brh.json +0 -1
- package/src/locales/publication-metadata/da.json +0 -310
- package/src/locales/publication-metadata/el.json +0 -310
- package/src/locales/publication-metadata/en.json +0 -310
- package/src/locales/publication-metadata/es.json +0 -333
- package/src/locales/publication-metadata/et.json +0 -310
- package/src/locales/publication-metadata/fi.json +0 -310
- package/src/locales/publication-metadata/fr.json +0 -333
- package/src/locales/publication-metadata/he.json +0 -9
- package/src/locales/publication-metadata/it.json +0 -333
- package/src/locales/publication-metadata/lt.json +0 -8
- package/src/locales/publication-metadata/pl.json +0 -333
- package/src/locales/publication-metadata/pt_PT.json +0 -329
- package/src/locales/publication-metadata/sv.json +0 -310
- package/src/locales/publication-metadata/tr.json +0 -51
- package/src/locales/publication-metadata/uk.json +0 -1
- package/src/publication/services/timeline/audio.ts +0 -31
- package/src/publication/services/timeline/html.ts +0 -5
- package/types/src/publication/services/timeline/audio.d.ts +0 -4
- package/types/src/publication/services/timeline/html.d.ts +0 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const e = { metadata: { accessibility: { "display-guide": { "accessibility-summary": { "no-metadata": "Sem informação disponível", "publisher-contact": "Para mais informações sobre a acessibilidade deste produto, contacte a editora: ", title: "Resumo de acessibilidade" }, "additional-accessibility-information": { aria: { compact: "Inclui funções ARIA", descriptive: "O conteúdo foi otimizado com funções ARIA para melhorar a organização e facilitar a navegação" }, "audio-descriptions": "Descrições em áudio", braille: "Braille", "color-not-sole-means-of-conveying-information": "A cor não é o único meio de transmitir informação", "dyslexia-readability": "Otimizado para dislexia", "full-ruby-annotations": "Anotações Ruby completas", "high-contrast-between-foreground-and-background-audio": "Alto contraste entre som principal e fundo", "high-contrast-between-text-and-background": "Alto contraste entre texto e fundo", "large-print": "Impressão ampliada", "page-breaks": { compact: "Inclui quebras de página", descriptive: "Inclui quebras de página da fonte impressa original" }, "ruby-annotations": "Algumas anotações Ruby", "sign-language": "Língua gestual", "tactile-graphics": { compact: "Inclui gráficos táteis", descriptive: "Inclui gráficos táteis que facilitam o acesso a elementos visuais para pessoas cegas" }, "tactile-objects": "Objetos táteis 3D", "text-to-speech-hinting": "Sugestões para leitura em voz alta", title: "Informação adicional de acessibilidade", "ultra-high-contrast-between-text-and-background": "Contraste muito elevado entre texto e fundo", "visible-page-numbering": "Numeração de páginas visível", "without-background-sounds": "Sem sons de fundo" }, conformance: { a: { compact: "Cumpre as normas mínimas de acessibilidade", descriptive: "A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível A" }, aa: { compact: "Cumpre as normas aceites de acessibilidade", descriptive: "A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AA" }, aaa: { compact: "Excede as normas aceites de acessibilidade", descriptive: "A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AAA" }, certifier: "A publicação foi certificada por ", "certifier-credentials": "As credenciais do certificador são ", details: { "certification-info": "A publicação foi certificada em ", "certifier-report": "Para mais informações, consulte o relatório do certificador", claim: "Esta publicação declara conformidade com", "epub-accessibility-1-0": "EPUB Accessibility 1.0", "epub-accessibility-1-1": "EPUB Accessibility 1.1", "level-a": "Nível A", "level-aa": "Nível AA", "level-aaa": "Nível AAA", "wcag-2-0": { compact: "WCAG 2.0", descriptive: "Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.0" }, "wcag-2-1": { compact: "WCAG 2.1", descriptive: "Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.1" }, "wcag-2-2": { compact: "WCAG 2.2", descriptive: "Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.2" } }, "details-title": "Detalhes de conformidade", no: "Sem informação disponível", title: "Conformidade", "unknown-standard": "Não foi possível determinar a conformidade com as normas de acessibilidade aceites para esta publicação" }, hazards: { flashing: { compact: "Conteúdo intermitente", descriptive: "A publicação contém conteúdo intermitente que pode causar crises fotossensíveis" }, "flashing-none": { compact: "Sem perigos de intermitência", descriptive: "A publicação não contém conteúdo intermitente que possa causar crises fotossensíveis" }, "flashing-unknown": { compact: "Risco de intermitência desconhecido", descriptive: "Não foi possível determinar se existe conteúdo intermitente que possa causar crises fotossensíveis" }, motion: { compact: "Simulação de movimento", descriptive: "A publicação contém simulações de movimento que podem causar enjoo" }, "motion-none": { compact: "Sem simulação de movimento", descriptive: "A publicação não contém simulações de movimento que possam causar enjoo" }, "motion-unknown": { compact: "Risco de movimento desconhecido", descriptive: "Não foi possível determinar se existem simulações de movimento que possam causar enjoo" }, "no-metadata": "Sem informação disponível", none: { compact: "Sem perigos", descriptive: "A publicação não contém perigos conhecidos" }, sound: { compact: "Sons sensíveis", descriptive: "A publicação contém sons que podem causar sensibilidade auditiva" }, "sound-none": { compact: "Sem perigos sonoros", descriptive: "A publicação não contém sons que possam causar sensibilidade auditiva" }, "sound-unknown": { compact: "Risco sonoro desconhecido", descriptive: "Não foi possível determinar se a publicação contém sons que possam causar sensibilidade auditiva" }, title: "Perigos", unknown: "Presença de perigos não determinada" }, "legal-considerations": { exempt: { compact: "Declara isenção de conformidade em algumas jurisdições", descriptive: "Esta publicação declara isenção de conformidade em algumas jurisdições" }, "no-metadata": "Sem informação disponível", title: "Considerações legais" }, navigation: { index: { compact: "Índice remissivo", descriptive: "Índice com ligações para entradas referenciadas" }, "no-metadata": "Sem informação disponível", "page-navigation": { compact: "Ir para página", descriptive: "Lista de páginas que permite aceder às páginas da versão impressa original" }, structural: { compact: "Títulos e estrutura", descriptive: "Elementos como títulos, tabelas, etc., para navegação estruturada" }, title: "Navegação", toc: { compact: "Índice", descriptive: "Índice de conteúdos com ligações para todos os capítulos do texto" } }, "rich-content": { "accessible-chemistry-as-latex": { compact: "Fórmulas químicas em LaTeX", descriptive: "Fórmulas químicas em formato acessível (LaTeX)" }, "accessible-chemistry-as-mathml": { compact: "Fórmulas químicas em MathML", descriptive: "Fórmulas químicas em formato acessível (MathML)" }, "accessible-math-as-latex": { compact: "Matemática em LaTeX", descriptive: "Fórmulas matemáticas em formato acessível (LaTeX)" }, "accessible-math-described": "Descrição textual das fórmulas matemáticas", "closed-captions": { compact: "Vídeos com legendas ocultas", descriptive: "Os vídeos incluídos na publicação têm legendas ocultas" }, "extended-descriptions": "Imagens complexas com descrições detalhadas", "math-as-mathml": { compact: "Matemática em MathML", descriptive: "Fórmulas matemáticas em formato acessível (MathML)" }, "open-captions": { compact: "Vídeos com legendas abertas", descriptive: "Os vídeos incluídos na publicação têm legendas abertas" }, title: "Conteúdo rico", transcript: "Transcrição fornecida", unknown: "Sem informação disponível" }, "ways-of-reading": { "nonvisual-reading": { "alt-text": { compact: "Contém texto alternativo", descriptive: "Inclui descrições alternativas de texto para imagens" }, "no-metadata": "Sem informação sobre leitura não visual", none: { compact: "Não legível em leitura em voz alta ou braille dinâmico", descriptive: "O conteúdo não é legível em voz alta ou através de braille dinâmico" }, "not-fully": { compact: "Parcialmente legível em leitura em voz alta ou braille dinâmico", descriptive: "Nem todo o conteúdo é legível em voz alta ou através de braille dinâmico" }, readable: { compact: "Totalmente legível em leitura em voz alta ou braille dinâmico", descriptive: "Todo o conteúdo pode ser lido em voz alta ou através de braille dinâmico" } }, "prerecorded-audio": { complementary: { compact: "Contém clipes de áudio pré-gravados", descriptive: "O conteúdo contém clipes de áudio pré-gravados incorporados" }, "no-metadata": "Sem informação sobre áudio pré-gravado", only: { compact: "Apenas áudio pré-gravado", descriptive: "A publicação é apenas áudio e não possui alternativa em texto" }, synchronized: { compact: "Áudio pré-gravado sincronizado com texto", descriptive: "Todo o conteúdo está disponível como áudio pré-gravado sincronizado com texto" } }, title: "Formas de leitura", "visual-adjustments": { modifiable: { compact: "Aspeto personalizável", descriptive: "O aspeto do texto e o layout da página podem ser modificados de acordo com as capacidades do sistema de leitura (tipo e tamanho de letra, espaçamento entre parágrafos, frases, palavras e letras, bem como a cor de fundo e do texto)" }, unknown: "Sem informação sobre personalização do aspeto", unmodifiable: { compact: "Aspeto não ajustável", descriptive: "O texto e o layout da página não podem ser modificados, uma vez que a experiência de leitura é semelhante à versão impressa, mas os sistemas de leitura ainda podem oferecer opções de ampliação" } } } } }, altIdentifier_one: "identificador alternativo", altIdentifier_other: "identificadores alternativos", artist_one: "artista", artist_other: "artistas", author_one: "autor", author_other: "autores", collection_one: "coleção", collection_other: "coleções", colorist_one: "colorista", colorist_other: "coloristas", contributor_one: "colaborador", contributor_other: "colaboradores", description: "descrição", duration: "duração", editor_one: "editor", editor_other: "editores", identifier_one: "identificador", identifier_other: "identificadores", illustrator_one: "ilustrador", illustrator_other: "ilustradores", imprint_one: "selo editorial", imprint_other: "selos editoriais", inker_one: "arte-finalista", inker_other: "arte-finalistas", language_one: "idioma", language_other: "idiomas", letterer_one: "letrista", letterer_other: "letristas", modified: "data de modificação", narrator_one: "narrador", narrator_other: "narradores", numberOfPages: "número de páginas", penciler_one: "desenhador", penciler_other: "desenhadores", published: "data de publicação", publisher_one: "editora", publisher_other: "editoras", series_one: "série", series_other: "séries", subject_one: "tema", subject_other: "temas", subtitle: "subtítulo", title: "título", translator_one: "tradutor", translator_other: "tradutores" } }, a = {
|
|
2
|
+
publication: e
|
|
3
|
+
};
|
|
4
|
+
export {
|
|
5
|
+
a as default,
|
|
6
|
+
e as publication
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const e = { metadata: { accessibility: { "display-guide": { "accessibility-summary": { "no-metadata": "Information saknas", "publisher-contact": "För mer information om den här publikationens tillgänglighet, kontakta utgivaren: ", title: "Kompletterande information om tillgänglighet" }, "additional-accessibility-information": { aria: { compact: "Innehåller ARIA-roller", descriptive: "Innehållet har försetts med ARIA-roller för att tydliggöra strukturen och underlätta navigering" }, "audio-descriptions": "Syntolkning", braille: "Punktskrift", "color-not-sole-means-of-conveying-information": "Betydelse uttrycks aldrig enbart med färg", "dyslexia-readability": "Förbättrad läsbarhet för personer med dyslexi", "full-ruby-annotations": "Fullständig ruby-annotering", "high-contrast-between-foreground-and-background-audio": "Hög kontrast mellan förgrundsljud och bakgrundsljud", "high-contrast-between-text-and-background": "Hög kontrast mellan text och bakgrund", "large-print": "Storstil", "page-breaks": { compact: "Innehåller sidnummer", descriptive: "Innehåller sidnummer från tryckt förlaga" }, "ruby-annotations": "Viss ruby-annotering", "sign-language": "Teckenspråk", "tactile-graphics": { compact: "Innehåller taktila bilder", descriptive: "Taktila bilder har lagts till för att tillgängliggöra visuella element för personer med synnedsättning" }, "tactile-objects": "Taktila 3D-objekt", "text-to-speech-hinting": "Innehåller uttalsinstruktioner för talsyntes", title: "Ytterligare tillgänglighetsinformation", "ultra-high-contrast-between-text-and-background": "Extra hög kontrast mellan text och bakgrund", "visible-page-numbering": "Synlig sidnumrering", "without-background-sounds": "Utan bakgrundsljud" }, conformance: { a: { compact: "Publikationen uppfyller tillgänglighetskrav på en grundläggande nivå", descriptive: "Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå A" }, aa: { compact: "Publikationen uppfyller tillgänglighetskrav på en vedertagen nivå", descriptive: "Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AA" }, aaa: { compact: "Publikationen uppfyller tillgänglighetskrav utöver en vedertagen nivå", descriptive: "Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AAA" }, certifier: "Publikationen är certifierad av ", "certifier-credentials": "Certifierarens märkning är ", details: { "certification-info": "Publikationen certifierades ", "certifier-report": "Se certifieringsrapporten för mer information", claim: "Publikationen anger att den uppfyller kraven enligt", "epub-accessibility-1-0": "EPUB Accessibility 1.0", "epub-accessibility-1-1": "EPUB Accessibility 1.1", "level-a": "nivå A", "level-aa": "nivå AA", "level-aaa": "nivå AAA", "wcag-2-0": { compact: "WCAG 2.0", descriptive: "Web Content Accessibility Guidelines (WCAG) 2.0" }, "wcag-2-1": { compact: "WCAG 2.1", descriptive: "Web Content Accessibility Guidelines (WCAG) 2.1" }, "wcag-2-2": { compact: "WCAG 2.2", descriptive: "Web Content Accessibility Guidelines (WCAG) 2.2" } }, "details-title": "Detaljerad information om tillgänglighetskrav", no: "Information saknas", title: "Tillgänglighetskrav", "unknown-standard": "Det går inte att avgöra om publikationen uppfyller vedertagna tillgänglighetskrav" }, hazards: { flashing: { compact: "Blinkande innehåll", descriptive: "Publikationen har blinkande innehåll som kan vara skadligt för ljuskänsliga personer" }, "flashing-none": { compact: "Inget blinkande innehåll", descriptive: "Publikationen har inget blinkande innehåll" }, "flashing-unknown": { compact: "Förekomst av blinkande innehåll är okänd", descriptive: "Förekomst av blinkande innehåll är okänd" }, motion: { compact: "Rörelsesimulering", descriptive: "Publikationen innehåller rörelsesimulering som skulle kunna orsaka illamående" }, "motion-none": { compact: "Ingen rörelsesimulering", descriptive: "Publikationen innehåller ingen rörelsesimulering" }, "motion-unknown": { compact: "Förekomst av rörelsesimulering är okänd", descriptive: "Förekomst av rörelsesimulering är okänd" }, "no-metadata": "Information saknas", none: { compact: "Inga risker", descriptive: "Publikationen innehåller inga risker" }, sound: { compact: "Ljud", descriptive: "Publikationen innehåller ljud som kan orsaka obehag" }, "sound-none": { compact: "Inget ljud som kan orsaka obehag", descriptive: "Publikationen innehåller inget ljud som kan orsaka obehag" }, "sound-unknown": { compact: "Förekomst av ljud som kan orsaka obehag är okänd", descriptive: "Förekomst av ljud som kan orsaka obehag är okänd" }, title: "Risker", unknown: "Förekomst av risker är okänd" }, "legal-considerations": { exempt: { compact: "Åberopar ett undantag från vissa lagstadgade tillgänglighetskrav", descriptive: "Publikationen åberopar ett undantag från vissa lagstadgade tillgänglighetskrav" }, "no-metadata": "Information saknas", title: "Juridiska aspekter" }, navigation: { index: { compact: "Register", descriptive: "Register med länkar till innehållet" }, "no-metadata": "Information saknas", "page-navigation": { compact: "Gå till sida", descriptive: "Sidindelning för navigering enligt sidnummer i tryckt förlaga" }, structural: { compact: "Rubriker", descriptive: "Navigerbara element såsom rubriker eller tabeller" }, title: "Navigering", toc: { compact: "Innehållsförteckning", descriptive: "Innehållsförteckning med länkar till alla kapitel" } }, "rich-content": { "accessible-chemistry-as-latex": { compact: "Kemiska formler i LaTeX", descriptive: "Kemiska formler i tillgängligt format (LaTeX)" }, "accessible-chemistry-as-mathml": { compact: "Kemiska formler i MathML", descriptive: "Kemiska formler i tillgängligt format (MathML)" }, "accessible-math-as-latex": { compact: "Matematik som LaTeX", descriptive: "Matematiska formler i tillgängligt format (LaTeX)" }, "accessible-math-described": "Innehåller textbeskrivningar av matematik", "closed-captions": { compact: "Videoklipp har undertext som kan sättas på/stängas av", descriptive: "Videoklipp som ingår i publikationen har undertext som kan sättas på och stängas av (stängda undertexter)" }, "extended-descriptions": "Informationsrika bilder har utökade bildbeskrivningar", "math-as-mathml": { compact: "Matematik som MathML", descriptive: "Matematiska formler i tillgängligt format (MathML)" }, "open-captions": { compact: "Videoklipp har undertext som inte kan stängas av", descriptive: "Videoklipp som ingår i publikationen har undertext som inte kan stängas av (öppna undertexter)" }, title: "Berikat innehåll", transcript: "Innehåller transkriptioner", unknown: "Information saknas" }, "ways-of-reading": { "nonvisual-reading": { "alt-text": { compact: "Har textalternativ (alt-texter)", descriptive: "Har textalternativ (alt-texter) till bilder" }, "no-metadata": "Information om icke-visuell läsbarhet saknas", none: { compact: "Kan inte läsas med uppläsningsfunktion eller punktskriftsskärm", descriptive: "Innehållet går inte att läsa med uppläsningsfunktion eller punktskriftsskärm" }, "not-fully": { compact: "Inte läsbart i sin helhet med uppläsningsfunktion eller punktskriftsskärm", descriptive: "Allt innehåll går inte att läsa med uppläsningsfunktion eller punktskriftsskärm" }, readable: { compact: "Kan läsas med uppläsningsfunktion eller punktskriftsskärm", descriptive: "Hela innehållet går att läsa med uppläsningsfunktion eller punktskriftsskärm" } }, "prerecorded-audio": { complementary: { compact: "Förinspelade ljudklipp", descriptive: "Innehåller förinspelade ljudklipp" }, "no-metadata": "Information om förinspelat ljud saknas", only: { compact: "Endast förinspelat ljud", descriptive: "Bok med ljud utan textalternativ" }, synchronized: { compact: "Förinspelat ljud synkroniserat med texten", descriptive: "Hela innehållet finns tillgängligt som förinspelat ljud synkroniserat med texten" } }, title: "Olika sätt att läsa", "visual-adjustments": { modifiable: { compact: "Utseendet kan justeras", descriptive: "Det går att justera text och layout i den utsträckning som läsprogrammet tillåter, till exempel typsnitt, storlek på text, avstånd mellan rader och stycken samt färg på text och bakgrund" }, unknown: "Information om möjlighet att justera utseende saknas", unmodifiable: { compact: "Utseendet kan inte justeras", descriptive: "Text- och sidlayout kan inte justeras eftersom presentationen liknar en tryckt version, men läsprogram kan ha funktioner för att zooma in" } } } } }, altIdentifier_one: "alternativ identifierare", altIdentifier_other: "alternativa identifierare", artist_one: "konstnär", artist_other: "konstnärer", author_one: "författare", author_other: "författare", collection_one: "samling", collection_other: "samlingar", colorist_one: "kolorist", colorist_other: "kolorister", contributor_one: "medverkande", contributor_other: "medverkande", description: "beskrivning", duration: "speltid", editor_one: "redaktör", editor_other: "redaktörer", identifier_one: "identifierare", identifier_other: "identifierare", illustrator_one: "illustratör", illustrator_other: "illustratörer", imprint_one: "imprint", imprint_other: "imprint", inker_one: "tuschare", inker_other: "tuschare", language_one: "språk", language_other: "språk", letterer_one: "textare", letterer_other: "textare", modified: "ändringsdatum", narrator_one: "berättarröst", narrator_other: "berättarröster", numberOfPages: "sidantal", penciler_one: "tecknare", penciler_other: "tecknare", published: "publikationsdatum", publisher_one: "förlag", publisher_other: "förlag", series_one: "serie", series_other: "serier", subject_one: "ämne", subject_other: "ämnen", subtitle: "undertitel", title: "titel", translator_one: "översättare", translator_other: "översättare" } }, t = {
|
|
2
|
+
publication: e
|
|
3
|
+
};
|
|
4
|
+
export {
|
|
5
|
+
t as default,
|
|
6
|
+
e as publication
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readium/shared",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared models to be used across other Readium projects and implementations in Typescript",
|
|
6
6
|
"author": "readium",
|
|
@@ -26,35 +26,16 @@
|
|
|
26
26
|
"parser",
|
|
27
27
|
"tts"
|
|
28
28
|
],
|
|
29
|
+
"main": "./dist/index.umd.cjs",
|
|
30
|
+
"module": "./dist/index.js",
|
|
29
31
|
"types": "./types/src/index.d.ts",
|
|
30
32
|
"exports": {
|
|
31
33
|
".": {
|
|
32
|
-
"ts-toolkit-source": "./src/index.ts",
|
|
33
34
|
"types": "./types/src/index.d.ts",
|
|
34
|
-
"import": "./dist/index.js"
|
|
35
|
-
|
|
36
|
-
"./html": {
|
|
37
|
-
"ts-toolkit-source": "./src/publication/html/index.ts",
|
|
38
|
-
"types": "./types/src/publication/html/index.d.ts",
|
|
39
|
-
"import": "./dist/publication/html/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./epub": {
|
|
42
|
-
"ts-toolkit-source": "./src/publication/epub/index.ts",
|
|
43
|
-
"types": "./types/src/publication/epub/index.d.ts",
|
|
44
|
-
"import": "./dist/publication/epub/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./opds": {
|
|
47
|
-
"ts-toolkit-source": "./src/publication/opds/index.ts",
|
|
48
|
-
"types": "./types/src/publication/opds/index.d.ts",
|
|
49
|
-
"import": "./dist/publication/opds/index.js"
|
|
50
|
-
},
|
|
51
|
-
"./encryption": {
|
|
52
|
-
"ts-toolkit-source": "./src/publication/encryption/index.ts",
|
|
53
|
-
"types": "./types/src/publication/encryption/index.d.ts",
|
|
54
|
-
"import": "./dist/publication/encryption/index.js"
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"require": "./dist/index.umd.cjs"
|
|
55
37
|
}
|
|
56
38
|
},
|
|
57
|
-
"sideEffects": false,
|
|
58
39
|
"files": [
|
|
59
40
|
"dist",
|
|
60
41
|
"src",
|
|
@@ -63,26 +44,38 @@
|
|
|
63
44
|
"engines": {
|
|
64
45
|
"node": ">=18"
|
|
65
46
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
47
|
+
"size-limit": [
|
|
48
|
+
{
|
|
49
|
+
"path": "dist/index.js",
|
|
50
|
+
"limit": "50 KB"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@edrlab/thorium-locales": "github:edrlab/thorium-locales"
|
|
73
55
|
},
|
|
74
56
|
"devDependencies": {
|
|
75
57
|
"@babel/core": "^7.28.6",
|
|
76
58
|
"@babel/preset-env": "^7.28.6",
|
|
77
59
|
"@babel/preset-typescript": "^7.28.5",
|
|
60
|
+
"@size-limit/file": "^12.0.0",
|
|
78
61
|
"@types/jest": "^30.0.0",
|
|
79
62
|
"babel-jest": "^30.2.0",
|
|
80
63
|
"css-selector-generator": "^3.8.0",
|
|
81
64
|
"jest": "^30.2.0",
|
|
82
|
-
"rimraf": "^6.1.
|
|
65
|
+
"rimraf": "^6.1.2",
|
|
66
|
+
"size-limit": "^12.0.0",
|
|
83
67
|
"ts-jest": "^29.4.6",
|
|
84
68
|
"tslib": "^2.8.1",
|
|
85
69
|
"typescript": "^5.9.3",
|
|
86
70
|
"vite": "^7.3.1"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"dev": "vite",
|
|
74
|
+
"clean": "rimraf types dist",
|
|
75
|
+
"build": "pnpm clean && tsc && vite build",
|
|
76
|
+
"test": "jest",
|
|
77
|
+
"size": "size-limit",
|
|
78
|
+
"check-locales": "node scripts/check-locales.mjs",
|
|
79
|
+
"update-locales": "pnpm remove @edrlab/thorium-locales && pnpm add @edrlab/thorium-locales@github:edrlab/thorium-locales && pnpm check-locales"
|
|
87
80
|
}
|
|
88
|
-
}
|
|
81
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Link } from '../publication/Link.ts';
|
|
2
2
|
import { Fetcher } from './Fetcher.ts';
|
|
3
|
-
import { NumberRange, Resource } from './Resource.ts';
|
|
3
|
+
import { NumberRange, Resource, ResourceReadOptions } from './Resource.ts';
|
|
4
4
|
|
|
5
5
|
export type FetchImplementation = (
|
|
6
6
|
input: RequestInfo | URL,
|
|
@@ -72,9 +72,9 @@ export class HttpResource implements Resource {
|
|
|
72
72
|
return this._link; // TODO mediatype alteration. Need http response mediatype sniffer stuff
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
async read(range?: NumberRange): Promise<Uint8Array | undefined> {
|
|
75
|
+
async read(range?: NumberRange, options?: ResourceReadOptions): Promise<Uint8Array | undefined> {
|
|
76
76
|
if (range) throw new Error('http read range not implemented!'); // TODO
|
|
77
|
-
const resp = await this.client(this.url);
|
|
77
|
+
const resp = await this.client(this.url, options?.signal ? { signal: options.signal } : undefined);
|
|
78
78
|
if (!resp.ok)
|
|
79
79
|
throw new Error(
|
|
80
80
|
`http GET request for ${this.url} failed with HTTP status code ${resp.status}`
|
|
@@ -108,7 +108,7 @@ export class HttpResource implements Resource {
|
|
|
108
108
|
return await resp.text();
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async readAsXML(): Promise<
|
|
111
|
+
async readAsXML(): Promise<Document> {
|
|
112
112
|
const resp = await this.client(this.url);
|
|
113
113
|
if (!resp.ok)
|
|
114
114
|
throw new Error(
|
|
@@ -116,7 +116,7 @@ export class HttpResource implements Resource {
|
|
|
116
116
|
); // TODO
|
|
117
117
|
return new DOMParser().parseFromString(
|
|
118
118
|
await resp.text(),
|
|
119
|
-
'application/xml'
|
|
119
|
+
this._link.mediaType.isHTML ? (this._link.mediaType.string as 'application/xhtml+xml' | 'text/html') : 'text/xml'
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
}
|
package/src/fetcher/Resource.ts
CHANGED
|
@@ -11,10 +11,15 @@ export class NumberRange {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface ResourceReadOptions {
|
|
15
|
+
/** Aborts the underlying request, e.g. when a prefetched resource is no longer needed */
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export abstract class Resource {
|
|
15
20
|
abstract link(): Promise<Link>;
|
|
16
21
|
abstract length(): Promise<number | undefined>; // TODO make try?
|
|
17
|
-
abstract read(range?: NumberRange): Promise<Uint8Array | undefined>;
|
|
22
|
+
abstract read(range?: NumberRange, options?: ResourceReadOptions): Promise<Uint8Array | undefined>;
|
|
18
23
|
readAsString(): Promise<string | undefined> {
|
|
19
24
|
return this.read().then(bytes => {
|
|
20
25
|
if (bytes === undefined) return bytes;
|
|
@@ -27,11 +32,11 @@ export abstract class Resource {
|
|
|
27
32
|
return JSON.parse(str);
|
|
28
33
|
});
|
|
29
34
|
}
|
|
30
|
-
readAsXML(): Promise<
|
|
31
|
-
return this.readAsString().then(str => {
|
|
35
|
+
readAsXML(): Promise<Document | undefined> {
|
|
36
|
+
return this.link().then(l => this.readAsString().then(str => {
|
|
32
37
|
if (str === undefined) return str;
|
|
33
|
-
return new DOMParser().parseFromString(str, 'text/xml');
|
|
34
|
-
});
|
|
38
|
+
return new DOMParser().parseFromString(str, l.mediaType.isHTML ? (l.mediaType.string as 'application/xhtml+xml' | 'text/html') : 'text/xml');
|
|
39
|
+
}));
|
|
35
40
|
}
|
|
36
41
|
abstract close(): void;
|
|
37
42
|
}
|
package/src/publication/Link.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
positiveNumberfromJSON,
|
|
12
12
|
setToArray,
|
|
13
13
|
} from '../util/JSONParse.ts';
|
|
14
|
-
import { Locator } from './Locator.ts';
|
|
14
|
+
import { LocatorLocations, Locator } from './Locator.ts';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Link Object for the Readium Web Publication Manifest.
|
|
@@ -197,10 +197,14 @@ export class Link {
|
|
|
197
197
|
* Creates a [Locator] from a reading order [Link].
|
|
198
198
|
*/
|
|
199
199
|
public get locator(): Locator {
|
|
200
|
+
let parts = this.href.split('#');
|
|
200
201
|
return new Locator({
|
|
201
|
-
href: this.href,
|
|
202
|
+
href: parts.length > 0 && parts[0] !== undefined ? parts[0] : this.href,
|
|
202
203
|
type: this.type ?? '',
|
|
203
204
|
title: this.title,
|
|
205
|
+
locations: new LocatorLocations({
|
|
206
|
+
fragments: parts.length > 1 && parts[1] !== undefined ? [parts[1]] : [],
|
|
207
|
+
}),
|
|
204
208
|
});
|
|
205
209
|
}
|
|
206
210
|
}
|
|
@@ -59,20 +59,12 @@ export class LocatorLocations {
|
|
|
59
59
|
'progression',
|
|
60
60
|
'totalProgression',
|
|
61
61
|
'position',
|
|
62
|
-
'otherLocations',
|
|
63
62
|
]);
|
|
64
63
|
Object.entries(json).forEach(([key, value]) => {
|
|
65
64
|
if (!reservedKeys.has(key)) {
|
|
66
65
|
otherLocations.set(key, value);
|
|
67
66
|
}
|
|
68
67
|
});
|
|
69
|
-
// json may be a live LocatorLocations instance (e.g. passed through in-memory
|
|
70
|
-
// rather than round-tripped as RWPM JSON) — its otherLocations is a Map, not
|
|
71
|
-
// flattened keys, and must be merged in directly rather than treated as an
|
|
72
|
-
// extension entry itself.
|
|
73
|
-
if (json.otherLocations instanceof Map) {
|
|
74
|
-
json.otherLocations.forEach((value: any, key: string) => otherLocations.set(key, value));
|
|
75
|
-
}
|
|
76
68
|
|
|
77
69
|
return new LocatorLocations({
|
|
78
70
|
fragments: arrayfromJSONorString(json.fragments || json.fragment),
|
|
@@ -184,22 +176,12 @@ export class Locator {
|
|
|
184
176
|
locations?: LocatorLocations;
|
|
185
177
|
text?: LocatorText;
|
|
186
178
|
}) {
|
|
187
|
-
|
|
188
|
-
const hrefFragment = hashIndex >= 0 ? values.href.slice(hashIndex + 1) : undefined;
|
|
189
|
-
this.href = hashIndex >= 0 ? values.href.slice(0, hashIndex) : values.href;
|
|
179
|
+
this.href = values.href;
|
|
190
180
|
this.type = values.type;
|
|
191
181
|
this.title = values.title;
|
|
192
|
-
// If locations.fragments is already set, it takes precedence over any fragment in the href.
|
|
193
|
-
// We don't merge both because explicit fragments are considered authoritative.
|
|
194
|
-
const existingFragments = values.locations?.fragments;
|
|
195
|
-
const needsFragment = hrefFragment && (!existingFragments || existingFragments.length === 0);
|
|
196
182
|
this.locations = values.locations
|
|
197
|
-
?
|
|
198
|
-
|
|
199
|
-
: values.locations
|
|
200
|
-
: hrefFragment
|
|
201
|
-
? new LocatorLocations({ fragments: [hrefFragment] })
|
|
202
|
-
: new LocatorLocations({});
|
|
183
|
+
? values.locations
|
|
184
|
+
: new LocatorLocations({});
|
|
203
185
|
this.text = values.text;
|
|
204
186
|
}
|
|
205
187
|
|
|
@@ -43,7 +43,7 @@ export class Manifest {
|
|
|
43
43
|
}) {
|
|
44
44
|
this.context = values.context;
|
|
45
45
|
this.metadata = values.metadata;
|
|
46
|
-
this.links = values.links;
|
|
46
|
+
this.links = values.links || new Links([]);
|
|
47
47
|
this.readingOrder = values.readingOrder;
|
|
48
48
|
this.resources = values.resources;
|
|
49
49
|
this.toc = values.toc;
|
|
@@ -63,8 +63,6 @@ export class Manifest {
|
|
|
63
63
|
|
|
64
64
|
if (!metadata) return;
|
|
65
65
|
|
|
66
|
-
const links = Links.deserialize(json.links);
|
|
67
|
-
|
|
68
66
|
const readingOrder = Links.deserialize(
|
|
69
67
|
json.readingOrder ? json.readingOrder : json.spine
|
|
70
68
|
);
|
|
@@ -80,7 +78,7 @@ export class Manifest {
|
|
|
80
78
|
return new Manifest({
|
|
81
79
|
context: arrayfromJSONorString(json['@context']),
|
|
82
80
|
metadata,
|
|
83
|
-
links,
|
|
81
|
+
links: Links.deserialize(json.links),
|
|
84
82
|
readingOrder,
|
|
85
83
|
resources: Links.deserialize(json.resources),
|
|
86
84
|
toc: Links.deserialize(json.toc),
|
|
@@ -95,7 +93,7 @@ export class Manifest {
|
|
|
95
93
|
const json: any = {};
|
|
96
94
|
if (this.context !== undefined) json['@context'] = this.context;
|
|
97
95
|
json.metadata = this.metadata.serialize();
|
|
98
|
-
if (this.links
|
|
96
|
+
if (this.links && this.links.items.length > 0) json.links = this.links.serialize();
|
|
99
97
|
json.readingOrder = this.readingOrder.serialize();
|
|
100
98
|
if (this.resources) json.resources = this.resources.serialize();
|
|
101
99
|
if (this.toc) json.toc = this.toc.serialize();
|
|
@@ -145,19 +143,21 @@ export class Manifest {
|
|
|
145
143
|
* Returns null if the resource is not found in this manifest.
|
|
146
144
|
*/
|
|
147
145
|
public locatorFromLink(link: Link): Locator | undefined {
|
|
148
|
-
const
|
|
149
|
-
const
|
|
146
|
+
const components = link.href.split("#");
|
|
147
|
+
const href = components.length == 2 ? components[0] : link.href;
|
|
148
|
+
const resourceLink = this.linkWithHref(href);
|
|
150
149
|
if(!resourceLink) return undefined;
|
|
151
150
|
const type = resourceLink.type;
|
|
152
151
|
if(!type) return undefined;
|
|
153
|
-
const
|
|
152
|
+
const fragment = components.length == 2 ? components[1] : undefined;
|
|
154
153
|
|
|
155
154
|
return new Locator({
|
|
156
|
-
href
|
|
155
|
+
href,
|
|
157
156
|
type,
|
|
158
157
|
title: resourceLink.title ?? link.title,
|
|
159
158
|
locations: new LocatorLocations({
|
|
160
|
-
|
|
159
|
+
fragments: fragment ? [fragment] : undefined,
|
|
160
|
+
progression: fragment ? undefined : 0.0,
|
|
161
161
|
})
|
|
162
162
|
});
|
|
163
163
|
}
|
|
@@ -13,7 +13,6 @@ import { Resource } from '../fetcher/Resource.ts';
|
|
|
13
13
|
import { GuidedNavigationDocument } from "./GuidedNavigation.ts";
|
|
14
14
|
import { MediaType, URITemplate } from "../util/index.ts";
|
|
15
15
|
import { Timeline } from './services/timeline/Timeline.ts';
|
|
16
|
-
import { buildTimeline } from './services/timeline/index.ts';
|
|
17
16
|
|
|
18
17
|
/** Shared model for a Readium Publication. */
|
|
19
18
|
export class Publication {
|
|
@@ -52,7 +51,7 @@ export class Publication {
|
|
|
52
51
|
* The result is cached after the first call.
|
|
53
52
|
*/
|
|
54
53
|
public get timeline(): Timeline {
|
|
55
|
-
if (!this._timeline) this._timeline =
|
|
54
|
+
if (!this._timeline) this._timeline = Timeline.build(this);
|
|
56
55
|
return this._timeline;
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
// Localization.ts
|
|
2
|
+
|
|
1
3
|
import { SUPPORTED_LANGUAGES } from './SupportedLanguages.ts';
|
|
2
|
-
import
|
|
4
|
+
// Static import for English (default locale)
|
|
5
|
+
import enLocale from '@edrlab/thorium-locales/publication-metadata/en.json';
|
|
3
6
|
|
|
4
7
|
export interface L10nString {
|
|
5
8
|
compact: string;
|
|
@@ -13,17 +16,16 @@ interface LocaleData {
|
|
|
13
16
|
|
|
14
17
|
// Dynamic imports for non-English locales
|
|
15
18
|
const jsonLoaders: Record<string, () => Promise<{ default: any }>> = {
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'et': () => import('
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'sv': () => import('../../locales/publication-metadata/sv.json')
|
|
19
|
+
'fr': () => import('@edrlab/thorium-locales/publication-metadata/fr.json'),
|
|
20
|
+
'ar': () => import('@edrlab/thorium-locales/publication-metadata/ar.json'),
|
|
21
|
+
'da': () => import('@edrlab/thorium-locales/publication-metadata/da.json'),
|
|
22
|
+
// 'el': () => import('@edrlab/thorium-locales/publication-metadata/el.json'),
|
|
23
|
+
// 'et': () => import('@edrlab/thorium-locales/publication-metadata/et.json'),
|
|
24
|
+
'it': () => import('@edrlab/thorium-locales/publication-metadata/it.json'),
|
|
25
|
+
'pt_PT': () => import('@edrlab/thorium-locales/publication-metadata/pt_PT.json'),
|
|
26
|
+
'sv': () => import('@edrlab/thorium-locales/publication-metadata/sv.json'),
|
|
27
|
+
// 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
|
|
28
|
+
// 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
// Extract English accessibility data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SUPPORTED_LANGUAGES = ['en', 'ar', 'da', '
|
|
1
|
+
export const SUPPORTED_LANGUAGES = ['en', 'ar', 'da', 'fr', 'it', 'pt_PT', 'sv'];
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { Properties } from '../Properties.ts';
|
|
2
2
|
import { Encryption } from './Encryption.ts';
|
|
3
3
|
|
|
4
|
-
// Encryption extensions for link Properties.
|
|
4
|
+
// Encryption extensions for link [Properties].
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare module '../Properties' {
|
|
7
|
+
export interface Properties {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates that a resource is encrypted/obfuscated and provides relevant information for
|
|
10
|
+
* decryption.
|
|
11
|
+
*/
|
|
12
|
+
encryption: Encryption | undefined;
|
|
13
|
+
}
|
|
8
14
|
}
|
|
15
|
+
|
|
16
|
+
Object.defineProperty(Properties.prototype, 'encryption', {
|
|
17
|
+
get: function(): Encryption | undefined {
|
|
18
|
+
return Encryption.deserialize(this.otherProperties.encrypted);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { Metadata } from
|
|
2
|
-
import { MediaOverlay } from
|
|
1
|
+
import { Metadata } from "../Metadata.ts";
|
|
2
|
+
import { MediaOverlay } from "./MediaOverlay.ts";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
declare module '../Metadata' {
|
|
5
|
+
export interface Metadata {
|
|
6
|
+
getMediaOverlay(): MediaOverlay | undefined;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Metadata.prototype.getMediaOverlay = function(): MediaOverlay | undefined {
|
|
11
|
+
const mediaOverlay = this.otherMetadata?.['mediaOverlay'];
|
|
5
12
|
|
|
6
|
-
export function getMediaOverlay(metadata: Metadata): MediaOverlay | undefined {
|
|
7
|
-
const mediaOverlay = metadata.otherMetadata?.['mediaOverlay'];
|
|
8
13
|
if (!mediaOverlay) return;
|
|
14
|
+
|
|
9
15
|
return MediaOverlay.deserialize(mediaOverlay);
|
|
10
|
-
}
|
|
16
|
+
};
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { Properties } from '../Properties.ts';
|
|
2
2
|
|
|
3
|
-
// EPUB extensions for link Properties.
|
|
3
|
+
// EPUB extensions for link [Properties].
|
|
4
4
|
// https://readium.org/webpub-manifest/schema/extensions/epub/properties.schema.json
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare module '../Properties' {
|
|
7
|
+
export interface Properties {
|
|
8
|
+
/**
|
|
9
|
+
* Identifies content contained in the linked resource, that cannot be strictly identified using a
|
|
10
|
+
* media type.
|
|
11
|
+
*/
|
|
12
|
+
getContains(): Set<string> | undefined;
|
|
13
|
+
}
|
|
8
14
|
}
|
|
15
|
+
|
|
16
|
+
Properties.prototype.getContains = function(): Set<string> | undefined {
|
|
17
|
+
return new Set<string>(this.otherProperties['contains'] || []);
|
|
18
|
+
};
|
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
import { Links } from '../Link.ts';
|
|
2
2
|
import { Publication } from '../Publication.ts';
|
|
3
3
|
|
|
4
|
-
// EPUB extensions for Publication.
|
|
4
|
+
// EPUB extensions for [Publication].
|
|
5
5
|
// https://readium.org/webpub-manifest/schema/extensions/epub/subcollections.schema.json
|
|
6
6
|
// https://idpf.github.io/epub-vocabs/structure/#navigation
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
declare module '../Publication' {
|
|
9
|
+
export interface Publication {
|
|
10
|
+
/**
|
|
11
|
+
* Provides navigation to positions in the Publication content that correspond to the locations of
|
|
12
|
+
* page boundaries present in a print source being represented by this EPUB Publication.
|
|
13
|
+
*/
|
|
14
|
+
getPageList(): Links | undefined;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Identifies fundamental structural components of the publication in order to enable Reading
|
|
18
|
+
* Systems to provide the User efficient access to them.
|
|
19
|
+
*/
|
|
20
|
+
getLandmarks(): Links | undefined;
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
getListOfAudioClips(): Links | undefined;
|
|
23
|
+
getListOfIllustrations(): Links | undefined;
|
|
24
|
+
getListOfTables(): Links | undefined;
|
|
25
|
+
getListOfVideoClips(): Links | undefined;
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
return
|
|
22
|
-
}
|
|
29
|
+
Publication.prototype.getPageList = function(): Links | undefined {
|
|
30
|
+
return this.linksWithRole('pageList');
|
|
31
|
+
};
|
|
23
32
|
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
}
|
|
33
|
+
Publication.prototype.getLandmarks = function(): Links | undefined {
|
|
34
|
+
return this.linksWithRole('landmarks');
|
|
35
|
+
};
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
}
|
|
37
|
+
Publication.prototype.getListOfAudioClips = function(): Links | undefined {
|
|
38
|
+
return this.linksWithRole('loa');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Publication.prototype.getListOfIllustrations = function(): Links | undefined {
|
|
42
|
+
return this.linksWithRole('loi');
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Publication.prototype.getListOfTables = function(): Links | undefined {
|
|
46
|
+
return this.linksWithRole('lot');
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Publication.prototype.getListOfVideoClips = function(): Links | undefined {
|
|
50
|
+
return this.linksWithRole('lov');
|
|
51
|
+
};
|