@holoscript/engine 6.0.3 → 6.0.4
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/AutoMesher-CK47F6AV.js +17 -0
- package/dist/GPUBuffers-2LHBCD7X.js +9 -0
- package/dist/WebGPUContext-TNEUYU2Y.js +11 -0
- package/dist/animation/index.cjs +38 -38
- package/dist/animation/index.d.cts +1 -1
- package/dist/animation/index.d.ts +1 -1
- package/dist/animation/index.js +1 -1
- package/dist/audio/index.cjs +16 -6
- package/dist/audio/index.d.cts +1 -1
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1 -1
- package/dist/camera/index.cjs +23 -23
- package/dist/camera/index.d.cts +1 -1
- package/dist/camera/index.d.ts +1 -1
- package/dist/camera/index.js +1 -1
- package/dist/character/index.cjs +6 -4
- package/dist/character/index.js +1 -1
- package/dist/choreography/index.cjs +1194 -0
- package/dist/choreography/index.d.cts +687 -0
- package/dist/choreography/index.d.ts +687 -0
- package/dist/choreography/index.js +1156 -0
- package/dist/chunk-2CSNRI2N.js +217 -0
- package/dist/chunk-33T2WINR.js +266 -0
- package/dist/chunk-35R73OFM.js +1257 -0
- package/dist/chunk-4MMDSUNP.js +1256 -0
- package/dist/chunk-5V6HOU72.js +319 -0
- package/dist/chunk-6QOP6PYF.js +1038 -0
- package/dist/chunk-7KMJVHIL.js +8944 -0
- package/dist/chunk-7VPUC62U.js +1106 -0
- package/dist/chunk-A2Y6RCAT.js +1878 -0
- package/dist/chunk-AHM42MK6.js +8944 -0
- package/dist/chunk-BL7IDTHE.js +218 -0
- package/dist/chunk-CITOMSWL.js +10462 -0
- package/dist/chunk-CXDPKW2K.js +8944 -0
- package/dist/chunk-CXZPLD4S.js +223 -0
- package/dist/chunk-CZYJE7IH.js +5169 -0
- package/dist/chunk-D2OP7YC7.js +6325 -0
- package/dist/chunk-EDRVQHUU.js +1544 -0
- package/dist/chunk-EJSLOOW2.js +3589 -0
- package/dist/chunk-F53SFGW5.js +1878 -0
- package/dist/chunk-HCFPELPY.js +919 -0
- package/dist/chunk-HNEE36PY.js +93 -0
- package/dist/chunk-HYXNV36F.js +1256 -0
- package/dist/chunk-IB7KHVFY.js +821 -0
- package/dist/chunk-IBBO7YYG.js +690 -0
- package/dist/chunk-ILIBGINU.js +5470 -0
- package/dist/chunk-IS4MHLKN.js +5479 -0
- package/dist/chunk-JT2PFKWD.js +5479 -0
- package/dist/chunk-K4CUB4NY.js +1038 -0
- package/dist/chunk-KATDQXRJ.js +10462 -0
- package/dist/chunk-KBQE6ZFJ.js +8944 -0
- package/dist/chunk-KBVD5K7E.js +560 -0
- package/dist/chunk-KCDPVQRY.js +4088 -0
- package/dist/chunk-KN4QJPKN.js +8944 -0
- package/dist/chunk-KWJ3ROSI.js +8944 -0
- package/dist/chunk-L45VF6DD.js +919 -0
- package/dist/chunk-LY4T37YK.js +307 -0
- package/dist/chunk-MDN5WZXA.js +1544 -0
- package/dist/chunk-MGCDP6VU.js +928 -0
- package/dist/chunk-NCX7X6G2.js +8681 -0
- package/dist/chunk-OF54BPVD.js +913 -0
- package/dist/chunk-OWSN2Q3Q.js +690 -0
- package/dist/chunk-PRRB5TTA.js +406 -0
- package/dist/chunk-PXWVQF76.js +4086 -0
- package/dist/chunk-PYCOIDT2.js +812 -0
- package/dist/chunk-PZCSADOV.js +928 -0
- package/dist/chunk-Q2XBVS2K.js +1038 -0
- package/dist/chunk-QDZRXWN5.js +1776 -0
- package/dist/chunk-RNWOZ6WQ.js +913 -0
- package/dist/chunk-ROLFT4CJ.js +1693 -0
- package/dist/chunk-SLTJRZ2N.js +266 -0
- package/dist/chunk-SRUS5XSU.js +4088 -0
- package/dist/chunk-TKCA3WZ5.js +5409 -0
- package/dist/chunk-TNRMXYI2.js +1650 -0
- package/dist/chunk-TQB3GJGM.js +9763 -0
- package/dist/chunk-TUFGXG6K.js +510 -0
- package/dist/chunk-U6KMTGQJ.js +632 -0
- package/dist/chunk-VMGJQST6.js +8681 -0
- package/dist/chunk-X4F4TCG4.js +5470 -0
- package/dist/chunk-ZIFROE75.js +1544 -0
- package/dist/chunk-ZIJQYHSQ.js +1204 -0
- package/dist/combat/index.cjs +4 -4
- package/dist/combat/index.d.cts +1 -1
- package/dist/combat/index.d.ts +1 -1
- package/dist/combat/index.js +1 -1
- package/dist/ecs/index.cjs +1 -1
- package/dist/ecs/index.js +1 -1
- package/dist/environment/index.cjs +14 -14
- package/dist/environment/index.d.cts +1 -1
- package/dist/environment/index.d.ts +1 -1
- package/dist/environment/index.js +1 -1
- package/dist/gpu/index.cjs +4810 -0
- package/dist/gpu/index.js +3714 -0
- package/dist/hologram/index.cjs +27 -1
- package/dist/hologram/index.js +1 -1
- package/dist/index-B2PIsAmR.d.cts +2180 -0
- package/dist/index-B2PIsAmR.d.ts +2180 -0
- package/dist/index-BHySEPX7.d.cts +2921 -0
- package/dist/index-BJV21zuy.d.cts +341 -0
- package/dist/index-BJV21zuy.d.ts +341 -0
- package/dist/index-BQutTphC.d.cts +790 -0
- package/dist/index-ByIq2XrS.d.cts +3910 -0
- package/dist/index-BysHjDSO.d.cts +224 -0
- package/dist/index-BysHjDSO.d.ts +224 -0
- package/dist/index-CKwAJGck.d.ts +455 -0
- package/dist/index-CUl3QstQ.d.cts +3006 -0
- package/dist/index-CUl3QstQ.d.ts +3006 -0
- package/dist/index-CmYtNiI-.d.cts +953 -0
- package/dist/index-CmYtNiI-.d.ts +953 -0
- package/dist/index-CnRzWxi_.d.cts +522 -0
- package/dist/index-CnRzWxi_.d.ts +522 -0
- package/dist/index-CwRWbSC7.d.ts +2921 -0
- package/dist/index-CxKIBstO.d.ts +790 -0
- package/dist/index-DJ6-R8vh.d.cts +455 -0
- package/dist/index-DQKisbcI.d.cts +4968 -0
- package/dist/index-DQKisbcI.d.ts +4968 -0
- package/dist/index-DRT2zJez.d.ts +3910 -0
- package/dist/index-DfNLiAka.d.cts +192 -0
- package/dist/index-DfNLiAka.d.ts +192 -0
- package/dist/index-nMvkoRm8.d.cts +405 -0
- package/dist/index-nMvkoRm8.d.ts +405 -0
- package/dist/index-s9yOFU37.d.cts +604 -0
- package/dist/index-s9yOFU37.d.ts +604 -0
- package/dist/index.cjs +22966 -6960
- package/dist/index.d.cts +864 -20
- package/dist/index.d.ts +864 -20
- package/dist/index.js +3062 -48
- package/dist/input/index.cjs +1 -1
- package/dist/input/index.js +1 -1
- package/dist/orbital/index.cjs +3 -3
- package/dist/orbital/index.d.cts +1 -1
- package/dist/orbital/index.d.ts +1 -1
- package/dist/orbital/index.js +1 -1
- package/dist/particles/index.cjs +16 -16
- package/dist/particles/index.d.cts +1 -1
- package/dist/particles/index.d.ts +1 -1
- package/dist/particles/index.js +1 -1
- package/dist/physics/index.cjs +2377 -21
- package/dist/physics/index.d.cts +1 -1
- package/dist/physics/index.d.ts +1 -1
- package/dist/physics/index.js +35 -1
- package/dist/postfx/index.cjs +3491 -0
- package/dist/postfx/index.js +93 -0
- package/dist/procedural/index.cjs +1 -1
- package/dist/procedural/index.js +1 -1
- package/dist/puppeteer-5VF6KDVO.js +52197 -0
- package/dist/puppeteer-IZVZ3SG4.js +52197 -0
- package/dist/rendering/index.cjs +33 -32
- package/dist/rendering/index.d.cts +1 -1
- package/dist/rendering/index.d.ts +1 -1
- package/dist/rendering/index.js +8 -6
- package/dist/runtime/index.cjs +23 -13
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +8 -6
- package/dist/runtime/protocols/index.cjs +349 -0
- package/dist/runtime/protocols/index.js +15 -0
- package/dist/scene/index.cjs +8 -8
- package/dist/scene/index.d.cts +1 -1
- package/dist/scene/index.d.ts +1 -1
- package/dist/scene/index.js +1 -1
- package/dist/shader/index.cjs +3087 -0
- package/dist/shader/index.js +3044 -0
- package/dist/simulation/index.cjs +10680 -0
- package/dist/simulation/index.d.cts +3 -0
- package/dist/simulation/index.d.ts +3 -0
- package/dist/simulation/index.js +307 -0
- package/dist/spatial/index.cjs +2443 -0
- package/dist/spatial/index.d.cts +1545 -0
- package/dist/spatial/index.d.ts +1545 -0
- package/dist/spatial/index.js +2400 -0
- package/dist/terrain/index.cjs +1 -1
- package/dist/terrain/index.d.cts +1 -1
- package/dist/terrain/index.d.ts +1 -1
- package/dist/terrain/index.js +1 -1
- package/dist/transformers.node-4NKAPD5U.js +45620 -0
- package/dist/vm/index.cjs +7 -8
- package/dist/vm/index.d.cts +1 -1
- package/dist/vm/index.d.ts +1 -1
- package/dist/vm/index.js +1 -1
- package/dist/vm-bridge/index.cjs +2 -2
- package/dist/vm-bridge/index.d.cts +2 -2
- package/dist/vm-bridge/index.d.ts +2 -2
- package/dist/vm-bridge/index.js +1 -1
- package/dist/vr/index.cjs +6 -6
- package/dist/vr/index.js +1 -1
- package/dist/world/index.cjs +3 -3
- package/dist/world/index.d.cts +1 -1
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.js +1 -1
- package/package.json +53 -21
- package/LICENSE +0 -21
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/runtime/protocols/index.ts
|
|
21
|
+
var protocols_exports = {};
|
|
22
|
+
__export(protocols_exports, {
|
|
23
|
+
MQTTClient: () => MQTTClient,
|
|
24
|
+
createMQTTClient: () => createMQTTClient,
|
|
25
|
+
getMQTTClient: () => getMQTTClient,
|
|
26
|
+
registerMQTTClient: () => registerMQTTClient,
|
|
27
|
+
unregisterMQTTClient: () => unregisterMQTTClient
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(protocols_exports);
|
|
30
|
+
|
|
31
|
+
// src/runtime/protocols/MQTTClient.ts
|
|
32
|
+
var MQTTClient = class _MQTTClient {
|
|
33
|
+
config;
|
|
34
|
+
state = "disconnected";
|
|
35
|
+
subscriptions = /* @__PURE__ */ new Map();
|
|
36
|
+
messageQueue = [];
|
|
37
|
+
reconnectAttempts = 0;
|
|
38
|
+
reconnectTimeout = null;
|
|
39
|
+
eventHandlers = /* @__PURE__ */ new Map();
|
|
40
|
+
// Simulated connection for environments without real MQTT
|
|
41
|
+
simulatedMode = false;
|
|
42
|
+
constructor(config) {
|
|
43
|
+
this.config = {
|
|
44
|
+
version: "5.0",
|
|
45
|
+
keepAlive: 60,
|
|
46
|
+
cleanSession: true,
|
|
47
|
+
reconnect: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
maxAttempts: 10,
|
|
50
|
+
baseDelay: 1e3,
|
|
51
|
+
maxDelay: 3e4
|
|
52
|
+
},
|
|
53
|
+
...config,
|
|
54
|
+
clientId: config.clientId || this.generateClientId()
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// ===========================================================================
|
|
58
|
+
// CONNECTION MANAGEMENT
|
|
59
|
+
// ===========================================================================
|
|
60
|
+
/**
|
|
61
|
+
* Connect to the MQTT broker
|
|
62
|
+
*/
|
|
63
|
+
async connect() {
|
|
64
|
+
if (this.state === "connected" || this.state === "connecting") {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.state = "connecting";
|
|
68
|
+
this.emit("connect");
|
|
69
|
+
try {
|
|
70
|
+
await this.simulateConnect();
|
|
71
|
+
this.state = "connected";
|
|
72
|
+
this.reconnectAttempts = 0;
|
|
73
|
+
this.flushMessageQueue();
|
|
74
|
+
} catch (error) {
|
|
75
|
+
this.state = "disconnected";
|
|
76
|
+
this.emit("error", error);
|
|
77
|
+
if (this.config.reconnect?.enabled) {
|
|
78
|
+
this.scheduleReconnect();
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Disconnect from the MQTT broker
|
|
85
|
+
*/
|
|
86
|
+
async disconnect() {
|
|
87
|
+
if (this.state === "disconnected" || this.state === "closed") {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (this.reconnectTimeout) {
|
|
91
|
+
clearTimeout(this.reconnectTimeout);
|
|
92
|
+
this.reconnectTimeout = null;
|
|
93
|
+
}
|
|
94
|
+
this.state = "closed";
|
|
95
|
+
this.emit("disconnect", "client_disconnect");
|
|
96
|
+
this.subscriptions.clear();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get current connection state
|
|
100
|
+
*/
|
|
101
|
+
getState() {
|
|
102
|
+
return this.state;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if connected
|
|
106
|
+
*/
|
|
107
|
+
isConnected() {
|
|
108
|
+
return this.state === "connected";
|
|
109
|
+
}
|
|
110
|
+
// ===========================================================================
|
|
111
|
+
// PUBLISH / SUBSCRIBE
|
|
112
|
+
// ===========================================================================
|
|
113
|
+
/**
|
|
114
|
+
* Publish a message to a topic
|
|
115
|
+
*/
|
|
116
|
+
async publish(topic, payload, options = {}) {
|
|
117
|
+
const { qos = 0, retain = false, properties } = options;
|
|
118
|
+
const serializedPayload = typeof payload === "object" && !(payload instanceof Buffer) ? JSON.stringify(payload) : payload;
|
|
119
|
+
if (this.state !== "connected") {
|
|
120
|
+
this.messageQueue.push({ topic, payload: serializedPayload, options });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
await this.simulatePublish(topic, serializedPayload, { qos, retain, properties });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Subscribe to a topic pattern
|
|
127
|
+
*/
|
|
128
|
+
async subscribe(topicOrSubscription, handler) {
|
|
129
|
+
const subscription = typeof topicOrSubscription === "string" ? { topic: topicOrSubscription, qos: 0 } : topicOrSubscription;
|
|
130
|
+
const { topic } = subscription;
|
|
131
|
+
if (!this.subscriptions.has(topic)) {
|
|
132
|
+
this.subscriptions.set(topic, /* @__PURE__ */ new Set());
|
|
133
|
+
}
|
|
134
|
+
this.subscriptions.get(topic).add(handler);
|
|
135
|
+
if (this.state === "connected") {
|
|
136
|
+
await this.simulateSubscribe(subscription);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Unsubscribe from a topic
|
|
141
|
+
*/
|
|
142
|
+
async unsubscribe(topic, handler) {
|
|
143
|
+
const handlers = this.subscriptions.get(topic);
|
|
144
|
+
if (!handlers) return;
|
|
145
|
+
if (handler) {
|
|
146
|
+
handlers.delete(handler);
|
|
147
|
+
if (handlers.size === 0) {
|
|
148
|
+
this.subscriptions.delete(topic);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
this.subscriptions.delete(topic);
|
|
152
|
+
}
|
|
153
|
+
if (this.state === "connected" && !this.subscriptions.has(topic)) {
|
|
154
|
+
await this.simulateUnsubscribe(topic);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get active subscriptions
|
|
159
|
+
*/
|
|
160
|
+
getSubscriptions() {
|
|
161
|
+
return Array.from(this.subscriptions.keys());
|
|
162
|
+
}
|
|
163
|
+
// ===========================================================================
|
|
164
|
+
// EVENT HANDLING
|
|
165
|
+
// ===========================================================================
|
|
166
|
+
/**
|
|
167
|
+
* Register an event handler
|
|
168
|
+
*/
|
|
169
|
+
on(event, handler) {
|
|
170
|
+
if (!this.eventHandlers.has(event)) {
|
|
171
|
+
this.eventHandlers.set(event, /* @__PURE__ */ new Set());
|
|
172
|
+
}
|
|
173
|
+
this.eventHandlers.get(event).add(handler);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Remove an event handler
|
|
177
|
+
*/
|
|
178
|
+
off(event, handler) {
|
|
179
|
+
this.eventHandlers.get(event)?.delete(handler);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Emit an event
|
|
183
|
+
*/
|
|
184
|
+
emit(event, ...args) {
|
|
185
|
+
const handlers = this.eventHandlers.get(event);
|
|
186
|
+
if (handlers) {
|
|
187
|
+
for (const handler of handlers) {
|
|
188
|
+
try {
|
|
189
|
+
handler(...args);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error(`Error in MQTT event handler for ${event}:`, error);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// ===========================================================================
|
|
197
|
+
// TOPIC MATCHING
|
|
198
|
+
// ===========================================================================
|
|
199
|
+
/**
|
|
200
|
+
* Check if a topic matches a subscription pattern
|
|
201
|
+
* Supports + (single-level) and # (multi-level) wildcards
|
|
202
|
+
*/
|
|
203
|
+
static matchTopic(pattern, topic) {
|
|
204
|
+
const patternParts = pattern.split("/");
|
|
205
|
+
const topicParts = topic.split("/");
|
|
206
|
+
for (let i = 0; i < patternParts.length; i++) {
|
|
207
|
+
const patternPart = patternParts[i];
|
|
208
|
+
if (patternPart === "#") {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (i >= topicParts.length) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (patternPart !== "+" && patternPart !== topicParts[i]) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return patternParts.length === topicParts.length;
|
|
219
|
+
}
|
|
220
|
+
// ===========================================================================
|
|
221
|
+
// MESSAGE PARSING
|
|
222
|
+
// ===========================================================================
|
|
223
|
+
/**
|
|
224
|
+
* Parse message payload based on content type
|
|
225
|
+
*/
|
|
226
|
+
static parsePayload(message) {
|
|
227
|
+
const contentType = message.properties?.contentType || "";
|
|
228
|
+
const payloadStr = message.payload instanceof Buffer ? message.payload.toString("utf-8") : String(message.payload);
|
|
229
|
+
if (contentType.includes("json") || payloadStr.startsWith("{") || payloadStr.startsWith("[")) {
|
|
230
|
+
try {
|
|
231
|
+
return JSON.parse(payloadStr);
|
|
232
|
+
} catch {
|
|
233
|
+
return payloadStr;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const num = Number(payloadStr);
|
|
237
|
+
if (!isNaN(num)) {
|
|
238
|
+
return num;
|
|
239
|
+
}
|
|
240
|
+
return payloadStr;
|
|
241
|
+
}
|
|
242
|
+
// ===========================================================================
|
|
243
|
+
// PRIVATE METHODS
|
|
244
|
+
// ===========================================================================
|
|
245
|
+
generateClientId() {
|
|
246
|
+
const timestamp = Date.now().toString(36);
|
|
247
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
248
|
+
return `holoscript_${timestamp}_${random}`;
|
|
249
|
+
}
|
|
250
|
+
async simulateConnect() {
|
|
251
|
+
this.simulatedMode = true;
|
|
252
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
253
|
+
}
|
|
254
|
+
async simulatePublish(topic, payload, options) {
|
|
255
|
+
const message = {
|
|
256
|
+
topic,
|
|
257
|
+
payload,
|
|
258
|
+
qos: options.qos || 0,
|
|
259
|
+
retain: options.retain || false,
|
|
260
|
+
properties: options.properties
|
|
261
|
+
};
|
|
262
|
+
this.deliverMessage(topic, message);
|
|
263
|
+
}
|
|
264
|
+
async simulateSubscribe(_subscription) {
|
|
265
|
+
}
|
|
266
|
+
async simulateUnsubscribe(_topic) {
|
|
267
|
+
}
|
|
268
|
+
deliverMessage(topic, message) {
|
|
269
|
+
for (const [pattern, handlers] of this.subscriptions) {
|
|
270
|
+
if (_MQTTClient.matchTopic(pattern, topic)) {
|
|
271
|
+
for (const handler of handlers) {
|
|
272
|
+
try {
|
|
273
|
+
handler(message);
|
|
274
|
+
} catch (error) {
|
|
275
|
+
console.error("Error in MQTT message handler:", error);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
this.emit("message", topic, message);
|
|
281
|
+
}
|
|
282
|
+
scheduleReconnect() {
|
|
283
|
+
const config = this.config.reconnect;
|
|
284
|
+
if (this.reconnectAttempts >= (config.maxAttempts || 10)) {
|
|
285
|
+
this.state = "disconnected";
|
|
286
|
+
this.emit("error", new Error("Max reconnect attempts reached"));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
this.state = "reconnecting";
|
|
290
|
+
this.reconnectAttempts++;
|
|
291
|
+
const delay = Math.min(
|
|
292
|
+
(config.baseDelay || 1e3) * Math.pow(2, this.reconnectAttempts - 1),
|
|
293
|
+
config.maxDelay || 3e4
|
|
294
|
+
);
|
|
295
|
+
this.emit("reconnect", this.reconnectAttempts);
|
|
296
|
+
this.reconnectTimeout = setTimeout(async () => {
|
|
297
|
+
try {
|
|
298
|
+
await this.connect();
|
|
299
|
+
} catch {
|
|
300
|
+
}
|
|
301
|
+
}, delay);
|
|
302
|
+
}
|
|
303
|
+
flushMessageQueue() {
|
|
304
|
+
while (this.messageQueue.length > 0) {
|
|
305
|
+
const { topic, payload, options } = this.messageQueue.shift();
|
|
306
|
+
this.publish(topic, payload, options).catch((error) => {
|
|
307
|
+
console.error("Error publishing queued message:", error);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Inject a message for testing purposes
|
|
313
|
+
*/
|
|
314
|
+
_injectMessage(topic, payload) {
|
|
315
|
+
const serializedPayload = typeof payload === "object" && !(payload instanceof Buffer) ? JSON.stringify(payload) : payload;
|
|
316
|
+
const message = {
|
|
317
|
+
topic,
|
|
318
|
+
payload: serializedPayload,
|
|
319
|
+
qos: 0,
|
|
320
|
+
retain: false
|
|
321
|
+
};
|
|
322
|
+
this.deliverMessage(topic, message);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
function createMQTTClient(config) {
|
|
326
|
+
return new MQTTClient(config);
|
|
327
|
+
}
|
|
328
|
+
var clientRegistry = /* @__PURE__ */ new Map();
|
|
329
|
+
function registerMQTTClient(name, client) {
|
|
330
|
+
clientRegistry.set(name, client);
|
|
331
|
+
}
|
|
332
|
+
function getMQTTClient(name) {
|
|
333
|
+
return clientRegistry.get(name);
|
|
334
|
+
}
|
|
335
|
+
function unregisterMQTTClient(name) {
|
|
336
|
+
const client = clientRegistry.get(name);
|
|
337
|
+
if (client) {
|
|
338
|
+
client.disconnect();
|
|
339
|
+
clientRegistry.delete(name);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
343
|
+
0 && (module.exports = {
|
|
344
|
+
MQTTClient,
|
|
345
|
+
createMQTTClient,
|
|
346
|
+
getMQTTClient,
|
|
347
|
+
registerMQTTClient,
|
|
348
|
+
unregisterMQTTClient
|
|
349
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MQTTClient,
|
|
3
|
+
createMQTTClient,
|
|
4
|
+
getMQTTClient,
|
|
5
|
+
registerMQTTClient,
|
|
6
|
+
unregisterMQTTClient
|
|
7
|
+
} from "../../chunk-5V6HOU72.js";
|
|
8
|
+
import "../../chunk-AKLW2MUS.js";
|
|
9
|
+
export {
|
|
10
|
+
MQTTClient,
|
|
11
|
+
createMQTTClient,
|
|
12
|
+
getMQTTClient,
|
|
13
|
+
registerMQTTClient,
|
|
14
|
+
unregisterMQTTClient
|
|
15
|
+
};
|
package/dist/scene/index.cjs
CHANGED
|
@@ -522,7 +522,7 @@ var SceneNode = class {
|
|
|
522
522
|
this.id = id;
|
|
523
523
|
this.name = name || id;
|
|
524
524
|
this.local = {
|
|
525
|
-
position:
|
|
525
|
+
position: [0, 0, 0],
|
|
526
526
|
rotation: { x: 0, y: 0, z: 0 },
|
|
527
527
|
scale: { x: 1, y: 1, z: 1 }
|
|
528
528
|
};
|
|
@@ -533,7 +533,7 @@ var SceneNode = class {
|
|
|
533
533
|
// Transform
|
|
534
534
|
// ---------------------------------------------------------------------------
|
|
535
535
|
setPosition(x, y, z) {
|
|
536
|
-
this.local.position =
|
|
536
|
+
this.local.position = [x, y, z];
|
|
537
537
|
this.markDirty();
|
|
538
538
|
}
|
|
539
539
|
setRotation(x, y, z) {
|
|
@@ -627,9 +627,9 @@ var SceneNode = class {
|
|
|
627
627
|
m[9] = -sx;
|
|
628
628
|
m[10] = cy * cx * s.z;
|
|
629
629
|
m[11] = 0;
|
|
630
|
-
m[12] = p
|
|
631
|
-
m[13] = p
|
|
632
|
-
m[14] = p
|
|
630
|
+
m[12] = p[0];
|
|
631
|
+
m[13] = p[1];
|
|
632
|
+
m[14] = p[2];
|
|
633
633
|
m[15] = 1;
|
|
634
634
|
return m;
|
|
635
635
|
}
|
|
@@ -704,9 +704,9 @@ var SceneQuery = class _SceneQuery {
|
|
|
704
704
|
root.traverse((node) => {
|
|
705
705
|
if (!node.visible) return;
|
|
706
706
|
const wp = node.getWorldPosition();
|
|
707
|
-
const dx = wp
|
|
708
|
-
const dy = wp
|
|
709
|
-
const dz = wp
|
|
707
|
+
const dx = wp[0] - frustum.position[0];
|
|
708
|
+
const dy = wp[1] - frustum.position[1];
|
|
709
|
+
const dz = wp[2] - frustum.position[2];
|
|
710
710
|
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
711
711
|
if (dist < frustum.near || dist > frustum.far) return;
|
|
712
712
|
if (dist > 0) {
|
package/dist/scene/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AnimationSnapshot, B as BuildConfig, C as CURRENT_SCHEMA_VERSION, F as Frustum, M as Matrix4, a as MigrationLog, b as MigrationResult, c as MigrationStep, N as NodeVisitor, P as ParticleSnapshot, d as ProjectAssetRef, e as ProjectFile, f as ProjectManager, R as RuntimeStateSnapshot, S as SavedScene, g as SceneDeserializer, h as SceneListEntry, j as SceneManager, k as SceneNode, l as SceneQuery, m as SceneReference, n as SceneSerializer, o as SerializedNode, p as SerializedScene, q as StateSnapshotCapture, T as Transform, U as UISnapshot, V as VersionMigration } from '../index-
|
|
1
|
+
export { A as AnimationSnapshot, B as BuildConfig, C as CURRENT_SCHEMA_VERSION, F as Frustum, M as Matrix4, a as MigrationLog, b as MigrationResult, c as MigrationStep, N as NodeVisitor, P as ParticleSnapshot, d as ProjectAssetRef, e as ProjectFile, f as ProjectManager, R as RuntimeStateSnapshot, S as SavedScene, g as SceneDeserializer, h as SceneListEntry, j as SceneManager, k as SceneNode, l as SceneQuery, m as SceneReference, n as SceneSerializer, o as SerializedNode, p as SerializedScene, q as StateSnapshotCapture, T as Transform, U as UISnapshot, V as VersionMigration } from '../index-DJ6-R8vh.cjs';
|
|
2
2
|
import '../World-CgKA4O2J.cjs';
|
package/dist/scene/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AnimationSnapshot, B as BuildConfig, C as CURRENT_SCHEMA_VERSION, F as Frustum, M as Matrix4, a as MigrationLog, b as MigrationResult, c as MigrationStep, N as NodeVisitor, P as ParticleSnapshot, d as ProjectAssetRef, e as ProjectFile, f as ProjectManager, R as RuntimeStateSnapshot, S as SavedScene, g as SceneDeserializer, h as SceneListEntry, j as SceneManager, k as SceneNode, l as SceneQuery, m as SceneReference, n as SceneSerializer, o as SerializedNode, p as SerializedScene, q as StateSnapshotCapture, T as Transform, U as UISnapshot, V as VersionMigration } from '../index-
|
|
1
|
+
export { A as AnimationSnapshot, B as BuildConfig, C as CURRENT_SCHEMA_VERSION, F as Frustum, M as Matrix4, a as MigrationLog, b as MigrationResult, c as MigrationStep, N as NodeVisitor, P as ParticleSnapshot, d as ProjectAssetRef, e as ProjectFile, f as ProjectManager, R as RuntimeStateSnapshot, S as SavedScene, g as SceneDeserializer, h as SceneListEntry, j as SceneManager, k as SceneNode, l as SceneQuery, m as SceneReference, n as SceneSerializer, o as SerializedNode, p as SerializedScene, q as StateSnapshotCapture, T as Transform, U as UISnapshot, V as VersionMigration } from '../index-CKwAJGck.js';
|
|
2
2
|
import '../World-CgKA4O2J.js';
|