Sha256: ba5ace85467af6ba87e28b36d8b353c4c6d54b8d8ff9814832005d7cce0282aa

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

module Archetype::Functions::CSS

  private

  #
  # router for `transition` properties
  #
  def self.get_derived_styles_router_for_transition(related, property)
    properties = %w(property duration timing-function delay)
    styles, reconstruct = with_each_available_relative_if_root(related, property) do |items, comma_separated|
      # blow away anything we've already discovered (because it's irrelevant)
      timings = get_timing_values(items)
      items = items - timings
      # property duration timing-function delay
      styles = ::Archetype::Hash.new
      styles[:duration] = timings.shift
      styles[:delay]    = timings.shift

      items.reject! do |item|
        case helpers.to_str(item)
        when R_TIMING_FUNCTION
          styles[:timing_function] = item
        else
          next
        end
        true
      end

      # set defaults if we missed anything...
      styles[:property] = items.shift
      styles = set_default_styles(styles, 'transition', properties)
      # make the styles available to the calling context
      styles
    end

    if reconstruct
      if styles.nil? or styles[:property].nil?
        return warn_not_enough_infomation_to_derive(property) if not styles.empty?
        return nil
      end
      value = extrapolate_shorthand_simple(styles, property, properties)
      return Sass::Script::Value::List.new(value, :space)
    end

    # otherwise just return the value we were asked for
    return styles
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
archetype-1.0.0.alpha.5 lib/archetype/functions/css/routers/transition.rb
archetype-1.0.0.alpha.4 lib/archetype/functions/css/routers/transition.rb
archetype-1.0.0.alpha.3 lib/archetype/functions/css/routers/transition.rb
archetype-1.0.0.alpha.2 lib/archetype/functions/css/routers/transition.rb
archetype-1.0.0.alpha.1 lib/archetype/functions/css/routers/transition.rb