@pyreon/unistyle 0.11.1 → 0.11.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.
- package/package.json +8 -7
- package/src/__tests__/alignContent.test.ts +121 -0
- package/src/__tests__/borderRadius.test.ts +125 -0
- package/src/__tests__/camelToKebab.test.ts +44 -0
- package/src/__tests__/context.test.ts +147 -0
- package/src/__tests__/createMediaQueries.test.ts +98 -0
- package/src/__tests__/edge.test.ts +164 -0
- package/src/__tests__/enrichTheme.test.ts +56 -0
- package/src/__tests__/extendCss.test.ts +45 -0
- package/src/__tests__/index.test.ts +79 -0
- package/src/__tests__/makeItResponsive.test.ts +171 -0
- package/src/__tests__/processDescriptor.test.ts +320 -0
- package/src/__tests__/responsive.test.ts +177 -0
- package/src/__tests__/styles.test.ts +119 -0
- package/src/__tests__/units.test.ts +134 -0
- package/src/context.tsx +34 -0
- package/src/enrichTheme.ts +42 -0
- package/src/index.ts +89 -0
- package/src/responsive/breakpoints.ts +15 -0
- package/src/responsive/createMediaQueries.ts +43 -0
- package/src/responsive/index.ts +14 -0
- package/src/responsive/makeItResponsive.ts +118 -0
- package/src/responsive/normalizeTheme.ts +65 -0
- package/src/responsive/optimizeTheme.ts +39 -0
- package/src/responsive/sortBreakpoints.ts +10 -0
- package/src/responsive/transformTheme.ts +48 -0
- package/src/styles/alignContent.ts +58 -0
- package/src/styles/extendCss.ts +26 -0
- package/src/styles/index.ts +16 -0
- package/src/styles/shorthands/borderRadius.ts +89 -0
- package/src/styles/shorthands/edge.ts +108 -0
- package/src/styles/shorthands/index.ts +4 -0
- package/src/styles/styles/camelToKebab.ts +3 -0
- package/src/styles/styles/index.ts +33 -0
- package/src/styles/styles/processDescriptor.ts +100 -0
- package/src/styles/styles/propertyMap.ts +436 -0
- package/src/styles/styles/types.ts +366 -0
- package/src/styles/styles/utils.ts +62 -0
- package/src/types.ts +175 -0
- package/src/units/index.ts +6 -0
- package/src/units/stripUnit.ts +25 -0
- package/src/units/value.ts +47 -0
- package/src/units/values.ts +40 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import value from "./value"
|
|
2
|
+
|
|
3
|
+
type CssUnits =
|
|
4
|
+
| "px"
|
|
5
|
+
| "rem"
|
|
6
|
+
| "%"
|
|
7
|
+
| "em"
|
|
8
|
+
| "ex"
|
|
9
|
+
| "cm"
|
|
10
|
+
| "mm"
|
|
11
|
+
| "in"
|
|
12
|
+
| "pt"
|
|
13
|
+
| "pc"
|
|
14
|
+
| "ch"
|
|
15
|
+
| "vh"
|
|
16
|
+
| "vw"
|
|
17
|
+
| "vmin"
|
|
18
|
+
| "vmax"
|
|
19
|
+
|
|
20
|
+
type GetValueOf = (...args: unknown[]) => number | string
|
|
21
|
+
const getValueOf: GetValueOf = (...args: any[]) =>
|
|
22
|
+
args.find((v) => typeof v !== "undefined" && v !== null)
|
|
23
|
+
|
|
24
|
+
export type Values = (
|
|
25
|
+
items: unknown[],
|
|
26
|
+
rootSize?: number,
|
|
27
|
+
outputUnit?: CssUnits,
|
|
28
|
+
) => string | number | null
|
|
29
|
+
|
|
30
|
+
const values: Values = (items, rootSize, outputUnit) => {
|
|
31
|
+
const param = getValueOf(...items)
|
|
32
|
+
|
|
33
|
+
if (Array.isArray(param)) {
|
|
34
|
+
return param.map((item) => value(item, rootSize, outputUnit)).join(" ")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return value(param, rootSize, outputUnit)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default values
|