Skip to content

Commit 107f417

Browse files
Matthewmrjacobbloom
authored andcommitted
Rework blocks (#258)
Implements a Blockly-like system of objects for blocks, scripts, and block attributes, and connects it to everything else. Fix a few other things in the process. * rough beginnings of reworked block code * add Attr constructor; transition from getOffset() to block.left() (etc.); rewrite json2html * fix bug where sometimes blocks didn’t symbolically attach to parent * bugfix: now you can add block to beginning of c-stack * move some event listeners around, resolve #242 in the process * fix duplicate functionality * disable context menu on “body” element * resolve error when rendering blank attributes * start on file import/export * bug fixes related to file import * I got single-file export to work :D * start fixing multiple html files * fixed bugs in switching between multiple html files * add CSS blocks and export * finish file import * make change described by @iamunknown2 (close #252) * fix bug where imported files weren’t editable * fix items sometimes reversing in order on drop (thanks @iamunknown2 for reporting) * clean up coords code * fix tutorial 2 * figured out the issues with CSS files * limit context menu to blocks in script area * fix issues with loose blocks not being JSON’d correctly * rename a whole bunch of things * add default blocks to new CSS files * refactor dropdown code and add to rule block * rename Attr to BlockAttribute to match other constructors’ snooty names * remove old files * move function blocksToJSON to block2json.js for obvious reasons * remove default scriptingArea contents since they’re always generated programmatically * bugfix: default blocks in new CSS files were marked inPalette * clean up blocks2json a lil * update zebra to use the new system * tweaks * switch from strings for block types to enum * bug fix with enum * remove a lot of old code and random nits * remove duplicate code * slightly simplify file import * a naive attempt to clog potential memory leaks * more attempt to plug memory leaks, p.s. this is miserable and I have no idea how to know if it works * tpyo * delEt aLL th1NGS * everything is garbage * bugfix that I don’t understand why it’s necessary but ok * Made searchBar superimpose blocks (but not when they are held by the cursor) (#261) * fix issue where tutorials scroll the page (resolves #254 and #259)
1 parent f4f5290 commit 107f417

18 files changed

Lines changed: 1015 additions & 1806 deletions

index.html

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
<meta charset="utf-8">
55
<title>UI v0.0.4 | Elemental</title>
66
<link rel="stylesheet" href="resources/css/style.css">
7-
<script src="resources/js/vendor/htmlparser.js"></script>
87
<script src="resources/js/vendor/interact.min.js"></script>
98
<script src="resources/js/vendor/jszip.min.js"></script>
109
<script src="resources/js/vendor/filesaver.min.js"></script>
11-
<script src="resources/js/vendor/cssjson.js"></script>
12-
<script src="resources/js/vendor/htmljson.js"></script>
1310
<script src="resources/js/script.js"></script>
1411
<script src="resources/js/blockFilter.js"></script>
1512
<script src="resources/js/elemental-intro.js"></script>
@@ -190,26 +187,14 @@
190187
</div>
191188
</div>
192189
</div>
193-
<div class="scriptingArea">
194-
<!-- some test stuff... -->
195-
<ul class="script">
196-
<li class="hat">DOCTYPE html</li>
197-
<ul class="c-wrapper e-body">
198-
<li class="c-header">body</li>
199-
<ul class="c-content">
200-
</ul>
201-
<li class="c-footer">&nbsp;</li>
202-
</ul>
203-
</ul>
204-
</div>
190+
<div class="scriptingArea"></div>
205191
<div class="trashCan" id="trashCan"></div>
206192
<div class="trashCan2" id="trashCan2"></div>
207193
</div>
208194
</div>
209195
<script src='resources/js/files.js'></script>
210-
<script src='resources/js/blocks.js'></script>
211196
<script src='resources/js/blockAttributes.js'></script>
212-
<script src='resources/js/cssAttributes.js'></script>
197+
<script src='resources/js/blocks.js'></script>
213198
<script src='resources/js/block2json.js'></script>
214199
<script src='resources/js/fileManagement.js'></script>
215200
</body>

resources/css/blocks.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/css/blocks.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ body {
172172
background-color: orange;
173173
border-radius: 10px;
174174
box-sizing: border-box;
175-
display: inline-block;
175+
display: inline-flex;
176176
padding: 3px;
177177
margin-right: 6px;
178178
.attr-dropdown,

resources/css/style.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ body {
166166
background-color: orange;
167167
border-radius: 10px;
168168
box-sizing: border-box;
169-
display: inline-block;
169+
display: inline-flex;
170170
padding: 3px;
171171
margin-right: 6px; }
172172
.attr-holder .attr-dropdown,
@@ -550,7 +550,8 @@ html, body {
550550
width: 0px;
551551
padding-right: 4px;
552552
opacity: 0.7;
553-
transition: width 0.2s, padding 0.2s; }
553+
transition: width 0.2s, padding 0.2s;
554+
z-index: 1; }
554555

555556
#searchBar:hover, #searchBar:focus {
556557
opacity: 1; }
@@ -611,5 +612,3 @@ html, body {
611612
@media (max-width: 450px) {
612613
.advanceWrap {
613614
display: none; } }
614-
615-
/*# sourceMappingURL=style.css.map */

resources/css/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ html, body {
329329
opacity: 0.7;
330330
transition: width 0.2s,
331331
padding 0.2s;
332+
z-index: 1;
332333
}
333334

334335
#searchBar:hover, #searchBar:focus {

0 commit comments

Comments
 (0)