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

CustomGradientPicker: Refactor to TypeScript #48929

Merged
merged 56 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6738371
Remove from ts-config exclude, rename files to .ts[x]
chad1008 Feb 22, 2023
229f3a9
Add types.ts
chad1008 Feb 22, 2023
8e233ab
Add initial component types
chad1008 Feb 22, 2023
f1a16e5
install `@types/gradient-parser`
chad1008 Feb 23, 2023
589f728
Add typing to `getGradientAstWithDefault`
chad1008 Feb 23, 2023
538a0a5
Assert that `colorStop.length` is no longer null, due to the `hasUnsu…
chad1008 Feb 23, 2023
da497b5
Add typing to `GradientAnglePicker`
chad1008 Feb 23, 2023
108e75c
Add typing for `gradientTypePicker`
chad1008 Feb 27, 2023
cfb04f0
Introduce `ControlPoint` type and apply to `CustomGradientPicker.onCh…
chad1008 Feb 27, 2023
6cec73c
Add typing to main component utils
chad1008 Feb 27, 2023
b82267a
Add serializer typing
chad1008 Mar 2, 2023
9397765
Fix union conflict on `getGradientAstWithControlPoints`
chad1008 Mar 2, 2023
ad502da
Add `CustomGradientBar` subcomponent typing
chad1008 Mar 2, 2023
6504d13
Add typing to `customGradientBarReducer`
chad1008 Mar 6, 2023
c62b3cc
Add typing for `GradientBar` utils
chad1008 Mar 6, 2023
62d1bff
Add typing to `ControlPoints`
chad1008 Mar 7, 2023
11fca9b
Refactor `ControlPoints` return value to a single JSX element
chad1008 Mar 7, 2023
6f30b08
Update tests to align with `gradientParser` typing
chad1008 Mar 7, 2023
6a44f5b
Update util tests to match typing
chad1008 Mar 7, 2023
566efa4
Update Storybook
chad1008 Mar 8, 2023
6739fe6
Self-review notes
chad1008 Mar 8, 2023
2a51a79
Comment/TODO cleanup
chad1008 Mar 8, 2023
1229def
update CHANGELOG
chad1008 Mar 8, 2023
3a9fe8e
TODO removal
chad1008 Mar 8, 2023
de50982
partial unit test fixes
chad1008 Mar 8, 2023
9c33aed
Use jest mocks for getBoundingClientRect
ciampo Mar 8, 2023
9eaf378
Clean up typing on `useRef` calls
chad1008 Mar 8, 2023
f344c22
fix `GradienttypePicker` `onSetLinearGradient`.
chad1008 Mar 13, 2023
d25daa6
Improve `GradientTypePicker`s `handleOnChange` type handling to align…
chad1008 Mar 13, 2023
134b10e
Remove unneeded `WordPressComponentProps`
chad1008 Mar 13, 2023
d3e8241
`as const` instead of importing prop types from `Dropdown`
chad1008 Mar 13, 2023
0362e85
Typo
chad1008 Mar 13, 2023
c1d14b0
Remove unneeded `undefined` typing
chad1008 Mar 13, 2023
74a02c5
Improve `ControlPoints` typeguarding logic
chad1008 Mar 14, 2023
0561fd4
Add comment describing `DistributiveOmit`
chad1008 Mar 14, 2023
ef96a5b
Remove unneeded `undefined` typing
chad1008 Mar 14, 2023
06939b1
Restore original gradient bar util JSDoc comments, minus type info
chad1008 Mar 14, 2023
ee86ba9
In utils, type `color` props as `ControlPoint[color]`
chad1008 Mar 14, 2023
7ef9d23
Convert `ColorStopTypeAndValue` to a `Pick`-based approach
chad1008 Mar 14, 2023
0d2c6a9
remove extra optional chaining
chad1008 Mar 14, 2023
cb4ffbf
remove unneeded `undefined` typing
chad1008 Mar 14, 2023
bf26ca9
include option `null` type for `CustomGradientPickerProps.value`
chad1008 Mar 14, 2023
5448a45
Code cleanup
chad1008 Mar 14, 2023
18ec48d
fix typos
chad1008 Mar 15, 2023
b4fa9e1
replace `!` with `@ts-expect-error` in `CustomGradientPicker` `contro…
chad1008 Mar 15, 2023
af4f889
Apply overrides to clarify `getHorizontalRelativeGradientPosition` re…
chad1008 Mar 15, 2023
66f4f40
remove `DistributiveOmit` in favor of `DistributivePick`
chad1008 Mar 15, 2023
1182a28
Remove `@ts-nocheck`s
chad1008 Mar 15, 2023
7595d97
Mark `Gradient.gradient` from `PaletteEdit` as optional
chad1008 Mar 15, 2023
748d17a
Type `minDistance` as `number`
chad1008 Mar 16, 2023
8f9e188
Mark `CustomGradientBar.__experimentalIsRenderedInSidebar` as optiona…
chad1008 Mar 16, 2023
5b3b080
Revert string casting that is no longer needed
chad1008 Mar 16, 2023
ce00031
Remove unneeded type assertion
chad1008 Mar 16, 2023
ef06890
Require a value for the input of `CustomGradientPickerProps.onChange`…
chad1008 Mar 16, 2023
d0f1d81
Add support for Storybook callback logging
chad1008 Mar 16, 2023
465a59d
Apply Marco's brilliance
chad1008 Mar 17, 2023
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
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"IS_GUTENBERG_PLUGIN": true
},
"dependencies": {
"@types/gradient-parser": "0.1.2",
"@wordpress/a11y": "file:packages/a11y",
"@wordpress/annotations": "file:packages/annotations",
"@wordpress/api-fetch": "file:packages/api-fetch",
Expand Down
10 changes: 7 additions & 3 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Internal

- `CustomGradientPicker`: Convert to TypeScript ([#48929](https://github.com/WordPress/gutenberg/pull/48929)).

## 23.6.0 (2023-03-15)

### Enhancements
Expand All @@ -12,8 +16,8 @@

### Bug Fix

- `ResponsiveWrapper`: use `aspect-ratio` CSS prop, add support for `SVG` elements ([#48573](https://github.com/WordPress/gutenberg/pull/48573).
- `ResizeTooltip`: Use `default.fontFamily` on tooltip ([#48805](https://github.com/WordPress/gutenberg/pull/48805).
- `ResponsiveWrapper`: use `aspect-ratio` CSS prop, add support for `SVG` elements ([#48573](https://github.com/WordPress/gutenberg/pull/48573).
- `ResizeTooltip`: Use `default.fontFamily` on tooltip ([#48805](https://github.com/WordPress/gutenberg/pull/48805).

### Internal

Expand All @@ -37,7 +41,7 @@

### Enhancements

- `ToolsPanel`: Separate reset all filter registration from items registration and support global resets ([#48123](https://github.com/WordPress/gutenberg/pull/48123)).
- `ToolsPanel`: Separate reset all filter registration from items registration and support global resets ([#48123](https://github.com/WordPress/gutenberg/pull/48123)).

### Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;

export const HORIZONTAL_GRADIENT_ORIENTATION = {
type: 'angular',
value: 90,
};
value: '90',
} as const;

export const GRADIENT_OPTIONS = [
{ value: 'linear-gradient', label: __( 'Linear' ) },
Expand Down
Loading