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

Move the @wordpress/blocks types defined in #48604 into own branch. #68213

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions packages/block-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{ "path": "../a11y" },
{ "path": "../api-fetch" },
{ "path": "../block-serialization-default-parser" },
{ "path": "../blocks" },
{ "path": "../blob" },
{ "path": "../components" },
{ "path": "../compose" },
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 @@ -13,6 +13,7 @@
{ "path": "../autop" },
{ "path": "../blob" },
{ "path": "../block-editor" },
{ "path": "../blocks" },
{ "path": "../components" },
{ "path": "../compose" },
{ "path": "../core-data" },
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"types": "build-types",
"sideEffects": [
"{src,build,build-module}/{index.js,store/index.js}"
],
Expand Down
55 changes: 55 additions & 0 deletions packages/blocks/src/api/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Describes options for Block serialization.
*
* Used by the Block [serializer](./serializer.js).
*
* @public
*/
export type BlockSerializationOptions = {
/**
* Whether to output HTML comments around blocks.
*/
isCommentDelimited?: boolean;

/**
* Whether the serialization process has descended into the inner blocks.
*/
isInnerBlocks?: boolean;

/**
* If a block is migrated from a deprecated version, skip logging the migration details.
*
* @internal
*/
__unstableSkipMigrationLogs?: boolean;

/**
* Whether to skip autop when processing freeform content.
*
* @internal
*/
__unstableSkipAutop?: boolean;
};

/**
* Describes options for Block parsing.
*
* Used by the block [parser](./parser/index.js).
*
* @public
*/
export type BlockParseOptions = {
/**
* If a block is migrated from a deprecated version, skip logging the migration details.
*
* @internal
*/
__unstableSkipMigrationLogs?: boolean;

/**
* Whether to skip autop when processing freeform content.
*
* @internal
*/
__unstableSkipAutop?: boolean;
};
67 changes: 67 additions & 0 deletions packages/blocks/src/store/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Internal dependencies
*/
import type {
BlockCategory,
BlockCollection,
BlockVariation,
BlockStyle,
BlockType,
} from '../types';

/**
* The state of the `core/blocks` redux store.
*
* @public
*/
export type BlockStoreState = {
/**
* Block variations by block name.
*/
blockVariations: Record< string, BlockVariation[] >;

/**
* Block styles by block name.
*/
blockStyles: Record< string, BlockStyle[] >;

/**
* Block type by name.
*/
blockTypes: Record< string, BlockType< any > >;

/**
* The available block categories.
*/
categories: BlockCategory[];

/**
* The available collections.
*/
collections: BlockCollection[];

/**
* Name of the default block name.
*/
defaultBlockName?: string;

/**
* Name of the block for handling non-block content.
*/
freeformFallbackBlockName?: string;

/**
* Name of the block for handling unregistered blocks.
*/
unregisteredFallbackBlockName?: string;

/**
* Name of the block for handling the grouping of blocks.
*/
groupingBlockName?: string;

/**
* Unprocessed block types.
*/
unprocessedBlockTypes?: any[];
};
Loading
Loading