@player-ui/markdown-plugin 0.13.0-next.1 → 0.13.0-next.3

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.
@@ -6828,9 +6828,10 @@ var MarkdownPlugin = function() {
6828
6828
  var import_timm7 = __toESM(require_timm(), 1);
6829
6829
  var import_timm8 = __toESM(require_timm(), 1);
6830
6830
  var import_p_defer = __toESM(require_p_defer(), 1);
6831
+ var import_queue_microtask = __toESM(require_queue_microtask(), 1);
6831
6832
  var import_p_defer2 = __toESM(require_p_defer(), 1);
6832
6833
  var import_timm9 = __toESM(require_timm(), 1);
6833
- var import_queue_microtask = __toESM(require_queue_microtask(), 1);
6834
+ var import_queue_microtask2 = __toESM(require_queue_microtask(), 1);
6834
6835
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+partial-match-registry@0.0.0/node_modules/@player-ui/partial-match-registry/dist/index.mjs
6835
6836
  var import_sorted_array = __toESM(require_sorted_array(), 1);
6836
6837
  function traverseObj(object) {
@@ -10204,13 +10205,13 @@ var MarkdownPlugin = function() {
10204
10205
  this.isTransitioning = false;
10205
10206
  this.hooks = {
10206
10207
  beforeStart: new SyncBailHook(),
10207
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
10208
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
10209
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
10210
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
10211
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
10212
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
10213
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
10208
+ onStart: new SyncHook(),
10209
+ onEnd: new SyncHook(),
10210
+ skipTransition: new SyncBailHook(),
10211
+ beforeTransition: new SyncWaterfallHook(),
10212
+ resolveTransitionNode: new SyncWaterfallHook(),
10213
+ transition: new SyncHook(),
10214
+ afterTransition: new SyncHook()
10214
10215
  };
10215
10216
  this.id = id;
10216
10217
  this.flow = flow3;
@@ -11300,7 +11301,7 @@ var MarkdownPlugin = function() {
11300
11301
  }
11301
11302
  if (!this.pendingUpdate.scheduled && !silent) {
11302
11303
  this.pendingUpdate.scheduled = true;
11303
- (0, import_queue_microtask.default)(function() {
11304
+ (0, import_queue_microtask2.default)(function() {
11304
11305
  var _this_pendingUpdate, _this_currentView;
11305
11306
  var updates = (_this_pendingUpdate = _this.pendingUpdate) === null || _this_pendingUpdate === void 0 ? void 0 : _this_pendingUpdate.changedBindings;
11306
11307
  _this.pendingUpdate = void 0;
@@ -11969,95 +11970,41 @@ var MarkdownPlugin = function() {
11969
11970
  validationController.reset();
11970
11971
  }
11971
11972
  });
11972
- flow3.hooks.afterTransition.tap("player", function(flowInstance) {
11973
+ flow3.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
11973
11974
  var _flowInstance_currentState;
11974
11975
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
11975
- if (value && value.state_type === "ACTION") {
11976
+ if (value && value.state_type === "ASYNC_ACTION") {
11976
11977
  var exp = value.exp;
11977
- var result = expressionEvaluator.evaluate(exp);
11978
- if (isPromiseLike(result)) {
11978
+ try {
11979
+ var result = expressionEvaluator.evaluateAsync(exp);
11980
+ if (isPromiseLike(result)) {
11981
+ if (value.await) {
11982
+ (0, import_queue_microtask.default)(function() {
11983
+ result.then(function(r) {
11984
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
11985
+ }).catch(flowResultDeferred.reject);
11986
+ });
11987
+ } else {
11988
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
11989
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
11990
+ }
11991
+ } else {
11992
+ _this.logger.warn("Non async expression used in async action node");
11993
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
11994
+ }
11995
+ } catch (e) {
11996
+ flowResultDeferred.reject(e);
11997
+ }
11998
+ } else if (value && value.state_type === "ACTION") {
11999
+ var exp1 = value.exp;
12000
+ var result1 = expressionEvaluator.evaluate(exp1);
12001
+ if (isPromiseLike(result1)) {
11979
12002
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
11980
12003
  }
11981
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
12004
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
11982
12005
  }
11983
12006
  expressionEvaluator.reset();
11984
12007
  });
11985
- var _this1 = _this;
11986
- flow3.hooks.afterTransition.tap("player", function() {
11987
- var _ref = _async_to_generator(function(flowInstance) {
11988
- var _flowInstance_currentState, value, exp, result, e;
11989
- return _ts_generator(this, function(_state) {
11990
- switch(_state.label){
11991
- case 0:
11992
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
11993
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
11994
- 3,
11995
- 8
11996
- ];
11997
- exp = value.exp;
11998
- _state.label = 1;
11999
- case 1:
12000
- _state.trys.push([
12001
- 1,
12002
- 7,
12003
- ,
12004
- 8
12005
- ]);
12006
- result = expressionEvaluator.evaluateAsync(exp);
12007
- if (!isPromiseLike(result)) return [
12008
- 3,
12009
- 5
12010
- ];
12011
- if (!value.await) return [
12012
- 3,
12013
- 3
12014
- ];
12015
- return [
12016
- 4,
12017
- result
12018
- ];
12019
- case 2:
12020
- result = _state.sent();
12021
- return [
12022
- 3,
12023
- 4
12024
- ];
12025
- case 3:
12026
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
12027
- _state.label = 4;
12028
- case 4:
12029
- return [
12030
- 3,
12031
- 6
12032
- ];
12033
- case 5:
12034
- _this1.logger.warn("Non async expression used in async action node");
12035
- _state.label = 6;
12036
- case 6:
12037
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
12038
- return [
12039
- 3,
12040
- 8
12041
- ];
12042
- case 7:
12043
- e = _state.sent();
12044
- flowResultDeferred.reject(e);
12045
- return [
12046
- 3,
12047
- 8
12048
- ];
12049
- case 8:
12050
- expressionEvaluator.reset();
12051
- return [
12052
- 2
12053
- ];
12054
- }
12055
- });
12056
- });
12057
- return function(flowInstance) {
12058
- return _ref.apply(this, arguments);
12059
- };
12060
- }());
12061
12008
  });
12062
12009
  this.hooks.dataController.call(dataController);
12063
12010
  validationController.setOptions({