-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add @wordpress/fields package #65230
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
453c13d
to
395cc25
Compare
packages/fields/src/index.ts
Outdated
|
||
export const privateApis = {}; | ||
|
||
lock( privateApis, {} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of locking the APIs, I think we should probably make this package a "bundled one" just like the "dataviews" package itself. I know there are two files (configs) to change to make a package a bundled package tools/webpack/packages.js
and packages/dependency-extraction-webpack-plugin/lib/util.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed with 7e04069
packages/fields/README.md
Outdated
@@ -0,0 +1,23 @@ | |||
# Fields | |||
|
|||
This package includes a set of field controls for the DataView library, designed for creating and managing data display elements within WordPress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should hold more than just field controls. I believe the whole editor/src/dataviews
existing folder belongs in this package.
- Fields
- Actions
- Controls
For WP entities basically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved the package description with 43b8a93:
This package provides core elements for the DataView library, designed to simplify the creation and management of data display elements in WordPress.
Let me know if it can work for you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of the initial follow-ups to this would be to try to move the fields and actions from packages/editor/src/dataviews/
to this package.
packages/fields/tsconfig.json
Outdated
{ "path": "../warning" }, | ||
{ "path": "../url" }, | ||
{ "path": "../notices" }, | ||
{ "path": "../dataviews" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the list above match the dependencies used in the package (empty for now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Fixed with b00ec03
|
||
## Usage | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add the README's API docs autogeneration markers (see other package README's)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! I agree! I will take a look to the |
I would be ok approving for the sake of iteration/smaller PRs but can we do at least one PR on top of it to see actual usage of this package in practice? |
It makes sense! I rebased #65196 on top of this PR. Unfortunately, I can't change the base branch of the linked PR because I'm pushing on my own fork. Here’s how the slug field control PR looks with this branch as the destination: gigitux#2 This is something that I did to test the benefit of this package. Now, I will follow your suggestion and I'm going move the fields and actions from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I see that there's a good plan already for the next steps.
Do you plan to publish this package to npm in the current shape with the next Gutenberg plugin RC release next week? I have one question, the description of the package is:
Is it tied exclusively to the DataView library? The name |
I'm planning to add more code to this package in the next days. Currently, we don't expect that this package will be used by other consumers: I read this documentation and it looks like that there isn't a way to disable the publishing of the package. Do you see any particular disadvantages to publishing the package?
Yes! I’m still exploring this project, and I wasn’t aware of the Fields API project. After reading the introduction, it seems there is some overlap with the goals of data views, but still, we are in the exploration phase stage. |
There is no value in publishing a package that isn't functional and can't be consumed. It's a one-line in
|
We should not have packages that are unused by core in this repository. Until that happens, I'd rather have it private. Given this has no-reversible consequences (publish to npm) and it's time-sensitive, I've prepared #65269 to mark it as private as Grzegorz suggested. |
Ok! Thanks for tacking care of it! 🙇 |
Hey @gigitux 👋 Would you be able to help write a dev note for this for the 6.7 release? We are planning to have this as part of a larger Miscellaneous Editor Updates note. We are hoping to get all drafts in by October 13th to leave some time for reviews before the RC1. All Dev Notes get tracked in #65784 so feel free to leave a note there or ping me directly :) Please let us know if you can assist with that. Thanks in advance :) |
Thanks for the ping, @fabiankaegy! 🙇 I'm not sure that we should include this in the dev note. Currently, this package is still experimental, we are exploring APIs, and currently I don't think that this package could be useful outside of Gutenberg. I'm not very expert with this process, so let me include @youknowriad and @oandregal. What do you think? I'm happy to write dev notes if you think that it is needed! (I'm not sure if with this comment you are referring to this PR) |
@gigitux okay, if this package is not bundled with WordPress core as one of the enqueued scripts we don’t need a dev note :) |
The package is not public API yet, so no need for dev note for now indeed. |
What?
This PR adds the
@wordpress/fields
package.Why?
The
@wordpress/fields
package introduces a collection of data field controls designed specifically for WordPress UI and needs. For example, this package will include controls for:These field controls provide streamlined and consistent functionality for managing essential WordPress elements.