@manyducks.co/dolla 0.75.0 → 0.75.1
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/lib/index.js +32 -21
- package/lib/index.js.map +2 -2
- package/lib/nodes/html.d.ts +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1070,16 +1070,21 @@ var HTML = class {
|
|
|
1070
1070
|
const propStopCallbacks = [];
|
|
1071
1071
|
if (styles == void 0) {
|
|
1072
1072
|
element.style.cssText = "";
|
|
1073
|
+
} else if (typeof styles === "string") {
|
|
1074
|
+
element.style.cssText = styles;
|
|
1073
1075
|
} else if (isReadable(styles)) {
|
|
1074
1076
|
let unapply;
|
|
1075
1077
|
const stop = observe(styles, (current) => {
|
|
1076
|
-
render.update(
|
|
1077
|
-
|
|
1078
|
-
unapply
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1078
|
+
render.update(
|
|
1079
|
+
() => {
|
|
1080
|
+
if (isFunction(unapply)) {
|
|
1081
|
+
unapply();
|
|
1082
|
+
}
|
|
1083
|
+
element.style.cssText = "";
|
|
1084
|
+
unapply = this.applyStyles(element, current, stopCallbacks);
|
|
1085
|
+
},
|
|
1086
|
+
this.getUpdateKey("styles", "*")
|
|
1087
|
+
);
|
|
1083
1088
|
});
|
|
1084
1089
|
stopCallbacks.push(stop);
|
|
1085
1090
|
propStopCallbacks.push(stop);
|
|
@@ -1090,13 +1095,16 @@ var HTML = class {
|
|
|
1090
1095
|
const setProperty = key.startsWith("--") ? (key2, value2) => value2 == null ? element.style.removeProperty(key2) : element.style.setProperty(key2, value2) : (key2, value2) => element.style[key2] = value2 ?? "";
|
|
1091
1096
|
if (isReadable(value)) {
|
|
1092
1097
|
const stop = observe(value, (current) => {
|
|
1093
|
-
render.update(
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1098
|
+
render.update(
|
|
1099
|
+
() => {
|
|
1100
|
+
if (current != null) {
|
|
1101
|
+
setProperty(key, current);
|
|
1102
|
+
} else {
|
|
1103
|
+
element.style.removeProperty(key);
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
this.getUpdateKey("style", key)
|
|
1107
|
+
);
|
|
1100
1108
|
});
|
|
1101
1109
|
stopCallbacks.push(stop);
|
|
1102
1110
|
propStopCallbacks.push(stop);
|
|
@@ -1124,13 +1132,16 @@ var HTML = class {
|
|
|
1124
1132
|
if (isReadable(classes)) {
|
|
1125
1133
|
let unapply;
|
|
1126
1134
|
const stop = observe(classes, (current) => {
|
|
1127
|
-
render.update(
|
|
1128
|
-
|
|
1129
|
-
unapply
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1135
|
+
render.update(
|
|
1136
|
+
() => {
|
|
1137
|
+
if (isFunction(unapply)) {
|
|
1138
|
+
unapply();
|
|
1139
|
+
}
|
|
1140
|
+
element.removeAttribute("class");
|
|
1141
|
+
unapply = this.applyClasses(element, current, stopCallbacks);
|
|
1142
|
+
},
|
|
1143
|
+
this.getUpdateKey("attr", "class")
|
|
1144
|
+
);
|
|
1134
1145
|
});
|
|
1135
1146
|
stopCallbacks.push(stop);
|
|
1136
1147
|
classStopCallbacks.push(stop);
|