@player-ui/markdown-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.
@@ -9392,20 +9392,15 @@ var MarkdownPlugin = function() {
9392
9392
  }();
9393
9393
  var ViewInstance = /*#__PURE__*/ function() {
9394
9394
  function ViewInstance(initialView, resolverOptions) {
9395
- var _this = this;
9396
9395
  _class_call_check(this, ViewInstance);
9397
9396
  this.hooks = {
9398
9397
  onUpdate: new SyncHook(),
9399
9398
  parser: new SyncHook(),
9400
9399
  resolver: new SyncHook(),
9401
- onTemplatePluginCreated: new SyncHook(),
9402
9400
  templatePlugin: new SyncHook()
9403
9401
  };
9404
9402
  this.initialView = initialView;
9405
9403
  this.resolverOptions = resolverOptions;
9406
- this.hooks.onTemplatePluginCreated.tap("view", function(templatePlugin) {
9407
- _this.templatePlugin = templatePlugin;
9408
- });
9409
9404
  }
9410
9405
  _create_class(ViewInstance, [
9411
9406
  {
@@ -9452,6 +9447,12 @@ var MarkdownPlugin = function() {
9452
9447
  var _this_validationProvider;
9453
9448
  return (_this_validationProvider = this.validationProvider) === null || _this_validationProvider === void 0 ? void 0 : _this_validationProvider.getValidationsForBinding(binding);
9454
9449
  }
9450
+ },
9451
+ {
9452
+ key: "setTemplatePlugin",
9453
+ value: function setTemplatePlugin(plugin) {
9454
+ this.templatePlugin = plugin;
9455
+ }
9455
9456
  }
9456
9457
  ]);
9457
9458
  return ViewInstance;
@@ -9623,6 +9624,7 @@ var MarkdownPlugin = function() {
9623
9624
  value: function apply(view) {
9624
9625
  view.hooks.parser.tap("template", this.applyParser.bind(this));
9625
9626
  view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
9627
+ view.setTemplatePlugin(this);
9626
9628
  }
9627
9629
  }
9628
9630
  ]);
@@ -11231,8 +11233,7 @@ var MarkdownPlugin = function() {
11231
11233
  var _this1 = this;
11232
11234
  _class_call_check(this, ViewController);
11233
11235
  this.hooks = {
11234
- /** Do any processing before the `View` instance is created */ resolveView: new SyncWaterfallHook(),
11235
- // The hook right before the View starts resolving. Attach anything custom here
11236
+ resolveView: new SyncWaterfallHook(),
11236
11237
  view: new SyncHook()
11237
11238
  };
11238
11239
  this.transformRegistry = new Registry();
@@ -11280,6 +11281,7 @@ var MarkdownPlugin = function() {
11280
11281
  ]));
11281
11282
  }
11282
11283
  });
11284
+ this.viewPlugins = this.createViewPlugins();
11283
11285
  }
11284
11286
  _create_class(ViewController, [
11285
11287
  {
@@ -11335,9 +11337,50 @@ var MarkdownPlugin = function() {
11335
11337
  }
11336
11338
  var view = new ViewInstance(source, this.viewOptions);
11337
11339
  this.currentView = view;
11340
+ this.applyViewPlugins(view);
11338
11341
  this.hooks.view.call(view);
11339
11342
  view.update();
11340
11343
  }
11344
+ },
11345
+ {
11346
+ key: "applyViewPlugins",
11347
+ value: function applyViewPlugins(view) {
11348
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
11349
+ try {
11350
+ for(var _iterator = this.viewPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
11351
+ var plugin = _step.value;
11352
+ plugin.apply(view);
11353
+ }
11354
+ } catch (err) {
11355
+ _didIteratorError = true;
11356
+ _iteratorError = err;
11357
+ } finally{
11358
+ try {
11359
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
11360
+ _iterator.return();
11361
+ }
11362
+ } finally{
11363
+ if (_didIteratorError) {
11364
+ throw _iteratorError;
11365
+ }
11366
+ }
11367
+ }
11368
+ }
11369
+ },
11370
+ {
11371
+ key: "createViewPlugins",
11372
+ value: function createViewPlugins() {
11373
+ var pluginOptions = toNodeResolveOptions(this.viewOptions);
11374
+ return [
11375
+ new AssetPlugin(),
11376
+ new SwitchPlugin(pluginOptions),
11377
+ new ApplicabilityPlugin(),
11378
+ new AssetTransformCorePlugin(this.transformRegistry),
11379
+ new StringResolverPlugin(),
11380
+ new TemplatePlugin(pluginOptions),
11381
+ new MultiNodePlugin()
11382
+ ];
11383
+ }
11341
11384
  }
11342
11385
  ]);
11343
11386
  return ViewController;
@@ -11710,35 +11753,6 @@ var MarkdownPlugin = function() {
11710
11753
  ref: Symbol("not-started"),
11711
11754
  status: "not-started"
11712
11755
  };
11713
- var DefaultViewPlugin = /*#__PURE__*/ function() {
11714
- function DefaultViewPlugin() {
11715
- _class_call_check(this, DefaultViewPlugin);
11716
- this.name = "default-view-plugin";
11717
- }
11718
- _create_class(DefaultViewPlugin, [
11719
- {
11720
- key: "apply",
11721
- value: function apply(player) {
11722
- var _this = this;
11723
- player.hooks.viewController.tap(this.name, function(viewController) {
11724
- viewController.hooks.view.tap(_this.name, function(view) {
11725
- var pluginOptions = toNodeResolveOptions(view.resolverOptions);
11726
- new AssetPlugin().apply(view);
11727
- new SwitchPlugin(pluginOptions).apply(view);
11728
- new ApplicabilityPlugin().apply(view);
11729
- new AssetTransformCorePlugin(viewController.transformRegistry).apply(view);
11730
- new StringResolverPlugin().apply(view);
11731
- var templatePlugin = new TemplatePlugin(pluginOptions);
11732
- templatePlugin.apply(view);
11733
- view.hooks.onTemplatePluginCreated.call(templatePlugin);
11734
- new MultiNodePlugin().apply(view);
11735
- });
11736
- });
11737
- }
11738
- }
11739
- ]);
11740
- return DefaultViewPlugin;
11741
- }();
11742
11756
  var PLAYER_VERSION = "__VERSION__";
11743
11757
  var COMMIT = "__GIT_COMMIT__";
11744
11758
  var _Player = /*#__PURE__*/ function() {
@@ -11768,8 +11782,7 @@ var MarkdownPlugin = function() {
11768
11782
  }
11769
11783
  this.config = config || {};
11770
11784
  this.config.plugins = [
11771
- new DefaultExpPlugin(),
11772
- new DefaultViewPlugin()
11785
+ new DefaultExpPlugin()
11773
11786
  ].concat(_to_consumable_array(this.config.plugins || []), [
11774
11787
  new FlowExpPlugin()
11775
11788
  ]);
@@ -12082,11 +12095,9 @@ var MarkdownPlugin = function() {
12082
12095
  }),
12083
12096
  constants: this.constantsController
12084
12097
  });
12085
- this.hooks.viewController.tap("player", function(vc) {
12086
- vc.hooks.view.tap("player", function(view) {
12087
- validationController.onView(view);
12088
- _this.hooks.view.call(view);
12089
- });
12098
+ viewController.hooks.view.tap("player", function(view) {
12099
+ validationController.onView(view);
12100
+ _this.hooks.view.call(view);
12090
12101
  });
12091
12102
  this.hooks.viewController.call(viewController);
12092
12103
  return {