@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.
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/build/angular/camera-view/index.d.ts +43 -0
- package/build/angular/camera-view/index.js +101 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +4 -0
- package/build/angular/services/camera-permissions.service.d.ts +8 -0
- package/build/angular/services/camera-permissions.service.js +82 -0
- package/build/core/android-barcode.d.ts +50 -0
- package/build/core/android-barcode.js +2 -0
- package/build/core/camera-api.d.ts +35 -0
- package/build/core/camera-api.js +68 -0
- package/build/core/camera-view-events.d.ts +3 -0
- package/build/core/camera-view-events.js +60 -0
- package/build/core/camera-view-handle.d.ts +26 -0
- package/build/core/camera-view-handle.js +40 -0
- package/build/core/camera-view.d.ts +12 -0
- package/build/core/camera-view.js +38 -0
- package/build/core/constants.d.ts +6 -0
- package/build/core/constants.js +7 -0
- package/build/core/index.d.ts +9 -0
- package/build/core/index.js +5 -0
- package/build/core/native-module.d.ts +28 -0
- package/build/core/native-module.js +3 -0
- package/build/core/picture-options.d.ts +9 -0
- package/build/core/picture-options.js +29 -0
- package/build/core/picture-ref.d.ts +2 -0
- package/build/core/picture-ref.js +3 -0
- package/build/core/props.d.ts +4 -0
- package/build/core/props.js +26 -0
- package/build/core/types.d.ts +170 -0
- package/build/core/types.js +1 -0
- package/build/react/camera-view.d.ts +8 -0
- package/build/react/camera-view.js +6 -0
- package/build/react/index.d.ts +5 -0
- package/build/react/index.js +4 -0
- package/build/react/use-camera-permissions.d.ts +9 -0
- package/build/react/use-camera-permissions.js +5 -0
- package/build/solid/camera-view.d.ts +33 -0
- package/build/solid/camera-view.js +4 -0
- package/build/solid/index.d.ts +4 -0
- package/build/solid/index.js +4 -0
- package/build/solid/use-camera-permissions.d.ts +10 -0
- package/build/solid/use-camera-permissions.js +5 -0
- package/build/svelte/camera-view.svelte +32 -0
- package/build/svelte/camera-view.svelte.d.ts +22 -0
- package/build/svelte/index.d.ts +4 -0
- package/build/svelte/index.js +4 -0
- package/build/svelte/use-camera-permissions.svelte.d.ts +9 -0
- package/build/svelte/use-camera-permissions.svelte.js +5 -0
- package/build/vue/camera-view.d.ts +2 -0
- package/build/vue/camera-view.js +4 -0
- package/build/vue/index.d.ts +4 -0
- package/build/vue/index.js +4 -0
- package/build/vue/use-camera-permissions.d.ts +10 -0
- package/build/vue/use-camera-permissions.js +5 -0
- package/build-ngc/angular/camera-view/index.d.ts +46 -0
- package/build-ngc/angular/camera-view/index.js +60 -0
- package/build-ngc/angular/camera-view/index.js.map +1 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/camera-permissions.service.d.ts +13 -0
- package/build-ngc/angular/services/camera-permissions.service.js +28 -0
- package/build-ngc/angular/services/camera-permissions.service.js.map +1 -0
- package/build-ngc/core/android-barcode.d.ts +50 -0
- package/build-ngc/core/android-barcode.js +3 -0
- package/build-ngc/core/android-barcode.js.map +1 -0
- package/build-ngc/core/camera-api.d.ts +35 -0
- package/build-ngc/core/camera-api.js +69 -0
- package/build-ngc/core/camera-api.js.map +1 -0
- package/build-ngc/core/camera-view-events.d.ts +3 -0
- package/build-ngc/core/camera-view-events.js +61 -0
- package/build-ngc/core/camera-view-events.js.map +1 -0
- package/build-ngc/core/camera-view-handle.d.ts +26 -0
- package/build-ngc/core/camera-view-handle.js +41 -0
- package/build-ngc/core/camera-view-handle.js.map +1 -0
- package/build-ngc/core/camera-view.d.ts +12 -0
- package/build-ngc/core/camera-view.js +39 -0
- package/build-ngc/core/camera-view.js.map +1 -0
- package/build-ngc/core/constants.d.ts +6 -0
- package/build-ngc/core/constants.js +8 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/index.d.ts +9 -0
- package/build-ngc/core/index.js +6 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +28 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/picture-options.d.ts +9 -0
- package/build-ngc/core/picture-options.js +30 -0
- package/build-ngc/core/picture-options.js.map +1 -0
- package/build-ngc/core/picture-ref.d.ts +2 -0
- package/build-ngc/core/picture-ref.js +4 -0
- package/build-ngc/core/picture-ref.js.map +1 -0
- package/build-ngc/core/props.d.ts +4 -0
- package/build-ngc/core/props.js +27 -0
- package/build-ngc/core/props.js.map +1 -0
- package/build-ngc/core/types.d.ts +170 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +22 -0
- package/package.json +144 -3
- package/src/angular/camera-view/index.ts +95 -0
- package/src/angular/index.ts +8 -0
- package/src/angular/services/camera-permissions.service.ts +28 -0
- package/src/core/android-barcode.ts +48 -0
- package/src/core/camera-api.ts +99 -0
- package/src/core/camera-view-events.ts +103 -0
- package/src/core/camera-view-handle.ts +93 -0
- package/src/core/camera-view.ts +56 -0
- package/src/core/constants.ts +11 -0
- package/src/core/index.ts +57 -0
- package/src/core/native-module.ts +57 -0
- package/src/core/picture-options.ts +46 -0
- package/src/core/picture-ref.ts +4 -0
- package/src/core/props.ts +31 -0
- package/src/core/types.ts +223 -0
- package/src/react/camera-view.ts +17 -0
- package/src/react/index.ts +7 -0
- package/src/react/use-camera-permissions.ts +21 -0
- package/src/solid/camera-view.ts +9 -0
- package/src/solid/index.ts +6 -0
- package/src/solid/use-camera-permissions.ts +22 -0
- package/src/svelte/camera-view.svelte +32 -0
- package/src/svelte/index.ts +9 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/svelte/use-camera-permissions.svelte.ts +21 -0
- package/src/vue/camera-view.ts +5 -0
- package/src/vue/index.ts +6 -0
- package/src/vue/use-camera-permissions.ts +22 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAccessibilityProps,
|
|
3
|
+
IAriaProps,
|
|
4
|
+
IResponderProps,
|
|
5
|
+
} from '@symbiote-native/components';
|
|
6
|
+
import type {
|
|
7
|
+
IStyleProp,
|
|
8
|
+
ISymbioteEvent,
|
|
9
|
+
IViewStyle,
|
|
10
|
+
} from '@symbiote-native/engine';
|
|
11
|
+
import type { IAndroidBarcode } from './android-barcode';
|
|
12
|
+
|
|
13
|
+
export type ICameraType = 'front' | 'back';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `screen` uses the display as the flash of a front camera, on iOS it maps to `on`
|
|
17
|
+
* and Retina Flash fires
|
|
18
|
+
*/
|
|
19
|
+
export type ICameraFlashMode = 'off' | 'on' | 'auto' | 'screen';
|
|
20
|
+
|
|
21
|
+
/** `on` focuses once and locks, `off` focuses whenever needed */
|
|
22
|
+
export type ICameraFocusMode = 'on' | 'off';
|
|
23
|
+
|
|
24
|
+
export type ICameraMode = 'picture' | 'video';
|
|
25
|
+
|
|
26
|
+
export type ICameraRatio = '4:3' | '16:9' | '1:1';
|
|
27
|
+
|
|
28
|
+
/** The codec of a video recording, iOS only */
|
|
29
|
+
export type ICameraVideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';
|
|
30
|
+
|
|
31
|
+
/** On Android all but `off` turn the stabilization on, the device picks the method */
|
|
32
|
+
export type ICameraVideoStabilization =
|
|
33
|
+
| 'off'
|
|
34
|
+
| 'standard'
|
|
35
|
+
| 'cinematic'
|
|
36
|
+
| 'auto';
|
|
37
|
+
|
|
38
|
+
export type ICameraVideoQuality =
|
|
39
|
+
| '2160p'
|
|
40
|
+
| '1080p'
|
|
41
|
+
| '720p'
|
|
42
|
+
| '480p'
|
|
43
|
+
| '4:3';
|
|
44
|
+
|
|
45
|
+
export type ICameraOrientation =
|
|
46
|
+
| 'portrait'
|
|
47
|
+
| 'portraitUpsideDown'
|
|
48
|
+
| 'landscapeLeft'
|
|
49
|
+
| 'landscapeRight';
|
|
50
|
+
|
|
51
|
+
export type ICameraBarcodeType =
|
|
52
|
+
| 'aztec'
|
|
53
|
+
| 'ean13'
|
|
54
|
+
| 'ean8'
|
|
55
|
+
| 'qr'
|
|
56
|
+
| 'pdf417'
|
|
57
|
+
| 'upc_e'
|
|
58
|
+
| 'datamatrix'
|
|
59
|
+
| 'code39'
|
|
60
|
+
| 'code93'
|
|
61
|
+
| 'itf14'
|
|
62
|
+
| 'codabar'
|
|
63
|
+
| 'code128'
|
|
64
|
+
| 'upc_a';
|
|
65
|
+
|
|
66
|
+
export type ICameraCapturedPicture = {
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
format: 'jpg' | 'png';
|
|
70
|
+
uri: string;
|
|
71
|
+
/** Base64 of the JPEG data, present when the `base64` option was set */
|
|
72
|
+
base64?: string;
|
|
73
|
+
/** The EXIF tags and their values, present when the `exif` option was set */
|
|
74
|
+
exif?: Record<string, unknown>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type ICameraPictureOptions = {
|
|
78
|
+
/** From `0` (small) to `1` (best), `1` by default */
|
|
79
|
+
quality?: number;
|
|
80
|
+
base64?: boolean;
|
|
81
|
+
exif?: boolean;
|
|
82
|
+
/** Extra EXIF data, takes effect with `exif` */
|
|
83
|
+
additionalExif?: Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the picture is saved, the promise then resolves at once with no data
|
|
86
|
+
* and the picture goes to this callback
|
|
87
|
+
*/
|
|
88
|
+
onPictureSaved?: (picture: ICameraCapturedPicture) => void;
|
|
89
|
+
/** Returns the image as it came from the sensor, `quality` is discarded */
|
|
90
|
+
skipProcessing?: boolean;
|
|
91
|
+
/** @deprecated Use the `mirror` prop of the view */
|
|
92
|
+
mirror?: boolean;
|
|
93
|
+
id?: number;
|
|
94
|
+
fastMode?: boolean;
|
|
95
|
+
maxDownsampling?: number;
|
|
96
|
+
/** `true` by default */
|
|
97
|
+
shutterSound?: boolean;
|
|
98
|
+
/** Resolves to a reference to the native image instead of a file */
|
|
99
|
+
pictureRef?: boolean;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type ICameraRecordingOptions = {
|
|
103
|
+
/** In seconds */
|
|
104
|
+
maxDuration?: number;
|
|
105
|
+
/** In bytes */
|
|
106
|
+
maxFileSize?: number;
|
|
107
|
+
/** @deprecated Use the `mirror` prop of the view */
|
|
108
|
+
mirror?: boolean;
|
|
109
|
+
/** iOS only */
|
|
110
|
+
codec?: ICameraVideoCodec;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type ICameraAvailableLenses = { lenses: string[] };
|
|
114
|
+
|
|
115
|
+
export type ICameraResponsiveOrientation = { orientation: ICameraOrientation };
|
|
116
|
+
|
|
117
|
+
export type ICameraMountError = { message: string };
|
|
118
|
+
|
|
119
|
+
export type ICameraBarcodePoint = { x: number; y: number };
|
|
120
|
+
|
|
121
|
+
export type ICameraBarcodeBounds = {
|
|
122
|
+
origin: ICameraBarcodePoint;
|
|
123
|
+
size: { height: number; width: number };
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type ICameraBarcodeScanningResult = {
|
|
127
|
+
type: string;
|
|
128
|
+
/** The parsed information encoded in the barcode */
|
|
129
|
+
data: string;
|
|
130
|
+
/** The raw information, Android only */
|
|
131
|
+
raw?: string;
|
|
132
|
+
/** The order of the points differs per platform, and is empty for some types */
|
|
133
|
+
cornerPoints: ICameraBarcodePoint[];
|
|
134
|
+
bounds: ICameraBarcodeBounds;
|
|
135
|
+
/** Extra information of the type of barcode, Android only */
|
|
136
|
+
extra?: IAndroidBarcode;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type ICameraScanningResult = Omit<
|
|
140
|
+
ICameraBarcodeScanningResult,
|
|
141
|
+
'bounds' | 'cornerPoints'
|
|
142
|
+
>;
|
|
143
|
+
|
|
144
|
+
export type ICameraBarcodeSettings = { barcodeTypes: ICameraBarcodeType[] };
|
|
145
|
+
|
|
146
|
+
/** The options of the system scanner, iOS 16+ and Google's code scanner on Android */
|
|
147
|
+
export type ICameraScanningOptions = {
|
|
148
|
+
barcodeTypes: ICameraBarcodeType[];
|
|
149
|
+
/** iOS only, `true` by default */
|
|
150
|
+
isPinchToZoomEnabled?: boolean;
|
|
151
|
+
/** iOS only, `true` by default */
|
|
152
|
+
isGuidanceEnabled?: boolean;
|
|
153
|
+
/** iOS only, `false` by default */
|
|
154
|
+
isHighlightingEnabled?: boolean;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export type ICameraPhotoResult = {
|
|
158
|
+
uri: string;
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
base64?: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type ICameraSavePictureOptions = {
|
|
165
|
+
quality?: number;
|
|
166
|
+
metadata?: Record<string, unknown>;
|
|
167
|
+
base64?: boolean;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type ICameraViewProps = IAccessibilityProps &
|
|
171
|
+
IAriaProps &
|
|
172
|
+
IResponderProps & {
|
|
173
|
+
/** `back` by default */
|
|
174
|
+
facing?: ICameraType;
|
|
175
|
+
/** `off` by default */
|
|
176
|
+
flash?: ICameraFlashMode;
|
|
177
|
+
/** From `0` to `1`, a share of the maximum zoom of the device */
|
|
178
|
+
zoom?: number;
|
|
179
|
+
/** `picture` by default */
|
|
180
|
+
mode?: ICameraMode;
|
|
181
|
+
/** Records video with no sound */
|
|
182
|
+
mute?: boolean;
|
|
183
|
+
/** Mirrors the image of the front camera */
|
|
184
|
+
mirror?: boolean;
|
|
185
|
+
/** iOS only, `off` by default */
|
|
186
|
+
autofocus?: ICameraFocusMode;
|
|
187
|
+
/** Stops the session while `false`, iOS only, `true` by default */
|
|
188
|
+
active?: boolean;
|
|
189
|
+
videoQuality?: ICameraVideoQuality;
|
|
190
|
+
/** In bits per second, on iOS needs the codec in `recordAsync` */
|
|
191
|
+
videoBitrate?: number;
|
|
192
|
+
animateShutter?: boolean;
|
|
193
|
+
/** Makes `ratio` ignored, the sizes come from `getAvailablePictureSizesAsync` */
|
|
194
|
+
pictureSize?: string;
|
|
195
|
+
/** iOS only, `builtInWideAngleCamera` by default */
|
|
196
|
+
selectedLens?: string;
|
|
197
|
+
enableTorch?: boolean;
|
|
198
|
+
/** `auto` by default */
|
|
199
|
+
videoStabilizationMode?: ICameraVideoStabilization;
|
|
200
|
+
barcodeScannerSettings?: ICameraBarcodeSettings;
|
|
201
|
+
/** Takes landscape pictures of a portrait-locked app when the device turns, iOS only */
|
|
202
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
203
|
+
/** Android only, switches the preview from fill to fit */
|
|
204
|
+
ratio?: ICameraRatio;
|
|
205
|
+
onCameraReady?: () => void;
|
|
206
|
+
onMountError?: (event: ICameraMountError) => void;
|
|
207
|
+
onBarcodeScanned?: (result: ICameraBarcodeScanningResult) => void;
|
|
208
|
+
/** iOS only */
|
|
209
|
+
onResponsiveOrientationChanged?: (
|
|
210
|
+
event: ICameraResponsiveOrientation,
|
|
211
|
+
) => void;
|
|
212
|
+
/** iOS only */
|
|
213
|
+
onAvailableLensesChanged?: (event: ICameraAvailableLenses) => void;
|
|
214
|
+
style?: IStyleProp<IViewStyle>;
|
|
215
|
+
testID?: string;
|
|
216
|
+
nativeID?: string;
|
|
217
|
+
onLayout?: (event: ISymbioteEvent) => void;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export type ICameraSupportedFeatures = {
|
|
221
|
+
isModernBarcodeScannerAvailable: boolean;
|
|
222
|
+
toggleRecordingAsyncAvailable: boolean;
|
|
223
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
|
+
import { useNativeViewController } from '@symbiote-native/react';
|
|
3
|
+
import { createCameraView } from '../core';
|
|
4
|
+
import type { ICameraViewHandle, ICameraViewProps } from '../core';
|
|
5
|
+
|
|
6
|
+
export type ICameraViewReactProps = ICameraViewProps & {
|
|
7
|
+
ref?: Ref<ICameraViewHandle>;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** React twin of `expo-camera`'s `CameraView` */
|
|
12
|
+
export function CameraView({
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}: ICameraViewReactProps): ReactElement | null {
|
|
16
|
+
return useNativeViewController(ref, createCameraView, props);
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @symbiote-native/camera/react: камера, съёмка, запись видео и сканирование кодов на общем ядре
|
|
2
|
+
|
|
3
|
+
export { CameraView } from './camera-view';
|
|
4
|
+
export type { ICameraViewReactProps } from './camera-view';
|
|
5
|
+
export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
|
|
6
|
+
export type { IUseCameraPermissionsHook } from './use-camera-permissions';
|
|
7
|
+
export * from '../core';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/react';
|
|
2
|
+
import {
|
|
3
|
+
cameraPermissionMethods,
|
|
4
|
+
microphonePermissionMethods,
|
|
5
|
+
} from '../core/camera-api';
|
|
6
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
|
|
9
|
+
export type IUseCameraPermissionsHook = (
|
|
10
|
+
options?: IPermissionHookBehavior,
|
|
11
|
+
) => [
|
|
12
|
+
PermissionResponse | null,
|
|
13
|
+
() => Promise<PermissionResponse>,
|
|
14
|
+
() => Promise<PermissionResponse>,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
// React twin of `expo-camera`'s permission hooks
|
|
18
|
+
export const useCameraPermissions: IUseCameraPermissionsHook =
|
|
19
|
+
createPermissionHook(cameraPermissionMethods);
|
|
20
|
+
export const useMicrophonePermissions: IUseCameraPermissionsHook =
|
|
21
|
+
createPermissionHook(microphonePermissionMethods);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineNativeViewComponent } from '@symbiote-native/solid';
|
|
2
|
+
import { createCameraView } from '../core';
|
|
3
|
+
import type { ICameraViewHandle, ICameraViewProps } from '../core';
|
|
4
|
+
|
|
5
|
+
/** Solid twin of `expo-camera`'s `CameraView`, `ref` gets the handle of the view */
|
|
6
|
+
export const CameraView = defineNativeViewComponent<
|
|
7
|
+
ICameraViewHandle,
|
|
8
|
+
ICameraViewProps
|
|
9
|
+
>(createCameraView);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @symbiote-native/camera/solid: камера, съёмка, запись видео и сканирование кодов на общем ядре
|
|
2
|
+
|
|
3
|
+
export { CameraView } from './camera-view';
|
|
4
|
+
export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
|
|
5
|
+
export type { IUseCameraPermissionsHook } from './use-camera-permissions';
|
|
6
|
+
export * from '../core';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/solid';
|
|
2
|
+
import {
|
|
3
|
+
cameraPermissionMethods,
|
|
4
|
+
microphonePermissionMethods,
|
|
5
|
+
} from '../core/camera-api';
|
|
6
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { Accessor } from 'solid-js';
|
|
9
|
+
|
|
10
|
+
export type IUseCameraPermissionsHook = (
|
|
11
|
+
options?: IPermissionHookBehavior,
|
|
12
|
+
) => [
|
|
13
|
+
Accessor<PermissionResponse | null>,
|
|
14
|
+
() => Promise<PermissionResponse>,
|
|
15
|
+
() => Promise<PermissionResponse>,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// Solid twin of `../react`'s camera permission hooks
|
|
19
|
+
export const useCameraPermissions: IUseCameraPermissionsHook =
|
|
20
|
+
createPermissionHook(cameraPermissionMethods);
|
|
21
|
+
export const useMicrophonePermissions: IUseCameraPermissionsHook =
|
|
22
|
+
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,9 @@
|
|
|
1
|
+
// @symbiote-native/camera/svelte: камера, съёмка, запись видео и сканирование кодов на общем ядре
|
|
2
|
+
|
|
3
|
+
export { default as CameraView } from './camera-view.svelte';
|
|
4
|
+
export {
|
|
5
|
+
useCameraPermissions,
|
|
6
|
+
useMicrophonePermissions,
|
|
7
|
+
} from './use-camera-permissions.svelte';
|
|
8
|
+
export type { IUseCameraPermissionsHook } from './use-camera-permissions.svelte';
|
|
9
|
+
export * from '../core';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/svelte/runes/create-permission-hook';
|
|
2
|
+
import {
|
|
3
|
+
cameraPermissionMethods,
|
|
4
|
+
microphonePermissionMethods,
|
|
5
|
+
} from '../core/camera-api';
|
|
6
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
|
|
9
|
+
export type IUseCameraPermissionsHook = (
|
|
10
|
+
options?: IPermissionHookBehavior,
|
|
11
|
+
) => {
|
|
12
|
+
readonly status: PermissionResponse | null;
|
|
13
|
+
requestPermission: () => Promise<PermissionResponse>;
|
|
14
|
+
getPermission: () => Promise<PermissionResponse>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Svelte twin of `../react`'s camera permission hooks
|
|
18
|
+
export const useCameraPermissions: IUseCameraPermissionsHook =
|
|
19
|
+
createPermissionHook(cameraPermissionMethods);
|
|
20
|
+
export const useMicrophonePermissions: IUseCameraPermissionsHook =
|
|
21
|
+
createPermissionHook(microphonePermissionMethods);
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @symbiote-native/camera/vue: камера, съёмка, запись видео и сканирование кодов на общем ядре
|
|
2
|
+
|
|
3
|
+
export { CameraView } from './camera-view';
|
|
4
|
+
export { useCameraPermissions, useMicrophonePermissions } from './use-camera-permissions';
|
|
5
|
+
export type { IUseCameraPermissionsHook } from './use-camera-permissions';
|
|
6
|
+
export * from '../core';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/vue';
|
|
2
|
+
import {
|
|
3
|
+
cameraPermissionMethods,
|
|
4
|
+
microphonePermissionMethods,
|
|
5
|
+
} from '../core/camera-api';
|
|
6
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { Ref } from '@vue/runtime-core';
|
|
9
|
+
|
|
10
|
+
export type IUseCameraPermissionsHook = (
|
|
11
|
+
options?: IPermissionHookBehavior,
|
|
12
|
+
) => [
|
|
13
|
+
Ref<PermissionResponse | null>,
|
|
14
|
+
() => Promise<PermissionResponse>,
|
|
15
|
+
() => Promise<PermissionResponse>,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// Vue twin of `../react`'s camera permission hooks
|
|
19
|
+
export const useCameraPermissions: IUseCameraPermissionsHook =
|
|
20
|
+
createPermissionHook(cameraPermissionMethods);
|
|
21
|
+
export const useMicrophonePermissions: IUseCameraPermissionsHook =
|
|
22
|
+
createPermissionHook(microphonePermissionMethods);
|