2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
|
import{SERIALIZE_TO_IPC_FN as o,invoke as t,transformCallback as x,Resource as I}from"./core-DhEqZVGG.js";class O{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new h(this.width*e,this.height*e)}[o](){return{width:this.width,height:this.height}}toJSON(){return this[o]()}}class h{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new O(this.width/e,this.height/e)}[o](){return{width:this.width,height:this.height}}toJSON(){return this[o]()}}class c{constructor(e){this.size=e}toLogical(e){return this.size instanceof O?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof h?this.size:this.size.toPhysical(e)}[o](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[o]()}}class A{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[o](){return{x:this.x,y:this.y}}toJSON(){return this[o]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new A(this.x/e,this.y/e)}[o](){return{x:this.x,y:this.y}}toJSON(){return this[o]()}}class w{constructor(e){this.position=e}toLogical(e){return this.position instanceof A?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[o](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[o]()}}var a;(function(i){i.WINDOW_RESIZED="tauri://resize",i.WINDOW_MOVED="tauri://move",i.WINDOW_CLOSE_REQUESTED="tauri://close-requested",i.WINDOW_DESTROYED="tauri://destroyed",i.WINDOW_FOCUS="tauri://focus",i.WINDOW_BLUR="tauri://blur",i.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",i.WINDOW_THEME_CHANGED="tauri://theme-changed",i.WINDOW_CREATED="tauri://window-created",i.WINDOW_SUSPENDED="tauri://suspended",i.WINDOW_RESUMED="tauri://resumed",i.WEBVIEW_CREATED="tauri://webview-created",i.DRAG_ENTER="tauri://drag-enter",i.DRAG_OVER="tauri://drag-over",i.DRAG_DROP="tauri://drag-drop",i.DRAG_LEAVE="tauri://drag-leave"})(a||(a={}));async function N(i,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(i,e),await t("plugin:event|unlisten",{event:i,eventId:e})}async function S(i,e,n){var l;const s=typeof n?.target=="string"?{kind:"AnyLabel",label:n.target}:(l=n?.target)!==null&&l!==void 0?l:{kind:"Any"};return t("plugin:event|listen",{event:i,target:s,handler:x(e)}).then(p=>async()=>N(i,p))}async function L(i,e,n){return S(i,l=>{N(i,l.id),e(l)},n)}async function R(i,e){await t("plugin:event|emit",{event:i,payload:e})}async function P(i,e,n){await t("plugin:event|emit_to",{target:typeof i=="string"?{kind:"AnyLabel",label:i}:i,event:e,payload:n})}class d extends I{constructor(e){super(e)}static async new(e,n,l){return t("plugin:image|new",{rgba:b(e),width:n,height:l}).then(s=>new d(s))}static async fromBytes(e){return t("plugin:image|from_bytes",{bytes:b(e)}).then(n=>new d(n))}static async fromPath(e){return t("plugin:image|from_path",{path:e}).then(n=>new d(n))}async rgba(){return t("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return t("plugin:image|size",{rid:this.rid})}}function b(i){return i==null?null:typeof i=="string"?i:i instanceof d?i.rid:i}var m;(function(i){i[i.Critical=1]="Critical",i[i.Informational=2]="Informational"})(m||(m={}));class k{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var v;
|