@eva/plugin-a11y 1.2.7-editor.9 → 1.2.7-fix.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  window.EVA = window.EVA || {};
4
3
  window.EVA.plugin = window.EVA.plugin || {};
5
-
6
4
  var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
7
5
  'use strict';
8
6
 
@@ -13,62 +11,45 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
13
11
  d.__proto__ = b;
14
12
  } || function (d, b) {
15
13
  for (var p in b) {
16
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
14
+ if (b.hasOwnProperty(p)) d[p] = b[p];
17
15
  }
18
16
  };
19
-
20
17
  return _extendStatics(d, b);
21
18
  };
22
-
23
19
  function __extends(d, b) {
24
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
-
26
20
  _extendStatics(d, b);
27
-
28
21
  function __() {
29
22
  this.constructor = d;
30
23
  }
31
-
32
24
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33
25
  }
34
-
35
26
  var _assign = function __assign() {
36
27
  _assign = Object.assign || function __assign(t) {
37
28
  for (var s, i = 1, n = arguments.length; i < n; i++) {
38
29
  s = arguments[i];
39
-
40
30
  for (var p in s) {
41
31
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
42
32
  }
43
33
  }
44
-
45
34
  return t;
46
35
  };
47
-
48
36
  return _assign.apply(this, arguments);
49
37
  };
50
-
51
38
  function __decorate(decorators, target, key, desc) {
52
39
  var c = arguments.length,
53
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
54
- d;
40
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
41
+ d;
55
42
  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--) {
56
43
  if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
57
44
  }
58
45
  return c > 3 && r && Object.defineProperty(target, key, r), r;
59
46
  }
60
-
61
- function __metadata(metadataKey, metadataValue) {
62
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
63
- }
64
-
65
47
  function __awaiter(thisArg, _arguments, P, generator) {
66
48
  function adopt(value) {
67
49
  return value instanceof P ? value : new P(function (resolve) {
68
50
  resolve(value);
69
51
  });
70
52
  }
71
-
72
53
  return new (P || (P = Promise))(function (resolve, reject) {
73
54
  function fulfilled(value) {
74
55
  try {
@@ -77,7 +58,6 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
77
58
  reject(e);
78
59
  }
79
60
  }
80
-
81
61
  function rejected(value) {
82
62
  try {
83
63
  step(generator["throw"](value));
@@ -85,29 +65,26 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
85
65
  reject(e);
86
66
  }
87
67
  }
88
-
89
68
  function step(result) {
90
69
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
91
70
  }
92
-
93
71
  step((generator = generator.apply(thisArg, _arguments || [])).next());
94
72
  });
95
73
  }
96
-
97
74
  function __generator(thisArg, body) {
98
75
  var _ = {
99
- label: 0,
100
- sent: function sent() {
101
- if (t[0] & 1) throw t[1];
102
- return t[1];
76
+ label: 0,
77
+ sent: function sent() {
78
+ if (t[0] & 1) throw t[1];
79
+ return t[1];
80
+ },
81
+ trys: [],
82
+ ops: []
103
83
  },
104
- trys: [],
105
- ops: []
106
- },
107
- f,
108
- y,
109
- t,
110
- g;
84
+ f,
85
+ y,
86
+ t,
87
+ g;
111
88
  return g = {
112
89
  next: verb(0),
113
90
  "throw": verb(1),
@@ -115,79 +92,60 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
115
92
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
116
93
  return this;
117
94
  }), g;
118
-
119
95
  function verb(n) {
120
96
  return function (v) {
121
97
  return step([n, v]);
122
98
  };
123
99
  }
124
-
125
100
  function step(op) {
126
101
  if (f) throw new TypeError("Generator is already executing.");
127
-
128
102
  while (_) {
129
103
  try {
130
104
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
131
105
  if (y = 0, t) op = [op[0] & 2, t.value];
132
-
133
106
  switch (op[0]) {
134
107
  case 0:
135
108
  case 1:
136
109
  t = op;
137
110
  break;
138
-
139
111
  case 4:
140
112
  _.label++;
141
113
  return {
142
114
  value: op[1],
143
115
  done: false
144
116
  };
145
-
146
117
  case 5:
147
118
  _.label++;
148
119
  y = op[1];
149
120
  op = [0];
150
121
  continue;
151
-
152
122
  case 7:
153
123
  op = _.ops.pop();
154
-
155
124
  _.trys.pop();
156
-
157
125
  continue;
158
-
159
126
  default:
160
127
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
161
128
  _ = 0;
162
129
  continue;
163
130
  }
164
-
165
131
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
166
132
  _.label = op[1];
167
133
  break;
168
134
  }
169
-
170
135
  if (op[0] === 6 && _.label < t[1]) {
171
136
  _.label = t[1];
172
137
  t = op;
173
138
  break;
174
139
  }
175
-
176
140
  if (t && _.label < t[2]) {
177
141
  _.label = t[2];
178
-
179
142
  _.ops.push(op);
180
-
181
143
  break;
182
144
  }
183
-
184
145
  if (t[2]) _.ops.pop();
185
-
186
146
  _.trys.pop();
187
-
188
147
  continue;
189
148
  }
190
-
191
149
  op = body.call(thisArg, _);
192
150
  } catch (e) {
193
151
  op = [6, e];
@@ -196,7 +154,6 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
196
154
  f = t = 0;
197
155
  }
198
156
  }
199
-
200
157
  if (op[0] & 5) throw op[1];
201
158
  return {
202
159
  value: op[0] ? op[1] : void 0,
@@ -204,11 +161,10 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
204
161
  };
205
162
  }
206
163
  }
207
-
208
164
  function __values(o) {
209
165
  var s = typeof Symbol === "function" && Symbol.iterator,
210
- m = s && o[s],
211
- i = 0;
166
+ m = s && o[s],
167
+ i = 0;
212
168
  if (m) return m.call(o);
213
169
  if (o && typeof o.length === "number") return {
214
170
  next: function next() {
@@ -221,141 +177,49 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
221
177
  };
222
178
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
223
179
  }
224
-
225
- var SymbolKeysNotSupportedError = function (_super) {
226
- __extends(SymbolKeysNotSupportedError, _super);
227
-
228
- function SymbolKeysNotSupportedError() {
229
- var _newTarget = this.constructor;
230
-
231
- var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
232
-
233
- Object.setPrototypeOf(_this, _newTarget.prototype);
234
- return _this;
235
- }
236
-
237
- return SymbolKeysNotSupportedError;
238
- }(Error);
239
-
240
- (function (_super) {
241
- __extends(StaticGetPropertiesIsNotAFunctionError, _super);
242
-
243
- function StaticGetPropertiesIsNotAFunctionError() {
244
- var _newTarget = this.constructor;
245
-
246
- var _this = _super.call(this, 'getProperties is not a function!') || this;
247
-
248
- Object.setPrototypeOf(_this, _newTarget.prototype);
249
- return _this;
250
- }
251
-
252
- return StaticGetPropertiesIsNotAFunctionError;
253
- })(Error);
254
-
255
- var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
256
-
257
- function transformBasicType(type) {
258
- if (type === String) {
259
- return 'string';
260
- }
261
-
262
- if (type === Number) {
263
- return 'number';
264
- }
265
-
266
- if (type === Boolean) {
267
- return 'boolean';
268
- }
269
-
270
- return 'unknown';
271
- }
272
-
273
- function defineTypes(target, key, options, returnTypeFunction) {
274
- var type = Reflect.getMetadata('design:type', target, key);
275
- var isArray = type === Array;
276
- var str = transformBasicType(type);
277
-
278
- if (str !== 'unknown') {
279
- type = str;
180
+ function getIDEPropsPropertyObj(target, propertyKey) {
181
+ if (!target.constructor.IDEProps) {
182
+ target.constructor.IDEProps = {};
280
183
  }
281
-
282
- if (returnTypeFunction) {
283
- var returnType = returnTypeFunction();
284
-
285
- if (Array.isArray(returnType)) {
286
- isArray = true;
287
- type = returnType[0];
288
- } else {
289
- type = returnType;
290
- }
184
+ if (!target.constructor.IDEProps[propertyKey]) {
185
+ target.constructor.IDEProps[propertyKey] = {};
291
186
  }
292
-
293
- var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
294
- properties[key] = _assign({
295
- type: type,
296
- isArray: isArray
297
- }, options);
298
- Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
187
+ var propertyObj = target.constructor.IDEProps[propertyKey];
188
+ return propertyObj;
299
189
  }
300
-
301
- function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
302
- if (typeof returnTypeFuncOrOptions === 'function') {
303
- return {
304
- returnTypeFunc: returnTypeFuncOrOptions,
305
- options: maybeOptions || {}
306
- };
307
- }
308
-
309
- return {
310
- options: returnTypeFuncOrOptions || {}
190
+ function type(type) {
191
+ return function (target, propertyKey) {
192
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
193
+ prop.key = propertyKey;
194
+ prop.type = type;
311
195
  };
312
196
  }
313
-
314
- function Field(returnTypeFunction, maybeOptions) {
197
+ function step(step) {
315
198
  return function (target, propertyKey) {
316
- if (typeof propertyKey === 'symbol') {
317
- throw new SymbolKeysNotSupportedError();
318
- }
319
-
320
- var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
321
- options = _a.options,
322
- returnTypeFunc = _a.returnTypeFunc;
323
-
324
- defineTypes(target, propertyKey, options, returnTypeFunc);
199
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
200
+ prop.step = step;
325
201
  };
326
202
  }
327
-
328
- var ExecuteMode;
329
-
330
- (function (ExecuteMode) {
331
- ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
332
- ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
333
- ExecuteMode[ExecuteMode["All"] = 6] = "All";
334
- })(ExecuteMode || (ExecuteMode = {}));
335
-
336
203
  function uuid(len) {
337
204
  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
338
205
  var uuid = [];
339
206
  var radix = chars.length;
340
-
341
207
  for (var i = 0; i < len; i++) {
342
208
  uuid[i] = chars[0 | Math.random() * radix];
343
209
  }
344
-
345
210
  return uuid.join('');
346
211
  }
347
-
348
212
  var setStyle = function setStyle(element, style) {
349
213
  var width = style.width,
350
- height = style.height,
351
- position = style.position,
352
- _a = style.left,
353
- left = _a === void 0 ? 0 : _a,
354
- _b = style.top,
355
- top = _b === void 0 ? 0 : _b,
356
- zIndex = style.zIndex,
357
- pointerEvents = style.pointerEvents,
358
- background = style.background;
214
+ height = style.height,
215
+ position = style.position,
216
+ _a = style.left,
217
+ left = _a === void 0 ? 0 : _a,
218
+ _b = style.top,
219
+ top = _b === void 0 ? 0 : _b,
220
+ zIndex = style.zIndex,
221
+ pointerEvents = style.pointerEvents,
222
+ background = style.background;
359
223
  element.style.width = width + "px";
360
224
  element.style.height = height + "px";
361
225
  element.style.position = position;
@@ -367,43 +231,38 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
367
231
  element.style.border = 'none';
368
232
  element.style.overflow = 'hidden';
369
233
  };
370
-
371
234
  var setTransform = function setTransform(element, transform, ratioX, ratioY) {
372
235
  var worldTransform = transform.worldTransform;
373
236
  var a = worldTransform.a,
374
- b = worldTransform.b,
375
- c = worldTransform.c,
376
- d = worldTransform.d,
377
- tx = worldTransform.tx,
378
- ty = worldTransform.ty;
237
+ b = worldTransform.b,
238
+ c = worldTransform.c,
239
+ d = worldTransform.d,
240
+ tx = worldTransform.tx,
241
+ ty = worldTransform.ty;
379
242
  var matrix = "matrix(" + a + ", " + b + ", " + c + ", " + d + ", " + tx * ratioX + ", " + ty * ratioY + ")";
380
243
  element.style.transform = "" + matrix;
381
244
  element.style.webkitTransform = "" + matrix;
382
245
  element.style.transformOrigin = 'left top';
383
246
  element.style.webkitTransformOrigin = 'left top';
384
247
  };
385
-
386
248
  var A11y = function (_super) {
387
249
  __extends(A11y, _super);
388
-
389
250
  function A11y(param) {
390
251
  var _this = _super.call(this) || this;
391
-
392
252
  _extends(_this, param);
393
-
394
253
  var _a = param.hint,
395
- hint = _a === void 0 ? '' : _a,
396
- event = param.event,
397
- _b = param.delay,
398
- delay = _b === void 0 ? 0 : _b,
399
- _c = param.attr,
400
- attr = _c === void 0 ? {} : _c,
401
- _d = param.role,
402
- role = _d === void 0 ? '' : _d,
403
- _e = param.props,
404
- props = _e === void 0 ? {} : _e,
405
- _f = param.state,
406
- state = _f === void 0 ? {} : _f;
254
+ hint = _a === void 0 ? '' : _a,
255
+ event = param.event,
256
+ _b = param.delay,
257
+ delay = _b === void 0 ? 0 : _b,
258
+ _c = param.attr,
259
+ attr = _c === void 0 ? {} : _c,
260
+ _d = param.role,
261
+ role = _d === void 0 ? '' : _d,
262
+ _e = param.props,
263
+ props = _e === void 0 ? {} : _e,
264
+ _f = param.state,
265
+ state = _f === void 0 ? {} : _f;
407
266
  _this.hint = hint;
408
267
  _this.event = event;
409
268
  _this.delay = delay;
@@ -414,61 +273,41 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
414
273
  _this.a11yId = "_" + uuid(6);
415
274
  return _this;
416
275
  }
417
-
418
276
  A11y.componentName = 'A11y';
419
-
420
- __decorate([Field(), __metadata("design:type", Boolean)], A11y.prototype, "interactive", void 0);
421
-
422
- __decorate([Field(), __metadata("design:type", String)], A11y.prototype, "hint", void 0);
423
-
424
- __decorate([Field({
425
- step: 1
426
- }), __metadata("design:type", Number)], A11y.prototype, "delay", void 0);
427
-
428
- __decorate([Field(), __metadata("design:type", String)], A11y.prototype, "role", void 0);
429
-
430
- __decorate([Field(), __metadata("design:type", String)], A11y.prototype, "a11yId", void 0);
431
-
277
+ __decorate([type('boolean')], A11y.prototype, "interactive", void 0);
278
+ __decorate([type('string')], A11y.prototype, "hint", void 0);
279
+ __decorate([type('number'), step(1)], A11y.prototype, "delay", void 0);
280
+ __decorate([type('string')], A11y.prototype, "role", void 0);
281
+ __decorate([type('string')], A11y.prototype, "a11yId", void 0);
432
282
  return A11y;
433
283
  }(eva_js.Component);
434
-
435
284
  var A11y$1 = A11y;
436
285
  var POSITION = 'absolute';
437
286
  var ZINDEX = 3;
438
287
  exports.A11yActivate = void 0;
439
-
440
288
  (function (A11yActivate) {
441
289
  A11yActivate[A11yActivate["ENABLE"] = 0] = "ENABLE";
442
290
  A11yActivate[A11yActivate["DISABLE"] = 1] = "DISABLE";
443
291
  A11yActivate[A11yActivate["CHECK"] = 2] = "CHECK";
444
292
  })(exports.A11yActivate || (exports.A11yActivate = {}));
445
-
446
293
  var PointerEvents;
447
-
448
294
  (function (PointerEvents) {
449
295
  PointerEvents["NONE"] = "none";
450
296
  PointerEvents["AUTO"] = "auto";
451
297
  })(PointerEvents || (PointerEvents = {}));
452
-
453
298
  var MaskBackground;
454
-
455
299
  (function (MaskBackground) {
456
300
  MaskBackground["DEBUG"] = "rgba(255,0,0,0.5)";
457
301
  MaskBackground["NONE"] = "transparent";
458
302
  })(MaskBackground || (MaskBackground = {}));
459
-
460
303
  var ElementType;
461
-
462
304
  (function (ElementType) {
463
305
  ElementType["BUTTON"] = "button";
464
306
  ElementType["DIV"] = "div";
465
307
  })(ElementType || (ElementType = {}));
466
-
467
308
  var notAttr = ['hint', 'event', 'delay', 'attr', 'role', 'props', 'state', 'a11yId', 'name'];
468
-
469
309
  var getEventFunc = function getEventFunc(event, gameObject, e) {
470
310
  var _this = this;
471
-
472
311
  ['touchstart', 'touchend', 'tap'].forEach(function (name) {
473
312
  event.emit(name, {
474
313
  stopPropagation: function stopPropagation() {
@@ -481,26 +320,21 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
481
320
  });
482
321
  });
483
322
  };
484
-
485
323
  var A11ySystem = function (_super) {
486
324
  __extends(A11ySystem, _super);
487
-
488
325
  function A11ySystem(opt) {
489
326
  var _this = _super.call(this, opt) || this;
490
-
491
327
  _this.cache = new Map();
492
328
  _this.eventCache = new Map();
493
329
  _this.zIndex = ZINDEX;
494
330
  return _this;
495
331
  }
496
-
497
332
  Object.defineProperty(A11ySystem.prototype, "ratioX", {
498
333
  get: function get() {
499
334
  if (this._ratioX) {
500
335
  return this._ratioX;
501
336
  } else {
502
337
  var success = this.setRatio();
503
-
504
338
  if (success) {
505
339
  return this._ratioX;
506
340
  } else {
@@ -517,7 +351,6 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
517
351
  return this._ratioY;
518
352
  } else {
519
353
  var success = this.setRatio();
520
-
521
354
  if (success) {
522
355
  return this._ratioY;
523
356
  } else {
@@ -528,15 +361,12 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
528
361
  enumerable: false,
529
362
  configurable: true
530
363
  });
531
-
532
364
  A11ySystem.prototype.init = function (opt) {
533
365
  if (opt === void 0) {
534
366
  opt = {};
535
367
  }
536
-
537
368
  return __awaiter(this, void 0, void 0, function () {
538
369
  var _a, activate, _b, delay, _c, checkA11yOpen, zIndex, _d, _e, div;
539
-
540
370
  return __generator(this, function (_f) {
541
371
  switch (_f.label) {
542
372
  case 0:
@@ -546,80 +376,59 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
546
376
  this.delay = delay;
547
377
  this.zIndex = zIndex || this.zIndex;
548
378
  _d = activate;
549
-
550
379
  switch (_d) {
551
380
  case exports.A11yActivate.CHECK:
552
381
  return [3, 1];
553
-
554
382
  case exports.A11yActivate.DISABLE:
555
383
  return [3, 5];
556
-
557
384
  case exports.A11yActivate.ENABLE:
558
385
  return [3, 6];
559
386
  }
560
-
561
387
  return [3, 7];
562
-
563
388
  case 1:
564
389
  _f.trys.push([1, 3,, 4]);
565
-
566
390
  _e = this;
567
391
  return [4, checkA11yOpen()];
568
-
569
392
  case 2:
570
393
  _e.activate = _f.sent();
571
394
  return [3, 4];
572
-
573
395
  case 3:
574
396
  _f.sent();
575
-
576
397
  this.activate = false;
577
398
  return [3, 4];
578
-
579
399
  case 4:
580
400
  return [3, 7];
581
-
582
401
  case 5:
583
402
  this.activate = false;
584
403
  return [3, 7];
585
-
586
404
  case 6:
587
405
  this.activate = true;
588
406
  return [3, 7];
589
-
590
407
  case 7:
591
408
  this.debug = opt.debug || false;
592
-
593
409
  if (this.debug) {
594
410
  this.activate = true;
595
411
  }
596
-
597
412
  if (!this.activate) return [2];
598
413
  div = document.createElement('div');
599
414
  this.div = div;
600
-
601
415
  if (this.game.canvas.parentNode) {
602
416
  this.game.canvas.parentNode.insertBefore(this.div, this.game.canvas);
603
417
  }
604
-
605
418
  return [2];
606
419
  }
607
420
  });
608
421
  });
609
422
  };
610
-
611
423
  A11ySystem.prototype.setRatio = function () {
612
424
  var _a = this.getCanvasBoundingClientRect(),
613
- width = _a.width,
614
- height = _a.height;
615
-
425
+ width = _a.width,
426
+ height = _a.height;
616
427
  var _b = this.getRenderRect(),
617
- renderWidth = _b.renderWidth,
618
- renderHeight = _b.renderHeight;
619
-
428
+ renderWidth = _b.renderWidth,
429
+ renderHeight = _b.renderHeight;
620
430
  this._ratioX = width / renderWidth;
621
431
  this._ratioY = height / renderHeight;
622
-
623
432
  if (width || height) {
624
433
  this.initDiv();
625
434
  return true;
@@ -627,28 +436,25 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
627
436
  return false;
628
437
  }
629
438
  };
630
-
631
439
  A11ySystem.prototype.getRenderRect = function () {
632
440
  var _a = this.game.getSystem(pluginRenderer.RendererSystem).params,
633
- params = _a === void 0 ? {
634
- width: 300,
635
- height: 300
636
- } : _a;
441
+ params = _a === void 0 ? {
442
+ width: 300,
443
+ height: 300
444
+ } : _a;
637
445
  var renderHeight = params.height,
638
- renderWidth = params.width;
446
+ renderWidth = params.width;
639
447
  return {
640
448
  renderWidth: renderWidth,
641
449
  renderHeight: renderHeight
642
450
  };
643
451
  };
644
-
645
452
  A11ySystem.prototype.getCanvasBoundingClientRect = function () {
646
453
  var _a = this.game.canvas.getBoundingClientRect(),
647
- width = _a.width,
648
- height = _a.height,
649
- left = _a.left,
650
- top = _a.top;
651
-
454
+ width = _a.width,
455
+ height = _a.height,
456
+ left = _a.left,
457
+ top = _a.top;
652
458
  return {
653
459
  width: width,
654
460
  height: height,
@@ -656,19 +462,15 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
656
462
  top: top
657
463
  };
658
464
  };
659
-
660
465
  A11ySystem.prototype.initDiv = function () {
661
466
  var _this = this;
662
-
663
467
  var pageXOffset = window.pageXOffset,
664
- pageYOffset = window.pageYOffset;
665
-
468
+ pageYOffset = window.pageYOffset;
666
469
  var _a = this.getCanvasBoundingClientRect(),
667
- width = _a.width,
668
- height = _a.height,
669
- left = _a.left,
670
- top = _a.top;
671
-
470
+ width = _a.width,
471
+ height = _a.height,
472
+ left = _a.left,
473
+ top = _a.top;
672
474
  var style = {
673
475
  width: width,
674
476
  height: height,
@@ -682,11 +484,9 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
682
484
  setStyle(this.div, style);
683
485
  this.div.addEventListener('click', function (e) {
684
486
  var currentTarget = e.currentTarget;
685
-
686
487
  var _a = currentTarget.getBoundingClientRect(),
687
- left = _a.left,
688
- top = _a.top;
689
-
488
+ left = _a.left,
489
+ top = _a.top;
690
490
  var x = (e.pageX - left) / _this.ratioX;
691
491
  var y = (e.pageY - top) / _this.ratioY;
692
492
  _this.eventPosition = {
@@ -695,35 +495,27 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
695
495
  };
696
496
  }, true);
697
497
  };
698
-
699
498
  A11ySystem.prototype.update = function () {
700
499
  return __awaiter(this, void 0, void 0, function () {
701
500
  var changes, changes_1, changes_1_1, changed;
702
-
703
501
  var e_1, _a;
704
-
705
502
  return __generator(this, function (_b) {
706
503
  changes = this.componentObserver.clear();
707
-
708
504
  if (!this.activate) {
709
505
  return [2];
710
506
  }
711
-
712
507
  try {
713
508
  for (changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
714
509
  changed = changes_1_1.value;
715
-
716
510
  switch (changed.type) {
717
511
  case eva_js.OBSERVER_TYPE.ADD:
718
512
  changed.componentName === 'Event' && this.addEvent(changed.gameObject);
719
513
  changed.componentName === 'A11y' && this.add(changed);
720
514
  break;
721
-
722
515
  case eva_js.OBSERVER_TYPE.CHANGE:
723
516
  changed.componentName === 'Transform' && this.transformChange(changed);
724
517
  changed.componentName === 'A11y' && this.change(changed);
725
518
  break;
726
-
727
519
  case eva_js.OBSERVER_TYPE.REMOVE:
728
520
  changed.componentName === 'Event' && this.removeEvent(changed);
729
521
  changed.componentName === 'A11y' && this.remove(changed);
@@ -740,22 +532,18 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
740
532
  if (e_1) throw e_1.error;
741
533
  }
742
534
  }
743
-
744
535
  return [2];
745
536
  });
746
537
  });
747
538
  };
748
-
749
539
  A11ySystem.prototype.change = function (changed) {
750
540
  var component = changed.component;
751
-
752
541
  if (changed.prop.prop[0] === 'hint') {
753
542
  var dom = this.cache.get(component.a11yId);
754
543
  dom === null || dom === void 0 ? void 0 : dom.setAttribute('aria-label', component.hint);
755
544
  dom && this.setPosition(dom, changed.gameObject.transform);
756
545
  }
757
546
  };
758
-
759
547
  A11ySystem.prototype.remove = function (changed) {
760
548
  var component = changed.component;
761
549
  if (!component) return;
@@ -764,48 +552,39 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
764
552
  element && this.div.removeChild(element);
765
553
  this.cache.delete(a11yId);
766
554
  };
767
-
768
555
  A11ySystem.prototype.add = function (changed) {
769
556
  var _this = this;
770
-
771
557
  if (!this.activate) return;
772
558
  var component = changed.component;
773
559
  var gameObject = changed.gameObject;
774
560
  var delay = component.delay,
775
- id = component.a11yId;
561
+ id = component.a11yId;
776
562
  var event = component.event;
777
563
  if (!gameObject) return;
778
564
  var transform = gameObject.transform;
779
565
  if (!transform) return;
780
566
  var element = document.createElement('div');
781
567
  this.cache.set(id, element);
782
-
783
568
  if (!event) {
784
569
  event = gameObject.getComponent('Event');
785
570
  }
786
-
787
571
  setTimeout(function () {
788
572
  _this.setPosition(element, transform);
789
-
790
573
  _this.setA11yAttr(element, component);
791
-
792
574
  if (event) {
793
575
  _this.addEvent(gameObject);
794
576
  }
795
-
796
577
  if (gameObject.scene) {
797
578
  _this.div.appendChild(element);
798
579
  }
799
580
  }, delay || this.delay);
800
581
  };
801
-
802
582
  A11ySystem.prototype.transformChange = function (changed) {
803
583
  var component = changed.component;
804
584
  var gameObject = changed.gameObject;
805
585
  var a11yComponent = gameObject.getComponent(A11y$1);
806
586
  if (!a11yComponent) return;
807
587
  var a11yId = a11yComponent.a11yId;
808
-
809
588
  if (!component.inScene) {
810
589
  var dom = this.div.querySelector("#" + a11yId);
811
590
  dom && this.div.removeChild(dom);
@@ -816,17 +595,14 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
816
595
  }
817
596
  }
818
597
  };
819
-
820
598
  A11ySystem.prototype.setEvent = function (element, event, gameObject, id) {
821
599
  if (!event) {
822
600
  return;
823
601
  }
824
-
825
602
  var func = getEventFunc.bind(this, event, gameObject);
826
603
  this.eventCache.set(id, func);
827
604
  element.addEventListener('click', func);
828
605
  };
829
-
830
606
  A11ySystem.prototype.addEvent = function (gameObject) {
831
607
  var a11y = gameObject.getComponent(A11y$1);
832
608
  if (!a11y) return;
@@ -835,7 +611,6 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
835
611
  var element = this.cache.get(a11y.a11yId);
836
612
  element && this.setEvent(element, event, gameObject, a11y.a11yId);
837
613
  };
838
-
839
614
  A11ySystem.prototype.removeEvent = function (changed) {
840
615
  var gameObject = changed.gameObject;
841
616
  var a11y = gameObject.getComponent(A11y$1);
@@ -847,23 +622,20 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
847
622
  var element = this.cache.get(a11yId);
848
623
  element && element.removeEventListener('click', func);
849
624
  };
850
-
851
625
  A11ySystem.prototype.setA11yAttr = function (element, component) {
852
626
  var e_2, _a, e_3, _b, e_4, _c;
853
-
854
627
  var hint = component.hint,
855
- _d = component.props,
856
- props = _d === void 0 ? {} : _d,
857
- _e = component.state,
858
- state = _e === void 0 ? {} : _e,
859
- role = component.role,
860
- id = component.a11yId;
628
+ _d = component.props,
629
+ props = _d === void 0 ? {} : _d,
630
+ _e = component.state,
631
+ state = _e === void 0 ? {} : _e,
632
+ role = component.role,
633
+ id = component.a11yId;
861
634
  var realRole = role || 'text';
862
635
  element.setAttribute('role', realRole);
863
636
  element.setAttribute('aria-label', hint);
864
637
  element.id = id;
865
638
  var ariaProps = Object.keys(props);
866
-
867
639
  try {
868
640
  for (var ariaProps_1 = __values(ariaProps), ariaProps_1_1 = ariaProps_1.next(); !ariaProps_1_1.done; ariaProps_1_1 = ariaProps_1.next()) {
869
641
  var key = ariaProps_1_1.value;
@@ -880,9 +652,7 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
880
652
  if (e_2) throw e_2.error;
881
653
  }
882
654
  }
883
-
884
655
  var ariaState = Object.keys(state);
885
-
886
656
  try {
887
657
  for (var ariaState_1 = __values(ariaState), ariaState_1_1 = ariaState_1.next(); !ariaState_1_1.done; ariaState_1_1 = ariaState_1.next()) {
888
658
  var key = ariaState_1_1.value;
@@ -899,11 +669,9 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
899
669
  if (e_3) throw e_3.error;
900
670
  }
901
671
  }
902
-
903
672
  try {
904
673
  for (var _f = __values(Object.keys(component)), _g = _f.next(); !_g.done; _g = _f.next()) {
905
674
  var key = _g.value;
906
-
907
675
  if (typeof component[key] === 'string' && notAttr.indexOf(key) === -1 && key.indexOf('_') !== 1) {
908
676
  element.setAttribute(key, component[key]);
909
677
  }
@@ -920,11 +688,10 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
920
688
  }
921
689
  }
922
690
  };
923
-
924
691
  A11ySystem.prototype.setPosition = function (element, transform) {
925
692
  var _a = transform.size,
926
- width = _a.width,
927
- height = _a.height;
693
+ width = _a.width,
694
+ height = _a.height;
928
695
  var style = {
929
696
  width: width === 0 ? 1 : width * this.ratioX,
930
697
  height: height === 0 ? 1 : height * this.ratioY,
@@ -933,29 +700,24 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
933
700
  pointerEvents: PointerEvents.AUTO,
934
701
  background: this.debug ? MaskBackground.DEBUG : MaskBackground.NONE
935
702
  };
936
-
937
703
  var transformProps = _assign({}, transform);
938
-
939
704
  setStyle(element, style);
940
705
  setTransform(element, transformProps, this.ratioX, this.ratioY);
941
706
  };
942
-
943
707
  A11ySystem.prototype.onDestroy = function () {
944
708
  this.div.parentElement.removeChild(this.div);
945
709
  this.cache = null;
946
710
  this.eventCache = null;
947
711
  this.div = null;
948
712
  };
949
-
950
713
  A11ySystem.systemName = 'A11ySystem';
951
714
  A11ySystem = __decorate([eva_js.decorators.componentObserver({
952
715
  A11y: ['hint'],
953
716
  Transform: ['inScene'],
954
717
  Event: []
955
- }), __metadata("design:paramtypes", [Object])], A11ySystem);
718
+ })], A11ySystem);
956
719
  return A11ySystem;
957
720
  }(eva_js.System);
958
-
959
721
  var A11ySystem$1 = A11ySystem;
960
722
  exports.A11y = A11y$1;
961
723
  exports.A11ySystem = A11ySystem$1;
@@ -964,5 +726,4 @@ var _EVA_IIFE_a11y = function (exports, eva_js, pluginRenderer) {
964
726
  });
965
727
  return exports;
966
728
  }({}, EVA, EVA.plugin.renderer);
967
-
968
729
  window.EVA.plugin.a11y = window.EVA.plugin.a11y || _EVA_IIFE_a11y;