Class: Component

Component(isCore)

new Component(isCore)

Base class for namespace components.

Components extend Top with namespace membership, title, notes, tags, auxiliary data, reference binding, and cloning.

In Heta code, component metadata can be written as notes, title, tags, and auxiliary properties on concrete component classes.

Parameters:
Name Type Description
isCore boolean

Marks the component as read-only.

Properties:
Name Type Description
space string | undefined

Namespace id.

className string

Heta class name.

indexObj object

{ id, space } selector for the component.

Extends

Members

notesHTML

Renders markdown notes to compact HTML.

Methods

bind(namespace) → {void}

Validates references and binds direct object references.

Parameters:
Name Type Description
namespace Namespace

Namespace used to resolve references.

Returns:
Type
void

clone() → {Component}

Creates a component clone with base metadata fields copied.

Returns:

Cloned component.

Type
Component

getProperty(path) → {*}

Reads a nested property by path.

Parameters:
Name Type Description
path string

Property path, for example assignments.start_.

Inherited From:
Returns:

Property value.

Type
*

instanceOf(className) → {boolean}

Checks class inheritance by Heta class name.

Parameters:
Name Type Description
className string

Heta class name.

Inherited From:
Returns:

true if this object is an instance of the class.

Type
boolean

merge(q) → {Component}

Merges component fields from a Q-object.

Parameters:
Name Type Description
q object

Q-object fragment.

Overrides:
Returns:

This component.

Type
Component

references() → {Array.<string>}

Returns unique direct references from this component.

Returns:

Component ids referenced by this component.

Type
Array.<string>

setProperty(path, value) → {*}

Writes a nested property by path.

Parameters:
Name Type Description
path string

Property path.

value *

Value to set.

Inherited From:
Returns:

Assigned value.

Type
*

toFlat(options) → {object}

Converts this object to flat Q-object format.

Parameters:
Name Type Description
options object

Serialization options.

Inherited From:
Returns:

Flat object representation.

Type
object

toQ(options) → {object}

Converts this component to Q-object format.

Parameters:
Name Type Description
options object

Serialization options.

Overrides:
Returns:

Q-object representation.

Type
object

updateReferences(q) → {Component}

Rewrites component references using prefix, suffix, and rename.

This is used by namespace import actions to keep references consistent after component ids are renamed.

Parameters:
Name Type Description
q object

Import options.

Returns:

This component.

Type
Component

(static) requirements() → {object}

Returns merged reference and validation requirements for this component class.

Returns:

Requirement map.

Type
object