@xpell/core 2.0.0-alpha.11 → 2.0.2
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 +100 -61
- package/dist/XCommand.d.ts +1 -1
- package/dist/XDataModule.d.ts +41 -0
- package/dist/XEvenetManagerModule.d.ts +10 -0
- package/dist/XEventManager.d.ts +3 -6
- package/dist/XModule.d.ts +14 -1
- package/dist/XNanoCommands.d.ts +6 -34
- package/dist/XObject.d.ts +40 -5
- package/dist/XObjectManager.d.ts +2 -0
- package/dist/XParams.d.ts +1 -1
- package/dist/XRuntime.d.ts +2 -0
- package/dist/XSkills.d.ts +47 -0
- package/dist/XUtils.d.ts +35 -0
- package/dist/Xpell.d.ts +31 -8
- package/dist/xpell-core.cjs.js +2 -2
- package/dist/xpell-core.es.js +1524 -750
- package/docs/AGENTS.md +10 -0
- package/package.json +5 -5
- package/docs/Codex.md +0 -138
package/dist/xpell-core.es.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var B = (o) => {
|
|
2
|
+
throw TypeError(o);
|
|
3
|
+
};
|
|
4
|
+
var J = (o, e, t) => e.has(o) || B("Cannot " + t);
|
|
5
|
+
var f = (o, e, t) => (J(o, e, "read from private field"), t ? t.call(o) : e.get(o)), V = (o, e, t) => e.has(o) ? B("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), z = (o, e, t, s) => (J(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t);
|
|
6
|
+
class Y {
|
|
2
7
|
/**
|
|
3
8
|
* Create ignore list for parser to ignore spell words
|
|
4
9
|
* @param list - comma-separated list of words
|
|
5
10
|
* @param reservedWords - base reserved words map (mutated)
|
|
6
11
|
*/
|
|
7
|
-
createIgnoreList(
|
|
8
|
-
if (!
|
|
9
|
-
const s =
|
|
10
|
-
for (const
|
|
11
|
-
return
|
|
12
|
+
createIgnoreList(e, t) {
|
|
13
|
+
if (!e) return t;
|
|
14
|
+
const s = e.split(",").map((n) => n.trim()).filter(Boolean);
|
|
15
|
+
for (const n of s) t[n] = "";
|
|
16
|
+
return t;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* GUID / UUID v4 (cross-platform)
|
|
@@ -19,21 +24,21 @@ class S {
|
|
|
19
24
|
* 3) Math.random() fallback (NOT crypto-secure, legacy fallback only)
|
|
20
25
|
*/
|
|
21
26
|
guid() {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const c = Array.from(
|
|
27
|
+
const t = globalThis.crypto;
|
|
28
|
+
if (t && typeof t.randomUUID == "function")
|
|
29
|
+
return t.randomUUID();
|
|
30
|
+
if (t && typeof t.getRandomValues == "function") {
|
|
31
|
+
const i = new Uint8Array(16);
|
|
32
|
+
t.getRandomValues(i), i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128;
|
|
33
|
+
const c = Array.from(i, (a) => a.toString(16).padStart(2, "0"));
|
|
29
34
|
return c.slice(0, 4).join("") + "-" + c.slice(4, 6).join("") + "-" + c.slice(6, 8).join("") + "-" + c.slice(8, 10).join("") + "-" + c.slice(10, 16).join("");
|
|
30
35
|
}
|
|
31
|
-
const s = "0123456789abcdef".split(""),
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
for (let
|
|
35
|
-
i
|
|
36
|
-
return
|
|
36
|
+
const s = "0123456789abcdef".split(""), n = [];
|
|
37
|
+
let r;
|
|
38
|
+
n[8] = n[13] = n[18] = n[23] = "-", n[14] = "4";
|
|
39
|
+
for (let i = 0; i < 36; i++)
|
|
40
|
+
n[i] || (r = (0 | Math.random() * 16) >>> 0, n[i] = s[i === 19 ? r & 3 | 8 : r & 15]);
|
|
41
|
+
return n.join("");
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Merge defaults into data object (mutates data)
|
|
@@ -41,138 +46,218 @@ class S {
|
|
|
41
46
|
* @param defaults - defaults object
|
|
42
47
|
* @param force - overwrite existing values
|
|
43
48
|
*/
|
|
44
|
-
mergeDefaultsWithData(
|
|
45
|
-
if (!
|
|
46
|
-
|
|
47
|
-
for (const
|
|
48
|
-
(!(
|
|
49
|
-
return
|
|
49
|
+
mergeDefaultsWithData(e, t, s = !1) {
|
|
50
|
+
if (!e) return t;
|
|
51
|
+
e._id || (e._id = e.id ?? this.guid());
|
|
52
|
+
for (const n of Object.keys(t))
|
|
53
|
+
(!(n in e) || s) && (e[n] = t[n]);
|
|
54
|
+
return e;
|
|
50
55
|
}
|
|
51
56
|
/**
|
|
52
57
|
* Encode string to Base64 (UTF-8 safe, cross-platform)
|
|
53
58
|
*/
|
|
54
|
-
encode(
|
|
55
|
-
const
|
|
56
|
-
if (typeof
|
|
57
|
-
const s = encodeURIComponent(String(
|
|
59
|
+
encode(e) {
|
|
60
|
+
const t = globalThis;
|
|
61
|
+
if (typeof t.btoa == "function") {
|
|
62
|
+
const s = encodeURIComponent(String(e)).replace(
|
|
58
63
|
/%([0-9A-F]{2})/g,
|
|
59
|
-
(
|
|
64
|
+
(n, r) => String.fromCharCode(parseInt(r, 16))
|
|
60
65
|
);
|
|
61
|
-
return
|
|
66
|
+
return t.btoa(s);
|
|
62
67
|
}
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
68
|
+
if (t.Buffer && typeof t.Buffer.from == "function")
|
|
69
|
+
return t.Buffer.from(String(e), "utf8").toString("base64");
|
|
65
70
|
throw new Error("Base64 encode not supported in this environment");
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
68
73
|
* Decode Base64 string to UTF-8 (cross-platform)
|
|
69
74
|
*/
|
|
70
|
-
decode(
|
|
71
|
-
const
|
|
72
|
-
if (typeof
|
|
73
|
-
const s =
|
|
74
|
-
return decodeURIComponent(
|
|
75
|
+
decode(e) {
|
|
76
|
+
const t = globalThis;
|
|
77
|
+
if (typeof t.atob == "function") {
|
|
78
|
+
const s = t.atob(String(e)), n = Array.prototype.map.call(s, (r) => "%" + r.charCodeAt(0).toString(16).padStart(2, "0")).join("");
|
|
79
|
+
return decodeURIComponent(n);
|
|
75
80
|
}
|
|
76
|
-
if (
|
|
77
|
-
return
|
|
81
|
+
if (t.Buffer && typeof t.Buffer.from == "function")
|
|
82
|
+
return t.Buffer.from(String(e), "base64").toString("utf8");
|
|
78
83
|
throw new Error("Base64 decode not supported in this environment");
|
|
79
84
|
}
|
|
80
85
|
/**
|
|
81
86
|
* Returns a random integer between min and max (inclusive)
|
|
82
87
|
* NOTE: Not cryptographically secure (OK for UI, NOT for IDs)
|
|
83
88
|
*/
|
|
84
|
-
getRandomInt(
|
|
85
|
-
return
|
|
89
|
+
getRandomInt(e, t) {
|
|
90
|
+
return e = Math.ceil(e), t = Math.floor(t), Math.floor(Math.random() * (t - e + 1)) + e;
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
88
93
|
* Extract parameter from XCommand
|
|
89
94
|
*/
|
|
90
|
-
getParam(
|
|
91
|
-
return
|
|
95
|
+
getParam(e, t, s = 0) {
|
|
96
|
+
return e?._params?.[t] ?? s;
|
|
92
97
|
}
|
|
93
98
|
/**
|
|
94
99
|
* Default frame scheduler (cross-platform)
|
|
95
100
|
* - Browser: requestAnimationFrame
|
|
96
101
|
* - Node / non-DOM: setImmediate (fast) or setTimeout (paced by target fps)
|
|
97
102
|
*/
|
|
98
|
-
createDefaultScheduler(
|
|
99
|
-
const
|
|
100
|
-
if (typeof
|
|
101
|
-
return (
|
|
102
|
-
const s = typeof
|
|
103
|
-
if (typeof
|
|
104
|
-
return (
|
|
105
|
-
const
|
|
106
|
-
return (
|
|
103
|
+
createDefaultScheduler(e) {
|
|
104
|
+
const t = globalThis;
|
|
105
|
+
if (typeof t.requestAnimationFrame == "function")
|
|
106
|
+
return (r) => t.requestAnimationFrame(r);
|
|
107
|
+
const s = typeof e == "number" && isFinite(e) && e > 0 ? e : 60;
|
|
108
|
+
if (typeof t.setImmediate == "function" && (!e || e >= 60))
|
|
109
|
+
return (r) => t.setImmediate(r);
|
|
110
|
+
const n = Math.max(1, Math.round(1e3 / s));
|
|
111
|
+
return (r) => t.setTimeout(r, n);
|
|
112
|
+
}
|
|
113
|
+
to_iso_now() {
|
|
114
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
115
|
+
}
|
|
116
|
+
is_plain_object(e) {
|
|
117
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
118
|
+
}
|
|
119
|
+
ensure_string(e, t) {
|
|
120
|
+
if (typeof e != "string" || !e.trim())
|
|
121
|
+
throw new Error(`Invalid '${t}'`);
|
|
122
|
+
return e.trim();
|
|
123
|
+
}
|
|
124
|
+
ensure_params(e) {
|
|
125
|
+
return this.is_plain_object(e) ? e : {};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Copy keys from source to target only when value is not null/undefined.
|
|
129
|
+
* Keeps valid falsy values (0, false, "").
|
|
130
|
+
*/
|
|
131
|
+
addIfNotNull(e, t, s) {
|
|
132
|
+
if (!(!e || !t || !Array.isArray(s)))
|
|
133
|
+
for (const n of s) {
|
|
134
|
+
const r = e[n];
|
|
135
|
+
r != null && (t[n] = r);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Add Last Slash
|
|
140
|
+
* adds a last slash to the url if it doesn't have one
|
|
141
|
+
*/
|
|
142
|
+
als(e) {
|
|
143
|
+
const t = String(e ?? "");
|
|
144
|
+
return t.endsWith("/") ? t : t + "/";
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Clear Last Slash
|
|
148
|
+
* removes the last slash if exists
|
|
149
|
+
*/
|
|
150
|
+
cls(e) {
|
|
151
|
+
const t = String(e ?? "");
|
|
152
|
+
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Add First Slash
|
|
156
|
+
*/
|
|
157
|
+
afs(e) {
|
|
158
|
+
const t = String(e ?? "");
|
|
159
|
+
return t.startsWith("/") ? t : "/" + t;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Clear First Slash
|
|
163
|
+
*/
|
|
164
|
+
cfs(e) {
|
|
165
|
+
const t = String(e ?? "");
|
|
166
|
+
return t.startsWith("/") ? t.slice(1) : t;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Calculates expiration time based on short format:
|
|
170
|
+
* - 1h (hours)
|
|
171
|
+
* - 2d (days)
|
|
172
|
+
* - 3y (years, 365d)
|
|
173
|
+
* Returns epoch ms (now + delta).
|
|
174
|
+
*/
|
|
175
|
+
calculateExpiration(e) {
|
|
176
|
+
const s = String(e ?? "").trim().match(/^(\d+)([hdy])$/);
|
|
177
|
+
if (!s) throw new Error("Invalid expiration format. Use: 1h | 2d | 3y");
|
|
178
|
+
const n = Number.parseInt(s[1], 10), r = s[2], i = Date.now();
|
|
179
|
+
let c = 0;
|
|
180
|
+
switch (r) {
|
|
181
|
+
case "h":
|
|
182
|
+
c = n * 60 * 60 * 1e3;
|
|
183
|
+
break;
|
|
184
|
+
case "d":
|
|
185
|
+
c = n * 24 * 60 * 60 * 1e3;
|
|
186
|
+
break;
|
|
187
|
+
case "y":
|
|
188
|
+
c = n * 365 * 24 * 60 * 60 * 1e3;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
return i + c;
|
|
107
192
|
}
|
|
108
193
|
}
|
|
109
|
-
const
|
|
110
|
-
class
|
|
111
|
-
#t = 0;
|
|
112
|
-
// displayed fps (stable)
|
|
194
|
+
const Z = new Y(), u = Z;
|
|
195
|
+
class ee {
|
|
113
196
|
#e = 0;
|
|
197
|
+
// displayed fps (stable)
|
|
198
|
+
#t = 0;
|
|
114
199
|
// EMA of ms/frame
|
|
115
200
|
#s = 0;
|
|
116
|
-
#i;
|
|
117
|
-
// weight of new samples (0..1)
|
|
118
201
|
#n;
|
|
202
|
+
// weight of new samples (0..1)
|
|
203
|
+
#r;
|
|
119
204
|
// minimum integer change to update displayed fps
|
|
120
|
-
constructor(
|
|
121
|
-
const s = Number(
|
|
122
|
-
this.#
|
|
123
|
-
const
|
|
124
|
-
this.#
|
|
205
|
+
constructor(e = 0.05, t = 1) {
|
|
206
|
+
const s = Number(e);
|
|
207
|
+
this.#n = Number.isFinite(s) ? Math.min(1, Math.max(1e-3, s)) : 0.05;
|
|
208
|
+
const n = Number(t);
|
|
209
|
+
this.#r = Number.isFinite(n) ? Math.max(0, Math.floor(n)) : 1;
|
|
125
210
|
}
|
|
126
211
|
now() {
|
|
127
|
-
const
|
|
128
|
-
return
|
|
212
|
+
const e = globalThis.performance;
|
|
213
|
+
return e && typeof e.now == "function" ? e.now() : Date.now();
|
|
129
214
|
}
|
|
130
215
|
calc() {
|
|
131
|
-
const
|
|
216
|
+
const e = this.now();
|
|
132
217
|
if (this.#s === 0)
|
|
133
|
-
return this.#s =
|
|
134
|
-
const
|
|
135
|
-
if (this.#s =
|
|
136
|
-
this.#
|
|
137
|
-
const s = 1e3 / this.#
|
|
138
|
-
if (!Number.isFinite(s) || s <= 0) return this.#
|
|
139
|
-
const
|
|
140
|
-
return this.#
|
|
218
|
+
return this.#s = e, this.#e;
|
|
219
|
+
const t = e - this.#s;
|
|
220
|
+
if (this.#s = e, !Number.isFinite(t) || t <= 0) return this.#e;
|
|
221
|
+
this.#t === 0 ? this.#t = t : this.#t = (1 - this.#n) * this.#t + this.#n * t;
|
|
222
|
+
const s = 1e3 / this.#t;
|
|
223
|
+
if (!Number.isFinite(s) || s <= 0) return this.#e;
|
|
224
|
+
const n = Math.round(s);
|
|
225
|
+
return this.#e !== 0 && this.#r > 0 && Math.abs(n - this.#e) < this.#r ? this.#e : (this.#e = n, this.#e);
|
|
141
226
|
}
|
|
142
227
|
reset() {
|
|
143
|
-
this.#
|
|
228
|
+
this.#e = 0, this.#t = 0, this.#s = 0;
|
|
144
229
|
}
|
|
145
230
|
}
|
|
146
|
-
class
|
|
147
|
-
constructor(
|
|
148
|
-
this._enabled = !0, this._show_date = !1, this._show_time = !0, this._debug = !1,
|
|
231
|
+
class te {
|
|
232
|
+
constructor(e) {
|
|
233
|
+
this._enabled = !0, this._show_date = !1, this._show_time = !0, this._debug = !1, e && this.configure(e);
|
|
149
234
|
}
|
|
150
|
-
configure(
|
|
151
|
-
typeof
|
|
235
|
+
configure(e) {
|
|
236
|
+
typeof e._enabled == "boolean" && (this._enabled = e._enabled), typeof e._show_date == "boolean" && (this._show_date = e._show_date), typeof e._show_time == "boolean" && (this._show_time = e._show_time), typeof e._debug == "boolean" && (this._debug = e._debug);
|
|
152
237
|
}
|
|
153
238
|
_dt() {
|
|
154
|
-
const
|
|
155
|
-
return
|
|
239
|
+
const e = /* @__PURE__ */ new Date(), t = this._show_date ? `${e.getDate()}.${e.getMonth()}.${e.getFullYear()} ` : "", s = this._show_time ? `${e.getHours()}:${e.getMinutes()}:${e.getSeconds()}.${e.getMilliseconds()}|` : "";
|
|
240
|
+
return t + s;
|
|
156
241
|
}
|
|
157
|
-
log(
|
|
158
|
-
this._enabled && console.log(this._dt(),
|
|
242
|
+
log(e, ...t) {
|
|
243
|
+
this._enabled && console.log(this._dt(), e, ...t);
|
|
159
244
|
}
|
|
160
|
-
warn(
|
|
161
|
-
this._enabled && console.warn(this._dt(),
|
|
245
|
+
warn(e, ...t) {
|
|
246
|
+
this._enabled && console.warn(this._dt(), e, ...t);
|
|
162
247
|
}
|
|
163
|
-
error(
|
|
164
|
-
this._enabled && console.error(this._dt(),
|
|
248
|
+
error(e, ...t) {
|
|
249
|
+
this._enabled && console.error(this._dt(), e, ...t);
|
|
165
250
|
}
|
|
166
|
-
debug(
|
|
167
|
-
!this._enabled || !this._debug || console.debug(this._dt(),
|
|
251
|
+
debug(e, ...t) {
|
|
252
|
+
!this._enabled || !this._debug || console.debug(this._dt(), e, ...t);
|
|
168
253
|
}
|
|
169
254
|
}
|
|
170
|
-
const
|
|
171
|
-
|
|
255
|
+
const l = new te(), Q = typeof process < "u" && !!process?.env && process.env.NODE_ENV === "production";
|
|
256
|
+
Q || console.info(
|
|
172
257
|
"[Xpell] _xlog is redirected to console in development mode. Tip: enable 'Show timestamps' in DevTools → Console for timed logs."
|
|
173
258
|
);
|
|
174
|
-
const
|
|
175
|
-
class
|
|
259
|
+
const v = Q ? l : console;
|
|
260
|
+
class se {
|
|
176
261
|
constructor() {
|
|
177
262
|
this._objects = {}, this._listeners = /* @__PURE__ */ new Map(), this._any_listeners = /* @__PURE__ */ new Set(), this._compat_writes = !0, this._warn_legacy_writes = !0, this._verbose = !1, this._compat_legacy_keys = !0, this._o_proxy = null, this._objects = {};
|
|
178
263
|
}
|
|
@@ -183,49 +268,49 @@ class A {
|
|
|
183
268
|
*/
|
|
184
269
|
get _o() {
|
|
185
270
|
return !this._compat_writes && !this._warn_legacy_writes ? this._objects : (this._o_proxy || (this._o_proxy = new Proxy(this._objects, {
|
|
186
|
-
set: (
|
|
187
|
-
const
|
|
271
|
+
set: (e, t, s) => {
|
|
272
|
+
const n = String(t);
|
|
188
273
|
return this._warn_legacy_writes && console.warn(
|
|
189
|
-
`[XData] Legacy write: _o["${
|
|
190
|
-
), this._compat_writes ? this.set(
|
|
274
|
+
`[XData] Legacy write: _o["${n}"] = ... ; prefer XData.set("${n}", value).`
|
|
275
|
+
), this._compat_writes ? this.set(n, s, { source: "legacy:_o" }) : e[n] = s, !0;
|
|
191
276
|
},
|
|
192
|
-
deleteProperty: (
|
|
193
|
-
const s = String(
|
|
277
|
+
deleteProperty: (e, t) => {
|
|
278
|
+
const s = String(t);
|
|
194
279
|
return this._warn_legacy_writes && console.warn(
|
|
195
280
|
`[XData] Legacy delete: delete _o["${s}"] ; prefer XData.delete("${s}").`
|
|
196
|
-
), this._compat_writes ? this.delete(s, { source: "legacy:_o" }) : delete
|
|
281
|
+
), this._compat_writes ? this.delete(s, { source: "legacy:_o" }) : delete e[s], !0;
|
|
197
282
|
}
|
|
198
283
|
})), this._o_proxy);
|
|
199
284
|
}
|
|
200
285
|
/** Preferred read API */
|
|
201
|
-
get(
|
|
202
|
-
return this._objects[
|
|
286
|
+
get(e) {
|
|
287
|
+
return this._objects[e];
|
|
203
288
|
}
|
|
204
289
|
/** Preferred write API */
|
|
205
|
-
set(
|
|
206
|
-
const
|
|
207
|
-
this._objects[
|
|
290
|
+
set(e, t, s) {
|
|
291
|
+
const n = this._objects[e];
|
|
292
|
+
this._objects[e] = t, this._emit({ key: e, value: t, prev: n, ts: Date.now(), op: "set", meta: s });
|
|
208
293
|
}
|
|
209
294
|
/** Shallow merge helper (nice for state objects) */
|
|
210
|
-
patch(
|
|
211
|
-
const
|
|
212
|
-
this._objects[
|
|
295
|
+
patch(e, t, s) {
|
|
296
|
+
const n = this._objects[e], i = { ...n && typeof n == "object" ? n : {}, ...t };
|
|
297
|
+
this._objects[e] = i, this._emit({ key: e, value: i, prev: n, ts: Date.now(), op: "patch", meta: s });
|
|
213
298
|
}
|
|
214
299
|
/** In-place mutation notifier */
|
|
215
|
-
touch(
|
|
216
|
-
const s = this._objects[
|
|
217
|
-
this._emit({ key:
|
|
300
|
+
touch(e, t) {
|
|
301
|
+
const s = this._objects[e];
|
|
302
|
+
this._emit({ key: e, value: s, prev: s, ts: Date.now(), op: "touch", meta: t });
|
|
218
303
|
}
|
|
219
|
-
has(
|
|
220
|
-
return Object.prototype.hasOwnProperty.call(this._objects,
|
|
304
|
+
has(e) {
|
|
305
|
+
return Object.prototype.hasOwnProperty.call(this._objects, e);
|
|
221
306
|
}
|
|
222
|
-
delete(
|
|
223
|
-
const s = this._objects[
|
|
224
|
-
delete this._objects[
|
|
307
|
+
delete(e, t) {
|
|
308
|
+
const s = this._objects[e];
|
|
309
|
+
delete this._objects[e], this._emit({ key: e, value: void 0, prev: s, ts: Date.now(), op: "delete", meta: t });
|
|
225
310
|
}
|
|
226
|
-
pick(
|
|
227
|
-
const s = this._objects[
|
|
228
|
-
return this.delete(
|
|
311
|
+
pick(e, t) {
|
|
312
|
+
const s = this._objects[e];
|
|
313
|
+
return this.delete(e, t), s;
|
|
229
314
|
}
|
|
230
315
|
clean() {
|
|
231
316
|
this._objects = {};
|
|
@@ -233,32 +318,32 @@ class A {
|
|
|
233
318
|
// ----------------------------
|
|
234
319
|
// Subscriptions
|
|
235
320
|
// ----------------------------
|
|
236
|
-
on(
|
|
237
|
-
let s = this._listeners.get(
|
|
238
|
-
return s || this._listeners.set(
|
|
321
|
+
on(e, t) {
|
|
322
|
+
let s = this._listeners.get(e);
|
|
323
|
+
return s || this._listeners.set(e, s = /* @__PURE__ */ new Set()), s.add(t), () => this.off(e, t);
|
|
239
324
|
}
|
|
240
|
-
off(
|
|
241
|
-
const s = this._listeners.get(
|
|
242
|
-
s && (s.delete(
|
|
325
|
+
off(e, t) {
|
|
326
|
+
const s = this._listeners.get(e);
|
|
327
|
+
s && (s.delete(t), s.size === 0 && this._listeners.delete(e));
|
|
243
328
|
}
|
|
244
|
-
onAny(
|
|
245
|
-
return this._any_listeners.add(
|
|
329
|
+
onAny(e) {
|
|
330
|
+
return this._any_listeners.add(e), () => this._any_listeners.delete(e);
|
|
246
331
|
}
|
|
247
332
|
// ----------------------------
|
|
248
333
|
// Emit
|
|
249
334
|
// ----------------------------
|
|
250
|
-
_emit(
|
|
251
|
-
this._verbose &&
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
for (const s of this._any_listeners) s(
|
|
335
|
+
_emit(e) {
|
|
336
|
+
this._verbose && e.meta?.trace && (e.stack = new Error().stack);
|
|
337
|
+
const t = this._listeners.get(e.key);
|
|
338
|
+
if (t) for (const s of t) s(e);
|
|
339
|
+
for (const s of this._any_listeners) s(e);
|
|
255
340
|
}
|
|
256
341
|
}
|
|
257
|
-
const
|
|
258
|
-
class
|
|
259
|
-
constructor(
|
|
260
|
-
|
|
261
|
-
this[
|
|
342
|
+
const D = new se(), m = D;
|
|
343
|
+
class R {
|
|
344
|
+
constructor(e) {
|
|
345
|
+
e && Object.keys(e).forEach((t) => {
|
|
346
|
+
this[t] = e[t];
|
|
262
347
|
}), this.d || (this.d = Date.now());
|
|
263
348
|
}
|
|
264
349
|
/**
|
|
@@ -271,83 +356,83 @@ class x {
|
|
|
271
356
|
* @param defaultValue the default value if none above exists
|
|
272
357
|
* @returns {any} the actual parameter value
|
|
273
358
|
*/
|
|
274
|
-
getParam(
|
|
275
|
-
return this._params?.hasOwnProperty(
|
|
359
|
+
getParam(e, t, s) {
|
|
360
|
+
return this._params?.hasOwnProperty(t) ? this._params[t] : this._params?.hasOwnProperty(e) ? this._params[e] : s;
|
|
276
361
|
}
|
|
277
362
|
}
|
|
278
|
-
const
|
|
363
|
+
const A = {
|
|
279
364
|
type: "_type",
|
|
280
365
|
children: "_children"
|
|
281
|
-
},
|
|
366
|
+
}, y = class y {
|
|
282
367
|
/**
|
|
283
368
|
* Adds HTML-Xpell Mapping item
|
|
284
369
|
* @param htmlElement HTML element to change from
|
|
285
370
|
* @param xpellElement Xpell element to change to
|
|
286
371
|
*/
|
|
287
|
-
static addHtml2XpellMapItem(
|
|
288
|
-
|
|
372
|
+
static addHtml2XpellMapItem(e, t) {
|
|
373
|
+
y.html2XMap.elements[e] = t;
|
|
289
374
|
}
|
|
290
375
|
/**
|
|
291
376
|
* convert text command to Xpell json command
|
|
292
377
|
* @param {string} txt
|
|
293
378
|
*/
|
|
294
|
-
static parse(
|
|
295
|
-
const s =
|
|
296
|
-
let
|
|
297
|
-
if (
|
|
298
|
-
for (let
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
|
|
379
|
+
static parse(e, t) {
|
|
380
|
+
const s = e.split(" ");
|
|
381
|
+
let n = new R();
|
|
382
|
+
if (t ? (n._module = t, n._op = s[0]) : (n._module = s[0], n._op = s[1]), n._params = {}, s.length > 1)
|
|
383
|
+
for (let r = 2; r < s.length; ++r) {
|
|
384
|
+
const i = s[r];
|
|
385
|
+
if (i.indexOf(":") > -1) {
|
|
386
|
+
const a = i.split(":");
|
|
387
|
+
n._params[a[0]] = a[1];
|
|
303
388
|
} else
|
|
304
|
-
|
|
389
|
+
n._params[r - 1] = s[r];
|
|
305
390
|
}
|
|
306
|
-
return
|
|
391
|
+
return n;
|
|
307
392
|
}
|
|
308
|
-
static replaceSpacesInQuotes(
|
|
309
|
-
return
|
|
310
|
-
const
|
|
311
|
-
return `${
|
|
393
|
+
static replaceSpacesInQuotes(e, t = "_%20_") {
|
|
394
|
+
return e.replace(/(['"])(.*?)\1/g, (s, n, r) => {
|
|
395
|
+
const i = String(r).replace(/\s/g, t);
|
|
396
|
+
return `${n}${i}${n}`;
|
|
312
397
|
});
|
|
313
398
|
}
|
|
314
|
-
static parseObjectCommand(
|
|
315
|
-
|
|
316
|
-
const s =
|
|
317
|
-
if (!
|
|
318
|
-
let
|
|
319
|
-
if (s[0]?.startsWith("#") && (
|
|
399
|
+
static parseObjectCommand(e, t) {
|
|
400
|
+
e = y.replaceSpacesInQuotes(e);
|
|
401
|
+
const s = e.trim().split(/\s+/), n = t || s.shift();
|
|
402
|
+
if (!n) throw new Error("Missing module name");
|
|
403
|
+
let r;
|
|
404
|
+
if (s[0]?.startsWith("#") && (r = s.shift().slice(1), !r))
|
|
320
405
|
throw new Error("Invalid object selector '#'. Use '#<id>'");
|
|
321
|
-
const
|
|
322
|
-
if (!
|
|
406
|
+
const i = s.shift();
|
|
407
|
+
if (!i) throw new Error("Missing operation");
|
|
323
408
|
const c = {};
|
|
324
|
-
let
|
|
325
|
-
if (s.forEach((
|
|
326
|
-
if (
|
|
327
|
-
if (
|
|
328
|
-
const
|
|
329
|
-
c[
|
|
409
|
+
let a = null, _ = null;
|
|
410
|
+
if (s.forEach((h) => {
|
|
411
|
+
if (_) {
|
|
412
|
+
if (_ += ` ${h}`, h.endsWith(_[0])) {
|
|
413
|
+
const p = _.slice(1, -1).replace(/_%20_/g, " ");
|
|
414
|
+
c[a] = p, _ = null;
|
|
330
415
|
}
|
|
331
416
|
return;
|
|
332
417
|
}
|
|
333
|
-
if (
|
|
334
|
-
if (
|
|
335
|
-
const
|
|
336
|
-
c[
|
|
418
|
+
if (h.startsWith('"') || h.startsWith("'")) {
|
|
419
|
+
if (_ = h, h.endsWith(h[0]) && h.length > 1) {
|
|
420
|
+
const p = h.slice(1, -1).replace(/_%20_/g, " ");
|
|
421
|
+
c[a] = p, _ = null;
|
|
337
422
|
}
|
|
338
423
|
return;
|
|
339
424
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
c[
|
|
425
|
+
if (h.includes(":")) {
|
|
426
|
+
const p = h.split(":"), x = p[0], j = p.slice(1).join(":").replace(/_%20_/g, " ");
|
|
427
|
+
c[x] = j, a = null;
|
|
343
428
|
return;
|
|
344
429
|
}
|
|
345
|
-
|
|
346
|
-
}),
|
|
430
|
+
a = h.replace(/_%20_/g, " ");
|
|
431
|
+
}), _) throw new Error("Unclosed quoted parameter value");
|
|
347
432
|
return {
|
|
348
|
-
_module:
|
|
349
|
-
_object:
|
|
350
|
-
_op:
|
|
433
|
+
_module: n,
|
|
434
|
+
_object: r,
|
|
435
|
+
_op: i,
|
|
351
436
|
_params: c
|
|
352
437
|
};
|
|
353
438
|
}
|
|
@@ -356,9 +441,9 @@ const w = {
|
|
|
356
441
|
* @param xmlString XML string
|
|
357
442
|
* @returns
|
|
358
443
|
*/
|
|
359
|
-
static xmlString2Xpell(
|
|
360
|
-
const s = new DOMParser().parseFromString(
|
|
361
|
-
return s.childNodes.length > 0 ?
|
|
444
|
+
static xmlString2Xpell(e) {
|
|
445
|
+
const s = new DOMParser().parseFromString(e, "text/xml");
|
|
446
|
+
return s.childNodes.length > 0 ? y.xml2Xpell(s.childNodes[0]) : {};
|
|
362
447
|
}
|
|
363
448
|
/**
|
|
364
449
|
* Converts XML/HTML Document to Xpell JSON
|
|
@@ -366,26 +451,26 @@ const w = {
|
|
|
366
451
|
* @param forceXhtml force Xpell XHTML for every unknown object
|
|
367
452
|
* @returns {} Xpell JSON
|
|
368
453
|
*/
|
|
369
|
-
static xml2Xpell(
|
|
370
|
-
const s =
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
let c =
|
|
375
|
-
if (
|
|
376
|
-
for (let
|
|
377
|
-
const
|
|
378
|
-
|
|
454
|
+
static xml2Xpell(e, t) {
|
|
455
|
+
const s = y.html2XMap;
|
|
456
|
+
let n = {};
|
|
457
|
+
n._children = [];
|
|
458
|
+
const r = e.nodeName, i = e.nodeName;
|
|
459
|
+
let c = t;
|
|
460
|
+
if (t ? (n[A.type] = "xhtml", n._html_ns = "http://www.w3.org/2000/svg") : n._type = s.elements[r] ? s.elements[r] : r, e.attributes)
|
|
461
|
+
for (let a = 0; a < e.attributes.length; ++a) {
|
|
462
|
+
const _ = e.attributes[a], h = s.attributes[_.name] ? s.attributes[_.name] : _.name;
|
|
463
|
+
n[h] = _.value;
|
|
379
464
|
}
|
|
380
|
-
if (
|
|
381
|
-
for (let
|
|
382
|
-
const
|
|
383
|
-
|
|
465
|
+
if (e?.firstChild?.nodeValue && (n.text = e?.firstChild.nodeValue.trim()), n[A.type] == "xhtml" ? n._html_tag = i : n[A.type] == "svg" && (c = !0, n._html_ns = "http://www.w3.org/2000/svg"), e?.childNodes.length > 0)
|
|
466
|
+
for (let a = 0; a < e.childNodes.length; ++a) {
|
|
467
|
+
const _ = e.childNodes[a];
|
|
468
|
+
_.nodeName.startsWith("#") || n[A.children].push(y.xml2Xpell(_, c));
|
|
384
469
|
}
|
|
385
|
-
return
|
|
470
|
+
return n;
|
|
386
471
|
}
|
|
387
472
|
};
|
|
388
|
-
|
|
473
|
+
y.html2XMap = {
|
|
389
474
|
elements: {
|
|
390
475
|
div: "view",
|
|
391
476
|
a: "link",
|
|
@@ -415,189 +500,201 @@ f.html2XMap = {
|
|
|
415
500
|
id: "_id"
|
|
416
501
|
}
|
|
417
502
|
};
|
|
418
|
-
let
|
|
419
|
-
class
|
|
420
|
-
constructor() {
|
|
421
|
-
this._log_rules = {
|
|
422
|
-
register: !1,
|
|
423
|
-
remove: !1,
|
|
424
|
-
fire: !1
|
|
425
|
-
}, this._events = {}, this._listener_index = {};
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Register a listener on an event name (runtime bus only).
|
|
429
|
-
*
|
|
430
|
-
* Backward compatible:
|
|
431
|
-
* - Canonical: on(name, cb, { _once, _owner, _tag })
|
|
432
|
-
* - Legacy: on(name, cb, { _once }, owner)
|
|
433
|
-
*/
|
|
434
|
-
on(t, e, s = {}, i) {
|
|
435
|
-
this._events[t] || (this._events[t] = []);
|
|
436
|
-
const n = s?._owner ?? i, r = p.guid(), c = {
|
|
437
|
-
_id: r,
|
|
438
|
-
_callback: e,
|
|
439
|
-
_options: s,
|
|
440
|
-
_owner: n,
|
|
441
|
-
_tag: s?._tag
|
|
442
|
-
};
|
|
443
|
-
return this._events[t].push(c), this._listener_index[r] = t, this._log_rules.register && y.log("XEM Register", t, r), r;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Register a listener that will be removed after first fire.
|
|
447
|
-
*/
|
|
448
|
-
once(t, e, s) {
|
|
449
|
-
return this.on(t, e, { _once: !0, _owner: s });
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Fire an event with optional payload.
|
|
453
|
-
*/
|
|
454
|
-
async fire(t, e) {
|
|
455
|
-
const s = this._events[t];
|
|
456
|
-
if (!s || s.length === 0) return;
|
|
457
|
-
this._log_rules.fire && y.log("XEM Fire", t, e);
|
|
458
|
-
const i = s.slice(), n = [];
|
|
459
|
-
for (const r of i) {
|
|
460
|
-
try {
|
|
461
|
-
r && r._callback && r._callback(e);
|
|
462
|
-
} catch (c) {
|
|
463
|
-
y.error(c);
|
|
464
|
-
}
|
|
465
|
-
r?._options?._once && n.push(r._id);
|
|
466
|
-
}
|
|
467
|
-
for (const r of n) this.remove(r);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Remove a listener by id.
|
|
471
|
-
*/
|
|
472
|
-
remove(t) {
|
|
473
|
-
const e = this._listener_index[t];
|
|
474
|
-
if (!e) return;
|
|
475
|
-
const s = this._events[e];
|
|
476
|
-
if (s && s.length) {
|
|
477
|
-
const i = s.findIndex((n) => n?._id === t);
|
|
478
|
-
i >= 0 && s.splice(i, 1), s.length === 0 && delete this._events[e];
|
|
479
|
-
}
|
|
480
|
-
delete this._listener_index[t], this._log_rules.remove && y.log("XEM Remove", e, t);
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Remove all listeners for a given owner reference.
|
|
484
|
-
*/
|
|
485
|
-
removeOwner(t) {
|
|
486
|
-
if (!t) return;
|
|
487
|
-
const e = [];
|
|
488
|
-
for (const s of Object.values(this._events))
|
|
489
|
-
for (const i of s)
|
|
490
|
-
(i?._owner ?? i?._options?._owner) === t && e.push(i._id);
|
|
491
|
-
e.forEach((s) => this.remove(s));
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Clear the entire event bus (mostly for tests / hard reset).
|
|
495
|
-
*/
|
|
496
|
-
clear() {
|
|
497
|
-
this._events = {}, this._listener_index = {};
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
const b = new $();
|
|
501
|
-
class R {
|
|
502
|
-
#t;
|
|
503
|
+
let w = y;
|
|
504
|
+
class ne {
|
|
503
505
|
#e;
|
|
506
|
+
#t;
|
|
504
507
|
#s;
|
|
505
508
|
constructor() {
|
|
506
|
-
this.#
|
|
509
|
+
this.#e = {}, this.#t = {}, this.#s = {};
|
|
507
510
|
}
|
|
508
511
|
get _objects() {
|
|
509
|
-
return this.#
|
|
512
|
+
return this.#t;
|
|
510
513
|
}
|
|
511
514
|
/**
|
|
512
515
|
* Checks if an object is found in the object manager
|
|
513
516
|
* @param xObjectId
|
|
514
517
|
* @returns
|
|
515
518
|
*/
|
|
516
|
-
hasObject(
|
|
517
|
-
return this.#
|
|
519
|
+
hasObject(e) {
|
|
520
|
+
return this.#t.hasOwnProperty(e);
|
|
518
521
|
}
|
|
519
522
|
/**
|
|
520
523
|
* Register multiple classes dictionary into the object manager
|
|
521
524
|
* @param xObjects - key value list -> \{"view":XView,...\}
|
|
522
525
|
*/
|
|
523
|
-
registerObjects(
|
|
524
|
-
Object.keys(
|
|
526
|
+
registerObjects(e) {
|
|
527
|
+
Object.keys(e).forEach((s) => this.registerObject(s, e[s]));
|
|
525
528
|
}
|
|
526
529
|
/**
|
|
527
530
|
* Registers single XObject
|
|
528
531
|
* @param name - name of the object
|
|
529
532
|
* @param xObjects The object class
|
|
530
533
|
*/
|
|
531
|
-
registerObject(
|
|
532
|
-
this.#
|
|
534
|
+
registerObject(e, t) {
|
|
535
|
+
this.#e[e] = t;
|
|
533
536
|
}
|
|
534
537
|
/**
|
|
535
538
|
* Checks if a class (name) is found in the object manager classes dictionary
|
|
536
539
|
* @param name - class name
|
|
537
540
|
* @returns {boolean}
|
|
538
541
|
*/
|
|
539
|
-
hasObjectClass(
|
|
540
|
-
return this.#
|
|
542
|
+
hasObjectClass(e) {
|
|
543
|
+
return this.#e.hasOwnProperty(e);
|
|
541
544
|
}
|
|
542
545
|
/**
|
|
543
546
|
* Retrieves XObject class instance
|
|
544
547
|
* @param name class name
|
|
545
548
|
* @returns {XObject}
|
|
546
549
|
*/
|
|
547
|
-
getObjectClass(
|
|
548
|
-
return this.#
|
|
550
|
+
getObjectClass(e) {
|
|
551
|
+
return this.#e[e];
|
|
549
552
|
}
|
|
550
553
|
/**
|
|
551
554
|
* Retrieves all the classes dictionary
|
|
552
555
|
* @returns XObjectManagerIndex
|
|
556
|
+
* @deprecated use getObjectClasses() instead
|
|
553
557
|
*/
|
|
554
558
|
getAllClasses() {
|
|
555
|
-
return this
|
|
559
|
+
return this.getObjectClasses();
|
|
560
|
+
}
|
|
561
|
+
getObjectClasses() {
|
|
562
|
+
return this.#e;
|
|
556
563
|
}
|
|
557
564
|
get _classes() {
|
|
558
|
-
return this.#
|
|
565
|
+
return this.#e;
|
|
559
566
|
}
|
|
560
567
|
/**
|
|
561
568
|
* Add XObject instance to the manager
|
|
562
569
|
* @param xObject XObject to maintain
|
|
563
570
|
*/
|
|
564
|
-
addObject(
|
|
565
|
-
|
|
571
|
+
addObject(e) {
|
|
572
|
+
e && e._id ? (this.#t[e._id] = e, (!e._name || e._name.length == 0) && (e._name = e._id), this.#s[e._name] = e._id) : l.log("unable to add object");
|
|
566
573
|
}
|
|
567
574
|
/**
|
|
568
575
|
* Remove XObject from the manager
|
|
569
576
|
* @param xObjectId object id to remove
|
|
570
577
|
*/
|
|
571
|
-
removeObject(
|
|
572
|
-
const
|
|
573
|
-
|
|
578
|
+
removeObject(e) {
|
|
579
|
+
const t = this.#t[e];
|
|
580
|
+
t && (delete this.#s[t?._name], delete this.#t[e]);
|
|
574
581
|
}
|
|
575
582
|
/**
|
|
576
583
|
* Retrieves XObject instance
|
|
577
584
|
* @param xObjectId XObject id
|
|
578
585
|
* @returns {XObject}
|
|
579
586
|
*/
|
|
580
|
-
getObject(
|
|
581
|
-
return this.#e
|
|
587
|
+
getObject(e) {
|
|
588
|
+
return this.#t[e];
|
|
582
589
|
}
|
|
583
590
|
/**
|
|
584
591
|
* alias to getObject
|
|
585
592
|
* @param id
|
|
586
593
|
* @returns
|
|
587
594
|
*/
|
|
588
|
-
go(
|
|
589
|
-
return this.getObject(
|
|
595
|
+
go(e) {
|
|
596
|
+
return this.getObject(e);
|
|
590
597
|
}
|
|
591
598
|
/**
|
|
592
599
|
* Retrieves XObject instance
|
|
593
600
|
* @param objectName XObject name
|
|
594
601
|
* @returns {XObject}
|
|
595
602
|
*/
|
|
596
|
-
getObjectByName(
|
|
597
|
-
return this.#s[
|
|
603
|
+
getObjectByName(e) {
|
|
604
|
+
return this.#s[e] ? this.getObject(this.#s[e]) : null;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
class fe {
|
|
608
|
+
constructor() {
|
|
609
|
+
this._log_rules = {
|
|
610
|
+
register: !1,
|
|
611
|
+
remove: !1,
|
|
612
|
+
fire: !1
|
|
613
|
+
}, this._events = {}, this._listener_index = {};
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Register a listener on an event name (runtime bus only).
|
|
617
|
+
*
|
|
618
|
+
* Backward compatible:
|
|
619
|
+
* - Canonical: on(name, cb, { _once, _owner, _tag })
|
|
620
|
+
* - Legacy: on(name, cb, { _once }, owner)
|
|
621
|
+
*/
|
|
622
|
+
on(e, t, s = {}, n) {
|
|
623
|
+
this._events[e] || (this._events[e] = []);
|
|
624
|
+
const r = s?._owner ?? n, i = u.guid(), c = {
|
|
625
|
+
_id: i,
|
|
626
|
+
_callback: t,
|
|
627
|
+
_options: s,
|
|
628
|
+
_owner: r,
|
|
629
|
+
_tag: s?._tag
|
|
630
|
+
};
|
|
631
|
+
return this._events[e].push(c), this._listener_index[i] = e, this._log_rules.register && v.log("XEM Register", e, i), i;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Register a listener that will be removed after first fire.
|
|
635
|
+
*/
|
|
636
|
+
once(e, t, s) {
|
|
637
|
+
return this.on(e, t, { _once: !0, _owner: s });
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Fire an event with optional payload.
|
|
641
|
+
*/
|
|
642
|
+
async fire(e, t) {
|
|
643
|
+
const s = this._events[e];
|
|
644
|
+
if (!s || s.length === 0) return;
|
|
645
|
+
this._log_rules.fire && v.log("XEM Fire", e, t);
|
|
646
|
+
const n = s.slice(), r = [];
|
|
647
|
+
for (const i of n) {
|
|
648
|
+
try {
|
|
649
|
+
i && i._callback && i._callback(t);
|
|
650
|
+
} catch (c) {
|
|
651
|
+
v.error(c);
|
|
652
|
+
}
|
|
653
|
+
i?._options?._once && r.push(i._id);
|
|
654
|
+
}
|
|
655
|
+
for (const i of r) this.remove(i);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Remove a listener by id.
|
|
659
|
+
*/
|
|
660
|
+
remove(e) {
|
|
661
|
+
const t = this._listener_index[e];
|
|
662
|
+
if (!t) return;
|
|
663
|
+
const s = this._events[t];
|
|
664
|
+
if (s && s.length) {
|
|
665
|
+
const n = s.findIndex((r) => r?._id === e);
|
|
666
|
+
n >= 0 && s.splice(n, 1), s.length === 0 && delete this._events[t];
|
|
667
|
+
}
|
|
668
|
+
delete this._listener_index[e], this._log_rules.remove && v.log("XEM Remove", t, e);
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Remove all listeners for a given owner reference.
|
|
672
|
+
*/
|
|
673
|
+
removeOwner(e) {
|
|
674
|
+
if (!e) return;
|
|
675
|
+
const t = [];
|
|
676
|
+
for (const s of Object.values(this._events))
|
|
677
|
+
for (const n of s)
|
|
678
|
+
(n?._owner ?? n?._options?._owner) === e && t.push(n._id);
|
|
679
|
+
t.forEach((s) => this.remove(s));
|
|
598
680
|
}
|
|
681
|
+
/**
|
|
682
|
+
* Clear the entire event bus (mostly for tests / hard reset).
|
|
683
|
+
*/
|
|
684
|
+
clear() {
|
|
685
|
+
this._events = {}, this._listener_index = {};
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
let N;
|
|
689
|
+
function pe(o) {
|
|
690
|
+
N = o;
|
|
691
|
+
}
|
|
692
|
+
function E() {
|
|
693
|
+
if (!N)
|
|
694
|
+
throw new Error("XEventManager not set");
|
|
695
|
+
return N;
|
|
599
696
|
}
|
|
600
|
-
const
|
|
697
|
+
const re = [
|
|
601
698
|
"_nano_commands",
|
|
602
699
|
"_cache_cmd_txt",
|
|
603
700
|
"_cache_jcmd",
|
|
@@ -606,106 +703,297 @@ const N = [
|
|
|
606
703
|
"_parent",
|
|
607
704
|
"_children"
|
|
608
705
|
];
|
|
609
|
-
function
|
|
610
|
-
return
|
|
706
|
+
function F(o) {
|
|
707
|
+
return re.includes(o);
|
|
611
708
|
}
|
|
612
|
-
function
|
|
709
|
+
function K(o) {
|
|
613
710
|
if (!o || typeof o != "object" || Array.isArray(o)) return !1;
|
|
614
|
-
const
|
|
615
|
-
return
|
|
711
|
+
const e = Object.getPrototypeOf(o);
|
|
712
|
+
return e === Object.prototype || e === null;
|
|
616
713
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
o
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
714
|
+
function g(o, e) {
|
|
715
|
+
return o._skill = e, o.getSkill = () => e, o;
|
|
716
|
+
}
|
|
717
|
+
const G = {
|
|
718
|
+
info: g(
|
|
719
|
+
(o, e) => {
|
|
720
|
+
l.log("XObject id " + e?._id);
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
_name: "info",
|
|
724
|
+
_scope: "object",
|
|
725
|
+
_description: "Logs the current object's id."
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
log: g(
|
|
729
|
+
(o, e) => {
|
|
730
|
+
o._params && o._params[1] ? l.log(o._params[1]) : l.log(e);
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
_name: "log",
|
|
734
|
+
_scope: "object",
|
|
735
|
+
_description: "Logs a message or the current object.",
|
|
736
|
+
_params: {
|
|
737
|
+
1: "Optional message to log."
|
|
637
738
|
}
|
|
638
|
-
t[e] = s;
|
|
639
739
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
740
|
+
),
|
|
741
|
+
fire: g(
|
|
742
|
+
(o, e) => {
|
|
743
|
+
o._params && o._params[1] ? E().fire(
|
|
744
|
+
String(o._params[1]),
|
|
745
|
+
o._params[2]
|
|
746
|
+
) : o._params && o._params.event && E().fire(
|
|
747
|
+
String(o._params.event),
|
|
748
|
+
o._params.data
|
|
749
|
+
);
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
_name: "fire",
|
|
753
|
+
_scope: "object",
|
|
754
|
+
_description: "Fires an XEventManager event.",
|
|
755
|
+
_params: {
|
|
756
|
+
event: "Event name.",
|
|
757
|
+
data: "Optional event payload.",
|
|
758
|
+
1: "Event name shorthand.",
|
|
759
|
+
2: "Event payload shorthand."
|
|
760
|
+
},
|
|
761
|
+
_example: {
|
|
762
|
+
_op: "fire",
|
|
763
|
+
_params: {
|
|
764
|
+
event: "user:login",
|
|
765
|
+
data: {
|
|
766
|
+
source: "button"
|
|
767
|
+
}
|
|
768
|
+
}
|
|
648
769
|
}
|
|
649
|
-
delete t[e];
|
|
650
770
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
771
|
+
),
|
|
772
|
+
noop: g(
|
|
773
|
+
() => {
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
_name: "noop",
|
|
777
|
+
_scope: "object",
|
|
778
|
+
_description: "No-op command. Useful as a placeholder in sequences."
|
|
659
779
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
780
|
+
),
|
|
781
|
+
"set-field": g(
|
|
782
|
+
(o, e) => {
|
|
783
|
+
const t = o._params?.name, s = o._params?.value;
|
|
784
|
+
if (!(!e || typeof t != "string" || t.length === 0)) {
|
|
785
|
+
if (F(t)) {
|
|
786
|
+
l.error(`set-field denied for protected field: ${t}`);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
e[t] = s;
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
_name: "set-field",
|
|
794
|
+
_scope: "object",
|
|
795
|
+
_description: "Sets a runtime field directly on the current object.",
|
|
796
|
+
_params: {
|
|
797
|
+
name: "Field name.",
|
|
798
|
+
value: "Value to assign."
|
|
799
|
+
},
|
|
800
|
+
_example: {
|
|
801
|
+
_op: "set-field",
|
|
802
|
+
_params: {
|
|
803
|
+
name: "_text",
|
|
804
|
+
value: "Hello"
|
|
805
|
+
}
|
|
806
|
+
}
|
|
670
807
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
808
|
+
),
|
|
809
|
+
"delete-field": g(
|
|
810
|
+
(o, e) => {
|
|
811
|
+
const t = o._params?.name;
|
|
812
|
+
if (!(!e || typeof t != "string" || t.length === 0)) {
|
|
813
|
+
if (F(t)) {
|
|
814
|
+
l.error(`delete-field denied for protected field: ${t}`);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
delete e[t];
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
_name: "delete-field",
|
|
822
|
+
_scope: "object",
|
|
823
|
+
_description: "Deletes a runtime field from the current object.",
|
|
824
|
+
_params: {
|
|
825
|
+
name: "Field name to delete."
|
|
826
|
+
}
|
|
674
827
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
828
|
+
),
|
|
829
|
+
"toggle-field": g(
|
|
830
|
+
(o, e) => {
|
|
831
|
+
const t = o._params?.name;
|
|
832
|
+
if (!e || typeof t != "string" || t.length === 0) return;
|
|
833
|
+
if (F(t)) {
|
|
834
|
+
l.error(`toggle-field denied for protected field: ${t}`);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
const s = e[t];
|
|
838
|
+
typeof s == "boolean" ? e[t] = !s : s == null ? e[t] = !0 : e[t] = !1;
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
_name: "toggle-field",
|
|
842
|
+
_scope: "object",
|
|
843
|
+
_description: "Toggles a runtime field using boolean-first semantics.",
|
|
844
|
+
_params: {
|
|
845
|
+
name: "Field name to toggle."
|
|
846
|
+
}
|
|
685
847
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
848
|
+
),
|
|
849
|
+
merge: g(
|
|
850
|
+
(o, e) => {
|
|
851
|
+
const t = o._params?.name, s = o._params?.value;
|
|
852
|
+
if (!e || typeof t != "string" || t.length === 0) return;
|
|
853
|
+
if (F(t)) {
|
|
854
|
+
l.error(`merge denied for protected field: ${t}`);
|
|
855
|
+
return;
|
|
690
856
|
}
|
|
691
|
-
if (s
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
857
|
+
if (!K(s)) {
|
|
858
|
+
l.error("merge expects _params.value as a plain object");
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
const n = e[t];
|
|
862
|
+
K(n) || (e[t] = {}), Object.assign(e[t], s);
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
_name: "merge",
|
|
866
|
+
_scope: "object",
|
|
867
|
+
_description: "Shallow-merges a plain object into a target object field.",
|
|
868
|
+
_params: {
|
|
869
|
+
name: "Target field name.",
|
|
870
|
+
value: "Plain object to merge."
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
"run-seq": g(
|
|
875
|
+
async (o, e) => {
|
|
876
|
+
if (!e) return;
|
|
877
|
+
const t = o._params?.seq;
|
|
878
|
+
if (!Array.isArray(t)) {
|
|
879
|
+
l.error("run-seq expects _params.seq as an array");
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
for (const s of t) {
|
|
883
|
+
if (typeof s == "string") {
|
|
884
|
+
await e.run(`${e._id} ${s}`);
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
if (s && typeof s == "object" && s._op) {
|
|
888
|
+
const n = s._object;
|
|
889
|
+
if (!(n == null || n === "this" || n === e._id)) {
|
|
890
|
+
l.error("run-seq rejected non-self _object target");
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
const i = {
|
|
894
|
+
_op: s._op,
|
|
895
|
+
_params: s._params ? { ...s._params } : void 0
|
|
896
|
+
};
|
|
897
|
+
await e.execute(i);
|
|
898
|
+
continue;
|
|
899
|
+
}
|
|
900
|
+
l.error(
|
|
901
|
+
"run-seq skipped invalid step; expected string or object with _op"
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
_name: "run-seq",
|
|
907
|
+
_scope: "object",
|
|
908
|
+
_description: "Runs a sequence of local nano-command steps in strict order.",
|
|
909
|
+
_params: {
|
|
910
|
+
seq: "Array of command strings or local command objects."
|
|
911
|
+
},
|
|
912
|
+
_example: {
|
|
913
|
+
_op: "run-seq",
|
|
914
|
+
_params: {
|
|
915
|
+
seq: [
|
|
916
|
+
{
|
|
917
|
+
_op: "set-field",
|
|
918
|
+
_params: {
|
|
919
|
+
name: "_debug",
|
|
920
|
+
value: !0
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
_op: "log",
|
|
925
|
+
_params: {
|
|
926
|
+
1: "Debug enabled"
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
]
|
|
696
930
|
}
|
|
697
|
-
const r = {
|
|
698
|
-
_op: s._op,
|
|
699
|
-
_params: s._params ? { ...s._params } : void 0
|
|
700
|
-
};
|
|
701
|
-
await t.execute(r);
|
|
702
|
-
continue;
|
|
703
931
|
}
|
|
704
|
-
a.error("run-seq skipped invalid step; expected string or object with _op");
|
|
705
932
|
}
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
|
|
933
|
+
)
|
|
934
|
+
};
|
|
935
|
+
let L;
|
|
936
|
+
function ie(o) {
|
|
937
|
+
L = o;
|
|
938
|
+
}
|
|
939
|
+
function oe() {
|
|
940
|
+
if (!L)
|
|
941
|
+
throw new Error("XRuntime not set");
|
|
942
|
+
return L;
|
|
943
|
+
}
|
|
944
|
+
const U = {
|
|
945
|
+
_id: "xobject",
|
|
946
|
+
_title: "XObject Core Runtime Contract",
|
|
947
|
+
_version: "1.0.0",
|
|
948
|
+
_active: !0,
|
|
949
|
+
_type: "runtime-api-skill",
|
|
950
|
+
_description: "Base runtime object for identity, typing, composition, lifecycle hooks, events, data binding, and nano-command execution.",
|
|
951
|
+
_fields: {
|
|
952
|
+
_id: "Unique object id.",
|
|
953
|
+
_type: "Registered runtime object type.",
|
|
954
|
+
_name: "Optional object name.",
|
|
955
|
+
_children: "Child objects/data.",
|
|
956
|
+
_data_source: "XData key to bind this object to.",
|
|
957
|
+
_on: "Event handlers map.",
|
|
958
|
+
_once: "One-time event handlers map.",
|
|
959
|
+
_on_create: "Lifecycle handler after object creation.",
|
|
960
|
+
_on_mount: "Lifecycle handler after mount.",
|
|
961
|
+
_on_frame: "Frame lifecycle handler.",
|
|
962
|
+
_on_data: "Data-source lifecycle handler.",
|
|
963
|
+
_process_frame: "Enable/disable frame processing.",
|
|
964
|
+
_process_data: "Enable/disable data-source processing.",
|
|
965
|
+
_debug: "Enable object debug logs."
|
|
966
|
+
},
|
|
967
|
+
_exports: {
|
|
968
|
+
_xui_fields: [
|
|
969
|
+
"_id",
|
|
970
|
+
"_type",
|
|
971
|
+
"_name",
|
|
972
|
+
"_children",
|
|
973
|
+
"_data_source",
|
|
974
|
+
"_on",
|
|
975
|
+
"_once",
|
|
976
|
+
"_on_create",
|
|
977
|
+
"_on_mount",
|
|
978
|
+
"_on_frame",
|
|
979
|
+
"_on_data",
|
|
980
|
+
"_process_frame",
|
|
981
|
+
"_process_data",
|
|
982
|
+
"_debug"
|
|
983
|
+
]
|
|
984
|
+
},
|
|
985
|
+
_core_rules: [
|
|
986
|
+
"All Xpell runtime objects inherit this contract.",
|
|
987
|
+
"Generated object JSON must be data-only.",
|
|
988
|
+
"Do not generate JavaScript functions.",
|
|
989
|
+
"Use _children for composition.",
|
|
990
|
+
"Use _on/_once with nano-command strings or data-only command objects."
|
|
991
|
+
],
|
|
992
|
+
_notes: [
|
|
993
|
+
"Runtime methods include parse, append, run, execute, bindDataSource, unbindDataSource, toXData, dispose, and removeChild.",
|
|
994
|
+
"Most prompts should use this skill as a compact dependency summary, not full context."
|
|
995
|
+
]
|
|
996
|
+
}, $ = { _children: "child nodes" }, X = class X {
|
|
709
997
|
/**
|
|
710
998
|
* XObject constructor is creating the object and adding all the data keys to the XObject instance
|
|
711
999
|
* @param data constructor input data (object)
|
|
@@ -713,7 +1001,7 @@ class j {
|
|
|
713
1001
|
* @param skipParse - skip data parsing
|
|
714
1002
|
* if override this method make sure to call super.init(data,skipParse) and to set skipParse to true
|
|
715
1003
|
*/
|
|
716
|
-
constructor(
|
|
1004
|
+
constructor(e, t, s) {
|
|
717
1005
|
this._children = [], this._parent = null, this._on = {}, this._once = {}, this._process_frame = !0, this._process_data = !0, this._nano_commands = {}, this._event_listeners_ids = {}, this._event_parsed = !1, this._mounted = !1, this._xporter = {
|
|
718
1006
|
_ignore_fields: [
|
|
719
1007
|
"_to_xdata_ignore_fields",
|
|
@@ -734,14 +1022,70 @@ class j {
|
|
|
734
1022
|
"_debug"
|
|
735
1023
|
],
|
|
736
1024
|
_instance_xporters: {}
|
|
737
|
-
},
|
|
1025
|
+
}, t && u.mergeDefaultsWithData(e, t), this._id = e && e._id ? e._id : "xo-" + u.guid(), this._type = "object", this._children = [], this._nano_commands = {}, this.addNanoCommandPack(G), e && e.hasOwnProperty("_nano_commands") && e._nano_commands && (this.addNanoCommandPack(e._nano_commands), delete e._nano_commands), this.addXporterDataIgnoreFields(["_nano_commands"]), this.addXporterInstanceXporter(X, (n) => n.toXData()), this._xem_options = {
|
|
738
1026
|
// _instance:_xem
|
|
739
1027
|
// _object: this
|
|
740
1028
|
// _support_html: true
|
|
741
|
-
}, !s &&
|
|
1029
|
+
}, !s && e && this.parse(e, $);
|
|
1030
|
+
}
|
|
1031
|
+
static getOwnSkill() {
|
|
1032
|
+
const e = this, t = e._skill ?? U;
|
|
1033
|
+
return {
|
|
1034
|
+
...t,
|
|
1035
|
+
_exports: {
|
|
1036
|
+
...t._exports ?? {},
|
|
1037
|
+
_nano_commands: e.getNanoCommandSkills?.() ?? []
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
static getSkillChain() {
|
|
1042
|
+
const e = Object.getPrototypeOf(this), t = e && typeof e.getSkillChain == "function" ? e.getSkillChain() : [], s = Object.prototype.hasOwnProperty.call(this, "_skill") ? this.getOwnSkill() : null;
|
|
1043
|
+
return s ? [...t, s] : t;
|
|
742
1044
|
}
|
|
743
|
-
|
|
744
|
-
|
|
1045
|
+
static getOwnNanoCommands() {
|
|
1046
|
+
return {
|
|
1047
|
+
...G
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
static getNanoCommands() {
|
|
1051
|
+
return {
|
|
1052
|
+
...this.getOwnNanoCommands()
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
static getNanoCommandSkills() {
|
|
1056
|
+
return Object.prototype.hasOwnProperty.call(
|
|
1057
|
+
this,
|
|
1058
|
+
"getOwnNanoCommands"
|
|
1059
|
+
) ? Object.values(this.getOwnNanoCommands()).map(
|
|
1060
|
+
(t) => t.getSkill?.() ?? t._skill
|
|
1061
|
+
).filter(Boolean) : [];
|
|
1062
|
+
}
|
|
1063
|
+
static getArtifactStrategy() {
|
|
1064
|
+
return "canonical";
|
|
1065
|
+
}
|
|
1066
|
+
static generateArtifact(e = {}) {
|
|
1067
|
+
const t = this.getOwnSkill?.(), s = t?._canonical_examples?.[0], n = s ? this.cloneArtifact(s) : { _type: this._xtype ?? t?._id ?? "object" };
|
|
1068
|
+
return this.applyArtifactIntent(n, e);
|
|
1069
|
+
}
|
|
1070
|
+
static cloneArtifact(e) {
|
|
1071
|
+
return typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e));
|
|
1072
|
+
}
|
|
1073
|
+
static applyArtifactIntent(e, t = {}) {
|
|
1074
|
+
const s = e;
|
|
1075
|
+
return t._id && (s._id = t._id), t._label && ("_label" in s ? s._label = t._label : "_text" in s ? s._text = t._label : "_title" in s && (s._title = t._label)), t._text && "_text" in s && (s._text = t._text), t._title && "_title" in s && (s._title = t._title), t._description && "_description" in s && (s._description = t._description), t._variant && "_variant" in s && (s._variant = t._variant), t._tone && "_tone" in s && (s._tone = t._tone), t._size && "_size" in s && (s._size = t._size), t._density && "_density" in s && (s._density = t._density), t._elevation && "_elevation" in s && (s._elevation = t._elevation), t.class && (s.class = t.class), t._placeholder && ("placeholder" in s ? s.placeholder = t._placeholder : "_placeholder" in s && (s._placeholder = t._placeholder)), t._data_output && "_data_output" in s && (s._data_output = t._data_output), Array.isArray(t._children) && (s._children = t._children), Array.isArray(t._actions) && (s._actions = t._actions), Array.isArray(t._items) && (s._items = t._items), t._flow_id && (s._flow = {
|
|
1076
|
+
_id: t._flow_id,
|
|
1077
|
+
_payload: t._payload ?? {}
|
|
1078
|
+
}), t._flow_event && (s._flow_event = t._flow_event), s;
|
|
1079
|
+
}
|
|
1080
|
+
static validateArtifact(e) {
|
|
1081
|
+
const t = [];
|
|
1082
|
+
return (!e || typeof e != "object") && t.push("artifact must be an object"), e._type || t.push("artifact requires _type"), {
|
|
1083
|
+
_ok: t.length === 0,
|
|
1084
|
+
_errors: t
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
log(e, ...t) {
|
|
1088
|
+
this._debug && e && l.log(this._type + "->" + this._id + "]", e, ...t);
|
|
745
1089
|
}
|
|
746
1090
|
/**
|
|
747
1091
|
* Initialize the XObject
|
|
@@ -749,82 +1093,89 @@ class j {
|
|
|
749
1093
|
* @param skipParse - skip data parsing
|
|
750
1094
|
* @deprecated - use parse method instead
|
|
751
1095
|
*/
|
|
752
|
-
init(
|
|
753
|
-
!
|
|
1096
|
+
init(e, t) {
|
|
1097
|
+
!t && e && this.parse(e, $);
|
|
754
1098
|
}
|
|
755
|
-
parseEvents(
|
|
1099
|
+
parseEvents(e) {
|
|
756
1100
|
if (!this._event_parsed) {
|
|
757
|
-
|
|
758
|
-
this.addEventListener(s, this._on[s],
|
|
1101
|
+
e || (e = this._xem_options), Object.keys(this._on).forEach((s) => {
|
|
1102
|
+
this.addEventListener(s, this._on[s], e);
|
|
759
1103
|
});
|
|
760
|
-
const
|
|
761
|
-
Object.assign(
|
|
762
|
-
this.addEventListener(s, this._once[s],
|
|
1104
|
+
const t = {};
|
|
1105
|
+
Object.assign(t, e), t._once = !0, Object.keys(this._once).forEach((s) => {
|
|
1106
|
+
this.addEventListener(s, this._once[s], t);
|
|
763
1107
|
}), this._event_parsed = !0;
|
|
764
1108
|
}
|
|
765
1109
|
}
|
|
766
|
-
addEventListener(
|
|
1110
|
+
addEventListener(e, t, s) {
|
|
767
1111
|
s || (s = this._xem_options);
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
e && e.length && (e.forEach((s) => {
|
|
786
|
-
b.remove(s);
|
|
787
|
-
}), delete this._event_listeners_ids[t]);
|
|
1112
|
+
const n = async (i) => {
|
|
1113
|
+
await this.checkAndRunInternalFunction(t, i);
|
|
1114
|
+
}, r = E().on(e, n, s, this);
|
|
1115
|
+
return this._event_listeners_ids[e] || (this._event_listeners_ids[e] = []), this._event_listeners_ids[e].push(r), r;
|
|
1116
|
+
}
|
|
1117
|
+
removeEventListener(e) {
|
|
1118
|
+
const t = this._event_listeners_ids;
|
|
1119
|
+
if (!t || typeof t != "object" || Array.isArray(t)) {
|
|
1120
|
+
this._event_listeners_ids = {};
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
(Array.isArray(t[e]) ? [...t[e]] : []).forEach((n) => {
|
|
1124
|
+
try {
|
|
1125
|
+
E().remove(n);
|
|
1126
|
+
} catch {
|
|
1127
|
+
}
|
|
1128
|
+
}), delete t[e];
|
|
788
1129
|
}
|
|
789
|
-
removeAllEventListeners() {
|
|
790
|
-
|
|
1130
|
+
removeAllEventListeners(e) {
|
|
1131
|
+
const t = this._event_listeners_ids;
|
|
1132
|
+
if (!t || typeof t != "object" || Array.isArray(t)) {
|
|
1133
|
+
this._event_listeners_ids = {};
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
(e ? [e] : Object.keys(t)).forEach((n) => {
|
|
1137
|
+
try {
|
|
1138
|
+
this.removeEventListener(n);
|
|
1139
|
+
} catch {
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
791
1142
|
}
|
|
792
1143
|
/**
|
|
793
1144
|
* Append a child XObject to this XObject
|
|
794
1145
|
* @param xobject
|
|
795
1146
|
*/
|
|
796
|
-
append(
|
|
797
|
-
this._children?.push(
|
|
1147
|
+
append(e) {
|
|
1148
|
+
this._children?.push(e), e._parent = this;
|
|
798
1149
|
}
|
|
799
1150
|
/**
|
|
800
1151
|
* Add single nano command to the object
|
|
801
1152
|
* @param commandName - the nano command name
|
|
802
1153
|
* @param nanoCommandFunction
|
|
803
1154
|
*/
|
|
804
|
-
addNanoCommand(
|
|
805
|
-
typeof
|
|
1155
|
+
addNanoCommand(e, t) {
|
|
1156
|
+
typeof t == "function" && (this._nano_commands[e] = t);
|
|
806
1157
|
}
|
|
807
|
-
addNanoCommandPack(
|
|
808
|
-
|
|
809
|
-
this.addNanoCommand(
|
|
1158
|
+
addNanoCommandPack(e) {
|
|
1159
|
+
e && Object.keys(e).forEach((t) => {
|
|
1160
|
+
this.addNanoCommand(t, e[t]);
|
|
810
1161
|
});
|
|
811
1162
|
}
|
|
812
1163
|
/**
|
|
813
1164
|
* List of fields to ignore when exporting the xobject to XData or string format
|
|
814
1165
|
* @param <string[]> ignoreFields - an array with all the fields to ignore
|
|
815
1166
|
*/
|
|
816
|
-
addXporterDataIgnoreFields(
|
|
817
|
-
this._xporter._ignore_fields = this._xporter._ignore_fields.concat(
|
|
1167
|
+
addXporterDataIgnoreFields(e) {
|
|
1168
|
+
this._xporter._ignore_fields = this._xporter._ignore_fields.concat(e);
|
|
818
1169
|
}
|
|
819
1170
|
/**
|
|
820
1171
|
* Add XData Xporter instance handler
|
|
821
1172
|
* @param <XDataInstanceXporter> ie - the instance exporter object
|
|
822
1173
|
*/
|
|
823
|
-
addXporterInstanceXporter(
|
|
824
|
-
const s =
|
|
1174
|
+
addXporterInstanceXporter(e, t) {
|
|
1175
|
+
const s = u.guid();
|
|
825
1176
|
this._xporter._instance_xporters[s] = {
|
|
826
|
-
cls:
|
|
827
|
-
handler:
|
|
1177
|
+
cls: e,
|
|
1178
|
+
handler: t
|
|
828
1179
|
};
|
|
829
1180
|
}
|
|
830
1181
|
/**
|
|
@@ -832,9 +1183,9 @@ class j {
|
|
|
832
1183
|
* @param data data to parse
|
|
833
1184
|
* @param ignore - lis of words to ignore in the parse process
|
|
834
1185
|
*/
|
|
835
|
-
parse(
|
|
836
|
-
Object.keys(
|
|
837
|
-
!
|
|
1186
|
+
parse(e, t = $) {
|
|
1187
|
+
Object.keys(e).forEach((n) => {
|
|
1188
|
+
!t.hasOwnProperty(n) && e.hasOwnProperty(n) && (this[n] = e[n]);
|
|
838
1189
|
});
|
|
839
1190
|
}
|
|
840
1191
|
/**
|
|
@@ -847,9 +1198,9 @@ class j {
|
|
|
847
1198
|
* ...
|
|
848
1199
|
* }
|
|
849
1200
|
*/
|
|
850
|
-
parseFieldsFromXDataObject(
|
|
851
|
-
Object.keys(
|
|
852
|
-
|
|
1201
|
+
parseFieldsFromXDataObject(e, t) {
|
|
1202
|
+
Object.keys(t).forEach((n) => {
|
|
1203
|
+
e.hasOwnProperty(n) ? this[n] = e[n] : this[n] = t[n];
|
|
853
1204
|
});
|
|
854
1205
|
}
|
|
855
1206
|
/**
|
|
@@ -858,13 +1209,13 @@ class j {
|
|
|
858
1209
|
* @param {Array<string>} fields - array of field names (string)
|
|
859
1210
|
* @param checkNonXParams - also check non Xpell fields (fields that not starting with "_" sign)
|
|
860
1211
|
*/
|
|
861
|
-
parseFields(
|
|
862
|
-
|
|
863
|
-
if (
|
|
864
|
-
this[
|
|
865
|
-
else if (s &&
|
|
866
|
-
const
|
|
867
|
-
|
|
1212
|
+
parseFields(e, t, s) {
|
|
1213
|
+
t.forEach((n) => {
|
|
1214
|
+
if (e.hasOwnProperty(n))
|
|
1215
|
+
this[n] = e[n];
|
|
1216
|
+
else if (s && n.startsWith("_")) {
|
|
1217
|
+
const r = n.substring(1);
|
|
1218
|
+
e.hasOwnProperty(r) && (this[n] = e[r], this[r] = e[r]);
|
|
868
1219
|
}
|
|
869
1220
|
});
|
|
870
1221
|
}
|
|
@@ -881,43 +1232,118 @@ class j {
|
|
|
881
1232
|
async onCreate() {
|
|
882
1233
|
this._on_create ? this.checkAndRunInternalFunction(this._on_create) : this._on && this._on.create ? this.checkAndRunInternalFunction(this._on.create) : this._once && this._once.create && this.checkAndRunInternalFunction(this._once.create);
|
|
883
1234
|
}
|
|
884
|
-
async runCmd(
|
|
885
|
-
const
|
|
886
|
-
await this.execute(
|
|
887
|
-
}
|
|
888
|
-
async checkAndRunInternalFunction(
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1235
|
+
async runCmd(e) {
|
|
1236
|
+
const t = e instanceof R ? e : new R(e);
|
|
1237
|
+
await this.execute(t);
|
|
1238
|
+
}
|
|
1239
|
+
async checkAndRunInternalFunction(e, ...t) {
|
|
1240
|
+
const s = (i, c) => {
|
|
1241
|
+
const a = c.split(".");
|
|
1242
|
+
let _ = i;
|
|
1243
|
+
for (const h of a) {
|
|
1244
|
+
if (_ == null) return;
|
|
1245
|
+
_ = _[h];
|
|
1246
|
+
}
|
|
1247
|
+
return _;
|
|
1248
|
+
}, n = (i, c) => {
|
|
1249
|
+
if (typeof i == "string")
|
|
1250
|
+
return i === "$prev" ? c : i.startsWith("$prev.") ? s(c, i.slice(6)) : i === "$event" ? t[0] : i.startsWith("$event.") ? s(t[0], i.slice(7)) : i === "$data" ? t[0] : i.startsWith("$data.") ? s(t[0], i.slice(6)) : i;
|
|
1251
|
+
if (Array.isArray(i))
|
|
1252
|
+
return i.map((a) => n(a, c));
|
|
1253
|
+
if (i && typeof i == "object") {
|
|
1254
|
+
const a = {};
|
|
1255
|
+
for (const _ of Object.keys(i))
|
|
1256
|
+
a[_] = n(i[_], c);
|
|
1257
|
+
return a;
|
|
1258
|
+
}
|
|
1259
|
+
return i;
|
|
1260
|
+
}, r = async (i, c) => {
|
|
1261
|
+
if (Array.isArray(i)) {
|
|
1262
|
+
let a;
|
|
1263
|
+
for (const _ of i)
|
|
1264
|
+
a = await r(_, a);
|
|
1265
|
+
return a;
|
|
1266
|
+
}
|
|
1267
|
+
if (typeof i == "function")
|
|
1268
|
+
return await i(this, ...t);
|
|
1269
|
+
if (typeof i == "string") {
|
|
1270
|
+
const a = w.parseObjectCommand(
|
|
1271
|
+
`${this._id} ${i}`
|
|
911
1272
|
);
|
|
912
|
-
|
|
1273
|
+
if (t.length > 0) {
|
|
1274
|
+
a._params = a._params || {};
|
|
1275
|
+
const _ = t[0];
|
|
1276
|
+
a._params._event = _, !a._params.data && !_?.target && (a._params.data = _);
|
|
1277
|
+
}
|
|
1278
|
+
return await this.execute(a);
|
|
913
1279
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1280
|
+
if (i && typeof i == "object" && Array.isArray(i._commands)) {
|
|
1281
|
+
const a = i, _ = typeof a._mode == "string" ? a._mode : "sequence", h = a._stop_on_error !== !1, p = a._commands;
|
|
1282
|
+
if (_ === "parallel") {
|
|
1283
|
+
const j = await Promise.allSettled(
|
|
1284
|
+
p.map(
|
|
1285
|
+
(P) => r(P, c)
|
|
1286
|
+
)
|
|
1287
|
+
), S = j.find(
|
|
1288
|
+
(P) => P.status === "rejected"
|
|
1289
|
+
);
|
|
1290
|
+
if (S && h)
|
|
1291
|
+
throw S.reason;
|
|
1292
|
+
return j;
|
|
1293
|
+
}
|
|
1294
|
+
let x = c;
|
|
1295
|
+
for (const j of p)
|
|
1296
|
+
try {
|
|
1297
|
+
x = await r(
|
|
1298
|
+
j,
|
|
1299
|
+
_ === "chain" ? x : c
|
|
1300
|
+
);
|
|
1301
|
+
} catch (S) {
|
|
1302
|
+
if (l.error(
|
|
1303
|
+
this._type + "->" + this._id + "] command sequence failed",
|
|
1304
|
+
S
|
|
1305
|
+
), h)
|
|
1306
|
+
throw S;
|
|
1307
|
+
}
|
|
1308
|
+
return x;
|
|
1309
|
+
}
|
|
1310
|
+
if (i && typeof i == "object" && i._op) {
|
|
1311
|
+
const a = i;
|
|
1312
|
+
if ((a._object === void 0 || a._object === null || a._object === "this" ? this._id : a._object) !== this._id) {
|
|
1313
|
+
l.error(
|
|
1314
|
+
"XObject JSON handler target not supported; expected _object omitted/'this'/" + this._id
|
|
1315
|
+
);
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
const h = {
|
|
1319
|
+
...a,
|
|
1320
|
+
_params: a._params ? { ...a._params } : {}
|
|
1321
|
+
};
|
|
1322
|
+
if (t.length > 0) {
|
|
1323
|
+
const p = t[0];
|
|
1324
|
+
Object.prototype.hasOwnProperty.call(
|
|
1325
|
+
h._params,
|
|
1326
|
+
"data"
|
|
1327
|
+
) || (h._params.data = p), Object.prototype.hasOwnProperty.call(
|
|
1328
|
+
h._params,
|
|
1329
|
+
"_event"
|
|
1330
|
+
) || (h._params._event = p);
|
|
1331
|
+
}
|
|
1332
|
+
return h._params = n(
|
|
1333
|
+
h._params,
|
|
1334
|
+
c
|
|
1335
|
+
), this._debug && l.log(
|
|
1336
|
+
this._type + "->" + this._id + "]",
|
|
1337
|
+
"JSON handler executed locally",
|
|
1338
|
+
h
|
|
1339
|
+
), await this.execute(h);
|
|
1340
|
+
}
|
|
1341
|
+
l.error(
|
|
1342
|
+
this._type + "->" + this._id + "] invalid handler in checkAndRunInternalFunction",
|
|
1343
|
+
i
|
|
1344
|
+
);
|
|
1345
|
+
};
|
|
1346
|
+
return await r(e);
|
|
921
1347
|
}
|
|
922
1348
|
/**
|
|
923
1349
|
* Triggers when the object is being mounted to other element
|
|
@@ -931,23 +1357,23 @@ class j {
|
|
|
931
1357
|
async onMount() {
|
|
932
1358
|
if (!this._mounted) {
|
|
933
1359
|
this.parseEvents(this._xem_options), this._process_data && typeof this._data_source == "string" && this._data_source.length > 0 && this.bindDataSource(this._data_source, { initial: !0 }), this._on_mount ? await this.checkAndRunInternalFunction(this._on_mount) : this._on && this._on.mount ? await this.checkAndRunInternalFunction(this._on.mount) : this._once && this._once.mount && await this.checkAndRunInternalFunction(this._once.mount), this._mounted = !0;
|
|
934
|
-
for (const
|
|
935
|
-
|
|
1360
|
+
for (const e of this._children)
|
|
1361
|
+
e.onMount && typeof e.onMount == "function" && e.onMount();
|
|
936
1362
|
}
|
|
937
1363
|
}
|
|
938
1364
|
emptyDataSource() {
|
|
939
|
-
const
|
|
940
|
-
if (typeof
|
|
941
|
-
const
|
|
942
|
-
|
|
1365
|
+
const e = this._data_source;
|
|
1366
|
+
if (typeof e != "string" || e.length === 0) return;
|
|
1367
|
+
const t = this._type ?? this.constructor.name, s = this._id ?? "no-id";
|
|
1368
|
+
D.delete(e, { source: `${t}#${s}.emptyDataSource` });
|
|
943
1369
|
}
|
|
944
1370
|
/**
|
|
945
1371
|
* Triggers when new data is being received from the data source
|
|
946
1372
|
* @param data - the data
|
|
947
1373
|
* if override this method make sure to call super.onData(data) to run the _on_data attribute
|
|
948
1374
|
*/
|
|
949
|
-
async onData(
|
|
950
|
-
this._process_data && (this._on_data ? this.checkAndRunInternalFunction(this._on_data,
|
|
1375
|
+
async onData(e) {
|
|
1376
|
+
this._process_data && (this._on_data ? this.checkAndRunInternalFunction(this._on_data, e) : this._on && this._on.data ? this.checkAndRunInternalFunction(this._on.data, e) : this._once && this._once.data && this.checkAndRunInternalFunction(this._once.data, e));
|
|
951
1377
|
}
|
|
952
1378
|
/**
|
|
953
1379
|
* Triggers from Xpell frame every frame
|
|
@@ -969,19 +1395,19 @@ class j {
|
|
|
969
1395
|
* _on_frame: "nano command text"
|
|
970
1396
|
*
|
|
971
1397
|
*/
|
|
972
|
-
async onFrame(
|
|
973
|
-
this._process_frame && (this._on_frame ? this.checkAndRunInternalFunction(this._on_frame,
|
|
974
|
-
for (const
|
|
975
|
-
|
|
1398
|
+
async onFrame(e) {
|
|
1399
|
+
this._process_frame && (this._on_frame ? this.checkAndRunInternalFunction(this._on_frame, e) : this._on && this._on.frame ? this.checkAndRunInternalFunction(this._on.frame, e) : this._once && this._once.frame && this.checkAndRunInternalFunction(this._once.frame, e));
|
|
1400
|
+
for (const t of this._children)
|
|
1401
|
+
t.onFrame && typeof t.onFrame == "function" && t.onFrame(e);
|
|
976
1402
|
}
|
|
977
1403
|
/**
|
|
978
1404
|
* Runs object nano commands
|
|
979
1405
|
* @param nanoCommand - object nano command (string)
|
|
980
1406
|
* @param cache - cache last command to prevent multiple parsing on the same command
|
|
981
1407
|
*/
|
|
982
|
-
async run(
|
|
983
|
-
let s = this._cache_cmd_txt && this._cache_cmd_txt ==
|
|
984
|
-
|
|
1408
|
+
async run(e, t = !0) {
|
|
1409
|
+
let s = this._cache_cmd_txt && this._cache_cmd_txt == e ? this._cache_jcmd : w.parseObjectCommand(e);
|
|
1410
|
+
t && (this._cache_cmd_txt = e, this._cache_jcmd = s), await this.execute(s);
|
|
985
1411
|
}
|
|
986
1412
|
/**
|
|
987
1413
|
* Execute XCommand within the XObject Nano Commands
|
|
@@ -994,39 +1420,67 @@ class j {
|
|
|
994
1420
|
* }
|
|
995
1421
|
*
|
|
996
1422
|
*/
|
|
997
|
-
async execute(
|
|
998
|
-
|
|
1423
|
+
async execute(e) {
|
|
1424
|
+
const t = e?._op, s = typeof t == "string" && t.startsWith("_") && t.length > 1 ? t.slice(1) : t;
|
|
1425
|
+
if (!s) {
|
|
1426
|
+
l.error(this._id + " missing _op in command");
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
const n = e?._module;
|
|
1430
|
+
if (n)
|
|
999
1431
|
try {
|
|
1000
|
-
await
|
|
1001
|
-
|
|
1002
|
-
|
|
1432
|
+
return await oe().execute({
|
|
1433
|
+
...e,
|
|
1434
|
+
_module: n,
|
|
1435
|
+
_op: s
|
|
1436
|
+
});
|
|
1437
|
+
} catch (r) {
|
|
1438
|
+
l.error(
|
|
1439
|
+
this._id + " module execution failed: " + n + "." + s + " " + r
|
|
1440
|
+
);
|
|
1441
|
+
return;
|
|
1003
1442
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1443
|
+
if (this._nano_commands[s])
|
|
1444
|
+
try {
|
|
1445
|
+
const r = {
|
|
1446
|
+
...e,
|
|
1447
|
+
_op: s
|
|
1448
|
+
};
|
|
1449
|
+
return await this._nano_commands[s](
|
|
1450
|
+
r,
|
|
1451
|
+
this
|
|
1452
|
+
);
|
|
1453
|
+
} catch (r) {
|
|
1454
|
+
l.error(
|
|
1455
|
+
this._id + " has error with command name " + s + " " + r
|
|
1456
|
+
);
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
l.error(this._id + " has no command name " + s);
|
|
1006
1460
|
}
|
|
1007
1461
|
/**
|
|
1008
1462
|
* Return an IXObjectData JSON representation of the XObject
|
|
1009
1463
|
* @returns IXObjectData
|
|
1010
1464
|
*/
|
|
1011
1465
|
toXData() {
|
|
1012
|
-
const
|
|
1013
|
-
return Object.keys(this).forEach((
|
|
1014
|
-
if (!this._xporter._ignore_fields.includes(
|
|
1015
|
-
const s = this[
|
|
1466
|
+
const e = {};
|
|
1467
|
+
return Object.keys(this).forEach((t) => {
|
|
1468
|
+
if (!this._xporter._ignore_fields.includes(t) && this.hasOwnProperty(t) && this[t] !== void 0) {
|
|
1469
|
+
const s = this[t];
|
|
1016
1470
|
if (typeof s == "function")
|
|
1017
1471
|
return;
|
|
1018
1472
|
if (typeof s == "object") {
|
|
1019
|
-
const
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1022
|
-
this._xporter._instance_xporters[
|
|
1023
|
-
}),
|
|
1473
|
+
const n = Object.keys(this._xporter._instance_xporters);
|
|
1474
|
+
let r = !0;
|
|
1475
|
+
n.forEach((i) => {
|
|
1476
|
+
this._xporter._instance_xporters[i], s instanceof this._xporter._instance_xporters[i].cls && (e[t] = this._xporter._instance_xporters[i].handler(s), r = !1);
|
|
1477
|
+
}), r && (e[t] = s);
|
|
1024
1478
|
} else
|
|
1025
|
-
t
|
|
1479
|
+
e[t] = s;
|
|
1026
1480
|
}
|
|
1027
|
-
}),
|
|
1028
|
-
typeof
|
|
1029
|
-
}),
|
|
1481
|
+
}), e._children = [], this._children.length > 0 && this._children.forEach((t) => {
|
|
1482
|
+
typeof t.toXData == "function" && e._children?.push(t.toXData());
|
|
1483
|
+
}), e;
|
|
1030
1484
|
}
|
|
1031
1485
|
/**
|
|
1032
1486
|
* Return a string representation of the XObject
|
|
@@ -1035,16 +1489,16 @@ class j {
|
|
|
1035
1489
|
toString() {
|
|
1036
1490
|
return JSON.stringify(this.toXData());
|
|
1037
1491
|
}
|
|
1038
|
-
clearAttributes(
|
|
1039
|
-
|
|
1040
|
-
this.hasOwnProperty(
|
|
1492
|
+
clearAttributes(e) {
|
|
1493
|
+
e.forEach((t) => {
|
|
1494
|
+
this.hasOwnProperty(t) && (this[t] = null, delete this[t]);
|
|
1041
1495
|
});
|
|
1042
1496
|
}
|
|
1043
|
-
bindDataSource(
|
|
1044
|
-
const s =
|
|
1045
|
-
typeof
|
|
1046
|
-
await this.onData(
|
|
1047
|
-
}), s &&
|
|
1497
|
+
bindDataSource(e, t) {
|
|
1498
|
+
const s = t?.initial ?? !0, n = e ?? this._data_source;
|
|
1499
|
+
typeof n != "string" || n.length === 0 || this._process_data && (this._xd_bound_key === n && this._xd_unsub || (this.unbindDataSource(), this._data_source = n, this._xd_bound_key = n, this._type ?? this.constructor.name, this._id, this._xd_unsub = D.on(n, async (r) => {
|
|
1500
|
+
await this.onData(r.value);
|
|
1501
|
+
}), s && D.has(n) && this.onData(D.get(n))));
|
|
1048
1502
|
}
|
|
1049
1503
|
unbindDataSource() {
|
|
1050
1504
|
this._xd_unsub?.(), this._xd_unsub = void 0, this._xd_bound_key = void 0;
|
|
@@ -1054,11 +1508,11 @@ class j {
|
|
|
1054
1508
|
*/
|
|
1055
1509
|
async dispose() {
|
|
1056
1510
|
if (this.unbindDataSource(), this._parent) {
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1511
|
+
const e = this._parent._children.indexOf(this);
|
|
1512
|
+
e > -1 && this._parent._children.splice(e, 1);
|
|
1059
1513
|
}
|
|
1060
|
-
this._process_data = !1, this._process_frame = !1, this.removeAllEventListeners(), this.clearAttributes(["_cache_cmd_txt", "_cache_jcmd", "_nano_commands", "_event_listeners_ids", "_parent", "_on", "_once", "_xem_options", "_xporter"]), this._children && this._children.forEach((
|
|
1061
|
-
typeof
|
|
1514
|
+
this._process_data = !1, this._process_frame = !1, this.removeAllEventListeners(), this.clearAttributes(["_cache_cmd_txt", "_cache_jcmd", "_nano_commands", "_event_listeners_ids", "_parent", "_on", "_once", "_xem_options", "_xporter"]), this._children && this._children.forEach((e) => {
|
|
1515
|
+
typeof e.dispose == "function" && e.dispose();
|
|
1062
1516
|
}), this._children = [];
|
|
1063
1517
|
}
|
|
1064
1518
|
/**
|
|
@@ -1066,80 +1520,156 @@ class j {
|
|
|
1066
1520
|
* @param child - the child to
|
|
1067
1521
|
* @returns void
|
|
1068
1522
|
*/
|
|
1069
|
-
removeChild(
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1523
|
+
removeChild(e, t = !1) {
|
|
1524
|
+
if (t)
|
|
1525
|
+
e.dispose();
|
|
1072
1526
|
else {
|
|
1073
|
-
const s = this._children.indexOf(
|
|
1074
|
-
s > -1 && this._children.splice(s, 1),
|
|
1527
|
+
const s = this._children.indexOf(e);
|
|
1528
|
+
s > -1 && this._children.splice(s, 1), e._parent = null;
|
|
1075
1529
|
}
|
|
1076
1530
|
}
|
|
1077
1531
|
/**
|
|
1078
1532
|
* @param child - the child to add
|
|
1079
1533
|
* @deprecated use append method instead
|
|
1080
1534
|
*/
|
|
1081
|
-
addChild(
|
|
1082
|
-
this.append(
|
|
1535
|
+
addChild(e) {
|
|
1536
|
+
this.append(e);
|
|
1083
1537
|
}
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1538
|
+
};
|
|
1539
|
+
X._xtype = "object", X._skill = U;
|
|
1540
|
+
let C = X;
|
|
1541
|
+
class me {
|
|
1086
1542
|
/**
|
|
1087
1543
|
* Get all registered object in this ObjectPack
|
|
1088
1544
|
* @returns XObject dictionary
|
|
1089
1545
|
*/
|
|
1090
1546
|
static getObjects() {
|
|
1091
1547
|
return {
|
|
1092
|
-
object:
|
|
1548
|
+
object: C
|
|
1093
1549
|
};
|
|
1094
1550
|
}
|
|
1095
1551
|
}
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1552
|
+
const ae = "engine:module:num-of-objects:", q = {
|
|
1553
|
+
_id: "xmodule",
|
|
1554
|
+
_title: "XModule Runtime Contract",
|
|
1555
|
+
_version: "1.0.0",
|
|
1556
|
+
_active: !0,
|
|
1557
|
+
_type: "runtime-api-skill",
|
|
1558
|
+
_description: "Base runtime module contract for object ownership, object packs, and executable underscore-prefixed commands.",
|
|
1559
|
+
_core_rules: [
|
|
1560
|
+
"Every module must have a unique _name.",
|
|
1561
|
+
"Modules expose commands through methods prefixed with underscore.",
|
|
1562
|
+
"Command names remove the leading underscore and convert dashes to underscores internally.",
|
|
1563
|
+
"Modules own and create registered XObject classes.",
|
|
1564
|
+
"Do not mutate another module's objects directly."
|
|
1565
|
+
]
|
|
1566
|
+
};
|
|
1567
|
+
var d;
|
|
1568
|
+
const M = class M {
|
|
1569
|
+
constructor(e) {
|
|
1570
|
+
V(this, d);
|
|
1571
|
+
this._loaded = !1, this._loading = !1, this._log_rules = {
|
|
1101
1572
|
createObject: !1,
|
|
1102
1573
|
removeObject: !1
|
|
1103
|
-
}, this
|
|
1574
|
+
}, z(this, d, new ne()), this._name = e._name, this._id = u.guid();
|
|
1104
1575
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1576
|
+
static getOwnSkillBase() {
|
|
1577
|
+
return {
|
|
1578
|
+
...this._skill
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
getOwnSkill() {
|
|
1582
|
+
const t = this.constructor._skill ?? q;
|
|
1583
|
+
return {
|
|
1584
|
+
...t,
|
|
1585
|
+
_exports: {
|
|
1586
|
+
...t._exports ?? {},
|
|
1587
|
+
_modules: [
|
|
1588
|
+
{
|
|
1589
|
+
_name: this._name,
|
|
1590
|
+
_scope: t._type === "server-module-api" ? "server" : "client",
|
|
1591
|
+
_description: t._description,
|
|
1592
|
+
_ops: this.getCommandSkills()
|
|
1593
|
+
}
|
|
1594
|
+
]
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
getSkillChain() {
|
|
1599
|
+
return [this.getOwnSkill()];
|
|
1600
|
+
}
|
|
1601
|
+
getObjectSkills() {
|
|
1602
|
+
const e = [], t = /* @__PURE__ */ new Set();
|
|
1603
|
+
for (const s of Object.values(f(this, d).getObjectClasses())) {
|
|
1604
|
+
if (typeof s.getOwnSkill != "function") continue;
|
|
1605
|
+
const n = s.getOwnSkill();
|
|
1606
|
+
n?._id && (t.has(n._id) || (t.add(n._id), e.push(n)));
|
|
1607
|
+
}
|
|
1608
|
+
return e;
|
|
1609
|
+
}
|
|
1610
|
+
getCommandSkills() {
|
|
1611
|
+
const e = Object.getPrototypeOf(this), s = this.constructor._ops ?? {};
|
|
1612
|
+
return Object.getOwnPropertyNames(e).filter(
|
|
1613
|
+
(n) => n.startsWith("_") && !n.startsWith("__") && typeof this[n] == "function"
|
|
1614
|
+
).map((n) => {
|
|
1615
|
+
const r = n.slice(1).replaceAll("_", "-");
|
|
1616
|
+
return s[r] ?? {
|
|
1617
|
+
_name: r,
|
|
1618
|
+
_scope: "module",
|
|
1619
|
+
_description: `Runtime module command: ${r}`
|
|
1620
|
+
};
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
async load() {
|
|
1624
|
+
if (!(this._loaded || this._loading)) {
|
|
1625
|
+
this._loading = !0;
|
|
1626
|
+
try {
|
|
1627
|
+
await this.onLoad(), this._loaded = !0, l.log("Module " + this._name + " loaded");
|
|
1628
|
+
} finally {
|
|
1629
|
+
this._loading = !1;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
async onLoad() {
|
|
1108
1634
|
}
|
|
1109
1635
|
/**
|
|
1110
1636
|
* Creates new XObject from data object
|
|
1111
1637
|
* @param data - The data of the new object (JSON)
|
|
1112
1638
|
* @return {XObject|*}
|
|
1113
1639
|
*/
|
|
1114
|
-
create(
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
throw
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1640
|
+
create(e) {
|
|
1641
|
+
e._debug && l.log("Creating object with data", e);
|
|
1642
|
+
let t;
|
|
1643
|
+
if (e.hasOwnProperty("_type")) {
|
|
1644
|
+
e._debug && l.log("Object type is", e._type, this.hasObject(e._type) ? "found" : "not found", "in module", this._name);
|
|
1645
|
+
const s = String(e._type), n = f(this, d).getObjectClass(s);
|
|
1646
|
+
if (!n)
|
|
1647
|
+
throw `Xpell object '${s}' not found in module '${this._name}'`;
|
|
1648
|
+
typeof n == "function" && n.hasOwnProperty("defaults") && u.mergeDefaultsWithData(
|
|
1649
|
+
e,
|
|
1650
|
+
n.defaults
|
|
1651
|
+
), t = new n(e);
|
|
1652
|
+
} else
|
|
1653
|
+
t = new C(e);
|
|
1654
|
+
return f(this, d).addObject(t), e._children && e._children.forEach((s) => {
|
|
1655
|
+
const n = this.create(s);
|
|
1656
|
+
t.append(n);
|
|
1657
|
+
}), t.onCreate(), t;
|
|
1128
1658
|
}
|
|
1129
1659
|
/**
|
|
1130
1660
|
* removes and XObject from the object manager
|
|
1131
1661
|
* @param objectId op
|
|
1132
1662
|
*/
|
|
1133
|
-
remove(
|
|
1134
|
-
const
|
|
1135
|
-
if (!
|
|
1136
|
-
const s = [],
|
|
1137
|
-
|
|
1663
|
+
remove(e) {
|
|
1664
|
+
const t = f(this, d).getObject(e);
|
|
1665
|
+
if (!t) return;
|
|
1666
|
+
const s = [], n = (r) => {
|
|
1667
|
+
r?._id && (s.push(r._id), (r._children ?? []).forEach((i) => n(i)));
|
|
1138
1668
|
};
|
|
1139
|
-
|
|
1669
|
+
n(t), typeof t.dispose == "function" && t.dispose(), s.reverse().forEach((r) => f(this, d).removeObject(r));
|
|
1140
1670
|
}
|
|
1141
|
-
_info(
|
|
1142
|
-
|
|
1671
|
+
_info(e) {
|
|
1672
|
+
l.log("module info");
|
|
1143
1673
|
}
|
|
1144
1674
|
//xpell interpreter
|
|
1145
1675
|
/**
|
|
@@ -1148,11 +1678,11 @@ class q {
|
|
|
1148
1678
|
* @param {string} XCommand input - text
|
|
1149
1679
|
* @returns command execution result
|
|
1150
1680
|
*/
|
|
1151
|
-
async run(
|
|
1152
|
-
if (
|
|
1153
|
-
let
|
|
1154
|
-
|
|
1155
|
-
let s =
|
|
1681
|
+
async run(e) {
|
|
1682
|
+
if (e) {
|
|
1683
|
+
let t = e.trim();
|
|
1684
|
+
t.startsWith(this._name) || (t = this._name + " " + t);
|
|
1685
|
+
let s = w.parse(t);
|
|
1156
1686
|
return await this.execute(s);
|
|
1157
1687
|
} else
|
|
1158
1688
|
throw "Unable to parse Xpell Command";
|
|
@@ -1163,32 +1693,32 @@ class q {
|
|
|
1163
1693
|
* @returns command execution result
|
|
1164
1694
|
*/
|
|
1165
1695
|
// inside XModule class
|
|
1166
|
-
async execute(
|
|
1167
|
-
if (!
|
|
1696
|
+
async execute(e) {
|
|
1697
|
+
if (!e || !e._op)
|
|
1168
1698
|
throw new Error(`Invalid XCommand: missing _op (module: ${this._name})`);
|
|
1169
|
-
const
|
|
1170
|
-
if (
|
|
1171
|
-
const
|
|
1172
|
-
if (!
|
|
1173
|
-
throw new Error(`Module '${this._name}' cant find object id: ${
|
|
1174
|
-
return await
|
|
1699
|
+
const t = e._object;
|
|
1700
|
+
if (t) {
|
|
1701
|
+
const c = f(this, d).getObject(t);
|
|
1702
|
+
if (!c)
|
|
1703
|
+
throw new Error(`Module '${this._name}' cant find object id: ${t}`);
|
|
1704
|
+
return await c.execute(e);
|
|
1175
1705
|
}
|
|
1176
|
-
const s = "_" +
|
|
1706
|
+
const s = e._op, r = "_" + (s.startsWith("_") && s.length > 1 ? s.slice(1) : s).replaceAll("-", "_"), i = this[r];
|
|
1177
1707
|
if (typeof i == "function")
|
|
1178
|
-
return await i.call(this,
|
|
1179
|
-
throw new Error(`Module '${this._name}' cant find op: ${
|
|
1708
|
+
return await i.call(this, e);
|
|
1709
|
+
throw new Error(`Module '${this._name}' cant find op: ${e._op}`);
|
|
1180
1710
|
}
|
|
1181
1711
|
/**
|
|
1182
1712
|
* This method triggers every frame from the Xpell engine.
|
|
1183
1713
|
* The method can be override by the extending module to support extended onFrame functionality
|
|
1184
1714
|
* @param frameNumber Current frame number
|
|
1185
1715
|
*/
|
|
1186
|
-
async onFrame(
|
|
1187
|
-
const
|
|
1188
|
-
s.forEach((
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1191
|
-
}),
|
|
1716
|
+
async onFrame(e) {
|
|
1717
|
+
const t = f(this, d)._objects, s = Object.keys(t);
|
|
1718
|
+
s.forEach((n) => {
|
|
1719
|
+
const r = t[n];
|
|
1720
|
+
r && r.onFrame && typeof r.onFrame == "function" && r?.onFrame(e);
|
|
1721
|
+
}), m.set(ae + this._id, s.length, {
|
|
1192
1722
|
source: "xmodule"
|
|
1193
1723
|
});
|
|
1194
1724
|
}
|
|
@@ -1203,18 +1733,21 @@ class q {
|
|
|
1203
1733
|
* getObject directly on the module instead of om.getObject
|
|
1204
1734
|
*/
|
|
1205
1735
|
get om() {
|
|
1206
|
-
return this
|
|
1736
|
+
return f(this, d);
|
|
1207
1737
|
}
|
|
1208
1738
|
get _object_manager() {
|
|
1209
|
-
return this
|
|
1739
|
+
return f(this, d);
|
|
1210
1740
|
}
|
|
1211
1741
|
/**
|
|
1212
1742
|
* Returns the XObject instance from the module Object Manager
|
|
1213
1743
|
* @param objectId
|
|
1214
1744
|
* @returns XObject
|
|
1215
1745
|
*/
|
|
1216
|
-
getObject(
|
|
1217
|
-
return this
|
|
1746
|
+
getObject(e) {
|
|
1747
|
+
return f(this, d).getObject(e);
|
|
1748
|
+
}
|
|
1749
|
+
hasObject(e) {
|
|
1750
|
+
return f(this, d).hasObjectClass(e);
|
|
1218
1751
|
}
|
|
1219
1752
|
/**
|
|
1220
1753
|
* Returns the XObject instance from the module Object Manager
|
|
@@ -1222,23 +1755,23 @@ class q {
|
|
|
1222
1755
|
* xmodule._o["object-id"] is equivalent to xmodule.getObject("object-id")
|
|
1223
1756
|
*/
|
|
1224
1757
|
get _o() {
|
|
1225
|
-
return this
|
|
1758
|
+
return f(this, d)._objects;
|
|
1226
1759
|
}
|
|
1227
1760
|
/**
|
|
1228
1761
|
* Imports external object pack to the engine
|
|
1229
1762
|
* The object class should be like XObjects with static implementation of getObjects() method
|
|
1230
1763
|
* @param {XObjects} xObjectPack
|
|
1231
1764
|
*/
|
|
1232
|
-
importObjectPack(
|
|
1233
|
-
this
|
|
1765
|
+
importObjectPack(e) {
|
|
1766
|
+
f(this, d).registerObjects(e.getObjects());
|
|
1234
1767
|
}
|
|
1235
1768
|
/**
|
|
1236
1769
|
* Imports external object pack to the engine
|
|
1237
1770
|
* @deprecated - use importObjectPack instead
|
|
1238
1771
|
* @param xObjectPack
|
|
1239
1772
|
*/
|
|
1240
|
-
importObjects(
|
|
1241
|
-
this.importObjectPack(
|
|
1773
|
+
importObjects(e) {
|
|
1774
|
+
this.importObjectPack(e);
|
|
1242
1775
|
}
|
|
1243
1776
|
/**
|
|
1244
1777
|
* Imports external objects to the engine
|
|
@@ -1246,19 +1779,19 @@ class q {
|
|
|
1246
1779
|
* @param xObjectName
|
|
1247
1780
|
* @param xObject
|
|
1248
1781
|
*/
|
|
1249
|
-
importObject(
|
|
1250
|
-
this
|
|
1782
|
+
importObject(e, t) {
|
|
1783
|
+
f(this, d).registerObject(e, t);
|
|
1251
1784
|
}
|
|
1252
1785
|
// In XModule
|
|
1253
|
-
async _help(
|
|
1254
|
-
const
|
|
1255
|
-
return this.help(
|
|
1786
|
+
async _help(e) {
|
|
1787
|
+
const t = e?._params?._op ?? e?._params?._command ?? "";
|
|
1788
|
+
return this.help(t);
|
|
1256
1789
|
}
|
|
1257
1790
|
/**
|
|
1258
1791
|
* Override in modules to provide help text.
|
|
1259
1792
|
* @param op optional: specific command name (e.g. "navigate")
|
|
1260
1793
|
*/
|
|
1261
|
-
help(
|
|
1794
|
+
help(e) {
|
|
1262
1795
|
return {
|
|
1263
1796
|
module: this._name,
|
|
1264
1797
|
usage: `${this._name} help`,
|
|
@@ -1266,60 +1799,263 @@ class q {
|
|
|
1266
1799
|
note: "No help() implemented for this module."
|
|
1267
1800
|
};
|
|
1268
1801
|
}
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1802
|
+
};
|
|
1803
|
+
d = new WeakMap(), M._skill = q, M._ops = {
|
|
1804
|
+
help: {
|
|
1805
|
+
_name: "help",
|
|
1806
|
+
_scope: "module",
|
|
1807
|
+
_description: "Return module help or command-specific help."
|
|
1808
|
+
},
|
|
1809
|
+
info: {
|
|
1810
|
+
_name: "info",
|
|
1811
|
+
_scope: "module",
|
|
1812
|
+
_description: "Log basic module information."
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
let I = M;
|
|
1816
|
+
const ce = {
|
|
1817
|
+
_id: "xdata",
|
|
1818
|
+
_title: "XData Runtime State Contract",
|
|
1819
|
+
_version: "1.0.0",
|
|
1820
|
+
_active: !0,
|
|
1821
|
+
_type: "xdata-skill",
|
|
1822
|
+
_description: "Shared runtime state store used by Xpell modules and objects for reactive data binding.",
|
|
1823
|
+
_requires: ["xmodule"],
|
|
1824
|
+
_core_rules: [
|
|
1825
|
+
"Use XData for shared runtime state.",
|
|
1826
|
+
"Use _data_source on objects to bind to an XData key.",
|
|
1827
|
+
"Use $xdata.key references in generated payloads when a flow or command needs current state.",
|
|
1828
|
+
"Do not use XData as hidden local component state.",
|
|
1829
|
+
"XData keys should be explicit and stable."
|
|
1830
|
+
],
|
|
1831
|
+
_fields: {
|
|
1832
|
+
_data_source: "XData key used by XObject/XUIObject for reactive data binding.",
|
|
1833
|
+
"$xdata.key": "Runtime payload reference to an XData value."
|
|
1834
|
+
}
|
|
1835
|
+
}, k = class k extends I {
|
|
1836
|
+
constructor() {
|
|
1837
|
+
super({ _name: k._name });
|
|
1838
|
+
}
|
|
1839
|
+
async _get(e) {
|
|
1840
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1841
|
+
return {
|
|
1842
|
+
_ok: !0,
|
|
1843
|
+
_result: m.get(s)
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
async _set(e) {
|
|
1847
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1848
|
+
return t._debug && v.log("XD SET", { key: s, value: t.value }), m.set(s, t.value, {
|
|
1849
|
+
source: t.source ?? "xd:set"
|
|
1850
|
+
}), {
|
|
1851
|
+
_ok: !0,
|
|
1852
|
+
_result: { key: s }
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
async _patch(e) {
|
|
1856
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1857
|
+
if (!u.is_plain_object(t.value))
|
|
1858
|
+
throw new Error("xd patch expects value as plain object");
|
|
1859
|
+
return m.patch(s, t.value, {
|
|
1860
|
+
source: t.source ?? "xd:patch"
|
|
1861
|
+
}), {
|
|
1862
|
+
_ok: !0,
|
|
1863
|
+
_result: { key: s }
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
async _delete(e) {
|
|
1867
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1868
|
+
return m.delete(s, {
|
|
1869
|
+
source: t.source ?? "xd:delete"
|
|
1870
|
+
}), {
|
|
1871
|
+
_ok: !0,
|
|
1872
|
+
_result: { key: s }
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
async _touch(e) {
|
|
1876
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1877
|
+
return m.touch(s, {
|
|
1878
|
+
source: t.source ?? "xd:touch"
|
|
1879
|
+
}), {
|
|
1880
|
+
_ok: !0,
|
|
1881
|
+
_result: { key: s }
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
async _has(e) {
|
|
1885
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.key, "key");
|
|
1886
|
+
return {
|
|
1887
|
+
_ok: !0,
|
|
1888
|
+
_result: m.has(s)
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
k._name = "xd", k._skill = ce, k._ops = {
|
|
1893
|
+
get: {
|
|
1894
|
+
_name: "get",
|
|
1895
|
+
_scope: "module",
|
|
1896
|
+
_description: "Get value from XData store.",
|
|
1897
|
+
_params: {
|
|
1898
|
+
key: "XData key."
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
set: {
|
|
1902
|
+
_name: "set",
|
|
1903
|
+
_scope: "module",
|
|
1904
|
+
_description: "Set value in XData store.",
|
|
1905
|
+
_params: {
|
|
1906
|
+
key: "XData key.",
|
|
1907
|
+
value: "Value to store.",
|
|
1908
|
+
source: "Optional mutation source."
|
|
1909
|
+
}
|
|
1910
|
+
},
|
|
1911
|
+
patch: {
|
|
1912
|
+
_name: "patch",
|
|
1913
|
+
_scope: "module",
|
|
1914
|
+
_description: "Patch plain object into existing XData value.",
|
|
1915
|
+
_params: {
|
|
1916
|
+
key: "XData key.",
|
|
1917
|
+
value: "Plain object patch.",
|
|
1918
|
+
source: "Optional mutation source."
|
|
1919
|
+
}
|
|
1920
|
+
},
|
|
1921
|
+
delete: {
|
|
1922
|
+
_name: "delete",
|
|
1923
|
+
_scope: "module",
|
|
1924
|
+
_description: "Delete XData key.",
|
|
1925
|
+
_params: {
|
|
1926
|
+
key: "XData key.",
|
|
1927
|
+
source: "Optional mutation source."
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
touch: {
|
|
1931
|
+
_name: "touch",
|
|
1932
|
+
_scope: "module",
|
|
1933
|
+
_description: "Trigger XData subscribers without changing value.",
|
|
1934
|
+
_params: {
|
|
1935
|
+
key: "XData key.",
|
|
1936
|
+
source: "Optional mutation source."
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
has: {
|
|
1940
|
+
_name: "has",
|
|
1941
|
+
_scope: "module",
|
|
1942
|
+
_description: "Check if XData key exists.",
|
|
1943
|
+
_params: {
|
|
1944
|
+
key: "XData key."
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
let T = k;
|
|
1949
|
+
const _e = {
|
|
1950
|
+
_id: "xem",
|
|
1951
|
+
_title: "XEventManager Runtime Event Bus",
|
|
1952
|
+
_version: "1.0.0",
|
|
1953
|
+
_active: !0,
|
|
1954
|
+
_type: "runtime-api-skill",
|
|
1955
|
+
_description: "Global runtime event bus for decoupled communication between Xpell modules, objects, flows, and UI components.",
|
|
1956
|
+
_requires: ["xmodule"],
|
|
1957
|
+
_core_rules: [
|
|
1958
|
+
"Use XEM for decoupled runtime events.",
|
|
1959
|
+
"Use explicit event names and explicit payload objects.",
|
|
1960
|
+
"Do not use XEM as state storage.",
|
|
1961
|
+
"Use XData for shared state and XEM for notifications/events.",
|
|
1962
|
+
"Prefer _on/_once on objects for local event handlers."
|
|
1963
|
+
],
|
|
1964
|
+
_fields: {
|
|
1965
|
+
_on: "Object event handler map.",
|
|
1966
|
+
_once: "Object one-time event handler map.",
|
|
1967
|
+
event: "Event name to fire.",
|
|
1968
|
+
data: "Optional event payload."
|
|
1969
|
+
},
|
|
1970
|
+
_notes: [
|
|
1971
|
+
"XEM is process-wide and listener order should not be assumed.",
|
|
1972
|
+
"Event payloads should be JSON/data-only."
|
|
1973
|
+
]
|
|
1974
|
+
}, O = class O extends I {
|
|
1975
|
+
constructor() {
|
|
1976
|
+
super({ _name: O._name });
|
|
1977
|
+
}
|
|
1978
|
+
async _fire(e) {
|
|
1979
|
+
const t = u.ensure_params(e?._params), s = u.ensure_string(t.event, "event"), n = t.data;
|
|
1980
|
+
t._debug && v.log("xem fire 🔥 ", s, n), await E().fire(s, n);
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
O._name = "xem", O._skill = _e, O._ops = {
|
|
1984
|
+
fire: {
|
|
1985
|
+
_name: "fire",
|
|
1986
|
+
_scope: "module",
|
|
1987
|
+
_description: "Fire a global XEM event with optional payload data.",
|
|
1988
|
+
_params: {
|
|
1989
|
+
event: "Event name.",
|
|
1990
|
+
data: "Optional event payload.",
|
|
1991
|
+
_debug: "Optional debug log flag."
|
|
1992
|
+
},
|
|
1993
|
+
_example: {
|
|
1994
|
+
_module: "xem",
|
|
1995
|
+
_op: "fire",
|
|
1996
|
+
_params: {
|
|
1997
|
+
event: "user:login",
|
|
1998
|
+
data: {
|
|
1999
|
+
source: "login-button"
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
let W = O;
|
|
2006
|
+
class ge {
|
|
1271
2007
|
/* -------------------------------------------------- */
|
|
1272
2008
|
/* core helpers */
|
|
1273
2009
|
/* -------------------------------------------------- */
|
|
1274
|
-
static get(
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
for (const
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
return String(
|
|
2010
|
+
static get(e, t, s) {
|
|
2011
|
+
const r = (e?._params ?? e)?.[t];
|
|
2012
|
+
return r !== void 0 ? r : s;
|
|
2013
|
+
}
|
|
2014
|
+
static has(e, t) {
|
|
2015
|
+
return (e?._params ?? e)[t] !== void 0;
|
|
2016
|
+
}
|
|
2017
|
+
static str(e, ...t) {
|
|
2018
|
+
const s = e?._params ?? e;
|
|
2019
|
+
for (const n of t) {
|
|
2020
|
+
const r = s?.[n];
|
|
2021
|
+
if (r != null)
|
|
2022
|
+
return String(r);
|
|
1287
2023
|
}
|
|
1288
2024
|
}
|
|
1289
2025
|
/* -------------------------------------------------- */
|
|
1290
2026
|
/* typed params */
|
|
1291
2027
|
/* -------------------------------------------------- */
|
|
1292
|
-
static bool(
|
|
1293
|
-
const
|
|
1294
|
-
if (typeof
|
|
1295
|
-
if (typeof
|
|
1296
|
-
if (typeof
|
|
1297
|
-
const
|
|
1298
|
-
if (["1", "true", "yes", "on"].includes(
|
|
1299
|
-
if (["0", "false", "no", "off"].includes(
|
|
2028
|
+
static bool(e, t, s = !1) {
|
|
2029
|
+
const n = e?._params ?? e, r = this.get(n, t, s);
|
|
2030
|
+
if (typeof r == "boolean") return r;
|
|
2031
|
+
if (typeof r == "number") return r !== 0;
|
|
2032
|
+
if (typeof r == "string") {
|
|
2033
|
+
const i = r.toLowerCase();
|
|
2034
|
+
if (["1", "true", "yes", "on"].includes(i)) return !0;
|
|
2035
|
+
if (["0", "false", "no", "off"].includes(i)) return !1;
|
|
1300
2036
|
}
|
|
1301
|
-
return !!
|
|
2037
|
+
return !!r;
|
|
1302
2038
|
}
|
|
1303
|
-
static int(
|
|
1304
|
-
const
|
|
1305
|
-
return Number.isFinite(
|
|
2039
|
+
static int(e, t, s = 0) {
|
|
2040
|
+
const n = e?._params ?? e, r = this.get(n, t, s), i = parseInt(String(r), 10);
|
|
2041
|
+
return Number.isFinite(i) ? i : s;
|
|
1306
2042
|
}
|
|
1307
|
-
static json(
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1310
|
-
if (typeof
|
|
1311
|
-
if (typeof
|
|
2043
|
+
static json(e, t, s) {
|
|
2044
|
+
const n = e?._params ?? e, r = this.get(n, t, s);
|
|
2045
|
+
if (r == null) return s;
|
|
2046
|
+
if (typeof r == "object") return r;
|
|
2047
|
+
if (typeof r == "string")
|
|
1312
2048
|
try {
|
|
1313
|
-
return JSON.parse(
|
|
2049
|
+
return JSON.parse(r);
|
|
1314
2050
|
} catch {
|
|
1315
2051
|
return s;
|
|
1316
2052
|
}
|
|
1317
2053
|
return s;
|
|
1318
2054
|
}
|
|
1319
2055
|
}
|
|
1320
|
-
class
|
|
1321
|
-
constructor(
|
|
1322
|
-
super(
|
|
2056
|
+
class H extends Error {
|
|
2057
|
+
constructor(e, t, s) {
|
|
2058
|
+
super(t), this.name = "XError", this._code = e, this._level = s?._level ?? "error", this._meta = s?._meta, this._cause = s?._cause;
|
|
1323
2059
|
}
|
|
1324
2060
|
toXData() {
|
|
1325
2061
|
return {
|
|
@@ -1340,33 +2076,33 @@ class E extends Error {
|
|
|
1340
2076
|
};
|
|
1341
2077
|
}
|
|
1342
2078
|
}
|
|
1343
|
-
class
|
|
1344
|
-
constructor(
|
|
1345
|
-
this._ok = !1, this._ts = Date.now(), this._pt = 0,
|
|
2079
|
+
class b {
|
|
2080
|
+
constructor(e) {
|
|
2081
|
+
this._ok = !1, this._ts = Date.now(), this._pt = 0, e && this.setXData(e);
|
|
1346
2082
|
}
|
|
1347
2083
|
// ---------------------------------------------------------------------------
|
|
1348
2084
|
// Factories
|
|
1349
2085
|
// ---------------------------------------------------------------------------
|
|
1350
|
-
static create(
|
|
1351
|
-
return new
|
|
2086
|
+
static create(e) {
|
|
2087
|
+
return new b(e);
|
|
1352
2088
|
}
|
|
1353
|
-
static ok(
|
|
1354
|
-
return new
|
|
2089
|
+
static ok(e) {
|
|
2090
|
+
return new b({ _ok: !0, _result: e });
|
|
1355
2091
|
}
|
|
1356
|
-
static error(
|
|
1357
|
-
if (
|
|
1358
|
-
return new
|
|
2092
|
+
static error(e) {
|
|
2093
|
+
if (e instanceof H)
|
|
2094
|
+
return new b({
|
|
1359
2095
|
_ok: !1,
|
|
1360
|
-
_result:
|
|
2096
|
+
_result: e.toXData()
|
|
1361
2097
|
});
|
|
1362
|
-
const
|
|
2098
|
+
const t = new H(
|
|
1363
2099
|
"E_INTERNAL",
|
|
1364
|
-
|
|
1365
|
-
{ _cause:
|
|
2100
|
+
e?.message ?? String(e),
|
|
2101
|
+
{ _cause: e }
|
|
1366
2102
|
);
|
|
1367
|
-
return new
|
|
2103
|
+
return new b({
|
|
1368
2104
|
_ok: !1,
|
|
1369
|
-
_result:
|
|
2105
|
+
_result: t.toXData()
|
|
1370
2106
|
});
|
|
1371
2107
|
}
|
|
1372
2108
|
// ---------------------------------------------------------------------------
|
|
@@ -1393,37 +2129,37 @@ class d {
|
|
|
1393
2129
|
toString() {
|
|
1394
2130
|
return JSON.stringify(this.toXData());
|
|
1395
2131
|
}
|
|
1396
|
-
setXData(
|
|
1397
|
-
|
|
2132
|
+
setXData(e) {
|
|
2133
|
+
e && ("_ok" in e && (this._ok = !!e._ok), "_ts" in e && typeof e._ts == "number" && (this._ts = e._ts), "_pt" in e && typeof e._pt == "number" && (this._pt = e._pt), "_result" in e && (this._result = e._result));
|
|
1398
2134
|
}
|
|
1399
2135
|
}
|
|
1400
|
-
class
|
|
1401
|
-
constructor(
|
|
1402
|
-
super(
|
|
2136
|
+
class ye extends b {
|
|
2137
|
+
constructor(e) {
|
|
2138
|
+
super(b.error(e).toXData());
|
|
1403
2139
|
}
|
|
1404
2140
|
}
|
|
1405
|
-
class
|
|
1406
|
-
constructor(
|
|
1407
|
-
super({ _ok: !0, _result:
|
|
2141
|
+
class be extends b {
|
|
2142
|
+
constructor(e) {
|
|
2143
|
+
super({ _ok: !0, _result: e });
|
|
1408
2144
|
}
|
|
1409
2145
|
}
|
|
1410
|
-
const
|
|
1411
|
-
class
|
|
1412
|
-
constructor(
|
|
1413
|
-
this._log_rules = {}, this._modules = {}, this._schedule_frame =
|
|
2146
|
+
const le = "engine:frame-number", he = "engine:fps";
|
|
2147
|
+
class ue {
|
|
2148
|
+
constructor(e) {
|
|
2149
|
+
this._log_rules = {}, this._modules = {}, this._schedule_frame = e?._schedule_frame ?? u.createDefaultScheduler(e?._target_fps), this._version = "0.0.1", this._engine_id = u.guid(), this._frame_number = 0, this._fps_calc = new ee(), this.parser = w, this._modules = {}, l._enabled = !1, ie(this);
|
|
1414
2150
|
}
|
|
1415
2151
|
/**
|
|
1416
2152
|
* @deprecated use _verbose instead
|
|
1417
2153
|
* Enable Xpell logs to console
|
|
1418
2154
|
*/
|
|
1419
|
-
set verbose(
|
|
1420
|
-
|
|
2155
|
+
set verbose(e) {
|
|
2156
|
+
l._enabled = e;
|
|
1421
2157
|
}
|
|
1422
2158
|
/**
|
|
1423
2159
|
* Enable Xpell logs to console
|
|
1424
2160
|
*/
|
|
1425
|
-
set _verbose(
|
|
1426
|
-
|
|
2161
|
+
set _verbose(e) {
|
|
2162
|
+
l._enabled = e;
|
|
1427
2163
|
}
|
|
1428
2164
|
/**
|
|
1429
2165
|
* Logs message to console using Xpell logger
|
|
@@ -1432,36 +2168,52 @@ class L {
|
|
|
1432
2168
|
* @param msg
|
|
1433
2169
|
* @param optionalParams
|
|
1434
2170
|
*/
|
|
1435
|
-
log(
|
|
1436
|
-
|
|
2171
|
+
log(e, ...t) {
|
|
2172
|
+
l.log(e, ...t);
|
|
1437
2173
|
}
|
|
1438
2174
|
/**
|
|
1439
2175
|
* Delay the execution of the next command
|
|
1440
2176
|
* @param ms - delay in milliseconds
|
|
1441
2177
|
* @returns
|
|
1442
2178
|
*/
|
|
1443
|
-
async delay(
|
|
1444
|
-
return new Promise((
|
|
2179
|
+
async delay(e) {
|
|
2180
|
+
return new Promise((t) => setTimeout(t, e));
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Module management
|
|
2184
|
+
* Modules are the main building blocks of Xpell applications, providing specific functionality (UI, data, etc.)
|
|
2185
|
+
* loadModule() is fire-and-forget.
|
|
2186
|
+
* Use loadModuleAsync() for deterministic startup.
|
|
2187
|
+
*/
|
|
2188
|
+
addModule(e) {
|
|
2189
|
+
return this._modules.hasOwnProperty(e._name) ? (l.log("Module " + e._name + " already loaded"), !1) : (this._modules[e._name] = e, !0);
|
|
1445
2190
|
}
|
|
1446
2191
|
/**
|
|
1447
2192
|
* Loads Xpell module into the engine
|
|
1448
2193
|
* @param {XModule} xModule
|
|
1449
2194
|
*/
|
|
1450
|
-
loadModule(
|
|
1451
|
-
this.
|
|
2195
|
+
loadModule(e) {
|
|
2196
|
+
this.addModule(e) && e.load();
|
|
1452
2197
|
}
|
|
1453
2198
|
/**
|
|
1454
2199
|
* Loads multiple module at ones
|
|
1455
2200
|
* @param {Array<XModule>} xModulesArray
|
|
1456
2201
|
*/
|
|
1457
|
-
loadModules(...
|
|
1458
|
-
|
|
2202
|
+
loadModules(...e) {
|
|
2203
|
+
e.forEach((t) => this.loadModule(t));
|
|
2204
|
+
}
|
|
2205
|
+
async loadModuleAsync(e) {
|
|
2206
|
+
this.addModule(e) && await e.load();
|
|
2207
|
+
}
|
|
2208
|
+
async loadModulesAsync(...e) {
|
|
2209
|
+
for (const t of e)
|
|
2210
|
+
await this.loadModuleAsync(t);
|
|
1459
2211
|
}
|
|
1460
2212
|
/**
|
|
1461
2213
|
* Display information about the Xpell engine to the console
|
|
1462
2214
|
*/
|
|
1463
2215
|
info() {
|
|
1464
|
-
|
|
2216
|
+
l.log(`Xpell information:
|
|
1465
2217
|
- Engine Id: ` + this._engine_id + `
|
|
1466
2218
|
- Version ` + this._version);
|
|
1467
2219
|
}
|
|
@@ -1469,10 +2221,10 @@ class L {
|
|
|
1469
2221
|
* Run textual xCommand -
|
|
1470
2222
|
* @param {cmd} - text command
|
|
1471
2223
|
*/
|
|
1472
|
-
run(
|
|
1473
|
-
if (
|
|
1474
|
-
let
|
|
1475
|
-
return this.execute(
|
|
2224
|
+
run(e) {
|
|
2225
|
+
if (e?.length > 2) {
|
|
2226
|
+
let t = w.parse(e);
|
|
2227
|
+
return this.execute(t);
|
|
1476
2228
|
} else
|
|
1477
2229
|
throw "Unable to parse Xpell command";
|
|
1478
2230
|
}
|
|
@@ -1480,10 +2232,10 @@ class L {
|
|
|
1480
2232
|
* Execute Xpell Command
|
|
1481
2233
|
* @param {XCommand}
|
|
1482
2234
|
*/
|
|
1483
|
-
execute(
|
|
1484
|
-
if (
|
|
1485
|
-
return this._modules[
|
|
1486
|
-
throw "Xpell module " +
|
|
2235
|
+
execute(e) {
|
|
2236
|
+
if (e && e._module && this._modules[e._module])
|
|
2237
|
+
return this._modules[e._module].execute(e);
|
|
2238
|
+
throw "Xpell module " + e._module + " not loaded";
|
|
1487
2239
|
}
|
|
1488
2240
|
/**
|
|
1489
2241
|
* Main onFrame method
|
|
@@ -1491,63 +2243,85 @@ class L {
|
|
|
1491
2243
|
*/
|
|
1492
2244
|
onFrame() {
|
|
1493
2245
|
this._frame_number++;
|
|
1494
|
-
for (const
|
|
1495
|
-
const s = this._modules[
|
|
2246
|
+
for (const t of Object.keys(this._modules)) {
|
|
2247
|
+
const s = this._modules[t];
|
|
1496
2248
|
s?.onFrame && typeof s.onFrame == "function" && s.onFrame(this._frame_number);
|
|
1497
2249
|
}
|
|
1498
|
-
const
|
|
1499
|
-
|
|
2250
|
+
const e = this._fps_calc.calc();
|
|
2251
|
+
m.set(le, this._frame_number, { source: "engine" }), m.set(he, e, { source: "engine" }), m._compat_legacy_keys && (m.set("frame-number", this._frame_number, { source: "engine:legacy" }), m.set("fps", e, { source: "engine:legacy" })), this._schedule_frame(() => this.onFrame());
|
|
1500
2252
|
}
|
|
1501
2253
|
/**
|
|
1502
2254
|
* Gets Xpell module by name
|
|
1503
2255
|
* @param {string} moduleName - name of the loaded module
|
|
1504
2256
|
* @returns {XModule}
|
|
1505
2257
|
*/
|
|
1506
|
-
getModule(
|
|
1507
|
-
return this._modules[
|
|
2258
|
+
getModule(e) {
|
|
2259
|
+
return this._modules[e];
|
|
1508
2260
|
}
|
|
1509
2261
|
/**
|
|
1510
2262
|
* Start Xpell engine for web browsers using requestAnimationFrame
|
|
1511
2263
|
*/
|
|
1512
2264
|
start() {
|
|
1513
|
-
|
|
2265
|
+
l.log("Loading Xpell core modules...[xd, xem]"), this.loadModule(new T()), this.loadModule(new W()), l.log("Starting Xpell"), this.onFrame();
|
|
1514
2266
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
2267
|
+
getCoreSkills() {
|
|
2268
|
+
return [
|
|
2269
|
+
q,
|
|
2270
|
+
U
|
|
2271
|
+
];
|
|
2272
|
+
}
|
|
2273
|
+
getModuleSkills() {
|
|
2274
|
+
return Object.values(this._modules).flatMap(
|
|
2275
|
+
(e) => typeof e.getSkillChain == "function" ? e.getSkillChain() : []
|
|
2276
|
+
);
|
|
2277
|
+
}
|
|
2278
|
+
getSkills() {
|
|
2279
|
+
return {
|
|
2280
|
+
_runtime: {
|
|
2281
|
+
_engine_id: this._engine_id,
|
|
2282
|
+
_version: this._version
|
|
2283
|
+
},
|
|
2284
|
+
_skills: this.getCoreSkills(),
|
|
2285
|
+
_modules: Object.values(this._modules).map((e) => ({
|
|
2286
|
+
_name: e._name,
|
|
2287
|
+
_skills: typeof e.getSkillChain == "function" ? e.getSkillChain() : [],
|
|
2288
|
+
_objects: typeof e.getObjectSkills == "function" ? e.getObjectSkills() : []
|
|
2289
|
+
}))
|
|
2290
|
+
};
|
|
1520
2291
|
}
|
|
1521
2292
|
}
|
|
1522
|
-
const
|
|
2293
|
+
const we = new ue();
|
|
1523
2294
|
export {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
2295
|
+
R as XCommand,
|
|
2296
|
+
he as XD_FPS,
|
|
2297
|
+
le as XD_FRAME_NUMBER,
|
|
2298
|
+
D as XData,
|
|
2299
|
+
T as XDataModule,
|
|
2300
|
+
H as XError,
|
|
2301
|
+
W as XEventManagerModule,
|
|
2302
|
+
l as XLogger,
|
|
2303
|
+
I as XModule,
|
|
2304
|
+
C as XObject,
|
|
2305
|
+
ne as XObjectManager,
|
|
2306
|
+
me as XObjectPack,
|
|
2307
|
+
ge as XParams,
|
|
2308
|
+
w as XParser,
|
|
2309
|
+
b as XResponse,
|
|
2310
|
+
ye as XResponseError,
|
|
2311
|
+
be as XResponseOK,
|
|
2312
|
+
Z as XUtils,
|
|
2313
|
+
we as Xpell,
|
|
2314
|
+
ue as XpellEngine,
|
|
2315
|
+
se as _XData,
|
|
2316
|
+
fe as _XEventManager,
|
|
2317
|
+
te as _XLogger,
|
|
2318
|
+
Y as _XUtils,
|
|
2319
|
+
we as _x,
|
|
2320
|
+
m as _xd,
|
|
2321
|
+
l as _xlog,
|
|
2322
|
+
u as _xu,
|
|
2323
|
+
g as createNanoCommandWithSkill,
|
|
2324
|
+
we as default,
|
|
2325
|
+
E as getXEventManager,
|
|
2326
|
+
pe as setXEventManager
|
|
1553
2327
|
};
|