@player-ui/beacon-plugin 0.13.0-next.0 → 0.13.0-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.
@@ -5144,20 +5144,15 @@ var BeaconPlugin = function() {
5144
5144
  }();
5145
5145
  var ViewInstance = /*#__PURE__*/ function() {
5146
5146
  function ViewInstance(initialView, resolverOptions) {
5147
- var _this = this;
5148
5147
  _class_call_check(this, ViewInstance);
5149
5148
  this.hooks = {
5150
5149
  onUpdate: new SyncHook(),
5151
5150
  parser: new SyncHook(),
5152
5151
  resolver: new SyncHook(),
5153
- onTemplatePluginCreated: new SyncHook(),
5154
5152
  templatePlugin: new SyncHook()
5155
5153
  };
5156
5154
  this.initialView = initialView;
5157
5155
  this.resolverOptions = resolverOptions;
5158
- this.hooks.onTemplatePluginCreated.tap("view", function(templatePlugin) {
5159
- _this.templatePlugin = templatePlugin;
5160
- });
5161
5156
  }
5162
5157
  _create_class(ViewInstance, [
5163
5158
  {
@@ -5204,6 +5199,12 @@ var BeaconPlugin = function() {
5204
5199
  var _this_validationProvider;
5205
5200
  return (_this_validationProvider = this.validationProvider) === null || _this_validationProvider === void 0 ? void 0 : _this_validationProvider.getValidationsForBinding(binding);
5206
5201
  }
5202
+ },
5203
+ {
5204
+ key: "setTemplatePlugin",
5205
+ value: function setTemplatePlugin(plugin) {
5206
+ this.templatePlugin = plugin;
5207
+ }
5207
5208
  }
5208
5209
  ]);
5209
5210
  return ViewInstance;
@@ -5375,6 +5376,7 @@ var BeaconPlugin = function() {
5375
5376
  value: function apply(view) {
5376
5377
  view.hooks.parser.tap("template", this.applyParser.bind(this));
5377
5378
  view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
5379
+ view.setTemplatePlugin(this);
5378
5380
  }
5379
5381
  }
5380
5382
  ]);
@@ -6983,8 +6985,7 @@ var BeaconPlugin = function() {
6983
6985
  var _this1 = this;
6984
6986
  _class_call_check(this, ViewController);
6985
6987
  this.hooks = {
6986
- /** Do any processing before the `View` instance is created */ resolveView: new SyncWaterfallHook(),
6987
- // The hook right before the View starts resolving. Attach anything custom here
6988
+ resolveView: new SyncWaterfallHook(),
6988
6989
  view: new SyncHook()
6989
6990
  };
6990
6991
  this.transformRegistry = new Registry();
@@ -7032,6 +7033,7 @@ var BeaconPlugin = function() {
7032
7033
  ]));
7033
7034
  }
7034
7035
  });
7036
+ this.viewPlugins = this.createViewPlugins();
7035
7037
  }
7036
7038
  _create_class(ViewController, [
7037
7039
  {
@@ -7087,9 +7089,50 @@ var BeaconPlugin = function() {
7087
7089
  }
7088
7090
  var view = new ViewInstance(source, this.viewOptions);
7089
7091
  this.currentView = view;
7092
+ this.applyViewPlugins(view);
7090
7093
  this.hooks.view.call(view);
7091
7094
  view.update();
7092
7095
  }
7096
+ },
7097
+ {
7098
+ key: "applyViewPlugins",
7099
+ value: function applyViewPlugins(view) {
7100
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7101
+ try {
7102
+ for(var _iterator = this.viewPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7103
+ var plugin = _step.value;
7104
+ plugin.apply(view);
7105
+ }
7106
+ } catch (err) {
7107
+ _didIteratorError = true;
7108
+ _iteratorError = err;
7109
+ } finally{
7110
+ try {
7111
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7112
+ _iterator.return();
7113
+ }
7114
+ } finally{
7115
+ if (_didIteratorError) {
7116
+ throw _iteratorError;
7117
+ }
7118
+ }
7119
+ }
7120
+ }
7121
+ },
7122
+ {
7123
+ key: "createViewPlugins",
7124
+ value: function createViewPlugins() {
7125
+ var pluginOptions = toNodeResolveOptions(this.viewOptions);
7126
+ return [
7127
+ new AssetPlugin(),
7128
+ new SwitchPlugin(pluginOptions),
7129
+ new ApplicabilityPlugin(),
7130
+ new AssetTransformCorePlugin(this.transformRegistry),
7131
+ new StringResolverPlugin(),
7132
+ new TemplatePlugin(pluginOptions),
7133
+ new MultiNodePlugin()
7134
+ ];
7135
+ }
7093
7136
  }
7094
7137
  ]);
7095
7138
  return ViewController;
@@ -7462,35 +7505,6 @@ var BeaconPlugin = function() {
7462
7505
  ref: Symbol("not-started"),
7463
7506
  status: "not-started"
7464
7507
  };
7465
- var DefaultViewPlugin = /*#__PURE__*/ function() {
7466
- function DefaultViewPlugin() {
7467
- _class_call_check(this, DefaultViewPlugin);
7468
- this.name = "default-view-plugin";
7469
- }
7470
- _create_class(DefaultViewPlugin, [
7471
- {
7472
- key: "apply",
7473
- value: function apply(player) {
7474
- var _this = this;
7475
- player.hooks.viewController.tap(this.name, function(viewController) {
7476
- viewController.hooks.view.tap(_this.name, function(view) {
7477
- var pluginOptions = toNodeResolveOptions(view.resolverOptions);
7478
- new AssetPlugin().apply(view);
7479
- new SwitchPlugin(pluginOptions).apply(view);
7480
- new ApplicabilityPlugin().apply(view);
7481
- new AssetTransformCorePlugin(viewController.transformRegistry).apply(view);
7482
- new StringResolverPlugin().apply(view);
7483
- var templatePlugin = new TemplatePlugin(pluginOptions);
7484
- templatePlugin.apply(view);
7485
- view.hooks.onTemplatePluginCreated.call(templatePlugin);
7486
- new MultiNodePlugin().apply(view);
7487
- });
7488
- });
7489
- }
7490
- }
7491
- ]);
7492
- return DefaultViewPlugin;
7493
- }();
7494
7508
  var PLAYER_VERSION = "__VERSION__";
7495
7509
  var COMMIT = "__GIT_COMMIT__";
7496
7510
  var _Player = /*#__PURE__*/ function() {
@@ -7520,8 +7534,7 @@ var BeaconPlugin = function() {
7520
7534
  }
7521
7535
  this.config = config || {};
7522
7536
  this.config.plugins = [
7523
- new DefaultExpPlugin(),
7524
- new DefaultViewPlugin()
7537
+ new DefaultExpPlugin()
7525
7538
  ].concat(_to_consumable_array(this.config.plugins || []), [
7526
7539
  new FlowExpPlugin()
7527
7540
  ]);
@@ -7834,11 +7847,9 @@ var BeaconPlugin = function() {
7834
7847
  }),
7835
7848
  constants: this.constantsController
7836
7849
  });
7837
- this.hooks.viewController.tap("player", function(vc) {
7838
- vc.hooks.view.tap("player", function(view) {
7839
- validationController.onView(view);
7840
- _this.hooks.view.call(view);
7841
- });
7850
+ viewController.hooks.view.tap("player", function(view) {
7851
+ validationController.onView(view);
7852
+ _this.hooks.view.call(view);
7842
7853
  });
7843
7854
  this.hooks.viewController.call(viewController);
7844
7855
  return {