@ankhorage/expo-runtime 3.1.1 → 3.2.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 (121) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +2 -1
  3. package/dist/barcodeScanner.d.ts +2 -0
  4. package/dist/barcodeScanner.d.ts.map +1 -0
  5. package/dist/barcodeScanner.js +2 -0
  6. package/dist/barcodeScanner.js.map +1 -0
  7. package/dist/createExpoRuntimeRegistry.d.ts.map +1 -1
  8. package/dist/createExpoRuntimeRegistry.js +5 -0
  9. package/dist/createExpoRuntimeRegistry.js.map +1 -1
  10. package/dist/expoRuntimePlanningMetadata.d.ts +9 -1
  11. package/dist/expoRuntimePlanningMetadata.d.ts.map +1 -1
  12. package/dist/expoRuntimePlanningMetadata.js +8 -0
  13. package/dist/expoRuntimePlanningMetadata.js.map +1 -1
  14. package/dist/generatedSources.d.ts +1 -0
  15. package/dist/generatedSources.d.ts.map +1 -1
  16. package/dist/generatedSources.js +9 -1
  17. package/dist/generatedSources.js.map +1 -1
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/planning.d.ts +1 -1
  23. package/dist/planning.d.ts.map +1 -1
  24. package/dist/planning.js +1 -1
  25. package/dist/planning.js.map +1 -1
  26. package/dist/reader/ExpoReaderSurfaceAdapter.d.ts +4 -0
  27. package/dist/reader/ExpoReaderSurfaceAdapter.d.ts.map +1 -0
  28. package/dist/reader/ExpoReaderSurfaceAdapter.js +102 -0
  29. package/dist/reader/ExpoReaderSurfaceAdapter.js.map +1 -0
  30. package/dist/reader/ReaderDocumentError.d.ts +6 -0
  31. package/dist/reader/ReaderDocumentError.d.ts.map +1 -0
  32. package/dist/reader/ReaderDocumentError.js +9 -0
  33. package/dist/reader/ReaderDocumentError.js.map +1 -0
  34. package/dist/reader/ReaderViewport.d.ts +4 -0
  35. package/dist/reader/ReaderViewport.d.ts.map +1 -0
  36. package/dist/reader/ReaderViewport.js +212 -0
  37. package/dist/reader/ReaderViewport.js.map +1 -0
  38. package/dist/reader/drivers/EpubReaderDriver.d.ts +20 -0
  39. package/dist/reader/drivers/EpubReaderDriver.d.ts.map +1 -0
  40. package/dist/reader/drivers/EpubReaderDriver.js +259 -0
  41. package/dist/reader/drivers/EpubReaderDriver.js.map +1 -0
  42. package/dist/reader/drivers/PdfReaderDriver.d.ts +18 -0
  43. package/dist/reader/drivers/PdfReaderDriver.d.ts.map +1 -0
  44. package/dist/reader/drivers/PdfReaderDriver.js +198 -0
  45. package/dist/reader/drivers/PdfReaderDriver.js.map +1 -0
  46. package/dist/reader/epub/EpubArchive.d.ts +11 -0
  47. package/dist/reader/epub/EpubArchive.d.ts.map +1 -0
  48. package/dist/reader/epub/EpubArchive.js +65 -0
  49. package/dist/reader/epub/EpubArchive.js.map +1 -0
  50. package/dist/reader/epub/EpubArchiveFetcher.d.ts +11 -0
  51. package/dist/reader/epub/EpubArchiveFetcher.d.ts.map +1 -0
  52. package/dist/reader/epub/EpubArchiveFetcher.js +44 -0
  53. package/dist/reader/epub/EpubArchiveFetcher.js.map +1 -0
  54. package/dist/reader/epub/mediaTypes.d.ts +3 -0
  55. package/dist/reader/epub/mediaTypes.d.ts.map +1 -0
  56. package/dist/reader/epub/mediaTypes.js +26 -0
  57. package/dist/reader/epub/mediaTypes.js.map +1 -0
  58. package/dist/reader/epub/parseEpubPackage.d.ts +22 -0
  59. package/dist/reader/epub/parseEpubPackage.d.ts.map +1 -0
  60. package/dist/reader/epub/parseEpubPackage.js +98 -0
  61. package/dist/reader/epub/parseEpubPackage.js.map +1 -0
  62. package/dist/reader/epub/path.d.ts +4 -0
  63. package/dist/reader/epub/path.d.ts.map +1 -0
  64. package/dist/reader/epub/path.js +28 -0
  65. package/dist/reader/epub/path.js.map +1 -0
  66. package/dist/reader/epub/sanitizeEpubDocument.d.ts +3 -0
  67. package/dist/reader/epub/sanitizeEpubDocument.d.ts.map +1 -0
  68. package/dist/reader/epub/sanitizeEpubDocument.js +90 -0
  69. package/dist/reader/epub/sanitizeEpubDocument.js.map +1 -0
  70. package/dist/reader/index.d.ts +2 -0
  71. package/dist/reader/index.d.ts.map +1 -0
  72. package/dist/reader/index.js +2 -0
  73. package/dist/reader/index.js.map +1 -0
  74. package/dist/reader/loadReaderSourceAsync.d.ts +2 -0
  75. package/dist/reader/loadReaderSourceAsync.d.ts.map +1 -0
  76. package/dist/reader/loadReaderSourceAsync.js +49 -0
  77. package/dist/reader/loadReaderSourceAsync.js.map +1 -0
  78. package/dist/reader/readerViewportPresentation.d.ts +4 -0
  79. package/dist/reader/readerViewportPresentation.d.ts.map +1 -0
  80. package/dist/reader/readerViewportPresentation.js +26 -0
  81. package/dist/reader/readerViewportPresentation.js.map +1 -0
  82. package/dist/reader/types.d.ts +57 -0
  83. package/dist/reader/types.d.ts.map +1 -0
  84. package/dist/reader/types.js +2 -0
  85. package/dist/reader/types.js.map +1 -0
  86. package/dist/reader/validateEpubArchiveEntriesAsync.d.ts +3 -0
  87. package/dist/reader/validateEpubArchiveEntriesAsync.d.ts.map +1 -0
  88. package/dist/reader/validateEpubArchiveEntriesAsync.js +48 -0
  89. package/dist/reader/validateEpubArchiveEntriesAsync.js.map +1 -0
  90. package/package.json +25 -4
  91. package/src/adapterEntrypoints.test.ts +48 -0
  92. package/src/barcodeScanner.ts +1 -0
  93. package/src/createExpoRuntimeRegistry.test.tsx +9 -1
  94. package/src/createExpoRuntimeRegistry.tsx +7 -1
  95. package/src/expoRuntimePlanningMetadata.ts +9 -1
  96. package/src/generatedSources.test.ts +11 -2
  97. package/src/generatedSources.ts +11 -1
  98. package/src/index.ts +5 -1
  99. package/src/planning.ts +4 -1
  100. package/src/reader/ExpoReaderSurfaceAdapter.tsx +170 -0
  101. package/src/reader/ReaderDocumentError.ts +11 -0
  102. package/src/reader/ReaderViewport.tsx +319 -0
  103. package/src/reader/drivers/EpubReaderDriver.ts +309 -0
  104. package/src/reader/drivers/PdfReaderDriver.ts +253 -0
  105. package/src/reader/epub/EpubArchive.ts +83 -0
  106. package/src/reader/epub/EpubArchiveFetcher.ts +58 -0
  107. package/src/reader/epub/mediaTypes.ts +16 -0
  108. package/src/reader/epub/parseEpubPackage.test.ts +116 -0
  109. package/src/reader/epub/parseEpubPackage.ts +152 -0
  110. package/src/reader/epub/path.test.ts +22 -0
  111. package/src/reader/epub/path.ts +26 -0
  112. package/src/reader/epub/sanitizeEpubDocument.ts +121 -0
  113. package/src/reader/index.ts +1 -0
  114. package/src/reader/loadReaderSourceAsync.test.ts +52 -0
  115. package/src/reader/loadReaderSourceAsync.ts +59 -0
  116. package/src/reader/readerViewportPresentation.ts +28 -0
  117. package/src/reader/rendererPackages.test.ts +3 -1
  118. package/src/reader/types.ts +61 -0
  119. package/src/reader/validateEpubArchiveEntriesAsync.test.ts +142 -0
  120. package/src/reader/validateEpubArchiveEntriesAsync.ts +73 -0
  121. package/src/resolveExpoRuntimePlan.test.ts +36 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @ankhorage/expo-runtime
2
2
 
3
+ ## 3.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1aeaf53: Expose capability-scoped barcode scanner and ebook reader adapter entrypoints, and generate bridges that avoid importing unrelated optional platform dependencies.
8
+
9
+ ## 3.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 14cff2c: Update Ankhorage dependencies: `@ankhorage/zora`.
14
+
15
+ ## 3.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 2c1d08a: Add the Expo ReaderSurface adapter for EPUB 3 and PDF documents, including isolated DOM rendering, swipe and keyboard pagination, protected-content handling, and declarative ebookReader dependency planning.
20
+
21
+ ## 3.1.2
22
+
23
+ ### Patch Changes
24
+
25
+ - 143a62a: Add executable EPUB archive expansion and overlap preflight limits for the reader adapter.
26
+
3
27
  ## 3.1.1
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # EXPO-RUNTIME
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v3.0.12](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v3.2.1](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Declarative runtime integration for Expo apps: maps app capabilities to permissions, packages, config plugins, providers, and adapters
9
9
 
@@ -18,6 +18,7 @@ Declarative runtime integration for Expo apps: maps app capabilities to permissi
18
18
  - [createExpoRuntimeRegistry sequence](././paradox/diagrams/sequences/create-expo-runtime-registry.mmd)
19
19
  - [executeExpoRuntimeAction sequence](././paradox/diagrams/sequences/execute-expo-runtime-action.mmd)
20
20
  - [ExpoBarcodeScannerAdapter sequence](././paradox/diagrams/sequences/expo-barcode-scanner-adapter.mmd)
21
+ - [ExpoReaderSurfaceAdapter sequence](././paradox/diagrams/sequences/expo-reader-surface-adapter.mmd)
21
22
  - [ExpoZoraIconFontProvider sequence](././paradox/diagrams/sequences/expo-zora-icon-font-provider.mmd)
22
23
  - [getExpoBundledMediaRegistrySource sequence](././paradox/diagrams/sequences/get-expo-bundled-media-registry-source.mmd)
23
24
  - [resolveExpoRuntimeGeneratedAppOutput sequence](././paradox/diagrams/sequences/resolve-expo-runtime-generated-app-output.mmd)
@@ -0,0 +1,2 @@
1
+ export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
2
+ //# sourceMappingURL=barcodeScanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barcodeScanner.d.ts","sourceRoot":"","sources":["../src/barcodeScanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
2
+ //# sourceMappingURL=barcodeScanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barcodeScanner.js","sourceRoot":"","sources":["../src/barcodeScanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createExpoRuntimeRegistry.d.ts","sourceRoot":"","sources":["../src/createExpoRuntimeRegistry.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAOtF,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,iBAAiB,GAAG,iBAAiB,CAE5F"}
1
+ {"version":3,"file":"createExpoRuntimeRegistry.d.ts","sourceRoot":"","sources":["../src/createExpoRuntimeRegistry.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAStF,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,iBAAiB,GAAG,iBAAiB,CAE5F"}
@@ -2,8 +2,10 @@ import {} from '@ankhorage/zora';
2
2
  import React from 'react';
3
3
  import { createComponentRegistry } from './componentRegistry';
4
4
  import { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
5
+ import { ExpoReaderSurfaceAdapter } from './reader/ExpoReaderSurfaceAdapter';
5
6
  const EXPO_RUNTIME_OVERRIDES = {
6
7
  BarcodeScannerView: ExpoBarcodeScannerView,
8
+ ReaderSurface: ExpoReaderSurface,
7
9
  };
8
10
  export function createExpoRuntimeRegistry(baseRegistry) {
9
11
  return createComponentRegistry(baseRegistry, EXPO_RUNTIME_OVERRIDES);
@@ -11,4 +13,7 @@ export function createExpoRuntimeRegistry(baseRegistry) {
11
13
  function ExpoBarcodeScannerView(props) {
12
14
  return <ExpoBarcodeScannerAdapter {...props}/>;
13
15
  }
16
+ function ExpoReaderSurface(props) {
17
+ return <ExpoReaderSurfaceAdapter {...props}/>;
18
+ }
14
19
  //# sourceMappingURL=createExpoRuntimeRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createExpoRuntimeRegistry.js","sourceRoot":"","sources":["../src/createExpoRuntimeRegistry.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,sBAAsB,GAAsB;IAChD,kBAAkB,EAAE,sBAAsB;CAC3C,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,YAA+B;IACvE,OAAO,uBAAuB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAA8B;IAC5D,OAAO,CAAC,yBAAyB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAClD,CAAC","sourcesContent":["import { type BarcodeScannerViewProps } from '@ankhorage/zora';\nimport React from 'react';\n\nimport { type ComponentRegistry, createComponentRegistry } from './componentRegistry';\nimport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\n\nconst EXPO_RUNTIME_OVERRIDES: ComponentRegistry = {\n BarcodeScannerView: ExpoBarcodeScannerView,\n};\n\nexport function createExpoRuntimeRegistry(baseRegistry: ComponentRegistry): ComponentRegistry {\n return createComponentRegistry(baseRegistry, EXPO_RUNTIME_OVERRIDES);\n}\n\nfunction ExpoBarcodeScannerView(props: BarcodeScannerViewProps) {\n return <ExpoBarcodeScannerAdapter {...props} />;\n}\n"]}
1
+ {"version":3,"file":"createExpoRuntimeRegistry.js","sourceRoot":"","sources":["../src/createExpoRuntimeRegistry.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyD,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,MAAM,sBAAsB,GAAsB;IAChD,kBAAkB,EAAE,sBAAsB;IAC1C,aAAa,EAAE,iBAAiB;CACjC,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,YAA+B;IACvE,OAAO,uBAAuB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAA8B;IAC5D,OAAO,CAAC,yBAAyB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAClD,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB;IAClD,OAAO,CAAC,wBAAwB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACjD,CAAC","sourcesContent":["import { type BarcodeScannerViewProps, type ReaderSurfaceProps } from '@ankhorage/zora';\nimport React from 'react';\n\nimport { type ComponentRegistry, createComponentRegistry } from './componentRegistry';\nimport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\nimport { ExpoReaderSurfaceAdapter } from './reader/ExpoReaderSurfaceAdapter';\n\nconst EXPO_RUNTIME_OVERRIDES: ComponentRegistry = {\n BarcodeScannerView: ExpoBarcodeScannerView,\n ReaderSurface: ExpoReaderSurface,\n};\n\nexport function createExpoRuntimeRegistry(baseRegistry: ComponentRegistry): ComponentRegistry {\n return createComponentRegistry(baseRegistry, EXPO_RUNTIME_OVERRIDES);\n}\n\nfunction ExpoBarcodeScannerView(props: BarcodeScannerViewProps) {\n return <ExpoBarcodeScannerAdapter {...props} />;\n}\n\nfunction ExpoReaderSurface(props: ReaderSurfaceProps) {\n return <ExpoReaderSurfaceAdapter {...props} />;\n}\n"]}
@@ -6,7 +6,7 @@ export interface ExpoRuntimeConfigPlugin {
6
6
  readonly options?: Readonly<Record<string, boolean | string>>;
7
7
  }
8
8
  export type ExpoRuntimeProviderId = 'permissions';
9
- export type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter';
9
+ export type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter' | 'ExpoReaderSurfaceAdapter';
10
10
  export interface ExpoRuntimeDiagnostic {
11
11
  readonly severity: 'error' | 'warning';
12
12
  readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';
@@ -29,6 +29,10 @@ export interface ExpoRuntimeHintMetadata {
29
29
  export declare const GENERATED_RUNTIME_DEPENDENCY_VERSIONS: {
30
30
  readonly '@ankhorage/permissions': "^0.2.3";
31
31
  readonly '@ankhorage/expo-runtime': "^3.0.0";
32
+ readonly '@readium/navigator': "2.8.2";
33
+ readonly '@readium/shared': "2.4.0";
34
+ readonly '@zip.js/zip.js': "2.9.0";
35
+ readonly 'pdfjs-dist': "6.3.289";
32
36
  };
33
37
  export declare const EXPO_RUNTIME_PROVIDER_PACKAGES: {
34
38
  readonly permissions: "@ankhorage/permissions";
@@ -55,6 +59,10 @@ export declare const EXPO_CAPABILITY_RUNTIME_REGISTRY: {
55
59
  };
56
60
  }];
57
61
  };
62
+ readonly ebookReader: {
63
+ readonly requiredPackages: readonly ["@readium/navigator", "@readium/shared", "@zip.js/zip.js", "pdfjs-dist"];
64
+ readonly runtimeAdapters: readonly ["ExpoReaderSurfaceAdapter"];
65
+ };
58
66
  };
59
67
  export declare function findCapabilityMetadata(registry: Readonly<Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>>, requirement: ScreenCapabilityRequirement): ExpoRuntimeCapabilityMetadata | undefined;
60
68
  export declare function findConfigHintMetadata(configHint: string): ExpoRuntimeHintMetadata | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"expoRuntimePlanningMetadata.d.ts","sourceRoot":"","sources":["../src/expoRuntimePlanningMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;CAC/D;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAClD,MAAM,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IACjF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACrE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CA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AE,SAAS,uBAAuB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAC3C;AAkBD,eAAO,MAAM,qCAAqC;;;;;;;CAGG,CAAC;AAEtD,eAAO,MAAM,8BAA8B;;CAEe,CAAC;AAE3D,yFAAyF;AACzF,eAAO,MAAM,0BAA0B;IACrC,SAAA,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAqC;CACV,CAAC;AAqEjE,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;CAwB5C,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,6BAA6B,CAAC,CAAC,CAAC,EAC3F,WAAW,EAAE,2BAA2B,GACvC,6BAA6B,GAAG,SAAS,CAE3C;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAE9F;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAOrF;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,iBAAiB,GACzB,qBAAqB,CAQvB;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAOrF"}
@@ -2,6 +2,10 @@ import { EXPO_PLATFORM } from './platform';
2
2
  const GENERATED_ANKHORAGE_DEPENDENCY_VERSIONS = {
3
3
  '@ankhorage/permissions': '^0.2.3',
4
4
  '@ankhorage/expo-runtime': '^3.0.0',
5
+ '@readium/navigator': '2.8.2',
6
+ '@readium/shared': '2.4.0',
7
+ '@zip.js/zip.js': '2.9.0',
8
+ 'pdfjs-dist': '6.3.289',
5
9
  };
6
10
  const GENERATED_EXPO_DEPENDENCY_VERSIONS = Object.fromEntries(Object.values(EXPO_PLATFORM.packages).map((dependency) => [
7
11
  dependency.name,
@@ -102,6 +106,10 @@ export const EXPO_CAPABILITY_RUNTIME_REGISTRY = {
102
106
  },
103
107
  ],
104
108
  },
109
+ ebookReader: {
110
+ requiredPackages: ['@readium/navigator', '@readium/shared', '@zip.js/zip.js', 'pdfjs-dist'],
111
+ runtimeAdapters: ['ExpoReaderSurfaceAdapter'],
112
+ },
105
113
  };
106
114
  export function findCapabilityMetadata(registry, requirement) {
107
115
  return Object.entries(registry).find(([name]) => name === requirement.capability)?.[1];
@@ -1 +1 @@
1
- {"version":3,"file":"expoRuntimePlanningMetadata.js","sourceRoot":"","sources":["../src/expoRuntimePlanningMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAgCrE,MAAM,uCAAuC,GAAG;IAC9C,wBAAwB,EAAE,QAAQ;IAClC,yBAAyB,EAAE,QAAQ;CACM,CAAC;AAE5C,MAAM,kCAAkC,GAAG,MAAM,CAAC,WAAW,CAC3D,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,UAA+B,EAAE,EAAE,CAAC;IAC7E,UAAU,CAAC,IAAI;IACf,UAAU,CAAC,OAAO;CACnB,CAAC,CACiC,CAAC;AAEtC,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,uCAAuC;IAC1C,GAAG,kCAAkC;CACc,CAAC;AAEtD,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,WAAW,EAAE,wBAAwB;CACmB,CAAC;AAE3D,yFAAyF;AACzF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;CACV,CAAC;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OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,uBAAuB,UAAU,mDAAmD;KAC9F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,UAAkB,EAClB,OAA0B;IAE1B,OAAO;QACL,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;QACrD,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,6BAA6B,UAAU,SAAS,OAAO,IAAI;QACpE,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO;QACL,QAAQ,EAAE,SAAS;QACnB,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,0DAA0D,UAAU,IAAI;KAClF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n AnkhorageCapabilityName,\n ScreenCapabilityRequirement,\n ScreenPermissionRequirement,\n} from '@ankhorage/contracts';\nimport type { PermissionSupport } from '@ankhorage/permissions/expo/manifest';\n\nimport { EXPO_PLATFORM, type ExpoPlatformPackage } from './platform';\n\nexport interface ExpoRuntimeConfigPlugin {\n readonly name: string;\n readonly options?: Readonly<Record<string, boolean | string>>;\n}\n\nexport type ExpoRuntimeProviderId = 'permissions';\nexport type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter';\n\nexport interface ExpoRuntimeDiagnostic {\n readonly severity: 'error' | 'warning';\n readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';\n readonly requirement: string;\n readonly message: string;\n readonly support?: PermissionSupport;\n}\n\nexport interface ExpoRuntimeCapabilityMetadata {\n readonly impliedPermissions?: readonly ScreenPermissionRequirement[];\n readonly requiredPackages?: readonly string[];\n readonly providers?: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters?: readonly ExpoRuntimeAdapterId[];\n readonly androidPermissions?: readonly string[];\n readonly plugins?: readonly ExpoRuntimeConfigPlugin[];\n}\n\nexport interface ExpoRuntimeHintMetadata {\n readonly androidPermissions?: readonly string[];\n readonly plugin?: ExpoRuntimeConfigPlugin;\n}\n\nconst GENERATED_ANKHORAGE_DEPENDENCY_VERSIONS = {\n '@ankhorage/permissions': '^0.2.3',\n '@ankhorage/expo-runtime': '^3.0.0',\n} as const satisfies Record<string, string>;\n\nconst GENERATED_EXPO_DEPENDENCY_VERSIONS = Object.fromEntries(\n Object.values(EXPO_PLATFORM.packages).map((dependency: ExpoPlatformPackage) => [\n dependency.name,\n dependency.version,\n ]),\n) as Readonly<Record<string, string>>;\n\nexport const GENERATED_RUNTIME_DEPENDENCY_VERSIONS = {\n ...GENERATED_ANKHORAGE_DEPENDENCY_VERSIONS,\n ...GENERATED_EXPO_DEPENDENCY_VERSIONS,\n} as const satisfies Readonly<Record<string, string>>;\n\nexport const EXPO_RUNTIME_PROVIDER_PACKAGES = {\n permissions: '@ankhorage/permissions',\n} as const satisfies Record<ExpoRuntimeProviderId, string>;\n\n/** Native Expo packages whose peer modules must be direct generated-app dependencies. */\nexport const EXPO_RUNTIME_PACKAGE_PEERS = {\n [EXPO_PLATFORM.packages.audio.name]: [EXPO_PLATFORM.packages.asset.name],\n} as const satisfies Readonly<Record<string, readonly string[]>>;\n\nconst EXPO_RUNTIME_CONFIG_HINTS = {\n cameraPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.camera.name,\n options: {\n barcodeScannerEnabled: false,\n cameraPermission: 'Allow camera access.',\n microphonePermission: false,\n recordAudioAndroid: false,\n },\n },\n },\n microphonePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.audio.name,\n options: {\n enableBackgroundPlayback: false,\n enableBackgroundRecording: false,\n microphonePermission: 'Allow microphone access.',\n },\n },\n },\n recordAudioAndroid: {\n plugin: {\n name: EXPO_PLATFORM.packages.audio.name,\n options: {\n enableBackgroundPlayback: false,\n enableBackgroundRecording: false,\n recordAudioAndroid: true,\n },\n },\n },\n mediaLibraryPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.mediaLibrary.name,\n options: {\n photosPermission: 'Allow photo library access.',\n savePhotosPermission: 'Allow saving to the photo library.',\n },\n },\n },\n locationWhenInUsePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.location.name,\n options: {\n locationWhenInUsePermission: 'Allow location access while using the app.',\n },\n },\n },\n locationAlwaysAndWhenInUsePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.location.name,\n options: {\n locationAlwaysAndWhenInUsePermission: 'Allow location access.',\n isAndroidBackgroundLocationEnabled: true,\n isAndroidForegroundServiceEnabled: true,\n isIosBackgroundLocationEnabled: true,\n },\n },\n },\n notificationsPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.notifications.name,\n },\n },\n} as const satisfies Readonly<Record<string, ExpoRuntimeHintMetadata>>;\n\nexport const EXPO_CAPABILITY_RUNTIME_REGISTRY = {\n barcodeScanner: {\n impliedPermissions: [{ permission: 'camera' }],\n requiredPackages: [EXPO_PLATFORM.packages.camera.name],\n providers: ['permissions'],\n runtimeAdapters: ['ExpoBarcodeScannerAdapter'],\n plugins: [\n {\n name: EXPO_PLATFORM.packages.camera.name,\n options: {\n cameraPermission: 'Allow camera access to scan barcodes.',\n barcodeScannerEnabled: true,\n microphonePermission: false,\n recordAudioAndroid: false,\n },\n },\n ],\n },\n} as const satisfies Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n>;\n\nexport function findCapabilityMetadata(\n registry: Readonly<Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>>,\n requirement: ScreenCapabilityRequirement,\n): ExpoRuntimeCapabilityMetadata | undefined {\n return Object.entries(registry).find(([name]) => name === requirement.capability)?.[1];\n}\n\nexport function findConfigHintMetadata(configHint: string): ExpoRuntimeHintMetadata | undefined {\n return Object.entries(EXPO_RUNTIME_CONFIG_HINTS).find(([name]) => name === configHint)?.[1];\n}\n\nexport function unknownPermissionDiagnostic(permission: string): ExpoRuntimeDiagnostic {\n return {\n severity: 'error',\n requirementType: 'permission',\n requirement: permission,\n message: `Unknown permission '${permission}' cannot be resolved for Expo runtime generation.`,\n };\n}\n\nexport function unsupportedPermissionDiagnostic(\n permission: string,\n support: PermissionSupport,\n): ExpoRuntimeDiagnostic {\n return {\n severity: support === 'limited' ? 'warning' : 'error',\n requirementType: 'permission',\n requirement: permission,\n message: `Expo runtime support for '${permission}' is '${support}'.`,\n support,\n };\n}\n\nexport function unknownCapabilityDiagnostic(capability: string): ExpoRuntimeDiagnostic {\n return {\n severity: 'warning',\n requirementType: 'capability',\n requirement: capability,\n message: `No Expo runtime metadata is registered for capability '${capability}'.`,\n };\n}\n"]}
1
+ {"version":3,"file":"expoRuntimePlanningMetadata.js","sourceRoot":"","sources":["../src/expoRuntimePlanningMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAgCrE,MAAM,uCAAuC,GAAG;IAC9C,wBAAwB,EAAE,QAAQ;IAClC,yBAAyB,EAAE,QAAQ;IACnC,oBAAoB,EAAE,OAAO;IAC7B,iBAAiB,EAAE,OAAO;IAC1B,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,SAAS;CACkB,CAAC;AAE5C,MAAM,kCAAkC,GAAG,MAAM,CAAC,WAAW,CAC3D,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,UAA+B,EAAE,EAAE,CAAC;IAC7E,UAAU,CAAC,IAAI;IACf,UAAU,CAAC,OAAO;CACnB,CAAC,CACiC,CAAC;AAEtC,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,uCAAuC;IAC1C,GAAG,kCAAkC;CACc,CAAC;AAEtD,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,WAAW,EAAE,wBAAwB;CACmB,CAA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KAAK,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,OAAO,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,uBAAuB,UAAU,mDAAmD;KAC9F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,UAAkB,EAClB,OAA0B;IAE1B,OAAO;QACL,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;QACrD,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,6BAA6B,UAAU,SAAS,OAAO,IAAI;QACpE,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO;QACL,QAAQ,EAAE,SAAS;QACnB,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,0DAA0D,UAAU,IAAI;KAClF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n AnkhorageCapabilityName,\n ScreenCapabilityRequirement,\n ScreenPermissionRequirement,\n} from '@ankhorage/contracts';\nimport type { PermissionSupport } from '@ankhorage/permissions/expo/manifest';\n\nimport { EXPO_PLATFORM, type ExpoPlatformPackage } from './platform';\n\nexport interface ExpoRuntimeConfigPlugin {\n readonly name: string;\n readonly options?: Readonly<Record<string, boolean | string>>;\n}\n\nexport type ExpoRuntimeProviderId = 'permissions';\nexport type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter' | 'ExpoReaderSurfaceAdapter';\n\nexport interface ExpoRuntimeDiagnostic {\n readonly severity: 'error' | 'warning';\n readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';\n readonly requirement: string;\n readonly message: string;\n readonly support?: PermissionSupport;\n}\n\nexport interface ExpoRuntimeCapabilityMetadata {\n readonly impliedPermissions?: readonly ScreenPermissionRequirement[];\n readonly requiredPackages?: readonly string[];\n readonly providers?: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters?: readonly ExpoRuntimeAdapterId[];\n readonly androidPermissions?: readonly string[];\n readonly plugins?: readonly ExpoRuntimeConfigPlugin[];\n}\n\nexport interface ExpoRuntimeHintMetadata {\n readonly androidPermissions?: readonly string[];\n readonly plugin?: ExpoRuntimeConfigPlugin;\n}\n\nconst GENERATED_ANKHORAGE_DEPENDENCY_VERSIONS = {\n '@ankhorage/permissions': '^0.2.3',\n '@ankhorage/expo-runtime': '^3.0.0',\n '@readium/navigator': '2.8.2',\n '@readium/shared': '2.4.0',\n '@zip.js/zip.js': '2.9.0',\n 'pdfjs-dist': '6.3.289',\n} as const satisfies Record<string, string>;\n\nconst GENERATED_EXPO_DEPENDENCY_VERSIONS = Object.fromEntries(\n Object.values(EXPO_PLATFORM.packages).map((dependency: ExpoPlatformPackage) => [\n dependency.name,\n dependency.version,\n ]),\n) as Readonly<Record<string, string>>;\n\nexport const GENERATED_RUNTIME_DEPENDENCY_VERSIONS = {\n ...GENERATED_ANKHORAGE_DEPENDENCY_VERSIONS,\n ...GENERATED_EXPO_DEPENDENCY_VERSIONS,\n} as const satisfies Readonly<Record<string, string>>;\n\nexport const EXPO_RUNTIME_PROVIDER_PACKAGES = {\n permissions: '@ankhorage/permissions',\n} as const satisfies Record<ExpoRuntimeProviderId, string>;\n\n/** Native Expo packages whose peer modules must be direct generated-app dependencies. */\nexport const EXPO_RUNTIME_PACKAGE_PEERS = {\n [EXPO_PLATFORM.packages.audio.name]: [EXPO_PLATFORM.packages.asset.name],\n} as const satisfies Readonly<Record<string, readonly string[]>>;\n\nconst EXPO_RUNTIME_CONFIG_HINTS = {\n cameraPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.camera.name,\n options: {\n barcodeScannerEnabled: false,\n cameraPermission: 'Allow camera access.',\n microphonePermission: false,\n recordAudioAndroid: false,\n },\n },\n },\n microphonePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.audio.name,\n options: {\n enableBackgroundPlayback: false,\n enableBackgroundRecording: false,\n microphonePermission: 'Allow microphone access.',\n },\n },\n },\n recordAudioAndroid: {\n plugin: {\n name: EXPO_PLATFORM.packages.audio.name,\n options: {\n enableBackgroundPlayback: false,\n enableBackgroundRecording: false,\n recordAudioAndroid: true,\n },\n },\n },\n mediaLibraryPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.mediaLibrary.name,\n options: {\n photosPermission: 'Allow photo library access.',\n savePhotosPermission: 'Allow saving to the photo library.',\n },\n },\n },\n locationWhenInUsePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.location.name,\n options: {\n locationWhenInUsePermission: 'Allow location access while using the app.',\n },\n },\n },\n locationAlwaysAndWhenInUsePermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.location.name,\n options: {\n locationAlwaysAndWhenInUsePermission: 'Allow location access.',\n isAndroidBackgroundLocationEnabled: true,\n isAndroidForegroundServiceEnabled: true,\n isIosBackgroundLocationEnabled: true,\n },\n },\n },\n notificationsPermission: {\n plugin: {\n name: EXPO_PLATFORM.packages.notifications.name,\n },\n },\n} as const satisfies Readonly<Record<string, ExpoRuntimeHintMetadata>>;\n\nexport const EXPO_CAPABILITY_RUNTIME_REGISTRY = {\n barcodeScanner: {\n impliedPermissions: [{ permission: 'camera' }],\n requiredPackages: [EXPO_PLATFORM.packages.camera.name],\n providers: ['permissions'],\n runtimeAdapters: ['ExpoBarcodeScannerAdapter'],\n plugins: [\n {\n name: EXPO_PLATFORM.packages.camera.name,\n options: {\n cameraPermission: 'Allow camera access to scan barcodes.',\n barcodeScannerEnabled: true,\n microphonePermission: false,\n recordAudioAndroid: false,\n },\n },\n ],\n },\n ebookReader: {\n requiredPackages: ['@readium/navigator', '@readium/shared', '@zip.js/zip.js', 'pdfjs-dist'],\n runtimeAdapters: ['ExpoReaderSurfaceAdapter'],\n },\n} as const satisfies Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n>;\n\nexport function findCapabilityMetadata(\n registry: Readonly<Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>>,\n requirement: ScreenCapabilityRequirement,\n): ExpoRuntimeCapabilityMetadata | undefined {\n return Object.entries(registry).find(([name]) => name === requirement.capability)?.[1];\n}\n\nexport function findConfigHintMetadata(configHint: string): ExpoRuntimeHintMetadata | undefined {\n return Object.entries(EXPO_RUNTIME_CONFIG_HINTS).find(([name]) => name === configHint)?.[1];\n}\n\nexport function unknownPermissionDiagnostic(permission: string): ExpoRuntimeDiagnostic {\n return {\n severity: 'error',\n requirementType: 'permission',\n requirement: permission,\n message: `Unknown permission '${permission}' cannot be resolved for Expo runtime generation.`,\n };\n}\n\nexport function unsupportedPermissionDiagnostic(\n permission: string,\n support: PermissionSupport,\n): ExpoRuntimeDiagnostic {\n return {\n severity: support === 'limited' ? 'warning' : 'error',\n requirementType: 'permission',\n requirement: permission,\n message: `Expo runtime support for '${permission}' is '${support}'.`,\n support,\n };\n}\n\nexport function unknownCapabilityDiagnostic(capability: string): ExpoRuntimeDiagnostic {\n return {\n severity: 'warning',\n requirementType: 'capability',\n requirement: capability,\n message: `No Expo runtime metadata is registered for capability '${capability}'.`,\n };\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export declare function getExpoBarcodeScannerViewSource(): string;
2
+ export declare function getExpoReaderSurfaceViewSource(): string;
2
3
  //# sourceMappingURL=generatedSources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generatedSources.d.ts","sourceRoot":"","sources":["../src/generatedSources.ts"],"names":[],"mappings":"AAMA,wBAAgB,+BAA+B,IAAI,MAAM,CAExD"}
1
+ {"version":3,"file":"generatedSources.d.ts","sourceRoot":"","sources":["../src/generatedSources.ts"],"names":[],"mappings":"AAYA,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED,wBAAgB,8BAA8B,IAAI,MAAM,CAEvD"}
@@ -1,9 +1,17 @@
1
1
  const EXPO_BARCODE_SCANNER_VIEW_SOURCE = [
2
2
  'export { ExpoBarcodeScannerAdapter as ExpoBarcodeScannerView }',
3
- " from '@ankhorage/expo-runtime';",
3
+ " from '@ankhorage/expo-runtime/barcode-scanner';",
4
+ '\n',
5
+ ];
6
+ const EXPO_READER_SURFACE_VIEW_SOURCE = [
7
+ 'export { ExpoReaderSurfaceAdapter as ExpoReaderSurfaceView }',
8
+ " from '@ankhorage/expo-runtime/reader';",
4
9
  '\n',
5
10
  ];
6
11
  export function getExpoBarcodeScannerViewSource() {
7
12
  return EXPO_BARCODE_SCANNER_VIEW_SOURCE.join('');
8
13
  }
14
+ export function getExpoReaderSurfaceViewSource() {
15
+ return EXPO_READER_SURFACE_VIEW_SOURCE.join('');
16
+ }
9
17
  //# sourceMappingURL=generatedSources.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generatedSources.js","sourceRoot":"","sources":["../src/generatedSources.ts"],"names":[],"mappings":"AAAA,MAAM,gCAAgC,GAAG;IACvC,gEAAgE;IAChE,kCAAkC;IAClC,IAAI;CACI,CAAC;AAEX,MAAM,UAAU,+BAA+B;IAC7C,OAAO,gCAAgC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["const EXPO_BARCODE_SCANNER_VIEW_SOURCE = [\n 'export { ExpoBarcodeScannerAdapter as ExpoBarcodeScannerView }',\n \" from '@ankhorage/expo-runtime';\",\n '\\n',\n] as const;\n\nexport function getExpoBarcodeScannerViewSource(): string {\n return EXPO_BARCODE_SCANNER_VIEW_SOURCE.join('');\n}\n"]}
1
+ {"version":3,"file":"generatedSources.js","sourceRoot":"","sources":["../src/generatedSources.ts"],"names":[],"mappings":"AAAA,MAAM,gCAAgC,GAAG;IACvC,gEAAgE;IAChE,kDAAkD;IAClD,IAAI;CACI,CAAC;AAEX,MAAM,+BAA+B,GAAG;IACtC,8DAA8D;IAC9D,yCAAyC;IACzC,IAAI;CACI,CAAC;AAEX,MAAM,UAAU,+BAA+B;IAC7C,OAAO,gCAAgC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO,+BAA+B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC","sourcesContent":["const EXPO_BARCODE_SCANNER_VIEW_SOURCE = [\n 'export { ExpoBarcodeScannerAdapter as ExpoBarcodeScannerView }',\n \" from '@ankhorage/expo-runtime/barcode-scanner';\",\n '\\n',\n] as const;\n\nconst EXPO_READER_SURFACE_VIEW_SOURCE = [\n 'export { ExpoReaderSurfaceAdapter as ExpoReaderSurfaceView }',\n \" from '@ankhorage/expo-runtime/reader';\",\n '\\n',\n] as const;\n\nexport function getExpoBarcodeScannerViewSource(): string {\n return EXPO_BARCODE_SCANNER_VIEW_SOURCE.join('');\n}\n\nexport function getExpoReaderSurfaceViewSource(): string {\n return EXPO_READER_SURFACE_VIEW_SOURCE.join('');\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -9,8 +9,9 @@ export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
9
9
  export { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';
10
10
  export { ExpoZoraIconFontProvider, type ExpoZoraIconFontProviderProps, } from './ExpoZoraIconFontProvider';
11
11
  export { type ExpoRuntimeConfigPluginOutput, type ExpoRuntimeDependencyMap, type ExpoRuntimeGeneratedAppOutputPlan, type ExpoRuntimeNativeOutputPlan, resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
12
- export { getExpoBarcodeScannerViewSource } from './generatedSources';
12
+ export { getExpoBarcodeScannerViewSource, getExpoReaderSurfaceViewSource, } from './generatedSources';
13
13
  export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
14
+ export { ExpoReaderSurfaceAdapter } from './reader/ExpoReaderSurfaceAdapter';
14
15
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
15
16
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,mCAAmC,EACxC,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,oBAAo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,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -8,7 +8,8 @@ export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
8
8
  export { ExpoRuntimeProviders } from './ExpoRuntimeProviders';
9
9
  export { ExpoZoraIconFontProvider, } from './ExpoZoraIconFontProvider';
10
10
  export { resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
11
- export { getExpoBarcodeScannerViewSource } from './generatedSources';
11
+ export { getExpoBarcodeScannerViewSource, getExpoReaderSurfaceViewSource, } from './generatedSources';
12
12
  export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
13
+ export { ExpoReaderSurfaceAdapter } from './reader/ExpoReaderSurfaceAdapter';
13
14
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
14
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EAGrB,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAK9B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EAOxB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n BARCODE_SCAN_DEDUPE_WINDOW_MS,\n BARCODE_SCANNER_TYPES,\n type BarcodeScanRecord,\n type ExpoBarcodeScanResultLike,\n mapPermissionStatusToCameraPermissionStatus,\n normalizeExpoBarcodeScanResult,\n shouldIgnoreBarcodeScan,\n} from './barcodeScanRuntime';\nexport {\n type ExpoBundledMediaRegistrySourceEntry,\n getExpoBundledMediaRegistrySource,\n} from './bundledMediaRegistrySource';\nexport {\n createExpoBundledMediaResolver,\n type ExpoBundledMediaRegistry,\n type ExpoBundledMediaResolver,\n type ExpoBundledMediaResolverArgs,\n type ExpoBundledMediaValue,\n resolveExpoBundledMediaAsset,\n} from './bundledMediaResolver';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n executeExpoRuntimeAction,\n type ExecuteExpoRuntimeActionArgs,\n type ExpoRuntimeActionHandlerArgs,\n type ExpoRuntimeActionHandlers,\n type ExpoRuntimeRouteResolution,\n type ExpoRuntimeRouterLike,\n type ExpoRuntimeThemeMode,\n resolveExpoRuntimeRoutePath,\n} from './expoActionBridge';\nexport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport {\n ExpoZoraIconFontProvider,\n type ExpoZoraIconFontProviderProps,\n} from './ExpoZoraIconFontProvider';\nexport {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EAGrB,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAK9B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EAOxB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAM7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n BARCODE_SCAN_DEDUPE_WINDOW_MS,\n BARCODE_SCANNER_TYPES,\n type BarcodeScanRecord,\n type ExpoBarcodeScanResultLike,\n mapPermissionStatusToCameraPermissionStatus,\n normalizeExpoBarcodeScanResult,\n shouldIgnoreBarcodeScan,\n} from './barcodeScanRuntime';\nexport {\n type ExpoBundledMediaRegistrySourceEntry,\n getExpoBundledMediaRegistrySource,\n} from './bundledMediaRegistrySource';\nexport {\n createExpoBundledMediaResolver,\n type ExpoBundledMediaRegistry,\n type ExpoBundledMediaResolver,\n type ExpoBundledMediaResolverArgs,\n type ExpoBundledMediaValue,\n resolveExpoBundledMediaAsset,\n} from './bundledMediaResolver';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n executeExpoRuntimeAction,\n type ExecuteExpoRuntimeActionArgs,\n type ExpoRuntimeActionHandlerArgs,\n type ExpoRuntimeActionHandlers,\n type ExpoRuntimeRouteResolution,\n type ExpoRuntimeRouterLike,\n type ExpoRuntimeThemeMode,\n resolveExpoRuntimeRoutePath,\n} from './expoActionBridge';\nexport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport {\n ExpoZoraIconFontProvider,\n type ExpoZoraIconFontProviderProps,\n} from './ExpoZoraIconFontProvider';\nexport {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport {\n getExpoBarcodeScannerViewSource,\n getExpoReaderSurfaceViewSource,\n} from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport { ExpoReaderSurfaceAdapter } from './reader/ExpoReaderSurfaceAdapter';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
@@ -1,5 +1,5 @@
1
1
  export { type ExpoRuntimeConfigPluginOutput, type ExpoRuntimeDependencyMap, type ExpoRuntimeGeneratedAppOutputPlan, type ExpoRuntimeNativeOutputPlan, resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
2
- export { getExpoBarcodeScannerViewSource } from './generatedSources';
2
+ export { getExpoBarcodeScannerViewSource, getExpoReaderSurfaceViewSource, } from './generatedSources';
3
3
  export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
4
4
  export { type ExpoRuntimeNativePlatform, type ExpoRuntimeNativeSchemeMap, resolveExpoRuntimeNativeSchemeMap, } from './nativeLinkingPlanning';
5
5
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimePlanningManifest, ExpoRuntimePlanningScreen, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
@@ -1 +1 @@
1
- {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/planning.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
2
- export { getExpoBarcodeScannerViewSource } from './generatedSources';
2
+ export { getExpoBarcodeScannerViewSource, getExpoReaderSurfaceViewSource, } from './generatedSources';
3
3
  export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
4
4
  export { resolveExpoRuntimeNativeSchemeMap, } from './nativeLinkingPlanning';
5
5
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
@@ -1 +1 @@
1
- {"version":3,"file":"planning.js","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport {\n type ExpoRuntimeNativePlatform,\n type ExpoRuntimeNativeSchemeMap,\n resolveExpoRuntimeNativeSchemeMap,\n} from './nativeLinkingPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimePlanningManifest,\n ExpoRuntimePlanningScreen,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
1
+ {"version":3,"file":"planning.js","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport {\n getExpoBarcodeScannerViewSource,\n getExpoReaderSurfaceViewSource,\n} from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport {\n type ExpoRuntimeNativePlatform,\n type ExpoRuntimeNativeSchemeMap,\n resolveExpoRuntimeNativeSchemeMap,\n} from './nativeLinkingPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimePlanningManifest,\n ExpoRuntimePlanningScreen,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
@@ -0,0 +1,4 @@
1
+ import { type ReaderSurfaceProps } from '@ankhorage/zora';
2
+ import React from 'react';
3
+ export declare function ExpoReaderSurfaceAdapter(props: ReaderSurfaceProps): React.JSX.Element;
4
+ //# sourceMappingURL=ExpoReaderSurfaceAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoReaderSurfaceAdapter.d.ts","sourceRoot":"","sources":["../../src/reader/ExpoReaderSurfaceAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,qBAgCjE"}
@@ -0,0 +1,102 @@
1
+ import { ReaderSurface } from '@ankhorage/zora';
2
+ import React from 'react';
3
+ import { Image, StyleSheet, View } from 'react-native';
4
+ import ReaderViewport from './ReaderViewport';
5
+ const INITIAL_STATE = {
6
+ canGoNext: false,
7
+ canGoPrevious: false,
8
+ page: 1,
9
+ progress: 0,
10
+ status: 'loading',
11
+ };
12
+ export function ExpoReaderSurfaceAdapter(props) {
13
+ const sourceUri = resolveReaderSourceUri(props.source);
14
+ const controller = useReaderController(props, sourceUri);
15
+ const appearance = useReaderAppearance(props);
16
+ const viewport = sourceUri ? (<ReaderAdapterViewport appearance={appearance} command={controller.command} format={props.format} initialLocation={props.location} onError={controller.handleError} onOpenExternalLink={controller.handleOpenExternalLink} onStateChange={controller.handleStateChange} sourceUri={sourceUri}/>) : undefined;
17
+ return (<ReaderSurface {...props} canGoNext={controller.state.canGoNext} canGoPrevious={controller.state.canGoPrevious} chapterLabel={controller.state.location?.chapterTitle ?? props.chapterLabel} onNextPage={controller.handleNextPage} onPreviousPage={controller.handlePreviousPage} page={controller.state.page} pageCount={controller.state.pageCount} progress={controller.state.progress} status={controller.error ? 'error' : sourceUri ? controller.state.status : 'idle'} viewport={viewport}/>);
18
+ }
19
+ function ReaderAdapterViewport({ appearance, command, format, initialLocation, onError, onOpenExternalLink, onStateChange, sourceUri, }) {
20
+ return (<View style={styles.viewport}>
21
+ <ReaderViewport appearance={appearance} command={command} dom={DOM_CONFIGURATION} format={format} initialLocation={initialLocation} key={`${format}:${sourceUri}`} onError={onError} onOpenExternalLink={onOpenExternalLink} onStateChange={onStateChange} sourceUri={sourceUri}/>
22
+ </View>);
23
+ }
24
+ function useReaderController(props, sourceUri) {
25
+ const { onLocationChange, onNextPage, onOpenExternalLink, onPreviousPage, onReaderError } = props;
26
+ const [state, setState] = React.useState(INITIAL_STATE);
27
+ const [error, setError] = React.useState();
28
+ const { command, issueCommand } = useReaderCommandState(sourceUri);
29
+ const handlePreviousPage = React.useCallback(() => {
30
+ issueCommand('previous');
31
+ void onPreviousPage?.();
32
+ }, [issueCommand, onPreviousPage]);
33
+ const handleNextPage = React.useCallback(() => {
34
+ issueCommand('next');
35
+ void onNextPage?.();
36
+ }, [issueCommand, onNextPage]);
37
+ const handleStateChange = React.useCallback(async (nextState) => {
38
+ setState(nextState);
39
+ setError(undefined);
40
+ if (nextState.location)
41
+ await onLocationChange?.(nextState.location);
42
+ }, [onLocationChange]);
43
+ const handleError = React.useCallback(async (event) => {
44
+ setError(event);
45
+ await onReaderError?.(event);
46
+ }, [onReaderError]);
47
+ const handleOpenExternalLink = React.useCallback(async (event) => onOpenExternalLink?.(event), [onOpenExternalLink]);
48
+ return {
49
+ command,
50
+ error,
51
+ handleError,
52
+ handleNextPage,
53
+ handleOpenExternalLink,
54
+ handlePreviousPage,
55
+ handleStateChange,
56
+ state,
57
+ };
58
+ }
59
+ function useReaderCommandState(sourceUri) {
60
+ const [command, setCommand] = React.useState();
61
+ const commandIdRef = React.useRef(0);
62
+ const issueCommand = React.useCallback((type) => {
63
+ if (!sourceUri)
64
+ return;
65
+ commandIdRef.current += 1;
66
+ setCommand({ id: commandIdRef.current, sourceUri, type });
67
+ }, [sourceUri]);
68
+ return { command, issueCommand };
69
+ }
70
+ function useReaderAppearance(props) {
71
+ const colorScheme = props.readerColorScheme ?? 'system';
72
+ const fontScale = props.fontScale ?? 1;
73
+ const lineHeight = resolveLineHeight(props.lineHeight ?? 'normal');
74
+ return React.useMemo(() => ({ colorScheme, fontScale, lineHeight }), [colorScheme, fontScale, lineHeight]);
75
+ }
76
+ function resolveReaderSourceUri(source) {
77
+ if (typeof source === 'string')
78
+ return source;
79
+ if (typeof source === 'number')
80
+ return Image.resolveAssetSource(source).uri;
81
+ return source ? source.uri : undefined;
82
+ }
83
+ function resolveLineHeight(lineHeight) {
84
+ if (lineHeight === 'compact')
85
+ return 1.25;
86
+ if (lineHeight === 'relaxed')
87
+ return 1.75;
88
+ return 1.5;
89
+ }
90
+ const styles = StyleSheet.create({
91
+ viewport: { flex: 1, minHeight: 360 },
92
+ });
93
+ const DOM_CONFIGURATION = {
94
+ allowsInlineMediaPlayback: false,
95
+ javaScriptCanOpenWindowsAutomatically: false,
96
+ mediaPlaybackRequiresUserAction: true,
97
+ originWhitelist: ['about:blank', 'blob:*'],
98
+ scrollEnabled: false,
99
+ style: styles.viewport,
100
+ unstable_useExpoModulesBridge: false,
101
+ };
102
+ //# sourceMappingURL=ExpoReaderSurfaceAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoReaderSurfaceAdapter.js","sourceRoot":"","sources":["../../src/reader/ExpoReaderSurfaceAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AAChG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,KAAK;IACpB,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,MAAM,SAAS,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAC3B,CAAC,qBAAqB,CACpB,UAAU,CAAC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AC,MAAM,CAAC;IAC/B,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;CACtC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG;IACxB,yBAAyB,EAAE,KAAK;IAChC,qCAAqC,EAAE,KAAK;IAC5C,+BAA+B,EAAE,IAAI;IACrC,eAAe,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC;IAC1C,aAAa,EAAE,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC,QAAQ;IACtB,6BAA6B,EAAE,KAAK;CACrC,CAAC","sourcesContent":["import { type ReaderErrorEvent, ReaderSurface, type ReaderSurfaceProps } from '@ankhorage/zora';\nimport React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport ReaderViewport from './ReaderViewport';\nimport type { ReaderAppearance, ReaderCommand, ReaderViewportState } from './types';\n\nconst INITIAL_STATE: ReaderViewportState = {\n canGoNext: false,\n canGoPrevious: false,\n page: 1,\n progress: 0,\n status: 'loading',\n};\n\nexport function ExpoReaderSurfaceAdapter(props: ReaderSurfaceProps) {\n const sourceUri = resolveReaderSourceUri(props.source);\n const controller = useReaderController(props, sourceUri);\n const appearance = useReaderAppearance(props);\n const viewport = sourceUri ? (\n <ReaderAdapterViewport\n appearance={appearance}\n command={controller.command}\n format={props.format}\n initialLocation={props.location}\n onError={controller.handleError}\n onOpenExternalLink={controller.handleOpenExternalLink}\n onStateChange={controller.handleStateChange}\n sourceUri={sourceUri}\n />\n ) : undefined;\n\n return (\n <ReaderSurface\n {...props}\n canGoNext={controller.state.canGoNext}\n canGoPrevious={controller.state.canGoPrevious}\n chapterLabel={controller.state.location?.chapterTitle ?? props.chapterLabel}\n onNextPage={controller.handleNextPage}\n onPreviousPage={controller.handlePreviousPage}\n page={controller.state.page}\n pageCount={controller.state.pageCount}\n progress={controller.state.progress}\n status={controller.error ? 'error' : sourceUri ? controller.state.status : 'idle'}\n viewport={viewport}\n />\n );\n}\n\nfunction ReaderAdapterViewport({\n appearance,\n command,\n format,\n initialLocation,\n onError,\n onOpenExternalLink,\n onStateChange,\n sourceUri,\n}: React.ComponentProps<typeof ReaderViewport>) {\n return (\n <View style={styles.viewport}>\n <ReaderViewport\n appearance={appearance}\n command={command}\n dom={DOM_CONFIGURATION}\n format={format}\n initialLocation={initialLocation}\n key={`${format}:${sourceUri}`}\n onError={onError}\n onOpenExternalLink={onOpenExternalLink}\n onStateChange={onStateChange}\n sourceUri={sourceUri}\n />\n </View>\n );\n}\n\nfunction useReaderController(props: ReaderSurfaceProps, sourceUri: string | undefined) {\n const { onLocationChange, onNextPage, onOpenExternalLink, onPreviousPage, onReaderError } = props;\n const [state, setState] = React.useState<ReaderViewportState>(INITIAL_STATE);\n const [error, setError] = React.useState<ReaderErrorEvent>();\n const { command, issueCommand } = useReaderCommandState(sourceUri);\n const handlePreviousPage = React.useCallback(() => {\n issueCommand('previous');\n void onPreviousPage?.();\n }, [issueCommand, onPreviousPage]);\n const handleNextPage = React.useCallback(() => {\n issueCommand('next');\n void onNextPage?.();\n }, [issueCommand, onNextPage]);\n const handleStateChange = React.useCallback(\n async (nextState: ReaderViewportState) => {\n setState(nextState);\n setError(undefined);\n if (nextState.location) await onLocationChange?.(nextState.location);\n },\n [onLocationChange],\n );\n const handleError = React.useCallback(\n async (event: ReaderErrorEvent) => {\n setError(event);\n await onReaderError?.(event);\n },\n [onReaderError],\n );\n const handleOpenExternalLink = React.useCallback(\n async (event: { readonly url: string }) => onOpenExternalLink?.(event),\n [onOpenExternalLink],\n );\n return {\n command,\n error,\n handleError,\n handleNextPage,\n handleOpenExternalLink,\n handlePreviousPage,\n handleStateChange,\n state,\n };\n}\n\nfunction useReaderCommandState(sourceUri: string | undefined) {\n const [command, setCommand] = React.useState<ReaderCommand>();\n const commandIdRef = React.useRef(0);\n const issueCommand = React.useCallback(\n (type: ReaderCommand['type']) => {\n if (!sourceUri) return;\n commandIdRef.current += 1;\n setCommand({ id: commandIdRef.current, sourceUri, type });\n },\n [sourceUri],\n );\n return { command, issueCommand };\n}\n\nfunction useReaderAppearance(props: ReaderSurfaceProps): ReaderAppearance {\n const colorScheme = props.readerColorScheme ?? 'system';\n const fontScale = props.fontScale ?? 1;\n const lineHeight = resolveLineHeight(props.lineHeight ?? 'normal');\n return React.useMemo(\n () => ({ colorScheme, fontScale, lineHeight }),\n [colorScheme, fontScale, lineHeight],\n );\n}\n\nfunction resolveReaderSourceUri(source: ReaderSurfaceProps['source']): string | undefined {\n if (typeof source === 'string') return source;\n if (typeof source === 'number') return Image.resolveAssetSource(source).uri;\n return source ? source.uri : undefined;\n}\n\nfunction resolveLineHeight(lineHeight: NonNullable<ReaderSurfaceProps['lineHeight']>): number {\n if (lineHeight === 'compact') return 1.25;\n if (lineHeight === 'relaxed') return 1.75;\n return 1.5;\n}\n\nconst styles = StyleSheet.create({\n viewport: { flex: 1, minHeight: 360 },\n});\n\nconst DOM_CONFIGURATION = {\n allowsInlineMediaPlayback: false,\n javaScriptCanOpenWindowsAutomatically: false,\n mediaPlaybackRequiresUserAction: true,\n originWhitelist: ['about:blank', 'blob:*'],\n scrollEnabled: false,\n style: styles.viewport,\n unstable_useExpoModulesBridge: false,\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import type { ReaderErrorCode } from '@ankhorage/zora';
2
+ export declare class ReaderDocumentError extends Error {
3
+ readonly code: ReaderErrorCode;
4
+ constructor(code: ReaderErrorCode, message: string);
5
+ }
6
+ //# sourceMappingURL=ReaderDocumentError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReaderDocumentError.d.ts","sourceRoot":"","sources":["../../src/reader/ReaderDocumentError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,qBAAa,mBAAoB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,IAAI,EAAE,eAAe;gBAArB,IAAI,EAAE,eAAe,EAC9B,OAAO,EAAE,MAAM;CAKlB"}
@@ -0,0 +1,9 @@
1
+ export class ReaderDocumentError extends Error {
2
+ code;
3
+ constructor(code, message) {
4
+ super(message);
5
+ this.code = code;
6
+ this.name = 'ReaderDocumentError';
7
+ }
8
+ }
9
+ //# sourceMappingURL=ReaderDocumentError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReaderDocumentError.js","sourceRoot":"","sources":["../../src/reader/ReaderDocumentError.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAEjC;IADX,YACW,IAAqB,EAC9B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAAI,CAAiB;QAI9B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF","sourcesContent":["import type { ReaderErrorCode } from '@ankhorage/zora';\n\nexport class ReaderDocumentError extends Error {\n constructor(\n readonly code: ReaderErrorCode,\n message: string,\n ) {\n super(message);\n this.name = 'ReaderDocumentError';\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ReaderViewportProps } from './types';
3
+ export default function ReaderViewport(props: ReaderViewportProps): React.JSX.Element;
4
+ //# sourceMappingURL=ReaderViewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReaderViewport.d.ts","sourceRoot":"","sources":["../../src/reader/ReaderViewport.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAIV,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAKjB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAoBhE"}