@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.
Files changed (43) hide show
  1. package/package.json +8 -7
  2. package/src/__tests__/alignContent.test.ts +121 -0
  3. package/src/__tests__/borderRadius.test.ts +125 -0
  4. package/src/__tests__/camelToKebab.test.ts +44 -0
  5. package/src/__tests__/context.test.ts +147 -0
  6. package/src/__tests__/createMediaQueries.test.ts +98 -0
  7. package/src/__tests__/edge.test.ts +164 -0
  8. package/src/__tests__/enrichTheme.test.ts +56 -0
  9. package/src/__tests__/extendCss.test.ts +45 -0
  10. package/src/__tests__/index.test.ts +79 -0
  11. package/src/__tests__/makeItResponsive.test.ts +171 -0
  12. package/src/__tests__/processDescriptor.test.ts +320 -0
  13. package/src/__tests__/responsive.test.ts +177 -0
  14. package/src/__tests__/styles.test.ts +119 -0
  15. package/src/__tests__/units.test.ts +134 -0
  16. package/src/context.tsx +34 -0
  17. package/src/enrichTheme.ts +42 -0
  18. package/src/index.ts +89 -0
  19. package/src/responsive/breakpoints.ts +15 -0
  20. package/src/responsive/createMediaQueries.ts +43 -0
  21. package/src/responsive/index.ts +14 -0
  22. package/src/responsive/makeItResponsive.ts +118 -0
  23. package/src/responsive/normalizeTheme.ts +65 -0
  24. package/src/responsive/optimizeTheme.ts +39 -0
  25. package/src/responsive/sortBreakpoints.ts +10 -0
  26. package/src/responsive/transformTheme.ts +48 -0
  27. package/src/styles/alignContent.ts +58 -0
  28. package/src/styles/extendCss.ts +26 -0
  29. package/src/styles/index.ts +16 -0
  30. package/src/styles/shorthands/borderRadius.ts +89 -0
  31. package/src/styles/shorthands/edge.ts +108 -0
  32. package/src/styles/shorthands/index.ts +4 -0
  33. package/src/styles/styles/camelToKebab.ts +3 -0
  34. package/src/styles/styles/index.ts +33 -0
  35. package/src/styles/styles/processDescriptor.ts +100 -0
  36. package/src/styles/styles/propertyMap.ts +436 -0
  37. package/src/styles/styles/types.ts +366 -0
  38. package/src/styles/styles/utils.ts +62 -0
  39. package/src/types.ts +175 -0
  40. package/src/units/index.ts +6 -0
  41. package/src/units/stripUnit.ts +25 -0
  42. package/src/units/value.ts +47 -0
  43. 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