-
Notifications
You must be signed in to change notification settings - Fork 417
Add slots API #984
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
Open
chrisvxd
wants to merge
95
commits into
main
Choose a base branch
from
255-more-portable-data-payload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add slots API #984
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1602e07
to
cbd976f
Compare
cbd976f
to
44fd9de
Compare
8b95960
to
550a20e
Compare
1849030
to
b9f84b3
Compare
22d1648
to
2047e2f
Compare
325cffe
to
5011a2f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce the slots API, the main feature to achieve #255. The ticket should likely not be closed until the migration strategy is determined, which may be part of a follow-on.
API
Slots are like DropZones, but as a field, with the data stored on the prop.
The data format follows the standard Puck data format for content, and supports all standard component APIs including
defaultProps
andresolveData
:This unlocked powerful patterns like the new Template demo component which allows you to save and load pre-configured templates of components.
This model is deterministic, making it possible easily convert it into other formats (like XML), or render in third party environments (even outside of React). For example, you could use react-from-json:
Drive-by features
trigger
parameter provided toresolveData
to determine what behaviour caused the data resolution (params.changed
flags all fields astrue
on initialization inresolveData
method #963)replaceRoot
action for changing root values specifically (NB may become irrelevant after full migration to slots)Migration
This change is backwards compatible, but it does deprecate DropZones. The PR includes a migration guide.
Part 2 (ticket TBD) of the deprecation will involve the following breaking changes, and be implemented before v1:
zones
content
to a child prop onroot
Remaining tasks
Closes #255, closes #963, closes #950, closes #862