Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The great Blockly upgrade #9865

Merged
merged 110 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
a5bfc96
initial blockly work
riknoll Nov 15, 2023
567a306
use newblocks in webapp
riknoll Nov 16, 2023
25d7f7b
bug fixes and array block
riknoll Nov 21, 2023
1cce69f
if/else block
riknoll Nov 21, 2023
59f1966
text blocks
riknoll Nov 21, 2023
cf8c822
gridpicker
riknoll Nov 21, 2023
0c1776f
field color number
riknoll Nov 21, 2023
37fcb3d
field slider and math_number_minmax
riknoll Nov 22, 2023
da5699b
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Nov 27, 2023
50fd189
duplicate on drag
riknoll Nov 28, 2023
3b3e681
workspace context menu
riknoll Nov 28, 2023
df1efc1
block context menu
riknoll Nov 28, 2023
967d1f8
tooltip
riknoll Nov 28, 2023
39ae196
remove block dragger patch
riknoll Nov 29, 2023
8f152eb
Fix insertion marker compile exception
riknoll Nov 29, 2023
dec4dca
don't duplicate function definition argument reporters in domToBlock
riknoll Nov 29, 2023
9fd1311
debugging
riknoll Dec 1, 2023
cae63c9
Add new variable option to variable field dropdown
riknoll Dec 1, 2023
79fa6c8
Bring back the collapsed input rendering
riknoll Dec 1, 2023
852267d
Monkey patch block svg to add expand button
riknoll Dec 2, 2023
4f19c20
update some fields
riknoll Dec 4, 2023
c8fe8fa
get all the rest of the field compiling
riknoll Dec 4, 2023
291fefb
bug fixes for fields and toolbox generation
riknoll Dec 5, 2023
37803b5
fix asset fields
riknoll Dec 5, 2023
91ffc69
fix block font
riknoll Dec 5, 2023
d511434
fix expandable blocks
riknoll Dec 5, 2023
33e1def
toolbox flyout label styling
riknoll Dec 6, 2023
4f7c894
clean up the renderer mixin interface
riknoll Dec 6, 2023
646a835
fix prompt placeholders
riknoll Dec 6, 2023
c7805df
make flyout buttons bigger and other fixes
riknoll Dec 6, 2023
befad77
fix note editor
riknoll Dec 6, 2023
882ca6a
Fix project importing
riknoll Dec 11, 2023
075bc34
shadow block hack
riknoll Dec 12, 2023
95df408
give comments ids if missing
riknoll Dec 12, 2023
4ae4d43
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Jan 8, 2024
33610b9
Cache category flyouts
riknoll Jan 12, 2024
a89ab49
fix typo in autocomplete field
riknoll Jan 12, 2024
0c199b8
don't upgrade all shadows
riknoll Jan 12, 2024
88e225a
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Jan 12, 2024
bb9dc9b
promote shadow blocks to regular blocks when they get non shadow chil…
riknoll Jan 17, 2024
304cbd4
fix undo redo
riknoll Jan 17, 2024
c6cf352
delete dead code
riknoll Jan 23, 2024
7dd783a
fix flyout click events
riknoll Jan 23, 2024
2af458a
port over imagedropdown css
riknoll Jan 23, 2024
653bf3b
remove dead code
riknoll Jan 24, 2024
fbd1e51
fix toolbox generation for draggable parameters
riknoll Jan 24, 2024
2984952
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Jan 24, 2024
a553994
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Jan 24, 2024
1d0ebaa
remove old blocks from pxtrunner
riknoll Jan 25, 2024
140ba48
fix tutorial snippets
riknoll Jan 25, 2024
66020f6
fix variable prompt
riknoll Jan 25, 2024
2e1fed1
fix draggable decompile
riknoll Jan 26, 2024
50a7194
properly hide flyout when closed
riknoll Jan 26, 2024
0733da5
don't recycle variable blocks
riknoll Jan 26, 2024
e072dfd
don't close flyout after creating a variable
riknoll Jan 26, 2024
4462621
fix autocomplete field not resizing
riknoll Jan 26, 2024
f66b193
fix ts expression color and autocomplete quotes
riknoll Jan 29, 2024
7bcbdad
fix the speed and angle slider fields
riknoll Jan 29, 2024
35b28d5
fix flyout groups with the same name as the category
riknoll Jan 29, 2024
98d63f7
fix collapse field being added multiple times
riknoll Jan 29, 2024
48be945
fix slider initial value
riknoll Jan 29, 2024
1eb31b8
fix slider dragging in firefox
riknoll Jan 29, 2024
81a4d71
fix width on firefox
riknoll Jan 29, 2024
78425a9
fix position field
riknoll Jan 29, 2024
fddfe2d
fix error outline
riknoll Jan 29, 2024
0f12a9f
replace the emboss filter with a darkened outline
riknoll Jan 30, 2024
92b2702
fix decompiler tests
riknoll Jan 30, 2024
aecb618
fix karma runner
riknoll Jan 31, 2024
28f48a1
fix karma bugs
riknoll Jan 31, 2024
515991e
fix rest of karma tests
riknoll Jan 31, 2024
49281df
remove old blocks
riknoll Jan 31, 2024
2fee499
move newblock to pxtblocks
riknoll Jan 31, 2024
8b05159
eliminate last references to pxtblockly
riknoll Jan 31, 2024
360bde3
fix editor extensions
riknoll Feb 1, 2024
3f1b9f3
fix eslint and patch pxtrunner
riknoll Feb 1, 2024
dbe5b03
lint
riknoll Feb 1, 2024
7f76257
fix build
riknoll Feb 1, 2024
fc7602a
fix build
riknoll Feb 1, 2024
b601e21
hoist type
riknoll Feb 1, 2024
bec4430
forgot files
riknoll Feb 1, 2024
f5cedf6
fix uglifyify
riknoll Feb 2, 2024
d94be9f
fix test imports
riknoll Feb 2, 2024
0534fbe
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 5, 2024
947a352
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 7, 2024
e4a2838
fix validation
riknoll Feb 7, 2024
03a31d6
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 7, 2024
0ed3e74
fixing target build
riknoll Feb 7, 2024
3ba5aad
fix duplicate on drag behavior for new functions
riknoll Feb 7, 2024
c69469e
fix highlight when blocks change size
riknoll Feb 8, 2024
5b6a311
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 8, 2024
e0ca173
remove type reference
riknoll Feb 8, 2024
9bb2d08
fix flyout-only blockly tutorials
riknoll Feb 8, 2024
eb75ed4
fix melody editor and add fixme notes
riknoll Feb 9, 2024
288ba50
remove dead code and add fancy note slides
riknoll Feb 12, 2024
747d5f2
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 12, 2024
222d832
merge conflict
riknoll Feb 13, 2024
58d94e9
clarify fixmes
riknoll Feb 13, 2024
2313e31
fix toggle click target and dropdown for external inputs
riknoll Feb 13, 2024
818517a
bring back menu separators in dropdown
riknoll Feb 13, 2024
0d7468c
dotted outline for draggable params
riknoll Feb 15, 2024
0009614
get textdropdown color from parent
riknoll Feb 15, 2024
3f2c12e
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 15, 2024
bc4d6b1
fix import
riknoll Feb 15, 2024
2e42f96
fix tests
riknoll Feb 16, 2024
dc4938b
update blockly
riknoll Feb 16, 2024
97bc8c1
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 16, 2024
ebab408
fix edit function arguments
riknoll Feb 16, 2024
45a484e
pin new dependencies
riknoll Feb 21, 2024
ab5db99
Merge remote-tracking branch 'origin/master' into dev/riknoll/the-gre…
riknoll Feb 21, 2024
b287977
bump major version to 10
riknoll Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 26 additions & 68 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,14 @@ const pxtlib = () => compileTsProject("pxtlib");
const pxtcompiler = () => compileTsProject("pxtcompiler");
const pxtpy = () => compileTsProject("pxtpy");
const pxtsim = () => compileTsProject("pxtsim");
const pxtblocks = () => compileTsProject("pxtblocks");
const pxtrunner = () => compileTsProject("pxtrunner", "built", true);
const pxteditor = () => compileTsProject("pxteditor", "built", true);
const pxtweb = () => compileTsProject("docfiles/pxtweb", "built/web");
const backendutils = () => compileTsProject("backendutils")
const cli = () => compileTsProject("cli", "built", true);
const webapp = () => compileTsProject("webapp", "built", true);
const reactCommon = () => compileTsProject("react-common", "built/react-common", true);

const pxtblockly = () => gulp.src([
"webapp/public/blockly/blockly_compressed.js",
"webapp/public/blockly/blocks_compressed.js",
"webapp/public/blockly/plugins.js",
"webapp/public/blockly/msg/js/en.js",
"built/pxtblocks.js"
])
.pipe(concat("pxtblockly.js"))
.pipe(gulp.dest("built"));
const pxtblocks = () => compileTsProject("pxtblocks", "built/pxtblocks", true);

const pxtapp = () => gulp.src([
"node_modules/lzma/src/lzma_worker-min.js",
Expand Down Expand Up @@ -86,7 +76,6 @@ const pxtembed = () => gulp.src([
"built/pxtlib.js",
"built/pxtcompiler.js",
"built/pxtpy.js",
"built/pxtblockly.js",
"built/pxtsim.js",
"built/web/runnerembed.js"
])
Expand Down Expand Up @@ -121,8 +110,8 @@ function initWatch() {
const tasks = [
pxtlib,
gulp.parallel(pxtcompiler, pxtsim, backendutils),
gulp.parallel(pxtpy, gulp.series(copyBlockly, pxtblocks, pxtblockly)),
pxteditor,
pxtpy,
gulp.parallel(pxtblocks, pxteditor),
gulp.parallel(pxtrunner, cli, pxtcommon),
gulp.parallel(updatestrings, browserifyEmbed),
gulp.parallel(pxtjs, pxtdts, pxtapp, pxtworker, pxtembed),
Expand All @@ -142,7 +131,7 @@ function initWatch() {
gulp.watch("./backendutils/**/*", gulp.series(backendutils, ...tasks.slice(2)));

gulp.watch("./pxtpy/**/*", gulp.series(pxtpy, ...tasks.slice(3)));
gulp.watch("./pxtblocks/**/*", gulp.series(gulp.series(copyBlockly, pxtblocks, pxtblockly), ...tasks.slice(3)));
gulp.watch("./pxtblocks/**/*", gulp.series(pxtblocks, ...tasks.slice(4)));

gulp.watch("./pxteditor/**/*", gulp.series(pxteditor, ...tasks.slice(4)));

Expand All @@ -162,7 +151,7 @@ function initWatchCli() {
const tasks = [
pxtlib,
gulp.parallel(pxtcompiler),
gulp.parallel(pxtpy, gulp.series(pxtblocks, pxtblockly)),
pxtpy,
cli,
notifyBuildComplete
]
Expand All @@ -172,7 +161,6 @@ function initWatchCli() {
gulp.watch("./pxtcompiler/**/*", gulp.series(pxtcompiler, ...tasks.slice(2)));

gulp.watch("./pxtpy/**/*", gulp.series(pxtpy, ...tasks.slice(3)));
gulp.watch("./pxtblockly/**/*", gulp.series(gulp.series(copyBlockly, pxtblocks, pxtblockly), ...tasks.slice(3)));

gulp.watch("./cli/**/*", gulp.series(cli, ...tasks.slice(5)));
}
Expand Down Expand Up @@ -388,8 +376,6 @@ const copyWebapp = () =>
"built/pxtlib.js",
"built/pxtcompiler.js",
"built/pxtpy.js",
"built/pxtblocks.js",
"built/pxtblockly.js",
"built/pxtsim.js",
"built/webapp/src/worker.js",
"built/webapp/src/serviceworker.js",
Expand All @@ -401,17 +387,16 @@ const copyWebapp = () =>
const copySemanticFonts = () => gulp.src("node_modules/semantic-ui-less/themes/default/assets/fonts/*")
.pipe(gulp.dest("built/web/fonts"))

const browserifyWebapp = () => process.env.PXT_ENV == 'production' ?
exec('node node_modules/browserify/bin/cmd ./built/webapp/src/app.js -g [ envify --NODE_ENV production ] -g uglifyify -o ./built/web/main.js') :
exec('node node_modules/browserify/bin/cmd built/webapp/src/app.js -o built/web/main.js --debug')
const execBrowserify = (entryPoint, outfile) => process.env.PXT_ENV == 'production' ?
exec(`node node_modules/browserify/bin/cmd ${entryPoint} -g [ envify --NODE_ENV production ] -g [ uglifyify --ignore '**/node_modules/@blockly/**' ] -o ${outfile}`) :
exec(`node node_modules/browserify/bin/cmd ${entryPoint} -o ${outfile} --debug`);

const browserifyAssetEditor = () => process.env.PXT_ENV == 'production' ?
exec('node node_modules/browserify/bin/cmd ./built/webapp/src/assetEditor.js -g [ envify --NODE_ENV production ] -g uglifyify -o ./built/web/pxtasseteditor.js') :
exec('node node_modules/browserify/bin/cmd built/webapp/src/assetEditor.js -o built/web/pxtasseteditor.js --debug')
const browserifyWebapp = () => execBrowserify("./built/webapp/src/app.js", "./built/web/main.js");

const browserifyAssetEditor = () => execBrowserify("./built/webapp/src/assetEditor.js", "./built/web/pxtasseteditor.js");

const browserifyEmbed = () => execBrowserify("./built/pxtrunner/embed.js", "./built/web/runnerembed.js");

const browserifyEmbed = () => process.env.PXT_ENV == 'production' ?
exec('node node_modules/browserify/bin/cmd ./built/pxtrunner/embed.js -g [ envify --NODE_ENV production ] -g uglifyify -o ./built/web/runnerembed.js') :
exec('node node_modules/browserify/bin/cmd built/pxtrunner/embed.js -o built/web/runnerembed.js --debug')

const buildSVGIcons = () => {
let webfontsGenerator = require('@vusion/webfonts-generator')
Expand Down Expand Up @@ -534,37 +519,6 @@ const copyMonaco = gulp.series(
stripMonacoSourceMaps
);



/********************************************************
Blockly
*********************************************************/

const copyBlocklyCompressed = () => gulp.src([
"node_modules/pxt-blockly/blocks_compressed.js",
"node_modules/pxt-blockly/blockly_compressed.js"
])
.pipe(gulp.dest("webapp/public/blockly/"));

const copyBlocklyExtensions = () => gulp.src("node_modules/@blockly/**/dist/index.js")
.pipe(concat("plugins.js"))
.pipe(gulp.dest("webapp/public/blockly/"));

const copyBlocklyEnJs = () => gulp.src("node_modules/pxt-blockly/msg/js/en.js")
.pipe(gulp.dest("webapp/public/blockly/msg/js/"));

const copyBlocklyEnJson = () => gulp.src("node_modules/pxt-blockly/msg/json/en.json")
.pipe(gulp.dest("webapp/public/blockly/msg/json/"));

const copyBlocklyMedia = () => gulp.src("node_modules/pxt-blockly/media/*")
.pipe(gulp.dest("webapp/public/blockly/media"))

const copyBlocklyTypings = () => gulp.src("node_modules/pxt-blockly/typings/blockly.d.ts")
.pipe(gulp.dest("localtypings/"))

const copyBlockly = gulp.parallel(copyBlocklyCompressed, copyBlocklyExtensions, copyBlocklyEnJs, copyBlocklyEnJson, copyBlocklyMedia, copyBlocklyTypings);


/********************************************************
Skillmap
*********************************************************/
Expand Down Expand Up @@ -764,7 +718,10 @@ const testtutorials = testTask("tutorial-test", "tutorialrunner.js");
const testlanguageservice = testTask("language-service", "languageservicerunner.js");
const testpxteditor = pxtEditorTestTask();

const buildKarmaRunner = () => compileTsProject("tests/blocklycompiler-test", "built/tests/", true);
const buildKarmaRunner = () => compileTsProject("tests/blocklycompiler-test", "built/", true);
const browserifyKarma = () =>
exec('node node_modules/browserify/bin/cmd built/tests/blocklycompiler-test/test.spec.js -o built/tests/karma-test-runner.js --debug');

const runKarma = () => {
let command;
if (isWin32) {
Expand All @@ -777,9 +734,11 @@ const runKarma = () => {
}
return exec(command, true);
}
const karma = gulp.series(buildKarmaRunner, runKarma);
const karma = gulp.series(buildKarmaRunner, browserifyKarma, runKarma);

const buildBlocksTestRunner = () => compileTsProject("tests/blocks-test", "built/tests", true)
const buildBlocksTestRunner = () => compileTsProject("tests/blocks-test", "built/", true);
const browserifyBlocksTestRunner = () =>
exec('node node_modules/browserify/bin/cmd built/tests/blocks-test/blocksrunner.js -o built/tests/blocksrunner.js --debug');

const testAll = gulp.series(
testdecompiler,
Expand Down Expand Up @@ -849,11 +808,10 @@ const buildAll = gulp.series(
updatestrings,
maybeUpdateWebappStrings(),
copyTypescriptServices,
copyBlocklyTypings,
gulp.parallel(pxtlib, pxtweb),
gulp.parallel(pxtcompiler, pxtsim, backendutils),
gulp.parallel(pxtpy, gulp.series(copyBlockly, pxtblocks, pxtblockly)),
pxteditor,
pxtpy,
gulp.parallel(pxteditor, pxtblocks),
gulp.parallel(pxtrunner, cli, pxtcommon),
browserifyEmbed,
gulp.parallel(pxtjs, pxtdts, pxtapp, pxtworker, pxtembed),
Expand All @@ -866,6 +824,7 @@ const buildAll = gulp.series(
browserifyAssetEditor,
gulp.parallel(semanticjs, copyJquery, copyWebapp, copySemanticFonts, copyMonaco),
buildBlocksTestRunner,
browserifyBlocksTestRunner,
runUglify
);

Expand All @@ -876,15 +835,14 @@ exports.clean = clean;
exports.build = buildAll;

exports.webapp = gulp.series(
reactCommon,
gulp.parallel(reactCommon, pxtblocks, pxteditor),
webapp,
browserifyWebapp,
browserifyAssetEditor
)

exports.skillmapTest = testSkillmap;
exports.updatestrings = updatestrings;
exports.updateblockly = copyBlockly;
exports.lint = lint
exports.testdecompiler = testdecompiler;
exports.testlang = testlang;
Expand Down Expand Up @@ -915,7 +873,7 @@ exports.testpxteditor = testpxteditor;
exports.cli = gulp.series(
gulp.parallel(pxtlib, pxtweb),
gulp.parallel(pxtcompiler, pxtsim, backendutils),
gulp.parallel(pxtpy, gulp.series(copyBlockly, pxtblocks, pxtblockly)),
pxtpy,
pxteditor,
gulp.parallel(pxtrunner, cli, pxtcommon),
pxtjs
Expand Down
3 changes: 1 addition & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ module.exports = function(config) {
'built/web/typescript.js',
'webapp/public/blockly/**/*.js',
'built/pxtlib.js',
'built/pxtblocks.js',
'built/pxtcompiler.js',
'built/tests/tests.spec.js',
'built/tests/karma-test-runner.js',

// test assets
{ pattern: 'tests/blocklycompiler-test/cases/*.blocks', watched: false, included: false, served: true, nocache: false },
Expand Down
5 changes: 5 additions & 0 deletions localtypings/evaluation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace pxt.blocks {
export interface EvaluationResult {
result: boolean;
}
}
19 changes: 19 additions & 0 deletions localtypings/navigationController.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type WorkspaceSvg = import("blockly").WorkspaceSvg;

declare module '@blockly/keyboard-navigation' {
class NavigationController {
init(): void;
addWorkspace(workspace: WorkspaceSvg): void;
enable(workspace: WorkspaceSvg): void;
disable(workspace: WorkspaceSvg): void;
focusToolbox(workspace: WorkspaceSvg): void;
navigation: Navigation;
}

class Navigation {
resetFlyout(workspace: WorkspaceSvg, shouldHide: boolean): void;
setState(workspace: WorkspaceSvg, state: BlocklyNavigationState): void;
}

type BlocklyNavigationState = "workspace" | "toolbox" | "flyout";
}
8 changes: 4 additions & 4 deletions localtypings/pxtarget.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference path="pxtpackage.d.ts" />
/// <reference path="pxtparts.d.ts" />
/// <reference path="pxtblockly.d.ts" />
/// <reference path="pxtelectron.d.ts" />

declare namespace pxt {
Expand Down Expand Up @@ -356,7 +355,8 @@ declare namespace pxt {
invertedMonaco?: boolean; // if true: use the vs-dark monaco theme
invertedGitHub?: boolean; // inverted github view
lightToc?: boolean; // if true: do NOT use inverted style in docs toc
blocklyOptions?: Blockly.BlocklyOptions; // Blockly options, see Configuration: https://developers.google.com/blockly/guides/get-started/web
// FIXME (riknoll): Can't use Blockly types here
blocklyOptions?: any; // Blockly options, see Configuration: https://developers.google.com/blockly/guides/get-started/web
hideFlyoutHeadings?: boolean; // Hide the flyout headings at the top of the flyout when on a mobile device.
monacoColors?: pxt.Map<string>; // Monaco theme colors, see https://code.visualstudio.com/docs/getstarted/theme-color-reference
simAnimationEnter?: string; // Simulator enter animation
Expand Down Expand Up @@ -398,8 +398,8 @@ declare namespace pxt {
useUploadMessage?: boolean; // change "Download" text to "Upload"
downloadIcon?: string; // which icon io use for download
blockColors?: Map<string>; // block namespace colors, used for build in categories
blockIcons?: Map<string>;
blocklyColors?: Blockly.Colours; // Blockly workspace, flyout and other colors
blockIcons?: Map<string | number>;
blocklyColors?: pxt.Map<string>; // Overrides for the styles in the workspace Blockly.Theme.ComponentStyle
socialOptions?: SocialOptions; // show social icons in share dialog, options like twitter handle and org handle
noReloadOnUpdate?: boolean; // do not notify the user or reload the page when a new app cache is downloaded
appPathNames?: string[]; // Authorized URL paths in embedded apps, all other paths will display a warning banner
Expand Down
Loading