@hortonstudio/main 1.1.11 → 1.1.13
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/animations/hero.js +16 -1
- package/package.json +1 -1
package/animations/hero.js
CHANGED
@@ -244,7 +244,7 @@ export async function init() {
|
|
244
244
|
// Animation timeline
|
245
245
|
document.fonts.ready.then(() => {
|
246
246
|
|
247
|
-
// Helper function to extract span mappings
|
247
|
+
// Helper function to extract span mappings and flatten HTML
|
248
248
|
function extractSpanMappings(element) {
|
249
249
|
const spanMappings = new Map();
|
250
250
|
const spans = element.querySelectorAll('span');
|
@@ -257,6 +257,10 @@ export async function init() {
|
|
257
257
|
}
|
258
258
|
});
|
259
259
|
|
260
|
+
// Force single text node to eliminate all text node boundaries
|
261
|
+
const originalText = element.textContent;
|
262
|
+
element.textContent = originalText;
|
263
|
+
|
260
264
|
return spanMappings;
|
261
265
|
}
|
262
266
|
|
@@ -266,9 +270,20 @@ export async function init() {
|
|
266
270
|
|
267
271
|
splitInstance.words.forEach(wordElement => {
|
268
272
|
const wordText = wordElement.textContent.trim();
|
273
|
+
|
274
|
+
// Try exact match first
|
269
275
|
if (spanMappings.has(wordText)) {
|
270
276
|
const classes = spanMappings.get(wordText);
|
271
277
|
wordElement.classList.add(...classes);
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
|
281
|
+
// Try case-insensitive and normalized match
|
282
|
+
for (const [spanText, classes] of spanMappings) {
|
283
|
+
if (wordText.toLowerCase() === spanText.toLowerCase()) {
|
284
|
+
wordElement.classList.add(...classes);
|
285
|
+
break;
|
286
|
+
}
|
272
287
|
}
|
273
288
|
});
|
274
289
|
}
|