8000 feat: break input types into separate classes by BeksOmega · Pull Request #7019 · google/blockly · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: break input types into separate classes #7019

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

Merged
merged 8 commits into from
May 4, 2023

Conversation

BeksOmega
Copy link
Collaborator

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Work on #2062

Proposed Changes

Splits all of the different types of inputs out into individual classes.

Reason for Changes

This matches how we want external developers to define custom inputs. And also matches people's mental models better.

Test Coverage

N/A - Should be covered by existing tests.

Documentation

N/A

Additional Information

We could mark the constructors for the new inputs @internal out of an abundance of caution. But I don't think there's any real risk to letting external developers construct them.

Best to review commit-wise!

@BeksOmega BeksOmega requested a review from a team as a code owner April 26, 2023 21:45
@BeksOmega BeksOmega requested a review from NeilFraser April 26, 2023 21:45
@github-actions github-actions bot added the PR: feature Adds a feature label Apr 26, 2023
@BeksOmega BeksOmega requested a review from maribethb April 26, 2023 21:46
@BeksOmega
Copy link
Collaborator Author

@maribethb I added you as a reviewer purely for the design-y / api-y bits of this. No need to do a nitty-gritty code review I (unless you want to), just want feedback on the approach.

@@ -71,8 +71,11 @@ import {Gesture} from './gesture.js';
import {Grid} from './grid.js';
import {Icon} from './icon.js';
import {inject} from './inject.js';
import {Align, Input} from './input.js';
import {inputTypes} from './input_types.js';
import {Align, Input} from './inputs/input.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the intention for developers to use Blockly.inputs.Input now? Can you fix the comments on the @see tags for ALIGN_LEFT et al in this file (line 200 or so) if so?

Although, if we do want people to change the import path for input, now might be a good time to break the Align enum into its own file, so that we can eventually get rid of the Input namespace, which is not recommended and makes our documentation more confusing. We could continue to export the new enum from the old location for now.

So new would be
Blockly.input.Input and Blockly.input.Align.LEFT

and old (deprecated, to be removed) would be Blockly.Input and Blockly.Input.Align.LEFT aka Blockly.ALIGN_LEFT

wdyt? If you don't intend external developers to update their usage then this is all moot, I just think it might be nice to fix while we're here and changing things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that's reasonable! That would be a breaking change though correct? If so I think it would be better too do that in a separate PR so we can link to it & include just what broke.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make it a deprecating change, and remove the old stuff in v11. But yes, doing it in its own PR so we can link to it from release notes makes sense.

@BeksOmega BeksOmega force-pushed the feat/input-types branch from ba4a450 to d6489f4 Compare May 3, 2023 18:20
@BeksOmega BeksOmega merged commit 3a9a9bd into google:develop May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0