@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,135 +0,0 @@
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 };
@@ -1,165 +0,0 @@
1
- const require_media = require("./media-DSJdRy_k.cjs");
2
- const require_core = require("./core.cjs");
3
- //#region src/grid/grid.ts
4
- const spaceScale = [
5
- 0,
6
- 4,
7
- 8,
8
- 16,
9
- 32,
10
- 64,
11
- 128,
12
- 256,
13
- 512
14
- ];
15
- const config = {
16
- gridGap: {
17
- property: "gridGap",
18
- scale: "space",
19
- defaultScale: spaceScale
20
- },
21
- gridColumnGap: {
22
- property: "gridColumnGap",
23
- scale: "space",
24
- defaultScale: spaceScale
25
- },
26
- gridRowGap: {
27
- property: "gridRowGap",
28
- scale: "space",
29
- defaultScale: spaceScale
30
- },
31
- gridColumn: true,
32
- gridRow: true,
33
- gridAutoFlow: true,
34
- gridAutoColumns: true,
35
- gridAutoRows: true,
36
- gridTemplateColumns: true,
37
- gridTemplateRows: true,
38
- gridTemplateAreas: true,
39
- gridArea: true
40
- };
41
- const grid = require_core.system(config);
42
- //#endregion
43
- //#region src/grid/layoutGrid.ts
44
- const spaceValue = (theme, value) => {
45
- const resolved = require_core.get(theme, `space.${value}`, value);
46
- return typeof resolved === "number" ? `${resolved}px` : resolved;
47
- };
48
- const declarations = (theme, display, entry) => {
49
- const { columns, margin, gutter, mode, maxWidth } = entry;
50
- const isFixed = mode === "fixed";
51
- const gap = gutter === void 0 ? void 0 : spaceValue(theme, gutter);
52
- const styles = {
53
- "--layout-columns": columns,
54
- "--layout-gutter": gap,
55
- gridTemplateColumns: display === "grid" && columns !== void 0 ? `repeat(${columns}, minmax(0, 1fr))` : void 0,
56
- columnGap: gap,
57
- paddingInline: margin === void 0 ? void 0 : spaceValue(theme, margin),
58
- maxWidth: isFixed && maxWidth !== void 0 ? spaceValue(theme, maxWidth) : "none",
59
- marginInline: isFixed ? "auto" : 0
60
- };
61
- return Object.fromEntries(Object.entries(styles).filter(([, value]) => value !== void 0));
62
- };
63
- /**
64
- * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
65
- * margin, gutter, fluid or fixed), inherited mobile-first. A field in `value` replaces the
66
- * theme's at every breakpoint (`{ gutter: 8 }`); an entry under a breakpoint name replaces it
67
- * there only, on top of those fields (`{ gutter: 8, md: { columns: 6 } }`), and the next
68
- * breakpoint is back to the theme. Every written block carries the full set, so no block
69
- * inherits a stale `max-width`.
70
- */
71
- const layoutGridStyles = (theme, value, display = "grid") => {
72
- if (!value) return {};
73
- const breakpoints = require_core.get(theme, "breakpoints", {});
74
- const layout = require_core.get(theme, "layout", {});
75
- const fields = typeof value === "object" ? Object.entries(value) : [];
76
- const everywhere = Object.fromEntries(fields.filter(([, field]) => typeof field !== "object"));
77
- const overrides = Object.fromEntries(fields.filter(([, field]) => typeof field === "object"));
78
- const hasEverywhere = Object.keys(everywhere).length > 0;
79
- const { keyed } = require_media.responsiveQueries(breakpoints);
80
- const styles = display === "grid" ? { display: "grid" } : {
81
- display: "flex",
82
- flexDirection: "row",
83
- flexWrap: "wrap"
84
- };
85
- let themed = {};
86
- let overridden = false;
87
- for (const key of Object.keys(breakpoints)) {
88
- const layer = layout[key]?.content;
89
- const named = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
90
- const override = hasEverywhere || named ? {
91
- ...everywhere,
92
- ...named
93
- } : void 0;
94
- themed = {
95
- ...themed,
96
- ...layer
97
- };
98
- if (layer || override || overridden) {
99
- const block = declarations(theme, display, {
100
- ...themed,
101
- ...override
102
- });
103
- const media = keyed.get(key);
104
- if (media) styles[media] = block;
105
- else Object.assign(styles, block);
106
- }
107
- overridden = override !== void 0;
108
- }
109
- return styles;
110
- };
111
- const layoutParser = (display) => Object.assign((props) => layoutGridStyles(props.theme, props.layout, display), {
112
- config: {},
113
- propNames: ["layout"],
114
- cache: {}
115
- });
116
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
117
- const layoutGrid = layoutParser("grid");
118
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
119
- const layoutFlex = layoutParser("flex");
120
- const flexSpan = (n) => {
121
- const columns = "var(--layout-columns)";
122
- const gutter = "var(--layout-gutter)";
123
- return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
124
- };
125
- /**
126
- * The `span` prop: how many layout-grid columns an element takes. It writes both
127
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
128
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
129
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
130
- */
131
- const span = require_core.system({ span: (n) => ({
132
- gridColumn: `span ${n}`,
133
- flex: flexSpan(n)
134
- }) });
135
- //#endregion
136
- Object.defineProperty(exports, "grid", {
137
- enumerable: true,
138
- get: function() {
139
- return grid;
140
- }
141
- });
142
- Object.defineProperty(exports, "layoutFlex", {
143
- enumerable: true,
144
- get: function() {
145
- return layoutFlex;
146
- }
147
- });
148
- Object.defineProperty(exports, "layoutGrid", {
149
- enumerable: true,
150
- get: function() {
151
- return layoutGrid;
152
- }
153
- });
154
- Object.defineProperty(exports, "layoutGridStyles", {
155
- enumerable: true,
156
- get: function() {
157
- return layoutGridStyles;
158
- }
159
- });
160
- Object.defineProperty(exports, "span", {
161
- enumerable: true,
162
- get: function() {
163
- return span;
164
- }
165
- });
@@ -1,47 +0,0 @@
1
- import { a as Parser, l as StyleObject } from "./index-IulNhyDt.mjs";
2
- import "./types-C4ogGxde.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`.
33
- */
34
- declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, display?: LayoutGridDisplay) => StyleObject;
35
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
36
- declare const layoutGrid: Parser;
37
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
38
- declare const layoutFlex: Parser;
39
- /**
40
- * The `span` prop: how many layout-grid columns an element takes. It writes both
41
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
42
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
43
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
44
- */
45
- declare const span: Parser;
46
- //#endregion
47
- export { layoutGrid as a, grid as c, layoutFlex as i, LayoutGridEntry as n, layoutGridStyles as o, LayoutGridValue as r, span as s, LayoutGridDisplay as t };
@@ -1,47 +0,0 @@
1
- import { a as Parser, l as StyleObject } from "./index-iVqAMF2L.cjs";
2
- import "./types-C4ogGxde.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. */
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`.
33
- */
34
- declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, display?: LayoutGridDisplay) => StyleObject;
35
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
36
- declare const layoutGrid: Parser;
37
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
38
- declare const layoutFlex: Parser;
39
- /**
40
- * The `span` prop: how many layout-grid columns an element takes. It writes both
41
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
42
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
43
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
44
- */
45
- declare const span: Parser;
46
- //#endregion
47
- export { layoutGrid as a, grid as c, layoutFlex as i, LayoutGridEntry as n, layoutGridStyles as o, LayoutGridValue as r, span as s, LayoutGridDisplay as t };