@jsenv/dom 0.7.1 → 0.7.2

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 +15 -3
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -544,6 +544,9 @@ const normalizeNumber = (value, { unit, propertyName, preferedType }) => {
544
544
  if (typeof value === "string") {
545
545
  // Keep strings as-is (including %, em, rem, auto, none, etc.)
546
546
  if (preferedType === "string") {
547
+ if (unit && !value.endsWith(unit)) {
548
+ return `${value}${unit}`;
549
+ }
547
550
  return value;
548
551
  }
549
552
  // convert to number if possible (font-size: "12px" -> fontSize:12, opacity: "0.5" -> opacity: 0.5)
@@ -570,14 +573,21 @@ const normalizeNumber = (value, { unit, propertyName, preferedType }) => {
570
573
  };
571
574
 
572
575
  // Normalize styles for DOM application
573
- const normalizeStyles = (styles, context = "js") => {
576
+ const normalizeStyles = (styles, context = "js", mutate = false) => {
574
577
  if (!styles) {
575
- return {};
578
+ return mutate ? styles : {};
576
579
  }
577
580
  if (typeof styles === "string") {
578
581
  styles = parseStyleString(styles);
579
582
  return styles;
580
583
  }
584
+ if (mutate) {
585
+ for (const key of Object.keys(styles)) {
586
+ const value = styles[key];
587
+ styles[key] = normalizeStyle(value, key, context);
588
+ }
589
+ return styles;
590
+ }
581
591
  const normalized = {};
582
592
  for (const key of Object.keys(styles)) {
583
593
  const value = styles[key];
@@ -10285,6 +10295,8 @@ import.meta.css = /* css */ `
10285
10295
  flex-direction: inherit;
10286
10296
  align-items: inherit;
10287
10297
  justify-content: inherit;
10298
+ border-radius: inherit;
10299
+ cursor: inherit;
10288
10300
  }
10289
10301
 
10290
10302
  .ui_transition_measure_wrapper[data-transition-translate-x] {
@@ -11718,4 +11730,4 @@ const notifyTransitionOverflow = (element, transitionId) => {
11718
11730
  };
11719
11731
  };
11720
11732
 
11721
- export { EASING, activeElementSignal, addActiveElementEffect, addAttributeEffect, addWillChange, allowWheelThrough, appendStyles, canInterceptKeys, captureScrollState, createDragGestureController, createDragToMoveGestureController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dragAfterThreshold, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findFocusable, getAvailableHeight, getAvailableWidth, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getInnerHeight, getInnerWidth, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getPaddingSizes, getPositionedParent, getPreferedColorScheme, getScrollContainer, getScrollContainerSet, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateY, getVisuallyVisibleInfo, getWidth, initFlexDetailsSet, initFocusGroup, initPositionSticky, initUITransition, isScrollable, mergeStyles, normalizeStyles, parseCSSColor, pickLightOrDark, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, resolveCSSColor, resolveCSSSize, setAttribute, setAttributes, setStyles, startDragToResizeGesture, stickyAsRelativeCoords, stringifyCSSColor, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect };
11733
+ export { EASING, activeElementSignal, addActiveElementEffect, addAttributeEffect, addWillChange, allowWheelThrough, appendStyles, canInterceptKeys, captureScrollState, createDragGestureController, createDragToMoveGestureController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dragAfterThreshold, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findFocusable, getAvailableHeight, getAvailableWidth, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getInnerHeight, getInnerWidth, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getPaddingSizes, getPositionedParent, getPreferedColorScheme, getScrollContainer, getScrollContainerSet, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateY, getVisuallyVisibleInfo, getWidth, initFlexDetailsSet, initFocusGroup, initPositionSticky, initUITransition, isScrollable, mergeStyles, normalizeStyle, normalizeStyles, parseCSSColor, pickLightOrDark, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, resolveCSSColor, resolveCSSSize, setAttribute, setAttributes, setStyles, startDragToResizeGesture, stickyAsRelativeCoords, stringifyCSSColor, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "DOM utilities for writing frontend code",
5
5
  "repository": {
6
6
  "type": "git",