Author variant tags when exporting a style#2
Open
FlorianKoerner wants to merge 1 commit into
Open
Conversation
A style author can now assign descriptive tags to variants from a new Tags tab in each component group, the same way per-variant weights are set. Each tag is validated against the schema grammar (category or category:value in camelCase, up to 129 characters, at most 32 per variant, unique) and written as variant.tags in the exported definition, dropped when empty. DiceBear core and the language ports already read these tags to filter variants through the tags render option. This adds the authoring side so styles can carry the tags that filter acts on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Tags tab to each component group so a style author can assign descriptive tags to variants (for example
mood:happyorhairLength:long). The tags are written asvariant.tagsin the exported style definition.Why
DiceBear core and the language ports already read variant tags to filter variants through the
tagsrender option, but nothing could author them yet. This is the authoring side, so styles can carry the tags the filter acts on.How
It mirrors the existing per-variant
weightspath end to end:tagsrecord onComponentGroupSettings, persisted topluginDatalike weights.TagsGroupchip input, one row per variant, on a Tags tab beside Weights (definition exports only, hidden for alias groups).isValidVariantTagandMAX_VARIANT_TAGS, so the export stays schema-valid:categoryorcategory:valuein camelCase, up to 129 characters, at most 32 per variant, unique. There is no exclusion prefix, since that belongs to the render-option filter, not the data.variant.tagsand omits empty arrays.Notes
Validation lives in the UI sanitizer, the single gate before persist, matching how weights and color arrays are handled. Re-validating on the code side would duplicate the validator across the bundle boundary, so it stays a known defense-in-depth follow-up.
The generated
components.d.tsis left out of this branch. It only churns a trailing semicolon on build.