init
This commit is contained in:
804
node_modules/@capacitor/camera/dist/docs.json
generated
vendored
Normal file
804
node_modules/@capacitor/camera/dist/docs.json
generated
vendored
Normal file
@@ -0,0 +1,804 @@
|
||||
{
|
||||
"api": {
|
||||
"name": "CameraPlugin",
|
||||
"slug": "cameraplugin",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [
|
||||
{
|
||||
"name": "getPhoto",
|
||||
"signature": "(options: ImageOptions) => Promise<Photo>",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "options",
|
||||
"docs": "",
|
||||
"type": "ImageOptions"
|
||||
}
|
||||
],
|
||||
"returns": "Promise<Photo>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.0.0"
|
||||
}
|
||||
],
|
||||
"docs": "Prompt the user to pick a photo from an album, or take a new photo\nwith the camera.",
|
||||
"complexTypes": [
|
||||
"Photo",
|
||||
"ImageOptions"
|
||||
],
|
||||
"slug": "getphoto"
|
||||
},
|
||||
{
|
||||
"name": "pickImages",
|
||||
"signature": "(options: GalleryImageOptions) => Promise<GalleryPhotos>",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "options",
|
||||
"docs": "",
|
||||
"type": "GalleryImageOptions"
|
||||
}
|
||||
],
|
||||
"returns": "Promise<GalleryPhotos>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.2.0"
|
||||
}
|
||||
],
|
||||
"docs": "Allows the user to pick multiple pictures from the photo gallery.\nOn iOS 13 and older it only allows to pick one picture.",
|
||||
"complexTypes": [
|
||||
"GalleryPhotos",
|
||||
"GalleryImageOptions"
|
||||
],
|
||||
"slug": "pickimages"
|
||||
},
|
||||
{
|
||||
"name": "pickLimitedLibraryPhotos",
|
||||
"signature": "() => Promise<GalleryPhotos>",
|
||||
"parameters": [],
|
||||
"returns": "Promise<GalleryPhotos>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "4.1.0"
|
||||
}
|
||||
],
|
||||
"docs": "iOS 14+ Only: Allows the user to update their limited photo library selection.\nOn iOS 15+ returns all the limited photos after the picker dismissal.\nOn iOS 14 or if the user gave full access to the photos it returns an empty array.",
|
||||
"complexTypes": [
|
||||
"GalleryPhotos"
|
||||
],
|
||||
"slug": "picklimitedlibraryphotos"
|
||||
},
|
||||
{
|
||||
"name": "getLimitedLibraryPhotos",
|
||||
"signature": "() => Promise<GalleryPhotos>",
|
||||
"parameters": [],
|
||||
"returns": "Promise<GalleryPhotos>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "4.1.0"
|
||||
}
|
||||
],
|
||||
"docs": "iOS 14+ Only: Return an array of photos selected from the limited photo library.",
|
||||
"complexTypes": [
|
||||
"GalleryPhotos"
|
||||
],
|
||||
"slug": "getlimitedlibraryphotos"
|
||||
},
|
||||
{
|
||||
"name": "checkPermissions",
|
||||
"signature": "() => Promise<PermissionStatus>",
|
||||
"parameters": [],
|
||||
"returns": "Promise<PermissionStatus>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.0.0"
|
||||
}
|
||||
],
|
||||
"docs": "Check camera and photo album permissions",
|
||||
"complexTypes": [
|
||||
"PermissionStatus"
|
||||
],
|
||||
"slug": "checkpermissions"
|
||||
},
|
||||
{
|
||||
"name": "requestPermissions",
|
||||
"signature": "(permissions?: CameraPluginPermissions | undefined) => Promise<PermissionStatus>",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "permissions",
|
||||
"docs": "",
|
||||
"type": "CameraPluginPermissions | undefined"
|
||||
}
|
||||
],
|
||||
"returns": "Promise<PermissionStatus>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.0.0"
|
||||
}
|
||||
],
|
||||
"docs": "Request camera and photo album permissions",
|
||||
"complexTypes": [
|
||||
"PermissionStatus",
|
||||
"CameraPluginPermissions"
|
||||
],
|
||||
"slug": "requestpermissions"
|
||||
}
|
||||
],
|
||||
"properties": []
|
||||
},
|
||||
"interfaces": [
|
||||
{
|
||||
"name": "Photo",
|
||||
"slug": "photo",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "base64String",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The base64 encoded string representation of the image, if using CameraResultType.Base64.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "dataUrl",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n\nNote: On web, the file format could change depending on the browser.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "If using CameraResultType.Uri, the path will contain a full,\nplatform-specific file URL that can be read later using the Filesystem API.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "webPath",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "webPath returns a path that can be used to set the src attribute of an image for efficient\nloading and rendering.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "exif",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Exif data, if any, retrieved from the image",
|
||||
"complexTypes": [],
|
||||
"type": "any"
|
||||
},
|
||||
{
|
||||
"name": "format",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The format of the image, ex: jpeg, png, gif.\n\niOS and Android only support jpeg.\nWeb supports jpeg, png and gif, but the exact availability may vary depending on the browser.\ngif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.",
|
||||
"complexTypes": [],
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "saved",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.1.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether if the image was saved to the gallery or not.\n\nOn Android and iOS, saving to the gallery can fail if the user didn't\ngrant the required permissions.\nOn Web there is no gallery, so always returns false.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ImageOptions",
|
||||
"slug": "imageoptions",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "quality",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The quality of image to return as JPEG, from 0-100\nNote: This option is only supported on Android and iOS",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "allowEditing",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to allow the user to crop or make small edits (platform specific).\nOn iOS 14+ it's only supported for CameraSource.Camera, but not for CameraSource.Photos.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "resultType",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported",
|
||||
"complexTypes": [
|
||||
"CameraResultType"
|
||||
],
|
||||
"type": "CameraResultType"
|
||||
},
|
||||
{
|
||||
"name": "saveToGallery",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": false",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to save the photo to the gallery.\nIf the photo was picked from the gallery, it will only be saved if edited.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The desired maximum width of the saved image. The aspect ratio is respected.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The desired maximum height of the saved image. The aspect ratio is respected.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "correctOrientation",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": true",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to automatically rotate the image \"up\" to correct for orientation\nin portrait mode",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "source",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": CameraSource.Prompt",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The source to get the photo from. By default this prompts the user to select\neither the photo album or take a photo.",
|
||||
"complexTypes": [
|
||||
"CameraSource"
|
||||
],
|
||||
"type": "CameraSource"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": CameraDirection.Rear",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "iOS and Web only: The camera direction.",
|
||||
"complexTypes": [
|
||||
"CameraDirection"
|
||||
],
|
||||
"type": "CameraDirection"
|
||||
},
|
||||
{
|
||||
"name": "presentationStyle",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'fullscreen'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "iOS only: The presentation style of the Camera.",
|
||||
"complexTypes": [],
|
||||
"type": "'fullscreen' | 'popover' | undefined"
|
||||
},
|
||||
{
|
||||
"name": "webUseInput",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Web only: Whether to use the PWA Element experience or file input. The\ndefault is to use PWA Elements if installed and fall back to file input.\nTo always use file input, set this to `true`.\n\nLearn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "promptLabelHeader",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'Photo'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Text value to use when displaying the prompt.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "promptLabelCancel",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'Cancel'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Text value to use when displaying the prompt.\niOS only: The label of the 'cancel' button.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "promptLabelPhoto",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'From Photos'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Text value to use when displaying the prompt.\nThe label of the button to select a saved image.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "promptLabelPicture",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'Take Picture'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Text value to use when displaying the prompt.\nThe label of the button to open the camera.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GalleryPhotos",
|
||||
"slug": "galleryphotos",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "photos",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Array of all the picked photos.",
|
||||
"complexTypes": [
|
||||
"GalleryPhoto"
|
||||
],
|
||||
"type": "GalleryPhoto[]"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GalleryPhoto",
|
||||
"slug": "galleryphoto",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "path",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Full, platform-specific file URL that can be read later using the Filesystem API.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "webPath",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "webPath returns a path that can be used to set the src attribute of an image for efficient\nloading and rendering.",
|
||||
"complexTypes": [],
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "exif",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Exif data, if any, retrieved from the image",
|
||||
"complexTypes": [],
|
||||
"type": "any"
|
||||
},
|
||||
{
|
||||
"name": "format",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The format of the image, ex: jpeg, png, gif.\n\niOS and Android only support jpeg.\nWeb supports jpeg, png and gif.",
|
||||
"complexTypes": [],
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GalleryImageOptions",
|
||||
"slug": "galleryimageoptions",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "quality",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The quality of image to return as JPEG, from 0-100\nNote: This option is only supported on Android and iOS.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The desired maximum width of the saved image. The aspect ratio is respected.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "The desired maximum height of the saved image. The aspect ratio is respected.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "correctOrientation",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": true",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to automatically rotate the image \"up\" to correct for orientation\nin portrait mode",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "presentationStyle",
|
||||
"tags": [
|
||||
{
|
||||
"text": ": 'fullscreen'",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "iOS only: The presentation style of the Camera.",
|
||||
"complexTypes": [],
|
||||
"type": "'fullscreen' | 'popover' | undefined"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"tags": [
|
||||
{
|
||||
"text": "0 (unlimited)",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "1.2.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Maximum number of pictures the user will be able to choose.\nNote: This option is only supported on Android 13+ and iOS.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PermissionStatus",
|
||||
"slug": "permissionstatus",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "camera",
|
||||
"tags": [],
|
||||
"docs": "",
|
||||
"complexTypes": [
|
||||
"CameraPermissionState"
|
||||
],
|
||||
"type": "CameraPermissionState"
|
||||
},
|
||||
{
|
||||
"name": "photos",
|
||||
"tags": [],
|
||||
"docs": "",
|
||||
"complexTypes": [
|
||||
"CameraPermissionState"
|
||||
],
|
||||
"type": "CameraPermissionState"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CameraPluginPermissions",
|
||||
"slug": "camerapluginpermissions",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "permissions",
|
||||
"tags": [],
|
||||
"docs": "",
|
||||
"complexTypes": [
|
||||
"CameraPermissionType"
|
||||
],
|
||||
"type": "CameraPermissionType[]"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"enums": [
|
||||
{
|
||||
"name": "CameraResultType",
|
||||
"slug": "cameraresulttype",
|
||||
"members": [
|
||||
{
|
||||
"name": "Uri",
|
||||
"value": "'uri'",
|
||||
"tags": [],
|
||||
"docs": ""
|
||||
},
|
||||
{
|
||||
"name": "Base64",
|
||||
"value": "'base64'",
|
||||
"tags": [],
|
||||
"docs": ""
|
||||
},
|
||||
{
|
||||
"name": "DataUrl",
|
||||
"value": "'dataUrl'",
|
||||
"tags": [],
|
||||
"docs": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CameraSource",
|
||||
"slug": "camerasource",
|
||||
"members": [
|
||||
{
|
||||
"name": "Prompt",
|
||||
"value": "'PROMPT'",
|
||||
"tags": [],
|
||||
"docs": "Prompts the user to select either the photo album or take a photo."
|
||||
},
|
||||
{
|
||||
"name": "Camera",
|
||||
"value": "'CAMERA'",
|
||||
"tags": [],
|
||||
"docs": "Take a new photo using the camera."
|
||||
},
|
||||
{
|
||||
"name": "Photos",
|
||||
"value": "'PHOTOS'",
|
||||
"tags": [],
|
||||
"docs": "Pick an existing photo from the gallery or photo album."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CameraDirection",
|
||||
"slug": "cameradirection",
|
||||
"members": [
|
||||
{
|
||||
"name": "Rear",
|
||||
"value": "'REAR'",
|
||||
"tags": [],
|
||||
"docs": ""
|
||||
},
|
||||
{
|
||||
"name": "Front",
|
||||
"value": "'FRONT'",
|
||||
"tags": [],
|
||||
"docs": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"typeAliases": [
|
||||
{
|
||||
"name": "CameraPermissionState",
|
||||
"slug": "camerapermissionstate",
|
||||
"docs": "",
|
||||
"types": [
|
||||
{
|
||||
"text": "PermissionState",
|
||||
"complexTypes": [
|
||||
"PermissionState"
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "'limited'",
|
||||
"complexTypes": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PermissionState",
|
||||
"slug": "permissionstate",
|
||||
"docs": "",
|
||||
"types": [
|
||||
{
|
||||
"text": "'prompt'",
|
||||
"complexTypes": []
|
||||
},
|
||||
{
|
||||
"text": "'prompt-with-rationale'",
|
||||
"complexTypes": []
|
||||
},
|
||||
{
|
||||
"text": "'granted'",
|
||||
"complexTypes": []
|
||||
},
|
||||
{
|
||||
"text": "'denied'",
|
||||
"complexTypes": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CameraPermissionType",
|
||||
"slug": "camerapermissiontype",
|
||||
"docs": "",
|
||||
"types": [
|
||||
{
|
||||
"text": "'camera'",
|
||||
"complexTypes": []
|
||||
},
|
||||
{
|
||||
"text": "'photos'",
|
||||
"complexTypes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"pluginConfigs": []
|
||||
}
|
||||
337
node_modules/@capacitor/camera/dist/esm/definitions.d.ts
generated
vendored
Normal file
337
node_modules/@capacitor/camera/dist/esm/definitions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,337 @@
|
||||
import type { PermissionState } from '@capacitor/core';
|
||||
export declare type CameraPermissionState = PermissionState | 'limited';
|
||||
export declare type CameraPermissionType = 'camera' | 'photos';
|
||||
export interface PermissionStatus {
|
||||
camera: CameraPermissionState;
|
||||
photos: CameraPermissionState;
|
||||
}
|
||||
export interface CameraPluginPermissions {
|
||||
permissions: CameraPermissionType[];
|
||||
}
|
||||
export interface CameraPlugin {
|
||||
/**
|
||||
* Prompt the user to pick a photo from an album, or take a new photo
|
||||
* with the camera.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
getPhoto(options: ImageOptions): Promise<Photo>;
|
||||
/**
|
||||
* Allows the user to pick multiple pictures from the photo gallery.
|
||||
* On iOS 13 and older it only allows to pick one picture.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;
|
||||
/**
|
||||
* iOS 14+ Only: Allows the user to update their limited photo library selection.
|
||||
* On iOS 15+ returns all the limited photos after the picker dismissal.
|
||||
* On iOS 14 or if the user gave full access to the photos it returns an empty array.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;
|
||||
/**
|
||||
* iOS 14+ Only: Return an array of photos selected from the limited photo library.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
getLimitedLibraryPhotos(): Promise<GalleryPhotos>;
|
||||
/**
|
||||
* Check camera and photo album permissions
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
/**
|
||||
* Request camera and photo album permissions
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
requestPermissions(permissions?: CameraPluginPermissions): Promise<PermissionStatus>;
|
||||
}
|
||||
export interface ImageOptions {
|
||||
/**
|
||||
* The quality of image to return as JPEG, from 0-100
|
||||
* Note: This option is only supported on Android and iOS
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
quality?: number;
|
||||
/**
|
||||
* Whether to allow the user to crop or make small edits (platform specific).
|
||||
* On iOS 14+ it's only supported for CameraSource.Camera, but not for CameraSource.Photos.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
allowEditing?: boolean;
|
||||
/**
|
||||
* How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
resultType: CameraResultType;
|
||||
/**
|
||||
* Whether to save the photo to the gallery.
|
||||
* If the photo was picked from the gallery, it will only be saved if edited.
|
||||
* @default: false
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
saveToGallery?: boolean;
|
||||
/**
|
||||
* The desired maximum width of the saved image. The aspect ratio is respected.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* The desired maximum height of the saved image. The aspect ratio is respected.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* Whether to automatically rotate the image "up" to correct for orientation
|
||||
* in portrait mode
|
||||
* @default: true
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
correctOrientation?: boolean;
|
||||
/**
|
||||
* The source to get the photo from. By default this prompts the user to select
|
||||
* either the photo album or take a photo.
|
||||
* @default: CameraSource.Prompt
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
source?: CameraSource;
|
||||
/**
|
||||
* iOS and Web only: The camera direction.
|
||||
* @default: CameraDirection.Rear
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
direction?: CameraDirection;
|
||||
/**
|
||||
* iOS only: The presentation style of the Camera.
|
||||
* @default: 'fullscreen'
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
presentationStyle?: 'fullscreen' | 'popover';
|
||||
/**
|
||||
* Web only: Whether to use the PWA Element experience or file input. The
|
||||
* default is to use PWA Elements if installed and fall back to file input.
|
||||
* To always use file input, set this to `true`.
|
||||
*
|
||||
* Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
webUseInput?: boolean;
|
||||
/**
|
||||
* Text value to use when displaying the prompt.
|
||||
* @default: 'Photo'
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
promptLabelHeader?: string;
|
||||
/**
|
||||
* Text value to use when displaying the prompt.
|
||||
* iOS only: The label of the 'cancel' button.
|
||||
* @default: 'Cancel'
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
promptLabelCancel?: string;
|
||||
/**
|
||||
* Text value to use when displaying the prompt.
|
||||
* The label of the button to select a saved image.
|
||||
* @default: 'From Photos'
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
promptLabelPhoto?: string;
|
||||
/**
|
||||
* Text value to use when displaying the prompt.
|
||||
* The label of the button to open the camera.
|
||||
* @default: 'Take Picture'
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
promptLabelPicture?: string;
|
||||
}
|
||||
export interface Photo {
|
||||
/**
|
||||
* The base64 encoded string representation of the image, if using CameraResultType.Base64.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
base64String?: string;
|
||||
/**
|
||||
* The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.
|
||||
*
|
||||
* Note: On web, the file format could change depending on the browser.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
dataUrl?: string;
|
||||
/**
|
||||
* If using CameraResultType.Uri, the path will contain a full,
|
||||
* platform-specific file URL that can be read later using the Filesystem API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* webPath returns a path that can be used to set the src attribute of an image for efficient
|
||||
* loading and rendering.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
webPath?: string;
|
||||
/**
|
||||
* Exif data, if any, retrieved from the image
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exif?: any;
|
||||
/**
|
||||
* The format of the image, ex: jpeg, png, gif.
|
||||
*
|
||||
* iOS and Android only support jpeg.
|
||||
* Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.
|
||||
* gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
format: string;
|
||||
/**
|
||||
* Whether if the image was saved to the gallery or not.
|
||||
*
|
||||
* On Android and iOS, saving to the gallery can fail if the user didn't
|
||||
* grant the required permissions.
|
||||
* On Web there is no gallery, so always returns false.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
saved: boolean;
|
||||
}
|
||||
export interface GalleryPhotos {
|
||||
/**
|
||||
* Array of all the picked photos.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
photos: GalleryPhoto[];
|
||||
}
|
||||
export interface GalleryPhoto {
|
||||
/**
|
||||
* Full, platform-specific file URL that can be read later using the Filesystem API.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* webPath returns a path that can be used to set the src attribute of an image for efficient
|
||||
* loading and rendering.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
webPath: string;
|
||||
/**
|
||||
* Exif data, if any, retrieved from the image
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
exif?: any;
|
||||
/**
|
||||
* The format of the image, ex: jpeg, png, gif.
|
||||
*
|
||||
* iOS and Android only support jpeg.
|
||||
* Web supports jpeg, png and gif.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
format: string;
|
||||
}
|
||||
export interface GalleryImageOptions {
|
||||
/**
|
||||
* The quality of image to return as JPEG, from 0-100
|
||||
* Note: This option is only supported on Android and iOS.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
quality?: number;
|
||||
/**
|
||||
* The desired maximum width of the saved image. The aspect ratio is respected.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* The desired maximum height of the saved image. The aspect ratio is respected.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* Whether to automatically rotate the image "up" to correct for orientation
|
||||
* in portrait mode
|
||||
* @default: true
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
correctOrientation?: boolean;
|
||||
/**
|
||||
* iOS only: The presentation style of the Camera.
|
||||
* @default: 'fullscreen'
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
presentationStyle?: 'fullscreen' | 'popover';
|
||||
/**
|
||||
* Maximum number of pictures the user will be able to choose.
|
||||
* Note: This option is only supported on Android 13+ and iOS.
|
||||
*
|
||||
* @default 0 (unlimited)
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
limit?: number;
|
||||
}
|
||||
export declare enum CameraSource {
|
||||
/**
|
||||
* Prompts the user to select either the photo album or take a photo.
|
||||
*/
|
||||
Prompt = "PROMPT",
|
||||
/**
|
||||
* Take a new photo using the camera.
|
||||
*/
|
||||
Camera = "CAMERA",
|
||||
/**
|
||||
* Pick an existing photo from the gallery or photo album.
|
||||
*/
|
||||
Photos = "PHOTOS"
|
||||
}
|
||||
export declare enum CameraDirection {
|
||||
Rear = "REAR",
|
||||
Front = "FRONT"
|
||||
}
|
||||
export declare enum CameraResultType {
|
||||
Uri = "uri",
|
||||
Base64 = "base64",
|
||||
DataUrl = "dataUrl"
|
||||
}
|
||||
/**
|
||||
* @deprecated Use `Photo`.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export declare type CameraPhoto = Photo;
|
||||
/**
|
||||
* @deprecated Use `ImageOptions`.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export declare type CameraOptions = ImageOptions;
|
||||
27
node_modules/@capacitor/camera/dist/esm/definitions.js
generated
vendored
Normal file
27
node_modules/@capacitor/camera/dist/esm/definitions.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export var CameraSource;
|
||||
(function (CameraSource) {
|
||||
/**
|
||||
* Prompts the user to select either the photo album or take a photo.
|
||||
*/
|
||||
CameraSource["Prompt"] = "PROMPT";
|
||||
/**
|
||||
* Take a new photo using the camera.
|
||||
*/
|
||||
CameraSource["Camera"] = "CAMERA";
|
||||
/**
|
||||
* Pick an existing photo from the gallery or photo album.
|
||||
*/
|
||||
CameraSource["Photos"] = "PHOTOS";
|
||||
})(CameraSource || (CameraSource = {}));
|
||||
export var CameraDirection;
|
||||
(function (CameraDirection) {
|
||||
CameraDirection["Rear"] = "REAR";
|
||||
CameraDirection["Front"] = "FRONT";
|
||||
})(CameraDirection || (CameraDirection = {}));
|
||||
export var CameraResultType;
|
||||
(function (CameraResultType) {
|
||||
CameraResultType["Uri"] = "uri";
|
||||
CameraResultType["Base64"] = "base64";
|
||||
CameraResultType["DataUrl"] = "dataUrl";
|
||||
})(CameraResultType || (CameraResultType = {}));
|
||||
//# sourceMappingURL=definitions.js.map
|
||||
1
node_modules/@capacitor/camera/dist/esm/definitions.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/camera/dist/esm/definitions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/@capacitor/camera/dist/esm/index.d.ts
generated
vendored
Normal file
4
node_modules/@capacitor/camera/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { CameraPlugin } from './definitions';
|
||||
declare const Camera: CameraPlugin;
|
||||
export * from './definitions';
|
||||
export { Camera };
|
||||
8
node_modules/@capacitor/camera/dist/esm/index.js
generated
vendored
Normal file
8
node_modules/@capacitor/camera/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
import { CameraWeb } from './web';
|
||||
const Camera = registerPlugin('Camera', {
|
||||
web: () => new CameraWeb(),
|
||||
});
|
||||
export * from './definitions';
|
||||
export { Camera };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@capacitor/camera/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/camera/dist/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,GAAG,cAAc,CAAe,QAAQ,EAAE;IACpD,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,SAAS,EAAE;CAC3B,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CameraPlugin } from './definitions';\nimport { CameraWeb } from './web';\n\nconst Camera = registerPlugin<CameraPlugin>('Camera', {\n web: () => new CameraWeb(),\n});\n\nexport * from './definitions';\nexport { Camera };\n"]}
|
||||
16
node_modules/@capacitor/camera/dist/esm/web.d.ts
generated
vendored
Normal file
16
node_modules/@capacitor/camera/dist/esm/web.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
import type { CameraPlugin, GalleryImageOptions, GalleryPhotos, ImageOptions, PermissionStatus, Photo } from './definitions';
|
||||
export declare class CameraWeb extends WebPlugin implements CameraPlugin {
|
||||
getPhoto(options: ImageOptions): Promise<Photo>;
|
||||
pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos>;
|
||||
private cameraExperience;
|
||||
private fileInputExperience;
|
||||
private multipleFileInputExperience;
|
||||
private _getCameraPhoto;
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
requestPermissions(): Promise<PermissionStatus>;
|
||||
pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;
|
||||
getLimitedLibraryPhotos(): Promise<GalleryPhotos>;
|
||||
}
|
||||
declare const Camera: CameraWeb;
|
||||
export { Camera };
|
||||
254
node_modules/@capacitor/camera/dist/esm/web.js
generated
vendored
Normal file
254
node_modules/@capacitor/camera/dist/esm/web.js
generated
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
import { WebPlugin, CapacitorException } from '@capacitor/core';
|
||||
import { CameraSource, CameraDirection } from './definitions';
|
||||
export class CameraWeb extends WebPlugin {
|
||||
async getPhoto(options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (options.webUseInput || options.source === CameraSource.Photos) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else if (options.source === CameraSource.Prompt) {
|
||||
let actionSheet = document.querySelector('pwa-action-sheet');
|
||||
if (!actionSheet) {
|
||||
actionSheet = document.createElement('pwa-action-sheet');
|
||||
document.body.appendChild(actionSheet);
|
||||
}
|
||||
actionSheet.header = options.promptLabelHeader || 'Photo';
|
||||
actionSheet.cancelable = false;
|
||||
actionSheet.options = [
|
||||
{ title: options.promptLabelPhoto || 'From Photos' },
|
||||
{ title: options.promptLabelPicture || 'Take Picture' },
|
||||
];
|
||||
actionSheet.addEventListener('onSelection', async (e) => {
|
||||
const selection = e.detail;
|
||||
if (selection === 0) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
async pickImages(_options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.multipleFileInputExperience(resolve, reject);
|
||||
});
|
||||
}
|
||||
async cameraExperience(options, resolve, reject) {
|
||||
if (customElements.get('pwa-camera-modal')) {
|
||||
const cameraModal = document.createElement('pwa-camera-modal');
|
||||
cameraModal.facingMode =
|
||||
options.direction === CameraDirection.Front ? 'user' : 'environment';
|
||||
document.body.appendChild(cameraModal);
|
||||
try {
|
||||
await cameraModal.componentOnReady();
|
||||
cameraModal.addEventListener('onPhoto', async (e) => {
|
||||
const photo = e.detail;
|
||||
if (photo === null) {
|
||||
reject(new CapacitorException('User cancelled photos app'));
|
||||
}
|
||||
else if (photo instanceof Error) {
|
||||
reject(photo);
|
||||
}
|
||||
else {
|
||||
resolve(await this._getCameraPhoto(photo, options));
|
||||
}
|
||||
cameraModal.dismiss();
|
||||
document.body.removeChild(cameraModal);
|
||||
});
|
||||
cameraModal.present();
|
||||
}
|
||||
catch (e) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
fileInputExperience(options, resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const file = input.files[0];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
if (options.resultType === 'dataUrl' ||
|
||||
options.resultType === 'base64') {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', () => {
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: reader.result,
|
||||
format,
|
||||
});
|
||||
}
|
||||
else if (options.resultType === 'base64') {
|
||||
const b64 = reader.result.split(',')[1];
|
||||
resolve({
|
||||
base64String: b64,
|
||||
format,
|
||||
});
|
||||
}
|
||||
cleanup();
|
||||
});
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.capture = true;
|
||||
if (options.source === CameraSource.Photos ||
|
||||
options.source === CameraSource.Prompt) {
|
||||
input.removeAttribute('capture');
|
||||
}
|
||||
else if (options.direction === CameraDirection.Front) {
|
||||
input.capture = 'user';
|
||||
}
|
||||
else if (options.direction === CameraDirection.Rear) {
|
||||
input.capture = 'environment';
|
||||
}
|
||||
input.click();
|
||||
}
|
||||
multipleFileInputExperience(resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input-multiple');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input-multiple';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
input.multiple = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const photos = [];
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < input.files.length; i++) {
|
||||
const file = input.files[i];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
photos.push({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
}
|
||||
resolve({ photos });
|
||||
cleanup();
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.click();
|
||||
}
|
||||
_getCameraPhoto(photo, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
const format = photo.type.split('/')[1];
|
||||
if (options.resultType === 'uri') {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(photo),
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
reader.readAsDataURL(photo);
|
||||
reader.onloadend = () => {
|
||||
const r = reader.result;
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: r,
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
base64String: r.split(',')[1],
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
reader.onerror = e => {
|
||||
reject(e);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
async checkPermissions() {
|
||||
if (typeof navigator === 'undefined' || !navigator.permissions) {
|
||||
throw this.unavailable('Permissions API not available in this browser');
|
||||
}
|
||||
try {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query
|
||||
// the specific permissions that are supported varies among browsers that implement the
|
||||
// permissions API, so we need a try/catch in case 'camera' is invalid
|
||||
const permission = await window.navigator.permissions.query({
|
||||
name: 'camera',
|
||||
});
|
||||
return {
|
||||
camera: permission.state,
|
||||
photos: 'granted',
|
||||
};
|
||||
}
|
||||
catch (_a) {
|
||||
throw this.unavailable('Camera permissions are not available in this browser');
|
||||
}
|
||||
}
|
||||
async requestPermissions() {
|
||||
throw this.unimplemented('Not implemented on web.');
|
||||
}
|
||||
async pickLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
async getLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
}
|
||||
const Camera = new CameraWeb();
|
||||
export { Camera };
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
node_modules/@capacitor/camera/dist/esm/web.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/camera/dist/esm/web.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
288
node_modules/@capacitor/camera/dist/plugin.cjs.js
generated
vendored
Normal file
288
node_modules/@capacitor/camera/dist/plugin.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@capacitor/core');
|
||||
|
||||
exports.CameraSource = void 0;
|
||||
(function (CameraSource) {
|
||||
/**
|
||||
* Prompts the user to select either the photo album or take a photo.
|
||||
*/
|
||||
CameraSource["Prompt"] = "PROMPT";
|
||||
/**
|
||||
* Take a new photo using the camera.
|
||||
*/
|
||||
CameraSource["Camera"] = "CAMERA";
|
||||
/**
|
||||
* Pick an existing photo from the gallery or photo album.
|
||||
*/
|
||||
CameraSource["Photos"] = "PHOTOS";
|
||||
})(exports.CameraSource || (exports.CameraSource = {}));
|
||||
exports.CameraDirection = void 0;
|
||||
(function (CameraDirection) {
|
||||
CameraDirection["Rear"] = "REAR";
|
||||
CameraDirection["Front"] = "FRONT";
|
||||
})(exports.CameraDirection || (exports.CameraDirection = {}));
|
||||
exports.CameraResultType = void 0;
|
||||
(function (CameraResultType) {
|
||||
CameraResultType["Uri"] = "uri";
|
||||
CameraResultType["Base64"] = "base64";
|
||||
CameraResultType["DataUrl"] = "dataUrl";
|
||||
})(exports.CameraResultType || (exports.CameraResultType = {}));
|
||||
|
||||
class CameraWeb extends core.WebPlugin {
|
||||
async getPhoto(options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (options.webUseInput || options.source === exports.CameraSource.Photos) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else if (options.source === exports.CameraSource.Prompt) {
|
||||
let actionSheet = document.querySelector('pwa-action-sheet');
|
||||
if (!actionSheet) {
|
||||
actionSheet = document.createElement('pwa-action-sheet');
|
||||
document.body.appendChild(actionSheet);
|
||||
}
|
||||
actionSheet.header = options.promptLabelHeader || 'Photo';
|
||||
actionSheet.cancelable = false;
|
||||
actionSheet.options = [
|
||||
{ title: options.promptLabelPhoto || 'From Photos' },
|
||||
{ title: options.promptLabelPicture || 'Take Picture' },
|
||||
];
|
||||
actionSheet.addEventListener('onSelection', async (e) => {
|
||||
const selection = e.detail;
|
||||
if (selection === 0) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
async pickImages(_options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.multipleFileInputExperience(resolve, reject);
|
||||
});
|
||||
}
|
||||
async cameraExperience(options, resolve, reject) {
|
||||
if (customElements.get('pwa-camera-modal')) {
|
||||
const cameraModal = document.createElement('pwa-camera-modal');
|
||||
cameraModal.facingMode =
|
||||
options.direction === exports.CameraDirection.Front ? 'user' : 'environment';
|
||||
document.body.appendChild(cameraModal);
|
||||
try {
|
||||
await cameraModal.componentOnReady();
|
||||
cameraModal.addEventListener('onPhoto', async (e) => {
|
||||
const photo = e.detail;
|
||||
if (photo === null) {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
}
|
||||
else if (photo instanceof Error) {
|
||||
reject(photo);
|
||||
}
|
||||
else {
|
||||
resolve(await this._getCameraPhoto(photo, options));
|
||||
}
|
||||
cameraModal.dismiss();
|
||||
document.body.removeChild(cameraModal);
|
||||
});
|
||||
cameraModal.present();
|
||||
}
|
||||
catch (e) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
fileInputExperience(options, resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const file = input.files[0];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
if (options.resultType === 'dataUrl' ||
|
||||
options.resultType === 'base64') {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', () => {
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: reader.result,
|
||||
format,
|
||||
});
|
||||
}
|
||||
else if (options.resultType === 'base64') {
|
||||
const b64 = reader.result.split(',')[1];
|
||||
resolve({
|
||||
base64String: b64,
|
||||
format,
|
||||
});
|
||||
}
|
||||
cleanup();
|
||||
});
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.capture = true;
|
||||
if (options.source === exports.CameraSource.Photos ||
|
||||
options.source === exports.CameraSource.Prompt) {
|
||||
input.removeAttribute('capture');
|
||||
}
|
||||
else if (options.direction === exports.CameraDirection.Front) {
|
||||
input.capture = 'user';
|
||||
}
|
||||
else if (options.direction === exports.CameraDirection.Rear) {
|
||||
input.capture = 'environment';
|
||||
}
|
||||
input.click();
|
||||
}
|
||||
multipleFileInputExperience(resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input-multiple');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input-multiple';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
input.multiple = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const photos = [];
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < input.files.length; i++) {
|
||||
const file = input.files[i];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
photos.push({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
}
|
||||
resolve({ photos });
|
||||
cleanup();
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.click();
|
||||
}
|
||||
_getCameraPhoto(photo, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
const format = photo.type.split('/')[1];
|
||||
if (options.resultType === 'uri') {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(photo),
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
reader.readAsDataURL(photo);
|
||||
reader.onloadend = () => {
|
||||
const r = reader.result;
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: r,
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
base64String: r.split(',')[1],
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
reader.onerror = e => {
|
||||
reject(e);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
async checkPermissions() {
|
||||
if (typeof navigator === 'undefined' || !navigator.permissions) {
|
||||
throw this.unavailable('Permissions API not available in this browser');
|
||||
}
|
||||
try {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query
|
||||
// the specific permissions that are supported varies among browsers that implement the
|
||||
// permissions API, so we need a try/catch in case 'camera' is invalid
|
||||
const permission = await window.navigator.permissions.query({
|
||||
name: 'camera',
|
||||
});
|
||||
return {
|
||||
camera: permission.state,
|
||||
photos: 'granted',
|
||||
};
|
||||
}
|
||||
catch (_a) {
|
||||
throw this.unavailable('Camera permissions are not available in this browser');
|
||||
}
|
||||
}
|
||||
async requestPermissions() {
|
||||
throw this.unimplemented('Not implemented on web.');
|
||||
}
|
||||
async pickLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
async getLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
}
|
||||
new CameraWeb();
|
||||
|
||||
const Camera = core.registerPlugin('Camera', {
|
||||
web: () => new CameraWeb(),
|
||||
});
|
||||
|
||||
exports.Camera = Camera;
|
||||
//# sourceMappingURL=plugin.cjs.js.map
|
||||
1
node_modules/@capacitor/camera/dist/plugin.cjs.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/camera/dist/plugin.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
291
node_modules/@capacitor/camera/dist/plugin.js
generated
vendored
Normal file
291
node_modules/@capacitor/camera/dist/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
var capacitorCamera = (function (exports, core) {
|
||||
'use strict';
|
||||
|
||||
exports.CameraSource = void 0;
|
||||
(function (CameraSource) {
|
||||
/**
|
||||
* Prompts the user to select either the photo album or take a photo.
|
||||
*/
|
||||
CameraSource["Prompt"] = "PROMPT";
|
||||
/**
|
||||
* Take a new photo using the camera.
|
||||
*/
|
||||
CameraSource["Camera"] = "CAMERA";
|
||||
/**
|
||||
* Pick an existing photo from the gallery or photo album.
|
||||
*/
|
||||
CameraSource["Photos"] = "PHOTOS";
|
||||
})(exports.CameraSource || (exports.CameraSource = {}));
|
||||
exports.CameraDirection = void 0;
|
||||
(function (CameraDirection) {
|
||||
CameraDirection["Rear"] = "REAR";
|
||||
CameraDirection["Front"] = "FRONT";
|
||||
})(exports.CameraDirection || (exports.CameraDirection = {}));
|
||||
exports.CameraResultType = void 0;
|
||||
(function (CameraResultType) {
|
||||
CameraResultType["Uri"] = "uri";
|
||||
CameraResultType["Base64"] = "base64";
|
||||
CameraResultType["DataUrl"] = "dataUrl";
|
||||
})(exports.CameraResultType || (exports.CameraResultType = {}));
|
||||
|
||||
class CameraWeb extends core.WebPlugin {
|
||||
async getPhoto(options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (options.webUseInput || options.source === exports.CameraSource.Photos) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else if (options.source === exports.CameraSource.Prompt) {
|
||||
let actionSheet = document.querySelector('pwa-action-sheet');
|
||||
if (!actionSheet) {
|
||||
actionSheet = document.createElement('pwa-action-sheet');
|
||||
document.body.appendChild(actionSheet);
|
||||
}
|
||||
actionSheet.header = options.promptLabelHeader || 'Photo';
|
||||
actionSheet.cancelable = false;
|
||||
actionSheet.options = [
|
||||
{ title: options.promptLabelPhoto || 'From Photos' },
|
||||
{ title: options.promptLabelPicture || 'Take Picture' },
|
||||
];
|
||||
actionSheet.addEventListener('onSelection', async (e) => {
|
||||
const selection = e.detail;
|
||||
if (selection === 0) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.cameraExperience(options, resolve, reject);
|
||||
}
|
||||
});
|
||||
}
|
||||
async pickImages(_options) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.multipleFileInputExperience(resolve, reject);
|
||||
});
|
||||
}
|
||||
async cameraExperience(options, resolve, reject) {
|
||||
if (customElements.get('pwa-camera-modal')) {
|
||||
const cameraModal = document.createElement('pwa-camera-modal');
|
||||
cameraModal.facingMode =
|
||||
options.direction === exports.CameraDirection.Front ? 'user' : 'environment';
|
||||
document.body.appendChild(cameraModal);
|
||||
try {
|
||||
await cameraModal.componentOnReady();
|
||||
cameraModal.addEventListener('onPhoto', async (e) => {
|
||||
const photo = e.detail;
|
||||
if (photo === null) {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
}
|
||||
else if (photo instanceof Error) {
|
||||
reject(photo);
|
||||
}
|
||||
else {
|
||||
resolve(await this._getCameraPhoto(photo, options));
|
||||
}
|
||||
cameraModal.dismiss();
|
||||
document.body.removeChild(cameraModal);
|
||||
});
|
||||
cameraModal.present();
|
||||
}
|
||||
catch (e) {
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
|
||||
this.fileInputExperience(options, resolve, reject);
|
||||
}
|
||||
}
|
||||
fileInputExperience(options, resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const file = input.files[0];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
if (options.resultType === 'dataUrl' ||
|
||||
options.resultType === 'base64') {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', () => {
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: reader.result,
|
||||
format,
|
||||
});
|
||||
}
|
||||
else if (options.resultType === 'base64') {
|
||||
const b64 = reader.result.split(',')[1];
|
||||
resolve({
|
||||
base64String: b64,
|
||||
format,
|
||||
});
|
||||
}
|
||||
cleanup();
|
||||
});
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.capture = true;
|
||||
if (options.source === exports.CameraSource.Photos ||
|
||||
options.source === exports.CameraSource.Prompt) {
|
||||
input.removeAttribute('capture');
|
||||
}
|
||||
else if (options.direction === exports.CameraDirection.Front) {
|
||||
input.capture = 'user';
|
||||
}
|
||||
else if (options.direction === exports.CameraDirection.Rear) {
|
||||
input.capture = 'environment';
|
||||
}
|
||||
input.click();
|
||||
}
|
||||
multipleFileInputExperience(resolve, reject) {
|
||||
let input = document.querySelector('#_capacitor-camera-input-multiple');
|
||||
const cleanup = () => {
|
||||
var _a;
|
||||
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
|
||||
};
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.id = '_capacitor-camera-input-multiple';
|
||||
input.type = 'file';
|
||||
input.hidden = true;
|
||||
input.multiple = true;
|
||||
document.body.appendChild(input);
|
||||
input.addEventListener('change', (_e) => {
|
||||
const photos = [];
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < input.files.length; i++) {
|
||||
const file = input.files[i];
|
||||
let format = 'jpeg';
|
||||
if (file.type === 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
else if (file.type === 'image/gif') {
|
||||
format = 'gif';
|
||||
}
|
||||
photos.push({
|
||||
webPath: URL.createObjectURL(file),
|
||||
format: format,
|
||||
});
|
||||
}
|
||||
resolve({ photos });
|
||||
cleanup();
|
||||
});
|
||||
input.addEventListener('cancel', (_e) => {
|
||||
reject(new core.CapacitorException('User cancelled photos app'));
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
input.accept = 'image/*';
|
||||
input.click();
|
||||
}
|
||||
_getCameraPhoto(photo, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
const format = photo.type.split('/')[1];
|
||||
if (options.resultType === 'uri') {
|
||||
resolve({
|
||||
webPath: URL.createObjectURL(photo),
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
reader.readAsDataURL(photo);
|
||||
reader.onloadend = () => {
|
||||
const r = reader.result;
|
||||
if (options.resultType === 'dataUrl') {
|
||||
resolve({
|
||||
dataUrl: r,
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
else {
|
||||
resolve({
|
||||
base64String: r.split(',')[1],
|
||||
format: format,
|
||||
saved: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
reader.onerror = e => {
|
||||
reject(e);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
async checkPermissions() {
|
||||
if (typeof navigator === 'undefined' || !navigator.permissions) {
|
||||
throw this.unavailable('Permissions API not available in this browser');
|
||||
}
|
||||
try {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query
|
||||
// the specific permissions that are supported varies among browsers that implement the
|
||||
// permissions API, so we need a try/catch in case 'camera' is invalid
|
||||
const permission = await window.navigator.permissions.query({
|
||||
name: 'camera',
|
||||
});
|
||||
return {
|
||||
camera: permission.state,
|
||||
photos: 'granted',
|
||||
};
|
||||
}
|
||||
catch (_a) {
|
||||
throw this.unavailable('Camera permissions are not available in this browser');
|
||||
}
|
||||
}
|
||||
async requestPermissions() {
|
||||
throw this.unimplemented('Not implemented on web.');
|
||||
}
|
||||
async pickLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
async getLimitedLibraryPhotos() {
|
||||
throw this.unavailable('Not implemented on web.');
|
||||
}
|
||||
}
|
||||
new CameraWeb();
|
||||
|
||||
const Camera = core.registerPlugin('Camera', {
|
||||
web: () => new CameraWeb(),
|
||||
});
|
||||
|
||||
exports.Camera = Camera;
|
||||
|
||||
return exports;
|
||||
|
||||
})({}, capacitorExports);
|
||||
//# sourceMappingURL=plugin.js.map
|
||||
1
node_modules/@capacitor/camera/dist/plugin.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/camera/dist/plugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user