mono-jsx 0.9.6 → 0.9.7
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/dom/jsx-runtime.mjs +9 -7
- package/package.json +1 -1
package/dom/jsx-runtime.mjs
CHANGED
|
@@ -638,10 +638,10 @@ var applyStyle = (el, style, mark) => {
|
|
|
638
638
|
if (isPlainObject(style)) {
|
|
639
639
|
let { classList } = el;
|
|
640
640
|
let inline;
|
|
641
|
+
let css = [];
|
|
641
642
|
classList.remove(...classList.values().filter((key) => key.startsWith("css-")));
|
|
642
643
|
for (let [k, v] of Object.entries(style)) {
|
|
643
644
|
v = $(v, mark);
|
|
644
|
-
let css = [];
|
|
645
645
|
switch (k.charCodeAt(0)) {
|
|
646
646
|
case /* ':' */
|
|
647
647
|
58:
|
|
@@ -671,12 +671,14 @@ var applyStyle = (el, style, mark) => {
|
|
|
671
671
|
inline ??= {};
|
|
672
672
|
inline[k] = v;
|
|
673
673
|
}
|
|
674
|
-
if (css.length) {
|
|
675
|
-
classList.add(computeStyleClassName(css));
|
|
676
|
-
}
|
|
677
674
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
675
|
+
if (css.length > 0) {
|
|
676
|
+
if (inline) {
|
|
677
|
+
css.unshift(null, renderStyle(inline));
|
|
678
|
+
}
|
|
679
|
+
classList.add(createStyleElement(css));
|
|
680
|
+
} else if (inline) {
|
|
681
|
+
el.style.cssText = renderStyle(inline).slice(1, -1);
|
|
680
682
|
}
|
|
681
683
|
} else if (isString(style)) {
|
|
682
684
|
el.style.cssText = style;
|
|
@@ -698,7 +700,7 @@ var renderStyle = (style, mark) => {
|
|
|
698
700
|
}
|
|
699
701
|
return "{" + css + "}";
|
|
700
702
|
};
|
|
701
|
-
var
|
|
703
|
+
var createStyleElement = (css) => {
|
|
702
704
|
const hash = hashCode(css.join("")).toString(36);
|
|
703
705
|
const className = "css-" + hash;
|
|
704
706
|
if (!document2.getElementById(className)) {
|