mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-29 13:31:27 +02:00
Merge remote-tracking branch 'origin/v2' into feat/camera
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
+13
-47
@@ -1,63 +1,29 @@
|
||||
var d$1 = Object.defineProperty;
|
||||
var e = (c, a) => {
|
||||
for (var b in a) d$1(c, b, { get: a[b], enumerable: !0 });
|
||||
};
|
||||
var f$1=Object.defineProperty;var g=(a,b)=>{for(var c in b)f$1(a,c,{get:b[c],enumerable:!0});};var e=(a,b,c)=>{if(!b.has(a))throw TypeError("Cannot "+c)};var h$1=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),i$1=(a,b,c)=>{if(b.has(a))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(a):b.set(a,c);},j=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c);
|
||||
|
||||
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 h={};g(h,{Channel:()=>o,PluginListener:()=>a,addPluginListener:()=>m,convertFileSrc:()=>y,invoke:()=>u,transformCallback:()=>s});function f(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(n,e=!1){let t=f(),r=`_${t}`;return Object.defineProperty(window,r,{value:c=>(e&&Reflect.deleteProperty(window,r),n?.(c)),writable:!1,configurable:!0}),t}var i,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;i$1(this,i,()=>{});this.id=s(e=>{h$1(this,i).call(this,e);});}set onmessage(e){j(this,i,e);}get onmessage(){return h$1(this,i)}toJSON(){return `__CHANNEL__:${this.id}`}};i=new WeakMap;var a=class{constructor(e,t,r){this.plugin=e,this.event=t,this.channelId=r;}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function m(n,e,t){let r=new o;return r.onmessage=t,u(`plugin:${n}|register_listener`,{event:e,handler:r}).then(()=>new a(n,e,r.id))}async function u(n,e={},t){return new Promise((r,c)=>{let g=s(d=>{r(d),Reflect.deleteProperty(window,`_${_}`);},!0),_=s(d=>{c(d),Reflect.deleteProperty(window,`_${g}`);},!0);window.__TAURI_IPC__({cmd:n,callback:g,error:_,payload:e,options:t});})}function y(n,e="asset"){return window.__TAURI__.convertFileSrc(n,e)}
|
||||
|
||||
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
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 u("plugin:camera|getPhoto", { ...options });
|
||||
}
|
||||
|
||||
export { CameraDirection, ResultType, Source, getPhoto };
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,25 +1,27 @@
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
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 };
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../guest-js/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;IAKY,OAIX;AAJD,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAJW,MAAM,KAAN,MAAM,GAIjB,EAAA,CAAA,CAAA,CAAA;IAEW,WAIX;AAJD,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,GAIrB,EAAA,CAAA,CAAA,CAAA;IAEW,gBAGX;AAHD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,GAG1B,EAAA,CAAA,CAAA,CAAA;AA2BM,eAAe,QAAQ,CAAC,OAAsB,EAAA;IACnD,OAAO,MAAM,MAAM,CAAC,wBAAwB,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAC/D;;;;"}
|
||||
{"version":3,"file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