[Feature] Introduce more compact style for ExpressionNode strings #4049
Labels
animations 🏮
feature request 📬
A request for new changes to improve functionality
improvements ✨
in progress 🚧
open discussion ☎️
Milestone
Describe the problem this feature would solve
Currently ExpressionNodes are resolved to strings that look like this:
This verbose style is great for being able to read the generated expressions but it also causes the expression size to grow faster, which can be problematic for complex animations that reach the 1000 character limit. Being able to read the generated expression is not that useful for consumers of the toolkit since the string is not exposed publicly, the only place I have seen it surface is when the Windows APIs throw an exception because of its length.
Describe the solution
It would be nice if it automatically generated (or at least, we could choose to generate) compact strings that are functionally equivalent but shorter, e.g
Looks like in the recent PR #4014 these identifiers were changed to guids, which are also relatively long but don't refer directly to class names either, so adopting shorter identifiers shouldn't have negative side effects.
As far as I can tell, it would be a matter of replacing this line https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/529624cf1af8f034bed9c4f9927d0e0d62f1a6db/Microsoft.Toolkit.Uwp.UI.Animations/Expressions/ExpressionNodes/ExpressionNode.cs#L288
with logic that returns unique, sequential, minimal-length ids (e.g. 'a', 'b', ... 'z', 'aa', 'ab' ...)
Describe alternatives you've considered
The current design of the animation API, which exposes public extension methods that take the ExpressionNode but keeps ExpressionNode.ToExpressionString() as an internal method, makes it impossible to manipulate/transform the generated animation strings from outside the toolkit. If ToExpressionString() were to be made public, developers would be able to transform the strings if they want/need to.
The text was updated successfully, but these errors were encountered: