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

refactor(edgeless): edgeless related api #5972

Merged
merged 52 commits into from
Jan 19, 2024
Merged

refactor(edgeless): edgeless related api #5972

merged 52 commits into from
Jan 19, 2024

Conversation

doouding
Copy link
Member

@doouding doouding commented Jan 12, 2024

Surface model & element model

  • New observe decorator to allow observe the yjs type property. E.g., the children property of group element.
  • New convert decorator to allow convert the new value before assigning to or updating the model property. It will gradually replace the existing function propsToY.
  • Introduce middleware that adheres to the lifecycle of the surface model. This middleware can be utilized to implement features that depend on the creation, reading, updating, and deletion (CRUD) of elements and are also closely tied to the model. For example, the path of the connector is dynamically generated based on its source and target properties in real-time, and it is not stored persistently in Yjs. To ensure the surface model is plug-and-play, the logic for generating the connector path is integrated through middleware.
  • New local property externalXYWH for element model, to store the rect dimensions of content associated with the element, such as the bounding rect of a group's title. This attribute is updated by the renderer during the rendering process. Once this data is stored, the relevant content becomes interactive and is also decoupled from the renderer.

Edgeless API & canvas renderer

  • Move most edgeless API from surface block to edgeless service.
  • Replace the old canvas element model with the new one. And the renderer is now just a stateless renderer, all models' rendering implementation is just a pure function.
  • Simplify the edgeless type to just two: EdgelessBlockModel and ElementModel. Both of them can be used with the instanceof operator.
  • Remove redundancy slot including previous elementUpdated, elementAdded, and elementRemoved. Use the slot of the model instead.

Copy link

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 19, 2024 1:59pm
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jan 19, 2024 1:59pm
blocksuite-docs-main ⬜️ Ignored (Inspect) Visit Preview Jan 19, 2024 1:59pm

@doouding doouding changed the title refactor(edgeless): redesign edgeless related api refactor(edgeless): edgeless related api Jan 12, 2024
@doodlewind doodlewind added the notable Major improvement worth emphasizing label Jan 19, 2024
Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

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

TODO: remove redundancy in onYBlockUpdated

@Saul-Mirone Saul-Mirone merged commit 573b518 into master Jan 19, 2024
19 checks passed
@Saul-Mirone Saul-Mirone deleted the refactor/surface branch January 19, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable Major improvement worth emphasizing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants