@weser/style 2.0.0 → 2.1.0

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 (87) hide show
  1. package/dist/core/__tests__/createRenderer.test copy.d.ts +2 -0
  2. package/dist/core/__tests__/createRenderer.test copy.d.ts.map +1 -0
  3. package/dist/core/__tests__/createRenderer.test copy.js +37 -0
  4. package/dist/core/__tests__/createRenderer.test copy.js.map +1 -0
  5. package/dist/core/__tests__/createRenderer.test.js +12 -0
  6. package/dist/core/__tests__/createRenderer.test.js.map +1 -1
  7. package/dist/core/__tests__/integration.test.d.ts +2 -0
  8. package/dist/core/__tests__/integration.test.d.ts.map +1 -0
  9. package/dist/core/__tests__/integration.test.js +20 -0
  10. package/dist/core/__tests__/integration.test.js.map +1 -0
  11. package/dist/core/__tests__/precompileConditions.d.ts +2 -0
  12. package/dist/core/__tests__/precompileConditions.d.ts.map +1 -0
  13. package/dist/core/__tests__/precompileConditions.js +20 -0
  14. package/dist/core/__tests__/precompileConditions.js.map +1 -0
  15. package/dist/core/__tests__/precompileConditions.test.d.ts +2 -0
  16. package/dist/core/__tests__/precompileConditions.test.d.ts.map +1 -0
  17. package/dist/core/__tests__/precompileConditions.test.js +20 -0
  18. package/dist/core/__tests__/precompileConditions.test.js.map +1 -0
  19. package/dist/core/createRenderer.d.ts +1 -0
  20. package/dist/core/createRenderer.d.ts.map +1 -1
  21. package/dist/core/createRenderer.js +16 -23
  22. package/dist/core/createRenderer.js.map +1 -1
  23. package/dist/core/precompileConditions.d.ts +10 -0
  24. package/dist/core/precompileConditions.d.ts.map +1 -0
  25. package/dist/core/precompileConditions.js +14 -0
  26. package/dist/core/precompileConditions.js.map +1 -0
  27. package/dist/helpers/flags.d.ts +10 -0
  28. package/dist/helpers/flags.d.ts.map +1 -0
  29. package/dist/helpers/flags.js +20 -0
  30. package/dist/helpers/flags.js.map +1 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +1 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/plugins/__tests__/customProperty.test.d.ts +2 -0
  36. package/dist/plugins/__tests__/customProperty.test.d.ts.map +1 -0
  37. package/dist/plugins/__tests__/customProperty.test.js +63 -0
  38. package/dist/plugins/__tests__/customProperty.test.js.map +1 -0
  39. package/dist/plugins/__tests__/debug.test.d.ts +2 -0
  40. package/dist/plugins/__tests__/debug.test.d.ts.map +1 -0
  41. package/dist/plugins/__tests__/debug.test.js +52 -0
  42. package/dist/plugins/__tests__/debug.test.js.map +1 -0
  43. package/dist/plugins/__tests__/embedded.test.d.ts +2 -0
  44. package/dist/plugins/__tests__/embedded.test.d.ts.map +1 -0
  45. package/dist/plugins/__tests__/embedded.test.js +76 -0
  46. package/dist/plugins/__tests__/embedded.test.js.map +1 -0
  47. package/dist/plugins/__tests__/enforceLonghand.test.d.ts +2 -0
  48. package/dist/plugins/__tests__/enforceLonghand.test.d.ts.map +1 -0
  49. package/dist/plugins/__tests__/enforceLonghand.test.js +88 -0
  50. package/dist/plugins/__tests__/enforceLonghand.test.js.map +1 -0
  51. package/dist/plugins/__tests__/fallbackValue.test.d.ts +2 -0
  52. package/dist/plugins/__tests__/fallbackValue.test.d.ts.map +1 -0
  53. package/dist/plugins/__tests__/fallbackValue.test.js +94 -0
  54. package/dist/plugins/__tests__/fallbackValue.test.js.map +1 -0
  55. package/dist/plugins/__tests__/logger.test.d.ts +2 -0
  56. package/dist/plugins/__tests__/logger.test.d.ts.map +1 -0
  57. package/dist/plugins/__tests__/logger.test.js +57 -0
  58. package/dist/plugins/__tests__/logger.test.js.map +1 -0
  59. package/dist/plugins/__tests__/prefixer.test.d.ts +2 -0
  60. package/dist/plugins/__tests__/prefixer.test.d.ts.map +1 -0
  61. package/dist/plugins/__tests__/prefixer.test.js +64 -0
  62. package/dist/plugins/__tests__/prefixer.test.js.map +1 -0
  63. package/dist/plugins/__tests__/pseudoElement.test.d.ts +2 -0
  64. package/dist/plugins/__tests__/pseudoElement.test.d.ts.map +1 -0
  65. package/dist/plugins/__tests__/pseudoElement.test.js +92 -0
  66. package/dist/plugins/__tests__/pseudoElement.test.js.map +1 -0
  67. package/dist/plugins/__tests__/responsiveValue.test.d.ts +2 -0
  68. package/dist/plugins/__tests__/responsiveValue.test.d.ts.map +1 -0
  69. package/dist/plugins/__tests__/responsiveValue.test.js +68 -0
  70. package/dist/plugins/__tests__/responsiveValue.test.js.map +1 -0
  71. package/dist/plugins/__tests__/rtl.test.d.ts +2 -0
  72. package/dist/plugins/__tests__/rtl.test.d.ts.map +1 -0
  73. package/dist/plugins/__tests__/rtl.test.js +57 -0
  74. package/dist/plugins/__tests__/rtl.test.js.map +1 -0
  75. package/dist/plugins/__tests__/sortCondition.test.d.ts +2 -0
  76. package/dist/plugins/__tests__/sortCondition.test.d.ts.map +1 -0
  77. package/dist/plugins/__tests__/sortCondition.test.js +65 -0
  78. package/dist/plugins/__tests__/sortCondition.test.js.map +1 -0
  79. package/dist/plugins/__tests__/sortProperty.test.d.ts +2 -0
  80. package/dist/plugins/__tests__/sortProperty.test.d.ts.map +1 -0
  81. package/dist/plugins/__tests__/sortProperty.test.js +68 -0
  82. package/dist/plugins/__tests__/sortProperty.test.js.map +1 -0
  83. package/dist/plugins/__tests__/unit.test.d.ts +2 -0
  84. package/dist/plugins/__tests__/unit.test.d.ts.map +1 -0
  85. package/dist/plugins/__tests__/unit.test.js +66 -0
  86. package/dist/plugins/__tests__/unit.test.js.map +1 -0
  87. package/package.json +6 -6
@@ -0,0 +1,76 @@
1
+ import { describe, test, expect, vi } from 'vitest';
2
+ import embeddedPlugin from '../embedded';
3
+ describe('embeddedPlugin', () => {
4
+ const createMockContext = () => ({
5
+ createNode: vi.fn(),
6
+ mergeStyle: vi.fn(),
7
+ props: {},
8
+ });
9
+ test('converts animationName object to keyframe reference', () => {
10
+ const mockContext = createMockContext();
11
+ const plugin = embeddedPlugin();
12
+ const style = {
13
+ animationName: {
14
+ from: { opacity: 0 },
15
+ to: { opacity: 1 },
16
+ },
17
+ };
18
+ const result = plugin(style, mockContext);
19
+ // animationName should be replaced with a string reference
20
+ expect(typeof result.animationName).toBe('string');
21
+ expect(mockContext.createNode).toHaveBeenCalled();
22
+ });
23
+ test('passes through non-animationName object properties', () => {
24
+ const mockContext = createMockContext();
25
+ const plugin = embeddedPlugin();
26
+ const style = {
27
+ color: 'red',
28
+ fontSize: 16,
29
+ };
30
+ const result = plugin(style, mockContext);
31
+ expect(result.color).toBe('red');
32
+ expect(result.fontSize).toBe(16);
33
+ expect(mockContext.createNode).not.toHaveBeenCalled();
34
+ });
35
+ test('handles nested style objects', () => {
36
+ const mockContext = createMockContext();
37
+ const plugin = embeddedPlugin();
38
+ const style = {
39
+ ':hover': {
40
+ animationName: {
41
+ '0%': { transform: 'scale(1)' },
42
+ '100%': { transform: 'scale(1.1)' },
43
+ },
44
+ },
45
+ };
46
+ const result = plugin(style, mockContext);
47
+ expect(typeof result[':hover']?.animationName).toBe('string');
48
+ expect(mockContext.createNode).toHaveBeenCalled();
49
+ });
50
+ test('preserves other properties in style with animationName', () => {
51
+ const mockContext = createMockContext();
52
+ const plugin = embeddedPlugin();
53
+ const style = {
54
+ animationName: {
55
+ from: { opacity: 0 },
56
+ to: { opacity: 1 },
57
+ },
58
+ animationDuration: '1s',
59
+ animationTimingFunction: 'ease-in-out',
60
+ };
61
+ const result = plugin(style, mockContext);
62
+ expect(result.animationDuration).toBe('1s');
63
+ expect(result.animationTimingFunction).toBe('ease-in-out');
64
+ });
65
+ test('handles string animationName (already resolved)', () => {
66
+ const mockContext = createMockContext();
67
+ const plugin = embeddedPlugin();
68
+ const style = {
69
+ animationName: 'existingAnimation',
70
+ };
71
+ const result = plugin(style, mockContext);
72
+ expect(result.animationName).toBe('existingAnimation');
73
+ expect(mockContext.createNode).not.toHaveBeenCalled();
74
+ });
75
+ });
76
+ //# sourceMappingURL=embedded.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded.test.js","sour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,EAAE,WAAkB,CAAC,CAAA;QAEvD,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3C,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC3D,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAA;QACvC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;QAE/B,MAAM,KAAK,GAAG;YACZ,aAAa,EAAE,mBAAmB;SACnC,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,EAAE,WAAkB,CAAC,CAAA;QAEvD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QACtD,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACvD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=enforceLonghand.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforceLonghand.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/enforceLonghand.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,88 @@
1
+ import { describe, test, expect } from 'vitest';
2
+ import enforceLonghandPlugin from '../enforceLonghand';
3
+ describe('enforceLonghandPlugin', () => {
4
+ test('returns a sort function', () => {
5
+ const plugin = enforceLonghandPlugin();
6
+ expect(typeof plugin).toBe('function');
7
+ });
8
+ test('sorts shorthand before longhand with default mode', () => {
9
+ const plugin = enforceLonghandPlugin('none');
10
+ const style = {
11
+ marginLeft: 10,
12
+ margin: 5,
13
+ };
14
+ const result = plugin(style);
15
+ const keys = Object.keys(result);
16
+ expect(keys[0]).toBe('margin');
17
+ expect(keys[1]).toBe('marginLeft');
18
+ });
19
+ test('sorts padding shorthand before longhand', () => {
20
+ const plugin = enforceLonghandPlugin();
21
+ const style = {
22
+ paddingTop: 10,
23
+ padding: 5,
24
+ };
25
+ const result = plugin(style);
26
+ const keys = Object.keys(result);
27
+ expect(keys[0]).toBe('padding');
28
+ expect(keys[1]).toBe('paddingTop');
29
+ });
30
+ test('handles border properties with longhand mode', () => {
31
+ const plugin = enforceLonghandPlugin('longhand');
32
+ const style = {
33
+ borderColor: 'red',
34
+ border: '1px solid black',
35
+ };
36
+ const result = plugin(style);
37
+ const keys = Object.keys(result);
38
+ // With longhand mode, borderColor should come after border
39
+ expect(keys.indexOf('border')).toBeLessThan(keys.indexOf('borderColor'));
40
+ });
41
+ test('handles border properties with directional mode', () => {
42
+ const plugin = enforceLonghandPlugin('directional');
43
+ const style = {
44
+ borderTop: '1px solid red',
45
+ border: '1px solid black',
46
+ };
47
+ const result = plugin(style);
48
+ const keys = Object.keys(result);
49
+ // With directional mode, borderTop should come after border
50
+ expect(keys.indexOf('border')).toBeLessThan(keys.indexOf('borderTop'));
51
+ });
52
+ test('handles flex properties', () => {
53
+ const plugin = enforceLonghandPlugin();
54
+ const style = {
55
+ flexBasis: '100%',
56
+ flex: '1 1 auto',
57
+ };
58
+ const result = plugin(style);
59
+ const keys = Object.keys(result);
60
+ expect(keys.indexOf('flex')).toBeLessThan(keys.indexOf('flexBasis'));
61
+ });
62
+ test('handles background properties', () => {
63
+ const plugin = enforceLonghandPlugin();
64
+ const style = {
65
+ backgroundColor: 'red',
66
+ background: 'blue',
67
+ };
68
+ const result = plugin(style);
69
+ const keys = Object.keys(result);
70
+ expect(keys.indexOf('background')).toBeLessThan(keys.indexOf('backgroundColor'));
71
+ });
72
+ test('handles nested styles', () => {
73
+ const plugin = enforceLonghandPlugin();
74
+ const style = {
75
+ margin: 5,
76
+ marginLeft: 10,
77
+ ':hover': {
78
+ padding: 5,
79
+ paddingTop: 10,
80
+ },
81
+ };
82
+ const result = plugin(style);
83
+ const hoverKeys = Object.keys(result[':hover']);
84
+ expect(hoverKeys[0]).toBe('padding');
85
+ expect(hoverKeys[1]).toBe('paddingTop');
86
+ });
87
+ });
88
+ //# sourceMappingURL=enforceLonghand.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforceLonghand.test.js","sourceRoot":"","sources":["../../../src/plugins/__tests__/enforceLonghand.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/C,OAAO,qBAAqB,MAAM,oBAAoB,CAAA;AAEtD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAA;QAEtC,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC7D,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;QAE5C,MAAM,KAAK,GAAG;YACZ,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,CAAC;SACV,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,CAAC,CAAA;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEhC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACnD,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAA;QAEtC,MAAM,KAAK,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F,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,CAAC,CAAA;QACnC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAE,CAAC,CAAA;QAEhD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACpC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fallbackValue.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallbackValue.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/fallbackValue.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,94 @@
1
+ import { describe, test, expect, vi } from 'vitest';
2
+ import fallbackValuePlugin from '../fallbackValue';
3
+ describe('fallbackValuePlugin', () => {
4
+ const createMockContext = () => ({
5
+ createNode: vi.fn(),
6
+ mergeStyle: vi.fn(),
7
+ props: {},
8
+ });
9
+ test('returns style unchanged with no fallbacks', () => {
10
+ const mockContext = createMockContext();
11
+ const plugin = fallbackValuePlugin([]);
12
+ const style = { color: 'red', width: 100 };
13
+ const result = plugin(style, mockContext);
14
+ expect(result.color).toBe('red');
15
+ expect(result.width).toBe(100);
16
+ expect(mockContext.createNode).not.toHaveBeenCalled();
17
+ });
18
+ test('applies fallback when property and value match', () => {
19
+ const mockContext = createMockContext();
20
+ const plugin = fallbackValuePlugin([
21
+ {
22
+ property: ['width'],
23
+ fallback: (value) => value === 'fit-content'
24
+ ? ['-webkit-fit-content', 'fit-content']
25
+ : undefined,
26
+ },
27
+ ]);
28
+ const style = { width: 'fit-content' };
29
+ const result = plugin(style, mockContext);
30
+ expect(result.width).toContain('var(');
31
+ expect(mockContext.createNode).toHaveBeenCalled();
32
+ });
33
+ test('does not apply fallback when value does not match', () => {
34
+ const mockContext = createMockContext();
35
+ const plugin = fallbackValuePlugin([
36
+ {
37
+ property: ['width'],
38
+ fallback: (value) => value === 'fit-content' ? ['fit-content'] : undefined,
39
+ },
40
+ ]);
41
+ const style = { width: '100px' };
42
+ const result = plugin(style, mockContext);
43
+ expect(result.width).toBe('100px');
44
+ expect(mockContext.createNode).not.toHaveBeenCalled();
45
+ });
46
+ test('does not apply fallback when property does not match', () => {
47
+ const mockContext = createMockContext();
48
+ const plugin = fallbackValuePlugin([
49
+ {
50
+ property: ['width'],
51
+ fallback: (value) => value === 'min-content' ? ['-webkit-min-content'] : undefined,
52
+ },
53
+ ]);
54
+ const style = { height: 'min-content' };
55
+ const result = plugin(style, mockContext);
56
+ expect(result.height).toBe('min-content');
57
+ expect(mockContext.createNode).not.toHaveBeenCalled();
58
+ });
59
+ test('handles nested style objects', () => {
60
+ const mockContext = createMockContext();
61
+ const plugin = fallbackValuePlugin([
62
+ {
63
+ property: ['width'],
64
+ fallback: (value) => value === 'max-content'
65
+ ? ['-webkit-max-content', 'max-content']
66
+ : undefined,
67
+ },
68
+ ]);
69
+ const style = {
70
+ ':hover': { width: 'max-content' },
71
+ };
72
+ const result = plugin(style, mockContext);
73
+ expect(result[':hover']?.width).toContain('var(');
74
+ });
75
+ test('handles multiple fallback rules', () => {
76
+ const mockContext = createMockContext();
77
+ const plugin = fallbackValuePlugin([
78
+ {
79
+ property: ['width'],
80
+ fallback: (value) => value === 'min-content' ? ['-webkit-min-content'] : undefined,
81
+ },
82
+ {
83
+ property: ['height'],
84
+ fallback: (value) => value === 'max-content' ? ['-webkit-max-content'] : undefined,
85
+ },
86
+ ]);
87
+ const style = { width: 'min-content', height: 'max-content' };
88
+ const result = plugin(style, mockContext);
89
+ expect(result.width).toContain('var(');
90
+ expect(result.height).toContain('var(');
91
+ expect(mockContext.createNode).toHaveBeenCalledTimes(2);
92
+ });
93
+ });
94
+ //# sourceMappingURL=fallbackValue.test.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,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,SAAS;aAChE;YACD;gBACE,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,SAAS;aAChE;SACF,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;QAE7D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,EAAE,WAAkB,CAAC,CAAA;QAEvD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACtC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACvC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=logger.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/logger.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import { describe, test, expect, vi, beforeEach, afterEach } from 'vitest';
2
+ import loggerPlugin from '../logger';
3
+ describe('loggerPlugin', () => {
4
+ const originalConsole = console.log;
5
+ beforeEach(() => {
6
+ console.log = vi.fn();
7
+ });
8
+ afterEach(() => {
9
+ console.log = originalConsole;
10
+ });
11
+ test('logs style object', () => {
12
+ const plugin = loggerPlugin();
13
+ const style = { color: 'red', fontSize: 16 };
14
+ plugin(style);
15
+ expect(console.log).toHaveBeenCalledWith(expect.objectContaining(style));
16
+ });
17
+ test('returns the original style unchanged', () => {
18
+ const plugin = loggerPlugin();
19
+ const style = { color: 'red' };
20
+ const result = plugin(style);
21
+ expect(result).toBe(style);
22
+ });
23
+ test('uses prefix when provided', () => {
24
+ const plugin = loggerPlugin({ prefix: 'STYLE:' });
25
+ const style = { color: 'blue' };
26
+ plugin(style);
27
+ expect(console.log).toHaveBeenCalledWith('STYLE:', expect.any(Object));
28
+ });
29
+ test('stringifies when stringify option is true', () => {
30
+ const plugin = loggerPlugin({ stringify: true });
31
+ const style = { color: 'green' };
32
+ plugin(style);
33
+ expect(console.log).toHaveBeenCalledWith(JSON.stringify(style));
34
+ });
35
+ test('clones style by default', () => {
36
+ const plugin = loggerPlugin();
37
+ const style = { color: 'red' };
38
+ plugin(style);
39
+ const loggedValue = console.log.mock.calls[0][0];
40
+ expect(loggedValue).not.toBe(style);
41
+ expect(loggedValue).toEqual(style);
42
+ });
43
+ test('does not clone when clone is false', () => {
44
+ const plugin = loggerPlugin({ clone: false });
45
+ const style = { color: 'red' };
46
+ plugin(style);
47
+ const loggedValue = console.log.mock.calls[0][0];
48
+ expect(loggedValue).toBe(style);
49
+ });
50
+ test('prefix and stringify work together', () => {
51
+ const plugin = loggerPlugin({ prefix: 'DEBUG:', stringify: true });
52
+ const style = { margin: 10 };
53
+ plugin(style);
54
+ expect(console.log).toHaveBeenCalledWith('DEBUG:', JSON.stringify(style));
55
+ });
56
+ });
57
+ //# sourceMappingURL=logger.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.test.js","sourceRoot":"","sources":["../../../src/plugins/__tests__/logger.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE1E,OAAO,YAAY,MAAM,WAAW,CA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,CAAA;QACzD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAClE,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;QAE5B,MAAM,CAAC,KAAK,CAAC,CAAA;QAEb,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prefixer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefixer.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/prefixer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { describe, test, expect } from 'vitest';
2
+ import prefixerPlugin from '../prefixer';
3
+ describe('prefixerPlugin', () => {
4
+ test('adds webkit prefix to appropriate properties', () => {
5
+ const plugin = prefixerPlugin();
6
+ const style = { appearance: 'none' };
7
+ const result = plugin(style);
8
+ expect(result.WebkitAppearance).toBe('none');
9
+ expect(result.appearance).toBe('none');
10
+ });
11
+ test('adds webkit prefix to userSelect', () => {
12
+ const plugin = prefixerPlugin();
13
+ const style = { userSelect: 'none' };
14
+ const result = plugin(style);
15
+ expect(result.WebkitUserSelect).toBe('none');
16
+ expect(result.userSelect).toBe('none');
17
+ });
18
+ test('adds webkit prefix to backdropFilter', () => {
19
+ const plugin = prefixerPlugin();
20
+ const style = { backdropFilter: 'blur(10px)' };
21
+ const result = plugin(style);
22
+ expect(result.WebkitBackdropFilter).toBe('blur(10px)');
23
+ expect(result.backdropFilter).toBe('blur(10px)');
24
+ });
25
+ test('adds moz prefix to tabSize', () => {
26
+ const plugin = prefixerPlugin();
27
+ const style = { tabSize: 4 };
28
+ const result = plugin(style);
29
+ expect(result.MozTabSize).toBe(4);
30
+ expect(result.tabSize).toBe(4);
31
+ });
32
+ test('does not prefix standard properties', () => {
33
+ const plugin = prefixerPlugin();
34
+ const style = { color: 'red', fontSize: 16 };
35
+ const result = plugin(style);
36
+ expect('WebkitColor' in result).toBeFalsy();
37
+ expect(result.color).toBe('red');
38
+ });
39
+ test('handles nested style objects', () => {
40
+ const plugin = prefixerPlugin();
41
+ const style = {
42
+ appearance: 'none',
43
+ ':hover': { userSelect: 'text' },
44
+ };
45
+ const result = plugin(style);
46
+ expect(result.WebkitAppearance).toBe('none');
47
+ expect(result[':hover']?.WebkitUserSelect).toBe('text');
48
+ });
49
+ test('prefixes mask properties', () => {
50
+ const plugin = prefixerPlugin();
51
+ const style = { maskImage: 'url(mask.png)' };
52
+ const result = plugin(style);
53
+ expect(result.WebkitMaskImage).toBe('url(mask.png)');
54
+ expect(result.maskImage).toBe('url(mask.png)');
55
+ });
56
+ test('prefixes clipPath', () => {
57
+ const plugin = prefixerPlugin();
58
+ const style = { clipPath: 'circle(50%)' };
59
+ const result = plugin(style);
60
+ expect(result.WebkitClipPath).toBe('circle(50%)');
61
+ expect(result.clipPath).toBe('circle(50%)');
62
+ });
63
+ });
64
+ //# sourceMappingURL=prefixer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefixer.test.js","sourceRoot":"","sources":["../../../src/plugins/__tests__/prefixer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/C,OAAO,cAAc,MAAM,aAAa,CAAA;AAExC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;QAC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AK,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;QAE5C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,CAAC,CAAA;QAEnC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACpD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC7B,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;QAC/B,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;QAEzC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,CAAC,CAAA;QAEnC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACjD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pseudoElement.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pseudoElement.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/pseudoElement.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,92 @@
1
+ import { describe, test, expect, vi } from 'vitest';
2
+ import pseudoElementPlugin from '../pseudoElement';
3
+ describe('pseudoElementPlugin', () => {
4
+ const createMockContext = () => ({
5
+ createNode: vi.fn(),
6
+ mergeStyle: vi.fn(),
7
+ props: {},
8
+ });
9
+ test('extracts pseudo element styles and creates node', () => {
10
+ const mockContext = createMockContext();
11
+ const plugin = pseudoElementPlugin();
12
+ const style = {
13
+ color: 'red',
14
+ '::before': {
15
+ content: '""',
16
+ display: 'block',
17
+ },
18
+ };
19
+ const result = plugin(style, mockContext);
20
+ // Pseudo element should be removed from style
21
+ expect(result['::before']).toBeUndefined();
22
+ expect(result.color).toBe('red');
23
+ // Node should be created
24
+ expect(mockContext.createNode).toHaveBeenCalled();
25
+ // data-style-id should be set
26
+ expect(mockContext.props['data-style-id']).toBeDefined();
27
+ });
28
+ test('handles ::after pseudo element', () => {
29
+ const mockContext = createMockContext();
30
+ const plugin = pseudoElementPlugin();
31
+ const style = {
32
+ '::after': {
33
+ content: '"→"',
34
+ marginLeft: 8,
35
+ },
36
+ };
37
+ const result = plugin(style, mockContext);
38
+ expect(result['::after']).toBeUndefined();
39
+ expect(mockContext.createNode).toHaveBeenCalled();
40
+ });
41
+ test('preserves non-pseudo-element nested styles', () => {
42
+ const mockContext = createMockContext();
43
+ const plugin = pseudoElementPlugin();
44
+ const style = {
45
+ ':hover': {
46
+ color: 'blue',
47
+ },
48
+ };
49
+ const result = plugin(style, mockContext);
50
+ expect(result[':hover']).toEqual({ color: 'blue' });
51
+ expect(mockContext.createNode).not.toHaveBeenCalled();
52
+ });
53
+ test('handles nested pseudo elements', () => {
54
+ const mockContext = createMockContext();
55
+ const plugin = pseudoElementPlugin();
56
+ const style = {
57
+ ':hover': {
58
+ '::before': {
59
+ opacity: 1,
60
+ },
61
+ },
62
+ };
63
+ const result = plugin(style, mockContext);
64
+ // The ::before inside :hover should be processed
65
+ expect(result[':hover']?.['::before']).toBeUndefined();
66
+ expect(mockContext.createNode).toHaveBeenCalled();
67
+ });
68
+ test('handles multiple pseudo elements', () => {
69
+ const mockContext = createMockContext();
70
+ const plugin = pseudoElementPlugin();
71
+ const style = {
72
+ '::before': { content: '"←"' },
73
+ '::after': { content: '"→"' },
74
+ };
75
+ const result = plugin(style, mockContext);
76
+ expect(result['::before']).toBeUndefined();
77
+ expect(result['::after']).toBeUndefined();
78
+ expect(mockContext.createNode).toHaveBeenCalledTimes(2);
79
+ });
80
+ test('passes through primitive values', () => {
81
+ const mockContext = createMockContext();
82
+ const plugin = pseudoElementPlugin();
83
+ const style = {
84
+ fontSize: 16,
85
+ lineHeight: 1.5,
86
+ };
87
+ const result = plugin(style, mockContext);
88
+ expect(result.fontSize).toBe(16);
89
+ expect(result.lineHeight).toBe(1.5);
90
+ });
91
+ });
92
+ //# sourceMappingURL=pseudoElement.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pseudoElement.test.js","sourceRoot":"","sources":["../../../src/plugins/__tests__/pseudoElement.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEnD,OAAO,mBAAmB,MAAM,kBAAkB,CAAA;AAElD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC;QAC/B,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;QACnB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;QACnB,KAAK,EAAE,EAAyB;KACjC,CAAC,CAAA;IAEF,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC3D,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAA;QACvC,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;QAEpC,MAAM,KAAK,GAAG;YACZ,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE;gBACV,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,OAAO;aACjB;SACF,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAY,EAAE,WAAkB,CAAC,CAAA;QAEvD,8CAA8C;QAC9C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QAC1C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEhC,yBAAyB;QACzB,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAEj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E,WAAkB,CAAC,CAAA;QAEvD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAChC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=responsiveValue.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsiveValue.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/responsiveValue.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ import { describe, test, expect } from 'vitest';
2
+ import responsiveValuePlugin, { responsiveValue } from '../responsiveValue';
3
+ describe('responsiveValuePlugin', () => {
4
+ const mediaQueries = [
5
+ '@media (min-width: 480px)',
6
+ '@media (min-width: 768px)',
7
+ '@media (min-width: 1024px)',
8
+ ];
9
+ test('expands array values to media queries', () => {
10
+ const plugin = responsiveValuePlugin(mediaQueries);
11
+ const result = plugin({ fontSize: responsiveValue([16, 18, 20, 24]) });
12
+ expect(result.fontSize).toBe(16);
13
+ expect(result['@media (min-width: 480px)']).toEqual({ fontSize: 18 });
14
+ expect(result['@media (min-width: 768px)']).toEqual({ fontSize: 20 });
15
+ expect(result['@media (min-width: 1024px)']).toEqual({ fontSize: 24 });
16
+ });
17
+ test('first value is default', () => {
18
+ const plugin = responsiveValuePlugin(mediaQueries);
19
+ const result = plugin({ padding: responsiveValue([8, 16]) });
20
+ expect(result.padding).toBe(8);
21
+ expect(result['@media (min-width: 480px)']).toEqual({ padding: 16 });
22
+ });
23
+ test('handles null/undefined values in array', () => {
24
+ const plugin = responsiveValuePlugin(mediaQueries);
25
+ const result = plugin({ margin: [8, undefined, 16] });
26
+ expect(result.margin).toBe(8);
27
+ expect(result['@media (min-width: 480px)']).toBeUndefined();
28
+ expect(result['@media (min-width: 768px)']).toEqual({ margin: 16 });
29
+ });
30
+ test('does not modify non-array values', () => {
31
+ const plugin = responsiveValuePlugin(mediaQueries);
32
+ const result = plugin({ color: 'red', padding: 8 });
33
+ expect(result.color).toBe('red');
34
+ expect(result.padding).toBe(8);
35
+ });
36
+ test('handles nested objects', () => {
37
+ const plugin = responsiveValuePlugin(mediaQueries);
38
+ const result = plugin({
39
+ ':hover': { fontSize: [14, 16] },
40
+ });
41
+ expect(result[':hover']?.fontSize).toBe(14);
42
+ expect(result[':hover']?.['@media (min-width: 480px)']).toEqual({
43
+ fontSize: 16,
44
+ });
45
+ });
46
+ test('handles multiple responsive properties', () => {
47
+ const plugin = responsiveValuePlugin(mediaQueries);
48
+ const result = plugin({
49
+ fontSize: responsiveValue([16, 18]),
50
+ padding: responsiveValue([8, 12]),
51
+ });
52
+ expect(result.fontSize).toBe(16);
53
+ expect(result.padding).toBe(8);
54
+ expect(result['@media (min-width: 480px)']).toEqual({
55
+ fontSize: 18,
56
+ padding: 12,
57
+ });
58
+ });
59
+ test('limits to number of media queries', () => {
60
+ const plugin = responsiveValuePlugin(['@media (min-width: 480px)']);
61
+ const result = plugin({ fontSize: responsiveValue([16, 18, 20, 24]) });
62
+ // Only first media query value used
63
+ expect(result.fontSize).toBe(16);
64
+ expect(result['@media (min-width: 480px)']).toEqual({ fontSize: 18 });
65
+ expect(result['@media (min-width: 768px)']).toBeUndefined();
66
+ });
67
+ });
68
+ //# sourceMappingURL=responsiveValue.test.js.map