Skip to content

Commit 937cb1e

Browse files
authored
Finalized code to block conversion (#4707)
* Complete refactoring of code to block conversion logic to be config driven * add blocks for code to block support * add unit tests and minified ast2blocks.json * add documentation for code to blocks * add images for code to blocks documentation * add more images to code to blocks documentation * add final images to code to blocks documentation * fix npm issues
1 parent 6df50f6 commit 937cb1e

20 files changed

+5835
-1101
lines changed

index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@
6666
<link rel="stylesheet" href="css/themes.css">
6767
<script src="lib/easeljs.min.js" defer></script>
6868
<script src="lib/tweenjs.min.js" defer></script>
69-
69+
<script>
70+
let ast2blocklist_config;
71+
fetch("js/js-export/ast2blocks.min.json")
72+
.then(response => response.json())
73+
.then(data => { ast2blocklist_config = data })
74+
</script>
7075
</head>
7176

7277
<body id="body" onload="init();" data-title="index" style="background: #f9f9f9;">

js/js-export/AST_example.png

336 KB
Loading

js/js-export/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ The code corresponding to the JavaScript Editor widget is in
1616
* `generate.js` — contains the utilities for generating code from the
1717
block stacks.
1818

19+
* `ast2blocklist.js` - contains the utilities for generating blocks from the code in the editor
20+
21+
* `ast2blocks.json` - contains the block configurations for code to block conversion.
22+
For detailed information on how to add blocks for code to block support see `./conversion_config_guide.md`
23+
1924
* `ASTutils.js` — contains the utilities for generating the *Abstract
2025
Syntax Tree* (*AST*) in `ESTree` specification, for the corresponding
2126
code to the block stacks. Used by `JSGenerate` class in `generate.js`.

js/js-export/__tests__/ast2blocklist.test.js

Lines changed: 550 additions & 76 deletions
Large diffs are not rendered by default.
155 KB
Loading

js/js-export/argument_block.png

10.3 KB
Loading

js/js-export/argument_vspace.png

60.6 KB
Loading
12.7 KB
Loading

js/js-export/ast2blocklist.js

Lines changed: 519 additions & 1021 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)