@eva/plugin-evax 2.0.0-beta.1 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EVA.plugin.EVAX.js +101 -204
- package/dist/EVA.plugin.EVAX.min.js +1 -1
- package/dist/plugin-evax.cjs.js +92 -178
- package/dist/plugin-evax.cjs.prod.js +16 -1
- package/dist/plugin-evax.esm.js +93 -179
- package/package.json +2 -2
package/dist/EVA.plugin.EVAX.js
CHANGED
|
@@ -2,23 +2,22 @@ window.EVA = window.EVA || {};
|
|
|
2
2
|
window.EVA.plugin = window.EVA.plugin || {};
|
|
3
3
|
var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
4
4
|
'use strict';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.constructor = d;
|
|
5
|
+
|
|
6
|
+
class EvaXComponent extends eva_js.Component {
|
|
7
|
+
constructor(gameObject) {
|
|
8
|
+
super(gameObject);
|
|
9
|
+
this.events = {};
|
|
10
|
+
}
|
|
11
|
+
init(option = {
|
|
12
|
+
events: {}
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
events
|
|
16
|
+
} = option;
|
|
17
|
+
this.events = events || {};
|
|
19
18
|
}
|
|
20
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
19
|
}
|
|
20
|
+
EvaXComponent.componentName = 'EvaX';
|
|
22
21
|
function __decorate(decorators, target, key, desc) {
|
|
23
22
|
var c = arguments.length,
|
|
24
23
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
@@ -26,68 +25,6 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
26
25
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
27
26
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
28
27
|
}
|
|
29
|
-
function __values(o) {
|
|
30
|
-
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
31
|
-
m = s && o[s],
|
|
32
|
-
i = 0;
|
|
33
|
-
if (m) return m.call(o);
|
|
34
|
-
if (o && typeof o.length === "number") return {
|
|
35
|
-
next: function () {
|
|
36
|
-
if (o && i >= o.length) o = void 0;
|
|
37
|
-
return {
|
|
38
|
-
value: o && o[i++],
|
|
39
|
-
done: !o
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
44
|
-
}
|
|
45
|
-
function __read(o, n) {
|
|
46
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
47
|
-
if (!m) return o;
|
|
48
|
-
var i = m.call(o),
|
|
49
|
-
r,
|
|
50
|
-
ar = [],
|
|
51
|
-
e;
|
|
52
|
-
try {
|
|
53
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
e = {
|
|
56
|
-
error: error
|
|
57
|
-
};
|
|
58
|
-
} finally {
|
|
59
|
-
try {
|
|
60
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
61
|
-
} finally {
|
|
62
|
-
if (e) throw e.error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return ar;
|
|
66
|
-
}
|
|
67
|
-
function __spread() {
|
|
68
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
69
|
-
return ar;
|
|
70
|
-
}
|
|
71
|
-
var EvaXComponent = function (_super) {
|
|
72
|
-
__extends(EvaXComponent, _super);
|
|
73
|
-
function EvaXComponent(gameObject) {
|
|
74
|
-
var _this = _super.call(this, gameObject) || this;
|
|
75
|
-
_this.events = {};
|
|
76
|
-
return _this;
|
|
77
|
-
}
|
|
78
|
-
EvaXComponent.prototype.init = function (option) {
|
|
79
|
-
if (option === void 0) {
|
|
80
|
-
option = {
|
|
81
|
-
events: {}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
var events = option.events;
|
|
85
|
-
this.events = events || {};
|
|
86
|
-
};
|
|
87
|
-
EvaXComponent.componentName = 'EvaX';
|
|
88
|
-
return EvaXComponent;
|
|
89
|
-
}(eva_js.Component);
|
|
90
|
-
var EvaXComponent$1 = EvaXComponent;
|
|
91
28
|
function createCommonjsModule(fn) {
|
|
92
29
|
var module = {
|
|
93
30
|
exports: {}
|
|
@@ -343,12 +280,12 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
343
280
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
344
281
|
var root = freeGlobal$1 || freeSelf || Function('return this')();
|
|
345
282
|
var root$1 = root;
|
|
346
|
-
var Symbol
|
|
347
|
-
var Symbol$
|
|
283
|
+
var Symbol = root$1.Symbol;
|
|
284
|
+
var Symbol$1 = Symbol;
|
|
348
285
|
var objectProto$c = Object.prototype;
|
|
349
286
|
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
350
287
|
var nativeObjectToString$1 = objectProto$c.toString;
|
|
351
|
-
var symToStringTag$1 = Symbol$
|
|
288
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
352
289
|
function getRawTag(value) {
|
|
353
290
|
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
354
291
|
tag = value[symToStringTag$1];
|
|
@@ -373,7 +310,7 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
373
310
|
}
|
|
374
311
|
var nullTag = '[object Null]',
|
|
375
312
|
undefinedTag = '[object Undefined]';
|
|
376
|
-
var symToStringTag = Symbol$
|
|
313
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
377
314
|
function baseGetTag(value) {
|
|
378
315
|
if (value == null) {
|
|
379
316
|
return value === undefined ? undefinedTag : nullTag;
|
|
@@ -961,7 +898,7 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
961
898
|
result.lastIndex = regexp.lastIndex;
|
|
962
899
|
return result;
|
|
963
900
|
}
|
|
964
|
-
var symbolProto = Symbol$
|
|
901
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
965
902
|
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
966
903
|
function cloneSymbol(symbol) {
|
|
967
904
|
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
@@ -1157,7 +1094,7 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
1157
1094
|
function cloneDeep(value) {
|
|
1158
1095
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
1159
1096
|
}
|
|
1160
|
-
|
|
1097
|
+
const _defineCache = new Map();
|
|
1161
1098
|
function defineProperty(key, deep, store, originKey, originStore, callback) {
|
|
1162
1099
|
if (!_defineCache.has(store)) {
|
|
1163
1100
|
_defineCache.set(store, []);
|
|
@@ -1166,45 +1103,45 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
1166
1103
|
return;
|
|
1167
1104
|
}
|
|
1168
1105
|
_defineCache.get(store).push(key);
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
for (
|
|
1106
|
+
const props = key.split('.');
|
|
1107
|
+
let obj = store;
|
|
1108
|
+
const length = props.length;
|
|
1109
|
+
for (let i = 0; i < length - 1; i++) {
|
|
1173
1110
|
if (obj[props[i]] === undefined) {
|
|
1174
1111
|
return;
|
|
1175
1112
|
}
|
|
1176
1113
|
obj = obj[props[i]];
|
|
1177
1114
|
}
|
|
1178
|
-
|
|
1115
|
+
const value = obj[props[length - 1]];
|
|
1179
1116
|
if (deep && isObject(value)) {
|
|
1180
|
-
for (
|
|
1181
|
-
defineProperty(
|
|
1117
|
+
for (const key in value) {
|
|
1118
|
+
defineProperty(key, deep, value, originKey, originStore, callback);
|
|
1182
1119
|
}
|
|
1183
1120
|
}
|
|
1184
|
-
|
|
1121
|
+
const _key = `_${props[length - 1]}`;
|
|
1185
1122
|
obj[_key] = value;
|
|
1186
1123
|
Object.defineProperty(obj, _key, {
|
|
1187
1124
|
enumerable: false
|
|
1188
1125
|
});
|
|
1189
1126
|
Object.defineProperty(obj, props[length - 1], {
|
|
1190
|
-
set
|
|
1191
|
-
|
|
1192
|
-
obj[
|
|
1127
|
+
set(val) {
|
|
1128
|
+
const oldStore = cloneDeep(originStore);
|
|
1129
|
+
obj[`_${props[length - 1]}`] = val;
|
|
1193
1130
|
callback(originKey, oldStore);
|
|
1194
1131
|
if (deep && isObject(val)) {
|
|
1195
1132
|
_defineCache.delete(obj);
|
|
1196
|
-
for (
|
|
1197
|
-
defineProperty(
|
|
1133
|
+
for (const key in val) {
|
|
1134
|
+
defineProperty(key, deep, val, originKey, originStore, callback);
|
|
1198
1135
|
}
|
|
1199
1136
|
}
|
|
1200
1137
|
},
|
|
1201
|
-
get
|
|
1202
|
-
return obj[
|
|
1138
|
+
get() {
|
|
1139
|
+
return obj[`_${props[length - 1]}`];
|
|
1203
1140
|
}
|
|
1204
1141
|
});
|
|
1205
1142
|
}
|
|
1206
1143
|
function updateStore(store, newStore, force) {
|
|
1207
|
-
for (
|
|
1144
|
+
for (const key in store) {
|
|
1208
1145
|
if (!(key in newStore)) {
|
|
1209
1146
|
continue;
|
|
1210
1147
|
}
|
|
@@ -1217,107 +1154,73 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
1217
1154
|
}
|
|
1218
1155
|
}
|
|
1219
1156
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
_this.changeList = [];
|
|
1225
|
-
return _this;
|
|
1157
|
+
let EvaXSystem = class EvaXSystem extends eva_js.System {
|
|
1158
|
+
constructor() {
|
|
1159
|
+
super(...arguments);
|
|
1160
|
+
this.changeList = [];
|
|
1226
1161
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1162
|
+
init({
|
|
1163
|
+
store = {}
|
|
1164
|
+
} = {
|
|
1165
|
+
store: {}
|
|
1166
|
+
}) {
|
|
1232
1167
|
this.ee = new EventEmitter();
|
|
1233
1168
|
this.store = store;
|
|
1234
1169
|
this.bindDefaultListener();
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
_this.updateStore(store);
|
|
1170
|
+
}
|
|
1171
|
+
bindDefaultListener() {
|
|
1172
|
+
this.ee.on('evax.updateStore', store => {
|
|
1173
|
+
this.updateStore(store);
|
|
1240
1174
|
});
|
|
1241
|
-
this.ee.on('evax.forceUpdateStore',
|
|
1242
|
-
|
|
1175
|
+
this.ee.on('evax.forceUpdateStore', store => {
|
|
1176
|
+
this.forceUpdateStore(store);
|
|
1243
1177
|
});
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1178
|
+
}
|
|
1179
|
+
changeCallback(key, oldStore) {
|
|
1246
1180
|
this.changeList.push({
|
|
1247
1181
|
key: key,
|
|
1248
1182
|
oldStore: oldStore
|
|
1249
1183
|
});
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1184
|
+
}
|
|
1185
|
+
updateStore(store) {
|
|
1252
1186
|
updateStore(this.store, store, false);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1187
|
+
}
|
|
1188
|
+
forceUpdateStore(store) {
|
|
1255
1189
|
updateStore(this.store, store, true);
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
var _this = this;
|
|
1190
|
+
}
|
|
1191
|
+
bindListener(key, deep) {
|
|
1259
1192
|
if (key.indexOf('store.') === -1) {
|
|
1260
1193
|
return;
|
|
1261
1194
|
}
|
|
1262
|
-
|
|
1263
|
-
defineProperty(realKey, deep, this.store, key, this.store,
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
this.add(changed);
|
|
1276
|
-
break;
|
|
1277
|
-
case eva_js.OBSERVER_TYPE.REMOVE:
|
|
1278
|
-
this.remove(changed);
|
|
1279
|
-
break;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
} catch (e_1_1) {
|
|
1283
|
-
e_1 = {
|
|
1284
|
-
error: e_1_1
|
|
1285
|
-
};
|
|
1286
|
-
} finally {
|
|
1287
|
-
try {
|
|
1288
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
1289
|
-
} finally {
|
|
1290
|
-
if (e_1) throw e_1.error;
|
|
1195
|
+
const realKey = key.split('.').slice(1).join('.');
|
|
1196
|
+
defineProperty(realKey, deep, this.store, key, this.store, (key, oldStore) => this.changeCallback(key, oldStore));
|
|
1197
|
+
}
|
|
1198
|
+
update() {
|
|
1199
|
+
const changes = this.componentObserver.clear();
|
|
1200
|
+
for (const changed of changes) {
|
|
1201
|
+
switch (changed.type) {
|
|
1202
|
+
case eva_js.OBSERVER_TYPE.ADD:
|
|
1203
|
+
this.add(changed);
|
|
1204
|
+
break;
|
|
1205
|
+
case eva_js.OBSERVER_TYPE.REMOVE:
|
|
1206
|
+
this.remove(changed);
|
|
1207
|
+
break;
|
|
1291
1208
|
}
|
|
1292
1209
|
}
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
for (var _b = __values(this.changeList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1298
|
-
var item = _c.value;
|
|
1299
|
-
this.ee.emit(item.key, this.store, item.oldStore);
|
|
1300
|
-
}
|
|
1301
|
-
} catch (e_2_1) {
|
|
1302
|
-
e_2 = {
|
|
1303
|
-
error: e_2_1
|
|
1304
|
-
};
|
|
1305
|
-
} finally {
|
|
1306
|
-
try {
|
|
1307
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1308
|
-
} finally {
|
|
1309
|
-
if (e_2) throw e_2.error;
|
|
1310
|
-
}
|
|
1210
|
+
}
|
|
1211
|
+
lateUpdate() {
|
|
1212
|
+
for (const item of this.changeList) {
|
|
1213
|
+
this.ee.emit(item.key, this.store, item.oldStore);
|
|
1311
1214
|
}
|
|
1312
1215
|
this.changeList = [];
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1216
|
+
}
|
|
1217
|
+
add(changed) {
|
|
1218
|
+
const component = changed.component;
|
|
1316
1219
|
component.evax = this;
|
|
1317
|
-
for (
|
|
1220
|
+
for (const key in component.events) {
|
|
1318
1221
|
if (component.events[key]) {
|
|
1319
1222
|
this.bindListener(key, !!component.events[key].deep);
|
|
1320
|
-
|
|
1223
|
+
let func;
|
|
1321
1224
|
if (component.events[key] instanceof Function) {
|
|
1322
1225
|
func = component.events[key];
|
|
1323
1226
|
} else {
|
|
@@ -1326,42 +1229,36 @@ var _EVA_IIFE_EVAX = function (exports, eva_js) {
|
|
|
1326
1229
|
this.ee.on(key, func.bind(component));
|
|
1327
1230
|
}
|
|
1328
1231
|
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
for (
|
|
1232
|
+
}
|
|
1233
|
+
remove(changed) {
|
|
1234
|
+
const component = changed.component;
|
|
1235
|
+
for (const key in component.events) {
|
|
1333
1236
|
if (component.events[key] instanceof Function) {
|
|
1334
1237
|
this.ee.off(key, component.events[key].bind(component));
|
|
1335
1238
|
}
|
|
1336
1239
|
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1240
|
+
}
|
|
1241
|
+
on(eventName, func) {
|
|
1339
1242
|
return this.ee.on(eventName, func, this);
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1243
|
+
}
|
|
1244
|
+
off(eventName, func) {
|
|
1342
1245
|
return this.ee.off(eventName, func);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
EvaXSystem.systemName = 'EvaX';
|
|
1354
|
-
EvaXSystem = __decorate([eva_js.decorators.componentObserver({
|
|
1355
|
-
EvaX: []
|
|
1356
|
-
})], EvaXSystem);
|
|
1357
|
-
return EvaXSystem;
|
|
1358
|
-
}(eva_js.System);
|
|
1246
|
+
}
|
|
1247
|
+
emit(eventName, ...args) {
|
|
1248
|
+
return this.ee.emit(eventName, ...args);
|
|
1249
|
+
}
|
|
1250
|
+
onDestroy() {}
|
|
1251
|
+
};
|
|
1252
|
+
EvaXSystem.systemName = 'EvaX';
|
|
1253
|
+
EvaXSystem = __decorate([eva_js.decorators.componentObserver({
|
|
1254
|
+
EvaX: []
|
|
1255
|
+
})], EvaXSystem);
|
|
1359
1256
|
var EvaXSystem$1 = EvaXSystem;
|
|
1360
1257
|
var index = {
|
|
1361
|
-
Components: [EvaXComponent
|
|
1258
|
+
Components: [EvaXComponent],
|
|
1362
1259
|
Systems: [EvaXSystem$1]
|
|
1363
1260
|
};
|
|
1364
|
-
exports.EvaX = EvaXComponent
|
|
1261
|
+
exports.EvaX = EvaXComponent;
|
|
1365
1262
|
exports.EvaXSystem = EvaXSystem$1;
|
|
1366
1263
|
exports["default"] = index;
|
|
1367
1264
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_EVAX=function(t,e){"use strict";var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},r(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}var c=function(t){function e(e){var r=t.call(this,e)||this;return r.events={},r}return n(e,t),e.prototype.init=function(t){void 0===t&&(t={events:{}});var e=t.events;this.events=e||{}},e.componentName="EvaX",e}(e.Component);var a=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,c){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,i||t,c),u=r?r+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function c(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,c=new Array(i);o<i;o++)c[o]=n[o].fn;return c},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,o,i,c){var a=r?r+t:t;if(!this._events[a])return!1;var u,s,f=this._events[a],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,n),!0;case 4:return f.fn.call(f.context,e,n,o),!0;case 5:return f.fn.call(f.context,e,n,o,i),!0;case 6:return f.fn.call(f.context,e,n,o,i,c),!0}for(s=1,u=new Array(l-1);s<l;s++)u[s-1]=arguments[s];f.fn.apply(f.context,u)}else{var p,v=f.length;for(s=0;s<v;s++)switch(f[s].once&&this.removeListener(t,f[s].fn,void 0,!0),l){case 1:f[s].fn.call(f[s].context);break;case 2:f[s].fn.call(f[s].context,e);break;case 3:f[s].fn.call(f[s].context,e,n);break;case 4:f[s].fn.call(f[s].context,e,n,o);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];f[s].fn.apply(f[s].context,u)}}return!0},a.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return c(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||n&&a.context!==n||c(this,i);else{for(var u=0,s=[],f=a.length;u<f;u++)(a[u].fn!==e||o&&!a[u].once||n&&a[u].context!==n)&&s.push(a[u]);s.length?this._events[i]=1===s.length?s[0]:s:c(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&c(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a})),u=a;function s(t,e){return t===e||t!=t&&e!=e}function f(t,e){for(var r=t.length;r--;)if(s(t[r][0],e))return r;return-1}var l=Array.prototype.splice;function p(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}p.prototype.clear=function(){this.__data__=[],this.size=0},p.prototype.delete=function(t){var e=this.__data__,r=f(e,t);return!(r<0)&&(r==e.length-1?e.pop():l.call(e,r,1),--this.size,!0)},p.prototype.get=function(t){var e=this.__data__,r=f(e,t);return r<0?void 0:e[r][1]},p.prototype.has=function(t){return f(this.__data__,t)>-1},p.prototype.set=function(t,e){var r=this.__data__,n=f(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var v="object"==typeof global&&global&&global.Object===Object&&global,y="object"==typeof self&&self&&self.Object===Object&&self,h=v||y||Function("return this")(),b=h.Symbol,d=Object.prototype,_=d.hasOwnProperty,j=d.toString,g=b?b.toStringTag:void 0;var w=Object.prototype.toString;var O=b?b.toStringTag:void 0;function m(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":O&&O in Object(t)?function(t){var e=_.call(t,g),r=t[g];try{t[g]=void 0;var n=!0}catch(t){}var o=j.call(t);return n&&(e?t[g]=r:delete t[g]),o}(t):function(t){return w.call(t)}(t)}function A(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function x(t){if(!A(t))return!1;var e=m(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var E,S=h["__core-js_shared__"],P=(E=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"";var V=Function.prototype.toString;function z(t){if(null!=t){try{return V.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var F=/^\[object .+?Constructor\]$/,U=Function.prototype,I=Object.prototype,L=U.toString,k=I.hasOwnProperty,T=RegExp("^"+L.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function C(t){return!(!A(t)||(e=t,P&&P in e))&&(x(t)?T:F).test(z(t));var e}function D(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return C(r)?r:void 0}var M=D(h,"Map"),R=D(Object,"create");var B=Object.prototype.hasOwnProperty;var X=Object.prototype.hasOwnProperty;function $(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function N(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function W(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}$.prototype.clear=function(){this.__data__=R?R(null):{},this.size=0},$.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$.prototype.get=function(t){var e=this.__data__;if(R){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return B.call(e,t)?e[t]:void 0},$.prototype.has=function(t){var e=this.__data__;return R?void 0!==e[t]:X.call(e,t)},$.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=R&&void 0===e?"__lodash_hash_undefined__":e,this},W.prototype.clear=function(){this.size=0,this.__data__={hash:new $,map:new(M||p),string:new $}},W.prototype.delete=function(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e},W.prototype.get=function(t){return N(this,t).get(t)},W.prototype.has=function(t){return N(this,t).has(t)},W.prototype.set=function(t,e){var r=N(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function q(t){var e=this.__data__=new p(t);this.size=e.size}q.prototype.clear=function(){this.__data__=new p,this.size=0},q.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},q.prototype.get=function(t){return this.__data__.get(t)},q.prototype.has=function(t){return this.__data__.has(t)},q.prototype.set=function(t,e){var r=this.__data__;if(r instanceof p){var n=r.__data__;if(!M||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new W(n)}return r.set(t,e),this.size=r.size,this};var G=function(){try{var t=D(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function Y(t,e,r){"__proto__"==e&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var H=Object.prototype.hasOwnProperty;function J(t,e,r){var n=t[e];H.call(t,e)&&s(n,r)&&(void 0!==r||e in t)||Y(t,e,r)}function K(t,e,r,n){var o=!r;r||(r={});for(var i=-1,c=e.length;++i<c;){var a=e[i],u=n?n(r[a],t[a],a,r,t):void 0;void 0===u&&(u=t[a]),o?Y(r,a,u):J(r,a,u)}return r}function Q(t){return null!=t&&"object"==typeof t}function Z(t){return Q(t)&&"[object Arguments]"==m(t)}var tt=Object.prototype,et=tt.hasOwnProperty,rt=tt.propertyIsEnumerable,nt=Z(function(){return arguments}())?Z:function(t){return Q(t)&&et.call(t,"callee")&&!rt.call(t,"callee")},ot=nt,it=Array.isArray;var ct="object"==typeof t&&t&&!t.nodeType&&t,at=ct&&"object"==typeof module&&module&&!module.nodeType&&module,ut=at&&at.exports===ct?h.Buffer:void 0,st=(ut?ut.isBuffer:void 0)||function(){return!1},ft=/^(?:0|[1-9]\d*)$/;function lt(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ft.test(t))&&t>-1&&t%1==0&&t<e}function pt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var vt={};function yt(t){return function(e){return t(e)}}vt["[object Float32Array]"]=vt["[object Float64Array]"]=vt["[object Int8Array]"]=vt["[object Int16Array]"]=vt["[object Int32Array]"]=vt["[object Uint8Array]"]=vt["[object Uint8ClampedArray]"]=vt["[object Uint16Array]"]=vt["[object Uint32Array]"]=!0,vt["[object Arguments]"]=vt["[object Array]"]=vt["[object ArrayBuffer]"]=vt["[object Boolean]"]=vt["[object DataView]"]=vt["[object Date]"]=vt["[object Error]"]=vt["[object Function]"]=vt["[object Map]"]=vt["[object Number]"]=vt["[object Object]"]=vt["[object RegExp]"]=vt["[object Set]"]=vt["[object String]"]=vt["[object WeakMap]"]=!1;var ht="object"==typeof t&&t&&!t.nodeType&&t,bt=ht&&"object"==typeof module&&module&&!module.nodeType&&module,dt=bt&&bt.exports===ht&&v.process,_t=function(){try{var t=bt&&bt.require&&bt.require("util").types;return t||dt&&dt.binding&&dt.binding("util")}catch(t){}}(),jt=_t&&_t.isTypedArray,gt=jt?yt(jt):function(t){return Q(t)&&pt(t.length)&&!!vt[m(t)]},wt=Object.prototype.hasOwnProperty;function Ot(t,e){var r=it(t),n=!r&&ot(t),o=!r&&!n&&st(t),i=!r&&!n&&!o&>(t),c=r||n||o||i,a=c?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=a.length;for(var s in t)!e&&!wt.call(t,s)||c&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||lt(s,u))||a.push(s);return a}var mt=Object.prototype;function At(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||mt)}function xt(t,e){return function(r){return t(e(r))}}var Et=xt(Object.keys,Object),St=Object.prototype.hasOwnProperty;function Pt(t){return null!=t&&pt(t.length)&&!x(t)}function Vt(t){return Pt(t)?Ot(t):function(t){if(!At(t))return Et(t);var e=[];for(var r in Object(t))St.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}var zt=Object.prototype.hasOwnProperty;function Ft(t){if(!A(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=At(t),r=[];for(var n in t)("constructor"!=n||!e&&zt.call(t,n))&&r.push(n);return r}function Ut(t){return Pt(t)?Ot(t,!0):Ft(t)}var It="object"==typeof t&&t&&!t.nodeType&&t,Lt=It&&"object"==typeof module&&module&&!module.nodeType&&module,kt=Lt&&Lt.exports===It?h.Buffer:void 0,Tt=kt?kt.allocUnsafe:void 0;function Ct(){return[]}var Dt=Object.prototype.propertyIsEnumerable,Mt=Object.getOwnPropertySymbols,Rt=Mt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var c=t[r];e(c,r,t)&&(i[o++]=c)}return i}(Mt(t),(function(e){return Dt.call(t,e)})))}:Ct,Bt=Rt;function Xt(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}var $t=xt(Object.getPrototypeOf,Object),Nt=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Xt(e,Bt(t)),t=$t(t);return e}:Ct;function Wt(t,e,r){var n=e(t);return it(t)?n:Xt(n,r(t))}function qt(t){return Wt(t,Vt,Bt)}function Gt(t){return Wt(t,Ut,Nt)}var Yt=D(h,"DataView"),Ht=D(h,"Promise"),Jt=D(h,"Set"),Kt=D(h,"WeakMap"),Qt="[object Map]",Zt="[object Promise]",te="[object Set]",ee="[object WeakMap]",re="[object DataView]",ne=z(Yt),oe=z(M),ie=z(Ht),ce=z(Jt),ae=z(Kt),ue=m;(Yt&&ue(new Yt(new ArrayBuffer(1)))!=re||M&&ue(new M)!=Qt||Ht&&ue(Ht.resolve())!=Zt||Jt&&ue(new Jt)!=te||Kt&&ue(new Kt)!=ee)&&(ue=function(t){var e=m(t),r="[object Object]"==e?t.constructor:void 0,n=r?z(r):"";if(n)switch(n){case ne:return re;case oe:return Qt;case ie:return Zt;case ce:return te;case ae:return ee}return e});var se=ue,fe=Object.prototype.hasOwnProperty;var le=h.Uint8Array;function pe(t){var e=new t.constructor(t.byteLength);return new le(e).set(new le(t)),e}var ve=/\w*$/;var ye=b?b.prototype:void 0,he=ye?ye.valueOf:void 0;function be(t,e,r){var n,o,i,c=t.constructor;switch(e){case"[object ArrayBuffer]":return pe(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return function(t,e){var r=e?pe(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var r=e?pe(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return(i=new(o=t).constructor(o.source,ve.exec(o))).lastIndex=o.lastIndex,i;case"[object Symbol]":return n=t,he?Object(he.call(n)):{}}}var de=Object.create,_e=function(){function t(){}return function(e){if(!A(e))return{};if(de)return de(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var je=_t&&_t.isMap,ge=je?yt(je):function(t){return Q(t)&&"[object Map]"==se(t)};var we=_t&&_t.isSet,Oe=we?yt(we):function(t){return Q(t)&&"[object Set]"==se(t)},me="[object Arguments]",Ae="[object Function]",xe="[object Object]",Ee={};function Se(t,e,r,n,o,i){var c,a=1&e,u=2&e,s=4&e;if(r&&(c=o?r(t,n,o,i):r(t)),void 0!==c)return c;if(!A(t))return t;var f=it(t);if(f){if(c=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&fe.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,c)}else{var l=se(t),p=l==Ae||"[object GeneratorFunction]"==l;if(st(t))return function(t,e){if(e)return t.slice();var r=t.length,n=Tt?Tt(r):new t.constructor(r);return t.copy(n),n}(t,a);if(l==xe||l==me||p&&!o){if(c=u||p?{}:function(t){return"function"!=typeof t.constructor||At(t)?{}:_e($t(t))}(t),!a)return u?function(t,e){return K(t,Nt(t),e)}(t,function(t,e){return t&&K(e,Ut(e),t)}(c,t)):function(t,e){return K(t,Bt(t),e)}(t,function(t,e){return t&&K(e,Vt(e),t)}(c,t))}else{if(!Ee[l])return o?t:{};c=be(t,l,a)}}i||(i=new q);var v=i.get(t);if(v)return v;i.set(t,c),Oe(t)?t.forEach((function(n){c.add(Se(n,e,r,n,t,i))})):ge(t)&&t.forEach((function(n,o){c.set(o,Se(n,e,r,o,t,i))}));var y=f?void 0:(s?u?Gt:qt:u?Ut:Vt)(t);return function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););}(y||t,(function(n,o){y&&(n=t[o=n]),J(c,o,Se(n,e,r,o,t,i))})),c}Ee[me]=Ee["[object Array]"]=Ee["[object ArrayBuffer]"]=Ee["[object DataView]"]=Ee["[object Boolean]"]=Ee["[object Date]"]=Ee["[object Float32Array]"]=Ee["[object Float64Array]"]=Ee["[object Int8Array]"]=Ee["[object Int16Array]"]=Ee["[object Int32Array]"]=Ee["[object Map]"]=Ee["[object Number]"]=Ee[xe]=Ee["[object RegExp]"]=Ee["[object Set]"]=Ee["[object String]"]=Ee["[object Symbol]"]=Ee["[object Uint8Array]"]=Ee["[object Uint8ClampedArray]"]=Ee["[object Uint16Array]"]=Ee["[object Uint32Array]"]=!0,Ee["[object Error]"]=Ee[Ae]=Ee["[object WeakMap]"]=!1;var Pe=new Map;function Ve(t,e,r,n,o,i){if(Pe.has(r)||Pe.set(r,[]),!(Pe.get(r).indexOf(t)>-1)){Pe.get(r).push(t);for(var c=t.split("."),a=r,u=c.length,s=0;s<u-1;s++){if(void 0===a[c[s]])return;a=a[c[s]]}var f=a[c[u-1]];if(e&&A(f))for(var l in f)Ve(l,e,f,n,o,i);var p="_"+c[u-1];a[p]=f,Object.defineProperty(a,p,{enumerable:!1}),Object.defineProperty(a,c[u-1],{set:function(t){var r=function(t){return Se(t,5)}(o);if(a["_"+c[u-1]]=t,i(n,r),e&&A(t))for(var s in Pe.delete(a),t)Ve(s,e,t,n,o,i)},get:function(){return a["_"+c[u-1]]}})}}function ze(t,e,r){for(var n in t)n in e&&("object"==typeof t[n]?ze(t[n],e[n],r):(r||t[n]!==e[n])&&(t[n]=e[n]))}var Fe=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.changeList=[],e}return n(r,t),r.prototype.init=function(t){var e=(void 0===t?{store:{}}:t).store,r=void 0===e?{}:e;this.ee=new u,this.store=r,this.bindDefaultListener()},r.prototype.bindDefaultListener=function(){var t=this;this.ee.on("evax.updateStore",(function(e){t.updateStore(e)})),this.ee.on("evax.forceUpdateStore",(function(e){t.forceUpdateStore(e)}))},r.prototype.changeCallback=function(t,e){this.changeList.push({key:t,oldStore:e})},r.prototype.updateStore=function(t){ze(this.store,t,!1)},r.prototype.forceUpdateStore=function(t){ze(this.store,t,!0)},r.prototype.bindListener=function(t,e){var r=this;-1!==t.indexOf("store.")&&Ve(t.split(".").slice(1).join("."),e,this.store,t,this.store,(function(t,e){return r.changeCallback(t,e)}))},r.prototype.update=function(){var t,r,n=this.componentObserver.clear();try{for(var i=o(n),c=i.next();!c.done;c=i.next()){var a=c.value;switch(a.type){case e.OBSERVER_TYPE.ADD:this.add(a);break;case e.OBSERVER_TYPE.REMOVE:this.remove(a)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},r.prototype.lateUpdate=function(){var t,e;try{for(var r=o(this.changeList),n=r.next();!n.done;n=r.next()){var i=n.value;this.ee.emit(i.key,this.store,i.oldStore)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.changeList=[]},r.prototype.add=function(t){var e=t.component;for(var r in e.evax=this,e.events)if(e.events[r]){this.bindListener(r,!!e.events[r].deep);var n=void 0;n=e.events[r]instanceof Function?e.events[r]:e.events[r].handler,this.ee.on(r,n.bind(e))}},r.prototype.remove=function(t){var e=t.component;for(var r in e.events)e.events[r]instanceof Function&&this.ee.off(r,e.events[r].bind(e))},r.prototype.on=function(t,e){return this.ee.on(t,e,this)},r.prototype.off=function(t,e){return this.ee.off(t,e)},r.prototype.emit=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(e=this.ee).emit.apply(e,function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t}([t],r))},r.prototype.onDestroy=function(){},r.systemName="EvaX",r=function(t,e,r,n){var o,i=arguments.length,c=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(c=(i<3?o(c):i>3?o(e,r,c):o(e,r))||c);return i>3&&c&&Object.defineProperty(e,r,c),c}([e.decorators.componentObserver({EvaX:[]})],r),r}(e.System),Ue=Fe,Ie={Components:[c],Systems:[Ue]};return t.EvaX=c,t.EvaXSystem=Ue,t.default=Ie,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.EVAX=window.EVA.plugin.EVAX||_EVA_IIFE_EVAX;
|
|
1
|
+
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_EVAX=function(t,e){"use strict";class r extends e.Component{constructor(t){super(t),this.events={}}init(t={events:{}}){const{events:e}=t;this.events=e||{}}}r.componentName="EvaX";var n=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function c(t,e,n,c,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,c||t,i),s=r?r+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],a]:t._events[s].push(a):(t._events[s]=a,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,c=n.length,i=new Array(c);o<c;o++)i[o]=n[o].fn;return i},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,o,c,i){var a=r?r+t:t;if(!this._events[a])return!1;var s,u,f=this._events[a],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,n),!0;case 4:return f.fn.call(f.context,e,n,o),!0;case 5:return f.fn.call(f.context,e,n,o,c),!0;case 6:return f.fn.call(f.context,e,n,o,c,i),!0}for(u=1,s=new Array(l-1);u<l;u++)s[u-1]=arguments[u];f.fn.apply(f.context,s)}else{var p,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(t,f[u].fn,void 0,!0),l){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,e);break;case 3:f[u].fn.call(f[u].context,e,n);break;case 4:f[u].fn.call(f[u].context,e,n,o);break;default:if(!s)for(p=1,s=new Array(l-1);p<l;p++)s[p-1]=arguments[p];f[u].fn.apply(f[u].context,s)}}return!0},a.prototype.on=function(t,e,r){return c(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return c(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,o){var c=r?r+t:t;if(!this._events[c])return this;if(!e)return i(this,c),this;var a=this._events[c];if(a.fn)a.fn!==e||o&&!a.once||n&&a.context!==n||i(this,c);else{for(var s=0,u=[],f=a.length;s<f;s++)(a[s].fn!==e||o&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[c]=1===u.length?u[0]:u:i(this,c)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&i(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a})),o=n;function c(t,e){return t===e||t!=t&&e!=e}function i(t,e){for(var r=t.length;r--;)if(c(t[r][0],e))return r;return-1}var a=Array.prototype.splice;function s(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}s.prototype.clear=function(){this.__data__=[],this.size=0},s.prototype.delete=function(t){var e=this.__data__,r=i(e,t);return!(r<0)&&(r==e.length-1?e.pop():a.call(e,r,1),--this.size,!0)},s.prototype.get=function(t){var e=this.__data__,r=i(e,t);return r<0?void 0:e[r][1]},s.prototype.has=function(t){return i(this.__data__,t)>-1},s.prototype.set=function(t,e){var r=this.__data__,n=i(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var u="object"==typeof global&&global&&global.Object===Object&&global,f="object"==typeof self&&self&&self.Object===Object&&self,l=u||f||Function("return this")(),p=l.Symbol,h=Object.prototype,v=h.hasOwnProperty,b=h.toString,y=p?p.toStringTag:void 0;var _=Object.prototype.toString;var d=p?p.toStringTag:void 0;function j(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":d&&d in Object(t)?function(t){var e=v.call(t,y),r=t[y];try{t[y]=void 0;var n=!0}catch(t){}var o=b.call(t);return n&&(e?t[y]=r:delete t[y]),o}(t):function(t){return _.call(t)}(t)}function g(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function w(t){if(!g(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var O,m=l["__core-js_shared__"],A=(O=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||""))?"Symbol(src)_1."+O:"";var x=Function.prototype.toString;function E(t){if(null!=t){try{return x.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var S=/^\[object .+?Constructor\]$/,P=Function.prototype,V=Object.prototype,z=P.toString,F=V.hasOwnProperty,U=RegExp("^"+z.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function I(t){return!(!g(t)||(e=t,A&&A in e))&&(w(t)?U:S).test(E(t));var e}function L(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return I(r)?r:void 0}var k=L(l,"Map"),C=L(Object,"create");var D=Object.prototype.hasOwnProperty;var M=Object.prototype.hasOwnProperty;function T(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function R(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function B(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}T.prototype.clear=function(){this.__data__=C?C(null):{},this.size=0},T.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},T.prototype.get=function(t){var e=this.__data__;if(C){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return D.call(e,t)?e[t]:void 0},T.prototype.has=function(t){var e=this.__data__;return C?void 0!==e[t]:M.call(e,t)},T.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&void 0===e?"__lodash_hash_undefined__":e,this},B.prototype.clear=function(){this.size=0,this.__data__={hash:new T,map:new(k||s),string:new T}},B.prototype.delete=function(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e},B.prototype.get=function(t){return R(this,t).get(t)},B.prototype.has=function(t){return R(this,t).has(t)},B.prototype.set=function(t,e){var r=R(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function $(t){var e=this.__data__=new s(t);this.size=e.size}$.prototype.clear=function(){this.__data__=new s,this.size=0},$.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},$.prototype.get=function(t){return this.__data__.get(t)},$.prototype.has=function(t){return this.__data__.has(t)},$.prototype.set=function(t,e){var r=this.__data__;if(r instanceof s){var n=r.__data__;if(!k||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new B(n)}return r.set(t,e),this.size=r.size,this};var X=function(){try{var t=L(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function N(t,e,r){"__proto__"==e&&X?X(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var W=Object.prototype.hasOwnProperty;function q(t,e,r){var n=t[e];W.call(t,e)&&c(n,r)&&(void 0!==r||e in t)||N(t,e,r)}function G(t,e,r,n){var o=!r;r||(r={});for(var c=-1,i=e.length;++c<i;){var a=e[c],s=n?n(r[a],t[a],a,r,t):void 0;void 0===s&&(s=t[a]),o?N(r,a,s):q(r,a,s)}return r}function Y(t){return null!=t&&"object"==typeof t}function H(t){return Y(t)&&"[object Arguments]"==j(t)}var J=Object.prototype,K=J.hasOwnProperty,Q=J.propertyIsEnumerable,Z=H(function(){return arguments}())?H:function(t){return Y(t)&&K.call(t,"callee")&&!Q.call(t,"callee")},tt=Z,et=Array.isArray;var rt="object"==typeof t&&t&&!t.nodeType&&t,nt=rt&&"object"==typeof module&&module&&!module.nodeType&&module,ot=nt&&nt.exports===rt?l.Buffer:void 0,ct=(ot?ot.isBuffer:void 0)||function(){return!1},it=/^(?:0|[1-9]\d*)$/;function at(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&it.test(t))&&t>-1&&t%1==0&&t<e}function st(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var ut={};function ft(t){return function(e){return t(e)}}ut["[object Float32Array]"]=ut["[object Float64Array]"]=ut["[object Int8Array]"]=ut["[object Int16Array]"]=ut["[object Int32Array]"]=ut["[object Uint8Array]"]=ut["[object Uint8ClampedArray]"]=ut["[object Uint16Array]"]=ut["[object Uint32Array]"]=!0,ut["[object Arguments]"]=ut["[object Array]"]=ut["[object ArrayBuffer]"]=ut["[object Boolean]"]=ut["[object DataView]"]=ut["[object Date]"]=ut["[object Error]"]=ut["[object Function]"]=ut["[object Map]"]=ut["[object Number]"]=ut["[object Object]"]=ut["[object RegExp]"]=ut["[object Set]"]=ut["[object String]"]=ut["[object WeakMap]"]=!1;var lt="object"==typeof t&&t&&!t.nodeType&&t,pt=lt&&"object"==typeof module&&module&&!module.nodeType&&module,ht=pt&&pt.exports===lt&&u.process,vt=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||ht&&ht.binding&&ht.binding("util")}catch(t){}}(),bt=vt&&vt.isTypedArray,yt=bt?ft(bt):function(t){return Y(t)&&st(t.length)&&!!ut[j(t)]},_t=Object.prototype.hasOwnProperty;function dt(t,e){var r=et(t),n=!r&&tt(t),o=!r&&!n&&ct(t),c=!r&&!n&&!o&&yt(t),i=r||n||o||c,a=i?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],s=a.length;for(var u in t)!e&&!_t.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||c&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||at(u,s))||a.push(u);return a}var jt=Object.prototype;function gt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function wt(t,e){return function(r){return t(e(r))}}var Ot=wt(Object.keys,Object),mt=Object.prototype.hasOwnProperty;function At(t){return null!=t&&st(t.length)&&!w(t)}function xt(t){return At(t)?dt(t):function(t){if(!gt(t))return Ot(t);var e=[];for(var r in Object(t))mt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}var Et=Object.prototype.hasOwnProperty;function St(t){if(!g(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=gt(t),r=[];for(var n in t)("constructor"!=n||!e&&Et.call(t,n))&&r.push(n);return r}function Pt(t){return At(t)?dt(t,!0):St(t)}var Vt="object"==typeof t&&t&&!t.nodeType&&t,zt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=zt&&zt.exports===Vt?l.Buffer:void 0,Ut=Ft?Ft.allocUnsafe:void 0;function It(){return[]}var Lt=Object.prototype.propertyIsEnumerable,kt=Object.getOwnPropertySymbols,Ct=kt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,c=[];++r<n;){var i=t[r];e(i,r,t)&&(c[o++]=i)}return c}(kt(t),(function(e){return Lt.call(t,e)})))}:It,Dt=Ct;function Mt(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}var Tt=wt(Object.getPrototypeOf,Object),Rt=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Mt(e,Dt(t)),t=Tt(t);return e}:It;function Bt(t,e,r){var n=e(t);return et(t)?n:Mt(n,r(t))}function $t(t){return Bt(t,xt,Dt)}function Xt(t){return Bt(t,Pt,Rt)}var Nt=L(l,"DataView"),Wt=L(l,"Promise"),qt=L(l,"Set"),Gt=L(l,"WeakMap"),Yt="[object Map]",Ht="[object Promise]",Jt="[object Set]",Kt="[object WeakMap]",Qt="[object DataView]",Zt=E(Nt),te=E(k),ee=E(Wt),re=E(qt),ne=E(Gt),oe=j;(Nt&&oe(new Nt(new ArrayBuffer(1)))!=Qt||k&&oe(new k)!=Yt||Wt&&oe(Wt.resolve())!=Ht||qt&&oe(new qt)!=Jt||Gt&&oe(new Gt)!=Kt)&&(oe=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?E(r):"";if(n)switch(n){case Zt:return Qt;case te:return Yt;case ee:return Ht;case re:return Jt;case ne:return Kt}return e});var ce=oe,ie=Object.prototype.hasOwnProperty;var ae=l.Uint8Array;function se(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e}var ue=/\w*$/;var fe=p?p.prototype:void 0,le=fe?fe.valueOf:void 0;function pe(t,e,r){var n,o,c,i=t.constructor;switch(e){case"[object ArrayBuffer]":return se(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t,e){var r=e?se(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var r=e?se(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return(c=new(o=t).constructor(o.source,ue.exec(o))).lastIndex=o.lastIndex,c;case"[object Symbol]":return n=t,le?Object(le.call(n)):{}}}var he=Object.create,ve=function(){function t(){}return function(e){if(!g(e))return{};if(he)return he(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var be=vt&&vt.isMap,ye=be?ft(be):function(t){return Y(t)&&"[object Map]"==ce(t)};var _e=vt&&vt.isSet,de=_e?ft(_e):function(t){return Y(t)&&"[object Set]"==ce(t)},je="[object Arguments]",ge="[object Function]",we="[object Object]",Oe={};function me(t,e,r,n,o,c){var i,a=1&e,s=2&e,u=4&e;if(r&&(i=o?r(t,n,o,c):r(t)),void 0!==i)return i;if(!g(t))return t;var f=et(t);if(f){if(i=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&ie.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,i)}else{var l=ce(t),p=l==ge||"[object GeneratorFunction]"==l;if(ct(t))return function(t,e){if(e)return t.slice();var r=t.length,n=Ut?Ut(r):new t.constructor(r);return t.copy(n),n}(t,a);if(l==we||l==je||p&&!o){if(i=s||p?{}:function(t){return"function"!=typeof t.constructor||gt(t)?{}:ve(Tt(t))}(t),!a)return s?function(t,e){return G(t,Rt(t),e)}(t,function(t,e){return t&&G(e,Pt(e),t)}(i,t)):function(t,e){return G(t,Dt(t),e)}(t,function(t,e){return t&&G(e,xt(e),t)}(i,t))}else{if(!Oe[l])return o?t:{};i=pe(t,l,a)}}c||(c=new $);var h=c.get(t);if(h)return h;c.set(t,i),de(t)?t.forEach((function(n){i.add(me(n,e,r,n,t,c))})):ye(t)&&t.forEach((function(n,o){i.set(o,me(n,e,r,o,t,c))}));var v=f?void 0:(u?s?Xt:$t:s?Pt:xt)(t);return function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););}(v||t,(function(n,o){v&&(n=t[o=n]),q(i,o,me(n,e,r,o,t,c))})),i}Oe[je]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object DataView]"]=Oe["[object Boolean]"]=Oe["[object Date]"]=Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe[we]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object Symbol]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Error]"]=Oe[ge]=Oe["[object WeakMap]"]=!1;const Ae=new Map;function xe(t,e,r,n,o,c){if(Ae.has(r)||Ae.set(r,[]),Ae.get(r).indexOf(t)>-1)return;Ae.get(r).push(t);const i=t.split(".");let a=r;const s=i.length;for(let t=0;t<s-1;t++){if(void 0===a[i[t]])return;a=a[i[t]]}const u=a[i[s-1]];if(e&&g(u))for(const t in u)xe(t,e,u,n,o,c);const f=`_${i[s-1]}`;a[f]=u,Object.defineProperty(a,f,{enumerable:!1}),Object.defineProperty(a,i[s-1],{set(t){const r=function(t){return me(t,5)}(o);if(a[`_${i[s-1]}`]=t,c(n,r),e&&g(t)){Ae.delete(a);for(const r in t)xe(r,e,t,n,o,c)}},get:()=>a[`_${i[s-1]}`]})}function Ee(t,e,r){for(const n in t)n in e&&("object"==typeof t[n]?Ee(t[n],e[n],r):(r||t[n]!==e[n])&&(t[n]=e[n]))}let Se=class extends e.System{constructor(){super(...arguments),this.changeList=[]}init({store:t={}}={store:{}}){this.ee=new o,this.store=t,this.bindDefaultListener()}bindDefaultListener(){this.ee.on("evax.updateStore",(t=>{this.updateStore(t)})),this.ee.on("evax.forceUpdateStore",(t=>{this.forceUpdateStore(t)}))}changeCallback(t,e){this.changeList.push({key:t,oldStore:e})}updateStore(t){Ee(this.store,t,!1)}forceUpdateStore(t){Ee(this.store,t,!0)}bindListener(t,e){if(-1===t.indexOf("store."))return;xe(t.split(".").slice(1).join("."),e,this.store,t,this.store,((t,e)=>this.changeCallback(t,e)))}update(){const t=this.componentObserver.clear();for(const r of t)switch(r.type){case e.OBSERVER_TYPE.ADD:this.add(r);break;case e.OBSERVER_TYPE.REMOVE:this.remove(r)}}lateUpdate(){for(const t of this.changeList)this.ee.emit(t.key,this.store,t.oldStore);this.changeList=[]}add(t){const e=t.component;e.evax=this;for(const t in e.events)if(e.events[t]){let r;this.bindListener(t,!!e.events[t].deep),r=e.events[t]instanceof Function?e.events[t]:e.events[t].handler,this.ee.on(t,r.bind(e))}}remove(t){const e=t.component;for(const t in e.events)e.events[t]instanceof Function&&this.ee.off(t,e.events[t].bind(e))}on(t,e){return this.ee.on(t,e,this)}off(t,e){return this.ee.off(t,e)}emit(t,...e){return this.ee.emit(t,...e)}onDestroy(){}};Se.systemName="EvaX",Se=function(t,e,r,n){var o,c=arguments.length,i=c<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(c<3?o(i):c>3?o(e,r,i):o(e,r))||i);return c>3&&i&&Object.defineProperty(e,r,i),i}([e.decorators.componentObserver({EvaX:[]})],Se);var Pe=Se,Ve={Components:[r],Systems:[Pe]};return t.EvaX=r,t.EvaXSystem=Pe,t.default=Ve,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.EVAX=window.EVA.plugin.EVAX||_EVA_IIFE_EVAX;
|
package/dist/plugin-evax.cjs.js
CHANGED
|
@@ -13,6 +13,18 @@ var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
|
|
13
13
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
14
14
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
15
15
|
|
|
16
|
+
class EvaXComponent extends eva_js.Component {
|
|
17
|
+
constructor(gameObject) {
|
|
18
|
+
super(gameObject);
|
|
19
|
+
this.events = {};
|
|
20
|
+
}
|
|
21
|
+
init(option = { events: {} }) {
|
|
22
|
+
const { events } = option;
|
|
23
|
+
this.events = events || {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
EvaXComponent.componentName = 'EvaX';
|
|
27
|
+
|
|
16
28
|
/*! *****************************************************************************
|
|
17
29
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
30
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -27,80 +39,15 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
27
39
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
28
40
|
and limitations under the License.
|
|
29
41
|
***************************************************************************** */
|
|
30
|
-
/* global Reflect, Promise */
|
|
31
|
-
|
|
32
|
-
var extendStatics = function(d, b) {
|
|
33
|
-
extendStatics = Object.setPrototypeOf ||
|
|
34
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
36
|
-
return extendStatics(d, b);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function __extends(d, b) {
|
|
40
|
-
extendStatics(d, b);
|
|
41
|
-
function __() { this.constructor = d; }
|
|
42
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
43
|
-
}
|
|
44
42
|
|
|
45
43
|
function __decorate(decorators, target, key, desc) {
|
|
46
44
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
47
45
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
48
46
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
49
47
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function __values(o) {
|
|
53
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
54
|
-
if (m) return m.call(o);
|
|
55
|
-
return {
|
|
56
|
-
next: function () {
|
|
57
|
-
if (o && i >= o.length) o = void 0;
|
|
58
|
-
return { value: o && o[i++], done: !o };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function __read(o, n) {
|
|
64
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
65
|
-
if (!m) return o;
|
|
66
|
-
var i = m.call(o), r, ar = [], e;
|
|
67
|
-
try {
|
|
68
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
69
|
-
}
|
|
70
|
-
catch (error) { e = { error: error }; }
|
|
71
|
-
finally {
|
|
72
|
-
try {
|
|
73
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
74
|
-
}
|
|
75
|
-
finally { if (e) throw e.error; }
|
|
76
|
-
}
|
|
77
|
-
return ar;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function __spread() {
|
|
81
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
82
|
-
ar = ar.concat(__read(arguments[i]));
|
|
83
|
-
return ar;
|
|
84
48
|
}
|
|
85
49
|
|
|
86
|
-
|
|
87
|
-
__extends(EvaXComponent, _super);
|
|
88
|
-
function EvaXComponent(gameObject) {
|
|
89
|
-
var _this = _super.call(this, gameObject) || this;
|
|
90
|
-
_this.events = {};
|
|
91
|
-
return _this;
|
|
92
|
-
}
|
|
93
|
-
EvaXComponent.prototype.init = function (option) {
|
|
94
|
-
if (option === void 0) { option = { events: {} }; }
|
|
95
|
-
var events = option.events;
|
|
96
|
-
this.events = events || {};
|
|
97
|
-
};
|
|
98
|
-
EvaXComponent.componentName = 'EvaX';
|
|
99
|
-
return EvaXComponent;
|
|
100
|
-
}(eva_js.Component));
|
|
101
|
-
var EvaXComponent$1 = EvaXComponent;
|
|
102
|
-
|
|
103
|
-
var _defineCache = new Map();
|
|
50
|
+
const _defineCache = new Map();
|
|
104
51
|
function defineProperty(key, deep, store, originKey, originStore, callback) {
|
|
105
52
|
if (!_defineCache.has(store)) {
|
|
106
53
|
_defineCache.set(store, []);
|
|
@@ -109,45 +56,45 @@ function defineProperty(key, deep, store, originKey, originStore, callback) {
|
|
|
109
56
|
return;
|
|
110
57
|
}
|
|
111
58
|
_defineCache.get(store).push(key);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
for (
|
|
59
|
+
const props = key.split('.');
|
|
60
|
+
let obj = store;
|
|
61
|
+
const length = props.length;
|
|
62
|
+
for (let i = 0; i < length - 1; i++) {
|
|
116
63
|
if (obj[props[i]] === undefined) {
|
|
117
64
|
return;
|
|
118
65
|
}
|
|
119
66
|
obj = obj[props[i]];
|
|
120
67
|
}
|
|
121
|
-
|
|
68
|
+
const value = obj[props[length - 1]];
|
|
122
69
|
if (deep && isObject__default(value)) {
|
|
123
|
-
for (
|
|
124
|
-
defineProperty(
|
|
70
|
+
for (const key in value) {
|
|
71
|
+
defineProperty(key, deep, value, originKey, originStore, callback);
|
|
125
72
|
}
|
|
126
73
|
}
|
|
127
|
-
|
|
74
|
+
const _key = `_${props[length - 1]}`;
|
|
128
75
|
obj[_key] = value;
|
|
129
76
|
Object.defineProperty(obj, _key, {
|
|
130
77
|
enumerable: false,
|
|
131
78
|
});
|
|
132
79
|
Object.defineProperty(obj, props[length - 1], {
|
|
133
|
-
set
|
|
134
|
-
|
|
135
|
-
obj[
|
|
80
|
+
set(val) {
|
|
81
|
+
const oldStore = cloneDeep__default(originStore);
|
|
82
|
+
obj[`_${props[length - 1]}`] = val;
|
|
136
83
|
callback(originKey, oldStore);
|
|
137
84
|
if (deep && isObject__default(val)) {
|
|
138
85
|
_defineCache.delete(obj);
|
|
139
|
-
for (
|
|
140
|
-
defineProperty(
|
|
86
|
+
for (const key in val) {
|
|
87
|
+
defineProperty(key, deep, val, originKey, originStore, callback);
|
|
141
88
|
}
|
|
142
89
|
}
|
|
143
90
|
},
|
|
144
|
-
get
|
|
145
|
-
return obj[
|
|
91
|
+
get() {
|
|
92
|
+
return obj[`_${props[length - 1]}`];
|
|
146
93
|
},
|
|
147
94
|
});
|
|
148
95
|
}
|
|
149
96
|
function updateStore(store, newStore, force) {
|
|
150
|
-
for (
|
|
97
|
+
for (const key in store) {
|
|
151
98
|
if (!(key in newStore)) {
|
|
152
99
|
continue;
|
|
153
100
|
}
|
|
@@ -162,96 +109,69 @@ function updateStore(store, newStore, force) {
|
|
|
162
109
|
}
|
|
163
110
|
}
|
|
164
111
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
_this.changeList = [];
|
|
170
|
-
return _this;
|
|
112
|
+
let EvaXSystem = class EvaXSystem extends eva_js.System {
|
|
113
|
+
constructor() {
|
|
114
|
+
super(...arguments);
|
|
115
|
+
this.changeList = [];
|
|
171
116
|
}
|
|
172
|
-
|
|
173
|
-
var _b = (_a === void 0 ? { store: {} } : _a).store, store = _b === void 0 ? {} : _b;
|
|
117
|
+
init({ store = {} } = { store: {} }) {
|
|
174
118
|
this.ee = new EventEmitter__default();
|
|
175
119
|
this.store = store;
|
|
176
120
|
this.bindDefaultListener();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
_this.updateStore(store);
|
|
121
|
+
}
|
|
122
|
+
bindDefaultListener() {
|
|
123
|
+
this.ee.on('evax.updateStore', store => {
|
|
124
|
+
this.updateStore(store);
|
|
182
125
|
});
|
|
183
|
-
this.ee.on('evax.forceUpdateStore',
|
|
184
|
-
|
|
126
|
+
this.ee.on('evax.forceUpdateStore', store => {
|
|
127
|
+
this.forceUpdateStore(store);
|
|
185
128
|
});
|
|
186
|
-
}
|
|
187
|
-
|
|
129
|
+
}
|
|
130
|
+
changeCallback(key, oldStore) {
|
|
188
131
|
this.changeList.push({
|
|
189
132
|
key: key,
|
|
190
133
|
oldStore: oldStore,
|
|
191
134
|
});
|
|
192
|
-
}
|
|
193
|
-
|
|
135
|
+
}
|
|
136
|
+
updateStore(store) {
|
|
194
137
|
updateStore(this.store, store, false);
|
|
195
|
-
}
|
|
196
|
-
|
|
138
|
+
}
|
|
139
|
+
forceUpdateStore(store) {
|
|
197
140
|
updateStore(this.store, store, true);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
var _this = this;
|
|
141
|
+
}
|
|
142
|
+
bindListener(key, deep) {
|
|
201
143
|
if (key.indexOf('store.') === -1) {
|
|
202
144
|
return;
|
|
203
145
|
}
|
|
204
|
-
|
|
205
|
-
defineProperty(realKey, deep, this.store, key, this.store,
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
case eva_js.OBSERVER_TYPE.REMOVE:
|
|
218
|
-
this.remove(changed);
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
224
|
-
finally {
|
|
225
|
-
try {
|
|
226
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
227
|
-
}
|
|
228
|
-
finally { if (e_1) throw e_1.error; }
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
EvaXSystem.prototype.lateUpdate = function () {
|
|
232
|
-
var e_2, _a;
|
|
233
|
-
try {
|
|
234
|
-
for (var _b = __values(this.changeList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
235
|
-
var item = _c.value;
|
|
236
|
-
this.ee.emit(item.key, this.store, item.oldStore);
|
|
146
|
+
const realKey = key.split('.').slice(1).join('.');
|
|
147
|
+
defineProperty(realKey, deep, this.store, key, this.store, (key, oldStore) => this.changeCallback(key, oldStore));
|
|
148
|
+
}
|
|
149
|
+
update() {
|
|
150
|
+
const changes = this.componentObserver.clear();
|
|
151
|
+
for (const changed of changes) {
|
|
152
|
+
switch (changed.type) {
|
|
153
|
+
case eva_js.OBSERVER_TYPE.ADD:
|
|
154
|
+
this.add(changed);
|
|
155
|
+
break;
|
|
156
|
+
case eva_js.OBSERVER_TYPE.REMOVE:
|
|
157
|
+
this.remove(changed);
|
|
158
|
+
break;
|
|
237
159
|
}
|
|
238
160
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
finally { if (e_2) throw e_2.error; }
|
|
161
|
+
}
|
|
162
|
+
lateUpdate() {
|
|
163
|
+
for (const item of this.changeList) {
|
|
164
|
+
this.ee.emit(item.key, this.store, item.oldStore);
|
|
245
165
|
}
|
|
246
166
|
this.changeList = [];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
167
|
+
}
|
|
168
|
+
add(changed) {
|
|
169
|
+
const component = changed.component;
|
|
250
170
|
component.evax = this;
|
|
251
|
-
for (
|
|
171
|
+
for (const key in component.events) {
|
|
252
172
|
if (component.events[key]) {
|
|
253
173
|
this.bindListener(key, !!component.events[key].deep);
|
|
254
|
-
|
|
174
|
+
let func;
|
|
255
175
|
if (component.events[key] instanceof Function) {
|
|
256
176
|
func = component.events[key];
|
|
257
177
|
}
|
|
@@ -261,45 +181,39 @@ var EvaXSystem = (function (_super) {
|
|
|
261
181
|
this.ee.on(key, func.bind(component));
|
|
262
182
|
}
|
|
263
183
|
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
for (
|
|
184
|
+
}
|
|
185
|
+
remove(changed) {
|
|
186
|
+
const component = changed.component;
|
|
187
|
+
for (const key in component.events) {
|
|
268
188
|
if (component.events[key] instanceof Function) {
|
|
269
189
|
this.ee.off(key, component.events[key].bind(component));
|
|
270
190
|
}
|
|
271
191
|
}
|
|
272
|
-
}
|
|
273
|
-
|
|
192
|
+
}
|
|
193
|
+
on(eventName, func) {
|
|
274
194
|
return this.ee.on(eventName, func, this);
|
|
275
|
-
}
|
|
276
|
-
|
|
195
|
+
}
|
|
196
|
+
off(eventName, func) {
|
|
277
197
|
return this.ee.off(eventName, func);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
eva_js.decorators.componentObserver({
|
|
291
|
-
EvaX: [],
|
|
292
|
-
})
|
|
293
|
-
], EvaXSystem);
|
|
294
|
-
return EvaXSystem;
|
|
295
|
-
}(eva_js.System));
|
|
198
|
+
}
|
|
199
|
+
emit(eventName, ...args) {
|
|
200
|
+
return this.ee.emit(eventName, ...args);
|
|
201
|
+
}
|
|
202
|
+
onDestroy() { }
|
|
203
|
+
};
|
|
204
|
+
EvaXSystem.systemName = 'EvaX';
|
|
205
|
+
EvaXSystem = __decorate([
|
|
206
|
+
eva_js.decorators.componentObserver({
|
|
207
|
+
EvaX: [],
|
|
208
|
+
})
|
|
209
|
+
], EvaXSystem);
|
|
296
210
|
var EvaXSystem$1 = EvaXSystem;
|
|
297
211
|
|
|
298
212
|
var index = {
|
|
299
|
-
Components: [EvaXComponent
|
|
213
|
+
Components: [EvaXComponent],
|
|
300
214
|
Systems: [EvaXSystem$1],
|
|
301
215
|
};
|
|
302
216
|
|
|
303
|
-
exports.EvaX = EvaXComponent
|
|
217
|
+
exports.EvaX = EvaXComponent;
|
|
304
218
|
exports.EvaXSystem = EvaXSystem$1;
|
|
305
219
|
exports["default"] = index;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("eventemitter3"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("eventemitter3"),s=require("lodash-es/cloneDeep"),n=require("lodash-es/isObject");function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=o(t),i=o(s),c=o(n);class a extends e.Component{constructor(e){super(e),this.events={}}init(e={events:{}}){const{events:t}=e;this.events=t||{}}}a.componentName="EvaX";const f=new Map;function h(e,t,s,n,o,r){if(f.has(s)||f.set(s,[]),f.get(s).indexOf(e)>-1)return;f.get(s).push(e);const a=e.split(".");let d=s;const l=a.length;for(let e=0;e<l-1;e++){if(void 0===d[a[e]])return;d=d[a[e]]}const p=d[a[l-1]];if(t&&c(p))for(const e in p)h(e,t,p,n,o,r);const u=`_${a[l-1]}`;d[u]=p,Object.defineProperty(d,u,{enumerable:!1}),Object.defineProperty(d,a[l-1],{set(e){const s=i(o);if(d[`_${a[l-1]}`]=e,r(n,s),t&&c(e)){f.delete(d);for(const s in e)h(s,t,e,n,o,r)}},get:()=>d[`_${a[l-1]}`]})}function d(e,t,s){for(const n in e)n in t&&("object"==typeof e[n]?d(e[n],t[n],s):(s||e[n]!==t[n])&&(e[n]=t[n]))}let l=class extends e.System{constructor(){super(...arguments),this.changeList=[]}init({store:e={}}={store:{}}){this.ee=new r,this.store=e,this.bindDefaultListener()}bindDefaultListener(){this.ee.on("evax.updateStore",(e=>{this.updateStore(e)})),this.ee.on("evax.forceUpdateStore",(e=>{this.forceUpdateStore(e)}))}changeCallback(e,t){this.changeList.push({key:e,oldStore:t})}updateStore(e){d(this.store,e,!1)}forceUpdateStore(e){d(this.store,e,!0)}bindListener(e,t){if(-1===e.indexOf("store."))return;h(e.split(".").slice(1).join("."),t,this.store,e,this.store,((e,t)=>this.changeCallback(e,t)))}update(){const t=this.componentObserver.clear();for(const s of t)switch(s.type){case e.OBSERVER_TYPE.ADD:this.add(s);break;case e.OBSERVER_TYPE.REMOVE:this.remove(s)}}lateUpdate(){for(const e of this.changeList)this.ee.emit(e.key,this.store,e.oldStore);this.changeList=[]}add(e){const t=e.component;t.evax=this;for(const e in t.events)if(t.events[e]){let s;this.bindListener(e,!!t.events[e].deep),s=t.events[e]instanceof Function?t.events[e]:t.events[e].handler,this.ee.on(e,s.bind(t))}}remove(e){const t=e.component;for(const e in t.events)t.events[e]instanceof Function&&this.ee.off(e,t.events[e].bind(t))}on(e,t){return this.ee.on(e,t,this)}off(e,t){return this.ee.off(e,t)}emit(e,...t){return this.ee.emit(e,...t)}onDestroy(){}};l.systemName="EvaX",l=
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
|
|
13
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
+
and limitations under the License.
|
|
15
|
+
***************************************************************************** */
|
|
16
|
+
function(e,t,s,n){var o,r=arguments.length,i=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(r<3?o(i):r>3?o(t,s,i):o(t,s))||i);return r>3&&i&&Object.defineProperty(t,s,i),i}([e.decorators.componentObserver({EvaX:[]})],l);var p=l,u={Components:[a],Systems:[p]};exports.EvaX=a,exports.EvaXSystem=p,exports.default=u;
|
package/dist/plugin-evax.esm.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { Component, OBSERVER_TYPE, decorators
|
|
1
|
+
import { Component, System, OBSERVER_TYPE, decorators } from '@eva/eva.js';
|
|
2
2
|
import EventEmitter from 'eventemitter3';
|
|
3
3
|
import cloneDeep from 'lodash-es/cloneDeep';
|
|
4
4
|
import isObject from 'lodash-es/isObject';
|
|
5
5
|
|
|
6
|
+
class EvaXComponent extends Component {
|
|
7
|
+
constructor(gameObject) {
|
|
8
|
+
super(gameObject);
|
|
9
|
+
this.events = {};
|
|
10
|
+
}
|
|
11
|
+
init(option = { events: {} }) {
|
|
12
|
+
const { events } = option;
|
|
13
|
+
this.events = events || {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
EvaXComponent.componentName = 'EvaX';
|
|
17
|
+
|
|
6
18
|
/*! *****************************************************************************
|
|
7
19
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
20
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -17,80 +29,15 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
17
29
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
18
30
|
and limitations under the License.
|
|
19
31
|
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise */
|
|
21
|
-
|
|
22
|
-
var extendStatics = function(d, b) {
|
|
23
|
-
extendStatics = Object.setPrototypeOf ||
|
|
24
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
25
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
26
|
-
return extendStatics(d, b);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function __extends(d, b) {
|
|
30
|
-
extendStatics(d, b);
|
|
31
|
-
function __() { this.constructor = d; }
|
|
32
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
33
|
-
}
|
|
34
32
|
|
|
35
33
|
function __decorate(decorators, target, key, desc) {
|
|
36
34
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
37
35
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
38
36
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
39
37
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function __values(o) {
|
|
43
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function __read(o, n) {
|
|
54
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
-
if (!m) return o;
|
|
56
|
-
var i = m.call(o), r, ar = [], e;
|
|
57
|
-
try {
|
|
58
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
-
}
|
|
60
|
-
catch (error) { e = { error: error }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e) throw e.error; }
|
|
66
|
-
}
|
|
67
|
-
return ar;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function __spread() {
|
|
71
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
72
|
-
ar = ar.concat(__read(arguments[i]));
|
|
73
|
-
return ar;
|
|
74
38
|
}
|
|
75
39
|
|
|
76
|
-
|
|
77
|
-
__extends(EvaXComponent, _super);
|
|
78
|
-
function EvaXComponent(gameObject) {
|
|
79
|
-
var _this = _super.call(this, gameObject) || this;
|
|
80
|
-
_this.events = {};
|
|
81
|
-
return _this;
|
|
82
|
-
}
|
|
83
|
-
EvaXComponent.prototype.init = function (option) {
|
|
84
|
-
if (option === void 0) { option = { events: {} }; }
|
|
85
|
-
var events = option.events;
|
|
86
|
-
this.events = events || {};
|
|
87
|
-
};
|
|
88
|
-
EvaXComponent.componentName = 'EvaX';
|
|
89
|
-
return EvaXComponent;
|
|
90
|
-
}(Component));
|
|
91
|
-
var EvaXComponent$1 = EvaXComponent;
|
|
92
|
-
|
|
93
|
-
var _defineCache = new Map();
|
|
40
|
+
const _defineCache = new Map();
|
|
94
41
|
function defineProperty(key, deep, store, originKey, originStore, callback) {
|
|
95
42
|
if (!_defineCache.has(store)) {
|
|
96
43
|
_defineCache.set(store, []);
|
|
@@ -99,45 +46,45 @@ function defineProperty(key, deep, store, originKey, originStore, callback) {
|
|
|
99
46
|
return;
|
|
100
47
|
}
|
|
101
48
|
_defineCache.get(store).push(key);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
for (
|
|
49
|
+
const props = key.split('.');
|
|
50
|
+
let obj = store;
|
|
51
|
+
const length = props.length;
|
|
52
|
+
for (let i = 0; i < length - 1; i++) {
|
|
106
53
|
if (obj[props[i]] === undefined) {
|
|
107
54
|
return;
|
|
108
55
|
}
|
|
109
56
|
obj = obj[props[i]];
|
|
110
57
|
}
|
|
111
|
-
|
|
58
|
+
const value = obj[props[length - 1]];
|
|
112
59
|
if (deep && isObject(value)) {
|
|
113
|
-
for (
|
|
114
|
-
defineProperty(
|
|
60
|
+
for (const key in value) {
|
|
61
|
+
defineProperty(key, deep, value, originKey, originStore, callback);
|
|
115
62
|
}
|
|
116
63
|
}
|
|
117
|
-
|
|
64
|
+
const _key = `_${props[length - 1]}`;
|
|
118
65
|
obj[_key] = value;
|
|
119
66
|
Object.defineProperty(obj, _key, {
|
|
120
67
|
enumerable: false,
|
|
121
68
|
});
|
|
122
69
|
Object.defineProperty(obj, props[length - 1], {
|
|
123
|
-
set
|
|
124
|
-
|
|
125
|
-
obj[
|
|
70
|
+
set(val) {
|
|
71
|
+
const oldStore = cloneDeep(originStore);
|
|
72
|
+
obj[`_${props[length - 1]}`] = val;
|
|
126
73
|
callback(originKey, oldStore);
|
|
127
74
|
if (deep && isObject(val)) {
|
|
128
75
|
_defineCache.delete(obj);
|
|
129
|
-
for (
|
|
130
|
-
defineProperty(
|
|
76
|
+
for (const key in val) {
|
|
77
|
+
defineProperty(key, deep, val, originKey, originStore, callback);
|
|
131
78
|
}
|
|
132
79
|
}
|
|
133
80
|
},
|
|
134
|
-
get
|
|
135
|
-
return obj[
|
|
81
|
+
get() {
|
|
82
|
+
return obj[`_${props[length - 1]}`];
|
|
136
83
|
},
|
|
137
84
|
});
|
|
138
85
|
}
|
|
139
86
|
function updateStore(store, newStore, force) {
|
|
140
|
-
for (
|
|
87
|
+
for (const key in store) {
|
|
141
88
|
if (!(key in newStore)) {
|
|
142
89
|
continue;
|
|
143
90
|
}
|
|
@@ -152,96 +99,69 @@ function updateStore(store, newStore, force) {
|
|
|
152
99
|
}
|
|
153
100
|
}
|
|
154
101
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
_this.changeList = [];
|
|
160
|
-
return _this;
|
|
102
|
+
let EvaXSystem = class EvaXSystem extends System {
|
|
103
|
+
constructor() {
|
|
104
|
+
super(...arguments);
|
|
105
|
+
this.changeList = [];
|
|
161
106
|
}
|
|
162
|
-
|
|
163
|
-
var _b = (_a === void 0 ? { store: {} } : _a).store, store = _b === void 0 ? {} : _b;
|
|
107
|
+
init({ store = {} } = { store: {} }) {
|
|
164
108
|
this.ee = new EventEmitter();
|
|
165
109
|
this.store = store;
|
|
166
110
|
this.bindDefaultListener();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
_this.updateStore(store);
|
|
111
|
+
}
|
|
112
|
+
bindDefaultListener() {
|
|
113
|
+
this.ee.on('evax.updateStore', store => {
|
|
114
|
+
this.updateStore(store);
|
|
172
115
|
});
|
|
173
|
-
this.ee.on('evax.forceUpdateStore',
|
|
174
|
-
|
|
116
|
+
this.ee.on('evax.forceUpdateStore', store => {
|
|
117
|
+
this.forceUpdateStore(store);
|
|
175
118
|
});
|
|
176
|
-
}
|
|
177
|
-
|
|
119
|
+
}
|
|
120
|
+
changeCallback(key, oldStore) {
|
|
178
121
|
this.changeList.push({
|
|
179
122
|
key: key,
|
|
180
123
|
oldStore: oldStore,
|
|
181
124
|
});
|
|
182
|
-
}
|
|
183
|
-
|
|
125
|
+
}
|
|
126
|
+
updateStore(store) {
|
|
184
127
|
updateStore(this.store, store, false);
|
|
185
|
-
}
|
|
186
|
-
|
|
128
|
+
}
|
|
129
|
+
forceUpdateStore(store) {
|
|
187
130
|
updateStore(this.store, store, true);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
var _this = this;
|
|
131
|
+
}
|
|
132
|
+
bindListener(key, deep) {
|
|
191
133
|
if (key.indexOf('store.') === -1) {
|
|
192
134
|
return;
|
|
193
135
|
}
|
|
194
|
-
|
|
195
|
-
defineProperty(realKey, deep, this.store, key, this.store,
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
case OBSERVER_TYPE.REMOVE:
|
|
208
|
-
this.remove(changed);
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
214
|
-
finally {
|
|
215
|
-
try {
|
|
216
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
217
|
-
}
|
|
218
|
-
finally { if (e_1) throw e_1.error; }
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
EvaXSystem.prototype.lateUpdate = function () {
|
|
222
|
-
var e_2, _a;
|
|
223
|
-
try {
|
|
224
|
-
for (var _b = __values(this.changeList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
225
|
-
var item = _c.value;
|
|
226
|
-
this.ee.emit(item.key, this.store, item.oldStore);
|
|
136
|
+
const realKey = key.split('.').slice(1).join('.');
|
|
137
|
+
defineProperty(realKey, deep, this.store, key, this.store, (key, oldStore) => this.changeCallback(key, oldStore));
|
|
138
|
+
}
|
|
139
|
+
update() {
|
|
140
|
+
const changes = this.componentObserver.clear();
|
|
141
|
+
for (const changed of changes) {
|
|
142
|
+
switch (changed.type) {
|
|
143
|
+
case OBSERVER_TYPE.ADD:
|
|
144
|
+
this.add(changed);
|
|
145
|
+
break;
|
|
146
|
+
case OBSERVER_TYPE.REMOVE:
|
|
147
|
+
this.remove(changed);
|
|
148
|
+
break;
|
|
227
149
|
}
|
|
228
150
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
finally { if (e_2) throw e_2.error; }
|
|
151
|
+
}
|
|
152
|
+
lateUpdate() {
|
|
153
|
+
for (const item of this.changeList) {
|
|
154
|
+
this.ee.emit(item.key, this.store, item.oldStore);
|
|
235
155
|
}
|
|
236
156
|
this.changeList = [];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
157
|
+
}
|
|
158
|
+
add(changed) {
|
|
159
|
+
const component = changed.component;
|
|
240
160
|
component.evax = this;
|
|
241
|
-
for (
|
|
161
|
+
for (const key in component.events) {
|
|
242
162
|
if (component.events[key]) {
|
|
243
163
|
this.bindListener(key, !!component.events[key].deep);
|
|
244
|
-
|
|
164
|
+
let func;
|
|
245
165
|
if (component.events[key] instanceof Function) {
|
|
246
166
|
func = component.events[key];
|
|
247
167
|
}
|
|
@@ -251,43 +171,37 @@ var EvaXSystem = (function (_super) {
|
|
|
251
171
|
this.ee.on(key, func.bind(component));
|
|
252
172
|
}
|
|
253
173
|
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
for (
|
|
174
|
+
}
|
|
175
|
+
remove(changed) {
|
|
176
|
+
const component = changed.component;
|
|
177
|
+
for (const key in component.events) {
|
|
258
178
|
if (component.events[key] instanceof Function) {
|
|
259
179
|
this.ee.off(key, component.events[key].bind(component));
|
|
260
180
|
}
|
|
261
181
|
}
|
|
262
|
-
}
|
|
263
|
-
|
|
182
|
+
}
|
|
183
|
+
on(eventName, func) {
|
|
264
184
|
return this.ee.on(eventName, func, this);
|
|
265
|
-
}
|
|
266
|
-
|
|
185
|
+
}
|
|
186
|
+
off(eventName, func) {
|
|
267
187
|
return this.ee.off(eventName, func);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
decorators.componentObserver({
|
|
281
|
-
EvaX: [],
|
|
282
|
-
})
|
|
283
|
-
], EvaXSystem);
|
|
284
|
-
return EvaXSystem;
|
|
285
|
-
}(System));
|
|
188
|
+
}
|
|
189
|
+
emit(eventName, ...args) {
|
|
190
|
+
return this.ee.emit(eventName, ...args);
|
|
191
|
+
}
|
|
192
|
+
onDestroy() { }
|
|
193
|
+
};
|
|
194
|
+
EvaXSystem.systemName = 'EvaX';
|
|
195
|
+
EvaXSystem = __decorate([
|
|
196
|
+
decorators.componentObserver({
|
|
197
|
+
EvaX: [],
|
|
198
|
+
})
|
|
199
|
+
], EvaXSystem);
|
|
286
200
|
var EvaXSystem$1 = EvaXSystem;
|
|
287
201
|
|
|
288
202
|
var index = {
|
|
289
|
-
Components: [EvaXComponent
|
|
203
|
+
Components: [EvaXComponent],
|
|
290
204
|
Systems: [EvaXSystem$1],
|
|
291
205
|
};
|
|
292
206
|
|
|
293
|
-
export { EvaXComponent
|
|
207
|
+
export { EvaXComponent as EvaX, EvaXSystem$1 as EvaXSystem, index as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-evax",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.11",
|
|
4
4
|
"description": "@eva/plugin-evax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-evax.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/eva.js": "2.0.0-beta.
|
|
21
|
+
"@eva/eva.js": "2.0.0-beta.11",
|
|
22
22
|
"eventemitter3": "^3.1.2",
|
|
23
23
|
"lodash-es": "^4.17.21"
|
|
24
24
|
}
|