mol_jsx_lib 0.0.57 → 0.0.60

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.
package/node.js CHANGED
@@ -817,6 +817,7 @@ var $;
817
817
  var $;
818
818
  (function ($) {
819
819
  $.$mol_jsx_prefix = '';
820
+ $.$mol_jsx_crumbs = '';
820
821
  $.$mol_jsx_booked = null;
821
822
  $.$mol_jsx_document = {
822
823
  getElementById: () => null,
@@ -826,7 +827,8 @@ var $;
826
827
  $.$mol_jsx_frag = '';
827
828
  function $mol_jsx(Elem, props, ...childNodes) {
828
829
  const id = props && props.id || '';
829
- const guid = $.$mol_jsx_prefix + id;
830
+ const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
831
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
830
832
  if (Elem && $.$mol_jsx_booked) {
831
833
  if ($.$mol_jsx_booked.has(id)) {
832
834
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -839,6 +841,7 @@ var $;
839
841
  if ($.$mol_jsx_prefix) {
840
842
  const prefix_ext = $.$mol_jsx_prefix;
841
843
  const booked_ext = $.$mol_jsx_booked;
844
+ const crumbs_ext = $.$mol_jsx_crumbs;
842
845
  for (const field in props) {
843
846
  const func = props[field];
844
847
  if (typeof func !== 'function')
@@ -846,14 +849,17 @@ var $;
846
849
  const wrapper = function (...args) {
847
850
  const prefix = $.$mol_jsx_prefix;
848
851
  const booked = $.$mol_jsx_booked;
852
+ const crumbs = $.$mol_jsx_crumbs;
849
853
  try {
850
854
  $.$mol_jsx_prefix = prefix_ext;
851
855
  $.$mol_jsx_booked = booked_ext;
856
+ $.$mol_jsx_crumbs = crumbs_ext;
852
857
  return func.call(this, ...args);
853
858
  }
854
859
  finally {
855
860
  $.$mol_jsx_prefix = prefix;
856
861
  $.$mol_jsx_booked = booked;
862
+ $.$mol_jsx_crumbs = crumbs;
857
863
  }
858
864
  };
859
865
  $mol_func_name_from(wrapper, func);
@@ -868,6 +874,7 @@ var $;
868
874
  view.childNodes = childNodes;
869
875
  if (!view.ownerDocument)
870
876
  view.ownerDocument = $.$mol_jsx_document;
877
+ view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
871
878
  node = view.valueOf();
872
879
  node[Elem] = view;
873
880
  return node;
@@ -875,14 +882,17 @@ var $;
875
882
  else {
876
883
  const prefix = $.$mol_jsx_prefix;
877
884
  const booked = $.$mol_jsx_booked;
885
+ const crumbs = $.$mol_jsx_crumbs;
878
886
  try {
879
887
  $.$mol_jsx_prefix = guid;
880
888
  $.$mol_jsx_booked = new Set;
889
+ $.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
881
890
  return Elem(props, ...childNodes);
882
891
  }
883
892
  finally {
884
893
  $.$mol_jsx_prefix = prefix;
885
894
  $.$mol_jsx_booked = booked;
895
+ $.$mol_jsx_crumbs = crumbs;
886
896
  }
887
897
  }
888
898
  }
@@ -913,6 +923,8 @@ var $;
913
923
  }
914
924
  if (guid)
915
925
  node.id = guid;
926
+ if ($.$mol_jsx_crumbs)
927
+ node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
916
928
  return node;
917
929
  }
918
930
  $.$mol_jsx = $mol_jsx;
@@ -1923,6 +1935,7 @@ var $;
1923
1935
  }
1924
1936
  attributes;
1925
1937
  ownerDocument;
1938
+ className;
1926
1939
  get childNodes() {
1927
1940
  return this._kids();
1928
1941
  }
@@ -1933,16 +1946,19 @@ var $;
1933
1946
  valueOf() {
1934
1947
  const prefix = $mol_jsx_prefix;
1935
1948
  const booked = $mol_jsx_booked;
1949
+ const crumbs = $mol_jsx_crumbs;
1936
1950
  const document = $mol_jsx_document;
1937
1951
  try {
1938
1952
  $mol_jsx_prefix = this[Symbol.toStringTag];
1939
1953
  $mol_jsx_booked = new Set;
1954
+ $mol_jsx_crumbs = this.className;
1940
1955
  $mol_jsx_document = this.ownerDocument;
1941
1956
  return this.render();
1942
1957
  }
1943
1958
  finally {
1944
1959
  $mol_jsx_prefix = prefix;
1945
1960
  $mol_jsx_booked = booked;
1961
+ $mol_jsx_crumbs = crumbs;
1946
1962
  $mol_jsx_document = document;
1947
1963
  }
1948
1964
  }