Skip to content
Merged
Prev Previous commit
Next Next commit
README v2 upon Luis feedback
  • Loading branch information
juanmaguitar committed Jun 29, 2023
commit 5cce55e7ac7f73ee4268e136faf561bfebdbf6ce
77 changes: 35 additions & 42 deletions packages/interactivity/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Interactivity API

> **Warning**
> **This package is only available in Gutenberg** at the moment and not in WordPress Core as it is still very experimental, and very likely to change.


> **Note**
> This package enables the API shared at [Proposal: The Interactivity API – A better developer experience in building interactive blocks](https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/). As part of an [Open Source project](https://developer.wordpress.org/block-editor/explanations/faq/#the-gutenberg-project) we encourage participation in helping shape this API and the [discussions in GitHub](https://github.com/WordPress/gutenberg/discussions/categories/interactivity-api) is the best place to engage.

This package can be tested, but it's still very experimental.
The Interactivity API is [being used in some core blocks](https://github.com/search?q=repo%3AWordPress%2Fgutenberg%20%40wordpress%2Finteractivity&type=code) but its use is still very limited.


## Frequently Asked Questions

At this point, some of the questions you have about the Interactivity API may be:

##### What is this?

This is the base of a new standard to create interactive blocks. Read [the proposal](https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/) to learn more about this.

##### Can I use it?

You can test it, but it's still very experimental.

##### How do I get started?

A "Getting started guide" section of the Interactivity API Docs is in progress. In the meantime check the **Docs & Examples** section below for resources to learn. You can also ask for guidance at the [“Interactivity API” category](https://github.com/WordPress/gutenberg/discussions/categories/interactivity-api) in the Gutenberg repo.

##### Where can I ask questions?

The [“Interactivity API” category](https://github.com/WordPress/gutenberg/discussions/categories/interactivity-api) in Gutenberg repo discussions is the best place to ask questions about the Interactivity API.

##### Where can I share my feedback about the API?

The [“Interactivity API” category](https://github.com/WordPress/gutenberg/discussions/categories/interactivity-api) in Gutenberg repo discussions is also the best place to share your feedback about the Interactivity API.

## Installation

Install the module:
Expand All @@ -10,55 +45,13 @@ npm install @wordpress/interactivity --save

_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._

## Usage

```js
import { store } from '@wordpress/interactivity';

store( {
effects: {
core: {
navigation: {
initMenu: ( { context, selectors, ref } ) => {
// ... some magic happens with this effect
}
},
},
},
selectors: {
core: {
navigation: {
isMenuOpen: ( { context } ) => {
// ... some magic info is returned with this selector
}
},
},
},
actions: {
core: {
navigation: {
openMenuOnHover( args ) {
// ... some magic happens on this action
},
},
},
} );
```

## Docs & Examples

Interactivity API is a recent proposal and its Documentation is still in progress. In the meantime, here you have these resources to learn/read more about the Interactivity API:

- [Proposal: The Interactivity API – A better developer experience in building interactive blocks](https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/)
- [“Interactivity API” category](https://github.com/WordPress/gutenberg/discussions/categories/interactivity-api) in Gutenberg repo discussions
block-interactivity-experiments repo and its discussions section
- Developer Hours sessions ([Americas](https://www.youtube.com/watch?v=RXNoyP2ZiS8&t=664s) & [APAC/EMEA](https://www.youtube.com/watch?v=6ghbrhyAcvA))
- [wpmovies.dev](http://wpmovies.dev/) demo and its [wp-movies-demo](https://github.com/WordPress/wp-movies-demo) repo

## Contributing to this package

This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.

To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).

<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>