Skip to content

v0.3.0

Compare
Choose a tag to compare
@stephannv stephannv released this 14 Feb 13:18
· 15 commits to main since this release

What's Changed

  • Match DeferredRender in performance by @stephannv in #3

    ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
    Warming up --------------------------------------
                Deferred    26.779k i/100ms
          Slotable 0.2.0     21.636k i/100ms
          Slotable 0.3.0    27.013k i/100ms
    Calculating -------------------------------------
                Deferred    267.884k (± 0.6%) i/s -      1.366M in   5.098391s
          Slotable 0.2.0    216.193k (± 0.4%) i/s -      1.082M in   5.003961s
          Slotable 0.3.0    270.082k (± 0.5%) i/s -      1.351M in   5.001001s
    
  • Allow polymorphic slots by @stephannv in #4

    class CardComponent < Phlex::HTML
      include Phlex::Slotable
    
      slot :avatar, types: { icon: IconComponent, image: ImageComponent }
    
      def template
        if avatar_slot?
          render avatar_slot
        end
      end
    end
    
    render CardComponent.new do |card|
      if user
        card.with_image_avatar(src: user.image_url)
      else
        card.with_icon_avatar(name: :user)
      end
    end

Full Changelog: v0.2.0...v0.3.0