@pyreon/unistyle 0.24.5 → 0.24.6

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 (50) hide show
  1. package/package.json +7 -9
  2. package/src/__tests__/alignContent.test.ts +0 -121
  3. package/src/__tests__/borderRadius.test.ts +0 -125
  4. package/src/__tests__/camelToKebab.test.ts +0 -44
  5. package/src/__tests__/context.test.ts +0 -147
  6. package/src/__tests__/createMediaQueries.test.ts +0 -98
  7. package/src/__tests__/edge.test.ts +0 -164
  8. package/src/__tests__/enrichTheme.test.ts +0 -56
  9. package/src/__tests__/extendCss.test.ts +0 -45
  10. package/src/__tests__/index.test.ts +0 -79
  11. package/src/__tests__/makeItResponsive.test.ts +0 -431
  12. package/src/__tests__/manifest-snapshot.test.ts +0 -34
  13. package/src/__tests__/native-marker.test.ts +0 -9
  14. package/src/__tests__/optimizeBreakpointDeltas.test.ts +0 -124
  15. package/src/__tests__/processDescriptor.test.ts +0 -322
  16. package/src/__tests__/responsive.test.ts +0 -221
  17. package/src/__tests__/special-keys.test.ts +0 -120
  18. package/src/__tests__/styles.test.ts +0 -273
  19. package/src/__tests__/unistyle.browser.test.tsx +0 -169
  20. package/src/__tests__/units.test.ts +0 -134
  21. package/src/context.tsx +0 -44
  22. package/src/enrichTheme.ts +0 -42
  23. package/src/env.d.ts +0 -6
  24. package/src/index.ts +0 -91
  25. package/src/manifest.ts +0 -197
  26. package/src/responsive/breakpoints.ts +0 -15
  27. package/src/responsive/createMediaQueries.ts +0 -43
  28. package/src/responsive/index.ts +0 -15
  29. package/src/responsive/makeItResponsive.ts +0 -223
  30. package/src/responsive/normalizeTheme.ts +0 -79
  31. package/src/responsive/optimizeBreakpointDeltas.ts +0 -190
  32. package/src/responsive/optimizeTheme.ts +0 -60
  33. package/src/responsive/sortBreakpoints.ts +0 -10
  34. package/src/responsive/transformTheme.ts +0 -54
  35. package/src/styles/alignContent.ts +0 -62
  36. package/src/styles/extendCss.ts +0 -26
  37. package/src/styles/index.ts +0 -16
  38. package/src/styles/shorthands/borderRadius.ts +0 -89
  39. package/src/styles/shorthands/edge.ts +0 -108
  40. package/src/styles/shorthands/index.ts +0 -4
  41. package/src/styles/styles/camelToKebab.ts +0 -3
  42. package/src/styles/styles/index.ts +0 -132
  43. package/src/styles/styles/processDescriptor.ts +0 -136
  44. package/src/styles/styles/propertyMap.ts +0 -438
  45. package/src/styles/styles/types.ts +0 -368
  46. package/src/types.ts +0 -175
  47. package/src/units/index.ts +0 -6
  48. package/src/units/stripUnit.ts +0 -25
  49. package/src/units/value.ts +0 -47
  50. package/src/units/values.ts +0 -40
@@ -1,164 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import edge from '../styles/shorthands/edge'
3
-
4
- const empty = {
5
- full: undefined,
6
- x: undefined,
7
- y: undefined,
8
- top: undefined,
9
- left: undefined,
10
- right: undefined,
11
- bottom: undefined,
12
- }
13
-
14
- const e = edge()
15
-
16
- describe('edge', () => {
17
- it('returns null when no values provided', () => {
18
- expect(e('margin', empty)).toBeNull()
19
- })
20
-
21
- describe('full shorthand (all same)', () => {
22
- it('margin with single value', () => {
23
- expect(e('margin', { ...empty, full: 16 })).toBe('margin: 1rem;')
24
- })
25
-
26
- it('padding with single value', () => {
27
- expect(e('padding', { ...empty, full: 32 })).toBe('padding: 2rem;')
28
- })
29
-
30
- it('inset with single value', () => {
31
- expect(e('inset', { ...empty, full: 16 })).toBe('inset: 1rem;')
32
- })
33
- })
34
-
35
- describe('two-value shorthand', () => {
36
- it('top===bottom and right===left', () => {
37
- const result = e('margin', { ...empty, y: 16, x: 32 })
38
- expect(result).toBe('margin: 1rem 2rem;')
39
- })
40
- })
41
-
42
- describe('three-value shorthand', () => {
43
- it('top, right===left, bottom', () => {
44
- const result = e('padding', {
45
- ...empty,
46
- top: 16,
47
- right: 32,
48
- bottom: 48,
49
- left: 32,
50
- })
51
- expect(result).toBe('padding: 1rem 2rem 3rem;')
52
- })
53
- })
54
-
55
- describe('four-value shorthand', () => {
56
- it('all different sides', () => {
57
- const result = e('margin', {
58
- ...empty,
59
- top: 16,
60
- right: 32,
61
- bottom: 48,
62
- left: 64,
63
- })
64
- expect(result).toBe('margin: 1rem 2rem 3rem 4rem;')
65
- })
66
- })
67
-
68
- describe('x and y values', () => {
69
- it('x sets left and right', () => {
70
- const result = e('margin', { ...empty, x: 16 })
71
- expect(result).toBe('margin-left: 1rem;margin-right: 1rem;')
72
- })
73
-
74
- it('y sets top and bottom', () => {
75
- const result = e('margin', { ...empty, y: 16 })
76
- expect(result).toBe('margin-top: 1rem;margin-bottom: 1rem;')
77
- })
78
- })
79
-
80
- describe('individual sides override x/y/full', () => {
81
- it('top overrides y', () => {
82
- const result = e('margin', { ...empty, y: 16, top: 32, x: 16 })
83
- // t=32, r=16, b=16, l=16 → r===l so 3-value shorthand
84
- expect(result).toBe('margin: 2rem 1rem 1rem;')
85
- })
86
-
87
- it('left overrides x', () => {
88
- const result = e('padding', { ...empty, full: 16, left: 32 })
89
- expect(result).toBe('padding: 1rem 1rem 1rem 2rem;')
90
- })
91
- })
92
-
93
- describe('border-width uses px unit', () => {
94
- it('border-width with full value', () => {
95
- expect(e('border-width', { ...empty, full: 1 })).toBe('border-width: 1px;')
96
- })
97
-
98
- it('border-width individual sides', () => {
99
- const result = e('border-width', { ...empty, top: 1, bottom: 2 })
100
- expect(result).toBe('border-top-width: 1px;border-bottom-width: 2px;')
101
- })
102
- })
103
-
104
- describe('border-style does not use units', () => {
105
- it('border-style with full value', () => {
106
- expect(e('border-style', { ...empty, full: 'solid' })).toBe('border-style: solid;')
107
- })
108
-
109
- it('border-style individual sides', () => {
110
- const result = e('border-style', { ...empty, top: 'solid', bottom: 'dashed' })
111
- expect(result).toBe('border-top-style: solid;border-bottom-style: dashed;')
112
- })
113
- })
114
-
115
- describe('border-color does not use units', () => {
116
- it('border-color with full value', () => {
117
- expect(e('border-color', { ...empty, full: 'red' })).toBe('border-color: red;')
118
- })
119
-
120
- it('border-color individual sides', () => {
121
- const result = e('border-color', { ...empty, top: 'red', left: 'blue' })
122
- expect(result).toBe('border-top-color: red;border-left-color: blue;')
123
- })
124
- })
125
-
126
- describe('individual format when not all sides have values', () => {
127
- it('only top is set', () => {
128
- expect(e('margin', { ...empty, top: 16 })).toBe('margin-top: 1rem;')
129
- })
130
-
131
- it('only left and right are set', () => {
132
- const result = e('padding', { ...empty, left: 16, right: 32 })
133
- expect(result).toBe('padding-left: 1rem;padding-right: 2rem;')
134
- })
135
-
136
- it('inset individual sides', () => {
137
- const result = e('inset', { ...empty, top: 0, left: 16 })
138
- expect(result).toBe('top: 0;left: 1rem;')
139
- })
140
- })
141
-
142
- describe('zero values are valid', () => {
143
- it('zero full value', () => {
144
- expect(e('margin', { ...empty, full: 0 })).toBe('margin: 0;')
145
- })
146
-
147
- it('zero individual side', () => {
148
- expect(e('padding', { ...empty, top: 0 })).toBe('padding-top: 0;')
149
- })
150
- })
151
-
152
- describe('custom rootSize', () => {
153
- it('uses custom rootSize for conversion', () => {
154
- const eCustom = edge(10)
155
- expect(eCustom('margin', { ...empty, full: 20 })).toBe('margin: 2rem;')
156
- })
157
- })
158
-
159
- describe('string values', () => {
160
- it('passes through string values like auto', () => {
161
- expect(e('margin', { ...empty, full: 'auto' })).toBe('margin: auto;')
162
- })
163
- })
164
- })
@@ -1,56 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { enrichTheme } from '../enrichTheme'
3
-
4
- describe('enrichTheme', () => {
5
- it('adds __PYREON__ with sortedBreakpoints and media', () => {
6
- const theme = { rootSize: 16, breakpoints: { xs: 0, sm: 576, md: 768 } }
7
- const result = enrichTheme(theme)
8
-
9
- expect(result.__PYREON__).toBeDefined()
10
- expect(result.__PYREON__.sortedBreakpoints).toEqual(['xs', 'sm', 'md'])
11
- expect(result.__PYREON__.media).toBeDefined()
12
- expect(typeof result.__PYREON__.media?.sm).toBe('function')
13
- })
14
-
15
- it('preserves custom theme properties', () => {
16
- const theme = { rootSize: 16, colors: { primary: 'blue' } }
17
- const result = enrichTheme(theme)
18
-
19
- expect(result.colors).toEqual({ primary: 'blue' })
20
- expect(result.rootSize).toBe(16)
21
- })
22
-
23
- it('handles theme without breakpoints', () => {
24
- const theme = { rootSize: 16 }
25
- const result = enrichTheme(theme)
26
-
27
- expect(result.__PYREON__).toBeDefined()
28
- expect(result.__PYREON__.sortedBreakpoints).toBeUndefined()
29
- expect(result.__PYREON__.media).toBeUndefined()
30
- })
31
-
32
- it('handles empty breakpoints', () => {
33
- const theme = { rootSize: 16, breakpoints: {} }
34
- const result = enrichTheme(theme)
35
-
36
- expect(result.__PYREON__.sortedBreakpoints).toBeUndefined()
37
- expect(result.__PYREON__.media).toBeUndefined()
38
- })
39
-
40
- it('defaults rootSize to 16', () => {
41
- const theme = { breakpoints: { sm: 576 } }
42
- const result = enrichTheme(theme)
43
-
44
- // Media queries should be created (breakpoints present)
45
- expect(result.__PYREON__.media).toBeDefined()
46
- })
47
-
48
- it('is a pure function — does not mutate input', () => {
49
- const theme = { rootSize: 16, breakpoints: { xs: 0, md: 768 } }
50
- const copy = { ...theme }
51
- enrichTheme(theme)
52
-
53
- expect(theme).toEqual(copy)
54
- expect((theme as any).__PYREON__).toBeUndefined()
55
- })
56
- })
@@ -1,45 +0,0 @@
1
- import { describe, expect, it } from "vitest"
2
- import extendCss from "../styles/extendCss"
3
-
4
- describe("extendCss", () => {
5
- it("returns empty string for null input", () => {
6
- expect(extendCss(null)).toBe("")
7
- })
8
-
9
- it("returns empty string for undefined input", () => {
10
- expect(extendCss(undefined)).toBe("")
11
- })
12
-
13
- it("returns the string as-is for string input", () => {
14
- expect(extendCss("color: red;")).toBe("color: red;")
15
- })
16
-
17
- it("returns empty string for empty string input", () => {
18
- expect(extendCss("")).toBe("")
19
- })
20
-
21
- it("calls function with simpleCss tagged template and returns result", () => {
22
- const result = extendCss((css) => css`color: red; font-size: 16px;`)
23
- expect(result).toBe("color: red; font-size: 16px;")
24
- })
25
-
26
- it("handles function with interpolated values", () => {
27
- const size = 16
28
- const result = extendCss((css) => css`font-size: ${size}px;`)
29
- expect(result).toBe("font-size: 16px;")
30
- })
31
-
32
- it("handles function with multiple interpolated values", () => {
33
- const color = "red"
34
- const size = 14
35
- const result = extendCss((css) => css`color: ${color}; font-size: ${size}px;`)
36
- expect(result).toBe("color: red; font-size: 14px;")
37
- })
38
-
39
- it("handles function with null/undefined interpolated values as empty string", () => {
40
- const nullVal = null as string | null
41
- const undefVal = undefined as string | undefined
42
- const result = extendCss((css) => css`color: ${nullVal}; font-size: ${undefVal}px;`)
43
- expect(result).toBe("color: ; font-size: px;")
44
- })
45
- })
@@ -1,79 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import * as unistyle from '../index'
3
-
4
- describe('index exports', () => {
5
- it('exports breakpoints', () => {
6
- expect(unistyle.breakpoints).toBeDefined()
7
- expect(typeof unistyle.breakpoints).toBe('object')
8
- })
9
-
10
- it('exports sortBreakpoints', () => {
11
- expect(unistyle.sortBreakpoints).toBeDefined()
12
- expect(typeof unistyle.sortBreakpoints).toBe('function')
13
- })
14
-
15
- it('exports createMediaQueries', () => {
16
- expect(unistyle.createMediaQueries).toBeDefined()
17
- expect(typeof unistyle.createMediaQueries).toBe('function')
18
- })
19
-
20
- it('exports makeItResponsive', () => {
21
- expect(unistyle.makeItResponsive).toBeDefined()
22
- expect(typeof unistyle.makeItResponsive).toBe('function')
23
- })
24
-
25
- it('exports normalizeTheme', () => {
26
- expect(unistyle.normalizeTheme).toBeDefined()
27
- expect(typeof unistyle.normalizeTheme).toBe('function')
28
- })
29
-
30
- it('exports transformTheme', () => {
31
- expect(unistyle.transformTheme).toBeDefined()
32
- expect(typeof unistyle.transformTheme).toBe('function')
33
- })
34
-
35
- it('exports styles', () => {
36
- expect(unistyle.styles).toBeDefined()
37
- expect(typeof unistyle.styles).toBe('function')
38
- })
39
-
40
- it('exports alignContent', () => {
41
- expect(unistyle.alignContent).toBeDefined()
42
- expect(typeof unistyle.alignContent).toBe('function')
43
- })
44
-
45
- it('exports extendCss', () => {
46
- expect(unistyle.extendCss).toBeDefined()
47
- expect(typeof unistyle.extendCss).toBe('function')
48
- })
49
-
50
- it('exports stripUnit', () => {
51
- expect(unistyle.stripUnit).toBeDefined()
52
- expect(typeof unistyle.stripUnit).toBe('function')
53
- })
54
-
55
- it('exports value', () => {
56
- expect(unistyle.value).toBeDefined()
57
- expect(typeof unistyle.value).toBe('function')
58
- })
59
-
60
- it('exports values', () => {
61
- expect(unistyle.values).toBeDefined()
62
- expect(typeof unistyle.values).toBe('function')
63
- })
64
-
65
- it('exports Provider', () => {
66
- expect(unistyle.Provider).toBeDefined()
67
- expect(typeof unistyle.Provider).toBe('function')
68
- })
69
-
70
- it('exports context', () => {
71
- expect(unistyle.context).toBeDefined()
72
- })
73
-
74
- it('exports align content constants', () => {
75
- expect(unistyle.ALIGN_CONTENT_DIRECTION).toBeDefined()
76
- expect(unistyle.ALIGN_CONTENT_MAP_X).toBeDefined()
77
- expect(unistyle.ALIGN_CONTENT_MAP_Y).toBeDefined()
78
- })
79
- })