mol_jsx_lib 0.0.56 → 0.0.59
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.d.ts +7 -0
- package/node.deps.json +1 -1
- package/node.esm.js +70 -2
- package/node.esm.js.map +1 -1
- package/node.js +70 -2
- package/node.js.map +1 -1
- package/node.test.js +131 -27
- package/node.test.js.map +1 -1
- package/package.json +3 -1
- package/web.d.ts +7 -0
- package/web.deps.json +1 -1
- package/web.esm.js +70 -2
- package/web.esm.js.map +1 -1
- package/web.js +70 -2
- package/web.js.map +1 -1
- package/web.test.js +61 -25
- package/web.test.js.map +1 -1
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);
|
|
@@ -789,6 +817,7 @@ var $;
|
|
|
789
817
|
var $;
|
|
790
818
|
(function ($) {
|
|
791
819
|
$.$mol_jsx_prefix = '';
|
|
820
|
+
$.$mol_jsx_crumbs = '';
|
|
792
821
|
$.$mol_jsx_booked = null;
|
|
793
822
|
$.$mol_jsx_document = {
|
|
794
823
|
getElementById: () => null,
|
|
@@ -798,16 +827,45 @@ var $;
|
|
|
798
827
|
$.$mol_jsx_frag = '';
|
|
799
828
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
800
829
|
const id = props && props.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(/([^ ]+)/, `$1_${id}`) : $.$mol_jsx_crumbs;
|
|
801
832
|
if (Elem && $.$mol_jsx_booked) {
|
|
802
833
|
if ($.$mol_jsx_booked.has(id)) {
|
|
803
|
-
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(
|
|
834
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
804
835
|
}
|
|
805
836
|
else {
|
|
806
837
|
$.$mol_jsx_booked.add(id);
|
|
807
838
|
}
|
|
808
839
|
}
|
|
809
|
-
const guid = $.$mol_jsx_prefix + id;
|
|
810
840
|
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
841
|
+
if ($.$mol_jsx_prefix) {
|
|
842
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
843
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
844
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
845
|
+
for (const field in props) {
|
|
846
|
+
const func = props[field];
|
|
847
|
+
if (typeof func !== 'function')
|
|
848
|
+
continue;
|
|
849
|
+
const wrapper = function (...args) {
|
|
850
|
+
const prefix = $.$mol_jsx_prefix;
|
|
851
|
+
const booked = $.$mol_jsx_booked;
|
|
852
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
853
|
+
try {
|
|
854
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
855
|
+
$.$mol_jsx_booked = booked_ext;
|
|
856
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
857
|
+
return func.call(this, ...args);
|
|
858
|
+
}
|
|
859
|
+
finally {
|
|
860
|
+
$.$mol_jsx_prefix = prefix;
|
|
861
|
+
$.$mol_jsx_booked = booked;
|
|
862
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
$mol_func_name_from(wrapper, func);
|
|
866
|
+
props[field] = wrapper;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
811
869
|
if (typeof Elem !== 'string') {
|
|
812
870
|
if ('prototype' in Elem) {
|
|
813
871
|
const view = node && node[Elem] || new Elem;
|
|
@@ -816,6 +874,7 @@ var $;
|
|
|
816
874
|
view.childNodes = childNodes;
|
|
817
875
|
if (!view.ownerDocument)
|
|
818
876
|
view.ownerDocument = $.$mol_jsx_document;
|
|
877
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
819
878
|
node = view.valueOf();
|
|
820
879
|
node[Elem] = view;
|
|
821
880
|
return node;
|
|
@@ -823,14 +882,17 @@ var $;
|
|
|
823
882
|
else {
|
|
824
883
|
const prefix = $.$mol_jsx_prefix;
|
|
825
884
|
const booked = $.$mol_jsx_booked;
|
|
885
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
826
886
|
try {
|
|
827
887
|
$.$mol_jsx_prefix = guid;
|
|
828
888
|
$.$mol_jsx_booked = new Set;
|
|
889
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
829
890
|
return Elem(props, ...childNodes);
|
|
830
891
|
}
|
|
831
892
|
finally {
|
|
832
893
|
$.$mol_jsx_prefix = prefix;
|
|
833
894
|
$.$mol_jsx_booked = booked;
|
|
895
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
834
896
|
}
|
|
835
897
|
}
|
|
836
898
|
}
|
|
@@ -861,6 +923,8 @@ var $;
|
|
|
861
923
|
}
|
|
862
924
|
if (guid)
|
|
863
925
|
node.id = guid;
|
|
926
|
+
if ($.$mol_jsx_crumbs)
|
|
927
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
864
928
|
return node;
|
|
865
929
|
}
|
|
866
930
|
$.$mol_jsx = $mol_jsx;
|
|
@@ -1871,6 +1935,7 @@ var $;
|
|
|
1871
1935
|
}
|
|
1872
1936
|
attributes;
|
|
1873
1937
|
ownerDocument;
|
|
1938
|
+
className;
|
|
1874
1939
|
get childNodes() {
|
|
1875
1940
|
return this._kids();
|
|
1876
1941
|
}
|
|
@@ -1881,16 +1946,19 @@ var $;
|
|
|
1881
1946
|
valueOf() {
|
|
1882
1947
|
const prefix = $mol_jsx_prefix;
|
|
1883
1948
|
const booked = $mol_jsx_booked;
|
|
1949
|
+
const crumbs = $mol_jsx_crumbs;
|
|
1884
1950
|
const document = $mol_jsx_document;
|
|
1885
1951
|
try {
|
|
1886
1952
|
$mol_jsx_prefix = this[Symbol.toStringTag];
|
|
1887
1953
|
$mol_jsx_booked = new Set;
|
|
1954
|
+
$mol_jsx_crumbs = this.className;
|
|
1888
1955
|
$mol_jsx_document = this.ownerDocument;
|
|
1889
1956
|
return this.render();
|
|
1890
1957
|
}
|
|
1891
1958
|
finally {
|
|
1892
1959
|
$mol_jsx_prefix = prefix;
|
|
1893
1960
|
$mol_jsx_booked = booked;
|
|
1961
|
+
$mol_jsx_crumbs = crumbs;
|
|
1894
1962
|
$mol_jsx_document = document;
|
|
1895
1963
|
}
|
|
1896
1964
|
}
|