@chipmobilesdk/rn-camera 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +11 -7
  3. package/lib/commonjs/config/types.js +54 -0
  4. package/lib/commonjs/config/types.js.map +1 -0
  5. package/lib/commonjs/core/capabilities.js +45 -0
  6. package/lib/commonjs/core/capabilities.js.map +1 -0
  7. package/lib/commonjs/core/captureController.js +107 -0
  8. package/lib/commonjs/core/captureController.js.map +1 -0
  9. package/lib/commonjs/core/contract.js +16 -0
  10. package/lib/commonjs/core/contract.js.map +1 -0
  11. package/lib/commonjs/core/controller.js +452 -0
  12. package/lib/commonjs/core/controller.js.map +1 -0
  13. package/lib/commonjs/core/sessionMachine.js +116 -0
  14. package/lib/commonjs/core/sessionMachine.js.map +1 -0
  15. package/lib/commonjs/core/sessionRuntime.js +218 -0
  16. package/lib/commonjs/core/sessionRuntime.js.map +1 -0
  17. package/lib/commonjs/diagnostics/errors.js +86 -0
  18. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  19. package/lib/commonjs/diagnostics/logger.js +40 -0
  20. package/lib/commonjs/diagnostics/logger.js.map +1 -0
  21. package/lib/commonjs/geometry/coordinateMapping.js +156 -0
  22. package/lib/commonjs/geometry/coordinateMapping.js.map +1 -0
  23. package/lib/commonjs/index.js +130 -0
  24. package/lib/commonjs/index.js.map +1 -0
  25. package/lib/commonjs/native/cameraEngine.js +86 -0
  26. package/lib/commonjs/native/cameraEngine.js.map +1 -0
  27. package/lib/commonjs/native/visionCameraPeer.js +28 -0
  28. package/lib/commonjs/native/visionCameraPeer.js.map +1 -0
  29. package/lib/commonjs/native/visionSurface.js +38 -0
  30. package/lib/commonjs/native/visionSurface.js.map +1 -0
  31. package/lib/commonjs/package.json +1 -0
  32. package/lib/commonjs/permissions/permissionPort.js +105 -0
  33. package/lib/commonjs/permissions/permissionPort.js.map +1 -0
  34. package/lib/commonjs/react/CameraPreview.js +136 -0
  35. package/lib/commonjs/react/CameraPreview.js.map +1 -0
  36. package/lib/commonjs/react/VisionCameraFeed.js +196 -0
  37. package/lib/commonjs/react/VisionCameraFeed.js.map +1 -0
  38. package/lib/commonjs/react/hooks.js +50 -0
  39. package/lib/commonjs/react/hooks.js.map +1 -0
  40. package/lib/commonjs/storage/artifactStore.js +98 -0
  41. package/lib/commonjs/storage/artifactStore.js.map +1 -0
  42. package/lib/commonjs/testing/conformance.js +109 -0
  43. package/lib/commonjs/testing/conformance.js.map +1 -0
  44. package/lib/commonjs/testing/index.js +50 -0
  45. package/lib/commonjs/testing/index.js.map +1 -0
  46. package/lib/commonjs/testing/testCameraAdapter.js +191 -0
  47. package/lib/commonjs/testing/testCameraAdapter.js.map +1 -0
  48. package/lib/module/config/types.js +49 -0
  49. package/lib/module/config/types.js.map +1 -0
  50. package/lib/module/core/capabilities.js +37 -0
  51. package/lib/module/core/capabilities.js.map +1 -0
  52. package/lib/module/core/captureController.js +98 -0
  53. package/lib/module/core/captureController.js.map +1 -0
  54. package/lib/module/core/contract.js +12 -0
  55. package/lib/module/core/contract.js.map +1 -0
  56. package/lib/module/core/controller.js +442 -0
  57. package/lib/module/core/controller.js.map +1 -0
  58. package/lib/module/core/sessionMachine.js +109 -0
  59. package/lib/module/core/sessionMachine.js.map +1 -0
  60. package/lib/module/core/sessionRuntime.js +215 -0
  61. package/lib/module/core/sessionRuntime.js.map +1 -0
  62. package/lib/module/diagnostics/errors.js +79 -0
  63. package/lib/module/diagnostics/errors.js.map +1 -0
  64. package/lib/module/diagnostics/logger.js +35 -0
  65. package/lib/module/diagnostics/logger.js.map +1 -0
  66. package/lib/module/geometry/coordinateMapping.js +149 -0
  67. package/lib/module/geometry/coordinateMapping.js.map +1 -0
  68. package/lib/module/index.js +44 -0
  69. package/lib/module/index.js.map +1 -0
  70. package/lib/module/native/cameraEngine.js +83 -0
  71. package/lib/module/native/cameraEngine.js.map +1 -0
  72. package/lib/module/native/visionCameraPeer.js +24 -0
  73. package/lib/module/native/visionCameraPeer.js.map +1 -0
  74. package/lib/module/native/visionSurface.js +34 -0
  75. package/lib/module/native/visionSurface.js.map +1 -0
  76. package/lib/module/package.json +1 -0
  77. package/lib/module/permissions/permissionPort.js +101 -0
  78. package/lib/module/permissions/permissionPort.js.map +1 -0
  79. package/lib/module/react/CameraPreview.js +130 -0
  80. package/lib/module/react/CameraPreview.js.map +1 -0
  81. package/lib/module/react/VisionCameraFeed.js +190 -0
  82. package/lib/module/react/VisionCameraFeed.js.map +1 -0
  83. package/lib/module/react/hooks.js +45 -0
  84. package/lib/module/react/hooks.js.map +1 -0
  85. package/lib/module/storage/artifactStore.js +94 -0
  86. package/lib/module/storage/artifactStore.js.map +1 -0
  87. package/lib/module/testing/conformance.js +102 -0
  88. package/lib/module/testing/conformance.js.map +1 -0
  89. package/lib/module/testing/index.js +13 -0
  90. package/lib/module/testing/index.js.map +1 -0
  91. package/lib/module/testing/testCameraAdapter.js +185 -0
  92. package/lib/module/testing/testCameraAdapter.js.map +1 -0
  93. package/lib/typescript/commonjs/config/types.d.ts +122 -0
  94. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/core/capabilities.d.ts +16 -0
  96. package/lib/typescript/commonjs/core/capabilities.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/core/captureController.d.ts +48 -0
  98. package/lib/typescript/commonjs/core/captureController.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/core/contract.d.ts +92 -0
  100. package/lib/typescript/commonjs/core/contract.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/core/controller.d.ts +15 -0
  102. package/lib/typescript/commonjs/core/controller.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/core/sessionMachine.d.ts +46 -0
  104. package/lib/typescript/commonjs/core/sessionMachine.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/core/sessionRuntime.d.ts +64 -0
  106. package/lib/typescript/commonjs/core/sessionRuntime.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/diagnostics/errors.d.ts +24 -0
  108. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/diagnostics/logger.d.ts +24 -0
  110. package/lib/typescript/commonjs/diagnostics/logger.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts +23 -0
  112. package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/index.d.ts +32 -0
  114. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/native/cameraEngine.d.ts +50 -0
  116. package/lib/typescript/commonjs/native/cameraEngine.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/native/visionCameraPeer.d.ts +2 -0
  118. package/lib/typescript/commonjs/native/visionCameraPeer.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/native/visionSurface.d.ts +41 -0
  120. package/lib/typescript/commonjs/native/visionSurface.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/package.json +1 -0
  122. package/lib/typescript/commonjs/permissions/permissionPort.d.ts +24 -0
  123. package/lib/typescript/commonjs/permissions/permissionPort.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/react/CameraPreview.d.ts +25 -0
  125. package/lib/typescript/commonjs/react/CameraPreview.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts +31 -0
  127. package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/react/hooks.d.ts +12 -0
  129. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/storage/artifactStore.d.ts +54 -0
  131. package/lib/typescript/commonjs/storage/artifactStore.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/testing/conformance.d.ts +37 -0
  133. package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/testing/index.d.ts +12 -0
  135. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts +61 -0
  137. package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts.map +1 -0
  138. package/lib/typescript/module/config/types.d.ts +122 -0
  139. package/lib/typescript/module/config/types.d.ts.map +1 -0
  140. package/lib/typescript/module/core/capabilities.d.ts +16 -0
  141. package/lib/typescript/module/core/capabilities.d.ts.map +1 -0
  142. package/lib/typescript/module/core/captureController.d.ts +48 -0
  143. package/lib/typescript/module/core/captureController.d.ts.map +1 -0
  144. package/lib/typescript/module/core/contract.d.ts +92 -0
  145. package/lib/typescript/module/core/contract.d.ts.map +1 -0
  146. package/lib/typescript/module/core/controller.d.ts +15 -0
  147. package/lib/typescript/module/core/controller.d.ts.map +1 -0
  148. package/lib/typescript/module/core/sessionMachine.d.ts +46 -0
  149. package/lib/typescript/module/core/sessionMachine.d.ts.map +1 -0
  150. package/lib/typescript/module/core/sessionRuntime.d.ts +64 -0
  151. package/lib/typescript/module/core/sessionRuntime.d.ts.map +1 -0
  152. package/lib/typescript/module/diagnostics/errors.d.ts +24 -0
  153. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  154. package/lib/typescript/module/diagnostics/logger.d.ts +24 -0
  155. package/lib/typescript/module/diagnostics/logger.d.ts.map +1 -0
  156. package/lib/typescript/module/geometry/coordinateMapping.d.ts +23 -0
  157. package/lib/typescript/module/geometry/coordinateMapping.d.ts.map +1 -0
  158. package/lib/typescript/module/index.d.ts +32 -0
  159. package/lib/typescript/module/index.d.ts.map +1 -0
  160. package/lib/typescript/module/native/cameraEngine.d.ts +50 -0
  161. package/lib/typescript/module/native/cameraEngine.d.ts.map +1 -0
  162. package/lib/typescript/module/native/visionCameraPeer.d.ts +2 -0
  163. package/lib/typescript/module/native/visionCameraPeer.d.ts.map +1 -0
  164. package/lib/typescript/module/native/visionSurface.d.ts +41 -0
  165. package/lib/typescript/module/native/visionSurface.d.ts.map +1 -0
  166. package/lib/typescript/module/package.json +1 -0
  167. package/lib/typescript/module/permissions/permissionPort.d.ts +24 -0
  168. package/lib/typescript/module/permissions/permissionPort.d.ts.map +1 -0
  169. package/lib/typescript/module/react/CameraPreview.d.ts +25 -0
  170. package/lib/typescript/module/react/CameraPreview.d.ts.map +1 -0
  171. package/lib/typescript/module/react/VisionCameraFeed.d.ts +31 -0
  172. package/lib/typescript/module/react/VisionCameraFeed.d.ts.map +1 -0
  173. package/lib/typescript/module/react/hooks.d.ts +12 -0
  174. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  175. package/lib/typescript/module/storage/artifactStore.d.ts +54 -0
  176. package/lib/typescript/module/storage/artifactStore.d.ts.map +1 -0
  177. package/lib/typescript/module/testing/conformance.d.ts +37 -0
  178. package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
  179. package/lib/typescript/module/testing/index.d.ts +12 -0
  180. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  181. package/lib/typescript/module/testing/testCameraAdapter.d.ts +61 -0
  182. package/lib/typescript/module/testing/testCameraAdapter.d.ts.map +1 -0
  183. package/package.json +49 -13
  184. package/skills/sdk-rn-camera/SKILL.md +6 -3
  185. package/src/index.ts +4 -12
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createVisionCameraEngine = createVisionCameraEngine;
7
+ var _visionCameraPeer = require("./visionCameraPeer.js");
8
+ var _errors = require("../diagnostics/errors.js");
9
+ var _visionSurface = require("./visionSurface.js");
10
+ /**
11
+ * CameraEngine port + default react-native-vision-camera adapter.
12
+ *
13
+ * This is the only module that knows a native camera library exists. The
14
+ * default adapter lazily requires it, mirroring
15
+ * `packages/rn-auth/src/tokens/secureStore.ts`, so unit tests that inject a
16
+ * fake never load native code.
17
+ *
18
+ * Preview frames never cross this boundary: `capture` returns a file reference
19
+ * plus metadata and nothing else (PERF-002, FR-021a).
20
+ *
21
+ * Targets the VisionCamera v5 API, where devices come from an async
22
+ * `CameraDeviceFactory` and capture runs through the photo output owned by the
23
+ * mounted preview surface (see `visionSurface`).
24
+ */
25
+
26
+ /** The subset of VisionCamera's `CameraDevice` this adapter reads. */
27
+
28
+ /**
29
+ * Default engine. VisionCamera drives the preview through its own React
30
+ * component, so this adapter owns capability discovery while `CameraPreview`
31
+ * owns the rendered surface and the photo output that capture runs through.
32
+ */
33
+ function createVisionCameraEngine() {
34
+ // One registry per engine, so two controllers never share a surface.
35
+ const surfaces = (0, _visionSurface.createSurfaceRegistry)();
36
+ // Loaded when the default adapter is created; a missing peer is `cameraUnavailable`.
37
+ const {
38
+ VisionCamera
39
+ } = (0, _visionCameraPeer.loadVisionCamera)();
40
+
41
+ // The factory is created once and reused: it keeps its own device list up to
42
+ // date, so re-creating it per call would only add latency.
43
+ let factory = null;
44
+ async function devices() {
45
+ factory ??= VisionCamera.createDeviceFactory();
46
+ return (await factory)?.cameraDevices ?? [];
47
+ }
48
+ return {
49
+ awaitsSurfaceStart: true,
50
+ attachSurface: surface => surfaces.attach(surface),
51
+ async start() {
52
+ // The preview component owns session activation; the engine only needs
53
+ // to confirm a device exists before the surface mounts.
54
+ const available = await devices();
55
+ if (available.length === 0) {
56
+ throw new _errors.CameraError('cameraUnavailable', 'No camera device is available');
57
+ }
58
+ },
59
+ async stop() {
60
+ // Teardown is driven by unmounting the preview surface.
61
+ },
62
+ async capture(request) {
63
+ const surface = surfaces.current();
64
+ if (!surface) {
65
+ throw new _errors.CameraError('notReady', 'The default VisionCamera engine captures through the CameraPreview ' + 'surface. Mount <CameraPreview> before calling capture().');
66
+ }
67
+ return surface.capture(request);
68
+ },
69
+ async setTorch() {
70
+ // Torch is a preview-surface prop; the controller mirrors the state and
71
+ // CameraPreview applies it.
72
+ },
73
+ async getCapabilities() {
74
+ const available = await devices();
75
+ const positions = Array.from(new Set(available.map(device => device.position).filter(p => p === 'front' || p === 'back')));
76
+ return {
77
+ availablePositions: positions,
78
+ hasFlash: available.some(device => device.hasFlash === true),
79
+ hasTorch: available.some(device => device.hasTorch === true),
80
+ supportsOrientationChange: true,
81
+ hasCameraHardware: available.length > 0
82
+ };
83
+ }
84
+ };
85
+ }
86
+ //# sourceMappingURL=cameraEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_visionCameraPeer","require","_errors","_visionSurface","createVisionCameraEngine","surfaces","createSurfaceRegistry","VisionCamera","loadVisionCamera","factory","devices","createDeviceFactory","cameraDevices","awaitsSurfaceStart","attachSurface","surface","attach","start","available","length","CameraError","stop","capture","request","current","setTorch","getCapabilities","positions","Array","from","Set","map","device","position","filter","p","availablePositions","hasFlash","some","hasTorch","supportsOrientationChange","hasCameraHardware"],"sourceRoot":"../../../src","sources":["native/cameraEngine.ts"],"mappings":";;;;;;AAgBA,IAAAA,iBAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;;AAOA;AACA;AACA;AACA;AACA;AACO,SAASG,wBAAwBA,CAAA,EAAiB;EACxD;EACA,MAAMC,QAAQ,GAAG,IAAAC,oCAAqB,EAAC,CAAC;EACxC;EACA,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,kCAAgB,EAItC,CAAC;;EAEJ;EACA;EACA,IAAIC,OAAuE,GAAG,IAAI;EAElF,eAAeC,OAAOA,CAAA,EAAyC;IAC9DD,OAAO,KAAKF,YAAY,CAACI,mBAAmB,CAAC,CAAC;IAC9C,OAAO,CAAC,MAAMF,OAAO,GAAGG,aAAa,IAAI,EAAE;EAC5C;EAEA,OAAO;IACNC,kBAAkB,EAAE,IAAI;IAExBC,aAAa,EAAEC,OAAO,IAAIV,QAAQ,CAACW,MAAM,CAACD,OAAO,CAAC;IAElD,MAAME,KAAKA,CAAA,EAAG;MACb;MACA;MACA,MAAMC,SAAS,GAA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+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadVisionCamera = loadVisionCamera;
7
+ var _rnCore = require("@chipmobilesdk/rn-core");
8
+ var _errors = require("../diagnostics/errors.js");
9
+ /**
10
+ * react-native-vision-camera, loaded on first use (rn-core's lazy peer). A missing
11
+ * or unlinked module is a `cameraUnavailable` CameraError, the code the controller
12
+ * already reports when the camera cannot be reached.
13
+ */
14
+
15
+ // The engine and the permission port each describe the slice they use.
16
+
17
+ const visionCamera = (0, _rnCore.lazyPeer)('react-native-vision-camera', () => {
18
+ // Inside `try`, so Metro bundles an app that leaves this optional peer out.
19
+ try {
20
+ return require('react-native-vision-camera');
21
+ } catch (cause) {
22
+ throw cause;
23
+ }
24
+ });
25
+ function loadVisionCamera() {
26
+ return visionCamera.require(peer => new _errors.CameraError('cameraUnavailable', `${peer} is not installed or its native module is not linked`));
27
+ }
28
+ //# sourceMappingURL=visionCameraPeer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_rnCore","require","_errors","visionCamera","lazyPeer","cause","loadVisionCamera","peer","CameraError"],"sourceRoot":"../../../src","sources":["native/visionCameraPeer.ts"],"mappings":";;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;;AAKA;;AAGA,MAAME,YAAY,GAAG,IAAAC,gBAAQ,EAAC,4BAA4B,EAAE,MAAM;EACjE;EACA,IAAI;IACH,OAAOH,OAAO,CAAC,4BAA4B,CAAC;EAC7C,CAAC,CAAC,OAAOI,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;AAEK,SAASC,gBAAgBA,CAAA,EAAS;EACxC,OAAOH,YAAY,CAACF,OAAO,CAC1BM,IAAI,IACH,IAAIC,mBAAW,CACd,mBAAmB,EACnB,GAAGD,IAAI,sDACR,CACF,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSurfaceRegistry = createSurfaceRegistry;
7
+ /**
8
+ * The port between a mounted preview surface and an engine.
9
+ *
10
+ * VisionCamera v5 owns capture through the session the `<Camera>` view
11
+ * configures, so the photo output only exists while a surface is mounted. The
12
+ * engine is created before any surface exists, so the surface attaches itself
13
+ * to the engine and the engine reads it back at capture time.
14
+ *
15
+ * The registry belongs to an engine instance, not to the module. A module-level
16
+ * slot meant two controllers — two screens in a stack — shared one, so a
17
+ * capture could run through the other screen's surface (CAM-20).
18
+ */
19
+
20
+ /** What the mounted preview actually is, once the device and format are known. */
21
+
22
+ /** What a surface reports back about its own session. */
23
+
24
+ function createSurfaceRegistry() {
25
+ let active = null;
26
+ return {
27
+ attach(surface) {
28
+ active = surface;
29
+ return () => {
30
+ if (active === surface) {
31
+ active = null;
32
+ }
33
+ };
34
+ },
35
+ current: () => active
36
+ };
37
+ }
38
+ //# sourceMappingURL=visionSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSurfaceRegistry","active","attach","surface","current"],"sourceRoot":"../../../src","sources":["native/visionSurface.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AAeA;;AAcO,SAASA,qBAAqBA,CAAA,EAAoB;EACxD,IAAIC,MAA4B,GAAG,IAAI;EACvC,OAAO;IACNC,MAAMA,CAACC,OAAO,EAAE;MACfF,MAAM,GAAGE,OAAO;MAChB,OAAO,MAAM;QACZ,IAAIF,MAAM,KAAKE,OAAO,EAAE;UACvBF,MAAM,GAAG,IAAI;QACd;MACD,CAAC;IACF,CAAC;IACDG,OAAO,EAAEA,CAAA,KAAMH;EAChB,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createVisionCameraPermissions = createVisionCameraPermissions;
7
+ var _visionCameraPeer = require("../native/visionCameraPeer.js");
8
+ var _rnCore = require("@chipmobilesdk/rn-core");
9
+ /**
10
+ * PermissionPort + default react-native-vision-camera adapter (FR-004..FR-008).
11
+ *
12
+ * `getStatus` never prompts and never opens a session (FR-005); only `request`
13
+ * may prompt, and it refuses to re-prompt once the OS reports a permanent
14
+ * denial (FR-006). The default adapter lazily requires the native module so
15
+ * unit tests that inject a fake never load native code — same approach as
16
+ * `packages/rn-auth/src/tokens/secureStore.ts`.
17
+ *
18
+ * The adapter targets the VisionCamera v5 API: permissions live on the
19
+ * `VisionCamera` hybrid object, not on the `Camera` component (which carries no
20
+ * statics since v5).
21
+ */
22
+
23
+ /**
24
+ * VisionCamera `PermissionStatus` mapped onto our seven-state contract.
25
+ *
26
+ * `not-determined` also covers "denied once, but the app may ask again" on
27
+ * Android, which is exactly the state where re-prompting is allowed, so it maps
28
+ * to `undetermined` rather than `denied`.
29
+ */
30
+ function mapStatus(raw) {
31
+ switch (raw) {
32
+ case 'authorized':
33
+ return 'granted';
34
+ case 'not-determined':
35
+ return 'undetermined';
36
+ case 'denied':
37
+ return 'deniedPermanently';
38
+ case 'restricted':
39
+ return 'deniedPermanently';
40
+ default:
41
+ return 'unsupported';
42
+ }
43
+ }
44
+ function createVisionCameraPermissions() {
45
+ // Loaded when the default adapter is created; a missing peer is `cameraUnavailable`.
46
+ const {
47
+ VisionCamera
48
+ } = (0, _visionCameraPeer.loadVisionCamera)();
49
+ const listeners = (0, _rnCore.createListenerSet)();
50
+ let last = null;
51
+ let stopWatchingLifecycle = null;
52
+ function read() {
53
+ try {
54
+ return mapStatus(VisionCamera.cameraPermissionStatus);
55
+ } catch {
56
+ // The native module is unreachable; report it rather than pretending
57
+ // the permission is merely undetermined.
58
+ return 'unsupported';
59
+ }
60
+ }
61
+ function emit(state) {
62
+ if (state !== last) {
63
+ last = state;
64
+ listeners.notify(state);
65
+ }
66
+ return state;
67
+ }
68
+ return {
69
+ async getStatus() {
70
+ return emit(read());
71
+ },
72
+ async request() {
73
+ // Never re-prompt after a permanent denial (FR-006); report the
74
+ // settings-required state instead so the app can route the user.
75
+ const current = read();
76
+ if (current === 'deniedPermanently') {
77
+ return emit(current);
78
+ }
79
+ await VisionCamera.requestCameraPermission();
80
+ // Re-read rather than trusting the boolean result: the status carries
81
+ // the richer distinction the contract needs.
82
+ return emit(read());
83
+ },
84
+ subscribe(listener) {
85
+ const remove = listeners.add(listener);
86
+ // Grants and revocations made in system Settings send the app through
87
+ // background/foreground, so re-reading on foreground is what surfaces
88
+ // them (FR-007). Attached only while somebody is listening.
89
+ // rn-core's shared lifecycle port, so this adds no native subscription of its own.
90
+ stopWatchingLifecycle ??= (0, _rnCore.appLifecycle)().subscribe(state => {
91
+ if (state === 'active') {
92
+ emit(read());
93
+ }
94
+ });
95
+ return () => {
96
+ remove();
97
+ if (listeners.size === 0 && stopWatchingLifecycle) {
98
+ stopWatchingLifecycle();
99
+ stopWatchingLifecycle = null;
100
+ }
101
+ };
102
+ }
103
+ };
104
+ }
105
+ //# sourceMappingURL=permissionPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_visionCameraPeer","require","_rnCore","mapStatus","raw","createVisionCameraPermissions","VisionCamera","loadVisionCamera","listeners","createListenerSet","last","stopWatchingLifecycle","read","cameraPermissionStatus","emit","state","notify","getStatus","request","current","requestCameraPermission","subscribe","listener","remove","add","appLifecycle","size"],"sourceRoot":"../../../src","sources":["permissions/permissionPort.ts"],"mappings":";;;;;;AAcA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,SAASA,CAACC,GAAW,EAAyB;EACtD,QAAQA,GAAG;IACV,KAAK,YAAY;MAChB,OAAO,SAAS;IACjB,KAAK,gBAA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AAY,EAAC,CAAC,CAACJ,SAAS,CAACN,KAAK,IAAI;QAC3D,IAAIA,KAAK,KAAK,QAAQ,EAAE;UACvBD,IAAI,CAACF,IAAI,CAAC,CAAC,CAAC;QACb;MACD,CAAC,CAAC;MACF,OAAO,MAAM;QACZW,MAAM,CAAC,CAAC;QACR,IAAIf,SAAS,CAACkB,IAAI,KAAK,CAAC,IAAIf,qBAAqB,EAAE;UAClDA,qBAAqB,CAAC,CAAC;UACvBA,qBAAqB,GAAG,IAAI;QAC7B;MACD,CAAC;IACF;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CameraPreview = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _hooks = require("./hooks.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * Camera preview surface (FR-009..FR-013, UX-001, UX-003).
14
+ *
15
+ * Renders the camera feed and nothing else: no shutter button, no permission
16
+ * copy, no error text, and no theme dependency. Consuming apps draw their own
17
+ * controls and overlays through `children`, positioned with the geometry
18
+ * reported by `onGeometryChange`.
19
+ */
20
+
21
+ /** The feed module failed to load; distinct from `null`, which means not requested. */
22
+ const FEED_UNAVAILABLE = 'unavailable';
23
+
24
+ /**
25
+ * Nominal capture dimensions, until the mounted surface reports its own.
26
+ *
27
+ * Geometry built on these was landscape on a portrait phone, so every mapped
28
+ * rectangle was wrong on a real device (CAM-10). `onGeometryChange` now fires
29
+ * again with the real numbers as soon as the preview reports them, and apps
30
+ * that map coordinates should wait for `state.surface` rather than the first
31
+ * geometry.
32
+ */
33
+ const DEFAULT_IMAGE_WIDTH = 1920;
34
+ const DEFAULT_IMAGE_HEIGHT = 1080;
35
+ const CameraPreview = ({
36
+ controller,
37
+ resizeMode = 'cover',
38
+ style,
39
+ onGeometryChange,
40
+ accessibilityLabel,
41
+ accessibilityRole,
42
+ children
43
+ }) => {
44
+ const [layout, setLayout] = (0, _react.useState)(null);
45
+ // Subscribed, not read once: a plain `controller.state` read only refreshed
46
+ // when the parent happened to re-render, so the feed could stay unmounted
47
+ // after the session became active (or stay mounted after it stopped).
48
+ const state = (0, _hooks.useCameraState)(controller);
49
+
50
+ // Tell the controller a surface exists so foregrounding can restart the
51
+ // session, and clear it on unmount so the camera is released (FR-016). Both
52
+ // calls are no-ops on an idle or disposed controller.
53
+ (0, _react.useEffect)(() => {
54
+ controller.setSurfaceMounted(true);
55
+ return () => {
56
+ controller.setSurfaceMounted(false);
57
+ controller.stop().catch(() => undefined);
58
+ };
59
+ }, [controller]);
60
+ const attachSurface = (0, _react.useCallback)(surface => controller.attachSurface(surface), [controller]);
61
+ const onSurfaceStarted = (0, _react.useCallback)(info => controller.reportSurfaceStarted(info), [controller]);
62
+ const onSurfaceFailed = (0, _react.useCallback)(code => controller.reportSurfaceFailed(code), [controller]);
63
+ const onLayout = (0, _react.useCallback)(event => {
64
+ const {
65
+ width,
66
+ height
67
+ } = event.nativeEvent.layout;
68
+ setLayout({
69
+ width,
70
+ height
71
+ });
72
+ }, []);
73
+ const geometry = (0, _react.useMemo)(() => {
74
+ if (!layout || layout.width === 0 || layout.height === 0) {
75
+ return null;
76
+ }
77
+ const surface = state.surface;
78
+ return {
79
+ imageWidth: surface && surface.imageWidth > 0 ? surface.imageWidth : DEFAULT_IMAGE_WIDTH,
80
+ imageHeight: surface && surface.imageHeight > 0 ? surface.imageHeight : DEFAULT_IMAGE_HEIGHT,
81
+ previewWidth: layout.width,
82
+ previewHeight: layout.height,
83
+ resizeMode,
84
+ orientation: surface?.orientation ?? 0,
85
+ isMirrored: (surface?.cameraPosition ?? state.cameraPosition) === 'front'
86
+ };
87
+ }, [layout, resizeMode, state.cameraPosition, state.surface]);
88
+ (0, _react.useEffect)(() => {
89
+ if (geometry && onGeometryChange) {
90
+ onGeometryChange(geometry);
91
+ }
92
+ }, [geometry, onGeometryChange]);
93
+
94
+ // Mounted while the session is coming up, running, or paused: the surface is
95
+ // what makes it come up at all, and unmounting it on a pause meant rebuilding
96
+ // the device, the session and the photo output on every resume (CAM-08, CAM-09).
97
+ const feedRequested = state.permission === 'granted' && (state.session === 'starting' || state.session === 'active' || state.session === 'paused');
98
+
99
+ // Lazy require so importing this package never pulls in the native module
100
+ // for consumers that only use the pure utilities or the test adapter.
101
+ const Feed = (0, _react.useMemo)(() => {
102
+ if (!feedRequested) {
103
+ return null;
104
+ }
105
+ try {
106
+ return require('./VisionCameraFeed').VisionCameraFeed;
107
+ } catch {
108
+ // Reported, not swallowed (CAM-21): the session fails with
109
+ // `cameraUnavailable` instead of showing a black preview.
110
+ return FEED_UNAVAILABLE;
111
+ }
112
+ }, [feedRequested]);
113
+ (0, _react.useEffect)(() => {
114
+ if (Feed === FEED_UNAVAILABLE) {
115
+ controller.reportSurfaceUnavailable();
116
+ }
117
+ }, [Feed, controller]);
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
119
+ style: style,
120
+ onLayout: onLayout,
121
+ accessibilityLabel: accessibilityLabel,
122
+ accessibilityRole: accessibilityRole,
123
+ testID: "rn-camera-preview",
124
+ children: [Feed && Feed !== FEED_UNAVAILABLE ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Feed, {
125
+ cameraPosition: state.cameraPosition,
126
+ resizeMode: resizeMode,
127
+ torchEnabled: state.torchEnabled,
128
+ isActive: state.session !== 'paused',
129
+ attachSurface: attachSurface,
130
+ onStarted: onSurfaceStarted,
131
+ onFailed: onSurfaceFailed
132
+ }) : null, children]
133
+ });
134
+ };
135
+ exports.CameraPreview = CameraPreview;
136
+ //# sourceMappingURL=CameraPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_hooks","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FEED_UNAVAILABLE","DEFAULT_IMAGE_WIDTH","DEFAULT_IMAGE_HEIGHT","CameraPreview","controller","resizeMode","style","onGeometryChange","accessibilityLabel","accessibilityRole","children","layout","setLayout","useState","state","useCameraState","useEffect","setSurfaceMounted","stop","catch","undefined","attachSurface","useCallback","surface","onSurfaceStarted","info","reportSurfaceStarted","onSurfaceFailed","code","reportSurfaceFailed","onLayout","event","width","height","nativeEvent","geometry","useMemo","imageWidth","imageHeight","previewWidth","previewHeight","orientation","isMirrored","cameraPosition","feedRequested","permission","session","Feed","VisionCameraFeed","reportSurfaceUnavailable","jsxs","View","testID","jsx","torchEnabled","isActive","onStarted","onFailed","exports"],"sourceRoot":"../../../src","sources":["react/CameraPreview.tsx"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,MAAA,GAAAF,OAAA;AAAyC,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAA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C6C,wBAAwB,CAAC,CAAC;IACtC;EACD,CAAC,EAAE,CAACF,IAAI,EAAE3C,UAAU,CAAC,CAAC;EAEtB,oBACC,IAAAxB,WAAA,CAAAsE,IAAA,EAACxE,YAAA,CAAAyE,IAAI;IACJ7C,KAAK,EAAEA,KAAM;IACbwB,QAAQ,EAAEA,QAAS;IACnBtB,kBAAkB,EAAEA,kBAAmB;IACvCC,iBAAiB,EAAEA,iBAAkB;IACrC2C,MAAM,EAAC,mBAAmB;IAAA1C,QAAA,GAEzBqC,IAAI,IAAIA,IAAI,KAAK/C,gBAAgB,gBACjC,IAAApB,WAAA,CAAAyE,GAAA,EAACN,IAAI;MACJJ,cAAc,EAAE7B,KAAK,CAAC6B,cAAe;MACrCtC,UAAU,EAAEA,UAAW;MACvBiD,YAAY,EAAExC,KAAK,CAACwC,YAAa;MACjCC,QAAQ,EAAEzC,KAAK,CAACgC,OAAO,KAAK,QAAS;MACrCzB,aAAa,EAAEA,aAAc;MAC7BmC,SAAS,EAAEhC,gBAAiB;MAC5BiC,QAAQ,EAAE9B;IAAgB,CAC1B,CAAC,GACC,IAAI,EACPjB,QAAQ;EAAA,CACJ,CAAC;AAET,CAAC;AAACgD,OAAA,CAAAvD,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VisionCameraFeed = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeVisionCamera = require("react-native-vision-camera");
10
+ var _types = require("../config/types.js");
11
+ var _captureController = require("../core/captureController.js");
12
+ var _errors = require("../diagnostics/errors.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
+ /**
16
+ * The live VisionCamera surface rendered inside `CameraPreview`.
17
+ *
18
+ * Split into its own module so `CameraPreview` can require it lazily: consumers
19
+ * that only use the pure utilities or the test adapter never load the native
20
+ * module, while the hooks this component needs (`useCameraDevice`,
21
+ * `usePhotoOutput`) can still be called normally.
22
+ *
23
+ * It also owns capture. In VisionCamera v5 the photo output belongs to the
24
+ * session the `<Camera>` view configures, so the output only exists while this
25
+ * surface is mounted; it is published to the engine through `visionSurface`.
26
+ */
27
+
28
+ const styles = _reactNative.StyleSheet.create({
29
+ feed: {
30
+ flex: 1
31
+ }
32
+ });
33
+ const MIME_TYPES = {
34
+ jpeg: 'image/jpeg',
35
+ heic: 'image/heic',
36
+ dng: 'image/x-adobe-dng',
37
+ tiff: 'image/tiff'
38
+ };
39
+
40
+ /** VisionCamera reports orientation as a compass value; the contract wants degrees. */
41
+ const ORIENTATION_DEGREES = {
42
+ up: 0,
43
+ right: 90,
44
+ down: 180,
45
+ left: 270
46
+ };
47
+ function orientationOf(orientation) {
48
+ const degrees = ORIENTATION_DEGREES[orientation];
49
+ return degrees === undefined ? (0, _types.unavailable)() : (0, _types.known)(degrees);
50
+ }
51
+ function toFileUri(path) {
52
+ return path.startsWith('file://') ? path : `file://${path}`;
53
+ }
54
+ function toFilePath(uri) {
55
+ return uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
56
+ }
57
+
58
+ /**
59
+ * What a native session error means, from the code VisionCamera reports
60
+ * (CAM-08). Anything unrecognised is an interruption: the session is gone, and
61
+ * the app may try again.
62
+ */
63
+ function nativeSessionCode(error) {
64
+ const code = String(error?.code ?? '').toLowerCase();
65
+ if (code.includes('permission')) return 'permissionDenied';
66
+ if (code.includes('in-use') || code.includes('already-in-use')) return 'cameraInUse';
67
+ if (code.includes('unavailable') || code.includes('no-device')) return 'cameraUnavailable';
68
+ if (code.includes('restricted') || code.includes('blocked')) return 'cameraBlocked';
69
+ return 'interrupted';
70
+ }
71
+
72
+ /** Native failures carry no code and may name a file path; never surface them raw. */
73
+ function asCameraError(error, code) {
74
+ return (0, _errors.isCameraError)(error) ? error : new _errors.CameraError(code);
75
+ }
76
+ async function capturePhoto(photoOutput, request, /** The device actually mounted; the request cannot ask for another one. */
77
+ cameraPosition) {
78
+ let photo;
79
+ try {
80
+ photo = await photoOutput.capturePhoto({
81
+ flashMode: request.flashMode ?? 'off'
82
+ }, {});
83
+ } catch (error) {
84
+ throw asCameraError(error, 'captureFailed');
85
+ }
86
+ try {
87
+ // A destination makes the artifact app-owned, so it is written straight
88
+ // there; otherwise it goes to a temporary file (FR-026a).
89
+ let path;
90
+ if (request.destination) {
91
+ try {
92
+ await photo.saveToFileAsync(toFilePath(request.destination));
93
+ } catch {
94
+ throw new _errors.CameraError('storageFailure', 'Could not write the capture to the requested destination');
95
+ }
96
+ path = request.destination;
97
+ } else {
98
+ // VisionCamera's own temporary directory. The controller moves the file
99
+ // into the artifact store, when it has one, so cleanup can reach it.
100
+ try {
101
+ path = await photo.saveToTemporaryFileAsync();
102
+ } catch (error) {
103
+ throw asCameraError(error, 'storageFailure');
104
+ }
105
+ }
106
+ return {
107
+ uri: toFileUri(path),
108
+ mimeType: MIME_TYPES[photo.containerFormat] ?? 'application/octet-stream',
109
+ width: photo.width,
110
+ height: photo.height,
111
+ timestamp: Date.now(),
112
+ // The camera that took it, not the one the request named (CAM-06).
113
+ cameraPosition,
114
+ // Ownership is decided by the controller from the original request;
115
+ // this value is overwritten there and is only a safe default.
116
+ ownership: request.destination ? 'appOwned' : 'packageTemporary',
117
+ // Quality is fixed on the photo output, not per capture, and nothing here
118
+ // resizes. Report what was actually applied rather than echo the hints.
119
+ effectiveQuality: _captureController.DEFAULT_QUALITY,
120
+ effectiveMaxDimension: (0, _types.unavailable)(),
121
+ // The native layer reports neither back after a save, and guessing them
122
+ // would be worse than saying so (FR-022).
123
+ fileSize: (0, _types.unavailable)(),
124
+ orientation: orientationOf(photo.orientation)
125
+ };
126
+ } finally {
127
+ // Large native buffers must not wait for the JS GC.
128
+ photo.dispose();
129
+ }
130
+ }
131
+
132
+ /** What the device actually is, for coordinate mapping (CAM-10). */
133
+ function surfaceInfoOf(device, fallback) {
134
+ const format = device?.formats?.[0];
135
+ return {
136
+ imageWidth: format?.photoWidth ?? format?.videoWidth ?? 0,
137
+ imageHeight: format?.photoHeight ?? format?.videoHeight ?? 0,
138
+ orientation: 0,
139
+ cameraPosition: device?.position === 'front' || device?.position === 'back' ? device.position : fallback
140
+ };
141
+ }
142
+
143
+ /** The slice of VisionCamera's `CameraDeviceFormat` the geometry needs. */
144
+
145
+ const VisionCameraFeed = ({
146
+ cameraPosition,
147
+ resizeMode,
148
+ torchEnabled,
149
+ isActive,
150
+ attachSurface,
151
+ onStarted,
152
+ onFailed
153
+ }) => {
154
+ const device = (0, _reactNativeVisionCamera.useCameraDevice)(cameraPosition);
155
+ const photoOutput = (0, _reactNativeVisionCamera.usePhotoOutput)({
156
+ quality: _captureController.DEFAULT_QUALITY
157
+ });
158
+ const surface = (0, _react.useMemo)(() => ({
159
+ capture: request => capturePhoto(photoOutput, request, cameraPosition)
160
+ }), [photoOutput, cameraPosition]);
161
+ (0, _react.useEffect)(() => attachSurface(surface), [attachSurface, surface]);
162
+
163
+ // VisionCamera applies `torchMode` on mount, before the camera is active, and
164
+ // leaves the native "Camera is not active" rejection unhandled — one red
165
+ // error per session start. Leave the prop unset until the torch is first
166
+ // turned on; after that 'off' must be sent explicitly to turn it back off.
167
+ const [torchTouched, setTorchTouched] = (0, _react.useState)(false);
168
+ if (torchEnabled && !torchTouched) {
169
+ setTorchTouched(true);
170
+ }
171
+ const torchMode = torchEnabled ? 'on' : torchTouched ? 'off' : undefined;
172
+ if (!device) {
173
+ return null;
174
+ }
175
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeVisionCamera.Camera, {
176
+ style: styles.feed,
177
+ device: device,
178
+ outputs: [photoOutput]
179
+ // Mounted through `paused` and `starting`: unmounting the view tore the
180
+ // session down and rebuilding it cost the first-frame budget (CAM-09).
181
+ ,
182
+ isActive: isActive
183
+ // The session is active when frames arrive, not when it was asked for.
184
+ ,
185
+ onStarted: () => onStarted(surfaceInfoOf(device, cameraPosition)),
186
+ onError: error => onFailed(nativeSessionCode(error)),
187
+ resizeMode: resizeMode
188
+ // Left unset until the app first touches the torch, so the device's own default stands.
189
+ ,
190
+ ...(torchMode === undefined ? {} : {
191
+ torchMode
192
+ })
193
+ });
194
+ };
195
+ exports.VisionCameraFeed = VisionCameraFeed;
196
+ //# sourceMappingURL=VisionCameraFeed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeVisionCamera","_types","_captureController","_errors","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","styles","StyleSheet","create","feed","flex","MIME_TYPES","jpeg","heic","dng","tiff","ORIENTATION_DEGREES","up","right","down","left","orientationOf","orientation","degrees","undefined","unavailable","known","toFileUri","path","startsWith","toFilePath","uri","slice","length","nativeSessionCode","error","code","String","toLowerCase","includes","asCameraError","isCameraError","CameraError","capturePhoto","photoOutput","request","cameraPosition","photo","flashMode","destination","saveToFileAsync","saveToTemporaryFileAsync","mimeType","containerFormat","width","height","timestamp","Date","now","ownership","effectiveQuality","DEFAULT_QUALITY","effectiveMaxDimension","fileSize","dispose","surfaceInfoOf","device","fallback","format","formats","imageWidth","photoWidth","videoWidth","imageHeight","photoHeight","videoHeight","position","VisionCameraFeed","resizeMode","torchEnabled","isActive","attachSurface","onStarted","onFailed","useCameraDevice","usePhotoOutput","quality","surface","useMemo","capture","useEffect","torchTouched","setTorchTouched","useState","torchMode","jsx","Camera","style","outputs","onError","exports"],"sourceRoot":"../../../src","sources":["react/VisionCameraFeed.tsx"],"mappings":";;;;;;AAaA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AASA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAyF,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CA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