-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimization.css
More file actions
172 lines (141 loc) · 3.69 KB
/
Copy pathoptimization.css
File metadata and controls
172 lines (141 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/* EULER - CSS Performance Optimizations */
/* This file contains performance-focused CSS enhancements
to improve rendering, animation, and interaction performance */
/* ========== Hardware Acceleration ========== */
/* Apply to elements that need smooth animations */
.hardware-accelerated {
transform: translateZ(0);
backface-visibility: hidden;
perspective: 1000px;
}
/* For elements that have significant transitions/transforms */
.transform-optimized {
will-change: transform;
}
/* For opacity animations (like fade in/out) */
.opacity-optimized {
will-change: opacity;
}
/* For elements that change multiple properties */
.complex-optimized {
will-change: transform, opacity;
}
/* ========== Specific Component Optimizations ========== */
/* Optimize button hover/active states */
.btn:hover,
.btn:active {
transform: translateZ(0) translateY(2px);
}
/* Optimize sidebar transition */
.sidebar {
transform: translateZ(0);
will-change: width;
}
/* Optimize euler branding transitions */
.title-area {
transform: translateZ(0);
will-change: transform, opacity;
}
/* Optimize dropdown/tooltip animations */
.dropdown-content,
.tooltip-content {
transform: translateZ(0);
will-change: opacity, transform;
}
/* Optimize hint box animations */
.hint-box:not(.hidden) {
transform: translateZ(0) translateY(0);
will-change: opacity, transform;
}
/* ========== Animation Performance ========== */
/* Use opacity and transform instead of other properties */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideIn {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
@keyframes pulseHighlight {
0% {
transform: scale(1);
opacity: 0.8;
}
50% {
transform: scale(1.05);
opacity: 1;
}
100% {
transform: scale(1);
opacity: 0.8;
}
}
/* ========== Selector Optimization ========== */
/* Avoid:
- Deep nesting (more than 3 levels)
- Universal selectors (*) when possible
- Excessive attribute selectors
- Inefficient selectors like :nth-child or :not
- Over-qualifying selectors
*/
/* Example of optimized selectors:
Instead of: body .main-content .widget:nth-child(odd) div > span
Use: .widget-odd-text
*/
/* Reduce selector complexity for commonly accessed elements */
.btn {
/* Target directly instead of .button-container .btn */
}
.form-input {
/* Target directly instead of .form-group .input-container .form-input */
}
/* ========== Paint/Layout Optimization ========== */
/* Use opacity and transform for animations as they don't trigger layout */
.notification-banner.active {
transform: translateY(0);
}
/* Use fixed size containers to minimize layout recalculation */
.input-container,
.button-container,
.form-group {
box-sizing: border-box;
}
/* Use contain property for optimization where appropriate */
.sidebar-panel,
.result-panel,
.graph-container {
contain: content;
}
/* ========== Responsive Performance ========== */
/* Provide resolution-appropriate assets */
@media (max-width: 576px) {
/* Simpler animations for mobile */
.complex-animation {
animation: none;
}
/* Disable unnecessary effects */
.desktop-only-effect {
transform: none;
will-change: auto;
}
}
/* ========== Transition Optimization ========== */
/* Optimize transition properties to only animate specific properties */
.btn {
transition: background-color var(--transition-fast), transform var(--transition-fast);
}
/* Replace all 'transition: all' with specific properties */
.form-input:focus {
transition: background-color var(--transition-fast), border-left-width var(--transition-normal);
}