@player-ui/common-types-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.
@@ -5174,20 +5174,15 @@ var CommonTypesPlugin = function() {
5174
5174
  }();
5175
5175
  var ViewInstance = /*#__PURE__*/ function() {
5176
5176
  function ViewInstance(initialView, resolverOptions) {
5177
- var _this = this;
5178
5177
  _class_call_check(this, ViewInstance);
5179
5178
  this.hooks = {
5180
5179
  onUpdate: new SyncHook(),
5181
5180
  parser: new SyncHook(),
5182
5181
  resolver: new SyncHook(),
5183
- onTemplatePluginCreated: new SyncHook(),
5184
5182
  templatePlugin: new SyncHook()
5185
5183
  };
5186
5184
  this.initialView = initialView;
5187
5185
  this.resolverOptions = resolverOptions;
5188
- this.hooks.onTemplatePluginCreated.tap("view", function(templatePlugin) {
5189
- _this.templatePlugin = templatePlugin;
5190
- });
5191
5186
  }
5192
5187
  _create_class(ViewInstance, [
5193
5188
  {
@@ -5234,6 +5229,12 @@ var CommonTypesPlugin = function() {
5234
5229
  var _this_validationProvider;
5235
5230
  return (_this_validationProvider = this.validationProvider) === null || _this_validationProvider === void 0 ? void 0 : _this_validationProvider.getValidationsForBinding(binding);
5236
5231
  }
5232
+ },
5233
+ {
5234
+ key: "setTemplatePlugin",
5235
+ value: function setTemplatePlugin(plugin) {
5236
+ this.templatePlugin = plugin;
5237
+ }
5237
5238
  }
5238
5239
  ]);
5239
5240
  return ViewInstance;
@@ -5405,6 +5406,7 @@ var CommonTypesPlugin = function() {
5405
5406
  value: function apply(view) {
5406
5407
  view.hooks.parser.tap("template", this.applyParser.bind(this));
5407
5408
  view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
5409
+ view.setTemplatePlugin(this);
5408
5410
  }
5409
5411
  }
5410
5412
  ]);
@@ -7013,8 +7015,7 @@ var CommonTypesPlugin = function() {
7013
7015
  var _this1 = this;
7014
7016
  _class_call_check(this, ViewController);
7015
7017
  this.hooks = {
7016
- /** Do any processing before the `View` instance is created */ resolveView: new SyncWaterfallHook(),
7017
- // The hook right before the View starts resolving. Attach anything custom here
7018
+ resolveView: new SyncWaterfallHook(),
7018
7019
  view: new SyncHook()
7019
7020
  };
7020
7021
  this.transformRegistry = new Registry();
@@ -7062,6 +7063,7 @@ var CommonTypesPlugin = function() {
7062
7063
  ]));
7063
7064
  }
7064
7065
  });
7066
+ this.viewPlugins = this.createViewPlugins();
7065
7067
  }
7066
7068
  _create_class(ViewController, [
7067
7069
  {
@@ -7117,9 +7119,50 @@ var CommonTypesPlugin = function() {
7117
7119
  }
7118
7120
  var view = new ViewInstance(source, this.viewOptions);
7119
7121
  this.currentView = view;
7122
+ this.applyViewPlugins(view);
7120
7123
  this.hooks.view.call(view);
7121
7124
  view.update();
7122
7125
  }
7126
+ },
7127
+ {
7128
+ key: "applyViewPlugins",
7129
+ value: function applyViewPlugins(view) {
7130
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7131
+ try {
7132
+ for(var _iterator = this.viewPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7133
+ var plugin = _step.value;
7134
+ plugin.apply(view);
7135
+ }
7136
+ } catch (err) {
7137
+ _didIteratorError = true;
7138
+ _iteratorError = err;
7139
+ } finally{
7140
+ try {
7141
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7142
+ _iterator.return();
7143
+ }
7144
+ } finally{
7145
+ if (_didIteratorError) {
7146
+ throw _iteratorError;
7147
+ }
7148
+ }
7149
+ }
7150
+ }
7151
+ },
7152
+ {
7153
+ key: "createViewPlugins",
7154
+ value: function createViewPlugins() {
7155
+ var pluginOptions = toNodeResolveOptions(this.viewOptions);
7156
+ return [
7157
+ new AssetPlugin(),
7158
+ new SwitchPlugin(pluginOptions),
7159
+ new ApplicabilityPlugin(),
7160
+ new AssetTransformCorePlugin(this.transformRegistry),
7161
+ new StringResolverPlugin(),
7162
+ new TemplatePlugin(pluginOptions),
7163
+ new MultiNodePlugin()
7164
+ ];
7165
+ }
7123
7166
  }
7124
7167
  ]);
7125
7168
  return ViewController;
@@ -7492,35 +7535,6 @@ var CommonTypesPlugin = function() {
7492
7535
  ref: Symbol("not-started"),
7493
7536
  status: "not-started"
7494
7537
  };
7495
- var DefaultViewPlugin = /*#__PURE__*/ function() {
7496
- function DefaultViewPlugin() {
7497
- _class_call_check(this, DefaultViewPlugin);
7498
- this.name = "default-view-plugin";
7499
- }
7500
- _create_class(DefaultViewPlugin, [
7501
- {
7502
- key: "apply",
7503
- value: function apply(player) {
7504
- var _this = this;
7505
- player.hooks.viewController.tap(this.name, function(viewController) {
7506
- viewController.hooks.view.tap(_this.name, function(view) {
7507
- var pluginOptions = toNodeResolveOptions(view.resolverOptions);
7508
- new AssetPlugin().apply(view);
7509
- new SwitchPlugin(pluginOptions).apply(view);
7510
- new ApplicabilityPlugin().apply(view);
7511
- new AssetTransformCorePlugin(viewController.transformRegistry).apply(view);
7512
- new StringResolverPlugin().apply(view);
7513
- var templatePlugin = new TemplatePlugin(pluginOptions);
7514
- templatePlugin.apply(view);
7515
- view.hooks.onTemplatePluginCreated.call(templatePlugin);
7516
- new MultiNodePlugin().apply(view);
7517
- });
7518
- });
7519
- }
7520
- }
7521
- ]);
7522
- return DefaultViewPlugin;
7523
- }();
7524
7538
  var PLAYER_VERSION = "__VERSION__";
7525
7539
  var COMMIT = "__GIT_COMMIT__";
7526
7540
  var _Player = /*#__PURE__*/ function() {
@@ -7550,8 +7564,7 @@ var CommonTypesPlugin = function() {
7550
7564
  }
7551
7565
  this.config = config || {};
7552
7566
  this.config.plugins = [
7553
- new DefaultExpPlugin(),
7554
- new DefaultViewPlugin()
7567
+ new DefaultExpPlugin()
7555
7568
  ].concat(_to_consumable_array(this.config.plugins || []), [
7556
7569
  new FlowExpPlugin()
7557
7570
  ]);
@@ -7864,11 +7877,9 @@ var CommonTypesPlugin = function() {
7864
7877
  }),
7865
7878
  constants: this.constantsController
7866
7879
  });
7867
- this.hooks.viewController.tap("player", function(vc) {
7868
- vc.hooks.view.tap("player", function(view) {
7869
- validationController.onView(view);
7870
- _this.hooks.view.call(view);
7871
- });
7880
+ viewController.hooks.view.tap("player", function(view) {
7881
+ validationController.onView(view);
7882
+ _this.hooks.view.call(view);
7872
7883
  });
7873
7884
  this.hooks.viewController.call(viewController);
7874
7885
  return {