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

refactor!: Update and modernize the continuous toolbox plugin. #2468

Open
wants to merge 39 commits into
base: rc/v12.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ba018cc
refactor: Update ContinuousFlyout for compatibility with new flyout API.
gonfunko Nov 6, 2024
1948c29
chore: Rename ContinuousFlyout.js to ContinuousFlyout.ts.
gonfunko Nov 6, 2024
caebe49
chore: Rename ContinuousToolbox.js to ContinuousToolbox.ts.
gonfunko Nov 6, 2024
e1de241
chore: Rename ContinuousMetricsFlyout.js to ContinuousMetricsFlyout.ts.
gonfunko Nov 6, 2024
5164c0c
chore: Rename ContinuousCategory.js to ContinuousCategory.ts.
gonfunko Nov 7, 2024
9fcab31
chore: Rename ContinuousMetrics.js to ContinuousMetrics.ts.
gonfunko Nov 7, 2024
5b73379
chore: Rename index.js to index.ts.
gonfunko Nov 7, 2024
27f8d77
refactor: Convert ContinuousToolbox to Typescript
gonfunko Nov 7, 2024
b427748
chore: Name RecyclableBlockFlyoutInflater.ts consistently with other …
gonfunko Nov 7, 2024
7f711f1
refactor: Add and use a function for registering the continuous toolbox.
gonfunko Nov 7, 2024
ccfd99e
chore: Improve docs.
gonfunko Nov 7, 2024
c08fa48
feat: Add support for autoclosing continuous toolboxes.
gonfunko Nov 7, 2024
be89b8f
fix: Fix bug when making configuration changes in the playground.
gonfunko Nov 8, 2024
285d89f
refactor: Update visibility on RecyclableBlockFlyoutInflater.
gonfunko Nov 8, 2024
a0fcb69
fix: Use the recycleEligibilityChecker callback if set.
gonfunko Nov 8, 2024
94fa6ab
refactor: Make converting toolbox items to flyout items more extensible.
gonfunko Nov 8, 2024
7a024d7
chore: Remove debugging.
gonfunko Nov 8, 2024
226c119
fix: Debounce flyout refreshes.
gonfunko Nov 8, 2024
7a7930d
chore: Remove unused import.
gonfunko Nov 8, 2024
0e23119
chore: Fix TSDoc args.
gonfunko Nov 8, 2024
5b61d3d
chore: Add TSDoc for registration function.
gonfunko Nov 8, 2024
308bf0c
refactor: Clean up implementation of recordScrollPositions.
gonfunko Nov 8, 2024
0075301
chore: Fix TSDoc.
gonfunko Nov 8, 2024
6543e46
chore: Remove unneeded underscores in symbol names.
gonfunko Nov 8, 2024
3e29643
chore: Suppress unavoidable lint errors.
gonfunko Nov 8, 2024
6519373
fix: Fix alignment when jumping to a category.
gonfunko Nov 8, 2024
933d9fa
fix: Fix injection options and documentation.
gonfunko Nov 8, 2024
0c4148a
chore: Fix typo.
gonfunko Nov 8, 2024
6622117
refactor: Make the ContinuousFlyoutMetrics class and file name consis…
gonfunko Nov 8, 2024
7c0a08c
fix: Update flyout contents in response to procedure mutations.
gonfunko Nov 8, 2024
a538e7e
refactor: Make the RecyclableBlockFlyoutInflater inert for non-contin…
gonfunko Nov 8, 2024
c464bd1
fix: Fix alignment of toolbox labels.
gonfunko Dec 4, 2024
c97c825
chore: Update to use Blockly v12 beta.
gonfunko Dec 4, 2024
6e4fd66
chore: Update plugins for compatibility with Blockly v12.
gonfunko Dec 4, 2024
52172b6
fix: Fix tests for v12 compatibility.
gonfunko Dec 5, 2024
2b5c09c
fix: Fix bug that could cause scroll jank when interrupting an animat…
gonfunko Dec 5, 2024
c9b38b0
chore: Revert errant test change.
gonfunko Jan 9, 2025
769aaca
refactor: Update continuous-toolbox for latest flyout API changes.
gonfunko Jan 9, 2025
b5a6780
chore: Update Blockly dependency to 12.0.0-beta.1.
gonfunko Jan 10, 2025
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
360 changes: 140 additions & 220 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@eslint/js": "^8.49.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"blockly": "^11.0.0",
"blockly": "^12.0.0-beta.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.49.0",
"eslint-config-google": "^0.14.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ObservableParameterModel
implements Blockly.procedures.IParameterModel
{
private id: string;
private variable: Blockly.VariableModel;
private variable: Blockly.IVariableModel<Blockly.IVariableState>;
private shouldFireEvents = false;
private procedureModel: Blockly.procedures.IProcedureModel | null = null;

Expand Down Expand Up @@ -44,8 +44,8 @@ export class ObservableParameterModel
* @returns This parameter model.
*/
setName(name: string, id?: string): this {
if (name === this.variable.name) return this;
const oldName = this.variable.name;
if (name === this.variable.getName()) return this;
const oldName = this.variable.getName();
this.variable =
this.workspace.getVariable(name) ??
this.workspace.createVariable(name, '', id);
Expand Down Expand Up @@ -73,7 +73,7 @@ export class ObservableParameterModel
protected createBackingVariable(
name: string,
varId?: string,
): Blockly.VariableModel {
): Blockly.IVariableModel<Blockly.IVariableState> {
this.variable =
this.workspace.getVariable(name) ??
this.workspace.createVariable(name, '', varId);
Expand All @@ -100,7 +100,7 @@ export class ObservableParameterModel
* @returns the name of this parameter.
*/
getName(): string {
return this.variable.name;
return this.variable.getName();
}

/**
Expand All @@ -123,7 +123,7 @@ export class ObservableParameterModel
/**
* @returns the variable model associated with the parameter model.
*/
getVariableModel(): Blockly.VariableModel {
getVariableModel(): Blockly.IVariableModel<Blockly.IVariableState> {
return this.variable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ suite('Procedures', function () {
'if a procedure caller block was already disabled before ' +
'its definition was disabled, it is not reenabled',
function () {
this.workspace.options.disable = true;
const defBlock = createProcDefBlock(this.workspace);
const callBlock = createProcCallBlock(this.workspace);
globalThis.clock.runAll();
Expand Down
2 changes: 1 addition & 1 deletion plugins/content-highlight/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as Blockly from 'blockly/core';
/**
* List of events that cause a change in content area size.
*/
const contentChangeEvents = [
const contentChangeEvents: string[] = [
Blockly.Events.VIEWPORT_CHANGE,
Blockly.Events.BLOCK_MOVE,
Blockly.Events.BLOCK_DELETE,
Expand Down
22 changes: 11 additions & 11 deletions plugins/continuous-toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ npm install @blockly/continuous-toolbox --save

## Usage

Include the toolbox, flyout, and metrics manager classes from the plugin in the options struct used when injecting Blockly. This style of flyout works best with a toolbox definition that does not use collapsible categories.
Import and call the `registerContinuousToolbox()` function before injecting
Blockly. This style of flyout works best with a toolbox definition that does
not use collapsible categories.

Note that this plugin uses APIs introduced in the `3.20200924.3` release of Blockly, so you will need to use at least this version or higher.
Note that this plugin uses APIs introduced in the `v12` release of Blockly, so
you will need to use at least this version or higher.

```js
import * as Blockly from 'blockly';
import {
ContinuousToolbox,
ContinuousFlyout,
ContinuousMetrics,
} from '@blockly/continuous-toolbox';
import {registerContinuousToolbox} from '@blockly/continuous-toolbox';

// Inject Blockly.
registerContinuousToolbox();
const workspace = Blockly.inject('blocklyDiv', {
toolbox: toolboxCategories,
plugins: {
toolbox: ContinuousToolbox,
flyoutsVerticalToolbox: ContinuousFlyout,
metricsManager: ContinuousMetrics,
flyoutsVerticalToolbox: 'ContinuousFlyout',
metricsManager: 'ContinuousMetrics',
toolbox: 'ContinuousToolbox',
},
toolbox: toolboxCategories,
// ... your other options here ...
});
```
Expand Down
Loading
Loading