@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 { Gt as TypographyProps, I as FontFamilyProps, L as FontSizeProps, R as FontStyleProps, Rt as TextOverflowProps, ct as LineHeightProps, jt as TextAlignProps, qt as WhiteSpaceProps, st as LetterSpacingProps, z as FontWeightProps } from "./types-Cv5WjcVA.cjs";
2
- import { t as typography } from "./index-BmyL5qR7.cjs";
1
+ import { I as FontFamilyProps, Jt as WhiteSpaceProps, Kt as TypographyProps, L as FontSizeProps, Mt as TextAlignProps, R as FontStyleProps, ct as LetterSpacingProps, lt as LineHeightProps, z as FontWeightProps, zt as TextOverflowProps } from "./types-Cj6Jx5LX.cjs";
2
+ import { t as typography } from "./index-PoT1oV9X.cjs";
3
3
  export { type FontFamilyProps, type FontSizeProps, type FontStyleProps, type FontWeightProps, type LetterSpacingProps, type LineHeightProps, type TextAlignProps, type TextOverflowProps, type TypographyProps, type WhiteSpaceProps, typography as default, typography };
@@ -1,3 +1,3 @@
1
- import { Gt as TypographyProps, I as FontFamilyProps, L as FontSizeProps, R as FontStyleProps, Rt as TextOverflowProps, ct as LineHeightProps, jt as TextAlignProps, qt as WhiteSpaceProps, st as LetterSpacingProps, z as FontWeightProps } from "./types-Cv5WjcVA.mjs";
2
- import { t as typography } from "./index-nfjmLzHF.mjs";
1
+ import { I as FontFamilyProps, Jt as WhiteSpaceProps, Kt as TypographyProps, L as FontSizeProps, Mt as TextAlignProps, R as FontStyleProps, ct as LetterSpacingProps, lt as LineHeightProps, z as FontWeightProps, zt as TextOverflowProps } from "./types-Cj6Jx5LX.mjs";
2
+ import { t as typography } from "./index-BvyUTPw5.mjs";
3
3
  export { type FontFamilyProps, type FontSizeProps, type FontStyleProps, type FontWeightProps, type LetterSpacingProps, type LineHeightProps, type TextAlignProps, type TextOverflowProps, type TypographyProps, type WhiteSpaceProps, typography as default, typography };
@@ -1,3 +1,3 @@
1
- import { Bt as TextStyleProps, C as ButtonStyleProps, T as ColorStyleProps } from "./types-Cv5WjcVA.cjs";
2
- import { a as textStyle, i as colorStyle, n as VariantOptions, o as variant, r as buttonStyle, t as VariantArgs } from "./index-Csbxj8Yo.cjs";
1
+ import { C as ButtonStyleProps, T as ColorStyleProps, Vt as TextStyleProps } from "./types-Cj6Jx5LX.cjs";
2
+ import { a as textStyle, i as colorStyle, n as VariantOptions, o as variant, r as buttonStyle, t as VariantArgs } from "./index-B7YL_4tg.cjs";
3
3
  export { type ButtonStyleProps, type ColorStyleProps, type TextStyleProps, VariantArgs, VariantOptions, buttonStyle, colorStyle, variant as default, variant, textStyle };
@@ -1,3 +1,3 @@
1
- import { Bt as TextStyleProps, C as ButtonStyleProps, T as ColorStyleProps } from "./types-Cv5WjcVA.mjs";
2
- import { a as textStyle, i as colorStyle, n as VariantOptions, o as variant, r as buttonStyle, t as VariantArgs } from "./index-ClbGlQxq.mjs";
1
+ import { C as ButtonStyleProps, T as ColorStyleProps, Vt as TextStyleProps } from "./types-Cj6Jx5LX.mjs";
2
+ import { a as textStyle, i as colorStyle, n as VariantOptions, o as variant, r as buttonStyle, t as VariantArgs } from "./index-4_E8pg8R.mjs";
3
3
  export { type ButtonStyleProps, type ColorStyleProps, type TextStyleProps, VariantArgs, VariantOptions, buttonStyle, colorStyle, variant as default, variant, textStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soroush.tech/styled-system",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-alpha.2",
4
4
  "description": "Maintained, first-class-TypeScript rewrite of styled-system - responsive, theme-aware style props for CSS-in-JS. Drop-in replacement for styled-system v5.",
5
5
  "keywords": [
6
6
  "styled-system",
@@ -1,126 +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. An entry in `value` replaces the
65
- * theme's at the breakpoint it names only; the next breakpoint is back to the theme. Every
66
- * written block carries the full set, so no block inherits a stale `max-width`.
67
- */
68
- const layoutGridStyles = (theme, value, display = "grid") => {
69
- if (!value) return {};
70
- const breakpoints = get(theme, "breakpoints", {});
71
- const layout = get(theme, "layout", {});
72
- const overrides = typeof value === "object" ? value : {};
73
- const { keyed } = responsiveQueries(breakpoints);
74
- const styles = display === "grid" ? { display: "grid" } : {
75
- display: "flex",
76
- flexDirection: "row",
77
- flexWrap: "wrap"
78
- };
79
- let themed = {};
80
- let overridden = false;
81
- for (const key of Object.keys(breakpoints)) {
82
- const layer = layout[key]?.content;
83
- const override = Object.hasOwn(overrides, key) ? overrides[key] : void 0;
84
- themed = {
85
- ...themed,
86
- ...layer
87
- };
88
- if (layer || override || overridden) {
89
- const block = declarations(theme, display, {
90
- ...themed,
91
- ...override
92
- });
93
- const media = keyed.get(key);
94
- if (media) styles[media] = block;
95
- else Object.assign(styles, block);
96
- }
97
- overridden = override !== void 0;
98
- }
99
- return styles;
100
- };
101
- const layoutParser = (display) => Object.assign((props) => layoutGridStyles(props.theme, props.layout, display), {
102
- config: {},
103
- propNames: ["layout"],
104
- cache: {}
105
- });
106
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
107
- const layoutGrid = layoutParser("grid");
108
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
109
- const layoutFlex = layoutParser("flex");
110
- const flexSpan = (n) => {
111
- const columns = "var(--layout-columns, 1)";
112
- const gutter = "var(--layout-gutter, 0px)";
113
- return `0 0 calc((100% - (${columns} - 1) * ${gutter}) / ${columns} * ${n} + ${n - 1} * ${gutter})`;
114
- };
115
- /**
116
- * The `span` prop: how many layout-grid columns an element takes. It writes both
117
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
118
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
119
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
120
- */
121
- const span = system({ span: (n) => ({
122
- gridColumn: `span ${n}`,
123
- flex: flexSpan(n)
124
- }) });
125
- //#endregion
126
- export { grid as a, span as i, layoutGrid as n, layoutGridStyles as r, layoutFlex as t };
@@ -1,42 +0,0 @@
1
- import { a as Parser, l as StyleObject } from "./index-iVqAMF2L.cjs";
2
- import "./types-Cv5WjcVA.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
- /** `true` for the theme's layout grid, or entries for named breakpoints that replace it there. */
20
- type LayoutGridValue = boolean | Record<string, LayoutGridEntry>;
21
- /** The container a layout grid is drawn on: column tracks, or a wrapping flex row. */
22
- type LayoutGridDisplay = 'grid' | 'flex';
23
- /**
24
- * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
25
- * margin, gutter, fluid or fixed), inherited mobile-first. An entry in `value` replaces the
26
- * theme's at the breakpoint it names only; the next breakpoint is back to the theme. Every
27
- * written block carries the full set, so no block inherits a stale `max-width`.
28
- */
29
- declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, display?: LayoutGridDisplay) => StyleObject;
30
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
31
- declare const layoutGrid: Parser;
32
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
33
- declare const layoutFlex: Parser;
34
- /**
35
- * The `span` prop: how many layout-grid columns an element takes. It writes both
36
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
37
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
38
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
39
- */
40
- declare const span: Parser;
41
- //#endregion
42
- 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,42 +0,0 @@
1
- import { a as Parser, l as StyleObject } from "./index-IulNhyDt.mjs";
2
- import "./types-Cv5WjcVA.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
- /** `true` for the theme's layout grid, or entries for named breakpoints that replace it there. */
20
- type LayoutGridValue = boolean | Record<string, LayoutGridEntry>;
21
- /** The container a layout grid is drawn on: column tracks, or a wrapping flex row. */
22
- type LayoutGridDisplay = 'grid' | 'flex';
23
- /**
24
- * The layout grid from `theme.layout`, per breakpoint: each breakpoint's `content` (columns,
25
- * margin, gutter, fluid or fixed), inherited mobile-first. An entry in `value` replaces the
26
- * theme's at the breakpoint it names only; the next breakpoint is back to the theme. Every
27
- * written block carries the full set, so no block inherits a stale `max-width`.
28
- */
29
- declare const layoutGridStyles: (theme: unknown, value: LayoutGridValue | undefined, display?: LayoutGridDisplay) => StyleObject;
30
- /** The `layout` prop on a grid container - see {@link layoutGridStyles}. */
31
- declare const layoutGrid: Parser;
32
- /** The `layout` prop on a flex container: a wrapping row with the same gutter and margin. */
33
- declare const layoutFlex: Parser;
34
- /**
35
- * The `span` prop: how many layout-grid columns an element takes. It writes both
36
- * `grid-column: span N` (read by a Grid parent) and a flex basis from the parent's
37
- * `--layout-columns` / `--layout-gutter` (read by a Flex parent); each container ignores the
38
- * other's property. Responsive like any prop: `span={{ xs: 4, md: 6 }}`.
39
- */
40
- declare const span: Parser;
41
- //#endregion
42
- 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 };