Skip to content

Commit

Permalink
Move types from #48604.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwelcher committed Dec 20, 2024
1 parent 12dd949 commit 590e900
Show file tree
Hide file tree
Showing 17 changed files with 1,717 additions and 2 deletions.
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

0 comments on commit 590e900

Please sign in to comment.