@sigx/lynx-camera 0.1.0 → 0.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Andreas Ekdahl
3
+ Copyright (c) 2025-2026 Andreas Ekdahl
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -8,22 +8,26 @@ Photo capture via the system camera for sigx-lynx. iOS uses `UIImagePickerContro
8
8
  pnpm add @sigx/lynx-camera
9
9
  ```
10
10
 
11
- ```ts
12
- // sigx.lynx.config.ts
13
- export default defineLynxConfig({
14
- modules: ['@sigx/lynx-camera'],
15
- });
16
- ```
17
-
18
- `sigx prebuild` auto-links the native module, injects `android.permission.CAMERA`, and adds the iOS usage descriptions:
11
+ `sigx prebuild` auto-discovers the package, links the native module, injects `android.permission.CAMERA`, and adds the iOS usage descriptions:
19
12
 
20
13
  - `NSCameraUsageDescription`
21
14
  - `NSMicrophoneUsageDescription`
22
15
  - `NSPhotoLibraryAddUsageDescription`
23
16
 
24
- Override the prompts in your `sigx.lynx.config.ts` under `ios.usageDescriptions` if you want app-specific copy.
17
+ Override the prompts in your `signalx.config.ts` under `ios.usageDescriptions` if you want app-specific copy:
18
+
19
+ ```ts
20
+ // signalx.config.ts
21
+ export default defineLynxConfig({
22
+ ios: {
23
+ usageDescriptions: {
24
+ NSCameraUsageDescription: 'Acme uses the camera to scan QR codes.',
25
+ },
26
+ },
27
+ });
28
+ ```
25
29
 
26
- > **Android pairs with `@sigx/lynx-permissions`** — that's where the runtime permission prompt + Activity Result wiring lives. Add it to your modules list (or anything that depends on it does, transitively).
30
+ > **Android requires `@sigx/lynx-permissions`** — that's where the runtime permission prompt + Activity Result wiring lives, and camera's Kotlin sources import `com.sigx.permissions.*` directly. Install it explicitly: `pnpm add @sigx/lynx-permissions`. The permission-using modules don't declare it as a peer dep, so the Android build will break without it.
27
31
 
28
32
  ## Usage
29
33
 
package/dist/camera.d.ts CHANGED
@@ -34,11 +34,11 @@ export interface PhotoResult {
34
34
  * ```
35
35
  */
36
36
  export declare const Camera: {
37
- readonly takePicture: (options?: CameraOptions) => Promise<PhotoResult>;
37
+ takePicture(options?: CameraOptions): Promise<PhotoResult>;
38
38
  /** Request camera permission, showing the OS dialog if needed. */
39
- readonly requestPermission: () => Promise<PermissionResponse>;
39
+ requestPermission(): Promise<PermissionResponse>;
40
40
  /** Check current camera permission status without prompting. */
41
- readonly getPermissionStatus: () => Promise<PermissionResponse>;
42
- readonly isAvailable: () => boolean;
41
+ getPermissionStatus(): Promise<PermissionResponse>;
42
+ isAvailable(): boolean;
43
43
  };
44
44
  //# sourceMappingURL=camera.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,WAAW,aAAa;IAC1B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IACxB,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;qCACM,aAAa,KAAQ,OAAO,CAAC,WAAW,CAAC;IAI9D,kEAAkE;sCAC7C,OAAO,CAAC,kBAAkB,CAAC;IAIhD,gEAAgE;wCACzC,OAAO,CAAC,kBAAkB,CAAC;gCAInC,OAAO;CAGhB,CAAC"}
1
+ {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,WAAW,aAAa;IAC1B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IACxB,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;IACf,WAAW,WAAU,aAAa,GAAQ,OAAO,CAAC,WAAW,CAAC;IAI9D,kEAAkE;IAClE,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIhD,gEAAgE;IAChE,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIlD,WAAW,IAAI,OAAO;CAGhB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Camera } from './camera.js';
2
- export type { CameraOptions, PhotoResult } from './camera.js';
1
+ export { Camera } from './camera';
2
+ export type { CameraOptions, PhotoResult } from './camera';
3
3
  export type { PermissionResponse } from '@sigx/lynx-core';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,20 @@
1
- export { Camera } from './camera.js';
1
+ import { callAsync as e, isModuleAvailable as t } from "@sigx/lynx-core";
2
+ //#region src/camera.ts
3
+ var n = "Camera", r = {
4
+ takePicture(t = {}) {
5
+ return e(n, "takePicture", t);
6
+ },
7
+ requestPermission() {
8
+ return e(n, "requestPermission");
9
+ },
10
+ getPermissionStatus() {
11
+ return e(n, "getPermissionStatus");
12
+ },
13
+ isAvailable() {
14
+ return t(n);
15
+ }
16
+ };
17
+ //#endregion
18
+ export { r as Camera };
19
+
2
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/camera.ts"],"sourcesContent":["import { callAsync, isModuleAvailable } from '@sigx/lynx-core';\nimport type { PermissionResponse } from '@sigx/lynx-core';\n\nconst MODULE = 'Camera';\n\nexport interface CameraOptions {\n /** 'front' or 'back' camera */\n facing?: 'front' | 'back';\n /** Image quality 0-1 */\n quality?: number;\n /** Max width in pixels */\n maxWidth?: number;\n /** Max height in pixels */\n maxHeight?: number;\n}\n\nexport interface PhotoResult {\n /** File URI of the captured photo */\n uri: string;\n /** Width in pixels */\n width: number;\n /** Height in pixels */\n height: number;\n /** Base64-encoded image data (if requested) */\n base64?: string;\n}\n\n/**\n * Camera capture APIs.\n *\n * @example\n * ```ts\n * import { Camera } from '@sigx/lynx-camera';\n *\n * const { status } = await Camera.requestPermission();\n * if (status === 'granted') {\n * const photo = await Camera.takePicture({ quality: 0.8 });\n * console.log(photo.uri);\n * }\n * ```\n */\nexport const Camera = {\n takePicture(options: CameraOptions = {}): Promise<PhotoResult> {\n return callAsync<PhotoResult>(MODULE, 'takePicture', options);\n },\n\n /** Request camera permission, showing the OS dialog if needed. */\n requestPermission(): Promise<PermissionResponse> {\n return callAsync<PermissionResponse>(MODULE, 'requestPermission');\n },\n\n /** Check current camera permission status without prompting. */\n getPermissionStatus(): Promise<PermissionResponse> {\n return callAsync<PermissionResponse>(MODULE, 'getPermissionStatus');\n },\n\n isAvailable(): boolean {\n return isModuleAvailable(MODULE);\n },\n} as const;\n"],"mappings":";;AAGA,IAAM,IAAS,UAsCF,IAAS;CAClB,YAAY,IAAyB,EAAE,EAAwB;EAC3D,OAAO,EAAuB,GAAQ,eAAe,EAAQ;;CAIjE,oBAAiD;EAC7C,OAAO,EAA8B,GAAQ,oBAAoB;;CAIrE,sBAAmD;EAC/C,OAAO,EAA8B,GAAQ,sBAAsB;;CAGvE,cAAuB;EACnB,OAAO,EAAkB,EAAO;;CAEvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigx/lynx-camera",
3
- "version": "0.1.0",
3
+ "version": "0.4.0",
4
4
  "description": "Camera capture for sigx-lynx",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,24 +10,46 @@
10
10
  "import": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./sigx-module.json": "./sigx-module.json"
13
+ "./signalx-module.json": "./signalx-module.json"
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
17
  "ios",
18
18
  "android",
19
- "sigx-module.json"
19
+ "signalx-module.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@sigx/lynx-core": "^0.1.0"
22
+ "@sigx/lynx-core": "^0.4.0"
23
23
  },
24
24
  "devDependencies": {
25
- "typescript": "^5.9.3"
25
+ "typescript": "^6.0.3",
26
+ "@sigx/vite": "^0.4.3"
26
27
  },
27
28
  "author": "Andreas Ekdahl",
28
29
  "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/signalxjs/lynx.git",
33
+ "directory": "packages/lynx-camera"
34
+ },
35
+ "homepage": "https://github.com/signalxjs/lynx/tree/main/packages/lynx-camera",
36
+ "bugs": {
37
+ "url": "https://github.com/signalxjs/lynx/issues"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "keywords": [
43
+ "signalx",
44
+ "sigx",
45
+ "lynx",
46
+ "mobile",
47
+ "ios",
48
+ "android",
49
+ "camera"
50
+ ],
29
51
  "scripts": {
30
- "build": "tsc",
31
- "dev": "tsc --watch"
52
+ "build": "vite build && tsgo --emitDeclarationOnly",
53
+ "dev": "vite build --watch"
32
54
  }
33
55
  }
package/dist/camera.js DELETED
@@ -1,33 +0,0 @@
1
- import { callAsync, isModuleAvailable } from '@sigx/lynx-core';
2
- const MODULE = 'Camera';
3
- /**
4
- * Camera capture APIs.
5
- *
6
- * @example
7
- * ```ts
8
- * import { Camera } from '@sigx/lynx-camera';
9
- *
10
- * const { status } = await Camera.requestPermission();
11
- * if (status === 'granted') {
12
- * const photo = await Camera.takePicture({ quality: 0.8 });
13
- * console.log(photo.uri);
14
- * }
15
- * ```
16
- */
17
- export const Camera = {
18
- takePicture(options = {}) {
19
- return callAsync(MODULE, 'takePicture', options);
20
- },
21
- /** Request camera permission, showing the OS dialog if needed. */
22
- requestPermission() {
23
- return callAsync(MODULE, 'requestPermission');
24
- },
25
- /** Check current camera permission status without prompting. */
26
- getPermissionStatus() {
27
- return callAsync(MODULE, 'getPermissionStatus');
28
- },
29
- isAvailable() {
30
- return isModuleAvailable(MODULE);
31
- },
32
- };
33
- //# sourceMappingURL=camera.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"camera.js","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAG/D,MAAM,MAAM,GAAG,QAAQ,CAAC;AAwBxB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,WAAW,CAAC,UAAyB,EAAE;QACnC,OAAO,SAAS,CAAc,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,kEAAkE;IAClE,iBAAiB;QACb,OAAO,SAAS,CAAqB,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACtE,CAAC;IAED,gEAAgE;IAChE,mBAAmB;QACf,OAAO,SAAS,CAAqB,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IAED,WAAW;QACP,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACK,CAAC"}
File without changes