Skip to content

Commit

Permalink
release: v10.3.0
Browse files Browse the repository at this point in the history
Merge pull request #7702 from google/rc/v10.3.0
  • Loading branch information
BeksOmega authored Dec 7, 2023
2 parents 925a7b9 + 631dfcf commit 26ee8cf
Show file tree
Hide file tree
Showing 129 changed files with 6,886 additions and 4,941 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/assign_reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Assign requested reviewer
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
try {
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browser_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# TODO (#2114): re-enable osx build.
# os: [ubuntu-latest, macos-latest]
os: [macos-latest]
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
# See supported Node.js release schedule at
# https://nodejs.org/en/about/releases/

Expand All @@ -34,7 +34,7 @@ jobs:
ssh://[email protected]/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# TODO (#2114): re-enable osx build.
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
# See supported Node.js release schedule at
# https://nodejs.org/en/about/releases/

Expand All @@ -33,7 +33,7 @@ jobs:
ssh://[email protected]/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x

Expand All @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag_module_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# Add the type: cleanup label
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
with:
script: |
// Note that pull requests are considered issues and "shared"
Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/welcome_new_contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ jobs:
Welcome! It looks like this is your first pull request in Blockly,
so here are a couple of tips:
- You can find tips about contributing to Blockly and how to
validate your changes on our
[developer site](https://developers.google.com/blockly/guides/contribute/core#making_and_verifying_a_change).
- You can find tips about contributing to Blockly and how to
validate your changes on our
[developer site](https://developers.google.com/blockly/guides/contribute/core#making_and_verifying_a_change).
- All contributors must sign the Google Contributor License
Agreement (CLA). If the google-cla bot leaves a comment on this
PR, make sure you follow the instructions.
- All contributors must sign the Google Contributor License
Agreement (CLA). If the google-cla bot leaves a comment on this
PR, make sure you follow the instructions.
- We use [conventional commits](https://www.conventionalcommits.org/)
to make versioning the package easier. Make sure your commit
message is in the [proper format](https://developers.google.com/blockly/guides/contribute/get-started/commits)
or [learn how to fix it](https://developers.google.com/blockly/guides/contribute/get-started/commits#fixing_non-conventional_commits).
- If any of the other checks on this PR fail, you can click on
them to learn why. It might be that your change caused a test
failure, or that you need to double-check the
[style guide](https://developers.google.com/blockly/guides/contribute/core/style_guide).
- We use conventional commits to make versioning the package easier. Make sure your commit
message is in the [proper format](https://developers.google.com/blockly/guides/contribute/get-started/commits)
or [learn how to fix it](https://developers.google.com/blockly/guides/contribute/get-started/commits#fixing_non-conventional_commits).
- If any of the other checks on this PR fail, you can click on
them to learn why. It might be that your change caused a test
failure, or that you need to double-check the
[style guide](https://developers.google.com/blockly/guides/contribute/core/style_guide).
Thank you for opening this PR! A member of the Blockly team will review it soon.
5 changes: 2 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

# Demos, scripts, misc
/node_modules/*
/generators/*
/demos/*
/appengine/*
/externs/*
Expand All @@ -27,5 +26,5 @@
CHANGELOG.md
PULL_REQUEST_TEMPLATE.md

# Don't bother formatting js blocks since we're getting rid of them
/blocks/*.js
# Don't bother formatting JavaScript files we're about to migrate:
/generators/**/*.js
8 changes: 6 additions & 2 deletions blocks/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ export const blocks = createBlockDefinitionsFromJsonArray([
},
]);

/** Type of a 'lists_create_with' block. */
type CreateWithBlock = Block & ListCreateWithMixin;
/**
* Type of a 'lists_create_with' block.
*
* @internal
*/
export type CreateWithBlock = Block & ListCreateWithMixin;
interface ListCreateWithMixin extends ListCreateWithMixinType {
itemCount_: number;
}
Expand Down
8 changes: 6 additions & 2 deletions blocks/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,12 @@ export const loopTypes: Set<string> = new Set([
'controls_whileUntil',
]);

/** Type of a block that has CONTROL_FLOW_IN_LOOP_CHECK_MIXIN */
type ControlFlowInLoopBlock = Block & ControlFlowInLoopMixin;
/**
* Type of a block that has CONTROL_FLOW_IN_LOOP_CHECK_MIXIN
*
* @internal
*/
export type ControlFlowInLoopBlock = Block & ControlFlowInLoopMixin;
interface ControlFlowInLoopMixin extends ControlFlowInLoopMixinType {}
type ControlFlowInLoopMixinType = typeof CONTROL_FLOW_IN_LOOP_CHECK_MIXIN;

Expand Down
8 changes: 6 additions & 2 deletions blocks/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,12 @@ blocks['procedures_callreturn'] = {
defType_: 'procedures_defreturn',
};

/** Type of a procedures_ifreturn block. */
type IfReturnBlock = Block & IfReturnMixin;
/**
* Type of a procedures_ifreturn block.
*
* @internal
*/
export type IfReturnBlock = Block & IfReturnMixin;
interface IfReturnMixin extends IfReturnMixinType {
hasReturnValue_: boolean;
}
Expand Down
10 changes: 8 additions & 2 deletions blocks/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,12 @@ const QUOTES_EXTENSION = function (this: QuoteImageBlock) {
this.quoteField_('TEXT');
};

/** Type of a block that has TEXT_JOIN_MUTATOR_MIXIN */
type JoinMutatorBlock = BlockSvg & JoinMutatorMixin & QuoteImageMixin;
/**
* Type of a block that has TEXT_JOIN_MUTATOR_MIXIN
*
* @internal
*/
export type JoinMutatorBlock = BlockSvg & JoinMutatorMixin & QuoteImageMixin;
interface JoinMutatorMixin extends JoinMutatorMixinType {}
type JoinMutatorMixinType = typeof JOIN_MUTATOR_MIXIN;

Expand Down Expand Up @@ -1018,6 +1022,8 @@ Extensions.register('text_indexOf_tooltip', INDEXOF_TOOLTIP_EXTENSION);

Extensions.register('text_quotes', QUOTES_EXTENSION);

Extensions.registerMixin('quote_image_mixin', QUOTE_IMAGE_MIXIN);

Extensions.registerMutator(
'text_join_mutator',
JOIN_MUTATOR_MIXIN,
Expand Down
36 changes: 26 additions & 10 deletions core/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ export class Block implements IASTNodeLocation, IDeletable {

/**
* Set whether this block is a shadow block or not.
* This method is internal and should not be called by users of Blockly. To
* create shadow blocks programmatically call connection.setShadowState
*
* @param shadow True if a shadow.
* @internal
Expand Down Expand Up @@ -1641,6 +1643,18 @@ export class Block implements IASTNodeLocation, IDeletable {
);
}

// Validate that each arg has a corresponding message
let n = 0;
while (json['args' + n]) {
if (json['message' + n] === undefined) {
throw Error(
warningPrefix +
`args${n} must have a corresponding message (message${n}).`,
);
}
n++;
}

// Set basic properties of block.
// Makes styles backward compatible with old way of defining hat style.
if (json['style'] && json['style'].hat) {
Expand Down Expand Up @@ -2208,25 +2222,27 @@ export class Block implements IASTNodeLocation, IDeletable {
const comment = this.getIcon(CommentIcon.TYPE) as CommentIcon | null;
const oldText = comment?.getText() ?? null;
if (oldText === text) return;
eventUtils.fire(
new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
this,
'comment',
null,
oldText,
text,
),
);

if (text !== null) {
let comment = this.getIcon(CommentIcon.TYPE) as CommentIcon | undefined;
if (!comment) {
comment = this.addIcon(new CommentIcon(this));
}
eventUtils.disable();
comment.setText(text);
eventUtils.enable();
} else {
this.removeIcon(CommentIcon.TYPE);
}

eventUtils.fire(
new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
this,
'comment',
null,
oldText,
text,
),
);
}

/**
Expand Down
32 changes: 16 additions & 16 deletions core/block_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
import type {WorkspaceSvg} from './workspace_svg.js';
import {hasBubble} from './interfaces/i_has_bubble.js';
import * as deprecation from './utils/deprecation.js';
import * as layers from './layers.js';

/**
* Class for a block dragger. It moves blocks around the workspace when they
Expand All @@ -48,7 +50,12 @@ export class BlockDragger implements IBlockDragger {
/** Whether the block would be deleted if dropped immediately. */
protected wouldDeleteBlock_ = false;
protected startXY_: Coordinate;
protected dragIconData_: IconPositionData[];

/**
* @deprecated To be removed in v11. Updating icons is now handled by the
* block's `moveDuringDrag` method.
*/
protected dragIconData_: IconPositionData[] = [];

/**
* @param block The block to drag.
Expand All @@ -70,11 +77,6 @@ export class BlockDragger implements IBlockDragger {
*/
this.startXY_ = this.draggingBlock_.getRelativeToSurfaceXY();

/**
* A list of all of the icons (comment, warning, and mutator) that are
* on this block and its descendants. Moving an icon moves the bubble that
* extends from it if that bubble is open.
*/
this.dragIconData_ = initIconData(block, this.startXY_);
}

Expand All @@ -85,7 +87,6 @@ export class BlockDragger implements IBlockDragger {
*/
dispose() {
this.dragIconData_.length = 0;

if (this.draggedConnectionManager_) {
this.draggedConnectionManager_.dispose();
}
Expand Down Expand Up @@ -119,6 +120,7 @@ export class BlockDragger implements IBlockDragger {
this.disconnectBlock_(healStack, currentDragDeltaXY);
}
this.draggingBlock_.setDragging(true);
this.workspace_.getLayerManager()?.moveToDragLayer(this.draggingBlock_);
}

/**
Expand Down Expand Up @@ -178,7 +180,6 @@ export class BlockDragger implements IBlockDragger {
const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);
const newLoc = Coordinate.sum(this.startXY_, delta);
this.draggingBlock_.moveDuringDrag(newLoc);
this.dragIcons_(delta);

const oldDragTarget = this.dragTarget_;
this.dragTarget_ = this.workspace_.getDragTarget(e);
Expand Down Expand Up @@ -210,7 +211,6 @@ export class BlockDragger implements IBlockDragger {
endDrag(e: PointerEvent, currentDragDeltaXY: Coordinate) {
// Make sure internal state is fresh.
this.drag(e, currentDragDeltaXY);
this.dragIconData_ = [];
this.fireDragEndEvent_();

dom.stopTextWidthCache();
Expand All @@ -233,6 +233,9 @@ export class BlockDragger implements IBlockDragger {
const deleted = this.maybeDeleteBlock_();
if (!deleted) {
// These are expensive and don't need to be done if we're deleting.
this.workspace_
.getLayerManager()
?.moveOffDragLayer(this.draggingBlock_, layers.BLOCK);
this.draggingBlock_.setDragging(false);
if (delta) {
// !preventMove
Expand Down Expand Up @@ -398,14 +401,11 @@ export class BlockDragger implements IBlockDragger {
/**
* Move all of the icons connected to this drag.
*
* @param dxy How far to move the icons from their original positions, in
* workspace units.
* @deprecated To be removed in v11. This is now handled by the block's
* `moveDuringDrag` method.
*/
protected dragIcons_(dxy: Coordinate) {
// Moving icons moves their associated bubbles.
for (const data of this.dragIconData_) {
data.icon.onLocationChange(Coordinate.sum(data.location, dxy));
}
protected dragIcons_() {
deprecation.warn('Blockly.BlockDragger.prototype.dragIcons_', 'v10', 'v11');
}

/**
Expand Down
Loading

0 comments on commit 26ee8cf

Please sign in to comment.