@synnaxlabs/drift 0.42.3 → 0.44.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/README.md +48 -56
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +153 -161
- package/dist/index.cjs +1 -1
- package/dist/index.js +297 -239
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/selectors-2mPd0CjI.cjs +1 -0
- package/dist/{selectors-B00IQPYW.js → selectors-C36jHClh.js} +2 -5
- package/dist/src/external.d.ts +3 -3
- package/dist/src/external.d.ts.map +1 -1
- package/dist/src/{noop/index.d.ts → noop.d.ts} +13 -9
- package/dist/src/noop.d.ts.map +1 -0
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/sync.d.ts.map +1 -1
- package/dist/src/window.d.ts +5 -5
- package/dist/src/window.d.ts.map +1 -1
- package/dist/state-D41-Dai4.js +12075 -0
- package/dist/state-yfMrLzJG.cjs +34 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +224 -197
- package/package.json +17 -21
- package/dist/noop.cjs +0 -1
- package/dist/noop.js +0 -68
- package/dist/selectors-CGCIf0Ac.cjs +0 -1
- package/dist/src/noop/index.d.ts.map +0 -1
- package/dist/state-BX_5GHgM.js +0 -406
- package/dist/state-xseZCh_u.cjs +0 -1
- package/dist/window-Bj8OM9F9.cjs +0 -41
- package/dist/window-DwJfMpbK.js +0 -8620
package/dist/index.js
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { configureStore as j } from "@reduxjs/toolkit";
|
|
2
|
-
import { g, l as d, a as T, r as E,
|
|
3
|
-
import {
|
|
4
|
-
import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-B00IQPYW.js";
|
|
2
|
+
import { M as w, g, l as d, a as T, r as E, _ as y, J as F, I as N, b as M, i as V, c as $, s as U, d as Q, e as Z, f as I, h as C, S as q, Z as K, j as X, k as B, m as J, n as Y, o as G, p as H, q as x, t as W, u as ee, v as se, w as te, x as ie, y as ae, z as oe, A as ne, B as ce, C as le, D as re, E as ue, F as fe } from "./state-D41-Dai4.js";
|
|
3
|
+
import { s as de, a as we, b as he, c as ye, d as pe, e as _e } from "./selectors-C36jHClh.js";
|
|
5
4
|
const be = new Error("request for lock canceled");
|
|
6
|
-
var me = function(
|
|
5
|
+
var me = function(t, e, s, i) {
|
|
7
6
|
function a(o) {
|
|
8
|
-
return o instanceof s ? o : new s(function(
|
|
9
|
-
|
|
7
|
+
return o instanceof s ? o : new s(function(c) {
|
|
8
|
+
c(o);
|
|
10
9
|
});
|
|
11
10
|
}
|
|
12
|
-
return new (s || (s = Promise))(function(o,
|
|
13
|
-
function n(
|
|
11
|
+
return new (s || (s = Promise))(function(o, c) {
|
|
12
|
+
function n(l) {
|
|
14
13
|
try {
|
|
15
|
-
u(
|
|
14
|
+
u(i.next(l));
|
|
16
15
|
} catch (f) {
|
|
17
|
-
|
|
16
|
+
c(f);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
function
|
|
19
|
+
function r(l) {
|
|
21
20
|
try {
|
|
22
|
-
u(
|
|
21
|
+
u(i.throw(l));
|
|
23
22
|
} catch (f) {
|
|
24
|
-
|
|
23
|
+
c(f);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
function u(
|
|
28
|
-
|
|
26
|
+
function u(l) {
|
|
27
|
+
l.done ? o(l.value) : a(l.value).then(n, r);
|
|
29
28
|
}
|
|
30
|
-
u((
|
|
29
|
+
u((i = i.apply(t, e || [])).next());
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
32
|
class ze {
|
|
@@ -37,26 +36,26 @@ class ze {
|
|
|
37
36
|
acquire(e = 1, s = 0) {
|
|
38
37
|
if (e <= 0)
|
|
39
38
|
throw new Error(`invalid weight ${e}: must be positive`);
|
|
40
|
-
return new Promise((
|
|
41
|
-
const o = { resolve:
|
|
42
|
-
|
|
39
|
+
return new Promise((i, a) => {
|
|
40
|
+
const o = { resolve: i, reject: a, weight: e, priority: s }, c = O(this._queue, (n) => s <= n.priority);
|
|
41
|
+
c === -1 && e <= this._value ? this._dispatchItem(o) : this._queue.splice(c + 1, 0, o);
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
44
|
runExclusive(e) {
|
|
46
|
-
return me(this, arguments, void 0, function* (s,
|
|
47
|
-
const [o,
|
|
45
|
+
return me(this, arguments, void 0, function* (s, i = 1, a = 0) {
|
|
46
|
+
const [o, c] = yield this.acquire(i, a);
|
|
48
47
|
try {
|
|
49
48
|
return yield s(o);
|
|
50
49
|
} finally {
|
|
51
|
-
|
|
50
|
+
c();
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
waitForUnlock(e = 1, s = 0) {
|
|
56
55
|
if (e <= 0)
|
|
57
56
|
throw new Error(`invalid weight ${e}: must be positive`);
|
|
58
|
-
return this._couldLockImmediately(e, s) ? Promise.resolve() : new Promise((
|
|
59
|
-
this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Se(this._weightedWaiters[e - 1], { resolve:
|
|
57
|
+
return this._couldLockImmediately(e, s) ? Promise.resolve() : new Promise((i) => {
|
|
58
|
+
this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Se(this._weightedWaiters[e - 1], { resolve: i, priority: s });
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
isLocked() {
|
|
@@ -94,16 +93,16 @@ class ze {
|
|
|
94
93
|
if (this._queue.length === 0)
|
|
95
94
|
for (let e = this._value; e > 0; e--) {
|
|
96
95
|
const s = this._weightedWaiters[e - 1];
|
|
97
|
-
s && (s.forEach((
|
|
96
|
+
s && (s.forEach((i) => i.resolve()), this._weightedWaiters[e - 1] = []);
|
|
98
97
|
}
|
|
99
98
|
else {
|
|
100
99
|
const e = this._queue[0].priority;
|
|
101
100
|
for (let s = this._value; s > 0; s--) {
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
101
|
+
const i = this._weightedWaiters[s - 1];
|
|
102
|
+
if (!i)
|
|
104
103
|
continue;
|
|
105
|
-
const a =
|
|
106
|
-
(a === -1 ?
|
|
104
|
+
const a = i.findIndex((o) => o.priority <= e);
|
|
105
|
+
(a === -1 ? i : i.splice(0, a)).forEach((o) => o.resolve());
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
}
|
|
@@ -111,49 +110,49 @@ class ze {
|
|
|
111
110
|
return (this._queue.length === 0 || this._queue[0].priority < s) && e <= this._value;
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
function Se(
|
|
115
|
-
const s = O(
|
|
116
|
-
|
|
113
|
+
function Se(t, e) {
|
|
114
|
+
const s = O(t, (i) => e.priority <= i.priority);
|
|
115
|
+
t.splice(s + 1, 0, e);
|
|
117
116
|
}
|
|
118
|
-
function O(
|
|
119
|
-
for (let s =
|
|
120
|
-
if (e(
|
|
117
|
+
function O(t, e) {
|
|
118
|
+
for (let s = t.length - 1; s >= 0; s--)
|
|
119
|
+
if (e(t[s]))
|
|
121
120
|
return s;
|
|
122
121
|
return -1;
|
|
123
122
|
}
|
|
124
|
-
var
|
|
123
|
+
var ke = function(t, e, s, i) {
|
|
125
124
|
function a(o) {
|
|
126
|
-
return o instanceof s ? o : new s(function(
|
|
127
|
-
|
|
125
|
+
return o instanceof s ? o : new s(function(c) {
|
|
126
|
+
c(o);
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
|
-
return new (s || (s = Promise))(function(o,
|
|
131
|
-
function n(
|
|
129
|
+
return new (s || (s = Promise))(function(o, c) {
|
|
130
|
+
function n(l) {
|
|
132
131
|
try {
|
|
133
|
-
u(
|
|
132
|
+
u(i.next(l));
|
|
134
133
|
} catch (f) {
|
|
135
|
-
|
|
134
|
+
c(f);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
function
|
|
137
|
+
function r(l) {
|
|
139
138
|
try {
|
|
140
|
-
u(
|
|
139
|
+
u(i.throw(l));
|
|
141
140
|
} catch (f) {
|
|
142
|
-
|
|
141
|
+
c(f);
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
|
-
function u(
|
|
146
|
-
|
|
144
|
+
function u(l) {
|
|
145
|
+
l.done ? o(l.value) : a(l.value).then(n, r);
|
|
147
146
|
}
|
|
148
|
-
u((
|
|
147
|
+
u((i = i.apply(t, e || [])).next());
|
|
149
148
|
});
|
|
150
149
|
};
|
|
151
|
-
class
|
|
150
|
+
class ve {
|
|
152
151
|
constructor(e) {
|
|
153
152
|
this._semaphore = new ze(1, e);
|
|
154
153
|
}
|
|
155
154
|
acquire() {
|
|
156
|
-
return
|
|
155
|
+
return ke(this, arguments, void 0, function* (e = 0) {
|
|
157
156
|
const [, s] = yield this._semaphore.acquire(1, e);
|
|
158
157
|
return s;
|
|
159
158
|
});
|
|
@@ -174,319 +173,378 @@ class ke {
|
|
|
174
173
|
return this._semaphore.cancel();
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
|
-
const ge = (
|
|
178
|
-
const
|
|
179
|
-
return
|
|
176
|
+
const ge = (t) => [...new Set(t)], Te = (t, e, s = !0) => {
|
|
177
|
+
const i = /* @__PURE__ */ new Map();
|
|
178
|
+
return t.forEach((a) => {
|
|
180
179
|
const o = e(a);
|
|
181
|
-
if (
|
|
180
|
+
if (i.has(o)) {
|
|
182
181
|
if (s) return;
|
|
183
|
-
|
|
182
|
+
i.delete(o);
|
|
184
183
|
}
|
|
185
|
-
|
|
186
|
-
}), Array.from(
|
|
184
|
+
i.set(o, a);
|
|
185
|
+
}), Array.from(i.values());
|
|
187
186
|
}, Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
188
187
|
__proto__: null,
|
|
189
188
|
by: Te,
|
|
190
189
|
unique: ge
|
|
191
|
-
}, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://",
|
|
192
|
-
const [e, s] =
|
|
193
|
-
if (s == null) return [
|
|
194
|
-
const [,
|
|
195
|
-
return [s,
|
|
196
|
-
}, z = (
|
|
197
|
-
...
|
|
198
|
-
type:
|
|
199
|
-
}),
|
|
200
|
-
const [e, s] =
|
|
190
|
+
}, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://", Me = (t, e) => L.concat(e, A, t), Ie = (t) => {
|
|
191
|
+
const [e, s] = t.split(A);
|
|
192
|
+
if (s == null) return [t, ""];
|
|
193
|
+
const [, i] = e.split(L);
|
|
194
|
+
return [s, i];
|
|
195
|
+
}, z = (t, e) => ({
|
|
196
|
+
...t,
|
|
197
|
+
type: Me(t.type, e)
|
|
198
|
+
}), Ce = (t) => {
|
|
199
|
+
const [e, s] = Ie(t.type);
|
|
201
200
|
return {
|
|
202
201
|
emitted: s != null && s.length > 0,
|
|
203
202
|
emitter: s,
|
|
204
|
-
action: { ...
|
|
203
|
+
action: { ...t, type: e }
|
|
205
204
|
};
|
|
206
|
-
},
|
|
205
|
+
}, qe = (t) => {
|
|
207
206
|
const {
|
|
208
207
|
centerCount: e,
|
|
209
208
|
processCount: s,
|
|
210
|
-
focusCount:
|
|
209
|
+
focusCount: i,
|
|
211
210
|
stage: a,
|
|
212
211
|
key: o,
|
|
213
|
-
prerenderLabel:
|
|
212
|
+
prerenderLabel: c,
|
|
214
213
|
reserved: n,
|
|
215
|
-
minimized:
|
|
214
|
+
minimized: r,
|
|
216
215
|
...u
|
|
217
|
-
} =
|
|
216
|
+
} = t;
|
|
218
217
|
return u;
|
|
219
|
-
}, Oe = async (
|
|
218
|
+
}, Oe = async (t, e, s, i) => {
|
|
220
219
|
const a = (await s.listLabels()).filter(
|
|
221
|
-
(
|
|
222
|
-
), o = Object.keys(
|
|
223
|
-
g(
|
|
224
|
-
const
|
|
225
|
-
for (const
|
|
226
|
-
!a.includes(
|
|
227
|
-
const n = s.label(),
|
|
228
|
-
if (
|
|
229
|
-
const u = { ...
|
|
230
|
-
await
|
|
220
|
+
(l) => l !== w
|
|
221
|
+
), o = Object.keys(t.windows).filter((l) => l !== w);
|
|
222
|
+
g(i, "syncInitial"), d(i, "existing windows in runtime", a.sort()), d(i, "non-main windows in state", o.sort()), T(i);
|
|
223
|
+
const c = Ee.unique([...a, ...o]);
|
|
224
|
+
for (const l of c)
|
|
225
|
+
!a.includes(l) && s.isMain() ? (d(i, "state window not in runtime, creating", l), await R(s, l, t.windows[l], i)) : o.includes(l) || (d(i, "runtime window not in state, closing", l), await p(s, l, i));
|
|
226
|
+
const n = s.label(), r = t.windows[n];
|
|
227
|
+
if (r == null) return;
|
|
228
|
+
const u = { ...N };
|
|
229
|
+
await P(u, r, s, i), e(
|
|
231
230
|
E({ label: s.label(), ...await s.getProps() })
|
|
232
231
|
);
|
|
233
|
-
}, Le = async (
|
|
234
|
-
d(
|
|
235
|
-
const a =
|
|
236
|
-
a == null || o == null || await
|
|
237
|
-
},
|
|
232
|
+
}, Le = async (t, e, s, i) => {
|
|
233
|
+
d(i, "sync", t, e), s.isMain() && await Ae(t, e, s, i);
|
|
234
|
+
const a = t.windows[s.label()], o = e.windows[s.label()];
|
|
235
|
+
a == null || o == null || await P(a, o, s, i);
|
|
236
|
+
}, P = async (t, e, s, i) => {
|
|
238
237
|
const a = [];
|
|
239
|
-
e.title != null && e.title !==
|
|
238
|
+
e.title != null && e.title !== t.title && a.push([
|
|
240
239
|
"title",
|
|
241
|
-
{ prev:
|
|
240
|
+
{ prev: t.title, next: e.title },
|
|
242
241
|
async () => s.setTitle(e.title)
|
|
243
242
|
]);
|
|
244
|
-
const o = e.visible != null && e.visible !==
|
|
243
|
+
const o = e.visible != null && e.visible !== t.visible, c = e.visible === !1, n = () => a.push([
|
|
245
244
|
"visible",
|
|
246
|
-
{ prev:
|
|
245
|
+
{ prev: t.visible, next: e.visible },
|
|
247
246
|
async () => {
|
|
248
247
|
if (await s.setVisible(e.visible), e.visible === !1) return;
|
|
249
|
-
let
|
|
250
|
-
|
|
248
|
+
let r = e.position;
|
|
249
|
+
r ??= (await s.getProps()).position, r != null && (await s.setPosition(F.translate(r, { x: 1, y: 1 })), await s.setPosition(r));
|
|
251
250
|
}
|
|
252
251
|
]);
|
|
253
|
-
if (o &&
|
|
252
|
+
if (o && c && n(), e.skipTaskbar != null && e.skipTaskbar !== t.skipTaskbar && a.push([
|
|
254
253
|
"skipTaskbar",
|
|
255
|
-
{ prev:
|
|
254
|
+
{ prev: t.skipTaskbar, next: e.skipTaskbar },
|
|
256
255
|
async () => await s.setSkipTaskbar(e.skipTaskbar)
|
|
257
|
-
]), e.maximized != null && e.maximized !==
|
|
256
|
+
]), e.maximized != null && e.maximized !== t.maximized && a.push([
|
|
258
257
|
"maximized",
|
|
259
|
-
{ prev:
|
|
258
|
+
{ prev: t.maximized, next: e.maximized },
|
|
260
259
|
async () => await s.setMaximized(e.maximized)
|
|
261
|
-
]), e.fullscreen != null && e.fullscreen !==
|
|
260
|
+
]), e.fullscreen != null && e.fullscreen !== t.fullscreen && a.push([
|
|
262
261
|
"fullscreen",
|
|
263
|
-
{ prev:
|
|
262
|
+
{ prev: t.fullscreen, next: e.fullscreen },
|
|
264
263
|
async () => await s.setFullscreen(e.fullscreen)
|
|
265
|
-
]), e.centerCount !==
|
|
264
|
+
]), e.centerCount !== t.centerCount && a.push([
|
|
266
265
|
"center",
|
|
267
|
-
{ prev:
|
|
266
|
+
{ prev: t.centerCount, next: e.centerCount },
|
|
268
267
|
async () => s.center()
|
|
269
|
-
]), e.minimized != null && e.minimized !==
|
|
268
|
+
]), e.minimized != null && e.minimized !== t.minimized && a.push([
|
|
270
269
|
"minimized",
|
|
271
|
-
{ prev:
|
|
270
|
+
{ prev: t.minimized, next: e.minimized },
|
|
272
271
|
async () => await s.setMinimized(e.minimized)
|
|
273
|
-
]), e.resizable != null && e.resizable !==
|
|
272
|
+
]), e.resizable != null && e.resizable !== t.resizable && a.push([
|
|
274
273
|
"resizable",
|
|
275
|
-
{ prev:
|
|
274
|
+
{ prev: t.resizable, next: e.resizable },
|
|
276
275
|
async () => await s.setResizable(e.resizable)
|
|
277
|
-
]), e.minSize != null && !
|
|
276
|
+
]), e.minSize != null && !y.equals(e.minSize, t.minSize) && a.push([
|
|
278
277
|
"minSize",
|
|
279
|
-
{ prev:
|
|
278
|
+
{ prev: t.minSize, next: e.minSize },
|
|
280
279
|
async () => await s.setMinSize(e.minSize)
|
|
281
|
-
]), e.maxSize != null && !
|
|
280
|
+
]), e.maxSize != null && !y.equals(e.maxSize, t.maxSize) && a.push([
|
|
282
281
|
"maxSize",
|
|
283
|
-
{ prev:
|
|
282
|
+
{ prev: t.maxSize, next: e.maxSize },
|
|
284
283
|
async () => await s.setMaxSize(e.maxSize)
|
|
285
|
-
]), e.size != null && !
|
|
284
|
+
]), e.size != null && !y.equals(e.size, t.size) && a.push([
|
|
286
285
|
"size",
|
|
287
|
-
{ prev:
|
|
286
|
+
{ prev: t.size, next: e.size },
|
|
288
287
|
async () => await s.setSize(e.size)
|
|
289
|
-
]), e.position != null && !
|
|
288
|
+
]), e.position != null && !y.equals(e.position, t.position) && a.push([
|
|
290
289
|
"position",
|
|
291
|
-
{ prev:
|
|
290
|
+
{ prev: t.position, next: e.position },
|
|
292
291
|
async () => await s.setPosition(e.position)
|
|
293
|
-
]), e.focusCount !==
|
|
292
|
+
]), e.focusCount !== t.focusCount && a.push(
|
|
294
293
|
[
|
|
295
294
|
"setVisible",
|
|
296
|
-
{ prev:
|
|
295
|
+
{ prev: t.visible, next: e.visible },
|
|
297
296
|
async () => await s.setVisible(!0)
|
|
298
297
|
],
|
|
299
298
|
[
|
|
300
299
|
"focus",
|
|
301
|
-
{ prev:
|
|
300
|
+
{ prev: t.focusCount, next: e.focusCount },
|
|
302
301
|
async () => await s.focus()
|
|
303
302
|
]
|
|
304
|
-
), e.decorations != null && e.decorations !==
|
|
303
|
+
), e.decorations != null && e.decorations !== t.decorations && a.push([
|
|
305
304
|
"decorations",
|
|
306
|
-
{ prev:
|
|
305
|
+
{ prev: t.decorations, next: e.decorations },
|
|
307
306
|
async () => await s.setDecorations(e.decorations)
|
|
308
|
-
]), e.alwaysOnTop != null && e.alwaysOnTop !==
|
|
307
|
+
]), e.alwaysOnTop != null && e.alwaysOnTop !== t.alwaysOnTop && a.push([
|
|
309
308
|
"alwaysOnTop",
|
|
310
|
-
{ prev:
|
|
309
|
+
{ prev: t.alwaysOnTop, next: e.alwaysOnTop },
|
|
311
310
|
async () => await s.setAlwaysOnTop(e.alwaysOnTop)
|
|
312
|
-
]), o && !
|
|
313
|
-
g(
|
|
314
|
-
for (const [
|
|
315
|
-
T(
|
|
316
|
-
for (const [, ,
|
|
317
|
-
}
|
|
318
|
-
}, Ae = async (
|
|
319
|
-
const a = Object.keys(
|
|
320
|
-
if (
|
|
311
|
+
]), o && !c && n(), a.length !== 0) {
|
|
312
|
+
g(i, `syncCurrent, label: ${s.label()}, key: ${e.key}`);
|
|
313
|
+
for (const [r, { prev: u, next: l }] of a) d(i, r, u, "->", l);
|
|
314
|
+
T(i);
|
|
315
|
+
for (const [, , r] of a) await r();
|
|
316
|
+
}
|
|
317
|
+
}, Ae = async (t, e, s, i) => {
|
|
318
|
+
const a = Object.keys(t.windows).filter((n) => !(n in e.windows)), o = Object.keys(e.windows).filter((n) => !(n in t.windows)), c = s.isMain();
|
|
319
|
+
if (c && a.length > 0)
|
|
321
320
|
for (const n of a)
|
|
322
|
-
d(
|
|
323
|
-
Object.keys(e.windows).filter((
|
|
324
|
-
), await
|
|
325
|
-
if (
|
|
321
|
+
d(i, "syncMain", "closing", n), n === w && await Promise.all(
|
|
322
|
+
Object.keys(e.windows).filter((r) => r !== w).map(async (r) => await p(s, r, i))
|
|
323
|
+
), await p(s, n, i);
|
|
324
|
+
if (c && o.length > 0)
|
|
326
325
|
for (const n of o)
|
|
327
|
-
await
|
|
328
|
-
},
|
|
329
|
-
if (
|
|
330
|
-
throw console.warn(S,
|
|
331
|
-
if (
|
|
332
|
-
throw console.warn(
|
|
333
|
-
},
|
|
334
|
-
let { action: o, emitted:
|
|
335
|
-
const
|
|
336
|
-
_({ action: a, emitted:
|
|
337
|
-
const u =
|
|
326
|
+
await R(s, n, e.windows[n], i);
|
|
327
|
+
}, R = async (t, e, s, i) => (d(i, "createWindow", s), await t.create(e, qe(s))), p = async (t, e, s) => (d(s, "closeWindow", e), await t.close(e)), S = "[drift] - unexpected undefined action", k = "[drift] - unexpected undefined action type", _ = (t) => {
|
|
328
|
+
if (t.emitted ??= !1, t.action == null)
|
|
329
|
+
throw console.warn(S, t), new Error(S);
|
|
330
|
+
if (t.action.type == null || t.action.type.length === 0)
|
|
331
|
+
throw console.warn(k, t), new Error(k);
|
|
332
|
+
}, Pe = new ve(), Re = [E.type, M.type], De = (t, e = !1) => (s) => (i) => (a) => {
|
|
333
|
+
let { action: o, emitted: c, emitter: n } = Ce(a);
|
|
334
|
+
const r = t.label();
|
|
335
|
+
_({ action: a, emitted: c, emitter: n });
|
|
336
|
+
const u = V(o.type);
|
|
338
337
|
if (u && d(e, "[drift] - middleware", {
|
|
339
338
|
action: o,
|
|
340
|
-
emitted:
|
|
339
|
+
emitted: c,
|
|
341
340
|
emitter: n,
|
|
342
|
-
host:
|
|
343
|
-
}), n ===
|
|
344
|
-
const
|
|
341
|
+
host: r
|
|
342
|
+
}), n === t.label()) return;
|
|
343
|
+
const l = u && !Re.includes(o.type);
|
|
345
344
|
let f = null;
|
|
346
|
-
u && (f = s.getState().drift, o =
|
|
345
|
+
u && (f = s.getState().drift, o = $(
|
|
347
346
|
o,
|
|
348
347
|
f
|
|
349
348
|
));
|
|
350
|
-
const h =
|
|
351
|
-
return
|
|
349
|
+
const h = i(o), b = l ? s.getState().drift : null, D = U(c, o.type);
|
|
350
|
+
return Pe.runExclusive(async () => {
|
|
352
351
|
try {
|
|
353
|
-
f !== null && b !== null && await Le(f, b,
|
|
352
|
+
f !== null && b !== null && await Le(f, b, t, e), D && await t.emit({ action: o });
|
|
354
353
|
} catch (m) {
|
|
355
354
|
d(e, "[drift] - ERROR", {
|
|
356
355
|
error: m.message,
|
|
357
356
|
action: o,
|
|
358
|
-
emitted:
|
|
357
|
+
emitted: c,
|
|
359
358
|
emitter: n,
|
|
360
|
-
host:
|
|
361
|
-
}), s.dispatch(
|
|
359
|
+
host: r
|
|
360
|
+
}), s.dispatch(Q({ key: r, message: m.message }));
|
|
362
361
|
}
|
|
363
362
|
}), h;
|
|
364
|
-
}, je = (
|
|
365
|
-
const a =
|
|
366
|
-
return [
|
|
367
|
-
},
|
|
368
|
-
runtime:
|
|
363
|
+
}, je = (t, e, s = !1) => (i) => {
|
|
364
|
+
const a = t != null ? typeof t == "function" ? t(i) : t : i();
|
|
365
|
+
return [De(e, s), ...a];
|
|
366
|
+
}, Fe = async ({
|
|
367
|
+
runtime: t,
|
|
369
368
|
preloadedState: e,
|
|
370
369
|
middleware: s,
|
|
371
|
-
debug:
|
|
370
|
+
debug: i = !1,
|
|
372
371
|
enablePrerender: a = !0,
|
|
373
372
|
defaultWindowProps: o,
|
|
374
|
-
...
|
|
373
|
+
...c
|
|
375
374
|
}) => {
|
|
376
|
-
await
|
|
375
|
+
await t.configure();
|
|
377
376
|
let n;
|
|
378
377
|
n = j({
|
|
379
|
-
...
|
|
380
|
-
preloadedState: await
|
|
381
|
-
t,
|
|
378
|
+
...c,
|
|
379
|
+
preloadedState: await Ne(
|
|
382
380
|
i,
|
|
381
|
+
t,
|
|
383
382
|
() => n,
|
|
384
383
|
o,
|
|
385
384
|
e
|
|
386
385
|
),
|
|
387
|
-
middleware: je(s,
|
|
388
|
-
}), await Oe(n.getState().drift, n.dispatch,
|
|
389
|
-
const
|
|
386
|
+
middleware: je(s, t, i)
|
|
387
|
+
}), await Oe(n.getState().drift, n.dispatch, t, i);
|
|
388
|
+
const r = t.label();
|
|
390
389
|
return n.dispatch(
|
|
391
|
-
|
|
392
|
-
), n.dispatch(
|
|
393
|
-
},
|
|
390
|
+
Z({ enablePrerender: a, defaultWindowProps: o, debug: i, label: r })
|
|
391
|
+
), n.dispatch(I({ stage: "created" })), t.onCloseRequested(() => n?.dispatch(C({}))), n;
|
|
392
|
+
}, Ne = async (t, e, s, i, a) => e.isMain() ? (await e.subscribe(({ action: c, emitter: n, sendState: r }) => {
|
|
394
393
|
const u = s();
|
|
395
394
|
if (u == null) return;
|
|
396
|
-
if (
|
|
397
|
-
_({ action:
|
|
395
|
+
if (c != null) {
|
|
396
|
+
_({ action: c, emitter: n }), u.dispatch(z(c, n));
|
|
398
397
|
return;
|
|
399
398
|
}
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
}), typeof a == "function" ?
|
|
399
|
+
const l = u.getState();
|
|
400
|
+
r === !0 && e.emit({ state: l }, n);
|
|
401
|
+
}), typeof a == "function" ? v(i, t, await a()) : v(i, t, a)) : await new Promise((c, n) => {
|
|
403
402
|
(async () => {
|
|
404
403
|
try {
|
|
405
|
-
await e.subscribe(({ action: u, emitter:
|
|
404
|
+
await e.subscribe(({ action: u, emitter: l, state: f }) => {
|
|
406
405
|
const h = s();
|
|
407
406
|
if (h == null)
|
|
408
|
-
return f != null ?
|
|
409
|
-
u != null && (_({ action: u, emitter:
|
|
407
|
+
return f != null ? c(f) : void 0;
|
|
408
|
+
u != null && (_({ action: u, emitter: l }), h.dispatch(z(u, l)));
|
|
410
409
|
}), await e.emit({ sendState: !0 }, w);
|
|
411
410
|
} catch (u) {
|
|
412
411
|
n(u);
|
|
413
412
|
}
|
|
414
413
|
})();
|
|
415
|
-
}), Ve =
|
|
414
|
+
}), Ve = Fe, v = (t, e, s) => {
|
|
416
415
|
if (s == null) return s;
|
|
417
|
-
const
|
|
418
|
-
return
|
|
419
|
-
Object.entries(
|
|
416
|
+
const i = s[q];
|
|
417
|
+
return i.config.debug = e ?? i.config.debug, i.windows = Object.fromEntries(
|
|
418
|
+
Object.entries(i.windows).filter(([, a]) => a.reserved).map(([a, o]) => (t?.visible != null && (o.visible = t.visible), o.focusCount = 0, o.centerCount = 0, o.processCount = 0, [a, o]))
|
|
420
419
|
), s;
|
|
421
|
-
}
|
|
420
|
+
};
|
|
421
|
+
class $e {
|
|
422
|
+
async emit() {
|
|
423
|
+
}
|
|
424
|
+
async subscribe() {
|
|
425
|
+
}
|
|
426
|
+
isMain() {
|
|
427
|
+
return !0;
|
|
428
|
+
}
|
|
429
|
+
label() {
|
|
430
|
+
return w;
|
|
431
|
+
}
|
|
432
|
+
onCloseRequested() {
|
|
433
|
+
}
|
|
434
|
+
async listLabels() {
|
|
435
|
+
return [];
|
|
436
|
+
}
|
|
437
|
+
async getProps() {
|
|
438
|
+
return {};
|
|
439
|
+
}
|
|
440
|
+
async create() {
|
|
441
|
+
}
|
|
442
|
+
async close() {
|
|
443
|
+
}
|
|
444
|
+
async focus() {
|
|
445
|
+
}
|
|
446
|
+
async setMinimized() {
|
|
447
|
+
}
|
|
448
|
+
async setMaximized() {
|
|
449
|
+
}
|
|
450
|
+
async setVisible() {
|
|
451
|
+
}
|
|
452
|
+
async setFullscreen() {
|
|
453
|
+
}
|
|
454
|
+
async center() {
|
|
455
|
+
}
|
|
456
|
+
async setPosition() {
|
|
457
|
+
}
|
|
458
|
+
async setSize() {
|
|
459
|
+
}
|
|
460
|
+
async setMinSize() {
|
|
461
|
+
}
|
|
462
|
+
async setMaxSize() {
|
|
463
|
+
}
|
|
464
|
+
async setResizable() {
|
|
465
|
+
}
|
|
466
|
+
async setSkipTaskbar() {
|
|
467
|
+
}
|
|
468
|
+
async setAlwaysOnTop() {
|
|
469
|
+
}
|
|
470
|
+
async setDecorations() {
|
|
471
|
+
}
|
|
472
|
+
async setTitle() {
|
|
473
|
+
}
|
|
474
|
+
async configure() {
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
422
478
|
__proto__: null,
|
|
423
479
|
MAIN_WINDOW: w,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
480
|
+
NoopRuntime: $e,
|
|
481
|
+
SLICE_NAME: q,
|
|
482
|
+
ZERO_SLICE_STATE: K,
|
|
483
|
+
closeWindow: C,
|
|
484
|
+
completeProcess: X,
|
|
428
485
|
configureStore: Ve,
|
|
429
|
-
createWindow:
|
|
430
|
-
focusWindow:
|
|
431
|
-
reducer:
|
|
432
|
-
registerProcess:
|
|
433
|
-
reloadWindow:
|
|
486
|
+
createWindow: B,
|
|
487
|
+
focusWindow: J,
|
|
488
|
+
reducer: Y,
|
|
489
|
+
registerProcess: G,
|
|
490
|
+
reloadWindow: M,
|
|
434
491
|
selectSliceState: de,
|
|
435
492
|
selectWindow: we,
|
|
436
493
|
selectWindowAttribute: he,
|
|
437
|
-
selectWindowKey:
|
|
438
|
-
selectWindowLabel:
|
|
494
|
+
selectWindowKey: ye,
|
|
495
|
+
selectWindowLabel: pe,
|
|
439
496
|
selectWindows: _e,
|
|
440
|
-
setWindowAlwaysOnTop:
|
|
441
|
-
setWindowDecorations:
|
|
442
|
-
setWindowFullscreen:
|
|
443
|
-
setWindowMaxSize:
|
|
444
|
-
setWindowMaximized:
|
|
445
|
-
setWindowMinSize:
|
|
446
|
-
setWindowMinimized:
|
|
447
|
-
setWindowPosition:
|
|
448
|
-
setWindowProps:
|
|
449
|
-
setWindowResizable:
|
|
450
|
-
setWindowSize:
|
|
451
|
-
setWindowSkipTaskbar:
|
|
452
|
-
setWindowStage:
|
|
453
|
-
setWindowTitle:
|
|
454
|
-
setWindowVisible:
|
|
497
|
+
setWindowAlwaysOnTop: H,
|
|
498
|
+
setWindowDecorations: x,
|
|
499
|
+
setWindowFullscreen: W,
|
|
500
|
+
setWindowMaxSize: ee,
|
|
501
|
+
setWindowMaximized: se,
|
|
502
|
+
setWindowMinSize: te,
|
|
503
|
+
setWindowMinimized: ie,
|
|
504
|
+
setWindowPosition: ae,
|
|
505
|
+
setWindowProps: oe,
|
|
506
|
+
setWindowResizable: ne,
|
|
507
|
+
setWindowSize: ce,
|
|
508
|
+
setWindowSkipTaskbar: le,
|
|
509
|
+
setWindowStage: I,
|
|
510
|
+
setWindowTitle: re,
|
|
511
|
+
setWindowVisible: ue,
|
|
455
512
|
windowPropsZ: fe
|
|
456
513
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
457
514
|
export {
|
|
458
515
|
Ke as Drift,
|
|
459
516
|
w as MAIN_WINDOW,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
517
|
+
$e as NoopRuntime,
|
|
518
|
+
q as SLICE_NAME,
|
|
519
|
+
K as ZERO_SLICE_STATE,
|
|
520
|
+
C as closeWindow,
|
|
521
|
+
X as completeProcess,
|
|
464
522
|
Ve as configureStore,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
523
|
+
B as createWindow,
|
|
524
|
+
J as focusWindow,
|
|
525
|
+
Y as reducer,
|
|
526
|
+
G as registerProcess,
|
|
527
|
+
M as reloadWindow,
|
|
470
528
|
de as selectSliceState,
|
|
471
529
|
we as selectWindow,
|
|
472
530
|
he as selectWindowAttribute,
|
|
473
|
-
|
|
474
|
-
|
|
531
|
+
ye as selectWindowKey,
|
|
532
|
+
pe as selectWindowLabel,
|
|
475
533
|
_e as selectWindows,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
534
|
+
H as setWindowAlwaysOnTop,
|
|
535
|
+
x as setWindowDecorations,
|
|
536
|
+
W as setWindowFullscreen,
|
|
537
|
+
ee as setWindowMaxSize,
|
|
538
|
+
se as setWindowMaximized,
|
|
539
|
+
te as setWindowMinSize,
|
|
540
|
+
ie as setWindowMinimized,
|
|
541
|
+
ae as setWindowPosition,
|
|
542
|
+
oe as setWindowProps,
|
|
543
|
+
ne as setWindowResizable,
|
|
544
|
+
ce as setWindowSize,
|
|
545
|
+
le as setWindowSkipTaskbar,
|
|
546
|
+
I as setWindowStage,
|
|
547
|
+
re as setWindowTitle,
|
|
548
|
+
ue as setWindowVisible,
|
|
491
549
|
fe as windowPropsZ
|
|
492
550
|
};
|