-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
- Part of Block API #41236.
In More core blocks and new store()
API, we first worked on preparing Core blocks for WP 6.4, including the new enhanced pagination of the Query block, and after the release of WP 6.4, we also worked on the migration of the new store()
API.
For this iteration of the Interactivity API, we want to focus on the preparation of a 1.0 version that can be released publicly in WordPress Core and serve as the base for future enhancements.
We also want to consolidate here the work of the Tracking Issue: Server Directive Processing to keep all the implementation work under the same issue, but we will keep tracking the documentation-related tasks in the Documentation Tracking Issue.
Tasks
This is the list of initial tasks, although we will edit this post as we progress and discover other things that we need to do.
- Directives
- Implement the
wp-run
directive - Expose the
useInit
anduseWatch
hooks - Add
data-wp-on-window
anddata-wp-on-document
directives - Remove the
navigation-link
directive - Remove the
wp-slot
andwp-fill
directives if we don't finally need them - Prevent using components in
data-wp-text
, only strings - Remove support for element state until naming and use cases are clearer
- Add support for element attributes
- Update Preact to the latest version and remove the custom
role
logic in our codebase - Expose
withScope
and add support for async functions (generators) - Add support for
wp-each
- Put all the private exports behind a locked proxy
- Remove the non-default
wp-context
suffix - Use
data-wp-interactive="namespace"
- Review the
@wordpress/interactivity
exports - Remove the
wp-body
directive - Fix: Improve the way we merge contexts after navigation
- Fix: Prevent proxifying non-plain objects
- Implement the
- Store
- Re-implement
wp_store
aswp_initial_state
- Fix: Merge new SSR state on client-side navigation (discussion)
- Re-implement
- Router
- Create the
core/router
store and move thenavigate
andprefecth
actions there - Code-split the
core/router
store in@wordpress/interactivity/router
- Rename
data-wp-navigation-id
todata-wp-router-region
- Add a top loading bar on navigation
- Add a screen reader announcement on navigation
- Expose a way to trigger virtual pageviews, like
state.url
in thecore/router
store - Fix: Fix the initial page cache (code)
-
Populatestate.url
from the server- We finally decided to maintain the code that adds it from the
core/router
store in JS.
- We finally decided to maintain the code that adds it from the
- Switch to global config
config['core/router'].regionNavigation = false
- Fix: Add
data-wp-key
to the page numbers
- Create the
- Block metadata
- Add
clientNavigation
andinteractive
to block supports metadata. - Move block script module registration to the
render_callback
and usewp_scripts_get_suffix
- Use private stores for all the interactive core block stores
- Add
- Server Directive Processing
- Make sure we only process the directives once
- Sort directives by priority
- Add support for
data-wp-interactive='{ "namespace": "..." }'
- Improve block identification (check the block name before the md5)
- Render the root interactive blocks
- Encapsulate everything into a single function
wp_interactivity_process_directives()
- Make sure it bails out on unbalanced tags
- Add tests for edge cases
- Add processor for
wp-each
- Optional: Add a helper function to add
data-wp-context
on PHP - Optional: Add support for private stores
- Fix: Skip SVG and MathML (instead of bail out)
- Debug
- Optional: Show an error in the browser console when the server directive processing fails
- Code Quality
- Optional: Typscript the entire runtime. Add comments to functions. Etc.