@synnaxlabs/drift 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +10 -9
- package/dist/index.cjs +1 -1
- package/dist/index.js +56 -55
- package/dist/noop.cjs +1 -0
- package/dist/noop.js +68 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors-BJ5IDnos.js → selectors--wDYbFAe.js} +1 -1
- package/dist/selectors-jksTA_U1.cjs +1 -0
- package/dist/src/noop/index.d.ts +32 -0
- package/dist/src/noop/index.d.ts.map +1 -0
- package/dist/src/window.d.ts +5 -93
- package/dist/src/window.d.ts.map +1 -1
- package/dist/state-Ckw4CzST.cjs +1 -0
- package/dist/state-D8a0PvFs.js +396 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +17 -16
- package/dist/window-BIbHrbtA.js +8619 -0
- package/dist/window-DLsE0-fP.cjs +41 -0
- package/package.json +8 -3
- package/dist/selectors-DPMyygQa.cjs +0 -1
- package/dist/state-DO5anaj4.js +0 -5893
- package/dist/state-DliTJ_c2.cjs +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const N=require("@reduxjs/toolkit"),d=require("./window-DLsE0-fP.cjs"),w=(e=!1,...n)=>{e&&console.log(...n)},m=(e=!1,...n)=>{e&&console.group(...n)},W=e=>{e&&console.groupEnd()},_=(e,n,o=".")=>{const t=e.split(o);return t.map((i,l)=>{const r=n(i,l,t);return r==null?null:typeof r=="string"?r:r.join(o)}).filter(i=>i!=null).join(o)},I=(e,n,o={optional:!1,separator:"."})=>{o.separator??(o.separator=".");const{optional:t,getter:i=(a,s)=>a[s]}=o,l=n.split(o.separator);if(l.length===1&&l[0]==="")return e;let r=e;for(const a of l){const s=i(r,a);if(s==null){if(t)return null;throw new Error(`Path ${n} does not exist. ${a} is null`)}r=s}return r},L=(e,n,o)=>{const t=n.split(".");let i=e;for(let l=0;l<t.length-1;l++){const r=t[l];i[r]??(i[r]={}),i=i[r]}try{i[t[t.length-1]]=o}catch(l){throw console.error("failed to set value",o,"at path",n,"on object",e),l}},D=(e,n)=>{const o=n.split(".");let t=e;for(let i=0;i<o.length-1;i++){const l=o[i];if(t[l]==null)return;t=t[l]}if(Array.isArray(t)){const i=parseInt(o[o.length-1]);if(isNaN(i))return;t.splice(i,1);return}delete t[o[o.length-1]]},M=(e,n)=>{const o=e.split(".");return n<0?o[o.length+n]:o[n]},j=(e,n)=>{try{return I(e,n),!0}catch{return!1}},R=(e,n)=>{if(n.length===0)return!0;const o=e.split("."),t=n.split(".");if(t.length>o.length)return!1;for(let i=0;i<t.length;i++){const l=o[i],r=t[i];if(r!=="*"&&l!==r)return!1}return!0},v=e=>JSON.parse(JSON.stringify(e)),C=(e,...n)=>(n.forEach(o=>{let t=e;const i=o.split(".");i.forEach((l,r)=>{r===i.length-1?delete t[l]:l in t&&(t=t[l])})}),e),$=(e,n,o="")=>{const t={},i=(l,r,a)=>{if(typeof l!=typeof r||l===null||r===null){t[a]=[l,r];return}if(typeof l=="object"&&typeof r=="object")if(Array.isArray(l)&&Array.isArray(r)){if(l.length!==r.length){t[a]=[l,r];return}for(let s=0;s<l.length;s++)i(l[s],r[s],`${a}[${s}]`)}else new Set([...Object.keys(l),...Object.keys(r)]).forEach(s=>{i(l[s],r[s],a!==""?`${a}.${s}`:s)});else l!==r&&(t[a]=[l,r])};return i(e,n,o),t},b=(e,n)=>{const o=Array.isArray(e),t=Array.isArray(n);if(o!==t)return!1;if(o&&t){const r=e,a=n;if(r.length!==a.length)return!1;for(let s=0;s<r.length;s++)if(!b(r[s],a[s]))return!1;return!0}if(e==null||n==null||typeof e!="object"||typeof n!="object")return e===n;if("equals"in e)return e.equals(n);const i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(const r of i){const a=e[r],s=n[r];if(typeof a=="object"&&typeof s=="object"){if(!b(a,s))return!1}else if(a!==s)return!1}return!0},k=(e,n)=>{if(typeof e!="object"||e==null)return e===n;const o=Object.keys(e),t=Object.keys(n);if(t.length>o.length)return!1;for(const i of t){const l=e[i],r=n[i];if(typeof l=="object"&&typeof r=="object"){if(!k(l,r))return!1}else if(l!==r)return!1}return!0},y=(e,...n)=>{if(n.length===0)return e;const o=n.shift();if(d.o(e)&&d.o(o))for(const t in o)try{d.o(o[t])?(t in e||Object.assign(e,{[t]:{}}),y(e[t],o[t])):Object.assign(e,{[t]:o[t]})}catch(i){throw i instanceof TypeError?new TypeError(`.${t}: ${i.message}`):i}return y(e,...n)},x=(e,n,o)=>{const t=(i,l,r)=>{for(const a in l){const s=l[a],p=r.shape;if(p!=null&&p[a]){const E=p[a].safeParse(s);E.success&&(i[a]=E.data)}else typeof s=="object"&&!Array.isArray(s)&&s!==null&&r&&r.shape&&r.shape[a]&&(i[a]||(i[a]={}),t(i[a],s,r.shape[a]))}return i};return t({...e},n,o)},g=Object.freeze(Object.defineProperty({__proto__:null,copy:v,deleteD:C,difference:$,element:M,equal:b,get:I,has:j,override:y,overrideValidItems:x,partialEqual:k,pathsMatch:R,remove:D,set:L,transformPath:_},Symbol.toStringTag,{value:"Module"})),q=d.O.milliseconds(50),z=()=>setTimeout(()=>window.location.reload(),q.milliseconds),A={label:d.MAIN_WINDOW,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...d.INITIAL_WINDOW_STATE,key:d.MAIN_WINDOW,reserved:!0}},labelKeys:{main:d.MAIN_WINDOW},keyLabels:{main:d.MAIN_WINDOW}},F=(e,n)=>{if(e.type===P.type)return n.label!==d.MAIN_WINDOW||(e.payload.label=d.Lt.create(),e.payload.prerenderLabel=d.Lt.create()),e;if("label"in e.payload)return e;let o=n.label;const t=e.payload;return t.key!=null&&(t.key in n.windows?o=t.key:o=n.keyLabels[t.key]),e.payload={...e.payload,label:o},e},c=e=>(n,o)=>{if(!("label"in o.payload))throw new Error("Missing label");e(n,o)},u=(e,n=!1)=>c((o,t)=>{let i=n;const l=o.windows[t.payload.label];if(l!=null){if(t.payload.value!=null)i=t.payload.value;else{const r=l[e];r!=null&&(i=!r)}o.windows[t.payload.label]={...l,[e]:i}}}),f=(e,n=!1)=>(o,t)=>{const i=o.windows[t.payload.label];i!=null&&(o.windows[t.payload.label]={...i,[e]:i[e]+(n?-1:1)})},K=e=>Object.values(e.windows).some(n=>n.key===d.PRERENDER_WINDOW&&!n.reserved),S="drift",V=(e,n,o)=>e.position!=null&&e.size!=null&&n==null?d.$t.topLeft(d.$t.positionInCenter(d.$t.construct(d.J.ZERO,o??d.J.ZERO),d.$t.construct(e.position,e.size))):n,J=(e,{payload:n})=>{if(n.key===d.PRERENDER_WINDOW)return;const{key:o,label:t,prerenderLabel:i}=n;if(t==null||i==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(e.config.debug),m(e.config.debug,"reducer create window");const l=e.windows.main;if(n.position=V(l,n.position,n.size),o in e.keyLabels){w(e.config.debug,"window already exists, un-minimize and focus it");const s=e.keyLabels[n.key];e.windows[s].visible=!0,e.windows[s].focusCount+=1,e.windows[s].minimized=!1,e.windows[s].position=n.position,W(e.config.debug);return}const[r,a]=Object.entries(e.windows).find(([,s])=>!s.reserved)??[null,null];r!=null?(w(e.config.debug,"using available pre-rendered window"),e.windows[r]={...a,visible:!0,reserved:!0,focusCount:1,focus:!0,...n},e.labelKeys[r]=n.key,e.keyLabels[n.key]=r):(w(e.config.debug,"creating new window"),e.windows[t]={...e.config.defaultWindowProps,...d.INITIAL_WINDOW_STATE,...n,reserved:!0},e.labelKeys[t]=o,e.keyLabels[o]=t),e.config.enablePrerender&&!K(e)&&(w(e.config.debug,"creating pre-render window"),e.windows[i]=g.copy({...e.config.defaultWindowProps,...d.INITIAL_PRERENDER_WINDOW_STATE})),W(e.config.debug)},Z=c((e,n)=>{const o=e.windows[n.payload.label];o!=null&&(o.stage=n.payload.stage)}),B=c((e,{payload:{label:n}})=>{const o=e.windows[n];o==null||o.processCount>0||(o.stage="closing",delete e.windows[n],delete e.labelKeys[n],delete e.keyLabels[o.key])}),H=c((e,n)=>{const o=e.windows[n.payload.label];o==null||o.processCount>0||(o.stage="reloading",z())}),U=c(f("processCount")),X=c((e,n)=>{f("processCount",!0)(e,n);const o=e.windows[n.payload.label];o!=null&&o.processCount===0&&(o.stage==="reloading"?z():(e.windows[n.payload.label].visible=!1,delete e.windows[n.payload.label],delete e.labelKeys[n.payload.label],delete e.keyLabels[o.key]))}),Y=(e,n)=>{const o=e.windows[n.payload.key];o!=null&&(o.error=n.payload.message)},G=c((e,n)=>{const o=e.windows[n.payload.label];o!=null&&(o.visible!==!0&&(o.visible=!0),f("focusCount")(e,n))}),Q=u("minimized"),ee=u("maximized"),ne=u("visible",!0),oe=u("fullscreen",!0),te=c(f("centerCount")),ie=c((e,n)=>{e.windows[n.payload.label].position=n.payload.position}),re=c((e,n)=>{e.windows[n.payload.label].size=n.payload.size}),le=c((e,n)=>{e.windows[n.payload.label].minSize=n.payload.size}),se=c((e,n)=>{e.windows[n.payload.label].maxSize=n.payload.size}),ae=u("resizable"),de=u("skipTaskbar"),ce=u("alwaysOnTop"),ue=c((e,n)=>{e.windows[n.payload.label].title=n.payload.title}),we=u("decorations"),h=(e,n)=>{const o=e.windows[n.payload.label];g.partialEqual(o,n.payload)||(e.windows[n.payload.label]={...o,...n.payload})},fe=(e,n)=>{if(e.config={...e.config,...n.payload},e.label=n.payload.label,e.label===d.MAIN_WINDOW&&e.config.enablePrerender){const o=d.Lt.create();e.windows[o]={...e.config.defaultWindowProps,...d.INITIAL_PRERENDER_WINDOW_STATE}}},O=N.createSlice({name:S,initialState:A,reducers:{internalSetInitial:fe,createWindow:J,setWindowStage:Z,closeWindow:B,registerProcess:U,completeProcess:X,setWindowError:Y,focusWindow:G,reloadWindow:H,setWindowMinimized:Q,setWindowMaximized:ee,setWindowVisible:ne,setWindowFullscreen:oe,centerWindow:te,setWindowPosition:ie,setWindowSize:re,setWindowMinSize:le,setWindowMaxSize:se,setWindowResizable:ae,setWindowSkipTaskbar:de,setWindowAlwaysOnTop:ce,setWindowTitle:ue,setWindowDecorations:we,runtimeSetWindowProps:h,setWindowProps:h}}),{actions:{runtimeSetWindowProps:pe,setWindowProps:We,createWindow:P,internalSetInitial:T,setWindowStage:be,closeWindow:ye,registerProcess:ge,completeProcess:Se,setWindowError:Ee,focusWindow:he,reloadWindow:me,setWindowMinimized:Ie,setWindowMaximized:ke,setWindowVisible:ze,setWindowFullscreen:Ae,centerWindow:xe,setWindowPosition:Oe,setWindowSize:Pe,setWindowMinSize:Te,setWindowMaxSize:Ne,setWindowResizable:_e,setWindowSkipTaskbar:Le,setWindowAlwaysOnTop:De,setWindowTitle:Me,setWindowDecorations:je}}=O,Re=O.reducer,ve=e=>e.startsWith(S),Ce=[T.type],$e=(e,n)=>!e&&!Ce.includes(n);exports.SLICE_NAME=S;exports.ZERO_SLICE_STATE=A;exports._=g;exports.assignLabel=F;exports.closeWindow=ye;exports.completeProcess=Se;exports.createWindow=P;exports.focusWindow=he;exports.group=m;exports.groupEnd=W;exports.internalSetInitial=T;exports.isDriftAction=ve;exports.log=w;exports.reducer=Re;exports.registerProcess=ge;exports.reloadWindow=me;exports.runtimeSetWindowProps=pe;exports.setWindowAlwaysOnTop=De;exports.setWindowDecorations=je;exports.setWindowError=Ee;exports.setWindowFullscreen=Ae;exports.setWindowMaxSize=Ne;exports.setWindowMaximized=ke;exports.setWindowMinSize=Te;exports.setWindowMinimized=Ie;exports.setWindowPosition=Oe;exports.setWindowProps=We;exports.setWindowResizable=_e;exports.setWindowSize=Pe;exports.setWindowSkipTaskbar=Le;exports.setWindowStage=be;exports.setWindowTitle=Me;exports.setWindowVisible=ze;exports.shouldEmit=$e;
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { createSlice as C } from "@reduxjs/toolkit";
|
|
2
|
+
import { o as b, O as M, M as u, I as z, P, a as O, L as g, $ as w, J as m } from "./window-BIbHrbtA.js";
|
|
3
|
+
const f = (e = !1, ...n) => {
|
|
4
|
+
e && console.log(...n);
|
|
5
|
+
}, R = (e = !1, ...n) => {
|
|
6
|
+
e && console.group(...n);
|
|
7
|
+
}, k = (e) => {
|
|
8
|
+
e && console.groupEnd();
|
|
9
|
+
}, _ = (e, n, o = ".") => {
|
|
10
|
+
const t = e.split(o);
|
|
11
|
+
return t.map((i, s) => {
|
|
12
|
+
const r = n(i, s, t);
|
|
13
|
+
return r == null ? null : typeof r == "string" ? r : r.join(o);
|
|
14
|
+
}).filter((i) => i != null).join(o);
|
|
15
|
+
}, A = (e, n, o = { optional: !1, separator: "." }) => {
|
|
16
|
+
o.separator ?? (o.separator = ".");
|
|
17
|
+
const { optional: t, getter: i = (a, l) => a[l] } = o, s = n.split(o.separator);
|
|
18
|
+
if (s.length === 1 && s[0] === "") return e;
|
|
19
|
+
let r = e;
|
|
20
|
+
for (const a of s) {
|
|
21
|
+
const l = i(r, a);
|
|
22
|
+
if (l == null) {
|
|
23
|
+
if (t) return null;
|
|
24
|
+
throw new Error(`Path ${n} does not exist. ${a} is null`);
|
|
25
|
+
}
|
|
26
|
+
r = l;
|
|
27
|
+
}
|
|
28
|
+
return r;
|
|
29
|
+
}, D = (e, n, o) => {
|
|
30
|
+
const t = n.split(".");
|
|
31
|
+
let i = e;
|
|
32
|
+
for (let s = 0; s < t.length - 1; s++) {
|
|
33
|
+
const r = t[s];
|
|
34
|
+
i[r] ?? (i[r] = {}), i = i[r];
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
i[t[t.length - 1]] = o;
|
|
38
|
+
} catch (s) {
|
|
39
|
+
throw console.error("failed to set value", o, "at path", n, "on object", e), s;
|
|
40
|
+
}
|
|
41
|
+
}, N = (e, n) => {
|
|
42
|
+
const o = n.split(".");
|
|
43
|
+
let t = e;
|
|
44
|
+
for (let i = 0; i < o.length - 1; i++) {
|
|
45
|
+
const s = o[i];
|
|
46
|
+
if (t[s] == null) return;
|
|
47
|
+
t = t[s];
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(t)) {
|
|
50
|
+
const i = parseInt(o[o.length - 1]);
|
|
51
|
+
if (isNaN(i)) return;
|
|
52
|
+
t.splice(i, 1);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
delete t[o[o.length - 1]];
|
|
56
|
+
}, $ = (e, n) => {
|
|
57
|
+
const o = e.split(".");
|
|
58
|
+
return n < 0 ? o[o.length + n] : o[n];
|
|
59
|
+
}, x = (e, n) => {
|
|
60
|
+
try {
|
|
61
|
+
return A(e, n), !0;
|
|
62
|
+
} catch {
|
|
63
|
+
return !1;
|
|
64
|
+
}
|
|
65
|
+
}, q = (e, n) => {
|
|
66
|
+
if (n.length === 0) return !0;
|
|
67
|
+
const o = e.split("."), t = n.split(".");
|
|
68
|
+
if (t.length > o.length) return !1;
|
|
69
|
+
for (let i = 0; i < t.length; i++) {
|
|
70
|
+
const s = o[i], r = t[i];
|
|
71
|
+
if (r !== "*" && s !== r)
|
|
72
|
+
return !1;
|
|
73
|
+
}
|
|
74
|
+
return !0;
|
|
75
|
+
}, K = (e) => JSON.parse(JSON.stringify(e)), F = (e, ...n) => (n.forEach((o) => {
|
|
76
|
+
let t = e;
|
|
77
|
+
const i = o.split(".");
|
|
78
|
+
i.forEach((s, r) => {
|
|
79
|
+
r === i.length - 1 ? delete t[s] : s in t && (t = t[s]);
|
|
80
|
+
});
|
|
81
|
+
}), e), V = (e, n, o = "") => {
|
|
82
|
+
const t = {}, i = (s, r, a) => {
|
|
83
|
+
if (typeof s != typeof r || s === null || r === null) {
|
|
84
|
+
t[a] = [s, r];
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (typeof s == "object" && typeof r == "object")
|
|
88
|
+
if (Array.isArray(s) && Array.isArray(r)) {
|
|
89
|
+
if (s.length !== r.length) {
|
|
90
|
+
t[a] = [s, r];
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
for (let l = 0; l < s.length; l++) i(s[l], r[l], `${a}[${l}]`);
|
|
94
|
+
} else
|
|
95
|
+
(/* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(r)])).forEach((l) => {
|
|
96
|
+
i(s[l], r[l], a !== "" ? `${a}.${l}` : l);
|
|
97
|
+
});
|
|
98
|
+
else s !== r && (t[a] = [s, r]);
|
|
99
|
+
};
|
|
100
|
+
return i(e, n, o), t;
|
|
101
|
+
}, W = (e, n) => {
|
|
102
|
+
const o = Array.isArray(e), t = Array.isArray(n);
|
|
103
|
+
if (o !== t) return !1;
|
|
104
|
+
if (o && t) {
|
|
105
|
+
const r = e, a = n;
|
|
106
|
+
if (r.length !== a.length) return !1;
|
|
107
|
+
for (let l = 0; l < r.length; l++) if (!W(r[l], a[l])) return !1;
|
|
108
|
+
return !0;
|
|
109
|
+
}
|
|
110
|
+
if (e == null || n == null || typeof e != "object" || typeof n != "object")
|
|
111
|
+
return e === n;
|
|
112
|
+
if ("equals" in e) return e.equals(n);
|
|
113
|
+
const i = Object.keys(e), s = Object.keys(n);
|
|
114
|
+
if (i.length !== s.length) return !1;
|
|
115
|
+
for (const r of i) {
|
|
116
|
+
const a = e[r], l = n[r];
|
|
117
|
+
if (typeof a == "object" && typeof l == "object") {
|
|
118
|
+
if (!W(a, l)) return !1;
|
|
119
|
+
} else if (a !== l) return !1;
|
|
120
|
+
}
|
|
121
|
+
return !0;
|
|
122
|
+
}, j = (e, n) => {
|
|
123
|
+
if (typeof e != "object" || e == null) return e === n;
|
|
124
|
+
const o = Object.keys(e), t = Object.keys(n);
|
|
125
|
+
if (t.length > o.length) return !1;
|
|
126
|
+
for (const i of t) {
|
|
127
|
+
const s = e[i], r = n[i];
|
|
128
|
+
if (typeof s == "object" && typeof r == "object") {
|
|
129
|
+
if (!j(s, r)) return !1;
|
|
130
|
+
} else if (s !== r) return !1;
|
|
131
|
+
}
|
|
132
|
+
return !0;
|
|
133
|
+
}, S = (e, ...n) => {
|
|
134
|
+
if (n.length === 0) return e;
|
|
135
|
+
const o = n.shift();
|
|
136
|
+
if (b(e) && b(o))
|
|
137
|
+
for (const t in o)
|
|
138
|
+
try {
|
|
139
|
+
b(o[t]) ? (t in e || Object.assign(e, { [t]: {} }), S(e[t], o[t])) : Object.assign(e, { [t]: o[t] });
|
|
140
|
+
} catch (i) {
|
|
141
|
+
throw i instanceof TypeError ? new TypeError(`.${t}: ${i.message}`) : i;
|
|
142
|
+
}
|
|
143
|
+
return S(e, ...n);
|
|
144
|
+
}, Z = (e, n, o) => {
|
|
145
|
+
const t = (i, s, r) => {
|
|
146
|
+
for (const a in s) {
|
|
147
|
+
const l = s[a], y = r.shape;
|
|
148
|
+
if (y != null && y[a]) {
|
|
149
|
+
const h = y[a].safeParse(l);
|
|
150
|
+
h.success && (i[a] = h.data);
|
|
151
|
+
} else typeof l == "object" && !Array.isArray(l) && l !== null && r && r.shape && r.shape[a] && (i[a] || (i[a] = {}), t(i[a], l, r.shape[a]));
|
|
152
|
+
}
|
|
153
|
+
return i;
|
|
154
|
+
};
|
|
155
|
+
return t({ ...e }, n, o);
|
|
156
|
+
}, v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
157
|
+
__proto__: null,
|
|
158
|
+
copy: K,
|
|
159
|
+
deleteD: F,
|
|
160
|
+
difference: V,
|
|
161
|
+
element: $,
|
|
162
|
+
equal: W,
|
|
163
|
+
get: A,
|
|
164
|
+
has: x,
|
|
165
|
+
override: S,
|
|
166
|
+
overrideValidItems: Z,
|
|
167
|
+
partialEqual: j,
|
|
168
|
+
pathsMatch: q,
|
|
169
|
+
remove: N,
|
|
170
|
+
set: D,
|
|
171
|
+
transformPath: _
|
|
172
|
+
}, Symbol.toStringTag, { value: "Module" })), J = M.milliseconds(50), L = () => setTimeout(() => window.location.reload(), J.milliseconds), B = {
|
|
173
|
+
label: u,
|
|
174
|
+
config: {
|
|
175
|
+
enablePrerender: !0,
|
|
176
|
+
debug: !1,
|
|
177
|
+
defaultWindowProps: {}
|
|
178
|
+
},
|
|
179
|
+
windows: {
|
|
180
|
+
main: {
|
|
181
|
+
...z,
|
|
182
|
+
key: u,
|
|
183
|
+
reserved: !0
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
labelKeys: {
|
|
187
|
+
main: u
|
|
188
|
+
},
|
|
189
|
+
keyLabels: {
|
|
190
|
+
main: u
|
|
191
|
+
}
|
|
192
|
+
}, ze = (e, n) => {
|
|
193
|
+
if (e.type === Se.type)
|
|
194
|
+
return n.label !== u || (e.payload.label = g.create(), e.payload.prerenderLabel = g.create()), e;
|
|
195
|
+
if ("label" in e.payload) return e;
|
|
196
|
+
let o = n.label;
|
|
197
|
+
const t = e.payload;
|
|
198
|
+
return t.key != null && (t.key in n.windows ? o = t.key : o = n.keyLabels[t.key]), e.payload = { ...e.payload, label: o }, e;
|
|
199
|
+
}, d = (e) => (n, o) => {
|
|
200
|
+
if (!("label" in o.payload)) throw new Error("Missing label");
|
|
201
|
+
e(n, o);
|
|
202
|
+
}, c = (e, n = !1) => d((o, t) => {
|
|
203
|
+
let i = n;
|
|
204
|
+
const s = o.windows[t.payload.label];
|
|
205
|
+
if (s != null) {
|
|
206
|
+
if (t.payload.value != null) i = t.payload.value;
|
|
207
|
+
else {
|
|
208
|
+
const r = s[e];
|
|
209
|
+
r != null && (i = !r);
|
|
210
|
+
}
|
|
211
|
+
o.windows[t.payload.label] = { ...s, [e]: i };
|
|
212
|
+
}
|
|
213
|
+
}), p = (e, n = !1) => (o, t) => {
|
|
214
|
+
const i = o.windows[t.payload.label];
|
|
215
|
+
i != null && (o.windows[t.payload.label] = {
|
|
216
|
+
...i,
|
|
217
|
+
[e]: i[e] + (n ? -1 : 1)
|
|
218
|
+
});
|
|
219
|
+
}, H = (e) => Object.values(e.windows).some((n) => n.key === P && !n.reserved), T = "drift", U = (e, n, o) => e.position != null && e.size != null && n == null ? w.topLeft(
|
|
220
|
+
w.positionInCenter(
|
|
221
|
+
w.construct(m.ZERO, o ?? m.ZERO),
|
|
222
|
+
w.construct(e.position, e.size)
|
|
223
|
+
)
|
|
224
|
+
) : n, X = (e, { payload: n }) => {
|
|
225
|
+
if (n.key === P) return;
|
|
226
|
+
const { key: o, label: t, prerenderLabel: i } = n;
|
|
227
|
+
if (t == null || i == null)
|
|
228
|
+
throw new Error("[drift] - bug - missing label and prerender label");
|
|
229
|
+
console.log(e.config.debug), R(e.config.debug, "reducer create window");
|
|
230
|
+
const s = e.windows.main;
|
|
231
|
+
if (n.position = U(s, n.position, n.size), o in e.keyLabels) {
|
|
232
|
+
f(e.config.debug, "window already exists, un-minimize and focus it");
|
|
233
|
+
const l = e.keyLabels[n.key];
|
|
234
|
+
e.windows[l].visible = !0, e.windows[l].focusCount += 1, e.windows[l].minimized = !1, e.windows[l].position = n.position, k(e.config.debug);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const [r, a] = Object.entries(e.windows).find(
|
|
238
|
+
([, l]) => !l.reserved
|
|
239
|
+
) ?? [null, null];
|
|
240
|
+
r != null ? (f(e.config.debug, "using available pre-rendered window"), e.windows[r] = {
|
|
241
|
+
...a,
|
|
242
|
+
visible: !0,
|
|
243
|
+
reserved: !0,
|
|
244
|
+
focusCount: 1,
|
|
245
|
+
focus: !0,
|
|
246
|
+
...n
|
|
247
|
+
}, e.labelKeys[r] = n.key, e.keyLabels[n.key] = r) : (f(e.config.debug, "creating new window"), e.windows[t] = {
|
|
248
|
+
...e.config.defaultWindowProps,
|
|
249
|
+
...z,
|
|
250
|
+
...n,
|
|
251
|
+
reserved: !0
|
|
252
|
+
}, e.labelKeys[t] = o, e.keyLabels[o] = t), e.config.enablePrerender && !H(e) && (f(e.config.debug, "creating pre-render window"), e.windows[i] = v.copy({
|
|
253
|
+
...e.config.defaultWindowProps,
|
|
254
|
+
...O
|
|
255
|
+
})), k(e.config.debug);
|
|
256
|
+
}, Y = d((e, n) => {
|
|
257
|
+
const o = e.windows[n.payload.label];
|
|
258
|
+
o != null && (o.stage = n.payload.stage);
|
|
259
|
+
}), G = d(
|
|
260
|
+
(e, { payload: { label: n } }) => {
|
|
261
|
+
const o = e.windows[n];
|
|
262
|
+
o == null || o.processCount > 0 || (o.stage = "closing", delete e.windows[n], delete e.labelKeys[n], delete e.keyLabels[o.key]);
|
|
263
|
+
}
|
|
264
|
+
), Q = d((e, n) => {
|
|
265
|
+
const o = e.windows[n.payload.label];
|
|
266
|
+
o == null || o.processCount > 0 || (o.stage = "reloading", L());
|
|
267
|
+
}), ee = d(
|
|
268
|
+
p("processCount")
|
|
269
|
+
), ne = d((e, n) => {
|
|
270
|
+
p("processCount", !0)(e, n);
|
|
271
|
+
const o = e.windows[n.payload.label];
|
|
272
|
+
o != null && o.processCount === 0 && (o.stage === "reloading" ? L() : (e.windows[n.payload.label].visible = !1, delete e.windows[n.payload.label], delete e.labelKeys[n.payload.label], delete e.keyLabels[o.key]));
|
|
273
|
+
}), oe = (e, n) => {
|
|
274
|
+
const o = e.windows[n.payload.key];
|
|
275
|
+
o != null && (o.error = n.payload.message);
|
|
276
|
+
}, te = d((e, n) => {
|
|
277
|
+
const o = e.windows[n.payload.label];
|
|
278
|
+
o != null && (o.visible !== !0 && (o.visible = !0), p("focusCount")(e, n));
|
|
279
|
+
}), ie = c("minimized"), re = c("maximized"), se = c("visible", !0), le = c("fullscreen", !0), ae = d(
|
|
280
|
+
p("centerCount")
|
|
281
|
+
), de = d((e, n) => {
|
|
282
|
+
e.windows[n.payload.label].position = n.payload.position;
|
|
283
|
+
}), ce = d((e, n) => {
|
|
284
|
+
e.windows[n.payload.label].size = n.payload.size;
|
|
285
|
+
}), ue = d((e, n) => {
|
|
286
|
+
e.windows[n.payload.label].minSize = n.payload.size;
|
|
287
|
+
}), we = d((e, n) => {
|
|
288
|
+
e.windows[n.payload.label].maxSize = n.payload.size;
|
|
289
|
+
}), fe = c("resizable"), pe = c("skipTaskbar"), ye = c("alwaysOnTop"), be = d((e, n) => {
|
|
290
|
+
e.windows[n.payload.label].title = n.payload.title;
|
|
291
|
+
}), ge = c("decorations"), E = (e, n) => {
|
|
292
|
+
const o = e.windows[n.payload.label];
|
|
293
|
+
v.partialEqual(o, n.payload) || (e.windows[n.payload.label] = { ...o, ...n.payload });
|
|
294
|
+
}, We = (e, n) => {
|
|
295
|
+
if (e.config = { ...e.config, ...n.payload }, e.label = n.payload.label, e.label === u && e.config.enablePrerender) {
|
|
296
|
+
const o = g.create();
|
|
297
|
+
e.windows[o] = {
|
|
298
|
+
...e.config.defaultWindowProps,
|
|
299
|
+
...O
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}, I = C({
|
|
303
|
+
name: T,
|
|
304
|
+
initialState: B,
|
|
305
|
+
reducers: {
|
|
306
|
+
internalSetInitial: We,
|
|
307
|
+
createWindow: X,
|
|
308
|
+
setWindowStage: Y,
|
|
309
|
+
closeWindow: G,
|
|
310
|
+
registerProcess: ee,
|
|
311
|
+
completeProcess: ne,
|
|
312
|
+
setWindowError: oe,
|
|
313
|
+
focusWindow: te,
|
|
314
|
+
reloadWindow: Q,
|
|
315
|
+
setWindowMinimized: ie,
|
|
316
|
+
setWindowMaximized: re,
|
|
317
|
+
setWindowVisible: se,
|
|
318
|
+
setWindowFullscreen: le,
|
|
319
|
+
centerWindow: ae,
|
|
320
|
+
setWindowPosition: de,
|
|
321
|
+
setWindowSize: ce,
|
|
322
|
+
setWindowMinSize: ue,
|
|
323
|
+
setWindowMaxSize: we,
|
|
324
|
+
setWindowResizable: fe,
|
|
325
|
+
setWindowSkipTaskbar: pe,
|
|
326
|
+
setWindowAlwaysOnTop: ye,
|
|
327
|
+
setWindowTitle: be,
|
|
328
|
+
setWindowDecorations: ge,
|
|
329
|
+
runtimeSetWindowProps: E,
|
|
330
|
+
setWindowProps: E
|
|
331
|
+
}
|
|
332
|
+
}), {
|
|
333
|
+
actions: {
|
|
334
|
+
runtimeSetWindowProps: Pe,
|
|
335
|
+
setWindowProps: Oe,
|
|
336
|
+
createWindow: Se,
|
|
337
|
+
internalSetInitial: he,
|
|
338
|
+
setWindowStage: Ae,
|
|
339
|
+
closeWindow: je,
|
|
340
|
+
registerProcess: ve,
|
|
341
|
+
completeProcess: Le,
|
|
342
|
+
setWindowError: Te,
|
|
343
|
+
focusWindow: Ie,
|
|
344
|
+
reloadWindow: Ce,
|
|
345
|
+
setWindowMinimized: Me,
|
|
346
|
+
setWindowMaximized: Re,
|
|
347
|
+
setWindowVisible: _e,
|
|
348
|
+
setWindowFullscreen: De,
|
|
349
|
+
centerWindow: Ne,
|
|
350
|
+
setWindowPosition: $e,
|
|
351
|
+
setWindowSize: xe,
|
|
352
|
+
setWindowMinSize: qe,
|
|
353
|
+
setWindowMaxSize: Ke,
|
|
354
|
+
setWindowResizable: Fe,
|
|
355
|
+
setWindowSkipTaskbar: Ve,
|
|
356
|
+
setWindowAlwaysOnTop: Ze,
|
|
357
|
+
setWindowTitle: Je,
|
|
358
|
+
setWindowDecorations: Be
|
|
359
|
+
}
|
|
360
|
+
} = I, He = I.reducer, Ue = (e) => e.startsWith(T), me = [he.type], Xe = (e, n) => !e && !me.includes(n);
|
|
361
|
+
export {
|
|
362
|
+
Fe as A,
|
|
363
|
+
xe as B,
|
|
364
|
+
Ve as C,
|
|
365
|
+
Je as D,
|
|
366
|
+
_e as E,
|
|
367
|
+
T as S,
|
|
368
|
+
B as Z,
|
|
369
|
+
v as _,
|
|
370
|
+
k as a,
|
|
371
|
+
Ce as b,
|
|
372
|
+
ze as c,
|
|
373
|
+
Te as d,
|
|
374
|
+
he as e,
|
|
375
|
+
Ae as f,
|
|
376
|
+
R as g,
|
|
377
|
+
je as h,
|
|
378
|
+
Ue as i,
|
|
379
|
+
Le as j,
|
|
380
|
+
Se as k,
|
|
381
|
+
f as l,
|
|
382
|
+
Ie as m,
|
|
383
|
+
He as n,
|
|
384
|
+
ve as o,
|
|
385
|
+
Ze as p,
|
|
386
|
+
Be as q,
|
|
387
|
+
Pe as r,
|
|
388
|
+
Xe as s,
|
|
389
|
+
De as t,
|
|
390
|
+
Ke as u,
|
|
391
|
+
Re as v,
|
|
392
|
+
qe as w,
|
|
393
|
+
Me as x,
|
|
394
|
+
$e as y,
|
|
395
|
+
Oe as z
|
|
396
|
+
};
|
package/dist/tauri.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var X=Object.defineProperty;var ee=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var W=(t,e,i)=>ee(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-DliTJ_c2.cjs"),ie=require("./debounce-BUAIXXZt.cjs");function te(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ne(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var O;const h="__TAURI_TO_IPC_KEY__";function se(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class le{get rid(){return te(this,O,"f")}constructor(e){O.set(this,void 0),ne(this,O,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}O=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function G(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:se(e)}).then(r=>async()=>G(t,r))}async function x(t,e,i){return f(t,n=>{G(t,n.id),e(n)},i)}async function L(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function H(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{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 d(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class d{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 _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{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)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}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 N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class v extends le{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:S(e),width:i,height:n}).then(l=>new v(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:S(e)}).then(i=>new v(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new v(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function S(t){return t==null?null:typeof t=="string"?t:t instanceof v?t.rid:t}var k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class ae{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var C;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(C||(C={}));function j(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function I(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const R=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await I()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return I()}static async getFocusedWindow(){for(const e of await I())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(R.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(R.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return R.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===k.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:S(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?S(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ae(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var M;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(M||(M={}));var F;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(F||(F={}));var B;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(B||(B={}));function re(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function oe(){return s("plugin:window|available_monitors").then(t=>t.map(re))}function J(){return new T(j(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function V(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new T(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class T{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await V()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return V()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function q(){const t=J();return new b(t.label,{skip:!0})}async function z(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new b(e,{skip:!0})))}class b{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await z()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new b(n.label,{skip:!0}):null}static getCurrent(){return q()}static async getAll(){return z()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ue(b,[E,T]);function ue(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const ce=t=>JSON.stringify(t),he=t=>JSON.parse(t),D="drift://action",we="tauri://error",be="tauri://created",de=t=>new Error(`Window not found: ${t}`),p=250,ye=c.w.seconds(1),m=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},pe=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:m(i),size:m(e)}},ge=async()=>(await oe()).map(e=>{const i=P(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.$t.construct(i,n)}),U=async t=>(await ge()).some(i=>c.$t.contains(i,t));class _e{constructor(e){W(this,"win");W(this,"unsubscribe");W(this,"fullscreenPoll",null);this.win=e??q(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},ye.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=ce({...e,emitter:n});if(i==null)return await L(D,l);const r=await b.getByLabel(i);if(r==null)throw de(i);await r.emit(D,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[D]=await f(D,n=>e(he(n.payload)));const i=ve();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,ie.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.I.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...$}=pe(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,p)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,p)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,p)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,p)),a!=null&&(await U(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...$});return await new Promise((Q,Y)=>{g.once(we,K=>Y(new Error(JSON.stringify(K.payload)))),g.once(be,()=>Q())})}catch(g){console.error(g)}}async close(e){const i=await b.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await z();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await z()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await U(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=m(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=m(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=m(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:P(await this.win.innerPosition(),e),size:Z(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const ve=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:P(await t.innerPosition(),e),size:Z(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=P(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],P=(t,e)=>c.J.scale(t,1/e),Z=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=_e;
|
|
1
|
+
"use strict";var ee=Object.defineProperty;var ie=(t,e,i)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var D=(t,e,i)=>ie(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./window-DLsE0-fP.cjs"),y=require("./state-Ckw4CzST.cjs"),te=require("./debounce-BUAIXXZt.cjs");function ne(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function se(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var S;const c="__TAURI_TO_IPC_KEY__";function le(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class ae{get rid(){return ne(this,S,"f")}constructor(e){S.set(this,void 0),se(this,S,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}S=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function H(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function W(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:le(e)}).then(r=>async()=>H(t,r))}async function L(t,e,i){return W(t,n=>{H(t,n.id),e(n)},i)}async function N(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function j(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class v{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 d(this.width*e,this.height*e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class d{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 v(this.width/e,this.height/e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class h{constructor(e){this.size=e}toLogical(e){return this.size instanceof v?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[c](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[c]()}}class T{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)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}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 T(this.x/e,this.y/e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class p{constructor(e){this.position=e}toLogical(e){return this.position instanceof T?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[c](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[c]()}}class m extends ae{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var x;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(x||(x={}));class re{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var M;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(M||(M={}));function q(){return new I(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function R(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new I(e,{skip:!0})))}const A=["tauri://created","tauri://error"];class I{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await R()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return R()}static async getFocusedWindow(){for(const e of await R())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===x.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new re(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var F;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(F||(F={}));var B;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(B||(B={}));var V;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(V||(V={}));function oe(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function ue(){return s("plugin:window|available_monitors").then(t=>t.map(oe))}function J(){return new C(q(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function U(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new C(new I(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const k=["tauri://created","tauri://error"];class C{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await U()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return U()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(k.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(k.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return k.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function Z(){const t=J();return new w(t.label,{skip:!0})}async function P(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new w(e,{skip:!0})))}class w{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await P()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new w(n.label,{skip:!0}):null}static getCurrent(){return Z()}static async getAll(){return P()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ce(w,[I,C]);function ce(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const he=t=>JSON.stringify(t),we=t=>JSON.parse(t),O="drift://action",de="tauri://error",be="tauri://created",ye=t=>new Error(`Window not found: ${t}`),g=250,pe=b.O.seconds(1),f=t=>{if(t!=null)return{width:Math.max(t.width,g),height:Math.max(t.height,g)}},ge=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:f(i),size:f(e)}},_e=async()=>(await ue()).map(e=>{const i=E(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return b.$t.construct(i,n)}),G=async t=>(await _e()).some(i=>b.$t.contains(i,t));class ve{constructor(e){D(this,"win");D(this,"unsubscribe");D(this,"fullscreenPoll",null);this.win=e??Z(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(b.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:y.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},pe.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===b.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=he({...e,emitter:n});if(i==null)return await N(O,l);const r=await w.getByLabel(i);if(r==null)throw ye(i);await r.emit(O,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[O]=await W(O,n=>e(we(n.payload)));const i=me();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,te.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=y._.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...Q}=ge(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,g)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,g)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,g)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,g)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const _=new w(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Q});return await new Promise((Y,K)=>{_.once(de,X=>K(new Error(JSON.stringify(X.payload)))),_.once(be,()=>Y())})}catch(_){console.error(_)}}async close(e){const i=await w.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await P();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await P()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new T(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=f(e),await this.win.setSize(new v(e.width,e.height))}async setMinSize(e){e=f(e),await this.win.setMinSize(new v(e.width,e.height))}async setMaxSize(e){e=f(e),await this.win.setMaxSize(new v(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:E(await this.win.innerPosition(),e),size:$(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const me=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:E(await t.innerPosition(),e),size:$(await t.innerSize(),e)};return y.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=E(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return y.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],E=(t,e)=>b.J.scale(t,1/e),$=(t,e)=>b._.scale(t,1/e);exports.TauriRuntime=ve;
|
package/dist/tauri.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var ee = Object.defineProperty;
|
|
2
2
|
var ie = (t, e, i) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var D = (t, e, i) => ie(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import {
|
|
4
|
+
import { O as te, S as ne, M as se, _ as le, J as ae, $ as G } from "./window-BIbHrbtA.js";
|
|
5
|
+
import { r as g, _ as re } from "./state-D8a0PvFs.js";
|
|
5
6
|
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
6
7
|
function ue(t, e, i, n) {
|
|
7
8
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -41,7 +42,7 @@ var o;
|
|
|
41
42
|
(function(t) {
|
|
42
43
|
t.WINDOW_RESIZED = "tauri://resize", t.WINDOW_MOVED = "tauri://move", t.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", t.WINDOW_DESTROYED = "tauri://destroyed", t.WINDOW_FOCUS = "tauri://focus", t.WINDOW_BLUR = "tauri://blur", t.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", t.WINDOW_THEME_CHANGED = "tauri://theme-changed", t.WINDOW_CREATED = "tauri://window-created", t.WEBVIEW_CREATED = "tauri://webview-created", t.DRAG_ENTER = "tauri://drag-enter", t.DRAG_OVER = "tauri://drag-over", t.DRAG_DROP = "tauri://drag-drop", t.DRAG_LEAVE = "tauri://drag-leave";
|
|
43
44
|
})(o || (o = {}));
|
|
44
|
-
async function
|
|
45
|
+
async function H(t, e) {
|
|
45
46
|
await s("plugin:event|unlisten", {
|
|
46
47
|
event: t,
|
|
47
48
|
eventId: e
|
|
@@ -54,11 +55,11 @@ async function m(t, e, i) {
|
|
|
54
55
|
event: t,
|
|
55
56
|
target: l,
|
|
56
57
|
handler: he(e)
|
|
57
|
-
}).then((r) => async () =>
|
|
58
|
+
}).then((r) => async () => H(t, r));
|
|
58
59
|
}
|
|
59
60
|
async function k(t, e, i) {
|
|
60
61
|
return m(t, (n) => {
|
|
61
|
-
|
|
62
|
+
H(t, n.id), e(n);
|
|
62
63
|
}, i);
|
|
63
64
|
}
|
|
64
65
|
async function L(t, e) {
|
|
@@ -2505,9 +2506,9 @@ const ge = (t) => JSON.stringify(t), _e = (t) => JSON.parse(t), W = "drift://act
|
|
|
2505
2506
|
return { ...t, maxSize: f(i), size: f(e) };
|
|
2506
2507
|
}, Oe = async () => (await ye()).map((e) => {
|
|
2507
2508
|
const i = I(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
|
|
2508
|
-
return
|
|
2509
|
-
}),
|
|
2510
|
-
class
|
|
2509
|
+
return G.construct(i, n);
|
|
2510
|
+
}), U = async (t) => (await Oe()).some((i) => G.contains(i, t));
|
|
2511
|
+
class Re {
|
|
2511
2512
|
/**
|
|
2512
2513
|
* @param window - The WebviewWindow to use as the underlying engine for this runtime.
|
|
2513
2514
|
* This should not be set in 99% of cases. Only use this if you know what you're doing.
|
|
@@ -2579,9 +2580,9 @@ class Pe {
|
|
|
2579
2580
|
});
|
|
2580
2581
|
}
|
|
2581
2582
|
async create(e, i) {
|
|
2582
|
-
i =
|
|
2583
|
-
const { size: n, minSize: l, maxSize: r, position: a, ...
|
|
2584
|
-
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await
|
|
2583
|
+
i = re.copy(i);
|
|
2584
|
+
const { size: n, minSize: l, maxSize: r, position: a, ...Q } = We(i);
|
|
2585
|
+
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await U(a) || (a.x = 0, a.y = 0));
|
|
2585
2586
|
try {
|
|
2586
2587
|
const p = new w(e, {
|
|
2587
2588
|
x: a == null ? void 0 : a.x,
|
|
@@ -2594,10 +2595,10 @@ class Pe {
|
|
|
2594
2595
|
maxHeight: r == null ? void 0 : r.height,
|
|
2595
2596
|
titleBarStyle: "overlay",
|
|
2596
2597
|
dragDropEnabled: !1,
|
|
2597
|
-
...
|
|
2598
|
+
...Q
|
|
2598
2599
|
});
|
|
2599
|
-
return await new Promise((
|
|
2600
|
-
p.once(ve, (X) =>
|
|
2600
|
+
return await new Promise((Y, K) => {
|
|
2601
|
+
p.once(ve, (X) => K(new Error(JSON.stringify(X.payload)))), p.once(fe, () => Y());
|
|
2601
2602
|
});
|
|
2602
2603
|
} catch (p) {
|
|
2603
2604
|
console.error(p);
|
|
@@ -2643,7 +2644,7 @@ class Pe {
|
|
|
2643
2644
|
}
|
|
2644
2645
|
async setPosition(e) {
|
|
2645
2646
|
const i = new N(e.x, e.y);
|
|
2646
|
-
await
|
|
2647
|
+
await U(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
|
|
2647
2648
|
}
|
|
2648
2649
|
async setSize(e) {
|
|
2649
2650
|
e = f(e), await this.win.setSize(new _(e.width, e.height));
|
|
@@ -2726,7 +2727,7 @@ const ze = () => [
|
|
|
2726
2727
|
label: t.label
|
|
2727
2728
|
})
|
|
2728
2729
|
}
|
|
2729
|
-
], I = (t, e) =>
|
|
2730
|
+
], I = (t, e) => ae.scale(t, 1 / e), $ = (t, e) => le.scale(t, 1 / e);
|
|
2730
2731
|
export {
|
|
2731
|
-
|
|
2732
|
+
Re as TauriRuntime
|
|
2732
2733
|
};
|