@soroush.tech/styled-system 5.8.2 → 5.9.0-alpha.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 +7 -7
- package/dist/background.d.cts +2 -2
- package/dist/background.d.mts +2 -2
- package/dist/border.d.cts +2 -2
- package/dist/border.d.mts +2 -2
- package/dist/color.d.cts +2 -2
- package/dist/color.d.mts +2 -2
- package/dist/core.cjs +17 -16
- package/dist/core.d.cts +3 -2
- package/dist/core.d.mts +3 -2
- package/dist/core.mjs +15 -16
- package/dist/{css-CeNnKyGm.cjs → css-BnnO16Cw.cjs} +3 -1
- package/dist/{css-BTuRmXCo.mjs → css-CunBKyMl.mjs} +3 -1
- package/dist/css.cjs +1 -1
- package/dist/css.d.cts +2 -1
- package/dist/css.d.mts +2 -1
- package/dist/css.mjs +1 -1
- package/dist/flexbox.d.cts +2 -2
- package/dist/flexbox.d.mts +2 -2
- package/dist/grid.d.cts +2 -2
- package/dist/grid.d.mts +2 -2
- package/dist/index-0k2kzlK5.d.cts +6 -0
- package/dist/{index-lMfmNFGL.d.mts → index-BKofCDzL.d.mts} +2 -2
- package/dist/index-BReBwT6c.d.mts +6 -0
- package/dist/{index-C0SM54dQ.d.cts → index-BXP1-da3.d.mts} +4 -3
- package/dist/{index-C0SM54dQ.d.mts → index-BYkO78Xl.d.cts} +4 -3
- package/dist/index-BhbWZw53.d.mts +6 -0
- package/dist/{index-BIbimgdO.d.mts → index-Bq7teef_.d.cts} +2 -2
- package/dist/index-C-B6-_Ku.d.mts +6 -0
- package/dist/index-C9CxJ5Zn.d.cts +6 -0
- package/dist/index-CIccdXWj.d.cts +6 -0
- package/dist/index-CJT-n3Vq.d.mts +6 -0
- package/dist/index-CcorN1bQ.d.mts +6 -0
- package/dist/index-Cd_CcxMh.d.cts +6 -0
- package/dist/index-Co0JY1hd.d.cts +6 -0
- package/dist/index-D9dwDAhC.d.mts +6 -0
- package/dist/index-DP40bJIa.d.cts +6 -0
- package/dist/index-DQhcFrR9.d.mts +6 -0
- package/dist/index-DcRfFIAZ.d.mts +6 -0
- package/dist/index-Dsc6RgbZ.d.cts +6 -0
- package/dist/{index-BB5onzAO.d.cts → index-DzcXmzdT.d.cts} +2 -2
- package/dist/index-Q8q5VND1.d.cts +6 -0
- package/dist/index-UGE-V15i.d.cts +6 -0
- package/dist/index-sk97pkUE.d.mts +6 -0
- package/dist/{index-BhQrpfIN.d.cts → index-wKeENlqd.d.mts} +2 -2
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +15 -14
- package/dist/index.d.mts +15 -14
- package/dist/index.mjs +3 -2
- package/dist/layout.d.cts +2 -2
- package/dist/layout.d.mts +2 -2
- package/dist/media-B8UpEDpY.mjs +18 -0
- package/dist/media-BoIPXBPV.cjs +29 -0
- package/dist/media-np0uvO4C.d.cts +14 -0
- package/dist/media-np0uvO4C.d.mts +14 -0
- package/dist/position.d.cts +2 -2
- package/dist/position.d.mts +2 -2
- package/dist/{presets-B2nFh_Zn.cjs → presets-CCvtQotd.cjs} +1 -1
- package/dist/{presets-Dg3yjRZU.mjs → presets-CV_TIXQ4.mjs} +1 -1
- package/dist/prop-types.cjs +1 -1
- package/dist/prop-types.mjs +1 -1
- package/dist/props.cjs +1 -1
- package/dist/props.mjs +1 -1
- package/dist/shadow.d.cts +2 -2
- package/dist/shadow.d.mts +2 -2
- package/dist/should-forward-prop.cjs +1 -1
- package/dist/should-forward-prop.mjs +1 -1
- package/dist/space.d.cts +2 -2
- package/dist/space.d.mts +2 -2
- package/dist/{types-BEHYHdIq.d.cts → types-B0SNbm6V.d.cts} +8 -5
- package/dist/{types-BEHYHdIq.d.mts → types-B0SNbm6V.d.mts} +8 -5
- package/dist/typography.d.cts +2 -2
- package/dist/typography.d.mts +2 -2
- package/dist/{variant-BSwNEY5l.cjs → variant-DdSForfI.cjs} +1 -1
- package/dist/{variant-NupmzzRg.mjs → variant-DfRW-ZJe.mjs} +1 -1
- package/dist/variant.cjs +1 -1
- package/dist/variant.d.cts +2 -2
- package/dist/variant.d.mts +2 -2
- package/dist/variant.mjs +1 -1
- package/package.json +5 -5
- package/dist/index-6v6ZPLqN.d.mts +0 -6
- package/dist/index-Br4itelo.d.cts +0 -6
- package/dist/index-Brk7KoTW.d.mts +0 -6
- package/dist/index-BwOWcSgh.d.cts +0 -6
- package/dist/index-BxEj-sWN.d.mts +0 -6
- package/dist/index-C-ZUVzJ7.d.mts +0 -6
- package/dist/index-C0U26AuK.d.cts +0 -6
- package/dist/index-C4mjv3ia.d.mts +0 -6
- package/dist/index-CA8D2_fO.d.mts +0 -6
- package/dist/index-CLPj_nlH.d.mts +0 -6
- package/dist/index-CSiiNuwr.d.cts +0 -6
- package/dist/index-DFHqxqDI.d.cts +0 -6
- package/dist/index-DPZut54X.d.cts +0 -6
- package/dist/index-Dj0F79Bp.d.mts +0 -6
- package/dist/index-KOeCRVqs.d.cts +0 -6
- package/dist/index-Lx-0Fn6T.d.cts +0 -6
- package/dist/index-P5vy3lm4.d.mts +0 -6
- package/dist/index-ogIIkqhV.d.cts +0 -6
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/@soroush.tech/styled-system)
|
|
8
8
|
[](./LICENSE)
|
|
9
9
|
|
|
10
|
-
A maintained, first-class-TypeScript rewrite of [styled-system](https://github.com/jxnblk/styled-system) v5
|
|
10
|
+
A maintained, first-class-TypeScript rewrite of [styled-system](https://github.com/jxnblk/styled-system) v5 - responsive, theme-aware style props for CSS-in-JS.
|
|
11
11
|
|
|
12
12
|
It is a **drop-in replacement** for the `styled-system` runtime: the root export surface matches upstream verbatim, and the package ships its own types (replacing `@types/styled-system`).
|
|
13
13
|
|
|
@@ -19,7 +19,7 @@ It is a **drop-in replacement** for the `styled-system` runtime: the root export
|
|
|
19
19
|
- Typographic scale, and a spacing scale for `margin`, `padding` and `gap`
|
|
20
20
|
- Works with any color palette
|
|
21
21
|
- Works with most CSS-in-JS libraries, including [Emotion](https://emotion.sh) and [styled-components](https://styled-components.com)
|
|
22
|
-
- First-class TypeScript types
|
|
22
|
+
- First-class TypeScript types - theme-scale-aware props, replacing `@types/styled-system`
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
@@ -39,9 +39,9 @@ yarn add @soroush.tech/styled-system
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`@emotion/is-prop-valid` (`^1.4.0`, peer) and `prop-types` (`^15.8.1`, optional peer) are
|
|
42
|
-
each used by a single [subpath](#subpath-imports)
|
|
42
|
+
each used by a single [subpath](#subpath-imports) - `should-forward-prop` and `prop-types`
|
|
43
43
|
respectively. Install one only if you import that subpath. You bring your own CSS-in-JS
|
|
44
|
-
library (Emotion, styled-components,
|
|
44
|
+
library (Emotion, styled-components, ...); the core carries neither at runtime.
|
|
45
45
|
|
|
46
46
|
## Usage
|
|
47
47
|
|
|
@@ -119,7 +119,7 @@ import shouldForwardProp, {
|
|
|
119
119
|
|
|
120
120
|
## Drop-in via alias
|
|
121
121
|
|
|
122
|
-
Existing `styled-system` users can swap with a package-manager alias
|
|
122
|
+
Existing `styled-system` users can swap with a package-manager alias - no code changes:
|
|
123
123
|
|
|
124
124
|
```jsonc
|
|
125
125
|
"dependencies": {
|
|
@@ -127,7 +127,7 @@ Existing `styled-system` users can swap with a package-manager alias — no code
|
|
|
127
127
|
}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
The satellite `@styled-system/*` packages don't need separate aliases
|
|
130
|
+
The satellite `@styled-system/*` packages don't need separate aliases - import them as
|
|
131
131
|
subpaths off the aliased `styled-system` name, and they resolve through this package's
|
|
132
132
|
`exports`:
|
|
133
133
|
|
|
@@ -164,4 +164,4 @@ Per-version notes for every published release live in
|
|
|
164
164
|
|
|
165
165
|
## License
|
|
166
166
|
|
|
167
|
-
MIT
|
|
167
|
+
MIT - a rewrite of styled-system (© 2017-2021 Brent Jackson), see [`LICENSE`](https://github.com/soroush-tech/core/tree/main/packages/styled-system/LICENSE).
|
package/dist/background.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as background } from "./index-
|
|
2
|
-
import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-
|
|
1
|
+
import { t as background } from "./index-Q8q5VND1.cjs";
|
|
2
|
+
import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-B0SNbm6V.cjs";
|
|
3
3
|
export { type BackgroundImageProps, type BackgroundPositionProps, type BackgroundProps, type BackgroundRepeatProps, type BackgroundSizeProps, background, background as default };
|
package/dist/background.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as background } from "./index-
|
|
2
|
-
import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-
|
|
1
|
+
import { t as background } from "./index-C-B6-_Ku.mjs";
|
|
2
|
+
import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-B0SNbm6V.mjs";
|
|
3
3
|
export { type BackgroundImageProps, type BackgroundPositionProps, type BackgroundProps, type BackgroundRepeatProps, type BackgroundSizeProps, background, background as default };
|
package/dist/border.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as BorderStyleProps, d as BorderBottomProps, f as BorderColorProps, g as BorderRightProps, h as BorderRadiusProps, m as BorderProps, p as BorderLeftProps, v as BorderTopProps, y as BorderWidthProps } from "./types-
|
|
2
|
-
import { t as border } from "./index-
|
|
1
|
+
import { _ as BorderStyleProps, d as BorderBottomProps, f as BorderColorProps, g as BorderRightProps, h as BorderRadiusProps, m as BorderProps, p as BorderLeftProps, v as BorderTopProps, y as BorderWidthProps } from "./types-B0SNbm6V.cjs";
|
|
2
|
+
import { t as border } from "./index-C9CxJ5Zn.cjs";
|
|
3
3
|
export { type BorderBottomProps, type BorderColorProps, type BorderLeftProps, type BorderProps, type BorderRadiusProps, type BorderRightProps, type BorderStyleProps, type BorderTopProps, type BorderWidthProps, border, border as default };
|
package/dist/border.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as BorderStyleProps, d as BorderBottomProps, f as BorderColorProps, g as BorderRightProps, h as BorderRadiusProps, m as BorderProps, p as BorderLeftProps, v as BorderTopProps, y as BorderWidthProps } from "./types-
|
|
2
|
-
import { t as border } from "./index-
|
|
1
|
+
import { _ as BorderStyleProps, d as BorderBottomProps, f as BorderColorProps, g as BorderRightProps, h as BorderRadiusProps, m as BorderProps, p as BorderLeftProps, v as BorderTopProps, y as BorderWidthProps } from "./types-B0SNbm6V.mjs";
|
|
2
|
+
import { t as border } from "./index-D9dwDAhC.mjs";
|
|
3
3
|
export { type BorderBottomProps, type BorderColorProps, type BorderLeftProps, type BorderProps, type BorderRadiusProps, type BorderRightProps, type BorderStyleProps, type BorderTopProps, type BorderWidthProps, border, border as default };
|
package/dist/color.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as ColorProps, Ot as TextColorProps, a as BackgroundColorProps, ft as OpacityProps } from "./types-
|
|
2
|
-
import { t as color } from "./index-
|
|
1
|
+
import { C as ColorProps, Ot as TextColorProps, a as BackgroundColorProps, ft as OpacityProps } from "./types-B0SNbm6V.cjs";
|
|
2
|
+
import { t as color } from "./index-Cd_CcxMh.cjs";
|
|
3
3
|
export { type BackgroundColorProps, type ColorProps, type OpacityProps, type TextColorProps, color, color as default };
|
package/dist/color.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as ColorProps, Ot as TextColorProps, a as BackgroundColorProps, ft as OpacityProps } from "./types-
|
|
2
|
-
import { t as color } from "./index-
|
|
1
|
+
import { C as ColorProps, Ot as TextColorProps, a as BackgroundColorProps, ft as OpacityProps } from "./types-B0SNbm6V.mjs";
|
|
2
|
+
import { t as color } from "./index-CJT-n3Vq.mjs";
|
|
3
3
|
export { type BackgroundColorProps, type ColorProps, type OpacityProps, type TextColorProps, color, color as default };
|
package/dist/core.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_media = require("./media-BoIPXBPV.cjs");
|
|
2
3
|
//#region src/core/core.ts
|
|
3
4
|
const merge = (a, b) => {
|
|
4
5
|
const result = {
|
|
@@ -11,14 +12,10 @@ const merge = (a, b) => {
|
|
|
11
12
|
}
|
|
12
13
|
return result;
|
|
13
14
|
};
|
|
14
|
-
const sort = (obj) => {
|
|
15
|
+
const sort = (obj, media) => {
|
|
15
16
|
const next = {};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
sensitivity: "base"
|
|
19
|
-
})).forEach((key) => {
|
|
20
|
-
next[key] = obj[key];
|
|
21
|
-
});
|
|
17
|
+
for (const key in obj) if (!media.includes(key)) next[key] = obj[key];
|
|
18
|
+
for (const key of media) if (key && key in obj) next[key] = obj[key];
|
|
22
19
|
return next;
|
|
23
20
|
};
|
|
24
21
|
const defaults = { breakpoints: [
|
|
@@ -26,7 +23,6 @@ const defaults = { breakpoints: [
|
|
|
26
23
|
52,
|
|
27
24
|
64
|
|
28
25
|
].map((n) => n + "em") };
|
|
29
|
-
const createMediaQuery = (n) => `@media screen and (min-width: ${n})`;
|
|
30
26
|
const getValue = (n, scale) => get(scale, n, n);
|
|
31
27
|
const get = (obj, key, def, p = 0, undef) => {
|
|
32
28
|
const path = typeof key === "string" ? key.split(".") : [key];
|
|
@@ -50,11 +46,11 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
|
|
|
50
46
|
const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
|
|
51
47
|
const styles = {};
|
|
52
48
|
for (const key in raw) {
|
|
53
|
-
const breakpoint = breakpoints[key];
|
|
49
|
+
const breakpoint = Object.hasOwn(breakpoints, key) ? breakpoints[key] : void 0;
|
|
54
50
|
const value = raw[key];
|
|
55
51
|
const style = sx(value, scale, props);
|
|
56
|
-
if (breakpoint) {
|
|
57
|
-
const media = createMediaQuery(breakpoint);
|
|
52
|
+
if (breakpoint !== void 0) {
|
|
53
|
+
const media = require_media.createMediaQuery(breakpoint);
|
|
58
54
|
Object.assign(styles, { [media]: {
|
|
59
55
|
...styles[media],
|
|
60
56
|
...style
|
|
@@ -64,7 +60,7 @@ const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
|
|
|
64
60
|
return styles;
|
|
65
61
|
};
|
|
66
62
|
const createParser = (config) => {
|
|
67
|
-
const cache = {};
|
|
63
|
+
const cache = { media: [] };
|
|
68
64
|
const parse = ((props) => {
|
|
69
65
|
let styles = {};
|
|
70
66
|
let shouldSort = false;
|
|
@@ -75,21 +71,24 @@ const createParser = (config) => {
|
|
|
75
71
|
const raw = props[key];
|
|
76
72
|
const scale = get(props.theme, sx.scale, sx.defaults);
|
|
77
73
|
if (typeof raw === "object") {
|
|
78
|
-
|
|
74
|
+
const breakpoints = get(props.theme, "breakpoints", defaults.breakpoints);
|
|
75
|
+
if (isCacheDisabled || cache.breakpoints !== breakpoints) {
|
|
76
|
+
cache.breakpoints = breakpoints;
|
|
77
|
+
cache.media = [null, ...Object.values(breakpoints).map(require_media.createMediaQuery)];
|
|
78
|
+
}
|
|
79
79
|
if (Array.isArray(raw)) {
|
|
80
|
-
cache.media = !isCacheDisabled && cache.media || [null, ...cache.breakpoints.map(createMediaQuery)];
|
|
81
80
|
styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
|
|
82
81
|
continue;
|
|
83
82
|
}
|
|
84
83
|
if (raw !== null) {
|
|
85
|
-
styles = merge(styles, parseResponsiveObject(
|
|
84
|
+
styles = merge(styles, parseResponsiveObject(breakpoints, sx, scale, raw, props));
|
|
86
85
|
shouldSort = true;
|
|
87
86
|
}
|
|
88
87
|
continue;
|
|
89
88
|
}
|
|
90
89
|
Object.assign(styles, sx(raw, scale, props));
|
|
91
90
|
}
|
|
92
|
-
if (shouldSort) styles = sort(styles);
|
|
91
|
+
if (shouldSort) styles = sort(styles, cache.media);
|
|
93
92
|
return styles;
|
|
94
93
|
});
|
|
95
94
|
parse.config = config;
|
|
@@ -144,7 +143,9 @@ const compose = (...parsers) => {
|
|
|
144
143
|
return createParser(config);
|
|
145
144
|
};
|
|
146
145
|
//#endregion
|
|
146
|
+
exports.breakpointQueries = require_media.breakpointQueries;
|
|
147
147
|
exports.compose = compose;
|
|
148
|
+
exports.createMediaQuery = require_media.createMediaQuery;
|
|
148
149
|
exports.createParser = createParser;
|
|
149
150
|
exports.createStyleFunction = createStyleFunction;
|
|
150
151
|
exports.get = get;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as breakpointQueries, r as createMediaQuery, t as Breakpoints } from "./media-np0uvO4C.cjs";
|
|
2
|
+
import { _ as merge, a as Parser, c as StyleFn, d as Theme, f as Transform, g as get, h as createStyleFunction, i as ConfigStyle, l as StyleObject, m as createParser, n as Config, o as ParserConfig, p as compose, r as ConfigFunction, s as Props, t as CSSObject, u as SystemConfig, v as styleFn, y as system } from "./index-BYkO78Xl.cjs";
|
|
3
|
+
export { Breakpoints, CSSObject, Config, ConfigFunction, ConfigStyle, Parser, ParserConfig, Props, StyleFn, StyleObject, SystemConfig, Theme, Transform, breakpointQueries, compose, createMediaQuery, createParser, createStyleFunction, get, merge, styleFn, system };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as breakpointQueries, r as createMediaQuery, t as Breakpoints } from "./media-np0uvO4C.mjs";
|
|
2
|
+
import { _ as merge, a as Parser, c as StyleFn, d as Theme, f as Transform, g as get, h as createStyleFunction, i as ConfigStyle, l as StyleObject, m as createParser, n as Config, o as ParserConfig, p as compose, r as ConfigFunction, s as Props, t as CSSObject, u as SystemConfig, v as styleFn, y as system } from "./index-BXP1-da3.mjs";
|
|
3
|
+
export { Breakpoints, CSSObject, Config, ConfigFunction, ConfigStyle, Parser, ParserConfig, Props, StyleFn, StyleObject, SystemConfig, Theme, Transform, breakpointQueries, compose, createMediaQuery, createParser, createStyleFunction, get, merge, styleFn, system };
|
package/dist/core.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as createMediaQuery, t as breakpointQueries } from "./media-B8UpEDpY.mjs";
|
|
1
2
|
//#region src/core/core.ts
|
|
2
3
|
const merge = (a, b) => {
|
|
3
4
|
const result = {
|
|
@@ -10,14 +11,10 @@ const merge = (a, b) => {
|
|
|
10
11
|
}
|
|
11
12
|
return result;
|
|
12
13
|
};
|
|
13
|
-
const sort = (obj) => {
|
|
14
|
+
const sort = (obj, media) => {
|
|
14
15
|
const next = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sensitivity: "base"
|
|
18
|
-
})).forEach((key) => {
|
|
19
|
-
next[key] = obj[key];
|
|
20
|
-
});
|
|
16
|
+
for (const key in obj) if (!media.includes(key)) next[key] = obj[key];
|
|
17
|
+
for (const key of media) if (key && key in obj) next[key] = obj[key];
|
|
21
18
|
return next;
|
|
22
19
|
};
|
|
23
20
|
const defaults = { breakpoints: [
|
|
@@ -25,7 +22,6 @@ const defaults = { breakpoints: [
|
|
|
25
22
|
52,
|
|
26
23
|
64
|
|
27
24
|
].map((n) => n + "em") };
|
|
28
|
-
const createMediaQuery = (n) => `@media screen and (min-width: ${n})`;
|
|
29
25
|
const getValue = (n, scale) => get(scale, n, n);
|
|
30
26
|
const get = (obj, key, def, p = 0, undef) => {
|
|
31
27
|
const path = typeof key === "string" ? key.split(".") : [key];
|
|
@@ -49,10 +45,10 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
|
|
|
49
45
|
const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
|
|
50
46
|
const styles = {};
|
|
51
47
|
for (const key in raw) {
|
|
52
|
-
const breakpoint = breakpoints[key];
|
|
48
|
+
const breakpoint = Object.hasOwn(breakpoints, key) ? breakpoints[key] : void 0;
|
|
53
49
|
const value = raw[key];
|
|
54
50
|
const style = sx(value, scale, props);
|
|
55
|
-
if (breakpoint) {
|
|
51
|
+
if (breakpoint !== void 0) {
|
|
56
52
|
const media = createMediaQuery(breakpoint);
|
|
57
53
|
Object.assign(styles, { [media]: {
|
|
58
54
|
...styles[media],
|
|
@@ -63,7 +59,7 @@ const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
|
|
|
63
59
|
return styles;
|
|
64
60
|
};
|
|
65
61
|
const createParser = (config) => {
|
|
66
|
-
const cache = {};
|
|
62
|
+
const cache = { media: [] };
|
|
67
63
|
const parse = ((props) => {
|
|
68
64
|
let styles = {};
|
|
69
65
|
let shouldSort = false;
|
|
@@ -74,21 +70,24 @@ const createParser = (config) => {
|
|
|
74
70
|
const raw = props[key];
|
|
75
71
|
const scale = get(props.theme, sx.scale, sx.defaults);
|
|
76
72
|
if (typeof raw === "object") {
|
|
77
|
-
|
|
73
|
+
const breakpoints = get(props.theme, "breakpoints", defaults.breakpoints);
|
|
74
|
+
if (isCacheDisabled || cache.breakpoints !== breakpoints) {
|
|
75
|
+
cache.breakpoints = breakpoints;
|
|
76
|
+
cache.media = [null, ...Object.values(breakpoints).map(createMediaQuery)];
|
|
77
|
+
}
|
|
78
78
|
if (Array.isArray(raw)) {
|
|
79
|
-
cache.media = !isCacheDisabled && cache.media || [null, ...cache.breakpoints.map(createMediaQuery)];
|
|
80
79
|
styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
|
|
81
80
|
continue;
|
|
82
81
|
}
|
|
83
82
|
if (raw !== null) {
|
|
84
|
-
styles = merge(styles, parseResponsiveObject(
|
|
83
|
+
styles = merge(styles, parseResponsiveObject(breakpoints, sx, scale, raw, props));
|
|
85
84
|
shouldSort = true;
|
|
86
85
|
}
|
|
87
86
|
continue;
|
|
88
87
|
}
|
|
89
88
|
Object.assign(styles, sx(raw, scale, props));
|
|
90
89
|
}
|
|
91
|
-
if (shouldSort) styles = sort(styles);
|
|
90
|
+
if (shouldSort) styles = sort(styles, cache.media);
|
|
92
91
|
return styles;
|
|
93
92
|
});
|
|
94
93
|
parse.config = config;
|
|
@@ -143,4 +142,4 @@ const compose = (...parsers) => {
|
|
|
143
142
|
return createParser(config);
|
|
144
143
|
};
|
|
145
144
|
//#endregion
|
|
146
|
-
export { compose, createParser, createStyleFunction, get, merge, system };
|
|
145
|
+
export { breakpointQueries, compose, createMediaQuery, createParser, createStyleFunction, get, merge, system };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_media = require("./media-BoIPXBPV.cjs");
|
|
1
2
|
//#region src/css/css.ts
|
|
2
3
|
const get = (obj, key, def, p = 0, undef) => {
|
|
3
4
|
const path = typeof key === "string" ? key.split(".") : [key];
|
|
@@ -156,7 +157,8 @@ const transforms = [
|
|
|
156
157
|
}), {});
|
|
157
158
|
const responsive = (styles) => (theme) => {
|
|
158
159
|
const next = {};
|
|
159
|
-
const
|
|
160
|
+
const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
|
|
161
|
+
const mediaQueries = [null, ...Object.values(breakpoints).map(require_media.createMediaQuery)];
|
|
160
162
|
for (const key in styles) {
|
|
161
163
|
const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
|
|
162
164
|
if (value == null) continue;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as createMediaQuery } from "./media-B8UpEDpY.mjs";
|
|
1
2
|
//#region src/css/css.ts
|
|
2
3
|
const get = (obj, key, def, p = 0, undef) => {
|
|
3
4
|
const path = typeof key === "string" ? key.split(".") : [key];
|
|
@@ -156,7 +157,8 @@ const transforms = [
|
|
|
156
157
|
}), {});
|
|
157
158
|
const responsive = (styles) => (theme) => {
|
|
158
159
|
const next = {};
|
|
159
|
-
const
|
|
160
|
+
const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
|
|
161
|
+
const mediaQueries = [null, ...Object.values(breakpoints).map(createMediaQuery)];
|
|
160
162
|
for (const key in styles) {
|
|
161
163
|
const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
|
|
162
164
|
if (value == null) continue;
|
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-
|
|
5
|
+
const require_css = require("./css-BnnO16Cw.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.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { t as Breakpoints } from "./media-np0uvO4C.cjs";
|
|
1
2
|
//#region src/css/css.d.ts
|
|
2
3
|
type CSSObject = Record<string, unknown>;
|
|
3
4
|
interface CssTheme {
|
|
4
|
-
breakpoints?:
|
|
5
|
+
breakpoints?: Breakpoints;
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|
|
7
8
|
type CssArg = CSSObject | ((theme: CssTheme) => CSSObject);
|
package/dist/css.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { t as Breakpoints } from "./media-np0uvO4C.mjs";
|
|
1
2
|
//#region src/css/css.d.ts
|
|
2
3
|
type CSSObject = Record<string, unknown>;
|
|
3
4
|
interface CssTheme {
|
|
4
|
-
breakpoints?:
|
|
5
|
+
breakpoints?: Breakpoints;
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|
|
7
8
|
type CssArg = CSSObject | ((theme: CssTheme) => CSSObject);
|
package/dist/css.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as get, r as responsive, t as css } from "./css-
|
|
1
|
+
import { n as get, r as responsive, t as css } from "./css-CunBKyMl.mjs";
|
|
2
2
|
export { css, css as default, get, responsive };
|
package/dist/flexbox.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as JustifyContentProps, A as FlexProps, D as FlexBasisProps, M as FlexWrapProps, N as FlexboxProps, O as FlexDirectionProps, et as JustifyItemsProps, j as FlexShrinkProps, k as FlexGrowProps, n as AlignItemsProps, pt as OrderProps, r as AlignSelfProps, t as AlignContentProps, tt as JustifySelfProps } from "./types-
|
|
2
|
-
import { t as flexbox } from "./index-
|
|
1
|
+
import { $ as JustifyContentProps, A as FlexProps, D as FlexBasisProps, M as FlexWrapProps, N as FlexboxProps, O as FlexDirectionProps, et as JustifyItemsProps, j as FlexShrinkProps, k as FlexGrowProps, n as AlignItemsProps, pt as OrderProps, r as AlignSelfProps, t as AlignContentProps, tt as JustifySelfProps } from "./types-B0SNbm6V.cjs";
|
|
2
|
+
import { t as flexbox } from "./index-CIccdXWj.cjs";
|
|
3
3
|
export { type AlignContentProps, type AlignItemsProps, type AlignSelfProps, type FlexBasisProps, type FlexDirectionProps, type FlexGrowProps, type FlexProps, type FlexShrinkProps, type FlexWrapProps, type FlexboxProps, type JustifyContentProps, type JustifyItemsProps, type JustifySelfProps, type OrderProps, flexbox as default, flexbox };
|
package/dist/flexbox.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as JustifyContentProps, A as FlexProps, D as FlexBasisProps, M as FlexWrapProps, N as FlexboxProps, O as FlexDirectionProps, et as JustifyItemsProps, j as FlexShrinkProps, k as FlexGrowProps, n as AlignItemsProps, pt as OrderProps, r as AlignSelfProps, t as AlignContentProps, tt as JustifySelfProps } from "./types-
|
|
2
|
-
import { t as flexbox } from "./index-
|
|
1
|
+
import { $ as JustifyContentProps, A as FlexProps, D as FlexBasisProps, M as FlexWrapProps, N as FlexboxProps, O as FlexDirectionProps, et as JustifyItemsProps, j as FlexShrinkProps, k as FlexGrowProps, n as AlignItemsProps, pt as OrderProps, r as AlignSelfProps, t as AlignContentProps, tt as JustifySelfProps } from "./types-B0SNbm6V.mjs";
|
|
2
|
+
import { t as flexbox } from "./index-DcRfFIAZ.mjs";
|
|
3
3
|
export { type AlignContentProps, type AlignItemsProps, type AlignSelfProps, type FlexBasisProps, type FlexDirectionProps, type FlexGrowProps, type FlexProps, type FlexShrinkProps, type FlexWrapProps, type FlexboxProps, type JustifyContentProps, type JustifyItemsProps, type JustifySelfProps, type OrderProps, flexbox as default, flexbox };
|
package/dist/grid.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as GridAutoColumnsProps, G as GridGapProps, H as GridAutoRowsProps, J as GridRowProps, K as GridProps, U as GridColumnGapProps, V as GridAutoFlowProps, W as GridColumnProps, X as GridTemplateColumnsProps, Y as GridTemplateAreasProps, Z as GridTemplateRowsProps, q as GridRowGapProps, z as GridAreaProps } from "./types-
|
|
2
|
-
import { t as grid } from "./index-
|
|
1
|
+
import { B as GridAutoColumnsProps, G as GridGapProps, H as GridAutoRowsProps, J as GridRowProps, K as GridProps, U as GridColumnGapProps, V as GridAutoFlowProps, W as GridColumnProps, X as GridTemplateColumnsProps, Y as GridTemplateAreasProps, Z as GridTemplateRowsProps, q as GridRowGapProps, z as GridAreaProps } from "./types-B0SNbm6V.cjs";
|
|
2
|
+
import { t as grid } from "./index-0k2kzlK5.cjs";
|
|
3
3
|
export { type GridAreaProps, type GridAutoColumnsProps, type GridAutoFlowProps, type GridAutoRowsProps, type GridColumnGapProps, type GridColumnProps, type GridGapProps, type GridProps, type GridRowGapProps, type GridRowProps, type GridTemplateAreasProps, type GridTemplateColumnsProps, type GridTemplateRowsProps, grid as default, grid };
|
package/dist/grid.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as GridAutoColumnsProps, G as GridGapProps, H as GridAutoRowsProps, J as GridRowProps, K as GridProps, U as GridColumnGapProps, V as GridAutoFlowProps, W as GridColumnProps, X as GridTemplateColumnsProps, Y as GridTemplateAreasProps, Z as GridTemplateRowsProps, q as GridRowGapProps, z as GridAreaProps } from "./types-
|
|
2
|
-
import { t as grid } from "./index-
|
|
1
|
+
import { B as GridAutoColumnsProps, G as GridGapProps, H as GridAutoRowsProps, J as GridRowProps, K as GridProps, U as GridColumnGapProps, V as GridAutoFlowProps, W as GridColumnProps, X as GridTemplateColumnsProps, Y as GridTemplateAreasProps, Z as GridTemplateRowsProps, q as GridRowGapProps, z as GridAreaProps } from "./types-B0SNbm6V.mjs";
|
|
2
|
+
import { t as grid } from "./index-DQhcFrR9.mjs";
|
|
3
3
|
export { type GridAreaProps, type GridAutoColumnsProps, type GridAutoFlowProps, type GridAutoRowsProps, type GridColumnGapProps, type GridColumnProps, type GridGapProps, type GridProps, type GridRowGapProps, type GridRowProps, type GridTemplateAreasProps, type GridTemplateColumnsProps, type GridTemplateRowsProps, grid as default, grid };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as Breakpoints } from "./media-np0uvO4C.mjs";
|
|
1
2
|
import * as CSS from "csstype";
|
|
2
3
|
//#region src/core/core.d.ts
|
|
3
4
|
type StyleObject = Record<string, any>;
|
|
@@ -12,7 +13,7 @@ interface CSSObject extends CSS.Properties<CSSLength>, CSS.PropertiesHyphen<CSSL
|
|
|
12
13
|
[selectorOrAtRule: string]: CSSObject | string | number | undefined;
|
|
13
14
|
}
|
|
14
15
|
interface Theme {
|
|
15
|
-
breakpoints?:
|
|
16
|
+
breakpoints?: Breakpoints;
|
|
16
17
|
disableStyledSystemCache?: boolean;
|
|
17
18
|
[key: string]: any;
|
|
18
19
|
}
|
|
@@ -39,8 +40,8 @@ type styleFn = Parser;
|
|
|
39
40
|
type Config = SystemConfig;
|
|
40
41
|
type ConfigFunction = StyleFn;
|
|
41
42
|
interface ParserCache {
|
|
42
|
-
breakpoints?:
|
|
43
|
-
media
|
|
43
|
+
breakpoints?: Breakpoints;
|
|
44
|
+
media: (string | null)[];
|
|
44
45
|
}
|
|
45
46
|
interface Parser {
|
|
46
47
|
(...args: any[]): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as Breakpoints } from "./media-np0uvO4C.cjs";
|
|
1
2
|
import * as CSS from "csstype";
|
|
2
3
|
//#region src/core/core.d.ts
|
|
3
4
|
type StyleObject = Record<string, any>;
|
|
@@ -12,7 +13,7 @@ interface CSSObject extends CSS.Properties<CSSLength>, CSS.PropertiesHyphen<CSSL
|
|
|
12
13
|
[selectorOrAtRule: string]: CSSObject | string | number | undefined;
|
|
13
14
|
}
|
|
14
15
|
interface Theme {
|
|
15
|
-
breakpoints?:
|
|
16
|
+
breakpoints?: Breakpoints;
|
|
16
17
|
disableStyledSystemCache?: boolean;
|
|
17
18
|
[key: string]: any;
|
|
18
19
|
}
|
|
@@ -39,8 +40,8 @@ type styleFn = Parser;
|
|
|
39
40
|
type Config = SystemConfig;
|
|
40
41
|
type ConfigFunction = StyleFn;
|
|
41
42
|
interface ParserCache {
|
|
42
|
-
breakpoints?:
|
|
43
|
-
media
|
|
43
|
+
breakpoints?: Breakpoints;
|
|
44
|
+
media: (string | null)[];
|
|
44
45
|
}
|
|
45
46
|
interface Parser {
|
|
46
47
|
(...args: any[]): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Parser } from "./index-
|
|
2
|
-
import "./types-
|
|
1
|
+
import { a as Parser } from "./index-BYkO78Xl.cjs";
|
|
2
|
+
import "./types-B0SNbm6V.cjs";
|
|
3
3
|
//#region src/space/space.d.ts
|
|
4
4
|
declare const margin: Parser;
|
|
5
5
|
declare const padding: Parser;
|