@synnaxlabs/drift 0.42.3 → 0.43.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/index.js CHANGED
@@ -1,36 +1,35 @@
1
1
  import { configureStore as j } from "@reduxjs/toolkit";
2
- import { g, l as d, a as T, r as E, b as I, i as N, c as F, s as V, d as $, e as U, f as C, h as q, S as M, Z as Q, j as Z, k as K, m as X, n as B, o as J, p as Y, q as G, t as H, u as x, v as W, w as ee, x as se, y as ie, z as te, A as ae, B as oe, C as ne, D as le, E as re } from "./state-BX_5GHgM.js";
3
- import { M as w, _ as p, J as ce, I as ue, w as fe } from "./window-DwJfMpbK.js";
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, A as y, K as F, I as N, b as M, i as V, c as $, s as U, d as K, e as Q, f as I, h as C, S as q, Z, j as X, k as B, m as G, n as Y, o as H, p as J, q as x, t as W, u as ee, v as se, w as ie, x as te, y as ae, z as oe, B as ne, C as ce, D as le, E as re, F as ue, G as fe } from "./state-C1PObbun.js";
3
+ import { s as de, a as we, b as he, c as ye, d as pe, e as _e } from "./selectors-CzAkOydY.js";
5
4
  const be = new Error("request for lock canceled");
6
- var me = function(i, e, s, t) {
5
+ var ze = function(i, e, s, t) {
7
6
  function a(o) {
8
- return o instanceof s ? o : new s(function(l) {
9
- l(o);
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, l) {
13
- function n(r) {
11
+ return new (s || (s = Promise))(function(o, c) {
12
+ function n(l) {
14
13
  try {
15
- u(t.next(r));
14
+ u(t.next(l));
16
15
  } catch (f) {
17
- l(f);
16
+ c(f);
18
17
  }
19
18
  }
20
- function c(r) {
19
+ function r(l) {
21
20
  try {
22
- u(t.throw(r));
21
+ u(t.throw(l));
23
22
  } catch (f) {
24
- l(f);
23
+ c(f);
25
24
  }
26
25
  }
27
- function u(r) {
28
- r.done ? o(r.value) : a(r.value).then(n, c);
26
+ function u(l) {
27
+ l.done ? o(l.value) : a(l.value).then(n, r);
29
28
  }
30
29
  u((t = t.apply(i, e || [])).next());
31
30
  });
32
31
  };
33
- class ze {
32
+ class me {
34
33
  constructor(e, s = be) {
35
34
  this._value = e, this._cancelError = s, this._queue = [], this._weightedWaiters = [];
36
35
  }
@@ -38,17 +37,17 @@ class ze {
38
37
  if (e <= 0)
39
38
  throw new Error(`invalid weight ${e}: must be positive`);
40
39
  return new Promise((t, a) => {
41
- const o = { resolve: t, reject: a, weight: e, priority: s }, l = O(this._queue, (n) => s <= n.priority);
42
- l === -1 && e <= this._value ? this._dispatchItem(o) : this._queue.splice(l + 1, 0, o);
40
+ const o = { resolve: t, 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, t = 1, a = 0) {
47
- const [o, l] = yield this.acquire(t, a);
45
+ return ze(this, arguments, void 0, function* (s, t = 1, a = 0) {
46
+ const [o, c] = yield this.acquire(t, a);
48
47
  try {
49
48
  return yield s(o);
50
49
  } finally {
51
- l();
50
+ c();
52
51
  }
53
52
  });
54
53
  }
@@ -121,39 +120,39 @@ function O(i, e) {
121
120
  return s;
122
121
  return -1;
123
122
  }
124
- var ve = function(i, e, s, t) {
123
+ var ke = function(i, e, s, t) {
125
124
  function a(o) {
126
- return o instanceof s ? o : new s(function(l) {
127
- l(o);
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, l) {
131
- function n(r) {
129
+ return new (s || (s = Promise))(function(o, c) {
130
+ function n(l) {
132
131
  try {
133
- u(t.next(r));
132
+ u(t.next(l));
134
133
  } catch (f) {
135
- l(f);
134
+ c(f);
136
135
  }
137
136
  }
138
- function c(r) {
137
+ function r(l) {
139
138
  try {
140
- u(t.throw(r));
139
+ u(t.throw(l));
141
140
  } catch (f) {
142
- l(f);
141
+ c(f);
143
142
  }
144
143
  }
145
- function u(r) {
146
- r.done ? o(r.value) : a(r.value).then(n, c);
144
+ function u(l) {
145
+ l.done ? o(l.value) : a(l.value).then(n, r);
147
146
  }
148
147
  u((t = t.apply(i, e || [])).next());
149
148
  });
150
149
  };
151
- class ke {
150
+ class ve {
152
151
  constructor(e) {
153
- this._semaphore = new ze(1, e);
152
+ this._semaphore = new me(1, e);
154
153
  }
155
154
  acquire() {
156
- return ve(this, arguments, void 0, function* (e = 0) {
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
  });
@@ -188,46 +187,46 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
188
187
  __proto__: null,
189
188
  by: Te,
190
189
  unique: ge
191
- }, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://", Ie = (i, e) => L.concat(e, A, i), Ce = (i) => {
190
+ }, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://", Me = (i, e) => L.concat(e, A, i), Ie = (i) => {
192
191
  const [e, s] = i.split(A);
193
192
  if (s == null) return [i, ""];
194
193
  const [, t] = e.split(L);
195
194
  return [s, t];
196
- }, z = (i, e) => ({
195
+ }, m = (i, e) => ({
197
196
  ...i,
198
- type: Ie(i.type, e)
199
- }), qe = (i) => {
200
- const [e, s] = Ce(i.type);
197
+ type: Me(i.type, e)
198
+ }), Ce = (i) => {
199
+ const [e, s] = Ie(i.type);
201
200
  return {
202
201
  emitted: s != null && s.length > 0,
203
202
  emitter: s,
204
203
  action: { ...i, type: e }
205
204
  };
206
- }, Me = (i) => {
205
+ }, qe = (i) => {
207
206
  const {
208
207
  centerCount: e,
209
208
  processCount: s,
210
209
  focusCount: t,
211
210
  stage: a,
212
211
  key: o,
213
- prerenderLabel: l,
212
+ prerenderLabel: c,
214
213
  reserved: n,
215
- minimized: c,
214
+ minimized: r,
216
215
  ...u
217
216
  } = i;
218
217
  return u;
219
218
  }, Oe = async (i, e, s, t) => {
220
219
  const a = (await s.listLabels()).filter(
221
- (r) => r !== w
222
- ), o = Object.keys(i.windows).filter((r) => r !== w);
220
+ (l) => l !== w
221
+ ), o = Object.keys(i.windows).filter((l) => l !== w);
223
222
  g(t, "syncInitial"), d(t, "existing windows in runtime", a.sort()), d(t, "non-main windows in state", o.sort()), T(t);
224
- const l = Ee.unique([...a, ...o]);
225
- for (const r of l)
226
- !a.includes(r) && s.isMain() ? (d(t, "state window not in runtime, creating", r), await D(s, r, i.windows[r], t)) : o.includes(r) || (d(t, "runtime window not in state, closing", r), await y(s, r, t));
227
- const n = s.label(), c = i.windows[n];
228
- if (c == null) return;
229
- const u = { ...ue };
230
- await R(u, c, s, t), e(
223
+ const c = Ee.unique([...a, ...o]);
224
+ for (const l of c)
225
+ !a.includes(l) && s.isMain() ? (d(t, "state window not in runtime, creating", l), await P(s, l, i.windows[l], t)) : o.includes(l) || (d(t, "runtime window not in state, closing", l), await p(s, l, t));
226
+ const n = s.label(), r = i.windows[n];
227
+ if (r == null) return;
228
+ const u = { ...N };
229
+ await R(u, r, s, t), e(
231
230
  E({ label: s.label(), ...await s.getProps() })
232
231
  );
233
232
  }, Le = async (i, e, s, t) => {
@@ -241,16 +240,16 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
241
240
  { prev: i.title, next: e.title },
242
241
  async () => s.setTitle(e.title)
243
242
  ]);
244
- const o = e.visible != null && e.visible !== i.visible, l = e.visible === !1, n = () => a.push([
243
+ const o = e.visible != null && e.visible !== i.visible, c = e.visible === !1, n = () => a.push([
245
244
  "visible",
246
245
  { prev: i.visible, next: e.visible },
247
246
  async () => {
248
247
  if (await s.setVisible(e.visible), e.visible === !1) return;
249
- let c = e.position;
250
- c ?? (c = (await s.getProps()).position), await s.setPosition(ce.translate(c, { x: 1, y: 1 })), await s.setPosition(c);
248
+ let r = e.position;
249
+ r ?? (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 && l && n(), e.skipTaskbar != null && e.skipTaskbar !== i.skipTaskbar && a.push([
252
+ if (o && c && n(), e.skipTaskbar != null && e.skipTaskbar !== i.skipTaskbar && a.push([
254
253
  "skipTaskbar",
255
254
  { prev: i.skipTaskbar, next: e.skipTaskbar },
256
255
  async () => await s.setSkipTaskbar(e.skipTaskbar)
@@ -274,19 +273,19 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
274
273
  "resizable",
275
274
  { prev: i.resizable, next: e.resizable },
276
275
  async () => await s.setResizable(e.resizable)
277
- ]), e.minSize != null && !p.equals(e.minSize, i.minSize) && a.push([
276
+ ]), e.minSize != null && !y.equals(e.minSize, i.minSize) && a.push([
278
277
  "minSize",
279
278
  { prev: i.minSize, next: e.minSize },
280
279
  async () => await s.setMinSize(e.minSize)
281
- ]), e.maxSize != null && !p.equals(e.maxSize, i.maxSize) && a.push([
280
+ ]), e.maxSize != null && !y.equals(e.maxSize, i.maxSize) && a.push([
282
281
  "maxSize",
283
282
  { prev: i.maxSize, next: e.maxSize },
284
283
  async () => await s.setMaxSize(e.maxSize)
285
- ]), e.size != null && !p.equals(e.size, i.size) && a.push([
284
+ ]), e.size != null && !y.equals(e.size, i.size) && a.push([
286
285
  "size",
287
286
  { prev: i.size, next: e.size },
288
287
  async () => await s.setSize(e.size)
289
- ]), e.position != null && !p.equals(e.position, i.position) && a.push([
288
+ ]), e.position != null && !y.equals(e.position, i.position) && a.push([
290
289
  "position",
291
290
  { prev: i.position, next: e.position },
292
291
  async () => await s.setPosition(e.position)
@@ -309,75 +308,75 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
309
308
  "alwaysOnTop",
310
309
  { prev: i.alwaysOnTop, next: e.alwaysOnTop },
311
310
  async () => await s.setAlwaysOnTop(e.alwaysOnTop)
312
- ]), o && !l && n(), a.length !== 0) {
311
+ ]), o && !c && n(), a.length !== 0) {
313
312
  g(t, `syncCurrent, label: ${s.label()}, key: ${e.key}`);
314
- for (const [c, { prev: u, next: r }] of a) d(t, c, u, "->", r);
313
+ for (const [r, { prev: u, next: l }] of a) d(t, r, u, "->", l);
315
314
  T(t);
316
- for (const [, , c] of a) await c();
315
+ for (const [, , r] of a) await r();
317
316
  }
318
317
  }, Ae = async (i, e, s, t) => {
319
- const a = Object.keys(i.windows).filter((n) => !(n in e.windows)), o = Object.keys(e.windows).filter((n) => !(n in i.windows)), l = s.isMain();
320
- if (l && a.length > 0)
318
+ 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
+ if (c && a.length > 0)
321
320
  for (const n of a)
322
321
  d(t, "syncMain", "closing", n), n === w && await Promise.all(
323
- Object.keys(e.windows).filter((c) => c !== w).map(async (c) => await y(s, c, t))
324
- ), await y(s, n, t);
325
- if (l && o.length > 0)
322
+ Object.keys(e.windows).filter((r) => r !== w).map(async (r) => await p(s, r, t))
323
+ ), await p(s, n, t);
324
+ if (c && o.length > 0)
326
325
  for (const n of o)
327
- await D(s, n, e.windows[n], t);
328
- }, D = async (i, e, s, t) => (d(t, "createWindow", s), await i.create(e, Me(s))), y = async (i, e, s) => (d(s, "closeWindow", e), await i.close(e)), S = "[drift] - unexpected undefined action", v = "[drift] - unexpected undefined action type", _ = (i) => {
326
+ await P(s, n, e.windows[n], t);
327
+ }, P = async (i, e, s, t) => (d(t, "createWindow", s), await i.create(e, qe(s))), p = async (i, e, s) => (d(s, "closeWindow", e), await i.close(e)), S = "[drift] - unexpected undefined action", k = "[drift] - unexpected undefined action type", _ = (i) => {
329
328
  if (i.emitted ?? (i.emitted = !1), i.action == null)
330
329
  throw console.warn(S, i), new Error(S);
331
330
  if (i.action.type == null || i.action.type.length === 0)
332
- throw console.warn(v, i), new Error(v);
333
- }, Re = new ke(), De = [E.type, I.type], Pe = (i, e = !1) => (s) => (t) => (a) => {
334
- let { action: o, emitted: l, emitter: n } = qe(a);
335
- const c = i.label();
336
- _({ action: a, emitted: l, emitter: n });
337
- const u = N(o.type);
331
+ throw console.warn(k, i), new Error(k);
332
+ }, Re = new ve(), Pe = [E.type, M.type], De = (i, e = !1) => (s) => (t) => (a) => {
333
+ let { action: o, emitted: c, emitter: n } = Ce(a);
334
+ const r = i.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: l,
339
+ emitted: c,
341
340
  emitter: n,
342
- host: c
341
+ host: r
343
342
  }), n === i.label()) return;
344
- const r = u && !De.includes(o.type);
343
+ const l = u && !Pe.includes(o.type);
345
344
  let f = null;
346
- u && (f = s.getState().drift, o = F(
345
+ u && (f = s.getState().drift, o = $(
347
346
  o,
348
347
  f
349
348
  ));
350
- const h = t(o), b = r ? s.getState().drift : null, P = V(l, o.type);
349
+ const h = t(o), b = l ? s.getState().drift : null, D = U(c, o.type);
351
350
  return Re.runExclusive(async () => {
352
351
  try {
353
- f !== null && b !== null && await Le(f, b, i, e), P && await i.emit({ action: o });
354
- } catch (m) {
352
+ f !== null && b !== null && await Le(f, b, i, e), D && await i.emit({ action: o });
353
+ } catch (z) {
355
354
  d(e, "[drift] - ERROR", {
356
- error: m.message,
355
+ error: z.message,
357
356
  action: o,
358
- emitted: l,
357
+ emitted: c,
359
358
  emitter: n,
360
- host: c
361
- }), s.dispatch($({ key: c, message: m.message }));
359
+ host: r
360
+ }), s.dispatch(K({ key: r, message: z.message }));
362
361
  }
363
362
  }), h;
364
363
  }, je = (i, e, s = !1) => (t) => {
365
364
  const a = i != null ? typeof i == "function" ? i(t) : i : t();
366
- return [Pe(e, s), ...a];
367
- }, Ne = async ({
365
+ return [De(e, s), ...a];
366
+ }, Fe = async ({
368
367
  runtime: i,
369
368
  preloadedState: e,
370
369
  middleware: s,
371
370
  debug: t = !1,
372
371
  enablePrerender: a = !0,
373
372
  defaultWindowProps: o,
374
- ...l
373
+ ...c
375
374
  }) => {
376
375
  await i.configure();
377
376
  let n;
378
377
  n = j({
379
- ...l,
380
- preloadedState: await Fe(
378
+ ...c,
379
+ preloadedState: await Ne(
381
380
  t,
382
381
  i,
383
382
  () => n,
@@ -386,107 +385,166 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
386
385
  ),
387
386
  middleware: je(s, i, t)
388
387
  }), await Oe(n.getState().drift, n.dispatch, i, t);
389
- const c = i.label();
388
+ const r = i.label();
390
389
  return n.dispatch(
391
- U({ enablePrerender: a, defaultWindowProps: o, debug: t, label: c })
392
- ), n.dispatch(C({ stage: "created" })), i.onCloseRequested(() => n == null ? void 0 : n.dispatch(q({}))), n;
393
- }, Fe = async (i, e, s, t, a) => e.isMain() ? (await e.subscribe(({ action: l, emitter: n, sendState: c }) => {
390
+ Q({ enablePrerender: a, defaultWindowProps: o, debug: t, label: r })
391
+ ), n.dispatch(I({ stage: "created" })), i.onCloseRequested(() => n == null ? void 0 : n.dispatch(C({}))), n;
392
+ }, Ne = async (i, e, s, t, 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 (l != null) {
397
- _({ action: l, emitter: n }), u.dispatch(z(l, n));
395
+ if (c != null) {
396
+ _({ action: c, emitter: n }), u.dispatch(m(c, n));
398
397
  return;
399
398
  }
400
- const r = u.getState();
401
- c === !0 && e.emit({ state: r }, n);
402
- }), typeof a == "function" ? k(t, i, await a()) : k(t, i, a)) : await new Promise((l, n) => {
399
+ const l = u.getState();
400
+ r === !0 && e.emit({ state: l }, n);
401
+ }), typeof a == "function" ? v(t, i, await a()) : v(t, i, a)) : await new Promise((c, n) => {
403
402
  (async () => {
404
403
  try {
405
- await e.subscribe(({ action: u, emitter: r, state: f }) => {
404
+ await e.subscribe(({ action: u, emitter: l, state: f }) => {
406
405
  const h = s();
407
406
  if (h == null)
408
- return f != null ? l(f) : void 0;
409
- u != null && (_({ action: u, emitter: r }), h.dispatch(z(u, r)));
407
+ return f != null ? c(f) : void 0;
408
+ u != null && (_({ action: u, emitter: l }), h.dispatch(m(u, l)));
410
409
  }), await e.emit({ sendState: !0 }, w);
411
410
  } catch (u) {
412
411
  n(u);
413
412
  }
414
413
  })();
415
- }), Ve = Ne, k = (i, e, s) => {
414
+ }), Ve = Fe, v = (i, e, s) => {
416
415
  if (s == null) return s;
417
- const t = s[M];
416
+ const t = s[q];
418
417
  return t.config.debug = e ?? t.config.debug, t.windows = Object.fromEntries(
419
418
  Object.entries(t.windows).filter(([, a]) => a.reserved).map(([a, o]) => ((i == null ? void 0 : i.visible) != null && (o.visible = i.visible), o.focusCount = 0, o.centerCount = 0, o.processCount = 0, [a, o]))
420
419
  ), s;
421
- }, Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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 Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
422
478
  __proto__: null,
423
479
  MAIN_WINDOW: w,
424
- SLICE_NAME: M,
425
- ZERO_SLICE_STATE: Q,
426
- closeWindow: q,
427
- completeProcess: Z,
480
+ NoopRuntime: $e,
481
+ SLICE_NAME: q,
482
+ ZERO_SLICE_STATE: Z,
483
+ closeWindow: C,
484
+ completeProcess: X,
428
485
  configureStore: Ve,
429
- createWindow: K,
430
- focusWindow: X,
431
- reducer: B,
432
- registerProcess: J,
433
- reloadWindow: I,
486
+ createWindow: B,
487
+ focusWindow: G,
488
+ reducer: Y,
489
+ registerProcess: H,
490
+ reloadWindow: M,
434
491
  selectSliceState: de,
435
492
  selectWindow: we,
436
493
  selectWindowAttribute: he,
437
- selectWindowKey: pe,
438
- selectWindowLabel: ye,
494
+ selectWindowKey: ye,
495
+ selectWindowLabel: pe,
439
496
  selectWindows: _e,
440
- setWindowAlwaysOnTop: Y,
441
- setWindowDecorations: G,
442
- setWindowFullscreen: H,
443
- setWindowMaxSize: x,
444
- setWindowMaximized: W,
445
- setWindowMinSize: ee,
446
- setWindowMinimized: se,
447
- setWindowPosition: ie,
448
- setWindowProps: te,
449
- setWindowResizable: ae,
450
- setWindowSize: oe,
451
- setWindowSkipTaskbar: ne,
452
- setWindowStage: C,
453
- setWindowTitle: le,
454
- setWindowVisible: re,
497
+ setWindowAlwaysOnTop: J,
498
+ setWindowDecorations: x,
499
+ setWindowFullscreen: W,
500
+ setWindowMaxSize: ee,
501
+ setWindowMaximized: se,
502
+ setWindowMinSize: ie,
503
+ setWindowMinimized: te,
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
- Ke as Drift,
515
+ Ze as Drift,
459
516
  w as MAIN_WINDOW,
460
- M as SLICE_NAME,
461
- Q as ZERO_SLICE_STATE,
462
- q as closeWindow,
463
- Z as completeProcess,
517
+ $e as NoopRuntime,
518
+ q as SLICE_NAME,
519
+ Z as ZERO_SLICE_STATE,
520
+ C as closeWindow,
521
+ X as completeProcess,
464
522
  Ve as configureStore,
465
- K as createWindow,
466
- X as focusWindow,
467
- B as reducer,
468
- J as registerProcess,
469
- I as reloadWindow,
523
+ B as createWindow,
524
+ G as focusWindow,
525
+ Y as reducer,
526
+ H as registerProcess,
527
+ M as reloadWindow,
470
528
  de as selectSliceState,
471
529
  we as selectWindow,
472
530
  he as selectWindowAttribute,
473
- pe as selectWindowKey,
474
- ye as selectWindowLabel,
531
+ ye as selectWindowKey,
532
+ pe as selectWindowLabel,
475
533
  _e as selectWindows,
476
- Y as setWindowAlwaysOnTop,
477
- G as setWindowDecorations,
478
- H as setWindowFullscreen,
479
- x as setWindowMaxSize,
480
- W as setWindowMaximized,
481
- ee as setWindowMinSize,
482
- se as setWindowMinimized,
483
- ie as setWindowPosition,
484
- te as setWindowProps,
485
- ae as setWindowResizable,
486
- oe as setWindowSize,
487
- ne as setWindowSkipTaskbar,
488
- C as setWindowStage,
489
- le as setWindowTitle,
490
- re as setWindowVisible,
534
+ J as setWindowAlwaysOnTop,
535
+ x as setWindowDecorations,
536
+ W as setWindowFullscreen,
537
+ ee as setWindowMaxSize,
538
+ se as setWindowMaximized,
539
+ ie as setWindowMinSize,
540
+ te 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
  };
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-CGCIf0Ac.cjs"),i=require("./state-xseZCh_u.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-DrXQNVVN.cjs"),i=require("./state-BGByXBtX.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
package/dist/react.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { useCallback as l, useRef as f, useEffect as m, useState as d, createElement as W } from "react";
2
2
  import { useSelector as u, useDispatch as y, Provider as g } from "react-redux";
3
3
  import { memoize as i } from "proxy-memoize";
4
- import { a as k, e as S, c as P, b as v } from "./selectors-B00IQPYW.js";
5
- import { o as w, j as p } from "./state-BX_5GHgM.js";
4
+ import { a as k, e as S, c as P, b as v } from "./selectors-CzAkOydY.js";
5
+ import { o as w, j as p } from "./state-C1PObbun.js";
6
6
  const h = (e) => u(
7
7
  l(
8
8
  i((r) => k(r, e)),
@@ -1,4 +1,4 @@
1
- import { M as i } from "./window-DwJfMpbK.js";
1
+ import { M as i } from "./state-C1PObbun.js";
2
2
  const l = (n) => n.drift, a = (n) => Object.values(l(n).windows), r = (n, e) => {
3
3
  const t = l(n);
4
4
  if (e == null) return t.windows[t.label];
@@ -0,0 +1 @@
1
+ "use strict";const i=require("./state-BGByXBtX.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},u=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},w=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},d=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=w;exports.selectWindowKey=u;exports.selectWindowLabel=d;exports.selectWindows=r;
@@ -1,8 +1,8 @@
1
1
  export { configureStore } from './configureStore';
2
- export type { Runtime } from './runtime';
2
+ export { NoopRuntime } from './noop';
3
+ export { type Runtime } from './runtime';
3
4
  export { selectSliceState, selectWindow, selectWindowAttribute, selectWindowKey, selectWindowLabel, selectWindows, } from './selectors';
4
- export type { Action, CloseWindowPayload, CreateWindowPayload, SetWindowAlwaysOnTopPayload, SetWindowMaximizedPayload, SetWindowMaxSizePayload, SetWindowMinimizedPayload, SetWindowMinSizePayload, SetWindowPositionPayload, SetWindowPropsPayload, SetWindowResizablePayload, SetWindowSizePayload, SetWindowSkipTaskbarPayload, SetWindowTitlePayload, SetWindowVisiblePayload, SliceState, StoreState, } from './state';
5
- export { closeWindow, completeProcess, createWindow, focusWindow, reducer, registerProcess, reloadWindow, setWindowAlwaysOnTop, setWindowDecorations, setWindowFullscreen, setWindowMaximized, setWindowMaxSize, setWindowMinimized, setWindowMinSize, setWindowPosition, setWindowProps, setWindowResizable, setWindowSize, setWindowSkipTaskbar, setWindowStage, setWindowTitle, setWindowVisible, SLICE_NAME, ZERO_SLICE_STATE, } from './state';
5
+ export { type Action, closeWindow, type CloseWindowPayload, completeProcess, createWindow, type CreateWindowPayload, focusWindow, type FocusWindowPayload, reducer, registerProcess, reloadWindow, type ReloadWindowPayload, setWindowAlwaysOnTop, type SetWindowAlwaysOnTopPayload, setWindowDecorations, type SetWindowDecorationsPayload, setWindowFullscreen, type SetWindowFullScreenPayload, setWindowMaximized, type SetWindowMaximizedPayload, setWindowMaxSize, type SetWindowMaxSizePayload, setWindowMinimized, type SetWindowMinimizedPayload, setWindowMinSize, type SetWindowMinSizePayload, setWindowPosition, type SetWindowPositionPayload, setWindowProps, type SetWindowPropsPayload, setWindowResizable, type SetWindowResizablePayload, setWindowSize, type SetWindowSizePayload, setWindowSkipTaskbar, type SetWindowSkipTaskbarPayload, setWindowStage, type SetWindowStagePayload, setWindowTitle, type SetWindowTitlePayload, setWindowVisible, type SetWindowVisiblePayload, SLICE_NAME, type SliceState, type StoreState, ZERO_SLICE_STATE, } from './state';
6
6
  export { type WindowProps, windowPropsZ, type WindowStage, type WindowState, } from './window';
7
7
  export { MAIN_WINDOW } from './window';
8
8
  //# sourceMappingURL=external.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,OAAO,EACP,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,MAAM,EACX,WAAW,EACX,KAAK,kBAAkB,EACvB,eAAe,EACf,YAAY,EACZ,KAAK,mBAAmB,EACxB,WAAW,EACX,KAAK,kBAAkB,EACvB,OAAO,EACP,eAAe,EACf,YAAY,EACZ,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,cAAc,EACd,KAAK,qBAAqB,EAC1B,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,aAAa,EACb,KAAK,oBAAoB,EACzB,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,cAAc,EACd,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,UAAU,EACV,KAAK,UAAU,EACf,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}