@symbiote-native/camera 0.0.0-stage → 0.0.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 (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -2
  3. package/build/angular/camera-view/index.d.ts +43 -0
  4. package/build/angular/camera-view/index.js +101 -0
  5. package/build/angular/index.d.ts +3 -0
  6. package/build/angular/index.js +4 -0
  7. package/build/angular/services/camera-permissions.service.d.ts +8 -0
  8. package/build/angular/services/camera-permissions.service.js +82 -0
  9. package/build/core/android-barcode.d.ts +50 -0
  10. package/build/core/android-barcode.js +2 -0
  11. package/build/core/camera-api.d.ts +35 -0
  12. package/build/core/camera-api.js +68 -0
  13. package/build/core/camera-view-events.d.ts +3 -0
  14. package/build/core/camera-view-events.js +60 -0
  15. package/build/core/camera-view-handle.d.ts +26 -0
  16. package/build/core/camera-view-handle.js +40 -0
  17. package/build/core/camera-view.d.ts +12 -0
  18. package/build/core/camera-view.js +38 -0
  19. package/build/core/constants.d.ts +6 -0
  20. package/build/core/constants.js +7 -0
  21. package/build/core/index.d.ts +9 -0
  22. package/build/core/index.js +5 -0
  23. package/build/core/native-module.d.ts +28 -0
  24. package/build/core/native-module.js +3 -0
  25. package/build/core/picture-options.d.ts +9 -0
  26. package/build/core/picture-options.js +29 -0
  27. package/build/core/picture-ref.d.ts +2 -0
  28. package/build/core/picture-ref.js +3 -0
  29. package/build/core/props.d.ts +4 -0
  30. package/build/core/props.js +26 -0
  31. package/build/core/types.d.ts +170 -0
  32. package/build/core/types.js +1 -0
  33. package/build/react/camera-view.d.ts +8 -0
  34. package/build/react/camera-view.js +6 -0
  35. package/build/react/index.d.ts +5 -0
  36. package/build/react/index.js +4 -0
  37. package/build/react/use-camera-permissions.d.ts +9 -0
  38. package/build/react/use-camera-permissions.js +5 -0
  39. package/build/solid/camera-view.d.ts +33 -0
  40. package/build/solid/camera-view.js +4 -0
  41. package/build/solid/index.d.ts +4 -0
  42. package/build/solid/index.js +4 -0
  43. package/build/solid/use-camera-permissions.d.ts +10 -0
  44. package/build/solid/use-camera-permissions.js +5 -0
  45. package/build/svelte/camera-view.svelte +32 -0
  46. package/build/svelte/camera-view.svelte.d.ts +22 -0
  47. package/build/svelte/index.d.ts +4 -0
  48. package/build/svelte/index.js +4 -0
  49. package/build/svelte/use-camera-permissions.svelte.d.ts +9 -0
  50. package/build/svelte/use-camera-permissions.svelte.js +5 -0
  51. package/build/vue/camera-view.d.ts +2 -0
  52. package/build/vue/camera-view.js +4 -0
  53. package/build/vue/index.d.ts +4 -0
  54. package/build/vue/index.js +4 -0
  55. package/build/vue/use-camera-permissions.d.ts +10 -0
  56. package/build/vue/use-camera-permissions.js +5 -0
  57. package/build-ngc/angular/camera-view/index.d.ts +46 -0
  58. package/build-ngc/angular/camera-view/index.js +60 -0
  59. package/build-ngc/angular/camera-view/index.js.map +1 -0
  60. package/build-ngc/angular/index.d.ts +3 -0
  61. package/build-ngc/angular/index.js +5 -0
  62. package/build-ngc/angular/index.js.map +1 -0
  63. package/build-ngc/angular/services/camera-permissions.service.d.ts +13 -0
  64. package/build-ngc/angular/services/camera-permissions.service.js +28 -0
  65. package/build-ngc/angular/services/camera-permissions.service.js.map +1 -0
  66. package/build-ngc/core/android-barcode.d.ts +50 -0
  67. package/build-ngc/core/android-barcode.js +3 -0
  68. package/build-ngc/core/android-barcode.js.map +1 -0
  69. package/build-ngc/core/camera-api.d.ts +35 -0
  70. package/build-ngc/core/camera-api.js +69 -0
  71. package/build-ngc/core/camera-api.js.map +1 -0
  72. package/build-ngc/core/camera-view-events.d.ts +3 -0
  73. package/build-ngc/core/camera-view-events.js +61 -0
  74. package/build-ngc/core/camera-view-events.js.map +1 -0
  75. package/build-ngc/core/camera-view-handle.d.ts +26 -0
  76. package/build-ngc/core/camera-view-handle.js +41 -0
  77. package/build-ngc/core/camera-view-handle.js.map +1 -0
  78. package/build-ngc/core/camera-view.d.ts +12 -0
  79. package/build-ngc/core/camera-view.js +39 -0
  80. package/build-ngc/core/camera-view.js.map +1 -0
  81. package/build-ngc/core/constants.d.ts +6 -0
  82. package/build-ngc/core/constants.js +8 -0
  83. package/build-ngc/core/constants.js.map +1 -0
  84. package/build-ngc/core/index.d.ts +9 -0
  85. package/build-ngc/core/index.js +6 -0
  86. package/build-ngc/core/index.js.map +1 -0
  87. package/build-ngc/core/native-module.d.ts +28 -0
  88. package/build-ngc/core/native-module.js +4 -0
  89. package/build-ngc/core/native-module.js.map +1 -0
  90. package/build-ngc/core/picture-options.d.ts +9 -0
  91. package/build-ngc/core/picture-options.js +30 -0
  92. package/build-ngc/core/picture-options.js.map +1 -0
  93. package/build-ngc/core/picture-ref.d.ts +2 -0
  94. package/build-ngc/core/picture-ref.js +4 -0
  95. package/build-ngc/core/picture-ref.js.map +1 -0
  96. package/build-ngc/core/props.d.ts +4 -0
  97. package/build-ngc/core/props.js +27 -0
  98. package/build-ngc/core/props.js.map +1 -0
  99. package/build-ngc/core/types.d.ts +170 -0
  100. package/build-ngc/core/types.js +2 -0
  101. package/build-ngc/core/types.js.map +1 -0
  102. package/native-link.json +22 -0
  103. package/package.json +144 -3
  104. package/src/angular/camera-view/index.ts +95 -0
  105. package/src/angular/index.ts +8 -0
  106. package/src/angular/services/camera-permissions.service.ts +28 -0
  107. package/src/core/android-barcode.ts +48 -0
  108. package/src/core/camera-api.ts +99 -0
  109. package/src/core/camera-view-events.ts +103 -0
  110. package/src/core/camera-view-handle.ts +93 -0
  111. package/src/core/camera-view.ts +56 -0
  112. package/src/core/constants.ts +11 -0
  113. package/src/core/index.ts +57 -0
  114. package/src/core/native-module.ts +57 -0
  115. package/src/core/picture-options.ts +46 -0
  116. package/src/core/picture-ref.ts +4 -0
  117. package/src/core/props.ts +31 -0
  118. package/src/core/types.ts +223 -0
  119. package/src/react/camera-view.ts +17 -0
  120. package/src/react/index.ts +7 -0
  121. package/src/react/use-camera-permissions.ts +21 -0
  122. package/src/solid/camera-view.ts +9 -0
  123. package/src/solid/index.ts +6 -0
  124. package/src/solid/use-camera-permissions.ts +22 -0
  125. package/src/svelte/camera-view.svelte +32 -0
  126. package/src/svelte/index.ts +9 -0
  127. package/src/svelte/svelte-ambient.d.ts +3 -0
  128. package/src/svelte/svelte-compile.test-helper.ts +6 -0
  129. package/src/svelte/use-camera-permissions.svelte.ts +21 -0
  130. package/src/vue/camera-view.ts +5 -0
  131. package/src/vue/index.ts +6 -0
  132. package/src/vue/use-camera-permissions.ts +22 -0
@@ -0,0 +1,38 @@
1
+ // Ядро `CameraView`: нативный view камеры, чьи функции вызываются через `ViewPrototypes`
2
+ import { requireNativeViewManager } from 'expo-modules-core';
3
+ import { el } from '@symbiote-native/components';
4
+ import { defineExpoNativeView, isDevBuild } from '@symbiote-native/engine';
5
+ import { createCameraViewEvents } from './camera-view-events.js';
6
+ import { createCameraViewHandle } from './camera-view-handle.js';
7
+ import { CAMERA_MODULE_NAME } from './constants.js';
8
+ import { ensureNativeProps } from './props.js';
9
+ // Регистрация идёт при рендере: побочный эффект барреля теряется в release
10
+ const cameraView = defineExpoNativeView(requireNativeViewManager, CAMERA_MODULE_NAME);
11
+ export const cameraViewName = cameraView.name;
12
+ export const ensureCameraViewRegistered = cameraView.ensureRegistered;
13
+ // What upstream's `defaultProps` gave the class component
14
+ const DEFAULT_VIEW_PROPS = {
15
+ zoom: 0,
16
+ facing: 'back',
17
+ enableTorch: false,
18
+ mode: 'picture',
19
+ flash: 'off',
20
+ };
21
+ /** One per mounted view, `getNode` answers the host node once it exists */
22
+ export function createCameraView(getNode) {
23
+ const toEvents = createCameraViewEvents();
24
+ return {
25
+ handle: createCameraViewHandle(getNode),
26
+ render: props => {
27
+ if (!ensureCameraViewRegistered()) {
28
+ if (isDevBuild())
29
+ console.warn("'CameraView' is not available.");
30
+ return null;
31
+ }
32
+ return el(cameraViewName(), {
33
+ ...ensureNativeProps({ ...DEFAULT_VIEW_PROPS, ...props }),
34
+ ...toEvents(props),
35
+ });
36
+ },
37
+ };
38
+ }
@@ -0,0 +1,6 @@
1
+ export declare const CAMERA_MODULE_NAME = "ExpoCamera";
2
+ /** The label upstream puts into its `UnavailabilityError` */
3
+ export declare const CAMERA_PACKAGE_NAME = "expo-camera";
4
+ /** Equal barcode events of one type inside this window are dropped */
5
+ export declare const BARCODE_EVENT_THROTTLE_MS = 500;
6
+ export declare const MODERN_SCANNER_EVENT = "onModernBarcodeScanned";
@@ -0,0 +1,7 @@
1
+ // Apart from `native-module`, which resolves the module on import: the view needs the name too
2
+ export const CAMERA_MODULE_NAME = 'ExpoCamera';
3
+ /** The label upstream puts into its `UnavailabilityError` */
4
+ export const CAMERA_PACKAGE_NAME = 'expo-camera';
5
+ /** Equal barcode events of one type inside this window are dropped */
6
+ export const BARCODE_EVENT_THROTTLE_MS = 500;
7
+ export const MODERN_SCANNER_EVENT = 'onModernBarcodeScanned';
@@ -0,0 +1,9 @@
1
+ export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api';
2
+ export { cameraViewName, createCameraView, ensureCameraViewRegistered, type ICameraView, } from './camera-view';
3
+ export type { ICameraViewHandle } from './camera-view-handle';
4
+ export { CAMERA_MODULE_NAME } from './constants';
5
+ export type { ICameraPictureRef } from './native-module';
6
+ export { PictureRef } from './picture-ref';
7
+ export type { IAndroidBarcode } from './android-barcode';
8
+ export type { ICameraAvailableLenses, ICameraBarcodeBounds, ICameraBarcodePoint, ICameraBarcodeScanningResult, ICameraBarcodeSettings, ICameraBarcodeType, ICameraCapturedPicture, ICameraFlashMode, ICameraFocusMode, ICameraMode, ICameraMountError, ICameraOrientation, ICameraPhotoResult, ICameraPictureOptions, ICameraRatio, ICameraRecordingOptions, ICameraResponsiveOrientation, ICameraSavePictureOptions, ICameraScanningOptions, ICameraScanningResult, ICameraSupportedFeatures, ICameraType, ICameraVideoCodec, ICameraVideoQuality, ICameraVideoStabilization, ICameraViewProps, } from './types';
9
+ export { PermissionStatus, type EventSubscription, type PermissionExpiration, type PermissionResponse, } from 'expo-modules-core';
@@ -0,0 +1,5 @@
1
+ export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api.js';
2
+ export { cameraViewName, createCameraView, ensureCameraViewRegistered, } from './camera-view.js';
3
+ export { CAMERA_MODULE_NAME } from './constants.js';
4
+ export { PictureRef } from './picture-ref.js';
5
+ export { PermissionStatus, } from 'expo-modules-core';
@@ -0,0 +1,28 @@
1
+ import type { EventSubscription, PermissionResponse, SharedRef } from 'expo-modules-core';
2
+ import type { ICameraBarcodeScanningResult, ICameraBarcodeType, ICameraPhotoResult, ICameraSavePictureOptions, ICameraScanningOptions, ICameraScanningResult, ICameraVideoCodec } from './types';
3
+ /** A reference to a native instance of an image, other Expo packages accept it as is */
4
+ export type ICameraPictureRef = SharedRef<'image'> & {
5
+ width: number;
6
+ height: number;
7
+ /** Saves the image into the cache directory */
8
+ savePictureAsync(options?: ICameraSavePictureOptions): Promise<ICameraPhotoResult>;
9
+ };
10
+ export type ICameraPictureRefClass = abstract new (...args: never[]) => ICameraPictureRef;
11
+ export type ICameraNativeModule = {
12
+ Picture: ICameraPictureRefClass;
13
+ readonly isModernBarcodeScannerAvailable: boolean;
14
+ readonly toggleRecordingAsyncAvailable: boolean;
15
+ readonly Type: Record<string, string>;
16
+ readonly FlashMode: Record<string, string>;
17
+ isAvailableAsync?(): Promise<boolean>;
18
+ launchScanner(options?: ICameraScanningOptions): Promise<void>;
19
+ dismissScanner(): Promise<void>;
20
+ scanFromURLAsync(url: string, barcodeTypes?: ICameraBarcodeType[]): Promise<ICameraBarcodeScanningResult[]>;
21
+ getCameraPermissionsAsync(): Promise<PermissionResponse>;
22
+ requestCameraPermissionsAsync(): Promise<PermissionResponse>;
23
+ getMicrophonePermissionsAsync(): Promise<PermissionResponse>;
24
+ requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;
25
+ getAvailableVideoCodecsAsync?(): Promise<ICameraVideoCodec[]>;
26
+ addListener(eventName: string, listener: (event: ICameraScanningResult) => void): EventSubscription;
27
+ };
28
+ export declare const expoCamera: ICameraNativeModule;
@@ -0,0 +1,3 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ import { CAMERA_MODULE_NAME } from './constants.js';
3
+ export const expoCamera = requireNativeModule(CAMERA_MODULE_NAME);
@@ -0,0 +1,9 @@
1
+ import type { ICameraCapturedPicture, ICameraPictureOptions, ICameraRecordingOptions } from './types';
2
+ export declare function ensurePictureOptions(options?: ICameraPictureOptions): ICameraPictureOptions;
3
+ export declare function ensureRecordingOptions(options?: ICameraRecordingOptions): ICameraRecordingOptions;
4
+ export declare function handlePictureSaved({ nativeEvent, }: {
5
+ nativeEvent: {
6
+ data: ICameraCapturedPicture;
7
+ id: number;
8
+ };
9
+ }): void;
@@ -0,0 +1,29 @@
1
+ const MIRROR_DEPRECATED = 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.';
2
+ // The callbacks wait here for the native event that carries their picture
3
+ const pictureSavedCallbacks = new Map();
4
+ let nextPictureId = 1;
5
+ export function ensurePictureOptions(options) {
6
+ if (!options || typeof options !== 'object')
7
+ return {};
8
+ if (options.mirror)
9
+ console.warn(MIRROR_DEPRECATED);
10
+ const { onPictureSaved, ...rest } = options;
11
+ const withQuality = { ...rest, quality: options.quality ?? 1 };
12
+ if (!onPictureSaved)
13
+ return withQuality;
14
+ const id = nextPictureId++;
15
+ pictureSavedCallbacks.set(id, onPictureSaved);
16
+ return { ...withQuality, id, fastMode: true };
17
+ }
18
+ export function ensureRecordingOptions(options = {}) {
19
+ if (options.mirror)
20
+ console.warn(MIRROR_DEPRECATED);
21
+ return options;
22
+ }
23
+ export function handlePictureSaved({ nativeEvent, }) {
24
+ const callback = pictureSavedCallbacks.get(nativeEvent.id);
25
+ if (!callback)
26
+ return;
27
+ pictureSavedCallbacks.delete(nativeEvent.id);
28
+ callback(nativeEvent.data);
29
+ }
@@ -0,0 +1,2 @@
1
+ /** The native image class, `takePictureAsync({ pictureRef: true })` resolves to an instance */
2
+ export declare const PictureRef: import("./native-module").ICameraPictureRefClass;
@@ -0,0 +1,3 @@
1
+ import { expoCamera } from './native-module.js';
2
+ /** The native image class, `takePictureAsync({ pictureRef: true })` resolves to an instance */
3
+ export const PictureRef = expoCamera.Picture;
@@ -0,0 +1,4 @@
1
+ type INativeProps = Record<string, unknown>;
2
+ /** The props the native view takes, built from the friendly ones of the view */
3
+ export declare function ensureNativeProps(props: object): INativeProps;
4
+ export {};
@@ -0,0 +1,26 @@
1
+ import { expoCamera } from './native-module.js';
2
+ // Values under these keys become native options, the tables come from the native module
3
+ function conversionTableFor(key) {
4
+ if (key === 'type')
5
+ return expoCamera.Type;
6
+ if (key === 'flash')
7
+ return expoCamera.FlashMode;
8
+ return undefined;
9
+ }
10
+ function convertNativeProps(props) {
11
+ return Object.fromEntries(Object.entries(props).map(([key, value]) => {
12
+ const table = conversionTableFor(key);
13
+ return [key, typeof value === 'string' && table ? table[value] : value];
14
+ }));
15
+ }
16
+ /** The props the native view takes, built from the friendly ones of the view */
17
+ export function ensureNativeProps(props) {
18
+ const { poster: _poster, ...native } = convertNativeProps(props);
19
+ return {
20
+ ...native,
21
+ barcodeScannerEnabled: Boolean(Reflect.get(props, 'onBarcodeScanned')),
22
+ flashMode: Reflect.get(props, 'flash') ?? 'off',
23
+ mute: Reflect.get(props, 'mute') ?? false,
24
+ autoFocus: Reflect.get(props, 'autofocus') ?? 'off',
25
+ };
26
+ }
@@ -0,0 +1,170 @@
1
+ import type { IAccessibilityProps, IAriaProps, IResponderProps } from '@symbiote-native/components';
2
+ import type { IStyleProp, ISymbioteEvent, IViewStyle } from '@symbiote-native/engine';
3
+ import type { IAndroidBarcode } from './android-barcode';
4
+ export type ICameraType = 'front' | 'back';
5
+ /**
6
+ * `screen` uses the display as the flash of a front camera, on iOS it maps to `on`
7
+ * and Retina Flash fires
8
+ */
9
+ export type ICameraFlashMode = 'off' | 'on' | 'auto' | 'screen';
10
+ /** `on` focuses once and locks, `off` focuses whenever needed */
11
+ export type ICameraFocusMode = 'on' | 'off';
12
+ export type ICameraMode = 'picture' | 'video';
13
+ export type ICameraRatio = '4:3' | '16:9' | '1:1';
14
+ /** The codec of a video recording, iOS only */
15
+ export type ICameraVideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';
16
+ /** On Android all but `off` turn the stabilization on, the device picks the method */
17
+ export type ICameraVideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';
18
+ export type ICameraVideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';
19
+ export type ICameraOrientation = 'portrait' | 'portraitUpsideDown' | 'landscapeLeft' | 'landscapeRight';
20
+ export type ICameraBarcodeType = 'aztec' | 'ean13' | 'ean8' | 'qr' | 'pdf417' | 'upc_e' | 'datamatrix' | 'code39' | 'code93' | 'itf14' | 'codabar' | 'code128' | 'upc_a';
21
+ export type ICameraCapturedPicture = {
22
+ width: number;
23
+ height: number;
24
+ format: 'jpg' | 'png';
25
+ uri: string;
26
+ /** Base64 of the JPEG data, present when the `base64` option was set */
27
+ base64?: string;
28
+ /** The EXIF tags and their values, present when the `exif` option was set */
29
+ exif?: Record<string, unknown>;
30
+ };
31
+ export type ICameraPictureOptions = {
32
+ /** From `0` (small) to `1` (best), `1` by default */
33
+ quality?: number;
34
+ base64?: boolean;
35
+ exif?: boolean;
36
+ /** Extra EXIF data, takes effect with `exif` */
37
+ additionalExif?: Record<string, unknown>;
38
+ /**
39
+ * Called when the picture is saved, the promise then resolves at once with no data
40
+ * and the picture goes to this callback
41
+ */
42
+ onPictureSaved?: (picture: ICameraCapturedPicture) => void;
43
+ /** Returns the image as it came from the sensor, `quality` is discarded */
44
+ skipProcessing?: boolean;
45
+ /** @deprecated Use the `mirror` prop of the view */
46
+ mirror?: boolean;
47
+ id?: number;
48
+ fastMode?: boolean;
49
+ maxDownsampling?: number;
50
+ /** `true` by default */
51
+ shutterSound?: boolean;
52
+ /** Resolves to a reference to the native image instead of a file */
53
+ pictureRef?: boolean;
54
+ };
55
+ export type ICameraRecordingOptions = {
56
+ /** In seconds */
57
+ maxDuration?: number;
58
+ /** In bytes */
59
+ maxFileSize?: number;
60
+ /** @deprecated Use the `mirror` prop of the view */
61
+ mirror?: boolean;
62
+ /** iOS only */
63
+ codec?: ICameraVideoCodec;
64
+ };
65
+ export type ICameraAvailableLenses = {
66
+ lenses: string[];
67
+ };
68
+ export type ICameraResponsiveOrientation = {
69
+ orientation: ICameraOrientation;
70
+ };
71
+ export type ICameraMountError = {
72
+ message: string;
73
+ };
74
+ export type ICameraBarcodePoint = {
75
+ x: number;
76
+ y: number;
77
+ };
78
+ export type ICameraBarcodeBounds = {
79
+ origin: ICameraBarcodePoint;
80
+ size: {
81
+ height: number;
82
+ width: number;
83
+ };
84
+ };
85
+ export type ICameraBarcodeScanningResult = {
86
+ type: string;
87
+ /** The parsed information encoded in the barcode */
88
+ data: string;
89
+ /** The raw information, Android only */
90
+ raw?: string;
91
+ /** The order of the points differs per platform, and is empty for some types */
92
+ cornerPoints: ICameraBarcodePoint[];
93
+ bounds: ICameraBarcodeBounds;
94
+ /** Extra information of the type of barcode, Android only */
95
+ extra?: IAndroidBarcode;
96
+ };
97
+ export type ICameraScanningResult = Omit<ICameraBarcodeScanningResult, 'bounds' | 'cornerPoints'>;
98
+ export type ICameraBarcodeSettings = {
99
+ barcodeTypes: ICameraBarcodeType[];
100
+ };
101
+ /** The options of the system scanner, iOS 16+ and Google's code scanner on Android */
102
+ export type ICameraScanningOptions = {
103
+ barcodeTypes: ICameraBarcodeType[];
104
+ /** iOS only, `true` by default */
105
+ isPinchToZoomEnabled?: boolean;
106
+ /** iOS only, `true` by default */
107
+ isGuidanceEnabled?: boolean;
108
+ /** iOS only, `false` by default */
109
+ isHighlightingEnabled?: boolean;
110
+ };
111
+ export type ICameraPhotoResult = {
112
+ uri: string;
113
+ width: number;
114
+ height: number;
115
+ base64?: string;
116
+ };
117
+ export type ICameraSavePictureOptions = {
118
+ quality?: number;
119
+ metadata?: Record<string, unknown>;
120
+ base64?: boolean;
121
+ };
122
+ export type ICameraViewProps = IAccessibilityProps & IAriaProps & IResponderProps & {
123
+ /** `back` by default */
124
+ facing?: ICameraType;
125
+ /** `off` by default */
126
+ flash?: ICameraFlashMode;
127
+ /** From `0` to `1`, a share of the maximum zoom of the device */
128
+ zoom?: number;
129
+ /** `picture` by default */
130
+ mode?: ICameraMode;
131
+ /** Records video with no sound */
132
+ mute?: boolean;
133
+ /** Mirrors the image of the front camera */
134
+ mirror?: boolean;
135
+ /** iOS only, `off` by default */
136
+ autofocus?: ICameraFocusMode;
137
+ /** Stops the session while `false`, iOS only, `true` by default */
138
+ active?: boolean;
139
+ videoQuality?: ICameraVideoQuality;
140
+ /** In bits per second, on iOS needs the codec in `recordAsync` */
141
+ videoBitrate?: number;
142
+ animateShutter?: boolean;
143
+ /** Makes `ratio` ignored, the sizes come from `getAvailablePictureSizesAsync` */
144
+ pictureSize?: string;
145
+ /** iOS only, `builtInWideAngleCamera` by default */
146
+ selectedLens?: string;
147
+ enableTorch?: boolean;
148
+ /** `auto` by default */
149
+ videoStabilizationMode?: ICameraVideoStabilization;
150
+ barcodeScannerSettings?: ICameraBarcodeSettings;
151
+ /** Takes landscape pictures of a portrait-locked app when the device turns, iOS only */
152
+ responsiveOrientationWhenOrientationLocked?: boolean;
153
+ /** Android only, switches the preview from fill to fit */
154
+ ratio?: ICameraRatio;
155
+ onCameraReady?: () => void;
156
+ onMountError?: (event: ICameraMountError) => void;
157
+ onBarcodeScanned?: (result: ICameraBarcodeScanningResult) => void;
158
+ /** iOS only */
159
+ onResponsiveOrientationChanged?: (event: ICameraResponsiveOrientation) => void;
160
+ /** iOS only */
161
+ onAvailableLensesChanged?: (event: ICameraAvailableLenses) => void;
162
+ style?: IStyleProp<IViewStyle>;
163
+ testID?: string;
164
+ nativeID?: string;
165
+ onLayout?: (event: ISymbioteEvent) => void;
166
+ };
167
+ export type ICameraSupportedFeatures = {
168
+ isModernBarcodeScannerAvailable: boolean;
169
+ toggleRecordingAsyncAvailable: boolean;
170
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ReactElement, Ref } from 'react';
2
+ import type { ICameraViewHandle, ICameraViewProps } from '../core';
3
+ export type ICameraViewReactProps = ICameraViewProps & {
4
+ ref?: Ref<ICameraViewHandle>;
5
+ className?: string;
6
+ };
7
+ /** React twin of `expo-camera`'s `CameraView` */
8
+ export declare function CameraView({ ref, ...props }: ICameraViewReactProps): ReactElement | null;
@@ -0,0 +1,6 @@
1
+ import { useNativeViewController } from '@symbiote-native/react';
2
+ import { createCameraView } from '../core/index.js';
3
+ /** React twin of `expo-camera`'s `CameraView` */
4
+ export function CameraView({ ref, ...props }) {
5
+ return useNativeViewController(ref, createCameraView, props);
6
+ }
@@ -0,0 +1,5 @@
1
+ export { CameraView } from './camera-view';
2
+ export type { ICameraViewReactProps } from './camera-view';
3
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
4
+ export type { IUseCameraPermissionsHook } from './use-camera-permissions';
5
+ export * from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/camera/react: камера, съёмка, запись видео и сканирование кодов на общем ядре
2
+ export { CameraView } from './camera-view.js';
3
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions.js';
4
+ export * from '../core/index.js';
@@ -0,0 +1,9 @@
1
+ import type { IPermissionHookBehavior } from '@symbiote-native/engine';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ export type IUseCameraPermissionsHook = (options?: IPermissionHookBehavior) => [
4
+ PermissionResponse | null,
5
+ () => Promise<PermissionResponse>,
6
+ () => Promise<PermissionResponse>
7
+ ];
8
+ export declare const useCameraPermissions: IUseCameraPermissionsHook;
9
+ export declare const useMicrophonePermissions: IUseCameraPermissionsHook;
@@ -0,0 +1,5 @@
1
+ import { createPermissionHook } from '@symbiote-native/react';
2
+ import { cameraPermissionMethods, microphonePermissionMethods, } from '../core/camera-api.js';
3
+ // React twin of `expo-camera`'s permission hooks
4
+ export const useCameraPermissions = createPermissionHook(cameraPermissionMethods);
5
+ export const useMicrophonePermissions = createPermissionHook(microphonePermissionMethods);
@@ -0,0 +1,33 @@
1
+ import type { ICameraViewHandle } from '../core';
2
+ /** Solid twin of `expo-camera`'s `CameraView`, `ref` gets the handle of the view */
3
+ export declare const CameraView: (props: import("@symbiote-native/components").IAccessibilityProps & import("@symbiote-native/components").IAriaProps & import("@symbiote-native/components").IResponderProps & {
4
+ facing?: import(".").ICameraType;
5
+ flash?: import(".").ICameraFlashMode;
6
+ zoom?: number;
7
+ mode?: import(".").ICameraMode;
8
+ mute?: boolean;
9
+ mirror?: boolean;
10
+ autofocus?: import(".").ICameraFocusMode;
11
+ active?: boolean;
12
+ videoQuality?: import(".").ICameraVideoQuality;
13
+ videoBitrate?: number;
14
+ animateShutter?: boolean;
15
+ pictureSize?: string;
16
+ selectedLens?: string;
17
+ enableTorch?: boolean;
18
+ videoStabilizationMode?: import(".").ICameraVideoStabilization;
19
+ barcodeScannerSettings?: import(".").ICameraBarcodeSettings;
20
+ responsiveOrientationWhenOrientationLocked?: boolean;
21
+ ratio?: import(".").ICameraRatio;
22
+ onCameraReady?: () => void;
23
+ onMountError?: (event: import(".").ICameraMountError) => void;
24
+ onBarcodeScanned?: (result: import(".").ICameraBarcodeScanningResult) => void;
25
+ onResponsiveOrientationChanged?: (event: import(".").ICameraResponsiveOrientation) => void;
26
+ onAvailableLensesChanged?: (event: import(".").ICameraAvailableLenses) => void;
27
+ style?: import("@symbiote-native/engine").IStyleProp<import("@symbiote-native/engine").IViewStyle>;
28
+ testID?: string;
29
+ nativeID?: string;
30
+ onLayout?: (event: import("@symbiote-native/engine").ISymbioteEvent) => void;
31
+ } & {
32
+ ref?: ((handle: ICameraViewHandle) => void) | undefined;
33
+ }) => import("@symbiote-native/engine").ISymbioteNode | null;
@@ -0,0 +1,4 @@
1
+ import { defineNativeViewComponent } from '@symbiote-native/solid';
2
+ import { createCameraView } from '../core/index.js';
3
+ /** Solid twin of `expo-camera`'s `CameraView`, `ref` gets the handle of the view */
4
+ export const CameraView = defineNativeViewComponent(createCameraView);
@@ -0,0 +1,4 @@
1
+ export { CameraView } from './camera-view';
2
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
3
+ export type { IUseCameraPermissionsHook } from './use-camera-permissions';
4
+ export * from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/camera/solid: камера, съёмка, запись видео и сканирование кодов на общем ядре
2
+ export { CameraView } from './camera-view.js';
3
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions.js';
4
+ export * from '../core/index.js';
@@ -0,0 +1,10 @@
1
+ import type { IPermissionHookBehavior } from '@symbiote-native/engine';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ import type { Accessor } from 'solid-js';
4
+ export type IUseCameraPermissionsHook = (options?: IPermissionHookBehavior) => [
5
+ Accessor<PermissionResponse | null>,
6
+ () => Promise<PermissionResponse>,
7
+ () => Promise<PermissionResponse>
8
+ ];
9
+ export declare const useCameraPermissions: IUseCameraPermissionsHook;
10
+ export declare const useMicrophonePermissions: IUseCameraPermissionsHook;
@@ -0,0 +1,5 @@
1
+ import { createPermissionHook } from '@symbiote-native/solid';
2
+ import { cameraPermissionMethods, microphonePermissionMethods, } from '../core/camera-api.js';
3
+ // Solid twin of `../react`'s camera permission hooks
4
+ export const useCameraPermissions = createPermissionHook(cameraPermissionMethods);
5
+ export const useMicrophonePermissions = createPermissionHook(microphonePermissionMethods);
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ // The native view name is mixed-case, which a literal tag would parse as a component reference,
3
+ // so the tag is dynamic
4
+ import { hostProps } from '@symbiote-native/svelte/native-view-bridge';
5
+ import { useNativeViewController } from '@symbiote-native/svelte/runes/use-native-view-controller';
6
+ import { createCameraView } from '../core';
7
+ import type { ICameraViewProps } from '../core';
8
+
9
+ const props: ICameraViewProps = $props();
10
+ const view = useNativeViewController(createCameraView, () => ({ ...props }));
11
+
12
+ // The functions of the view are instance members, `bind:this` reaches them
13
+ export const takePictureAsync = view.handle.takePictureAsync;
14
+ export const recordAsync = view.handle.recordAsync;
15
+ export const toggleRecordingAsync = view.handle.toggleRecordingAsync;
16
+ export const stopRecording = view.handle.stopRecording;
17
+ export const pausePreview = view.handle.pausePreview;
18
+ export const resumePreview = view.handle.resumePreview;
19
+ export const getAvailablePictureSizesAsync =
20
+ view.handle.getAvailablePictureSizesAsync;
21
+ export const getAvailableLensesAsync = view.handle.getAvailableLensesAsync;
22
+ export const getSupportedFeatures = view.handle.getSupportedFeatures;
23
+ export const getHostNode = view.handle.getHostNode;
24
+ </script>
25
+
26
+ {#if view.descriptor}
27
+ <svelte:element
28
+ this={view.descriptor.type}
29
+ {@attach view.attachHost}
30
+ {@attach hostProps(view.descriptor.props)}
31
+ />
32
+ {/if}
@@ -0,0 +1,22 @@
1
+ import type { ICameraViewProps } from '../core';
2
+ declare const CameraView: import("svelte").Component<ICameraViewProps, {
3
+ takePictureAsync: {
4
+ (options: import(".").ICameraPictureOptions & {
5
+ pictureRef: true;
6
+ }): Promise<import(".").ICameraPictureRef | undefined>;
7
+ (options?: import(".").ICameraPictureOptions): Promise<import(".").ICameraCapturedPicture | undefined>;
8
+ };
9
+ recordAsync: (options?: import(".").ICameraRecordingOptions) => Promise<{
10
+ uri: string;
11
+ } | undefined>;
12
+ toggleRecordingAsync: () => Promise<void>;
13
+ stopRecording: () => void;
14
+ pausePreview: () => Promise<void>;
15
+ resumePreview: () => Promise<void>;
16
+ getAvailablePictureSizesAsync: () => Promise<string[]>;
17
+ getAvailableLensesAsync: () => Promise<string[]>;
18
+ getSupportedFeatures: () => import(".").ICameraSupportedFeatures;
19
+ getHostNode: () => import("@symbiote-native/engine").ISymbioteNode | null;
20
+ }, "">;
21
+ type CameraView = ReturnType<typeof CameraView>;
22
+ export default CameraView;
@@ -0,0 +1,4 @@
1
+ export { default as CameraView } from './camera-view.svelte';
2
+ export { useCameraPermissions, useMicrophonePermissions, } from './use-camera-permissions.svelte';
3
+ export type { IUseCameraPermissionsHook } from './use-camera-permissions.svelte';
4
+ export * from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/camera/svelte: камера, съёмка, запись видео и сканирование кодов на общем ядре
2
+ export { default as CameraView } from './camera-view.svelte';
3
+ export { useCameraPermissions, useMicrophonePermissions, } from './use-camera-permissions.svelte';
4
+ export * from '../core/index.js';
@@ -0,0 +1,9 @@
1
+ import type { IPermissionHookBehavior } from '@symbiote-native/engine';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ export type IUseCameraPermissionsHook = (options?: IPermissionHookBehavior) => {
4
+ readonly status: PermissionResponse | null;
5
+ requestPermission: () => Promise<PermissionResponse>;
6
+ getPermission: () => Promise<PermissionResponse>;
7
+ };
8
+ export declare const useCameraPermissions: IUseCameraPermissionsHook;
9
+ export declare const useMicrophonePermissions: IUseCameraPermissionsHook;
@@ -0,0 +1,5 @@
1
+ import { createPermissionHook } from '@symbiote-native/svelte/runes/create-permission-hook';
2
+ import { cameraPermissionMethods, microphonePermissionMethods, } from '../core/camera-api.js';
3
+ // Svelte twin of `../react`'s camera permission hooks
4
+ export const useCameraPermissions = createPermissionHook(cameraPermissionMethods);
5
+ export const useMicrophonePermissions = createPermissionHook(microphonePermissionMethods);
@@ -0,0 +1,2 @@
1
+ /** Vue twin of `expo-camera`'s `CameraView` */
2
+ export declare const CameraView: import("vue").DefineComponent<{}, () => import("vue").VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,4 @@
1
+ import { defineNativeViewComponent } from '@symbiote-native/vue';
2
+ import { createCameraView } from '../core/index.js';
3
+ /** Vue twin of `expo-camera`'s `CameraView` */
4
+ export const CameraView = defineNativeViewComponent('CameraView', createCameraView);
@@ -0,0 +1,4 @@
1
+ export { CameraView } from './camera-view';
2
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
3
+ export type { IUseCameraPermissionsHook } from './use-camera-permissions';
4
+ export * from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/camera/vue: камера, съёмка, запись видео и сканирование кодов на общем ядре
2
+ export { CameraView } from './camera-view.js';
3
+ export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions.js';
4
+ export * from '../core/index.js';
@@ -0,0 +1,10 @@
1
+ import type { IPermissionHookBehavior } from '@symbiote-native/engine';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ import type { Ref } from '@vue/runtime-core';
4
+ export type IUseCameraPermissionsHook = (options?: IPermissionHookBehavior) => [
5
+ Ref<PermissionResponse | null>,
6
+ () => Promise<PermissionResponse>,
7
+ () => Promise<PermissionResponse>
8
+ ];
9
+ export declare const useCameraPermissions: IUseCameraPermissionsHook;
10
+ export declare const useMicrophonePermissions: IUseCameraPermissionsHook;
@@ -0,0 +1,5 @@
1
+ import { createPermissionHook } from '@symbiote-native/vue';
2
+ import { cameraPermissionMethods, microphonePermissionMethods, } from '../core/camera-api.js';
3
+ // Vue twin of `../react`'s camera permission hooks
4
+ export const useCameraPermissions = createPermissionHook(cameraPermissionMethods);
5
+ export const useMicrophonePermissions = createPermissionHook(microphonePermissionMethods);