@synnaxlabs/drift 0.47.0 → 0.49.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 +3 -3
- package/dist/eslint.config.d.ts +2 -1
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +209 -223
- package/dist/react.cjs +1 -1
- package/dist/react.js +16 -16
- package/dist/{selectors-BjelCGzn.cjs → selectors-C-yu1uR2.cjs} +1 -1
- package/dist/{selectors-ZKSe28UL.js → selectors-UsB3Nvlx.js} +1 -1
- package/dist/src/configureStore.d.ts +13 -14
- package/dist/src/configureStore.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/state-B6GRS-m8.cjs +28 -0
- package/dist/{state-DhV1kb1g.js → state-D-AHxNXX.js} +3557 -3397
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +72 -69
- package/package.json +16 -23
- package/dist/debounce-BUAIXXZt.cjs +0 -1
- package/dist/debounce-DOZKRZa9.js +0 -9
- package/dist/electron.cjs +0 -1
- package/dist/electron.js +0 -249
- package/dist/src/electron/index.d.ts +0 -49
- package/dist/src/electron/index.d.ts.map +0 -1
- package/dist/state-CpvoH8kq.cjs +0 -28
package/dist/electron.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { M as h, r as v } from "./state-DhV1kb1g.js";
|
|
2
|
-
import { o as R } from "./debounce-DOZKRZa9.js";
|
|
3
|
-
const u = "drift://action", m = "drift://create", _ = "drift://focus", p = "drift://close", S = "drift://set-minimized", w = "drift://set-maximized", z = "drift://set-visible", b = "drift://set-fullscreen", y = "drift://center", I = "drift://set-position", N = "drift://set-size", M = "drift://set-min-size", O = "drift://set-max-size", g = "drift://set-resizable", A = "drift://set-skip-taskbar", V = "drift://set-always-on-top", x = "drift://set-title", W = "drift://set-decorations", T = "drift://get-props", k = "drift://get-label", B = [
|
|
4
|
-
u,
|
|
5
|
-
m,
|
|
6
|
-
_,
|
|
7
|
-
p,
|
|
8
|
-
S,
|
|
9
|
-
w,
|
|
10
|
-
z,
|
|
11
|
-
b,
|
|
12
|
-
y,
|
|
13
|
-
I,
|
|
14
|
-
N,
|
|
15
|
-
M,
|
|
16
|
-
O,
|
|
17
|
-
g,
|
|
18
|
-
A,
|
|
19
|
-
V,
|
|
20
|
-
x,
|
|
21
|
-
W,
|
|
22
|
-
T
|
|
23
|
-
], H = (t) => {
|
|
24
|
-
if (!B.includes(t))
|
|
25
|
-
throw new Error(`Event ${t} is not on the list of allowed events`);
|
|
26
|
-
}, Z = [u], F = (t) => {
|
|
27
|
-
if (!Z.includes(t))
|
|
28
|
-
throw new Error(`Event ${t} is not on the list of allowed events`);
|
|
29
|
-
}, U = [T, k], q = (t) => {
|
|
30
|
-
if (!U.includes(t))
|
|
31
|
-
throw new Error(`Command ${t} is not on the list of allowed commands`);
|
|
32
|
-
}, $ = (t) => ({
|
|
33
|
-
x: t.position?.x,
|
|
34
|
-
y: t.position?.y,
|
|
35
|
-
width: t.size?.width,
|
|
36
|
-
height: t.size?.height,
|
|
37
|
-
center: t.center,
|
|
38
|
-
minHeight: t.minSize?.height,
|
|
39
|
-
minWidth: t.minSize?.width,
|
|
40
|
-
maxHeight: t.maxSize?.height,
|
|
41
|
-
maxWidth: t.maxSize?.width,
|
|
42
|
-
resizable: t.resizable,
|
|
43
|
-
fullscreen: t.fullscreen,
|
|
44
|
-
skipTaskbar: t.skipTaskbar,
|
|
45
|
-
title: t.title,
|
|
46
|
-
show: t.visible,
|
|
47
|
-
transparent: t.transparent,
|
|
48
|
-
alwaysOnTop: t.alwaysOnTop
|
|
49
|
-
}), G = (t) => {
|
|
50
|
-
const [s, a] = t.getSize(), [o, l] = t.getPosition();
|
|
51
|
-
return {
|
|
52
|
-
size: { width: s, height: a },
|
|
53
|
-
position: { x: o, y: l },
|
|
54
|
-
minimized: t.isMinimized(),
|
|
55
|
-
maximized: t.isMaximized(),
|
|
56
|
-
fullscreen: t.isFullScreen(),
|
|
57
|
-
visible: t.isVisible(),
|
|
58
|
-
resizable: t.isResizable(),
|
|
59
|
-
skipTaskbar: !1,
|
|
60
|
-
title: t.getTitle(),
|
|
61
|
-
alwaysOnTop: t.isAlwaysOnTop(),
|
|
62
|
-
decorations: !1
|
|
63
|
-
};
|
|
64
|
-
}, X = ({ mainWindow: t, createWindow: s }) => {
|
|
65
|
-
const a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
66
|
-
a.set(h, t.id), o.set(t.id, h);
|
|
67
|
-
const { ipcMain: l, BrowserWindow: E } = require("electron"), d = (i, e) => l.on(i, (n, r) => {
|
|
68
|
-
const c = E.fromWebContents(n.sender);
|
|
69
|
-
c != null && e(c, r);
|
|
70
|
-
});
|
|
71
|
-
l.on(p, (i, e) => {
|
|
72
|
-
const n = a.get(e);
|
|
73
|
-
if (n == null) return;
|
|
74
|
-
const r = E.fromId(n);
|
|
75
|
-
r != null && (r.close(), a.delete(e), o.delete(n));
|
|
76
|
-
}), l.handle(T, (i) => {
|
|
77
|
-
const e = E.fromWebContents(i.sender);
|
|
78
|
-
return e == null ? void 0 : { ...G(e), label: o.get(e.id) };
|
|
79
|
-
}), l.handle(k, (i) => {
|
|
80
|
-
const e = E.fromWebContents(i.sender);
|
|
81
|
-
if (e != null)
|
|
82
|
-
return o.get(e.id);
|
|
83
|
-
});
|
|
84
|
-
const D = (i, e, n) => {
|
|
85
|
-
i.on(e, R(n, 500));
|
|
86
|
-
}, C = (i) => {
|
|
87
|
-
for (const e of o.keys())
|
|
88
|
-
E.fromId(e)?.webContents.send(u, i);
|
|
89
|
-
}, P = (i, e) => {
|
|
90
|
-
const n = (r, c) => {
|
|
91
|
-
D(e, r, () => {
|
|
92
|
-
C({
|
|
93
|
-
action: v({ label: i, ...c(e) }),
|
|
94
|
-
emitter: "WHITELIST"
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
n("resize", (r) => {
|
|
99
|
-
const [c, L] = r.getSize();
|
|
100
|
-
return { size: { width: c, height: L } };
|
|
101
|
-
}), n("move", () => {
|
|
102
|
-
const [r, c] = e.getPosition();
|
|
103
|
-
return { position: { x: r, y: c } };
|
|
104
|
-
}), n("minimize", () => ({ minimized: !0 })), n("restore", () => ({ minimized: !1 })), n("maximize", () => ({ maximized: !0 })), n("unmaximize", () => ({ maximized: !1 })), n("enter-full-screen", (r) => (r.setWindowButtonVisibility(!0), { fullscreen: !0 })), n("leave-full-screen", () => (e.setWindowButtonVisibility(!1), { fullscreen: !1 }));
|
|
105
|
-
};
|
|
106
|
-
P(h, t), d(_, (i) => i.focus()), d(S, (i) => i.minimize()), d(w, (i) => i.maximize()), d(z, (i, e) => e ? i.show() : i.hide()), d(b, (i) => i.setFullScreen(!0)), d(y, (i) => i.center()), d(I, (i, { x: e, y: n }) => {
|
|
107
|
-
i.setPosition(Math.round(e), Math.round(n));
|
|
108
|
-
}), d(N, (i, { width: e, height: n }) => {
|
|
109
|
-
i.setSize(Math.round(e), Math.round(n));
|
|
110
|
-
}), d(
|
|
111
|
-
M,
|
|
112
|
-
(i, { width: e, height: n }) => i.setMinimumSize(Math.round(e), Math.round(n))
|
|
113
|
-
), d(
|
|
114
|
-
O,
|
|
115
|
-
(i, { width: e, height: n }) => i.setMaximumSize(Math.round(e), Math.round(n))
|
|
116
|
-
), d(g, (i, e) => i.setResizable(e)), d(
|
|
117
|
-
A,
|
|
118
|
-
(i, e) => i.setSkipTaskbar(e)
|
|
119
|
-
), d(
|
|
120
|
-
V,
|
|
121
|
-
(i, e) => i.setAlwaysOnTop(e)
|
|
122
|
-
), d(x, (i, e) => i.setTitle(e)), l.on(
|
|
123
|
-
m,
|
|
124
|
-
(i, e, n) => {
|
|
125
|
-
const r = s($(n));
|
|
126
|
-
a.set(e, r.id), o.set(r.id, e), P(e, r);
|
|
127
|
-
}
|
|
128
|
-
), l.on(u, (i, e, n) => {
|
|
129
|
-
if (e == null) return;
|
|
130
|
-
if (n == null) return C(e);
|
|
131
|
-
const r = a.get(n);
|
|
132
|
-
if (r == null) return;
|
|
133
|
-
const c = E.fromId(r);
|
|
134
|
-
c?.webContents.send(u, e);
|
|
135
|
-
});
|
|
136
|
-
}, f = "driftAPI", Y = () => {
|
|
137
|
-
const { ipcRenderer: t, contextBridge: s } = require("electron"), a = {
|
|
138
|
-
send: (o, ...l) => {
|
|
139
|
-
H(o), t.send(o, ...l);
|
|
140
|
-
},
|
|
141
|
-
invoke: async (o, ...l) => (q(o), await t.invoke(o, ...l)),
|
|
142
|
-
on: (o, l) => {
|
|
143
|
-
F(o), t.on(o, l);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
s.exposeInMainWorld(f, a);
|
|
147
|
-
}, j = async () => {
|
|
148
|
-
if (!(f in window))
|
|
149
|
-
throw new Error(
|
|
150
|
-
"Drift API not found. Make sure to call configurePreload in your preload script."
|
|
151
|
-
);
|
|
152
|
-
return await window[f].invoke(k);
|
|
153
|
-
};
|
|
154
|
-
class Q {
|
|
155
|
-
_label = "";
|
|
156
|
-
props = null;
|
|
157
|
-
api;
|
|
158
|
-
constructor() {
|
|
159
|
-
if (!(f in window))
|
|
160
|
-
throw new Error(
|
|
161
|
-
"Drift API not found. Make sure to call configurePreload in your preload script."
|
|
162
|
-
);
|
|
163
|
-
this.api = window[f];
|
|
164
|
-
}
|
|
165
|
-
async configure() {
|
|
166
|
-
const { label: s, ...a } = await this.api.invoke(T);
|
|
167
|
-
this._label = s, this.props = a;
|
|
168
|
-
}
|
|
169
|
-
label() {
|
|
170
|
-
return this._label;
|
|
171
|
-
}
|
|
172
|
-
isMain() {
|
|
173
|
-
return this._label === h;
|
|
174
|
-
}
|
|
175
|
-
release() {
|
|
176
|
-
}
|
|
177
|
-
async emit(s, a) {
|
|
178
|
-
this.api.send(u, { ...s, emitter: this.label() }, a);
|
|
179
|
-
}
|
|
180
|
-
async subscribe(s) {
|
|
181
|
-
this.api.on(u, (a, o) => s(o));
|
|
182
|
-
}
|
|
183
|
-
onCloseRequested() {
|
|
184
|
-
}
|
|
185
|
-
async create(s, a) {
|
|
186
|
-
this.api.send(m, s, JSON.parse(JSON.stringify(a)));
|
|
187
|
-
}
|
|
188
|
-
async close(s) {
|
|
189
|
-
this.api.send(p, s);
|
|
190
|
-
}
|
|
191
|
-
async listLabels() {
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
async focus() {
|
|
195
|
-
this.api.send(_);
|
|
196
|
-
}
|
|
197
|
-
async setMinimized(s) {
|
|
198
|
-
this.api.send(S, s);
|
|
199
|
-
}
|
|
200
|
-
async setMaximized(s) {
|
|
201
|
-
this.api.send(w, s);
|
|
202
|
-
}
|
|
203
|
-
async setVisible(s) {
|
|
204
|
-
this.api.send(z, s);
|
|
205
|
-
}
|
|
206
|
-
async setFullscreen(s) {
|
|
207
|
-
this.api.send(b, s);
|
|
208
|
-
}
|
|
209
|
-
async center() {
|
|
210
|
-
this.api.send(y);
|
|
211
|
-
}
|
|
212
|
-
async setPosition(s) {
|
|
213
|
-
this.api.send(I, s);
|
|
214
|
-
}
|
|
215
|
-
async setSize(s) {
|
|
216
|
-
this.api.send(N, s);
|
|
217
|
-
}
|
|
218
|
-
async setMinSize(s) {
|
|
219
|
-
this.api.send(M, s);
|
|
220
|
-
}
|
|
221
|
-
async setMaxSize(s) {
|
|
222
|
-
this.api.send(O, s);
|
|
223
|
-
}
|
|
224
|
-
async setResizable(s) {
|
|
225
|
-
this.api.send(g, s);
|
|
226
|
-
}
|
|
227
|
-
async setSkipTaskbar(s) {
|
|
228
|
-
this.api.send(A, s);
|
|
229
|
-
}
|
|
230
|
-
async setAlwaysOnTop(s) {
|
|
231
|
-
this.api.send(V, s);
|
|
232
|
-
}
|
|
233
|
-
async setTitle(s) {
|
|
234
|
-
this.api.send(x, s);
|
|
235
|
-
}
|
|
236
|
-
async setDecorations(s) {
|
|
237
|
-
this.api.send(W, s);
|
|
238
|
-
}
|
|
239
|
-
async getProps() {
|
|
240
|
-
if (this.props != null) return this.props;
|
|
241
|
-
throw new Error("Window not found");
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
export {
|
|
245
|
-
Q as ElectronRuntime,
|
|
246
|
-
Y as exposeAPI,
|
|
247
|
-
j as getWindowLabel,
|
|
248
|
-
X as listenOnMain
|
|
249
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Action, UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { dimensions, xy } from '@synnaxlabs/x';
|
|
3
|
-
import { BrowserWindow, BrowserWindowConstructorOptions } from 'electron';
|
|
4
|
-
import { Event, Runtime } from '../runtime';
|
|
5
|
-
import { StoreState } from '../state';
|
|
6
|
-
import { WindowProps } from '../window';
|
|
7
|
-
export interface ListenOnMainProps {
|
|
8
|
-
mainWindow: BrowserWindow;
|
|
9
|
-
createWindow: (props: BrowserWindowConstructorOptions) => BrowserWindow;
|
|
10
|
-
}
|
|
11
|
-
export declare const listenOnMain: ({ mainWindow, createWindow }: ListenOnMainProps) => void;
|
|
12
|
-
export declare const exposeAPI: () => void;
|
|
13
|
-
export declare const getWindowLabel: () => Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* An Electron backed implementation of the drift Runtime.
|
|
16
|
-
*/
|
|
17
|
-
export declare class ElectronRuntime<S extends StoreState, A extends Action = UnknownAction> implements Runtime<S, A> {
|
|
18
|
-
private _label;
|
|
19
|
-
private props;
|
|
20
|
-
private api;
|
|
21
|
-
constructor();
|
|
22
|
-
configure(): Promise<void>;
|
|
23
|
-
label(): string;
|
|
24
|
-
isMain(): boolean;
|
|
25
|
-
release(): void;
|
|
26
|
-
emit(event_: Omit<Event<S, A>, "emitter">, to?: string): Promise<void>;
|
|
27
|
-
subscribe(lis: (action: Event<S, A>) => void): Promise<void>;
|
|
28
|
-
onCloseRequested(): void;
|
|
29
|
-
create(label: string, props: Omit<WindowProps, "key">): Promise<void>;
|
|
30
|
-
close(key: string): Promise<void>;
|
|
31
|
-
listLabels(): Promise<string[]>;
|
|
32
|
-
focus(): Promise<void>;
|
|
33
|
-
setMinimized(value: boolean): Promise<void>;
|
|
34
|
-
setMaximized(value: boolean): Promise<void>;
|
|
35
|
-
setVisible(value: boolean): Promise<void>;
|
|
36
|
-
setFullscreen(value: boolean): Promise<void>;
|
|
37
|
-
center(): Promise<void>;
|
|
38
|
-
setPosition(xy: xy.XY): Promise<void>;
|
|
39
|
-
setSize(dims: dimensions.Dimensions): Promise<void>;
|
|
40
|
-
setMinSize(dims: dimensions.Dimensions): Promise<void>;
|
|
41
|
-
setMaxSize(dims: dimensions.Dimensions): Promise<void>;
|
|
42
|
-
setResizable(value: boolean): Promise<void>;
|
|
43
|
-
setSkipTaskbar(value: boolean): Promise<void>;
|
|
44
|
-
setAlwaysOnTop(value: boolean): Promise<void>;
|
|
45
|
-
setTitle(title: string): Promise<void>;
|
|
46
|
-
setDecorations(value: boolean): Promise<void>;
|
|
47
|
-
getProps(): Promise<Omit<WindowProps, "key">>;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/electron/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAY,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,+BAA+B,EAGrC,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAgEzD,MAAM,WAAW,iBAAiB;IAChC,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