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

Documentation for the Interactivity API - Tracking Issue #53296

Open
9 of 16 tasks
juanmaguitar opened this issue Aug 3, 2023 · 13 comments
Open
9 of 16 tasks

Documentation for the Interactivity API - Tracking Issue #53296

juanmaguitar opened this issue Aug 3, 2023 · 13 comments
Assignees
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Developer Documentation Documentation for developers [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@juanmaguitar
Copy link
Contributor

juanmaguitar commented Aug 3, 2023

Interactivity API is a proposal for a new standard to create interactive blocks. It's still in an experimental phase and is available with Gutenberg 16.2 or later

This tracking issue compiles all issues related to the documentation of the Interactivity API to keep track of the pending tasks and to ease the coordination of this work.

Interactivity API Docs are currently being created as Markdown files in the /docs folder of the interactivity package . When the Interactivity API is no longer in an experimental phase or is integrated into WordPress Core, the plan is to move this documentation to the Block Editor HandBook

If you are willing to help with the documentation, please add a comment to #51928, and we'll coordinate everyone's efforts.

Tasks

Tasks related to Interactivity API Docs are labelled with [Feature] Interactivity API] & [Type] Developer Documentation]

@juanmaguitar juanmaguitar self-assigned this Aug 3, 2023
@juanmaguitar juanmaguitar added [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Developer Documentation Documentation for developers [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. labels Aug 3, 2023
@juanmaguitar
Copy link
Contributor Author

juanmaguitar commented Nov 29, 2023

@luisherranz
Copy link
Member

luisherranz commented Jan 26, 2024

This is the list of APIs that in my opinion would cover the whole spectrum of what the Interactivity API encompasses:

It would be great to review it and start adding the missing items so this is ready before the WP 6.5 Release Candidate 1.

Reference API

  • Blocks
    • supports.interactivity
    • supports.interactivity.clientNavigation
  • Directives
    • Framework
      • data-wp-interactive
      • data-wp-ignore
      • data-wp-key
    • State
      • data-wp-context
    • Attributes
      • data-wp-bind--{attribute}
      • data-wp-class--{className}
      • data-wp-style--{styleProperty}
    • Inner content
      • data-wp-text
    • Event listeners
      • data-wp-on--{event}
      • data-wp-on-window--{event}
      • data-wp-on-window--{event}
    • Side effects
      • data-wp-init
      • data-wp-watch
      • data-wp-run
        • Hooks
          • useInit()
          • useWatch()
          • useEffect()
          • useLayoutEffect()
          • useCallback()
          • useMemo()
          • useState()
          • useRef()
    • Templating
      • data-wp-each
        • data-wp-each-child
  • Store
    • Client
      • store()
      • getContext()
      • getElement()
      • getConfig()
      • withScope()
    • Server
      • wp_interactivity_state()
      • wp_interactivity_config()
    • Private and read-only stores
  • Router
    • Store - core/router
      • state.url
      • actions.navigate()
      • actions.prefetch()
    • Directives
      • data-wp-router-region

The Core Concepts guides are optional and could be released after WP 6.5, but they would be a good addition to understanding the mental model behind the Interactivity API.

Core Concepts

  • Namespaces
  • State
    • Local, global, derived state
    • Server state -> Client state
  • Server directive processing
  • Declarative vs imperative code (don't mutate the DOM manually!)
  • Client-side navigation

The readmes should be updated to point to the official documentation, the getting started guide and the Interactivity API discussions for questions.

Readmes

  • @wordpress/interactivity package
  • @wordpress/interactivity-router package

@karstengresch
Copy link

As a dev user, I'd love to see a full CRUD example (with dynamic form submission) walkthrough, such as https://learn.wordpress.org/course/using-the-wordpress-data-layer/ b.t.w. :)

@juanmaguitar
Copy link
Contributor Author

Interactivity API Docs are now available from Block Editor Handbook > Reference Guides > Interactivity API Reference

@juanmaguitar
Copy link
Contributor Author

I have opened #62055 to review and update the README of the @wordpress/interactivity-router package

@WPLake
Copy link

WPLake commented Jun 5, 2024

@juanmaguitar The current format of the Interactivity API Docs is well-suited for developers with some experience in Gutenberg blocks. However, it lacks basic explanations and a separate guide on how to apply this outside of Gutenberg. We've posted a detailed explanation in our blog that aims to fill the gaps. Wouldn't it be useful to mention this article in the Docs & Examples section?

@juanmaguitar
Copy link
Contributor Author

Wow! That post is great! Congratulations @WPLake 🙌

WordPress Docs does have a external linking policy that doesn't allow to link resources outside of wordpress.org (with some exceptions), but I would love that some of the explanations and ideas that are covered in your article are also included in the official docs.

Would you like to help shape and improve the official docs?
If so, the best next step would be opening an issue detailing the specific improvements you'd like to see in the docs.
I'd also be happy to connect via Make WordPress Slack (@JuanMa) to discuss any other ways to collaborate to improve the iAPI docs.

@WPLake
Copy link

WPLake commented Jun 27, 2024

@juanmaguitar I'm also open to collaboration on the iAPI Docs. I wrote you in Slack DM (@juanma from WPLake) on 18th June. Should we rather chat by email?

@juanmaguitar
Copy link
Contributor Author

juanmaguitar commented Jun 27, 2024

@WPLake, I apologize for the delay in getting back to you.
I've been intensely focused lately on the Docs Squad work for WP 6.6 release 😅
I actually had my response in draft form, but I wanted to provide some background GitHub issues to frame our conversation. I finally completed that today, so I'm happy to continue the discussion via Slack. I'll ping you there today.

@juanmaguitar
Copy link
Contributor Author

The issue #63570 has been created and added to the list in the description of this issue

@luisherranz
Copy link
Member

I've created and added this issue to the list:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Developer Documentation Documentation for developers [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

4 participants