Members

(constant) Tab

An actual tab.

(constant) TabContainer

A container containing the actual tabs, providing layout functionality.

(constant) TabContentContainer

A container for the content associated with a tab providing layout functionality.

(constant) Tabs

A tab-system which allows to switch between different contents based on the selected tab.

Methods

applyChange(string, change) → {string}

Applys a change to a string.

Parameters:
NameTypeDescription
stringstring

The string to change.

changeObject

The change to apply

Properties
NameTypeAttributesDescription
startNumber

The start positing to apply the change from.

endNumber<optional>

If applicable the position in the string up to which the change applies.

linesArray.<string><optional>

If applicable the lines to insert or replace into the range.

action"insert" | "remove" | "replace"

The type of change to be applied.

Returns:

The transformed string.

Type: 
string

applyChanges(s, changes) → {string}

Apply a set of changes to a given string.

Parameters:
NameTypeDescription
sstring

The string to be changed.

changesArray.<Object>

The set of changes to be applied to the string.

Returns:

The transformed string.

Type: 
string

convertToExpression(aMorph, opts) → {object}

Converts a given morph to an expression object that preserves the component definition.

Parameters:
NameTypeDescription
aMorphMorph

The morph to convert to a expression.

optsobject

Custom options passed to the serialization. For more info, see serlializeSpec().

Returns:

An expression object.

Type: 
object

createInitialComponentDefinition(aComponent, asExprObject) → {string|object}

The cheap way is just to generate a new spec from a component morph. however:

  1. this is most inefficient solution since it involves generating and stringifying a AST. (slow)
  2. it does not preserve the original formatting of the user.

instead we want to rather patch the source as needed to reconcile changes that happen in direct manipulation. This function should only be used in cases we do NOT have a preexisting definition residing in source.f

Parameters:
NameTypeDescription
aComponentMorph

The component morph we use to create the component definition from.

asExprObjectboolean

Wether or not to return an expression object (with binding info) instead of just a string.

Returns:

The component definition as stringified expression or expression object.

Type: 
string | object

describe(node)

Parameters:
NameTypeDescription
nodeNode

A toplevel node of the parsed source code If the passed Node does not represent a describe block, it will not be processed. If it represents a describe block, it will be shown as a declaration and all containing code will be parsed using parseDescribeBlock()

determineNodeToRemoveSubmorphs(nodeToRemove, parsedComponent, fromMorph, ignoredPropsopt) → {object}

Given a morph with a corresponding spec, determine wether it still includes enough properties to bepreserved. If there is no property(s) exceeding the set of ignored props, the spec is determined removable and we escalate the consideration of removal further to the parent. By doing this, we are able to cleanup unnessecary specs that clutter component definitions.

Parameters:
NameTypeAttributesDefaultDescription
nodeToRemoveobject

The node of the sopec we initially consider to remove.

parsedComponentobject

The node pointing to the entire component definition.

fromMorphMorph

The morph that we traverse the owner chain from in case of escalation.

ignoredPropsArray.<string><optional>
['name', 'submorphs']

The set of property names that are not considered enough for the node to be preserved.

Returns:

Returns the final node deemed to be removed.

Type: 
object

ensureFolder(pathString) → {string}

Given a path such as "path/to/file" returns a folderized version such as: "path/to/file/".

Parameters:
NameTypeDescription
pathStringstring

The path to transform.

Returns:

The transformed path;

Type: 
string

findComponentDef(parsedModuleContent, componentName) → {object}

Slight variation to getComponentNode(). Here we retrieve the component declaration, which means we include the declarator component() as well as the const variable the component is assigned to.

Parameters:
NameTypeDescription
parsedModuleContentobject

The AST of the entire module where we look for the component definition.

componentNamestring

The name of the component.

Returns:

The AST node of the component declaration

Type: 
object

fixUndeclaredVars(sourceCode, requiredBindings, mod) → {string}

Transforms a given source code string such that undefined required bindings are resolved by imports.

Parameters:
NameTypeDescription
sourceCodestring

The source code to adjust the imports for.

requiredBindingsArray.<object>

A list of required bindings for the source code.

modModule

The module the source code belongs to.

Returns:

The updated source code.

Type: 
string

generatePropsFor(aMorph)

Generates a randomized set of properties that can be applied to the given morph.

Parameters:
NameTypeDescription
aMorphMorph

The morph to generate the props for.

getComponentNode(parsedContent, componentName) → {object}

Returns the AST node of the component declarator inside the module;

Parameters:
NameTypeDescription
parsedContentobject

The AST of the module the component definition should be retrieved from.

componentNamestring

The name of the component.

Returns:

The AST node of the component declarator.

Type: 
object

getMorphNode(parsedComponent, aMorph) → {object|null}

Slight variation of getPropertiesNode(). In cases where a derived morph is added to a component definition this function will retreive the AST node that includes the part() or add() call. This is useful when we want to remove this node entirely from a definition. (Just removing the node returned by getPropertiesNode() will result in empty part() or add() left over in the code).

Parameters:
NameTypeDescription
parsedComponentobject

The parsed component definition wherein we look for the morph node.

aMorphMorph

A morph object we use the name of to find the properties node in the definition.

Returns:

The AST node comprising the part()/add() call, if nessecary.

Type: 
object | null

getProp(propsNode, prop) → {object|null}

Retrieve a property declaration from a properties nodes.

Parameters:
NameTypeDescription
propsNodeobject

The AST node of the properties object (spec) for a particular morph in a component definition.

propstring

The name of the prop to retrieve.

Returns:

If present, the node the prop def.

Type: 
object | null

getPropertiesNode(parsedComponent, aMorphOrName) → {object|null}

Returns the AST node that containts the property attributes of a morph spec within a component definition.

Parameters:
NameTypeDescription
parsedComponentobject

The parsed component.

aMorphOrNameMorph | string

A morph or name referencing the spec.

Returns:

The AST node of the parsed props object.

Type: 
object | null

getValueExpr(prop, value) → {object}

Converts a certain value to a serializable expression. Requires a name of the property it belongs to, in order to properly convert nested properties.

Parameters:
NameTypeDescription
propstring

The name of the property.

value*

The value of the property to serialize.

Returns:

Converted version of the property value as expression object.

Type: 
object

insertComponentDefinition(protoMorph, variableName, modId)

Inserts a new component definition into a module based on a morph that will be used to generate the definition. This function is only used for initial creation of new components and therefore does not need to be decoupled from the module creation + source code changes it performs.

Parameters:
NameTypeDescription
protoMorphMorph

The morph to be used to generate a component definition from.

variableNamestring

The name of the variable that should reference the component definition.

modIdstring

The id of the module to be changed.

insertPropChange(sourceCode, propertiesNode, key, valueExpr, sourceEditoropt) → {string}

Inserts a new property into a properties node of a component definition located in a source string.

Parameters:
NameTypeAttributesDefaultDescription
sourceCodestring

The source code to adjust.

propertiesNodeobject

The AST node pointing to the properties object to adjust.

keystring

The property name.

valueExprobject

The expression object of the value of the property.

sourceEditorText<optional>
false

An optional source code editor that serves as the store of the source code.

Returns:

The transformed source code.

Type: 
string

joinPath() → {string}

Joins the strings passed as paramters together so that ea string is connected via a single "/".

Returns:

The joined path.

Type: 
string
Example
string.joinPath("foo", "bar") // => "foo/bar";

parseDescribeBlock(parent)

Parameters:
NameTypeDescription
parentNode

A node representing a describe block All subnodes of the passed Node will be parsed to extract declarations for contained describe blocks, test setup methods (like after,...) and test cases.

prepareConsole(platformConsole, consoleMethods, _window)

Parameters:
NameTypeDescription
platformConsoleconsole

The console object to instrument/prepare

consoleMethodsArray.<string>

An array with the names of methods to instrument

_windowWindow

The window to which platformConsole belongs

randomSelectChild(aMorph) → {Morph}

Randomly selects a descendant of this morph, or the morph itself if no submorphs present;

Parameters:
NameTypeDescription
aMorphMorph

The morph whose descendants to traverse.

Returns:

The randomly selected morph.

Type: 
Morph

removeComponentDefinition(entityName, modId)

Removes a component definition together with its export(s) from a module. This function is only used in response to removing a component definition from a package and therefore does not need to be decoupled from the module + source changes it performs.

Parameters:
NameTypeDescription
entityNamestring

The name of the component definition to remove.

modIdstring

The name of the module to remove the component definition from.

renameComponent(protoMorph)

Given a proto morph, rename the corresponding component definition inside of the module it is defined in. In case the component is the top level component that determines the module's name, then we perform a renaming of the module.

Parameters:
NameTypeDescription
protoMorphtype

description

replaceComponentDefinition(defAsCode, entityName, modId)

Replaces a component definition within a module. This function is only used in response to resetting a component definition and therefore does not need to be decoupled from the module + source changes it performs.

Parameters:
NameTypeDescription
defAsCodestring

The code snippet of the updated component definition.

entityNamestring

The name of the const referencing the component definition.

modIdstring

The id of the module to be updated.

uncollapseSubmorphHierarchy(sourceCode, parsedComponent, hiddenMorph) → {string}

In case the change of a morph needs to be reconciled, but said morph does not appear inside the component def, that means it was not yet mentioned since no overriding changes where applied. In this case we need to uncollapse the morph structure such that the overridden change can be reconciled accordingly.

Parameters:
NameTypeDescription
sourceCodestring

The source code of the module affected.

parsedComponentobject

The AST of the component definition affected.

hiddenMorphMorph

The morph with the change we need to uncover in the component definition.

Returns:

The transformed source code.

Type: 
string

Type Definitions

LinterMessage

Type:
  • object
Properties
NameTypeDescription
columnnumber

Starting column the warning was located at.

endColumnnumber

Ending column the warning was located at.

linenumber

Starting line the warning was located at.

endLinenumber

Ending line the warning was located at.

messagestring

Message that explains the linter violation.

messageIdstring

Shorthand for the violated linter rule.

ruleIdstring

Id of the violated rule.

nodeTypestring

Ast node type at the point of violation.

severitynumber

Prioritization of the violation.