@player-ui/reference-assets-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.
@@ -5355,20 +5355,15 @@ var ReferenceAssetsPlugin = function() {
5355
5355
  }();
5356
5356
  var ViewInstance = /*#__PURE__*/ function() {
5357
5357
  function ViewInstance(initialView, resolverOptions) {
5358
- var _this = this;
5359
5358
  _class_call_check(this, ViewInstance);
5360
5359
  this.hooks = {
5361
5360
  onUpdate: new SyncHook(),
5362
5361
  parser: new SyncHook(),
5363
5362
  resolver: new SyncHook(),
5364
- onTemplatePluginCreated: new SyncHook(),
5365
5363
  templatePlugin: new SyncHook()
5366
5364
  };
5367
5365
  this.initialView = initialView;
5368
5366
  this.resolverOptions = resolverOptions;
5369
- this.hooks.onTemplatePluginCreated.tap("view", function(templatePlugin) {
5370
- _this.templatePlugin = templatePlugin;
5371
- });
5372
5367
  }
5373
5368
  _create_class(ViewInstance, [
5374
5369
  {
@@ -5415,6 +5410,12 @@ var ReferenceAssetsPlugin = function() {
5415
5410
  var _this_validationProvider;
5416
5411
  return (_this_validationProvider = this.validationProvider) === null || _this_validationProvider === void 0 ? void 0 : _this_validationProvider.getValidationsForBinding(binding);
5417
5412
  }
5413
+ },
5414
+ {
5415
+ key: "setTemplatePlugin",
5416
+ value: function setTemplatePlugin(plugin) {
5417
+ this.templatePlugin = plugin;
5418
+ }
5418
5419
  }
5419
5420
  ]);
5420
5421
  return ViewInstance;
@@ -5713,6 +5714,7 @@ var ReferenceAssetsPlugin = function() {
5713
5714
  value: function apply(view) {
5714
5715
  view.hooks.parser.tap("template", this.applyParser.bind(this));
5715
5716
  view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
5717
+ view.setTemplatePlugin(this);
5716
5718
  }
5717
5719
  }
5718
5720
  ]);
@@ -7321,8 +7323,7 @@ var ReferenceAssetsPlugin = function() {
7321
7323
  var _this1 = this;
7322
7324
  _class_call_check(this, ViewController);
7323
7325
  this.hooks = {
7324
- /** Do any processing before the `View` instance is created */ resolveView: new SyncWaterfallHook(),
7325
- // The hook right before the View starts resolving. Attach anything custom here
7326
+ resolveView: new SyncWaterfallHook(),
7326
7327
  view: new SyncHook()
7327
7328
  };
7328
7329
  this.transformRegistry = new Registry();
@@ -7370,6 +7371,7 @@ var ReferenceAssetsPlugin = function() {
7370
7371
  ]));
7371
7372
  }
7372
7373
  });
7374
+ this.viewPlugins = this.createViewPlugins();
7373
7375
  }
7374
7376
  _create_class(ViewController, [
7375
7377
  {
@@ -7425,9 +7427,50 @@ var ReferenceAssetsPlugin = function() {
7425
7427
  }
7426
7428
  var view = new ViewInstance(source, this.viewOptions);
7427
7429
  this.currentView = view;
7430
+ this.applyViewPlugins(view);
7428
7431
  this.hooks.view.call(view);
7429
7432
  view.update();
7430
7433
  }
7434
+ },
7435
+ {
7436
+ key: "applyViewPlugins",
7437
+ value: function applyViewPlugins(view) {
7438
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7439
+ try {
7440
+ for(var _iterator = this.viewPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7441
+ var plugin = _step.value;
7442
+ plugin.apply(view);
7443
+ }
7444
+ } catch (err) {
7445
+ _didIteratorError = true;
7446
+ _iteratorError = err;
7447
+ } finally{
7448
+ try {
7449
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7450
+ _iterator.return();
7451
+ }
7452
+ } finally{
7453
+ if (_didIteratorError) {
7454
+ throw _iteratorError;
7455
+ }
7456
+ }
7457
+ }
7458
+ }
7459
+ },
7460
+ {
7461
+ key: "createViewPlugins",
7462
+ value: function createViewPlugins() {
7463
+ var pluginOptions = toNodeResolveOptions(this.viewOptions);
7464
+ return [
7465
+ new AssetPlugin(),
7466
+ new SwitchPlugin(pluginOptions),
7467
+ new ApplicabilityPlugin(),
7468
+ new AssetTransformCorePlugin(this.transformRegistry),
7469
+ new StringResolverPlugin(),
7470
+ new TemplatePlugin(pluginOptions),
7471
+ new MultiNodePlugin()
7472
+ ];
7473
+ }
7431
7474
  }
7432
7475
  ]);
7433
7476
  return ViewController;
@@ -7800,35 +7843,6 @@ var ReferenceAssetsPlugin = function() {
7800
7843
  ref: Symbol("not-started"),
7801
7844
  status: "not-started"
7802
7845
  };
7803
- var DefaultViewPlugin = /*#__PURE__*/ function() {
7804
- function DefaultViewPlugin() {
7805
- _class_call_check(this, DefaultViewPlugin);
7806
- this.name = "default-view-plugin";
7807
- }
7808
- _create_class(DefaultViewPlugin, [
7809
- {
7810
- key: "apply",
7811
- value: function apply(player) {
7812
- var _this = this;
7813
- player.hooks.viewController.tap(this.name, function(viewController) {
7814
- viewController.hooks.view.tap(_this.name, function(view) {
7815
- var pluginOptions = toNodeResolveOptions(view.resolverOptions);
7816
- new AssetPlugin().apply(view);
7817
- new SwitchPlugin(pluginOptions).apply(view);
7818
- new ApplicabilityPlugin().apply(view);
7819
- new AssetTransformCorePlugin(viewController.transformRegistry).apply(view);
7820
- new StringResolverPlugin().apply(view);
7821
- var templatePlugin = new TemplatePlugin(pluginOptions);
7822
- templatePlugin.apply(view);
7823
- view.hooks.onTemplatePluginCreated.call(templatePlugin);
7824
- new MultiNodePlugin().apply(view);
7825
- });
7826
- });
7827
- }
7828
- }
7829
- ]);
7830
- return DefaultViewPlugin;
7831
- }();
7832
7846
  var PLAYER_VERSION = "__VERSION__";
7833
7847
  var COMMIT = "__GIT_COMMIT__";
7834
7848
  var _Player = /*#__PURE__*/ function() {
@@ -7858,8 +7872,7 @@ var ReferenceAssetsPlugin = function() {
7858
7872
  }
7859
7873
  this.config = config || {};
7860
7874
  this.config.plugins = [
7861
- new DefaultExpPlugin(),
7862
- new DefaultViewPlugin()
7875
+ new DefaultExpPlugin()
7863
7876
  ].concat(_to_consumable_array(this.config.plugins || []), [
7864
7877
  new FlowExpPlugin()
7865
7878
  ]);
@@ -8172,11 +8185,9 @@ var ReferenceAssetsPlugin = function() {
8172
8185
  }),
8173
8186
  constants: this.constantsController
8174
8187
  });
8175
- this.hooks.viewController.tap("player", function(vc) {
8176
- vc.hooks.view.tap("player", function(view) {
8177
- validationController.onView(view);
8178
- _this.hooks.view.call(view);
8179
- });
8188
+ viewController.hooks.view.tap("player", function(view) {
8189
+ validationController.onView(view);
8190
+ _this.hooks.view.call(view);
8180
8191
  });
8181
8192
  this.hooks.viewController.call(viewController);
8182
8193
  return {