@payfit/unity-themes 2.55.22 → 2.56.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 (52) hide show
  1. package/dist/esm/scripts/style-dictionary-config.d.ts +14 -0
  2. package/package.json +14 -5
  3. package/skills/unity-themes/SKILL.md +45 -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
package/src/utils/cn.ts DELETED
@@ -1,109 +0,0 @@
1
- import { cnMerge } from 'tailwind-variants'
2
-
3
- import { twMergeConfig } from './merge-config'
4
-
5
- /**
6
- * Internal Unity-configured class name utility function.
7
- * @internal
8
- */
9
- const uyCn = (...params: Parameters<typeof cnMerge>) =>
10
- cnMerge(...params)({
11
- twMerge: true,
12
- twMergeConfig,
13
- })
14
-
15
- /**
16
- * Unity-configured class name utility function for merging CSS classes.
17
- *
18
- * This is a pre-configured version of tailwind-variants' `cn` function that includes
19
- * Unity's custom tailwind-merge configuration. It automatically handles Unity's custom
20
- * class names and resolves conflicts according to Unity design system rules.
21
- * @param classes - CSS class names to merge
22
- * @returns Merged and deduplicated class string
23
- * @example
24
- * ```tsx
25
- * import { cn } from '@payfit/unity-themes'
26
- *
27
- * // Basic usage
28
- * const className = cn('uy:p-200', 'uy:bg-surface-primary-default')
29
- * // → 'uy:p-200 uy:bg-surface-primary-default'
30
- *
31
- * // Conflict resolution - last class wins
32
- * const className = cn('uy:bg-surface-primary-default', 'uy:bg-surface-danger-default')
33
- * // → 'uy:bg-surface-danger-default'
34
- *
35
- * // Conditional classes
36
- * const className = cn(
37
- * 'uy:px-200 uy:py-100',
38
- * isActive && 'uy:bg-surface-primary-default',
39
- * isDisabled && 'uy:bg-surface-neutral-disabled'
40
- * )
41
- *
42
- * // With component props
43
- * function Button({ variant, size, className: extraClasses, ...props }) {
44
- * return (
45
- * <button
46
- * className={cn(
47
- * 'uy:px-200 uy:py-100 uy:rounded-100', // base styles
48
- * variant === 'primary' && 'uy:bg-surface-primary-default',
49
- * variant === 'secondary' && 'uy:bg-surface-neutral-default',
50
- * size === 'large' && 'uy:px-300 uy:py-150',
51
- * extraClasses // allow override
52
- * )}
53
- * {...props}
54
- * />
55
- * )
56
- * }
57
- * ```
58
- * @description
59
- * - Automatically merges conflicting Unity classes using Unity's design system rules
60
- * - Supports all Unity design tokens: semantic colors, primitive colors, spacing, typography, etc.
61
- * - Handles conditional classes (falsy values are ignored)
62
- * - Compatible with standard Tailwind classes alongside Unity classes
63
- * - Removes duplicate classes and resolves conflicts intelligently
64
- * @see {@link uyMerge} for the underlying merge function
65
- * @see {@link twMergeConfig} for the Unity merge configuration details
66
- */
67
- export const cn = uyCn
68
-
69
- /**
70
- * Alias for {@link cn} - Unity-configured class name utility function.
71
- *
72
- * This function is identical to `cn` but provides a more descriptive name
73
- * for developers who prefer explicit naming conventions.
74
- * @param classes - CSS class names to merge
75
- * @returns Merged and deduplicated class string
76
- * @example
77
- * ```tsx
78
- * import { classNames } from '@payfit/unity-themes'
79
- *
80
- * const buttonClasses = classNames(
81
- * 'uy:px-200 uy:py-100',
82
- * 'uy:bg-surface-primary-default',
83
- * 'uy:text-content-inverted-default'
84
- * )
85
- * ```
86
- * @see {@link cn} for detailed documentation and examples
87
- */
88
- export const classNames = uyCn
89
-
90
- /**
91
- * Alias for {@link cn} - Unity-configured class name utility function.
92
- *
93
- * This function is identical to `cn` but follows the naming convention
94
- * popularized by the `clsx` library for developers familiar with that API.
95
- * @param classes - CSS class names to merge
96
- * @returns Merged and deduplicated class string
97
- * @example
98
- * ```tsx
99
- * import { clsx } from '@payfit/unity-themes'
100
- *
101
- * const cardClasses = clsx(
102
- * 'uy:p-300 uy:rounded-200',
103
- * 'uy:bg-surface-neutral-default',
104
- * isHighlighted && 'uy:border-border-primary-default'
105
- * )
106
- * ```
107
- * @see {@link cn} for detailed documentation and examples
108
- */
109
- export const clsx = uyCn
@@ -1,194 +0,0 @@
1
- import { validators } from 'tailwind-merge'
2
-
3
- // Unity spacing scale values
4
- const unitySpacing = [
5
- '0',
6
- '25',
7
- '50',
8
- '75',
9
- '100',
10
- '125',
11
- '150',
12
- '200',
13
- '250',
14
- '300',
15
- '400',
16
- '500',
17
- '600',
18
- '800',
19
- '1000',
20
- ]
21
-
22
- // Unity typography classes - actual generated class names (without -sm variants)
23
- const unityTypography = [
24
- 'display-heading',
25
- 'h1',
26
- 'h2',
27
- 'h3',
28
- 'h4',
29
- 'overline',
30
- 'subtitle',
31
- 'display-title',
32
- 'display-body',
33
- 'body',
34
- 'body-strong',
35
- 'body-small',
36
- 'body-small-strong',
37
- 'body-large',
38
- 'body-large-strong',
39
- 'action',
40
- 'action-small',
41
- 'action-large',
42
- ]
43
-
44
- // Unity font sizes
45
- const unityFontSizes = [
46
- '50',
47
- '75',
48
- '100',
49
- '200',
50
- '300',
51
- '400',
52
- '500',
53
- '600',
54
- '800',
55
- '1000',
56
- '1200',
57
- '1400',
58
- '1600',
59
- ]
60
-
61
- // Unity border radius values
62
- const unityBorderRadius = [
63
- '0',
64
- '25',
65
- '50',
66
- '75',
67
- '100',
68
- '125',
69
- '150',
70
- '200',
71
- '300',
72
- '400',
73
- 'xs',
74
- 'sm',
75
- 'md',
76
- 'lg',
77
- 'xl',
78
- 'circle',
79
- 'pill',
80
- ]
81
-
82
- // Unity shadow values
83
- const unityShadows = ['canvas', 'raising', 'floating', 'flying', 'soaring']
84
-
85
- // Custom validator for Unity colors
86
- const isUnityColor = (value: string): boolean => {
87
- // Primitive colors: {color}-l{number}
88
- if (/^[a-z]+-l\d+$/.test(value)) return true
89
- // Semantic colors: {category}-{type}-{variant}(-{state})?
90
- if (/^(?:canvas|surface|content|border|utility)-.+$/.test(value)) return true
91
- return false
92
- }
93
-
94
- export const twMergeConfig = {
95
- prefix: 'uy',
96
- extend: {
97
- classGroups: {
98
- // Colors - Use pattern matching for maintainability
99
- // Matches primitive colors like: grayscale-l0, red-l1, blue-l12, etc.
100
- // Matches semantic colors like: surface-primary-default, content-neutral-low, border-danger-default, etc.
101
- 'bg-color': [{ bg: [validators.isArbitraryValue, isUnityColor] }],
102
- 'text-color': [{ text: [validators.isArbitraryValue, isUnityColor] }],
103
- 'border-color': [{ border: [validators.isArbitraryValue, isUnityColor] }],
104
- 'outline-color': [
105
- { outline: [validators.isArbitraryValue, isUnityColor] },
106
- ],
107
- 'ring-color': [{ ring: [validators.isArbitraryValue, isUnityColor] }],
108
- 'ring-offset-color': [
109
- { 'ring-offset': [validators.isArbitraryValue, isUnityColor] },
110
- ],
111
- 'divide-color': [{ divide: [validators.isArbitraryValue, isUnityColor] }],
112
- 'text-decoration-color': [
113
- { decoration: [validators.isArbitraryValue, isUnityColor] },
114
- ],
115
- 'gradient-color-from': [
116
- { from: [validators.isArbitraryValue, isUnityColor] },
117
- ],
118
- 'gradient-color-via': [
119
- { via: [validators.isArbitraryValue, isUnityColor] },
120
- ],
121
- 'gradient-color-to': [
122
- { to: [validators.isArbitraryValue, isUnityColor] },
123
- ],
124
- // Spacing - Padding
125
- p: [{ p: unitySpacing }],
126
- px: [{ px: unitySpacing }],
127
- py: [{ py: unitySpacing }],
128
- ps: [{ ps: unitySpacing }],
129
- pe: [{ pe: unitySpacing }],
130
- pt: [{ pt: unitySpacing }],
131
- pr: [{ pr: unitySpacing }],
132
- pb: [{ pb: unitySpacing }],
133
- pl: [{ pl: unitySpacing }],
134
- // Spacing - Margin
135
- m: [{ m: unitySpacing }],
136
- mx: [{ mx: unitySpacing }],
137
- my: [{ my: unitySpacing }],
138
- ms: [{ ms: unitySpacing }],
139
- me: [{ me: unitySpacing }],
140
- mt: [{ mt: unitySpacing }],
141
- mr: [{ mr: unitySpacing }],
142
- mb: [{ mb: unitySpacing }],
143
- ml: [{ ml: unitySpacing }],
144
- // Spacing - Gap
145
- gap: [{ gap: unitySpacing }],
146
- 'gap-x': [{ 'gap-x': unitySpacing }],
147
- 'gap-y': [{ 'gap-y': unitySpacing }],
148
- // Spacing - Space between
149
- 'space-x': [{ 'space-x': unitySpacing }],
150
- 'space-y': [{ 'space-y': unitySpacing }],
151
- // Spacing - Scroll padding
152
- 'scroll-p': [{ 'scroll-p': unitySpacing }],
153
- 'scroll-px': [{ 'scroll-px': unitySpacing }],
154
- 'scroll-py': [{ 'scroll-py': unitySpacing }],
155
- 'scroll-ps': [{ 'scroll-ps': unitySpacing }],
156
- 'scroll-pe': [{ 'scroll-pe': unitySpacing }],
157
- 'scroll-pt': [{ 'scroll-pt': unitySpacing }],
158
- 'scroll-pr': [{ 'scroll-pr': unitySpacing }],
159
- 'scroll-pb': [{ 'scroll-pb': unitySpacing }],
160
- 'scroll-pl': [{ 'scroll-pl': unitySpacing }],
161
- // Spacing - Scroll margin
162
- 'scroll-m': [{ 'scroll-m': unitySpacing }],
163
- 'scroll-mx': [{ 'scroll-mx': unitySpacing }],
164
- 'scroll-my': [{ 'scroll-my': unitySpacing }],
165
- 'scroll-ms': [{ 'scroll-ms': unitySpacing }],
166
- 'scroll-me': [{ 'scroll-me': unitySpacing }],
167
- 'scroll-mt': [{ 'scroll-mt': unitySpacing }],
168
- 'scroll-mr': [{ 'scroll-mr': unitySpacing }],
169
- 'scroll-mb': [{ 'scroll-mb': unitySpacing }],
170
- 'scroll-ml': [{ 'scroll-ml': unitySpacing }],
171
- // Typography
172
- typography: [{ typography: unityTypography }],
173
- 'font-size': [{ text: unityFontSizes }],
174
- // Border radius
175
- rounded: [{ rounded: unityBorderRadius }],
176
- 'rounded-s': [{ 'rounded-s': unityBorderRadius }],
177
- 'rounded-e': [{ 'rounded-e': unityBorderRadius }],
178
- 'rounded-t': [{ 'rounded-t': unityBorderRadius }],
179
- 'rounded-r': [{ 'rounded-r': unityBorderRadius }],
180
- 'rounded-b': [{ 'rounded-b': unityBorderRadius }],
181
- 'rounded-l': [{ 'rounded-l': unityBorderRadius }],
182
- 'rounded-ss': [{ 'rounded-ss': unityBorderRadius }],
183
- 'rounded-se': [{ 'rounded-se': unityBorderRadius }],
184
- 'rounded-ee': [{ 'rounded-ee': unityBorderRadius }],
185
- 'rounded-es': [{ 'rounded-es': unityBorderRadius }],
186
- 'rounded-tl': [{ 'rounded-tl': unityBorderRadius }],
187
- 'rounded-tr': [{ 'rounded-tr': unityBorderRadius }],
188
- 'rounded-br': [{ 'rounded-br': unityBorderRadius }],
189
- 'rounded-bl': [{ 'rounded-bl': unityBorderRadius }],
190
- // Shadows
191
- shadow: [{ shadow: unityShadows }],
192
- },
193
- },
194
- }