Skip to content

Commit fdcfffb

Browse files
committed
refactor: export block types (and move blocks to separate sub-export)
1 parent 4b40c57 commit fdcfffb

File tree

22 files changed

+74
-53
lines changed

22 files changed

+74
-53
lines changed

packages/core/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
"import": "./dist/comments.js",
5858
"require": "./dist/comments.cjs"
5959
},
60+
"./blocks": {
61+
"types": "./types/src/blocks/index.d.ts",
62+
"import": "./dist/blocks.js",
63+
"require": "./dist/blocks.cjs"
64+
},
6065
"./locales": {
6166
"types": "./types/src/i18n/index.d.ts",
6267
"import": "./dist/locales.js",

packages/core/src/blocks/Audio/block.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface AudioOptions {
1818
icon?: string;
1919
}
2020

21+
export type AudioBlockConfig = ReturnType<typeof createAudioBlockConfig>;
22+
2123
export const createAudioBlockConfig = createBlockConfig(
2224
(_ctx: AudioOptions) =>
2325
({

packages/core/src/blocks/Code/block.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export type CodeBlockOptions = {
5151
createHighlighter?: () => Promise<HighlighterGeneric<any, any>>;
5252
};
5353

54+
export type CodeBlockConfig = ReturnType<typeof createCodeBlockConfig>;
55+
5456
export const createCodeBlockConfig = createBlockConfig(
5557
({ defaultLanguage = "text" }: CodeBlockOptions) =>
5658
({

packages/core/src/blocks/File/block.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { parseFigureElement } from "./helpers/parse/parseFigureElement.js";
55
import { createFileBlockWrapper } from "./helpers/render/createFileBlockWrapper.js";
66
import { createLinkWithCaption } from "./helpers/toExternalHTML/createLinkWithCaption.js";
77

8+
export type FileBlockConfig = ReturnType<typeof createFileBlockConfig>;
9+
810
export const createFileBlockConfig = createBlockConfig(
911
() =>
1012
({

packages/core/src/blocks/Heading/block.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export interface HeadingOptions {
1212
allowToggleHeadings?: boolean;
1313
}
1414

15+
export type HeadingBlockConfig = ReturnType<typeof createHeadingBlockConfig>;
16+
1517
export const createHeadingBlockConfig = createBlockConfig(
1618
({
1719
defaultLevel = 1,

packages/core/src/blocks/Image/block.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export const FILE_IMAGE_ICON_SVG =
1717
export interface ImageOptions {
1818
icon?: string;
1919
}
20+
21+
export type ImageBlockConfig = ReturnType<typeof createImageBlockConfig>;
22+
2023
export const createImageBlockConfig = createBlockConfig(
2124
(_ctx: ImageOptions = {}) =>
2225
({

packages/core/src/blocks/ListItem/BulletListItem/block.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { defaultProps } from "../../defaultProps.js";
44
import { handleEnter } from "../../utils/listItemEnterHandler.js";
55
import { getListItemContent } from "../getListItemContent.js";
66

7+
export type BulletListItemBlockConfig = ReturnType<
8+
typeof createBulletListItemBlockConfig
9+
>;
10+
711
export const createBulletListItemBlockConfig = createBlockConfig(
812
() =>
913
({

packages/core/src/blocks/ListItem/CheckListItem/block.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { defaultProps } from "../../defaultProps.js";
44
import { handleEnter } from "../../utils/listItemEnterHandler.js";
55
import { getListItemContent } from "../getListItemContent.js";
66

7+
export type CheckListItemBlockConfig = ReturnType<
8+
typeof createCheckListItemConfig
9+
>;
10+
711
export const createCheckListItemConfig = createBlockConfig(
812
() =>
913
({

packages/core/src/blocks/ListItem/NumberedListItem/block.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { handleEnter } from "../../utils/listItemEnterHandler.js";
55
import { getListItemContent } from "../getListItemContent.js";
66
import { NumberedListIndexingDecorationPlugin } from "./IndexingPlugin.js";
77

8+
export type NumberedListItemBlockConfig = ReturnType<
9+
typeof createNumberedListItemBlockConfig
10+
>;
11+
812
export const createNumberedListItemBlockConfig = createBlockConfig(
913
() =>
1014
({

packages/core/src/blocks/ListItem/ToggleListItem/block.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { defaultProps } from "../../defaultProps.js";
44
import { createToggleWrapper } from "../../ToggleWrapper/createToggleWrapper.js";
55
import { handleEnter } from "../../utils/listItemEnterHandler.js";
66

7+
export type ToggleListItemBlockConfig = ReturnType<
8+
typeof createToggleListItemBlockConfig
9+
>;
10+
711
export const createToggleListItemBlockConfig = createBlockConfig(
812
() =>
913
({

0 commit comments

Comments
 (0)