* This is the main entry point for the animation when the `text` config is changed. * It orchestrates the measurement and animation phases. It also contains a `try/catch` * block to handle potential errors during the complex animation logic, with a single-retry * mechanism to recover
(value, oldValue)
| 319 | * @protected |
| 320 | */ |
| 321 | async afterSetText(value, oldValue) { |
| 322 | let me = this, |
| 323 | {measureElement} = me; |
| 324 | |
| 325 | if (oldValue) { |
| 326 | me.previousChars = me.chars |
| 327 | } |
| 328 | |
| 329 | if (value) { |
| 330 | try { |
| 331 | me.chars = []; |
| 332 | measureElement.cn = []; |
| 333 | |
| 334 | value?.split('').forEach(char => { |
| 335 | me.chars.push({name: char}); |
| 336 | measureElement.cn.push({tag: 'span', text: char}) |
| 337 | }); |
| 338 | |
| 339 | if (me.mounted) { |
| 340 | await me.measureChars() |
| 341 | } |
| 342 | |
| 343 | if (me.isDestroyed) return; |
| 344 | |
| 345 | await me.updateChars() |
| 346 | } catch (e) { |
| 347 | if (e === Neo.isDestroyed) return; |
| 348 | |
| 349 | if (!me.isRetrying) { |
| 350 | me.isRetrying = true; |
| 351 | me.previousChars = []; |
| 352 | |
| 353 | // Reset a transitioning state |
| 354 | me.visualWrapper.cn.length = 0; |
| 355 | |
| 356 | await me.afterSetText(value, oldValue) |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | me.isRetrying = false |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Updates the VDOM to include or remove the SEO-friendly list. |
nothing calls this directly
no test coverage detected