@readium/navigator 2.4.0 → 2.5.0-beta.2

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.
Files changed (34) hide show
  1. package/dist/ReadiumCSS-after-B_e3a-PY.js +592 -0
  2. package/dist/ReadiumCSS-after-C-T_0paD.js +530 -0
  3. package/dist/ReadiumCSS-after-lr-n3fz2.js +475 -0
  4. package/dist/ReadiumCSS-after-mXeKKPap.js +490 -0
  5. package/dist/ReadiumCSS-before-Bjd3POej.js +426 -0
  6. package/dist/ReadiumCSS-before-CfXPAGaQ.js +425 -0
  7. package/dist/ReadiumCSS-before-CrNWvuyE.js +425 -0
  8. package/dist/ReadiumCSS-before-KVen5ceo.js +425 -0
  9. package/dist/ReadiumCSS-default-BKAG5pGU.js +162 -0
  10. package/dist/ReadiumCSS-default-C63bYOYF.js +183 -0
  11. package/dist/ReadiumCSS-default-CclvbeNC.js +162 -0
  12. package/dist/ReadiumCSS-default-DnlgDaBu.js +180 -0
  13. package/dist/ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js +82 -0
  14. package/dist/index.js +2246 -3159
  15. package/dist/index.umd.cjs +4432 -1083
  16. package/package.json +1 -1
  17. package/src/audio/index.ts +1 -1
  18. package/src/epub/EpubNavigator.ts +72 -32
  19. package/src/epub/css/ReadiumCSS.ts +11 -0
  20. package/src/epub/frame/FrameBlobBuilder.ts +23 -22
  21. package/src/epub/frame/FrameManager.ts +4 -0
  22. package/src/epub/fxl/FXLFramePoolManager.ts +5 -1
  23. package/src/epub/helpers/scriptMode.ts +52 -0
  24. package/src/epub/index.ts +1 -0
  25. package/src/injection/epubInjectables.ts +82 -9
  26. package/src/injection/webpubInjectables.ts +1 -1
  27. package/src/webpub/WebPubNavigator.ts +9 -4
  28. package/types/src/epub/EpubNavigator.d.ts +4 -3
  29. package/types/src/epub/css/ReadiumCSS.d.ts +2 -0
  30. package/types/src/epub/frame/FrameManager.d.ts +1 -0
  31. package/types/src/epub/helpers/scriptMode.d.ts +19 -0
  32. package/types/src/epub/index.d.ts +1 -0
  33. package/types/src/injection/epubInjectables.d.ts +4 -2
  34. package/types/src/injection/webpubInjectables.d.ts +1 -1
@@ -0,0 +1,19 @@
1
+ import { Metadata } from "@readium/shared";
2
+ export type ScriptMode = 'ltr' | 'rtl' | 'cjk-horizontal' | 'cjk-vertical' | 'mongolian-vertical';
3
+ /**
4
+ * Derives the script mode from publication metadata.
5
+ *
6
+ * Rules:
7
+ * - Only the first language in the array is used. A Latin book containing
8
+ * some Japanese is still Latin.
9
+ * - For CJK (zh/ja/ko): both language AND explicit reading progression are
10
+ * required. CJK vertical = explicit rtl + CJK language. CJK horizontal =
11
+ * CJK language with ltr or unset progression.
12
+ * - For RTL (ar/fa/he): language wins. If the primary language is a RTL
13
+ * script, RTL mode is applied regardless of the explicit progression
14
+ * direction declared in the OPF.
15
+ * - For Mongolian (mn): Traditional Mongolian script (mn-Mong) uses
16
+ * writing-mode: vertical-lr. Cyrillic Mongolian (mn-Cyrl) is standard LTR.
17
+ * An explicit script subtag is required; bare `mn` defaults to LTR.
18
+ */
19
+ export declare function getScriptMode(metadata: Metadata): ScriptMode;
@@ -3,3 +3,4 @@ export * from "./frame/index.ts";
3
3
  export * from "./fxl/index.ts";
4
4
  export * from "./preferences/index.ts";
5
5
  export * from "./css/index.ts";
6
+ export { getScriptMode, type ScriptMode } from "./helpers/scriptMode.ts";
@@ -1,6 +1,8 @@
1
1
  import { IInjectableRule } from "../injection/Injectable.ts";
2
2
  import { Metadata, Link } from "@readium/shared";
3
3
  /**
4
- * Creates injectable rules for EPUB content documents
4
+ * Creates injectable rules for EPUB content documents.
5
+ * Async so that script-specific Readium CSS stylesheets can be imported
6
+ * dynamically — only the variant that is actually needed is bundled.
5
7
  */
6
- export declare function createReadiumEpubRules(metadata: Metadata, readingOrderItems: Link[]): IInjectableRule[];
8
+ export declare function createReadiumEpubRules(metadata: Metadata, readingOrderItems: Link[]): Promise<IInjectableRule[]>;
@@ -1,4 +1,4 @@
1
- import { IInjectableRule } from "../injection/Injectable";
1
+ import { IInjectableRule } from "../injection/Injectable.ts";
2
2
  import { Link } from "@readium/shared";
3
3
  /**
4
4
  * Creates injectable rules for WebPub content documents