@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/drift",
3
- "version": "0.42.3",
3
+ "version": "0.44.0",
4
4
  "description": "State synchronization and Redux state synchronization for Tauri Apps",
5
5
  "repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
6
6
  "type": "module",
@@ -14,30 +14,30 @@
14
14
  "application level state"
15
15
  ],
16
16
  "dependencies": {
17
- "@reduxjs/toolkit": "^2.6.1",
18
- "@tauri-apps/api": "^2.4.1",
17
+ "@reduxjs/toolkit": "^2.8.2",
18
+ "@tauri-apps/api": "^2.6.0",
19
19
  "async-mutex": "^0.5.0",
20
20
  "proxy-memoize": "2.0.3",
21
21
  "react": "^19.1.0",
22
22
  "react-dom": "^19.1.0",
23
23
  "react-redux": "^9.2.0",
24
- "zod": "^4.0.0-beta",
25
- "@synnaxlabs/x": "0.42.3"
24
+ "zod": "^4.0.2",
25
+ "@synnaxlabs/x": "^0.44.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/react": "^19.1.0",
29
- "@vitejs/plugin-react": "^4.3.4",
30
- "electron": "^33.4.4",
31
- "eslint": "^9.24.0",
28
+ "@types/react": "^19.1.8",
29
+ "@vitejs/plugin-react": "^4.6.0",
30
+ "electron": "^36.7.0",
31
+ "eslint": "^9.30.1",
32
32
  "react": "^19.1.0",
33
33
  "react-dom": "^19.1.0",
34
34
  "react-redux": "^9.2.0",
35
35
  "typescript": "^5.8.3",
36
- "vite": "^6.2.5",
37
- "vitest": "^3.1.1",
38
- "@synnaxlabs/tsconfig": "0.0.2",
39
- "eslint-config-synnaxlabs": "0.0.1",
40
- "@synnaxlabs/vite-plugin": "0.0.1"
36
+ "vite": "^7.0.4",
37
+ "vitest": "^3.2.4",
38
+ "@synnaxlabs/tsconfig": "^0.43.0",
39
+ "@synnaxlabs/vite-plugin": "^0.43.0",
40
+ "eslint-config-synnaxlabs": "^0.43.0"
41
41
  },
42
42
  "files": [
43
43
  "dist"
@@ -65,18 +65,14 @@
65
65
  "types": "./dist/src/electron/index.d.ts",
66
66
  "import": "./dist/electron.js",
67
67
  "require": "./dist/electron.cjs"
68
- },
69
- "./noop": {
70
- "types": "./dist/src/noop/index.d.ts",
71
- "import": "./dist/noop.js",
72
- "require": "./dist/noop.cjs"
73
68
  }
74
69
  },
75
70
  "scripts": {
76
71
  "build": "tsc --noEmit && vite build",
72
+ "check-types": "tsc --noEmit",
77
73
  "watch": "tsc --noEmit && vite build --watch",
78
74
  "test": "vitest",
79
- "lint": "eslint --cache",
80
- "fix": "eslint --cache --fix"
75
+ "lint": "eslint",
76
+ "fix": "eslint --fix"
81
77
  }
82
78
  }
package/dist/noop.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./window-Bj8OM9F9.cjs");class s{async configure(){}isMain(){return!0}label(){return e.MAIN_WINDOW}async emit(){}async subscribe(){}onCloseRequested(){}async listLabels(){return[e.MAIN_WINDOW]}async create(){}async close(){}async focus(){}async setMinimized(){}async setMaximized(){}async setVisible(){}async setFullscreen(){}async center(){}async setPosition(){}async setSize(){}async setMinSize(){}async setMaxSize(){}async setResizable(){}async setSkipTaskbar(){}async setAlwaysOnTop(){}async setTitle(){}async setDecorations(){}async getProps(){return{visible:!0,focus:!0,maximized:!1,minimized:!1,fullscreen:!1,position:{x:0,y:0},size:{width:800,height:600}}}}exports.NoopRuntime=s;
package/dist/noop.js DELETED
@@ -1,68 +0,0 @@
1
- import { M as s } from "./window-DwJfMpbK.js";
2
- class a {
3
- async configure() {
4
- }
5
- isMain() {
6
- return !0;
7
- }
8
- label() {
9
- return s;
10
- }
11
- async emit() {
12
- }
13
- async subscribe() {
14
- }
15
- onCloseRequested() {
16
- }
17
- async listLabels() {
18
- return [s];
19
- }
20
- async create() {
21
- }
22
- async close() {
23
- }
24
- async focus() {
25
- }
26
- async setMinimized() {
27
- }
28
- async setMaximized() {
29
- }
30
- async setVisible() {
31
- }
32
- async setFullscreen() {
33
- }
34
- async center() {
35
- }
36
- async setPosition() {
37
- }
38
- async setSize() {
39
- }
40
- async setMinSize() {
41
- }
42
- async setMaxSize() {
43
- }
44
- async setResizable() {
45
- }
46
- async setSkipTaskbar() {
47
- }
48
- async setAlwaysOnTop() {
49
- }
50
- async setTitle() {
51
- }
52
- async setDecorations() {
53
- }
54
- async getProps() {
55
- return {
56
- visible: !0,
57
- focus: !0,
58
- maximized: !1,
59
- minimized: !1,
60
- fullscreen: !1,
61
- position: { x: 0, y: 0 },
62
- size: { width: 800, height: 600 }
63
- };
64
- }
65
- }
66
- export {
67
- a as NoopRuntime
68
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("./window-Bj8OM9F9.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]},w=(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},d=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},u=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=d;exports.selectWindowKey=w;exports.selectWindowLabel=u;exports.selectWindows=r;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/noop/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,qBAAa,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,GAAG,aAAa,CAC7E,YAAW,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC,MAAM,IAAI,OAAO;IAIjB,KAAK,IAAI,MAAM;IAIT,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAErB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC,gBAAgB,IAAI,IAAI;IAElB,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAE5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CAWpD"}
@@ -1,406 +0,0 @@
1
- import { createSlice as R } from "@reduxjs/toolkit";
2
- import { o as W, O as _, M as f, I as v, P as A, a as O, L as S, $ as p, J as k } from "./window-DwJfMpbK.js";
3
- const y = (e = !1, ...n) => {
4
- e && console.log(...n);
5
- }, D = (e = !1, ...n) => {
6
- e && console.group(...n);
7
- }, z = (e) => {
8
- e && console.groupEnd();
9
- }, x = (e, n, t = ".") => {
10
- const o = e.split(t);
11
- return o.map((s, r) => {
12
- const i = n(s, r, o);
13
- return i == null ? null : typeof i == "string" ? i : i.join(t);
14
- }).filter((s) => s != null).join(t);
15
- }, j = (e, n, t = { optional: !1, separator: "." }) => {
16
- t.separator ?? (t.separator = ".");
17
- const { optional: o, getter: s = (a, l) => a[l] } = t, r = n.split(t.separator);
18
- if (r.length === 1 && r[0] === "") return e;
19
- let i = e;
20
- for (const a of r) {
21
- const l = s(i, a);
22
- if (l == null) {
23
- if (o) return null;
24
- throw new Error(`Path ${n} does not exist. ${a} is null`);
25
- }
26
- i = l;
27
- }
28
- return i;
29
- }, N = (e, n, t) => {
30
- const o = n.split(".");
31
- let s = e;
32
- for (let r = 0; r < o.length - 1; r++) {
33
- const i = o[r];
34
- s[i] ?? (s[i] = {}), s = s[i];
35
- }
36
- try {
37
- s[o[o.length - 1]] = t;
38
- } catch (r) {
39
- throw console.error("failed to set value", t, "at path", n, "on object", e), r;
40
- }
41
- }, $ = (e, n) => {
42
- const t = n.split(".");
43
- let o = e;
44
- for (let s = 0; s < t.length - 1; s++) {
45
- const r = t[s];
46
- if (o[r] == null) return;
47
- o = o[r];
48
- }
49
- if (Array.isArray(o)) {
50
- const s = parseInt(t[t.length - 1]);
51
- if (isNaN(s)) return;
52
- o.splice(s, 1);
53
- return;
54
- }
55
- delete o[t[t.length - 1]];
56
- }, q = (e, n) => {
57
- const t = e.split(".");
58
- return n < 0 ? t[t.length + n] : t[n];
59
- }, K = (e, n) => {
60
- try {
61
- return j(e, n), !0;
62
- } catch {
63
- return !1;
64
- }
65
- }, F = (e, n) => {
66
- if (n.length === 0) return !0;
67
- const t = e.split("."), o = n.split(".");
68
- if (o.length > t.length) return !1;
69
- for (let s = 0; s < o.length; s++) {
70
- const r = t[s], i = o[s];
71
- if (i !== "*" && r !== i)
72
- return !1;
73
- }
74
- return !0;
75
- }, V = (e) => JSON.parse(JSON.stringify(e)), Z = (e, ...n) => (n.forEach((t) => {
76
- let o = e;
77
- const s = t.split(".");
78
- s.forEach((r, i) => {
79
- i === s.length - 1 ? delete o[r] : r in o && (o = o[r]);
80
- });
81
- }), e), J = (e, n, t = "") => {
82
- const o = {}, s = (r, i, a) => {
83
- if (typeof r != typeof i || r === null || i === null) {
84
- o[a] = [r, i];
85
- return;
86
- }
87
- if (typeof r == "object" && typeof i == "object")
88
- if (Array.isArray(r) && Array.isArray(i)) {
89
- if (r.length !== i.length) {
90
- o[a] = [r, i];
91
- return;
92
- }
93
- for (let l = 0; l < r.length; l++) s(r[l], i[l], `${a}[${l}]`);
94
- } else
95
- (/* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])).forEach((l) => {
96
- s(r[l], i[l], a !== "" ? `${a}.${l}` : l);
97
- });
98
- else r !== i && (o[a] = [r, i]);
99
- };
100
- return s(e, n, t), o;
101
- }, h = (e, n) => {
102
- const t = Array.isArray(e), o = Array.isArray(n);
103
- if (t !== o) return !1;
104
- if (t && o) {
105
- const i = e, a = n;
106
- if (i.length !== a.length) return !1;
107
- for (let l = 0; l < i.length; l++) if (!h(i[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 s = Object.keys(e), r = Object.keys(n);
114
- if (s.length !== r.length) return !1;
115
- for (const i of s) {
116
- const a = e[i], l = n[i];
117
- if (typeof a == "object" && typeof l == "object") {
118
- if (!h(a, l)) return !1;
119
- } else if (a !== l) return !1;
120
- }
121
- return !0;
122
- }, L = (e, n) => {
123
- if (typeof e != "object" || e == null) return e === n;
124
- const t = Object.keys(e), o = Object.keys(n);
125
- if (o.length > t.length) return !1;
126
- for (const s of o) {
127
- const r = e[s], i = n[s];
128
- if (typeof r == "object" && typeof i == "object") {
129
- if (!L(r, i)) return !1;
130
- } else if (r !== i) return !1;
131
- }
132
- return !0;
133
- }, m = (e, ...n) => {
134
- if (n.length === 0) return e;
135
- const t = n.shift();
136
- if (W(e) && W(t))
137
- for (const o in t)
138
- try {
139
- W(t[o]) ? (o in e || Object.assign(e, { [o]: {} }), m(e[o], t[o])) : Object.assign(e, { [o]: t[o] });
140
- } catch (s) {
141
- throw s instanceof TypeError ? new TypeError(`.${o}: ${s.message}`) : s;
142
- }
143
- return m(e, ...n);
144
- }, B = (e, n, t) => {
145
- const o = (s, r, i) => {
146
- var a, l;
147
- if (((a = i.def) == null ? void 0 : a.type) === "union")
148
- return i.def.options.reduce(
149
- (d, w) => o(d, r, w),
150
- s
151
- );
152
- if (((l = i.def) == null ? void 0 : l.type) === "intersection") {
153
- const d = o(s, r, i.def.left);
154
- return o(d, r, i.def.right);
155
- }
156
- for (const d in r) {
157
- const w = r[d], g = i == null ? void 0 : i.shape;
158
- if (g != null && g[d]) {
159
- const E = g[d].safeParse(w);
160
- E.success && (s[d] = E.data);
161
- } else typeof w == "object" && !Array.isArray(w) && w !== null && i && i.shape && i.shape[d] && (s[d] || (s[d] = {}), o(s[d], w, i.shape[d]));
162
- }
163
- return s;
164
- };
165
- return o({ ...e }, n, t);
166
- }, I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
167
- __proto__: null,
168
- copy: V,
169
- deleteD: Z,
170
- difference: J,
171
- element: q,
172
- equal: h,
173
- get: j,
174
- has: K,
175
- override: m,
176
- overrideValidItems: B,
177
- partialEqual: L,
178
- pathsMatch: F,
179
- remove: $,
180
- set: N,
181
- transformPath: x
182
- }, Symbol.toStringTag, { value: "Module" })), H = _.milliseconds(50), T = () => setTimeout(() => window.location.reload(), H.milliseconds), U = {
183
- label: f,
184
- config: {
185
- enablePrerender: !0,
186
- debug: !1,
187
- defaultWindowProps: {}
188
- },
189
- windows: {
190
- main: {
191
- ...v,
192
- key: f,
193
- reserved: !0
194
- }
195
- },
196
- labelKeys: {
197
- main: f
198
- },
199
- keyLabels: {
200
- main: f
201
- }
202
- }, ve = (e, n) => {
203
- if (e.type === me.type)
204
- return n.label !== f || (e.payload.label = S.create(), e.payload.prerenderLabel = S.create()), e;
205
- if ("label" in e.payload) return e;
206
- let t = n.label;
207
- const o = e.payload;
208
- return o.key != null && (o.key in n.windows ? t = o.key : t = n.keyLabels[o.key]), e.payload = { ...e.payload, label: t }, e;
209
- }, c = (e) => (n, t) => {
210
- if (!("label" in t.payload)) throw new Error("Missing label");
211
- e(n, t);
212
- }, u = (e, n = !1) => c((t, o) => {
213
- let s = n;
214
- const r = t.windows[o.payload.label];
215
- if (r != null) {
216
- if (o.payload.value != null) s = o.payload.value;
217
- else {
218
- const i = r[e];
219
- i != null && (s = !i);
220
- }
221
- t.windows[o.payload.label] = { ...r, [e]: s };
222
- }
223
- }), b = (e, n = !1) => (t, o) => {
224
- const s = t.windows[o.payload.label];
225
- s != null && (t.windows[o.payload.label] = {
226
- ...s,
227
- [e]: s[e] + (n ? -1 : 1)
228
- });
229
- }, X = (e) => Object.values(e.windows).some((n) => n.key === A && !n.reserved), C = "drift", Y = (e, n, t) => e.position != null && e.size != null && n == null ? p.topLeft(
230
- p.positionInCenter(
231
- p.construct(k.ZERO, t ?? k.ZERO),
232
- p.construct(e.position, e.size)
233
- )
234
- ) : n, G = (e, { payload: n }) => {
235
- if (n.key === A) return;
236
- const { key: t, label: o, prerenderLabel: s } = n;
237
- if (o == null || s == null)
238
- throw new Error("[drift] - bug - missing label and prerender label");
239
- console.log(e.config.debug), D(e.config.debug, "reducer create window");
240
- const r = e.windows.main;
241
- if (n.position = Y(r, n.position, n.size), t in e.keyLabels) {
242
- y(e.config.debug, "window already exists, un-minimize and focus it");
243
- const l = e.keyLabels[n.key];
244
- e.windows[l].visible = !0, e.windows[l].focusCount += 1, e.windows[l].minimized = !1, e.windows[l].position = n.position, z(e.config.debug);
245
- return;
246
- }
247
- const [i, a] = Object.entries(e.windows).find(
248
- ([, l]) => !l.reserved
249
- ) ?? [null, null];
250
- i != null ? (y(e.config.debug, "using available pre-rendered window"), e.windows[i] = {
251
- ...a,
252
- visible: !0,
253
- reserved: !0,
254
- focusCount: 1,
255
- focus: !0,
256
- ...n
257
- }, e.labelKeys[i] = n.key, e.keyLabels[n.key] = i) : (y(e.config.debug, "creating new window"), e.windows[o] = {
258
- ...e.config.defaultWindowProps,
259
- ...v,
260
- ...n,
261
- reserved: !0
262
- }, e.labelKeys[o] = t, e.keyLabels[t] = o), e.config.enablePrerender && !X(e) && (y(e.config.debug, "creating pre-render window"), e.windows[s] = I.copy({
263
- ...e.config.defaultWindowProps,
264
- ...O
265
- })), z(e.config.debug);
266
- }, Q = c((e, n) => {
267
- const t = e.windows[n.payload.label];
268
- t != null && (t.stage = n.payload.stage);
269
- }), ee = c(
270
- (e, { payload: { label: n } }) => {
271
- const t = e.windows[n];
272
- t == null || t.processCount > 0 || (t.stage = "closing", delete e.windows[n], delete e.labelKeys[n], delete e.keyLabels[t.key]);
273
- }
274
- ), ne = c((e, n) => {
275
- const t = e.windows[n.payload.label];
276
- t == null || t.processCount > 0 || (t.stage = "reloading", T());
277
- }), te = c(
278
- b("processCount")
279
- ), oe = c((e, n) => {
280
- b("processCount", !0)(e, n);
281
- const t = e.windows[n.payload.label];
282
- t != null && t.processCount === 0 && (t.stage === "reloading" ? T() : (e.windows[n.payload.label].visible = !1, delete e.windows[n.payload.label], delete e.labelKeys[n.payload.label], delete e.keyLabels[t.key]));
283
- }), ie = (e, n) => {
284
- const t = e.windows[n.payload.key];
285
- t != null && (t.error = n.payload.message);
286
- }, se = c((e, n) => {
287
- const t = e.windows[n.payload.label];
288
- t != null && (t.visible !== !0 && (t.visible = !0), b("focusCount")(e, n));
289
- }), re = u("minimized"), le = u("maximized"), ae = u("visible", !0), de = u("fullscreen", !0), ce = c(
290
- b("centerCount")
291
- ), ue = c((e, n) => {
292
- e.windows[n.payload.label].position = n.payload.position;
293
- }), we = c((e, n) => {
294
- e.windows[n.payload.label].size = n.payload.size;
295
- }), fe = c((e, n) => {
296
- e.windows[n.payload.label].minSize = n.payload.size;
297
- }), pe = c((e, n) => {
298
- e.windows[n.payload.label].maxSize = n.payload.size;
299
- }), ye = u("resizable"), be = u("skipTaskbar"), ge = u("alwaysOnTop"), We = c((e, n) => {
300
- e.windows[n.payload.label].title = n.payload.title;
301
- }), Se = u("decorations"), P = (e, n) => {
302
- const t = e.windows[n.payload.label];
303
- I.partialEqual(t, n.payload) || (e.windows[n.payload.label] = { ...t, ...n.payload });
304
- }, he = (e, n) => {
305
- if (e.config = { ...e.config, ...n.payload }, e.label = n.payload.label, e.label === f && e.config.enablePrerender) {
306
- const t = S.create();
307
- e.windows[t] = {
308
- ...e.config.defaultWindowProps,
309
- ...O
310
- };
311
- }
312
- }, M = R({
313
- name: C,
314
- initialState: U,
315
- reducers: {
316
- internalSetInitial: he,
317
- createWindow: G,
318
- setWindowStage: Q,
319
- closeWindow: ee,
320
- registerProcess: te,
321
- completeProcess: oe,
322
- setWindowError: ie,
323
- focusWindow: se,
324
- reloadWindow: ne,
325
- setWindowMinimized: re,
326
- setWindowMaximized: le,
327
- setWindowVisible: ae,
328
- setWindowFullscreen: de,
329
- centerWindow: ce,
330
- setWindowPosition: ue,
331
- setWindowSize: we,
332
- setWindowMinSize: fe,
333
- setWindowMaxSize: pe,
334
- setWindowResizable: ye,
335
- setWindowSkipTaskbar: be,
336
- setWindowAlwaysOnTop: ge,
337
- setWindowTitle: We,
338
- setWindowDecorations: Se,
339
- runtimeSetWindowProps: P,
340
- setWindowProps: P
341
- }
342
- }), {
343
- actions: {
344
- runtimeSetWindowProps: Ae,
345
- setWindowProps: Oe,
346
- createWindow: me,
347
- internalSetInitial: Ee,
348
- setWindowStage: je,
349
- closeWindow: Le,
350
- registerProcess: Ie,
351
- completeProcess: Te,
352
- setWindowError: Ce,
353
- focusWindow: Me,
354
- reloadWindow: Re,
355
- setWindowMinimized: _e,
356
- setWindowMaximized: De,
357
- setWindowVisible: xe,
358
- setWindowFullscreen: Ne,
359
- centerWindow: $e,
360
- setWindowPosition: qe,
361
- setWindowSize: Ke,
362
- setWindowMinSize: Fe,
363
- setWindowMaxSize: Ve,
364
- setWindowResizable: Ze,
365
- setWindowSkipTaskbar: Je,
366
- setWindowAlwaysOnTop: Be,
367
- setWindowTitle: He,
368
- setWindowDecorations: Ue
369
- }
370
- } = M, Xe = M.reducer, Ye = (e) => e.startsWith(C), ke = [Ee.type], Ge = (e, n) => !e && !ke.includes(n);
371
- export {
372
- Ze as A,
373
- Ke as B,
374
- Je as C,
375
- He as D,
376
- xe as E,
377
- I as F,
378
- C as S,
379
- U as Z,
380
- z as a,
381
- Re as b,
382
- ve as c,
383
- Ce as d,
384
- Ee as e,
385
- je as f,
386
- D as g,
387
- Le as h,
388
- Ye as i,
389
- Te as j,
390
- me as k,
391
- y as l,
392
- Me as m,
393
- Xe as n,
394
- Ie as o,
395
- Be as p,
396
- Ue as q,
397
- Ae as r,
398
- Ge as s,
399
- Ne as t,
400
- Ve as u,
401
- De as v,
402
- Fe as w,
403
- _e as x,
404
- qe as y,
405
- Oe as z
406
- };
@@ -1 +0,0 @@
1
- "use strict";const _=require("@reduxjs/toolkit"),a=require("./window-Bj8OM9F9.cjs"),p=(e=!1,...n)=>{e&&console.log(...n)},A=(e=!1,...n)=>{e&&console.group(...n)},y=e=>{e&&console.groupEnd()},v=(e,n,t=".")=>{const o=e.split(t);return o.map((r,s)=>{const i=n(r,s,o);return i==null?null:typeof i=="string"?i:i.join(t)}).filter(r=>r!=null).join(t)},k=(e,n,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:o,getter:r=(d,l)=>d[l]}=t,s=n.split(t.separator);if(s.length===1&&s[0]==="")return e;let i=e;for(const d of s){const l=r(i,d);if(l==null){if(o)return null;throw new Error(`Path ${n} does not exist. ${d} is null`)}i=l}return i},D=(e,n,t)=>{const o=n.split(".");let r=e;for(let s=0;s<o.length-1;s++){const i=o[s];r[i]??(r[i]={}),r=r[i]}try{r[o[o.length-1]]=t}catch(s){throw console.error("failed to set value",t,"at path",n,"on object",e),s}},M=(e,n)=>{const t=n.split(".");let o=e;for(let r=0;r<t.length-1;r++){const s=t[r];if(o[s]==null)return;o=o[s]}if(Array.isArray(o)){const r=parseInt(t[t.length-1]);if(isNaN(r))return;o.splice(r,1);return}delete o[t[t.length-1]]},j=(e,n)=>{const t=e.split(".");return n<0?t[t.length+n]:t[n]},R=(e,n)=>{try{return k(e,n),!0}catch{return!1}},C=(e,n)=>{if(n.length===0)return!0;const t=e.split("."),o=n.split(".");if(o.length>t.length)return!1;for(let r=0;r<o.length;r++){const s=t[r],i=o[r];if(i!=="*"&&s!==i)return!1}return!0},x=e=>JSON.parse(JSON.stringify(e)),$=(e,...n)=>(n.forEach(t=>{let o=e;const r=t.split(".");r.forEach((s,i)=>{i===r.length-1?delete o[s]:s in o&&(o=o[s])})}),e),q=(e,n,t="")=>{const o={},r=(s,i,d)=>{if(typeof s!=typeof i||s===null||i===null){o[d]=[s,i];return}if(typeof s=="object"&&typeof i=="object")if(Array.isArray(s)&&Array.isArray(i)){if(s.length!==i.length){o[d]=[s,i];return}for(let l=0;l<s.length;l++)r(s[l],i[l],`${d}[${l}]`)}else new Set([...Object.keys(s),...Object.keys(i)]).forEach(l=>{r(s[l],i[l],d!==""?`${d}.${l}`:l)});else s!==i&&(o[d]=[s,i])};return r(e,n,t),o},g=(e,n)=>{const t=Array.isArray(e),o=Array.isArray(n);if(t!==o)return!1;if(t&&o){const i=e,d=n;if(i.length!==d.length)return!1;for(let l=0;l<i.length;l++)if(!g(i[l],d[l]))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 r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(const i of r){const d=e[i],l=n[i];if(typeof d=="object"&&typeof l=="object"){if(!g(d,l))return!1}else if(d!==l)return!1}return!0},z=(e,n)=>{if(typeof e!="object"||e==null)return e===n;const t=Object.keys(e),o=Object.keys(n);if(o.length>t.length)return!1;for(const r of o){const s=e[r],i=n[r];if(typeof s=="object"&&typeof i=="object"){if(!z(s,i))return!1}else if(s!==i)return!1}return!0},S=(e,...n)=>{if(n.length===0)return e;const t=n.shift();if(a.o(e)&&a.o(t))for(const o in t)try{a.o(t[o])?(o in e||Object.assign(e,{[o]:{}}),S(e[o],t[o])):Object.assign(e,{[o]:t[o]})}catch(r){throw r instanceof TypeError?new TypeError(`.${o}: ${r.message}`):r}return S(e,...n)},K=(e,n,t)=>{const o=(r,s,i)=>{var d,l;if(((d=i.def)==null?void 0:d.type)==="union")return i.def.options.reduce((c,f)=>o(c,s,f),r);if(((l=i.def)==null?void 0:l.type)==="intersection"){const c=o(r,s,i.def.left);return o(c,s,i.def.right)}for(const c in s){const f=s[c],b=i==null?void 0:i.shape;if(b!=null&&b[c]){const m=b[c].safeParse(f);m.success&&(r[c]=m.data)}else typeof f=="object"&&!Array.isArray(f)&&f!==null&&i&&i.shape&&i.shape[c]&&(r[c]||(r[c]={}),o(r[c],f,i.shape[c]))}return r};return o({...e},n,t)},E=Object.freeze(Object.defineProperty({__proto__:null,copy:x,deleteD:$,difference:q,element:j,equal:g,get:k,has:R,override:S,overrideValidItems:K,partialEqual:z,pathsMatch:C,remove:M,set:D,transformPath:v},Symbol.toStringTag,{value:"Module"})),F=a.O.milliseconds(50),O=()=>setTimeout(()=>window.location.reload(),F.milliseconds),P={label:a.MAIN_WINDOW,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...a.INITIAL_WINDOW_STATE,key:a.MAIN_WINDOW,reserved:!0}},labelKeys:{main:a.MAIN_WINDOW},keyLabels:{main:a.MAIN_WINDOW}},V=(e,n)=>{if(e.type===N.type)return n.label!==a.MAIN_WINDOW||(e.payload.label=a.Lt.create(),e.payload.prerenderLabel=a.Lt.create()),e;if("label"in e.payload)return e;let t=n.label;const o=e.payload;return o.key!=null&&(o.key in n.windows?t=o.key:t=n.keyLabels[o.key]),e.payload={...e.payload,label:t},e},u=e=>(n,t)=>{if(!("label"in t.payload))throw new Error("Missing label");e(n,t)},w=(e,n=!1)=>u((t,o)=>{let r=n;const s=t.windows[o.payload.label];if(s!=null){if(o.payload.value!=null)r=o.payload.value;else{const i=s[e];i!=null&&(r=!i)}t.windows[o.payload.label]={...s,[e]:r}}}),W=(e,n=!1)=>(t,o)=>{const r=t.windows[o.payload.label];r!=null&&(t.windows[o.payload.label]={...r,[e]:r[e]+(n?-1:1)})},J=e=>Object.values(e.windows).some(n=>n.key===a.PRERENDER_WINDOW&&!n.reserved),h="drift",Z=(e,n,t)=>e.position!=null&&e.size!=null&&n==null?a.$t.topLeft(a.$t.positionInCenter(a.$t.construct(a.J.ZERO,t??a.J.ZERO),a.$t.construct(e.position,e.size))):n,B=(e,{payload:n})=>{if(n.key===a.PRERENDER_WINDOW)return;const{key:t,label:o,prerenderLabel:r}=n;if(o==null||r==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(e.config.debug),A(e.config.debug,"reducer create window");const s=e.windows.main;if(n.position=Z(s,n.position,n.size),t in e.keyLabels){p(e.config.debug,"window already exists, un-minimize and focus it");const l=e.keyLabels[n.key];e.windows[l].visible=!0,e.windows[l].focusCount+=1,e.windows[l].minimized=!1,e.windows[l].position=n.position,y(e.config.debug);return}const[i,d]=Object.entries(e.windows).find(([,l])=>!l.reserved)??[null,null];i!=null?(p(e.config.debug,"using available pre-rendered window"),e.windows[i]={...d,visible:!0,reserved:!0,focusCount:1,focus:!0,...n},e.labelKeys[i]=n.key,e.keyLabels[n.key]=i):(p(e.config.debug,"creating new window"),e.windows[o]={...e.config.defaultWindowProps,...a.INITIAL_WINDOW_STATE,...n,reserved:!0},e.labelKeys[o]=t,e.keyLabels[t]=o),e.config.enablePrerender&&!J(e)&&(p(e.config.debug,"creating pre-render window"),e.windows[r]=E.copy({...e.config.defaultWindowProps,...a.INITIAL_PRERENDER_WINDOW_STATE})),y(e.config.debug)},H=u((e,n)=>{const t=e.windows[n.payload.label];t!=null&&(t.stage=n.payload.stage)}),U=u((e,{payload:{label:n}})=>{const t=e.windows[n];t==null||t.processCount>0||(t.stage="closing",delete e.windows[n],delete e.labelKeys[n],delete e.keyLabels[t.key])}),X=u((e,n)=>{const t=e.windows[n.payload.label];t==null||t.processCount>0||(t.stage="reloading",O())}),Y=u(W("processCount")),G=u((e,n)=>{W("processCount",!0)(e,n);const t=e.windows[n.payload.label];t!=null&&t.processCount===0&&(t.stage==="reloading"?O():(e.windows[n.payload.label].visible=!1,delete e.windows[n.payload.label],delete e.labelKeys[n.payload.label],delete e.keyLabels[t.key]))}),Q=(e,n)=>{const t=e.windows[n.payload.key];t!=null&&(t.error=n.payload.message)},ee=u((e,n)=>{const t=e.windows[n.payload.label];t!=null&&(t.visible!==!0&&(t.visible=!0),W("focusCount")(e,n))}),ne=w("minimized"),te=w("maximized"),oe=w("visible",!0),ie=w("fullscreen",!0),re=u(W("centerCount")),se=u((e,n)=>{e.windows[n.payload.label].position=n.payload.position}),le=u((e,n)=>{e.windows[n.payload.label].size=n.payload.size}),ae=u((e,n)=>{e.windows[n.payload.label].minSize=n.payload.size}),de=u((e,n)=>{e.windows[n.payload.label].maxSize=n.payload.size}),ce=w("resizable"),ue=w("skipTaskbar"),we=w("alwaysOnTop"),fe=u((e,n)=>{e.windows[n.payload.label].title=n.payload.title}),pe=w("decorations"),I=(e,n)=>{const t=e.windows[n.payload.label];E.partialEqual(t,n.payload)||(e.windows[n.payload.label]={...t,...n.payload})},We=(e,n)=>{if(e.config={...e.config,...n.payload},e.label=n.payload.label,e.label===a.MAIN_WINDOW&&e.config.enablePrerender){const t=a.Lt.create();e.windows[t]={...e.config.defaultWindowProps,...a.INITIAL_PRERENDER_WINDOW_STATE}}},T=_.createSlice({name:h,initialState:P,reducers:{internalSetInitial:We,createWindow:B,setWindowStage:H,closeWindow:U,registerProcess:Y,completeProcess:G,setWindowError:Q,focusWindow:ee,reloadWindow:X,setWindowMinimized:ne,setWindowMaximized:te,setWindowVisible:oe,setWindowFullscreen:ie,centerWindow:re,setWindowPosition:se,setWindowSize:le,setWindowMinSize:ae,setWindowMaxSize:de,setWindowResizable:ce,setWindowSkipTaskbar:ue,setWindowAlwaysOnTop:we,setWindowTitle:fe,setWindowDecorations:pe,runtimeSetWindowProps:I,setWindowProps:I}}),{actions:{runtimeSetWindowProps:be,setWindowProps:ye,createWindow:N,internalSetInitial:L,setWindowStage:ge,closeWindow:Se,registerProcess:Ee,completeProcess:he,setWindowError:me,focusWindow:Ie,reloadWindow:Ae,setWindowMinimized:ke,setWindowMaximized:ze,setWindowVisible:Oe,setWindowFullscreen:Pe,centerWindow:Ke,setWindowPosition:Te,setWindowSize:Ne,setWindowMinSize:Le,setWindowMaxSize:_e,setWindowResizable:ve,setWindowSkipTaskbar:De,setWindowAlwaysOnTop:Me,setWindowTitle:je,setWindowDecorations:Re}}=T,Ce=T.reducer,xe=e=>e.startsWith(h),$e=[L.type],qe=(e,n)=>!e&&!$e.includes(n);exports.SLICE_NAME=h;exports.ZERO_SLICE_STATE=P;exports.assignLabel=V;exports.closeWindow=Se;exports.completeProcess=he;exports.createWindow=N;exports.focusWindow=Ie;exports.group=A;exports.groupEnd=y;exports.internalSetInitial=L;exports.isDriftAction=xe;exports.log=p;exports.reducer=Ce;exports.registerProcess=Ee;exports.reloadWindow=Ae;exports.runtimeSetWindowProps=be;exports.setWindowAlwaysOnTop=Me;exports.setWindowDecorations=Re;exports.setWindowError=me;exports.setWindowFullscreen=Pe;exports.setWindowMaxSize=_e;exports.setWindowMaximized=ze;exports.setWindowMinSize=Le;exports.setWindowMinimized=ke;exports.setWindowPosition=Te;exports.setWindowProps=ye;exports.setWindowResizable=ve;exports.setWindowSize=Ne;exports.setWindowSkipTaskbar=De;exports.setWindowStage=ge;exports.setWindowTitle=je;exports.setWindowVisible=Oe;exports.shouldEmit=qe;exports.x=E;