@storybook/blocks
Advanced tools
Comparing version 0.0.0-pr-30021-sha-b1cc74da to 0.0.0-pr-30031-sha-5acb6e15
@@ -418,43 +418,44 @@ import { Conditional, DocsContextProps, PreparedStory, ModuleExports, Renderer as Renderer$1, Args as Args$1, StoryId, ModuleExport, ResolvedModuleExportType, ResolvedModuleExportFromType, Parameters as Parameters$1, ProjectAnnotations, BaseAnnotations, ComponentTitle } from 'storybook/internal/types'; | ||
*/ | ||
declare const enum RuleType { | ||
blockQuote = "0", | ||
breakLine = "1", | ||
breakThematic = "2", | ||
codeBlock = "3", | ||
codeFenced = "4", | ||
codeInline = "5", | ||
footnote = "6", | ||
footnoteReference = "7", | ||
gfmTask = "8", | ||
heading = "9", | ||
headingSetext = "10", | ||
declare const RuleType: { | ||
readonly blockQuote: "0"; | ||
readonly breakLine: "1"; | ||
readonly breakThematic: "2"; | ||
readonly codeBlock: "3"; | ||
readonly codeFenced: "4"; | ||
readonly codeInline: "5"; | ||
readonly footnote: "6"; | ||
readonly footnoteReference: "7"; | ||
readonly gfmTask: "8"; | ||
readonly heading: "9"; | ||
readonly headingSetext: "10"; | ||
/** only available if not `disableHTMLParsing` */ | ||
htmlBlock = "11", | ||
htmlComment = "12", | ||
readonly htmlBlock: "11"; | ||
readonly htmlComment: "12"; | ||
/** only available if not `disableHTMLParsing` */ | ||
htmlSelfClosing = "13", | ||
image = "14", | ||
link = "15", | ||
readonly htmlSelfClosing: "13"; | ||
readonly image: "14"; | ||
readonly link: "15"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkAngleBraceStyleDetector = "16", | ||
readonly linkAngleBraceStyleDetector: "16"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkBareUrlDetector = "17", | ||
readonly linkBareUrlDetector: "17"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkMailtoDetector = "18", | ||
newlineCoalescer = "19", | ||
orderedList = "20", | ||
paragraph = "21", | ||
ref = "22", | ||
refImage = "23", | ||
refLink = "24", | ||
table = "25", | ||
tableSeparator = "26", | ||
text = "27", | ||
textBolded = "28", | ||
textEmphasized = "29", | ||
textEscaped = "30", | ||
textMarked = "31", | ||
textStrikethroughed = "32", | ||
unorderedList = "33" | ||
} | ||
readonly linkMailtoDetector: "18"; | ||
readonly newlineCoalescer: "19"; | ||
readonly orderedList: "20"; | ||
readonly paragraph: "21"; | ||
readonly ref: "22"; | ||
readonly refImage: "23"; | ||
readonly refLink: "24"; | ||
readonly table: "25"; | ||
readonly tableSeparator: "26"; | ||
readonly text: "27"; | ||
readonly textBolded: "28"; | ||
readonly textEmphasized: "29"; | ||
readonly textEscaped: "30"; | ||
readonly textMarked: "31"; | ||
readonly textStrikethroughed: "32"; | ||
readonly unorderedList: "33"; | ||
}; | ||
type RuleType = (typeof RuleType)[keyof typeof RuleType]; | ||
declare const enum Priority { | ||
@@ -486,4 +487,3 @@ /** | ||
*/ | ||
declare const Markdown$1: React.FC<{ | ||
[key: string]: any; | ||
declare const Markdown$1: React.FC<Omit<React.HTMLAttributes<Element>, 'children'> & { | ||
children: string; | ||
@@ -500,3 +500,3 @@ options?: MarkdownToJSX.Options; | ||
export type CreateElement = typeof React.createElement; | ||
export type HTMLTags = keyof JSX.IntrinsicElements; | ||
export type HTMLTags = keyof React.JSX.IntrinsicElements; | ||
export type State = { | ||
@@ -513,2 +513,4 @@ /** true if the current content is inside anchor link grammar */ | ||
list?: boolean; | ||
/** used for lookbacks */ | ||
prevCapture?: string; | ||
/** true if parsing in inline context w/o links */ | ||
@@ -518,14 +520,15 @@ simple?: boolean; | ||
export interface BlockQuoteNode { | ||
alert?: string; | ||
children: MarkdownToJSX.ParserResult[]; | ||
type: RuleType.blockQuote; | ||
type: typeof RuleType.blockQuote; | ||
} | ||
export interface BreakLineNode { | ||
type: RuleType.breakLine; | ||
type: typeof RuleType.breakLine; | ||
} | ||
export interface BreakThematicNode { | ||
type: RuleType.breakThematic; | ||
type: typeof RuleType.breakThematic; | ||
} | ||
export interface CodeBlockNode { | ||
type: RuleType.codeBlock; | ||
attrs?: JSX.IntrinsicAttributes; | ||
type: typeof RuleType.codeBlock; | ||
attrs?: React.JSX.IntrinsicAttributes; | ||
lang?: string; | ||
@@ -535,13 +538,13 @@ text: string; | ||
export interface CodeFencedNode { | ||
type: RuleType.codeFenced; | ||
type: typeof RuleType.codeFenced; | ||
} | ||
export interface CodeInlineNode { | ||
type: RuleType.codeInline; | ||
type: typeof RuleType.codeInline; | ||
text: string; | ||
} | ||
export interface FootnoteNode { | ||
type: RuleType.footnote; | ||
type: typeof RuleType.footnote; | ||
} | ||
export interface FootnoteReferenceNode { | ||
type: RuleType.footnoteReference; | ||
type: typeof RuleType.footnoteReference; | ||
target: string; | ||
@@ -551,7 +554,7 @@ text: string; | ||
export interface GFMTaskNode { | ||
type: RuleType.gfmTask; | ||
type: typeof RuleType.gfmTask; | ||
completed: boolean; | ||
} | ||
export interface HeadingNode { | ||
type: RuleType.heading; | ||
type: typeof RuleType.heading; | ||
children: MarkdownToJSX.ParserResult[]; | ||
@@ -562,9 +565,9 @@ id: string; | ||
export interface HeadingSetextNode { | ||
type: RuleType.headingSetext; | ||
type: typeof RuleType.headingSetext; | ||
} | ||
export interface HTMLCommentNode { | ||
type: RuleType.htmlComment; | ||
type: typeof RuleType.htmlComment; | ||
} | ||
export interface ImageNode { | ||
type: RuleType.image; | ||
type: typeof RuleType.image; | ||
alt?: string; | ||
@@ -575,3 +578,3 @@ target: string; | ||
export interface LinkNode { | ||
type: RuleType.link; | ||
type: typeof RuleType.link; | ||
children: MarkdownToJSX.ParserResult[]; | ||
@@ -582,12 +585,12 @@ target: string; | ||
export interface LinkAngleBraceNode { | ||
type: RuleType.linkAngleBraceStyleDetector; | ||
type: typeof RuleType.linkAngleBraceStyleDetector; | ||
} | ||
export interface LinkBareURLNode { | ||
type: RuleType.linkBareUrlDetector; | ||
type: typeof RuleType.linkBareUrlDetector; | ||
} | ||
export interface LinkMailtoNode { | ||
type: RuleType.linkMailtoDetector; | ||
type: typeof RuleType.linkMailtoDetector; | ||
} | ||
export interface OrderedListNode { | ||
type: RuleType.orderedList; | ||
type: typeof RuleType.orderedList; | ||
items: MarkdownToJSX.ParserResult[][]; | ||
@@ -598,3 +601,3 @@ ordered: true; | ||
export interface UnorderedListNode { | ||
type: RuleType.unorderedList; | ||
type: typeof RuleType.unorderedList; | ||
items: MarkdownToJSX.ParserResult[][]; | ||
@@ -604,13 +607,13 @@ ordered: false; | ||
export interface NewlineNode { | ||
type: RuleType.newlineCoalescer; | ||
type: typeof RuleType.newlineCoalescer; | ||
} | ||
export interface ParagraphNode { | ||
type: RuleType.paragraph; | ||
type: typeof RuleType.paragraph; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface ReferenceNode { | ||
type: RuleType.ref; | ||
type: typeof RuleType.ref; | ||
} | ||
export interface ReferenceImageNode { | ||
type: RuleType.refImage; | ||
type: typeof RuleType.refImage; | ||
alt?: string; | ||
@@ -620,9 +623,9 @@ ref: string; | ||
export interface ReferenceLinkNode { | ||
type: RuleType.refLink; | ||
type: typeof RuleType.refLink; | ||
children: MarkdownToJSX.ParserResult[]; | ||
fallbackChildren: MarkdownToJSX.ParserResult[]; | ||
fallbackChildren: string; | ||
ref: string; | ||
} | ||
export interface TableNode { | ||
type: RuleType.table; | ||
type: typeof RuleType.table; | ||
/** | ||
@@ -636,30 +639,30 @@ * alignment for each table column | ||
export interface TableSeparatorNode { | ||
type: RuleType.tableSeparator; | ||
type: typeof RuleType.tableSeparator; | ||
} | ||
export interface TextNode { | ||
type: RuleType.text; | ||
type: typeof RuleType.text; | ||
text: string; | ||
} | ||
export interface BoldTextNode { | ||
type: RuleType.textBolded; | ||
type: typeof RuleType.textBolded; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface ItalicTextNode { | ||
type: RuleType.textEmphasized; | ||
type: typeof RuleType.textEmphasized; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface EscapedTextNode { | ||
type: RuleType.textEscaped; | ||
type: typeof RuleType.textEscaped; | ||
} | ||
export interface MarkedTextNode { | ||
type: RuleType.textMarked; | ||
type: typeof RuleType.textMarked; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface StrikethroughTextNode { | ||
type: RuleType.textStrikethroughed; | ||
type: typeof RuleType.textStrikethroughed; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface HTMLNode { | ||
type: RuleType.htmlBlock; | ||
attrs: JSX.IntrinsicAttributes; | ||
type: typeof RuleType.htmlBlock; | ||
attrs: React.JSX.IntrinsicAttributes; | ||
children?: ReturnType<MarkdownToJSX.NestedParser> | undefined; | ||
@@ -671,4 +674,4 @@ noInnerParse: Boolean; | ||
export interface HTMLSelfClosingNode { | ||
type: RuleType.htmlSelfClosing; | ||
attrs: JSX.IntrinsicAttributes; | ||
type: typeof RuleType.htmlSelfClosing; | ||
attrs: React.JSX.IntrinsicAttributes; | ||
tag: string; | ||
@@ -679,3 +682,3 @@ } | ||
export type Parser<ParserOutput> = (capture: RegExpMatchArray, nestedParse: NestedParser, state?: MarkdownToJSX.State) => ParserOutput; | ||
export type RuleOutput = (ast: MarkdownToJSX.ParserResult | MarkdownToJSX.ParserResult[], state: MarkdownToJSX.State) => JSX.Element; | ||
export type RuleOutput = (ast: MarkdownToJSX.ParserResult | MarkdownToJSX.ParserResult[], state: MarkdownToJSX.State) => React.JSX.Element; | ||
export type Rule<ParserOutput = MarkdownToJSX.ParserResult> = { | ||
@@ -689,6 +692,8 @@ match: (source: string, state: MarkdownToJSX.State, prevCapturedString?: string) => RegExpMatchArray; | ||
*/ | ||
render: RuleOutput, state?: MarkdownToJSX.State) => React.ReactChild; | ||
render: RuleOutput, state?: MarkdownToJSX.State) => React.ReactNode; | ||
}; | ||
export type Rules = { | ||
[K in ParserResult['type']]: Rule<Extract<ParserResult, { | ||
[K in ParserResult['type']]: K extends typeof RuleType.table ? Rule<Extract<ParserResult, { | ||
type: K | typeof RuleType.paragraph; | ||
}>> : Rule<Extract<ParserResult, { | ||
type: K; | ||
@@ -710,4 +715,9 @@ }>>; | ||
*/ | ||
createElement: (tag: Parameters<CreateElement>[0], props: JSX.IntrinsicAttributes, ...children: React.ReactChild[]) => React.ReactChild; | ||
createElement: (tag: Parameters<CreateElement>[0], props: React.JSX.IntrinsicAttributes, ...children: React.ReactNode[]) => React.ReactNode; | ||
/** | ||
* The library automatically generates an anchor tag for bare URLs included in the markdown | ||
* document, but this behavior can be disabled if desired. | ||
*/ | ||
disableAutoLink: boolean; | ||
/** | ||
* Disable the compiler's best-effort transcription of provided raw HTML | ||
@@ -789,3 +799,3 @@ * into JSX-equivalent. This is the functionality that prevents the need to | ||
/** Resume normal processing, call this function as a fallback if you are not returning custom JSX. */ | ||
next: () => React.ReactChild, | ||
next: () => React.ReactNode, | ||
/** the current AST node, use `RuleType` against `node.type` for identification */ | ||
@@ -796,8 +806,12 @@ node: ParserResult, | ||
/** contains `key` which should be supplied to the topmost JSX element */ | ||
state: State) => React.ReactChild; | ||
state: State) => React.ReactNode; | ||
/** | ||
* Override the built-in sanitizer function for URLs, etc if desired. The built-in version is available as a library export called `sanitizer`. | ||
*/ | ||
sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null; | ||
/** | ||
* Override normalization of non-URI-safe characters for use in generating | ||
* HTML IDs for anchor linking purposes. | ||
*/ | ||
slugify: (source: string) => string; | ||
slugify: (input: string, defaultFn: (input: string) => string) => string; | ||
/** | ||
@@ -804,0 +818,0 @@ * Declare the type of the wrapper to be used when there are multiple |
{ | ||
"name": "@storybook/blocks", | ||
"version": "0.0.0-pr-30021-sha-b1cc74da", | ||
"version": "0.0.0-pr-30031-sha-5acb6e15", | ||
"description": "Storybook Doc Blocks", | ||
@@ -51,9 +51,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"@storybook/addon-actions": "0.0.0-pr-30021-sha-b1cc74da", | ||
"@storybook/react": "0.0.0-pr-30021-sha-b1cc74da", | ||
"@storybook/test": "0.0.0-pr-30021-sha-b1cc74da", | ||
"@storybook/addon-actions": "0.0.0-pr-30031-sha-5acb6e15", | ||
"@storybook/react": "0.0.0-pr-30031-sha-5acb6e15", | ||
"@storybook/test": "0.0.0-pr-30031-sha-5acb6e15", | ||
"@types/color-convert": "^2.0.0", | ||
"color-convert": "^2.0.1", | ||
"es-toolkit": "^1.22.0", | ||
"markdown-to-jsx": "^7.4.5", | ||
"markdown-to-jsx": "patch:markdown-to-jsx@npm%3A7.7.1#~/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch", | ||
"memoizerific": "^1.11.3", | ||
@@ -68,3 +68,3 @@ "polished": "^4.2.2", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", | ||
"storybook": "^0.0.0-pr-30021-sha-b1cc74da" | ||
"storybook": "^0.0.0-pr-30031-sha-5acb6e15" | ||
}, | ||
@@ -71,0 +71,0 @@ "peerDependenciesMeta": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
607223
3324