@soroush.tech/styled-system 5.1.6 → 5.2.0

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/README.md CHANGED
@@ -143,8 +143,8 @@ Full docs live in [`docs/`](./docs/README.md):
143
143
  - [TypeScript](https://github.com/soroush-tech/soroush.tech/tree/main/packages/styled-system/docs/typescript.md)
144
144
  - [Guides](https://github.com/soroush-tech/soroush.tech/tree/main/packages/styled-system/docs/guides/index.md)
145
145
 
146
- Runnable demos live in [`examples/styled-system/`](../../examples/styled-system).
146
+ Runnable demos live in [`examples/styled-system/`](https://github.com/soroush-tech/soroush.tech/tree/main/examples/styled-system).
147
147
 
148
148
  ## License
149
149
 
150
- MIT — a rewrite of styled-system (© 2017–2021 Brent Jackson), see [`LICENSE`](./LICENSE).
150
+ MIT — a rewrite of styled-system (© 2017–2021 Brent Jackson), see [`LICENSE`](https://github.com/soroush-tech/soroush.tech/tree/main/packages/styled-system/LICENSE).
package/dist/core.cjs CHANGED
@@ -1,7 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/core/core.ts
3
3
  const merge = (a, b) => {
4
- const result = Object.assign({}, a, b);
4
+ const result = {
5
+ ...a,
6
+ ...b
7
+ };
5
8
  for (const key in a) {
6
9
  if (!a[key] || typeof b[key] !== "object") continue;
7
10
  Object.assign(result, { [key]: Object.assign(a[key], b[key]) });
@@ -25,10 +28,10 @@ const defaults = { breakpoints: [
25
28
  ].map((n) => n + "em") };
26
29
  const createMediaQuery = (n) => `@media screen and (min-width: ${n})`;
27
30
  const getValue = (n, scale) => get(scale, n, n);
28
- const get = (obj, key, def, p, undef) => {
31
+ const get = (obj, key, def, p = 0, undef) => {
29
32
  const path = typeof key === "string" ? key.split(".") : [key];
30
33
  let value = obj;
31
- for (p = 0; p < path.length; p++) value = value ? value[path[p]] : undef;
34
+ for (; p < path.length; p++) value = value ? value[path[p]] : undef;
32
35
  return value === undef ? def : value;
33
36
  };
34
37
  const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
@@ -36,8 +39,11 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
36
39
  raw.slice(0, mediaQueries.length).forEach((value, i) => {
37
40
  const media = mediaQueries[i];
38
41
  const style = sx(value, scale, props);
39
- if (!media) Object.assign(styles, style);
40
- else Object.assign(styles, { [media]: Object.assign({}, styles[media], style) });
42
+ if (media) Object.assign(styles, { [media]: {
43
+ ...styles[media],
44
+ ...style
45
+ } });
46
+ else Object.assign(styles, style);
41
47
  });
42
48
  return styles;
43
49
  };
@@ -47,11 +53,13 @@ const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
47
53
  const breakpoint = breakpoints[key];
48
54
  const value = raw[key];
49
55
  const style = sx(value, scale, props);
50
- if (!breakpoint) Object.assign(styles, style);
51
- else {
56
+ if (breakpoint) {
52
57
  const media = createMediaQuery(breakpoint);
53
- Object.assign(styles, { [media]: Object.assign({}, styles[media], style) });
54
- }
58
+ Object.assign(styles, { [media]: {
59
+ ...styles[media],
60
+ ...style
61
+ } });
62
+ } else Object.assign(styles, style);
55
63
  }
56
64
  return styles;
57
65
  };
@@ -60,7 +68,7 @@ const createParser = (config) => {
60
68
  const parse = ((props) => {
61
69
  let styles = {};
62
70
  let shouldSort = false;
63
- const isCacheDisabled = props.theme && props.theme.disableStyledSystemCache;
71
+ const isCacheDisabled = props.theme?.disableStyledSystemCache;
64
72
  for (const key in props) {
65
73
  if (!config[key]) continue;
66
74
  const sx = config[key];
@@ -130,7 +138,7 @@ const system = (args = {}) => {
130
138
  const compose = (...parsers) => {
131
139
  const config = {};
132
140
  parsers.forEach((parser) => {
133
- if (!parser || !parser.config) return;
141
+ if (!parser?.config) return;
134
142
  Object.assign(config, parser.config);
135
143
  });
136
144
  return createParser(config);
package/dist/core.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  //#region src/core/core.ts
2
2
  const merge = (a, b) => {
3
- const result = Object.assign({}, a, b);
3
+ const result = {
4
+ ...a,
5
+ ...b
6
+ };
4
7
  for (const key in a) {
5
8
  if (!a[key] || typeof b[key] !== "object") continue;
6
9
  Object.assign(result, { [key]: Object.assign(a[key], b[key]) });
@@ -24,10 +27,10 @@ const defaults = { breakpoints: [
24
27
  ].map((n) => n + "em") };
25
28
  const createMediaQuery = (n) => `@media screen and (min-width: ${n})`;
26
29
  const getValue = (n, scale) => get(scale, n, n);
27
- const get = (obj, key, def, p, undef) => {
30
+ const get = (obj, key, def, p = 0, undef) => {
28
31
  const path = typeof key === "string" ? key.split(".") : [key];
29
32
  let value = obj;
30
- for (p = 0; p < path.length; p++) value = value ? value[path[p]] : undef;
33
+ for (; p < path.length; p++) value = value ? value[path[p]] : undef;
31
34
  return value === undef ? def : value;
32
35
  };
33
36
  const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
@@ -35,8 +38,11 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
35
38
  raw.slice(0, mediaQueries.length).forEach((value, i) => {
36
39
  const media = mediaQueries[i];
37
40
  const style = sx(value, scale, props);
38
- if (!media) Object.assign(styles, style);
39
- else Object.assign(styles, { [media]: Object.assign({}, styles[media], style) });
41
+ if (media) Object.assign(styles, { [media]: {
42
+ ...styles[media],
43
+ ...style
44
+ } });
45
+ else Object.assign(styles, style);
40
46
  });
41
47
  return styles;
42
48
  };
@@ -46,11 +52,13 @@ const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
46
52
  const breakpoint = breakpoints[key];
47
53
  const value = raw[key];
48
54
  const style = sx(value, scale, props);
49
- if (!breakpoint) Object.assign(styles, style);
50
- else {
55
+ if (breakpoint) {
51
56
  const media = createMediaQuery(breakpoint);
52
- Object.assign(styles, { [media]: Object.assign({}, styles[media], style) });
53
- }
57
+ Object.assign(styles, { [media]: {
58
+ ...styles[media],
59
+ ...style
60
+ } });
61
+ } else Object.assign(styles, style);
54
62
  }
55
63
  return styles;
56
64
  };
@@ -59,7 +67,7 @@ const createParser = (config) => {
59
67
  const parse = ((props) => {
60
68
  let styles = {};
61
69
  let shouldSort = false;
62
- const isCacheDisabled = props.theme && props.theme.disableStyledSystemCache;
70
+ const isCacheDisabled = props.theme?.disableStyledSystemCache;
63
71
  for (const key in props) {
64
72
  if (!config[key]) continue;
65
73
  const sx = config[key];
@@ -129,7 +137,7 @@ const system = (args = {}) => {
129
137
  const compose = (...parsers) => {
130
138
  const config = {};
131
139
  parsers.forEach((parser) => {
132
- if (!parser || !parser.config) return;
140
+ if (!parser?.config) return;
133
141
  Object.assign(config, parser.config);
134
142
  });
135
143
  return createParser(config);
@@ -1,8 +1,8 @@
1
1
  //#region src/css/css.ts
2
- const get = (obj, key, def, p, undef) => {
2
+ const get = (obj, key, def, p = 0, undef) => {
3
3
  const path = typeof key === "string" ? key.split(".") : [key];
4
4
  let value = obj;
5
- for (p = 0; p < path.length; p++) value = value ? value[path[p]] : undef;
5
+ for (; p < path.length; p++) value = value ? value[path[p]] : undef;
6
6
  return value === undef ? def : value;
7
7
  };
8
8
  const defaultBreakpoints = [
@@ -205,7 +205,7 @@ const css = (args) => (props = {}) => {
205
205
  const value = get(transforms, prop, get)(scale, val, val);
206
206
  if (multiples[prop]) {
207
207
  const dirs = multiples[prop];
208
- for (let i = 0; i < dirs.length; i++) result[dirs[i]] = value;
208
+ for (const dir of dirs) result[dir] = value;
209
209
  } else result[prop] = value;
210
210
  }
211
211
  return result;
@@ -1,8 +1,8 @@
1
1
  //#region src/css/css.ts
2
- const get = (obj, key, def, p, undef) => {
2
+ const get = (obj, key, def, p = 0, undef) => {
3
3
  const path = typeof key === "string" ? key.split(".") : [key];
4
4
  let value = obj;
5
- for (p = 0; p < path.length; p++) value = value ? value[path[p]] : undef;
5
+ for (; p < path.length; p++) value = value ? value[path[p]] : undef;
6
6
  return value === undef ? def : value;
7
7
  };
8
8
  const defaultBreakpoints = [
@@ -205,7 +205,7 @@ const css = (args) => (props = {}) => {
205
205
  const value = get(transforms, prop, get)(scale, val, val);
206
206
  if (multiples[prop]) {
207
207
  const dirs = multiples[prop];
208
- for (let i = 0; i < dirs.length; i++) result[dirs[i]] = value;
208
+ for (const dir of dirs) result[dir] = value;
209
209
  } else result[prop] = value;
210
210
  }
211
211
  return result;
package/dist/css.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_css = require("./css-nzeM_Xnf.cjs");
5
+ const require_css = require("./css-BQ6QmZDs.cjs");
6
6
  exports.css = require_css.css;
7
7
  exports.default = require_css.css;
8
8
  exports.get = require_css.get;
package/dist/css.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as get, r as responsive, t as css } from "./css-rLZ9Oeye.mjs";
1
+ import { n as get, r as responsive, t as css } from "./css-DPyZNAmX.mjs";
2
2
  export { css, css as default, get, responsive };
package/dist/index.cjs CHANGED
@@ -5,12 +5,12 @@ const require_border = require("./border-UuT-fTpy.cjs");
5
5
  const require_color = require("./color-BNs17Gw-.cjs");
6
6
  const require_flexbox = require("./flexbox-CFkO6PrP.cjs");
7
7
  const require_grid = require("./grid-CpvRIng4.cjs");
8
- const require_layout = require("./layout-B1-2dfQ9.cjs");
8
+ const require_layout = require("./layout-JlwVxg8y.cjs");
9
9
  const require_position = require("./position-zWvCE4hD.cjs");
10
10
  const require_typography = require("./typography-DD_eWLLx.cjs");
11
- const require_space = require("./space-C14uiNpw.cjs");
11
+ const require_space = require("./space-CAX_62yL.cjs");
12
12
  const require_shadow = require("./shadow-BrDnaQQl.cjs");
13
- const require_variant = require("./variant-ChsBzwrI.cjs");
13
+ const require_variant = require("./variant-C7vPzZHo.cjs");
14
14
  //#region src/style/style.ts
15
15
  const style = ({ prop, cssProperty, alias, key, transformValue, scale, properties }) => {
16
16
  const config = {};
package/dist/index.d.cts CHANGED
@@ -35,7 +35,7 @@ declare const style: ({
35
35
  //#region src/types.d.ts
36
36
  type ObjectOrArray<T, K extends keyof never = keyof never> = T[] | Record<K, T | Record<K, T> | T[]>;
37
37
  type Scale = ObjectOrArray<number | string>;
38
- type TLengthStyledSystem = string | 0 | number;
38
+ type TLengthStyledSystem = string | number;
39
39
  interface Theme<TLength = TLengthStyledSystem> {
40
40
  breakpoints?: ObjectOrArray<number | string | symbol>;
41
41
  mediaQueries?: {
@@ -62,37 +62,7 @@ interface Theme<TLength = TLengthStyledSystem> {
62
62
  type RequiredTheme = Required<Theme>;
63
63
  type ThemeValue<K extends keyof ThemeType, ThemeType, TVal = unknown> = NonNullable<ThemeType[K]> extends TVal[] ? number : NonNullable<ThemeType[K]> extends Record<infer E, TVal> ? E : NonNullable<ThemeType[K]> extends ObjectOrArray<infer F> ? F : never;
64
64
  type ResponsiveValue<T, ThemeType extends Theme = RequiredTheme> = T | null | Array<T | null> | { [key in (ThemeValue<'breakpoints', ThemeType> & string) | number]?: T };
65
- type L = TLengthStyledSystem;
66
- interface SpaceProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> {
67
- m?: ResponsiveValue<TVal, ThemeType>;
68
- margin?: ResponsiveValue<TVal, ThemeType>;
69
- mt?: ResponsiveValue<TVal, ThemeType>;
70
- marginTop?: ResponsiveValue<TVal, ThemeType>;
71
- mr?: ResponsiveValue<TVal, ThemeType>;
72
- marginRight?: ResponsiveValue<TVal, ThemeType>;
73
- mb?: ResponsiveValue<TVal, ThemeType>;
74
- marginBottom?: ResponsiveValue<TVal, ThemeType>;
75
- ml?: ResponsiveValue<TVal, ThemeType>;
76
- marginLeft?: ResponsiveValue<TVal, ThemeType>;
77
- mx?: ResponsiveValue<TVal, ThemeType>;
78
- marginX?: ResponsiveValue<TVal, ThemeType>;
79
- my?: ResponsiveValue<TVal, ThemeType>;
80
- marginY?: ResponsiveValue<TVal, ThemeType>;
81
- p?: ResponsiveValue<TVal, ThemeType>;
82
- padding?: ResponsiveValue<TVal, ThemeType>;
83
- pt?: ResponsiveValue<TVal, ThemeType>;
84
- paddingTop?: ResponsiveValue<TVal, ThemeType>;
85
- pr?: ResponsiveValue<TVal, ThemeType>;
86
- paddingRight?: ResponsiveValue<TVal, ThemeType>;
87
- pb?: ResponsiveValue<TVal, ThemeType>;
88
- paddingBottom?: ResponsiveValue<TVal, ThemeType>;
89
- pl?: ResponsiveValue<TVal, ThemeType>;
90
- paddingLeft?: ResponsiveValue<TVal, ThemeType>;
91
- px?: ResponsiveValue<TVal, ThemeType>;
92
- paddingX?: ResponsiveValue<TVal, ThemeType>;
93
- py?: ResponsiveValue<TVal, ThemeType>;
94
- paddingY?: ResponsiveValue<TVal, ThemeType>;
95
- }
65
+ interface SpaceProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> extends MarginProps<ThemeType, TVal>, PaddingProps<ThemeType, TVal> {}
96
66
  interface MarginProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> {
97
67
  m?: ResponsiveValue<TVal, ThemeType>;
98
68
  margin?: ResponsiveValue<TVal, ThemeType>;
@@ -126,25 +96,25 @@ interface PaddingProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValu
126
96
  paddingY?: ResponsiveValue<TVal, ThemeType>;
127
97
  }
128
98
  interface LayoutProps<ThemeType extends Theme = RequiredTheme> {
129
- width?: ResponsiveValue<CSS.Property.Width<L>, ThemeType>;
130
- height?: ResponsiveValue<CSS.Property.Height<L>, ThemeType>;
131
- minWidth?: ResponsiveValue<CSS.Property.MinWidth<L>, ThemeType>;
132
- minHeight?: ResponsiveValue<CSS.Property.MinHeight<L>, ThemeType>;
133
- maxWidth?: ResponsiveValue<CSS.Property.MaxWidth<L>, ThemeType>;
134
- maxHeight?: ResponsiveValue<CSS.Property.MaxHeight<L>, ThemeType>;
135
- size?: ResponsiveValue<CSS.Property.Width<L>, ThemeType>;
99
+ width?: ResponsiveValue<CSS.Property.Width<TLengthStyledSystem>, ThemeType>;
100
+ height?: ResponsiveValue<CSS.Property.Height<TLengthStyledSystem>, ThemeType>;
101
+ minWidth?: ResponsiveValue<CSS.Property.MinWidth<TLengthStyledSystem>, ThemeType>;
102
+ minHeight?: ResponsiveValue<CSS.Property.MinHeight<TLengthStyledSystem>, ThemeType>;
103
+ maxWidth?: ResponsiveValue<CSS.Property.MaxWidth<TLengthStyledSystem>, ThemeType>;
104
+ maxHeight?: ResponsiveValue<CSS.Property.MaxHeight<TLengthStyledSystem>, ThemeType>;
105
+ size?: ResponsiveValue<CSS.Property.Width<TLengthStyledSystem>, ThemeType>;
136
106
  overflow?: ResponsiveValue<CSS.Property.Overflow, ThemeType>;
137
107
  overflowX?: ResponsiveValue<CSS.Property.OverflowX, ThemeType>;
138
108
  overflowY?: ResponsiveValue<CSS.Property.OverflowY, ThemeType>;
139
109
  display?: ResponsiveValue<CSS.Property.Display, ThemeType>;
140
- verticalAlign?: ResponsiveValue<CSS.Property.VerticalAlign<L>, ThemeType>;
110
+ verticalAlign?: ResponsiveValue<CSS.Property.VerticalAlign<TLengthStyledSystem>, ThemeType>;
141
111
  }
142
112
  interface TypographyProps<ThemeType extends Theme = RequiredTheme> {
143
113
  fontFamily?: ResponsiveValue<CSS.Property.FontFamily, ThemeType>;
144
114
  fontSize?: ResponsiveValue<ThemeValue<'fontSizes', ThemeType>, ThemeType>;
145
115
  fontWeight?: ResponsiveValue<ThemeValue<'fontWeights', ThemeType> | string, ThemeType>;
146
116
  lineHeight?: ResponsiveValue<ThemeValue<'lineHeights', ThemeType>, ThemeType>;
147
- letterSpacing?: ResponsiveValue<CSS.Property.LetterSpacing<L>, ThemeType>;
117
+ letterSpacing?: ResponsiveValue<CSS.Property.LetterSpacing<TLengthStyledSystem>, ThemeType>;
148
118
  textAlign?: ResponsiveValue<CSS.Property.TextAlign, ThemeType>;
149
119
  fontStyle?: ResponsiveValue<CSS.Property.FontStyle, ThemeType>;
150
120
  }
@@ -155,10 +125,10 @@ interface FlexboxProps<ThemeType extends Theme = RequiredTheme> {
155
125
  justifyContent?: ResponsiveValue<CSS.Property.JustifyContent, ThemeType>;
156
126
  flexWrap?: ResponsiveValue<CSS.Property.FlexWrap, ThemeType>;
157
127
  flexDirection?: ResponsiveValue<CSS.Property.FlexDirection, ThemeType>;
158
- flex?: ResponsiveValue<CSS.Property.Flex<L>, ThemeType>;
128
+ flex?: ResponsiveValue<CSS.Property.Flex<TLengthStyledSystem>, ThemeType>;
159
129
  flexGrow?: ResponsiveValue<CSS.Property.FlexGrow, ThemeType>;
160
130
  flexShrink?: ResponsiveValue<CSS.Property.FlexShrink, ThemeType>;
161
- flexBasis?: ResponsiveValue<CSS.Property.FlexBasis<L>, ThemeType>;
131
+ flexBasis?: ResponsiveValue<CSS.Property.FlexBasis<TLengthStyledSystem>, ThemeType>;
162
132
  justifySelf?: ResponsiveValue<CSS.Property.JustifySelf, ThemeType>;
163
133
  alignSelf?: ResponsiveValue<CSS.Property.AlignSelf, ThemeType>;
164
134
  order?: ResponsiveValue<CSS.Property.Order, ThemeType>;
@@ -166,10 +136,10 @@ interface FlexboxProps<ThemeType extends Theme = RequiredTheme> {
166
136
  interface PositionProps<ThemeType extends Theme = RequiredTheme> {
167
137
  position?: ResponsiveValue<CSS.Property.Position, ThemeType>;
168
138
  zIndex?: ResponsiveValue<CSS.Property.ZIndex, ThemeType>;
169
- top?: ResponsiveValue<CSS.Property.Top<L>, ThemeType>;
170
- right?: ResponsiveValue<CSS.Property.Right<L>, ThemeType>;
171
- bottom?: ResponsiveValue<CSS.Property.Bottom<L>, ThemeType>;
172
- left?: ResponsiveValue<CSS.Property.Left<L>, ThemeType>;
139
+ top?: ResponsiveValue<CSS.Property.Top<TLengthStyledSystem>, ThemeType>;
140
+ right?: ResponsiveValue<CSS.Property.Right<TLengthStyledSystem>, ThemeType>;
141
+ bottom?: ResponsiveValue<CSS.Property.Bottom<TLengthStyledSystem>, ThemeType>;
142
+ left?: ResponsiveValue<CSS.Property.Left<TLengthStyledSystem>, ThemeType>;
173
143
  }
174
144
  interface ColorProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'colors', ThemeType>> {
175
145
  color?: ResponsiveValue<TVal, ThemeType>;
@@ -178,34 +148,34 @@ interface ColorProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<
178
148
  opacity?: ResponsiveValue<CSS.Property.Opacity, ThemeType>;
179
149
  }
180
150
  interface BorderProps<ThemeType extends Theme = RequiredTheme> {
181
- border?: ResponsiveValue<CSS.Property.Border<L>, ThemeType>;
182
- borderWidth?: ResponsiveValue<CSS.Property.BorderWidth<L>, ThemeType>;
151
+ border?: ResponsiveValue<CSS.Property.Border<TLengthStyledSystem>, ThemeType>;
152
+ borderWidth?: ResponsiveValue<CSS.Property.BorderWidth<TLengthStyledSystem>, ThemeType>;
183
153
  borderStyle?: ResponsiveValue<CSS.Property.BorderStyle, ThemeType>;
184
154
  borderColor?: ResponsiveValue<ThemeValue<'colors', ThemeType>, ThemeType>;
185
155
  borderRadius?: ResponsiveValue<ThemeValue<'radii', ThemeType>, ThemeType>;
186
- borderTop?: ResponsiveValue<CSS.Property.BorderTop<L>, ThemeType>;
187
- borderRight?: ResponsiveValue<CSS.Property.BorderRight<L>, ThemeType>;
188
- borderBottom?: ResponsiveValue<CSS.Property.BorderBottom<L>, ThemeType>;
189
- borderLeft?: ResponsiveValue<CSS.Property.BorderLeft<L>, ThemeType>;
156
+ borderTop?: ResponsiveValue<CSS.Property.BorderTop<TLengthStyledSystem>, ThemeType>;
157
+ borderRight?: ResponsiveValue<CSS.Property.BorderRight<TLengthStyledSystem>, ThemeType>;
158
+ borderBottom?: ResponsiveValue<CSS.Property.BorderBottom<TLengthStyledSystem>, ThemeType>;
159
+ borderLeft?: ResponsiveValue<CSS.Property.BorderLeft<TLengthStyledSystem>, ThemeType>;
190
160
  }
191
161
  interface BackgroundProps<ThemeType extends Theme = RequiredTheme> {
192
- background?: ResponsiveValue<CSS.Property.Background<L>, ThemeType>;
162
+ background?: ResponsiveValue<CSS.Property.Background<TLengthStyledSystem>, ThemeType>;
193
163
  backgroundImage?: ResponsiveValue<CSS.Property.BackgroundImage, ThemeType>;
194
- backgroundSize?: ResponsiveValue<CSS.Property.BackgroundSize<L>, ThemeType>;
195
- backgroundPosition?: ResponsiveValue<CSS.Property.BackgroundPosition<L>, ThemeType>;
164
+ backgroundSize?: ResponsiveValue<CSS.Property.BackgroundSize<TLengthStyledSystem>, ThemeType>;
165
+ backgroundPosition?: ResponsiveValue<CSS.Property.BackgroundPosition<TLengthStyledSystem>, ThemeType>;
196
166
  backgroundRepeat?: ResponsiveValue<CSS.Property.BackgroundRepeat, ThemeType>;
197
167
  }
198
168
  interface GridProps<ThemeType extends Theme = RequiredTheme> {
199
- gridGap?: ResponsiveValue<CSS.Property.GridGap<L>, ThemeType>;
200
- gridColumnGap?: ResponsiveValue<CSS.Property.GridColumnGap<L>, ThemeType>;
201
- gridRowGap?: ResponsiveValue<CSS.Property.GridRowGap<L>, ThemeType>;
169
+ gridGap?: ResponsiveValue<CSS.Property.GridGap<TLengthStyledSystem>, ThemeType>;
170
+ gridColumnGap?: ResponsiveValue<CSS.Property.GridColumnGap<TLengthStyledSystem>, ThemeType>;
171
+ gridRowGap?: ResponsiveValue<CSS.Property.GridRowGap<TLengthStyledSystem>, ThemeType>;
202
172
  gridColumn?: ResponsiveValue<CSS.Property.GridColumn, ThemeType>;
203
173
  gridRow?: ResponsiveValue<CSS.Property.GridRow, ThemeType>;
204
174
  gridAutoFlow?: ResponsiveValue<CSS.Property.GridAutoFlow, ThemeType>;
205
- gridAutoColumns?: ResponsiveValue<CSS.Property.GridAutoColumns<L>, ThemeType>;
206
- gridAutoRows?: ResponsiveValue<CSS.Property.GridAutoRows<L>, ThemeType>;
207
- gridTemplateColumns?: ResponsiveValue<CSS.Property.GridTemplateColumns<L>, ThemeType>;
208
- gridTemplateRows?: ResponsiveValue<CSS.Property.GridTemplateRows<L>, ThemeType>;
175
+ gridAutoColumns?: ResponsiveValue<CSS.Property.GridAutoColumns<TLengthStyledSystem>, ThemeType>;
176
+ gridAutoRows?: ResponsiveValue<CSS.Property.GridAutoRows<TLengthStyledSystem>, ThemeType>;
177
+ gridTemplateColumns?: ResponsiveValue<CSS.Property.GridTemplateColumns<TLengthStyledSystem>, ThemeType>;
178
+ gridTemplateRows?: ResponsiveValue<CSS.Property.GridTemplateRows<TLengthStyledSystem>, ThemeType>;
209
179
  gridTemplateAreas?: ResponsiveValue<CSS.Property.GridTemplateAreas, ThemeType>;
210
180
  gridArea?: ResponsiveValue<CSS.Property.GridArea, ThemeType>;
211
181
  }
package/dist/index.d.mts CHANGED
@@ -35,7 +35,7 @@ declare const style: ({
35
35
  //#region src/types.d.ts
36
36
  type ObjectOrArray<T, K extends keyof never = keyof never> = T[] | Record<K, T | Record<K, T> | T[]>;
37
37
  type Scale = ObjectOrArray<number | string>;
38
- type TLengthStyledSystem = string | 0 | number;
38
+ type TLengthStyledSystem = string | number;
39
39
  interface Theme<TLength = TLengthStyledSystem> {
40
40
  breakpoints?: ObjectOrArray<number | string | symbol>;
41
41
  mediaQueries?: {
@@ -62,37 +62,7 @@ interface Theme<TLength = TLengthStyledSystem> {
62
62
  type RequiredTheme = Required<Theme>;
63
63
  type ThemeValue<K extends keyof ThemeType, ThemeType, TVal = unknown> = NonNullable<ThemeType[K]> extends TVal[] ? number : NonNullable<ThemeType[K]> extends Record<infer E, TVal> ? E : NonNullable<ThemeType[K]> extends ObjectOrArray<infer F> ? F : never;
64
64
  type ResponsiveValue<T, ThemeType extends Theme = RequiredTheme> = T | null | Array<T | null> | { [key in (ThemeValue<'breakpoints', ThemeType> & string) | number]?: T };
65
- type L = TLengthStyledSystem;
66
- interface SpaceProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> {
67
- m?: ResponsiveValue<TVal, ThemeType>;
68
- margin?: ResponsiveValue<TVal, ThemeType>;
69
- mt?: ResponsiveValue<TVal, ThemeType>;
70
- marginTop?: ResponsiveValue<TVal, ThemeType>;
71
- mr?: ResponsiveValue<TVal, ThemeType>;
72
- marginRight?: ResponsiveValue<TVal, ThemeType>;
73
- mb?: ResponsiveValue<TVal, ThemeType>;
74
- marginBottom?: ResponsiveValue<TVal, ThemeType>;
75
- ml?: ResponsiveValue<TVal, ThemeType>;
76
- marginLeft?: ResponsiveValue<TVal, ThemeType>;
77
- mx?: ResponsiveValue<TVal, ThemeType>;
78
- marginX?: ResponsiveValue<TVal, ThemeType>;
79
- my?: ResponsiveValue<TVal, ThemeType>;
80
- marginY?: ResponsiveValue<TVal, ThemeType>;
81
- p?: ResponsiveValue<TVal, ThemeType>;
82
- padding?: ResponsiveValue<TVal, ThemeType>;
83
- pt?: ResponsiveValue<TVal, ThemeType>;
84
- paddingTop?: ResponsiveValue<TVal, ThemeType>;
85
- pr?: ResponsiveValue<TVal, ThemeType>;
86
- paddingRight?: ResponsiveValue<TVal, ThemeType>;
87
- pb?: ResponsiveValue<TVal, ThemeType>;
88
- paddingBottom?: ResponsiveValue<TVal, ThemeType>;
89
- pl?: ResponsiveValue<TVal, ThemeType>;
90
- paddingLeft?: ResponsiveValue<TVal, ThemeType>;
91
- px?: ResponsiveValue<TVal, ThemeType>;
92
- paddingX?: ResponsiveValue<TVal, ThemeType>;
93
- py?: ResponsiveValue<TVal, ThemeType>;
94
- paddingY?: ResponsiveValue<TVal, ThemeType>;
95
- }
65
+ interface SpaceProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> extends MarginProps<ThemeType, TVal>, PaddingProps<ThemeType, TVal> {}
96
66
  interface MarginProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'space', ThemeType>> {
97
67
  m?: ResponsiveValue<TVal, ThemeType>;
98
68
  margin?: ResponsiveValue<TVal, ThemeType>;
@@ -126,25 +96,25 @@ interface PaddingProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValu
126
96
  paddingY?: ResponsiveValue<TVal, ThemeType>;
127
97
  }
128
98
  interface LayoutProps<ThemeType extends Theme = RequiredTheme> {
129
- width?: ResponsiveValue<CSS.Property.Width<L>, ThemeType>;
130
- height?: ResponsiveValue<CSS.Property.Height<L>, ThemeType>;
131
- minWidth?: ResponsiveValue<CSS.Property.MinWidth<L>, ThemeType>;
132
- minHeight?: ResponsiveValue<CSS.Property.MinHeight<L>, ThemeType>;
133
- maxWidth?: ResponsiveValue<CSS.Property.MaxWidth<L>, ThemeType>;
134
- maxHeight?: ResponsiveValue<CSS.Property.MaxHeight<L>, ThemeType>;
135
- size?: ResponsiveValue<CSS.Property.Width<L>, ThemeType>;
99
+ width?: ResponsiveValue<CSS.Property.Width<TLengthStyledSystem>, ThemeType>;
100
+ height?: ResponsiveValue<CSS.Property.Height<TLengthStyledSystem>, ThemeType>;
101
+ minWidth?: ResponsiveValue<CSS.Property.MinWidth<TLengthStyledSystem>, ThemeType>;
102
+ minHeight?: ResponsiveValue<CSS.Property.MinHeight<TLengthStyledSystem>, ThemeType>;
103
+ maxWidth?: ResponsiveValue<CSS.Property.MaxWidth<TLengthStyledSystem>, ThemeType>;
104
+ maxHeight?: ResponsiveValue<CSS.Property.MaxHeight<TLengthStyledSystem>, ThemeType>;
105
+ size?: ResponsiveValue<CSS.Property.Width<TLengthStyledSystem>, ThemeType>;
136
106
  overflow?: ResponsiveValue<CSS.Property.Overflow, ThemeType>;
137
107
  overflowX?: ResponsiveValue<CSS.Property.OverflowX, ThemeType>;
138
108
  overflowY?: ResponsiveValue<CSS.Property.OverflowY, ThemeType>;
139
109
  display?: ResponsiveValue<CSS.Property.Display, ThemeType>;
140
- verticalAlign?: ResponsiveValue<CSS.Property.VerticalAlign<L>, ThemeType>;
110
+ verticalAlign?: ResponsiveValue<CSS.Property.VerticalAlign<TLengthStyledSystem>, ThemeType>;
141
111
  }
142
112
  interface TypographyProps<ThemeType extends Theme = RequiredTheme> {
143
113
  fontFamily?: ResponsiveValue<CSS.Property.FontFamily, ThemeType>;
144
114
  fontSize?: ResponsiveValue<ThemeValue<'fontSizes', ThemeType>, ThemeType>;
145
115
  fontWeight?: ResponsiveValue<ThemeValue<'fontWeights', ThemeType> | string, ThemeType>;
146
116
  lineHeight?: ResponsiveValue<ThemeValue<'lineHeights', ThemeType>, ThemeType>;
147
- letterSpacing?: ResponsiveValue<CSS.Property.LetterSpacing<L>, ThemeType>;
117
+ letterSpacing?: ResponsiveValue<CSS.Property.LetterSpacing<TLengthStyledSystem>, ThemeType>;
148
118
  textAlign?: ResponsiveValue<CSS.Property.TextAlign, ThemeType>;
149
119
  fontStyle?: ResponsiveValue<CSS.Property.FontStyle, ThemeType>;
150
120
  }
@@ -155,10 +125,10 @@ interface FlexboxProps<ThemeType extends Theme = RequiredTheme> {
155
125
  justifyContent?: ResponsiveValue<CSS.Property.JustifyContent, ThemeType>;
156
126
  flexWrap?: ResponsiveValue<CSS.Property.FlexWrap, ThemeType>;
157
127
  flexDirection?: ResponsiveValue<CSS.Property.FlexDirection, ThemeType>;
158
- flex?: ResponsiveValue<CSS.Property.Flex<L>, ThemeType>;
128
+ flex?: ResponsiveValue<CSS.Property.Flex<TLengthStyledSystem>, ThemeType>;
159
129
  flexGrow?: ResponsiveValue<CSS.Property.FlexGrow, ThemeType>;
160
130
  flexShrink?: ResponsiveValue<CSS.Property.FlexShrink, ThemeType>;
161
- flexBasis?: ResponsiveValue<CSS.Property.FlexBasis<L>, ThemeType>;
131
+ flexBasis?: ResponsiveValue<CSS.Property.FlexBasis<TLengthStyledSystem>, ThemeType>;
162
132
  justifySelf?: ResponsiveValue<CSS.Property.JustifySelf, ThemeType>;
163
133
  alignSelf?: ResponsiveValue<CSS.Property.AlignSelf, ThemeType>;
164
134
  order?: ResponsiveValue<CSS.Property.Order, ThemeType>;
@@ -166,10 +136,10 @@ interface FlexboxProps<ThemeType extends Theme = RequiredTheme> {
166
136
  interface PositionProps<ThemeType extends Theme = RequiredTheme> {
167
137
  position?: ResponsiveValue<CSS.Property.Position, ThemeType>;
168
138
  zIndex?: ResponsiveValue<CSS.Property.ZIndex, ThemeType>;
169
- top?: ResponsiveValue<CSS.Property.Top<L>, ThemeType>;
170
- right?: ResponsiveValue<CSS.Property.Right<L>, ThemeType>;
171
- bottom?: ResponsiveValue<CSS.Property.Bottom<L>, ThemeType>;
172
- left?: ResponsiveValue<CSS.Property.Left<L>, ThemeType>;
139
+ top?: ResponsiveValue<CSS.Property.Top<TLengthStyledSystem>, ThemeType>;
140
+ right?: ResponsiveValue<CSS.Property.Right<TLengthStyledSystem>, ThemeType>;
141
+ bottom?: ResponsiveValue<CSS.Property.Bottom<TLengthStyledSystem>, ThemeType>;
142
+ left?: ResponsiveValue<CSS.Property.Left<TLengthStyledSystem>, ThemeType>;
173
143
  }
174
144
  interface ColorProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<'colors', ThemeType>> {
175
145
  color?: ResponsiveValue<TVal, ThemeType>;
@@ -178,34 +148,34 @@ interface ColorProps<ThemeType extends Theme = RequiredTheme, TVal = ThemeValue<
178
148
  opacity?: ResponsiveValue<CSS.Property.Opacity, ThemeType>;
179
149
  }
180
150
  interface BorderProps<ThemeType extends Theme = RequiredTheme> {
181
- border?: ResponsiveValue<CSS.Property.Border<L>, ThemeType>;
182
- borderWidth?: ResponsiveValue<CSS.Property.BorderWidth<L>, ThemeType>;
151
+ border?: ResponsiveValue<CSS.Property.Border<TLengthStyledSystem>, ThemeType>;
152
+ borderWidth?: ResponsiveValue<CSS.Property.BorderWidth<TLengthStyledSystem>, ThemeType>;
183
153
  borderStyle?: ResponsiveValue<CSS.Property.BorderStyle, ThemeType>;
184
154
  borderColor?: ResponsiveValue<ThemeValue<'colors', ThemeType>, ThemeType>;
185
155
  borderRadius?: ResponsiveValue<ThemeValue<'radii', ThemeType>, ThemeType>;
186
- borderTop?: ResponsiveValue<CSS.Property.BorderTop<L>, ThemeType>;
187
- borderRight?: ResponsiveValue<CSS.Property.BorderRight<L>, ThemeType>;
188
- borderBottom?: ResponsiveValue<CSS.Property.BorderBottom<L>, ThemeType>;
189
- borderLeft?: ResponsiveValue<CSS.Property.BorderLeft<L>, ThemeType>;
156
+ borderTop?: ResponsiveValue<CSS.Property.BorderTop<TLengthStyledSystem>, ThemeType>;
157
+ borderRight?: ResponsiveValue<CSS.Property.BorderRight<TLengthStyledSystem>, ThemeType>;
158
+ borderBottom?: ResponsiveValue<CSS.Property.BorderBottom<TLengthStyledSystem>, ThemeType>;
159
+ borderLeft?: ResponsiveValue<CSS.Property.BorderLeft<TLengthStyledSystem>, ThemeType>;
190
160
  }
191
161
  interface BackgroundProps<ThemeType extends Theme = RequiredTheme> {
192
- background?: ResponsiveValue<CSS.Property.Background<L>, ThemeType>;
162
+ background?: ResponsiveValue<CSS.Property.Background<TLengthStyledSystem>, ThemeType>;
193
163
  backgroundImage?: ResponsiveValue<CSS.Property.BackgroundImage, ThemeType>;
194
- backgroundSize?: ResponsiveValue<CSS.Property.BackgroundSize<L>, ThemeType>;
195
- backgroundPosition?: ResponsiveValue<CSS.Property.BackgroundPosition<L>, ThemeType>;
164
+ backgroundSize?: ResponsiveValue<CSS.Property.BackgroundSize<TLengthStyledSystem>, ThemeType>;
165
+ backgroundPosition?: ResponsiveValue<CSS.Property.BackgroundPosition<TLengthStyledSystem>, ThemeType>;
196
166
  backgroundRepeat?: ResponsiveValue<CSS.Property.BackgroundRepeat, ThemeType>;
197
167
  }
198
168
  interface GridProps<ThemeType extends Theme = RequiredTheme> {
199
- gridGap?: ResponsiveValue<CSS.Property.GridGap<L>, ThemeType>;
200
- gridColumnGap?: ResponsiveValue<CSS.Property.GridColumnGap<L>, ThemeType>;
201
- gridRowGap?: ResponsiveValue<CSS.Property.GridRowGap<L>, ThemeType>;
169
+ gridGap?: ResponsiveValue<CSS.Property.GridGap<TLengthStyledSystem>, ThemeType>;
170
+ gridColumnGap?: ResponsiveValue<CSS.Property.GridColumnGap<TLengthStyledSystem>, ThemeType>;
171
+ gridRowGap?: ResponsiveValue<CSS.Property.GridRowGap<TLengthStyledSystem>, ThemeType>;
202
172
  gridColumn?: ResponsiveValue<CSS.Property.GridColumn, ThemeType>;
203
173
  gridRow?: ResponsiveValue<CSS.Property.GridRow, ThemeType>;
204
174
  gridAutoFlow?: ResponsiveValue<CSS.Property.GridAutoFlow, ThemeType>;
205
- gridAutoColumns?: ResponsiveValue<CSS.Property.GridAutoColumns<L>, ThemeType>;
206
- gridAutoRows?: ResponsiveValue<CSS.Property.GridAutoRows<L>, ThemeType>;
207
- gridTemplateColumns?: ResponsiveValue<CSS.Property.GridTemplateColumns<L>, ThemeType>;
208
- gridTemplateRows?: ResponsiveValue<CSS.Property.GridTemplateRows<L>, ThemeType>;
175
+ gridAutoColumns?: ResponsiveValue<CSS.Property.GridAutoColumns<TLengthStyledSystem>, ThemeType>;
176
+ gridAutoRows?: ResponsiveValue<CSS.Property.GridAutoRows<TLengthStyledSystem>, ThemeType>;
177
+ gridTemplateColumns?: ResponsiveValue<CSS.Property.GridTemplateColumns<TLengthStyledSystem>, ThemeType>;
178
+ gridTemplateRows?: ResponsiveValue<CSS.Property.GridTemplateRows<TLengthStyledSystem>, ThemeType>;
209
179
  gridTemplateAreas?: ResponsiveValue<CSS.Property.GridTemplateAreas, ThemeType>;
210
180
  gridArea?: ResponsiveValue<CSS.Property.GridArea, ThemeType>;
211
181
  }
package/dist/index.mjs CHANGED
@@ -4,12 +4,12 @@ import { t as border } from "./border-Dder4Dhp.mjs";
4
4
  import { t as color } from "./color-CGmMe8yP.mjs";
5
5
  import { t as flexbox } from "./flexbox-XQnlnfa4.mjs";
6
6
  import { t as grid } from "./grid-Bpk-QjhF.mjs";
7
- import { t as layout } from "./layout-TqD8vcEl.mjs";
7
+ import { t as layout } from "./layout-Dx0Un_6l.mjs";
8
8
  import { t as position } from "./position-jf6VlRyR.mjs";
9
9
  import { t as typography } from "./typography-CptBXSy0.mjs";
10
- import { n as padding, r as space, t as margin } from "./space-CNrX-zoo.mjs";
10
+ import { n as padding, r as space, t as margin } from "./space-DEf9-0r9.mjs";
11
11
  import { t as shadow } from "./shadow-Bp7lx_41.mjs";
12
- import { i as variant, n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-CWUfe1Cc.mjs";
12
+ import { i as variant, n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-DQA9pqwW.mjs";
13
13
  //#region src/style/style.ts
14
14
  const style = ({ prop, cssProperty, alias, key, transformValue, scale, properties }) => {
15
15
  const config = {};
@@ -1,6 +1,6 @@
1
1
  import { get, system } from "./core.mjs";
2
2
  //#region src/layout/layout.ts
3
- const isNumber = (n) => typeof n === "number" && !isNaN(n);
3
+ const isNumber = (n) => typeof n === "number" && !Number.isNaN(n);
4
4
  const getWidth = (n, scale) => get(scale, n, !isNumber(n) || n > 1 ? n : n * 100 + "%");
5
5
  const layout = system({
6
6
  width: {
@@ -1,6 +1,6 @@
1
1
  const require_core = require("./core.cjs");
2
2
  //#region src/layout/layout.ts
3
- const isNumber = (n) => typeof n === "number" && !isNaN(n);
3
+ const isNumber = (n) => typeof n === "number" && !Number.isNaN(n);
4
4
  const getWidth = (n, scale) => require_core.get(scale, n, !isNumber(n) || n > 1 ? n : n * 100 + "%");
5
5
  const config = {
6
6
  width: {
package/dist/layout.cjs CHANGED
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_layout = require("./layout-B1-2dfQ9.cjs");
5
+ const require_layout = require("./layout-JlwVxg8y.cjs");
6
6
  exports.default = require_layout.layout;
7
7
  exports.layout = require_layout.layout;
package/dist/layout.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as layout } from "./layout-TqD8vcEl.mjs";
1
+ import { t as layout } from "./layout-Dx0Un_6l.mjs";
2
2
  export { layout as default, layout };
@@ -4,12 +4,12 @@ const require_border = require("./border-UuT-fTpy.cjs");
4
4
  const require_color = require("./color-BNs17Gw-.cjs");
5
5
  const require_flexbox = require("./flexbox-CFkO6PrP.cjs");
6
6
  const require_grid = require("./grid-CpvRIng4.cjs");
7
- const require_layout = require("./layout-B1-2dfQ9.cjs");
7
+ const require_layout = require("./layout-JlwVxg8y.cjs");
8
8
  const require_position = require("./position-zWvCE4hD.cjs");
9
9
  const require_typography = require("./typography-DD_eWLLx.cjs");
10
- const require_space = require("./space-C14uiNpw.cjs");
10
+ const require_space = require("./space-CAX_62yL.cjs");
11
11
  const require_shadow = require("./shadow-BrDnaQQl.cjs");
12
- const require_variant = require("./variant-ChsBzwrI.cjs");
12
+ const require_variant = require("./variant-C7vPzZHo.cjs");
13
13
  //#region src/presets/presets.ts
14
14
  const all = require_core.compose(require_space.space, require_typography.typography, require_color.color, require_layout.layout, require_flexbox.flexbox, require_border.border, require_background.background, require_position.position, require_grid.grid, require_shadow.shadow, require_variant.buttonStyle, require_variant.textStyle, require_variant.colorStyle);
15
15
  //#endregion
@@ -4,12 +4,12 @@ import { t as border } from "./border-Dder4Dhp.mjs";
4
4
  import { t as color } from "./color-CGmMe8yP.mjs";
5
5
  import { t as flexbox } from "./flexbox-XQnlnfa4.mjs";
6
6
  import { t as grid } from "./grid-Bpk-QjhF.mjs";
7
- import { t as layout } from "./layout-TqD8vcEl.mjs";
7
+ import { t as layout } from "./layout-Dx0Un_6l.mjs";
8
8
  import { t as position } from "./position-jf6VlRyR.mjs";
9
9
  import { t as typography } from "./typography-CptBXSy0.mjs";
10
- import { r as space } from "./space-CNrX-zoo.mjs";
10
+ import { r as space } from "./space-DEf9-0r9.mjs";
11
11
  import { t as shadow } from "./shadow-Bp7lx_41.mjs";
12
- import { n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-CWUfe1Cc.mjs";
12
+ import { n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-DQA9pqwW.mjs";
13
13
  //#region src/presets/presets.ts
14
14
  const all = compose(space, typography, color, layout, flexbox, border, background, position, grid, shadow, buttonStyle, textStyle, colorStyle);
15
15
  //#endregion
package/dist/props.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_presets = require("./presets-DlUVOAIL.cjs");
2
+ const require_presets = require("./presets-BgKBhlRl.cjs");
3
3
  //#region src/props/props.ts
4
- const regex = new RegExp(`^(${require_presets.all.propNames.join("|")})$`);
4
+ const styledSystemProps = new Set(require_presets.all.propNames);
5
5
  const omit = (props) => {
6
6
  const next = {};
7
7
  for (const key in props) {
8
- if (regex.test(key)) continue;
8
+ if (key === "__proto__" || styledSystemProps.has(key)) continue;
9
9
  next[key] = props[key];
10
10
  }
11
11
  return next;
@@ -13,7 +13,7 @@ const omit = (props) => {
13
13
  const pick = (props) => {
14
14
  const next = {};
15
15
  for (const key in props) {
16
- if (!regex.test(key)) continue;
16
+ if (!styledSystemProps.has(key)) continue;
17
17
  next[key] = props[key];
18
18
  }
19
19
  return next;
package/dist/props.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { t as all } from "./presets-DjaCx0dm.mjs";
1
+ import { t as all } from "./presets-CcKoA0BA.mjs";
2
2
  //#region src/props/props.ts
3
- const regex = new RegExp(`^(${all.propNames.join("|")})$`);
3
+ const styledSystemProps = new Set(all.propNames);
4
4
  const omit = (props) => {
5
5
  const next = {};
6
6
  for (const key in props) {
7
- if (regex.test(key)) continue;
7
+ if (key === "__proto__" || styledSystemProps.has(key)) continue;
8
8
  next[key] = props[key];
9
9
  }
10
10
  return next;
@@ -12,7 +12,7 @@ const omit = (props) => {
12
12
  const pick = (props) => {
13
13
  const next = {};
14
14
  for (const key in props) {
15
- if (!regex.test(key)) continue;
15
+ if (!styledSystemProps.has(key)) continue;
16
16
  next[key] = props[key];
17
17
  }
18
18
  return next;
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_presets = require("./presets-DlUVOAIL.cjs");
27
+ const require_presets = require("./presets-BgKBhlRl.cjs");
28
28
  let _emotion_is_prop_valid = require("@emotion/is-prop-valid");
29
29
  _emotion_is_prop_valid = __toESM(_emotion_is_prop_valid, 1);
30
30
  //#region src/should-forward-prop/should-forward-prop.ts
@@ -37,8 +37,8 @@ const memoize = (fn) => {
37
37
  };
38
38
  const props = require_presets.all.propNames;
39
39
  const createShouldForwardProp = (propNames) => {
40
- const regex = new RegExp(`^(${propNames.join("|")})$`);
41
- return memoize((prop) => (0, _emotion_is_prop_valid.default)(prop) && !regex.test(prop));
40
+ const blocked = new Set(propNames);
41
+ return memoize((prop) => (0, _emotion_is_prop_valid.default)(prop) && !blocked.has(prop));
42
42
  };
43
43
  var should_forward_prop_default = createShouldForwardProp(props);
44
44
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as all } from "./presets-DjaCx0dm.mjs";
1
+ import { t as all } from "./presets-CcKoA0BA.mjs";
2
2
  import isPropValid from "@emotion/is-prop-valid";
3
3
  //#region src/should-forward-prop/should-forward-prop.ts
4
4
  const memoize = (fn) => {
@@ -10,8 +10,8 @@ const memoize = (fn) => {
10
10
  };
11
11
  const props = all.propNames;
12
12
  const createShouldForwardProp = (propNames) => {
13
- const regex = new RegExp(`^(${propNames.join("|")})$`);
14
- return memoize((prop) => isPropValid(prop) && !regex.test(prop));
13
+ const blocked = new Set(propNames);
14
+ return memoize((prop) => isPropValid(prop) && !blocked.has(prop));
15
15
  };
16
16
  var should_forward_prop_default = createShouldForwardProp(props);
17
17
  //#endregion
@@ -11,7 +11,7 @@ const spaceScale = [
11
11
  256,
12
12
  512
13
13
  ];
14
- const isNumber = (n) => typeof n === "number" && !isNaN(n);
14
+ const isNumber = (n) => typeof n === "number" && !Number.isNaN(n);
15
15
  const getMargin = (n, scale) => {
16
16
  if (!isNumber(n)) return require_core.get(scale, n, n);
17
17
  const isNegative = n < 0;
@@ -11,7 +11,7 @@ const spaceScale = [
11
11
  256,
12
12
  512
13
13
  ];
14
- const isNumber = (n) => typeof n === "number" && !isNaN(n);
14
+ const isNumber = (n) => typeof n === "number" && !Number.isNaN(n);
15
15
  const getMargin = (n, scale) => {
16
16
  if (!isNumber(n)) return get(scale, n, n);
17
17
  const isNegative = n < 0;
package/dist/space.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_space = require("./space-C14uiNpw.cjs");
5
+ const require_space = require("./space-CAX_62yL.cjs");
6
6
  exports.default = require_space.space;
7
7
  exports.margin = require_space.margin;
8
8
  exports.padding = require_space.padding;
package/dist/space.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as padding, r as space, t as margin } from "./space-CNrX-zoo.mjs";
1
+ import { n as padding, r as space, t as margin } from "./space-DEf9-0r9.mjs";
2
2
  export { space as default, space, margin, padding };
@@ -1,5 +1,5 @@
1
1
  const require_core = require("./core.cjs");
2
- const require_css = require("./css-nzeM_Xnf.cjs");
2
+ const require_css = require("./css-BQ6QmZDs.cjs");
3
3
  //#region src/variant/variant.ts
4
4
  const variant = (options = {}) => {
5
5
  const { scale, prop = "variant", variants = {}, key } = options;
@@ -1,5 +1,5 @@
1
1
  import { createParser, get } from "./core.mjs";
2
- import { t as css } from "./css-rLZ9Oeye.mjs";
2
+ import { t as css } from "./css-DPyZNAmX.mjs";
3
3
  //#region src/variant/variant.ts
4
4
  const variant = (options = {}) => {
5
5
  const { scale, prop = "variant", variants = {}, key } = options;
package/dist/variant.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_variant = require("./variant-ChsBzwrI.cjs");
5
+ const require_variant = require("./variant-C7vPzZHo.cjs");
6
6
  exports.buttonStyle = require_variant.buttonStyle;
7
7
  exports.colorStyle = require_variant.colorStyle;
8
8
  exports.default = require_variant.variant;
package/dist/variant.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as variant, n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-CWUfe1Cc.mjs";
1
+ import { i as variant, n as colorStyle, r as textStyle, t as buttonStyle } from "./variant-DQA9pqwW.mjs";
2
2
  export { buttonStyle, colorStyle, variant as default, variant, textStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soroush.tech/styled-system",
3
- "version": "5.1.6",
3
+ "version": "5.2.0",
4
4
  "description": "Maintained, first-class-TypeScript rewrite of styled-system — responsive, theme-aware style props for CSS-in-JS. Drop-in replacement for styled-system v5.",
5
5
  "keywords": [
6
6
  "styled-system",
@@ -28,213 +28,183 @@
28
28
  "dist"
29
29
  ],
30
30
  "exports": {
31
- ".": "./src/index.ts",
32
- "./core": "./src/core/index.ts",
33
- "./space": "./src/space/index.ts",
34
- "./color": "./src/color/index.ts",
35
- "./layout": "./src/layout/index.ts",
36
- "./typography": "./src/typography/index.ts",
37
- "./flexbox": "./src/flexbox/index.ts",
38
- "./grid": "./src/grid/index.ts",
39
- "./background": "./src/background/index.ts",
40
- "./border": "./src/border/index.ts",
41
- "./position": "./src/position/index.ts",
42
- "./shadow": "./src/shadow/index.ts",
43
- "./variant": "./src/variant/index.ts",
44
- "./css": "./src/css/index.ts",
45
- "./theme-get": "./src/theme-get/index.ts",
46
- "./props": "./src/props/index.ts",
47
- "./should-forward-prop": "./src/should-forward-prop/index.ts"
31
+ ".": {
32
+ "import": {
33
+ "types": "./dist/index.d.mts",
34
+ "default": "./dist/index.mjs"
35
+ },
36
+ "require": {
37
+ "types": "./dist/index.d.cts",
38
+ "default": "./dist/index.cjs"
39
+ }
40
+ },
41
+ "./core": {
42
+ "import": {
43
+ "types": "./dist/core.d.mts",
44
+ "default": "./dist/core.mjs"
45
+ },
46
+ "require": {
47
+ "types": "./dist/core.d.cts",
48
+ "default": "./dist/core.cjs"
49
+ }
50
+ },
51
+ "./space": {
52
+ "import": {
53
+ "types": "./dist/space.d.mts",
54
+ "default": "./dist/space.mjs"
55
+ },
56
+ "require": {
57
+ "types": "./dist/space.d.cts",
58
+ "default": "./dist/space.cjs"
59
+ }
60
+ },
61
+ "./color": {
62
+ "import": {
63
+ "types": "./dist/color.d.mts",
64
+ "default": "./dist/color.mjs"
65
+ },
66
+ "require": {
67
+ "types": "./dist/color.d.cts",
68
+ "default": "./dist/color.cjs"
69
+ }
70
+ },
71
+ "./layout": {
72
+ "import": {
73
+ "types": "./dist/layout.d.mts",
74
+ "default": "./dist/layout.mjs"
75
+ },
76
+ "require": {
77
+ "types": "./dist/layout.d.cts",
78
+ "default": "./dist/layout.cjs"
79
+ }
80
+ },
81
+ "./typography": {
82
+ "import": {
83
+ "types": "./dist/typography.d.mts",
84
+ "default": "./dist/typography.mjs"
85
+ },
86
+ "require": {
87
+ "types": "./dist/typography.d.cts",
88
+ "default": "./dist/typography.cjs"
89
+ }
90
+ },
91
+ "./flexbox": {
92
+ "import": {
93
+ "types": "./dist/flexbox.d.mts",
94
+ "default": "./dist/flexbox.mjs"
95
+ },
96
+ "require": {
97
+ "types": "./dist/flexbox.d.cts",
98
+ "default": "./dist/flexbox.cjs"
99
+ }
100
+ },
101
+ "./grid": {
102
+ "import": {
103
+ "types": "./dist/grid.d.mts",
104
+ "default": "./dist/grid.mjs"
105
+ },
106
+ "require": {
107
+ "types": "./dist/grid.d.cts",
108
+ "default": "./dist/grid.cjs"
109
+ }
110
+ },
111
+ "./background": {
112
+ "import": {
113
+ "types": "./dist/background.d.mts",
114
+ "default": "./dist/background.mjs"
115
+ },
116
+ "require": {
117
+ "types": "./dist/background.d.cts",
118
+ "default": "./dist/background.cjs"
119
+ }
120
+ },
121
+ "./border": {
122
+ "import": {
123
+ "types": "./dist/border.d.mts",
124
+ "default": "./dist/border.mjs"
125
+ },
126
+ "require": {
127
+ "types": "./dist/border.d.cts",
128
+ "default": "./dist/border.cjs"
129
+ }
130
+ },
131
+ "./position": {
132
+ "import": {
133
+ "types": "./dist/position.d.mts",
134
+ "default": "./dist/position.mjs"
135
+ },
136
+ "require": {
137
+ "types": "./dist/position.d.cts",
138
+ "default": "./dist/position.cjs"
139
+ }
140
+ },
141
+ "./shadow": {
142
+ "import": {
143
+ "types": "./dist/shadow.d.mts",
144
+ "default": "./dist/shadow.mjs"
145
+ },
146
+ "require": {
147
+ "types": "./dist/shadow.d.cts",
148
+ "default": "./dist/shadow.cjs"
149
+ }
150
+ },
151
+ "./variant": {
152
+ "import": {
153
+ "types": "./dist/variant.d.mts",
154
+ "default": "./dist/variant.mjs"
155
+ },
156
+ "require": {
157
+ "types": "./dist/variant.d.cts",
158
+ "default": "./dist/variant.cjs"
159
+ }
160
+ },
161
+ "./css": {
162
+ "import": {
163
+ "types": "./dist/css.d.mts",
164
+ "default": "./dist/css.mjs"
165
+ },
166
+ "require": {
167
+ "types": "./dist/css.d.cts",
168
+ "default": "./dist/css.cjs"
169
+ }
170
+ },
171
+ "./theme-get": {
172
+ "import": {
173
+ "types": "./dist/theme-get.d.mts",
174
+ "default": "./dist/theme-get.mjs"
175
+ },
176
+ "require": {
177
+ "types": "./dist/theme-get.d.cts",
178
+ "default": "./dist/theme-get.cjs"
179
+ }
180
+ },
181
+ "./props": {
182
+ "import": {
183
+ "types": "./dist/props.d.mts",
184
+ "default": "./dist/props.mjs"
185
+ },
186
+ "require": {
187
+ "types": "./dist/props.d.cts",
188
+ "default": "./dist/props.cjs"
189
+ }
190
+ },
191
+ "./should-forward-prop": {
192
+ "import": {
193
+ "types": "./dist/should-forward-prop.d.mts",
194
+ "default": "./dist/should-forward-prop.mjs"
195
+ },
196
+ "require": {
197
+ "types": "./dist/should-forward-prop.d.cts",
198
+ "default": "./dist/should-forward-prop.cjs"
199
+ }
200
+ }
48
201
  },
49
202
  "imports": {
50
203
  "#presets": "./src/presets/index.ts"
51
204
  },
52
- "types": "./src/index.ts",
205
+ "types": "./dist/index.d.mts",
53
206
  "publishConfig": {
54
- "access": "public",
55
- "exports": {
56
- ".": {
57
- "import": {
58
- "types": "./dist/index.d.mts",
59
- "default": "./dist/index.mjs"
60
- },
61
- "require": {
62
- "types": "./dist/index.d.cts",
63
- "default": "./dist/index.cjs"
64
- }
65
- },
66
- "./core": {
67
- "import": {
68
- "types": "./dist/core.d.mts",
69
- "default": "./dist/core.mjs"
70
- },
71
- "require": {
72
- "types": "./dist/core.d.cts",
73
- "default": "./dist/core.cjs"
74
- }
75
- },
76
- "./space": {
77
- "import": {
78
- "types": "./dist/space.d.mts",
79
- "default": "./dist/space.mjs"
80
- },
81
- "require": {
82
- "types": "./dist/space.d.cts",
83
- "default": "./dist/space.cjs"
84
- }
85
- },
86
- "./color": {
87
- "import": {
88
- "types": "./dist/color.d.mts",
89
- "default": "./dist/color.mjs"
90
- },
91
- "require": {
92
- "types": "./dist/color.d.cts",
93
- "default": "./dist/color.cjs"
94
- }
95
- },
96
- "./layout": {
97
- "import": {
98
- "types": "./dist/layout.d.mts",
99
- "default": "./dist/layout.mjs"
100
- },
101
- "require": {
102
- "types": "./dist/layout.d.cts",
103
- "default": "./dist/layout.cjs"
104
- }
105
- },
106
- "./typography": {
107
- "import": {
108
- "types": "./dist/typography.d.mts",
109
- "default": "./dist/typography.mjs"
110
- },
111
- "require": {
112
- "types": "./dist/typography.d.cts",
113
- "default": "./dist/typography.cjs"
114
- }
115
- },
116
- "./flexbox": {
117
- "import": {
118
- "types": "./dist/flexbox.d.mts",
119
- "default": "./dist/flexbox.mjs"
120
- },
121
- "require": {
122
- "types": "./dist/flexbox.d.cts",
123
- "default": "./dist/flexbox.cjs"
124
- }
125
- },
126
- "./grid": {
127
- "import": {
128
- "types": "./dist/grid.d.mts",
129
- "default": "./dist/grid.mjs"
130
- },
131
- "require": {
132
- "types": "./dist/grid.d.cts",
133
- "default": "./dist/grid.cjs"
134
- }
135
- },
136
- "./background": {
137
- "import": {
138
- "types": "./dist/background.d.mts",
139
- "default": "./dist/background.mjs"
140
- },
141
- "require": {
142
- "types": "./dist/background.d.cts",
143
- "default": "./dist/background.cjs"
144
- }
145
- },
146
- "./border": {
147
- "import": {
148
- "types": "./dist/border.d.mts",
149
- "default": "./dist/border.mjs"
150
- },
151
- "require": {
152
- "types": "./dist/border.d.cts",
153
- "default": "./dist/border.cjs"
154
- }
155
- },
156
- "./position": {
157
- "import": {
158
- "types": "./dist/position.d.mts",
159
- "default": "./dist/position.mjs"
160
- },
161
- "require": {
162
- "types": "./dist/position.d.cts",
163
- "default": "./dist/position.cjs"
164
- }
165
- },
166
- "./shadow": {
167
- "import": {
168
- "types": "./dist/shadow.d.mts",
169
- "default": "./dist/shadow.mjs"
170
- },
171
- "require": {
172
- "types": "./dist/shadow.d.cts",
173
- "default": "./dist/shadow.cjs"
174
- }
175
- },
176
- "./variant": {
177
- "import": {
178
- "types": "./dist/variant.d.mts",
179
- "default": "./dist/variant.mjs"
180
- },
181
- "require": {
182
- "types": "./dist/variant.d.cts",
183
- "default": "./dist/variant.cjs"
184
- }
185
- },
186
- "./css": {
187
- "import": {
188
- "types": "./dist/css.d.mts",
189
- "default": "./dist/css.mjs"
190
- },
191
- "require": {
192
- "types": "./dist/css.d.cts",
193
- "default": "./dist/css.cjs"
194
- }
195
- },
196
- "./theme-get": {
197
- "import": {
198
- "types": "./dist/theme-get.d.mts",
199
- "default": "./dist/theme-get.mjs"
200
- },
201
- "require": {
202
- "types": "./dist/theme-get.d.cts",
203
- "default": "./dist/theme-get.cjs"
204
- }
205
- },
206
- "./props": {
207
- "import": {
208
- "types": "./dist/props.d.mts",
209
- "default": "./dist/props.mjs"
210
- },
211
- "require": {
212
- "types": "./dist/props.d.cts",
213
- "default": "./dist/props.cjs"
214
- }
215
- },
216
- "./should-forward-prop": {
217
- "import": {
218
- "types": "./dist/should-forward-prop.d.mts",
219
- "default": "./dist/should-forward-prop.mjs"
220
- },
221
- "require": {
222
- "types": "./dist/should-forward-prop.d.cts",
223
- "default": "./dist/should-forward-prop.cjs"
224
- }
225
- }
226
- },
227
- "main": "./dist/index.cjs",
228
- "module": "./dist/index.mjs",
229
- "types": "./dist/index.d.mts"
230
- },
231
- "scripts": {
232
- "build": "tsdown",
233
- "lint": "eslint . --max-warnings 0",
234
- "typecheck": "tsc --noEmit",
235
- "test": "vitest run",
236
- "test:coverage": "vitest run --coverage",
237
- "prepublishOnly": "pnpm build"
207
+ "access": "public"
238
208
  },
239
209
  "dependencies": {
240
210
  "csstype": "^3.1.3"
@@ -244,12 +214,21 @@
244
214
  },
245
215
  "devDependencies": {
246
216
  "@emotion/is-prop-valid": "^1.4.0",
247
- "@soroush.tech/eslint-config": "workspace:*",
248
217
  "@vitest/coverage-v8": "^4.1.9",
249
218
  "eslint": "^10.5.0",
250
219
  "globals": "^17.7.0",
251
220
  "tsdown": "^0.22.3",
252
221
  "typescript": "~6.0.3",
253
- "vitest": "^4.1.9"
254
- }
255
- }
222
+ "vitest": "^4.1.9",
223
+ "@soroush.tech/eslint-config": "0.0.0"
224
+ },
225
+ "scripts": {
226
+ "build": "tsdown",
227
+ "lint": "eslint . --max-warnings 0",
228
+ "typecheck": "tsc --noEmit",
229
+ "test": "vitest run",
230
+ "test:coverage": "vitest run --coverage"
231
+ },
232
+ "main": "./dist/index.cjs",
233
+ "module": "./dist/index.mjs"
234
+ }