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

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 (67) 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/flexbox.d.cts +2 -2
  8. package/dist/flexbox.d.mts +2 -2
  9. package/dist/grid-CvJv0uga.cjs +198 -0
  10. package/dist/grid-Du9HrjII.mjs +168 -0
  11. package/dist/grid.cjs +2 -2
  12. package/dist/grid.d.cts +3 -3
  13. package/dist/grid.d.mts +3 -3
  14. package/dist/grid.mjs +2 -2
  15. package/dist/{index-Cnya5hgU.d.mts → index--7PfXEZf.d.mts} +1 -1
  16. package/dist/{index-BgcnUGws.d.cts → index-BDUZ7qQu.d.cts} +1 -1
  17. package/dist/{index-CkSwZa-Z.d.mts → index-BQUTi5eL.d.mts} +1 -1
  18. package/dist/{index-BiZPbJuj.d.mts → index-BTZ4J3Ql.d.mts} +1 -1
  19. package/dist/{index-CXOIz3b_.d.cts → index-BUX09rTq.d.cts} +1 -1
  20. package/dist/{index-C4BUuCOD.d.cts → index-BUa_KRfs.d.cts} +1 -1
  21. package/dist/{index-DJw2NCm-.d.cts → index-BVNmdtmk.d.cts} +1 -1
  22. package/dist/index-BZI1xwTA.d.cts +55 -0
  23. package/dist/{index-BCO1q3Ee.d.mts → index-BZs9fI-P.d.mts} +1 -1
  24. package/dist/{index-DBX-YuCP.d.mts → index-Bhpc-68J.d.mts} +1 -1
  25. package/dist/{index-BolQQ69W.d.cts → index-BqZjtkzF.d.cts} +1 -1
  26. package/dist/{index-Bq7LA-5J.d.cts → index-C56_VCbD.d.cts} +1 -1
  27. package/dist/{index-o6j0bywN.d.cts → index-DGGFii8s.d.cts} +1 -1
  28. package/dist/{index-z2p2DCxL.d.mts → index-DXURX22V.d.mts} +1 -1
  29. package/dist/{index-Cow4kTN2.d.mts → index-DYc5_RYF.d.mts} +1 -1
  30. package/dist/{index-k5b5FR_o.d.mts → index-D_XDxNlm.d.mts} +1 -1
  31. package/dist/{index-DS5tvdki.d.cts → index-Di8gHXKt.d.cts} +1 -1
  32. package/dist/{index-CV2xW58U.d.mts → index-Dr5JeEjc.d.mts} +1 -1
  33. package/dist/{index-ygAGm7QY.d.cts → index-Dv3K2IAS.d.cts} +1 -1
  34. package/dist/{index-MqRHkwxm.d.cts → index-DwJSd01p.d.cts} +1 -1
  35. package/dist/index-Np-KvYhu.d.mts +55 -0
  36. package/dist/{index-CVxHdrQd.d.mts → index-mSyoGVmz.d.mts} +1 -1
  37. package/dist/index.cjs +2 -2
  38. package/dist/index.d.cts +13 -13
  39. package/dist/index.d.mts +13 -13
  40. package/dist/index.mjs +2 -2
  41. package/dist/layout.d.cts +2 -2
  42. package/dist/layout.d.mts +2 -2
  43. package/dist/position.d.cts +2 -2
  44. package/dist/position.d.mts +2 -2
  45. package/dist/{presets-DtE_nRxp.mjs → presets-Cxa2Xoxa.mjs} +1 -1
  46. package/dist/{presets-fJFZ74qt.cjs → presets-mePesdYM.cjs} +1 -1
  47. package/dist/prop-types.cjs +1 -1
  48. package/dist/prop-types.mjs +1 -1
  49. package/dist/props.cjs +1 -1
  50. package/dist/props.mjs +1 -1
  51. package/dist/shadow.d.cts +2 -2
  52. package/dist/shadow.d.mts +2 -2
  53. package/dist/should-forward-prop.cjs +1 -1
  54. package/dist/should-forward-prop.mjs +1 -1
  55. package/dist/space.d.cts +2 -2
  56. package/dist/space.d.mts +2 -2
  57. package/dist/{types-C4ogGxde.d.cts → types-Cl2haWqC.d.cts} +22 -9
  58. package/dist/{types-C4ogGxde.d.mts → types-Cl2haWqC.d.mts} +22 -9
  59. package/dist/typography.d.cts +2 -2
  60. package/dist/typography.d.mts +2 -2
  61. package/dist/variant.d.cts +2 -2
  62. package/dist/variant.d.mts +2 -2
  63. package/package.json +1 -1
  64. package/dist/grid-BdKZQBHF.mjs +0 -135
  65. package/dist/grid-CAlwl8LZ.cjs +0 -165
  66. package/dist/index-Cy51GZK8.d.mts +0 -47
  67. package/dist/index-DrwsZZkS.d.cts +0 -47
@@ -1,3 +1,3 @@
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";
1
+ import { t as background } from "./index-Di8gHXKt.cjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cl2haWqC.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-CVxHdrQd.mjs";
2
- import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-C4ogGxde.mjs";
1
+ import { t as background } from "./index-mSyoGVmz.mjs";
2
+ import { c as BackgroundProps, l as BackgroundRepeatProps, o as BackgroundImageProps, s as BackgroundPositionProps, u as BackgroundSizeProps } from "./types-Cl2haWqC.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-C4ogGxde.cjs";
2
- import { t as border } from "./index-BolQQ69W.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-Cl2haWqC.cjs";
2
+ import { t as border } from "./index-BqZjtkzF.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-C4ogGxde.mjs";
2
- import { t as border } from "./index-z2p2DCxL.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-Cl2haWqC.mjs";
2
+ import { t as border } from "./index-DXURX22V.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-C4ogGxde.cjs";
2
- import { t as color } from "./index-MqRHkwxm.cjs";
1
+ import { Nt as TextColorProps, a as BackgroundColorProps, gt as OpacityProps, w as ColorProps } from "./types-Cl2haWqC.cjs";
2
+ import { t as color } from "./index-DwJSd01p.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-C4ogGxde.mjs";
2
- import { t as color } from "./index-BiZPbJuj.mjs";
1
+ import { Nt as TextColorProps, a as BackgroundColorProps, gt as OpacityProps, w as ColorProps } from "./types-Cl2haWqC.mjs";
2
+ import { t as color } from "./index-BTZ4J3Ql.mjs";
3
3
  export { type BackgroundColorProps, type ColorProps, type OpacityProps, type TextColorProps, color, color as default };
@@ -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-C4ogGxde.cjs";
2
- import { t as flexbox } from "./index-CXOIz3b_.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-Cl2haWqC.cjs";
2
+ import { t as flexbox } from "./index-BUX09rTq.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-C4ogGxde.mjs";
2
- import { t as flexbox } from "./index-BCO1q3Ee.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-Cl2haWqC.mjs";
2
+ import { t as flexbox } from "./index-BZs9fI-P.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,198 @@
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 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 gridDeclarations = (theme, { columns, gutter }) => ({
57
+ gridTemplateColumns: columns === void 0 ? void 0 : `repeat(${columns}, minmax(0, 1fr))`,
58
+ columnGap: gutter === void 0 ? void 0 : spaceValue(theme, gutter)
59
+ });
60
+ const declarations = (theme, part, entry) => {
61
+ const styles = part === "frame" ? frameDeclarations(theme, entry) : gridDeclarations(theme, entry);
62
+ return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
63
+ };
64
+ const gapAsGutter = (breakpoints, gap) => {
65
+ if (gap === void 0 || gap === null) return {
66
+ field: {},
67
+ entries: {}
68
+ };
69
+ if (typeof gap !== "object") return {
70
+ field: { gutter: gap },
71
+ entries: {}
72
+ };
73
+ const names = Object.keys(breakpoints);
74
+ const pairs = Array.isArray(gap) ? gap.map((value, index) => [names[index], value]) : Object.entries(gap);
75
+ const entries = {};
76
+ for (const [name, value] of pairs) if (name !== void 0 && value !== null) entries[name] = { gutter: value };
77
+ return {
78
+ field: {},
79
+ entries
80
+ };
81
+ };
82
+ const layoutStyles = (theme, value, part, gap) => {
83
+ if (!value) return {};
84
+ const breakpoints = require_core.get(theme, "breakpoints", {});
85
+ const layout = require_core.get(theme, "layout", {});
86
+ const fields = typeof value === "object" ? Object.entries(value) : [];
87
+ const named = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
88
+ const fromGap = gapAsGutter(breakpoints, gap);
89
+ const everywhere = {
90
+ ...Object.fromEntries(fields.filter(([, field]) => typeof field !== "object")),
91
+ ...fromGap.field
92
+ };
93
+ const hasEverywhere = Object.keys(everywhere).length > 0;
94
+ const { keyed } = require_media.responsiveQueries(breakpoints);
95
+ const styles = part === "grid" ? { display: "grid" } : {};
96
+ let themed = {};
97
+ let carried = {};
98
+ Object.keys(breakpoints).forEach((key, index) => {
99
+ const layer = layout[key]?.content;
100
+ const entry = Object.hasOwn(named, key) ? named[key] : void 0;
101
+ const gapEntry = Object.hasOwn(fromGap.entries, key) ? fromGap.entries[key] : void 0;
102
+ themed = {
103
+ ...themed,
104
+ ...layer
105
+ };
106
+ carried = {
107
+ ...carried,
108
+ ...entry,
109
+ ...gapEntry
110
+ };
111
+ if (layer || entry || gapEntry || index === 0 && hasEverywhere) {
112
+ const block = declarations(theme, part, {
113
+ ...themed,
114
+ ...everywhere,
115
+ ...carried
116
+ });
117
+ const media = keyed.get(key);
118
+ if (media) styles[media] = block;
119
+ else Object.assign(styles, block);
120
+ }
121
+ });
122
+ return styles;
123
+ };
124
+ /**
125
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
126
+ * margin, gutter, fluid or fixed), mobile-first. A field in `value` replaces the theme's at
127
+ * every breakpoint (`{ maxWidth: '1280px' }`); an entry under a breakpoint name replaces it
128
+ * from that breakpoint up, on top of those fields (`{ lg: { columns: 16 } }`). `gap` - the
129
+ * element's own `gap` / `columnGap` - sets the gutter the same way, single or responsive; where
130
+ * it is not set, the theme's gutter applies. Every written block carries the full set, so no
131
+ * block inherits a stale `max-width`. Rows take `rowGap` (or `gap`'s row half), never the layout.
132
+ */
133
+ const layoutGridStyles = (theme, value, gap) => {
134
+ const grid = layoutStyles(theme, value, "grid", gap);
135
+ const frame = layoutStyles(theme, value, "frame");
136
+ for (const [key, block] of Object.entries(frame)) grid[key] = key.startsWith("@") ? {
137
+ ...grid[key],
138
+ ...block
139
+ } : block;
140
+ return grid;
141
+ };
142
+ /**
143
+ * The `layout` prop as the page frame alone: the margin and, in fixed mode, the centred max
144
+ * width per breakpoint - no columns, and `display` is left alone. Every View-based component
145
+ * takes it; compose it with `layoutGrid` for the columns.
146
+ */
147
+ const layoutFrame = Object.assign((props) => layoutStyles(props.theme, props.layout, "frame"), {
148
+ config: {},
149
+ propNames: ["layout"],
150
+ cache: {}
151
+ });
152
+ /**
153
+ * The `layout` prop's columns on a grid container: the tracks and the gutter. The gutter is the
154
+ * element's own `columnGap` or `gap` where it sets one, the theme's elsewhere - so `column-gap`
155
+ * has a single source and an explicit gap is never silently replaced.
156
+ */
157
+ const layoutGrid = Object.assign((props) => layoutStyles(props.theme, props.layout, "grid", props.columnGap ?? props.gap), {
158
+ config: {},
159
+ propNames: ["layout"],
160
+ cache: {}
161
+ });
162
+ /**
163
+ * The `span` prop: how many columns of a grid an element takes - `grid-column: span N` - or
164
+ * `span="full"` for the whole row whatever the column count. Responsive like any prop:
165
+ * `span={{ xs: 'full', md: 6 }}`.
166
+ */
167
+ const span = require_core.system({ span: (n) => ({ gridColumn: n === "full" ? "1 / -1" : `span ${n}` }) });
168
+ //#endregion
169
+ Object.defineProperty(exports, "grid", {
170
+ enumerable: true,
171
+ get: function() {
172
+ return grid;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, "layoutFrame", {
176
+ enumerable: true,
177
+ get: function() {
178
+ return layoutFrame;
179
+ }
180
+ });
181
+ Object.defineProperty(exports, "layoutGrid", {
182
+ enumerable: true,
183
+ get: function() {
184
+ return layoutGrid;
185
+ }
186
+ });
187
+ Object.defineProperty(exports, "layoutGridStyles", {
188
+ enumerable: true,
189
+ get: function() {
190
+ return layoutGridStyles;
191
+ }
192
+ });
193
+ Object.defineProperty(exports, "span", {
194
+ enumerable: true,
195
+ get: function() {
196
+ return span;
197
+ }
198
+ });
@@ -0,0 +1,168 @@
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 gridDeclarations = (theme, { columns, gutter }) => ({
56
+ gridTemplateColumns: columns === void 0 ? void 0 : `repeat(${columns}, minmax(0, 1fr))`,
57
+ columnGap: gutter === void 0 ? void 0 : spaceValue(theme, gutter)
58
+ });
59
+ const declarations = (theme, part, entry) => {
60
+ const styles = part === "frame" ? frameDeclarations(theme, entry) : gridDeclarations(theme, entry);
61
+ return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
62
+ };
63
+ const gapAsGutter = (breakpoints, gap) => {
64
+ if (gap === void 0 || gap === null) return {
65
+ field: {},
66
+ entries: {}
67
+ };
68
+ if (typeof gap !== "object") return {
69
+ field: { gutter: gap },
70
+ entries: {}
71
+ };
72
+ const names = Object.keys(breakpoints);
73
+ const pairs = Array.isArray(gap) ? gap.map((value, index) => [names[index], value]) : Object.entries(gap);
74
+ const entries = {};
75
+ for (const [name, value] of pairs) if (name !== void 0 && value !== null) entries[name] = { gutter: value };
76
+ return {
77
+ field: {},
78
+ entries
79
+ };
80
+ };
81
+ const layoutStyles = (theme, value, part, gap) => {
82
+ if (!value) return {};
83
+ const breakpoints = get(theme, "breakpoints", {});
84
+ const layout = get(theme, "layout", {});
85
+ const fields = typeof value === "object" ? Object.entries(value) : [];
86
+ const named = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
87
+ const fromGap = gapAsGutter(breakpoints, gap);
88
+ const everywhere = {
89
+ ...Object.fromEntries(fields.filter(([, field]) => typeof field !== "object")),
90
+ ...fromGap.field
91
+ };
92
+ const hasEverywhere = Object.keys(everywhere).length > 0;
93
+ const { keyed } = responsiveQueries(breakpoints);
94
+ const styles = part === "grid" ? { display: "grid" } : {};
95
+ let themed = {};
96
+ let carried = {};
97
+ Object.keys(breakpoints).forEach((key, index) => {
98
+ const layer = layout[key]?.content;
99
+ const entry = Object.hasOwn(named, key) ? named[key] : void 0;
100
+ const gapEntry = Object.hasOwn(fromGap.entries, key) ? fromGap.entries[key] : void 0;
101
+ themed = {
102
+ ...themed,
103
+ ...layer
104
+ };
105
+ carried = {
106
+ ...carried,
107
+ ...entry,
108
+ ...gapEntry
109
+ };
110
+ if (layer || entry || gapEntry || index === 0 && hasEverywhere) {
111
+ const block = declarations(theme, part, {
112
+ ...themed,
113
+ ...everywhere,
114
+ ...carried
115
+ });
116
+ const media = keyed.get(key);
117
+ if (media) styles[media] = block;
118
+ else Object.assign(styles, block);
119
+ }
120
+ });
121
+ return styles;
122
+ };
123
+ /**
124
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
125
+ * margin, gutter, fluid or fixed), mobile-first. A field in `value` replaces the theme's at
126
+ * every breakpoint (`{ maxWidth: '1280px' }`); an entry under a breakpoint name replaces it
127
+ * from that breakpoint up, on top of those fields (`{ lg: { columns: 16 } }`). `gap` - the
128
+ * element's own `gap` / `columnGap` - sets the gutter the same way, single or responsive; where
129
+ * it is not set, the theme's gutter applies. Every written block carries the full set, so no
130
+ * block inherits a stale `max-width`. Rows take `rowGap` (or `gap`'s row half), never the layout.
131
+ */
132
+ const layoutGridStyles = (theme, value, gap) => {
133
+ const grid = layoutStyles(theme, value, "grid", gap);
134
+ const frame = layoutStyles(theme, value, "frame");
135
+ for (const [key, block] of Object.entries(frame)) grid[key] = key.startsWith("@") ? {
136
+ ...grid[key],
137
+ ...block
138
+ } : block;
139
+ return grid;
140
+ };
141
+ /**
142
+ * The `layout` prop as the page frame alone: the margin and, in fixed mode, the centred max
143
+ * width per breakpoint - no columns, and `display` is left alone. Every View-based component
144
+ * takes it; compose it with `layoutGrid` for the columns.
145
+ */
146
+ const layoutFrame = Object.assign((props) => layoutStyles(props.theme, props.layout, "frame"), {
147
+ config: {},
148
+ propNames: ["layout"],
149
+ cache: {}
150
+ });
151
+ /**
152
+ * The `layout` prop's columns on a grid container: the tracks and the gutter. The gutter is the
153
+ * element's own `columnGap` or `gap` where it sets one, the theme's elsewhere - so `column-gap`
154
+ * has a single source and an explicit gap is never silently replaced.
155
+ */
156
+ const layoutGrid = Object.assign((props) => layoutStyles(props.theme, props.layout, "grid", props.columnGap ?? props.gap), {
157
+ config: {},
158
+ propNames: ["layout"],
159
+ cache: {}
160
+ });
161
+ /**
162
+ * The `span` prop: how many columns of a grid an element takes - `grid-column: span N` - or
163
+ * `span="full"` for the whole row whatever the column count. Responsive like any prop:
164
+ * `span={{ xs: 'full', md: 6 }}`.
165
+ */
166
+ const span = system({ span: (n) => ({ gridColumn: n === "full" ? "1 / -1" : `span ${n}` }) });
167
+ //#endregion
168
+ export { grid as a, span as i, layoutGrid as n, layoutGridStyles as r, layoutFrame as t };
package/dist/grid.cjs CHANGED
@@ -2,10 +2,10 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_grid = require("./grid-CAlwl8LZ.cjs");
5
+ const require_grid = require("./grid-CvJv0uga.cjs");
6
6
  exports.default = require_grid.grid;
7
7
  exports.grid = require_grid.grid;
8
- exports.layoutFlex = require_grid.layoutFlex;
8
+ exports.layoutFrame = require_grid.layoutFrame;
9
9
  exports.layoutGrid = require_grid.layoutGrid;
10
10
  exports.layoutGridStyles = require_grid.layoutGridStyles;
11
11
  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-C4ogGxde.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-DrwsZZkS.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-Cl2haWqC.cjs";
2
+ import { a as layoutGrid, c as grid, i as layoutFrame, n as LayoutGridGap, o as layoutGridStyles, r as LayoutGridValue, s as span, t as LayoutGridEntry } from "./index-BZI1xwTA.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, LayoutGridEntry, LayoutGridGap, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, 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-C4ogGxde.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-Cy51GZK8.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-Cl2haWqC.mjs";
2
+ import { a as layoutGrid, c as grid, i as layoutFrame, n as LayoutGridGap, o as layoutGridStyles, r as LayoutGridValue, s as span, t as LayoutGridEntry } from "./index-Np-KvYhu.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, LayoutGridEntry, LayoutGridGap, type LayoutGridProps, LayoutGridValue, type SpanProps, grid as default, grid, 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-BdKZQBHF.mjs";
2
- export { grid as default, grid, layoutFlex, layoutGrid, layoutGridStyles, span };
1
+ import { a as grid, i as span, n as layoutGrid, r as layoutGridStyles, t as layoutFrame } from "./grid-Du9HrjII.mjs";
2
+ export { grid as default, grid, layoutFrame, layoutGrid, layoutGridStyles, span };
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
3
3
  //#region src/shadow/shadow.d.ts
4
4
  declare const shadow: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.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-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
3
3
  //#region src/typography/typography.d.ts
4
4
  declare const typography: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
3
3
  //#region src/color/color.d.ts
4
4
  declare const color: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.cjs";
3
3
  //#region src/flexbox/flexbox.d.ts
4
4
  declare const flexbox: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.cjs";
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-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.cjs";
3
3
  //#region src/position/position.d.ts
4
4
  declare const position: Parser;
5
5
  //#endregion
@@ -0,0 +1,55 @@
1
+ import { a as Parser, l as StyleObject } from "./index-iVqAMF2L.cjs";
2
+ import "./types-Cl2haWqC.cjs";
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. Set per element with `gap`. */
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 from that breakpoint up.
22
+ */
23
+ type LayoutGridValue = boolean | Record<string, LayoutGridEntry | LayoutGridEntry[keyof LayoutGridEntry]>;
24
+ /** A `gap` / `columnGap` value: one value, an array by breakpoint position, or an object by name. */
25
+ type LayoutGridGap = string | number | null | undefined | Array<string | number | null> | Record<string, string | number | null>;
26
+ /**
27
+ * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
28
+ * margin, gutter, fluid or fixed), mobile-first. A field in `value` replaces the theme's at
29
+ * every breakpoint (`{ maxWidth: '1280px' }`); an entry under a breakpoint name replaces it
30
+ * from that breakpoint up, on top of those fields (`{ lg: { columns: 16 } }`). `gap` - the
31
+ * element's own `gap` / `columnGap` - sets the gutter the same way, single or responsive; where
32
+ * it is not set, the theme's gutter applies. Every written block carries the full set, so no
33
+ * block inherits a stale `max-width`. Rows take `rowGap` (or `gap`'s row half), never the layout.
34
+ */
35
+ declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, gap?: LayoutGridGap) => 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. Every View-based component
39
+ * takes it; compose it with `layoutGrid` for the columns.
40
+ */
41
+ declare const layoutFrame: Parser;
42
+ /**
43
+ * The `layout` prop's columns on a grid container: the tracks and the gutter. The gutter is the
44
+ * element's own `columnGap` or `gap` where it sets one, the theme's elsewhere - so `column-gap`
45
+ * has a single source and an explicit gap is never silently replaced.
46
+ */
47
+ declare const layoutGrid: Parser;
48
+ /**
49
+ * The `span` prop: how many columns of a grid an element takes - `grid-column: span N` - or
50
+ * `span="full"` for the whole row whatever the column count. Responsive like any prop:
51
+ * `span={{ xs: 'full', md: 6 }}`.
52
+ */
53
+ declare const span: Parser;
54
+ //#endregion
55
+ export { layoutGrid as a, grid as c, layoutFrame as i, LayoutGridGap as n, layoutGridStyles as o, LayoutGridValue as r, span as s, LayoutGridEntry as t };
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
3
3
  //#region src/flexbox/flexbox.d.ts
4
4
  declare const flexbox: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
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-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.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-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.cjs";
3
3
  //#region src/typography/typography.d.ts
4
4
  declare const typography: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.cjs";
2
+ import "./types-Cl2haWqC.cjs";
3
3
  //#region src/shadow/shadow.d.ts
4
4
  declare const shadow: Parser;
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { a as Parser } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.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-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.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-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.mjs";
2
+ import "./types-Cl2haWqC.mjs";
3
3
  //#region src/space/space.d.ts
4
4
  declare const margin: Parser;
5
5
  declare const padding: Parser;