Sha256: 1752c2602be9b32c436fc117dbc3a9d1ecd983b67f6b586c98b70257c7e24671

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true


generator = Genesis.generator

generator.build_render_method(:html_shape) do
  current_atome = @atome
  id_found = current_atome[:id]
  @html_object = Html.new
  @html_object.add_class('atome')
  @html_object.attr('id', id_found)
end

generator.build_render_method(:html_color) do |_value|
  # we remove previous unused style tag
  opal_document[id]&.remove
  red_found = @atome[:red]
  blue_found = @atome[:blue]
  green_found = @atome[:green]
  alpha_found = @atome[:alpha]
  opal_document.head << DOM("<style atome='#{type}'  id='#{id}'>.#{id}{background-color: rgba(#{red_found * 255},
  #{green_found * 255},#{blue_found * 255},#{alpha_found})}</style>")
  # TODO/ use the code below to modify the style tag
  # `document.getElementById(#{id}).sheet.cssRules[0].style.backgroundColor = 'red'`
end

generator.build_render_method(:html_image) do |_user_prc|
  # id_found = id
  # instance_exec(&proc) if proc.is_a?(Proc)
  # DOM do
  #   img({ id: id_found }).atome
  # end.append_to($document[:user_view])
  # @html_object = $document[id_found]
  # @html_type = :image
end

generator.build_render_method(:html_shadow) do
end

generator.build_render_method(:html_video) do |_value, _user_proc|
  # id_found = id
  # # instance_exec(&proc) if proc.is_a?(Proc)
  # DOM do
  #   video({ id: id_found, autoplay: true ,loop: false, muted: true }).atome
  # end.append_to($document[:user_view])
  # @html_object = $document[id_found]
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atome-0.5.1.9 lib/atome/renderers/html/atome.rb
atome-0.5.1.4 lib/atome/renderers/html/atome.rb
atome-0.5.1.1 lib/atome/renderers/html/atome.rb