|
1 | 1 | const icons = "__ICON_LIST__"; |
2 | 2 |
|
3 | 3 | const styles = ` |
| 4 | + @keyframes reveal-fallback { |
| 5 | + 0% { visibility: hidden; } |
| 6 | + 99% { visibility: hidden; } |
| 7 | + 100% { visibility: visible; } |
| 8 | + } |
| 9 | +
|
4 | 10 | html:not([data-theme]) body { |
5 | 11 | visibility: hidden; |
| 12 | + animation: reveal-fallback 300ms forwards; |
6 | 13 | } |
7 | 14 |
|
8 | 15 | html { |
@@ -77,7 +84,6 @@ const styles = ` |
77 | 84 | color: var(--text-primary); |
78 | 85 | font-size: 14px; |
79 | 86 | outline: none; |
80 | | - transition: border-color 0.2s; |
81 | 87 | box-sizing: border-box; |
82 | 88 | } |
83 | 89 |
|
@@ -106,9 +112,7 @@ const styles = ` |
106 | 112 | border: 1px solid var(--border-icon-item); |
107 | 113 | border-radius: 8px; |
108 | 114 | box-shadow: 0 2px 0px var(--shadow-icon-item); |
109 | | - transition: background-color 0.2s linear, border-color 0.2s linear; |
110 | 115 | font-family: "JetBrains Mono", Monaco, Consolas, "Lucida Console", monospace |
111 | | - |
112 | 116 | } |
113 | 117 |
|
114 | 118 | .icon-item:hover { |
@@ -148,7 +152,6 @@ const styles = ` |
148 | 152 | color: var(--text-primary); |
149 | 153 | font-size: 14px; |
150 | 154 | cursor: pointer; |
151 | | - transition: background 0.2s; |
152 | 155 | } |
153 | 156 |
|
154 | 157 | .pagination-button:hover:not(:disabled) { |
@@ -179,10 +182,23 @@ const [isMobile, setIsMobile] = useState(window.innerWidth <= 480); |
179 | 182 |
|
180 | 183 | const pageSize = isMobile ? 6 : 10; |
181 | 184 |
|
| 185 | +// Simple fuzzy search - checks if all query chars appear in order |
| 186 | +const fuzzyMatch = (query, text) => { |
| 187 | + let queryIndex = 0; |
| 188 | + const lowerQuery = query.toLowerCase(); |
| 189 | + const lowerText = text.toLowerCase(); |
| 190 | + |
| 191 | + for (let i = 0; i < lowerText.length && queryIndex < lowerQuery.length; i++) { |
| 192 | + if (lowerText[i] === lowerQuery[queryIndex]) { |
| 193 | + queryIndex++; |
| 194 | + } |
| 195 | + } |
| 196 | + |
| 197 | + return queryIndex === lowerQuery.length; |
| 198 | +}; |
| 199 | + |
182 | 200 | const filteredIcons = searchQuery |
183 | | - ? icons.filter((icon) => |
184 | | - icon.toLowerCase().includes(searchQuery.toLowerCase()) |
185 | | - ) |
| 201 | + ? icons.filter(icon => fuzzyMatch(searchQuery, icon)) |
186 | 202 | : icons; |
187 | 203 |
|
188 | 204 | const totalPages = Math.ceil(filteredIcons.length / pageSize); |
|
0 commit comments