removed scaffolding in blocks.js

snap8
Jens Mönig 2022-03-01 16:24:19 +01:00
rodzic c7f8204bf3
commit c8eadd6b5a
2 zmienionych plików z 19 dodań i 19 usunięć

Wyświetl plik

@ -19,6 +19,7 @@
* objects: removed scaffolding * objects: removed scaffolding
* store: apply block migration dictionary to hidden blocks in microworlds * store: apply block migration dictionary to hidden blocks in microworlds
* store: removed scaffolding * store: removed scaffolding
* blocks: removed scaffolding
### 2022-02-28 ### 2022-02-28
* blocks, objects, threads, store: made addition reporter variadic * blocks, objects, threads, store: made addition reporter variadic

Wyświetl plik

@ -1014,7 +1014,7 @@ SyntaxElementMorph.prototype.labelParts = {
type: 'multi' type: 'multi'
slots: a slot spec string slots: a slot spec string
label: (optional) label: (optional)
infix: (optional) // +++ infix: (optional)
collapse: (optional) alternative label to "Input list" collapse: (optional) alternative label to "Input list"
tags: 'widget' // doesn't count as "empty" slot implicit parameter tags: 'widget' // doesn't count as "empty" slot implicit parameter
min: (optional) number of minimum inputs) or zero min: (optional) number of minimum inputs) or zero
@ -1097,28 +1097,28 @@ SyntaxElementMorph.prototype.labelParts = {
defaults: 1, defaults: 1,
tags: 'static widget' tags: 'static widget'
}, },
'%sum': { // +++ '%sum': {
type: 'multi', type: 'multi',
slots: '%n', slots: '%n',
min: 2, min: 2,
infix: '+', infix: '+',
collapse: 'sum' collapse: 'sum'
}, },
'%product': { // +++ '%product': {
type: 'multi', type: 'multi',
slots: '%n', slots: '%n',
min: 2, min: 2,
infix: '\u00D7', infix: '\u00D7',
collapse: 'product' collapse: 'product'
}, },
'%min': { // +++ '%min': {
type: 'multi', type: 'multi',
slots: '%n', slots: '%n',
min: 2, min: 2,
infix: 'min', infix: 'min',
collapse: 'minimum' collapse: 'minimum'
}, },
'%max': { // +++ '%max': {
type: 'multi', type: 'multi',
slots: '%n', slots: '%n',
min: 2, min: 2,
@ -1280,10 +1280,9 @@ SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) {
oldArg.inputs().forEach(inp => // preserve nested reporters oldArg.inputs().forEach(inp => // preserve nested reporters
oldArg.replaceInput(inp, new InputSlotMorph()) oldArg.replaceInput(inp, new InputSlotMorph())
); );
// if (this.dynamicInputLabels && newArg instanceof ReporterBlockMorph) {
if ((this.dynamicInputLabels || oldArg.collapse) && if ((this.dynamicInputLabels || oldArg.collapse) &&
newArg instanceof ReporterBlockMorph) { newArg instanceof ReporterBlockMorph) {
replacement = new ArgLabelMorph(newArg, oldArg.collapse); // +++ replacement = new ArgLabelMorph(newArg, oldArg.collapse);
} }
} }
replacement.parent = this; replacement.parent = this;
@ -1766,8 +1765,8 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
info.min || 0, info.min || 0,
spec, spec,
null, null, null, null, null, null, null, null, null, null,
info.infix, // +++ info.infix,
info.collapse // +++ info.collapse
); );
part.maxInputs = info.max; part.maxInputs = info.max;
for (i = 0; i < info.defaults || 0; i += 1) { for (i = 0; i < info.defaults || 0; i += 1) {
@ -3758,7 +3757,7 @@ BlockMorph.prototype.setSelector = function (aSelector, inputOffset = 0) {
} }
}; };
BlockMorph.prototype.restoreInputs = function (oldInputs, offset = 0) { // +++++ BlockMorph.prototype.restoreInputs = function (oldInputs, offset = 0) {
// private - used only for relabel() // private - used only for relabel()
// try to restore my previous inputs when my spec has been changed // try to restore my previous inputs when my spec has been changed
// return an Array of left-over blocks, if any // return an Array of left-over blocks, if any
@ -3881,7 +3880,7 @@ BlockMorph.prototype.restoreInputs = function (oldInputs, offset = 0) { // +++++
} }
} }
} }
element.cachedInputs = null; // +++ element.cachedInputs = null;
this.cachedInputs = null; this.cachedInputs = null;
return leftOver; return leftOver;
}; };
@ -12346,8 +12345,8 @@ function MultiArgMorph(
shadowColor, shadowColor,
shadowOffset, shadowOffset,
isTransparent, isTransparent,
infix, // +++ infix,
collapse // +++ collapse
) { ) {
this.init( this.init(
slotSpec, slotSpec,
@ -12385,8 +12384,8 @@ MultiArgMorph.prototype.init = function (
this.slotSpec = slotSpec || '%s'; this.slotSpec = slotSpec || '%s';
this.labelText = localize(labelTxt || ''); this.labelText = localize(labelTxt || '');
this.infix = infix || ''; // +++ this.infix = infix || '';
this.collapse = collapse || ''; // +++ this.collapse = collapse || '';
this.minInputs = min || 0; this.minInputs = min || 0;
this.maxInputs = null; this.maxInputs = null;
this.elementSpec = eSpec || null; this.elementSpec = eSpec || null;
@ -12446,7 +12445,7 @@ MultiArgMorph.prototype.label = function () {
MultiArgMorph.prototype.allLabels = function () { MultiArgMorph.prototype.allLabels = function () {
// including infix labels // including infix labels
return this.children.filter(m => m instanceof BlockLabelMorph); // +++ return this.children.filter(m => m instanceof BlockLabelMorph);
}; };
MultiArgMorph.prototype.arrows = function () { MultiArgMorph.prototype.arrows = function () {
@ -12660,7 +12659,7 @@ MultiArgMorph.prototype.addInput = function (contents) {
var newPart = this.labelPart(this.slotSpec), var newPart = this.labelPart(this.slotSpec),
i, name, idx; i, name, idx;
this.addInfix(); // +++ this.addInfix();
idx = this.children.length - 1; idx = this.children.length - 1;
if (contents) { if (contents) {
newPart.setContents(contents); newPart.setContents(contents);
@ -12721,7 +12720,7 @@ MultiArgMorph.prototype.removeInput = function () {
} }
} }
} }
if (this.infix !== '') { // +++ if (this.infix !== '') {
if (this.children.length > 1) { if (this.children.length > 1) {
this.removeChild(this.children[this.children.length - 2]); this.removeChild(this.children[this.children.length - 2]);
} }
@ -12973,7 +12972,7 @@ ArgLabelMorph.prototype.init = function (argMorph, labelTxt) {
this.add(argMorph); this.add(argMorph);
}; };
ArgLabelMorph.prototype.label = function () { // +++ ArgLabelMorph.prototype.label = function () {
return this.children[0]; return this.children[0];
}; };