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