Documentation
¶
Index ¶
- Constants
- Variables
- func GetIsArbitraryValue(val string, label interface{}, testValue func(string) bool) bool
- func IsAny(_ string) bool
- func IsArbitraryImage(val string) bool
- func IsArbitraryLength(val string) bool
- func IsArbitraryNumber(val string) bool
- func IsArbitraryPosition(val string) bool
- func IsArbitraryShadow(val string) bool
- func IsArbitrarySize(val string) bool
- func IsArbitraryValue(val string) bool
- func IsFloat(val string) bool
- func IsFraction(val string) bool
- func IsImage(val string) bool
- func IsInteger(val string) bool
- func IsLength(val string) bool
- func IsLengthOnly(val string) bool
- func IsNever(_ string) bool
- func IsNumber(val string) bool
- func IsPercent(val string) bool
- func IsShadow(val string) bool
- func IsTshirtSize(val string) bool
- func MakeMergeClassList(conf *TwMergeConfig, splitModifiers SplitModifiersFn, ...) func(classList string) string
- func SortModifiers(modifiers []string) []string
- type ClassGroupValidator
- type ClassPart
- type ConflictingClassGroups
- type GetClassGroupIdfn
- type SplitModifiersFn
- type TwMergeConfig
- type TwMergeFn
Constants ¶
View Source
const SPLIT_CLASSES_REGEX = `\s+`
Variables ¶
View Source
var Merge = CreateTwMerge(nil, nil)
Functions ¶
func GetIsArbitraryValue ¶
func IsArbitraryImage ¶
func IsArbitraryLength ¶
func IsArbitraryNumber ¶
func IsArbitraryPosition ¶
func IsArbitraryShadow ¶
func IsArbitrarySize ¶
func IsArbitraryValue ¶
func IsFraction ¶
func IsLengthOnly ¶
func IsTshirtSize ¶
func MakeMergeClassList ¶
func MakeMergeClassList(conf *TwMergeConfig, splitModifiers SplitModifiersFn, getClassGroupId GetClassGroupIdfn) func(classList string) string
func SortModifiers ¶
*
- Sorts modifiers according to following schema:
- - Predefined modifiers are sorted alphabetically
- - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
Types ¶
type ClassGroupValidator ¶
type ClassPart ¶
type ClassPart struct { NextPart map[string]ClassPart Validators []ClassGroupValidator ClassGroupId string }
type ConflictingClassGroups ¶
type GetClassGroupIdfn ¶
func MakeGetClassGroupId ¶
func MakeGetClassGroupId(conf *TwMergeConfig) GetClassGroupIdfn
type SplitModifiersFn ¶
type SplitModifiersFn = func(string) (baseClass string, modifiers []string, hasImportant bool, maybePostfixModPosition int)
func MakeSplitModifiers ¶
func MakeSplitModifiers(conf *TwMergeConfig) SplitModifiersFn
type TwMergeConfig ¶
type TwMergeConfig struct { // defaults should be good enough // hover:bg-red-500 -> : ModifierSeparator rune // bg-red-500 -> - ClassSeparator rune // !bg-red-500 -> ! ImportantModifier rune // used for bg-red-500/50 (50% opacity) -> / PostfixModifier rune // optional Prefix string // CACHE MaxCacheSize int // This is a large map of all the classes and their validators -> see default-config.go ClassGroups ClassPart // class group with conflict + conflicting groups -> if "p" is set all others are removed // p: ['px', 'py', 'ps', 'pe', 'pt', 'pr', 'pb', 'pl'] ConflictingClassGroups ConflictingClassGroups }
func MakeDefaultConfig ¶
func MakeDefaultConfig() *TwMergeConfig
This is horrible code. I'm sorry. I wanted to get the package working without writing the code to generate the config. Now that it is working I plan to writing it.
type TwMergeFn ¶ added in v0.2.0
func CreateTwMerge ¶
func CreateTwMerge(config *TwMergeConfig, cache cache.ICache) TwMergeFn
Click to show internal directories.
Click to hide internal directories.