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

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 (68) 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 +13 -16
  8. package/dist/core.mjs +13 -16
  9. package/dist/flexbox.d.cts +2 -2
  10. package/dist/flexbox.d.mts +2 -2
  11. package/dist/grid-CAuvylKs.mjs +158 -0
  12. package/dist/{grid-BlMUPDJM.cjs → grid-Cv-XGWcr.cjs} +69 -31
  13. package/dist/grid.cjs +2 -1
  14. package/dist/grid.d.cts +3 -3
  15. package/dist/grid.d.mts +3 -3
  16. package/dist/grid.mjs +2 -2
  17. package/dist/{index-ClbGlQxq.d.mts → index-4_E8pg8R.d.mts} +1 -1
  18. package/dist/{index-Csbxj8Yo.d.cts → index-B7YL_4tg.d.cts} +1 -1
  19. package/dist/{index-CQWZd4iQ.d.mts → index-BgSrVqHI.d.mts} +1 -1
  20. package/dist/{index-BQPI7z-B.d.mts → index-BnfK4WNL.d.mts} +1 -1
  21. package/dist/{index-nfjmLzHF.d.mts → index-BvyUTPw5.d.mts} +1 -1
  22. package/dist/index-C0X-fL6a.d.mts +55 -0
  23. package/dist/{index-D5xp7RWT.d.cts → index-C8kegqfi.d.cts} +1 -1
  24. package/dist/{index-Bxh1FNcS.d.cts → index-CnHK2xHk.d.cts} +1 -1
  25. package/dist/{index-C1IdMVtQ.d.mts → index-CnVRmFIZ.d.mts} +1 -1
  26. package/dist/{index-D2v_oJEm.d.cts → index-CpS2pkHD.d.cts} +1 -1
  27. package/dist/{index-aRomguCQ.d.mts → index-D8sNCYCo.d.mts} +1 -1
  28. package/dist/index-DHAamdKa.d.cts +55 -0
  29. package/dist/{index-ByDfI1go.d.cts → index-DOzfQDfG.d.cts} +1 -1
  30. package/dist/{index-MbcUN6uf.d.mts → index-DbwnL32Q.d.mts} +1 -1
  31. package/dist/{index-CgJzEbXW.d.cts → index-Dpqn1WzM.d.cts} +1 -1
  32. package/dist/{index-CQyvhO-h.d.cts → index-ILo8rb05.d.cts} +1 -1
  33. package/dist/{index-Bwpwvg1h.d.cts → index-IfEDsoFj.d.cts} +1 -1
  34. package/dist/{index-BmyL5qR7.d.cts → index-PoT1oV9X.d.cts} +1 -1
  35. package/dist/{index-DKz4zEeT.d.mts → index-Xh-lC-ge.d.mts} +1 -1
  36. package/dist/{index-D1mRMWDm.d.cts → index-eWVK6SXF.d.cts} +1 -1
  37. package/dist/{index-90_abc05.d.mts → index-fuBvJDhs.d.mts} +1 -1
  38. package/dist/{index-pzogdlkS.d.mts → index-kkyge37R.d.mts} +1 -1
  39. package/dist/index.cjs +2 -1
  40. package/dist/index.d.cts +13 -13
  41. package/dist/index.d.mts +13 -13
  42. package/dist/index.mjs +2 -2
  43. package/dist/layout.d.cts +2 -2
  44. package/dist/layout.d.mts +2 -2
  45. package/dist/position.d.cts +2 -2
  46. package/dist/position.d.mts +2 -2
  47. package/dist/{presets-DsxPfpSE.mjs → presets-B4QR0tKt.mjs} +1 -1
  48. package/dist/{presets-KURYP1_7.cjs → presets-Da2kvQPo.cjs} +1 -1
  49. package/dist/prop-types.cjs +1 -1
  50. package/dist/prop-types.mjs +1 -1
  51. package/dist/props.cjs +1 -1
  52. package/dist/props.mjs +1 -1
  53. package/dist/shadow.d.cts +2 -2
  54. package/dist/shadow.d.mts +2 -2
  55. package/dist/should-forward-prop.cjs +1 -1
  56. package/dist/should-forward-prop.mjs +1 -1
  57. package/dist/space.d.cts +2 -2
  58. package/dist/space.d.mts +2 -2
  59. package/dist/{types-Cv5WjcVA.d.cts → types-Cj6Jx5LX.d.cts} +27 -13
  60. package/dist/{types-Cv5WjcVA.d.mts → types-Cj6Jx5LX.d.mts} +27 -13
  61. package/dist/typography.d.cts +2 -2
  62. package/dist/typography.d.mts +2 -2
  63. package/dist/variant.d.cts +2 -2
  64. package/dist/variant.d.mts +2 -2
  65. package/package.json +1 -1
  66. package/dist/grid-CYjL4-gb.mjs +0 -126
  67. package/dist/index-CXK27dY_.d.cts +0 -42
  68. package/dist/index-D7IZ8-Zq.d.mts +0 -42
@@ -1,3 +1,3 @@
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";
1
+ import { t as background } from "./index-IfEDsoFj.cjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cj6Jx5LX.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-DKz4zEeT.mjs";
2
- import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cv5WjcVA.mjs";
1
+ import { t as background } from "./index-Xh-lC-ge.mjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cj6Jx5LX.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-Cv5WjcVA.cjs";
2
- import { t as border } from "./index-D5xp7RWT.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-Cj6Jx5LX.cjs";
2
+ import { t as border } from "./index-C8kegqfi.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-Cv5WjcVA.mjs";
2
- import { t as border } from "./index-CQWZd4iQ.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-Cj6Jx5LX.mjs";
2
+ import { t as border } from "./index-BgSrVqHI.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 { 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";
1
+ import { Nt as TextColorProps, a as BackgroundColorProps, gt as OpacityProps, w as ColorProps } from "./types-Cj6Jx5LX.cjs";
2
+ import { t as color } from "./index-DOzfQDfG.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 { 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";
1
+ import { Nt as TextColorProps, a as BackgroundColorProps, gt as OpacityProps, w as ColorProps } from "./types-Cj6Jx5LX.mjs";
2
+ import { t as color } from "./index-fuBvJDhs.mjs";
3
3
  export { type BackgroundColorProps, type ColorProps, type OpacityProps, type TextColorProps, color, color as default };
package/dist/core.cjs CHANGED
@@ -56,33 +56,30 @@ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
56
56
  }
57
57
  return styles;
58
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
+ };
59
67
  const createParser = (config) => {
60
68
  const cache = {};
61
69
  const parse = ((props) => {
62
70
  let styles = {};
63
71
  let shouldSort = false;
64
- const isCacheDisabled = props.theme?.disableStyledSystemCache;
65
72
  for (const key in props) {
66
73
  if (!config[key]) continue;
67
74
  const sx = config[key];
68
75
  const raw = props[key];
69
76
  const scale = get(props.theme, sx.scale, sx.defaults);
70
77
  if (typeof raw === "object") {
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;
77
- if (Array.isArray(raw)) {
78
- styles = merge(styles, parseResponsiveStyle(queries.array, sx, scale, raw, props));
79
- shouldSort = true;
80
- continue;
81
- }
82
- if (raw !== null) {
83
- styles = merge(styles, parseResponsiveObject(queries.keyed, sx, scale, raw, props));
84
- shouldSort = true;
85
- }
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;
86
83
  continue;
87
84
  }
88
85
  Object.assign(styles, sx(raw, scale, props));
package/dist/core.mjs CHANGED
@@ -55,33 +55,30 @@ const parseResponsiveObject = (keyed, sx, scale, raw, props) => {
55
55
  }
56
56
  return styles;
57
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
+ };
58
66
  const createParser = (config) => {
59
67
  const cache = {};
60
68
  const parse = ((props) => {
61
69
  let styles = {};
62
70
  let shouldSort = false;
63
- const isCacheDisabled = props.theme?.disableStyledSystemCache;
64
71
  for (const key in props) {
65
72
  if (!config[key]) continue;
66
73
  const sx = config[key];
67
74
  const raw = props[key];
68
75
  const scale = get(props.theme, sx.scale, sx.defaults);
69
76
  if (typeof raw === "object") {
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;
76
- if (Array.isArray(raw)) {
77
- styles = merge(styles, parseResponsiveStyle(queries.array, sx, scale, raw, props));
78
- shouldSort = true;
79
- continue;
80
- }
81
- if (raw !== null) {
82
- styles = merge(styles, parseResponsiveObject(queries.keyed, sx, scale, raw, props));
83
- shouldSort = true;
84
- }
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;
85
82
  continue;
86
83
  }
87
84
  Object.assign(styles, sx(raw, scale, props));
@@ -1,3 +1,3 @@
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";
1
+ import { A as FlexDirectionProps, F as FlexboxProps, M as FlexProps, N as FlexShrinkProps, P as FlexWrapProps, _t 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-Cj6Jx5LX.cjs";
2
+ import { t as flexbox } from "./index-ILo8rb05.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 { 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";
1
+ import { A as FlexDirectionProps, F as FlexboxProps, M as FlexProps, N as FlexShrinkProps, P as FlexWrapProps, _t 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-Cj6Jx5LX.mjs";
2
+ import { t as flexbox } from "./index-D8sNCYCo.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,158 @@
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 frameDeclarations = (theme, { margin, mode, maxWidth }) => {
48
+ const width = mode === "fixed" && maxWidth !== void 0 ? spaceValue(theme, maxWidth) : void 0;
49
+ return {
50
+ paddingInline: margin === void 0 ? void 0 : spaceValue(theme, margin),
51
+ maxWidth: width ?? "none",
52
+ marginInline: width === void 0 ? 0 : `max(0px, calc((100% - ${width}) / 2))`
53
+ };
54
+ };
55
+ const columnDeclarations = (theme, display, { columns, gutter }) => {
56
+ const gap = gutter === void 0 ? void 0 : spaceValue(theme, gutter);
57
+ return {
58
+ "--layout-columns": columns,
59
+ "--layout-gutter": gap,
60
+ gridTemplateColumns: display === "grid" && columns !== void 0 ? `repeat(${columns}, minmax(0, 1fr))` : void 0,
61
+ columnGap: gap
62
+ };
63
+ };
64
+ const declarations = (theme, parts, entry) => {
65
+ const styles = Object.assign({}, ...parts.map((part) => part === "frame" ? frameDeclarations(theme, entry) : columnDeclarations(theme, part, entry)));
66
+ return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
67
+ };
68
+ const DISPLAY = {
69
+ frame: {},
70
+ grid: { display: "grid" },
71
+ flex: {
72
+ display: "flex",
73
+ flexDirection: "row",
74
+ flexWrap: "wrap"
75
+ }
76
+ };
77
+ const layoutStyles = (theme, value, parts) => {
78
+ if (!value) return {};
79
+ const breakpoints = get(theme, "breakpoints", {});
80
+ const layout = get(theme, "layout", {});
81
+ const fields = typeof value === "object" ? Object.entries(value) : [];
82
+ const everywhere = Object.fromEntries(fields.filter(([, field]) => typeof field !== "object"));
83
+ const overrides = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
84
+ const hasEverywhere = Object.keys(everywhere).length > 0;
85
+ const { keyed } = responsiveQueries(breakpoints);
86
+ const styles = Object.assign({}, ...parts.map((part) => DISPLAY[part]));
87
+ let themed = {};
88
+ let overridden = false;
89
+ for (const key of Object.keys(breakpoints)) {
90
+ const layer = layout[key]?.content;
91
+ const named = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
92
+ const override = hasEverywhere || named ? {
93
+ ...everywhere,
94
+ ...named
95
+ } : void 0;
96
+ themed = {
97
+ ...themed,
98
+ ...layer
99
+ };
100
+ if (layer || override || overridden) {
101
+ const block = declarations(theme, parts, {
102
+ ...themed,
103
+ ...override
104
+ });
105
+ const media = keyed.get(key);
106
+ if (media) styles[media] = block;
107
+ else Object.assign(styles, block);
108
+ }
109
+ overridden = override !== void 0;
110
+ }
111
+ return styles;
112
+ };
113
+ /**
114
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
115
+ * margin, gutter, fluid or fixed), inherited mobile-first. A field in `value` replaces the
116
+ * theme's at every breakpoint (`{ gutter: 8 }`); an entry under a breakpoint name replaces it
117
+ * there only, on top of those fields (`{ gutter: 8, md: { columns: 6 } }`), and the next
118
+ * breakpoint is back to the theme. Every written block carries the full set, so no block
119
+ * inherits a stale `max-width`. The layout owns what it writes - an explicit `gap`, padding or
120
+ * `maxWidth` on the same element does not override it; rows take `rowGap`.
121
+ */
122
+ const layoutGridStyles = (theme, value, display = "grid") => layoutStyles(theme, value, [display, "frame"]);
123
+ const layoutParser = (part) => Object.assign((props) => layoutStyles(props.theme, props.layout, [part]), {
124
+ config: {},
125
+ propNames: ["layout"],
126
+ cache: {}
127
+ });
128
+ /**
129
+ * The `layout` prop as the page frame alone: the margin and, in fixed mode, the centred max
130
+ * width per breakpoint - no columns, and `display` is left alone. Compose it with `layoutGrid`
131
+ * or `layoutFlex` for the columns; {@link layoutGridStyles} writes both in a style function.
132
+ */
133
+ const layoutFrame = layoutParser("frame");
134
+ /** The `layout` prop's columns on a grid container: tracks, gutter, `--layout-*` variables. */
135
+ const layoutGrid = layoutParser("grid");
136
+ /** The `layout` prop's columns on a flex container: a wrapping row with the same gutter. */
137
+ const layoutFlex = layoutParser("flex");
138
+ const flexSpan = (n) => {
139
+ const columns = "var(--layout-columns)";
140
+ const gutter = "var(--layout-gutter)";
141
+ return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
142
+ };
143
+ /**
144
+ * The `span` prop: how many layout-grid columns an element takes. It writes both
145
+ * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
146
+ * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
147
+ * other's property. `span="full"` takes the whole row whatever the column count - in any grid,
148
+ * layout grid or not. Responsive like any prop: `span={{ xs: 'full', md: 6 }}`.
149
+ */
150
+ const span = system({ span: (n) => n === "full" ? {
151
+ gridColumn: "1 / -1",
152
+ flex: "0 0 100%"
153
+ } : {
154
+ gridColumn: `span ${n}`,
155
+ flex: flexSpan(n)
156
+ } });
157
+ //#endregion
158
+ export { span as a, layoutGridStyles as i, layoutFrame as n, grid as o, layoutGrid as r, layoutFlex as t };
@@ -45,49 +45,61 @@ const spaceValue = (theme, value) => {
45
45
  const resolved = require_core.get(theme, `space.${value}`, value);
46
46
  return typeof resolved === "number" ? `${resolved}px` : resolved;
47
47
  };
48
- const declarations = (theme, display, entry) => {
49
- const { columns, margin, gutter, mode, maxWidth } = entry;
50
- const isFixed = mode === "fixed";
48
+ const frameDeclarations = (theme, { margin, mode, maxWidth }) => {
49
+ const width = mode === "fixed" && maxWidth !== void 0 ? spaceValue(theme, maxWidth) : void 0;
50
+ return {
51
+ paddingInline: margin === void 0 ? void 0 : spaceValue(theme, margin),
52
+ maxWidth: width ?? "none",
53
+ marginInline: width === void 0 ? 0 : `max(0px, calc((100% - ${width}) / 2))`
54
+ };
55
+ };
56
+ const columnDeclarations = (theme, display, { columns, gutter }) => {
51
57
  const gap = gutter === void 0 ? void 0 : spaceValue(theme, gutter);
52
- const styles = {
58
+ return {
53
59
  "--layout-columns": columns,
54
60
  "--layout-gutter": gap,
55
61
  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
62
+ columnGap: gap
60
63
  };
64
+ };
65
+ const declarations = (theme, parts, entry) => {
66
+ const styles = Object.assign({}, ...parts.map((part) => part === "frame" ? frameDeclarations(theme, entry) : columnDeclarations(theme, part, entry)));
61
67
  return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
62
68
  };
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") => {
69
+ const DISPLAY = {
70
+ frame: {},
71
+ grid: { display: "grid" },
72
+ flex: {
73
+ display: "flex",
74
+ flexDirection: "row",
75
+ flexWrap: "wrap"
76
+ }
77
+ };
78
+ const layoutStyles = (theme, value, parts) => {
70
79
  if (!value) return {};
71
80
  const breakpoints = require_core.get(theme, "breakpoints", {});
72
81
  const layout = require_core.get(theme, "layout", {});
73
- const overrides = typeof value === "object" ? value : {};
82
+ const fields = typeof value === "object" ? Object.entries(value) : [];
83
+ const everywhere = Object.fromEntries(fields.filter(([, field]) => typeof field !== "object"));
84
+ const overrides = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
85
+ const hasEverywhere = Object.keys(everywhere).length > 0;
74
86
  const { keyed } = require_media.responsiveQueries(breakpoints);
75
- const styles = display === "grid" ? { display: "grid" } : {
76
- display: "flex",
77
- flexDirection: "row",
78
- flexWrap: "wrap"
79
- };
87
+ const styles = Object.assign({}, ...parts.map((part) => DISPLAY[part]));
80
88
  let themed = {};
81
89
  let overridden = false;
82
90
  for (const key of Object.keys(breakpoints)) {
83
91
  const layer = layout[key]?.content;
84
- const override = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
92
+ const named = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
93
+ const override = hasEverywhere || named ? {
94
+ ...everywhere,
95
+ ...named
96
+ } : void 0;
85
97
  themed = {
86
98
  ...themed,
87
99
  ...layer
88
100
  };
89
101
  if (layer || override || overridden) {
90
- const block = declarations(theme, display, {
102
+ const block = declarations(theme, parts, {
91
103
  ...themed,
92
104
  ...override
93
105
  });
@@ -99,30 +111,50 @@ const layoutGridStyles = (theme, value, display = "grid") => {
99
111
  }
100
112
  return styles;
101
113
  };
102
- const layoutParser = (display) => Object.assign((props) => layoutGridStyles(props.theme, props.layout, display), {
114
+ /**
115
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
116
+ * margin, gutter, fluid or fixed), inherited mobile-first. A field in `value` replaces the
117
+ * theme's at every breakpoint (`{ gutter: 8 }`); an entry under a breakpoint name replaces it
118
+ * there only, on top of those fields (`{ gutter: 8, md: { columns: 6 } }`), and the next
119
+ * breakpoint is back to the theme. Every written block carries the full set, so no block
120
+ * inherits a stale `max-width`. The layout owns what it writes - an explicit `gap`, padding or
121
+ * `maxWidth` on the same element does not override it; rows take `rowGap`.
122
+ */
123
+ const layoutGridStyles = (theme, value, display = "grid") => layoutStyles(theme, value, [display, "frame"]);
124
+ const layoutParser = (part) => Object.assign((props) => layoutStyles(props.theme, props.layout, [part]), {
103
125
  config: {},
104
126
  propNames: ["layout"],
105
127
  cache: {}
106
128
  });
107
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
129
+ /**
130
+ * The `layout` prop as the page frame alone: the margin and, in fixed mode, the centred max
131
+ * width per breakpoint - no columns, and `display` is left alone. Compose it with `layoutGrid`
132
+ * or `layoutFlex` for the columns; {@link layoutGridStyles} writes both in a style function.
133
+ */
134
+ const layoutFrame = layoutParser("frame");
135
+ /** The `layout` prop's columns on a grid container: tracks, gutter, `--layout-*` variables. */
108
136
  const layoutGrid = layoutParser("grid");
109
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
137
+ /** The `layout` prop's columns on a flex container: a wrapping row with the same gutter. */
110
138
  const layoutFlex = layoutParser("flex");
111
139
  const flexSpan = (n) => {
112
- const columns = "var(--layout-columns, 1)";
113
- const gutter = "var(--layout-gutter, 0px)";
140
+ const columns = "var(--layout-columns)";
141
+ const gutter = "var(--layout-gutter)";
114
142
  return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
115
143
  };
116
144
  /**
117
145
  * The `span` prop: how many layout-grid columns an element takes. It writes both
118
146
  * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
119
147
  * `--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 }}`.
148
+ * other's property. `span="full"` takes the whole row whatever the column count - in any grid,
149
+ * layout grid or not. Responsive like any prop: `span={{ xs: 'full', md: 6 }}`.
121
150
  */
122
- const span = require_core.system({ span: (n) => ({
151
+ const span = require_core.system({ span: (n) => n === "full" ? {
152
+ gridColumn: "1 / -1",
153
+ flex: "0 0 100%"
154
+ } : {
123
155
  gridColumn: `span ${n}`,
124
156
  flex: flexSpan(n)
125
- }) });
157
+ } });
126
158
  //#endregion
127
159
  Object.defineProperty(exports, "grid", {
128
160
  enumerable: true,
@@ -136,6 +168,12 @@ Object.defineProperty(exports, "layoutFlex", {
136
168
  return layoutFlex;
137
169
  }
138
170
  });
171
+ Object.defineProperty(exports, "layoutFrame", {
172
+ enumerable: true,
173
+ get: function() {
174
+ return layoutFrame;
175
+ }
176
+ });
139
177
  Object.defineProperty(exports, "layoutGrid", {
140
178
  enumerable: true,
141
179
  get: function() {
package/dist/grid.cjs CHANGED
@@ -2,10 +2,11 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_grid = require("./grid-BlMUPDJM.cjs");
5
+ const require_grid = require("./grid-Cv-XGWcr.cjs");
6
6
  exports.default = require_grid.grid;
7
7
  exports.grid = require_grid.grid;
8
8
  exports.layoutFlex = require_grid.layoutFlex;
9
+ exports.layoutFrame = require_grid.layoutFrame;
9
10
  exports.layoutGrid = require_grid.layoutGrid;
10
11
  exports.layoutGridStyles = require_grid.layoutGridStyles;
11
12
  exports.span = require_grid.span;
package/dist/grid.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as GridTemplateRowsProps, G as GridColumnGapProps, H as GridAutoColumnsProps, J as GridProps, K as GridColumnProps, Ot as SpanProps, Q as GridTemplateColumnsProps, U as GridAutoFlowProps, V as GridAreaProps, W as GridAutoRowsProps, X as GridRowProps, Y as GridRowGapProps, Z as GridTemplateAreasProps, it as LayoutGridProps, q as GridGapProps } from "./types-Cv5WjcVA.cjs";
2
- import { a as layoutGrid, c as grid, i as layoutFlex, n as LayoutGridEntry, o as layoutGridStyles, r as LayoutGridValue, s as span, t as LayoutGridDisplay } from "./index-CXK27dY_.cjs";
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, LayoutGridDisplay, LayoutGridEntry, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, layoutFlex, layoutGrid, layoutGridStyles, span };
1
+ import { $ as GridTemplateRowsProps, G as GridColumnGapProps, H as GridAutoColumnsProps, J as GridProps, K as GridColumnProps, Q as GridTemplateColumnsProps, U as GridAutoFlowProps, V as GridAreaProps, W as GridAutoRowsProps, X as GridRowProps, Y as GridRowGapProps, Z as GridTemplateAreasProps, at as LayoutGridProps, it as LayoutFrameProps, kt as SpanProps, q as GridGapProps } from "./types-Cj6Jx5LX.cjs";
2
+ import { a as layoutFrame, c as span, i as layoutFlex, l as grid, n as LayoutGridEntry, o as layoutGrid, r as LayoutGridValue, s as layoutGridStyles, t as LayoutGridDisplay } from "./index-DHAamdKa.cjs";
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, type LayoutFrameProps, LayoutGridDisplay, LayoutGridEntry, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, layoutFlex, layoutFrame, layoutGrid, layoutGridStyles, span };
package/dist/grid.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as GridTemplateRowsProps, G as GridColumnGapProps, H as GridAutoColumnsProps, J as GridProps, K as GridColumnProps, Ot as SpanProps, Q as GridTemplateColumnsProps, U as GridAutoFlowProps, V as GridAreaProps, W as GridAutoRowsProps, X as GridRowProps, Y as GridRowGapProps, Z as GridTemplateAreasProps, it as LayoutGridProps, q as GridGapProps } from "./types-Cv5WjcVA.mjs";
2
- import { a as layoutGrid, c as grid, i as layoutFlex, n as LayoutGridEntry, o as layoutGridStyles, r as LayoutGridValue, s as span, t as LayoutGridDisplay } from "./index-D7IZ8-Zq.mjs";
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, LayoutGridDisplay, LayoutGridEntry, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, layoutFlex, layoutGrid, layoutGridStyles, span };
1
+ import { $ as GridTemplateRowsProps, G as GridColumnGapProps, H as GridAutoColumnsProps, J as GridProps, K as GridColumnProps, Q as GridTemplateColumnsProps, U as GridAutoFlowProps, V as GridAreaProps, W as GridAutoRowsProps, X as GridRowProps, Y as GridRowGapProps, Z as GridTemplateAreasProps, at as LayoutGridProps, it as LayoutFrameProps, kt as SpanProps, q as GridGapProps } from "./types-Cj6Jx5LX.mjs";
2
+ import { a as layoutFrame, c as span, i as layoutFlex, l as grid, n as LayoutGridEntry, o as layoutGrid, r as LayoutGridValue, s as layoutGridStyles, t as LayoutGridDisplay } from "./index-C0X-fL6a.mjs";
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, type LayoutFrameProps, LayoutGridDisplay, LayoutGridEntry, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, layoutFlex, layoutFrame, layoutGrid, layoutGridStyles, span };
package/dist/grid.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as grid, i as span, n as layoutGrid, r as layoutGridStyles, t as layoutFlex } from "./grid-CYjL4-gb.mjs";
2
- export { grid as default, grid, layoutFlex, layoutGrid, layoutGridStyles, span };
1
+ import { a as span, i as layoutGridStyles, n as layoutFrame, o as grid, r as layoutGrid, t as layoutFlex } from "./grid-CAuvylKs.mjs";
2
+ export { grid as default, grid, layoutFlex, layoutFrame, layoutGrid, layoutGridStyles, span };
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
3
  //#region src/variant/variant.d.ts
4
4
  interface VariantOptions {
5
5
  scale?: string;
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-Cv5WjcVA.cjs";
2
+ import "./types-Cj6Jx5LX.cjs";
3
3
  //#region src/variant/variant.d.ts
4
4
  interface VariantOptions {
5
5
  scale?: string;
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
3
  //#region src/border/border.d.ts
4
4
  declare const border: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
3
  //#region src/space/space.d.ts
4
4
  declare const margin: Parser;
5
5
  declare const padding: Parser;
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
3
  //#region src/typography/typography.d.ts
4
4
  declare const typography: Parser;
5
5
  //#endregion
@@ -0,0 +1,55 @@
1
+ import { a as Parser, l as StyleObject } from "./index-IulNhyDt.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
+ //#region src/grid/grid.d.ts
4
+ declare const grid: Parser;
5
+ //#endregion
6
+ //#region src/grid/layoutGrid.d.ts
7
+ /** The layout grid at one breakpoint - the `content` part of a `theme.layout` entry. */
8
+ interface LayoutGridEntry {
9
+ /** Equal columns. */
10
+ columns?: number;
11
+ /** Inline padding - a `theme.space` key or a CSS length. */
12
+ margin?: string | number;
13
+ /** Gap between columns - a `theme.space` key or a CSS length. */
14
+ gutter?: string | number;
15
+ /** `fluid` spans the space; `fixed` is a container centred at `maxWidth`. */
16
+ mode?: 'fluid' | 'fixed';
17
+ maxWidth?: string | number;
18
+ }
19
+ /**
20
+ * `true` for the theme's layout grid, or an entry: its fields replace the theme's at every
21
+ * breakpoint, and entries under breakpoint names replace it at that breakpoint only.
22
+ */
23
+ type LayoutGridValue = boolean | Record<string, LayoutGridEntry | LayoutGridEntry[keyof LayoutGridEntry]>;
24
+ /** The container a layout grid is drawn on: column tracks, or a wrapping flex row. */
25
+ type LayoutGridDisplay = 'grid' | 'flex';
26
+ /**
27
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
28
+ * margin, gutter, fluid or fixed), inherited mobile-first. A field in `value` replaces the
29
+ * theme's at every breakpoint (`{ gutter: 8 }`); an entry under a breakpoint name replaces it
30
+ * there only, on top of those fields (`{ gutter: 8, md: { columns: 6 } }`), and the next
31
+ * breakpoint is back to the theme. Every written block carries the full set, so no block
32
+ * inherits a stale `max-width`. The layout owns what it writes - an explicit `gap`, padding or
33
+ * `maxWidth` on the same element does not override it; rows take `rowGap`.
34
+ */
35
+ declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, display?: LayoutGridDisplay) => StyleObject;
36
+ /**
37
+ * The `layout` prop as the page frame alone: the margin and, in fixed mode, the centred max
38
+ * width per breakpoint - no columns, and `display` is left alone. Compose it with `layoutGrid`
39
+ * or `layoutFlex` for the columns; {@link layoutGridStyles} writes both in a style function.
40
+ */
41
+ declare const layoutFrame: Parser;
42
+ /** The `layout` prop's columns on a grid container: tracks, gutter, `--layout-*` variables. */
43
+ declare const layoutGrid: Parser;
44
+ /** The `layout` prop's columns on a flex container: a wrapping row with the same gutter. */
45
+ declare const layoutFlex: Parser;
46
+ /**
47
+ * The `span` prop: how many layout-grid columns an element takes. It writes both
48
+ * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
49
+ * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
50
+ * other's property. `span="full"` takes the whole row whatever the column count - in any grid,
51
+ * layout grid or not. Responsive like any prop: `span={{ xs: 'full', md: 6 }}`.
52
+ */
53
+ declare const span: Parser;
54
+ //#endregion
55
+ export { layoutFrame as a, span as c, layoutFlex as i, grid as l, LayoutGridEntry as n, layoutGrid as o, LayoutGridValue as r, layoutGridStyles as s, LayoutGridDisplay as t };
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-Cv5WjcVA.cjs";
2
+ import "./types-Cj6Jx5LX.cjs";
3
3
  //#region src/border/border.d.ts
4
4
  declare const border: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-Cv5WjcVA.cjs";
2
+ import "./types-Cj6Jx5LX.cjs";
3
3
  //#region src/layout/layout.d.ts
4
4
  declare const layout: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.mjs";
2
+ import "./types-Cj6Jx5LX.mjs";
3
3
  //#region src/shadow/shadow.d.ts
4
4
  declare const shadow: Parser;
5
5
  //#endregion