@payfit/unity-themes 2.55.21 → 2.55.23

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 (52) hide show
  1. package/dist/esm/scripts/style-dictionary-config.d.ts +14 -0
  2. package/package.json +20 -11
  3. package/skills/unity-themes/SKILL.md +41 -0
  4. package/src/agent-references/manifest.json +16 -0
  5. package/src/agent-references/tokens-catalog.json +13891 -0
  6. package/dist/esm/scripts/agent-references/color-reference.d.ts +0 -37
  7. package/src/agent-references/README.mdx +0 -25
  8. package/src/agent-references/primitive-colors.mdx +0 -18
  9. package/src/agent-references/semantic-border-colors.mdx +0 -16
  10. package/src/agent-references/semantic-content-colors.mdx +0 -16
  11. package/src/agent-references/semantic-surface-colors.mdx +0 -16
  12. package/src/agent-references/semantic-utility-colors.mdx +0 -16
  13. package/src/components/unity-theme-provider.stories.tsx +0 -532
  14. package/src/components/unity-theme-provider.test.tsx +0 -150
  15. package/src/components/unity-theme-provider.tsx +0 -72
  16. package/src/index.ts +0 -15
  17. package/src/scripts/actions/append-animations.ts +0 -73
  18. package/src/scripts/actions/compose-multi-theme.ts +0 -59
  19. package/src/scripts/agent-references/color-reference.test.ts +0 -140
  20. package/src/scripts/agent-references/color-reference.ts +0 -348
  21. package/src/scripts/build.ts +0 -420
  22. package/src/scripts/file-headers/unity.ts +0 -31
  23. package/src/scripts/formats/processors/grid-processor.test.ts +0 -378
  24. package/src/scripts/formats/processors/grid-processor.ts +0 -64
  25. package/src/scripts/formats/processors/typography-processor.test.ts +0 -111
  26. package/src/scripts/formats/processors/typography-processor.ts +0 -48
  27. package/src/scripts/formats/unity-theme.test.ts +0 -329
  28. package/src/scripts/formats/unity-theme.ts +0 -54
  29. package/src/scripts/formats/utils.test.ts +0 -264
  30. package/src/scripts/formats/utils.ts +0 -15
  31. package/src/scripts/transforms/oklch.test.ts +0 -166
  32. package/src/scripts/transforms/oklch.ts +0 -19
  33. package/src/scripts/transforms/tailwind-animation-token.test.ts +0 -108
  34. package/src/scripts/transforms/tailwind-animation-token.ts +0 -51
  35. package/src/scripts/transforms/tailwind-color-token.test.ts +0 -304
  36. package/src/scripts/transforms/tailwind-color-token.ts +0 -17
  37. package/src/scripts/transforms/tailwind-grid-token.test.ts +0 -114
  38. package/src/scripts/transforms/tailwind-grid-token.ts +0 -27
  39. package/src/scripts/transforms/tailwind-spacing-token.test.ts +0 -315
  40. package/src/scripts/transforms/tailwind-spacing-token.ts +0 -24
  41. package/src/scripts/transforms/tailwind-text-token.test.ts +0 -328
  42. package/src/scripts/transforms/tailwind-text-token.ts +0 -30
  43. package/src/scripts/transforms/tailwind-typography-token.test.ts +0 -55
  44. package/src/scripts/transforms/tailwind-typography-token.ts +0 -20
  45. package/src/scripts/types.ts +0 -30
  46. package/src/scripts/utils/prefix-transform.test.ts +0 -137
  47. package/src/scripts/utils/prefix-transform.ts +0 -16
  48. package/src/utils/cn.ts +0 -109
  49. package/src/utils/merge-config.ts +0 -194
  50. package/src/utils/tailwind-merge.test.ts +0 -462
  51. package/src/utils/tailwind-merge.ts +0 -77
  52. package/src/utils/tailwind-variants.ts +0 -53
@@ -1,114 +0,0 @@
1
- import type { Token, TransformedToken } from 'style-dictionary'
2
-
3
- import { describe, expect, it } from 'vitest'
4
-
5
- import { filter, transform } from './tailwind-grid-token.js'
6
-
7
- describe('tailwind-grid-token', () => {
8
- describe('filter', () => {
9
- it('should return true for tokens with grid category', () => {
10
- const token: Token = {
11
- name: 'grid-layout-default-columns',
12
- path: ['grid', 'layout', 'default', 'columns'],
13
- original: { $value: 6 },
14
- attributes: {
15
- category: 'grid',
16
- type: 'layout',
17
- item: 'default',
18
- subitem: 'columns',
19
- },
20
- $value: 6,
21
- $type: 'number',
22
- }
23
-
24
- expect(filter(token)).toBe(true)
25
- })
26
-
27
- it('should return false for tokens without grid category', () => {
28
- const token: Token = {
29
- name: 'color-primary',
30
- path: ['color', 'primary'],
31
- original: { $value: '#ff0000' },
32
- attributes: { category: 'color', type: 'primary' },
33
- $value: '#ff0000',
34
- $type: 'color',
35
- }
36
-
37
- expect(filter(token)).toBe(false)
38
- })
39
-
40
- it('should return false for tokens without attributes', () => {
41
- const token: Token = {
42
- name: 'some-token',
43
- path: ['some', 'token'],
44
- original: { $value: 'value' },
45
- $value: 'value',
46
- }
47
-
48
- expect(filter(token)).toBe(false)
49
- })
50
-
51
- it('should return false for tokens with undefined category', () => {
52
- const token: Token = {
53
- name: 'some-token',
54
- path: ['some', 'token'],
55
- original: { $value: 'value' },
56
- attributes: {
57
- category: undefined,
58
- type: undefined,
59
- item: undefined,
60
- subitem: undefined,
61
- },
62
- $value: 'value',
63
- }
64
-
65
- expect(filter(token)).toBe(false)
66
- })
67
- })
68
-
69
- describe('transform', () => {
70
- it('should transform grid token path to expected format', () => {
71
- const token: TransformedToken = {
72
- name: 'grid-layout-default-columns',
73
- path: ['grid', 'layout', 'default', 'columns'],
74
- original: { $value: 6 },
75
- attributes: {
76
- category: 'grid',
77
- type: 'layout',
78
- item: 'default',
79
- subitem: 'columns',
80
- },
81
- $value: 6,
82
- $type: 'number',
83
- filePath: 'test.json',
84
- isSource: true,
85
- }
86
-
87
- const result = transform(token, {}, {})
88
-
89
- expect(result).toBe('grid-layout-columns--default')
90
- })
91
-
92
- it('should prepend prefix when config.prefix is set', () => {
93
- const token: TransformedToken = {
94
- name: 'grid-layout-default-columns',
95
- path: ['grid', 'layout', 'default', 'columns'],
96
- original: { $value: 6 },
97
- attributes: {
98
- category: 'grid',
99
- type: 'layout',
100
- item: 'default',
101
- subitem: 'columns',
102
- },
103
- $value: 6,
104
- $type: 'number',
105
- filePath: 'test.json',
106
- isSource: true,
107
- }
108
-
109
- const result = transform(token, { prefix: 'uy' }, {})
110
-
111
- expect(result).toBe('uy-grid-layout-columns--default')
112
- })
113
- })
114
- })
@@ -1,27 +0,0 @@
1
- import type { Token } from 'style-dictionary'
2
- import type { NameTransform } from 'style-dictionary/types'
3
-
4
- import { prefixTransform } from '../utils/prefix-transform'
5
-
6
- type Transformer = NameTransform['transform']
7
-
8
- export function filter(token: Token): boolean {
9
- return token.attributes?.category === 'grid'
10
- }
11
-
12
- export const tailwindGridTokenNameTransform: Transformer = (token, config) => {
13
- if (!token.attributes) {
14
- return token.name
15
- }
16
- const { category, type, item, subitem } = token.attributes as Record<
17
- string,
18
- string
19
- >
20
- let name = String(category)
21
- if (type) name += `-${type}`
22
- if (subitem) name += `-${subitem}`
23
- if (item) name += `--${item}`
24
- return name
25
- }
26
-
27
- export const transform = prefixTransform(tailwindGridTokenNameTransform)
@@ -1,315 +0,0 @@
1
- import type { Token } from 'style-dictionary'
2
- import type { Config, PlatformConfig } from 'style-dictionary/types'
3
-
4
- import { describe, expect, it } from 'vitest'
5
-
6
- import { filter, transform } from './tailwind-spacing-token.js'
7
-
8
- describe('tailwind spacing token transform', () => {
9
- const createMockToken = (path: string[]): Token =>
10
- ({
11
- name: 'test-token',
12
- value: '1rem',
13
- type: 'spacing',
14
- path,
15
- original: {},
16
- filePath: '',
17
- isSource: false,
18
- }) as Token
19
-
20
- const createMockConfig = (): Config => ({
21
- platforms: {},
22
- source: [],
23
- include: [],
24
- })
25
-
26
- const createMockPlatformConfig = (): PlatformConfig => ({
27
- transforms: [],
28
- buildPath: '',
29
- files: [],
30
- })
31
-
32
- describe('filter', () => {
33
- it('should return true for tokens with spacing as first path element', () => {
34
- const token = createMockToken(['spacing', '1', 'base'])
35
- const config = createMockConfig()
36
-
37
- const result = filter(token, config)
38
-
39
- expect(result).toBe(true)
40
- })
41
-
42
- it('should return false for tokens without spacing as first path element', () => {
43
- const testCases = [
44
- ['color', 'primary', 'default'],
45
- ['typography', 'heading', 'h1'],
46
- ['border', 'width', 'thin'],
47
- ['shadow', 'small'],
48
- ['breakpoint', 'mobile'],
49
- ]
50
-
51
- testCases.forEach(path => {
52
- const token = createMockToken(path)
53
- const config = createMockConfig()
54
-
55
- const result = filter(token, config)
56
-
57
- expect(result).toBe(false)
58
- })
59
- })
60
-
61
- it('should return false for empty path', () => {
62
- const token = createMockToken([])
63
- const config = createMockConfig()
64
-
65
- const result = filter(token, config)
66
-
67
- expect(result).toBe(false)
68
- })
69
-
70
- it('should return false for single element path that is not spacing', () => {
71
- const token = createMockToken(['color'])
72
- const config = createMockConfig()
73
-
74
- const result = filter(token, config)
75
-
76
- expect(result).toBe(false)
77
- })
78
-
79
- it('should handle case sensitivity', () => {
80
- const testCases = [
81
- { path: ['Spacing', '1'], expected: false },
82
- { path: ['SPACING', '1'], expected: false },
83
- { path: ['spacing', '1'], expected: true },
84
- ]
85
-
86
- testCases.forEach(({ path, expected }) => {
87
- const token = createMockToken(path)
88
- const config = createMockConfig()
89
-
90
- const result = filter(token, config)
91
-
92
- expect(result).toBe(expected)
93
- })
94
- })
95
- })
96
-
97
- describe('transform', () => {
98
- it('should join path elements with hyphens, excluding base', () => {
99
- const token = createMockToken(['spacing', '1', 'base'])
100
- const config = createMockPlatformConfig()
101
-
102
- const result = transform(token, config)
103
-
104
- expect(result).toBe('spacing-1')
105
- })
106
-
107
- it('should handle path without base', () => {
108
- const token = createMockToken(['spacing', '1', 'mobile'])
109
- const config = createMockPlatformConfig()
110
-
111
- const result = transform(token, config)
112
-
113
- expect(result).toBe('spacing-1-mobile')
114
- })
115
-
116
- it('should handle path with multiple base occurrences', () => {
117
- const token = createMockToken(['spacing', 'base', '1', 'base'])
118
- const config = createMockPlatformConfig()
119
-
120
- const result = transform(token, config)
121
-
122
- expect(result).toBe('spacing-1')
123
- })
124
-
125
- it('should handle path with only spacing and base', () => {
126
- const token = createMockToken(['spacing', 'base'])
127
- const config = createMockPlatformConfig()
128
-
129
- const result = transform(token, config)
130
-
131
- expect(result).toBe('spacing')
132
- })
133
-
134
- it('should handle path with only spacing', () => {
135
- const token = createMockToken(['spacing'])
136
- const config = createMockPlatformConfig()
137
-
138
- const result = transform(token, config)
139
-
140
- expect(result).toBe('spacing')
141
- })
142
-
143
- it('should handle complex spacing paths', () => {
144
- const testCases = [
145
- { path: ['spacing', '1', 'base'], expected: 'spacing-1' },
146
- { path: ['spacing', '2', 'mobile'], expected: 'spacing-2-mobile' },
147
- {
148
- path: ['spacing', '3', 'base', 'desktop'],
149
- expected: 'spacing-3-desktop',
150
- },
151
- {
152
- path: ['spacing', '4', 'base', 'base', 'tablet'],
153
- expected: 'spacing-4-tablet',
154
- },
155
- ]
156
-
157
- testCases.forEach(({ path, expected }) => {
158
- const token = createMockToken(path)
159
- const config = createMockPlatformConfig()
160
-
161
- const result = transform(token, config)
162
-
163
- expect(result).toBe(expected)
164
- })
165
- })
166
-
167
- it('should handle path with special characters', () => {
168
- const testCases = [
169
- {
170
- path: ['spacing', '1', 'with-dash'],
171
- expected: 'spacing-1-with-dash',
172
- },
173
- {
174
- path: ['spacing', '1', 'with_underscore'],
175
- expected: 'spacing-1-with_underscore',
176
- },
177
- { path: ['spacing', '1', 'with.dot'], expected: 'spacing-1-with.dot' },
178
- ]
179
-
180
- testCases.forEach(({ path, expected }) => {
181
- const token = createMockToken(path)
182
- const config = createMockPlatformConfig()
183
-
184
- const result = transform(token, config)
185
-
186
- expect(result).toBe(expected)
187
- })
188
- })
189
-
190
- it('should handle path with numbers', () => {
191
- const testCases = [
192
- { path: ['spacing', '1', 'base'], expected: 'spacing-1' },
193
- { path: ['spacing', '2', 'mobile'], expected: 'spacing-2-mobile' },
194
- { path: ['spacing', '10', 'desktop'], expected: 'spacing-10-desktop' },
195
- { path: ['spacing', '0.5', 'tablet'], expected: 'spacing-0.5-tablet' },
196
- ]
197
-
198
- testCases.forEach(({ path, expected }) => {
199
- const token = createMockToken(path)
200
- const config = createMockPlatformConfig()
201
-
202
- const result = transform(token, config)
203
-
204
- expect(result).toBe(expected)
205
- })
206
- })
207
-
208
- it('should handle path with mixed content', () => {
209
- const testCases = [
210
- {
211
- path: ['spacing', '1', 'base', 'mobile', 'desktop'],
212
- expected: 'spacing-1-mobile-desktop',
213
- },
214
- {
215
- path: ['spacing', '2', 'base', 'tablet', 'base'],
216
- expected: 'spacing-2-tablet',
217
- },
218
- {
219
- path: ['spacing', '3', 'base', 'base', 'base'],
220
- expected: 'spacing-3',
221
- },
222
- ]
223
-
224
- testCases.forEach(({ path, expected }) => {
225
- const token = createMockToken(path)
226
- const config = createMockPlatformConfig()
227
-
228
- const result = transform(token, config)
229
-
230
- expect(result).toBe(expected)
231
- })
232
- })
233
-
234
- it('should handle edge cases', () => {
235
- const testCases = [
236
- { path: ['spacing', 'base', 'base', 'base'], expected: 'spacing' },
237
- { path: ['spacing', '1', 'base', 'base'], expected: 'spacing-1' },
238
- { path: ['spacing', 'base', '1', 'base'], expected: 'spacing-1' },
239
- { path: ['spacing', 'base', 'base', '1'], expected: 'spacing-1' },
240
- ]
241
-
242
- testCases.forEach(({ path, expected }) => {
243
- const token = createMockToken(path)
244
- const config = createMockPlatformConfig()
245
-
246
- const result = transform(token, config)
247
-
248
- expect(result).toBe(expected)
249
- })
250
- })
251
-
252
- it('should handle empty path elements', () => {
253
- const token = createMockToken(['spacing', '', '1', 'base'])
254
- const config = createMockPlatformConfig()
255
-
256
- const result = transform(token, config)
257
-
258
- expect(result).toBe('spacing--1')
259
- })
260
-
261
- it('should handle path with whitespace', () => {
262
- const token = createMockToken(['spacing', '1', ' ', 'base'])
263
- const config = createMockPlatformConfig()
264
-
265
- const result = transform(token, config)
266
-
267
- expect(result).toBe('spacing-1- ')
268
- })
269
-
270
- it('should handle path with base in different positions', () => {
271
- const testCases = [
272
- { path: ['spacing', 'base', '1'], expected: 'spacing-1' },
273
- { path: ['spacing', '1', 'base'], expected: 'spacing-1' },
274
- { path: ['spacing', 'base', 'base', '1'], expected: 'spacing-1' },
275
- { path: ['spacing', '1', 'base', 'base'], expected: 'spacing-1' },
276
- ]
277
-
278
- testCases.forEach(({ path, expected }) => {
279
- const token = createMockToken(path)
280
- const config = createMockPlatformConfig()
281
-
282
- const result = transform(token, config)
283
-
284
- expect(result).toBe(expected)
285
- })
286
- })
287
-
288
- it('should handle path with base-like strings that are not base', () => {
289
- const testCases = [
290
- { path: ['spacing', '1', 'baseball'], expected: 'spacing-1' },
291
- { path: ['spacing', '1'], expected: 'spacing-1' },
292
- { path: ['spacing', 'base'], expected: 'spacing' },
293
- { path: ['spacing', '1', 'base'], expected: 'spacing-1' },
294
- ]
295
-
296
- testCases.forEach(({ path, expected }) => {
297
- const token = createMockToken(path)
298
- const config = createMockPlatformConfig()
299
-
300
- const result = transform(token, config)
301
-
302
- expect(result).toBe(expected)
303
- })
304
- })
305
-
306
- it('should prepend prefix when config.prefix is set', () => {
307
- const token = createMockToken(['spacing', '1', 'base'])
308
- const config = { ...createMockPlatformConfig(), prefix: 'uy' }
309
-
310
- const result = transform(token, config)
311
-
312
- expect(result).toBe('uy-spacing-1')
313
- })
314
- })
315
- })
@@ -1,24 +0,0 @@
1
- import type { Token } from 'style-dictionary'
2
- import type {
3
- Config,
4
- NameTransform,
5
- PlatformConfig,
6
- } from 'style-dictionary/types'
7
-
8
- import { prefixTransform } from '../utils/prefix-transform'
9
-
10
- type Transformer = NameTransform['transform']
11
-
12
- export function filter(token: Token, options: Config): boolean {
13
- return token.path[0] === 'spacing'
14
- }
15
-
16
- const tailwindSpacingTokenNameTransform: Transformer = (
17
- token: Token,
18
- config: PlatformConfig,
19
- ) => {
20
- const ignoreDefault = (nameToken: string) => !nameToken.includes('base')
21
- return [...(token.path as string[]).filter(ignoreDefault)].join('-')
22
- }
23
-
24
- export const transform = prefixTransform(tailwindSpacingTokenNameTransform)