@jsenv/navi 0.11.8 → 0.11.9

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.
@@ -9802,14 +9802,24 @@ const FlexDirectionContext = createContext();
9802
9802
  */
9803
9803
  const withPropsStyle = (
9804
9804
  props,
9805
- { base, layout, spacing = layout, align = layout, expansion = layout, typo },
9805
+ {
9806
+ base,
9807
+ layout,
9808
+ spacing = layout,
9809
+ align = layout,
9810
+ size = layout,
9811
+ typo,
9812
+ visual = true,
9813
+ },
9806
9814
  ...remainingConfig
9807
9815
  ) => {
9808
9816
  const flexDirection = useContext(FlexDirectionContext);
9809
9817
  const {
9810
9818
  // style from props
9811
9819
  style,
9820
+
9812
9821
  // layout props
9822
+ // layout/spacing
9813
9823
  margin,
9814
9824
  marginX,
9815
9825
  marginY,
@@ -9824,11 +9834,16 @@ const withPropsStyle = (
9824
9834
  paddingRight,
9825
9835
  paddingTop,
9826
9836
  paddingBottom,
9837
+ // layout/alignment
9827
9838
  alignX,
9828
9839
  alignY,
9840
+ // layout/size
9829
9841
  expand,
9830
9842
  expandX = expand,
9831
9843
  expandY = expand,
9844
+ width,
9845
+ height,
9846
+
9832
9847
  // typo props
9833
9848
  textSize,
9834
9849
  textBold,
@@ -9838,18 +9853,44 @@ const withPropsStyle = (
9838
9853
  textUnderlineStyle,
9839
9854
  textUnderlineColor,
9840
9855
  textColor,
9856
+ textShadow,
9857
+
9858
+ // visual props
9859
+ boxShadow,
9860
+ background,
9861
+ backgroundColor,
9862
+ backgroundImage,
9863
+ border,
9864
+ borderWidth,
9865
+ borderRadius,
9866
+ borderColor,
9867
+ borderStyle,
9868
+ borderTop,
9869
+ borderLeft,
9870
+ borderRight,
9871
+ borderBottom,
9872
+ opacity,
9873
+ filter,
9874
+
9841
9875
  // props not related to styling
9842
9876
  ...remainingProps
9843
9877
  } = props;
9844
9878
 
9845
9879
  const hasRemainingConfig = remainingConfig.length > 0;
9880
+ let propStyles;
9846
9881
  let marginStyles;
9847
9882
  let paddingStyles;
9848
9883
  let alignmentStyles;
9849
- let expansionStyles;
9884
+ let sizeStyles;
9850
9885
  let typoStyles;
9851
- let propStyles;
9886
+ let visualStyles;
9852
9887
 
9888
+ props_styles: {
9889
+ if (!style && !hasRemainingConfig) {
9890
+ break props_styles;
9891
+ }
9892
+ propStyles = style ? normalizeStyles(style, "css") : {};
9893
+ }
9853
9894
  spacing_styles: {
9854
9895
  if (!spacing && !hasRemainingConfig) {
9855
9896
  break spacing_styles;
@@ -9978,28 +10019,32 @@ const withPropsStyle = (
9978
10019
  }
9979
10020
  }
9980
10021
  }
9981
- expansion_styles: {
9982
- if (!expansion && !hasRemainingConfig) {
9983
- break expansion_styles;
10022
+ size_styles: {
10023
+ if (!size && !hasRemainingConfig) {
10024
+ break size_styles;
9984
10025
  }
9985
- expansionStyles = {};
10026
+ sizeStyles = {};
9986
10027
  if (expandX) {
9987
10028
  if (flexDirection === "row") {
9988
- expansionStyles.flexGrow = 1; // Grow horizontally in row
10029
+ sizeStyles.flexGrow = 1; // Grow horizontally in row
9989
10030
  } else if (flexDirection === "column") {
9990
- expansionStyles.width = "100%"; // Take full width in column
10031
+ sizeStyles.width = "100%"; // Take full width in column
9991
10032
  } else {
9992
- expansionStyles.width = "100%"; // Take full width outside flex
10033
+ sizeStyles.width = "100%"; // Take full width outside flex
9993
10034
  }
10035
+ } else if (width !== undefined) {
10036
+ sizeStyles.width = width;
9994
10037
  }
9995
10038
  if (expandY) {
9996
10039
  if (flexDirection === "row") {
9997
- expansionStyles.height = "100%"; // Take full height in row
10040
+ sizeStyles.height = "100%"; // Take full height in row
9998
10041
  } else if (flexDirection === "column") {
9999
- expansionStyles.flexGrow = 1; // Grow vertically in column
10042
+ sizeStyles.flexGrow = 1; // Grow vertically in column
10000
10043
  } else {
10001
- expansionStyles.height = "100%"; // Take full height outside flex
10044
+ sizeStyles.height = "100%"; // Take full height outside flex
10002
10045
  }
10046
+ } else if (height !== undefined) {
10047
+ sizeStyles.height = height;
10003
10048
  }
10004
10049
  }
10005
10050
  typo_styles: {
@@ -10038,13 +10083,61 @@ const withPropsStyle = (
10038
10083
  if (textUnderlineColor) {
10039
10084
  typoStyles.textDecorationColor = textUnderlineColor;
10040
10085
  }
10086
+ if (textShadow) {
10087
+ typoStyles.textShadow = textShadow;
10088
+ }
10041
10089
  typoStyles.color = textColor;
10042
10090
  }
10043
- props_styles: {
10044
- if (!style && !hasRemainingConfig) {
10045
- break props_styles;
10091
+ visual_styles: {
10092
+ if (!visual && !hasRemainingConfig) {
10093
+ break visual_styles;
10094
+ }
10095
+ visualStyles = {};
10096
+ if (boxShadow !== undefined) {
10097
+ visualStyles.boxShadow = boxShadow;
10098
+ }
10099
+ if (background !== undefined) {
10100
+ visualStyles.background = background;
10101
+ }
10102
+ if (backgroundColor !== undefined) {
10103
+ visualStyles.backgroundColor = backgroundColor;
10104
+ }
10105
+ if (backgroundImage !== undefined) {
10106
+ visualStyles.backgroundImage = backgroundImage;
10107
+ }
10108
+ if (border !== undefined) {
10109
+ visualStyles.border = border;
10110
+ }
10111
+ if (borderTop !== undefined) {
10112
+ visualStyles.borderTop = borderTop;
10113
+ }
10114
+ if (borderLeft !== undefined) {
10115
+ visualStyles.borderLeft = borderLeft;
10116
+ }
10117
+ if (borderRight !== undefined) {
10118
+ visualStyles.borderRight = borderRight;
10119
+ }
10120
+ if (borderBottom !== undefined) {
10121
+ visualStyles.borderBottom = borderBottom;
10122
+ }
10123
+ if (borderWidth !== undefined) {
10124
+ visualStyles.borderWidth = borderWidth;
10125
+ }
10126
+ if (borderRadius !== undefined) {
10127
+ visualStyles.borderRadius = borderRadius;
10128
+ }
10129
+ if (borderColor !== undefined) {
10130
+ visualStyles.borderColor = borderColor;
10131
+ }
10132
+ if (borderStyle !== undefined) {
10133
+ visualStyles.borderStyle = borderStyle;
10134
+ }
10135
+ if (opacity !== undefined) {
10136
+ visualStyles.opacity = opacity;
10137
+ }
10138
+ if (filter !== undefined) {
10139
+ visualStyles.filter = filter;
10046
10140
  }
10047
- propStyles = style ? normalizeStyles(style, "css") : {};
10048
10141
  }
10049
10142
 
10050
10143
  const firstConfigStyle = {};
@@ -10057,12 +10150,15 @@ const withPropsStyle = (
10057
10150
  if (align) {
10058
10151
  Object.assign(firstConfigStyle, alignmentStyles);
10059
10152
  }
10060
- if (expansion) {
10061
- Object.assign(firstConfigStyle, expansionStyles);
10153
+ if (size) {
10154
+ Object.assign(firstConfigStyle, sizeStyles);
10062
10155
  }
10063
10156
  if (typo) {
10064
10157
  Object.assign(firstConfigStyle, typoStyles);
10065
10158
  }
10159
+ if (visual) {
10160
+ Object.assign(firstConfigStyle, visualStyles);
10161
+ }
10066
10162
  if (style) {
10067
10163
  appendStyles(firstConfigStyle, propStyles, "css");
10068
10164
  }
@@ -10081,12 +10177,15 @@ const withPropsStyle = (
10081
10177
  if (config.align || config.layout) {
10082
10178
  Object.assign(configStyle, alignmentStyles);
10083
10179
  }
10084
- if (config.expansion || config.layout) {
10085
- Object.assign(configStyle, expansionStyles);
10180
+ if (config.size || config.layout) {
10181
+ Object.assign(configStyle, sizeStyles);
10086
10182
  }
10087
10183
  if (config.typo) {
10088
10184
  Object.assign(configStyle, typoStyles);
10089
10185
  }
10186
+ if (config.visual || config.visual === undefined) {
10187
+ Object.assign(configStyle, visualStyles);
10188
+ }
10090
10189
  if (config.style) {
10091
10190
  appendStyles(configStyle, propStyles, "css");
10092
10191
  }
@@ -19250,7 +19349,7 @@ const FlexRow = ({
19250
19349
  justifyContent: alignX !== "start" ? alignX : undefined,
19251
19350
  // Only set alignItems if it's not the default "stretch"
19252
19351
  alignItems: alignY !== "stretch" ? alignY : undefined,
19253
- gap
19352
+ gap: sizeSpacingScale[gap] || gap
19254
19353
  },
19255
19354
  layout: true
19256
19355
  });