@soroush.tech/styled-system 5.9.0-alpha.0 → 6.0.0-alpha.1

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 (111) 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 +31 -31
  8. package/dist/core.d.cts +3 -3
  9. package/dist/core.d.mts +3 -3
  10. package/dist/core.mjs +28 -32
  11. package/dist/{css-CunBKyMl.mjs → css-Ba4jdXOq.mjs} +26 -18
  12. package/dist/{css-BnnO16Cw.cjs → css-D1zAlDVz.cjs} +26 -18
  13. package/dist/css.cjs +1 -1
  14. package/dist/css.d.cts +1 -1
  15. package/dist/css.d.mts +1 -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-BdKZQBHF.mjs +135 -0
  20. package/dist/grid-CAlwl8LZ.cjs +165 -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-BCO1q3Ee.d.mts +6 -0
  26. package/dist/{index-BKofCDzL.d.mts → index-BgcnUGws.d.cts} +2 -2
  27. package/dist/index-BiZPbJuj.d.mts +6 -0
  28. package/dist/index-BolQQ69W.d.cts +6 -0
  29. package/dist/index-Bq7LA-5J.d.cts +6 -0
  30. package/dist/{index-wKeENlqd.d.mts → index-C4BUuCOD.d.cts} +2 -2
  31. package/dist/index-CV2xW58U.d.mts +6 -0
  32. package/dist/index-CVxHdrQd.d.mts +6 -0
  33. package/dist/index-CXOIz3b_.d.cts +6 -0
  34. package/dist/index-CkSwZa-Z.d.mts +6 -0
  35. package/dist/index-Cnya5hgU.d.mts +6 -0
  36. package/dist/{index-DzcXmzdT.d.cts → index-Cow4kTN2.d.mts} +2 -2
  37. package/dist/index-Cy51GZK8.d.mts +47 -0
  38. package/dist/index-DBX-YuCP.d.mts +6 -0
  39. package/dist/index-DJw2NCm-.d.cts +6 -0
  40. package/dist/index-DS5tvdki.d.cts +6 -0
  41. package/dist/index-DrwsZZkS.d.cts +47 -0
  42. package/dist/{index-BXP1-da3.d.mts → index-IulNhyDt.d.mts} +2 -2
  43. package/dist/index-MqRHkwxm.d.cts +6 -0
  44. package/dist/{index-BYkO78Xl.d.cts → index-iVqAMF2L.d.cts} +2 -2
  45. package/dist/{index-Bq7teef_.d.cts → index-k5b5FR_o.d.mts} +2 -2
  46. package/dist/index-o6j0bywN.d.cts +6 -0
  47. package/dist/index-ygAGm7QY.d.cts +6 -0
  48. package/dist/index-z2p2DCxL.d.mts +6 -0
  49. package/dist/index.cjs +12 -4
  50. package/dist/index.d.cts +15 -15
  51. package/dist/index.d.mts +15 -15
  52. package/dist/index.mjs +5 -5
  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-CV_TIXQ4.mjs → presets-DtE_nRxp.mjs} +4 -4
  66. package/dist/{presets-CCvtQotd.cjs → presets-fJFZ74qt.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-B0SNbm6V.d.cts → types-C4ogGxde.d.cts} +37 -7
  78. package/dist/{types-B0SNbm6V.d.mts → types-C4ogGxde.d.mts} +37 -7
  79. package/dist/typography.d.cts +2 -2
  80. package/dist/typography.d.mts +2 -2
  81. package/dist/{variant-DdSForfI.cjs → variant-BSPTyRcQ.cjs} +1 -1
  82. package/dist/{variant-DfRW-ZJe.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 +1 -1
  88. package/dist/grid-Bpk-QjhF.mjs +0 -41
  89. package/dist/grid-CpvRIng4.cjs +0 -47
  90. package/dist/index-0k2kzlK5.d.cts +0 -6
  91. package/dist/index-BReBwT6c.d.mts +0 -6
  92. package/dist/index-BhbWZw53.d.mts +0 -6
  93. package/dist/index-C-B6-_Ku.d.mts +0 -6
  94. package/dist/index-C9CxJ5Zn.d.cts +0 -6
  95. package/dist/index-CIccdXWj.d.cts +0 -6
  96. package/dist/index-CJT-n3Vq.d.mts +0 -6
  97. package/dist/index-CcorN1bQ.d.mts +0 -6
  98. package/dist/index-Cd_CcxMh.d.cts +0 -6
  99. package/dist/index-Co0JY1hd.d.cts +0 -6
  100. package/dist/index-D9dwDAhC.d.mts +0 -6
  101. package/dist/index-DP40bJIa.d.cts +0 -6
  102. package/dist/index-DQhcFrR9.d.mts +0 -6
  103. package/dist/index-DcRfFIAZ.d.mts +0 -6
  104. package/dist/index-Dsc6RgbZ.d.cts +0 -6
  105. package/dist/index-Q8q5VND1.d.cts +0 -6
  106. package/dist/index-UGE-V15i.d.cts +0 -6
  107. package/dist/index-sk97pkUE.d.mts +0 -6
  108. package/dist/media-B8UpEDpY.mjs +0 -18
  109. package/dist/media-BoIPXBPV.cjs +0 -29
  110. package/dist/media-np0uvO4C.d.cts +0 -14
  111. package/dist/media-np0uvO4C.d.mts +0 -14
@@ -1,3 +1,3 @@
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";
1
+ import { t as background } from "./index-DS5tvdki.cjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-C4ogGxde.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-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";
1
+ import { t as background } from "./index-CVxHdrQd.mjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-C4ogGxde.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-B0SNbm6V.cjs";
2
- import { t as border } from "./index-C9CxJ5Zn.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-C4ogGxde.cjs";
2
+ import { t as border } from "./index-BolQQ69W.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-B0SNbm6V.mjs";
2
- import { t as border } from "./index-D9dwDAhC.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-C4ogGxde.mjs";
2
+ import { t as border } from "./index-z2p2DCxL.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-B0SNbm6V.cjs";
2
- import { t as color } from "./index-Cd_CcxMh.cjs";
1
+ import { Mt as TextColorProps, a as BackgroundColorProps, ht as OpacityProps, w as ColorProps } from "./types-C4ogGxde.cjs";
2
+ import { t as color } from "./index-MqRHkwxm.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-B0SNbm6V.mjs";
2
- import { t as color } from "./index-CJT-n3Vq.mjs";
1
+ import { Mt as TextColorProps, a as BackgroundColorProps, ht as OpacityProps, w as ColorProps } from "./types-C4ogGxde.mjs";
2
+ import { t as color } from "./index-BiZPbJuj.mjs";
3
3
  export { type BackgroundColorProps, type ColorProps, type OpacityProps, type TextColorProps, color, color as default };
package/dist/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_media = require("./media-BoIPXBPV.cjs");
2
+ const require_media = require("./media-DSJdRy_k.cjs");
3
3
  //#region src/core/core.ts
4
4
  const merge = (a, b) => {
5
5
  const result = {
@@ -12,10 +12,10 @@ const merge = (a, b) => {
12
12
  }
13
13
  return result;
14
14
  };
15
- const sort = (obj, media) => {
15
+ const sort = (obj, order) => {
16
16
  const next = {};
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];
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];
19
19
  return next;
20
20
  };
21
21
  const defaults = { breakpoints: [
@@ -43,52 +43,48 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
43
43
  });
44
44
  return styles;
45
45
  };
46
- const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
46
+ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
47
47
  const styles = {};
48
48
  for (const key in raw) {
49
- const breakpoint = Object.hasOwn(breakpoints, key) ? breakpoints[key] : void 0;
50
- const value = raw[key];
51
- const style = sx(value, scale, props);
52
- if (breakpoint !== void 0) {
53
- const media = require_media.createMediaQuery(breakpoint);
54
- Object.assign(styles, { [media]: {
55
- ...styles[media],
56
- ...style
57
- } });
58
- } 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);
59
56
  }
60
57
  return styles;
61
58
  };
59
+ const queriesFor = (cache, theme) => {
60
+ const breakpoints = get(theme, "breakpoints", defaults.breakpoints);
61
+ if (theme?.disableStyledSystemCache || cache.breakpoints !== breakpoints || !cache.queries) {
62
+ cache.breakpoints = breakpoints;
63
+ cache.queries = require_media.responsiveQueries(breakpoints);
64
+ }
65
+ return cache.queries;
66
+ };
62
67
  const createParser = (config) => {
63
- const cache = { media: [] };
68
+ const cache = {};
64
69
  const parse = ((props) => {
65
70
  let styles = {};
66
71
  let shouldSort = false;
67
- const isCacheDisabled = props.theme?.disableStyledSystemCache;
68
72
  for (const key in props) {
69
73
  if (!config[key]) continue;
70
74
  const sx = config[key];
71
75
  const raw = props[key];
72
76
  const scale = get(props.theme, sx.scale, sx.defaults);
73
77
  if (typeof raw === "object") {
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
- if (Array.isArray(raw)) {
80
- styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
81
- continue;
82
- }
83
- if (raw !== null) {
84
- styles = merge(styles, parseResponsiveObject(breakpoints, sx, scale, raw, props));
85
- shouldSort = true;
86
- }
78
+ if (raw === null) continue;
79
+ const { array, keyed } = queriesFor(cache, props.theme);
80
+ const responsive = Array.isArray(raw) ? parseResponsiveStyle(array, sx, scale, raw, props) : parseResponsiveObject(keyed, sx, scale, raw, props);
81
+ styles = merge(styles, responsive);
82
+ shouldSort = true;
87
83
  continue;
88
84
  }
89
85
  Object.assign(styles, sx(raw, scale, props));
90
86
  }
91
- if (shouldSort) styles = sort(styles, cache.media);
87
+ if (shouldSort && cache.queries) styles = sort(styles, cache.queries.order);
92
88
  return styles;
93
89
  });
94
90
  parse.config = config;
@@ -145,9 +141,13 @@ const compose = (...parsers) => {
145
141
  //#endregion
146
142
  exports.breakpointQueries = require_media.breakpointQueries;
147
143
  exports.compose = compose;
144
+ exports.containerKey = require_media.containerKey;
145
+ exports.createContainerQueries = require_media.createContainerQueries;
146
+ exports.createMediaHelpers = require_media.createMediaHelpers;
148
147
  exports.createMediaQuery = require_media.createMediaQuery;
149
148
  exports.createParser = createParser;
150
149
  exports.createStyleFunction = createStyleFunction;
151
150
  exports.get = get;
152
151
  exports.merge = merge;
152
+ exports.responsiveQueries = require_media.responsiveQueries;
153
153
  exports.system = system;
package/dist/core.d.cts CHANGED
@@ -1,3 +1,3 @@
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 };
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,3 +1,3 @@
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 };
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,4 +1,4 @@
1
- import { n as createMediaQuery, t as breakpointQueries } from "./media-B8UpEDpY.mjs";
1
+ import { a as createMediaQuery, i as createMediaHelpers, n as containerKey, o as responsiveQueries, r as createContainerQueries, t as breakpointQueries } from "./media-Bho3l7WK.mjs";
2
2
  //#region src/core/core.ts
3
3
  const merge = (a, b) => {
4
4
  const result = {
@@ -11,10 +11,10 @@ const merge = (a, b) => {
11
11
  }
12
12
  return result;
13
13
  };
14
- const sort = (obj, media) => {
14
+ const sort = (obj, order) => {
15
15
  const next = {};
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];
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];
18
18
  return next;
19
19
  };
20
20
  const defaults = { breakpoints: [
@@ -42,52 +42,48 @@ const parseResponsiveStyle = (mediaQueries, sx, scale, raw, props) => {
42
42
  });
43
43
  return styles;
44
44
  };
45
- const parseResponsiveObject = (breakpoints, sx, scale, raw, props) => {
45
+ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
46
46
  const styles = {};
47
47
  for (const key in raw) {
48
- const breakpoint = Object.hasOwn(breakpoints, key) ? breakpoints[key] : void 0;
49
- const value = raw[key];
50
- const style = sx(value, scale, props);
51
- if (breakpoint !== void 0) {
52
- const media = createMediaQuery(breakpoint);
53
- Object.assign(styles, { [media]: {
54
- ...styles[media],
55
- ...style
56
- } });
57
- } 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);
58
55
  }
59
56
  return styles;
60
57
  };
58
+ const queriesFor = (cache, theme) => {
59
+ const breakpoints = get(theme, "breakpoints", defaults.breakpoints);
60
+ if (theme?.disableStyledSystemCache || cache.breakpoints !== breakpoints || !cache.queries) {
61
+ cache.breakpoints = breakpoints;
62
+ cache.queries = responsiveQueries(breakpoints);
63
+ }
64
+ return cache.queries;
65
+ };
61
66
  const createParser = (config) => {
62
- const cache = { media: [] };
67
+ const cache = {};
63
68
  const parse = ((props) => {
64
69
  let styles = {};
65
70
  let shouldSort = false;
66
- const isCacheDisabled = props.theme?.disableStyledSystemCache;
67
71
  for (const key in props) {
68
72
  if (!config[key]) continue;
69
73
  const sx = config[key];
70
74
  const raw = props[key];
71
75
  const scale = get(props.theme, sx.scale, sx.defaults);
72
76
  if (typeof raw === "object") {
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
- if (Array.isArray(raw)) {
79
- styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
80
- continue;
81
- }
82
- if (raw !== null) {
83
- styles = merge(styles, parseResponsiveObject(breakpoints, sx, scale, raw, props));
84
- shouldSort = true;
85
- }
77
+ if (raw === null) continue;
78
+ const { array, keyed } = queriesFor(cache, props.theme);
79
+ const responsive = Array.isArray(raw) ? parseResponsiveStyle(array, sx, scale, raw, props) : parseResponsiveObject(keyed, sx, scale, raw, props);
80
+ styles = merge(styles, responsive);
81
+ shouldSort = true;
86
82
  continue;
87
83
  }
88
84
  Object.assign(styles, sx(raw, scale, props));
89
85
  }
90
- if (shouldSort) styles = sort(styles, cache.media);
86
+ if (shouldSort && cache.queries) styles = sort(styles, cache.queries.order);
91
87
  return styles;
92
88
  });
93
89
  parse.config = config;
@@ -142,4 +138,4 @@ const compose = (...parsers) => {
142
138
  return createParser(config);
143
139
  };
144
140
  //#endregion
145
- export { breakpointQueries, compose, createMediaQuery, createParser, createStyleFunction, get, merge, system };
141
+ export { breakpointQueries, compose, containerKey, createContainerQueries, createMediaHelpers, createMediaQuery, createParser, createStyleFunction, get, merge, responsiveQueries, system };
@@ -1,4 +1,4 @@
1
- import { n as createMediaQuery } from "./media-B8UpEDpY.mjs";
1
+ import { o as responsiveQueries } from "./media-Bho3l7WK.mjs";
2
2
  //#region src/css/css.ts
3
3
  const get = (obj, key, def, p = 0, undef) => {
4
4
  const path = typeof key === "string" ? key.split(".") : [key];
@@ -155,29 +155,37 @@ const transforms = [
155
155
  ...acc,
156
156
  [curr]: positiveOrNegative
157
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));
158
159
  const responsive = (styles) => (theme) => {
159
160
  const next = {};
161
+ const blocks = /* @__PURE__ */ new Map();
160
162
  const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
161
- const mediaQueries = [null, ...Object.values(breakpoints).map(createMediaQuery)];
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
+ };
162
173
  for (const key in styles) {
163
174
  const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
164
175
  if (value == null) continue;
165
- if (!Array.isArray(value)) {
166
- next[key] = value;
167
- continue;
168
- }
169
- const slice = value.slice(0, mediaQueries.length);
170
- for (let i = 0; i < slice.length; i++) {
171
- const media = mediaQueries[i];
172
- if (!media) {
173
- next[key] = slice[i];
174
- continue;
175
- }
176
- const block = next[media] || {};
177
- next[media] = block;
178
- if (slice[i] == null) continue;
179
- block[key] = slice[i];
180
- }
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
+ };
181
189
  }
182
190
  return next;
183
191
  };
@@ -1,4 +1,4 @@
1
- const require_media = require("./media-BoIPXBPV.cjs");
1
+ const require_media = require("./media-DSJdRy_k.cjs");
2
2
  //#region src/css/css.ts
3
3
  const get = (obj, key, def, p = 0, undef) => {
4
4
  const path = typeof key === "string" ? key.split(".") : [key];
@@ -155,29 +155,37 @@ const transforms = [
155
155
  ...acc,
156
156
  [curr]: positiveOrNegative
157
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));
158
159
  const responsive = (styles) => (theme) => {
159
160
  const next = {};
161
+ const blocks = /* @__PURE__ */ new Map();
160
162
  const breakpoints = get(theme, "breakpoints", defaultBreakpoints);
161
- const mediaQueries = [null, ...Object.values(breakpoints).map(require_media.createMediaQuery)];
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
+ };
162
173
  for (const key in styles) {
163
174
  const value = typeof styles[key] === "function" ? styles[key](theme) : styles[key];
164
175
  if (value == null) continue;
165
- if (!Array.isArray(value)) {
166
- next[key] = value;
167
- continue;
168
- }
169
- const slice = value.slice(0, mediaQueries.length);
170
- for (let i = 0; i < slice.length; i++) {
171
- const media = mediaQueries[i];
172
- if (!media) {
173
- next[key] = slice[i];
174
- continue;
175
- }
176
- const block = next[media] || {};
177
- next[media] = block;
178
- if (slice[i] == null) continue;
179
- block[key] = slice[i];
180
- }
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
+ };
181
189
  }
182
190
  return next;
183
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-BnnO16Cw.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,4 +1,4 @@
1
- import { t as Breakpoints } from "./media-np0uvO4C.cjs";
1
+ import { n as Breakpoints } from "./media-CfYDomHt.cjs";
2
2
  //#region src/css/css.d.ts
3
3
  type CSSObject = Record<string, unknown>;
4
4
  interface CssTheme {
package/dist/css.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Breakpoints } from "./media-np0uvO4C.mjs";
1
+ import { n as Breakpoints } from "./media-CfYDomHt.mjs";
2
2
  //#region src/css/css.d.ts
3
3
  type CSSObject = Record<string, unknown>;
4
4
  interface CssTheme {
package/dist/css.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as get, r as responsive, t as css } from "./css-CunBKyMl.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-B0SNbm6V.cjs";
2
- import { t as flexbox } from "./index-CIccdXWj.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-C4ogGxde.cjs";
2
+ import { t as flexbox } from "./index-CXOIz3b_.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-B0SNbm6V.mjs";
2
- import { t as flexbox } from "./index-DcRfFIAZ.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-C4ogGxde.mjs";
2
+ import { t as flexbox } from "./index-BCO1q3Ee.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,135 @@
1
+ import { o as responsiveQueries } from "./media-Bho3l7WK.mjs";
2
+ import { get, system } from "./core.mjs";
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 grid = system({
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
+ //#endregion
42
+ //#region src/grid/layoutGrid.ts
43
+ const spaceValue = (theme, value) => {
44
+ const resolved = get(theme, `space.${value}`, value);
45
+ return typeof resolved === "number" ? `${resolved}px` : resolved;
46
+ };
47
+ const declarations = (theme, display, entry) => {
48
+ const { columns, margin, gutter, mode, maxWidth } = entry;
49
+ const isFixed = mode === "fixed";
50
+ const gap = gutter === void 0 ? void 0 : spaceValue(theme, gutter);
51
+ const styles = {
52
+ "--layout-columns": columns,
53
+ "--layout-gutter": gap,
54
+ gridTemplateColumns: display === "grid" && columns !== void 0 ? `repeat(${columns}, minmax(0, 1fr))` : void 0,
55
+ columnGap: gap,
56
+ paddingInline: margin === void 0 ? void 0 : spaceValue(theme, margin),
57
+ maxWidth: isFixed && maxWidth !== void 0 ? spaceValue(theme, maxWidth) : "none",
58
+ marginInline: isFixed ? "auto" : 0
59
+ };
60
+ return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
61
+ };
62
+ /**
63
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
64
+ * margin, gutter, fluid or fixed), inherited mobile-first. A field in `value` replaces the
65
+ * theme's at every breakpoint (`{ gutter: 8 }`); an entry under a breakpoint name replaces it
66
+ * there only, on top of those fields (`{ gutter: 8, md: { columns: 6 } }`), and the next
67
+ * breakpoint is back to the theme. Every written block carries the full set, so no block
68
+ * inherits a stale `max-width`.
69
+ */
70
+ const layoutGridStyles = (theme, value, display = "grid") => {
71
+ if (!value) return {};
72
+ const breakpoints = get(theme, "breakpoints", {});
73
+ const layout = get(theme, "layout", {});
74
+ const fields = typeof value === "object" ? Object.entries(value) : [];
75
+ const everywhere = Object.fromEntries(fields.filter(([, field]) => typeof field !== "object"));
76
+ const overrides = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
77
+ const hasEverywhere = Object.keys(everywhere).length > 0;
78
+ const { keyed } = responsiveQueries(breakpoints);
79
+ const styles = display === "grid" ? { display: "grid" } : {
80
+ display: "flex",
81
+ flexDirection: "row",
82
+ flexWrap: "wrap"
83
+ };
84
+ let themed = {};
85
+ let overridden = false;
86
+ for (const key of Object.keys(breakpoints)) {
87
+ const layer = layout[key]?.content;
88
+ const named = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
89
+ const override = hasEverywhere || named ? {
90
+ ...everywhere,
91
+ ...named
92
+ } : void 0;
93
+ themed = {
94
+ ...themed,
95
+ ...layer
96
+ };
97
+ if (layer || override || overridden) {
98
+ const block = declarations(theme, display, {
99
+ ...themed,
100
+ ...override
101
+ });
102
+ const media = keyed.get(key);
103
+ if (media) styles[media] = block;
104
+ else Object.assign(styles, block);
105
+ }
106
+ overridden = override !== void 0;
107
+ }
108
+ return styles;
109
+ };
110
+ const layoutParser = (display) => Object.assign((props) => layoutGridStyles(props.theme, props.layout, display), {
111
+ config: {},
112
+ propNames: ["layout"],
113
+ cache: {}
114
+ });
115
+ /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
116
+ const layoutGrid = layoutParser("grid");
117
+ /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
118
+ const layoutFlex = layoutParser("flex");
119
+ const flexSpan = (n) => {
120
+ const columns = "var(--layout-columns)";
121
+ const gutter = "var(--layout-gutter)";
122
+ return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
123
+ };
124
+ /**
125
+ * The `span` prop: how many layout-grid columns an element takes. It writes both
126
+ * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
127
+ * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
128
+ * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
129
+ */
130
+ const span = system({ span: (n) => ({
131
+ gridColumn: `span ${n}`,
132
+ flex: flexSpan(n)
133
+ }) });
134
+ //#endregion
135
+ export { grid as a, span as i, layoutGrid as n, layoutGridStyles as r, layoutFlex as t };