@player-ui/reference-assets-plugin 0.11.2--canary.649.23032 → 0.11.2-next.1

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.
@@ -3807,9 +3807,6 @@ var ReferenceAssetsPlugin = function() {
3807
3807
  },
3808
3808
  setDataVal: function() {
3809
3809
  return setDataVal;
3810
- },
3811
- waitFor: function() {
3812
- return waitFor;
3813
3810
  }
3814
3811
  });
3815
3812
  var setDataVal = function(_context, binding, value) {
@@ -3837,27 +3834,6 @@ var ReferenceAssetsPlugin = function() {
3837
3834
  return null;
3838
3835
  };
3839
3836
  conditional.resolveParams = false;
3840
- var waitFor = function() {
3841
- var _ref = _async_to_generator(function(ctx, promise) {
3842
- return _ts_generator(this, function(_state) {
3843
- switch(_state.label){
3844
- case 0:
3845
- return [
3846
- 4,
3847
- promise
3848
- ];
3849
- case 1:
3850
- return [
3851
- 2,
3852
- _state.sent()
3853
- ];
3854
- }
3855
- });
3856
- });
3857
- return function waitFor(ctx, promise) {
3858
- return _ref.apply(this, arguments);
3859
- };
3860
- }();
3861
3837
  var andandOperator = function(ctx, a, b) {
3862
3838
  return ctx.evaluate(a) && ctx.evaluate(b);
3863
3839
  };
@@ -3963,12 +3939,7 @@ var ReferenceAssetsPlugin = function() {
3963
3939
  this.operators = {
3964
3940
  binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
3965
3941
  unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
3966
- expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
3967
- [
3968
- "await",
3969
- waitFor
3970
- ]
3971
- ]))
3942
+ expressions: new Map(Object.entries(evaluator_functions_exports))
3972
3943
  };
3973
3944
  this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
3974
3945
  evaluate: function(expr) {
@@ -3978,12 +3949,7 @@ var ReferenceAssetsPlugin = function() {
3978
3949
  return _this._execAST(node, _this.defaultHookOptions);
3979
3950
  }
3980
3951
  });
3981
- this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
3982
- if (options.async) {
3983
- return _this._resolveNodeAsync(result, node, options);
3984
- }
3985
- return _this._resolveNode(result, node, options);
3986
- });
3952
+ this.hooks.resolve.tap("ExpressionEvaluator", this._resolveNode.bind(this));
3987
3953
  this.evaluate = this.evaluate.bind(this);
3988
3954
  }
3989
3955
  _create_class(ExpressionEvaluator, [
@@ -4021,14 +3987,6 @@ var ReferenceAssetsPlugin = function() {
4021
3987
  return this._execString(String(expression), resolvedOpts);
4022
3988
  }
4023
3989
  },
4024
- {
4025
- key: "evaluateAsync",
4026
- value: function evaluateAsync(expr, options) {
4027
- return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
4028
- async: true
4029
- }));
4030
- }
4031
- },
4032
3990
  {
4033
3991
  key: "addExpressionFunction",
4034
3992
  value: function addExpressionFunction(name, handler) {
@@ -4074,10 +4032,8 @@ var ReferenceAssetsPlugin = function() {
4074
4032
  var matches = exp.match(/^@\[(.*)\]@$/);
4075
4033
  var matchedExp = exp;
4076
4034
  if (matches) {
4077
- var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
4078
- if (matched) {
4079
- matchedExp = matched;
4080
- }
4035
+ var ref;
4036
+ ref = _sliced_to_array(Array.from(matches), 2), matchedExp = ref[1], ref;
4081
4037
  }
4082
4038
  var storedAST;
4083
4039
  try {
@@ -4238,452 +4194,6 @@ var ReferenceAssetsPlugin = function() {
4238
4194
  return resolveNode(node.left);
4239
4195
  }
4240
4196
  }
4241
- },
4242
- {
4243
- key: "_resolveNodeAsync",
4244
- value: function _resolveNodeAsync(_currentValue, node, options) {
4245
- var _this = this;
4246
- return _async_to_generator(function() {
4247
- var resolveNode, model, expressionContext, operator, _tmp, _tmp1, operator1, _tmp2, _tmp3, attributes, resolvedAttributes, expressionName, operator2, args, obj, prop, value, value1, result, operation, newValue, _tmp4, _tmp5;
4248
- return _ts_generator(this, function(_state) {
4249
- switch(_state.label){
4250
- case 0:
4251
- resolveNode = options.resolveNode, model = options.model;
4252
- expressionContext = _object_spread_props(_object_spread({}, options), {
4253
- evaluate: function(expr) {
4254
- return _this.evaluate(expr, options);
4255
- }
4256
- });
4257
- if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
4258
- 3,
4259
- 7
4260
- ];
4261
- operator = _this.operators.binary.get(node.operator);
4262
- if (!operator) return [
4263
- 3,
4264
- 6
4265
- ];
4266
- if (!("resolveParams" in operator)) return [
4267
- 3,
4268
- 3
4269
- ];
4270
- if (operator.resolveParams === false) {
4271
- return [
4272
- 2,
4273
- operator(expressionContext, node.left, node.right)
4274
- ];
4275
- }
4276
- _tmp = [
4277
- expressionContext
4278
- ];
4279
- return [
4280
- 4,
4281
- resolveNode(node.left)
4282
- ];
4283
- case 1:
4284
- _tmp = _tmp.concat([
4285
- _state.sent()
4286
- ]);
4287
- return [
4288
- 4,
4289
- resolveNode(node.right)
4290
- ];
4291
- case 2:
4292
- return [
4293
- 2,
4294
- operator.apply(void 0, _tmp.concat([
4295
- _state.sent()
4296
- ]))
4297
- ];
4298
- case 3:
4299
- return [
4300
- 4,
4301
- resolveNode(node.left)
4302
- ];
4303
- case 4:
4304
- _tmp1 = [
4305
- _state.sent()
4306
- ];
4307
- return [
4308
- 4,
4309
- resolveNode(node.right)
4310
- ];
4311
- case 5:
4312
- return [
4313
- 2,
4314
- operator.apply(void 0, _tmp1.concat([
4315
- _state.sent()
4316
- ]))
4317
- ];
4318
- case 6:
4319
- return [
4320
- 2
4321
- ];
4322
- case 7:
4323
- if (!(node.type === "UnaryExpression")) return [
4324
- 3,
4325
- 14
4326
- ];
4327
- operator1 = _this.operators.unary.get(node.operator);
4328
- if (!operator1) return [
4329
- 3,
4330
- 13
4331
- ];
4332
- if (!("resolveParams" in operator1)) return [
4333
- 3,
4334
- 11
4335
- ];
4336
- _tmp2 = [
4337
- expressionContext
4338
- ];
4339
- if (!(operator1.resolveParams === false)) return [
4340
- 3,
4341
- 8
4342
- ];
4343
- _tmp3 = node.argument;
4344
- return [
4345
- 3,
4346
- 10
4347
- ];
4348
- case 8:
4349
- return [
4350
- 4,
4351
- resolveNode(node.argument)
4352
- ];
4353
- case 9:
4354
- _tmp3 = _state.sent();
4355
- _state.label = 10;
4356
- case 10:
4357
- return [
4358
- 2,
4359
- operator1.apply(void 0, _tmp2.concat([
4360
- _tmp3
4361
- ]))
4362
- ];
4363
- case 11:
4364
- return [
4365
- 4,
4366
- resolveNode(node.argument)
4367
- ];
4368
- case 12:
4369
- return [
4370
- 2,
4371
- operator1.apply(void 0, [
4372
- _state.sent()
4373
- ])
4374
- ];
4375
- case 13:
4376
- return [
4377
- 2
4378
- ];
4379
- case 14:
4380
- if (!(node.type === "Object")) return [
4381
- 3,
4382
- 16
4383
- ];
4384
- attributes = node.attributes;
4385
- resolvedAttributes = {};
4386
- return [
4387
- 4,
4388
- Promise.all(attributes.map(function() {
4389
- var _ref = _async_to_generator(function(attr) {
4390
- var key, value;
4391
- return _ts_generator(this, function(_state) {
4392
- switch(_state.label){
4393
- case 0:
4394
- return [
4395
- 4,
4396
- resolveNode(attr.key)
4397
- ];
4398
- case 1:
4399
- key = _state.sent();
4400
- return [
4401
- 4,
4402
- resolveNode(attr.value)
4403
- ];
4404
- case 2:
4405
- value = _state.sent();
4406
- resolvedAttributes[key] = value;
4407
- return [
4408
- 2
4409
- ];
4410
- }
4411
- });
4412
- });
4413
- return function(attr) {
4414
- return _ref.apply(this, arguments);
4415
- };
4416
- }()))
4417
- ];
4418
- case 15:
4419
- _state.sent();
4420
- return [
4421
- 2,
4422
- resolvedAttributes
4423
- ];
4424
- case 16:
4425
- if (!(node.type === "CallExpression")) return [
4426
- 3,
4427
- 18
4428
- ];
4429
- expressionName = node.callTarget.name;
4430
- operator2 = _this.operators.expressions.get(expressionName);
4431
- if (!operator2) {
4432
- throw new Error("Unknown expression function: ".concat(expressionName));
4433
- }
4434
- if ("resolveParams" in operator2 && operator2.resolveParams === false) {
4435
- return [
4436
- 2,
4437
- operator2.apply(void 0, [
4438
- expressionContext
4439
- ].concat(_to_consumable_array(node.args)))
4440
- ];
4441
- }
4442
- return [
4443
- 4,
4444
- Promise.all(node.args.map(function() {
4445
- var _ref = _async_to_generator(function(n) {
4446
- return _ts_generator(this, function(_state) {
4447
- switch(_state.label){
4448
- case 0:
4449
- return [
4450
- 4,
4451
- resolveNode(n)
4452
- ];
4453
- case 1:
4454
- return [
4455
- 2,
4456
- _state.sent()
4457
- ];
4458
- }
4459
- });
4460
- });
4461
- return function(n) {
4462
- return _ref.apply(this, arguments);
4463
- };
4464
- }()))
4465
- ];
4466
- case 17:
4467
- args = _state.sent();
4468
- return [
4469
- 2,
4470
- operator2.apply(void 0, [
4471
- expressionContext
4472
- ].concat(_to_consumable_array(args)))
4473
- ];
4474
- case 18:
4475
- if (node.type === "ModelRef") {
4476
- return [
4477
- 2,
4478
- model.get(node.ref, {
4479
- context: {
4480
- model: options.model
4481
- }
4482
- })
4483
- ];
4484
- }
4485
- if (!(node.type === "MemberExpression")) return [
4486
- 3,
4487
- 21
4488
- ];
4489
- return [
4490
- 4,
4491
- resolveNode(node.object)
4492
- ];
4493
- case 19:
4494
- obj = _state.sent();
4495
- return [
4496
- 4,
4497
- resolveNode(node.property)
4498
- ];
4499
- case 20:
4500
- prop = _state.sent();
4501
- return [
4502
- 2,
4503
- obj[prop]
4504
- ];
4505
- case 21:
4506
- if (!(node.type === "Assignment")) return [
4507
- 3,
4508
- 26
4509
- ];
4510
- if (!(node.left.type === "ModelRef")) return [
4511
- 3,
4512
- 23
4513
- ];
4514
- return [
4515
- 4,
4516
- resolveNode(node.right)
4517
- ];
4518
- case 22:
4519
- value = _state.sent();
4520
- model.set([
4521
- [
4522
- node.left.ref,
4523
- value
4524
- ]
4525
- ]);
4526
- return [
4527
- 2,
4528
- value
4529
- ];
4530
- case 23:
4531
- if (!(node.left.type === "Identifier")) return [
4532
- 3,
4533
- 25
4534
- ];
4535
- return [
4536
- 4,
4537
- resolveNode(node.right)
4538
- ];
4539
- case 24:
4540
- value1 = _state.sent();
4541
- _this.vars[node.left.name] = value1;
4542
- return [
4543
- 2,
4544
- value1
4545
- ];
4546
- case 25:
4547
- return [
4548
- 2
4549
- ];
4550
- case 26:
4551
- if (!(node.type === "ConditionalExpression")) return [
4552
- 3,
4553
- 28
4554
- ];
4555
- return [
4556
- 4,
4557
- resolveNode(node.test)
4558
- ];
4559
- case 27:
4560
- result = _state.sent() ? node.consequent : node.alternate;
4561
- return [
4562
- 2,
4563
- resolveNode(result)
4564
- ];
4565
- case 28:
4566
- if (node.type === "ArrayExpression") {
4567
- return [
4568
- 2,
4569
- Promise.all(node.elements.map(function() {
4570
- var _ref = _async_to_generator(function(ele) {
4571
- return _ts_generator(this, function(_state) {
4572
- switch(_state.label){
4573
- case 0:
4574
- return [
4575
- 4,
4576
- resolveNode(ele)
4577
- ];
4578
- case 1:
4579
- return [
4580
- 2,
4581
- _state.sent()
4582
- ];
4583
- }
4584
- });
4585
- });
4586
- return function(ele) {
4587
- return _ref.apply(this, arguments);
4588
- };
4589
- }()))
4590
- ];
4591
- }
4592
- if (!(node.type === "Modification")) return [
4593
- 3,
4594
- 38
4595
- ];
4596
- operation = _this.operators.binary.get(node.operator);
4597
- if (!operation) return [
4598
- 3,
4599
- 37
4600
- ];
4601
- if (!("resolveParams" in operation)) return [
4602
- 3,
4603
- 33
4604
- ];
4605
- if (!(operation.resolveParams === false)) return [
4606
- 3,
4607
- 29
4608
- ];
4609
- newValue = operation(expressionContext, node.left, node.right);
4610
- return [
4611
- 3,
4612
- 32
4613
- ];
4614
- case 29:
4615
- _tmp4 = [
4616
- expressionContext
4617
- ];
4618
- return [
4619
- 4,
4620
- resolveNode(node.left)
4621
- ];
4622
- case 30:
4623
- _tmp4 = _tmp4.concat([
4624
- _state.sent()
4625
- ]);
4626
- return [
4627
- 4,
4628
- resolveNode(node.right)
4629
- ];
4630
- case 31:
4631
- newValue = operation.apply(void 0, _tmp4.concat([
4632
- _state.sent()
4633
- ]));
4634
- _state.label = 32;
4635
- case 32:
4636
- return [
4637
- 3,
4638
- 36
4639
- ];
4640
- case 33:
4641
- return [
4642
- 4,
4643
- resolveNode(node.left)
4644
- ];
4645
- case 34:
4646
- _tmp5 = [
4647
- _state.sent()
4648
- ];
4649
- return [
4650
- 4,
4651
- resolveNode(node.right)
4652
- ];
4653
- case 35:
4654
- newValue = operation.apply(void 0, _tmp5.concat([
4655
- _state.sent()
4656
- ]));
4657
- _state.label = 36;
4658
- case 36:
4659
- if (node.left.type === "ModelRef") {
4660
- model.set([
4661
- [
4662
- node.left.ref,
4663
- newValue
4664
- ]
4665
- ]);
4666
- } else if (node.left.type === "Identifier") {
4667
- _this.vars[node.left.name] = newValue;
4668
- }
4669
- return [
4670
- 2,
4671
- newValue
4672
- ];
4673
- case 37:
4674
- return [
4675
- 2,
4676
- resolveNode(node.left)
4677
- ];
4678
- case 38:
4679
- return [
4680
- 2,
4681
- _this._resolveNode(_currentValue, node, options)
4682
- ];
4683
- }
4684
- });
4685
- })();
4686
- }
4687
4197
  }
4688
4198
  ]);
4689
4199
  return ExpressionEvaluator;
@@ -8235,56 +7745,15 @@ var ReferenceAssetsPlugin = function() {
8235
7745
  validationController.reset();
8236
7746
  }
8237
7747
  });
8238
- flow.hooks.afterTransition.tap("player", function() {
8239
- var _ref = _async_to_generator(function(flowInstance) {
8240
- var _flowInstance_currentState, value, exp, result, e;
8241
- return _ts_generator(this, function(_state) {
8242
- switch(_state.label){
8243
- case 0:
8244
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8245
- if (!(value && value.state_type === "ACTION")) return [
8246
- 3,
8247
- 4
8248
- ];
8249
- exp = value.exp;
8250
- _state.label = 1;
8251
- case 1:
8252
- _state.trys.push([
8253
- 1,
8254
- 3,
8255
- ,
8256
- 4
8257
- ]);
8258
- return [
8259
- 4,
8260
- expressionEvaluator.evaluateAsync(exp)
8261
- ];
8262
- case 2:
8263
- result = _state.sent();
8264
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8265
- return [
8266
- 3,
8267
- 4
8268
- ];
8269
- case 3:
8270
- e = _state.sent();
8271
- flowResultDeferred.reject(e);
8272
- return [
8273
- 3,
8274
- 4
8275
- ];
8276
- case 4:
8277
- expressionEvaluator.reset();
8278
- return [
8279
- 2
8280
- ];
8281
- }
8282
- });
8283
- });
8284
- return function(flowInstance) {
8285
- return _ref.apply(this, arguments);
8286
- };
8287
- }());
7748
+ flow.hooks.afterTransition.tap("player", function(flowInstance) {
7749
+ var _flowInstance_currentState;
7750
+ var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7751
+ if (value && value.state_type === "ACTION") {
7752
+ var exp = value.exp;
7753
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp)));
7754
+ }
7755
+ expressionEvaluator.reset();
7756
+ });
8288
7757
  });
8289
7758
  this.hooks.dataController.call(dataController);
8290
7759
  validationController.setOptions({