Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 49 additions & 49 deletions docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/blocks`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.ts) -->

### getActiveBlockVariation

Expand Down Expand Up @@ -45,14 +45,14 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _blockName_ `string`: Name of block (example: “core/columns”).
- _attributes_ `Object`: Block attributes used to determine active variation.
- _scope_ `[WPBlockVariationScope]`: Block variation scope name.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Name of block (example: "core/columns").
- _attributes_ `Record< string, unknown >`: Block attributes used to determine active variation.
- _scope_ `BlockVariationScope`: Block variation scope name.

_Returns_

- `(WPBlockVariation|undefined)`: Active block variation.
- `BlockVariation | undefined`: Active block variation.

### getBlockStyles

Expand Down Expand Up @@ -83,12 +83,12 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _name_ `string`: Block type name.

_Returns_

- `Array?`: Block Styles.
- `BlockStyle[]`: Block Styles.

### getBlockSupport

Expand Down Expand Up @@ -121,14 +121,14 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _nameOrType_ `(string|Object)`: Block name or type object
- _feature_ `Array|string`: Feature to retrieve
- _defaultSupports_ `*`: Default value to return if not explicitly defined
- _state_ `BlockStoreState`: Data state.
- _nameOrType_ `string | BlockType`: Block name or type object
- _feature_ `string | string[]`: Feature to retrieve
- _defaultSupports_ `unknown`: Default value to return if not explicitly defined

_Returns_

- `?*`: Block support value
- `unknown`: Block support value

### getBlockType

Expand Down Expand Up @@ -167,12 +167,12 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _name_ `string`: Block type name.

_Returns_

- `?Object`: Block Type.
- `BlockType | undefined`: Block Type.

### getBlockTypes

Expand Down Expand Up @@ -202,11 +202,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `Array`: Block Types.
- `BlockType[]`: Block Types.

### getBlockVariations

Expand Down Expand Up @@ -238,13 +238,13 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Block type name.
- _scope_ `[WPBlockVariationScope]`: Block variation scope name.
- _scope_ `BlockVariationScope`: Block variation scope name.

_Returns_

- `(WPBlockVariation[]|void)`: Block variations.
- `BlockVariation[] | undefined`: Block variations.

### getCategories

Expand Down Expand Up @@ -274,11 +274,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `WPBlockCategory[]`: Categories list.
- `BlockCategory[]`: Categories list.

### getChildBlockNames

Expand Down Expand Up @@ -310,12 +310,12 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Block type name.

_Returns_

- `Array`: Array of child block names.
- `string[]`: Array of child block names.

### getCollections

Expand Down Expand Up @@ -346,11 +346,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `Object`: Collections list.
- `Record< string, BlockCollection >`: Collections list.

### getDefaultBlockName

Expand Down Expand Up @@ -381,11 +381,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `?string`: Default block name.
- `string | null`: Default block name.

### getDefaultBlockVariation

Expand Down Expand Up @@ -420,13 +420,13 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Block type name.
- _scope_ `[WPBlockVariationScope]`: Block variation scope name.
- _scope_ `BlockVariationScope`: Block variation scope name.

_Returns_

- `?WPBlockVariation`: The default block variation.
- `BlockVariation | undefined`: The default block variation.

### getFreeformFallbackBlockName

Expand Down Expand Up @@ -460,11 +460,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `?string`: Name of the block for handling non-block content.
- `string | null`: Name of the block for handling non-block content.

### getGroupingBlockName

Expand Down Expand Up @@ -498,11 +498,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `?string`: Name of the block for handling the grouping of blocks.
- `string | null`: Name of the block for handling the grouping of blocks.

### getUnregisteredFallbackBlockName

Expand Down Expand Up @@ -536,11 +536,11 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.

_Returns_

- `?string`: Name of the block for handling unregistered blocks.
- `string | null`: Name of the block for handling unregistered blocks.

### hasBlockSupport

Expand Down Expand Up @@ -572,10 +572,10 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _nameOrType_ `(string|Object)`: Block name or type object.
- _feature_ `string`: Feature to test.
- _defaultSupports_ `boolean`: Whether feature is supported by default if not explicitly defined.
- _state_ `BlockStoreState`: Data state.
- _nameOrType_ `string | BlockType`: Block name or type object.
- _feature_ `string | string[]`: Feature to test.
- _defaultSupports_ `unknown`: Whether feature is supported by default if not explicitly defined.

_Returns_

Expand Down Expand Up @@ -611,7 +611,7 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Block type name.

_Returns_
Expand Down Expand Up @@ -653,7 +653,7 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Data state.
- _state_ `BlockStoreState`: Data state.
- _blockName_ `string`: Block type name.

_Returns_
Expand Down Expand Up @@ -696,26 +696,26 @@ const ExampleComponent = () => {

_Parameters_

- _state_ `Object`: Blocks state.
- _nameOrType_ `(string|Object)`: Block name or type object.
- _state_ `BlockStoreState`: Blocks state.
- _nameOrType_ `string | BlockType`: Block name or type object.
- _searchTerm_ `string`: Search term by which to filter.

_Returns_

- `Object[]`: Whether block type matches search term.
- `boolean`: Whether block type matches search term.

<!-- END TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.ts) -->

## Actions

The actions in this package shouldn't be used directly. Instead, use the functions listed in the public API [here](/packages/blocks/README.md)

<!-- START TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.ts) -->

### reapplyBlockTypeFilters

Signals that all block types should be computed again. It uses stored unprocessed block types and all the most recent list of registered filters.

It addresses the issue where third party block filters get registered after third party blocks. A sample sequence: 1. Filter A. 2. Block B. 3. Block C. 4. Filter D. 5. Filter E. 6. Block F. 7. Filter G. In this scenario some filters would not get applied for all blocks because they are registered too late.

<!-- END TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.ts) -->
1 change: 1 addition & 0 deletions packages/block-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{ "path": "../a11y" },
{ "path": "../block-serialization-default-parser" },
{ "path": "../blob" },
{ "path": "../blocks" },
{ "path": "../components" },
{ "path": "../compose" },
{ "path": "../data" },
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{ "path": "../autop" },
{ "path": "../blob" },
{ "path": "../block-editor" },
{ "path": "../blocks" },
{ "path": "../components" },
{ "path": "../compose" },
{ "path": "../core-data" },
Expand Down
Loading
Loading