@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.
|
@@ -36695,8 +36695,23 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
36695
36695
|
};
|
|
36696
36696
|
func.runtime.render.apply_xu_class = async function (options) {
|
|
36697
36697
|
try {
|
|
36698
|
-
const
|
|
36698
|
+
const raw_value = options?.val?.value;
|
|
36699
36699
|
const xuData = func.runtime.ui.get_data(options.$elm)?.xuData;
|
|
36700
|
+
if (typeof raw_value === 'string') {
|
|
36701
|
+
const trimmed = raw_value.trim();
|
|
36702
|
+
const looks_like_object = trimmed.startsWith('{') && trimmed.endsWith('}');
|
|
36703
|
+
|
|
36704
|
+
if (!looks_like_object) {
|
|
36705
|
+
func.runtime.render.apply_expression_class(options.$elm, raw_value);
|
|
36706
|
+
xuData.debug_info.attribute_stat['xu-class'] = func.runtime.ui.get_first_node(options.$elm)?.className || func.runtime.ui.get_attr(options.$elm, 'class');
|
|
36707
|
+
return {};
|
|
36708
|
+
}
|
|
36709
|
+
}
|
|
36710
|
+
|
|
36711
|
+
const classes_obj = typeof raw_value === 'string' ? JSON5.parse(raw_value) : Object.assign({}, {}, raw_value);
|
|
36712
|
+
if (typeof classes_obj !== 'object' || classes_obj === null || Array.isArray(classes_obj)) {
|
|
36713
|
+
throw new Error('xu-class expects an object map or a class string');
|
|
36714
|
+
}
|
|
36700
36715
|
const class_names = Object.keys(classes_obj);
|
|
36701
36716
|
|
|
36702
36717
|
for (let index = 0; index < class_names.length; index++) {
|
|
@@ -36735,7 +36750,7 @@ func.runtime.render.apply_xu_class = async function (options) {
|
|
|
36735
36750
|
},
|
|
36736
36751
|
},
|
|
36737
36752
|
e,
|
|
36738
|
-
'xu-class has invalid
|
|
36753
|
+
'xu-class has invalid syntax',
|
|
36739
36754
|
);
|
|
36740
36755
|
return { abort: true };
|
|
36741
36756
|
}
|