module Phlex::Helpers

def __append_token__(tokens, token)

Other tags:
    Api: - private
def __append_token__(tokens, token)
ken
il then nil
tring then tokens << token
ymbol then tokens << token.name
rray then tokens.concat(token)
aise ArgumentError,
itional classes must be Symbols, Strings, or Arrays of Symbols or Strings."

def classes(*tokens, **conditional_tokens)

Returns:
  • (Hash) -
def classes(*tokens, **conditional_tokens)
= self.tokens(*tokens, **conditional_tokens)
ns.empty?
s: tokens }

def mix(*args)

Returns:
  • (Hash) -
def mix(*args)
ch_with_object({}) do |object, result|
.merge!(object) do |_key, old, new|
new
Hash
is_a?(Hash) ? mix(old, new) : new
Array
is_a?(Array) ? (old + new) : new
String
is_a?(String) ? "#{old} #{new}" : new
.transform_keys! do |key|
nd_with?("!") ? key.name.chop.to_sym : key

def tokens(*tokens, **conditional_tokens)

Returns:
  • (String) -
def tokens(*tokens, **conditional_tokens)
onal_tokens.each do |condition, token|
 = case condition
Symbol then send(condition)
Proc then condition.call
raise ArgumentError, "The class condition must be a Symbol or a Proc."
thy
token
 Hash then __append_token__(tokens, token[:then])
 __append_token__(tokens, token)
token
 Hash then __append_token__(tokens, token[:else])
= tokens.select(&:itself).join(" ")
strip!
gsub!(/\s+/, " ")