@salla.sa/twilight-tailwind-theme 2.14.537 → 2.14.539
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.
- package/component-tokens.js +10 -0
- package/generator-globals.js +17 -0
- package/global-utilities.js +153 -0
- package/index.js +5 -331
- package/package.json +6 -3
- package/plugin-core.js +211 -0
- package/utilities.json +1 -1
package/plugin-core.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Shared by index.js (theme plugin) and twilight-components per-component build.
|
|
2
|
+
const globalUtilities = require('./global-utilities');
|
|
3
|
+
|
|
4
|
+
// SAL-73 Phase 3: the new animation system (keyframes, animation utilities and
|
|
5
|
+
// the prefers-reduced-motion overrides) is dormant on master and only registers
|
|
6
|
+
// when TWILIGHT_THEME_V2=true at build time. With the flag off the emitted CSS
|
|
7
|
+
// is identical to the previous release.
|
|
8
|
+
const enableThemeV2 = process.env.TWILIGHT_THEME_V2 === 'true'
|
|
9
|
+
|
|
10
|
+
const v2Keyframes = enableThemeV2 ? {
|
|
11
|
+
fadeInUp: {
|
|
12
|
+
'0%': { transform: 'translateY(20px)', opacity: '0' },
|
|
13
|
+
'100%': { transform: 'translateY(0)', opacity: '1' },
|
|
14
|
+
},
|
|
15
|
+
fadeIn: {
|
|
16
|
+
'0%': { opacity: '0' },
|
|
17
|
+
'100%': { opacity: '1' },
|
|
18
|
+
},
|
|
19
|
+
fadeOut: {
|
|
20
|
+
'0%': { opacity: '1' },
|
|
21
|
+
'100%': { opacity: '0' },
|
|
22
|
+
},
|
|
23
|
+
translateLeft: {
|
|
24
|
+
'0%': { transform: 'translateX(110%)', opacity: '0' },
|
|
25
|
+
'100%': { transform: 'translateX(0)', opacity: '1' },
|
|
26
|
+
},
|
|
27
|
+
translateRight: {
|
|
28
|
+
'0%': { transform: 'translateX(-110%)', opacity: '0' },
|
|
29
|
+
'100%': { transform: 'translateX(0)', opacity: '1' },
|
|
30
|
+
},
|
|
31
|
+
translateLeftOut: {
|
|
32
|
+
'0%': { transform: 'translateX(0)', opacity: '1' },
|
|
33
|
+
'100%': { transform: 'translateX(110%)', opacity: '0' },
|
|
34
|
+
},
|
|
35
|
+
translateRightOut: {
|
|
36
|
+
'0%': { transform: 'translateX(0)', opacity: '1' },
|
|
37
|
+
'100%': { transform: 'translateX(-110%)', opacity: '0' },
|
|
38
|
+
},
|
|
39
|
+
shrinkFly: {
|
|
40
|
+
'0%': { transform: 'scale(1)', opacity: '1' },
|
|
41
|
+
'50%': { transform: 'scale(0.2)', opacity: '1' },
|
|
42
|
+
'100%': { transform: 'scale(0)', opacity: '0' },
|
|
43
|
+
},
|
|
44
|
+
expandHeight: {
|
|
45
|
+
'0%': { height: '0', opacity: '0' },
|
|
46
|
+
'100%': { opacity: '1' },
|
|
47
|
+
},
|
|
48
|
+
collapseHeight: {
|
|
49
|
+
'0%': { opacity: '1' },
|
|
50
|
+
'100%': { height: '0', opacity: '0' },
|
|
51
|
+
},
|
|
52
|
+
slideDownShare: {
|
|
53
|
+
'0%': { transform: 'translateY(-30px) scaleY(0)', opacity: '0' },
|
|
54
|
+
'100%': { transform: 'translateY(0) scaleY(1)', opacity: '1' },
|
|
55
|
+
},
|
|
56
|
+
rubberBand: {
|
|
57
|
+
'0%': { transform: 'scale(1)' },
|
|
58
|
+
'30%': { transform: 'scale(1.25, 0.75)' },
|
|
59
|
+
'40%': { transform: 'scale(0.75, 1.25)' },
|
|
60
|
+
'50%': { transform: 'scale(1.15, 0.85)' },
|
|
61
|
+
'65%': { transform: 'scale(0.95, 1.05)' },
|
|
62
|
+
'75%': { transform: 'scale(1.05, 0.95)' },
|
|
63
|
+
'100%': { transform: 'scale(1)' },
|
|
64
|
+
},
|
|
65
|
+
} : {}
|
|
66
|
+
|
|
67
|
+
const v2Animations = enableThemeV2 ? {
|
|
68
|
+
'fade-in-up': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
69
|
+
'fade-in': 'fadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
70
|
+
'fade-out': 'fadeOut 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
71
|
+
'translate-left': 'translateLeft 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
72
|
+
'translate-right': 'translateRight 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
73
|
+
'translate-left-out': 'translateLeftOut 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
74
|
+
'translate-right-out': 'translateRightOut 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
75
|
+
'shrink-fly': 'shrinkFly 1.7s ease-out forwards',
|
|
76
|
+
'expand-height': 'expandHeight 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955) forwards',
|
|
77
|
+
'collapse-height': 'collapseHeight 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955) forwards',
|
|
78
|
+
'slide-down-share': 'slideDownShare 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards',
|
|
79
|
+
'rubber-band': 'rubberBand 0.8s ease-out',
|
|
80
|
+
'stagger-0': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0s forwards',
|
|
81
|
+
'stagger-100': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards',
|
|
82
|
+
'stagger-200': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards',
|
|
83
|
+
'stagger-300': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards',
|
|
84
|
+
'stagger-400': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards',
|
|
85
|
+
'stagger-500': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards',
|
|
86
|
+
'stagger-70': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.07s forwards',
|
|
87
|
+
'stagger-140': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.14s forwards',
|
|
88
|
+
'stagger-210': 'fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.21s forwards',
|
|
89
|
+
} : {}
|
|
90
|
+
|
|
91
|
+
module.exports = {
|
|
92
|
+
handler({ addUtilities, addVariant }) {
|
|
93
|
+
addVariant('border', ['&:focus']);
|
|
94
|
+
globalUtilities.forEach((group) => addUtilities(group));
|
|
95
|
+
|
|
96
|
+
// SAL-73 Phase 3: prefers-reduced-motion overrides for the v2 animation
|
|
97
|
+
// utilities. Dormant unless TWILIGHT_THEME_V2=true.
|
|
98
|
+
if (enableThemeV2) {
|
|
99
|
+
addUtilities({
|
|
100
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
101
|
+
'.animate-fade-in-up, .animate-fade-in, .animate-fade-out': {
|
|
102
|
+
'animation': 'none !important',
|
|
103
|
+
'opacity': '1 !important',
|
|
104
|
+
'transform': 'none !important',
|
|
105
|
+
},
|
|
106
|
+
'.animate-translate-left, .animate-translate-right, .animate-translate-left-out, .animate-translate-right-out': {
|
|
107
|
+
'animation': 'none !important',
|
|
108
|
+
'opacity': '1 !important',
|
|
109
|
+
'transform': 'none !important',
|
|
110
|
+
},
|
|
111
|
+
'.animate-shrink-fly': {
|
|
112
|
+
'animation': 'none !important',
|
|
113
|
+
'opacity': '1 !important',
|
|
114
|
+
'transform': 'none !important',
|
|
115
|
+
},
|
|
116
|
+
'.animate-expand-height, .animate-collapse-height': {
|
|
117
|
+
'animation': 'none !important',
|
|
118
|
+
'opacity': '1 !important',
|
|
119
|
+
'height': 'auto !important',
|
|
120
|
+
},
|
|
121
|
+
'.animate-slide-down-share': {
|
|
122
|
+
'animation': 'none !important',
|
|
123
|
+
'opacity': '1 !important',
|
|
124
|
+
'transform': 'none !important',
|
|
125
|
+
},
|
|
126
|
+
'.animate-stagger-0, .animate-stagger-100, .animate-stagger-200, .animate-stagger-300, .animate-stagger-400, .animate-stagger-500': {
|
|
127
|
+
'animation': 'none !important',
|
|
128
|
+
'opacity': '1 !important',
|
|
129
|
+
'transform': 'none !important',
|
|
130
|
+
},
|
|
131
|
+
'.animate-stagger-70, .animate-stagger-140, .animate-stagger-210': {
|
|
132
|
+
'animation': 'none !important',
|
|
133
|
+
'opacity': '1 !important',
|
|
134
|
+
'transform': 'none !important',
|
|
135
|
+
},
|
|
136
|
+
'.animate-rubber-band': {
|
|
137
|
+
'animation': 'none !important',
|
|
138
|
+
'transform': 'none !important',
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
config: {
|
|
145
|
+
important: true,
|
|
146
|
+
darkMode: 'class', // or 'media' or 'class',
|
|
147
|
+
theme: {
|
|
148
|
+
fontFamily: { // move to plugin
|
|
149
|
+
sans: [
|
|
150
|
+
'var(--font-main)',
|
|
151
|
+
'-apple-system',
|
|
152
|
+
'BlinkMacSystemFont',
|
|
153
|
+
],
|
|
154
|
+
primary: "var(--font-main)"
|
|
155
|
+
},
|
|
156
|
+
extend: {
|
|
157
|
+
colors: {
|
|
158
|
+
'inherit': 'inherit',
|
|
159
|
+
'transparent': 'transparent',
|
|
160
|
+
'primary': 'var(--color-primary)',
|
|
161
|
+
'primary-d': 'var(--color-primary-dark)',
|
|
162
|
+
'primary-l': 'var(--color-primary-light)',
|
|
163
|
+
'primary-reverse': 'var(--color-primary-reverse)',
|
|
164
|
+
'dark': 'var(--color-dark)'
|
|
165
|
+
},
|
|
166
|
+
zIndex: {
|
|
167
|
+
'1': '1',
|
|
168
|
+
},
|
|
169
|
+
fontSize: {
|
|
170
|
+
'icon-lg': '33px',
|
|
171
|
+
},
|
|
172
|
+
boxShadow: {
|
|
173
|
+
'default': '5px 10px 30px #2B2D340D;',
|
|
174
|
+
},
|
|
175
|
+
transitionTimingFunction: {
|
|
176
|
+
'elastic': 'cubic-bezier(0.55, 0, 0.1, 1)',
|
|
177
|
+
},
|
|
178
|
+
screens: {
|
|
179
|
+
'xxs': { 'min': '380px', 'max': '479px' },
|
|
180
|
+
'xs': '480px',
|
|
181
|
+
},
|
|
182
|
+
keyframes: {
|
|
183
|
+
slideUpFromBottom: {
|
|
184
|
+
'0%': { transform: 'translateY(100%)', opacity: '0' },
|
|
185
|
+
'100%': { transform: 'translateY(0%)', opacity: '1' },
|
|
186
|
+
},
|
|
187
|
+
slideDownFromBottom: {
|
|
188
|
+
'0%': { transform: 'translateY(0%)', opacity: '1' },
|
|
189
|
+
'100%': { transform: 'translateY(100%)', opacity: '0' },
|
|
190
|
+
},
|
|
191
|
+
slideUPFromTop: {
|
|
192
|
+
'0%': { transform: 'translateY(-0%)', opacity: '1' },
|
|
193
|
+
'100%': { transform: 'translateY(-100%)', opacity: '0' }
|
|
194
|
+
},
|
|
195
|
+
slideDownFromTop: {
|
|
196
|
+
'0%': { transform: 'translateY(-100%)', opacity: '0' },
|
|
197
|
+
'100%': { transform: 'translateY(-0%)', opacity: '1' }
|
|
198
|
+
},
|
|
199
|
+
...v2Keyframes,
|
|
200
|
+
},
|
|
201
|
+
animation: {
|
|
202
|
+
slideUpFromBottom: 'slideUpFromBottom .6s linear',
|
|
203
|
+
slideDownFromBottom: 'slideDownFromBottom .6s linear',
|
|
204
|
+
slideDownFromTop: 'slideDownFromTop .6s linear',
|
|
205
|
+
slideUPFromTop: 'slideUPFromTop .6s linear',
|
|
206
|
+
...v2Animations,
|
|
207
|
+
},
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
};
|