@octane-xplat/camera 0.12.0 → 0.14.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 +63 -3
- package/dist/linux/CameraView.web.tsrx.js +337 -0
- package/dist/linux/host-movie.web.js +100 -0
- package/dist/linux/index.js +5 -0
- package/dist/linux/layout-child.web.js +29 -0
- package/dist/linux/movie-metadata.web.js +65 -0
- package/dist/linux/octane-client-build.json +8 -0
- package/dist/linux/session-backend.linux.js +479 -0
- package/dist/linux/session-core.js +368 -0
- package/dist/linux/session.js +29 -0
- package/dist/linux/synthetic-session.js +280 -0
- package/dist/linux/types.js +19 -0
- package/dist/native/CameraView.android.js +25 -1
- package/dist/native/CameraView.ios.js +24 -1
- package/dist/native/CameraView.windows.js +173 -0
- package/dist/native/camera-permission.windows.js +43 -0
- package/dist/native/camera-session.windows.js +78 -0
- package/dist/native/cx.mobile.js +3 -2
- package/dist/native/cx.windows.js +9 -0
- package/dist/native/index.js +4 -1
- package/dist/native/layout-child.windows.js +53 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/session-backend.android.js +234 -0
- package/dist/native/session-backend.ios.js +682 -0
- package/dist/native/session-backend.js +55 -0
- package/dist/native/session-backend.windows.js +905 -0
- package/dist/native/session-core.js +368 -0
- package/dist/native/session.js +29 -0
- package/dist/native/synthetic-session.js +280 -0
- package/dist/native/types.js +19 -0
- package/dist/web/CameraView.web.tsrx.js +28 -8
- package/dist/web/host-movie.web.js +100 -0
- package/dist/web/index.js +4 -1
- package/dist/web/movie-metadata.web.js +65 -0
- package/dist/web/movie-storage.web.js +119 -0
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/session-backend.web.js +490 -0
- package/dist/web/session-core.js +368 -0
- package/dist/web/session.js +29 -0
- package/dist/web/synthetic-session.js +280 -0
- package/dist/web/types.js +19 -0
- package/package.json +23 -5
- package/platforms/android/AndroidManifest.xml +2 -0
- package/platforms/android/include.gradle +1 -0
- package/platforms/android/java/com/octanexplat/camera/CameraPreviewView.java +4 -0
- package/platforms/android/java/com/octanexplat/camera/CameraSessionBridge.java +363 -0
- package/platforms/ios/Info.plist +2 -0
- package/platforms/macos/src/XplatCameraHost.swift +513 -0
- package/src/CameraView.android.tsrx +21 -1
- package/src/CameraView.ios.tsrx +28 -2
- package/src/CameraView.macos.tsrx +93 -0
- package/src/CameraView.web.tsrx +20 -2
- package/src/CameraView.windows.tsrx +124 -0
- package/src/camera-permission.windows.ts +76 -0
- package/src/camera-session.macos.ts +75 -0
- package/src/camera-session.windows.ts +123 -0
- package/src/cx.macos.ts +5 -0
- package/src/cx.mobile.ts +3 -2
- package/src/cx.windows.ts +6 -0
- package/src/host-movie.web.ts +180 -0
- package/src/index.ts +31 -0
- package/src/index.web.ts +31 -0
- package/src/layout-child.windows.ts +79 -0
- package/src/movie-metadata.web.ts +84 -0
- package/src/movie-storage.web.ts +164 -0
- package/src/props.ts +7 -1
- package/src/session-backend.android.ts +397 -0
- package/src/session-backend.ios.ts +1092 -0
- package/src/session-backend.linux.ts +869 -0
- package/src/session-backend.macos.ts +624 -0
- package/src/session-backend.ts +57 -0
- package/src/session-backend.web.ts +874 -0
- package/src/session-backend.windows.ts +1517 -0
- package/src/session-core.ts +659 -0
- package/src/session.ts +37 -0
- package/src/synthetic-session.ts +367 -0
- package/src/types.ts +329 -0
- package/types/index.d.ts +43 -0
- package/types/props.d.ts +7 -1
- package/types/session-core.d.ts +129 -0
- package/types/synthetic-session.d.ts +48 -0
- package/types/types.d.ts +263 -0
- package/src/CameraView.windows.ts +0 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { attachSessionPreview } from "./session.js";
|
|
1
2
|
import { cameraHardwarePresent, ensureCameraPermission } from "./camera-permission.mobile.js";
|
|
2
3
|
import { applyEscapeProps, layoutChildProps, nativeAccessibilityRole, nativeAccessibilityState } from "./layout-child.js";
|
|
3
4
|
import { cx } from "./cx.mobile.js";
|
|
@@ -48,6 +49,25 @@ var CameraView = defineUniversalComponent("nativescript", function CameraView(pr
|
|
|
48
49
|
nativeView.setCameraActive(active);
|
|
49
50
|
if (!active) return () => nativeView.setCameraActive(false);
|
|
50
51
|
const fail = (message) => props.onError?.({ message });
|
|
52
|
+
if (props.session) {
|
|
53
|
+
if (props.facing !== void 0) {
|
|
54
|
+
fail("camera session conflicts with facing");
|
|
55
|
+
return () => nativeView.setCameraActive(false);
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const detach = attachSessionPreview(props.session, nativeView, {
|
|
59
|
+
onReady: props.onReady,
|
|
60
|
+
onError: (issue) => fail(issue.message)
|
|
61
|
+
});
|
|
62
|
+
return () => {
|
|
63
|
+
detach();
|
|
64
|
+
nativeView.setCameraActive(false);
|
|
65
|
+
};
|
|
66
|
+
} catch (error) {
|
|
67
|
+
fail(error?.message ?? "camera session error");
|
|
68
|
+
return () => nativeView.setCameraActive(false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
51
71
|
if (!cameraHardwarePresent()) {
|
|
52
72
|
fail("camera unsupported");
|
|
53
73
|
return () => nativeView.setCameraActive(false);
|
|
@@ -89,7 +109,11 @@ var CameraView = defineUniversalComponent("nativescript", function CameraView(pr
|
|
|
89
109
|
provider.unbind(preview);
|
|
90
110
|
} catch {}
|
|
91
111
|
};
|
|
92
|
-
}, [
|
|
112
|
+
}, [
|
|
113
|
+
active,
|
|
114
|
+
facing,
|
|
115
|
+
props.session
|
|
116
|
+
], _h$3);
|
|
93
117
|
useEffect(() => {
|
|
94
118
|
const view = host.current;
|
|
95
119
|
if (!view) return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { attachSessionPreview } from "./session.js";
|
|
1
2
|
import { cameraHardwarePresent, ensureCameraPermission } from "./camera-permission.mobile.js";
|
|
2
3
|
import { startCameraPreview } from "./camera-session.ios.js";
|
|
3
4
|
import { applyEscapeProps, layoutChildProps, nativeAccessibilityRole, nativeAccessibilityState } from "./layout-child.js";
|
|
@@ -29,6 +30,24 @@ var CameraView = defineUniversalComponent("nativescript", function CameraView(pr
|
|
|
29
30
|
let disposed = false;
|
|
30
31
|
let stopPreview;
|
|
31
32
|
const fail = (message) => props.onError?.({ message });
|
|
33
|
+
if (props.session) {
|
|
34
|
+
if (props.facing !== void 0) {
|
|
35
|
+
fail("camera session conflicts with facing");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const detach = attachSessionPreview(props.session, view, { onReady: () => {
|
|
40
|
+
if (!disposed) props.onReady?.();
|
|
41
|
+
} });
|
|
42
|
+
return () => {
|
|
43
|
+
disposed = true;
|
|
44
|
+
detach();
|
|
45
|
+
};
|
|
46
|
+
} catch (error) {
|
|
47
|
+
fail(error?.message ?? "camera session error");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
32
51
|
if (!cameraHardwarePresent()) {
|
|
33
52
|
fail("camera unsupported");
|
|
34
53
|
return;
|
|
@@ -49,7 +68,11 @@ var CameraView = defineUniversalComponent("nativescript", function CameraView(pr
|
|
|
49
68
|
disposed = true;
|
|
50
69
|
stopPreview?.();
|
|
51
70
|
};
|
|
52
|
-
}, [
|
|
71
|
+
}, [
|
|
72
|
+
active,
|
|
73
|
+
facing,
|
|
74
|
+
props.session
|
|
75
|
+
], _h$3);
|
|
53
76
|
useEffect(() => {
|
|
54
77
|
const view = host.current;
|
|
55
78
|
if (!view) return;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { attachSessionPreview } from "./session.js";
|
|
2
|
+
import { cameraHardwarePresent, ensureCameraPermission } from "./camera-permission.windows.js";
|
|
3
|
+
import { startCameraPreview } from "./camera-session.windows.js";
|
|
4
|
+
import { applyEscapeProps, layoutChildProps, nativeAccessibilityRole, nativeAccessibilityState } from "./layout-child.windows.js";
|
|
5
|
+
import { cx } from "./cx.windows.js";
|
|
6
|
+
import { defineUniversalComponent, hookSlots, registerElement, universalPlan, universalProps, universalValue, useCallback, useEffect, useImperativeHandle, useRef } from "@nativescript-community/octane";
|
|
7
|
+
import { View } from "@nativescript/core";
|
|
8
|
+
//#region src/CameraView.windows.tsrx
|
|
9
|
+
var _hs$ = /* @__PURE__ */ hookSlots(5);
|
|
10
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
11
|
+
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
12
|
+
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
13
|
+
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
14
|
+
var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
15
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
16
|
+
"kind": "host",
|
|
17
|
+
"type": "gridlayout",
|
|
18
|
+
"propsSlot": 0,
|
|
19
|
+
"children": [{
|
|
20
|
+
"kind": "host",
|
|
21
|
+
"type": "camerapreview",
|
|
22
|
+
"props": {
|
|
23
|
+
"row": 0,
|
|
24
|
+
"col": 0
|
|
25
|
+
},
|
|
26
|
+
"bindings": [["ref", 1]]
|
|
27
|
+
}]
|
|
28
|
+
});
|
|
29
|
+
var CameraPreview = class extends View {
|
|
30
|
+
createNativeView() {
|
|
31
|
+
const { Microsoft } = globalThis;
|
|
32
|
+
return new Microsoft.UI.Xaml.Controls.CaptureElement();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
registerElement("camerapreview", CameraPreview);
|
|
36
|
+
var CameraView = defineUniversalComponent("nativescript", function CameraView(props) {
|
|
37
|
+
const host = useRef(null, _h$0);
|
|
38
|
+
const active = props.active !== false;
|
|
39
|
+
const facing = props.facing ?? "back";
|
|
40
|
+
useImperativeHandle(props.ref, () => ({ native: host.current?.nativeViewProtected }), [], _h$1);
|
|
41
|
+
const bindHost = useCallback((view) => {
|
|
42
|
+
host.current = view;
|
|
43
|
+
}, [], _h$2);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const view = host.current;
|
|
46
|
+
if (!view || !active) return;
|
|
47
|
+
let disposed = false;
|
|
48
|
+
let stopPreview;
|
|
49
|
+
const fail = (message) => props.onError?.({ message });
|
|
50
|
+
if (props.session) {
|
|
51
|
+
if (props.facing !== void 0) {
|
|
52
|
+
fail("camera session conflicts with facing");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const detach = attachSessionPreview(props.session, view, {
|
|
57
|
+
onReady: () => {
|
|
58
|
+
if (!disposed) props.onReady?.();
|
|
59
|
+
},
|
|
60
|
+
onError: (issue) => {
|
|
61
|
+
if (!disposed) fail(issue.message);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
disposed = true;
|
|
66
|
+
detach();
|
|
67
|
+
};
|
|
68
|
+
} catch (error) {
|
|
69
|
+
fail(error?.message ?? "camera session error");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!cameraHardwarePresent()) {
|
|
74
|
+
fail("camera unsupported");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
ensureCameraPermission().then(async (granted) => {
|
|
78
|
+
if (disposed) return;
|
|
79
|
+
if (!granted) {
|
|
80
|
+
fail("camera permission denied");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
stopPreview = await startCameraPreview(view, facing, () => {
|
|
85
|
+
if (!disposed) props.onReady?.();
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (!disposed) fail(error?.message ?? "camera error");
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return () => {
|
|
92
|
+
disposed = true;
|
|
93
|
+
stopPreview?.();
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
active,
|
|
97
|
+
facing,
|
|
98
|
+
props.session
|
|
99
|
+
], _h$3);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const view = host.current;
|
|
102
|
+
if (!view) return;
|
|
103
|
+
applyEscapeProps(view.nativeViewProtected, props);
|
|
104
|
+
}, [props.ref, props.windows], _h$4);
|
|
105
|
+
return universalValue(__octaneUniversalPlan0, [universalProps([
|
|
106
|
+
[
|
|
107
|
+
"set",
|
|
108
|
+
"id",
|
|
109
|
+
props.id
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"set",
|
|
113
|
+
"rows",
|
|
114
|
+
"*"
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"set",
|
|
118
|
+
"columns",
|
|
119
|
+
"*"
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
"set",
|
|
123
|
+
"className",
|
|
124
|
+
cx("vx-layers", "vx-cameraview", props.className)
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
"set",
|
|
128
|
+
"style",
|
|
129
|
+
{
|
|
130
|
+
backgroundColor: "#000",
|
|
131
|
+
...props.style
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
["spread", layoutChildProps(props)],
|
|
135
|
+
[
|
|
136
|
+
"set",
|
|
137
|
+
"accessible",
|
|
138
|
+
props.accessible
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"set",
|
|
142
|
+
"accessibilityLabel",
|
|
143
|
+
props.accessibilityLabel
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
"set",
|
|
147
|
+
"accessibilityRole",
|
|
148
|
+
nativeAccessibilityRole(props.accessibilityRole)
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
"set",
|
|
152
|
+
"accessibilityHint",
|
|
153
|
+
props.accessibilityHint
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"set",
|
|
157
|
+
"accessibilityValue",
|
|
158
|
+
props.accessibilityValue
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
"set",
|
|
162
|
+
"accessibilityState",
|
|
163
|
+
nativeAccessibilityState(props.accessibilityState)
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"set",
|
|
167
|
+
"accessibilityLiveRegion",
|
|
168
|
+
props.accessibilityLiveRegion
|
|
169
|
+
]
|
|
170
|
+
]), bindHost]);
|
|
171
|
+
}, { "module": "@nativescript-community/octane" });
|
|
172
|
+
//#endregion
|
|
173
|
+
export { CameraView };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/camera-permission.windows.ts
|
|
2
|
+
/** Windows camera-permission probe for preview-only `CameraView` callers.
|
|
3
|
+
* Uses `AppCapability` when projected and falls back to
|
|
4
|
+
* `DeviceAccessInformation`; both are non-prompting checks — only
|
|
5
|
+
* `RequestAccessAsync` may show the system prompt. */
|
|
6
|
+
var windows = () => globalThis;
|
|
7
|
+
var toPromise = (op) => {
|
|
8
|
+
const { NSWinRT } = windows();
|
|
9
|
+
if (NSWinRT?.toPromise && op != null) return NSWinRT.toPromise(op);
|
|
10
|
+
if (op?.done) return new Promise((resolve, reject) => {
|
|
11
|
+
try {
|
|
12
|
+
op.done(resolve, reject);
|
|
13
|
+
} catch (cause) {
|
|
14
|
+
reject(cause);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return Promise.resolve(op);
|
|
18
|
+
};
|
|
19
|
+
function cameraHardwarePresent() {
|
|
20
|
+
const { Windows, Microsoft } = windows();
|
|
21
|
+
return !!(Windows?.Media?.Capture?.MediaCapture && Windows?.Devices?.Enumeration?.DeviceInformation && Microsoft?.UI?.Xaml?.Controls?.CaptureElement);
|
|
22
|
+
}
|
|
23
|
+
async function ensureCameraPermission() {
|
|
24
|
+
try {
|
|
25
|
+
const { Windows } = windows();
|
|
26
|
+
const capability = Windows?.Security?.Authorization?.AppCapabilityAccess?.AppCapability?.Create?.("webcam");
|
|
27
|
+
if (capability) {
|
|
28
|
+
const status = capability.CheckAccess();
|
|
29
|
+
if (status === 4) return true;
|
|
30
|
+
if (status === 3) return await toPromise(capability.RequestAccessAsync()) === 4;
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const enumeration = Windows?.Devices?.Enumeration;
|
|
34
|
+
const deviceClass = enumeration?.DeviceClass?.VideoCapture;
|
|
35
|
+
const info = deviceClass === void 0 ? void 0 : enumeration?.DeviceAccessInformation?.CreateFromDeviceClass(deviceClass);
|
|
36
|
+
if (info) return info.CurrentStatus !== 2 && info.CurrentStatus !== 3;
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { cameraHardwarePresent, ensureCameraPermission };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/camera-session.windows.ts
|
|
2
|
+
/** Standalone (non-session) WinUI preview for `CameraView` without a
|
|
3
|
+
* `session` prop. Owns a private `MediaCapture` bound to a
|
|
4
|
+
* `CaptureElement`; the returned function stops preview and closes the
|
|
5
|
+
* device. Session-backed previews share their capture through
|
|
6
|
+
* `session-backend.windows.ts` instead. */
|
|
7
|
+
var windows = () => globalThis;
|
|
8
|
+
var toPromise = (op) => {
|
|
9
|
+
const { NSWinRT } = windows();
|
|
10
|
+
if (NSWinRT?.toPromise && op != null) return NSWinRT.toPromise(op);
|
|
11
|
+
if (op?.done) return new Promise((resolve, reject) => {
|
|
12
|
+
try {
|
|
13
|
+
op.done(resolve, reject);
|
|
14
|
+
} catch (cause) {
|
|
15
|
+
reject(cause);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return Promise.resolve(op);
|
|
19
|
+
};
|
|
20
|
+
var vectorToArray = (items) => {
|
|
21
|
+
const result = [];
|
|
22
|
+
const size = Number(items?.Size ?? items?.Count ?? 0);
|
|
23
|
+
for (let index = 0; index < size; index += 1) result.push(items.GetAt(index));
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
/** Attach a MediaCapture preview to the view's `CaptureElement`.
|
|
27
|
+
* `facing` maps to enclosure panels; desktop cameras without a panel fall
|
|
28
|
+
* back to the OS default — front/back is a preference, never a fabrication. */
|
|
29
|
+
async function startCameraPreview(view, facing, onReady) {
|
|
30
|
+
const { Windows } = windows();
|
|
31
|
+
const enumeration = Windows?.Devices?.Enumeration;
|
|
32
|
+
const captureApi = Windows?.Media?.Capture;
|
|
33
|
+
if (!enumeration || !captureApi) throw new Error("camera preview unsupported");
|
|
34
|
+
const devices = vectorToArray(await toPromise(enumeration.DeviceInformation.FindAllAsync(enumeration.DeviceClass.VideoCapture)));
|
|
35
|
+
if (!devices.length) throw new Error("camera unavailable");
|
|
36
|
+
const wantedPanel = facing === "front" ? 1 : 2;
|
|
37
|
+
const device = devices.find((entry) => Number(entry?.EnclosureLocation?.Panel) === wantedPanel) ?? devices[0];
|
|
38
|
+
const settings = new captureApi.MediaCaptureInitializationSettings();
|
|
39
|
+
settings.VideoDeviceId = String(device?.Id ?? device?.id ?? "");
|
|
40
|
+
settings.StreamingCaptureMode = 0;
|
|
41
|
+
const capture = new captureApi.MediaCapture();
|
|
42
|
+
try {
|
|
43
|
+
await toPromise(capture.InitializeAsync(settings));
|
|
44
|
+
} catch (cause) {
|
|
45
|
+
try {
|
|
46
|
+
capture.Close();
|
|
47
|
+
} catch {
|
|
48
|
+
try {
|
|
49
|
+
capture.Dispose();
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
throw cause instanceof Error ? cause : /* @__PURE__ */ new Error("camera unavailable");
|
|
53
|
+
}
|
|
54
|
+
const element = view?.nativeViewProtected ?? view;
|
|
55
|
+
element.Source = capture;
|
|
56
|
+
try {
|
|
57
|
+
if (Number(device?.EnclosureLocation?.Panel) === 1 && typeof capture.SetPreviewMirroring === "function") capture.SetPreviewMirroring(true);
|
|
58
|
+
} catch {}
|
|
59
|
+
await toPromise(capture.StartPreviewAsync());
|
|
60
|
+
onReady?.();
|
|
61
|
+
return async () => {
|
|
62
|
+
try {
|
|
63
|
+
element.Source = null;
|
|
64
|
+
} catch {}
|
|
65
|
+
try {
|
|
66
|
+
await toPromise(capture.StopPreviewAsync());
|
|
67
|
+
} catch {}
|
|
68
|
+
try {
|
|
69
|
+
capture.Close();
|
|
70
|
+
} catch {
|
|
71
|
+
try {
|
|
72
|
+
capture.Dispose();
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { startCameraPreview };
|
package/dist/native/cx.mobile.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/cx.mobile.ts
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
2
|
+
/** Imperative `view.className` writes still need a pre-joined string —
|
|
3
|
+
* NativeScript's className setter splits on ' ' only. Normalize arrays here
|
|
4
|
+
* so they stay space separated. */
|
|
4
5
|
function cx(...parts) {
|
|
5
6
|
return parts.flat(Infinity).filter(Boolean).join(" ");
|
|
6
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/cx.windows.ts
|
|
2
|
+
/** Imperative `view.className` writes still need a pre-joined string —
|
|
3
|
+
* NativeScript's className setter splits on ' ' only. Normalize arrays here
|
|
4
|
+
* so they stay space separated. */
|
|
5
|
+
function cx(...parts) {
|
|
6
|
+
return parts.flat(Infinity).filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { cx };
|
package/dist/native/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { CameraCaptureError } from "./types.js";
|
|
2
|
+
import { createCameraSession } from "./session.js";
|
|
3
|
+
import { createMemoryCameraStorage, createSyntheticCameraSession } from "./synthetic-session.js";
|
|
1
4
|
import { CameraView } from "./src/CameraView";
|
|
2
|
-
export { CameraView };
|
|
5
|
+
export { CameraCaptureError, CameraView, createCameraSession, createMemoryCameraStorage, createSyntheticCameraSession };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/layout-child.windows.ts
|
|
2
|
+
/** Windows twins of the layout-child helpers — the unsuffixed module
|
|
3
|
+
* resolves the platform escape bag through `isIOS`, which has no Windows
|
|
4
|
+
* branch. Pure helpers are re-declared here to keep divergence at the file
|
|
5
|
+
* boundary. */
|
|
6
|
+
function layoutChildProps(props) {
|
|
7
|
+
const result = {};
|
|
8
|
+
for (const key of [
|
|
9
|
+
"row",
|
|
10
|
+
"col",
|
|
11
|
+
"rowSpan",
|
|
12
|
+
"colSpan",
|
|
13
|
+
"dock",
|
|
14
|
+
"left",
|
|
15
|
+
"top",
|
|
16
|
+
"flexGrow",
|
|
17
|
+
"flexShrink",
|
|
18
|
+
"alignSelf",
|
|
19
|
+
"order"
|
|
20
|
+
]) if (props[key] !== void 0) result[key] = props[key];
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function applyEscapeProps(view, props) {
|
|
24
|
+
if (view && props.windows) Object.assign(view, props.windows);
|
|
25
|
+
}
|
|
26
|
+
var nativeRoles = {
|
|
27
|
+
button: "button",
|
|
28
|
+
link: "link",
|
|
29
|
+
search: "search",
|
|
30
|
+
image: "image",
|
|
31
|
+
heading: "header",
|
|
32
|
+
adjustable: "adjustable",
|
|
33
|
+
summary: "summary",
|
|
34
|
+
text: "text",
|
|
35
|
+
none: "none",
|
|
36
|
+
progressbar: "progressBar",
|
|
37
|
+
checkbox: "checkbox",
|
|
38
|
+
switch: "switch",
|
|
39
|
+
radio: "radioButton",
|
|
40
|
+
spinbutton: "spinButton",
|
|
41
|
+
tab: "button"
|
|
42
|
+
};
|
|
43
|
+
function nativeAccessibilityRole(role) {
|
|
44
|
+
return role ? nativeRoles[role] : void 0;
|
|
45
|
+
}
|
|
46
|
+
function nativeAccessibilityState(state) {
|
|
47
|
+
if (state?.disabled) return "disabled";
|
|
48
|
+
if (state?.selected) return "selected";
|
|
49
|
+
if (state?.checked === true) return "checked";
|
|
50
|
+
if (state?.checked === false) return "unchecked";
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { applyEscapeProps, layoutChildProps, nativeAccessibilityRole, nativeAccessibilityState };
|