@soroush.tech/styled-system 5.8.3 → 6.0.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.
Files changed (107) hide show
  1. package/dist/background.d.cts +2 -2
  2. package/dist/background.d.mts +2 -2
  3. package/dist/border.d.cts +2 -2
  4. package/dist/border.d.mts +2 -2
  5. package/dist/color.d.cts +2 -2
  6. package/dist/color.d.mts +2 -2
  7. package/dist/core.cjs +28 -24
  8. package/dist/core.d.cts +3 -2
  9. package/dist/core.d.mts +3 -2
  10. package/dist/core.mjs +23 -25
  11. package/dist/{css-BTuRmXCo.mjs → css-Ba4jdXOq.mjs} +27 -17
  12. package/dist/{css-CeNnKyGm.cjs → css-D1zAlDVz.cjs} +27 -17
  13. package/dist/css.cjs +1 -1
  14. package/dist/css.d.cts +2 -1
  15. package/dist/css.d.mts +2 -1
  16. package/dist/css.mjs +1 -1
  17. package/dist/flexbox.d.cts +2 -2
  18. package/dist/flexbox.d.mts +2 -2
  19. package/dist/grid-BlMUPDJM.cjs +156 -0
  20. package/dist/grid-CYjL4-gb.mjs +126 -0
  21. package/dist/grid.cjs +5 -1
  22. package/dist/grid.d.cts +3 -3
  23. package/dist/grid.d.mts +3 -3
  24. package/dist/grid.mjs +2 -2
  25. package/dist/index-90_abc05.d.mts +6 -0
  26. package/dist/{index-6cAxfKIl.d.mts → index-BQPI7z-B.d.mts} +2 -2
  27. package/dist/index-BmyL5qR7.d.cts +6 -0
  28. package/dist/index-Bwpwvg1h.d.cts +6 -0
  29. package/dist/index-Bxh1FNcS.d.cts +6 -0
  30. package/dist/index-ByDfI1go.d.cts +6 -0
  31. package/dist/index-C1IdMVtQ.d.mts +6 -0
  32. package/dist/index-CQWZd4iQ.d.mts +6 -0
  33. package/dist/index-CQyvhO-h.d.cts +6 -0
  34. package/dist/index-CXK27dY_.d.cts +42 -0
  35. package/dist/{index-O6xVfQo3.d.cts → index-CgJzEbXW.d.cts} +2 -2
  36. package/dist/{index-DbknCBOx.d.mts → index-ClbGlQxq.d.mts} +2 -2
  37. package/dist/{index-bHspW0eP.d.cts → index-Csbxj8Yo.d.cts} +2 -2
  38. package/dist/index-D1mRMWDm.d.cts +6 -0
  39. package/dist/index-D2v_oJEm.d.cts +6 -0
  40. package/dist/index-D5xp7RWT.d.cts +6 -0
  41. package/dist/index-D7IZ8-Zq.d.mts +42 -0
  42. package/dist/index-DKz4zEeT.d.mts +6 -0
  43. package/dist/{index-C0SM54dQ.d.cts → index-IulNhyDt.d.mts} +4 -3
  44. package/dist/index-MbcUN6uf.d.mts +6 -0
  45. package/dist/index-aRomguCQ.d.mts +6 -0
  46. package/dist/{index-C0SM54dQ.d.mts → index-iVqAMF2L.d.cts} +4 -3
  47. package/dist/index-nfjmLzHF.d.mts +6 -0
  48. package/dist/index-pzogdlkS.d.mts +6 -0
  49. package/dist/index.cjs +14 -3
  50. package/dist/index.d.cts +15 -14
  51. package/dist/index.d.mts +15 -14
  52. package/dist/index.mjs +5 -4
  53. package/dist/{layout-kqQ2OsL5.cjs → layout-D3pG7vBp.cjs} +3 -1
  54. package/dist/{layout-lG3i5mWZ.mjs → layout-DF83ooFn.mjs} +3 -1
  55. package/dist/layout.cjs +1 -1
  56. package/dist/layout.d.cts +3 -3
  57. package/dist/layout.d.mts +3 -3
  58. package/dist/layout.mjs +1 -1
  59. package/dist/media-Bho3l7WK.mjs +85 -0
  60. package/dist/media-CfYDomHt.d.cts +54 -0
  61. package/dist/media-CfYDomHt.d.mts +54 -0
  62. package/dist/media-DSJdRy_k.cjs +120 -0
  63. package/dist/position.d.cts +2 -2
  64. package/dist/position.d.mts +2 -2
  65. package/dist/{presets-Dg3yjRZU.mjs → presets-DsxPfpSE.mjs} +4 -4
  66. package/dist/{presets-B2nFh_Zn.cjs → presets-KURYP1_7.cjs} +4 -4
  67. package/dist/prop-types.cjs +3 -3
  68. package/dist/prop-types.mjs +3 -3
  69. package/dist/props.cjs +1 -1
  70. package/dist/props.mjs +1 -1
  71. package/dist/shadow.d.cts +2 -2
  72. package/dist/shadow.d.mts +2 -2
  73. package/dist/should-forward-prop.cjs +1 -1
  74. package/dist/should-forward-prop.mjs +1 -1
  75. package/dist/space.d.cts +2 -2
  76. package/dist/space.d.mts +2 -2
  77. package/dist/{types-B52XAdkx.d.cts → types-Cv5WjcVA.d.cts} +36 -4
  78. package/dist/{types-B52XAdkx.d.mts → types-Cv5WjcVA.d.mts} +36 -4
  79. package/dist/typography.d.cts +2 -2
  80. package/dist/typography.d.mts +2 -2
  81. package/dist/{variant-BSwNEY5l.cjs → variant-BSPTyRcQ.cjs} +1 -1
  82. package/dist/{variant-NupmzzRg.mjs → variant-D1u5rSqm.mjs} +1 -1
  83. package/dist/variant.cjs +1 -1
  84. package/dist/variant.d.cts +2 -2
  85. package/dist/variant.d.mts +2 -2
  86. package/dist/variant.mjs +1 -1
  87. package/package.json +4 -4
  88. package/dist/grid-Bpk-QjhF.mjs +0 -41
  89. package/dist/grid-CpvRIng4.cjs +0 -47
  90. package/dist/index-B89zA95f.d.mts +0 -6
  91. package/dist/index-BBuQfHYC.d.cts +0 -6
  92. package/dist/index-BNnm8JPL.d.mts +0 -6
  93. package/dist/index-B_swWveU.d.cts +0 -6
  94. package/dist/index-Bqj29Szo.d.mts +0 -6
  95. package/dist/index-C-8kLZ_X.d.mts +0 -6
  96. package/dist/index-ClSRfFkX.d.cts +0 -6
  97. package/dist/index-CpDyBw8z.d.cts +0 -6
  98. package/dist/index-D11y4gdv.d.mts +0 -6
  99. package/dist/index-DLQzYvfH.d.mts +0 -6
  100. package/dist/index-DOmnNWoA.d.cts +0 -6
  101. package/dist/index-Daclwf93.d.cts +0 -6
  102. package/dist/index-DdlTo1c6.d.mts +0 -6
  103. package/dist/index-DluQIAXz.d.cts +0 -6
  104. package/dist/index-DuI1XGHT.d.mts +0 -6
  105. package/dist/index-NT55TmXe.d.cts +0 -6
  106. package/dist/index-RXhfbqjT.d.cts +0 -6
  107. package/dist/index-yC71Yo0d.d.mts +0 -6
@@ -1,3 +1,3 @@
1
- import { t as background } from "./index-BBuQfHYC.cjs";
2
- import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-B52XAdkx.cjs";
1
+ import { t as background } from "./index-Bwpwvg1h.cjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cv5WjcVA.cjs";
3
3
  export { type BackgroundImageProps, type BackgroundPositionProps, type BackgroundProps, type BackgroundRepeatProps, type BackgroundSizeProps, background, background as default };
@@ -1,3 +1,3 @@
1
- import { t as background } from "./index-yC71Yo0d.mjs";
2
- import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-B52XAdkx.mjs";
1
+ import { t as background } from "./index-DKz4zEeT.mjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cv5WjcVA.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-B52XAdkx.cjs";
2
- import { t as border } from "./index-Daclwf93.cjs";
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-Cv5WjcVA.cjs";
2
+ import { t as border } from "./index-D5xp7RWT.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-B52XAdkx.mjs";
2
- import { t as border } from "./index-DdlTo1c6.mjs";
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-Cv5WjcVA.mjs";
2
+ import { t as border } from "./index-CQWZd4iQ.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-B52XAdkx.cjs";
2
- import { t as color } from "./index-RXhfbqjT.cjs";
1
+ import { Mt as TextColorProps, a as BackgroundColorProps, ht as OpacityProps, w as ColorProps } from "./types-Cv5WjcVA.cjs";
2
+ import { t as color } from "./index-ByDfI1go.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-B52XAdkx.mjs";
2
- import { t as color } from "./index-BNnm8JPL.mjs";
1
+ import { Mt as TextColorProps, a as BackgroundColorProps, ht as OpacityProps, w as ColorProps } from "./types-Cv5WjcVA.mjs";
2
+ import { t as color } from "./index-90_abc05.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-DSJdRy_k.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, order) => {
15
16
  const next = {};
16
- Object.keys(obj).sort((a, b) => a.localeCompare(b, void 0, {
17
- numeric: true,
18
- sensitivity: "base"
19
- })).forEach((key) => {
20
- next[key] = obj[key];
21
- });
17
+ for (const key in obj) if (!order.includes(key)) next[key] = obj[key];
18
+ for (const key of order) if (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];
@@ -47,19 +43,16 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
47
43
  });
48
44
  return styles;
49
45
  };
50
- const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
46
+ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
51
47
  const styles = {};
52
48
  for (const key in raw) {
53
- const breakpoint = breakpoints[key];
54
- const value = raw[key];
55
- const style = sx(value, scale, props);
56
- if (breakpoint) {
57
- const media = createMediaQuery(breakpoint);
58
- Object.assign(styles, { [media]: {
59
- ...styles[media],
60
- ...style
61
- } });
62
- } else Object.assign(styles, style);
49
+ const media = keyed.get(key);
50
+ const style = sx(raw[key], scale, props);
51
+ if (media) Object.assign(styles, { [media]: {
52
+ ...styles[media],
53
+ ...style
54
+ } });
55
+ else Object.assign(styles, style);
63
56
  }
64
57
  return styles;
65
58
  };
@@ -75,21 +68,26 @@ const createParser = (config) => {
75
68
  const raw = props[key];
76
69
  const scale = get(props.theme, sx.scale, sx.defaults);
77
70
  if (typeof raw === "object") {
78
- cache.breakpoints = !isCacheDisabled && cache.breakpoints || get(props.theme, "breakpoints", defaults.breakpoints);
71
+ const breakpoints = get(props.theme, "breakpoints", defaults.breakpoints);
72
+ if (isCacheDisabled || cache.breakpoints !== breakpoints || !cache.queries) {
73
+ cache.breakpoints = breakpoints;
74
+ cache.queries = require_media.responsiveQueries(breakpoints);
75
+ }
76
+ const queries = cache.queries;
79
77
  if (Array.isArray(raw)) {
80
- cache.media = !isCacheDisabled && cache.media || [null, ...cache.breakpoints.map(createMediaQuery)];
81
- styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
78
+ styles = merge(styles, parseResponsiveStyle(queries.array, sx, scale, raw, props));
79
+ shouldSort = true;
82
80
  continue;
83
81
  }
84
82
  if (raw !== null) {
85
- styles = merge(styles, parseResponsiveObject(cache.breakpoints, sx, scale, raw, props));
83
+ styles = merge(styles, parseResponsiveObject(queries.keyed, sx, scale, raw, props));
86
84
  shouldSort = true;
87
85
  }
88
86
  continue;
89
87
  }
90
88
  Object.assign(styles, sx(raw, scale, props));
91
89
  }
92
- if (shouldSort) styles = sort(styles);
90
+ if (shouldSort && cache.queries) styles = sort(styles, cache.queries.order);
93
91
  return styles;
94
92
  });
95
93
  parse.config = config;
@@ -144,9 +142,15 @@ const compose = (...parsers) => {
144
142
  return createParser(config);
145
143
  };
146
144
  //#endregion
145
+ exports.breakpointQueries = require_media.breakpointQueries;
147
146
  exports.compose = compose;
147
+ exports.containerKey = require_media.containerKey;
148
+ exports.createContainerQueries = require_media.createContainerQueries;
149
+ exports.createMediaHelpers = require_media.createMediaHelpers;
150
+ exports.createMediaQuery = require_media.createMediaQuery;
148
151
  exports.createParser = createParser;
149
152
  exports.createStyleFunction = createStyleFunction;
150
153
  exports.get = get;
151
154
  exports.merge = merge;
155
+ exports.responsiveQueries = require_media.responsiveQueries;
152
156
  exports.system = system;
package/dist/core.d.cts CHANGED
@@ -1,2 +1,3 @@
1
- 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-C0SM54dQ.cjs";
2
- export { CSSObject, Config, ConfigFunction, ConfigStyle, Parser, ParserConfig, Props, StyleFn, StyleObject, SystemConfig, Theme, Transform, compose, createParser, createStyleFunction, get, merge, styleFn, system };
1
+ import { a as ResponsiveQueries, c as createContainerQueries, d as responsiveQueries, i as QueryHelpers, l as createMediaHelpers, n as Breakpoints, o as breakpointQueries, r as ContainerQueries, s as containerKey, t as BreakpointInput, u as createMediaQuery } from "./media-CfYDomHt.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-iVqAMF2L.cjs";
3
+ export { BreakpointInput, Breakpoints, CSSObject, Config, ConfigFunction, ConfigStyle, ContainerQueries, Parser, ParserConfig, Props, QueryHelpers, ResponsiveQueries, StyleFn, StyleObject, SystemConfig, Theme, Transform, breakpointQueries, compose, containerKey, createContainerQueries, createMediaHelpers, createMediaQuery, createParser, createStyleFunction, get, merge, responsiveQueries, styleFn, system };
package/dist/core.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- 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-C0SM54dQ.mjs";
2
- export { CSSObject, Config, ConfigFunction, ConfigStyle, Parser, ParserConfig, Props, StyleFn, StyleObject, SystemConfig, Theme, Transform, compose, createParser, createStyleFunction, get, merge, styleFn, system };
1
+ import { a as ResponsiveQueries, c as createContainerQueries, d as responsiveQueries, i as QueryHelpers, l as createMediaHelpers, n as Breakpoints, o as breakpointQueries, r as ContainerQueries, s as containerKey, t as BreakpointInput, u as createMediaQuery } from "./media-CfYDomHt.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-IulNhyDt.mjs";
3
+ export { BreakpointInput, Breakpoints, CSSObject, Config, ConfigFunction, ConfigStyle, ContainerQueries, Parser, ParserConfig, Props, QueryHelpers, ResponsiveQueries, StyleFn, StyleObject, SystemConfig, Theme, Transform, breakpointQueries, compose, containerKey, createContainerQueries, createMediaHelpers, createMediaQuery, createParser, createStyleFunction, get, merge, responsiveQueries, styleFn, system };
package/dist/core.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as createMediaQuery, i as createMediaHelpers, n as containerKey, o as responsiveQueries, r as createContainerQueries, t as breakpointQueries } from "./media-Bho3l7WK.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, order) => {
14
15
  const next = {};
15
- Object.keys(obj).sort((a, b) => a.localeCompare(b, void 0, {
16
- numeric: true,
17
- sensitivity: "base"
18
- })).forEach((key) => {
19
- next[key] = obj[key];
20
- });
16
+ for (const key in obj) if (!order.includes(key)) next[key] = obj[key];
17
+ for (const key of order) if (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];
@@ -46,19 +42,16 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
46
42
  });
47
43
  return styles;
48
44
  };
49
- const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
45
+ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
50
46
  const styles = {};
51
47
  for (const key in raw) {
52
- const breakpoint = breakpoints[key];
53
- const value = raw[key];
54
- const style = sx(value, scale, props);
55
- if (breakpoint) {
56
- const media = createMediaQuery(breakpoint);
57
- Object.assign(styles, { [media]: {
58
- ...styles[media],
59
- ...style
60
- } });
61
- } else Object.assign(styles, style);
48
+ const media = keyed.get(key);
49
+ const style = sx(raw[key], scale, props);
50
+ if (media) Object.assign(styles, { [media]: {
51
+ ...styles[media],
52
+ ...style
53
+ } });
54
+ else Object.assign(styles, style);
62
55
  }
63
56
  return styles;
64
57
  };
@@ -74,21 +67,26 @@ const createParser = (config) => {
74
67
  const raw = props[key];
75
68
  const scale = get(props.theme, sx.scale, sx.defaults);
76
69
  if (typeof raw === "object") {
77
- cache.breakpoints = !isCacheDisabled && cache.breakpoints || get(props.theme, "breakpoints", defaults.breakpoints);
70
+ const breakpoints = get(props.theme, "breakpoints", defaults.breakpoints);
71
+ if (isCacheDisabled || cache.breakpoints !== breakpoints || !cache.queries) {
72
+ cache.breakpoints = breakpoints;
73
+ cache.queries = responsiveQueries(breakpoints);
74
+ }
75
+ const queries = cache.queries;
78
76
  if (Array.isArray(raw)) {
79
- cache.media = !isCacheDisabled && cache.media || [null, ...cache.breakpoints.map(createMediaQuery)];
80
- styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
77
+ styles = merge(styles, parseResponsiveStyle(queries.array, sx, scale, raw, props));
78
+ shouldSort = true;
81
79
  continue;
82
80
  }
83
81
  if (raw !== null) {
84
- styles = merge(styles, parseResponsiveObject(cache.breakpoints, sx, scale, raw, props));
82
+ styles = merge(styles, parseResponsiveObject(queries.keyed, sx, scale, raw, props));
85
83
  shouldSort = true;
86
84
  }
87
85
  continue;
88
86
  }
89
87
  Object.assign(styles, sx(raw, scale, props));
90
88
  }
91
- if (shouldSort) styles = sort(styles);
89
+ if (shouldSort && cache.queries) styles = sort(styles, cache.queries.order);
92
90
  return styles;
93
91
  });
94
92
  parse.config = config;
@@ -143,4 +141,4 @@ const compose = (...parsers) => {
143
141
  return createParser(config);
144
142
  };
145
143
  //#endregion
146
- export { compose, createParser, createStyleFunction, get, merge, system };
144
+ export { breakpointQueries, compose, containerKey, createContainerQueries, createMediaHelpers, createMediaQuery, createParser, createStyleFunction, get, merge, responsiveQueries, system };
@@ -1,3 +1,4 @@
1
+ import { o as responsiveQueries } from "./media-Bho3l7WK.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];
@@ -154,28 +155,37 @@ const transforms = [
154
155
  ...acc,
155
156
  [curr]: positiveOrNegative
156
157
  }), {});
158
+ const isResponsiveObject = (value, keyed) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => keyed.has(key));
157
159
  const responsive = (styles) => (theme) => {
158
160
  const next = {};
159
- const mediaQueries = [null, ...get(theme, "breakpoints", defaultBreakpoints).map((n) => `@media screen and (min-width: ${n})`)];
161
+ const blocks = /* @__PURE__ */ new Map();
162
+ const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
163
+ const { array, keyed, order } = responsiveQueries(breakpoints);
164
+ const place = (key, media, value) => {
165
+ if (!media) {
166
+ next[key] = value;
167
+ return;
168
+ }
169
+ const block = blocks.get(media) ?? {};
170
+ blocks.set(media, block);
171
+ if (value != null) block[key] = value;
172
+ };
160
173
  for (const key in styles) {
161
174
  const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
162
175
  if (value == null) continue;
163
- if (!Array.isArray(value)) {
164
- next[key] = value;
165
- continue;
166
- }
167
- const slice = value.slice(0, mediaQueries.length);
168
- for (let i = 0; i < slice.length; i++) {
169
- const media = mediaQueries[i];
170
- if (!media) {
171
- next[key] = slice[i];
172
- continue;
173
- }
174
- const block = next[media] || {};
175
- next[media] = block;
176
- if (slice[i] == null) continue;
177
- block[key] = slice[i];
178
- }
176
+ if (Array.isArray(value)) value.slice(0, array.length).forEach((item, i) => place(key, array[i], item));
177
+ else if (isResponsiveObject(value, keyed)) for (const [name, item] of Object.entries(value)) place(key, keyed.get(name), item);
178
+ else next[key] = value;
179
+ }
180
+ for (const media of order) {
181
+ const block = blocks.get(media);
182
+ if (!block) continue;
183
+ const own = next[media];
184
+ delete next[media];
185
+ next[media] = {
186
+ ...own,
187
+ ...block
188
+ };
179
189
  }
180
190
  return next;
181
191
  };
@@ -1,3 +1,4 @@
1
+ const require_media = require("./media-DSJdRy_k.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];
@@ -154,28 +155,37 @@ const transforms = [
154
155
  ...acc,
155
156
  [curr]: positiveOrNegative
156
157
  }), {});
158
+ const isResponsiveObject = (value, keyed) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => keyed.has(key));
157
159
  const responsive = (styles) => (theme) => {
158
160
  const next = {};
159
- const mediaQueries = [null, ...get(theme, "breakpoints", defaultBreakpoints).map((n) => `@media screen and (min-width: ${n})`)];
161
+ const blocks = /* @__PURE__ */ new Map();
162
+ const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
163
+ const { array, keyed, order } = require_media.responsiveQueries(breakpoints);
164
+ const place = (key, media, value) => {
165
+ if (!media) {
166
+ next[key] = value;
167
+ return;
168
+ }
169
+ const block = blocks.get(media) ?? {};
170
+ blocks.set(media, block);
171
+ if (value != null) block[key] = value;
172
+ };
160
173
  for (const key in styles) {
161
174
  const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
162
175
  if (value == null) continue;
163
- if (!Array.isArray(value)) {
164
- next[key] = value;
165
- continue;
166
- }
167
- const slice = value.slice(0, mediaQueries.length);
168
- for (let i = 0; i < slice.length; i++) {
169
- const media = mediaQueries[i];
170
- if (!media) {
171
- next[key] = slice[i];
172
- continue;
173
- }
174
- const block = next[media] || {};
175
- next[media] = block;
176
- if (slice[i] == null) continue;
177
- block[key] = slice[i];
178
- }
176
+ if (Array.isArray(value)) value.slice(0, array.length).forEach((item, i) => place(key, array[i], item));
177
+ else if (isResponsiveObject(value, keyed)) for (const [name, item] of Object.entries(value)) place(key, keyed.get(name), item);
178
+ else next[key] = value;
179
+ }
180
+ for (const media of order) {
181
+ const block = blocks.get(media);
182
+ if (!block) continue;
183
+ const own = next[media];
184
+ delete next[media];
185
+ next[media] = {
186
+ ...own,
187
+ ...block
188
+ };
179
189
  }
180
190
  return next;
181
191
  };
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-CeNnKyGm.cjs");
5
+ const require_css = require("./css-D1zAlDVz.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 { n as Breakpoints } from "./media-CfYDomHt.cjs";
1
2
  //#region src/css/css.d.ts
2
3
  type CSSObject = Record<string, unknown>;
3
4
  interface CssTheme {
4
- breakpoints?: (string | number)[];
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 { n as Breakpoints } from "./media-CfYDomHt.mjs";
1
2
  //#region src/css/css.d.ts
2
3
  type CSSObject = Record<string, unknown>;
3
4
  interface CssTheme {
4
- breakpoints?: (string | number)[];
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-BTuRmXCo.mjs";
1
+ import { n as get, r as responsive, t as css } from "./css-Ba4jdXOq.mjs";
2
2
  export { css, css as default, get, responsive };
@@ -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-B52XAdkx.cjs";
2
- import { t as flexbox } from "./index-CpDyBw8z.cjs";
1
+ import { A as FlexDirectionProps, F as FlexboxProps, M as FlexProps, N as FlexShrinkProps, P as FlexWrapProps, gt as OrderProps, j as FlexGrowProps, k as FlexBasisProps, n as AlignItemsProps, nt as JustifyItemsProps, r as AlignSelfProps, rt as JustifySelfProps, t as AlignContentProps, tt as JustifyContentProps } from "./types-Cv5WjcVA.cjs";
2
+ import { t as flexbox } from "./index-CQyvhO-h.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 };
@@ -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-B52XAdkx.mjs";
2
- import { t as flexbox } from "./index-DuI1XGHT.mjs";
1
+ import { A as FlexDirectionProps, F as FlexboxProps, M as FlexProps, N as FlexShrinkProps, P as FlexWrapProps, gt as OrderProps, j as FlexGrowProps, k as FlexBasisProps, n as AlignItemsProps, nt as JustifyItemsProps, r as AlignSelfProps, rt as JustifySelfProps, t as AlignContentProps, tt as JustifyContentProps } from "./types-Cv5WjcVA.mjs";
2
+ import { t as flexbox } from "./index-aRomguCQ.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 };
@@ -0,0 +1,156 @@
1
+ const require_media = require("./media-DSJdRy_k.cjs");
2
+ const require_core = require("./core.cjs");
3
+ //#region src/grid/grid.ts
4
+ const spaceScale = [
5
+ 0,
6
+ 4,
7
+ 8,
8
+ 16,
9
+ 32,
10
+ 64,
11
+ 128,
12
+ 256,
13
+ 512
14
+ ];
15
+ const config = {
16
+ gridGap: {
17
+ property: "gridGap",
18
+ scale: "space",
19
+ defaultScale: spaceScale
20
+ },
21
+ gridColumnGap: {
22
+ property: "gridColumnGap",
23
+ scale: "space",
24
+ defaultScale: spaceScale
25
+ },
26
+ gridRowGap: {
27
+ property: "gridRowGap",
28
+ scale: "space",
29
+ defaultScale: spaceScale
30
+ },
31
+ gridColumn: true,
32
+ gridRow: true,
33
+ gridAutoFlow: true,
34
+ gridAutoColumns: true,
35
+ gridAutoRows: true,
36
+ gridTemplateColumns: true,
37
+ gridTemplateRows: true,
38
+ gridTemplateAreas: true,
39
+ gridArea: true
40
+ };
41
+ const grid = require_core.system(config);
42
+ //#endregion
43
+ //#region src/grid/layoutGrid.ts
44
+ const spaceValue = (theme, value) => {
45
+ const resolved = require_core.get(theme, `space.${value}`, value);
46
+ return typeof resolved === "number" ? `${resolved}px` : resolved;
47
+ };
48
+ const declarations = (theme, display, entry) => {
49
+ const { columns, margin, gutter, mode, maxWidth } = entry;
50
+ const isFixed = mode === "fixed";
51
+ const gap = gutter === void 0 ? void 0 : spaceValue(theme, gutter);
52
+ const styles = {
53
+ "--layout-columns": columns,
54
+ "--layout-gutter": gap,
55
+ gridTemplateColumns: display === "grid" && columns !== void 0 ? `repeat(${columns}, minmax(0, 1fr))` : void 0,
56
+ columnGap: gap,
57
+ paddingInline: margin === void 0 ? void 0 : spaceValue(theme, margin),
58
+ maxWidth: isFixed && maxWidth !== void 0 ? spaceValue(theme, maxWidth) : "none",
59
+ marginInline: isFixed ? "auto" : 0
60
+ };
61
+ return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
62
+ };
63
+ /**
64
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
65
+ * margin, gutter, fluid or fixed), inherited mobile-first. An entry in `value` replaces the
66
+ * theme's at the breakpoint it names only; the next breakpoint is back to the theme. Every
67
+ * written block carries the full set, so no block inherits a stale `max-width`.
68
+ */
69
+ const layoutGridStyles = (theme, value, display = "grid") => {
70
+ if (!value) return {};
71
+ const breakpoints = require_core.get(theme, "breakpoints", {});
72
+ const layout = require_core.get(theme, "layout", {});
73
+ const overrides = typeof value === "object" ? value : {};
74
+ const { keyed } = require_media.responsiveQueries(breakpoints);
75
+ const styles = display === "grid" ? { display: "grid" } : {
76
+ display: "flex",
77
+ flexDirection: "row",
78
+ flexWrap: "wrap"
79
+ };
80
+ let themed = {};
81
+ let overridden = false;
82
+ for (const key of Object.keys(breakpoints)) {
83
+ const layer = layout[key]?.content;
84
+ const override = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
85
+ themed = {
86
+ ...themed,
87
+ ...layer
88
+ };
89
+ if (layer || override || overridden) {
90
+ const block = declarations(theme, display, {
91
+ ...themed,
92
+ ...override
93
+ });
94
+ const media = keyed.get(key);
95
+ if (media) styles[media] = block;
96
+ else Object.assign(styles, block);
97
+ }
98
+ overridden = override !== void 0;
99
+ }
100
+ return styles;
101
+ };
102
+ const layoutParser = (display) => Object.assign((props) => layoutGridStyles(props.theme, props.layout, display), {
103
+ config: {},
104
+ propNames: ["layout"],
105
+ cache: {}
106
+ });
107
+ /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
108
+ const layoutGrid = layoutParser("grid");
109
+ /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
110
+ const layoutFlex = layoutParser("flex");
111
+ const flexSpan = (n) => {
112
+ const columns = "var(--layout-columns, 1)";
113
+ const gutter = "var(--layout-gutter, 0px)";
114
+ return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
115
+ };
116
+ /**
117
+ * The `span` prop: how many layout-grid columns an element takes. It writes both
118
+ * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
119
+ * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
120
+ * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
121
+ */
122
+ const span = require_core.system({ span: (n) => ({
123
+ gridColumn: `span ${n}`,
124
+ flex: flexSpan(n)
125
+ }) });
126
+ //#endregion
127
+ Object.defineProperty(exports, "grid", {
128
+ enumerable: true,
129
+ get: function() {
130
+ return grid;
131
+ }
132
+ });
133
+ Object.defineProperty(exports, "layoutFlex", {
134
+ enumerable: true,
135
+ get: function() {
136
+ return layoutFlex;
137
+ }
138
+ });
139
+ Object.defineProperty(exports, "layoutGrid", {
140
+ enumerable: true,
141
+ get: function() {
142
+ return layoutGrid;
143
+ }
144
+ });
145
+ Object.defineProperty(exports, "layoutGridStyles", {
146
+ enumerable: true,
147
+ get: function() {
148
+ return layoutGridStyles;
149
+ }
150
+ });
151
+ Object.defineProperty(exports, "span", {
152
+ enumerable: true,
153
+ get: function() {
154
+ return span;
155
+ }
156
+ });