@arcanejs/toolkit 7.0.0 → 9.0.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/backend/components/base.d.mts +2 -1
- package/dist/backend/components/base.d.ts +2 -1
- package/dist/backend/components/base.js +2 -2
- package/dist/backend/components/base.mjs +1 -1
- package/dist/backend/components/button.d.mts +2 -1
- package/dist/backend/components/button.d.ts +2 -1
- package/dist/backend/components/button.js +3 -3
- package/dist/backend/components/button.mjs +2 -2
- package/dist/backend/components/group.d.mts +2 -1
- package/dist/backend/components/group.d.ts +2 -1
- package/dist/backend/components/group.js +3 -3
- package/dist/backend/components/group.mjs +2 -2
- package/dist/backend/components/label.d.mts +2 -1
- package/dist/backend/components/label.d.ts +2 -1
- package/dist/backend/components/label.js +3 -3
- package/dist/backend/components/label.mjs +2 -2
- package/dist/backend/components/rect.d.mts +2 -1
- package/dist/backend/components/rect.d.ts +2 -1
- package/dist/backend/components/rect.js +3 -3
- package/dist/backend/components/rect.mjs +2 -2
- package/dist/backend/components/slider-button.d.mts +2 -1
- package/dist/backend/components/slider-button.d.ts +2 -1
- package/dist/backend/components/slider-button.js +3 -3
- package/dist/backend/components/slider-button.mjs +2 -2
- package/dist/backend/components/switch.d.mts +2 -1
- package/dist/backend/components/switch.d.ts +2 -1
- package/dist/backend/components/switch.js +3 -3
- package/dist/backend/components/switch.mjs +2 -2
- package/dist/backend/components/tabs.d.mts +2 -1
- package/dist/backend/components/tabs.d.ts +2 -1
- package/dist/backend/components/tabs.js +3 -3
- package/dist/backend/components/tabs.mjs +2 -2
- package/dist/backend/components/text-input.d.mts +2 -1
- package/dist/backend/components/text-input.d.ts +2 -1
- package/dist/backend/components/text-input.js +3 -3
- package/dist/backend/components/text-input.mjs +2 -2
- package/dist/backend/components/timeline.d.mts +2 -1
- package/dist/backend/components/timeline.d.ts +2 -1
- package/dist/backend/components/timeline.js +3 -3
- package/dist/backend/components/timeline.mjs +2 -2
- package/dist/{chunk-IV3AE3CW.js → chunk-2R23ER4K.js} +3 -3
- package/dist/{chunk-R5OA7LLZ.mjs → chunk-5K7DK7CW.mjs} +1 -1
- package/dist/{chunk-RJLYYTZ6.mjs → chunk-7WTSYZOS.mjs} +1 -1
- package/dist/{chunk-2K4UT5QB.js → chunk-AYMITMVR.js} +3 -3
- package/dist/{chunk-K6V55JTG.mjs → chunk-KO24S32V.mjs} +1 -1
- package/dist/{chunk-XSKWLJOQ.js → chunk-KRGLXKY2.js} +4 -4
- package/dist/{chunk-JHWFQLLE.mjs → chunk-MNEFCU3M.mjs} +1 -1
- package/dist/{chunk-TF7N4O5G.js → chunk-NEFCI6N6.js} +2 -2
- package/dist/{chunk-TULW7CRV.mjs → chunk-NJW4ZG4X.mjs} +1 -1
- package/dist/{chunk-MHSAHTVN.mjs → chunk-QBZB56TQ.mjs} +1 -1
- package/dist/{chunk-UHEZQR2Q.js → chunk-QHCNKTKW.js} +2 -2
- package/dist/{chunk-4AGKM5NT.js → chunk-RELZ3VTJ.js} +3 -3
- package/dist/{chunk-7MQHRTBE.mjs → chunk-RGLKNCJ3.mjs} +1 -1
- package/dist/{chunk-A3RWE7HZ.js → chunk-SPYBETRJ.js} +3 -3
- package/dist/{chunk-GONHNB6V.mjs → chunk-UTTTCTUQ.mjs} +26 -5
- package/dist/{chunk-GXJ3JRRK.mjs → chunk-VD6S32ED.mjs} +1 -1
- package/dist/{chunk-5B65Q7RL.js → chunk-VTNAO4KC.js} +2 -2
- package/dist/{chunk-6PS3Q66F.mjs → chunk-Y3NPWW27.mjs} +1 -1
- package/dist/{chunk-CVY55KAR.js → chunk-Y5FC42KD.js} +3 -3
- package/dist/{chunk-WN3GXVUE.js → chunk-YNOJTE3G.js} +26 -5
- package/dist/frontend/entrypoint.js +43 -2
- package/dist/frontend/entrypoint.js.map +2 -2
- package/dist/frontend/index.js +69 -12
- package/dist/frontend/index.mjs +69 -12
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +183 -64
- package/dist/index.mjs +154 -35
- package/dist/{toolkit-Bglbv3ix.d.ts → toolkit-CKA9A4r-.d.ts} +116 -93
- package/dist/{toolkit-BPqxbDbk.d.mts → toolkit-GNytD78y.d.mts} +116 -93
- package/package.json +8 -8
package/dist/frontend/index.js
CHANGED
|
@@ -37,6 +37,19 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
37
37
|
nextId: 1,
|
|
38
38
|
pings: /* @__PURE__ */ new Map()
|
|
39
39
|
});
|
|
40
|
+
const notificationListeners = _react.useRef.call(void 0, /* @__PURE__ */ new Set());
|
|
41
|
+
const addNotificationListener = _react.useCallback.call(void 0,
|
|
42
|
+
(listener) => {
|
|
43
|
+
notificationListeners.current.add(listener);
|
|
44
|
+
},
|
|
45
|
+
[]
|
|
46
|
+
);
|
|
47
|
+
const removeNotificationListener = _react.useCallback.call(void 0,
|
|
48
|
+
(listener) => {
|
|
49
|
+
notificationListeners.current.delete(listener);
|
|
50
|
+
},
|
|
51
|
+
[]
|
|
52
|
+
);
|
|
40
53
|
const preparedRenderers = _react.useMemo.call(void 0, () => {
|
|
41
54
|
const prepared = {};
|
|
42
55
|
for (const renderer of renderers) {
|
|
@@ -82,6 +95,12 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
82
95
|
}
|
|
83
96
|
return;
|
|
84
97
|
}
|
|
98
|
+
case "notification": {
|
|
99
|
+
for (const listener of notificationListeners.current) {
|
|
100
|
+
listener(msg);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
85
104
|
case "pong": {
|
|
86
105
|
const ping = pings.current.pings.get(msg.pingId);
|
|
87
106
|
if (!ping) {
|
|
@@ -149,28 +168,62 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
149
168
|
const sendMessage = _react.useCallback.call(void 0, async (msg) => {
|
|
150
169
|
(await (socket.current || initializeWebsocket())).send(JSON.stringify(msg));
|
|
151
170
|
}, []);
|
|
152
|
-
const
|
|
171
|
+
const callHandler = _react.useCallback.call(void 0,
|
|
153
172
|
async (msg) => {
|
|
154
173
|
const requestId = calls.current.nextId++;
|
|
155
174
|
const sendMsg = {
|
|
156
175
|
...msg,
|
|
157
176
|
requestId
|
|
158
177
|
};
|
|
159
|
-
const promise = new Promise(
|
|
160
|
-
(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
);
|
|
178
|
+
const promise = new Promise((resolve, reject) => {
|
|
179
|
+
calls.current.calls.set(requestId, {
|
|
180
|
+
resolve,
|
|
181
|
+
reject
|
|
182
|
+
});
|
|
183
|
+
(socket.current || initializeWebsocket()).then(
|
|
184
|
+
(s) => s.send(JSON.stringify(sendMsg))
|
|
185
|
+
);
|
|
186
|
+
});
|
|
170
187
|
return promise;
|
|
171
188
|
},
|
|
172
189
|
[]
|
|
173
190
|
);
|
|
191
|
+
const call = _react.useCallback.call(void 0,
|
|
192
|
+
async (msg) => callHandler(msg),
|
|
193
|
+
[]
|
|
194
|
+
);
|
|
195
|
+
const upload = _react.useCallback.call(void 0,
|
|
196
|
+
async (msg, data) => {
|
|
197
|
+
const uploadId = await callHandler(msg);
|
|
198
|
+
const uploadUrl = new URL(`upload/${uploadId}`, window.location.href);
|
|
199
|
+
const result = await fetch(uploadUrl.href, {
|
|
200
|
+
method: "POST",
|
|
201
|
+
body: data
|
|
202
|
+
});
|
|
203
|
+
if (!result.ok) {
|
|
204
|
+
throw new Error(`Upload failed with status ${result.status}`);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[]
|
|
208
|
+
);
|
|
209
|
+
const download = _react.useCallback.call(void 0,
|
|
210
|
+
async (msg) => {
|
|
211
|
+
const downloadId = await callHandler(msg);
|
|
212
|
+
const downloadUrl = new URL(
|
|
213
|
+
`download/${downloadId}`,
|
|
214
|
+
window.location.href
|
|
215
|
+
);
|
|
216
|
+
const result = await fetch(downloadUrl.href);
|
|
217
|
+
if (!result.ok) {
|
|
218
|
+
throw new Error(`Download failed with status ${result.status}`);
|
|
219
|
+
}
|
|
220
|
+
if (!result.body) {
|
|
221
|
+
throw new Error("Download response has no body");
|
|
222
|
+
}
|
|
223
|
+
return result.body;
|
|
224
|
+
},
|
|
225
|
+
[]
|
|
226
|
+
);
|
|
174
227
|
_react.useEffect.call(void 0, () => {
|
|
175
228
|
initializeWebsocket();
|
|
176
229
|
}, [initializeWebsocket]);
|
|
@@ -209,6 +262,10 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
209
262
|
sendMessage,
|
|
210
263
|
renderComponent,
|
|
211
264
|
call,
|
|
265
|
+
upload,
|
|
266
|
+
download,
|
|
267
|
+
addNotificationListener,
|
|
268
|
+
removeNotificationListener,
|
|
212
269
|
connectionUuid: connection.state === "connected" ? connection.uuid : null,
|
|
213
270
|
connection,
|
|
214
271
|
timeDifferenceMs: _nullishCoalesce(_optionalChain([bestPing, 'optionalAccess', _ => _.timeDifferenceMs]), () => ( null)),
|
package/dist/frontend/index.mjs
CHANGED
|
@@ -37,6 +37,19 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
37
37
|
nextId: 1,
|
|
38
38
|
pings: /* @__PURE__ */ new Map()
|
|
39
39
|
});
|
|
40
|
+
const notificationListeners = useRef(/* @__PURE__ */ new Set());
|
|
41
|
+
const addNotificationListener = useCallback(
|
|
42
|
+
(listener) => {
|
|
43
|
+
notificationListeners.current.add(listener);
|
|
44
|
+
},
|
|
45
|
+
[]
|
|
46
|
+
);
|
|
47
|
+
const removeNotificationListener = useCallback(
|
|
48
|
+
(listener) => {
|
|
49
|
+
notificationListeners.current.delete(listener);
|
|
50
|
+
},
|
|
51
|
+
[]
|
|
52
|
+
);
|
|
40
53
|
const preparedRenderers = useMemo(() => {
|
|
41
54
|
const prepared = {};
|
|
42
55
|
for (const renderer of renderers) {
|
|
@@ -82,6 +95,12 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
82
95
|
}
|
|
83
96
|
return;
|
|
84
97
|
}
|
|
98
|
+
case "notification": {
|
|
99
|
+
for (const listener of notificationListeners.current) {
|
|
100
|
+
listener(msg);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
85
104
|
case "pong": {
|
|
86
105
|
const ping = pings.current.pings.get(msg.pingId);
|
|
87
106
|
if (!ping) {
|
|
@@ -149,28 +168,62 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
149
168
|
const sendMessage = useCallback(async (msg) => {
|
|
150
169
|
(await (socket.current || initializeWebsocket())).send(JSON.stringify(msg));
|
|
151
170
|
}, []);
|
|
152
|
-
const
|
|
171
|
+
const callHandler = useCallback(
|
|
153
172
|
async (msg) => {
|
|
154
173
|
const requestId = calls.current.nextId++;
|
|
155
174
|
const sendMsg = {
|
|
156
175
|
...msg,
|
|
157
176
|
requestId
|
|
158
177
|
};
|
|
159
|
-
const promise = new Promise(
|
|
160
|
-
(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
);
|
|
178
|
+
const promise = new Promise((resolve, reject) => {
|
|
179
|
+
calls.current.calls.set(requestId, {
|
|
180
|
+
resolve,
|
|
181
|
+
reject
|
|
182
|
+
});
|
|
183
|
+
(socket.current || initializeWebsocket()).then(
|
|
184
|
+
(s) => s.send(JSON.stringify(sendMsg))
|
|
185
|
+
);
|
|
186
|
+
});
|
|
170
187
|
return promise;
|
|
171
188
|
},
|
|
172
189
|
[]
|
|
173
190
|
);
|
|
191
|
+
const call = useCallback(
|
|
192
|
+
async (msg) => callHandler(msg),
|
|
193
|
+
[]
|
|
194
|
+
);
|
|
195
|
+
const upload = useCallback(
|
|
196
|
+
async (msg, data) => {
|
|
197
|
+
const uploadId = await callHandler(msg);
|
|
198
|
+
const uploadUrl = new URL(`upload/${uploadId}`, window.location.href);
|
|
199
|
+
const result = await fetch(uploadUrl.href, {
|
|
200
|
+
method: "POST",
|
|
201
|
+
body: data
|
|
202
|
+
});
|
|
203
|
+
if (!result.ok) {
|
|
204
|
+
throw new Error(`Upload failed with status ${result.status}`);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[]
|
|
208
|
+
);
|
|
209
|
+
const download = useCallback(
|
|
210
|
+
async (msg) => {
|
|
211
|
+
const downloadId = await callHandler(msg);
|
|
212
|
+
const downloadUrl = new URL(
|
|
213
|
+
`download/${downloadId}`,
|
|
214
|
+
window.location.href
|
|
215
|
+
);
|
|
216
|
+
const result = await fetch(downloadUrl.href);
|
|
217
|
+
if (!result.ok) {
|
|
218
|
+
throw new Error(`Download failed with status ${result.status}`);
|
|
219
|
+
}
|
|
220
|
+
if (!result.body) {
|
|
221
|
+
throw new Error("Download response has no body");
|
|
222
|
+
}
|
|
223
|
+
return result.body;
|
|
224
|
+
},
|
|
225
|
+
[]
|
|
226
|
+
);
|
|
174
227
|
useEffect(() => {
|
|
175
228
|
initializeWebsocket();
|
|
176
229
|
}, [initializeWebsocket]);
|
|
@@ -209,6 +262,10 @@ var Stage = ({ className, renderers, loadingState }) => {
|
|
|
209
262
|
sendMessage,
|
|
210
263
|
renderComponent,
|
|
211
264
|
call,
|
|
265
|
+
upload,
|
|
266
|
+
download,
|
|
267
|
+
addNotificationListener,
|
|
268
|
+
removeNotificationListener,
|
|
212
269
|
connectionUuid: connection.state === "connected" ? connection.uuid : null,
|
|
213
270
|
connection,
|
|
214
271
|
timeDifferenceMs: bestPing?.timeDifferenceMs ?? null,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyComponent, B as Button, G as Group, l as GroupHeader, T as Toolkit, e as ToolkitAdditionalFiles, f as ToolkitClockSyncOptions, a as ToolkitConnection, g as ToolkitCoreAssetRelativePath, h as ToolkitHtmlPageContext, i as ToolkitOptions, b as ToolkitRenderContext, d as ToolkitServerListener, c as ToolkitServerListenerOptions, j as ToolkitStaticFile, k as ToolkitStaticFileResolver } from './toolkit-
|
|
1
|
+
export { A as AnyComponent, B as Button, G as Group, l as GroupHeader, T as Toolkit, e as ToolkitAdditionalFiles, f as ToolkitClockSyncOptions, a as ToolkitConnection, g as ToolkitCoreAssetRelativePath, h as ToolkitHtmlPageContext, i as ToolkitOptions, b as ToolkitRenderContext, d as ToolkitServerListener, c as ToolkitServerListenerOptions, j as ToolkitStaticFile, k as ToolkitStaticFileResolver } from './toolkit-GNytD78y.mjs';
|
|
2
2
|
export { Label } from './backend/components/label.mjs';
|
|
3
3
|
export { Rect } from './backend/components/rect.mjs';
|
|
4
4
|
export { SliderButton } from './backend/components/slider-button.mjs';
|
|
@@ -12,6 +12,7 @@ import 'http';
|
|
|
12
12
|
import 'express';
|
|
13
13
|
import 'ws';
|
|
14
14
|
import '@arcanejs/protocol';
|
|
15
|
+
import 'node:stream';
|
|
16
|
+
import './id-map-DxQ3_gyA.mjs';
|
|
15
17
|
import '@arcanejs/protocol/core';
|
|
16
18
|
import '@arcanejs/protocol/styles';
|
|
17
|
-
import './id-map-DxQ3_gyA.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyComponent, B as Button, G as Group, l as GroupHeader, T as Toolkit, e as ToolkitAdditionalFiles, f as ToolkitClockSyncOptions, a as ToolkitConnection, g as ToolkitCoreAssetRelativePath, h as ToolkitHtmlPageContext, i as ToolkitOptions, b as ToolkitRenderContext, d as ToolkitServerListener, c as ToolkitServerListenerOptions, j as ToolkitStaticFile, k as ToolkitStaticFileResolver } from './toolkit-
|
|
1
|
+
export { A as AnyComponent, B as Button, G as Group, l as GroupHeader, T as Toolkit, e as ToolkitAdditionalFiles, f as ToolkitClockSyncOptions, a as ToolkitConnection, g as ToolkitCoreAssetRelativePath, h as ToolkitHtmlPageContext, i as ToolkitOptions, b as ToolkitRenderContext, d as ToolkitServerListener, c as ToolkitServerListenerOptions, j as ToolkitStaticFile, k as ToolkitStaticFileResolver } from './toolkit-CKA9A4r-.js';
|
|
2
2
|
export { Label } from './backend/components/label.js';
|
|
3
3
|
export { Rect } from './backend/components/rect.js';
|
|
4
4
|
export { SliderButton } from './backend/components/slider-button.js';
|
|
@@ -12,6 +12,7 @@ import 'http';
|
|
|
12
12
|
import 'express';
|
|
13
13
|
import 'ws';
|
|
14
14
|
import '@arcanejs/protocol';
|
|
15
|
+
import 'node:stream';
|
|
16
|
+
import './id-map-DxQ3_gyA.js';
|
|
15
17
|
import '@arcanejs/protocol/core';
|
|
16
18
|
import '@arcanejs/protocol/styles';
|
|
17
|
-
import './id-map-DxQ3_gyA.js';
|