@jsenv/dom 0.9.3 → 0.9.4

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.
Files changed (2) hide show
  1. package/dist/jsenv_dom.js +17 -4
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -2227,6 +2227,9 @@ const normalizeStyle = (
2227
2227
  if (propertyName === "lineHeight") {
2228
2228
  if (context === "js") {
2229
2229
  if (typeof value === "string") {
2230
+ if (isCSSFunction(value)) {
2231
+ return value;
2232
+ }
2230
2233
  const unit = getUnit(value);
2231
2234
  if (unit === "px") {
2232
2235
  const float = parseFloat(value);
@@ -2271,6 +2274,9 @@ const normalizeStyle = (
2271
2274
  }
2272
2275
 
2273
2276
  if (colorPropertySet.has(propertyName)) {
2277
+ if (typeof value === "string" && isCSSFunction(value)) {
2278
+ return value;
2279
+ }
2274
2280
  const rgba = parseCSSColor(value, element);
2275
2281
  if (context === "js") {
2276
2282
  return rgba;
@@ -2287,8 +2293,15 @@ const stringifyStyle = (value, propertyName, element) => {
2287
2293
  return normalizeStyle(value, propertyName, "css", element);
2288
2294
  };
2289
2295
 
2296
+ const isCSSFunction = (value) => {
2297
+ return /^[a-z-]+\(/.test(value);
2298
+ };
2290
2299
  const normalizeNumber = (value, { unit, propertyName, preferedType }) => {
2291
2300
  if (typeof value === "string") {
2301
+ // CSS variables and CSS functions like calc() must be passed through as-is
2302
+ if (isCSSFunction(value)) {
2303
+ return value;
2304
+ }
2292
2305
  // Keep strings as-is (including %, em, rem, auto, none, etc.)
2293
2306
  if (preferedType === "string") {
2294
2307
  if (unit && isUnitless(value) && !unitlessKeywordSet.has(value)) {
@@ -7052,7 +7065,7 @@ import.meta.css = [/* css */`
7052
7065
  inset: 0;
7053
7066
  user-select: none;
7054
7067
  }
7055
- `, "/src/interaction/drag/drag_gesture.js"];
7068
+ `, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
7056
7069
 
7057
7070
  installImportMetaCssBuild(import.meta);const setupConstraintFeedbackLine = () => {
7058
7071
  const constraintFeedbackLine = createConstraintFeedbackLine();
@@ -7141,7 +7154,7 @@ import.meta.css = [/* css */`
7141
7154
  .navi_constraint_feedback_line[data-visible] {
7142
7155
  visibility: visible;
7143
7156
  }
7144
- `, "/src/interaction/drag/constraint_feedback_line.js"];
7157
+ `, "@jsenv/dom/src/interaction/drag/constraint_feedback_line.js"];
7145
7158
 
7146
7159
  installImportMetaCssBuild(import.meta);// Keep visual markers (debug markers, obstacle markers, constraint feedback line) in DOM after drag ends
7147
7160
  const MARKER_SIZE = 12;
@@ -7723,7 +7736,7 @@ import.meta.css = [/* css */`
7723
7736
  border-radius: 3px;
7724
7737
  pointer-events: none;
7725
7738
  }
7726
- `, "/src/interaction/drag/drag_debug_markers.js"];
7739
+ `, "@jsenv/dom/src/interaction/drag/drag_debug_markers.js"];
7727
7740
 
7728
7741
  const initDragConstraints = (
7729
7742
  dragGesture,
@@ -8916,7 +8929,7 @@ import.meta.css = [/* css */`
8916
8929
  height: auto !important;
8917
8930
  opacity: 0 !important;
8918
8931
  }
8919
- `, "/src/position/position_sticky.js"];
8932
+ `, "@jsenv/dom/src/position/position_sticky.js"];
8920
8933
  const initPositionSticky = element => {
8921
8934
  const computedStyle = getComputedStyle(element);
8922
8935
  const topCssValue = computedStyle.top;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "DOM utilities for writing frontend code",
5
5
  "repository": {
6
6
  "type": "git",