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

fix: shareable procedures v11 #2180

Merged
merged 8 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
195 changes: 99 additions & 96 deletions plugins/block-shareable-procedures/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plugins/block-shareable-procedures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
"devDependencies": {
"@blockly/dev-scripts": "^3.1.1",
"@blockly/dev-tools": "^7.1.5",
"blockly": "^10.2.0",
"blockly": "^11.0.0-beta.3",
"chai": "^4.3.7",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
"sinon": "^15.0.1",
"typescript": "^5.2.2"
},
"peerDependencies": {
"blockly": "^10.2.0"
"blockly": "^11.0.0-beta.3"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion plugins/block-shareable-procedures/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ const procedureCallerUpdateShapeMixin = {
for (const [i, p] of params.entries()) {
this.appendValueInput(`ARG${i}`)
.appendField(new Blockly.FieldLabel(p), `ARGNAME${i}`)
.setAlign(Blockly.Input.Align.RIGHT);
.setAlign(Blockly.inputs.Align.RIGHT);
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,28 @@
this.procedureModel = model;
return this;
}

/** Serializes the state of this parameter to JSON.

Check warning on line 159 in plugins/block-shareable-procedures/src/observable_parameter_model.ts

View workflow job for this annotation

GitHub Actions / lint

Should have no text on the "0th" line (after the `/**`)
*
* @returns JSON serializable state of the parameter.
*/
saveState(): Blockly.serialization.procedures.ParameterState {
const state: Blockly.serialization.procedures.ParameterState = {
id: this.getId(),
name: this.getName(),
};
if (!this.getTypes().length) return state;
state.types = this.getTypes();
return state;
}

/** Returns a new parameter model with the given state. */

Check warning on line 173 in plugins/block-shareable-procedures/src/observable_parameter_model.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @param "state" declaration

Check warning on line 173 in plugins/block-shareable-procedures/src/observable_parameter_model.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @param "workspace" declaration
static loadState(
state: Blockly.serialization.procedures.ParameterState,
workspace: Blockly.Workspace,
): ObservableParameterModel {
const model = new ObservableParameterModel(workspace, state.name, state.id);
if (state.types) model.setTypes(state.types);
return model;
}
}
Loading
Loading