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

feat!: add block definitions to colour field plugin #2162

Merged
merged 24 commits into from
Feb 12, 2024

Conversation

rachel-fenichel
Copy link
Collaborator

@rachel-fenichel rachel-fenichel commented Jan 24, 2024

The basics

The details

Resolves

Fixes #2152

Proposed Changes

  • Adds block definitions and generators for four blocks associated with the colour field:
    • colour_blend
    • colour_rgb
    • colour_picker
    • colour_random
  • Demonstrates a pattern for defining and exporting a library of blocks.

BREAKING CHANGE: The colour field no longer registers itself on load. The developer must either manually register the field or install blocks, which will install the field. This is part of a move to have no side effects in field and block definitions, so that tree-shaking can remove unwanted fields and blocks.

Reason for Changes

This is the next step in extracting block definitions from the core library and publishing them as smaller libraries. Developers can then choose which blocks and fields to install, and can tree-shake out unneeded ones.

Test Coverage

  • Updated mocha tests to call registerColourField to unregister previous field (from core).
  • Updated test playground to delete/unregister blocks, generators, and the field from core, then install/register the new blocks, generators, and field.
  • Stripped use of old generateFieldTestBlocks helper in favor of manually defining test blocks and the test toolbox.
    • I found the result easier to read and modify as I tried to test things, and it won't change frequently.

The test toolbox looks like this:
image

The first part of the toolbox tests the exported blocks. The later sections test the implementation of the colour field.

Documentation

This PR includes documentation updates in the README.

Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look at the first one, and it mostly looks good but I do have some… opinions.

plugins/field-angle/src/field_angle.ts Outdated Show resolved Hide resolved
plugins/field-angle/src/field_angle.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/generatorUtils.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/generatorUtils.ts Outdated Show resolved Hide resolved
Comment on lines 268 to 270
// TODO: Should the reserved words be passed in at the same time as the generator
// for the installGenerators function?
generators.dart?.addReservedWords('Math');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be tempted to put the reserved words in a property on the generator function and let installGenerators retrieve them from there, but I know that some of my colleagues have this funny idea that functions shouldn't be treated like normal objects…

I observe that doing that would make this install function less useful as a guide to how to install the required individual pieces—though in fact the installGenerators function already does that to large extent.

I think I might favour doing it inline:

  if(generators.dart) generators.dart.forBlock[blockName] = jsGenerator;
  if(generators.lua) generators.lua.forBlock[blockName] = luaGenerator;
  //..

(With judicious choice of variable names it may be possible to keep each of these on a single line.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do it inline for colour_picker, it looks like this:


export function installBlock(generators: Generators = {}) {
    registerColourField();
    Blockly.common.defineBlocks([blockDef]);
    if (generators.javascript) generators.javascript.forBlock[BLOCK_NAME] = jsGenerator;
    if (generators.dart) generators.dart.forBlock[BLOCK_NAME] = dartGenerator;
    if (generators.lua) generators.lua.forBlock[BLOCK_NAME] = luaGenerator;
    if (generators.php) generators.php.forBlock[BLOCK_NAME] = phpGenerator;
    if (generators.python) generators.python.forBlock[BLOCK_NAME] = pythonGenerator;
}

And if I extend that to a case where I do have reserved words, like colour_blend, I get this:

export function installBlock(generators: Generators = {}) {
    registerColourField();
    Blockly.common.defineBlocks([blockDef]);
    if (generators.javascript) generators.javascript.forBlock[BLOCK_NAME] = jsGenerator;
    if (generators.dart) {
        generators.dart.forBlock[BLOCK_NAME] = dartGenerator;
        generators.dart.addReservedWords('Math');
    }
    if (generators.lua) generators.lua.forBlock[BLOCK_NAME] = luaGenerator;
    if (generators.php) generators.php.forBlock[BLOCK_NAME] = phpGenerator;
    if (generators.python) generators.python.forBlock[BLOCK_NAME] = pythonGenerator;
}

It's verbose, but has several advantages:

  • Keeps reserved words and block generator installation together.
  • The installBlock function actually shows everything it's doing
    • As you observed, installGenerators was obfuscating.

The disadvantages are:

  • Lots of text to copy.
  • Lots of duplicated code.

I think this is worth doing, even if it adds duplicated code. The types did help me avoid installing a dart block generator into python, and that makes me happy. I think it's worth the change. @maribethb do you have any thoughts or objections?

plugins/field-angle/src/field_angle.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/generatorUtils.ts Outdated Show resolved Hide resolved
Comment on lines 268 to 270
// TODO: Should the reserved words be passed in at the same time as the generator
// for the installGenerators function?
generators.dart?.addReservedWords('Math');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do it inline for colour_picker, it looks like this:


export function installBlock(generators: Generators = {}) {
    registerColourField();
    Blockly.common.defineBlocks([blockDef]);
    if (generators.javascript) generators.javascript.forBlock[BLOCK_NAME] = jsGenerator;
    if (generators.dart) generators.dart.forBlock[BLOCK_NAME] = dartGenerator;
    if (generators.lua) generators.lua.forBlock[BLOCK_NAME] = luaGenerator;
    if (generators.php) generators.php.forBlock[BLOCK_NAME] = phpGenerator;
    if (generators.python) generators.python.forBlock[BLOCK_NAME] = pythonGenerator;
}

And if I extend that to a case where I do have reserved words, like colour_blend, I get this:

export function installBlock(generators: Generators = {}) {
    registerColourField();
    Blockly.common.defineBlocks([blockDef]);
    if (generators.javascript) generators.javascript.forBlock[BLOCK_NAME] = jsGenerator;
    if (generators.dart) {
        generators.dart.forBlock[BLOCK_NAME] = dartGenerator;
        generators.dart.addReservedWords('Math');
    }
    if (generators.lua) generators.lua.forBlock[BLOCK_NAME] = luaGenerator;
    if (generators.php) generators.php.forBlock[BLOCK_NAME] = phpGenerator;
    if (generators.python) generators.python.forBlock[BLOCK_NAME] = pythonGenerator;
}

It's verbose, but has several advantages:

  • Keeps reserved words and block generator installation together.
  • The installBlock function actually shows everything it's doing
    • As you observed, installGenerators was obfuscating.

The disadvantages are:

  • Lots of text to copy.
  • Lots of duplicated code.

I think this is worth doing, even if it adds duplicated code. The types did help me avoid installing a dart block generator into python, and that makes me happy. I think it's worth the change. @maribethb do you have any thoughts or objections?

plugins/field-colour/README.md Outdated Show resolved Hide resolved
plugins/field-colour/README.md Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourPicker.ts Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated this PR to only change the colour field.

plugins/field-colour/README.md Outdated Show resolved Hide resolved
plugins/field-colour/README.md Outdated Show resolved Hide resolved
plugins/field-colour/README.md Outdated Show resolved Hide resolved
import { FieldColour } from '@blockly/field-colour';

// Installs all four blocks, the colour field, and all of the language generators.
FieldColour.installAllBlocks({
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: where should I document the generators parameter in more detail? Where should the type live? Currently it's in blocks/generatorUtils.ts and needs to be duplicated into every plugin where I define blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Do we auto-generate API documentation for plugins like we do for core?

In any case it seems like the best approach is probably to declare and explain the type in GeneratorUtils.ts (possibly renaming this file, if it no longer contains any functions), but have the individual install functions point to some examples in the README rather than trying to explain in detail (and repeatedly) exactly how this parameter works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that I will also need to declare this type in field_angle and field_multilinetextinput when I update those, because there's no shared place for this type to live.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you proposing to move the declaration to Blockly itself? I can see an argument in favour (it would be useful to have in a common location, and why not add it to the thing that all the client code will be importing anyway?), but on balance I am against adding a type to core that's not used anywhere in core.

There might be an argument for adding it to a utility package of field and block definition support code, but so far I think it's just this one type, and the type is straightforward enough that I don't think it's worth creating a separate package for it. DRY is a useful principle but not IMHO a compelling reason to incur the expense of an extra dependency for this.

If we end up with a bunch of declarations that are actually complicated enough to be worth factoring out then I would think the utility package would be the way to go.

Of course your original question pertains to documenting the type. To that I feel like the examples usages in the readme are sufficient, especially in conjunction with the type's declaration and JSDoc comment.

@rachel-fenichel rachel-fenichel changed the title Field_blocks feat!: add block definitions to colour field plugin Feb 8, 2024
@rachel-fenichel rachel-fenichel marked this pull request as ready for review February 8, 2024 00:30
@rachel-fenichel rachel-fenichel requested review from BeksOmega and removed request for a team February 8, 2024 00:30
@rachel-fenichel rachel-fenichel removed the request for review from BeksOmega February 8, 2024 00:31
@rachel-fenichel
Copy link
Collaborator Author

This pull request is now (finally!) ready for review. Thanks for putting up with all the back and forth on this one.

Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looking good, but still a few nits and some dissatisfaction with naming.

  • The local variable name suggestions are from my perspective just that, though I think mostly in line with the styleguide's rules.
  • The export naming commens are about making sure we will be happy with these names in future / in other similar packages.

Also, one major item: there appear to be unittests for the colour block generators in core, and these should be reimplemented in samples. I'd be fine with this being done in a separate PR, but I think they should be done (and passing) before this PR gets released.

plugins/field-colour/README.md Outdated Show resolved Hide resolved
"chai": "^4.2.0",
"sinon": "^9.0.1",
"typescript": "^5.0.4"
},
"peerDependencies": {
"blockly": "^10.2.0"
"blockly": "^11.0.0-beta.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin should work with -beta.1 as well as the forthcoming v10 release, no?

plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourRgb.ts Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe generator_types.ts or just generators.ts?

Comment on lines 16 to 17
import {registerFieldColour} from '../field_colour';
import {Generators} from './generatorUtils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per practice in the core repo, I think imports of files from the same package should use the full (compiled) filename:

Suggested change
import {registerFieldColour} from '../field_colour';
import {Generators} from './generatorUtils';
import {registerFieldColour} from '../field_colour.js';
import {Generators} from './generatorUtils.js';

This doesn't matter so long as we are webpacking the file, but will matter if we start publishing unbundled packages (which we are intending to).

(Here and most files below.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to use .js extensions failed with this error:

ERROR in ./src/blocks/colourBlend.ts 12:0-57
Module not found: Error: Can't resolve '../field_colour.js' in '/home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/blocks'
resolve '../field_colour.js' in '/home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/blocks'
  using description file: /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/package.json (relative path: ./src/blocks)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/package.json (relative path: ./src/field_colour.js)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js.js doesn't exist
      as directory
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js doesn't exist
 @ ./src/index.ts 10:0-52 17:0-54 18:0-40 30:4-28
 @ ./test/index.ts 16:0-71 272:4-23

plugins/field-colour/src/index.ts Outdated Show resolved Hide resolved
plugins/field-colour/test/index.ts Show resolved Hide resolved
Copy link
Collaborator Author

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed (or punted) all comments except for the file extensions, which I'm still digging into.

After discussion with Christopher, I'm going to make a blocks_for_fields branch off master that I can merge successive field changes against, so that I can make smaller PRs to fix the follow-ups without accidentally releasing anything.

plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourBlend.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/blocks/colourRgb.ts Show resolved Hide resolved
plugins/field-colour/src/blocks/colourRgb.ts Show resolved Hide resolved
plugins/field-colour/src/blocks/colourRgb.ts Outdated Show resolved Hide resolved
plugins/field-colour/src/index.ts Outdated Show resolved Hide resolved
plugins/field-colour/README.md Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Extra comment below that I forgot to include in the previous review).

Comment on lines 16 to 17
import {registerFieldColour} from '../field_colour';
import {Generators} from './generatorUtils';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to use .js extensions failed with this error:

ERROR in ./src/blocks/colourBlend.ts 12:0-57
Module not found: Error: Can't resolve '../field_colour.js' in '/home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/blocks'
resolve '../field_colour.js' in '/home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/blocks'
  using description file: /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/package.json (relative path: ./src/blocks)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/package.json (relative path: ./src/field_colour.js)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js.js doesn't exist
      as directory
        /home/fenichel/Documents/blockly-dev/blockly-samples/plugins/field-colour/src/field_colour.js doesn't exist
 @ ./src/index.ts 10:0-52 17:0-54 18:0-40 30:4-28
 @ ./test/index.ts 16:0-71 272:4-23

@rachel-fenichel rachel-fenichel changed the base branch from master to blocks_for_fields February 9, 2024 20:34
Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after a very cursory re-review.

@rachel-fenichel rachel-fenichel merged commit 44d3671 into google:blocks_for_fields Feb 12, 2024
8 checks passed
rachel-fenichel added a commit that referenced this pull request Mar 29, 2024
* feat: export functions to register some angle, colour, and multiline input fields

* feat: add block definitions to colour and multiline input fields

* feat: add block generators for the colour_picker block

* fix: use Blockly.common.defineBlocksWithJsonArray

* feat: add block generators for colour_random block

* feat: add generators type and standardize exports for block files

* chore: update to blockly@beta and fix types

* chore: move all colour blocks to separate files and add more generator-related types

* feat: finish adding block code generators for colour blocks

* fix: PR feedback

* fix: remove immediate registration of blocks and fields in field_colour

* chore: use named imports and numbered TODOs

* feat: add usage information about blocks to README

* chore: revert changes outside of field_colour

* chore: clean up tsdoc and exports

* cgire: clean up README

* chore: respond to PR feedback on names and comments

* feat(tests): add and improve tests

* chore(format): run formatter

* fix: respond to PR feedback about names and file structure

* fix: allow const variables to have UPPER_CASE names

* fix: respond to PR feedback

* chore: format

* fix: line length
rachel-fenichel added a commit that referenced this pull request Apr 2, 2024
* feat: export functions to register some angle, colour, and multiline input fields

* feat: add block definitions to colour and multiline input fields

* feat: add block generators for the colour_picker block

* fix: use Blockly.common.defineBlocksWithJsonArray

* feat: add block generators for colour_random block

* feat: add generators type and standardize exports for block files

* chore: update to blockly@beta and fix types

* chore: move all colour blocks to separate files and add more generator-related types

* feat: finish adding block code generators for colour blocks

* fix: PR feedback

* fix: remove immediate registration of blocks and fields in field_colour

* chore: use named imports and numbered TODOs

* feat: add usage information about blocks to README

* chore: revert changes outside of field_colour

* chore: clean up tsdoc and exports

* cgire: clean up README

* chore: respond to PR feedback on names and comments

* feat(tests): add and improve tests

* chore(format): run formatter

* fix: respond to PR feedback about names and file structure

* fix: allow const variables to have UPPER_CASE names

* fix: respond to PR feedback

* chore: format

* fix: line length
rachel-fenichel added a commit that referenced this pull request Apr 2, 2024
* feat: export functions to register some angle, colour, and multiline input fields

* feat: add block definitions to colour and multiline input fields

* feat: add block generators for the colour_picker block

* fix: use Blockly.common.defineBlocksWithJsonArray

* feat: add block generators for colour_random block

* feat: add generators type and standardize exports for block files

* chore: update to blockly@beta and fix types

* chore: move all colour blocks to separate files and add more generator-related types

* feat: finish adding block code generators for colour blocks

* fix: PR feedback

* fix: remove immediate registration of blocks and fields in field_colour

* chore: use named imports and numbered TODOs

* feat: add usage information about blocks to README

* chore: revert changes outside of field_colour

* chore: clean up tsdoc and exports

* cgire: clean up README

* chore: respond to PR feedback on names and comments

* feat(tests): add and improve tests

* chore(format): run formatter

* fix: respond to PR feedback about names and file structure

* fix: allow const variables to have UPPER_CASE names

* fix: respond to PR feedback

* chore: format

* fix: line length
maribethb pushed a commit that referenced this pull request Apr 2, 2024
* feat!: add block definitions to colour field plugin (#2162)

* feat: export functions to register some angle, colour, and multiline input fields

* feat: add block definitions to colour and multiline input fields

* feat: add block generators for the colour_picker block

* fix: use Blockly.common.defineBlocksWithJsonArray

* feat: add block generators for colour_random block

* feat: add generators type and standardize exports for block files

* chore: update to blockly@beta and fix types

* chore: move all colour blocks to separate files and add more generator-related types

* feat: finish adding block code generators for colour blocks

* fix: PR feedback

* fix: remove immediate registration of blocks and fields in field_colour

* chore: use named imports and numbered TODOs

* feat: add usage information about blocks to README

* chore: revert changes outside of field_colour

* chore: clean up tsdoc and exports

* cgire: clean up README

* chore: respond to PR feedback on names and comments

* feat(tests): add and improve tests

* chore(format): run formatter

* fix: respond to PR feedback about names and file structure

* fix: allow const variables to have UPPER_CASE names

* fix: respond to PR feedback

* chore: format

* fix: line length

* feat!: add block definition to multiline text field plugin (#2202)

* chore: force-install blockly 10.4.0-beta.1 for development

* feat: add text_multiline block and associated generators

* feat: update test page to use new block and field

* feat: README

* chore: respond to PR feedback

BREAKING CHANGE: The multiline text input field no longer registers itself on load. The developer must either manually register the field or install blocks, which will install the field. This is part of a move to have no side effects in field and block definitions, so that tree-shaking can remove unwanted fields and blocks.

* chore: format (#2221)

* feat!: Add registration function to field_angle and make it no longer install on file load (#2211)

* feat!: Add registration function to field_angle and make it no longer install on file load

* chore: formatting

BREAKING CHANGE: The angle field no longer registers itself on load. The developer must manually register the field. This is part of a move to have no side effects in field and block definitions, so that tree-shaking can remove unwanted fields and blocks.

* feat: add tests for per-block generators in field-colour (#2220)

* feat: add unit tests for generators

* fix: imports in tests

* chore: format

* feat: ignore golden files in plugin tests

* chore: fix lint

* feat: ignore golden files for linting

* fix: revert addition of fs and path packages

* fix: remove suite.only to make all tests run

* chore: handle review feedback

* fix: only import what you need in colour blocks

* feat: add generator tests for the text_multiline block (#2232)

* feat: add generator tests for the text_multiline block

* fix: updated test string to include multiple types of quotes

* fix: code style in generators for field colour blocks (#2233)

* feat!: update blockly version to 10.4.3 for colour and multilineinput (#2296)

* feat!: update blockly version to 10.4.3 for colour and multilineinput

* chore!: update peer dependencies

* chore: update package-lock.jsons

* chore: fix dependencies
gonfunko pushed a commit to gonfunko/blockly-samples that referenced this pull request Apr 15, 2024
* feat!: add block definitions to colour field plugin (google#2162)

* feat: export functions to register some angle, colour, and multiline input fields

* feat: add block definitions to colour and multiline input fields

* feat: add block generators for the colour_picker block

* fix: use Blockly.common.defineBlocksWithJsonArray

* feat: add block generators for colour_random block

* feat: add generators type and standardize exports for block files

* chore: update to blockly@beta and fix types

* chore: move all colour blocks to separate files and add more generator-related types

* feat: finish adding block code generators for colour blocks

* fix: PR feedback

* fix: remove immediate registration of blocks and fields in field_colour

* chore: use named imports and numbered TODOs

* feat: add usage information about blocks to README

* chore: revert changes outside of field_colour

* chore: clean up tsdoc and exports

* cgire: clean up README

* chore: respond to PR feedback on names and comments

* feat(tests): add and improve tests

* chore(format): run formatter

* fix: respond to PR feedback about names and file structure

* fix: allow const variables to have UPPER_CASE names

* fix: respond to PR feedback

* chore: format

* fix: line length

* feat!: add block definition to multiline text field plugin (google#2202)

* chore: force-install blockly 10.4.0-beta.1 for development

* feat: add text_multiline block and associated generators

* feat: update test page to use new block and field

* feat: README

* chore: respond to PR feedback

BREAKING CHANGE: The multiline text input field no longer registers itself on load. The developer must either manually register the field or install blocks, which will install the field. This is part of a move to have no side effects in field and block definitions, so that tree-shaking can remove unwanted fields and blocks.

* chore: format (google#2221)

* feat!: Add registration function to field_angle and make it no longer install on file load (google#2211)

* feat!: Add registration function to field_angle and make it no longer install on file load

* chore: formatting

BREAKING CHANGE: The angle field no longer registers itself on load. The developer must manually register the field. This is part of a move to have no side effects in field and block definitions, so that tree-shaking can remove unwanted fields and blocks.

* feat: add tests for per-block generators in field-colour (google#2220)

* feat: add unit tests for generators

* fix: imports in tests

* chore: format

* feat: ignore golden files in plugin tests

* chore: fix lint

* feat: ignore golden files for linting

* fix: revert addition of fs and path packages

* fix: remove suite.only to make all tests run

* chore: handle review feedback

* fix: only import what you need in colour blocks

* feat: add generator tests for the text_multiline block (google#2232)

* feat: add generator tests for the text_multiline block

* fix: updated test string to include multiple types of quotes

* fix: code style in generators for field colour blocks (google#2233)

* feat!: update blockly version to 10.4.3 for colour and multilineinput (google#2296)

* feat!: update blockly version to 10.4.3 for colour and multilineinput

* chore!: update peer dependencies

* chore: update package-lock.jsons

* chore: fix dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Field colour: add block definitions
4 participants