@player-ui/metrics-plugin 0.11.0-next.3 → 0.11.0

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.
@@ -4879,6 +4879,7 @@ var MetricsPlugin = function() {
4879
4879
  ]);
4880
4880
  return ViewInstance;
4881
4881
  }();
4882
+ var templateSymbol = Symbol("template");
4882
4883
  var TemplatePlugin = /*#__PURE__*/ function() {
4883
4884
  function TemplatePlugin(options) {
4884
4885
  _class_call_check(this, TemplatePlugin);
@@ -4949,6 +4950,9 @@ var MetricsPlugin = function() {
4949
4950
  override: false,
4950
4951
  values: values
4951
4952
  };
4953
+ if (node.placement !== void 0) {
4954
+ result[templateSymbol] = node.placement;
4955
+ }
4952
4956
  return result;
4953
4957
  }
4954
4958
  },
@@ -4962,6 +4966,40 @@ var MetricsPlugin = function() {
4962
4966
  }
4963
4967
  return node;
4964
4968
  });
4969
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
4970
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
4971
+ if (node2.type === "multi-node") {
4972
+ return node2[templateSymbol];
4973
+ } else if (node2.type === "template") {
4974
+ return node2.placement;
4975
+ }
4976
+ return void 0;
4977
+ };
4978
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
4979
+ node.children = node.children.sort(function(a, b) {
4980
+ var aPath = a.path.join();
4981
+ var bPath = b.path.join();
4982
+ var pathsEqual = aPath === bPath;
4983
+ if (pathsEqual) {
4984
+ var aPlacement = getTemplateSymbolValue(a.value);
4985
+ var bPlacement = getTemplateSymbolValue(b.value);
4986
+ if (aPlacement !== void 0 && bPlacement === void 0) {
4987
+ return aPlacement === "prepend" ? -1 : 1;
4988
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
4989
+ return bPlacement === "prepend" ? 1 : -1;
4990
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
4991
+ if (aPlacement === bPlacement) {
4992
+ return 0;
4993
+ }
4994
+ return aPlacement === "prepend" ? -1 : 1;
4995
+ }
4996
+ return 0;
4997
+ }
4998
+ return aPath > bPath ? 1 : -1;
4999
+ });
5000
+ }
5001
+ return node;
5002
+ });
4965
5003
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4966
5004
  if (childOptions && hasTemplateKey(childOptions.key)) {
4967
5005
  return obj.map(function(template) {
@@ -4971,7 +5009,8 @@ var MetricsPlugin = function() {
4971
5009
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4972
5010
  data: template.data,
4973
5011
  template: template.value,
4974
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5012
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5013
+ placement: template.placement
4975
5014
  }, template);
4976
5015
  if (!templateAST) return;
4977
5016
  if (templateAST.type === "multi-node") {
@@ -7125,8 +7164,8 @@ var MetricsPlugin = function() {
7125
7164
  ]);
7126
7165
  return DefaultViewPlugin;
7127
7166
  }();
7128
- var PLAYER_VERSION = "__VERSION__";
7129
- var COMMIT = "__GIT_COMMIT__";
7167
+ var PLAYER_VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "__VERSION__";
7168
+ var COMMIT = typeof __GIT_COMMIT__ !== "undefined" ? __GIT_COMMIT__ : "__GIT_COMMIT__";
7130
7169
  var _Player = /*#__PURE__*/ function() {
7131
7170
  function _Player2(config) {
7132
7171
  var _this = this;