pxt-core 7.5.45 → 7.5.48
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 +125 -26
- package/built/pxtblockly.js +23 -15
- package/built/pxtblocks.d.ts +1 -0
- package/built/pxtblocks.js +9 -1
- package/built/pxtlib.d.ts +2 -0
- package/built/pxtlib.js +12 -2
- package/built/pxtpy.js +113 -24
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.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/pxtpy.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +117 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/package.json +2 -2
- package/react-common/components/controls/LazyImage.tsx +6 -0
- package/react-common/styles/controls/LazyImage.less +27 -0
- package/react-common/styles/extensions/ExtensionCard.less +5 -1
- package/react-common/styles/react-common-breakpoints.less +136 -0
- package/react-common/styles/react-common-variables.less +2 -17
- package/theme/soundeffecteditor.less +7 -3
- package/theme/tutorial-sidebar.less +1 -0
- package/theme/tutorial.less +1 -0
- package/webapp/public/blockly/blockly_compressed.js +14 -14
package/built/pxt.js
CHANGED
|
@@ -102151,6 +102151,10 @@ var pxt;
|
|
|
102151
102151
|
(function (pxt) {
|
|
102152
102152
|
var BrowserUtils;
|
|
102153
102153
|
(function (BrowserUtils) {
|
|
102154
|
+
function isDocumentVisible() {
|
|
102155
|
+
return typeof window !== "undefined" && document.visibilityState === 'visible';
|
|
102156
|
+
}
|
|
102157
|
+
BrowserUtils.isDocumentVisible = isDocumentVisible;
|
|
102154
102158
|
function isIFrame() {
|
|
102155
102159
|
try {
|
|
102156
102160
|
return window && window.self !== window.top;
|
|
@@ -107990,6 +107994,12 @@ var pxt;
|
|
|
107990
107994
|
GitRepoStatus[GitRepoStatus["Approved"] = 1] = "Approved";
|
|
107991
107995
|
GitRepoStatus[GitRepoStatus["Banned"] = 2] = "Banned";
|
|
107992
107996
|
})(GitRepoStatus = github.GitRepoStatus || (github.GitRepoStatus = {}));
|
|
107997
|
+
function isDefaultBranch(branch, repo) {
|
|
107998
|
+
if (repo && repo.defaultBranch)
|
|
107999
|
+
return branch === repo.defaultBranch;
|
|
108000
|
+
return /^(main|master)$/.test(branch);
|
|
108001
|
+
}
|
|
108002
|
+
github.isDefaultBranch = isDefaultBranch;
|
|
107993
108003
|
function listUserReposAsync() {
|
|
107994
108004
|
const q = `{
|
|
107995
108005
|
viewer {
|
|
@@ -108007,12 +108017,12 @@ var pxt;
|
|
|
108007
108017
|
defaultBranchRef {
|
|
108008
108018
|
name
|
|
108009
108019
|
}
|
|
108010
|
-
pxtjson: object(expression: "
|
|
108020
|
+
pxtjson: object(expression: "HEAD:pxt.json") {
|
|
108011
108021
|
... on Blob {
|
|
108012
108022
|
text
|
|
108013
108023
|
}
|
|
108014
108024
|
}
|
|
108015
|
-
readme: object(expression: "
|
|
108025
|
+
readme: object(expression: "HEAD:README.md") {
|
|
108016
108026
|
... on Blob {
|
|
108017
108027
|
text
|
|
108018
108028
|
}
|
|
@@ -140367,6 +140377,7 @@ var pxt;
|
|
|
140367
140377
|
return mkType({ primType: tp });
|
|
140368
140378
|
}
|
|
140369
140379
|
function getOrSetSymbolType(sym) {
|
|
140380
|
+
var _a;
|
|
140370
140381
|
if (!sym.pySymbolType) {
|
|
140371
140382
|
currErrorCtx = sym.pyQName;
|
|
140372
140383
|
if (sym.parameters) {
|
|
@@ -140388,8 +140399,24 @@ var pxt;
|
|
|
140388
140399
|
sym.pyRetType = mkType({ moduleType: sym });
|
|
140389
140400
|
}
|
|
140390
140401
|
else {
|
|
140391
|
-
if (sym.retType)
|
|
140392
|
-
sym.
|
|
140402
|
+
if (sym.retType) {
|
|
140403
|
+
if (((_a = sym.qName) === null || _a === void 0 ? void 0 : _a.endsWith(".__constructor")) && sym.retType === "void") {
|
|
140404
|
+
// This must be a TS class. Because python treats constructors as functions,
|
|
140405
|
+
// set the return type to be the class instead of void
|
|
140406
|
+
const classSym = lookupGlobalSymbol(sym.qName.substring(0, sym.qName.lastIndexOf(".")));
|
|
140407
|
+
if (classSym) {
|
|
140408
|
+
sym.pyRetType = mkType({
|
|
140409
|
+
classType: classSym
|
|
140410
|
+
});
|
|
140411
|
+
}
|
|
140412
|
+
else {
|
|
140413
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
140414
|
+
}
|
|
140415
|
+
}
|
|
140416
|
+
else {
|
|
140417
|
+
sym.pyRetType = mapTsType(sym.retType);
|
|
140418
|
+
}
|
|
140419
|
+
}
|
|
140393
140420
|
else if (sym.pyRetType) {
|
|
140394
140421
|
// nothing to do
|
|
140395
140422
|
}
|
|
@@ -140428,7 +140455,7 @@ var pxt;
|
|
|
140428
140455
|
let sym = lookupApi(name);
|
|
140429
140456
|
if (sym)
|
|
140430
140457
|
getOrSetSymbolType(sym);
|
|
140431
|
-
else if (name.indexOf(".")) {
|
|
140458
|
+
else if (name.indexOf(".") && !name.endsWith(".__constructor")) {
|
|
140432
140459
|
const base = name.substring(0, name.lastIndexOf("."));
|
|
140433
140460
|
const baseSymbol = lookupGlobalSymbol(base);
|
|
140434
140461
|
if ((baseSymbol === null || baseSymbol === void 0 ? void 0 : baseSymbol.kind) === 8 /* Class */ && ((_a = baseSymbol.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -140517,7 +140544,10 @@ var pxt;
|
|
|
140517
140544
|
pref += ".";
|
|
140518
140545
|
}
|
|
140519
140546
|
let qualifiedName = pref + name;
|
|
140520
|
-
if (
|
|
140547
|
+
if (scope.kind === "ClassDef") {
|
|
140548
|
+
varSym = addSymbol(2 /* Property */, qualifiedName);
|
|
140549
|
+
}
|
|
140550
|
+
else if (isLocalScope(scope)
|
|
140521
140551
|
&& (modifier === py_1.VarModifier.Global
|
|
140522
140552
|
|| modifier === py_1.VarModifier.NonLocal)) {
|
|
140523
140553
|
varSym = addSymbol(4 /* Variable */, name);
|
|
@@ -140842,17 +140872,22 @@ var pxt;
|
|
|
140842
140872
|
return n.symInfo;
|
|
140843
140873
|
}
|
|
140844
140874
|
// TODO optimize ?
|
|
140845
|
-
function listClassFields(cd
|
|
140875
|
+
function listClassFields(cd) {
|
|
140846
140876
|
let qn = cd.symInfo.qName;
|
|
140847
|
-
return pxt.U.values(internalApis).filter(e => e.namespace == qn &&
|
|
140877
|
+
return pxt.U.values(internalApis).filter(e => e.namespace == qn && e.kind == 2 /* Property */);
|
|
140848
140878
|
}
|
|
140849
|
-
function getClassField(ct, n, checkOnly = false, skipBases = false) {
|
|
140879
|
+
function getClassField(ct, n, isStatic, checkOnly = false, skipBases = false) {
|
|
140850
140880
|
let qid;
|
|
140851
140881
|
if (n === "__init__") {
|
|
140852
140882
|
qid = ct.pyQName + ".__constructor";
|
|
140853
140883
|
}
|
|
140854
140884
|
else {
|
|
140855
|
-
|
|
140885
|
+
if (n.startsWith(ct.pyQName + ".")) {
|
|
140886
|
+
qid = n;
|
|
140887
|
+
}
|
|
140888
|
+
else {
|
|
140889
|
+
qid = ct.pyQName + "." + n;
|
|
140890
|
+
}
|
|
140856
140891
|
}
|
|
140857
140892
|
let f = lookupGlobalSymbol(qid);
|
|
140858
140893
|
if (f)
|
|
@@ -140863,7 +140898,7 @@ var pxt;
|
|
|
140863
140898
|
if (sym) {
|
|
140864
140899
|
if (sym == ct)
|
|
140865
140900
|
pxt.U.userError("field lookup loop on: " + sym.qName + " / " + n);
|
|
140866
|
-
let classF = getClassField(sym, n, true);
|
|
140901
|
+
let classF = getClassField(sym, n, isStatic, true);
|
|
140867
140902
|
if (classF)
|
|
140868
140903
|
return classF;
|
|
140869
140904
|
}
|
|
@@ -140871,7 +140906,7 @@ var pxt;
|
|
|
140871
140906
|
}
|
|
140872
140907
|
if (!checkOnly && ct.pyAST && ct.pyAST.kind == "ClassDef") {
|
|
140873
140908
|
let sym = addSymbol(2 /* Property */, qid);
|
|
140874
|
-
sym.isInstance =
|
|
140909
|
+
sym.isInstance = !isStatic;
|
|
140875
140910
|
return sym;
|
|
140876
140911
|
}
|
|
140877
140912
|
return null;
|
|
@@ -140888,16 +140923,14 @@ var pxt;
|
|
|
140888
140923
|
const recvType = typeOf(recv);
|
|
140889
140924
|
const constructorTypes = getTypesForFieldLookup(recvType);
|
|
140890
140925
|
for (let ct of constructorTypes) {
|
|
140891
|
-
let
|
|
140926
|
+
let isModule = !!recvType.moduleType;
|
|
140927
|
+
let f = getClassField(ct, n, isModule, checkOnly);
|
|
140892
140928
|
if (f) {
|
|
140893
|
-
let isModule = !!recvType.moduleType;
|
|
140894
140929
|
if (isModule) {
|
|
140895
140930
|
if (f.isInstance)
|
|
140896
140931
|
error(null, 9505, pxt.U.lf("the field '{0}' of '{1}' is not static", n, ct.pyQName));
|
|
140897
140932
|
}
|
|
140898
140933
|
else {
|
|
140899
|
-
if (!f.isInstance)
|
|
140900
|
-
error(null, 9504, pxt.U.lf("the field '{0}' of '{1}' is static", n, ct.pyQName));
|
|
140901
140934
|
if (isSuper(recv))
|
|
140902
140935
|
f.isProtected = true;
|
|
140903
140936
|
else if (isThis(recv)) {
|
|
@@ -141305,7 +141338,7 @@ var pxt;
|
|
|
141305
141338
|
let scopeValueVar = n.vars["value"];
|
|
141306
141339
|
let valueVar = scopeValueVar === null || scopeValueVar === void 0 ? void 0 : scopeValueVar.symbol;
|
|
141307
141340
|
if (funname == "__set__" && valueVar) {
|
|
141308
|
-
let cf = getClassField(ctx.currClass.symInfo, "__get__");
|
|
141341
|
+
let cf = getClassField(ctx.currClass.symInfo, "__get__", false);
|
|
141309
141342
|
if (cf && cf.pyAST && cf.pyAST.kind == "FunctionDef")
|
|
141310
141343
|
unify(n, valueVar.pyRetType, cf.pyRetType);
|
|
141311
141344
|
}
|
|
@@ -141401,7 +141434,7 @@ var pxt;
|
|
|
141401
141434
|
}
|
|
141402
141435
|
}
|
|
141403
141436
|
const classDefs = n.body.filter(s => n.isNamespace || s.kind === "FunctionDef");
|
|
141404
|
-
const staticStmts = n.isNamespace ? [] : n.body.filter(s => classDefs.indexOf(s) === -1);
|
|
141437
|
+
const staticStmts = n.isNamespace ? [] : n.body.filter(s => classDefs.indexOf(s) === -1 && s.kind !== "Pass");
|
|
141405
141438
|
let body = stmts(classDefs);
|
|
141406
141439
|
nodes.push(body);
|
|
141407
141440
|
// Python classes allow arbitrary statements in their bodies, sort of like namespaces.
|
|
@@ -141418,18 +141451,20 @@ var pxt;
|
|
|
141418
141451
|
body.children.unshift(initFun);
|
|
141419
141452
|
}
|
|
141420
141453
|
if (!n.isNamespace) {
|
|
141421
|
-
|
|
141422
|
-
const fieldDefs = listClassFields(n, false)
|
|
141423
|
-
.filter(f => f.kind == 2 /* Property */ || isStatic(f))
|
|
141454
|
+
const fieldDefs = listClassFields(n)
|
|
141424
141455
|
.map(f => {
|
|
141425
141456
|
if (!f.pyName || !f.pyRetType)
|
|
141426
141457
|
error(n, 9535, lf("field definition missing py name or return type", f.qName));
|
|
141427
141458
|
return f;
|
|
141428
141459
|
});
|
|
141429
|
-
const
|
|
141460
|
+
const staticFieldSymbols = fieldDefs.filter(f => !f.isInstance);
|
|
141461
|
+
const instanceFields = fieldDefs.filter(f => f.isInstance)
|
|
141430
141462
|
.map((f) => B.mkStmt(accessAnnot(f), quote(f.pyName), typeAnnot(f.pyRetType)));
|
|
141431
|
-
const staticFields =
|
|
141432
|
-
.map((f) => B.
|
|
141463
|
+
const staticFields = staticFieldSymbols
|
|
141464
|
+
.map((f) => B.mkGroup([
|
|
141465
|
+
B.mkStmt(accessAnnot(f), B.mkText("static "), quote(f.pyName), typeAnnot(f.pyRetType)),
|
|
141466
|
+
declareLocalStatic(quoteStr(n.name), quoteStr(f.pyName), t2s(f.pyRetType))
|
|
141467
|
+
]));
|
|
141433
141468
|
body.children = staticFields.concat(instanceFields).concat(body.children);
|
|
141434
141469
|
}
|
|
141435
141470
|
if (generatedInitFunction) {
|
|
@@ -141744,7 +141779,7 @@ var pxt;
|
|
|
141744
141779
|
// class fields can't be const
|
|
141745
141780
|
// hack: value in @namespace should always be const
|
|
141746
141781
|
isConstCall = !!(value && ctx.currClass.isNamespace);
|
|
141747
|
-
let fd = getClassField(ctx.currClass.symInfo, nm);
|
|
141782
|
+
let fd = getClassField(ctx.currClass.symInfo, nm, true);
|
|
141748
141783
|
if (!fd)
|
|
141749
141784
|
error(n, 9544, lf("cannot get class field"));
|
|
141750
141785
|
// TODO: use or remove this code
|
|
@@ -142146,6 +142181,9 @@ var pxt;
|
|
|
142146
142181
|
let methName = "";
|
|
142147
142182
|
if (isClass) {
|
|
142148
142183
|
fun = lookupSymbol(namedSymbol.pyQName + ".__constructor");
|
|
142184
|
+
if (!fun) {
|
|
142185
|
+
fun = addSymbolFor(3 /* Function */, createDummyConstructorSymbol(namedSymbol === null || namedSymbol === void 0 ? void 0 : namedSymbol.pyAST));
|
|
142186
|
+
}
|
|
142149
142187
|
}
|
|
142150
142188
|
else {
|
|
142151
142189
|
if (n.func.kind == "Attribute") {
|
|
@@ -142343,7 +142381,6 @@ var pxt;
|
|
|
142343
142381
|
]);
|
|
142344
142382
|
}
|
|
142345
142383
|
}
|
|
142346
|
-
// TODO (riknoll): Make sure __init__ isn't being added as a symbol by the super call in the subclass. Should be converted to .__constructor
|
|
142347
142384
|
let fn;
|
|
142348
142385
|
if (isSuperConstructor) {
|
|
142349
142386
|
fn = B.mkText("super");
|
|
@@ -143007,6 +143044,68 @@ var pxt;
|
|
|
143007
143044
|
break;
|
|
143008
143045
|
}
|
|
143009
143046
|
}
|
|
143047
|
+
function createDummyConstructorSymbol(def, sym = def.symInfo) {
|
|
143048
|
+
var _a;
|
|
143049
|
+
const existing = lookupApi(sym.pyQName + ".__constructor");
|
|
143050
|
+
if (!existing && ((_a = sym.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
143051
|
+
const parentSymbol = lookupSymbol(sym.extendsTypes[0]) || lookupGlobalSymbol(sym.extendsTypes[0]);
|
|
143052
|
+
if (parentSymbol) {
|
|
143053
|
+
return createDummyConstructorSymbol(def, parentSymbol);
|
|
143054
|
+
}
|
|
143055
|
+
}
|
|
143056
|
+
const result = {
|
|
143057
|
+
kind: "FunctionDef",
|
|
143058
|
+
name: "__init__",
|
|
143059
|
+
startPos: def.startPos,
|
|
143060
|
+
endPos: def.endPos,
|
|
143061
|
+
parent: def,
|
|
143062
|
+
body: [],
|
|
143063
|
+
args: {
|
|
143064
|
+
kind: "Arguments",
|
|
143065
|
+
startPos: 0,
|
|
143066
|
+
endPos: 0,
|
|
143067
|
+
args: [{
|
|
143068
|
+
startPos: 0,
|
|
143069
|
+
endPos: 0,
|
|
143070
|
+
kind: "Arg",
|
|
143071
|
+
arg: "self"
|
|
143072
|
+
}],
|
|
143073
|
+
kw_defaults: [],
|
|
143074
|
+
kwonlyargs: [],
|
|
143075
|
+
defaults: []
|
|
143076
|
+
},
|
|
143077
|
+
decorator_list: [],
|
|
143078
|
+
vars: {},
|
|
143079
|
+
symInfo: mkSymbol(3 /* Function */, def.symInfo.qName + ".__constructor")
|
|
143080
|
+
};
|
|
143081
|
+
result.symInfo.parameters = [];
|
|
143082
|
+
result.symInfo.pyRetType = mkType({ classType: def.symInfo });
|
|
143083
|
+
if (existing) {
|
|
143084
|
+
result.args.args.push(...existing.parameters.map(p => ({
|
|
143085
|
+
startPos: 0,
|
|
143086
|
+
endPos: 0,
|
|
143087
|
+
kind: "Arg",
|
|
143088
|
+
arg: p.name,
|
|
143089
|
+
})));
|
|
143090
|
+
result.symInfo.parameters.push(...existing.parameters.map(p => {
|
|
143091
|
+
if (p.pyType)
|
|
143092
|
+
return p;
|
|
143093
|
+
const res = Object.assign(Object.assign({}, p), { pyType: mapTsType(p.type) });
|
|
143094
|
+
return res;
|
|
143095
|
+
}));
|
|
143096
|
+
}
|
|
143097
|
+
return result;
|
|
143098
|
+
}
|
|
143099
|
+
function declareLocalStatic(className, name, type) {
|
|
143100
|
+
const isSetVar = `___${name}_is_set`;
|
|
143101
|
+
const localVar = `___${name}`;
|
|
143102
|
+
return B.mkStmt(B.mkStmt(B.mkText(`private ${isSetVar}: boolean`)), B.mkStmt(B.mkText(`private ${localVar}: ${type}`)), B.mkStmt(B.mkText(`get ${name}(): ${type}`), B.mkBlock([
|
|
143103
|
+
B.mkText(`return this.${isSetVar} ? this.${localVar} : ${className}.${name}`)
|
|
143104
|
+
])), B.mkStmt(B.mkText(`set ${name}(value: ${type})`), B.mkBlock([
|
|
143105
|
+
B.mkStmt(B.mkText(`this.${isSetVar} = true`)),
|
|
143106
|
+
B.mkStmt(B.mkText(`this.${localVar} = value`)),
|
|
143107
|
+
])));
|
|
143108
|
+
}
|
|
143010
143109
|
})(py = pxt.py || (pxt.py = {}));
|
|
143011
143110
|
})(pxt || (pxt = {}));
|
|
143012
143111
|
// Lexer spec: https://docs.python.org/3/reference/lexical_analysis.html
|
package/built/pxtblockly.js
CHANGED
|
@@ -190,9 +190,9 @@ Blockly.Xml.domToBlock(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.ge
|
|
|
190
190
|
Blockly.WorkspaceComment.fromXml(l,b):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==k){if(f)Blockly.Xml.domToVariables(l,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");f=!1}}}}finally{e||Blockly.Events.setGroup(!1),Blockly.utils.dom.stopTextWidthCache()}b.setResizesEnabled&&b.setResizesEnabled(!0);b.loadingEventsDisabled=!1;b.getAllBlocks(!1).forEach(function(a){a.onLoadedIntoWorkspace()});
|
|
191
191
|
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.FINISHED_LOADING))(b));return c};
|
|
192
192
|
Blockly.Xml.appendDomToWorkspace=function(a,b){var c;Object.prototype.hasOwnProperty.call(b,"scale")&&(c=b.getBlocksBoundingBox());a=Blockly.Xml.domToWorkspace(a,b);if(c&&c.top!=c.bottom){var d=c.bottom;var e=b.RTL?c.right:c.left;var f=Infinity,g=-Infinity,h=Infinity;for(c=0;c<a.length;c++){var k=b.getBlockById(a[c]).getRelativeToSurfaceXY();k.y<h&&(h=k.y);k.x<f&&(f=k.x);k.x>g&&(g=k.x)}d=d-h+10;e=b.RTL?e-g:e-f;for(c=0;c<a.length;c++)b.getBlockById(a[c]).moveBy(e,d)}return a};
|
|
193
|
-
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionTracking(!1);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.disposed||d.
|
|
194
|
-
e.length-1;0<=f;f--)e[f].initModel()}finally{Blockly.Events.enable()}if(Blockly.Events.isEnabled()){a=Blockly.Variables.getAddedVariables(b,c);for(f=0;f<a.length;f++)b=a[f],Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_CREATE))(b));
|
|
195
|
-
Blockly.Xml.domToVariables=function(a,b){for(var c=0,d;d=a.childNodes[c];c++)if(d.nodeType==Blockly.utils.dom.NodeType.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}};
|
|
193
|
+
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionTracking(!1);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.disposed||d.outputConnection&&d.outputConnection.targetConnection&&
|
|
194
|
+
d.outputConnection.targetConnection.sourceBlock_&&!d.outputConnection.targetConnection.sourceBlock_.inputList.find(function(a){return a.connection===d.outputConnection.targetConnection}).isVisible()||d.setConnectionTracking(!0)},1);d.updateDisabled();b.resizeContents()}else for(f=e.length-1;0<=f;f--)e[f].initModel()}finally{Blockly.Events.enable()}if(Blockly.Events.isEnabled()){a=Blockly.Variables.getAddedVariables(b,c);for(f=0;f<a.length;f++)b=a[f],Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_CREATE))(b));
|
|
195
|
+
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.CREATE))(d))}return d};Blockly.Xml.domToVariables=function(a,b){for(var c=0,d;d=a.childNodes[c];c++)if(d.nodeType==Blockly.utils.dom.NodeType.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}};
|
|
196
196
|
Blockly.Xml.mapSupportedXmlTags_=function(a){for(var b={mutation:[],comment:[],data:[],field:[],input:[],next:[],breakpoint:[]},c=0,d;d=a.childNodes[c];c++)if(d.nodeType!=Blockly.utils.dom.NodeType.TEXT_NODE)switch(d.nodeName.toLowerCase()){case "mutation":b.mutation.push(d);break;case "comment":if(!Blockly.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}b.comment.push(d);break;case "data":b.data.push(d);break;case "title":case "field":b.field.push(d);break;
|
|
197
197
|
case "value":case "statement":b.input.push(d);break;case "next":b.next.push(d);break;case "breakpoint":b.breakpoint.push(d);break;default:console.warn("Ignoring unknown tag: "+d.nodeName)}return b};Blockly.Xml.applyMutationTagNodes_=function(a,b){for(var c=!1,d=0,e;e=a[d];d++)b.domToMutation&&(b.domToMutation(e),b.initSvg&&(c=!0));return c};
|
|
198
198
|
Blockly.Xml.applyCommentTagNodes_=function(a,b){for(var c=0,d;d=a[c];c++){var e=d.textContent,f="true"==d.getAttribute("pinned"),g=parseInt(d.getAttribute("w"),10),h=parseInt(d.getAttribute("h"),10);b.setCommentText(e);b.commentModel.pinned=f;isNaN(g)||isNaN(h)||(b.commentModel.size=new Blockly.utils.Size(g,h));e=parseInt(d.getAttribute("relx"),10);d=parseInt(d.getAttribute("rely"),10);isNaN(e)||isNaN(d)||(b.commentModel.xy=new Blockly.utils.Coordinate(e,d));f&&b.getCommentIcon&&!b.isInFlyout&&setTimeout(function(){b.getCommentIcon().setVisible(!0)},
|
|
@@ -738,13 +738,13 @@ Blockly.Block.prototype.getSurroundParent=function(){var a=this;do{var b=a;a=a.g
|
|
|
738
738
|
Blockly.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type==Blockly.connectionTypes.NEXT_STATEMENT)return b.connection;return null};Blockly.Block.prototype.getRootBlock=function(){var a=this;do{var b=a;a=b.parentBlock_}while(a);return b};Blockly.Block.prototype.getTopStackBlock=function(){var a=this;do var b=a.getPreviousBlock();while(b&&b.getNextBlock()==a&&(a=b));return a};
|
|
739
739
|
Blockly.Block.prototype.getChildren=function(a){if(!a)return this.childBlocks_;a=[];for(var b=0,c;c=this.inputList[b];b++)c.connection&&(c=c.connection.targetBlock())&&a.push(c);(b=this.getNextBlock())&&a.push(b);return a};
|
|
740
740
|
Blockly.Block.prototype.setParent=function(a){if(a!=this.parentBlock_){if(this.parentBlock_){Blockly.utils.arrayRemove(this.parentBlock_.childBlocks_,this);if(this.previousConnection&&this.previousConnection.isConnected())throw Error("Still connected to previous block.");if(this.outputConnection&&this.outputConnection.isConnected())throw Error("Still connected to parent block.");this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):this.workspace.addTopBlock(this)}};
|
|
741
|
-
Blockly.Block.prototype.getDescendants=function(a,b){for(var c=[this],d=this.getChildren(a),e,f=0;e=d[f];f++)b&&e.isShadow()||c.push.apply(c,e.getDescendants(a));return c};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.inDebugWorkspace=function(){return!(!this.workspace||!this.workspace.options.debugMode)};
|
|
742
|
-
Blockly.Block.prototype.isMovable=function(){return this.isMovablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isMovablePersisted=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setMovable=function(a){this.movable_=a};
|
|
743
|
-
Blockly.Block.prototype.
|
|
744
|
-
Blockly.Block.prototype.
|
|
745
|
-
Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!=a.length)throw Error("Connection lists did not match in length.");for(var d=0;d<a.length;d++)if(a[d]==b)return c[d];return null};
|
|
746
|
-
Blockly.Block.prototype.
|
|
747
|
-
Blockly.Block.prototype.setOnChange=function(a){if(a&&"function"!=typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};
|
|
741
|
+
Blockly.Block.prototype.getDescendants=function(a,b){for(var c=[this],d=this.getChildren(a),e,f=0;e=d[f];f++)b&&e.isShadow()||c.push.apply(c,e.getDescendants(a));return c};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)&&!this.inDebugWorkspace()};Blockly.Block.prototype.inDebugWorkspace=function(){return!(!this.workspace||!this.workspace.options.debugMode)};
|
|
742
|
+
Blockly.Block.prototype.setDeletable=function(a){this.deletable_=a};Blockly.Block.prototype.isMovable=function(){return this.isMovablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isMovablePersisted=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setMovable=function(a){this.movable_=a};
|
|
743
|
+
Blockly.Block.prototype.isDuplicatable=function(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(Blockly.utils.getBlockTypeCounts(this,!0)):!0};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};
|
|
744
|
+
Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.Colours.insertionMarker),this.setOpacity(Blockly.Colours.insertionMarkerOpacity),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyInsertionMarker"))};Blockly.Block.prototype.isEditable=function(){return this.isEditablePersisted()&&!this.inDebugWorkspace()};Blockly.Block.prototype.isEditablePersisted=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};
|
|
745
|
+
Blockly.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};Blockly.Block.prototype.isDisposed=function(){return this.disposed};Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!=a.length)throw Error("Connection lists did not match in length.");for(var d=0;d<a.length;d++)if(a[d]==b)return c[d];return null};
|
|
746
|
+
Blockly.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};Blockly.Block.prototype.setTooltip=function(a){this.tooltip=a};Blockly.Block.prototype.getTooltip=function(){return Blockly.Tooltip.getTooltipOfObject(this)};Blockly.Block.prototype.getColour=function(){return this.colour_};Blockly.Block.prototype.getStyleName=function(){return this.styleName_};Blockly.Block.prototype.getHue=function(){return this.hue_};
|
|
747
|
+
Blockly.Block.prototype.setColour=function(a){a=Blockly.utils.parseBlockColour(a);this.hue_=a.hue;this.colour_=a.hex};Blockly.Block.prototype.setStyle=function(a){this.styleName_=a};Blockly.Block.prototype.setOnChange=function(a){if(a&&"function"!=typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};
|
|
748
748
|
Blockly.Block.prototype.getField=function(a){if("string"!==typeof a)throw TypeError("Blockly.Block.prototype.getField expects a string with the field name but received "+(void 0===a?"nothing":a+" of type "+typeof a)+" instead");for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(e.name===a)return e;return null};
|
|
749
749
|
Blockly.Block.prototype.getVars=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a};Blockly.Block.prototype.getVarModels=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&(e=this.workspace.getVariableById(e.getValue()))&&a.push(e);return a};
|
|
750
750
|
Blockly.Block.prototype.updateVarName=function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.getId()==e.getValue()&&e.forceRerender()};Blockly.Block.prototype.renameVarById=function(a,b){for(var c=0,d;d=this.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a==f.getValue()&&f.setValue(b)};Blockly.Block.prototype.getFieldValue=function(a){return(a=this.getField(a))?a.getValue():null};
|
|
@@ -891,7 +891,7 @@ Blockly.BlockSvg.prototype.setStyle=function(a){var b=this.workspace.getRenderer
|
|
|
891
891
|
Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};
|
|
892
892
|
Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.removeInput=function(a,b){a=Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};
|
|
893
893
|
Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};Blockly.BlockSvg.prototype.appendInput_=function(a,b){a=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};
|
|
894
|
-
Blockly.BlockSvg.prototype.setConnectionTracking=function(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}};
|
|
894
|
+
Blockly.BlockSvg.prototype.setConnectionTracking=function(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++)if(this.inputList[b].isVisible()){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}};
|
|
895
895
|
Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.prototype.lastConnectionInStack=function(a){return Blockly.BlockSvg.superClass_.lastConnectionInStack.call(this,a)};
|
|
896
896
|
Blockly.BlockSvg.prototype.getMatchingConnection=function(a,b){return Blockly.BlockSvg.superClass_.getMatchingConnection.call(this,a,b)};Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.RenderedConnection(this,a)};
|
|
897
897
|
Blockly.BlockSvg.prototype.bumpNeighbours=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){d.isConnected()&&d.isSuperior()&&d.targetBlock().bumpNeighbours();for(var e=d.neighbours(Blockly.SNAP_RADIUS),f=0,g;g=e[f];f++)d.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!=a&&(d.isSuperior()?g.bumpAwayFrom(d):d.bumpAwayFrom(g))}}};
|
|
@@ -1084,7 +1084,7 @@ return Blockly.Functions.namesInUse(b,null,a)[c]?(Blockly.alert(Blockly.Msg.VARI
|
|
|
1084
1084
|
Blockly.Functions.mutateCallersAndDefinition=function(a,b,c){var d=Blockly.Functions.getDefinition(a,b);d?(a=Blockly.Functions.getCallers(a,d.workspace),a.push(d),Blockly.Events.setGroup(!0),a.forEach(function(a){var b=a.mutationToDom(),e=b&&Blockly.Xml.domToText(b);a.domToMutation(c);var h=a.mutationToDom(),k=h&&Blockly.Xml.domToText(h);if(e!=k)if(Blockly.Events.fire(new Blockly.Events.BlockChange(a,"mutation",null,e,k)),a.id==d.id){var l=Blockly.Functions.getArgMap(b),m=Blockly.Functions.getArgMap(h,
|
|
1085
1085
|
!0);d.getDescendants().forEach(function(a){if(Blockly.pxtBlocklyUtils.isFunctionArgumentReporter(a)){var b=a.getFieldValue("VALUE"),c=l[b];m[c]?m[c]!==b&&a.setFieldValue(m[c],"VALUE"):a.dispose()}})}else setTimeout(function(){a.bumpNeighbours()},Blockly.BUMP_DELAY)}),Blockly.Events.setGroup(!1)):console.warn("Attempted to change function "+a+", but no definition block was found on the workspace")};
|
|
1086
1086
|
Blockly.Functions.createFlyout=function(a,b){var c=new Blockly.Options({scrollbars:!0,disabledPatternId:a.options.disabledPatternId,parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,toolboxPosition:a.options.toolboxPosition,zoomOptions:a.options.zoomOptions,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides,newFunctions:a.options.newFunctions,move:{scrollbars:!0}});c=c.horizontalLayout?new Blockly.HorizontalFlyout(c):new Blockly.VerticalFlyout(c);
|
|
1087
|
-
var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.
|
|
1087
|
+
var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.VERSION="4.0.12";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.parentContainer=null;Blockly.svgSize=function(a){Blockly.utils.deprecation.warn("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize");return new Blockly.utils.Size(a.cachedWidth_,a.cachedHeight_)};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
1088
1088
|
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=a.getCachedParentSvgSize(),d=b.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.width!=e&&(b.setAttribute("width",e+"px"),a.setCachedParentSvgSize(e,null));c.height!=d&&(b.setAttribute("height",d+"px"),a.setCachedParentSvgSize(null,d));a.resize()}};
|
|
1089
1089
|
Blockly.onKeyDown=function(a){var b=Blockly.mainWorkspace;if(b&&!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))Blockly.ShortcutRegistry.registry.onKeyDown(b,a)};Blockly.deleteBlock=function(a){a.workspace.isFlyout||(Blockly.Events.setGroup(!0),Blockly.hideChaff(),a.outputConnection?a.dispose(!1,!0):a.dispose(!0,!0),Blockly.Events.setGroup(!1))};Blockly.copy=function(a){if(a=a.toCopyData())Blockly.clipboardXml_=a.xml,Blockly.clipboardSource_=a.source,Blockly.clipboardTypeCounts_=a.typeCounts};
|
|
1090
1090
|
Blockly.paste=function(){if(!Blockly.clipboardXml_)return!1;var a=Blockly.clipboardSource_;a.isFlyout&&(a=a.targetWorkspace);return Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)?(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1),!0):!1};
|
|
@@ -2356,7 +2356,7 @@ Blockly.FieldNumber.prototype.updateDisplay_=function(a){this.htmlInput_.value=a
|
|
|
2356
2356
|
Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=a.replace(/infinity/i,"Infinity");a=Number(a||0);if(isNaN(a))return null;this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);null!=this.decimalPlaces_&&(a=Number(a.toFixed(this.decimalPlaces_)));return a};
|
|
2357
2357
|
Blockly.FieldNumber.prototype.widgetCreate_=function(a,b,c){a=Blockly.FieldNumber.superClass_.widgetCreate_.call(this,a,b,c);-Infinity<this.min_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMIN,this.min_);Infinity>this.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_);return a};Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber);Blockly.FieldNumberDropdown=function(a,b,c,d,e,f){this.setConstraints=Blockly.FieldNumber.prototype.setConstraints;this.setMinInternal_=Blockly.FieldNumber.prototype.setMinInternal_;this.setMaxInternal_=Blockly.FieldNumber.prototype.setMaxInternal_;this.setPrecisionInternal_=Blockly.FieldNumber.prototype.setPrecisionInternal_;c=Blockly.FieldNumber.prototype.getNumRestrictor.call(this,c,d,e);Blockly.FieldNumberDropdown.superClass_.constructor.call(this,a,b,f,c);this.addArgType("numberdropdown")};
|
|
2358
2358
|
Blockly.utils.object.inherits(Blockly.FieldNumberDropdown,Blockly.FieldTextDropdown);Blockly.FieldNumberDropdown.fromJson=function(a){return new Blockly.FieldNumberDropdown(a.value,a.options,a.min,a.max,a.precision)};Blockly.FieldNumberDropdown.prototype.classValidator=Blockly.FieldNumber.prototype.classValidator;Blockly.fieldRegistry.register("field_numberdropdown",Blockly.FieldNumberDropdown);Blockly.FieldVariable=function(a,b,c,d,e){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.size_=new Blockly.utils.Size(0,0);e&&this.configure_(e);b&&this.setValidator(b);e||this.setTypes_(c,d)};Blockly.utils.object.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,void 0,void 0,void 0,a)};
|
|
2359
|
-
Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};Blockly.FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}};
|
|
2359
|
+
Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};Blockly.FieldVariable.prototype.initModel=function(){if(!(this.variable_||this.sourceBlock_&&this.sourceBlock_.isInsertionMarker())){var a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}};
|
|
2360
2360
|
Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||!("variables_get"==this.sourceBlock_.type||"variables_get_reporter"==this.sourceBlock_.type))};
|
|
2361
2361
|
Blockly.FieldVariable.prototype.fromXml=function(a){a.getAttribute("id");var b=a.textContent,c=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,b,c);if(null!=c&&c!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())};
|
|
2362
2362
|
Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a)};
|
|
@@ -2643,7 +2643,7 @@ Blockly.zelos.ConstantProvider.prototype.makeRounded=function(){function a(a,b,f
|
|
|
2643
2643
|
connectionOffsetY:function(a){return a/2},connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}};
|
|
2644
2644
|
Blockly.zelos.ConstantProvider.prototype.makeSquared=function(){function a(a,d,e){a-=2*b;return Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?-1:1)*b,(d?-1:1)*b))+Blockly.utils.svgPaths.lineOnAxis("v",(e?1:-1)*a)+Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?1:-1)*b,(d?-1:1)*b))}var b=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:function(a){return b},height:function(a){return a},connectionOffsetY:function(a){return a/2},
|
|
2645
2645
|
connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}};
|
|
2646
|
-
Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case Blockly.connectionTypes.
|
|
2646
|
+
Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case Blockly.connectionTypes.OUTPUT_VALUE:if(a=a.getSourceBlock().getOutputShape(),null!=a)switch(a){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}case Blockly.connectionTypes.INPUT_VALUE:if(b&&-1!=b.indexOf("Boolean"))return this.HEXAGONAL;if(b&&-1!=b.indexOf("Number"))return this.ROUNDED;
|
|
2647
2647
|
b&&b.indexOf("String");return this.ROUNDED;case Blockly.connectionTypes.PREVIOUS_STATEMENT:case Blockly.connectionTypes.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type");}};
|
|
2648
2648
|
Blockly.zelos.ConstantProvider.prototype.makeNotch=function(){function a(a){return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,g/2),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,g/2),Blockly.utils.svgPaths.point(a*e/2,g),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.lineOnAxis("h",a*d)+Blockly.utils.svgPaths.curve("c",
|
|
2649
2649
|
[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,-(g/2)),Blockly.utils.svgPaths.point(a*e,-g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,-f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,-(g/2)),Blockly.utils.svgPaths.point(a*e/2,-g),Blockly.utils.svgPaths.point(a*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{type:this.SHAPES.NOTCH,width:b,height:c,pathLeft:h,pathRight:k}};
|
|
@@ -12212,6 +12212,12 @@ var pxtblockly;
|
|
|
12212
12212
|
// This creates the little arrow for dropdown fields. Intentionally
|
|
12213
12213
|
// do nothing
|
|
12214
12214
|
}
|
|
12215
|
+
showPromptEditor_() {
|
|
12216
|
+
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
|
|
12217
|
+
this.setValue(this.getValueFromEditorText_(newValue));
|
|
12218
|
+
this.forceRerender();
|
|
12219
|
+
});
|
|
12220
|
+
}
|
|
12215
12221
|
}
|
|
12216
12222
|
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
12217
12223
|
})(pxtblockly || (pxtblockly = {}));
|
|
@@ -15487,6 +15493,7 @@ var pxtblockly;
|
|
|
15487
15493
|
widgetDiv.style.height = "";
|
|
15488
15494
|
widgetDiv.style.opacity = "";
|
|
15489
15495
|
widgetDiv.style.transition = "";
|
|
15496
|
+
widgetDiv.style.alignItems = "";
|
|
15490
15497
|
Blockly.Events.enable();
|
|
15491
15498
|
Blockly.Events.setGroup(true);
|
|
15492
15499
|
this.fireNumberInputUpdate(this.options.durationInputName, initialSound.duration);
|
|
@@ -15528,7 +15535,8 @@ var pxtblockly;
|
|
|
15528
15535
|
widgetDiv.style.top = top + "px";
|
|
15529
15536
|
widgetDiv.style.width = "30rem";
|
|
15530
15537
|
widgetDiv.style.height = "40rem";
|
|
15531
|
-
widgetDiv.style.display = "
|
|
15538
|
+
widgetDiv.style.display = "flex";
|
|
15539
|
+
widgetDiv.style.alignItems = "center";
|
|
15532
15540
|
widgetDiv.style.transition = "transform 0.25s ease 0s, opacity 0.25s ease 0s";
|
|
15533
15541
|
widgetDiv.style.borderRadius = "";
|
|
15534
15542
|
fv.onHide(() => {
|
package/built/pxtblocks.d.ts
CHANGED
package/built/pxtblocks.js
CHANGED
|
@@ -8650,6 +8650,12 @@ var pxtblockly;
|
|
|
8650
8650
|
// This creates the little arrow for dropdown fields. Intentionally
|
|
8651
8651
|
// do nothing
|
|
8652
8652
|
}
|
|
8653
|
+
showPromptEditor_() {
|
|
8654
|
+
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
|
|
8655
|
+
this.setValue(this.getValueFromEditorText_(newValue));
|
|
8656
|
+
this.forceRerender();
|
|
8657
|
+
});
|
|
8658
|
+
}
|
|
8653
8659
|
}
|
|
8654
8660
|
pxtblockly.FieldAutoComplete = FieldAutoComplete;
|
|
8655
8661
|
})(pxtblockly || (pxtblockly = {}));
|
|
@@ -11925,6 +11931,7 @@ var pxtblockly;
|
|
|
11925
11931
|
widgetDiv.style.height = "";
|
|
11926
11932
|
widgetDiv.style.opacity = "";
|
|
11927
11933
|
widgetDiv.style.transition = "";
|
|
11934
|
+
widgetDiv.style.alignItems = "";
|
|
11928
11935
|
Blockly.Events.enable();
|
|
11929
11936
|
Blockly.Events.setGroup(true);
|
|
11930
11937
|
this.fireNumberInputUpdate(this.options.durationInputName, initialSound.duration);
|
|
@@ -11966,7 +11973,8 @@ var pxtblockly;
|
|
|
11966
11973
|
widgetDiv.style.top = top + "px";
|
|
11967
11974
|
widgetDiv.style.width = "30rem";
|
|
11968
11975
|
widgetDiv.style.height = "40rem";
|
|
11969
|
-
widgetDiv.style.display = "
|
|
11976
|
+
widgetDiv.style.display = "flex";
|
|
11977
|
+
widgetDiv.style.alignItems = "center";
|
|
11970
11978
|
widgetDiv.style.transition = "transform 0.25s ease 0s, opacity 0.25s ease 0s";
|
|
11971
11979
|
widgetDiv.style.borderRadius = "";
|
|
11972
11980
|
fv.onHide(() => {
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -689,6 +689,7 @@ declare namespace pxt.blocks {
|
|
|
689
689
|
function getBlockDefinition(blockId: string): BlockDefinition;
|
|
690
690
|
}
|
|
691
691
|
declare namespace pxt.BrowserUtils {
|
|
692
|
+
export function isDocumentVisible(): boolean;
|
|
692
693
|
export function isIFrame(): boolean;
|
|
693
694
|
export function hasNavigator(): boolean;
|
|
694
695
|
export function hasWindow(): boolean;
|
|
@@ -1305,6 +1306,7 @@ declare namespace pxt.github {
|
|
|
1305
1306
|
private?: boolean;
|
|
1306
1307
|
fork?: boolean;
|
|
1307
1308
|
}
|
|
1309
|
+
function isDefaultBranch(branch: string, repo?: GitRepo): boolean;
|
|
1308
1310
|
function listUserReposAsync(): Promise<GitRepo[]>;
|
|
1309
1311
|
function createRepoAsync(name: string, description: string, priv?: boolean): Promise<GitRepo>;
|
|
1310
1312
|
function enablePagesAsync(repo: string): Promise<void>;
|
package/built/pxtlib.js
CHANGED
|
@@ -4465,6 +4465,10 @@ var pxt;
|
|
|
4465
4465
|
(function (pxt) {
|
|
4466
4466
|
var BrowserUtils;
|
|
4467
4467
|
(function (BrowserUtils) {
|
|
4468
|
+
function isDocumentVisible() {
|
|
4469
|
+
return typeof window !== "undefined" && document.visibilityState === 'visible';
|
|
4470
|
+
}
|
|
4471
|
+
BrowserUtils.isDocumentVisible = isDocumentVisible;
|
|
4468
4472
|
function isIFrame() {
|
|
4469
4473
|
try {
|
|
4470
4474
|
return window && window.self !== window.top;
|
|
@@ -10304,6 +10308,12 @@ var pxt;
|
|
|
10304
10308
|
GitRepoStatus[GitRepoStatus["Approved"] = 1] = "Approved";
|
|
10305
10309
|
GitRepoStatus[GitRepoStatus["Banned"] = 2] = "Banned";
|
|
10306
10310
|
})(GitRepoStatus = github.GitRepoStatus || (github.GitRepoStatus = {}));
|
|
10311
|
+
function isDefaultBranch(branch, repo) {
|
|
10312
|
+
if (repo && repo.defaultBranch)
|
|
10313
|
+
return branch === repo.defaultBranch;
|
|
10314
|
+
return /^(main|master)$/.test(branch);
|
|
10315
|
+
}
|
|
10316
|
+
github.isDefaultBranch = isDefaultBranch;
|
|
10307
10317
|
function listUserReposAsync() {
|
|
10308
10318
|
const q = `{
|
|
10309
10319
|
viewer {
|
|
@@ -10321,12 +10331,12 @@ var pxt;
|
|
|
10321
10331
|
defaultBranchRef {
|
|
10322
10332
|
name
|
|
10323
10333
|
}
|
|
10324
|
-
pxtjson: object(expression: "
|
|
10334
|
+
pxtjson: object(expression: "HEAD:pxt.json") {
|
|
10325
10335
|
... on Blob {
|
|
10326
10336
|
text
|
|
10327
10337
|
}
|
|
10328
10338
|
}
|
|
10329
|
-
readme: object(expression: "
|
|
10339
|
+
readme: object(expression: "HEAD:README.md") {
|
|
10330
10340
|
... on Blob {
|
|
10331
10341
|
text
|
|
10332
10342
|
}
|