@player-ui/async-node-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.
@@ -5140,20 +5140,15 @@ var AsyncNodePlugin = function() {
5140
5140
  }();
5141
5141
  var ViewInstance = /*#__PURE__*/ function() {
5142
5142
  function ViewInstance(initialView, resolverOptions) {
5143
- var _this = this;
5144
5143
  _class_call_check(this, ViewInstance);
5145
5144
  this.hooks = {
5146
5145
  onUpdate: new SyncHook(),
5147
5146
  parser: new SyncHook(),
5148
5147
  resolver: new SyncHook(),
5149
- onTemplatePluginCreated: new SyncHook(),
5150
5148
  templatePlugin: new SyncHook()
5151
5149
  };
5152
5150
  this.initialView = initialView;
5153
5151
  this.resolverOptions = resolverOptions;
5154
- this.hooks.onTemplatePluginCreated.tap("view", function(templatePlugin) {
5155
- _this.templatePlugin = templatePlugin;
5156
- });
5157
5152
  }
5158
5153
  _create_class(ViewInstance, [
5159
5154
  {
@@ -5200,6 +5195,12 @@ var AsyncNodePlugin = function() {
5200
5195
  var _this_validationProvider;
5201
5196
  return (_this_validationProvider = this.validationProvider) === null || _this_validationProvider === void 0 ? void 0 : _this_validationProvider.getValidationsForBinding(binding);
5202
5197
  }
5198
+ },
5199
+ {
5200
+ key: "setTemplatePlugin",
5201
+ value: function setTemplatePlugin(plugin) {
5202
+ this.templatePlugin = plugin;
5203
+ }
5203
5204
  }
5204
5205
  ]);
5205
5206
  return ViewInstance;
@@ -5498,6 +5499,7 @@ var AsyncNodePlugin = function() {
5498
5499
  value: function apply(view) {
5499
5500
  view.hooks.parser.tap("template", this.applyParser.bind(this));
5500
5501
  view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
5502
+ view.setTemplatePlugin(this);
5501
5503
  }
5502
5504
  }
5503
5505
  ]);
@@ -7106,8 +7108,7 @@ var AsyncNodePlugin = function() {
7106
7108
  var _this1 = this;
7107
7109
  _class_call_check(this, ViewController);
7108
7110
  this.hooks = {
7109
- /** Do any processing before the `View` instance is created */ resolveView: new SyncWaterfallHook(),
7110
- // The hook right before the View starts resolving. Attach anything custom here
7111
+ resolveView: new SyncWaterfallHook(),
7111
7112
  view: new SyncHook()
7112
7113
  };
7113
7114
  this.transformRegistry = new Registry();
@@ -7155,6 +7156,7 @@ var AsyncNodePlugin = function() {
7155
7156
  ]));
7156
7157
  }
7157
7158
  });
7159
+ this.viewPlugins = this.createViewPlugins();
7158
7160
  }
7159
7161
  _create_class(ViewController, [
7160
7162
  {
@@ -7210,9 +7212,50 @@ var AsyncNodePlugin = function() {
7210
7212
  }
7211
7213
  var view = new ViewInstance(source, this.viewOptions);
7212
7214
  this.currentView = view;
7215
+ this.applyViewPlugins(view);
7213
7216
  this.hooks.view.call(view);
7214
7217
  view.update();
7215
7218
  }
7219
+ },
7220
+ {
7221
+ key: "applyViewPlugins",
7222
+ value: function applyViewPlugins(view) {
7223
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7224
+ try {
7225
+ for(var _iterator = this.viewPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7226
+ var plugin = _step.value;
7227
+ plugin.apply(view);
7228
+ }
7229
+ } catch (err) {
7230
+ _didIteratorError = true;
7231
+ _iteratorError = err;
7232
+ } finally{
7233
+ try {
7234
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7235
+ _iterator.return();
7236
+ }
7237
+ } finally{
7238
+ if (_didIteratorError) {
7239
+ throw _iteratorError;
7240
+ }
7241
+ }
7242
+ }
7243
+ }
7244
+ },
7245
+ {
7246
+ key: "createViewPlugins",
7247
+ value: function createViewPlugins() {
7248
+ var pluginOptions = toNodeResolveOptions(this.viewOptions);
7249
+ return [
7250
+ new AssetPlugin(),
7251
+ new SwitchPlugin(pluginOptions),
7252
+ new ApplicabilityPlugin(),
7253
+ new AssetTransformCorePlugin(this.transformRegistry),
7254
+ new StringResolverPlugin(),
7255
+ new TemplatePlugin(pluginOptions),
7256
+ new MultiNodePlugin()
7257
+ ];
7258
+ }
7216
7259
  }
7217
7260
  ]);
7218
7261
  return ViewController;
@@ -7585,35 +7628,6 @@ var AsyncNodePlugin = function() {
7585
7628
  ref: Symbol("not-started"),
7586
7629
  status: "not-started"
7587
7630
  };
7588
- var DefaultViewPlugin = /*#__PURE__*/ function() {
7589
- function DefaultViewPlugin() {
7590
- _class_call_check(this, DefaultViewPlugin);
7591
- this.name = "default-view-plugin";
7592
- }
7593
- _create_class(DefaultViewPlugin, [
7594
- {
7595
- key: "apply",
7596
- value: function apply(player) {
7597
- var _this = this;
7598
- player.hooks.viewController.tap(this.name, function(viewController) {
7599
- viewController.hooks.view.tap(_this.name, function(view) {
7600
- var pluginOptions = toNodeResolveOptions(view.resolverOptions);
7601
- new AssetPlugin().apply(view);
7602
- new SwitchPlugin(pluginOptions).apply(view);
7603
- new ApplicabilityPlugin().apply(view);
7604
- new AssetTransformCorePlugin(viewController.transformRegistry).apply(view);
7605
- new StringResolverPlugin().apply(view);
7606
- var templatePlugin = new TemplatePlugin(pluginOptions);
7607
- templatePlugin.apply(view);
7608
- view.hooks.onTemplatePluginCreated.call(templatePlugin);
7609
- new MultiNodePlugin().apply(view);
7610
- });
7611
- });
7612
- }
7613
- }
7614
- ]);
7615
- return DefaultViewPlugin;
7616
- }();
7617
7631
  var PLAYER_VERSION = "__VERSION__";
7618
7632
  var COMMIT = "__GIT_COMMIT__";
7619
7633
  var _Player = /*#__PURE__*/ function() {
@@ -7643,8 +7657,7 @@ var AsyncNodePlugin = function() {
7643
7657
  }
7644
7658
  this.config = config || {};
7645
7659
  this.config.plugins = [
7646
- new DefaultExpPlugin(),
7647
- new DefaultViewPlugin()
7660
+ new DefaultExpPlugin()
7648
7661
  ].concat(_to_consumable_array(this.config.plugins || []), [
7649
7662
  new FlowExpPlugin()
7650
7663
  ]);
@@ -7957,11 +7970,9 @@ var AsyncNodePlugin = function() {
7957
7970
  }),
7958
7971
  constants: this.constantsController
7959
7972
  });
7960
- this.hooks.viewController.tap("player", function(vc) {
7961
- vc.hooks.view.tap("player", function(view) {
7962
- validationController.onView(view);
7963
- _this.hooks.view.call(view);
7964
- });
7973
+ viewController.hooks.view.tap("player", function(view) {
7974
+ validationController.onView(view);
7975
+ _this.hooks.view.call(view);
7965
7976
  });
7966
7977
  this.hooks.viewController.call(viewController);
7967
7978
  return {