@xuda.io/runtime-bundle 1.0.1431 → 1.0.1433
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/js/xuda-runtime-slim.js
CHANGED
|
@@ -17819,8 +17819,23 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
17819
17819
|
};
|
|
17820
17820
|
func.runtime.render.apply_xu_class = async function (options) {
|
|
17821
17821
|
try {
|
|
17822
|
-
const
|
|
17822
|
+
const raw_value = options?.val?.value;
|
|
17823
17823
|
const xuData = func.runtime.ui.get_data(options.$elm)?.xuData;
|
|
17824
|
+
if (typeof raw_value === 'string') {
|
|
17825
|
+
const trimmed = raw_value.trim();
|
|
17826
|
+
const looks_like_object = trimmed.startsWith('{') && trimmed.endsWith('}');
|
|
17827
|
+
|
|
17828
|
+
if (!looks_like_object) {
|
|
17829
|
+
func.runtime.render.apply_expression_class(options.$elm, raw_value);
|
|
17830
|
+
xuData.debug_info.attribute_stat['xu-class'] = func.runtime.ui.get_first_node(options.$elm)?.className || func.runtime.ui.get_attr(options.$elm, 'class');
|
|
17831
|
+
return {};
|
|
17832
|
+
}
|
|
17833
|
+
}
|
|
17834
|
+
|
|
17835
|
+
const classes_obj = typeof raw_value === 'string' ? JSON5.parse(raw_value) : Object.assign({}, {}, raw_value);
|
|
17836
|
+
if (typeof classes_obj !== 'object' || classes_obj === null || Array.isArray(classes_obj)) {
|
|
17837
|
+
throw new Error('xu-class expects an object map or a class string');
|
|
17838
|
+
}
|
|
17824
17839
|
const class_names = Object.keys(classes_obj);
|
|
17825
17840
|
|
|
17826
17841
|
for (let index = 0; index < class_names.length; index++) {
|
|
@@ -17859,7 +17874,7 @@ func.runtime.render.apply_xu_class = async function (options) {
|
|
|
17859
17874
|
},
|
|
17860
17875
|
},
|
|
17861
17876
|
e,
|
|
17862
|
-
'xu-class has invalid
|
|
17877
|
+
'xu-class has invalid syntax',
|
|
17863
17878
|
);
|
|
17864
17879
|
return { abort: true };
|
|
17865
17880
|
}
|
|
@@ -17745,8 +17745,23 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
17745
17745
|
};
|
|
17746
17746
|
func.runtime.render.apply_xu_class = async function (options) {
|
|
17747
17747
|
try {
|
|
17748
|
-
const
|
|
17748
|
+
const raw_value = options?.val?.value;
|
|
17749
17749
|
const xuData = func.runtime.ui.get_data(options.$elm)?.xuData;
|
|
17750
|
+
if (typeof raw_value === 'string') {
|
|
17751
|
+
const trimmed = raw_value.trim();
|
|
17752
|
+
const looks_like_object = trimmed.startsWith('{') && trimmed.endsWith('}');
|
|
17753
|
+
|
|
17754
|
+
if (!looks_like_object) {
|
|
17755
|
+
func.runtime.render.apply_expression_class(options.$elm, raw_value);
|
|
17756
|
+
xuData.debug_info.attribute_stat['xu-class'] = func.runtime.ui.get_first_node(options.$elm)?.className || func.runtime.ui.get_attr(options.$elm, 'class');
|
|
17757
|
+
return {};
|
|
17758
|
+
}
|
|
17759
|
+
}
|
|
17760
|
+
|
|
17761
|
+
const classes_obj = typeof raw_value === 'string' ? JSON5.parse(raw_value) : Object.assign({}, {}, raw_value);
|
|
17762
|
+
if (typeof classes_obj !== 'object' || classes_obj === null || Array.isArray(classes_obj)) {
|
|
17763
|
+
throw new Error('xu-class expects an object map or a class string');
|
|
17764
|
+
}
|
|
17750
17765
|
const class_names = Object.keys(classes_obj);
|
|
17751
17766
|
|
|
17752
17767
|
for (let index = 0; index < class_names.length; index++) {
|
|
@@ -17785,7 +17800,7 @@ func.runtime.render.apply_xu_class = async function (options) {
|
|
|
17785
17800
|
},
|
|
17786
17801
|
},
|
|
17787
17802
|
e,
|
|
17788
|
-
'xu-class has invalid
|
|
17803
|
+
'xu-class has invalid syntax',
|
|
17789
17804
|
);
|
|
17790
17805
|
return { abort: true };
|
|
17791
17806
|
}
|