mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-10 16:27:05 +02:00
feat: move example
This commit is contained in:
Vendored
+27
-27
@@ -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>;
|
||||
|
||||
Vendored
+47
-11
@@ -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 };
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user