# new RezSingleLayout()
A layout that holds exactly one content block.
Use this layout when you need to wrap a single piece of content with a layout template.
Extends
Methods
# addContent(block)
Sets the single content block for this layout.
Parameters:
| Name | Type | Description |
|---|---|---|
block |
RezBlock
|
The content block |
- Overrides:
# bindAs() → {string}
Returns the binding name for this layout.
- Overrides:
The block type as binding name
string
# bindBlocks() → {Object}
Renders all nested blocks to HTML.
- Inherited From:
Map of binding names to rendered HTML strings
Object
# bindValues() → {Object}
Creates the complete value bindings for template rendering.
Combines parent bindings with this block's bindings, adding:
block: Reference to this blockparams: The params objectsource: The source element- Source's bindAs name: The source element (aliased)
- Inherited From:
Complete bindings object for template rendering
Object
# bindings() → {Object}
Computes complete bindings including values and rendered blocks.
- Inherited From:
Complete bindings object
Object
# copy() → {RezSingleLayout}
Creates a copy of this layout including its content.
- Overrides:
A new layout with copied content
# css_classes() → {string}
Gets the CSS classes for this block's wrapper element.
- Inherited From:
If block type is not recognized
Error
Space-separated CSS class names
string
# dereferenceBoundValue(value) → {Object|Array.<Object>}
Dereferences element references to their actual elements.
Handles both single values and arrays of values.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string
|
Object
|
Array
|
Value(s) to dereference |
- Inherited From:
The dereferenced element(s)
Object
|
Array.<Object>
# extractBindingValue(bindings, source, derefopt) → {*}
Extracts a value from a binding source.
Supports multiple source types:
- String: Treated as an element ID
- Element reference ({$ref: "id"}): Resolved to the element
- Function: Invoked with block context
- Object with binding function: Path-based resolution
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
bindings |
Object
|
Current bindings object |
||
source |
string
|
function
|
Object
|
The binding source |
||
deref |
boolean
|
<optional> |
false | Whether to dereference the result |
- Inherited From:
If source type is not recognized
Error
The extracted value
*
# getBindings(initialBindings) → {Object}
Builds the bindings object from the source element's bindings attribute.
Processes each binding specification, resolving sources to values and adding them to the bindings object with their specified prefixes.
Parameters:
| Name | Type | Description |
|---|---|---|
initialBindings |
Object
|
Initial bindings to extend |
- Inherited From:
The complete bindings object
Object
# getBlocks() → {Object}
Retrieves and instantiates nested blocks from the source's blocks attribute.
Each block specification defines a binding name and source element. The blocks are instantiated as RezBlock instances with this block as parent.
- Inherited From:
Map of binding names to RezBlock instances
Object
# getViewTemplate() → {function}
Gets the view template function for this block.
- Inherited From:
Template function that accepts bindings and returns HTML
function
# html() → {string}
Renders this layout to HTML.
Renders content first, then applies the layout's template with the content and all bindings.
- Inherited From:
Complete HTML for this layout
string
# instantiateBindingPath(p) → {*}
Resolves a binding path function against the source.
Parameters:
| Name | Type | Description |
|---|---|---|
p |
function
|
Path function to invoke |
- Inherited From:
The resolved value
*
# instantiateFunctionBinding(bindings, f) → {*}
Invokes a function binding with the current context.
Parameters:
| Name | Type | Description |
|---|---|---|
bindings |
Object
|
Current bindings object |
f |
function
|
The function to invoke |
- Inherited From:
The function's return value
*
# instantiateIdBinding(id) → {Object}
Resolves an element ID to its corresponding game element.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
The element ID to resolve |
- Inherited From:
The resolved game element
Object
# instantiatePathBinding(path_fn, bindings) → {*}
Resolves a path binding function with current bindings.
Parameters:
| Name | Type | Description |
|---|---|---|
path_fn |
function
|
Path function to invoke |
bindings |
Object
|
Current bindings object |
- Inherited From:
The resolved value
*
# instantiatePropertyBinding(ref) → {*}
Resolves a property reference to its value.
Parameters:
| Name | Type | Description |
|---|---|---|
ref |
Object
|
Property reference with elem_id and attr_name |
elem_id |
string
|
The element ID |
attr_name |
string
|
The attribute name to read |
- Inherited From:
The attribute value
*
# parentBindings() → {Object}
Gets bindings from the parent block, if any.
- Inherited From:
Parent bindings or empty object
Object
# renderBlock() → {string}
Renders the block content using its template and bindings.
- Inherited From:
Rendered HTML content
string
# renderContents() → {string}
Renders the content block to HTML.
- Overrides:
Rendered content HTML
string
# resolveBindingValue(bindings, bindingObject) → {*}
Resolves a binding object to its actual value.
Handles literal values directly, otherwise delegates to extractBindingValue for source-based resolution.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
bindings |
Object
|
Current bindings object |
|
bindingObject |
Object
|
The binding specification |
|
literal |
*
|
<optional> |
A literal value (used directly if present) |
source |
*
|
<optional> |
Source for value resolution |
deref |
boolean
|
<optional> |
Whether to dereference the result |
- Inherited From:
If source is undefined or null when no literal is provided
Error
The resolved binding value
*
# static constructor(sourceName, source)
Creates a new RezSingleLayout.
Parameters:
| Name | Type | Description |
|---|---|---|
sourceName |
string
|
The block type name |
source |
Object
|
The source element for this layout |