@pandacss/studio 0.0.0-dev-20240126232947 → 0.0.0-dev-20240128131310
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.
- package/package.json +7 -7
- package/styled-system/helpers.mjs +31 -1
- package/styled-system/patterns/aspect-ratio.mjs +5 -2
- package/styled-system/patterns/bleed.mjs +12 -7
- package/styled-system/patterns/box.mjs +5 -2
- package/styled-system/patterns/center.mjs +5 -2
- package/styled-system/patterns/circle.mjs +5 -2
- package/styled-system/patterns/container.mjs +5 -2
- package/styled-system/patterns/divider.mjs +8 -4
- package/styled-system/patterns/flex.mjs +5 -2
- package/styled-system/patterns/float.mjs +10 -3
- package/styled-system/patterns/grid-item.mjs +5 -2
- package/styled-system/patterns/grid.mjs +11 -6
- package/styled-system/patterns/hstack.mjs +8 -4
- package/styled-system/patterns/link-box.mjs +5 -2
- package/styled-system/patterns/link-overlay.mjs +5 -2
- package/styled-system/patterns/spacer.mjs +5 -2
- package/styled-system/patterns/square.mjs +5 -2
- package/styled-system/patterns/stack.mjs +8 -4
- package/styled-system/patterns/visually-hidden.mjs +5 -2
- package/styled-system/patterns/vstack.mjs +8 -4
- package/styled-system/patterns/wrap.mjs +5 -2
- package/styled-system/types/pattern.d.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/studio",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20240128131310",
|
|
4
4
|
"description": "The automated token documentation for Panda CSS",
|
|
5
5
|
"main": "dist/studio.js",
|
|
6
6
|
"module": "dist/studio.mjs",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"react": "18.2.0",
|
|
49
49
|
"react-dom": "18.2.0",
|
|
50
50
|
"vite": "5.0.12",
|
|
51
|
-
"@pandacss/
|
|
52
|
-
"@pandacss/
|
|
53
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
54
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
55
|
-
"@pandacss/types": "0.0.0-dev-
|
|
56
|
-
"@pandacss/astro-plugin-studio": "0.0.0-dev-
|
|
51
|
+
"@pandacss/config": "0.0.0-dev-20240128131310",
|
|
52
|
+
"@pandacss/logger": "0.0.0-dev-20240128131310",
|
|
53
|
+
"@pandacss/shared": "0.0.0-dev-20240128131310",
|
|
54
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240128131310",
|
|
55
|
+
"@pandacss/types": "0.0.0-dev-20240128131310",
|
|
56
|
+
"@pandacss/astro-plugin-studio": "0.0.0-dev-20240128131310"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "18.2.42",
|
|
@@ -14,7 +14,7 @@ function filterBaseConditions(c) {
|
|
|
14
14
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// src/
|
|
17
|
+
// src/important.ts
|
|
18
18
|
var importantRegex = /\s*!(important)?/i;
|
|
19
19
|
function isImportant(value) {
|
|
20
20
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -211,6 +211,34 @@ var hypenateProperty = memo((property) => {
|
|
|
211
211
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
+
// src/is-css-function.ts
|
|
215
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
216
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
217
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
218
|
+
|
|
219
|
+
// src/is-css-unit.ts
|
|
220
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
221
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
222
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
223
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
224
|
+
|
|
225
|
+
// src/is-css-var.ts
|
|
226
|
+
var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
227
|
+
|
|
228
|
+
// src/pattern-fns.ts
|
|
229
|
+
var patternFns = {
|
|
230
|
+
map: mapObject,
|
|
231
|
+
isCssFunction,
|
|
232
|
+
isCssVar,
|
|
233
|
+
isCssUnit
|
|
234
|
+
};
|
|
235
|
+
var getPatternStyles = (pattern, styles) => {
|
|
236
|
+
if (!pattern.defaultValues)
|
|
237
|
+
return styles;
|
|
238
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
239
|
+
return Object.assign({}, defaults, compact(styles));
|
|
240
|
+
};
|
|
241
|
+
|
|
214
242
|
// src/slot.ts
|
|
215
243
|
var getSlotRecipes = (recipe = {}) => {
|
|
216
244
|
const init = (slot) => ({
|
|
@@ -260,6 +288,7 @@ export {
|
|
|
260
288
|
createCss,
|
|
261
289
|
createMergeCss,
|
|
262
290
|
filterBaseConditions,
|
|
291
|
+
getPatternStyles,
|
|
263
292
|
getSlotCompoundVariant,
|
|
264
293
|
getSlotRecipes,
|
|
265
294
|
hypenateProperty,
|
|
@@ -268,6 +297,7 @@ export {
|
|
|
268
297
|
mapObject,
|
|
269
298
|
memo,
|
|
270
299
|
mergeProps,
|
|
300
|
+
patternFns,
|
|
271
301
|
splitProps,
|
|
272
302
|
toHash,
|
|
273
303
|
uniq,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const aspectRatioConfig = {
|
|
@@ -29,7 +29,10 @@ transform(props, { map }) {
|
|
|
29
29
|
};
|
|
30
30
|
}}
|
|
31
31
|
|
|
32
|
-
export const getAspectRatioStyle = (styles = {}) =>
|
|
32
|
+
export const getAspectRatioStyle = (styles = {}) => {
|
|
33
|
+
const _styles = getPatternStyles(aspectRatioConfig, styles)
|
|
34
|
+
return aspectRatioConfig.transform(_styles, patternFns)
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
export const aspectRatio = (styles) => css(getAspectRatioStyle(styles))
|
|
35
38
|
aspectRatio.raw = getAspectRatioStyle
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const bleedConfig = {
|
|
5
|
-
transform(props) {
|
|
6
|
-
const { inline
|
|
5
|
+
transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { inline, block, ...rest } = props;
|
|
7
|
+
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
7
8
|
return {
|
|
8
|
-
"--bleed-x":
|
|
9
|
-
"--bleed-y":
|
|
9
|
+
"--bleed-x": map(inline, valueFn),
|
|
10
|
+
"--bleed-y": map(block, valueFn),
|
|
10
11
|
marginInline: "calc(var(--bleed-x, 0) * -1)",
|
|
11
12
|
marginBlock: "calc(var(--bleed-y, 0) * -1)",
|
|
12
13
|
...rest
|
|
13
14
|
};
|
|
14
|
-
}
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{inline:'0',block:'0'}}
|
|
15
17
|
|
|
16
|
-
export const getBleedStyle = (styles = {}) =>
|
|
18
|
+
export const getBleedStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(bleedConfig, styles)
|
|
20
|
+
return bleedConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
17
22
|
|
|
18
23
|
export const bleed = (styles) => css(getBleedStyle(styles))
|
|
19
24
|
bleed.raw = getBleedStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const boxConfig = {
|
|
@@ -6,7 +6,10 @@ transform(props) {
|
|
|
6
6
|
return props;
|
|
7
7
|
}}
|
|
8
8
|
|
|
9
|
-
export const getBoxStyle = (styles = {}) =>
|
|
9
|
+
export const getBoxStyle = (styles = {}) => {
|
|
10
|
+
const _styles = getPatternStyles(boxConfig, styles)
|
|
11
|
+
return boxConfig.transform(_styles, patternFns)
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
export const box = (styles) => css(getBoxStyle(styles))
|
|
12
15
|
box.raw = getBoxStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const centerConfig = {
|
|
@@ -12,7 +12,10 @@ transform(props) {
|
|
|
12
12
|
};
|
|
13
13
|
}}
|
|
14
14
|
|
|
15
|
-
export const getCenterStyle = (styles = {}) =>
|
|
15
|
+
export const getCenterStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(centerConfig, styles)
|
|
17
|
+
return centerConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
export const center = (styles) => css(getCenterStyle(styles))
|
|
18
21
|
center.raw = getCenterStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const circleConfig = {
|
|
@@ -16,7 +16,10 @@ transform(props) {
|
|
|
16
16
|
};
|
|
17
17
|
}}
|
|
18
18
|
|
|
19
|
-
export const getCircleStyle = (styles = {}) =>
|
|
19
|
+
export const getCircleStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(circleConfig, styles)
|
|
21
|
+
return circleConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
export const circle = (styles) => css(getCircleStyle(styles))
|
|
22
25
|
circle.raw = getCircleStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const containerConfig = {
|
|
@@ -12,7 +12,10 @@ transform(props) {
|
|
|
12
12
|
};
|
|
13
13
|
}}
|
|
14
14
|
|
|
15
|
-
export const getContainerStyle = (styles = {}) =>
|
|
15
|
+
export const getContainerStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(containerConfig, styles)
|
|
17
|
+
return containerConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
export const container = (styles) => css(getContainerStyle(styles))
|
|
18
21
|
container.raw = getContainerStyle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const dividerConfig = {
|
|
5
5
|
transform(props, { map }) {
|
|
6
|
-
const { orientation
|
|
6
|
+
const { orientation, thickness, color, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
"--thickness": thickness,
|
|
9
9
|
width: map(orientation, (v) => v === "vertical" ? void 0 : "100%"),
|
|
@@ -13,9 +13,13 @@ transform(props, { map }) {
|
|
|
13
13
|
borderColor: color,
|
|
14
14
|
...rest
|
|
15
15
|
};
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
defaultValues:{orientation:'horizontal',thickness:'1px'}}
|
|
17
18
|
|
|
18
|
-
export const getDividerStyle = (styles = {}) =>
|
|
19
|
+
export const getDividerStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(dividerConfig, styles)
|
|
21
|
+
return dividerConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
19
23
|
|
|
20
24
|
export const divider = (styles) => css(getDividerStyle(styles))
|
|
21
25
|
divider.raw = getDividerStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const flexConfig = {
|
|
@@ -17,7 +17,10 @@ transform(props) {
|
|
|
17
17
|
};
|
|
18
18
|
}}
|
|
19
19
|
|
|
20
|
-
export const getFlexStyle = (styles = {}) =>
|
|
20
|
+
export const getFlexStyle = (styles = {}) => {
|
|
21
|
+
const _styles = getPatternStyles(flexConfig, styles)
|
|
22
|
+
return flexConfig.transform(_styles, patternFns)
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
export const flex = (styles) => css(getFlexStyle(styles))
|
|
23
26
|
flex.raw = getFlexStyle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const floatConfig = {
|
|
5
5
|
transform(props, { map }) {
|
|
6
|
-
const { offset
|
|
6
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
display: "inline-flex",
|
|
9
9
|
justifyContent: "center",
|
|
@@ -37,9 +37,16 @@ transform(props, { map }) {
|
|
|
37
37
|
}),
|
|
38
38
|
...rest
|
|
39
39
|
};
|
|
40
|
+
},
|
|
41
|
+
defaultValues(props) {
|
|
42
|
+
const offset = props.offset || "0";
|
|
43
|
+
return { offset, offsetX: offset, offsetY: offset, placement: "top-end" };
|
|
40
44
|
}}
|
|
41
45
|
|
|
42
|
-
export const getFloatStyle = (styles = {}) =>
|
|
46
|
+
export const getFloatStyle = (styles = {}) => {
|
|
47
|
+
const _styles = getPatternStyles(floatConfig, styles)
|
|
48
|
+
return floatConfig.transform(_styles, patternFns)
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
export const float = (styles) => css(getFloatStyle(styles))
|
|
45
52
|
float.raw = getFloatStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const gridItemConfig = {
|
|
@@ -16,7 +16,10 @@ transform(props, { map }) {
|
|
|
16
16
|
};
|
|
17
17
|
}}
|
|
18
18
|
|
|
19
|
-
export const getGridItemStyle = (styles = {}) =>
|
|
19
|
+
export const getGridItemStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(gridItemConfig, styles)
|
|
21
|
+
return gridItemConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
export const gridItem = (styles) => css(getGridItemStyle(styles))
|
|
22
25
|
gridItem.raw = getGridItemStyle
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const gridConfig = {
|
|
5
|
-
transform(props, { map }) {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const getValue = (v) => regex.test(v) ? v : `token(sizes.${v}, ${v})`;
|
|
5
|
+
transform(props, { map, isCssUnit }) {
|
|
6
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
|
|
7
|
+
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
9
8
|
return {
|
|
10
9
|
display: "grid",
|
|
11
10
|
gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
|
|
@@ -14,9 +13,15 @@ transform(props, { map }) {
|
|
|
14
13
|
rowGap,
|
|
15
14
|
...rest
|
|
16
15
|
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues(props) {
|
|
18
|
+
return { gap: props.columnGap || props.rowGap ? void 0 : "10px" };
|
|
17
19
|
}}
|
|
18
20
|
|
|
19
|
-
export const getGridStyle = (styles = {}) =>
|
|
21
|
+
export const getGridStyle = (styles = {}) => {
|
|
22
|
+
const _styles = getPatternStyles(gridConfig, styles)
|
|
23
|
+
return gridConfig.transform(_styles, patternFns)
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
export const grid = (styles) => css(getGridStyle(styles))
|
|
22
27
|
grid.raw = getGridStyle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const hstackConfig = {
|
|
5
5
|
transform(props) {
|
|
6
|
-
const { justify, gap
|
|
6
|
+
const { justify, gap, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
|
@@ -12,9 +12,13 @@ transform(props) {
|
|
|
12
12
|
flexDirection: "row",
|
|
13
13
|
...rest
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{gap:'10px'}}
|
|
16
17
|
|
|
17
|
-
export const getHstackStyle = (styles = {}) =>
|
|
18
|
+
export const getHstackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(hstackConfig, styles)
|
|
20
|
+
return hstackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
18
22
|
|
|
19
23
|
export const hstack = (styles) => css(getHstackStyle(styles))
|
|
20
24
|
hstack.raw = getHstackStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const linkBoxConfig = {
|
|
@@ -13,7 +13,10 @@ transform(props) {
|
|
|
13
13
|
};
|
|
14
14
|
}}
|
|
15
15
|
|
|
16
|
-
export const getLinkBoxStyle = (styles = {}) =>
|
|
16
|
+
export const getLinkBoxStyle = (styles = {}) => {
|
|
17
|
+
const _styles = getPatternStyles(linkBoxConfig, styles)
|
|
18
|
+
return linkBoxConfig.transform(_styles, patternFns)
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
export const linkBox = (styles) => css(getLinkBoxStyle(styles))
|
|
19
22
|
linkBox.raw = getLinkBoxStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const linkOverlayConfig = {
|
|
@@ -18,7 +18,10 @@ transform(props) {
|
|
|
18
18
|
};
|
|
19
19
|
}}
|
|
20
20
|
|
|
21
|
-
export const getLinkOverlayStyle = (styles = {}) =>
|
|
21
|
+
export const getLinkOverlayStyle = (styles = {}) => {
|
|
22
|
+
const _styles = getPatternStyles(linkOverlayConfig, styles)
|
|
23
|
+
return linkOverlayConfig.transform(_styles, patternFns)
|
|
24
|
+
}
|
|
22
25
|
|
|
23
26
|
export const linkOverlay = (styles) => css(getLinkOverlayStyle(styles))
|
|
24
27
|
linkOverlay.raw = getLinkOverlayStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const spacerConfig = {
|
|
@@ -12,7 +12,10 @@ transform(props, { map }) {
|
|
|
12
12
|
};
|
|
13
13
|
}}
|
|
14
14
|
|
|
15
|
-
export const getSpacerStyle = (styles = {}) =>
|
|
15
|
+
export const getSpacerStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(spacerConfig, styles)
|
|
17
|
+
return spacerConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
export const spacer = (styles) => css(getSpacerStyle(styles))
|
|
18
21
|
spacer.raw = getSpacerStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const squareConfig = {
|
|
@@ -15,7 +15,10 @@ transform(props) {
|
|
|
15
15
|
};
|
|
16
16
|
}}
|
|
17
17
|
|
|
18
|
-
export const getSquareStyle = (styles = {}) =>
|
|
18
|
+
export const getSquareStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(squareConfig, styles)
|
|
20
|
+
return squareConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
19
22
|
|
|
20
23
|
export const square = (styles) => css(getSquareStyle(styles))
|
|
21
24
|
square.raw = getSquareStyle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const stackConfig = {
|
|
5
5
|
transform(props) {
|
|
6
|
-
const { align, justify, direction
|
|
6
|
+
const { align, justify, direction, gap, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: direction,
|
|
@@ -12,9 +12,13 @@ transform(props) {
|
|
|
12
12
|
gap,
|
|
13
13
|
...rest
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{direction:'column',gap:'10px'}}
|
|
16
17
|
|
|
17
|
-
export const getStackStyle = (styles = {}) =>
|
|
18
|
+
export const getStackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(stackConfig, styles)
|
|
20
|
+
return stackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
18
22
|
|
|
19
23
|
export const stack = (styles) => css(getStackStyle(styles))
|
|
20
24
|
stack.raw = getStackStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const visuallyHiddenConfig = {
|
|
@@ -9,7 +9,10 @@ transform(props) {
|
|
|
9
9
|
};
|
|
10
10
|
}}
|
|
11
11
|
|
|
12
|
-
export const getVisuallyHiddenStyle = (styles = {}) =>
|
|
12
|
+
export const getVisuallyHiddenStyle = (styles = {}) => {
|
|
13
|
+
const _styles = getPatternStyles(visuallyHiddenConfig, styles)
|
|
14
|
+
return visuallyHiddenConfig.transform(_styles, patternFns)
|
|
15
|
+
}
|
|
13
16
|
|
|
14
17
|
export const visuallyHidden = (styles) => css(getVisuallyHiddenStyle(styles))
|
|
15
18
|
visuallyHidden.raw = getVisuallyHiddenStyle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const vstackConfig = {
|
|
5
5
|
transform(props) {
|
|
6
|
-
const { justify, gap
|
|
6
|
+
const { justify, gap, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
|
@@ -12,9 +12,13 @@ transform(props) {
|
|
|
12
12
|
flexDirection: "column",
|
|
13
13
|
...rest
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{gap:'10px'}}
|
|
16
17
|
|
|
17
|
-
export const getVstackStyle = (styles = {}) =>
|
|
18
|
+
export const getVstackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(vstackConfig, styles)
|
|
20
|
+
return vstackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
18
22
|
|
|
19
23
|
export const vstack = (styles) => css(getVstackStyle(styles))
|
|
20
24
|
vstack.raw = getVstackStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const wrapConfig = {
|
|
@@ -16,7 +16,10 @@ transform(props) {
|
|
|
16
16
|
};
|
|
17
17
|
}}
|
|
18
18
|
|
|
19
|
-
export const getWrapStyle = (styles = {}) =>
|
|
19
|
+
export const getWrapStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(wrapConfig, styles)
|
|
21
|
+
return wrapConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
export const wrap = (styles) => css(getWrapStyle(styles))
|
|
22
25
|
wrap.raw = getWrapStyle
|
|
@@ -13,13 +13,20 @@ export type PatternProperty =
|
|
|
13
13
|
|
|
14
14
|
export interface PatternHelpers {
|
|
15
15
|
map: (value: any, fn: (value: string) => string | undefined) => any
|
|
16
|
+
isCssUnit: (value: any) => boolean
|
|
17
|
+
isCssVar: (value: any) => boolean
|
|
18
|
+
isCssFunction: (value: any) => boolean
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export interface PatternProperties {
|
|
19
22
|
[key: string]: PatternProperty
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
type
|
|
25
|
+
type InferProps<T> = Record<LiteralUnion<keyof T>, any>
|
|
26
|
+
|
|
27
|
+
export type PatternDefaultValue<T> = Partial<InferProps<T>>
|
|
28
|
+
|
|
29
|
+
export type PatternDefaultValueFn<T> = (props: InferProps<T>) => PatternDefaultValue<T>
|
|
23
30
|
|
|
24
31
|
export interface PatternConfig<T extends PatternProperties = PatternProperties> {
|
|
25
32
|
/**
|
|
@@ -35,10 +42,14 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
|
|
|
35
42
|
* The properties of the pattern.
|
|
36
43
|
*/
|
|
37
44
|
properties?: T
|
|
45
|
+
/**
|
|
46
|
+
* The default values of the pattern.
|
|
47
|
+
*/
|
|
48
|
+
defaultValues?: PatternDefaultValue<T> | PatternDefaultValueFn<T>
|
|
38
49
|
/**
|
|
39
50
|
* The css object this pattern will generate.
|
|
40
51
|
*/
|
|
41
|
-
transform?: (props:
|
|
52
|
+
transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject
|
|
42
53
|
/**
|
|
43
54
|
* The jsx element name this pattern will generate.
|
|
44
55
|
*/
|