Sha256: 629cb7025829beb0492de135386fb34f119d98f6275a3976816b7adf3f8cfc65

Contents?: true

Size: 1.91 KB

Versions: 27

Compression:

Stored size: 1.91 KB

Contents

# frozen_string_literal: true

new({ method: :overflow, renderer: :html, type: :string }) do |params, bloc|
  html.overflow(params, bloc)
end

new({ method: :gradient, renderer: :html, type: :hash })

new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove, bloc|

  if object_id_to_remove.instance_of? Hash
    object_id_to_remove.each do |particle, value|
      case particle
      when :category
        html.remove_class(value)
      else
        atome_ids_found = send(object_id_to_remove[:all])
        atome_ids_found.each do |atome_id|
          remove(atome_id)
        end
      end
    end
  else
    atome_to_remove = grab(object_id_to_remove)
    atome_type_found = atome_to_remove.type
    case atome_type_found
    when :color
      if color == []
        # we remove the last color set
        html.style(:backgroundColor, :black)
      else
        html.style(:background, '')
        html.style(:backgroundColor, '')
        @apply.delete(object_id_to_remove)
        apply(@apply)
      end
    when :shadow
      html.style("boxShadow", 'none')
      html.style("filter", 'none')
      @apply.delete(object_id_to_remove)
      apply(@apply)
    when :paint
      atome_to_remove = grab(object_id_to_remove)
      atome_to_remove.gradient.each do |color_id|
        html.style(:background, '')
        html.style(:backgroundColor, '')
        @apply.delete(color_id)
      end
      @apply.delete(object_id_to_remove)
      apply(@apply)
    end
  end
end


new({ method: :border, type: :hash, renderer: :html }) do |value, _user_proc|
  thickness = value[:thickness] || 5
  type = value[:pattern] || :solid
  color = if value[:color]
            color_found = value[:color]
            "#{color_found.red * 255},#{color_found.green * 255},#{color_found.blue * 255},#{color_found.alpha} "
          else
            "0,0,0,1"
          end

  html.style(:border, "#{type} #{thickness}px rgba(#{color})")
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
atome-0.5.6.4.8 lib/renderers/html/material.rb
atome-0.5.6.4.5 lib/renderers/html/material.rb
atome-0.5.6.4.2 lib/renderers/html/material.rb
atome-0.5.6.4.1 lib/renderers/html/material.rb
atome-0.5.6.4.0 lib/renderers/html/material.rb
atome-0.5.6.3.9 lib/renderers/html/material.rb
atome-0.5.6.3.6 lib/renderers/html/material.rb
atome-0.5.6.3.5 lib/renderers/html/material.rb
atome-0.5.6.3.1 lib/renderers/html/material.rb
atome-0.5.6.3.0 lib/renderers/html/material.rb
atome-0.5.6.2.9 lib/renderers/html/material.rb
atome-0.5.6.2.7 lib/renderers/html/material.rb
atome-0.5.6.2.5 lib/renderers/html/material.rb
atome-0.5.6.2.4 lib/renderers/html/material.rb
atome-0.5.6.2.3 lib/renderers/html/material.rb
atome-0.5.6.2.1 lib/renderers/html/material.rb
atome-0.5.6.2.0 lib/renderers/html/material.rb
atome-0.5.6.1.9 lib/renderers/html/material.rb
atome-0.5.6.1.4 lib/renderers/html/material.rb
atome-0.5.6.1.1 lib/renderers/html/material.rb