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.
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
string | string | The string to change. | ||||||||||||||||||||
change | Object | The change to apply Properties
|
- Source
The transformed string.
- Type:
- string
applyChanges(s, changes) → {string}
Apply a set of changes to a given string.
Name | Type | Description |
---|---|---|
s | string | The string to be changed. |
changes | Array.<Object> | The set of changes to be applied to the string. |
- Source
The transformed string.
- Type:
- string
convertToExpression(aMorph, opts) → {object}
Converts a given morph to an expression object that preserves the component definition.
Name | Type | Description |
---|---|---|
aMorph | Morph | The morph to convert to a expression. |
opts | object | Custom options passed to the serialization. For more info, see |
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:
- this is most inefficient solution since it involves generating and stringifying a AST. (slow)
- 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
Name | Type | Description |
---|---|---|
aComponent | Morph | The component morph we use to create the component definition from. |
asExprObject | boolean | Wether or not to return an expression object (with binding info) instead of just a string. |
The component definition as stringified expression or expression object.
- Type:
- string |
object
describe(node)
Name | Type | Description |
---|---|---|
node | Node | A toplevel node of the parsed source code If the passed |
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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
nodeToRemove | object | The node of the sopec we initially consider to remove. | ||
parsedComponent | object | The node pointing to the entire component definition. | ||
fromMorph | Morph | The morph that we traverse the owner chain from in case of escalation. | ||
ignoredProps | Array.<string> | <optional> | ['name', 'submorphs'] | The set of property names that are not considered enough for the node to be preserved. |
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/".
Name | Type | Description |
---|---|---|
pathString | string | The path to transform. |
- Source
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.
Name | Type | Description |
---|---|---|
parsedModuleContent | object | The AST of the entire module where we look for the component definition. |
componentName | string | The name of the component. |
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.
Name | Type | Description |
---|---|---|
sourceCode | string | The source code to adjust the imports for. |
requiredBindings | Array.<object> | A list of required bindings for the source code. |
mod | Module | The module the source code belongs to. |
The updated source code.
- Type:
- string
generatePropsFor(aMorph)
Generates a randomized set of properties that can be applied to the given morph.
Name | Type | Description |
---|---|---|
aMorph | Morph | The morph to generate the props for. |
getComponentNode(parsedContent, componentName) → {object}
Returns the AST node of the component declarator inside the module;
Name | Type | Description |
---|---|---|
parsedContent | object | The AST of the module the component definition should be retrieved from. |
componentName | string | The name of the component. |
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).
Name | Type | Description |
---|---|---|
parsedComponent | object | The parsed component definition wherein we look for the morph node. |
aMorph | Morph | A morph object we use the name of to find the properties node in the definition. |
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.
Name | Type | Description |
---|---|---|
propsNode | object | The AST node of the properties object (spec) for a particular morph in a component definition. |
prop | string | The name of the prop to retrieve. |
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.
Name | Type | Description |
---|---|---|
parsedComponent | object | The parsed component. |
aMorphOrName | Morph | | A morph or name referencing the spec. |
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.
Name | Type | Description |
---|---|---|
prop | string | The name of the property. |
value | * | The value of the property to serialize. |
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.
Name | Type | Description |
---|---|---|
protoMorph | Morph | The morph to be used to generate a component definition from. |
variableName | string | The name of the variable that should reference the component definition. |
modId | string | 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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sourceCode | string | The source code to adjust. | ||
propertiesNode | object | The AST node pointing to the properties object to adjust. | ||
key | string | The property name. | ||
valueExpr | object | The expression object of the value of the property. | ||
sourceEditor | Text | <optional> | false | An optional source code editor that serves as the store of the source code. |
The transformed source code.
- Type:
- string
joinPath() → {string}
Joins the strings passed as paramters together so that ea string is connected via a single "/".
- Source
The joined path.
- Type:
- string
string.joinPath("foo", "bar") // => "foo/bar";
parseDescribeBlock(parent)
Name | Type | Description |
---|---|---|
parent | Node | A node representing a |
prepareConsole(platformConsole, consoleMethods, _window)
Name | Type | Description |
---|---|---|
platformConsole | console | The |
consoleMethods | Array.<string> | An array with the names of methods to instrument |
_window | Window | The window to which |
randomSelectChild(aMorph) → {Morph}
Randomly selects a descendant of this morph, or the morph itself if no submorphs present;
Name | Type | Description |
---|---|---|
aMorph | Morph | The morph whose descendants to traverse. |
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.
Name | Type | Description |
---|---|---|
entityName | string | The name of the component definition to remove. |
modId | string | 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.
Name | Type | Description |
---|---|---|
protoMorph | type | 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.
Name | Type | Description |
---|---|---|
defAsCode | string | The code snippet of the updated component definition. |
entityName | string | The name of the const referencing the component definition. |
modId | string | 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.
Name | Type | Description |
---|---|---|
sourceCode | string | The source code of the module affected. |
parsedComponent | object | The AST of the component definition affected. |
hiddenMorph | Morph | The morph with the change we need to uncover in the component definition. |
The transformed source code.
- Type:
- string
Type Definitions
LinterMessage
- object
Name | Type | Description |
---|---|---|
column | number | Starting column the warning was located at. |
endColumn | number | Ending column the warning was located at. |
line | number | Starting line the warning was located at. |
endLine | number | Ending line the warning was located at. |
message | string | Message that explains the linter violation. |
messageId | string | Shorthand for the violated linter rule. |
ruleId | string | Id of the violated rule. |
nodeType | string | Ast node type at the point of violation. |
severity | number | Prioritization of the violation. |
- Source