feat: move example

This commit is contained in:
Lucas Nogueira
2023-05-06 13:21:14 -03:00
parent 490aee9634
commit db900f6650
108 changed files with 223 additions and 6512 deletions
+27 -27
View File
@@ -1,38 +1,38 @@
export declare enum Source {
Prompt = "PROMPT",
Camera = "CAMERA",
Photos = "PHOTOS"
Prompt = "PROMPT",
Camera = "CAMERA",
Photos = "PHOTOS",
}
export declare enum ResultType {
Uri = "uri",
Base64 = "base64",
DataUrl = "dataUrl"
Uri = "uri",
Base64 = "base64",
DataUrl = "dataUrl",
}
export declare enum CameraDirection {
Rear = "REAR",
Front = "FRONT"
Rear = "REAR",
Front = "FRONT",
}
export interface ImageOptions {
quality?: number;
allowEditing?: boolean;
resultType?: ResultType;
saveToGallery?: boolean;
width?: number;
height?: number;
correctOrientation?: boolean;
source?: Source;
direction?: CameraDirection;
presentationStyle?: 'fullscreen' | 'popover';
promptLabelHeader?: string;
promptLabelCancel?: string;
promptLabelPhoto?: string;
promptLabelPicture?: string;
quality?: number;
allowEditing?: boolean;
resultType?: ResultType;
saveToGallery?: boolean;
width?: number;
height?: number;
correctOrientation?: boolean;
source?: Source;
direction?: CameraDirection;
presentationStyle?: "fullscreen" | "popover";
promptLabelHeader?: string;
promptLabelCancel?: string;
promptLabelPhoto?: string;
promptLabelPicture?: string;
}
export interface Image {
data: string;
assetUrl?: string;
format: string;
saved: boolean;
exif: unknown;
data: string;
assetUrl?: string;
format: string;
saved: boolean;
exif: unknown;
}
export declare function getPhoto(options?: ImageOptions): Promise<Image>;
+47 -11
View File
@@ -1,27 +1,63 @@
var d$1=Object.defineProperty;var e=(c,a)=>{for(var b in a)d$1(c,b,{get:a[b],enumerable:!0});};
var d$1 = Object.defineProperty;
var e = (c, a) => {
for (var b in a) d$1(c, b, { get: a[b], enumerable: !0 });
};
var w={};e(w,{convertFileSrc:()=>u,invoke:()=>d,transformCallback:()=>s});function l(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(r,n=!1){let e=l(),t=`_${e}`;return Object.defineProperty(window,t,{value:o=>(n&&Reflect.deleteProperty(window,t),r?.(o)),writable:!1,configurable:!0}),e}async function d(r,n={}){return new Promise((e,t)=>{let o=s(i=>{e(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:r,callback:o,error:a,...n});})}function u(r,n="asset"){let e=encodeURIComponent(r);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${e}`:`${n}://localhost/${e}`}
var w = {};
e(w, { convertFileSrc: () => u, invoke: () => d, transformCallback: () => s });
function l() {
return window.crypto.getRandomValues(new Uint32Array(1))[0];
}
function s(r, n = !1) {
let e = l(),
t = `_${e}`;
return (
Object.defineProperty(window, t, {
value: (o) => (n && Reflect.deleteProperty(window, t), r?.(o)),
writable: !1,
configurable: !0,
}),
e
);
}
async function d(r, n = {}) {
return new Promise((e, t) => {
let o = s((i) => {
e(i), Reflect.deleteProperty(window, `_${a}`);
}, !0),
a = s((i) => {
t(i), Reflect.deleteProperty(window, `_${o}`);
}, !0);
window.__TAURI_IPC__({ cmd: r, callback: o, error: a, ...n });
});
}
function u(r, n = "asset") {
let e = encodeURIComponent(r);
return navigator.userAgent.includes("Windows")
? `https://${n}.localhost/${e}`
: `${n}://localhost/${e}`;
}
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
var Source;
(function (Source) {
Source["Prompt"] = "PROMPT";
Source["Camera"] = "CAMERA";
Source["Photos"] = "PHOTOS";
Source["Prompt"] = "PROMPT";
Source["Camera"] = "CAMERA";
Source["Photos"] = "PHOTOS";
})(Source || (Source = {}));
var ResultType;
(function (ResultType) {
ResultType["Uri"] = "uri";
ResultType["Base64"] = "base64";
ResultType["DataUrl"] = "dataUrl";
ResultType["Uri"] = "uri";
ResultType["Base64"] = "base64";
ResultType["DataUrl"] = "dataUrl";
})(ResultType || (ResultType = {}));
var CameraDirection;
(function (CameraDirection) {
CameraDirection["Rear"] = "REAR";
CameraDirection["Front"] = "FRONT";
CameraDirection["Rear"] = "REAR";
CameraDirection["Front"] = "FRONT";
})(CameraDirection || (CameraDirection = {}));
async function getPhoto(options) {
return await d('plugin:camera|getPhoto', { ...options });
return await d("plugin:camera|getPhoto", { ...options });
}
export { CameraDirection, ResultType, Source, getPhoto };
+10 -10
View File
@@ -1,25 +1,25 @@
import { invoke } from '@tauri-apps/api/tauri';
import { invoke } from "@tauri-apps/api/tauri";
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
var Source;
(function (Source) {
Source["Prompt"] = "PROMPT";
Source["Camera"] = "CAMERA";
Source["Photos"] = "PHOTOS";
Source["Prompt"] = "PROMPT";
Source["Camera"] = "CAMERA";
Source["Photos"] = "PHOTOS";
})(Source || (Source = {}));
var ResultType;
(function (ResultType) {
ResultType["Uri"] = "uri";
ResultType["Base64"] = "base64";
ResultType["DataUrl"] = "dataUrl";
ResultType["Uri"] = "uri";
ResultType["Base64"] = "base64";
ResultType["DataUrl"] = "dataUrl";
})(ResultType || (ResultType = {}));
var CameraDirection;
(function (CameraDirection) {
CameraDirection["Rear"] = "REAR";
CameraDirection["Front"] = "FRONT";
CameraDirection["Rear"] = "REAR";
CameraDirection["Front"] = "FRONT";
})(CameraDirection || (CameraDirection = {}));
async function getPhoto(options) {
return await invoke('plugin:camera|getPhoto', { ...options });
return await invoke("plugin:camera|getPhoto", { ...options });
}
export { CameraDirection, ResultType, Source, getPhoto };