pxt-core 7.5.40 → 7.5.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/pxt.js +21 -6
- package/built/pxtblockly.js +186 -18
- package/built/pxtblocks.d.ts +46 -9
- package/built/pxtblocks.js +186 -18
- package/built/pxtlib.d.ts +6 -0
- package/built/pxtlib.js +21 -6
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtblockly.js +2 -2
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/localtypings/pxtarget.d.ts +2 -0
- package/package.json +1 -1
- package/react-common/components/extensions/ExtensionCard.tsx +4 -4
- package/theme/common.less +4 -1
package/built/pxt.js
CHANGED
|
@@ -108310,6 +108310,7 @@ var pxt;
|
|
|
108310
108310
|
}
|
|
108311
108311
|
github.join = join;
|
|
108312
108312
|
function upgradeRules(cfg, id) {
|
|
108313
|
+
var _a;
|
|
108313
108314
|
if (!cfg)
|
|
108314
108315
|
return null;
|
|
108315
108316
|
const parsed = parseRepoId(id);
|
|
@@ -108318,7 +108319,7 @@ var pxt;
|
|
|
108318
108319
|
const repoData = cfg.approvedRepoLib;
|
|
108319
108320
|
// lookup base repo for upgrade rules
|
|
108320
108321
|
// (since nested repoes share the same version number)
|
|
108321
|
-
return cfg.approvedRepoLib && pxt.U.lookup(cfg.approvedRepoLib, parsed.slug.toLowerCase()).upgrades;
|
|
108322
|
+
return cfg.approvedRepoLib && ((_a = pxt.U.lookup(cfg.approvedRepoLib, parsed.slug.toLowerCase())) === null || _a === void 0 ? void 0 : _a.upgrades);
|
|
108322
108323
|
}
|
|
108323
108324
|
function upgradedDisablesVariants(cfg, id) {
|
|
108324
108325
|
const rules = upgradeRules(cfg, id) || [];
|
|
@@ -108691,6 +108692,7 @@ var pxt;
|
|
|
108691
108692
|
constructor(io) {
|
|
108692
108693
|
var _a;
|
|
108693
108694
|
this.io = io;
|
|
108695
|
+
this.initialized = false;
|
|
108694
108696
|
this.cmdSeq = pxt.U.randomUint32();
|
|
108695
108697
|
this.lock = new pxt.U.PromiseQueue();
|
|
108696
108698
|
this.flashing = false;
|
|
@@ -108705,6 +108707,7 @@ var pxt;
|
|
|
108705
108707
|
this.jacdacAvailable = false;
|
|
108706
108708
|
this.onSerial = (buf, isStderr) => { };
|
|
108707
108709
|
this.onCustomEvent = (type, payload) => { };
|
|
108710
|
+
this.onConnectionChanged = () => { };
|
|
108708
108711
|
let frames = [];
|
|
108709
108712
|
io.onDeviceConnectionChanged = connect => this.disconnectAsync()
|
|
108710
108713
|
.then(() => connect && this.reconnectAsync());
|
|
@@ -108772,6 +108775,7 @@ var pxt;
|
|
|
108772
108775
|
});
|
|
108773
108776
|
}
|
|
108774
108777
|
resetState() {
|
|
108778
|
+
this.initialized = false;
|
|
108775
108779
|
this.lock = new pxt.U.PromiseQueue();
|
|
108776
108780
|
this.info = null;
|
|
108777
108781
|
this.infoRaw = null;
|
|
@@ -108794,6 +108798,12 @@ var pxt;
|
|
|
108794
108798
|
return Promise.resolve(); // ignore
|
|
108795
108799
|
return Promise.reject(new Error("invalid custom event type"));
|
|
108796
108800
|
}
|
|
108801
|
+
isConnected() {
|
|
108802
|
+
return this.io.isConnected() && this.initialized;
|
|
108803
|
+
}
|
|
108804
|
+
isConnecting() {
|
|
108805
|
+
return this.io.isConnecting() || (this.io.isConnected() && !this.initialized);
|
|
108806
|
+
}
|
|
108797
108807
|
reconnectAsync() {
|
|
108798
108808
|
this.resetState();
|
|
108799
108809
|
log(`reconnect raw=${this.rawMode}`);
|
|
@@ -109002,8 +109012,10 @@ var pxt;
|
|
|
109002
109012
|
.then(() => { });
|
|
109003
109013
|
}
|
|
109004
109014
|
initAsync() {
|
|
109005
|
-
if (this.rawMode)
|
|
109015
|
+
if (this.rawMode) {
|
|
109016
|
+
this.initialized = true;
|
|
109006
109017
|
return Promise.resolve();
|
|
109018
|
+
}
|
|
109007
109019
|
return Promise.resolve()
|
|
109008
109020
|
.then(() => this.talkAsync(HF2.HF2_CMD_BININFO))
|
|
109009
109021
|
.then(binfo => {
|
|
@@ -109037,13 +109049,16 @@ var pxt;
|
|
|
109037
109049
|
};
|
|
109038
109050
|
log(`Board-ID: ${this.info.BoardID} v${this.info.Parsed.Version} f${this.info.Parsed.Features}`);
|
|
109039
109051
|
})
|
|
109040
|
-
.then(() => this.talkAsync(HF2.HF2_CMD_JDS_CONFIG, new Uint8Array([1]))
|
|
109052
|
+
.then(() => this.talkAsync(HF2.HF2_CMD_JDS_CONFIG, new Uint8Array([1]))
|
|
109053
|
+
.then(() => {
|
|
109041
109054
|
this.jacdacAvailable = true;
|
|
109042
109055
|
}, _err => {
|
|
109043
109056
|
this.jacdacAvailable = false;
|
|
109044
109057
|
}))
|
|
109045
109058
|
.then(() => {
|
|
109046
109059
|
this.reconnectTries = 0;
|
|
109060
|
+
this.initialized = true;
|
|
109061
|
+
this.io.onConnectionChanged();
|
|
109047
109062
|
});
|
|
109048
109063
|
}
|
|
109049
109064
|
}
|
|
@@ -112545,11 +112560,11 @@ var pxt;
|
|
|
112545
112560
|
* The DAP wrapper is active and the device is connected
|
|
112546
112561
|
*/
|
|
112547
112562
|
function isConnected() {
|
|
112548
|
-
return !!wrapper
|
|
112563
|
+
return !!(wrapper === null || wrapper === void 0 ? void 0 : wrapper.isConnected());
|
|
112549
112564
|
}
|
|
112550
112565
|
packetio.isConnected = isConnected;
|
|
112551
112566
|
function isConnecting() {
|
|
112552
|
-
return !!wrapper
|
|
112567
|
+
return !!(wrapper === null || wrapper === void 0 ? void 0 : wrapper.isConnecting());
|
|
112553
112568
|
}
|
|
112554
112569
|
packetio.isConnecting = isConnecting;
|
|
112555
112570
|
function icon() {
|
|
@@ -113435,7 +113450,7 @@ var ts;
|
|
|
113435
113450
|
return r;
|
|
113436
113451
|
}
|
|
113437
113452
|
pxtc.emptyExtInfo = emptyExtInfo;
|
|
113438
|
-
const numberAttributes = ["weight", "imageLiteral", "topblockWeight"];
|
|
113453
|
+
const numberAttributes = ["weight", "imageLiteral", "topblockWeight", "inlineInputModeLimit"];
|
|
113439
113454
|
const booleanAttributes = [
|
|
113440
113455
|
"advanced",
|
|
113441
113456
|
"handlerStatement",
|
package/built/pxtblockly.js
CHANGED
|
@@ -5962,6 +5962,7 @@ var pxt;
|
|
|
5962
5962
|
registerFieldEditor('position', pxtblockly.FieldPosition);
|
|
5963
5963
|
registerFieldEditor('melody', pxtblockly.FieldCustomMelody);
|
|
5964
5964
|
registerFieldEditor('soundeffect', pxtblockly.FieldSoundEffect);
|
|
5965
|
+
registerFieldEditor('autocomplete', pxtblockly.FieldAutoComplete);
|
|
5965
5966
|
}
|
|
5966
5967
|
blocks.initFieldEditors = initFieldEditors;
|
|
5967
5968
|
function registerFieldEditor(selector, field, validator) {
|
|
@@ -10910,7 +10911,13 @@ var pxt;
|
|
|
10910
10911
|
const totalOptions = def.parameters.length;
|
|
10911
10912
|
const buttonDelta = toggle ? totalOptions : 1;
|
|
10912
10913
|
const variableInlineInputs = info.blocksById[b.type].attributes.inlineInputMode === "variable";
|
|
10914
|
+
const inlineInputModeLimit = info.blocksById[b.type].attributes.inlineInputModeLimit || 4;
|
|
10913
10915
|
const compileHiddenArguments = info.blocksById[b.type].attributes.compileHiddenArguments;
|
|
10916
|
+
const breakString = info.blocksById[b.type].attributes.expandableArgumentBreaks;
|
|
10917
|
+
let breaks;
|
|
10918
|
+
if (breakString) {
|
|
10919
|
+
breaks = breakString.split(/[;,]/).map(s => parseInt(s));
|
|
10920
|
+
}
|
|
10914
10921
|
const state = new MutationState(b);
|
|
10915
10922
|
state.setEventsEnabled(false);
|
|
10916
10923
|
state.setValue(numVisibleAttr, 0);
|
|
@@ -11018,7 +11025,7 @@ var pxt;
|
|
|
11018
11025
|
}
|
|
11019
11026
|
updateButtons();
|
|
11020
11027
|
if (variableInlineInputs)
|
|
11021
|
-
b.setInputsInline(visibleOptions <
|
|
11028
|
+
b.setInputsInline(visibleOptions < inlineInputModeLimit);
|
|
11022
11029
|
if (!skipRender)
|
|
11023
11030
|
b.render();
|
|
11024
11031
|
}
|
|
@@ -11065,7 +11072,28 @@ var pxt;
|
|
|
11065
11072
|
updateButtons();
|
|
11066
11073
|
}
|
|
11067
11074
|
function addDelta(delta) {
|
|
11068
|
-
|
|
11075
|
+
const newValue = Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
|
|
11076
|
+
if (breaks) {
|
|
11077
|
+
if (delta >= 0) {
|
|
11078
|
+
if (newValue === 0)
|
|
11079
|
+
return 0;
|
|
11080
|
+
for (const breakpoint of breaks) {
|
|
11081
|
+
if (breakpoint >= newValue) {
|
|
11082
|
+
return breakpoint;
|
|
11083
|
+
}
|
|
11084
|
+
}
|
|
11085
|
+
return totalOptions;
|
|
11086
|
+
}
|
|
11087
|
+
else {
|
|
11088
|
+
for (let i = 0; i < breaks.length; i++) {
|
|
11089
|
+
if (breaks[i] >= newValue) {
|
|
11090
|
+
return i > 0 ? breaks[i - 1] : 0;
|
|
11091
|
+
}
|
|
11092
|
+
}
|
|
11093
|
+
return breaks[breaks.length - 1];
|
|
11094
|
+
}
|
|
11095
|
+
}
|
|
11096
|
+
return newValue;
|
|
11069
11097
|
}
|
|
11070
11098
|
function setInputVisible(input, visible) {
|
|
11071
11099
|
// If the block isn't rendered, Blockly will crash
|
|
@@ -12037,6 +12065,156 @@ var pxtblockly;
|
|
|
12037
12065
|
}
|
|
12038
12066
|
pxtblockly.FieldArgumentVariable = FieldArgumentVariable;
|
|
12039
12067
|
})(pxtblockly || (pxtblockly = {}));
|
|
12068
|
+
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
12069
|
+
var pxtblockly;
|
|
12070
|
+
(function (pxtblockly) {
|
|
12071
|
+
class FieldTextDropdown extends Blockly.FieldTextDropdown {
|
|
12072
|
+
constructor(text, options, opt_validator) {
|
|
12073
|
+
super(text, options.values, opt_validator);
|
|
12074
|
+
this.isFieldCustom_ = true;
|
|
12075
|
+
}
|
|
12076
|
+
}
|
|
12077
|
+
pxtblockly.FieldTextDropdown = FieldTextDropdown;
|
|
12078
|
+
})(pxtblockly || (pxtblockly = {}));
|
|
12079
|
+
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
12080
|
+
/// <reference path="./field_textdropdown.ts" />
|
|
12081
|
+
var pxtblockly;
|
|
12082
|
+
(function (pxtblockly) {
|
|
12083
|
+
class FieldAutoComplete extends Blockly.FieldTextDropdown {
|
|
12084
|
+
constructor(text, options, opt_validator) {
|
|
12085
|
+
super(text, () => [], opt_validator);
|
|
12086
|
+
this.isFieldCustom_ = true;
|
|
12087
|
+
this.key = options.key;
|
|
12088
|
+
this.isTextValid_ = true;
|
|
12089
|
+
}
|
|
12090
|
+
isOptionListDynamic() {
|
|
12091
|
+
return true;
|
|
12092
|
+
}
|
|
12093
|
+
getDisplayText_() {
|
|
12094
|
+
return this.parsedValue || "";
|
|
12095
|
+
}
|
|
12096
|
+
doValueUpdate_(newValue) {
|
|
12097
|
+
if (newValue === null)
|
|
12098
|
+
return;
|
|
12099
|
+
if (/['"`].*['"`]/.test(newValue)) {
|
|
12100
|
+
this.parsedValue = JSON.parse(newValue);
|
|
12101
|
+
}
|
|
12102
|
+
else {
|
|
12103
|
+
this.parsedValue = newValue;
|
|
12104
|
+
}
|
|
12105
|
+
this.value_ = this.parsedValue;
|
|
12106
|
+
}
|
|
12107
|
+
getValue() {
|
|
12108
|
+
if (this.parsedValue) {
|
|
12109
|
+
return JSON.stringify(this.parsedValue);
|
|
12110
|
+
}
|
|
12111
|
+
else
|
|
12112
|
+
return '""';
|
|
12113
|
+
}
|
|
12114
|
+
getOptions() {
|
|
12115
|
+
var _a;
|
|
12116
|
+
const workspace = (_a = this.sourceBlock_) === null || _a === void 0 ? void 0 : _a.workspace;
|
|
12117
|
+
if (!workspace)
|
|
12118
|
+
return [];
|
|
12119
|
+
const res = [];
|
|
12120
|
+
const fields = pxtblockly.getAllFields(workspace, field => field instanceof FieldAutoComplete && field.getKey() === this.key);
|
|
12121
|
+
const options = fields.map(field => field.ref.getDisplayText_());
|
|
12122
|
+
for (const option of options) {
|
|
12123
|
+
if (!option.trim() || res.some(tuple => tuple[0] === option))
|
|
12124
|
+
continue;
|
|
12125
|
+
res.push([option, option]);
|
|
12126
|
+
}
|
|
12127
|
+
res.sort((a, b) => a[0].localeCompare(b[0]));
|
|
12128
|
+
return res;
|
|
12129
|
+
}
|
|
12130
|
+
showDropdown_() {
|
|
12131
|
+
const options = this.getOptions();
|
|
12132
|
+
if (options.length)
|
|
12133
|
+
super.showDropdown_();
|
|
12134
|
+
}
|
|
12135
|
+
getKey() {
|
|
12136
|
+
if (this.key)
|
|
12137
|
+
return this.key;
|
|
12138
|
+
if (this.sourceBlock_)
|
|
12139
|
+
return this.sourceBlock_.type;
|
|
12140
|
+
return undefined;
|
|
12141
|
+
}
|
|
12142
|
+
// Copied from field_string in pxt-blockly
|
|
12143
|
+
initView() {
|
|
12144
|
+
// Add quotes around the string
|
|
12145
|
+
// Positioned on updatSize, after text size is calculated.
|
|
12146
|
+
this.quoteSize_ = 16;
|
|
12147
|
+
this.quoteWidth_ = 8;
|
|
12148
|
+
this.quoteLeftX_ = 0;
|
|
12149
|
+
this.quoteRightX_ = 0;
|
|
12150
|
+
this.quoteY_ = 10;
|
|
12151
|
+
if (this.quoteLeft_)
|
|
12152
|
+
this.quoteLeft_.parentNode.removeChild(this.quoteLeft_);
|
|
12153
|
+
this.quoteLeft_ = Blockly.utils.dom.createSvgElement('text', {
|
|
12154
|
+
'font-size': this.quoteSize_ + 'px',
|
|
12155
|
+
'class': 'field-text-quote'
|
|
12156
|
+
}, this.fieldGroup_);
|
|
12157
|
+
super.initView();
|
|
12158
|
+
if (this.quoteRight_)
|
|
12159
|
+
this.quoteRight_.parentNode.removeChild(this.quoteRight_);
|
|
12160
|
+
this.quoteRight_ = Blockly.utils.dom.createSvgElement('text', {
|
|
12161
|
+
'font-size': this.quoteSize_ + 'px',
|
|
12162
|
+
'class': 'field-text-quote'
|
|
12163
|
+
}, this.fieldGroup_);
|
|
12164
|
+
this.quoteLeft_.appendChild(document.createTextNode('"'));
|
|
12165
|
+
this.quoteRight_.appendChild(document.createTextNode('"'));
|
|
12166
|
+
}
|
|
12167
|
+
// Copied from field_string in pxt-blockly
|
|
12168
|
+
updateSize_() {
|
|
12169
|
+
super.updateSize_();
|
|
12170
|
+
const sWidth = Math.max(this.size_.width, 1);
|
|
12171
|
+
const xPadding = 3;
|
|
12172
|
+
let addedWidth = this.positionLeft(sWidth + xPadding);
|
|
12173
|
+
this.textElement_.setAttribute('x', addedWidth.toString());
|
|
12174
|
+
addedWidth += this.positionRight(addedWidth + sWidth + xPadding);
|
|
12175
|
+
this.size_.width = sWidth + addedWidth;
|
|
12176
|
+
}
|
|
12177
|
+
// Copied from field_string in pxt-blockly
|
|
12178
|
+
positionRight(x) {
|
|
12179
|
+
if (!this.quoteRight_) {
|
|
12180
|
+
return 0;
|
|
12181
|
+
}
|
|
12182
|
+
let addedWidth = 0;
|
|
12183
|
+
if (this.sourceBlock_.RTL) {
|
|
12184
|
+
this.quoteRightX_ = Blockly.FieldString.quotePadding;
|
|
12185
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12186
|
+
}
|
|
12187
|
+
else {
|
|
12188
|
+
this.quoteRightX_ = x + Blockly.FieldString.quotePadding;
|
|
12189
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12190
|
+
}
|
|
12191
|
+
this.quoteRight_.setAttribute('transform', 'translate(' + this.quoteRightX_ + ',' + this.quoteY_ + ')');
|
|
12192
|
+
return addedWidth;
|
|
12193
|
+
}
|
|
12194
|
+
// Copied from field_string in pxt-blockly
|
|
12195
|
+
positionLeft(x) {
|
|
12196
|
+
if (!this.quoteLeft_) {
|
|
12197
|
+
return 0;
|
|
12198
|
+
}
|
|
12199
|
+
let addedWidth = 0;
|
|
12200
|
+
if (this.sourceBlock_.RTL) {
|
|
12201
|
+
this.quoteLeftX_ = x + this.quoteWidth_ + Blockly.FieldString.quotePadding * 2;
|
|
12202
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12203
|
+
}
|
|
12204
|
+
else {
|
|
12205
|
+
this.quoteLeftX_ = 0;
|
|
12206
|
+
addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
|
|
12207
|
+
}
|
|
12208
|
+
this.quoteLeft_.setAttribute('transform', 'translate(' + this.quoteLeftX_ + ',' + this.quoteY_ + ')');
|
|
12209
|
+
return addedWidth;
|
|
12210
|
+
}
|
|
12211
|
+
createSVGArrow_() {
|
|
12212
|
+
// This creates the little arrow for dropdown fields. Intentionally
|
|
12213
|
+
// do nothing
|
|
12214
|
+
}
|
|
12215
|
+
}
|
|
12216
|
+
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
12217
|
+
})(pxtblockly || (pxtblockly = {}));
|
|
12040
12218
|
/// <reference path="../../localtypings/blockly.d.ts" />
|
|
12041
12219
|
/// <reference path="../../built/pxtsim.d.ts" />
|
|
12042
12220
|
var pxtblockly;
|
|
@@ -15729,17 +15907,6 @@ var pxtblockly;
|
|
|
15729
15907
|
})(pxtblockly || (pxtblockly = {}));
|
|
15730
15908
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
15731
15909
|
var pxtblockly;
|
|
15732
|
-
(function (pxtblockly) {
|
|
15733
|
-
class FieldTextDropdown extends Blockly.FieldTextDropdown {
|
|
15734
|
-
constructor(text, options, opt_validator) {
|
|
15735
|
-
super(text, options.values, opt_validator);
|
|
15736
|
-
this.isFieldCustom_ = true;
|
|
15737
|
-
}
|
|
15738
|
-
}
|
|
15739
|
-
pxtblockly.FieldTextDropdown = FieldTextDropdown;
|
|
15740
|
-
})(pxtblockly || (pxtblockly = {}));
|
|
15741
|
-
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
15742
|
-
var pxtblockly;
|
|
15743
15910
|
(function (pxtblockly) {
|
|
15744
15911
|
class FieldTextInput extends Blockly.FieldTextInput {
|
|
15745
15912
|
constructor(value, options, opt_validator) {
|
|
@@ -16851,11 +17018,11 @@ var pxtblockly;
|
|
|
16851
17018
|
}
|
|
16852
17019
|
}
|
|
16853
17020
|
function getAllBlocksWithTilemaps(ws) {
|
|
16854
|
-
return
|
|
17021
|
+
return getAllFields(ws, f => f instanceof pxtblockly.FieldTilemap && !f.isGreyBlock);
|
|
16855
17022
|
}
|
|
16856
17023
|
pxtblockly.getAllBlocksWithTilemaps = getAllBlocksWithTilemaps;
|
|
16857
17024
|
function getAllBlocksWithTilesets(ws) {
|
|
16858
|
-
return
|
|
17025
|
+
return getAllFields(ws, f => f instanceof pxtblockly.FieldTileset);
|
|
16859
17026
|
}
|
|
16860
17027
|
pxtblockly.getAllBlocksWithTilesets = getAllBlocksWithTilesets;
|
|
16861
17028
|
function needsTilemapUpgrade(ws) {
|
|
@@ -16911,7 +17078,7 @@ var pxtblockly;
|
|
|
16911
17078
|
}
|
|
16912
17079
|
}
|
|
16913
17080
|
pxtblockly.upgradeTilemapsInWorkspace = upgradeTilemapsInWorkspace;
|
|
16914
|
-
function
|
|
17081
|
+
function getAllFields(ws, predicate) {
|
|
16915
17082
|
const result = [];
|
|
16916
17083
|
const top = ws.getTopBlocks(false);
|
|
16917
17084
|
top.forEach(block => getAllFieldsRecursive(block));
|
|
@@ -16932,6 +17099,7 @@ var pxtblockly;
|
|
|
16932
17099
|
}
|
|
16933
17100
|
}
|
|
16934
17101
|
}
|
|
17102
|
+
pxtblockly.getAllFields = getAllFields;
|
|
16935
17103
|
function getAllReferencedTiles(workspace, excludeBlockID) {
|
|
16936
17104
|
var _a;
|
|
16937
17105
|
let all = {};
|
|
@@ -16970,10 +17138,10 @@ var pxtblockly;
|
|
|
16970
17138
|
function getTemporaryAssets(workspace, type) {
|
|
16971
17139
|
switch (type) {
|
|
16972
17140
|
case "image" /* Image */:
|
|
16973
|
-
return
|
|
17141
|
+
return getAllFields(workspace, field => field instanceof pxtblockly.FieldSpriteEditor && field.isTemporaryAsset())
|
|
16974
17142
|
.map(f => f.ref.getAsset());
|
|
16975
17143
|
case "animation" /* Animation */:
|
|
16976
|
-
return
|
|
17144
|
+
return getAllFields(workspace, field => field instanceof pxtblockly.FieldAnimationEditor && field.isTemporaryAsset())
|
|
16977
17145
|
.map(f => f.ref.getAsset());
|
|
16978
17146
|
default: return [];
|
|
16979
17147
|
}
|
package/built/pxtblocks.d.ts
CHANGED
|
@@ -515,6 +515,51 @@ declare namespace pxtblockly {
|
|
|
515
515
|
dropdownCreate(): any;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
+
declare namespace pxtblockly {
|
|
519
|
+
interface FieldTextDropdownOptions extends Blockly.FieldCustomOptions {
|
|
520
|
+
values: any;
|
|
521
|
+
}
|
|
522
|
+
class FieldTextDropdown extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
|
|
523
|
+
isFieldCustom_: boolean;
|
|
524
|
+
constructor(text: string, options: FieldTextDropdownOptions, opt_validator?: Function);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
declare namespace Blockly {
|
|
528
|
+
interface FieldTextDropdown {
|
|
529
|
+
showDropdown_(): void;
|
|
530
|
+
isTextValid_: boolean;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
declare namespace pxtblockly {
|
|
534
|
+
interface FieldAutoCompleteOptions extends Blockly.FieldCustomOptions {
|
|
535
|
+
key: string;
|
|
536
|
+
}
|
|
537
|
+
class FieldAutoComplete extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
|
|
538
|
+
isFieldCustom_: boolean;
|
|
539
|
+
protected key: string;
|
|
540
|
+
protected parsedValue: string;
|
|
541
|
+
protected quoteSize_: number;
|
|
542
|
+
protected quoteWidth_: number;
|
|
543
|
+
protected quoteLeftX_: number;
|
|
544
|
+
protected quoteRightX_: number;
|
|
545
|
+
protected quoteY_: number;
|
|
546
|
+
protected quoteLeft_: SVGTextElement;
|
|
547
|
+
protected quoteRight_: SVGTextElement;
|
|
548
|
+
constructor(text: string, options: FieldAutoCompleteOptions, opt_validator?: Function);
|
|
549
|
+
isOptionListDynamic(): boolean;
|
|
550
|
+
getDisplayText_(): string;
|
|
551
|
+
doValueUpdate_(newValue: string): void;
|
|
552
|
+
getValue(): string;
|
|
553
|
+
getOptions(): [string, string][];
|
|
554
|
+
showDropdown_(): void;
|
|
555
|
+
getKey(): string;
|
|
556
|
+
initView(): void;
|
|
557
|
+
updateSize_(): void;
|
|
558
|
+
positionRight(x: number): number;
|
|
559
|
+
positionLeft(x: number): number;
|
|
560
|
+
createSVGArrow_(): void;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
518
563
|
declare namespace pxtblockly {
|
|
519
564
|
class FieldBreakpoint extends Blockly.FieldNumber implements Blockly.FieldCustom {
|
|
520
565
|
isFieldCustom_: boolean;
|
|
@@ -1231,15 +1276,6 @@ declare namespace pxtblockly {
|
|
|
1231
1276
|
constructor(value: string, options?: StyleOptions, opt_validator?: Function);
|
|
1232
1277
|
}
|
|
1233
1278
|
}
|
|
1234
|
-
declare namespace pxtblockly {
|
|
1235
|
-
interface FieldTextDropdownOptions extends Blockly.FieldCustomOptions {
|
|
1236
|
-
values: any;
|
|
1237
|
-
}
|
|
1238
|
-
class FieldTextDropdown extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
|
|
1239
|
-
isFieldCustom_: boolean;
|
|
1240
|
-
constructor(text: string, options: FieldTextDropdownOptions, opt_validator?: Function);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
1279
|
declare namespace pxtblockly {
|
|
1244
1280
|
class FieldTextInput extends Blockly.FieldTextInput implements Blockly.FieldCustom {
|
|
1245
1281
|
isFieldCustom_: boolean;
|
|
@@ -1469,6 +1505,7 @@ declare namespace pxtblockly {
|
|
|
1469
1505
|
function getAllBlocksWithTilesets(ws: Blockly.Workspace): FieldEditorReference<FieldTileset>[];
|
|
1470
1506
|
function needsTilemapUpgrade(ws: Blockly.Workspace): boolean;
|
|
1471
1507
|
function upgradeTilemapsInWorkspace(ws: Blockly.Workspace, proj: pxt.TilemapProject): void;
|
|
1508
|
+
function getAllFields<U extends Blockly.Field>(ws: Blockly.Workspace, predicate: (field: Blockly.Field) => boolean): FieldEditorReference<U>[];
|
|
1472
1509
|
function getAllReferencedTiles(workspace: Blockly.Workspace, excludeBlockID?: string): pxt.Tile[];
|
|
1473
1510
|
function getTemporaryAssets(workspace: Blockly.Workspace, type: pxt.AssetType): pxt.Asset[];
|
|
1474
1511
|
function workspaceToScreenCoordinates(ws: Blockly.WorkspaceSvg, wsCoordinates: Blockly.utils.Coordinate): Blockly.utils.Coordinate;
|