@capacitor/camera 8.0.0-dev-2444-20251112T191750.0 → 8.0.0-dev-2440-20251112T200158.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/android/src/main/java/com/capacitorjs/plugins/camera/CameraBottomSheetDialogFragment.java +7 -5
- package/android/src/main/java/com/capacitorjs/plugins/camera/CameraPlugin.java +51 -38
- package/android/src/main/java/com/capacitorjs/plugins/camera/CameraUtils.java +1 -1
- package/dist/esm/definitions.d.ts +4 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +7 -4
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +7 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +7 -4
- package/dist/plugin.js.map +1 -1
- package/package.json +12 -12
package/android/src/main/java/com/capacitorjs/plugins/camera/CameraBottomSheetDialogFragment.java
CHANGED
|
@@ -97,12 +97,14 @@ public class CameraBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
|
|
97
97
|
tv.setTextColor(Color.parseColor("#000000"));
|
|
98
98
|
tv.setPadding(layoutPaddingPx12, layoutPaddingPx12, layoutPaddingPx12, layoutPaddingPx12);
|
|
99
99
|
tv.setText(options.get(i));
|
|
100
|
-
tv.setOnClickListener(
|
|
101
|
-
|
|
102
|
-
selectedListener
|
|
100
|
+
tv.setOnClickListener(
|
|
101
|
+
view -> {
|
|
102
|
+
if (selectedListener != null) {
|
|
103
|
+
selectedListener.onSelected(optionIndex);
|
|
104
|
+
}
|
|
105
|
+
dismiss();
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
});
|
|
107
|
+
);
|
|
106
108
|
layout.addView(tv);
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -171,7 +171,7 @@ public class CameraPlugin extends Plugin {
|
|
|
171
171
|
fragment.setTitle(call.getString("promptLabelHeader", "Photo"));
|
|
172
172
|
fragment.setOptions(
|
|
173
173
|
options,
|
|
174
|
-
|
|
174
|
+
index -> {
|
|
175
175
|
if (index == 0) {
|
|
176
176
|
settings.setSource(CameraSource.PHOTOS);
|
|
177
177
|
openPhotos(call);
|
|
@@ -351,46 +351,58 @@ public class CameraPlugin extends Plugin {
|
|
|
351
351
|
private void openPhotos(final PluginCall call, boolean multiple) {
|
|
352
352
|
try {
|
|
353
353
|
if (multiple) {
|
|
354
|
-
pickMultipleMedia =
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
354
|
+
pickMultipleMedia =
|
|
355
|
+
registerActivityResultLauncher(
|
|
356
|
+
getContractForCall(call),
|
|
357
|
+
uris -> {
|
|
358
|
+
if (!uris.isEmpty()) {
|
|
359
|
+
Executor executor = Executors.newSingleThreadExecutor();
|
|
360
|
+
executor.execute(
|
|
361
|
+
() -> {
|
|
362
|
+
JSObject ret = new JSObject();
|
|
363
|
+
JSArray photos = new JSArray();
|
|
364
|
+
for (Uri imageUri : uris) {
|
|
365
|
+
try {
|
|
366
|
+
JSObject processResult = processPickedImages(imageUri);
|
|
367
|
+
if (
|
|
368
|
+
processResult.getString("error") != null && !processResult.getString("error").isEmpty()
|
|
369
|
+
) {
|
|
370
|
+
call.reject(processResult.getString("error"));
|
|
371
|
+
return;
|
|
372
|
+
} else {
|
|
373
|
+
photos.put(processResult);
|
|
374
|
+
}
|
|
375
|
+
} catch (SecurityException ex) {
|
|
376
|
+
call.reject("SecurityException");
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
ret.put("photos", photos);
|
|
380
|
+
call.resolve(ret);
|
|
368
381
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
382
|
+
);
|
|
383
|
+
} else {
|
|
384
|
+
call.reject(USER_CANCELLED);
|
|
372
385
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
} else {
|
|
377
|
-
call.reject(USER_CANCELLED);
|
|
378
|
-
}
|
|
379
|
-
pickMultipleMedia.unregister();
|
|
380
|
-
});
|
|
386
|
+
pickMultipleMedia.unregister();
|
|
387
|
+
}
|
|
388
|
+
);
|
|
381
389
|
pickMultipleMedia.launch(
|
|
382
390
|
new PickVisualMediaRequest.Builder().setMediaType(ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE).build()
|
|
383
391
|
);
|
|
384
392
|
} else {
|
|
385
|
-
pickMedia =
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
393
|
+
pickMedia =
|
|
394
|
+
registerActivityResultLauncher(
|
|
395
|
+
new ActivityResultContracts.PickVisualMedia(),
|
|
396
|
+
uri -> {
|
|
397
|
+
if (uri != null) {
|
|
398
|
+
imagePickedContentUri = uri;
|
|
399
|
+
processPickedImage(uri, call);
|
|
400
|
+
} else {
|
|
401
|
+
call.reject(USER_CANCELLED);
|
|
402
|
+
}
|
|
403
|
+
pickMedia.unregister();
|
|
404
|
+
}
|
|
405
|
+
);
|
|
394
406
|
pickMedia.launch(
|
|
395
407
|
new PickVisualMediaRequest.Builder().setMediaType(ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE).build()
|
|
396
408
|
);
|
|
@@ -856,9 +868,10 @@ public class CameraPlugin extends Plugin {
|
|
|
856
868
|
List<ResolveInfo> resInfoList;
|
|
857
869
|
|
|
858
870
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
859
|
-
resInfoList =
|
|
860
|
-
|
|
861
|
-
|
|
871
|
+
resInfoList =
|
|
872
|
+
getContext()
|
|
873
|
+
.getPackageManager()
|
|
874
|
+
.queryIntentActivities(editIntent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY));
|
|
862
875
|
} else {
|
|
863
876
|
resInfoList = legacyQueryIntentActivities(editIntent);
|
|
864
877
|
}
|
|
@@ -23,7 +23,7 @@ public class CameraUtils {
|
|
|
23
23
|
String imageFileName = "JPEG_" + timeStamp + "_";
|
|
24
24
|
File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
|
25
25
|
|
|
26
|
-
File image = File.createTempFile(imageFileName, /* prefix */
|
|
26
|
+
File image = File.createTempFile(imageFileName, /* prefix */".jpg", /* suffix */storageDir/* directory */);
|
|
27
27
|
|
|
28
28
|
return image;
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PermissionState } from '@capacitor/core';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type CameraPermissionState = PermissionState | 'limited';
|
|
3
|
+
export type CameraPermissionType = 'camera' | 'photos';
|
|
4
4
|
export interface PermissionStatus {
|
|
5
5
|
camera: CameraPermissionState;
|
|
6
6
|
photos: CameraPermissionState;
|
|
@@ -328,9 +328,9 @@ export declare enum CameraResultType {
|
|
|
328
328
|
* @deprecated Use `Photo`.
|
|
329
329
|
* @since 1.0.0
|
|
330
330
|
*/
|
|
331
|
-
export
|
|
331
|
+
export type CameraPhoto = Photo;
|
|
332
332
|
/**
|
|
333
333
|
* @deprecated Use `ImageOptions`.
|
|
334
334
|
* @since 1.0.0
|
|
335
335
|
*/
|
|
336
|
-
export
|
|
336
|
+
export type CameraOptions = ImageOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAuUA,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CameraPermissionState = PermissionState | 'limited';\n\nexport type CameraPermissionType = 'camera' | 'photos';\n\nexport interface PermissionStatus {\n camera: CameraPermissionState;\n photos: CameraPermissionState;\n}\n\nexport interface CameraPluginPermissions {\n permissions: CameraPermissionType[];\n}\n\nexport interface CameraPlugin {\n /**\n * Prompt the user to pick a photo from an album, or take a new photo\n * with the camera.\n *\n * @since 1.0.0\n */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n *\n * @since 1.2.0\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n\n /**\n * Allows the user to update their limited photo library selection.\n * Returns all the limited photos after the picker dismissal.\n * If instead the user gave full access to the photos it returns an empty array.\n *\n * @since 4.1.0\n */\n pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n /**\n * Return an array of photos selected from the limited photo library.\n *\n * @since 4.1.0\n */\n getLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n\n /**\n * Check camera and photo album permissions\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera and photo album permissions\n *\n * @since 1.0.0\n */\n requestPermissions(\n permissions?: CameraPluginPermissions,\n ): Promise<PermissionStatus>;\n}\n\nexport interface ImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS\n *\n * @since 1.0.0\n */\n quality?: number;\n /**\n * Whether to allow the user to crop or make small edits (platform specific).\n * On iOS it's only supported for CameraSource.Camera, but not for CameraSource.Photos.\n *\n * @since 1.0.0\n */\n allowEditing?: boolean;\n /**\n * How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported\n *\n * @since 1.0.0\n */\n resultType: CameraResultType;\n /**\n * Whether to save the photo to the gallery.\n * If the photo was picked from the gallery, it will only be saved if edited.\n * @default: false\n *\n * @since 1.0.0\n */\n saveToGallery?: boolean;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.0.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.0.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default: true\n *\n * @since 1.0.0\n */\n correctOrientation?: boolean;\n /**\n * The source to get the photo from. By default this prompts the user to select\n * either the photo album or take a photo.\n * @default: CameraSource.Prompt\n *\n * @since 1.0.0\n */\n source?: CameraSource;\n /**\n * iOS and Web only: The camera direction.\n * @default: CameraDirection.Rear\n *\n * @since 1.0.0\n */\n direction?: CameraDirection;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default: 'fullscreen'\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 1.0.0\n */\n webUseInput?: boolean;\n\n /**\n * Text value to use when displaying the prompt.\n * @default: 'Photo'\n *\n * @since 1.0.0\n *\n */\n promptLabelHeader?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * iOS only: The label of the 'cancel' button.\n * @default: 'Cancel'\n *\n * @since 1.0.0\n */\n promptLabelCancel?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to select a saved image.\n * @default: 'From Photos'\n *\n * @since 1.0.0\n */\n promptLabelPhoto?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to open the camera.\n * @default: 'Take Picture'\n *\n * @since 1.0.0\n */\n promptLabelPicture?: string;\n}\n\nexport interface Photo {\n /**\n * The base64 encoded string representation of the image, if using CameraResultType.Base64.\n *\n * @since 1.0.0\n */\n base64String?: string;\n /**\n * The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n *\n * Note: On web, the file format could change depending on the browser.\n * @since 1.0.0\n */\n dataUrl?: string;\n /**\n * If using CameraResultType.Uri, the path will contain a full,\n * platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.0.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.0.0\n */\n webPath?: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.0.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.\n *\n * @since 1.0.0\n */\n format: string;\n /**\n * Whether if the image was saved to the gallery or not.\n *\n * On Android and iOS, saving to the gallery can fail if the user didn't\n * grant the required permissions.\n * On Web there is no gallery, so always returns false.\n *\n * @since 1.1.0\n */\n saved: boolean;\n}\n\nexport interface GalleryPhotos {\n /**\n * Array of all the picked photos.\n *\n * @since 1.2.0\n */\n photos: GalleryPhoto[];\n}\n\nexport interface GalleryPhoto {\n /**\n * Full, platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.2.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.2.0\n */\n webPath: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.2.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif.\n *\n * @since 1.2.0\n */\n format: string;\n}\nexport interface GalleryImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.2.0\n */\n quality?: number;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default: true\n *\n * @since 1.2.0\n */\n correctOrientation?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default: 'fullscreen'\n *\n * @since 1.2.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Maximum number of pictures the user will be able to choose.\n * Note: This option is only supported on Android 13+ and iOS.\n *\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\n\nexport enum CameraSource {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n Prompt = 'PROMPT',\n /**\n * Take a new photo using the camera.\n */\n Camera = 'CAMERA',\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n Photos = 'PHOTOS',\n}\n\nexport enum CameraDirection {\n Rear = 'REAR',\n Front = 'FRONT',\n}\n\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\n}\n\n/**\n * @deprecated Use `Photo`.\n * @since 1.0.0\n */\nexport type CameraPhoto = Photo;\n\n/**\n * @deprecated Use `ImageOptions`.\n * @since 1.0.0\n */\nexport type CameraOptions = ImageOptions;\n"]}
|
package/dist/esm/web.js
CHANGED
|
@@ -43,7 +43,8 @@ export class CameraWeb extends WebPlugin {
|
|
|
43
43
|
async cameraExperience(options, resolve, reject) {
|
|
44
44
|
if (customElements.get('pwa-camera-modal')) {
|
|
45
45
|
const cameraModal = document.createElement('pwa-camera-modal');
|
|
46
|
-
cameraModal.facingMode =
|
|
46
|
+
cameraModal.facingMode =
|
|
47
|
+
options.direction === CameraDirection.Front ? 'user' : 'environment';
|
|
47
48
|
document.body.appendChild(cameraModal);
|
|
48
49
|
try {
|
|
49
50
|
await cameraModal.componentOnReady();
|
|
@@ -93,7 +94,8 @@ export class CameraWeb extends WebPlugin {
|
|
|
93
94
|
else if (file.type === 'image/gif') {
|
|
94
95
|
format = 'gif';
|
|
95
96
|
}
|
|
96
|
-
if (options.resultType === 'dataUrl' ||
|
|
97
|
+
if (options.resultType === 'dataUrl' ||
|
|
98
|
+
options.resultType === 'base64') {
|
|
97
99
|
const reader = new FileReader();
|
|
98
100
|
reader.addEventListener('load', () => {
|
|
99
101
|
if (options.resultType === 'dataUrl') {
|
|
@@ -128,7 +130,8 @@ export class CameraWeb extends WebPlugin {
|
|
|
128
130
|
}
|
|
129
131
|
input.accept = 'image/*';
|
|
130
132
|
input.capture = true;
|
|
131
|
-
if (options.source === CameraSource.Photos ||
|
|
133
|
+
if (options.source === CameraSource.Photos ||
|
|
134
|
+
options.source === CameraSource.Prompt) {
|
|
132
135
|
input.removeAttribute('capture');
|
|
133
136
|
}
|
|
134
137
|
else if (options.direction === CameraDirection.Front) {
|
|
@@ -210,7 +213,7 @@ export class CameraWeb extends WebPlugin {
|
|
|
210
213
|
});
|
|
211
214
|
}
|
|
212
215
|
};
|
|
213
|
-
reader.onerror =
|
|
216
|
+
reader.onerror = e => {
|
|
214
217
|
reject(e);
|
|
215
218
|
};
|
|
216
219
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAU9D,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,QAAQ,CAAC,OA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,yBAAyB,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,uBAAuB;QAC3B,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACpD,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { WebPlugin, CapacitorException } from '@capacitor/core';\n\nimport { CameraSource, CameraDirection } from './definitions';\nimport type {\n CameraPlugin,\n GalleryImageOptions,\n GalleryPhotos,\n ImageOptions,\n PermissionStatus,\n Photo,\n} from './definitions';\n\nexport class CameraWeb extends WebPlugin implements CameraPlugin {\n async getPhoto(options: ImageOptions): Promise<Photo> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<Photo>(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n } else if (options.source === CameraSource.Prompt) {\n let actionSheet: any = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e: any) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n\n async pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<GalleryPhotos>(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n\n private async cameraExperience(options: ImageOptions, resolve: any, reject: any) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal: any = document.createElement('pwa-camera-modal');\n cameraModal.facingMode = options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e: any) => {\n const photo = e.detail;\n\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n } else if (photo instanceof Error) {\n reject(photo);\n } else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n\n cameraModal.present();\n } catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n } else {\n console.error(\n `Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`,\n );\n this.fileInputExperience(options, resolve, reject);\n }\n }\n\n private fileInputExperience(options: ImageOptions, resolve: any, reject: any) {\n let input = document.querySelector('#_capacitor-camera-input') as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const file = input.files![0];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n\n if (options.resultType === 'dataUrl' || options.resultType === 'base64') {\n const reader = new FileReader();\n\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n } as Photo);\n } else if (options.resultType === 'base64') {\n const b64 = (reader.result as string).split(',')[1];\n resolve({\n base64String: b64,\n format,\n } as Photo);\n }\n\n cleanup();\n });\n\n reader.readAsDataURL(file);\n } else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n (input as any).capture = true;\n\n if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n } else if (options.direction === CameraDirection.Front) {\n (input as any).capture = 'user';\n } else if (options.direction === CameraDirection.Rear) {\n (input as any).capture = 'environment';\n }\n\n input.click();\n }\n\n private multipleFileInputExperience(resolve: any, reject: any) {\n let input = document.querySelector('#_capacitor-camera-input-multiple') as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files!.length; i++) {\n const file = input.files![i];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n\n input.click();\n }\n\n private _getCameraPhoto(photo: Blob, options: ImageOptions) {\n return new Promise<Photo>((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n } else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result as string;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n } else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = (e) => {\n reject(e);\n };\n }\n });\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n } catch {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async pickLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n\n async getLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n}\n\nconst Camera = new CameraWeb();\n\nexport { Camera };\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAU9D,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,QAAQ,CAAC,OAAqB;QAClC,qDAAqD;QACrD,OAAO,IAAI,OAAO,CAAQ,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC;gBAClE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC;iBAAM,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC;gBAClD,IAAI,WAAW,GAAQ,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBAClE,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;oBACz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AAC;IACpD,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { WebPlugin, CapacitorException } from '@capacitor/core';\n\nimport { CameraSource, CameraDirection } from './definitions';\nimport type {\n CameraPlugin,\n GalleryImageOptions,\n GalleryPhotos,\n ImageOptions,\n PermissionStatus,\n Photo,\n} from './definitions';\n\nexport class CameraWeb extends WebPlugin implements CameraPlugin {\n async getPhoto(options: ImageOptions): Promise<Photo> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<Photo>(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n } else if (options.source === CameraSource.Prompt) {\n let actionSheet: any = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e: any) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n\n async pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<GalleryPhotos>(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n\n private async cameraExperience(\n options: ImageOptions,\n resolve: any,\n reject: any,\n ) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal: any = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e: any) => {\n const photo = e.detail;\n\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n } else if (photo instanceof Error) {\n reject(photo);\n } else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n\n cameraModal.present();\n } catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n } else {\n console.error(\n `Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`,\n );\n this.fileInputExperience(options, resolve, reject);\n }\n }\n\n private fileInputExperience(\n options: ImageOptions,\n resolve: any,\n reject: any,\n ) {\n let input = document.querySelector(\n '#_capacitor-camera-input',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const file = input.files![0];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n\n if (\n options.resultType === 'dataUrl' ||\n options.resultType === 'base64'\n ) {\n const reader = new FileReader();\n\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n } as Photo);\n } else if (options.resultType === 'base64') {\n const b64 = (reader.result as string).split(',')[1];\n resolve({\n base64String: b64,\n format,\n } as Photo);\n }\n\n cleanup();\n });\n\n reader.readAsDataURL(file);\n } else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n (input as any).capture = true;\n\n if (\n options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt\n ) {\n input.removeAttribute('capture');\n } else if (options.direction === CameraDirection.Front) {\n (input as any).capture = 'user';\n } else if (options.direction === CameraDirection.Rear) {\n (input as any).capture = 'environment';\n }\n\n input.click();\n }\n\n private multipleFileInputExperience(resolve: any, reject: any) {\n let input = document.querySelector(\n '#_capacitor-camera-input-multiple',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files!.length; i++) {\n const file = input.files![i];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n\n input.click();\n }\n\n private _getCameraPhoto(photo: Blob, options: ImageOptions) {\n return new Promise<Photo>((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n } else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result as string;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n } else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n } catch {\n throw this.unavailable(\n 'Camera permissions are not available in this browser',\n );\n }\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async pickLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n\n async getLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n}\n\nconst Camera = new CameraWeb();\n\nexport { Camera };\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -72,7 +72,8 @@ class CameraWeb extends core.WebPlugin {
|
|
|
72
72
|
async cameraExperience(options, resolve, reject) {
|
|
73
73
|
if (customElements.get('pwa-camera-modal')) {
|
|
74
74
|
const cameraModal = document.createElement('pwa-camera-modal');
|
|
75
|
-
cameraModal.facingMode =
|
|
75
|
+
cameraModal.facingMode =
|
|
76
|
+
options.direction === exports.CameraDirection.Front ? 'user' : 'environment';
|
|
76
77
|
document.body.appendChild(cameraModal);
|
|
77
78
|
try {
|
|
78
79
|
await cameraModal.componentOnReady();
|
|
@@ -122,7 +123,8 @@ class CameraWeb extends core.WebPlugin {
|
|
|
122
123
|
else if (file.type === 'image/gif') {
|
|
123
124
|
format = 'gif';
|
|
124
125
|
}
|
|
125
|
-
if (options.resultType === 'dataUrl' ||
|
|
126
|
+
if (options.resultType === 'dataUrl' ||
|
|
127
|
+
options.resultType === 'base64') {
|
|
126
128
|
const reader = new FileReader();
|
|
127
129
|
reader.addEventListener('load', () => {
|
|
128
130
|
if (options.resultType === 'dataUrl') {
|
|
@@ -157,7 +159,8 @@ class CameraWeb extends core.WebPlugin {
|
|
|
157
159
|
}
|
|
158
160
|
input.accept = 'image/*';
|
|
159
161
|
input.capture = true;
|
|
160
|
-
if (options.source === exports.CameraSource.Photos ||
|
|
162
|
+
if (options.source === exports.CameraSource.Photos ||
|
|
163
|
+
options.source === exports.CameraSource.Prompt) {
|
|
161
164
|
input.removeAttribute('capture');
|
|
162
165
|
}
|
|
163
166
|
else if (options.direction === exports.CameraDirection.Front) {
|
|
@@ -239,7 +242,7 @@ class CameraWeb extends core.WebPlugin {
|
|
|
239
242
|
});
|
|
240
243
|
}
|
|
241
244
|
};
|
|
242
|
-
reader.onerror =
|
|
245
|
+
reader.onerror = e => {
|
|
243
246
|
reject(e);
|
|
244
247
|
};
|
|
245
248
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode = options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' || options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = (e) => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACrC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,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AAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;AACxE,gBAAgB,IAAI,EAAE,QAAQ;AAC9B,aAAa,CAAC;AACd,YAAY,OAAO;AACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;AACxC,gBAAgB,MAAM,EAAE,SAAS;AACjC,aAAa;AACb,QAAQ;AACR,QAAQ,OAAO,EAAE,EAAE;AACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC;AAC1F,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,wBAAwB,GAAG;AACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;AACzD,IAAI;AACJ,IAAI,MAAM,uBAAuB,GAAG;AACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;AACzD,IAAI;AACJ;AACe,IAAI,SAAS;;ACtPvB,MAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,IAAI,SAAS,EAAE;AAC9B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACrC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACrC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACrC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;AACpC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;AACX,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,KAAK;AACnC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACzC,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACvBxC,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B;AACA,QAAQ,OAAO,IAAI,OAAO,CAAC,OAAO,OAAO,EAAE,MAAM,KAAK;AACtD,YAAY,IAAI,OAAO,CAAC,WAAW,IAAI,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B,CAAC;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -71,7 +71,8 @@ var capacitorCamera = (function (exports, core) {
|
|
|
71
71
|
async cameraExperience(options, resolve, reject) {
|
|
72
72
|
if (customElements.get('pwa-camera-modal')) {
|
|
73
73
|
const cameraModal = document.createElement('pwa-camera-modal');
|
|
74
|
-
cameraModal.facingMode =
|
|
74
|
+
cameraModal.facingMode =
|
|
75
|
+
options.direction === exports.CameraDirection.Front ? 'user' : 'environment';
|
|
75
76
|
document.body.appendChild(cameraModal);
|
|
76
77
|
try {
|
|
77
78
|
await cameraModal.componentOnReady();
|
|
@@ -121,7 +122,8 @@ var capacitorCamera = (function (exports, core) {
|
|
|
121
122
|
else if (file.type === 'image/gif') {
|
|
122
123
|
format = 'gif';
|
|
123
124
|
}
|
|
124
|
-
if (options.resultType === 'dataUrl' ||
|
|
125
|
+
if (options.resultType === 'dataUrl' ||
|
|
126
|
+
options.resultType === 'base64') {
|
|
125
127
|
const reader = new FileReader();
|
|
126
128
|
reader.addEventListener('load', () => {
|
|
127
129
|
if (options.resultType === 'dataUrl') {
|
|
@@ -156,7 +158,8 @@ var capacitorCamera = (function (exports, core) {
|
|
|
156
158
|
}
|
|
157
159
|
input.accept = 'image/*';
|
|
158
160
|
input.capture = true;
|
|
159
|
-
if (options.source === exports.CameraSource.Photos ||
|
|
161
|
+
if (options.source === exports.CameraSource.Photos ||
|
|
162
|
+
options.source === exports.CameraSource.Prompt) {
|
|
160
163
|
input.removeAttribute('capture');
|
|
161
164
|
}
|
|
162
165
|
else if (options.direction === exports.CameraDirection.Front) {
|
|
@@ -238,7 +241,7 @@ var capacitorCamera = (function (exports, core) {
|
|
|
238
241
|
});
|
|
239
242
|
}
|
|
240
243
|
};
|
|
241
|
-
reader.onerror =
|
|
244
|
+
reader.onerror = e => {
|
|
242
245
|
reject(e);
|
|
243
246
|
};
|
|
244
247
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode = options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' || options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = (e) => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;IACpC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B,IAAI,gBAAgB,C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I,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ;IACe,IAAI,SAAS;;ACtPvB,UAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,IAAI,SAAS,EAAE;IAC9B,CAAC;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,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,IAAI;IACZ;IACA;IACA;IACA,YAAY,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;IACxE,gBAAgB,IAAI,EAAE,QAAQ;IAC9B,aAAa,CAAC;IACd,YAAY,OAAO;IACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;IACxC,gBAAgB,MAAM,EAAE,SAAS;IACjC,aAAa;IACb,QAAQ;IACR,QAAQ,OAAO,EAAE,EAAE;IACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC;IAC1F,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ;IACe,IAAI,SAAS;;ACzPvB,UAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,IAAI,SAAS,EAAE;IAC9B,CAAC;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/camera",
|
|
3
|
-
"version": "8.0.0-dev-
|
|
3
|
+
"version": "8.0.0-dev-2440-20251112T200158.0",
|
|
4
4
|
"description": "The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
38
38
|
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
39
39
|
"eslint": "eslint . --ext ts",
|
|
40
|
-
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"
|
|
40
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
41
41
|
"swiftlint": "node-swiftlint",
|
|
42
42
|
"docgen": "docgen --api CameraPlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
43
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@capacitor/android": "next",
|
|
51
51
|
"@capacitor/core": "next",
|
|
52
|
-
"@capacitor/docgen": "0.
|
|
52
|
+
"@capacitor/docgen": "0.3.0",
|
|
53
53
|
"@capacitor/ios": "next",
|
|
54
54
|
"@ionic/eslint-config": "^0.4.0",
|
|
55
|
-
"@ionic/prettier-config": "
|
|
56
|
-
"@ionic/swiftlint-config": "^
|
|
57
|
-
"eslint": "^8.57.
|
|
58
|
-
"prettier": "
|
|
59
|
-
"prettier-plugin-java": "
|
|
60
|
-
"rimraf": "^6.0
|
|
61
|
-
"rollup": "^4.
|
|
62
|
-
"swiftlint": "^
|
|
63
|
-
"typescript": "
|
|
55
|
+
"@ionic/prettier-config": "~1.0.1",
|
|
56
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
57
|
+
"eslint": "^8.57.1",
|
|
58
|
+
"prettier": "~2.3.0",
|
|
59
|
+
"prettier-plugin-java": "~1.0.2",
|
|
60
|
+
"rimraf": "^6.1.0",
|
|
61
|
+
"rollup": "^4.53.2",
|
|
62
|
+
"swiftlint": "^2.0.0",
|
|
63
|
+
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@capacitor/core": "next"
|