mol_jsx_lib 0.0.56 → 0.0.57

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
@@ -729,6 +729,34 @@ var $;
729
729
  ;
730
730
  "use strict";
731
731
  var $;
732
+ (function ($) {
733
+ function $mol_func_name(func) {
734
+ let name = func.name;
735
+ if (name?.length > 1)
736
+ return name;
737
+ for (let key in this) {
738
+ try {
739
+ if (this[key] !== func)
740
+ continue;
741
+ name = key;
742
+ Object.defineProperty(func, 'name', { value: name });
743
+ break;
744
+ }
745
+ catch { }
746
+ }
747
+ return name;
748
+ }
749
+ $.$mol_func_name = $mol_func_name;
750
+ function $mol_func_name_from(target, source) {
751
+ Object.defineProperty(target, 'name', { value: source.name });
752
+ return target;
753
+ }
754
+ $.$mol_func_name_from = $mol_func_name_from;
755
+ })($ || ($ = {}));
756
+ //mol/func/name/name.ts
757
+ ;
758
+ "use strict";
759
+ var $;
732
760
  (function ($) {
733
761
  function $mol_dom_render_children(el, childNodes) {
734
762
  const node_set = new Set(childNodes);
@@ -798,16 +826,40 @@ var $;
798
826
  $.$mol_jsx_frag = '';
799
827
  function $mol_jsx(Elem, props, ...childNodes) {
800
828
  const id = props && props.id || '';
829
+ const guid = $.$mol_jsx_prefix + id;
801
830
  if (Elem && $.$mol_jsx_booked) {
802
831
  if ($.$mol_jsx_booked.has(id)) {
803
- $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(id)}`));
832
+ $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
804
833
  }
805
834
  else {
806
835
  $.$mol_jsx_booked.add(id);
807
836
  }
808
837
  }
809
- const guid = $.$mol_jsx_prefix + id;
810
838
  let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
839
+ if ($.$mol_jsx_prefix) {
840
+ const prefix_ext = $.$mol_jsx_prefix;
841
+ const booked_ext = $.$mol_jsx_booked;
842
+ for (const field in props) {
843
+ const func = props[field];
844
+ if (typeof func !== 'function')
845
+ continue;
846
+ const wrapper = function (...args) {
847
+ const prefix = $.$mol_jsx_prefix;
848
+ const booked = $.$mol_jsx_booked;
849
+ try {
850
+ $.$mol_jsx_prefix = prefix_ext;
851
+ $.$mol_jsx_booked = booked_ext;
852
+ return func.call(this, ...args);
853
+ }
854
+ finally {
855
+ $.$mol_jsx_prefix = prefix;
856
+ $.$mol_jsx_booked = booked;
857
+ }
858
+ };
859
+ $mol_func_name_from(wrapper, func);
860
+ props[field] = wrapper;
861
+ }
862
+ }
811
863
  if (typeof Elem !== 'string') {
812
864
  if ('prototype' in Elem) {
813
865
  const view = node && node[Elem] || new Elem;