A progressive Node.js framework for visually building efficient and scalable nodejs based applications.
Language Class Interface for creating DSL parsers for Concepto DSL
Concepto DSL Base Class: A base class (to be extended) for defining new languages for Concepto to be compiled to.
- concepto
- instance
- .init()
- .autocompleteContentTemplate(record, render) ⇒
string
- .addAutocompleteDefinition([extends_], [parentsAll], [parents], [childrenTypes], [id], [text], [type], [icons], [level], [hint], [attributes]) ⇒
Object
- .reply_template([init]) ⇒
Object
- .onInit()
- .onAfterProcess(processedNode) ⇒
Object
- .onDefineTitle(node) ⇒
String
- .onDefineFilename(node) ⇒
String
- .onDefineNodeName(node) ⇒
String
- .onCompleteCodeTemplate(processedNode) ⇒
Object
- .onPrepare()
- .onErrors(errors)
- .onCreateFiles(processedNodes)
- .onEnd()
- .addCommands(command_func)
- .cacheCommands()
- .findCommand(node, [justone]) ⇒
Command
|Array.<Command>
- .abortProcessing() ⇒
Command
|boolean
- .findValidCommand(node, [object]) ⇒
Command
|boolean
- .process() ⇒
Object
- .array_intersect(arr1, arr2) ⇒
Array.<string>
|Array.<Object>
|Array.<boolean>
- .array_substract(arr1, arr2) ⇒
Array.<string>
|Array.<Object>
|Array.<boolean>
- .array_difference(arr1, arr2) ⇒
Array.<string>
|Array.<Object>
|Array.<boolean>
- .array_union(arr1, arr2) ⇒
Array.<string>
|Array.<Object>
|Array.<boolean>
- .debug(message, [data])
- .debug_time(id)
- .exists(dir_or_file) ⇒
boolean
- .debug_timeEnd(id)
- .debug_table(title)
- .hasBrotherID(id, x_id) ⇒
Boolean
- .hasBrotherBefore(id) ⇒
Boolean
- .hasBrotherNext(id) ⇒
Boolean
- .isExactParentID(id, x_id) ⇒
Boolean
- .hasParentID(id, x_id) ⇒
Boolean
- .getParentIDs(id, array) ⇒
string
|Array.<Object>
- .getParentIDs2Array(id) ⇒
Array.<Object>
.getParentIDs2ArrayWXID(id) ⇒Array.<Object>
- .tagParams(struct) ⇒
string
- .struct2params(struct) ⇒
string
- inner
- ~AutocompleteItem :
Object
- ~NodeDSL :
Object
- ~Arrow :
Object
- ~Command :
Object
- ~AutocompleteItem :
- instance
Initializes/starts the class
Kind: instance method of concepto
Renders an HTML template for displaying an autocomplete item within the IDE Should return the rendered HTML
Kind: instance method of concepto
Returns: string
- - HTML template
Param | Type | Description |
---|---|---|
record | AutocompleteItem |
autocomplete item record |
render | Object |
render object with default methods for rendering autocomplete items |
render.placeholders | function |
internal function to escape {icon}:x placeholders; returns modified string with rendered icons |
render.icon | function |
internal function to call to render any given icon into an img tag; you can either call this or use your own method within the code |
render.attrs | function |
internal function to call to render the item attributes as an html table |
concepto.addAutocompleteDefinition([extends_], [parentsAll], [parents], [childrenTypes], [id], [text], [type], [icons], [level], [hint], [attributes]) ⇒ Object
Adds the given definition for the generation of autocomplete files recods
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
[extends_] | String |
extends autocomplete record; |
[parentsAll] | Array |
required node parents of this definition; empty means any; * means item must match all parents listed |
[parents] | Array |
posible node parents of this definition; empty means any; * means item must be partof |
[childrenTypes] | Array |
posible children type nodes; empty means no restrictions |
[id] | String |
Unique AC node identifier (usually the 'text') |
[text] | String |
Node text (ex. 'consultar modelo "x",') to be shown to used within list |
[type] | String |
Node type (ex. 'view') to be shown to used within list; empty by default |
[icons] | Array |
Array of icons (in order) for autocomplete node detection |
[level] | Array |
Array of levels of node definition to be detected (1=root, 2=child, 3=grandchild, etc) |
[hint] | String |
Hint to show user for command completion |
[attributes] | Object |
Possible node command attributes (ex. { 'id':{ required:true, type:'number', values:'1,2,3', hint:'id of datamodel' } }) |
Sets the default reply Object for commands
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
[init] | Object |
Merges given object keys with default defined template |
Gets automatically executed after init method finishes. You should place any parser preparation steps here (ex. load commands)
Kind: instance method of concepto
Gets automatically executed after parsing all nodes level 2 of the given dsl (before onCompleteCodeTemplate)
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
processedNode | Object |
reply content of process method per processed level2 node (keys of reply_template method) |
Gets automatically executed within writer method for setting the title for a node level 2.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
node | NodeDSL |
node to process |
Gets automatically executed for naming filename of class/page by testing node (you could use a slud method here).
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
node | NodeDSL |
node to process |
Gets automatically called for naming the class/page by testing node (similar to a filename, but for objects reference).
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
node | NodeDSL |
node to process |
Defines template for code given the processedNodes of writer(). Useful to prepend/append code before writting code to disk.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
processedNode | Object |
reply content of process method per processed level2 node (keys of reply_template method) |
Defines preparation steps before processing nodes.
Kind: instance method of concepto
Gets automatically called after errors have being found while processing nodes (with the defined commands)
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
errors | Array.<string> |
array of errors messages |
Gets automatically called after all processing on nodes has being done. You usually create the files here using the received processedNodes array.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
processedNodes | Array.<Object> |
array of nodes already processed (keys of reply_template method) ready to be written to disk |
Gets automatically called after all processes have finished. Useful for cleaning the enviroment.
Kind: instance method of concepto
Add commands for processing nodes with the current class
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
command_func | function |
async function returning an object with commands objects (Command) where each key is the command id, and its value a Command object. |
Detects which x_commands changed their code since last persistant cache usage. To be called before process().
Kind: instance method of concepto
Finds one or more commands defined that matches the specs of the given node.
Kind: instance method of concepto
Param | Type | Default | Description |
---|---|---|---|
node | NodeDSL |
node for which to find commands that match | |
[justone] | boolean |
true |
indicates if you want just the first match (true), or all commands that match the given node (false) |
Signals an abort event for the processing methods.
Kind: instance method of concepto
Finds the valid/best command match for the given node. Also tests the command for its 'valid' attribute, in case the command func specified aditional conditions. If no command is found, returns false.
Kind: instance method of concepto
Param | Type | Default | Description |
---|---|---|---|
node | NodeDSL |
node for which to find the command | |
[object] | boolean |
false |
if false returns the command reference, true returns the command execution answer |
This method traverses the dsl parsed tree, finds/execute x_commands and generated code as files.
Kind: instance method of concepto
Helper method for obtaining the common values (which can be anything) between two arrays.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
arr1 | Array.<string> | Array.<Object> | Array.<boolean> |
first array |
arr2 | Array.<string> | Array.<Object> | Array.<boolean> |
second array |
Helper method for obtaining the first array items minus the second array items (which can be anything).
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
arr1 | Array.<string> | Array.<Object> | Array.<boolean> |
first array from which to substract |
arr2 | Array.<string> | Array.<Object> | Array.<boolean> |
second array with items to substract from arr1 |
Helper method for obtaining the unique values (which can be anything) between two arrays.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
arr1 | Array.<string> | Array.<Object> | Array.<boolean> |
first array |
arr2 | Array.<string> | Array.<Object> | Array.<boolean> |
second array |
Helper method for joining the values (which can be anything) between two arrays.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
arr1 | Array.<string> | Array.<Object> | Array.<boolean> |
first array |
arr2 | Array.<string> | Array.<Object> | Array.<boolean> |
second array |
Helper method for defining how to display (or do with them; if you overload it) debug messages.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
message | string | Object |
message to display. It can also be an Object of open-console params. |
[data] | * |
data variable to show with message |
Helper method for measuring (start) time in ms from this method until debug_timeEnd() method and show it in the console.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
id key (which can also have spaces and/or symbols) with a unique id to identify the stopwatch. |
Helper to test if a given file exists or not
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
dir_or_file | string |
full directory or file to test |
Helper method for measuring (end) time in ms from the call of debug_time() method.
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
id key used in the call for debug_time() method. |
Helper method for showing a table with each command execution time and amount of calls
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
title | string |
Optional custom title for table. |
Helper method to return true if given node id has a brother of given command x_id
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
x_id | string |
Command object x_id to test for |
Helper method to return true if given node ID has a brother before it
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
Helper method to return true if given node ID has a brother following it
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
Helper method to return true if given Command object x_id is the exact parent for the given NodeDSL object id
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
x_id | string |
Command object x_id to test for |
Helper method to return true if given Command object x_id is the parent or is an ancestor for the given NodeDSL object id
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
x_id | string |
Command object x_id to test for |
Helper method to return all Command object x_ids parents of given NodeDSL id; if array=true,
Kind: instance method of concepto
Param | Type | Default | Description |
---|---|---|---|
id | string |
ID of NodeDSL object to query | |
array | Boolean |
false |
If true, returns array of objects with x_id and ids, instead of a list of NodeDSL ids. |
Helper method to return all Command object x_ids parents of given NodeDSL id as an array (its an alias for getParentIDs)
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
Deprecated
Helper method to return all NodeDSL ids parents of given NodeDSL id
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
id | string |
ID of NodeDSL object to query |
Helper method to return a tag with key/values as tag attributes
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
struct | Object |
Object with keys and values to transform from. |
Helper method to transform object keys/values into params for customtags usage
Kind: instance method of concepto
Param | Type | Description |
---|---|---|
struct | Object |
Object with keys and values to transform from. |
An autocomplete object representing an item within the autocomplete list
Kind: inner typedef of concepto
Properties
Name | Type | Description |
---|---|---|
parentsAll | Array.<string> |
Optionally indicates if this node item needs to have all of these parents (node texts for now). |
parents | Array.<string> |
Optionally indicates if this node item needs to have any of these parents (node texts for now). |
extends_ | string |
Optionally indicates if this item extends another existing one. |
text | string |
Indicates the text to show; aka keyword to complete. |
hint | string |
Indicates the html to show as the summary for the keyword. |
icons | Array.<string> |
Array with icon names used in the node. |
level | Array.<number> |
Array with supported level numbers. |
attributes | Object |
Object with a key for each attribute supported by the node (the key is the attribute name, the value is an object with keys: type, default, hint - supports icon placeholders like {icon:idea} within their texts). |
events | Object |
Object with a key for each event supported by the node. |
A node object representation of a DSL node.
Kind: inner typedef of concepto
Properties
Name | Type | Description |
---|---|---|
id | number |
Node unique ID. |
level | number |
Indicates the depth level from the center of the dsl map. |
text | string |
Indicates the text defined in the node itself. |
text_rich | string |
Indicates the html defined in the node itself. |
text_note | string |
Indicates the text/html defined in the notes view of the node (if any). |
image | string |
Image link defined as an image within the node. |
cloud | Object |
Cloud information of the node. |
cloud.bgcolor | string |
Background color of cloud. |
cloud.used | boolean |
True if cloud is used, false otherwise. |
arrows | Array.<Arrow> |
Visual connections of this node with other nodes #module_concepto..Arrow. |
nodes | Array.<NodeDSL> |
Children nodes of current node. |
font | Object |
Define font, size and styles of node texts. |
font.face | Object |
Font face type used on node. |
font.size | Object |
Font size used on node. |
font.bold | Object |
True if node text is in bold. |
font.italic | Object |
True if node text is in italics. |
style | string |
Style applied to the node. |
color | string |
Text color of node. |
bgcolor | string |
Background color of node. |
link | string |
Link defined on node. |
position | string |
Position in relation of central node (left,right). |
attributes | Object |
Object with each attribute (key is attribute name, value is attribute value). |
icons | Array.<string> |
Array with icon names used in the node. |
date_modified | date |
Date of node when it was last modified. |
date_created | date |
Date of node when it was created. |
Arrow object definition, for connections to other nodes within a DSL.
Kind: inner typedef of concepto
Properties
Name | Type | Description |
---|---|---|
target | string |
Target node ID of connection. |
color | string |
Color of visual connection. |
style | string |
Graphical representation type of link (source-to-target, target-to-source, both-ways). |
A command object specifying requirements for a node to execute its function.
Kind: inner typedef of concepto
Properties
Name | Type | Description |
---|---|---|
[x_icons] | string |
List of required icons that the node must define to be a match for this command. |
[x_not_icons] | string |
List of icons that the node cannot define to be a match for this command. |
[x_not_empty] | string |
List of keys that must not be empty to be a match for this command (can be any key from a NodeDSL object). Example: 'attribute[src],color' |
[x_not_text_contains] | string |
List of strings, which cannot be within the node text. |
[x_empty] | string |
List of NodeDSL keys that must be empty to be a match for this command. |
[x_text_contains] | string |
List of strings, that can be contain in node text (if delimiter is |
[x_text_pattern] | string | Array.<string> |
Minimatch pattern to match to be a match for this command. Can also be an array of patterns (one must match). |
[x_level] | string |
Numeric conditions that the level of the node must met (example: '>2,<5' or '2,3,4'). |
[x_all_hasparent] | string |
List of commands ids (keys), which must be ancestors of the node to be a match for this command. |
[x_or_hasparent] | string |
List of commands ids (keys), which at least one must be an ancestor of the node to be a match for this command. |
[x_or_isparent] | string |
List of commands ids (keys), which at least one must be the exact parent of the node to be a match for this command. |
[autocomplete] | Object |
Describes the node for the autocomplete feature of Concepto DSL software and its related documentation. The feature also takes into account the definition of the command (x_level and x_icons) |
[autocomplete.key_text] | string |
String that the node text must have for this command to be suggested. |
[autocomplete.hint] | string |
Text description for this command to be shown on Concepto DSL. |
func | function |
Function to execute with a matching node. Receives one argument and it must be a NodeDSL object. |
© 2020-2022 Pablo Schaffner <[email protected]>.