Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions block-lexical-variables/FIELDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
There are four main fields defined by the Lexical Variable plugin:

* `FieldLexicalVariable` \- A dropdown field which shows the names of any variables that are in scope (i.e. that are referenceable) at the point of the program that that field's corresponding block appears. Typically this is used for variable getter and setter blocks
* `FieldGlobalFlydown` \- A field which is used to name (and rename) a global variable. It also provides a "flydown" which is displayed when the field is hovered over. The flydown enables the user to select getter or setter blocks corresponding to the global variable. This field is typically used as part of a block which defines a global variable.
* `FieldParameterFlydown` \- A somewhat poorly named field which is similar to the `FieldGlobalFlydown`, but is used for lexically scoped variables. It is typically used to define such variables in blocks that introduce lexical scopes, e.g. for the parameters of procedure/function (hence the "parameter" in the field name) definitions, "let" type blocks, "for-loop" type blocks, etc.
* `FieldGlobalFlydown` \- A field which is used to name (and rename) a global variable. It also provides a "flydown" which is displayed when the field is hovered over with a mouse (or pen); clicking the field edits the name. On a touch screen, where there is no hover, tapping the field opens the flydown and a second tap on the same field within `FieldFlydown.DOUBLE_TAP_TIMEOUT` milliseconds (500 by default) edits the name. The flydown enables the user to select getter or setter blocks corresponding to the global variable. This field is typically used as part of a block which defines a global variable.
* `FieldParameterFlydown` \- A somewhat poorly named field which is similar to the `FieldGlobalFlydown` (same hover/click and tap/double-tap gestures; the double-tap only edits if the field was created as editable), but is used for lexically scoped variables. It is typically used to define such variables in blocks that introduce lexical scopes, e.g. for the parameters of procedure/function (hence the "parameter" in the field name) definitions, "let" type blocks, "for-loop" type blocks, etc.
* `FieldNoCheckDropdown` \- This is a field which is used by procedure call blocks to provide a dropdown of callable procedure names. Unfortunately, it is not currently completely usable by itself to do that. There is logic in the call blocks themselves which could (and should) be pulled out into a subclass of `FieldNoCheckDropdown` which could, more easily, be used to define your own call block(s).

For the plugin fields to work properly, there are a set of methods that the blocks that they are part of need to
Expand Down
3 changes: 2 additions & 1 deletion block-lexical-variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ within the body of the block.

![A picture of a lexical variable block](readme-media/lexvar.png "Lexical variable")

While hovering over the variable name:
While hovering over the variable name (on a touch screen, tap it instead; a
second tap within half a second opens the rename editor):

![A picture of a lexical variable block with getter and setter blocks](readme-media/lexvar-with-flydown.png "Lexical variable with flydown")

Expand Down
179 changes: 141 additions & 38 deletions block-lexical-variables/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions block-lexical-variables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mit-app-inventor/blockly-block-lexical-variables",
"version": "11.0.3",
"version": "11.0.4",
"description": "A Blockly plugin providing lexical/local variable support and flydown variable getters and setters.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
Expand Down Expand Up @@ -50,7 +50,8 @@
"@blockly/dev-tools": "^8.1.2",
"blockly": "^11.2.2",
"chai": "^4.5.0",
"mocha": "^10.2.0"
"mocha": "^10.2.0",
"sinon": "^22.1.0"
},
"peerDependencies": {
"blockly": "^11.2.2"
Expand Down
Loading