mirror of
https://github.com/google/blockly.git
synced 2026-02-09 17:10:14 +01:00
Merge branch 'main' into undo-redo
This commit is contained in:
1
.github/workflows/appengine_deploy.yml
vendored
1
.github/workflows/appengine_deploy.yml
vendored
@@ -20,6 +20,7 @@ jobs:
|
||||
- name: Prepare demo files
|
||||
# Install all dependencies, then copy all the files needed for demos.
|
||||
run: |
|
||||
cd packages/blockly
|
||||
npm install
|
||||
npm run prepareDemos
|
||||
|
||||
|
||||
4
.github/workflows/browser_test.yml
vendored
4
.github/workflows/browser_test.yml
vendored
@@ -25,6 +25,10 @@ jobs:
|
||||
# See supported Node.js release schedule at
|
||||
# https://nodejs.org/en/about/releases/
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./packages/blockly
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
|
||||
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -43,6 +43,7 @@ jobs:
|
||||
- name: Linux Test Setup
|
||||
if: runner.os == 'Linux'
|
||||
run: source ./tests/scripts/setup_linux_env.sh
|
||||
working-directory: ./packages/blockly
|
||||
|
||||
- name: Run
|
||||
run: npm run test
|
||||
|
||||
4
.github/workflows/keyboard_plugin_test.yml
vendored
4
.github/workflows/keyboard_plugin_test.yml
vendored
@@ -52,11 +52,11 @@ jobs:
|
||||
|
||||
- name: Link latest core main with plugin
|
||||
run: |
|
||||
cd core-blockly
|
||||
cd core-blockly/packages/blockly
|
||||
npm run package
|
||||
cd dist
|
||||
npm link
|
||||
cd ../../blockly-keyboard-experimentation
|
||||
cd ../../../../blockly-keyboard-experimentation
|
||||
npm link blockly
|
||||
cd ..
|
||||
|
||||
|
||||
37
.github/workflows/tag_module_cleanup.yml
vendored
37
.github/workflows/tag_module_cleanup.yml
vendored
@@ -1,37 +0,0 @@
|
||||
# For new pull requests against the goog_module branch, adds the 'type: cleanup'
|
||||
# label and sets the milestone to q3 2021 release.
|
||||
|
||||
name: Tag module cleanup
|
||||
|
||||
# Trigger on pull requests against goog_module branch only
|
||||
# Uses pull_request_target to get write permissions so that it can write labels.
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- goog_module
|
||||
|
||||
jobs:
|
||||
tag-module-cleanup:
|
||||
# Add the type: cleanup label
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
// Note that pull requests are considered issues and "shared"
|
||||
// actions for both features, like manipulating labels and
|
||||
// milestones are provided within the issues API.
|
||||
await github.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
// 2021 q3 release milestone.
|
||||
// https://github.com/google/blockly/milestone/18
|
||||
milestone: 18
|
||||
})
|
||||
await github.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ['type: cleanup']
|
||||
})
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -9,14 +9,3 @@ build-debug.log
|
||||
*.komodoproject
|
||||
/nbproject/private/
|
||||
tsdoc-metadata.json
|
||||
|
||||
tests/compile/main_compressed.js
|
||||
tests/compile/main_compressed.js.map
|
||||
tests/compile/*compiler*.jar
|
||||
tests/screenshot/outputs/*
|
||||
local_build/*compiler*.jar
|
||||
local_build/local_*_compressed.js
|
||||
chromedriver
|
||||
build/
|
||||
dist/
|
||||
temp/
|
||||
|
||||
5274
package-lock.json
generated
5274
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
166
package.json
166
package.json
@@ -1,158 +1,28 @@
|
||||
{
|
||||
"name": "blockly",
|
||||
"version": "12.3.1",
|
||||
"description": "Blockly is a library for building visual programming editors.",
|
||||
"name": "blockly-repo",
|
||||
"version": "0.0.0",
|
||||
"description": "Monorepo for blockly and related packages",
|
||||
"keywords": [
|
||||
"blockly"
|
||||
],
|
||||
"homepage": "https://blockly.com",
|
||||
"bugs": {
|
||||
"url": "https://github.com/RaspberryPiFoundation/blockly/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/google/blockly.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/google/blockly/issues"
|
||||
},
|
||||
"homepage": "https://developers.google.com/blockly/",
|
||||
"author": {
|
||||
"name": "Neil Fraser"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"build-debug": "gulp build --verbose --debug",
|
||||
"build-debug-log": "npm run build:debug > build-debug.log 2>&1 && tail -3 build-debug.log",
|
||||
"build-strict": "gulp build --verbose --strict",
|
||||
"build-strict-log": "npm run build:strict > build-debug.log 2>&1 && tail -3 build-debug.log",
|
||||
"clean": "gulp clean",
|
||||
"deployDemos": "npm ci && gulp deployDemos",
|
||||
"deployDemos:beta": "npm ci && gulp deployDemosBeta",
|
||||
"docs": "gulp docs",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"messages": "gulp messages",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"langfiles": "gulp langfiles",
|
||||
"minify": "gulp minify",
|
||||
"package": "gulp pack",
|
||||
"postinstall": "patch-package",
|
||||
"prepareDemos": "gulp prepareDemos",
|
||||
"publish": "npm ci && gulp publish",
|
||||
"publish:beta": "npm ci && gulp publishBeta",
|
||||
"recompile": "gulp recompile",
|
||||
"release": "gulp gitCreateRC",
|
||||
"start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"http-server ./ -s -o /tests/playground.html -c-1\"",
|
||||
"tsc": "gulp tsc",
|
||||
"test": "gulp test",
|
||||
"test:browser": "cd tests/browser && npx mocha",
|
||||
"test:generators": "gulp testGenerators",
|
||||
"test:mocha:interactive": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"gulp interactiveMocha\"",
|
||||
"test:compile:advanced": "gulp buildAdvancedCompilationTest --debug",
|
||||
"updateGithubPages": "npm ci && gulp gitUpdateGithubPages"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.mjs",
|
||||
"umd": "./blockly.min.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./core": {
|
||||
"types": "./core.d.ts",
|
||||
"node": "./core-node.js",
|
||||
"import": "./blockly.mjs",
|
||||
"default": "./blockly_compressed.js"
|
||||
},
|
||||
"./blocks": {
|
||||
"types": "./blocks.d.ts",
|
||||
"import": "./blocks.mjs",
|
||||
"default": "./blocks_compressed.js"
|
||||
},
|
||||
"./dart": {
|
||||
"types": "./dart.d.ts",
|
||||
"import": "./dart.mjs",
|
||||
"default": "./dart_compressed.js"
|
||||
},
|
||||
"./lua": {
|
||||
"types": "./lua.d.ts",
|
||||
"import": "./lua.mjs",
|
||||
"default": "./lua_compressed.js"
|
||||
},
|
||||
"./javascript": {
|
||||
"types": "./javascript.d.ts",
|
||||
"import": "./javascript.mjs",
|
||||
"default": "./javascript_compressed.js"
|
||||
},
|
||||
"./php": {
|
||||
"types": "./php.d.ts",
|
||||
"import": "./php.mjs",
|
||||
"default": "./php_compressed.js"
|
||||
},
|
||||
"./python": {
|
||||
"types": "./python.d.ts",
|
||||
"import": "./python.mjs",
|
||||
"default": "./python_compressed.js"
|
||||
},
|
||||
"./msg/*": {
|
||||
"types": "./msg/*.d.ts",
|
||||
"import": "./msg/*.mjs",
|
||||
"default": "./msg/*.js"
|
||||
}
|
||||
"url": "git+https://github.com/RaspberryPiFoundation/blockly.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@blockly/block-test": "^7.0.2",
|
||||
"@blockly/dev-tools": "^9.0.2",
|
||||
"@blockly/keyboard-navigation": "^3.0.1",
|
||||
"@blockly/theme-modern": "^7.0.1",
|
||||
"@commitlint/cli": "^20.1.0",
|
||||
"@commitlint/config-conventional": "^20.0.0",
|
||||
"@hyperjump/browser": "^1.1.4",
|
||||
"@hyperjump/json-schema": "^1.5.0",
|
||||
"@microsoft/api-documenter": "7.22.4",
|
||||
"@microsoft/api-extractor": "^7.29.5",
|
||||
"ajv": "^8.17.1",
|
||||
"async-done": "^2.0.0",
|
||||
"chai": "^6.0.1",
|
||||
"concurrently": "^9.0.1",
|
||||
"eslint": "^9.15.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-plugin-jsdoc": "^52.0.2",
|
||||
"eslint-plugin-mocha": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"glob": "^11.0.1",
|
||||
"globals": "^16.0.0",
|
||||
"google-closure-compiler": "^20251015.0.0",
|
||||
"gulp": "^5.0.0",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-gzip": "^1.4.2",
|
||||
"gulp-header": "^2.0.9",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-series": "^1.0.2",
|
||||
"gulp-shell": "^0.8.0",
|
||||
"gulp-sourcemaps": "^3.0.0",
|
||||
"gulp-umd": "^2.0.0",
|
||||
"http-server": "^14.0.0",
|
||||
"json5": "^2.2.0",
|
||||
"markdown-tables-to-json": "^0.1.7",
|
||||
"mocha": "^11.3.0",
|
||||
"patch-package": "^8.0.0",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier-plugin-organize-imports": "^4.0.0",
|
||||
"puppeteer-core": "^24.17.0",
|
||||
"readline-sync": "^1.4.10",
|
||||
"rimraf": "^5.0.0",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"webdriverio": "^9.0.7",
|
||||
"yargs": "^17.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsdom": "26.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"author": "Raspberry Pi Foundation",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run test --ws --if-present",
|
||||
"lint": "npm run lint --ws --if-present",
|
||||
"build": "npm run build --ws --if-present",
|
||||
"format:check": "npm run format:check --ws --if-present"
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/blockly/.gitignore
vendored
Normal file
10
packages/blockly/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
tests/compile/main_compressed.js
|
||||
tests/compile/main_compressed.js.map
|
||||
tests/compile/*compiler*.jar
|
||||
tests/screenshot/outputs/*
|
||||
local_build/*compiler*.jar
|
||||
local_build/local_*_compressed.js
|
||||
chromedriver
|
||||
build/
|
||||
dist/
|
||||
temp/
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
@@ -308,7 +308,9 @@ const PROCEDURE_DEF_COMMON = {
|
||||
while (paramBlock && !paramBlock.isInsertionMarker()) {
|
||||
const varName = paramBlock.getFieldValue('NAME');
|
||||
this.arguments_.push(varName);
|
||||
const variable = this.workspace.getVariable(varName, '')!;
|
||||
const variable = this.workspace
|
||||
.getVariableMap()
|
||||
.getVariable(varName, '')!;
|
||||
this.argumentVarModels_.push(variable);
|
||||
|
||||
this.paramIds_.push(paramBlock.id);
|
||||
@@ -374,13 +376,13 @@ const PROCEDURE_DEF_COMMON = {
|
||||
oldId: string,
|
||||
newId: string,
|
||||
) {
|
||||
const oldVariable = this.workspace.getVariableById(oldId)!;
|
||||
const oldVariable = this.workspace.getVariableMap().getVariableById(oldId)!;
|
||||
if (oldVariable.getType() !== '') {
|
||||
// Procedure arguments always have the empty type.
|
||||
return;
|
||||
}
|
||||
const oldName = oldVariable.getName();
|
||||
const newVar = this.workspace.getVariableById(newId)!;
|
||||
const newVar = this.workspace.getVariableMap().getVariableById(newId)!;
|
||||
|
||||
let change = false;
|
||||
for (let i = 0; i < this.argumentVarModels_.length; i++) {
|
||||
@@ -1161,9 +1161,9 @@ export class Block {
|
||||
const vars = [];
|
||||
for (const field of this.getFields()) {
|
||||
if (field.referencesVariables()) {
|
||||
const model = this.workspace.getVariableById(
|
||||
field.getValue() as string,
|
||||
);
|
||||
const model = this.workspace
|
||||
.getVariableMap()
|
||||
.getVariableById(field.getValue() as string);
|
||||
// Check if the variable actually exists (and isn't just a potential
|
||||
// variable).
|
||||
if (model) {
|
||||
@@ -46,6 +46,9 @@ const PAGE_MODE_MULTIPLIER = 125;
|
||||
* @param opt_noCaptureIdentifier True if triggering on this event should not
|
||||
* block execution of other event handlers on this touch or other
|
||||
* simultaneous touches. False by default.
|
||||
* @param options An object with options controlling the behavior of the event
|
||||
* listener. Passed through directly as the third argument to
|
||||
* `addEventListener`.
|
||||
* @returns Opaque data that can be passed to unbindEvent_.
|
||||
*/
|
||||
export function conditionalBind(
|
||||
@@ -54,6 +57,7 @@ export function conditionalBind(
|
||||
thisObject: object | null,
|
||||
func: Function,
|
||||
opt_noCaptureIdentifier?: boolean,
|
||||
options?: AddEventListenerOptions,
|
||||
): Data {
|
||||
/**
|
||||
*
|
||||
@@ -75,11 +79,11 @@ export function conditionalBind(
|
||||
if (name in Touch.TOUCH_MAP) {
|
||||
for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {
|
||||
const type = Touch.TOUCH_MAP[name][i];
|
||||
node.addEventListener(type, wrapFunc, false);
|
||||
node.addEventListener(type, wrapFunc, {capture: false, ...options});
|
||||
bindData.push([node, type, wrapFunc]);
|
||||
}
|
||||
} else {
|
||||
node.addEventListener(name, wrapFunc, false);
|
||||
node.addEventListener(name, wrapFunc, {capture: false, ...options});
|
||||
bindData.push([node, name, wrapFunc]);
|
||||
}
|
||||
return bindData;
|
||||
@@ -95,6 +99,9 @@ export function conditionalBind(
|
||||
* @param name Event name to listen to (e.g. 'mousedown').
|
||||
* @param thisObject The value of 'this' in the function.
|
||||
* @param func Function to call when event is triggered.
|
||||
* @param options An object with options controlling the behavior of the event
|
||||
* listener. Passed through directly as the third argument to
|
||||
* `addEventListener`.
|
||||
* @returns Opaque data that can be passed to unbindEvent_.
|
||||
*/
|
||||
export function bind(
|
||||
@@ -102,6 +109,7 @@ export function bind(
|
||||
name: string,
|
||||
thisObject: object | null,
|
||||
func: Function,
|
||||
options?: AddEventListenerOptions,
|
||||
): Data {
|
||||
/**
|
||||
*
|
||||
@@ -119,11 +127,11 @@ export function bind(
|
||||
if (name in Touch.TOUCH_MAP) {
|
||||
for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {
|
||||
const type = Touch.TOUCH_MAP[name][i];
|
||||
node.addEventListener(type, wrapFunc, false);
|
||||
node.addEventListener(type, wrapFunc, {capture: false, ...options});
|
||||
bindData.push([node, type, wrapFunc]);
|
||||
}
|
||||
} else {
|
||||
node.addEventListener(name, wrapFunc, false);
|
||||
node.addEventListener(name, wrapFunc, {capture: false, ...options});
|
||||
bindData.push([node, name, wrapFunc]);
|
||||
}
|
||||
return bindData;
|
||||
@@ -95,9 +95,16 @@ export class CommentEditor implements IFocusableNode {
|
||||
);
|
||||
|
||||
// Don't zoom with mousewheel; let it scroll instead.
|
||||
browserEvents.conditionalBind(this.textArea, 'wheel', this, (e: Event) => {
|
||||
e.stopPropagation();
|
||||
});
|
||||
browserEvents.conditionalBind(
|
||||
this.textArea,
|
||||
'wheel',
|
||||
this,
|
||||
(e: Event) => {
|
||||
e.stopPropagation();
|
||||
},
|
||||
false,
|
||||
{passive: true},
|
||||
);
|
||||
|
||||
// Register listener for keydown events that would finish editing.
|
||||
browserEvents.conditionalBind(
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user