module ViewComponentContrib::StyleVariants::ClassMethods

def default_style_name

Namespaced::MyComponent => my_component
MyComponent::Component => my_component
Returns the name of the default style set based on the class name:
def default_style_name
  @default_style_name ||= name.demodulize.sub(/(::Component|Component)$/, "").underscore.presence || "component"
end

def default_style_name

Namespaced::MyComponent => my_component
MyComponent::Component => my_component
Returns the name of the default style set based on the class name:
def default_style_name
  @default_style_name ||= name.demodulize.sub(/(::Component|Component)$/, "").underscore.presence || "component"
end

def style(name = default_style_name, &block)

def style(name = default_style_name, &block)
  style_config.define(name.to_sym, &block)
end

def style(name = default_style_name, &block)

def style(name = default_style_name, &block)
  style_config.define(name.to_sym, &block)
end

def style_config

def style_config
  @style_config ||=
    if superclass.respond_to?(:style_config)
      superclass.style_config.dup
    else
      StyleConfig.new
    end
end

def style_config

def style_config
  @style_config ||=
    if superclass.respond_to?(:style_config)
      superclass.style_config.dup
    else
      StyleConfig.new
    end
end