@octane-xplat/camera 0.19.0 → 0.20.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/README.md +2 -132
- package/package.json +20 -25
- package/platforms/android/java/com/octanexplat/camera/CameraPreviewView.java +24 -0
- package/platforms/android/java/com/octanexplat/camera/CameraSessionBridge.java +153 -21
- package/platforms/ios/src/XplatSwitchingMovieWriter.swift +557 -0
- package/src/CameraView.android.tsrx +187 -154
- package/src/CameraView.ios.tsrx +124 -110
- package/src/CameraView.macos.tsrx +103 -96
- package/src/CameraView.tsrx +2 -0
- package/src/CameraView.web.tsrx +157 -146
- package/src/CameraView.windows.tsrx +134 -125
- package/src/camera-host.macos.ts +1059 -0
- package/src/camera-permission.mobile.ts +85 -81
- package/src/camera-permission.windows.ts +56 -53
- package/src/camera-session.ios.ts +89 -61
- package/src/camera-session.macos.ts +51 -49
- package/src/camera-session.windows.ts +113 -105
- package/src/host-movie.web.ts +257 -231
- package/src/index.ts +28 -26
- package/src/index.web.ts +27 -25
- package/src/layout-child.ts +86 -79
- package/src/layout-child.web.ts +54 -53
- package/src/layout-child.windows.ts +80 -74
- package/src/movie-metadata.web.ts +84 -81
- package/src/movie-storage.web.ts +142 -135
- package/src/movie-writer.ios.ts +170 -0
- package/src/photo-lifecycle.macos.ts +60 -0
- package/src/photo-sheet.macos.ts +505 -0
- package/src/preview-display.ios.ts +69 -0
- package/src/preview-pinch.ts +41 -0
- package/src/preview-tap.ts +22 -21
- package/src/props.ts +115 -93
- package/src/recording-haptics.ios.ts +39 -0
- package/src/recording-source.web.ts +159 -0
- package/src/session-backend.android.ts +552 -410
- package/src/session-backend.ios.ts +1500 -1148
- package/src/session-backend.linux.ts +886 -860
- package/src/session-backend.macos.ts +697 -679
- package/src/session-backend.ts +51 -49
- package/src/session-backend.web.ts +1181 -867
- package/src/session-backend.windows.ts +1540 -1467
- package/src/session-core.ts +925 -714
- package/src/session.ts +12 -12
- package/src/style-merge.ts +40 -37
- package/src/synthetic-session.ts +391 -339
- package/src/types.ts +372 -298
- package/types/generated/.tsrx-typegen-manifest.json +4 -24
- package/types/generated/CameraView.d.ts +2 -0
- package/types/generated/camera-host.macos.d.ts +33 -0
- package/types/generated/index.d.ts +27 -26
- package/types/generated/photo-lifecycle.macos.d.ts +12 -0
- package/types/generated/photo-sheet.macos.d.ts +36 -0
- package/types/generated/props.d.ts +24 -2
- package/types/generated/session-core.d.ts +30 -1
- package/types/generated/synthetic-session.d.ts +7 -0
- package/types/generated/types.d.ts +75 -1
- package/platforms/macos/src/CameraOwnership.swift +0 -22
- package/platforms/macos/src/PhotoCaptureLifecycle.swift +0 -34
- package/platforms/macos/src/XplatCameraHost.swift +0 -639
- package/platforms/macos/src/XplatPhotoCaptureSheet.swift +0 -192
- package/types/generated/CameraView.android.d.ts +0 -9
- package/types/generated/CameraView.ios.d.ts +0 -5
- package/types/generated/CameraView.macos.d.ts +0 -5
- package/types/generated/CameraView.mobile.d.ts +0 -5
- package/types/generated/CameraView.windows.d.ts +0 -11
- package/types/generated/camera-permission.mobile.d.ts +0 -2
- package/types/generated/camera-permission.windows.d.ts +0 -6
- package/types/generated/camera-session.ios.d.ts +0 -2
- package/types/generated/camera-session.macos.d.ts +0 -10
- package/types/generated/camera-session.windows.d.ts +0 -9
- package/types/generated/host-movie.web.d.ts +0 -100
- package/types/generated/index.web.d.ts +0 -7
- package/types/generated/layout-child.d.ts +0 -11
- package/types/generated/layout-child.windows.d.ts +0 -13
- package/types/generated/movie-metadata.web.d.ts +0 -9
- package/types/generated/movie-storage.web.d.ts +0 -5
- package/types/generated/preview-tap.d.ts +0 -7
- package/types/generated/session-backend.android.d.ts +0 -3
- package/types/generated/session-backend.ios.d.ts +0 -5
- package/types/generated/session-backend.linux.d.ts +0 -3
- package/types/generated/session-backend.macos.d.ts +0 -8
- package/types/generated/session-backend.web.d.ts +0 -3
- package/types/generated/session-backend.windows.d.ts +0 -37
- package/types/generated/style-merge.d.ts +0 -8
package/src/session.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { CameraSession, CameraSessionConfig } from './types'
|
|
|
13
13
|
* Recording support is delivered per platform; `capabilities()` reports
|
|
14
14
|
* honest `supported`/`available` state on every host. */
|
|
15
15
|
export function createCameraSession(config: CameraSessionConfig = {}): CameraSession {
|
|
16
|
-
|
|
16
|
+
return new SharedCameraSession(createSessionBackend(config), config)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** Package-internal: attach `host` as the session's preview surface.
|
|
@@ -21,17 +21,17 @@ export function createCameraSession(config: CameraSessionConfig = {}): CameraSes
|
|
|
21
21
|
* returned function requests stop on an in-flight attempt and releases
|
|
22
22
|
* camera ownership once finalization settles. */
|
|
23
23
|
export function attachSessionPreview(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
session: CameraSession,
|
|
25
|
+
host: unknown,
|
|
26
|
+
listener?: BackendPreviewListener,
|
|
27
27
|
): () => void {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if (!(session instanceof SharedCameraSession)) {
|
|
29
|
+
throw new CameraCaptureError({
|
|
30
|
+
kind: 'invalidArgument',
|
|
31
|
+
operation: 'attachPreview',
|
|
32
|
+
message: 'session was not created by createCameraSession',
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
return session.attach(host, listener)
|
|
37
37
|
}
|
package/src/style-merge.ts
CHANGED
|
@@ -7,50 +7,53 @@ export type StyleInput = string | Record<string, any> | null | undefined | reado
|
|
|
7
7
|
* Authored keys win; array styles fold in order; a string style is appended
|
|
8
8
|
* after the serialized defaults so its declarations override them too. */
|
|
9
9
|
export function mergeStyle(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
base: Record<string, any>,
|
|
11
|
+
style?: Record<string, any> | readonly (Record<string, any> | null | undefined)[] | null,
|
|
12
12
|
): Record<string, any>
|
|
13
13
|
|
|
14
14
|
export function mergeStyle(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
base: Record<string, any>,
|
|
16
|
+
style?: StyleInput,
|
|
17
17
|
): string | Record<string, any>
|
|
18
18
|
|
|
19
19
|
export function mergeStyle(
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
base: Record<string, any>,
|
|
21
|
+
style?: StyleInput,
|
|
22
22
|
): string | Record<string, any> {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
if (style == null) {
|
|
24
|
+
return base
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let obj: Record<string, any> = { ...base }
|
|
28
|
+
const strings: string[] = []
|
|
29
|
+
const add = (s: StyleInput) => {
|
|
30
|
+
if (s == null) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof s === 'string') {
|
|
35
|
+
strings.push(s)
|
|
36
|
+
} else if (Array.isArray(s)) {
|
|
37
|
+
for (const part of s) {
|
|
38
|
+
add(part)
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
obj = { ...obj, ...s }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
add(style)
|
|
46
|
+
|
|
47
|
+
if (strings.length === 0) {
|
|
48
|
+
return obj
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const prefix = Object.entries(obj)
|
|
52
|
+
.filter(([, v]) => v != null)
|
|
53
|
+
.map(([k, v]) => `${kebab(k)}:${v}`)
|
|
54
|
+
.join(';')
|
|
55
|
+
|
|
56
|
+
return [prefix, ...strings].filter(Boolean).join(';')
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export type StyleProp = string | Record<string, any> | readonly StyleProp[] | null | undefined
|