Module: Mayu::Component
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/component.rb,
lib/mayu/component/base.rb,
lib/mayu/component/helpers.rb,
lib/mayu/component/wrapper.rb,
lib/mayu/component/interface.rb,
lib/mayu/component/handler_ref.rb
Defined Under Namespace
Modules: DSL, Interface
Classes: Base, HandlerRef, Helpers, Wrapper
Constant Summary
collapse
- Props =
T.type_alias { T::Hash[Symbol, T.untyped] }
- State =
T.type_alias { T::Hash[Symbol, T.untyped] }
- LambdaComponent =
T.type_alias do
T
.proc
.params(kwargs: Props)
.returns(T.nilable(VDOM::Interfaces::Descriptor))
end
- ComponentType =
T.type_alias { T.any(T.class_of(Base), LambdaComponent) }
- Children =
T.type_alias { T.any(ChildType, T::Array[ChildType]) }
- ChildType =
T.type_alias do
T.nilable(
T.any(VDOM::Interfaces::Descriptor, T::Boolean, String, Numeric)
)
end
- ElementType =
T.type_alias { T.any(Symbol, ComponentType) }
Class Method Summary
collapse
Class Method Details
.===(other) ⇒ Object
36
37
38
|
# File 'lib/mayu/component.rb', line 36
def self.===(other)
component_class?(other)
end
|
.component_class?(klass) ⇒ Boolean
41
42
43
|
# File 'lib/mayu/component.rb', line 41
def self.component_class?(klass)
!!(klass.is_a?(Class) && klass < Base)
end
|
.wrap(vnode, type, props) ⇒ Object
50
51
52
|
# File 'lib/mayu/component.rb', line 50
def self.wrap(vnode, type, props)
component_class?(type) ? Wrapper.new(vnode, type, props) : nil
end
|