@estjs/template 0.0.16-beta.4 → 0.0.16-beta.6

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.
@@ -1,5 +1,5 @@
1
- import { getActiveScope, runWithScope, onCleanup, __objRest, createScope, disposeScope, __async } from './chunk-JT6RSDKI.dev.esm.js';
2
- import { normalizeClassName, isObject, warn, isSpecialBooleanAttr, isBooleanAttr, includeBooleanAttr, isSymbol, isString, isArray, camelCase, capitalize, isBrowser, error, isPromise, isFunction, isOn, coerceArray } from '@estjs/shared';
1
+ import { getActiveScope, runWithScope, onCleanup, __objRest, createScope, disposeScope, __async } from './chunk-OEKE4VTS.dev.esm.js';
2
+ import { normalizeClassName, isObject, warn, isSpecialBooleanAttr, isBooleanAttr, includeBooleanAttr, isSymbol, isString, isArray, kebabCase, camelCase, capitalize, isBrowser, error, isPromise, isFunction, isOn, coerceArray } from '@estjs/shared';
3
3
  import { effect, shallowReactive, isSignal, isComputed, signal } from '@estjs/signals';
4
4
 
5
5
  // src/constants.ts
@@ -196,17 +196,29 @@ function setStyle(style, name, val) {
196
196
  if (val == null || val === "") {
197
197
  val = "";
198
198
  }
199
+ const priority = isString(val) && importantRE.test(val) ? "important" : "";
200
+ if (priority) {
201
+ val = val.replace(importantRE, "");
202
+ }
199
203
  if (name.startsWith("--")) {
200
- style.setProperty(name, val);
204
+ if (priority) {
205
+ style.setProperty(name, val, priority);
206
+ } else {
207
+ style.setProperty(name, val);
208
+ }
201
209
  return;
202
210
  }
203
211
  const prefixed = autoPrefix(style, name);
204
- if (isString(val) && importantRE.test(val)) {
205
- style.setProperty(camelCase(prefixed), val.replace(importantRE, ""), "important");
212
+ if (priority) {
213
+ style.setProperty(toCssPropertyName(prefixed), val, priority);
206
214
  } else {
207
215
  style[prefixed] = val;
208
216
  }
209
217
  }
218
+ function toCssPropertyName(name) {
219
+ const hyphenated = kebabCase(name);
220
+ return name.startsWith("Webkit") || name.startsWith("Moz") || name.startsWith("ms") ? `-${hyphenated}` : hyphenated;
221
+ }
210
222
  function autoPrefix(style, rawName) {
211
223
  const cached = prefixCache[rawName];
212
224
  if (cached) {