Class: JsxRosetta::IR::Component
- Inherits:
-
Data
- Object
- Data
- JsxRosetta::IR::Component
- Includes:
- Node
- Defined in:
- lib/jsx_rosetta/ir/types.rb
Overview
A translated component definition. The root of a lowered IR tree.
name : String — component name as it appears in JSX (e.g. “Button”). props : [Prop] body : Node — usually an Element or Fragment. rest_prop_name : String | nil — name of a rest-destructured prop
(`function X({ a, ...rest })`). When non-nil, the
backend should generate a `**rest` initializer kwarg
and make it available via `@rest_prop_name`.
local_bindings : [LocalBinding] — non-JSX local ‘const` bindings inside
the component body. Backends typically render these as
a TODO comment block since arbitrary JS-to-Ruby
translation isn't attempted.
stimulus_methods : [StimulusMethod] — event handlers extracted from
inline arrows / const-bound arrows used in onX={...}.
When non-empty, backends should emit a sibling
Stimulus controller file alongside the .rb/.erb pair.
react_hooks : [ReactHookCall] — calls to React hooks (useState,
useEffect, useRef, useContext, useMemo, useCallback,
useReducer, useImperativeHandle, useLayoutEffect).
Surfaced as a distinct TODO block so the human
reviewer knows to translate behavior to Stimulus
and state to server-side rendering.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#local_bindings ⇒ Object
readonly
Returns the value of attribute local_bindings.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#props ⇒ Object
readonly
Returns the value of attribute props.
-
#react_hooks ⇒ Object
readonly
Returns the value of attribute react_hooks.
-
#rest_prop_name ⇒ Object
readonly
Returns the value of attribute rest_prop_name.
-
#stimulus_methods ⇒ Object
readonly
Returns the value of attribute stimulus_methods.
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def body @body end |
#local_bindings ⇒ Object (readonly)
Returns the value of attribute local_bindings
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def local_bindings @local_bindings end |
#name ⇒ Object (readonly)
Returns the value of attribute name
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def name @name end |
#props ⇒ Object (readonly)
Returns the value of attribute props
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def props @props end |
#react_hooks ⇒ Object (readonly)
Returns the value of attribute react_hooks
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def react_hooks @react_hooks end |
#rest_prop_name ⇒ Object (readonly)
Returns the value of attribute rest_prop_name
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def rest_prop_name @rest_prop_name end |
#stimulus_methods ⇒ Object (readonly)
Returns the value of attribute stimulus_methods
33 34 35 |
# File 'lib/jsx_rosetta/ir/types.rb', line 33 def stimulus_methods @stimulus_methods end |